@warp-ds/elements 2.9.2-next.1 → 2.10.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/api.js +1 -1
- package/dist/api.js.map +1 -1
- package/dist/custom-elements.json +508 -145
- package/dist/docs/affix/affix.md +2 -2
- package/dist/docs/affix/styling.md +1 -0
- package/dist/docs/alert/alert.md +2 -2
- package/dist/docs/alert/styling.md +1 -0
- package/dist/docs/attention/attention.md +2 -0
- package/dist/docs/attention/styling.md +1 -0
- package/dist/docs/badge/badge.md +2 -0
- package/dist/docs/badge/styling.md +1 -0
- package/dist/docs/box/box.md +22 -40
- package/dist/docs/box/examples.md +20 -38
- package/dist/docs/box/styling.md +1 -0
- package/dist/docs/breadcrumbs/breadcrumbs.md +8 -2
- package/dist/docs/breadcrumbs/examples.md +7 -1
- package/dist/docs/breadcrumbs/styling.md +1 -0
- package/dist/docs/button/accessibility.md +42 -0
- package/dist/docs/button/api.md +63 -39
- package/dist/docs/button/button.md +395 -42
- package/dist/docs/button/examples.md +126 -0
- package/dist/docs/button/styling.md +72 -0
- package/dist/docs/button/usage.md +89 -0
- package/dist/docs/card/accessibility.md +74 -0
- package/dist/docs/card/api.md +9 -3
- package/dist/docs/card/card.md +236 -5
- package/dist/docs/card/examples.md +75 -0
- package/dist/docs/card/styling.md +1 -0
- package/dist/docs/card/usage.md +76 -0
- package/dist/docs/checkbox/api.md +128 -0
- package/dist/docs/checkbox/checkbox.md +134 -0
- package/dist/docs/checkbox-group/accessibility.md +71 -0
- package/dist/docs/checkbox-group/api.md +79 -0
- package/dist/docs/checkbox-group/checkbox-group.md +492 -0
- package/dist/docs/checkbox-group/examples.md +105 -0
- package/dist/docs/checkbox-group/styling.md +132 -0
- package/dist/docs/checkbox-group/usage.md +95 -0
- package/dist/docs/combobox/accessibility.md +71 -0
- package/dist/docs/combobox/api.md +60 -30
- package/dist/docs/combobox/combobox.md +205 -32
- package/dist/docs/combobox/examples.md +44 -0
- package/dist/docs/combobox/styling.md +1 -0
- package/dist/docs/combobox/usage.md +28 -0
- package/dist/docs/datepicker/accessibility.md +25 -0
- package/dist/docs/datepicker/api.md +22 -14
- package/dist/docs/datepicker/datepicker.md +208 -16
- package/dist/docs/datepicker/examples.md +75 -0
- package/dist/docs/datepicker/styling.md +1 -0
- package/dist/docs/datepicker/usage.md +84 -0
- package/dist/docs/expandable/api.md +20 -32
- package/dist/docs/expandable/examples.md +54 -0
- package/dist/docs/expandable/expandable.md +74 -32
- package/dist/docs/expandable/styling.md +1 -0
- package/dist/docs/icon/accessibility.md +5 -0
- package/dist/docs/icon/api.md +43 -0
- package/dist/docs/icon/examples.md +45 -0
- package/dist/docs/icon/icon.md +115 -0
- package/dist/docs/icon/styling.md +1 -0
- package/dist/docs/icon/usage.md +11 -0
- package/dist/docs/index.md +46 -0
- package/dist/docs/link/api.md +18 -22
- package/dist/docs/link/examples.md +75 -0
- package/dist/docs/link/link.md +113 -24
- package/dist/docs/link/styling.md +1 -0
- package/dist/docs/link/usage.md +18 -0
- package/dist/docs/modal/api.md +51 -0
- package/dist/docs/modal/examples.md +67 -0
- package/dist/docs/modal/modal.md +240 -0
- package/dist/docs/modal/styling.md +1 -0
- package/dist/docs/modal/usage.md +110 -0
- package/dist/docs/modal-footer/api.md +11 -0
- package/dist/docs/modal-footer/modal-footer.md +17 -0
- package/dist/docs/modal-header/api.md +42 -0
- package/dist/docs/modal-header/modal-header.md +48 -0
- package/dist/docs/page-indicator/api.md +6 -6
- package/dist/docs/page-indicator/examples.md +8 -0
- package/dist/docs/page-indicator/page-indicator.md +25 -6
- package/dist/docs/page-indicator/styling.md +1 -0
- package/dist/docs/page-indicator/usage.md +8 -0
- package/dist/docs/pagination/api.md +12 -10
- package/dist/docs/pagination/examples.md +20 -0
- package/dist/docs/pagination/pagination.md +52 -12
- package/dist/docs/pagination/styling.md +1 -0
- package/dist/docs/pagination/usage.md +18 -0
- package/dist/docs/pill/accessibility.md +2 -0
- package/dist/docs/pill/api.md +10 -26
- package/dist/docs/pill/examples.md +23 -0
- package/dist/docs/pill/pill.md +45 -28
- package/dist/docs/pill/styling.md +1 -0
- package/dist/docs/pill/usage.md +8 -0
- package/dist/docs/radio/radio.md +1 -7
- package/dist/docs/select/select.md +2 -0
- package/dist/docs/select/styling.md +1 -0
- package/dist/docs/slider/slider.md +2 -0
- package/dist/docs/slider/styling.md +1 -0
- package/dist/docs/slider-thumb/slider-thumb.md +2 -0
- package/dist/docs/slider-thumb/styling.md +1 -0
- package/dist/docs/step-indicator/step-indicator.md +2 -0
- package/dist/docs/step-indicator/styling.md +1 -0
- package/dist/docs/switch/styling.md +1 -0
- package/dist/docs/switch/switch.md +2 -0
- package/dist/docs/tabs/styling.md +1 -0
- package/dist/docs/tabs/tabs.md +2 -0
- package/dist/docs/textarea/styling.md +1 -0
- package/dist/docs/textarea/textarea.md +2 -0
- package/dist/docs/textfield/styling.md +1 -0
- package/dist/docs/textfield/textfield.md +2 -0
- package/dist/index.d.ts +950 -602
- package/dist/packages/affix/affix.hydration.test.js +1 -1
- package/dist/packages/affix/affix.js +4 -4
- package/dist/packages/affix/affix.js.map +4 -4
- package/dist/packages/alert/alert.hydration.test.js +1 -1
- package/dist/packages/alert/alert.js +3 -3
- package/dist/packages/alert/alert.js.map +3 -3
- package/dist/packages/attention/attention.hydration.test.js +1 -1
- package/dist/packages/attention/attention.js +397 -444
- package/dist/packages/attention/attention.js.map +4 -4
- package/dist/packages/attention/attention.test.js +1 -1
- package/dist/packages/badge/badge.hydration.test.js +1 -1
- package/dist/packages/box/box.hydration.test.js +1 -1
- package/dist/packages/box/box.js +1 -1
- package/dist/packages/box/box.js.map +1 -1
- package/dist/packages/breadcrumbs/breadcrumbs.hydration.test.js +3 -2
- package/dist/packages/breadcrumbs/breadcrumbs.js +4 -4
- package/dist/packages/breadcrumbs/breadcrumbs.js.map +3 -3
- package/dist/packages/button/button.d.ts +54 -37
- package/dist/packages/button/button.hydration.test.js +1 -1
- package/dist/packages/button/button.js +385 -432
- package/dist/packages/button/button.js.map +4 -4
- package/dist/packages/button/button.react.stories.d.ts +2 -2
- package/dist/packages/button/button.stories.d.ts +29 -0
- package/dist/packages/button/button.stories.js +176 -2
- package/dist/packages/button/react.d.ts +1 -1
- package/dist/packages/button/styles.d.ts +22 -1
- package/dist/packages/button/styles.js +390 -1
- package/dist/packages/card/card.d.ts +9 -6
- package/dist/packages/card/card.hydration.test.js +1 -1
- package/dist/packages/card/card.js +3 -3
- package/dist/packages/card/card.js.map +4 -4
- package/dist/packages/checkbox/checkbox.d.ts +45 -14
- package/dist/packages/checkbox/checkbox.hydration.test.js +1 -1
- package/dist/packages/checkbox/checkbox.js +3 -3
- package/dist/packages/checkbox/checkbox.js.map +3 -3
- package/dist/packages/checkbox/checkbox.react.stories.d.ts +1 -1
- package/dist/packages/checkbox/checkbox.stories.d.ts +2 -2
- package/dist/packages/checkbox/checkbox.test.js +1 -1
- package/dist/packages/checkbox/react.d.ts +2 -2
- package/dist/packages/checkbox-group/checkbox-group.a11y.test.js +1 -1
- package/dist/packages/checkbox-group/checkbox-group.d.ts +35 -8
- package/dist/packages/checkbox-group/checkbox-group.hydration.test.js +1 -1
- package/dist/packages/checkbox-group/checkbox-group.js +6 -6
- package/dist/packages/checkbox-group/checkbox-group.js.map +4 -4
- package/dist/packages/checkbox-group/react.d.ts +3 -3
- package/dist/packages/combobox/combobox.a11y.test.js +24 -0
- package/dist/packages/combobox/combobox.d.ts +65 -45
- package/dist/packages/combobox/combobox.hydration.test.js +39 -1
- package/dist/packages/combobox/combobox.js +21 -21
- package/dist/packages/combobox/combobox.js.map +4 -4
- package/dist/packages/combobox/combobox.stories.js +28 -15
- package/dist/packages/combobox/combobox.test.js +110 -0
- package/dist/packages/datepicker/DatePicker.test.js +1 -1
- package/dist/packages/datepicker/datepicker.d.ts +22 -30
- package/dist/packages/datepicker/datepicker.hydration.test.js +1 -1
- package/dist/packages/datepicker/datepicker.js +49 -49
- package/dist/packages/datepicker/datepicker.js.map +4 -4
- package/dist/packages/datepicker/datepicker.test.js +1 -1
- package/dist/packages/expandable/expandable.d.ts +11 -32
- package/dist/packages/expandable/expandable.hydration.test.js +1 -1
- package/dist/packages/expandable/expandable.js +11 -11
- package/dist/packages/expandable/expandable.js.map +3 -3
- package/dist/packages/expandable/expandable.react.stories.d.ts +2 -2
- package/dist/packages/expandable/react.d.ts +1 -1
- package/dist/packages/icon/icon.d.ts +16 -4
- package/dist/packages/icon/icon.hydration.test.js +1 -1
- package/dist/packages/icon/icon.js +2 -2
- package/dist/packages/icon/icon.js.map +3 -3
- package/dist/packages/icon/icon.react.stories.d.ts +1 -1
- package/dist/packages/icon/react.d.ts +2 -2
- package/dist/packages/link/link.d.ts +15 -16
- package/dist/packages/link/link.hydration.test.js +1 -1
- package/dist/packages/link/link.js +420 -190
- package/dist/packages/link/link.js.map +4 -4
- package/dist/packages/link/link.test.js +1 -1
- package/dist/packages/link/styles.d.ts +5 -0
- package/dist/packages/link/styles.js +80 -0
- package/dist/packages/modal/index.d.ts +4 -4
- package/dist/packages/modal/index.js +4 -4
- package/dist/packages/modal/modal.d.ts +22 -12
- package/dist/packages/modal/modal.hydration.test.js +1 -1
- package/dist/packages/modal/modal.js +5 -5
- package/dist/packages/modal/modal.js.map +3 -3
- package/dist/packages/modal/modal.react.stories.d.ts +3 -3
- package/dist/packages/modal/modal.stories.d.ts +2 -1
- package/dist/packages/modal/modal.stories.js +85 -3
- package/dist/packages/modal/react.d.ts +2 -2
- package/dist/packages/modal-footer/modal-footer.d.ts +5 -3
- package/dist/packages/modal-footer/modal-footer.js +4 -4
- package/dist/packages/modal-footer/modal-footer.js.map +3 -3
- package/dist/packages/modal-footer/react.d.ts +1 -1
- package/dist/packages/modal-header/modal-header.d.ts +21 -11
- package/dist/packages/modal-header/modal-header.js +11 -9
- package/dist/packages/modal-header/modal-header.js.map +4 -4
- package/dist/packages/modal-header/react.d.ts +2 -2
- package/dist/packages/page-indicator/page-indicator.d.ts +9 -14
- package/dist/packages/page-indicator/page-indicator.hydration.test.js +1 -1
- package/dist/packages/page-indicator/page-indicator.js +5 -5
- package/dist/packages/page-indicator/page-indicator.js.map +4 -4
- package/dist/packages/pagination/pagination.d.ts +11 -11
- package/dist/packages/pagination/pagination.hydration.test.js +1 -1
- package/dist/packages/pagination/pagination.js +4 -4
- package/dist/packages/pagination/pagination.js.map +4 -4
- package/dist/packages/pagination/pagination.test.js +1 -1
- package/dist/packages/pill/pill.d.ts +14 -29
- package/dist/packages/pill/pill.hydration.test.js +1 -1
- package/dist/packages/pill/pill.js +3 -3
- package/dist/packages/pill/pill.js.map +4 -4
- package/dist/packages/pill/pill.react.stories.d.ts +2 -2
- package/dist/packages/pill/react.d.ts +1 -1
- package/dist/packages/radio/radio.hydration.test.js +1 -1
- package/dist/packages/radio/radio.js +3 -3
- package/dist/packages/radio/radio.js.map +3 -3
- package/dist/packages/radio/radio.test.js +1 -1
- package/dist/packages/radio-group/radio-group.a11y.test.js +7 -3
- package/dist/packages/radio-group/radio-group.hydration.test.js +6 -2
- package/dist/packages/radio-group/radio-group.js +11 -11
- package/dist/packages/radio-group/radio-group.js.map +4 -4
- package/dist/packages/select/select.a11y.test.js +6 -2
- package/dist/packages/select/select.hydration.test.js +1 -1
- package/dist/packages/select/select.js +7 -7
- package/dist/packages/select/select.js.map +4 -4
- package/dist/packages/select/select.test.js +4 -2
- package/dist/packages/slider/slider.hydration.test.js +7 -2
- package/dist/packages/slider/slider.js +5 -5
- package/dist/packages/slider/slider.js.map +4 -4
- package/dist/packages/slider/slider.react.stories.js +2 -2
- package/dist/packages/slider/slider.test.js +1 -1
- package/dist/packages/slider-thumb/slider-thumb.hydration.test.js +1 -1
- package/dist/packages/slider-thumb/slider-thumb.js +20 -20
- package/dist/packages/slider-thumb/slider-thumb.js.map +4 -4
- package/dist/packages/step/step.hydration.test.js +1 -1
- package/dist/packages/step/step.js +8 -8
- package/dist/packages/step/step.js.map +4 -4
- package/dist/packages/step-indicator/step-indicator.hydration.test.js +1 -1
- package/dist/packages/switch/switch.a11y.test.js +1 -1
- package/dist/packages/switch/switch.hydration.test.js +1 -1
- package/dist/packages/switch/switch.js +1 -1
- package/dist/packages/switch/switch.js.map +1 -1
- package/dist/packages/tab/tab.hydration.test.js +1 -1
- package/dist/packages/tab/tab.js +10 -10
- package/dist/packages/tab/tab.js.map +2 -2
- package/dist/packages/tab-panel/tab-panel.hydration.test.js +1 -1
- package/dist/packages/tab-panel/tab-panel.js +3 -3
- package/dist/packages/tab-panel/tab-panel.js.map +2 -2
- package/dist/packages/tabs/tabs.a11y.test.js +2 -2
- package/dist/packages/tabs/tabs.hydration.test.js +1 -1
- package/dist/packages/tabs/tabs.js +1 -1
- package/dist/packages/tabs/tabs.js.map +2 -2
- package/dist/packages/tabs/tabs.test.js +4 -4
- package/dist/packages/textarea/textarea.hydration.test.js +1 -1
- package/dist/packages/textarea/textarea.js +4 -4
- package/dist/packages/textarea/textarea.js.map +3 -3
- package/dist/packages/textarea/textarea.test.js +1 -1
- package/dist/packages/textfield/textfield.hydration.test.js +1 -1
- package/dist/packages/textfield/textfield.js +1 -1
- package/dist/packages/textfield/textfield.js.map +1 -1
- package/dist/packages/textfield/textfield.test.js +1 -1
- package/dist/packages/toast/toast.js +6 -6
- package/dist/packages/toast/toast.js.map +4 -4
- package/dist/packages/toast/toast.stories.d.ts +1 -5
- package/dist/packages/toast/toast.stories.js +0 -17
- package/dist/packages/toast-container/toast-container.js +2 -2
- package/dist/packages/toast-container/toast-container.js.map +2 -2
- package/dist/web-types.json +509 -172
- package/eik/index.js +2536 -0
- package/package.json +18 -12
- package/dist/docs/radio/examples.md +0 -1
- package/dist/docs/radio/usage.md +0 -1
- package/dist/packages/button/styles/w-button.styles.d.ts +0 -1
- package/dist/packages/button/styles/w-button.styles.js +0 -282
- package/dist/packages/link/styles/w-link.styles.d.ts +0 -1
- package/dist/packages/link/styles/w-link.styles.js +0 -213
- /package/dist/docs/{radio → modal}/accessibility.md +0 -0
package/dist/docs/card/usage.md
CHANGED
|
@@ -1 +1,77 @@
|
|
|
1
1
|
## Usage
|
|
2
|
+
|
|
3
|
+
Card is a layout component for visually grouping related content as one item.
|
|
4
|
+
|
|
5
|
+
Use `w-card` for listings, summaries, recommendations, or selectable choices where the grouped content should feel like a single object. The component does not add padding, headings, spacing between children, or semantic structure. Those must be provided by the content inside the card.
|
|
6
|
+
|
|
7
|
+
### Basic Card
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<w-card>
|
|
11
|
+
<div style="padding: 16px;">
|
|
12
|
+
<h3>Apartment in Oslo</h3>
|
|
13
|
+
<p>Bright 3-room apartment with balcony.</p>
|
|
14
|
+
</div>
|
|
15
|
+
</w-card>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Visual Treatments
|
|
19
|
+
|
|
20
|
+
The default card uses an elevated surface. Use `flat` when the card should sit more quietly in the layout.
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<w-card>
|
|
24
|
+
<div style="padding: 16px;">
|
|
25
|
+
<h3>Elevated card</h3>
|
|
26
|
+
<p>Use this for cards that need more visual separation.</p>
|
|
27
|
+
</div>
|
|
28
|
+
</w-card>
|
|
29
|
+
|
|
30
|
+
<w-card flat>
|
|
31
|
+
<div style="padding: 16px;">
|
|
32
|
+
<h3>Flat card</h3>
|
|
33
|
+
<p>Use this for dense layouts or cards inside another surface.</p>
|
|
34
|
+
</div>
|
|
35
|
+
</w-card>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Selected Cards
|
|
39
|
+
|
|
40
|
+
Use `selected` when a card represents a selected item or choice.
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<w-card selected>
|
|
44
|
+
<div style="padding: 16px;">
|
|
45
|
+
<h3>Standard delivery</h3>
|
|
46
|
+
<p>Delivered in 2-4 business days.</p>
|
|
47
|
+
</div>
|
|
48
|
+
</w-card>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The `selected` property only controls the card's visual state. Update it from your application state when the selection changes.
|
|
52
|
+
|
|
53
|
+
### Clickable Cards
|
|
54
|
+
|
|
55
|
+
Use `clickable` when the whole card should behave as one interactive choice. The card becomes keyboard focusable, and Enter or Space triggers a click on the card.
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<w-card clickable>
|
|
59
|
+
<div style="padding: 16px;">
|
|
60
|
+
<h3>Pick up nearby</h3>
|
|
61
|
+
<p>Collect the item from a pickup point.</p>
|
|
62
|
+
</div>
|
|
63
|
+
</w-card>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Listen for the card's click event and update `selected` yourself.
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<w-card clickable selected>
|
|
70
|
+
<div style="padding: 16px;">
|
|
71
|
+
<h3>Home delivery</h3>
|
|
72
|
+
<p>Delivered to your door.</p>
|
|
73
|
+
</div>
|
|
74
|
+
</w-card>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Do not use `clickable` when the card contains separate links, buttons, form controls, or other interactive elements. In those cases, keep the card non-clickable and make the specific control interactive instead.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
### `<w-checkbox>` API
|
|
2
|
+
|
|
3
|
+
#### Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Default | Summary |
|
|
6
|
+
|-|-|-|-|
|
|
7
|
+
| _computedInvalid (JS only) | `boolean` | `-` | Computed invalid state: combines own invalid with group invalid |
|
|
8
|
+
| checked | `boolean` | `false` | Whether the checkbox is checked. |
|
|
9
|
+
| disabled | `boolean` | `false` | Whether the checkbox is disabled. |
|
|
10
|
+
| indeterminate | `boolean` | `false` | Whether the checkbox is visually indeterminate. |
|
|
11
|
+
| input (JS only) | `HTMLInputElement \| null` | `-` | - |
|
|
12
|
+
| invalid | `boolean` | `false` | Whether the checkbox is visually invalid. |
|
|
13
|
+
| name | `string \| undefined` | `-` | The name of the checkbox. |
|
|
14
|
+
| required | `boolean` | `false` | Whether the checkbox must be checked before form submission. |
|
|
15
|
+
| shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true }` | - |
|
|
16
|
+
| validationMessage (JS only) | `string` | `-` | Returns the validation message if the checkbox is invalid, otherwise an empty string |
|
|
17
|
+
| validity (JS only) | `ValidityState` | `-` | Returns the validity state of the checkbox |
|
|
18
|
+
| value | `string \| null` | `null` | The value submitted when the checkbox is checked. |
|
|
19
|
+
|
|
20
|
+
#### Property Details
|
|
21
|
+
|
|
22
|
+
##### _computedInvalid (JS only)
|
|
23
|
+
|
|
24
|
+
Computed invalid state: combines own invalid with group invalid
|
|
25
|
+
|
|
26
|
+
- Type: `boolean`
|
|
27
|
+
- Default: `-`
|
|
28
|
+
|
|
29
|
+
##### checked
|
|
30
|
+
|
|
31
|
+
Whether the checkbox is checked.
|
|
32
|
+
|
|
33
|
+
Checked checkboxes submit their value with form data. The property is reflected to the `checked` attribute.
|
|
34
|
+
|
|
35
|
+
- Type: `boolean`
|
|
36
|
+
- Default: `false`
|
|
37
|
+
|
|
38
|
+
##### disabled
|
|
39
|
+
|
|
40
|
+
Whether the checkbox is disabled.
|
|
41
|
+
|
|
42
|
+
Disabled checkboxes cannot be focused, changed, or submitted with form data.
|
|
43
|
+
|
|
44
|
+
- Type: `boolean`
|
|
45
|
+
- Default: `false`
|
|
46
|
+
|
|
47
|
+
##### indeterminate
|
|
48
|
+
|
|
49
|
+
Whether the checkbox is visually indeterminate.
|
|
50
|
+
|
|
51
|
+
Use this for parent options that represent a mixed set of child selections. Clicking the checkbox clears the indeterminate state and sets the checkbox to checked.
|
|
52
|
+
|
|
53
|
+
- Type: `boolean`
|
|
54
|
+
- Default: `false`
|
|
55
|
+
|
|
56
|
+
##### input (JS only)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
- Type: `HTMLInputElement | null`
|
|
61
|
+
- Default: `-`
|
|
62
|
+
|
|
63
|
+
##### invalid
|
|
64
|
+
|
|
65
|
+
Whether the checkbox is visually invalid.
|
|
66
|
+
|
|
67
|
+
Use this to show an externally managed validation error. Required validation also sets the invalid state after the user interacts with the checkbox or tries to submit the form.
|
|
68
|
+
|
|
69
|
+
- Type: `boolean`
|
|
70
|
+
- Default: `false`
|
|
71
|
+
|
|
72
|
+
##### name
|
|
73
|
+
|
|
74
|
+
The name of the checkbox.
|
|
75
|
+
|
|
76
|
+
When the checkbox is checked and belongs to a form, this name is submitted with the checkbox value. If the checkbox is inside a `w-checkbox-group` with a name, the group name is used when the checkbox does not have its own name.
|
|
77
|
+
|
|
78
|
+
- Type: `string | undefined`
|
|
79
|
+
- Default: `-`
|
|
80
|
+
|
|
81
|
+
##### required
|
|
82
|
+
|
|
83
|
+
Whether the checkbox must be checked before form submission.
|
|
84
|
+
|
|
85
|
+
A required checkbox is invalid until it is checked. For requiring at least one option in a set, use `required` on `w-checkbox-group`.
|
|
86
|
+
|
|
87
|
+
- Type: `boolean`
|
|
88
|
+
- Default: `false`
|
|
89
|
+
|
|
90
|
+
##### shadowRootOptions (JS only)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
- Type: `object`
|
|
95
|
+
- Default: `{ ...LitElement.shadowRootOptions, delegatesFocus: true }`
|
|
96
|
+
|
|
97
|
+
##### validationMessage (JS only)
|
|
98
|
+
|
|
99
|
+
Returns the validation message if the checkbox is invalid, otherwise an empty string
|
|
100
|
+
|
|
101
|
+
- Type: `string`
|
|
102
|
+
- Default: `-`
|
|
103
|
+
|
|
104
|
+
##### validity (JS only)
|
|
105
|
+
|
|
106
|
+
Returns the validity state of the checkbox
|
|
107
|
+
|
|
108
|
+
- Type: `ValidityState`
|
|
109
|
+
- Default: `-`
|
|
110
|
+
|
|
111
|
+
##### value
|
|
112
|
+
|
|
113
|
+
The value submitted when the checkbox is checked.
|
|
114
|
+
|
|
115
|
+
If no value attribute is set, the checkbox defaults to `on`. Unchecked and disabled checkboxes do not submit a value.
|
|
116
|
+
|
|
117
|
+
- Type: `string | null`
|
|
118
|
+
- Default: `null`
|
|
119
|
+
|
|
120
|
+
#### Events
|
|
121
|
+
|
|
122
|
+
##### change
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
- Type: `Event`
|
|
127
|
+
|
|
128
|
+
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Checkbox (w-checkbox)
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Checkbox lets users select one or more options. Use it for independent yes/no choices, multi-select lists, and terms or consent confirmations.
|
|
6
|
+
|
|
7
|
+
### `<w-checkbox>` API
|
|
8
|
+
|
|
9
|
+
#### Properties
|
|
10
|
+
|
|
11
|
+
| Name | Type | Default | Summary |
|
|
12
|
+
|-|-|-|-|
|
|
13
|
+
| _computedInvalid (JS only) | `boolean` | `-` | Computed invalid state: combines own invalid with group invalid |
|
|
14
|
+
| checked | `boolean` | `false` | Whether the checkbox is checked. |
|
|
15
|
+
| disabled | `boolean` | `false` | Whether the checkbox is disabled. |
|
|
16
|
+
| indeterminate | `boolean` | `false` | Whether the checkbox is visually indeterminate. |
|
|
17
|
+
| input (JS only) | `HTMLInputElement \| null` | `-` | - |
|
|
18
|
+
| invalid | `boolean` | `false` | Whether the checkbox is visually invalid. |
|
|
19
|
+
| name | `string \| undefined` | `-` | The name of the checkbox. |
|
|
20
|
+
| required | `boolean` | `false` | Whether the checkbox must be checked before form submission. |
|
|
21
|
+
| shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true }` | - |
|
|
22
|
+
| validationMessage (JS only) | `string` | `-` | Returns the validation message if the checkbox is invalid, otherwise an empty string |
|
|
23
|
+
| validity (JS only) | `ValidityState` | `-` | Returns the validity state of the checkbox |
|
|
24
|
+
| value | `string \| null` | `null` | The value submitted when the checkbox is checked. |
|
|
25
|
+
|
|
26
|
+
#### Property Details
|
|
27
|
+
|
|
28
|
+
##### _computedInvalid (JS only)
|
|
29
|
+
|
|
30
|
+
Computed invalid state: combines own invalid with group invalid
|
|
31
|
+
|
|
32
|
+
- Type: `boolean`
|
|
33
|
+
- Default: `-`
|
|
34
|
+
|
|
35
|
+
##### checked
|
|
36
|
+
|
|
37
|
+
Whether the checkbox is checked.
|
|
38
|
+
|
|
39
|
+
Checked checkboxes submit their value with form data. The property is reflected to the `checked` attribute.
|
|
40
|
+
|
|
41
|
+
- Type: `boolean`
|
|
42
|
+
- Default: `false`
|
|
43
|
+
|
|
44
|
+
##### disabled
|
|
45
|
+
|
|
46
|
+
Whether the checkbox is disabled.
|
|
47
|
+
|
|
48
|
+
Disabled checkboxes cannot be focused, changed, or submitted with form data.
|
|
49
|
+
|
|
50
|
+
- Type: `boolean`
|
|
51
|
+
- Default: `false`
|
|
52
|
+
|
|
53
|
+
##### indeterminate
|
|
54
|
+
|
|
55
|
+
Whether the checkbox is visually indeterminate.
|
|
56
|
+
|
|
57
|
+
Use this for parent options that represent a mixed set of child selections. Clicking the checkbox clears the indeterminate state and sets the checkbox to checked.
|
|
58
|
+
|
|
59
|
+
- Type: `boolean`
|
|
60
|
+
- Default: `false`
|
|
61
|
+
|
|
62
|
+
##### input (JS only)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
- Type: `HTMLInputElement | null`
|
|
67
|
+
- Default: `-`
|
|
68
|
+
|
|
69
|
+
##### invalid
|
|
70
|
+
|
|
71
|
+
Whether the checkbox is visually invalid.
|
|
72
|
+
|
|
73
|
+
Use this to show an externally managed validation error. Required validation also sets the invalid state after the user interacts with the checkbox or tries to submit the form.
|
|
74
|
+
|
|
75
|
+
- Type: `boolean`
|
|
76
|
+
- Default: `false`
|
|
77
|
+
|
|
78
|
+
##### name
|
|
79
|
+
|
|
80
|
+
The name of the checkbox.
|
|
81
|
+
|
|
82
|
+
When the checkbox is checked and belongs to a form, this name is submitted with the checkbox value. If the checkbox is inside a `w-checkbox-group` with a name, the group name is used when the checkbox does not have its own name.
|
|
83
|
+
|
|
84
|
+
- Type: `string | undefined`
|
|
85
|
+
- Default: `-`
|
|
86
|
+
|
|
87
|
+
##### required
|
|
88
|
+
|
|
89
|
+
Whether the checkbox must be checked before form submission.
|
|
90
|
+
|
|
91
|
+
A required checkbox is invalid until it is checked. For requiring at least one option in a set, use `required` on `w-checkbox-group`.
|
|
92
|
+
|
|
93
|
+
- Type: `boolean`
|
|
94
|
+
- Default: `false`
|
|
95
|
+
|
|
96
|
+
##### shadowRootOptions (JS only)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
- Type: `object`
|
|
101
|
+
- Default: `{ ...LitElement.shadowRootOptions, delegatesFocus: true }`
|
|
102
|
+
|
|
103
|
+
##### validationMessage (JS only)
|
|
104
|
+
|
|
105
|
+
Returns the validation message if the checkbox is invalid, otherwise an empty string
|
|
106
|
+
|
|
107
|
+
- Type: `string`
|
|
108
|
+
- Default: `-`
|
|
109
|
+
|
|
110
|
+
##### validity (JS only)
|
|
111
|
+
|
|
112
|
+
Returns the validity state of the checkbox
|
|
113
|
+
|
|
114
|
+
- Type: `ValidityState`
|
|
115
|
+
- Default: `-`
|
|
116
|
+
|
|
117
|
+
##### value
|
|
118
|
+
|
|
119
|
+
The value submitted when the checkbox is checked.
|
|
120
|
+
|
|
121
|
+
If no value attribute is set, the checkbox defaults to `on`. Unchecked and disabled checkboxes do not submit a value.
|
|
122
|
+
|
|
123
|
+
- Type: `string | null`
|
|
124
|
+
- Default: `null`
|
|
125
|
+
|
|
126
|
+
#### Events
|
|
127
|
+
|
|
128
|
+
##### change
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
- Type: `Event`
|
|
133
|
+
|
|
134
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
## Accessibility
|
|
2
|
+
|
|
3
|
+
Checkbox group renders the child checkboxes inside an element with `role="group"`. The group label is connected to the group, and help text is connected when provided.
|
|
4
|
+
|
|
5
|
+
### Provide A Group Label
|
|
6
|
+
|
|
7
|
+
Use `label` to describe the shared question or topic.
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<w-checkbox-group label="Interests" name="interests">
|
|
11
|
+
<w-checkbox value="housing">Housing</w-checkbox>
|
|
12
|
+
<w-checkbox value="jobs">Jobs</w-checkbox>
|
|
13
|
+
<w-checkbox value="travel">Travel</w-checkbox>
|
|
14
|
+
</w-checkbox-group>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The group label should not duplicate every option label. It should explain what the options are about.
|
|
18
|
+
|
|
19
|
+
### Use Help Text For Extra Context
|
|
20
|
+
|
|
21
|
+
Use `help-text` for instructions, constraints, or validation feedback.
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<w-checkbox-group label="Interests" help-text="Select all that apply" name="interests">
|
|
25
|
+
<w-checkbox value="housing">Housing</w-checkbox>
|
|
26
|
+
<w-checkbox value="jobs">Jobs</w-checkbox>
|
|
27
|
+
<w-checkbox value="travel">Travel</w-checkbox>
|
|
28
|
+
</w-checkbox-group>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Keep help text short and actionable.
|
|
32
|
+
|
|
33
|
+
### Required Groups
|
|
34
|
+
|
|
35
|
+
Use `required` on the group when at least one option must be selected.
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<w-checkbox-group label="Preferences" required help-text="Choose at least one" name="preferences">
|
|
39
|
+
<w-checkbox value="email">Email</w-checkbox>
|
|
40
|
+
<w-checkbox value="sms">SMS</w-checkbox>
|
|
41
|
+
</w-checkbox-group>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Do not put `required` on each child checkbox for a "choose at least one" requirement. That would mean every option must be selected.
|
|
45
|
+
|
|
46
|
+
### Validation Feedback
|
|
47
|
+
|
|
48
|
+
Do not rely on invalid styling alone. Provide clear help text that explains what the user needs to do.
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<w-checkbox-group label="Preferences" invalid help-text="Select at least one option" name="preferences">
|
|
52
|
+
<w-checkbox value="email">Email</w-checkbox>
|
|
53
|
+
<w-checkbox value="sms">SMS</w-checkbox>
|
|
54
|
+
</w-checkbox-group>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
When the group is invalid, the invalid state is also shared with child checkboxes for consistent styling and accessibility state.
|
|
58
|
+
|
|
59
|
+
### Checkbox Labels
|
|
60
|
+
|
|
61
|
+
Each child checkbox still needs its own clear label.
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<w-checkbox-group label="Contact preferences" name="contact">
|
|
65
|
+
<w-checkbox value="email">Email</w-checkbox>
|
|
66
|
+
<w-checkbox value="sms">SMS</w-checkbox>
|
|
67
|
+
<w-checkbox value="push">Push notifications</w-checkbox>
|
|
68
|
+
</w-checkbox-group>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Avoid option labels that only make sense visually, such as "Yes" or "This one", unless the group label gives enough context.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
## `<w-checkbox-group>` API
|
|
2
|
+
|
|
3
|
+
Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
|
|
4
|
+
|
|
5
|
+
### Properties
|
|
6
|
+
|
|
7
|
+
| Name | Type | Default | Summary |
|
|
8
|
+
|-|-|-|-|
|
|
9
|
+
| help-text | `string` | `-` | Help text displayed below the checkbox group. |
|
|
10
|
+
| invalid | `boolean` | `false` | Whether the checkbox group is visually invalid. |
|
|
11
|
+
| label | `string` | `-` | The group label displayed above the checkboxes. |
|
|
12
|
+
| name | `string` | `-` | The name applied to child checkboxes when they do not provide one. |
|
|
13
|
+
| optional | `boolean` | `false` | Whether to show optional text next to the label. |
|
|
14
|
+
| required | `boolean` | `false` | Whether at least one checkbox in the group must be selected. |
|
|
15
|
+
| shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }` | - |
|
|
16
|
+
|
|
17
|
+
### Property Details
|
|
18
|
+
|
|
19
|
+
#### help-text
|
|
20
|
+
|
|
21
|
+
Help text displayed below the checkbox group.
|
|
22
|
+
|
|
23
|
+
Use this for supporting guidance or validation feedback. When required validation fails, the group replaces this text with the localized required message.
|
|
24
|
+
|
|
25
|
+
- Type: `string`
|
|
26
|
+
- Default: `-`
|
|
27
|
+
|
|
28
|
+
#### invalid
|
|
29
|
+
|
|
30
|
+
Whether the checkbox group is visually invalid.
|
|
31
|
+
|
|
32
|
+
Use this to show an externally managed validation error for the group. The invalid state is also shared with child checkboxes for consistent styling and accessibility state.
|
|
33
|
+
|
|
34
|
+
- Type: `boolean`
|
|
35
|
+
- Default: `false`
|
|
36
|
+
|
|
37
|
+
#### label
|
|
38
|
+
|
|
39
|
+
The group label displayed above the checkboxes.
|
|
40
|
+
|
|
41
|
+
Use this to describe the shared question or topic for the checkbox options. The label is connected to the internal group for assistive technologies.
|
|
42
|
+
|
|
43
|
+
- Type: `string`
|
|
44
|
+
- Default: `-`
|
|
45
|
+
|
|
46
|
+
#### name
|
|
47
|
+
|
|
48
|
+
The name applied to child checkboxes when they do not provide one.
|
|
49
|
+
|
|
50
|
+
Use this when the grouped checkboxes should submit values under the same form field name. Individual checkboxes can still override the group name with their own `name`.
|
|
51
|
+
|
|
52
|
+
- Type: `string`
|
|
53
|
+
- Default: `-`
|
|
54
|
+
|
|
55
|
+
#### optional
|
|
56
|
+
|
|
57
|
+
Whether to show optional text next to the label.
|
|
58
|
+
|
|
59
|
+
Use this to indicate that selecting an option from the group is not required.
|
|
60
|
+
|
|
61
|
+
- Type: `boolean`
|
|
62
|
+
- Default: `false`
|
|
63
|
+
|
|
64
|
+
#### required
|
|
65
|
+
|
|
66
|
+
Whether at least one checkbox in the group must be selected.
|
|
67
|
+
|
|
68
|
+
Required validation is managed by the group. The individual checkboxes provide the submitted form values.
|
|
69
|
+
|
|
70
|
+
- Type: `boolean`
|
|
71
|
+
- Default: `false`
|
|
72
|
+
|
|
73
|
+
#### shadowRootOptions (JS only)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
- Type: `object`
|
|
78
|
+
- Default: `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }`
|
|
79
|
+
|