diff --git a/docs/_includes/component.njk b/docs/_includes/component.njk
index cbfd0f5c19..3ea2711da6 100644
--- a/docs/_includes/component.njk
+++ b/docs/_includes/component.njk
@@ -77,7 +77,7 @@
{# Guidelines #}
{% if
guidelines %}
-
Usage guidelines
+ Usage Guidelines
{{ guidelines | markdown | safe }}
{% endif %}
{# Importing #}
diff --git a/docs/_includes/default.njk b/docs/_includes/default.njk
index b42ca9a9ae..b0aaa4f9bb 100644
--- a/docs/_includes/default.njk
+++ b/docs/_includes/default.njk
@@ -166,7 +166,7 @@
diff --git a/docs/_includes/sidebar.njk b/docs/_includes/sidebar.njk
index 0a99be2a85..8be1b3f1e0 100644
--- a/docs/_includes/sidebar.njk
+++ b/docs/_includes/sidebar.njk
@@ -2,38 +2,72 @@
Getting Started
Tutorials
Teamshares Brand
Styles
{#
@@ -53,74 +87,191 @@
Core Components
Auxiliary Components
Utilities
-
+
\ No newline at end of file
diff --git a/docs/assets/images/confirm-dialog-DO-2.png b/docs/assets/images/confirm-dialog-DO-2.png
new file mode 100644
index 0000000000..d993c624d6
Binary files /dev/null and b/docs/assets/images/confirm-dialog-DO-2.png differ
diff --git a/docs/assets/images/confirm-dialog-DO.png b/docs/assets/images/confirm-dialog-DO.png
new file mode 100644
index 0000000000..529b89b7ba
Binary files /dev/null and b/docs/assets/images/confirm-dialog-DO.png differ
diff --git a/docs/assets/images/confirm-dialog-DONT-2.png b/docs/assets/images/confirm-dialog-DONT-2.png
new file mode 100644
index 0000000000..7653df3cc9
Binary files /dev/null and b/docs/assets/images/confirm-dialog-DONT-2.png differ
diff --git a/docs/assets/images/confirm-dialog-DONT.png b/docs/assets/images/confirm-dialog-DONT.png
new file mode 100644
index 0000000000..6f76111175
Binary files /dev/null and b/docs/assets/images/confirm-dialog-DONT.png differ
diff --git a/docs/pages/components/alert.md b/docs/pages/components/alert.md
index c40fb12380..f12e3dadd1 100644
--- a/docs/pages/components/alert.md
+++ b/docs/pages/components/alert.md
@@ -19,7 +19,7 @@ guidelines: |
![Don't use another icon not in the examples](../../assets/images/alert-icon-example-DONT.png "Don't use another icon not in the examples")
- Don't use a one-off icon with your alert variant
- - If you have a strong use case for using an one-off icon, check with the design team
+ - If you have a strong use case for using a one-off icon, check with the design team
:::
**Using Headers in Alerts**
@@ -42,16 +42,16 @@ guidelines: |
```html:preview
- This is super informative
- This is a standard informational alert.
+ This is the alert header
+ This is the alert message. Keep it simple!
```
```pug:slim
sl-alert open="true"
sl-icon slot="icon" library="fa" name="fas-circle-info"
- div slot="header" This is super informative
- | This is a standard informational alert.
+ div slot="header" This is the alert header
+ | This is the alert message. Keep it simple!
```
```jsx:react
@@ -77,55 +77,57 @@ Set the `variant` attribute to change the alert's variant.
```html:preview
- This is super informative
- You can tell by how pretty the alert is.
+ We’ve simplified your login experience
+ You can now log in to both apps with one set of credentials.
- You can safely exit the app now
- Your changes have been saved.
+ Request approved
+ This request was approved on April 25, 2024.
- Your session has ended
- Please login again to continue.
+ This view is currently hidden from shareholders
+ Go to Company settings to edit the visibility of this page.
- Your account has been deleted
- We are very sorry to see you go!
+ Your payment is past due
+ To avoid late fees, pay your minimum amount due today.
```
```pug:slim
sl-alert variant="primary" open="true"
sl-icon slot="icon" library="fa" name="fas-circle-info"
- div slot="header" This is super informative
- | You can tell by how pretty the alert is.
+ div slot="header" We’ve simplified your login experience!
+ | You can now log in to both apps with one set of credentials.
br
sl-alert variant="success" open="true"
sl-icon slot="icon" library="fa" name="fas-circle-check"
- div slot="header" Your changes have been saved
- | You can safely exit the app now.
+ div slot="header" Request approved
+ | This request was approved on April 25, 2024.
br
sl-alert variant="warning" open="true"
sl-icon slot="icon" library="fa" name="fas-triangle-exclamation"
- div slot="header" Your session has ended
- | Please login again to continue.
+ div slot="header" This view is currently hidden from shareholders
+ | Go to
+ a class="ts-text-link" href="#" Company settings
+ | to edit the visibility of this page.
br
sl-alert variant="danger" open="true"
sl-icon slot="icon" library="fa" name="fas-circle-exclamation"
- div slot="header" Your account has been deleted
- | We are very sorry to see you go!
+ div slot="header" Your payment is past due
+ | To avoid late fees, pay your minimum amount due today.
```
```jsx:react
@@ -330,38 +332,31 @@ You should always use the `closable` attribute so users can dismiss the notifica
Primary
Success
-
Warning
Danger
-
-
- This is super informative
- You can tell by how pretty the alert is.
-
-
-
-
- Your changes have been saved
- You can safely exit the app now.
-
+
+
+ We’ve simplified your login experience
+ You can now log in to both apps with one set of credentials.
+
-
-
- Your session has ended
- Please login again to continue.
-
+
+
+ Request submitted
+ Your request to issue 1,000 shares to Grace Hopper has been submitted.
+
-
-
- Your account has been deleted
- We are very sorry to see you go!
-
+
+
+ Your settings couldn’t be updated
+ Please contact support for help with this issue.
+
+```
+
+```pug:slim
+form.validation
+ sl-radio-group label="Select at least one option" required="true"
+ sl-radio value="1" Option 1
+ sl-radio value="2" Option 2
+ sl-radio value="3" Option 3
+ br
+ sl-button type="submit" variant="primary" Submit
+
+javascript:
+ const form = document.querySelector(.validation);
+
+ // Wait for controls to be defined before attaching form listeners
+ await Promise.all([
+ customElements.whenDefined('sl-checkbox-group'),
+ ]).then(() => {
+ // Handle form submit
+ form.addEventListener(submit, event => {
+ event.preventDefault();
+ alert(All fields are valid!);
+ });
+ });
+```
+
+```jsx:react
+import SlButton from '@teamshares/shoelace/dist/react/button';
+import SlIcon from '@teamshares/shoelace/dist/react/icon';
+import SlRadio from '@teamshares/shoelace/dist/react/radio';
+import SlRadioGroup from '@teamshares/shoelace/dist/react/radio-group';
+const App = () => {
+ function handleSubmit(event) {
+ event.preventDefault();
+ alert('All fields are valid!');
+ }
+
+ return (
+
+ );
+};
+```
+
+### Custom Validity
+
+Use the `setCustomValidity()` method to set a custom validation message. This will prevent the form from submitting and make the browser display the error message you provide. To clear the error, call this function with an empty string.
+
+```html:preview
+
+
+
+```
+
+```pug:slim
+form.validation
+ sl-radio-group label="Select the third option" required="true"
+ sl-radio value="1" You can optionally choose me
+ sl-radio value="2" I'm optional too
+ sl-radio value="3" You must choose me
+ br
+ sl-button type="submit" variant="primary" Submit
+
+javascript:
+ const form = document.querySelector(.custom-validity);
+ const checkboxGroup = form.querySelector('sl-checkbox-group');
+ const errorMessage = 'You must choose the last option';
+
+ // Set initial validity as soon as the element is defined
+ customElements.whenDefined('sl-checkbox').then(() => {
+ checkboxGroup.setCustomValidity(errorMessage);
+ });
+
+ // Update validity when a selection is made
+ form.addEventListener('sl-change', () => {
+ const isValid = checkboxGroup.value.some(value => value.includes('option-3: true'));
+ checkboxGroup.setCustomValidity(isValid ? '' : errorMessage);
+ });
+
+ // Wait for controls to be defined before attaching form listeners
+ await Promise.all([
+ customElements.whenDefined('sl-checkbox-group'),
+ ]).then(() => {
+ // Handle form submit
+ form.addEventListener(submit, event => {
+ event.preventDefault();
+ alert(All fields are valid!);
+ });
+ });
+```
+
+```jsx:react
+import SlButton from '@teamshares/shoelace/dist/react/button';
+import SlIcon from '@teamshares/shoelace/dist/react/icon';
+import SlRadio from '@teamshares/shoelace/dist/react/radio';
+import SlRadioGroup from '@teamshares/shoelace/dist/react/radio-group';
+const App = () => {
+ function handleSubmit(event) {
+ event.preventDefault();
+ alert('All fields are valid!');
+ }
+
+ return (
+
+ );
+};
+```
diff --git a/docs/pages/components/checkbox.md b/docs/pages/components/checkbox.md
index b8f79d7f90..7193528a01 100644
--- a/docs/pages/components/checkbox.md
+++ b/docs/pages/components/checkbox.md
@@ -3,6 +3,11 @@ meta:
title: Checkbox
description: Checkboxes allow the user to toggle an option on or off.
layout: component
+unusedProperties: |
+ - Sizes `small`, `large`
+ - Boolean `indeterminate`
+guidelines: |
+ - Refer to the [Checkbox Group component general guidelines](/components/checkbox-group/#usage-guidelines)
---
## Examples
@@ -10,11 +15,11 @@ layout: component
### Basic Checkbox
```html:preview
-Checkbox
+Financial products access
```
```pug:slim
-sl-checkbox Checkbox
+sl-checkbox Financial products access
```
```jsx:react
@@ -27,16 +32,135 @@ const App = () => Checkbox;
This component works with standard `
-
```
@@ -343,10 +545,14 @@ javascript:
radioGroup.setCustomValidity(isValid ? : errorMessage);
});
- // Handle form submit
- form.addEventListener(submit, event => {
- event.preventDefault();
- alert(All fields are valid!);
+ await Promise.all([
+ customElements.whenDefined('sl-radio-group'),
+ ]).then(() => {
+ // Handle form submit
+ form.addEventListener(submit, event => {
+ event.preventDefault();
+ alert(All fields are valid!);
+ });
});
```
diff --git a/docs/pages/components/radio.md b/docs/pages/components/radio.md
index 81ba76c606..aa9d5f3316 100644
--- a/docs/pages/components/radio.md
+++ b/docs/pages/components/radio.md
@@ -3,6 +3,10 @@ meta:
title: Radio
description: Radios allow the user to select a single option from a group.
layout: component
+unusedProperties: |
+ - Sizes `small`, `large`
+guidelines: |
+ - Refer to the [Radio Group component general guidelines](/components/radio-group/#usage-guidelines)
---
## Examples
@@ -12,18 +16,18 @@ layout: component
Radios are designed to be used with [radio groups](/components/radio-group).
```html:preview
-
- Option 1
- Option 2
- Option 3
+
+ Issue shares
+ Employee buyback
+ Cancel a certificate
```
```pug:slim
-sl-radio-group label="Select an option" name="a" value="1"
- sl-radio value="1" Option 1
- sl-radio value="2" Option 2
- sl-radio value="3" Option 3
+sl-radio-group label="What would you like to do?" name="a" value="issue_shares" required
+ sl-radio value="issue_shares" Issue shares
+ sl-radio value="employee_buyback" Employee buyback
+ sl-radio value="cancel_certificate" Cancel a certificate
```
```jsx:react
@@ -43,23 +47,171 @@ const App = () => (
This component works with standard `