@warp-ds/elements 2.10.0-next.4 → 2.10.0-next.6

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.
Files changed (158) hide show
  1. package/README.md +4 -0
  2. package/dist/custom-elements.json +68 -14
  3. package/dist/docs/affix/affix.md +2 -2
  4. package/dist/docs/affix/styling.md +1 -0
  5. package/dist/docs/alert/alert.md +2 -2
  6. package/dist/docs/alert/styling.md +1 -0
  7. package/dist/docs/attention/attention.md +2 -0
  8. package/dist/docs/attention/styling.md +1 -0
  9. package/dist/docs/badge/badge.md +2 -0
  10. package/dist/docs/badge/styling.md +1 -0
  11. package/dist/docs/box/box.md +22 -40
  12. package/dist/docs/box/examples.md +20 -38
  13. package/dist/docs/box/styling.md +1 -0
  14. package/dist/docs/breadcrumbs/breadcrumbs.md +8 -2
  15. package/dist/docs/breadcrumbs/examples.md +7 -1
  16. package/dist/docs/breadcrumbs/styling.md +1 -0
  17. package/dist/docs/button/button.md +73 -2
  18. package/dist/docs/button/styling.md +72 -0
  19. package/dist/docs/card/card.md +2 -2
  20. package/dist/docs/card/styling.md +1 -0
  21. package/dist/docs/checkbox/api.md +128 -0
  22. package/dist/docs/checkbox/checkbox.md +134 -0
  23. package/dist/docs/checkbox-group/accessibility.md +71 -0
  24. package/dist/docs/checkbox-group/api.md +79 -0
  25. package/dist/docs/checkbox-group/checkbox-group.md +492 -0
  26. package/dist/docs/checkbox-group/examples.md +105 -0
  27. package/dist/docs/checkbox-group/styling.md +132 -0
  28. package/dist/docs/checkbox-group/usage.md +95 -0
  29. package/dist/docs/combobox/combobox.md +2 -2
  30. package/dist/docs/combobox/styling.md +1 -0
  31. package/dist/docs/datepicker/accessibility.md +25 -0
  32. package/dist/docs/datepicker/api.md +22 -14
  33. package/dist/docs/datepicker/datepicker.md +208 -16
  34. package/dist/docs/datepicker/examples.md +75 -0
  35. package/dist/docs/datepicker/styling.md +1 -0
  36. package/dist/docs/datepicker/usage.md +84 -0
  37. package/dist/docs/expandable/api.md +20 -32
  38. package/dist/docs/expandable/examples.md +54 -0
  39. package/dist/docs/expandable/expandable.md +74 -32
  40. package/dist/docs/expandable/styling.md +1 -0
  41. package/dist/docs/icon/icon.md +3 -1
  42. package/dist/docs/icon/styling.md +1 -0
  43. package/dist/docs/index.md +46 -0
  44. package/dist/docs/link/link.md +2 -2
  45. package/dist/docs/link/styling.md +1 -0
  46. package/dist/docs/modal/modal.md +2 -0
  47. package/dist/docs/modal/styling.md +1 -0
  48. package/dist/docs/modal-footer/modal-footer.md +0 -6
  49. package/dist/docs/modal-header/modal-header.md +0 -6
  50. package/dist/docs/page-indicator/page-indicator.md +2 -0
  51. package/dist/docs/page-indicator/styling.md +1 -0
  52. package/dist/docs/pagination/pagination.md +2 -0
  53. package/dist/docs/pagination/styling.md +1 -0
  54. package/dist/docs/pill/pill.md +2 -0
  55. package/dist/docs/pill/styling.md +1 -0
  56. package/dist/docs/radio/radio.md +1 -7
  57. package/dist/docs/select/select.md +2 -0
  58. package/dist/docs/select/styling.md +1 -0
  59. package/dist/docs/slider/slider.md +2 -0
  60. package/dist/docs/slider/styling.md +1 -0
  61. package/dist/docs/slider-thumb/slider-thumb.md +2 -0
  62. package/dist/docs/slider-thumb/styling.md +1 -0
  63. package/dist/docs/step-indicator/step-indicator.md +2 -0
  64. package/dist/docs/step-indicator/styling.md +1 -0
  65. package/dist/docs/switch/styling.md +1 -0
  66. package/dist/docs/switch/switch.md +2 -0
  67. package/dist/docs/tabs/styling.md +1 -0
  68. package/dist/docs/tabs/tabs.md +2 -0
  69. package/dist/docs/textarea/styling.md +1 -0
  70. package/dist/docs/textarea/textarea.md +2 -0
  71. package/dist/docs/textfield/styling.md +1 -0
  72. package/dist/docs/textfield/textfield.md +2 -0
  73. package/dist/index.d.ts +164 -128
  74. package/dist/packages/affix/affix.hydration.test.js +1 -1
  75. package/dist/packages/alert/alert.hydration.test.js +1 -1
  76. package/dist/packages/attention/attention.hydration.test.js +1 -1
  77. package/dist/packages/attention/attention.js +397 -446
  78. package/dist/packages/attention/attention.js.map +4 -4
  79. package/dist/packages/badge/badge.hydration.test.js +1 -1
  80. package/dist/packages/box/box.hydration.test.js +1 -1
  81. package/dist/packages/breadcrumbs/breadcrumbs.hydration.test.js +3 -2
  82. package/dist/packages/button/button.hydration.test.js +1 -1
  83. package/dist/packages/button/button.js +387 -436
  84. package/dist/packages/button/button.js.map +4 -4
  85. package/dist/packages/button/button.stories.d.ts +29 -0
  86. package/dist/packages/button/button.stories.js +176 -2
  87. package/dist/packages/button/styles.d.ts +22 -1
  88. package/dist/packages/button/styles.js +390 -1
  89. package/dist/packages/card/card.hydration.test.js +1 -1
  90. package/dist/packages/checkbox/checkbox.d.ts +5 -3
  91. package/dist/packages/checkbox/checkbox.hydration.test.js +1 -1
  92. package/dist/packages/checkbox/checkbox.js +2 -2
  93. package/dist/packages/checkbox/checkbox.js.map +3 -3
  94. package/dist/packages/checkbox/checkbox.react.stories.d.ts +1 -1
  95. package/dist/packages/checkbox/checkbox.stories.d.ts +2 -2
  96. package/dist/packages/checkbox/react.d.ts +2 -2
  97. package/dist/packages/checkbox-group/checkbox-group.d.ts +5 -3
  98. package/dist/packages/checkbox-group/checkbox-group.hydration.test.js +1 -1
  99. package/dist/packages/checkbox-group/checkbox-group.js +6 -6
  100. package/dist/packages/checkbox-group/checkbox-group.js.map +3 -3
  101. package/dist/packages/checkbox-group/react.d.ts +3 -3
  102. package/dist/packages/datepicker/datepicker.d.ts +22 -30
  103. package/dist/packages/datepicker/datepicker.hydration.test.js +1 -1
  104. package/dist/packages/datepicker/datepicker.js.map +2 -2
  105. package/dist/packages/expandable/expandable.d.ts +11 -32
  106. package/dist/packages/expandable/expandable.hydration.test.js +1 -1
  107. package/dist/packages/expandable/expandable.js.map +2 -2
  108. package/dist/packages/expandable/expandable.react.stories.d.ts +2 -2
  109. package/dist/packages/expandable/react.d.ts +1 -1
  110. package/dist/packages/icon/icon.hydration.test.js +1 -1
  111. package/dist/packages/link/link.hydration.test.js +1 -1
  112. package/dist/packages/link/link.js +420 -190
  113. package/dist/packages/link/link.js.map +4 -4
  114. package/dist/packages/link/styles.d.ts +5 -0
  115. package/dist/packages/link/styles.js +80 -0
  116. package/dist/packages/modal/modal.hydration.test.js +1 -1
  117. package/dist/packages/page-indicator/page-indicator.hydration.test.js +1 -1
  118. package/dist/packages/pagination/pagination.hydration.test.js +1 -1
  119. package/dist/packages/pill/pill.hydration.test.js +1 -1
  120. package/dist/packages/radio/radio.hydration.test.js +1 -1
  121. package/dist/packages/radio/radio.js.map +1 -1
  122. package/dist/packages/radio-group/radio-group.a11y.test.js +6 -2
  123. package/dist/packages/radio-group/radio-group.hydration.test.js +6 -2
  124. package/dist/packages/radio-group/radio-group.js +2 -2
  125. package/dist/packages/radio-group/radio-group.js.map +4 -4
  126. package/dist/packages/select/select.a11y.test.js +6 -2
  127. package/dist/packages/select/select.hydration.test.js +1 -1
  128. package/dist/packages/select/select.test.js +4 -2
  129. package/dist/packages/slider/slider.hydration.test.js +7 -2
  130. package/dist/packages/slider/slider.js.map +1 -1
  131. package/dist/packages/slider/slider.react.stories.js +2 -2
  132. package/dist/packages/slider-thumb/slider-thumb.hydration.test.js +1 -1
  133. package/dist/packages/step/step.hydration.test.js +1 -1
  134. package/dist/packages/step-indicator/step-indicator.hydration.test.js +1 -1
  135. package/dist/packages/switch/switch.hydration.test.js +1 -1
  136. package/dist/packages/tab/tab.hydration.test.js +1 -1
  137. package/dist/packages/tab-panel/tab-panel.hydration.test.js +1 -1
  138. package/dist/packages/tabs/tabs.a11y.test.js +1 -1
  139. package/dist/packages/tabs/tabs.hydration.test.js +1 -1
  140. package/dist/packages/tabs/tabs.test.js +3 -3
  141. package/dist/packages/textarea/textarea.hydration.test.js +1 -1
  142. package/dist/packages/textfield/textfield.hydration.test.js +1 -1
  143. package/dist/web-types.json +91 -28
  144. package/eik/index.js +115 -0
  145. package/package.json +7 -7
  146. package/dist/docs/modal-footer/accessibility.md +0 -1
  147. package/dist/docs/modal-footer/examples.md +0 -1
  148. package/dist/docs/modal-footer/usage.md +0 -1
  149. package/dist/docs/modal-header/accessibility.md +0 -1
  150. package/dist/docs/modal-header/examples.md +0 -1
  151. package/dist/docs/modal-header/usage.md +0 -1
  152. package/dist/docs/radio/accessibility.md +0 -1
  153. package/dist/docs/radio/examples.md +0 -1
  154. package/dist/docs/radio/usage.md +0 -1
  155. package/dist/packages/button/styles/w-button.styles.d.ts +0 -1
  156. package/dist/packages/button/styles/w-button.styles.js +0 -282
  157. package/dist/packages/link/styles/w-link.styles.d.ts +0 -1
  158. package/dist/packages/link/styles/w-link.styles.js +0 -213
@@ -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
+
@@ -0,0 +1,492 @@
1
+ # CheckboxGroup (w-checkbox-group)
2
+
3
+ ## Description
4
+
5
+ Use `w-checkbox-group` when several checkboxes share one label, help text, optional indicator, or required validation.
6
+
7
+ ## Usage
8
+
9
+ Checkbox lets users select one or more options. Use it for independent yes/no choices, multi-select lists, and terms or consent confirmations.
10
+
11
+ Use `w-checkbox-group` when several checkboxes share one label, help text, optional indicator, or required validation.
12
+
13
+ ### Basic Checkbox
14
+
15
+ ```html
16
+ <w-checkbox name="newsletter" value="yes">Sign up for updates</w-checkbox>
17
+ ```
18
+
19
+ The slotted text becomes the checkbox label.
20
+
21
+ ### Checked State
22
+
23
+ Use `checked` when the checkbox should be selected by default.
24
+
25
+ ```html
26
+ <w-checkbox name="alerts" value="email" checked>Email alerts</w-checkbox>
27
+ ```
28
+
29
+ Listen for the `change` event when you need to react to user changes.
30
+
31
+ ```html
32
+ <w-checkbox id="newsletter" name="newsletter" value="yes">Sign up for updates</w-checkbox>
33
+
34
+ <script>
35
+ const checkbox = document.querySelector('#newsletter');
36
+
37
+ checkbox.addEventListener('change', () => {
38
+ console.log(checkbox.checked);
39
+ });
40
+ </script>
41
+ ```
42
+
43
+ ### Form Submission
44
+
45
+ `w-checkbox` is form-associated. When checked, it submits its `name` and `value` with the form. When unchecked or disabled, it submits nothing.
46
+
47
+ ```html
48
+ <form>
49
+ <w-checkbox name="newsletter" value="yes">Sign up for updates</w-checkbox>
50
+ <w-button type="submit">Submit</w-button>
51
+ </form>
52
+ ```
53
+
54
+ If no `value` is set, the submitted value defaults to `on`.
55
+
56
+ ### Required
57
+
58
+ Use `required` when one standalone checkbox must be checked before form submission, such as accepting terms.
59
+
60
+ ```html
61
+ <form>
62
+ <w-checkbox name="terms" value="accepted" required>Accept the terms</w-checkbox>
63
+ <w-button type="submit">Continue</w-button>
64
+ </form>
65
+ ```
66
+
67
+ For a set of options where at least one option is required, put `required` on `w-checkbox-group` instead.
68
+
69
+ ### Checkbox Group
70
+
71
+ Use `w-checkbox-group` to group related options under a shared label and help text.
72
+
73
+ ```html
74
+ <w-checkbox-group label="Interests" help-text="Select all that apply" name="interests">
75
+ <w-checkbox value="housing">Housing</w-checkbox>
76
+ <w-checkbox value="jobs">Jobs</w-checkbox>
77
+ <w-checkbox value="travel">Travel</w-checkbox>
78
+ </w-checkbox-group>
79
+ ```
80
+
81
+ The group name is applied to child checkboxes that do not have their own `name`.
82
+
83
+ ### Indeterminate
84
+
85
+ Use `indeterminate` when a parent checkbox represents a mixed set of child selections.
86
+
87
+ ```html
88
+ <w-checkbox name="all-notifications" indeterminate>All notifications</w-checkbox>
89
+ ```
90
+
91
+ Indeterminate is a visual state. When the user clicks the checkbox, the indeterminate state is cleared and the checkbox becomes checked.
92
+
93
+ ### Invalid
94
+
95
+ Set `invalid` when validation is managed outside the component.
96
+
97
+ ```html
98
+ <w-checkbox name="terms" value="accepted" invalid>Accept the terms</w-checkbox>
99
+ ```
100
+
101
+ When possible, place clear error text near the checkbox or group so users know how to correct the error.
102
+
103
+ ## Accessibility
104
+
105
+ 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.
106
+
107
+ ### Provide A Group Label
108
+
109
+ Use `label` to describe the shared question or topic.
110
+
111
+ ```html
112
+ <w-checkbox-group label="Interests" name="interests">
113
+ <w-checkbox value="housing">Housing</w-checkbox>
114
+ <w-checkbox value="jobs">Jobs</w-checkbox>
115
+ <w-checkbox value="travel">Travel</w-checkbox>
116
+ </w-checkbox-group>
117
+ ```
118
+
119
+ The group label should not duplicate every option label. It should explain what the options are about.
120
+
121
+ ### Use Help Text For Extra Context
122
+
123
+ Use `help-text` for instructions, constraints, or validation feedback.
124
+
125
+ ```html
126
+ <w-checkbox-group label="Interests" help-text="Select all that apply" name="interests">
127
+ <w-checkbox value="housing">Housing</w-checkbox>
128
+ <w-checkbox value="jobs">Jobs</w-checkbox>
129
+ <w-checkbox value="travel">Travel</w-checkbox>
130
+ </w-checkbox-group>
131
+ ```
132
+
133
+ Keep help text short and actionable.
134
+
135
+ ### Required Groups
136
+
137
+ Use `required` on the group when at least one option must be selected.
138
+
139
+ ```html
140
+ <w-checkbox-group label="Preferences" required help-text="Choose at least one" name="preferences">
141
+ <w-checkbox value="email">Email</w-checkbox>
142
+ <w-checkbox value="sms">SMS</w-checkbox>
143
+ </w-checkbox-group>
144
+ ```
145
+
146
+ Do not put `required` on each child checkbox for a "choose at least one" requirement. That would mean every option must be selected.
147
+
148
+ ### Validation Feedback
149
+
150
+ Do not rely on invalid styling alone. Provide clear help text that explains what the user needs to do.
151
+
152
+ ```html
153
+ <w-checkbox-group label="Preferences" invalid help-text="Select at least one option" name="preferences">
154
+ <w-checkbox value="email">Email</w-checkbox>
155
+ <w-checkbox value="sms">SMS</w-checkbox>
156
+ </w-checkbox-group>
157
+ ```
158
+
159
+ When the group is invalid, the invalid state is also shared with child checkboxes for consistent styling and accessibility state.
160
+
161
+ ### Checkbox Labels
162
+
163
+ Each child checkbox still needs its own clear label.
164
+
165
+ ```html
166
+ <w-checkbox-group label="Contact preferences" name="contact">
167
+ <w-checkbox value="email">Email</w-checkbox>
168
+ <w-checkbox value="sms">SMS</w-checkbox>
169
+ <w-checkbox value="push">Push notifications</w-checkbox>
170
+ </w-checkbox-group>
171
+ ```
172
+
173
+ Avoid option labels that only make sense visually, such as "Yes" or "This one", unless the group label gives enough context.
174
+
175
+ ## Examples
176
+
177
+ ### Basic
178
+
179
+ <elements-example>
180
+
181
+ ```html
182
+ <w-checkbox name="newsletter" value="yes">Sign up for updates</w-checkbox>
183
+ ```
184
+
185
+ </elements-example>
186
+
187
+ ### Checked
188
+
189
+ <elements-example>
190
+
191
+ ```html
192
+ <w-checkbox name="alerts" value="email" checked>Email alerts</w-checkbox>
193
+ ```
194
+
195
+ </elements-example>
196
+
197
+ ### Required
198
+
199
+ <elements-example>
200
+
201
+ ```html
202
+ <form>
203
+ <w-checkbox name="terms" value="accepted" required>Accept the terms</w-checkbox>
204
+ <w-button type="submit">Continue</w-button>
205
+ </form>
206
+ ```
207
+
208
+ </elements-example>
209
+
210
+ ### Invalid
211
+
212
+ <elements-example>
213
+
214
+ ```html
215
+ <w-checkbox name="terms" value="accepted" invalid>Accept the terms</w-checkbox>
216
+ ```
217
+
218
+ </elements-example>
219
+
220
+ ### Disabled
221
+
222
+ <elements-example>
223
+
224
+ ```html
225
+ <w-checkbox name="newsletter" value="yes" disabled>Sign up for updates</w-checkbox>
226
+ ```
227
+
228
+ </elements-example>
229
+
230
+ ### Indeterminate
231
+
232
+ <elements-example>
233
+
234
+ ```html
235
+ <w-checkbox name="all-notifications" indeterminate>All notifications</w-checkbox>
236
+ ```
237
+
238
+ </elements-example>
239
+
240
+ ### Checkbox Group
241
+
242
+ <elements-example>
243
+
244
+ ```html
245
+ <w-checkbox-group label="Interests" help-text="Select all that apply" name="interests">
246
+ <w-checkbox value="housing">Housing</w-checkbox>
247
+ <w-checkbox value="jobs">Jobs</w-checkbox>
248
+ <w-checkbox value="travel">Travel</w-checkbox>
249
+ </w-checkbox-group>
250
+ ```
251
+
252
+ </elements-example>
253
+
254
+ ### Required Checkbox Group
255
+
256
+ <elements-example>
257
+
258
+ ```html
259
+ <w-checkbox-group label="Preferences" required help-text="Choose at least one" name="preferences">
260
+ <w-checkbox value="email">Email</w-checkbox>
261
+ <w-checkbox value="sms">SMS</w-checkbox>
262
+ <w-checkbox value="push">Push notifications</w-checkbox>
263
+ </w-checkbox-group>
264
+ ```
265
+
266
+ </elements-example>
267
+
268
+ ### Form Associated
269
+
270
+ <elements-example>
271
+
272
+ ```html
273
+ <form>
274
+ <w-checkbox name="newsletter" value="yes">Sign up for updates</w-checkbox>
275
+ <w-button type="submit">Submit</w-button>
276
+ </form>
277
+ ```
278
+
279
+ </elements-example>
280
+
281
+ ## Styling API
282
+
283
+ This section documents the supported styling hooks for `<w-checkbox>`.
284
+
285
+ Use these hooks to customize appearance without relying on internal structure or selectors.
286
+
287
+ ### Parts
288
+
289
+ The checkbox exposes a small set of parts that can be targeted for last‑mile layout or typography tweaks.
290
+
291
+ | Part | Targets | Typical use |
292
+ |---|---|---|
293
+ | `base` | wrapper element | layout adjustments (spacing, alignment) |
294
+ | `control` | checkbox control (box) | minor alignment or sizing tweaks |
295
+ | `input` | native `<input type="checkbox">` | focus / outline adjustments |
296
+ | `label` | label content | typography tweaks |
297
+
298
+ Example:
299
+
300
+ ```css
301
+ w-checkbox::part(label) {
302
+ font-weight: 600;
303
+ }
304
+
305
+ w-checkbox::part(control) {
306
+ margin-top: 1px;
307
+ }
308
+ ```
309
+
310
+ Parts are intended as an **escape hatch**.
311
+ Prefer component tokens for anything state‑ or size‑related.
312
+
313
+ ### Component tokens (`--w-c-checkbox-*`)
314
+
315
+ Component tokens act as inputs to the checkbox styling.
316
+ They can be set directly on the component or inherited from a parent container.
317
+
318
+ ```css
319
+ .settings-panel {
320
+ --w-c-checkbox-gap: 12px;
321
+ }
322
+ ```
323
+
324
+ Defaults are defined internally; setting a token is always optional.
325
+
326
+
327
+ #### Layout & size
328
+
329
+ | Token | Purpose | Default |
330
+ |---|---|---|
331
+ | `--w-c-checkbox-gap` | space between control and label | `8px` |
332
+ | `--w-c-checkbox-control-size` | width/height of the control | `2rem` |
333
+ | `--w-c-checkbox-radius` | border radius of the control | `4px` |
334
+ | `--w-c-checkbox-border-width` | border width | `1px` |
335
+
336
+
337
+ #### Colors
338
+
339
+ | Token | Purpose | Default |
340
+ |---|---|---|
341
+ | `--w-c-checkbox-bg` | control background | theme default |
342
+ | `--w-c-checkbox-border-color` | control border color | theme default |
343
+ | `--w-c-checkbox-bg-checked` | background when checked | theme default |
344
+ | `--w-c-checkbox-border-color-checked` | border when checked | theme default |
345
+ | `--w-c-checkbox-icon-color` | icon color | theme default |
346
+
347
+
348
+ #### Invalid state
349
+
350
+ | Token | Purpose | Default |
351
+ |---|---|---|
352
+ | `--w-c-checkbox-border-color-invalid` | border color when invalid | theme default |
353
+ | `--w-c-checkbox-bg-invalid-checked` | background when invalid and checked | theme default |
354
+
355
+
356
+ #### Disabled state
357
+
358
+ | Token | Purpose | Default |
359
+ |---|---|---|
360
+ | `--w-c-checkbox-bg-disabled` | background when disabled | theme default |
361
+ | `--w-c-checkbox-border-color-disabled` | border when disabled | theme default |
362
+ | `--w-c-checkbox-bg-disabled-checked` | background when disabled and checked | theme default |
363
+
364
+ #### Focus
365
+
366
+ | Token | Purpose | Default |
367
+ |---|---|---|
368
+ | `--w-c-checkbox-outline-width` | focus outline width | `2px` |
369
+ | `--w-c-checkbox-outline-color` | focus outline color | theme default |
370
+ | `--w-c-checkbox-outline-offset` | focus outline offset | theme default |
371
+
372
+ #### Motion
373
+
374
+ | Token | Purpose | Default |
375
+ |---|---|---|
376
+ | `--w-c-checkbox-transition` | transition for control | `150ms cubic-bezier(0.4, 0, 0.2, 1)` |
377
+
378
+ Transitions are automatically disabled when `prefers-reduced-motion: reduce` is active.
379
+
380
+ ### Examples
381
+
382
+ #### Compact checkbox
383
+
384
+ ```css
385
+ .filters w-checkbox {
386
+ --w-c-checkbox-gap: 4px;
387
+ --w-c-checkbox-control-size: 1.6rem;
388
+ }
389
+ ```
390
+
391
+ #### Rounded checkbox
392
+
393
+ ```css
394
+ w-checkbox {
395
+ --w-c-checkbox-radius: 9999px;
396
+ }
397
+ ```
398
+
399
+ #### Contextual color override (advanced)
400
+
401
+ ```css
402
+ .danger-zone w-checkbox {
403
+ --w-c-checkbox-border-color-checked: red;
404
+ }
405
+ ```
406
+
407
+ ### Guidelines
408
+
409
+ - Prefer **component tokens** for size, spacing, and state styling
410
+ - Use **parts** only for small, local tweaks
411
+ - Avoid relying on internal class names or selectors
412
+ - If multiple tokens are required to achieve a look, consider whether a new variant or design token is more appropriate
413
+
414
+ ## `<w-checkbox-group>` API
415
+
416
+ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
417
+
418
+ ### Properties
419
+
420
+ | Name | Type | Default | Summary |
421
+ |-|-|-|-|
422
+ | help-text | `string` | `-` | Help text displayed below the checkbox group. |
423
+ | invalid | `boolean` | `false` | Whether the checkbox group is visually invalid. |
424
+ | label | `string` | `-` | The group label displayed above the checkboxes. |
425
+ | name | `string` | `-` | The name applied to child checkboxes when they do not provide one. |
426
+ | optional | `boolean` | `false` | Whether to show optional text next to the label. |
427
+ | required | `boolean` | `false` | Whether at least one checkbox in the group must be selected. |
428
+ | shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }` | - |
429
+
430
+ ### Property Details
431
+
432
+ #### help-text
433
+
434
+ Help text displayed below the checkbox group.
435
+
436
+ Use this for supporting guidance or validation feedback. When required validation fails, the group replaces this text with the localized required message.
437
+
438
+ - Type: `string`
439
+ - Default: `-`
440
+
441
+ #### invalid
442
+
443
+ Whether the checkbox group is visually invalid.
444
+
445
+ 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.
446
+
447
+ - Type: `boolean`
448
+ - Default: `false`
449
+
450
+ #### label
451
+
452
+ The group label displayed above the checkboxes.
453
+
454
+ Use this to describe the shared question or topic for the checkbox options. The label is connected to the internal group for assistive technologies.
455
+
456
+ - Type: `string`
457
+ - Default: `-`
458
+
459
+ #### name
460
+
461
+ The name applied to child checkboxes when they do not provide one.
462
+
463
+ 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`.
464
+
465
+ - Type: `string`
466
+ - Default: `-`
467
+
468
+ #### optional
469
+
470
+ Whether to show optional text next to the label.
471
+
472
+ Use this to indicate that selecting an option from the group is not required.
473
+
474
+ - Type: `boolean`
475
+ - Default: `false`
476
+
477
+ #### required
478
+
479
+ Whether at least one checkbox in the group must be selected.
480
+
481
+ Required validation is managed by the group. The individual checkboxes provide the submitted form values.
482
+
483
+ - Type: `boolean`
484
+ - Default: `false`
485
+
486
+ #### shadowRootOptions (JS only)
487
+
488
+
489
+
490
+ - Type: `object`
491
+ - Default: `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }`
492
+