@warp-ds/elements 2.10.0-next.1 → 2.10.0-next.11

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 (254) hide show
  1. package/README.md +4 -0
  2. package/dist/api.js +1 -1
  3. package/dist/api.js.map +1 -1
  4. package/dist/custom-elements.json +233 -87
  5. package/dist/docs/affix/affix.md +2 -2
  6. package/dist/docs/affix/styling.md +1 -0
  7. package/dist/docs/alert/alert.md +2 -2
  8. package/dist/docs/alert/styling.md +1 -0
  9. package/dist/docs/attention/attention.md +2 -0
  10. package/dist/docs/attention/styling.md +1 -0
  11. package/dist/docs/badge/badge.md +2 -0
  12. package/dist/docs/badge/styling.md +1 -0
  13. package/dist/docs/box/box.md +22 -40
  14. package/dist/docs/box/examples.md +20 -38
  15. package/dist/docs/box/styling.md +1 -0
  16. package/dist/docs/breadcrumbs/breadcrumbs.md +8 -2
  17. package/dist/docs/breadcrumbs/examples.md +7 -1
  18. package/dist/docs/breadcrumbs/styling.md +1 -0
  19. package/dist/docs/button/button.md +73 -2
  20. package/dist/docs/button/styling.md +72 -0
  21. package/dist/docs/card/accessibility.md +74 -0
  22. package/dist/docs/card/api.md +9 -3
  23. package/dist/docs/card/card.md +236 -5
  24. package/dist/docs/card/examples.md +75 -0
  25. package/dist/docs/card/styling.md +1 -0
  26. package/dist/docs/card/usage.md +76 -0
  27. package/dist/docs/checkbox/api.md +128 -0
  28. package/dist/docs/checkbox/checkbox.md +134 -0
  29. package/dist/docs/checkbox-group/accessibility.md +71 -0
  30. package/dist/docs/checkbox-group/api.md +79 -0
  31. package/dist/docs/checkbox-group/checkbox-group.md +492 -0
  32. package/dist/docs/checkbox-group/examples.md +105 -0
  33. package/dist/docs/checkbox-group/styling.md +132 -0
  34. package/dist/docs/checkbox-group/usage.md +95 -0
  35. package/dist/docs/combobox/accessibility.md +71 -0
  36. package/dist/docs/combobox/api.md +60 -30
  37. package/dist/docs/combobox/combobox.md +205 -32
  38. package/dist/docs/combobox/examples.md +44 -0
  39. package/dist/docs/combobox/styling.md +1 -0
  40. package/dist/docs/combobox/usage.md +28 -0
  41. package/dist/docs/datepicker/accessibility.md +25 -0
  42. package/dist/docs/datepicker/api.md +22 -14
  43. package/dist/docs/datepicker/datepicker.md +208 -16
  44. package/dist/docs/datepicker/examples.md +75 -0
  45. package/dist/docs/datepicker/styling.md +1 -0
  46. package/dist/docs/datepicker/usage.md +84 -0
  47. package/dist/docs/expandable/api.md +20 -32
  48. package/dist/docs/expandable/examples.md +54 -0
  49. package/dist/docs/expandable/expandable.md +74 -32
  50. package/dist/docs/expandable/styling.md +1 -0
  51. package/dist/docs/icon/accessibility.md +5 -0
  52. package/dist/docs/icon/api.md +43 -0
  53. package/dist/docs/icon/examples.md +45 -0
  54. package/dist/docs/icon/icon.md +115 -0
  55. package/dist/docs/icon/styling.md +1 -0
  56. package/dist/docs/icon/usage.md +11 -0
  57. package/dist/docs/index.md +46 -0
  58. package/dist/docs/link/api.md +18 -22
  59. package/dist/docs/link/examples.md +75 -0
  60. package/dist/docs/link/link.md +113 -24
  61. package/dist/docs/link/styling.md +1 -0
  62. package/dist/docs/link/usage.md +18 -0
  63. package/dist/docs/modal/modal.md +2 -0
  64. package/dist/docs/modal/styling.md +1 -0
  65. package/dist/docs/modal-footer/modal-footer.md +0 -6
  66. package/dist/docs/modal-header/modal-header.md +0 -6
  67. package/dist/docs/page-indicator/page-indicator.md +2 -0
  68. package/dist/docs/page-indicator/styling.md +1 -0
  69. package/dist/docs/pagination/pagination.md +2 -0
  70. package/dist/docs/pagination/styling.md +1 -0
  71. package/dist/docs/pill/pill.md +2 -0
  72. package/dist/docs/pill/styling.md +1 -0
  73. package/dist/docs/radio/radio.md +1 -7
  74. package/dist/docs/select/select.md +2 -0
  75. package/dist/docs/select/styling.md +1 -0
  76. package/dist/docs/slider/slider.md +2 -0
  77. package/dist/docs/slider/styling.md +1 -0
  78. package/dist/docs/slider-thumb/slider-thumb.md +2 -0
  79. package/dist/docs/slider-thumb/styling.md +1 -0
  80. package/dist/docs/step-indicator/step-indicator.md +2 -0
  81. package/dist/docs/step-indicator/styling.md +1 -0
  82. package/dist/docs/switch/styling.md +1 -0
  83. package/dist/docs/switch/switch.md +2 -0
  84. package/dist/docs/tabs/styling.md +1 -0
  85. package/dist/docs/tabs/tabs.md +2 -0
  86. package/dist/docs/textarea/styling.md +1 -0
  87. package/dist/docs/textarea/textarea.md +2 -0
  88. package/dist/docs/textfield/styling.md +1 -0
  89. package/dist/docs/textfield/textfield.md +2 -0
  90. package/dist/index.d.ts +932 -341
  91. package/dist/packages/affix/affix.hydration.test.js +1 -1
  92. package/dist/packages/affix/affix.js +4 -4
  93. package/dist/packages/affix/affix.js.map +4 -4
  94. package/dist/packages/alert/alert.hydration.test.js +1 -1
  95. package/dist/packages/alert/alert.js +3 -3
  96. package/dist/packages/alert/alert.js.map +3 -3
  97. package/dist/packages/attention/attention.hydration.test.js +1 -1
  98. package/dist/packages/attention/attention.js +397 -446
  99. package/dist/packages/attention/attention.js.map +4 -4
  100. package/dist/packages/attention/attention.test.js +1 -1
  101. package/dist/packages/badge/badge.hydration.test.js +1 -1
  102. package/dist/packages/box/box.hydration.test.js +1 -1
  103. package/dist/packages/box/box.js +1 -1
  104. package/dist/packages/box/box.js.map +1 -1
  105. package/dist/packages/breadcrumbs/breadcrumbs.hydration.test.js +3 -2
  106. package/dist/packages/breadcrumbs/breadcrumbs.js +4 -4
  107. package/dist/packages/breadcrumbs/breadcrumbs.js.map +3 -3
  108. package/dist/packages/button/button.hydration.test.js +1 -1
  109. package/dist/packages/button/button.js +387 -436
  110. package/dist/packages/button/button.js.map +4 -4
  111. package/dist/packages/button/button.stories.d.ts +29 -0
  112. package/dist/packages/button/button.stories.js +176 -2
  113. package/dist/packages/button/styles.d.ts +22 -1
  114. package/dist/packages/button/styles.js +390 -1
  115. package/dist/packages/card/card.d.ts +9 -6
  116. package/dist/packages/card/card.hydration.test.js +1 -1
  117. package/dist/packages/card/card.js +3 -3
  118. package/dist/packages/card/card.js.map +4 -4
  119. package/dist/packages/checkbox/checkbox.d.ts +45 -14
  120. package/dist/packages/checkbox/checkbox.hydration.test.js +1 -1
  121. package/dist/packages/checkbox/checkbox.js +3 -3
  122. package/dist/packages/checkbox/checkbox.js.map +3 -3
  123. package/dist/packages/checkbox/checkbox.react.stories.d.ts +1 -1
  124. package/dist/packages/checkbox/checkbox.stories.d.ts +2 -2
  125. package/dist/packages/checkbox/checkbox.test.js +1 -1
  126. package/dist/packages/checkbox/react.d.ts +2 -2
  127. package/dist/packages/checkbox-group/checkbox-group.a11y.test.js +1 -1
  128. package/dist/packages/checkbox-group/checkbox-group.d.ts +35 -8
  129. package/dist/packages/checkbox-group/checkbox-group.hydration.test.js +1 -1
  130. package/dist/packages/checkbox-group/checkbox-group.js +6 -6
  131. package/dist/packages/checkbox-group/checkbox-group.js.map +4 -4
  132. package/dist/packages/checkbox-group/react.d.ts +3 -3
  133. package/dist/packages/combobox/combobox.a11y.test.js +24 -0
  134. package/dist/packages/combobox/combobox.d.ts +65 -45
  135. package/dist/packages/combobox/combobox.hydration.test.js +39 -1
  136. package/dist/packages/combobox/combobox.js +21 -21
  137. package/dist/packages/combobox/combobox.js.map +4 -4
  138. package/dist/packages/combobox/combobox.stories.js +28 -15
  139. package/dist/packages/combobox/combobox.test.js +110 -0
  140. package/dist/packages/datepicker/DatePicker.test.js +1 -1
  141. package/dist/packages/datepicker/datepicker.d.ts +22 -30
  142. package/dist/packages/datepicker/datepicker.hydration.test.js +1 -1
  143. package/dist/packages/datepicker/datepicker.js +49 -49
  144. package/dist/packages/datepicker/datepicker.js.map +4 -4
  145. package/dist/packages/datepicker/datepicker.test.js +1 -1
  146. package/dist/packages/expandable/expandable.d.ts +11 -32
  147. package/dist/packages/expandable/expandable.hydration.test.js +1 -1
  148. package/dist/packages/expandable/expandable.js +11 -11
  149. package/dist/packages/expandable/expandable.js.map +3 -3
  150. package/dist/packages/expandable/expandable.react.stories.d.ts +2 -2
  151. package/dist/packages/expandable/react.d.ts +1 -1
  152. package/dist/packages/icon/icon.d.ts +16 -4
  153. package/dist/packages/icon/icon.hydration.test.js +1 -1
  154. package/dist/packages/icon/icon.js +2 -2
  155. package/dist/packages/icon/icon.js.map +3 -3
  156. package/dist/packages/icon/icon.react.stories.d.ts +1 -1
  157. package/dist/packages/icon/react.d.ts +2 -2
  158. package/dist/packages/link/link.d.ts +15 -16
  159. package/dist/packages/link/link.hydration.test.js +1 -1
  160. package/dist/packages/link/link.js +420 -190
  161. package/dist/packages/link/link.js.map +4 -4
  162. package/dist/packages/link/link.test.js +1 -1
  163. package/dist/packages/link/styles.d.ts +5 -0
  164. package/dist/packages/link/styles.js +80 -0
  165. package/dist/packages/modal/modal.d.ts +1 -0
  166. package/dist/packages/modal/modal.hydration.test.js +1 -1
  167. package/dist/packages/modal/modal.js +4 -4
  168. package/dist/packages/modal/modal.js.map +3 -3
  169. package/dist/packages/modal/modal.react.stories.d.ts +4 -4
  170. package/dist/packages/modal/modal.react.stories.js +9 -1
  171. package/dist/packages/modal/react.d.ts +34 -4
  172. package/dist/packages/modal/react.js +30 -0
  173. package/dist/packages/modal-header/modal-header.js +11 -9
  174. package/dist/packages/modal-header/modal-header.js.map +4 -4
  175. package/dist/packages/page-indicator/page-indicator.hydration.test.js +1 -1
  176. package/dist/packages/page-indicator/page-indicator.js +5 -5
  177. package/dist/packages/page-indicator/page-indicator.js.map +3 -3
  178. package/dist/packages/pagination/pagination.hydration.test.js +1 -1
  179. package/dist/packages/pagination/pagination.js +4 -4
  180. package/dist/packages/pagination/pagination.js.map +4 -4
  181. package/dist/packages/pagination/pagination.test.js +1 -1
  182. package/dist/packages/pill/pill.hydration.test.js +1 -1
  183. package/dist/packages/pill/pill.js +3 -3
  184. package/dist/packages/pill/pill.js.map +4 -4
  185. package/dist/packages/radio/radio.hydration.test.js +1 -1
  186. package/dist/packages/radio/radio.js +3 -3
  187. package/dist/packages/radio/radio.js.map +3 -3
  188. package/dist/packages/radio/radio.test.js +1 -1
  189. package/dist/packages/radio-group/radio-group.a11y.test.js +7 -3
  190. package/dist/packages/radio-group/radio-group.hydration.test.js +6 -2
  191. package/dist/packages/radio-group/radio-group.js +11 -11
  192. package/dist/packages/radio-group/radio-group.js.map +4 -4
  193. package/dist/packages/select/select.a11y.test.js +6 -2
  194. package/dist/packages/select/select.hydration.test.js +1 -1
  195. package/dist/packages/select/select.js +7 -7
  196. package/dist/packages/select/select.js.map +4 -4
  197. package/dist/packages/select/select.test.js +4 -2
  198. package/dist/packages/slider/slider.hydration.test.js +7 -2
  199. package/dist/packages/slider/slider.js +5 -5
  200. package/dist/packages/slider/slider.js.map +4 -4
  201. package/dist/packages/slider/slider.react.stories.js +2 -2
  202. package/dist/packages/slider/slider.test.js +1 -1
  203. package/dist/packages/slider-thumb/slider-thumb.hydration.test.js +1 -1
  204. package/dist/packages/slider-thumb/slider-thumb.js +20 -20
  205. package/dist/packages/slider-thumb/slider-thumb.js.map +4 -4
  206. package/dist/packages/step/step.hydration.test.js +1 -1
  207. package/dist/packages/step/step.js +8 -8
  208. package/dist/packages/step/step.js.map +4 -4
  209. package/dist/packages/step-indicator/step-indicator.hydration.test.js +1 -1
  210. package/dist/packages/switch/switch.a11y.test.js +1 -1
  211. package/dist/packages/switch/switch.hydration.test.js +1 -1
  212. package/dist/packages/switch/switch.js +1 -1
  213. package/dist/packages/switch/switch.js.map +1 -1
  214. package/dist/packages/tab/tab.hydration.test.js +1 -1
  215. package/dist/packages/tab/tab.js +10 -10
  216. package/dist/packages/tab/tab.js.map +2 -2
  217. package/dist/packages/tab-panel/tab-panel.hydration.test.js +1 -1
  218. package/dist/packages/tab-panel/tab-panel.js +3 -3
  219. package/dist/packages/tab-panel/tab-panel.js.map +2 -2
  220. package/dist/packages/tabs/tabs.a11y.test.js +2 -2
  221. package/dist/packages/tabs/tabs.hydration.test.js +1 -1
  222. package/dist/packages/tabs/tabs.js +1 -1
  223. package/dist/packages/tabs/tabs.js.map +2 -2
  224. package/dist/packages/tabs/tabs.test.js +4 -4
  225. package/dist/packages/textarea/textarea.hydration.test.js +1 -1
  226. package/dist/packages/textarea/textarea.js +4 -4
  227. package/dist/packages/textarea/textarea.js.map +3 -3
  228. package/dist/packages/textarea/textarea.test.js +1 -1
  229. package/dist/packages/textfield/textfield.hydration.test.js +1 -1
  230. package/dist/packages/textfield/textfield.js +1 -1
  231. package/dist/packages/textfield/textfield.js.map +1 -1
  232. package/dist/packages/textfield/textfield.test.js +1 -1
  233. package/dist/packages/toast/toast.js +6 -6
  234. package/dist/packages/toast/toast.js.map +4 -4
  235. package/dist/packages/toast/toast.stories.d.ts +1 -5
  236. package/dist/packages/toast/toast.stories.js +0 -17
  237. package/dist/packages/toast-container/toast-container.js +2 -2
  238. package/dist/packages/toast-container/toast-container.js.map +2 -2
  239. package/dist/web-types.json +238 -103
  240. package/eik/index.js +2536 -0
  241. package/package.json +15 -9
  242. package/dist/docs/modal-footer/accessibility.md +0 -1
  243. package/dist/docs/modal-footer/examples.md +0 -1
  244. package/dist/docs/modal-footer/usage.md +0 -1
  245. package/dist/docs/modal-header/accessibility.md +0 -1
  246. package/dist/docs/modal-header/examples.md +0 -1
  247. package/dist/docs/modal-header/usage.md +0 -1
  248. package/dist/docs/radio/accessibility.md +0 -1
  249. package/dist/docs/radio/examples.md +0 -1
  250. package/dist/docs/radio/usage.md +0 -1
  251. package/dist/packages/button/styles/w-button.styles.d.ts +0 -1
  252. package/dist/packages/button/styles/w-button.styles.js +0 -282
  253. package/dist/packages/link/styles/w-link.styles.d.ts +0 -1
  254. package/dist/packages/link/styles/w-link.styles.js +0 -213
@@ -0,0 +1,105 @@
1
+ ## Examples
2
+
3
+ ### Basic
4
+
5
+ <elements-example>
6
+
7
+ ```html
8
+ <w-checkbox name="newsletter" value="yes">Sign up for updates</w-checkbox>
9
+ ```
10
+
11
+ </elements-example>
12
+
13
+ ### Checked
14
+
15
+ <elements-example>
16
+
17
+ ```html
18
+ <w-checkbox name="alerts" value="email" checked>Email alerts</w-checkbox>
19
+ ```
20
+
21
+ </elements-example>
22
+
23
+ ### Required
24
+
25
+ <elements-example>
26
+
27
+ ```html
28
+ <form>
29
+ <w-checkbox name="terms" value="accepted" required>Accept the terms</w-checkbox>
30
+ <w-button type="submit">Continue</w-button>
31
+ </form>
32
+ ```
33
+
34
+ </elements-example>
35
+
36
+ ### Invalid
37
+
38
+ <elements-example>
39
+
40
+ ```html
41
+ <w-checkbox name="terms" value="accepted" invalid>Accept the terms</w-checkbox>
42
+ ```
43
+
44
+ </elements-example>
45
+
46
+ ### Disabled
47
+
48
+ <elements-example>
49
+
50
+ ```html
51
+ <w-checkbox name="newsletter" value="yes" disabled>Sign up for updates</w-checkbox>
52
+ ```
53
+
54
+ </elements-example>
55
+
56
+ ### Indeterminate
57
+
58
+ <elements-example>
59
+
60
+ ```html
61
+ <w-checkbox name="all-notifications" indeterminate>All notifications</w-checkbox>
62
+ ```
63
+
64
+ </elements-example>
65
+
66
+ ### Checkbox Group
67
+
68
+ <elements-example>
69
+
70
+ ```html
71
+ <w-checkbox-group label="Interests" help-text="Select all that apply" name="interests">
72
+ <w-checkbox value="housing">Housing</w-checkbox>
73
+ <w-checkbox value="jobs">Jobs</w-checkbox>
74
+ <w-checkbox value="travel">Travel</w-checkbox>
75
+ </w-checkbox-group>
76
+ ```
77
+
78
+ </elements-example>
79
+
80
+ ### Required Checkbox Group
81
+
82
+ <elements-example>
83
+
84
+ ```html
85
+ <w-checkbox-group label="Preferences" required help-text="Choose at least one" name="preferences">
86
+ <w-checkbox value="email">Email</w-checkbox>
87
+ <w-checkbox value="sms">SMS</w-checkbox>
88
+ <w-checkbox value="push">Push notifications</w-checkbox>
89
+ </w-checkbox-group>
90
+ ```
91
+
92
+ </elements-example>
93
+
94
+ ### Form Associated
95
+
96
+ <elements-example>
97
+
98
+ ```html
99
+ <form>
100
+ <w-checkbox name="newsletter" value="yes">Sign up for updates</w-checkbox>
101
+ <w-button type="submit">Submit</w-button>
102
+ </form>
103
+ ```
104
+
105
+ </elements-example>
@@ -0,0 +1,132 @@
1
+ ## Styling API
2
+
3
+ This section documents the supported styling hooks for `<w-checkbox>`.
4
+
5
+ Use these hooks to customize appearance without relying on internal structure or selectors.
6
+
7
+ ### Parts
8
+
9
+ The checkbox exposes a small set of parts that can be targeted for last‑mile layout or typography tweaks.
10
+
11
+ | Part | Targets | Typical use |
12
+ |---|---|---|
13
+ | `base` | wrapper element | layout adjustments (spacing, alignment) |
14
+ | `control` | checkbox control (box) | minor alignment or sizing tweaks |
15
+ | `input` | native `<input type="checkbox">` | focus / outline adjustments |
16
+ | `label` | label content | typography tweaks |
17
+
18
+ Example:
19
+
20
+ ```css
21
+ w-checkbox::part(label) {
22
+ font-weight: 600;
23
+ }
24
+
25
+ w-checkbox::part(control) {
26
+ margin-top: 1px;
27
+ }
28
+ ```
29
+
30
+ Parts are intended as an **escape hatch**.
31
+ Prefer component tokens for anything state‑ or size‑related.
32
+
33
+ ### Component tokens (`--w-c-checkbox-*`)
34
+
35
+ Component tokens act as inputs to the checkbox styling.
36
+ They can be set directly on the component or inherited from a parent container.
37
+
38
+ ```css
39
+ .settings-panel {
40
+ --w-c-checkbox-gap: 12px;
41
+ }
42
+ ```
43
+
44
+ Defaults are defined internally; setting a token is always optional.
45
+
46
+
47
+ #### Layout & size
48
+
49
+ | Token | Purpose | Default |
50
+ |---|---|---|
51
+ | `--w-c-checkbox-gap` | space between control and label | `8px` |
52
+ | `--w-c-checkbox-control-size` | width/height of the control | `2rem` |
53
+ | `--w-c-checkbox-radius` | border radius of the control | `4px` |
54
+ | `--w-c-checkbox-border-width` | border width | `1px` |
55
+
56
+
57
+ #### Colors
58
+
59
+ | Token | Purpose | Default |
60
+ |---|---|---|
61
+ | `--w-c-checkbox-bg` | control background | theme default |
62
+ | `--w-c-checkbox-border-color` | control border color | theme default |
63
+ | `--w-c-checkbox-bg-checked` | background when checked | theme default |
64
+ | `--w-c-checkbox-border-color-checked` | border when checked | theme default |
65
+ | `--w-c-checkbox-icon-color` | icon color | theme default |
66
+
67
+
68
+ #### Invalid state
69
+
70
+ | Token | Purpose | Default |
71
+ |---|---|---|
72
+ | `--w-c-checkbox-border-color-invalid` | border color when invalid | theme default |
73
+ | `--w-c-checkbox-bg-invalid-checked` | background when invalid and checked | theme default |
74
+
75
+
76
+ #### Disabled state
77
+
78
+ | Token | Purpose | Default |
79
+ |---|---|---|
80
+ | `--w-c-checkbox-bg-disabled` | background when disabled | theme default |
81
+ | `--w-c-checkbox-border-color-disabled` | border when disabled | theme default |
82
+ | `--w-c-checkbox-bg-disabled-checked` | background when disabled and checked | theme default |
83
+
84
+ #### Focus
85
+
86
+ | Token | Purpose | Default |
87
+ |---|---|---|
88
+ | `--w-c-checkbox-outline-width` | focus outline width | `2px` |
89
+ | `--w-c-checkbox-outline-color` | focus outline color | theme default |
90
+ | `--w-c-checkbox-outline-offset` | focus outline offset | theme default |
91
+
92
+ #### Motion
93
+
94
+ | Token | Purpose | Default |
95
+ |---|---|---|
96
+ | `--w-c-checkbox-transition` | transition for control | `150ms cubic-bezier(0.4, 0, 0.2, 1)` |
97
+
98
+ Transitions are automatically disabled when `prefers-reduced-motion: reduce` is active.
99
+
100
+ ### Examples
101
+
102
+ #### Compact checkbox
103
+
104
+ ```css
105
+ .filters w-checkbox {
106
+ --w-c-checkbox-gap: 4px;
107
+ --w-c-checkbox-control-size: 1.6rem;
108
+ }
109
+ ```
110
+
111
+ #### Rounded checkbox
112
+
113
+ ```css
114
+ w-checkbox {
115
+ --w-c-checkbox-radius: 9999px;
116
+ }
117
+ ```
118
+
119
+ #### Contextual color override (advanced)
120
+
121
+ ```css
122
+ .danger-zone w-checkbox {
123
+ --w-c-checkbox-border-color-checked: red;
124
+ }
125
+ ```
126
+
127
+ ### Guidelines
128
+
129
+ - Prefer **component tokens** for size, spacing, and state styling
130
+ - Use **parts** only for small, local tweaks
131
+ - Avoid relying on internal class names or selectors
132
+ - If multiple tokens are required to achieve a look, consider whether a new variant or design token is more appropriate
@@ -0,0 +1,95 @@
1
+ ## Usage
2
+
3
+ Checkbox lets users select one or more options. Use it for independent yes/no choices, multi-select lists, and terms or consent confirmations.
4
+
5
+ Use `w-checkbox-group` when several checkboxes share one label, help text, optional indicator, or required validation.
6
+
7
+ ### Basic Checkbox
8
+
9
+ ```html
10
+ <w-checkbox name="newsletter" value="yes">Sign up for updates</w-checkbox>
11
+ ```
12
+
13
+ The slotted text becomes the checkbox label.
14
+
15
+ ### Checked State
16
+
17
+ Use `checked` when the checkbox should be selected by default.
18
+
19
+ ```html
20
+ <w-checkbox name="alerts" value="email" checked>Email alerts</w-checkbox>
21
+ ```
22
+
23
+ Listen for the `change` event when you need to react to user changes.
24
+
25
+ ```html
26
+ <w-checkbox id="newsletter" name="newsletter" value="yes">Sign up for updates</w-checkbox>
27
+
28
+ <script>
29
+ const checkbox = document.querySelector('#newsletter');
30
+
31
+ checkbox.addEventListener('change', () => {
32
+ console.log(checkbox.checked);
33
+ });
34
+ </script>
35
+ ```
36
+
37
+ ### Form Submission
38
+
39
+ `w-checkbox` is form-associated. When checked, it submits its `name` and `value` with the form. When unchecked or disabled, it submits nothing.
40
+
41
+ ```html
42
+ <form>
43
+ <w-checkbox name="newsletter" value="yes">Sign up for updates</w-checkbox>
44
+ <w-button type="submit">Submit</w-button>
45
+ </form>
46
+ ```
47
+
48
+ If no `value` is set, the submitted value defaults to `on`.
49
+
50
+ ### Required
51
+
52
+ Use `required` when one standalone checkbox must be checked before form submission, such as accepting terms.
53
+
54
+ ```html
55
+ <form>
56
+ <w-checkbox name="terms" value="accepted" required>Accept the terms</w-checkbox>
57
+ <w-button type="submit">Continue</w-button>
58
+ </form>
59
+ ```
60
+
61
+ For a set of options where at least one option is required, put `required` on `w-checkbox-group` instead.
62
+
63
+ ### Checkbox Group
64
+
65
+ Use `w-checkbox-group` to group related options under a shared label and help text.
66
+
67
+ ```html
68
+ <w-checkbox-group label="Interests" help-text="Select all that apply" name="interests">
69
+ <w-checkbox value="housing">Housing</w-checkbox>
70
+ <w-checkbox value="jobs">Jobs</w-checkbox>
71
+ <w-checkbox value="travel">Travel</w-checkbox>
72
+ </w-checkbox-group>
73
+ ```
74
+
75
+ The group name is applied to child checkboxes that do not have their own `name`.
76
+
77
+ ### Indeterminate
78
+
79
+ Use `indeterminate` when a parent checkbox represents a mixed set of child selections.
80
+
81
+ ```html
82
+ <w-checkbox name="all-notifications" indeterminate>All notifications</w-checkbox>
83
+ ```
84
+
85
+ Indeterminate is a visual state. When the user clicks the checkbox, the indeterminate state is cleared and the checkbox becomes checked.
86
+
87
+ ### Invalid
88
+
89
+ Set `invalid` when validation is managed outside the component.
90
+
91
+ ```html
92
+ <w-checkbox name="terms" value="accepted" invalid>Accept the terms</w-checkbox>
93
+ ```
94
+
95
+ When possible, place clear error text near the checkbox or group so users know how to correct the error.
@@ -1 +1,72 @@
1
1
  ## Accessibility
2
+
3
+ Combobox renders an input with `role="combobox"` and a popup list with `role="listbox"`. Each suggestion is rendered with `role="option"`, and the active suggestion is connected to the input with `aria-activedescendant`.
4
+
5
+ ### Provide A Label
6
+
7
+ Always provide a visible label.
8
+
9
+ ```html
10
+ <w-combobox label="Country" placeholder="Search">
11
+ <option value="no">Norway</option>
12
+ <option value="se">Sweden</option>
13
+ <option value="dk">Denmark</option>
14
+ </w-combobox>
15
+ ```
16
+
17
+ Do not rely on placeholder text as the only label. Placeholder text disappears as soon as the user types and is not a reliable accessible name.
18
+
19
+ ### Help Text And Errors
20
+
21
+ Use `help-text` for extra guidance or validation feedback.
22
+
23
+ ```html
24
+ <w-combobox label="Country" help-text="Start typing to filter countries">
25
+ <option value="no">Norway</option>
26
+ <option value="se">Sweden</option>
27
+ <option value="dk">Denmark</option>
28
+ </w-combobox>
29
+ ```
30
+
31
+ When the combobox is invalid, pair `invalid` with help text that explains how to correct the error.
32
+
33
+ ```html
34
+ <w-combobox label="Country" invalid help-text="Select a country from the list">
35
+ <option value="no">Norway</option>
36
+ <option value="se">Sweden</option>
37
+ <option value="dk">Denmark</option>
38
+ </w-combobox>
39
+ ```
40
+
41
+ Do not rely on invalid styling alone.
42
+
43
+ ### Keyboard Interaction
44
+
45
+ The input follows common combobox keyboard behavior:
46
+
47
+ - Arrow Down and Arrow Up open the list and move between suggestions.
48
+ - Home and End move to the first and last suggestion.
49
+ - Page Up and Page Down move through suggestions in larger steps.
50
+ - Enter selects the active suggestion.
51
+ - Escape closes the list. When the list is already closed, Escape clears the value.
52
+ - Tab closes the list and moves focus onward.
53
+
54
+ ### Suggestions
55
+
56
+ The component announces the number of available suggestions through a screen-reader-only status message while the list is open.
57
+
58
+ Keep option labels short and unique enough to distinguish. If the submitted `value` differs from what users should read, provide a clear option label.
59
+
60
+ ```html
61
+ <w-combobox label="Country" placeholder="Search">
62
+ <option value="us" label="United States">US</option>
63
+ <option value="uk" label="United Kingdom">UK</option>
64
+ <option value="no">Norway</option>
65
+ </w-combobox>
66
+ ```
67
+
68
+ ### Disabled Comboboxes
69
+
70
+ Avoid disabled comboboxes where possible. Disabled controls can be hard to discover and do not explain why the field is unavailable.
71
+
72
+ Prefer leaving the combobox enabled and showing validation or explanatory feedback when the user tries to continue.
@@ -6,125 +6,155 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
6
6
 
7
7
  | Name | Type | Default | Summary |
8
8
  |-|-|-|-|
9
- | autocomplete | `string \| undefined` | `'off'` | Autocomplete attribute for the input field |
10
- | disable-static-filtering | `boolean` | `false` | Disable client-side static filtering |
11
- | disabled | `boolean` | `false` | Whether the element is disabled |
12
- | help-text | `string \| undefined` | `''` | The content to display as the help text |
13
- | invalid | `boolean` | `false` | Renders the input field in an invalid state |
14
- | label | `string \| undefined` | `''` | Label above input |
15
- | match-text-segments | `boolean` | `false` | Whether the matching text segments in the options should be highlighted |
16
- | name | `string \| undefined` | `''` | Name attribute for form submission |
17
- | open-on-focus | `boolean` | `false` | Whether the popover opens when focus is on the text field |
18
- | optional | `boolean` | `false` | Whether to show optional text |
19
- | options | `ComboboxOption[]` | `[]` | The available options to select from |
20
- | placeholder | `string \| undefined` | `''` | Input placeholder |
21
- | required | `boolean` | `false` | Whether the element is required |
22
- | select-on-blur | `boolean` | `true` | Select active option on blur |
23
- | value | `string` | `''` | The input value |
9
+ | autocomplete | `string \| undefined` | `'off'` | The autocomplete attribute passed to the internal input. |
10
+ | disable-static-filtering | `boolean` | `false` | Whether built-in client-side filtering is disabled. |
11
+ | disabled | `boolean` | `false` | Whether the combobox is disabled. |
12
+ | help-text | `string \| undefined` | `''` | Help text displayed below the input. |
13
+ | invalid | `boolean` | `false` | Whether the combobox is visually invalid. |
14
+ | label | `string \| undefined` | `''` | The label displayed above the input. |
15
+ | match-text-segments | `boolean` | `false` | Whether matching text segments in options are highlighted. |
16
+ | name | `string \| undefined` | `''` | The name submitted with the combobox value. |
17
+ | open-on-focus | `boolean` | `false` | Whether the option list opens when the input receives focus. |
18
+ | optional | `boolean` | `false` | Whether to show optional text next to the label. |
19
+ | options | `ComboboxOption[]` | `[]` | The available options to select from. |
20
+ | placeholder | `string \| undefined` | `''` | Placeholder text displayed when the input is empty. |
21
+ | required | `boolean` | `false` | Whether the combobox is required before form submission. |
22
+ | select-on-blur | `boolean` | `true` | Whether the active option is selected when the input loses focus. |
23
+ | value | `string` | `''` | The selected or typed value. |
24
24
 
25
25
  ### Property Details
26
26
 
27
27
  #### autocomplete
28
28
 
29
- Autocomplete attribute for the input field
29
+ The autocomplete attribute passed to the internal input.
30
+
31
+ Defaults to `off`. Set this when browser autocomplete should be enabled or scoped to a specific autocomplete token.
30
32
 
31
33
  - Type: `string | undefined`
32
34
  - Default: `'off'`
33
35
 
34
36
  #### disable-static-filtering
35
37
 
36
- Disable client-side static filtering
38
+ Whether built-in client-side filtering is disabled.
39
+
40
+ Use this for remote search or externally filtered results. When disabled, all entries in `options` are rendered as provided.
37
41
 
38
42
  - Type: `boolean`
39
43
  - Default: `false`
40
44
 
41
45
  #### disabled
42
46
 
43
- Whether the element is disabled
47
+ Whether the combobox is disabled.
48
+
49
+ Disabled comboboxes cannot be focused, changed, or submitted with form data.
44
50
 
45
51
  - Type: `boolean`
46
52
  - Default: `false`
47
53
 
48
54
  #### help-text
49
55
 
50
- The content to display as the help text
56
+ Help text displayed below the input.
57
+
58
+ Use this for supporting guidance or validation feedback.
51
59
 
52
60
  - Type: `string | undefined`
53
61
  - Default: `''`
54
62
 
55
63
  #### invalid
56
64
 
57
- Renders the input field in an invalid state
65
+ Whether the combobox is visually invalid.
66
+
67
+ Use this to show an externally managed validation error. Pair it with `help-text` to explain how to fix the error.
58
68
 
59
69
  - Type: `boolean`
60
70
  - Default: `false`
61
71
 
62
72
  #### label
63
73
 
64
- Label above input
74
+ The label displayed above the input.
75
+
76
+ Use this to give the combobox a visible and accessible name.
65
77
 
66
78
  - Type: `string | undefined`
67
79
  - Default: `''`
68
80
 
69
81
  #### match-text-segments
70
82
 
71
- Whether the matching text segments in the options should be highlighted
83
+ Whether matching text segments in options are highlighted.
84
+
85
+ Use this to visually emphasize the part of each option that matches the current input value.
72
86
 
73
87
  - Type: `boolean`
74
88
  - Default: `false`
75
89
 
76
90
  #### name
77
91
 
78
- Name attribute for form submission
92
+ The name submitted with the combobox value.
93
+
94
+ Use this when the combobox belongs to a form and its value should be included in form data.
79
95
 
80
96
  - Type: `string | undefined`
81
97
  - Default: `''`
82
98
 
83
99
  #### open-on-focus
84
100
 
85
- Whether the popover opens when focus is on the text field
101
+ Whether the option list opens when the input receives focus.
102
+
103
+ Use this when users should see available options before they start typing.
86
104
 
87
105
  - Type: `boolean`
88
106
  - Default: `false`
89
107
 
90
108
  #### optional
91
109
 
92
- Whether to show optional text
110
+ Whether to show optional text next to the label.
111
+
112
+ Use this to indicate that the combobox is not required.
93
113
 
94
114
  - Type: `boolean`
95
115
  - Default: `false`
96
116
 
97
117
  #### options
98
118
 
99
- The available options to select from
119
+ The available options to select from.
120
+
121
+ Use this for framework usage, application state, or remote search results. When `options` contains entries, it is used instead of child `<option>` elements.
100
122
 
101
123
  - Type: `ComboboxOption[]`
102
124
  - Default: `[]`
103
125
 
104
126
  #### placeholder
105
127
 
106
- Input placeholder
128
+ Placeholder text displayed when the input is empty.
129
+
130
+ Use this as a short hint for the expected input. Do not use placeholder text as a replacement for a label.
107
131
 
108
132
  - Type: `string | undefined`
109
133
  - Default: `''`
110
134
 
111
135
  #### required
112
136
 
113
- Whether the element is required
137
+ Whether the combobox is required before form submission.
138
+
139
+ Use this when the user must provide a value before submitting the form.
114
140
 
115
141
  - Type: `boolean`
116
142
  - Default: `false`
117
143
 
118
144
  #### select-on-blur
119
145
 
120
- Select active option on blur
146
+ Whether the active option is selected when the input loses focus.
147
+
148
+ When enabled, the combobox selects the keyboard-highlighted option, or an option whose value exactly matches the current input value, on blur.
121
149
 
122
150
  - Type: `boolean`
123
151
  - Default: `true`
124
152
 
125
153
  #### value
126
154
 
127
- The input value
155
+ The selected or typed value.
156
+
157
+ When an option is selected, this is set to the option value. The displayed text may differ when the option has a separate label.
128
158
 
129
159
  - Type: `string`
130
160
  - Default: `''`