@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.
Files changed (283) 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 +508 -145
  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/accessibility.md +42 -0
  20. package/dist/docs/button/api.md +63 -39
  21. package/dist/docs/button/button.md +395 -42
  22. package/dist/docs/button/examples.md +126 -0
  23. package/dist/docs/button/styling.md +72 -0
  24. package/dist/docs/button/usage.md +89 -0
  25. package/dist/docs/card/accessibility.md +74 -0
  26. package/dist/docs/card/api.md +9 -3
  27. package/dist/docs/card/card.md +236 -5
  28. package/dist/docs/card/examples.md +75 -0
  29. package/dist/docs/card/styling.md +1 -0
  30. package/dist/docs/card/usage.md +76 -0
  31. package/dist/docs/checkbox/api.md +128 -0
  32. package/dist/docs/checkbox/checkbox.md +134 -0
  33. package/dist/docs/checkbox-group/accessibility.md +71 -0
  34. package/dist/docs/checkbox-group/api.md +79 -0
  35. package/dist/docs/checkbox-group/checkbox-group.md +492 -0
  36. package/dist/docs/checkbox-group/examples.md +105 -0
  37. package/dist/docs/checkbox-group/styling.md +132 -0
  38. package/dist/docs/checkbox-group/usage.md +95 -0
  39. package/dist/docs/combobox/accessibility.md +71 -0
  40. package/dist/docs/combobox/api.md +60 -30
  41. package/dist/docs/combobox/combobox.md +205 -32
  42. package/dist/docs/combobox/examples.md +44 -0
  43. package/dist/docs/combobox/styling.md +1 -0
  44. package/dist/docs/combobox/usage.md +28 -0
  45. package/dist/docs/datepicker/accessibility.md +25 -0
  46. package/dist/docs/datepicker/api.md +22 -14
  47. package/dist/docs/datepicker/datepicker.md +208 -16
  48. package/dist/docs/datepicker/examples.md +75 -0
  49. package/dist/docs/datepicker/styling.md +1 -0
  50. package/dist/docs/datepicker/usage.md +84 -0
  51. package/dist/docs/expandable/api.md +20 -32
  52. package/dist/docs/expandable/examples.md +54 -0
  53. package/dist/docs/expandable/expandable.md +74 -32
  54. package/dist/docs/expandable/styling.md +1 -0
  55. package/dist/docs/icon/accessibility.md +5 -0
  56. package/dist/docs/icon/api.md +43 -0
  57. package/dist/docs/icon/examples.md +45 -0
  58. package/dist/docs/icon/icon.md +115 -0
  59. package/dist/docs/icon/styling.md +1 -0
  60. package/dist/docs/icon/usage.md +11 -0
  61. package/dist/docs/index.md +46 -0
  62. package/dist/docs/link/api.md +18 -22
  63. package/dist/docs/link/examples.md +75 -0
  64. package/dist/docs/link/link.md +113 -24
  65. package/dist/docs/link/styling.md +1 -0
  66. package/dist/docs/link/usage.md +18 -0
  67. package/dist/docs/modal/api.md +51 -0
  68. package/dist/docs/modal/examples.md +67 -0
  69. package/dist/docs/modal/modal.md +240 -0
  70. package/dist/docs/modal/styling.md +1 -0
  71. package/dist/docs/modal/usage.md +110 -0
  72. package/dist/docs/modal-footer/api.md +11 -0
  73. package/dist/docs/modal-footer/modal-footer.md +17 -0
  74. package/dist/docs/modal-header/api.md +42 -0
  75. package/dist/docs/modal-header/modal-header.md +48 -0
  76. package/dist/docs/page-indicator/api.md +6 -6
  77. package/dist/docs/page-indicator/examples.md +8 -0
  78. package/dist/docs/page-indicator/page-indicator.md +25 -6
  79. package/dist/docs/page-indicator/styling.md +1 -0
  80. package/dist/docs/page-indicator/usage.md +8 -0
  81. package/dist/docs/pagination/api.md +12 -10
  82. package/dist/docs/pagination/examples.md +20 -0
  83. package/dist/docs/pagination/pagination.md +52 -12
  84. package/dist/docs/pagination/styling.md +1 -0
  85. package/dist/docs/pagination/usage.md +18 -0
  86. package/dist/docs/pill/accessibility.md +2 -0
  87. package/dist/docs/pill/api.md +10 -26
  88. package/dist/docs/pill/examples.md +23 -0
  89. package/dist/docs/pill/pill.md +45 -28
  90. package/dist/docs/pill/styling.md +1 -0
  91. package/dist/docs/pill/usage.md +8 -0
  92. package/dist/docs/radio/radio.md +1 -7
  93. package/dist/docs/select/select.md +2 -0
  94. package/dist/docs/select/styling.md +1 -0
  95. package/dist/docs/slider/slider.md +2 -0
  96. package/dist/docs/slider/styling.md +1 -0
  97. package/dist/docs/slider-thumb/slider-thumb.md +2 -0
  98. package/dist/docs/slider-thumb/styling.md +1 -0
  99. package/dist/docs/step-indicator/step-indicator.md +2 -0
  100. package/dist/docs/step-indicator/styling.md +1 -0
  101. package/dist/docs/switch/styling.md +1 -0
  102. package/dist/docs/switch/switch.md +2 -0
  103. package/dist/docs/tabs/styling.md +1 -0
  104. package/dist/docs/tabs/tabs.md +2 -0
  105. package/dist/docs/textarea/styling.md +1 -0
  106. package/dist/docs/textarea/textarea.md +2 -0
  107. package/dist/docs/textfield/styling.md +1 -0
  108. package/dist/docs/textfield/textfield.md +2 -0
  109. package/dist/index.d.ts +950 -602
  110. package/dist/packages/affix/affix.hydration.test.js +1 -1
  111. package/dist/packages/affix/affix.js +4 -4
  112. package/dist/packages/affix/affix.js.map +4 -4
  113. package/dist/packages/alert/alert.hydration.test.js +1 -1
  114. package/dist/packages/alert/alert.js +3 -3
  115. package/dist/packages/alert/alert.js.map +3 -3
  116. package/dist/packages/attention/attention.hydration.test.js +1 -1
  117. package/dist/packages/attention/attention.js +397 -444
  118. package/dist/packages/attention/attention.js.map +4 -4
  119. package/dist/packages/attention/attention.test.js +1 -1
  120. package/dist/packages/badge/badge.hydration.test.js +1 -1
  121. package/dist/packages/box/box.hydration.test.js +1 -1
  122. package/dist/packages/box/box.js +1 -1
  123. package/dist/packages/box/box.js.map +1 -1
  124. package/dist/packages/breadcrumbs/breadcrumbs.hydration.test.js +3 -2
  125. package/dist/packages/breadcrumbs/breadcrumbs.js +4 -4
  126. package/dist/packages/breadcrumbs/breadcrumbs.js.map +3 -3
  127. package/dist/packages/button/button.d.ts +54 -37
  128. package/dist/packages/button/button.hydration.test.js +1 -1
  129. package/dist/packages/button/button.js +385 -432
  130. package/dist/packages/button/button.js.map +4 -4
  131. package/dist/packages/button/button.react.stories.d.ts +2 -2
  132. package/dist/packages/button/button.stories.d.ts +29 -0
  133. package/dist/packages/button/button.stories.js +176 -2
  134. package/dist/packages/button/react.d.ts +1 -1
  135. package/dist/packages/button/styles.d.ts +22 -1
  136. package/dist/packages/button/styles.js +390 -1
  137. package/dist/packages/card/card.d.ts +9 -6
  138. package/dist/packages/card/card.hydration.test.js +1 -1
  139. package/dist/packages/card/card.js +3 -3
  140. package/dist/packages/card/card.js.map +4 -4
  141. package/dist/packages/checkbox/checkbox.d.ts +45 -14
  142. package/dist/packages/checkbox/checkbox.hydration.test.js +1 -1
  143. package/dist/packages/checkbox/checkbox.js +3 -3
  144. package/dist/packages/checkbox/checkbox.js.map +3 -3
  145. package/dist/packages/checkbox/checkbox.react.stories.d.ts +1 -1
  146. package/dist/packages/checkbox/checkbox.stories.d.ts +2 -2
  147. package/dist/packages/checkbox/checkbox.test.js +1 -1
  148. package/dist/packages/checkbox/react.d.ts +2 -2
  149. package/dist/packages/checkbox-group/checkbox-group.a11y.test.js +1 -1
  150. package/dist/packages/checkbox-group/checkbox-group.d.ts +35 -8
  151. package/dist/packages/checkbox-group/checkbox-group.hydration.test.js +1 -1
  152. package/dist/packages/checkbox-group/checkbox-group.js +6 -6
  153. package/dist/packages/checkbox-group/checkbox-group.js.map +4 -4
  154. package/dist/packages/checkbox-group/react.d.ts +3 -3
  155. package/dist/packages/combobox/combobox.a11y.test.js +24 -0
  156. package/dist/packages/combobox/combobox.d.ts +65 -45
  157. package/dist/packages/combobox/combobox.hydration.test.js +39 -1
  158. package/dist/packages/combobox/combobox.js +21 -21
  159. package/dist/packages/combobox/combobox.js.map +4 -4
  160. package/dist/packages/combobox/combobox.stories.js +28 -15
  161. package/dist/packages/combobox/combobox.test.js +110 -0
  162. package/dist/packages/datepicker/DatePicker.test.js +1 -1
  163. package/dist/packages/datepicker/datepicker.d.ts +22 -30
  164. package/dist/packages/datepicker/datepicker.hydration.test.js +1 -1
  165. package/dist/packages/datepicker/datepicker.js +49 -49
  166. package/dist/packages/datepicker/datepicker.js.map +4 -4
  167. package/dist/packages/datepicker/datepicker.test.js +1 -1
  168. package/dist/packages/expandable/expandable.d.ts +11 -32
  169. package/dist/packages/expandable/expandable.hydration.test.js +1 -1
  170. package/dist/packages/expandable/expandable.js +11 -11
  171. package/dist/packages/expandable/expandable.js.map +3 -3
  172. package/dist/packages/expandable/expandable.react.stories.d.ts +2 -2
  173. package/dist/packages/expandable/react.d.ts +1 -1
  174. package/dist/packages/icon/icon.d.ts +16 -4
  175. package/dist/packages/icon/icon.hydration.test.js +1 -1
  176. package/dist/packages/icon/icon.js +2 -2
  177. package/dist/packages/icon/icon.js.map +3 -3
  178. package/dist/packages/icon/icon.react.stories.d.ts +1 -1
  179. package/dist/packages/icon/react.d.ts +2 -2
  180. package/dist/packages/link/link.d.ts +15 -16
  181. package/dist/packages/link/link.hydration.test.js +1 -1
  182. package/dist/packages/link/link.js +420 -190
  183. package/dist/packages/link/link.js.map +4 -4
  184. package/dist/packages/link/link.test.js +1 -1
  185. package/dist/packages/link/styles.d.ts +5 -0
  186. package/dist/packages/link/styles.js +80 -0
  187. package/dist/packages/modal/index.d.ts +4 -4
  188. package/dist/packages/modal/index.js +4 -4
  189. package/dist/packages/modal/modal.d.ts +22 -12
  190. package/dist/packages/modal/modal.hydration.test.js +1 -1
  191. package/dist/packages/modal/modal.js +5 -5
  192. package/dist/packages/modal/modal.js.map +3 -3
  193. package/dist/packages/modal/modal.react.stories.d.ts +3 -3
  194. package/dist/packages/modal/modal.stories.d.ts +2 -1
  195. package/dist/packages/modal/modal.stories.js +85 -3
  196. package/dist/packages/modal/react.d.ts +2 -2
  197. package/dist/packages/modal-footer/modal-footer.d.ts +5 -3
  198. package/dist/packages/modal-footer/modal-footer.js +4 -4
  199. package/dist/packages/modal-footer/modal-footer.js.map +3 -3
  200. package/dist/packages/modal-footer/react.d.ts +1 -1
  201. package/dist/packages/modal-header/modal-header.d.ts +21 -11
  202. package/dist/packages/modal-header/modal-header.js +11 -9
  203. package/dist/packages/modal-header/modal-header.js.map +4 -4
  204. package/dist/packages/modal-header/react.d.ts +2 -2
  205. package/dist/packages/page-indicator/page-indicator.d.ts +9 -14
  206. package/dist/packages/page-indicator/page-indicator.hydration.test.js +1 -1
  207. package/dist/packages/page-indicator/page-indicator.js +5 -5
  208. package/dist/packages/page-indicator/page-indicator.js.map +4 -4
  209. package/dist/packages/pagination/pagination.d.ts +11 -11
  210. package/dist/packages/pagination/pagination.hydration.test.js +1 -1
  211. package/dist/packages/pagination/pagination.js +4 -4
  212. package/dist/packages/pagination/pagination.js.map +4 -4
  213. package/dist/packages/pagination/pagination.test.js +1 -1
  214. package/dist/packages/pill/pill.d.ts +14 -29
  215. package/dist/packages/pill/pill.hydration.test.js +1 -1
  216. package/dist/packages/pill/pill.js +3 -3
  217. package/dist/packages/pill/pill.js.map +4 -4
  218. package/dist/packages/pill/pill.react.stories.d.ts +2 -2
  219. package/dist/packages/pill/react.d.ts +1 -1
  220. package/dist/packages/radio/radio.hydration.test.js +1 -1
  221. package/dist/packages/radio/radio.js +3 -3
  222. package/dist/packages/radio/radio.js.map +3 -3
  223. package/dist/packages/radio/radio.test.js +1 -1
  224. package/dist/packages/radio-group/radio-group.a11y.test.js +7 -3
  225. package/dist/packages/radio-group/radio-group.hydration.test.js +6 -2
  226. package/dist/packages/radio-group/radio-group.js +11 -11
  227. package/dist/packages/radio-group/radio-group.js.map +4 -4
  228. package/dist/packages/select/select.a11y.test.js +6 -2
  229. package/dist/packages/select/select.hydration.test.js +1 -1
  230. package/dist/packages/select/select.js +7 -7
  231. package/dist/packages/select/select.js.map +4 -4
  232. package/dist/packages/select/select.test.js +4 -2
  233. package/dist/packages/slider/slider.hydration.test.js +7 -2
  234. package/dist/packages/slider/slider.js +5 -5
  235. package/dist/packages/slider/slider.js.map +4 -4
  236. package/dist/packages/slider/slider.react.stories.js +2 -2
  237. package/dist/packages/slider/slider.test.js +1 -1
  238. package/dist/packages/slider-thumb/slider-thumb.hydration.test.js +1 -1
  239. package/dist/packages/slider-thumb/slider-thumb.js +20 -20
  240. package/dist/packages/slider-thumb/slider-thumb.js.map +4 -4
  241. package/dist/packages/step/step.hydration.test.js +1 -1
  242. package/dist/packages/step/step.js +8 -8
  243. package/dist/packages/step/step.js.map +4 -4
  244. package/dist/packages/step-indicator/step-indicator.hydration.test.js +1 -1
  245. package/dist/packages/switch/switch.a11y.test.js +1 -1
  246. package/dist/packages/switch/switch.hydration.test.js +1 -1
  247. package/dist/packages/switch/switch.js +1 -1
  248. package/dist/packages/switch/switch.js.map +1 -1
  249. package/dist/packages/tab/tab.hydration.test.js +1 -1
  250. package/dist/packages/tab/tab.js +10 -10
  251. package/dist/packages/tab/tab.js.map +2 -2
  252. package/dist/packages/tab-panel/tab-panel.hydration.test.js +1 -1
  253. package/dist/packages/tab-panel/tab-panel.js +3 -3
  254. package/dist/packages/tab-panel/tab-panel.js.map +2 -2
  255. package/dist/packages/tabs/tabs.a11y.test.js +2 -2
  256. package/dist/packages/tabs/tabs.hydration.test.js +1 -1
  257. package/dist/packages/tabs/tabs.js +1 -1
  258. package/dist/packages/tabs/tabs.js.map +2 -2
  259. package/dist/packages/tabs/tabs.test.js +4 -4
  260. package/dist/packages/textarea/textarea.hydration.test.js +1 -1
  261. package/dist/packages/textarea/textarea.js +4 -4
  262. package/dist/packages/textarea/textarea.js.map +3 -3
  263. package/dist/packages/textarea/textarea.test.js +1 -1
  264. package/dist/packages/textfield/textfield.hydration.test.js +1 -1
  265. package/dist/packages/textfield/textfield.js +1 -1
  266. package/dist/packages/textfield/textfield.js.map +1 -1
  267. package/dist/packages/textfield/textfield.test.js +1 -1
  268. package/dist/packages/toast/toast.js +6 -6
  269. package/dist/packages/toast/toast.js.map +4 -4
  270. package/dist/packages/toast/toast.stories.d.ts +1 -5
  271. package/dist/packages/toast/toast.stories.js +0 -17
  272. package/dist/packages/toast-container/toast-container.js +2 -2
  273. package/dist/packages/toast-container/toast-container.js.map +2 -2
  274. package/dist/web-types.json +509 -172
  275. package/eik/index.js +2536 -0
  276. package/package.json +18 -12
  277. package/dist/docs/radio/examples.md +0 -1
  278. package/dist/docs/radio/usage.md +0 -1
  279. package/dist/packages/button/styles/w-button.styles.d.ts +0 -1
  280. package/dist/packages/button/styles/w-button.styles.js +0 -282
  281. package/dist/packages/link/styles/w-link.styles.d.ts +0 -1
  282. package/dist/packages/link/styles/w-link.styles.js +0 -213
  283. /package/dist/docs/{radio → modal}/accessibility.md +0 -0
@@ -4,14 +4,157 @@
4
4
 
5
5
  A combobox element for text input with selectable options.
6
6
 
7
- [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/forms-combobox--docs)
8
-
9
7
  ## Usage
10
8
 
9
+ Use child `<option>` elements for declarative HTML usage.
10
+
11
+ <elements-example>
12
+
13
+ ```html
14
+ <w-combobox label="Country" placeholder="Search">
15
+ <option value="no">Norway</option>
16
+ <option value="se">Sweden</option>
17
+ <option value="dk">Denmark</option>
18
+ </w-combobox>
19
+ ```
20
+
21
+ </elements-example>
22
+
23
+ The option text is used as the visible suggestion. The `value` attribute is used as the submitted and selected value.
24
+
25
+ For framework usage or dynamic data, you may set the `options` property instead.
26
+
27
+ ```js
28
+ combobox.options = [
29
+ { value: 'no', label: 'Norway' },
30
+ { value: 'se', label: 'Sweden' },
31
+ { value: 'dk', label: 'Denmark' },
32
+ ];
33
+ ```
34
+
35
+ When `options` contains entries, it is used instead of child `<option>` elements.
36
+
11
37
  ## Accessibility
12
38
 
39
+ 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`.
40
+
41
+ ### Provide A Label
42
+
43
+ Always provide a visible label.
44
+
45
+ ```html
46
+ <w-combobox label="Country" placeholder="Search">
47
+ <option value="no">Norway</option>
48
+ <option value="se">Sweden</option>
49
+ <option value="dk">Denmark</option>
50
+ </w-combobox>
51
+ ```
52
+
53
+ 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.
54
+
55
+ ### Help Text And Errors
56
+
57
+ Use `help-text` for extra guidance or validation feedback.
58
+
59
+ ```html
60
+ <w-combobox label="Country" help-text="Start typing to filter countries">
61
+ <option value="no">Norway</option>
62
+ <option value="se">Sweden</option>
63
+ <option value="dk">Denmark</option>
64
+ </w-combobox>
65
+ ```
66
+
67
+ When the combobox is invalid, pair `invalid` with help text that explains how to correct the error.
68
+
69
+ ```html
70
+ <w-combobox label="Country" invalid help-text="Select a country from the list">
71
+ <option value="no">Norway</option>
72
+ <option value="se">Sweden</option>
73
+ <option value="dk">Denmark</option>
74
+ </w-combobox>
75
+ ```
76
+
77
+ Do not rely on invalid styling alone.
78
+
79
+ ### Keyboard Interaction
80
+
81
+ The input follows common combobox keyboard behavior:
82
+
83
+ - Arrow Down and Arrow Up open the list and move between suggestions.
84
+ - Home and End move to the first and last suggestion.
85
+ - Page Up and Page Down move through suggestions in larger steps.
86
+ - Enter selects the active suggestion.
87
+ - Escape closes the list. When the list is already closed, Escape clears the value.
88
+ - Tab closes the list and moves focus onward.
89
+
90
+ ### Suggestions
91
+
92
+ The component announces the number of available suggestions through a screen-reader-only status message while the list is open.
93
+
94
+ Keep option labels short and unique enough to distinguish. If the submitted `value` differs from what users should read, provide a clear option label.
95
+
96
+ ```html
97
+ <w-combobox label="Country" placeholder="Search">
98
+ <option value="us" label="United States">US</option>
99
+ <option value="uk" label="United Kingdom">UK</option>
100
+ <option value="no">Norway</option>
101
+ </w-combobox>
102
+ ```
103
+
104
+ ### Disabled Comboboxes
105
+
106
+ Avoid disabled comboboxes where possible. Disabled controls can be hard to discover and do not explain why the field is unavailable.
107
+
108
+ Prefer leaving the combobox enabled and showing validation or explanatory feedback when the user tries to continue.
109
+
13
110
  ## Examples
14
111
 
112
+ <elements-example>
113
+
114
+ ```html
115
+ <w-combobox label="Fruit" placeholder="Type to search">
116
+ <option value="apple">Apple</option>
117
+ <option value="banana">Banana</option>
118
+ <option value="orange">Orange</option>
119
+ </w-combobox>
120
+ ```
121
+
122
+ </elements-example>
123
+
124
+ ### Different label and value
125
+
126
+ Use the `label` attribute when the visible suggestion should differ from the selected value.
127
+
128
+ <elements-example>
129
+
130
+ ```html
131
+ <w-combobox label="Country" placeholder="Search">
132
+ <option value="us" label="United States">US</option>
133
+ <option value="uk" label="United Kingdom">UK</option>
134
+ <option value="no">Norway</option>
135
+ </w-combobox>
136
+ ```
137
+
138
+ </elements-example>
139
+
140
+ ### Dynamic options
141
+
142
+ Use the `options` property when options come from application state or a remote search.
143
+
144
+ ```js
145
+ const combobox = document.querySelector('w-combobox');
146
+
147
+ combobox.options = [
148
+ { value: 'apple', label: 'Apple' },
149
+ { value: 'banana', label: 'Banana' },
150
+ { value: 'orange', label: 'Orange' },
151
+ ];
152
+ ```
153
+
154
+ Child option content is plain text. Rich option content is not supported.
155
+
156
+ ## Styling API
157
+
15
158
  ## `<w-combobox>` API
16
159
 
17
160
  Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
@@ -20,125 +163,155 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
20
163
 
21
164
  | Name | Type | Default | Summary |
22
165
  |-|-|-|-|
23
- | autocomplete | `string \| undefined` | `'off'` | Autocomplete attribute for the input field |
24
- | disable-static-filtering | `boolean` | `false` | Disable client-side static filtering |
25
- | disabled | `boolean` | `false` | Whether the element is disabled |
26
- | help-text | `string \| undefined` | `''` | The content to display as the help text |
27
- | invalid | `boolean` | `false` | Renders the input field in an invalid state |
28
- | label | `string \| undefined` | `''` | Label above input |
29
- | match-text-segments | `boolean` | `false` | Whether the matching text segments in the options should be highlighted |
30
- | name | `string \| undefined` | `''` | Name attribute for form submission |
31
- | open-on-focus | `boolean` | `false` | Whether the popover opens when focus is on the text field |
32
- | optional | `boolean` | `false` | Whether to show optional text |
33
- | options | `ComboboxOption[]` | `[]` | The available options to select from |
34
- | placeholder | `string \| undefined` | `''` | Input placeholder |
35
- | required | `boolean` | `false` | Whether the element is required |
36
- | select-on-blur | `boolean` | `true` | Select active option on blur |
37
- | value | `string` | `''` | The input value |
166
+ | autocomplete | `string \| undefined` | `'off'` | The autocomplete attribute passed to the internal input. |
167
+ | disable-static-filtering | `boolean` | `false` | Whether built-in client-side filtering is disabled. |
168
+ | disabled | `boolean` | `false` | Whether the combobox is disabled. |
169
+ | help-text | `string \| undefined` | `''` | Help text displayed below the input. |
170
+ | invalid | `boolean` | `false` | Whether the combobox is visually invalid. |
171
+ | label | `string \| undefined` | `''` | The label displayed above the input. |
172
+ | match-text-segments | `boolean` | `false` | Whether matching text segments in options are highlighted. |
173
+ | name | `string \| undefined` | `''` | The name submitted with the combobox value. |
174
+ | open-on-focus | `boolean` | `false` | Whether the option list opens when the input receives focus. |
175
+ | optional | `boolean` | `false` | Whether to show optional text next to the label. |
176
+ | options | `ComboboxOption[]` | `[]` | The available options to select from. |
177
+ | placeholder | `string \| undefined` | `''` | Placeholder text displayed when the input is empty. |
178
+ | required | `boolean` | `false` | Whether the combobox is required before form submission. |
179
+ | select-on-blur | `boolean` | `true` | Whether the active option is selected when the input loses focus. |
180
+ | value | `string` | `''` | The selected or typed value. |
38
181
 
39
182
  ### Property Details
40
183
 
41
184
  #### autocomplete
42
185
 
43
- Autocomplete attribute for the input field
186
+ The autocomplete attribute passed to the internal input.
187
+
188
+ Defaults to `off`. Set this when browser autocomplete should be enabled or scoped to a specific autocomplete token.
44
189
 
45
190
  - Type: `string | undefined`
46
191
  - Default: `'off'`
47
192
 
48
193
  #### disable-static-filtering
49
194
 
50
- Disable client-side static filtering
195
+ Whether built-in client-side filtering is disabled.
196
+
197
+ Use this for remote search or externally filtered results. When disabled, all entries in `options` are rendered as provided.
51
198
 
52
199
  - Type: `boolean`
53
200
  - Default: `false`
54
201
 
55
202
  #### disabled
56
203
 
57
- Whether the element is disabled
204
+ Whether the combobox is disabled.
205
+
206
+ Disabled comboboxes cannot be focused, changed, or submitted with form data.
58
207
 
59
208
  - Type: `boolean`
60
209
  - Default: `false`
61
210
 
62
211
  #### help-text
63
212
 
64
- The content to display as the help text
213
+ Help text displayed below the input.
214
+
215
+ Use this for supporting guidance or validation feedback.
65
216
 
66
217
  - Type: `string | undefined`
67
218
  - Default: `''`
68
219
 
69
220
  #### invalid
70
221
 
71
- Renders the input field in an invalid state
222
+ Whether the combobox is visually invalid.
223
+
224
+ Use this to show an externally managed validation error. Pair it with `help-text` to explain how to fix the error.
72
225
 
73
226
  - Type: `boolean`
74
227
  - Default: `false`
75
228
 
76
229
  #### label
77
230
 
78
- Label above input
231
+ The label displayed above the input.
232
+
233
+ Use this to give the combobox a visible and accessible name.
79
234
 
80
235
  - Type: `string | undefined`
81
236
  - Default: `''`
82
237
 
83
238
  #### match-text-segments
84
239
 
85
- Whether the matching text segments in the options should be highlighted
240
+ Whether matching text segments in options are highlighted.
241
+
242
+ Use this to visually emphasize the part of each option that matches the current input value.
86
243
 
87
244
  - Type: `boolean`
88
245
  - Default: `false`
89
246
 
90
247
  #### name
91
248
 
92
- Name attribute for form submission
249
+ The name submitted with the combobox value.
250
+
251
+ Use this when the combobox belongs to a form and its value should be included in form data.
93
252
 
94
253
  - Type: `string | undefined`
95
254
  - Default: `''`
96
255
 
97
256
  #### open-on-focus
98
257
 
99
- Whether the popover opens when focus is on the text field
258
+ Whether the option list opens when the input receives focus.
259
+
260
+ Use this when users should see available options before they start typing.
100
261
 
101
262
  - Type: `boolean`
102
263
  - Default: `false`
103
264
 
104
265
  #### optional
105
266
 
106
- Whether to show optional text
267
+ Whether to show optional text next to the label.
268
+
269
+ Use this to indicate that the combobox is not required.
107
270
 
108
271
  - Type: `boolean`
109
272
  - Default: `false`
110
273
 
111
274
  #### options
112
275
 
113
- The available options to select from
276
+ The available options to select from.
277
+
278
+ Use this for framework usage, application state, or remote search results. When `options` contains entries, it is used instead of child `<option>` elements.
114
279
 
115
280
  - Type: `ComboboxOption[]`
116
281
  - Default: `[]`
117
282
 
118
283
  #### placeholder
119
284
 
120
- Input placeholder
285
+ Placeholder text displayed when the input is empty.
286
+
287
+ Use this as a short hint for the expected input. Do not use placeholder text as a replacement for a label.
121
288
 
122
289
  - Type: `string | undefined`
123
290
  - Default: `''`
124
291
 
125
292
  #### required
126
293
 
127
- Whether the element is required
294
+ Whether the combobox is required before form submission.
295
+
296
+ Use this when the user must provide a value before submitting the form.
128
297
 
129
298
  - Type: `boolean`
130
299
  - Default: `false`
131
300
 
132
301
  #### select-on-blur
133
302
 
134
- Select active option on blur
303
+ Whether the active option is selected when the input loses focus.
304
+
305
+ When enabled, the combobox selects the keyboard-highlighted option, or an option whose value exactly matches the current input value, on blur.
135
306
 
136
307
  - Type: `boolean`
137
308
  - Default: `true`
138
309
 
139
310
  #### value
140
311
 
141
- The input value
312
+ The selected or typed value.
313
+
314
+ When an option is selected, this is set to the option value. The displayed text may differ when the option has a separate label.
142
315
 
143
316
  - Type: `string`
144
317
  - Default: `''`
@@ -1 +1,45 @@
1
1
  ## Examples
2
+
3
+ <elements-example>
4
+
5
+ ```html
6
+ <w-combobox label="Fruit" placeholder="Type to search">
7
+ <option value="apple">Apple</option>
8
+ <option value="banana">Banana</option>
9
+ <option value="orange">Orange</option>
10
+ </w-combobox>
11
+ ```
12
+
13
+ </elements-example>
14
+
15
+ ### Different label and value
16
+
17
+ Use the `label` attribute when the visible suggestion should differ from the selected value.
18
+
19
+ <elements-example>
20
+
21
+ ```html
22
+ <w-combobox label="Country" placeholder="Search">
23
+ <option value="us" label="United States">US</option>
24
+ <option value="uk" label="United Kingdom">UK</option>
25
+ <option value="no">Norway</option>
26
+ </w-combobox>
27
+ ```
28
+
29
+ </elements-example>
30
+
31
+ ### Dynamic options
32
+
33
+ Use the `options` property when options come from application state or a remote search.
34
+
35
+ ```js
36
+ const combobox = document.querySelector('w-combobox');
37
+
38
+ combobox.options = [
39
+ { value: 'apple', label: 'Apple' },
40
+ { value: 'banana', label: 'Banana' },
41
+ { value: 'orange', label: 'Orange' },
42
+ ];
43
+ ```
44
+
45
+ Child option content is plain text. Rich option content is not supported.
@@ -0,0 +1 @@
1
+ ## Styling API
@@ -1 +1,29 @@
1
1
  ## Usage
2
+
3
+ Use child `<option>` elements for declarative HTML usage.
4
+
5
+ <elements-example>
6
+
7
+ ```html
8
+ <w-combobox label="Country" placeholder="Search">
9
+ <option value="no">Norway</option>
10
+ <option value="se">Sweden</option>
11
+ <option value="dk">Denmark</option>
12
+ </w-combobox>
13
+ ```
14
+
15
+ </elements-example>
16
+
17
+ The option text is used as the visible suggestion. The `value` attribute is used as the submitted and selected value.
18
+
19
+ For framework usage or dynamic data, you may set the `options` property instead.
20
+
21
+ ```js
22
+ combobox.options = [
23
+ { value: 'no', label: 'Norway' },
24
+ { value: 'se', label: 'Sweden' },
25
+ { value: 'dk', label: 'Denmark' },
26
+ ];
27
+ ```
28
+
29
+ When `options` contains entries, it is used instead of child `<option>` elements.
@@ -1 +1,26 @@
1
1
  ## Accessibility
2
+
3
+ Datepicker renders a labeled date input with a button that opens a calendar dialog. The calendar uses a grid of dates and moves focus into the calendar when it opens.
4
+
5
+ ### Provide A Label
6
+
7
+ Always provide a visible label.
8
+
9
+ ```html
10
+ <w-datepicker label="Departure date" name="departure"></w-datepicker>
11
+ ```
12
+
13
+ The label should describe the date being requested. Avoid generic labels such as "Date" when there are several date fields on the same page.
14
+
15
+ ### Calendar Dialog
16
+
17
+ The calendar popup is rendered as a dialog with `aria-modal="true"`. The month heading is announced with `aria-live="polite"` when users move between months.
18
+
19
+ Each date in the calendar grid has an accessible name formatted using `day-format`.
20
+
21
+ ```html
22
+ <w-datepicker label="Date" name="date" day-format="PPPP"></w-datepicker>
23
+ ```
24
+
25
+ Use a descriptive `day-format` so screen reader users hear the full date, not only the day number.
26
+ See [the Date FNS docs](https://date-fns.org/v4.1.0/docs/format) for formatting options.
@@ -7,15 +7,15 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
7
7
  | Name | Type | Default | Summary |
8
8
  |-|-|-|-|
9
9
  | calendar (JS only) | `HTMLDivElement` | `-` | - |
10
- | day-format | `string` | `'PPPP'` | Decides the format of the day in the calendar as read to screen readers. |
11
- | header-format | `string` | `'MMMM yyyy'` | Decides the format of the date as shown in the calendar header. |
10
+ | day-format | `string` | `'PPPP'` | The date format used for calendar day accessible names. |
11
+ | header-format | `string` | `'MMMM yyyy'` | The date format used in the calendar header. |
12
12
  | input (JS only) | `HTMLInputElement` | `-` | - |
13
13
  | isCalendarOpen (JS only) | `boolean` | `false` | - |
14
- | isDayDisabled (JS only) | `(day: Date) => boolean` | `-` | Lets you control if a date in the calendar should be disabled. |
15
- | label | `string` | `-` | - |
16
- | lang | `string` | `-` | Takes precedence over the `<html>` lang attribute. |
14
+ | isDayDisabled (JS only) | `(day: Date) => boolean` | `-` | Function used to disable dates in the calendar. |
15
+ | label | `string` | `-` | The label displayed above the date input. |
16
+ | lang | `string` | `-` | The locale used for calendar labels and date formatting. |
17
17
  | month (JS only) | `unknown` | `-` | - |
18
- | name | `string` | `-` | - |
18
+ | name | `string` | `-` | The name submitted with the date value. |
19
19
  | navigationDate (JS only) | `Date` | `-` | - |
20
20
  | previousMonthButton (JS only) | `HTMLButtonElement` | `-` | This is the first focusable element, needed for the modal focus trap. |
21
21
  | selectedCell (JS only) | `HTMLTableCellElement` | `-` | - |
@@ -23,8 +23,8 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
23
23
  | shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }` | - |
24
24
  | todayCell (JS only) | `HTMLTableCellElement` | `-` | - |
25
25
  | toggleButton (JS only) | `HTMLButtonElement` | `-` | - |
26
- | value | `string` | `-` | - |
27
- | weekday-format | `string` | `'EEEEEE'` | Decides the format of the weekday as shown above the grid of dates in the calendar. |
26
+ | value | `string` | `-` | The selected date value. |
27
+ | weekday-format | `string` | `'EEEEEE'` | The weekday format shown above the calendar grid. |
28
28
  | weeks (JS only) | `unknown` | `-` | - |
29
29
  | wrapper (JS only) | `HTMLDivElement` | `-` | - |
30
30
 
@@ -39,7 +39,7 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
39
39
 
40
40
  #### day-format
41
41
 
42
- Decides the format of the day in the calendar as read to screen readers.
42
+ The date format used for calendar day accessible names.
43
43
 
44
44
  The syntax is defined by [date-fns/format](https://date-fns.org/v4.1.0/docs/format).
45
45
 
@@ -48,7 +48,7 @@ The syntax is defined by [date-fns/format](https://date-fns.org/v4.1.0/docs/form
48
48
 
49
49
  #### header-format
50
50
 
51
- Decides the format of the date as shown in the calendar header.
51
+ The date format used in the calendar header.
52
52
 
53
53
  The syntax is defined by [date-fns/format](https://date-fns.org/v4.1.0/docs/format).
54
54
 
@@ -71,23 +71,27 @@ The syntax is defined by [date-fns/format](https://date-fns.org/v4.1.0/docs/form
71
71
 
72
72
  #### isDayDisabled (JS only)
73
73
 
74
- Lets you control if a date in the calendar should be disabled.
74
+ Function used to disable dates in the calendar.
75
75
 
76
- This needs to be set on the element instance in JavaScript, not as an HTML attribute.
76
+ Set this on the element instance in JavaScript, not as an HTML attribute. Disabled dates cannot be selected from the calendar.
77
77
 
78
78
  - Type: `(day: Date) => boolean`
79
79
  - Default: `-`
80
80
 
81
81
  #### label
82
82
 
83
+ The label displayed above the date input.
83
84
 
85
+ Use this to give the datepicker a visible and accessible name.
84
86
 
85
87
  - Type: `string`
86
88
  - Default: `-`
87
89
 
88
90
  #### lang
89
91
 
90
- Takes precedence over the `<html>` lang attribute.
92
+ The locale used for calendar labels and date formatting.
93
+
94
+ This takes precedence over the `<html>` `lang` attribute. Supported built-in locales are `en`, `nb`, `sv`, `da`, and `fi`.
91
95
 
92
96
  - Type: `string`
93
97
  - Default: `-`
@@ -101,7 +105,9 @@ Takes precedence over the `<html>` lang attribute.
101
105
 
102
106
  #### name
103
107
 
108
+ The name submitted with the date value.
104
109
 
110
+ Use this when the datepicker belongs to a form and its value should be included in form data.
105
111
 
106
112
  - Type: `string`
107
113
  - Default: `-`
@@ -161,14 +167,16 @@ the query will point to an element that doesn't exist anymore.
161
167
 
162
168
  #### value
163
169
 
170
+ The selected date value.
164
171
 
172
+ Use an ISO date string in `YYYY-MM-DD` format. The value is submitted with the form and is reset to its initial value when the form resets.
165
173
 
166
174
  - Type: `string`
167
175
  - Default: `-`
168
176
 
169
177
  #### weekday-format
170
178
 
171
- Decides the format of the weekday as shown above the grid of dates in the calendar.
179
+ The weekday format shown above the calendar grid.
172
180
 
173
181
  The syntax is defined by [date-fns/format](https://date-fns.org/v4.1.0/docs/format).
174
182