@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
@@ -4,14 +4,239 @@
4
4
 
5
5
  Card is a layout component used for separating content areas on a page.
6
6
 
7
- [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/navigation-card--docs)
8
-
9
7
  ## Usage
10
8
 
9
+ Card is a layout component for visually grouping related content as one item.
10
+
11
+ Use `w-card` for listings, summaries, recommendations, or selectable choices where the grouped content should feel like a single object. The component does not add padding, headings, spacing between children, or semantic structure. Those must be provided by the content inside the card.
12
+
13
+ ### Basic Card
14
+
15
+ ```html
16
+ <w-card>
17
+ <div style="padding: 16px;">
18
+ <h3>Apartment in Oslo</h3>
19
+ <p>Bright 3-room apartment with balcony.</p>
20
+ </div>
21
+ </w-card>
22
+ ```
23
+
24
+ ### Visual Treatments
25
+
26
+ The default card uses an elevated surface. Use `flat` when the card should sit more quietly in the layout.
27
+
28
+ ```html
29
+ <w-card>
30
+ <div style="padding: 16px;">
31
+ <h3>Elevated card</h3>
32
+ <p>Use this for cards that need more visual separation.</p>
33
+ </div>
34
+ </w-card>
35
+
36
+ <w-card flat>
37
+ <div style="padding: 16px;">
38
+ <h3>Flat card</h3>
39
+ <p>Use this for dense layouts or cards inside another surface.</p>
40
+ </div>
41
+ </w-card>
42
+ ```
43
+
44
+ ### Selected Cards
45
+
46
+ Use `selected` when a card represents a selected item or choice.
47
+
48
+ ```html
49
+ <w-card selected>
50
+ <div style="padding: 16px;">
51
+ <h3>Standard delivery</h3>
52
+ <p>Delivered in 2-4 business days.</p>
53
+ </div>
54
+ </w-card>
55
+ ```
56
+
57
+ The `selected` property only controls the card's visual state. Update it from your application state when the selection changes.
58
+
59
+ ### Clickable Cards
60
+
61
+ Use `clickable` when the whole card should behave as one interactive choice. The card becomes keyboard focusable, and Enter or Space triggers a click on the card.
62
+
63
+ ```html
64
+ <w-card clickable>
65
+ <div style="padding: 16px;">
66
+ <h3>Pick up nearby</h3>
67
+ <p>Collect the item from a pickup point.</p>
68
+ </div>
69
+ </w-card>
70
+ ```
71
+
72
+ Listen for the card's click event and update `selected` yourself.
73
+
74
+ ```html
75
+ <w-card clickable selected>
76
+ <div style="padding: 16px;">
77
+ <h3>Home delivery</h3>
78
+ <p>Delivered to your door.</p>
79
+ </div>
80
+ </w-card>
81
+ ```
82
+
83
+ Do not use `clickable` when the card contains separate links, buttons, form controls, or other interactive elements. In those cases, keep the card non-clickable and make the specific control interactive instead.
84
+
11
85
  ## Accessibility
12
86
 
87
+ Card is a visual container. It does not create a heading, landmark, list item, link, button, or other semantic structure for the slotted content.
88
+
89
+ ### Provide Semantic Content
90
+
91
+ Use semantic HTML inside the card so assistive technologies can understand the content.
92
+
93
+ ```html
94
+ <w-card>
95
+ <article style="padding: 16px;" aria-labelledby="listing-heading">
96
+ <h3 id="listing-heading">Apartment in Oslo</h3>
97
+ <p>Bright 3-room apartment with balcony.</p>
98
+ </article>
99
+ </w-card>
100
+ ```
101
+
102
+ Do not rely on the card surface, border, or selected styling to communicate meaning.
103
+
104
+ ### Selected State
105
+
106
+ Use `selected` only when the card represents a selected item or choice.
107
+
108
+ ```html
109
+ <w-card selected>
110
+ <div style="padding: 16px;">
111
+ <h3>Standard delivery</h3>
112
+ <p>Delivered in 2-4 business days.</p>
113
+ </div>
114
+ </w-card>
115
+ ```
116
+
117
+ The selected state should also be clear from the surrounding context, such as a group label, heading, or visible text.
118
+
119
+ ### Clickable Cards
120
+
121
+ Use `clickable` only when the whole card has one action or represents one selectable choice.
122
+
123
+ ```html
124
+ <w-card clickable>
125
+ <div style="padding: 16px;">
126
+ <h3>Home delivery</h3>
127
+ <p>Delivered to your door.</p>
128
+ </div>
129
+ </w-card>
130
+ ```
131
+
132
+ The visible card content should describe what will be selected or activated. Do not put separate links, buttons, form controls, or other interactive elements inside a clickable card.
133
+
134
+ ### Prefer Specific Interactive Elements
135
+
136
+ If only part of the card is interactive, use the appropriate element for that action.
137
+
138
+ Use a link for navigation:
139
+
140
+ ```html
141
+ <w-card>
142
+ <div style="padding: 16px;">
143
+ <h3><a href="/listings/123">Apartment in Oslo</a></h3>
144
+ <p>Bright 3-room apartment with balcony.</p>
145
+ </div>
146
+ </w-card>
147
+ ```
148
+
149
+ Use a button for an action on the current page:
150
+
151
+ ```html
152
+ <w-card>
153
+ <div style="padding: 16px;">
154
+ <h3>Apartment in Oslo</h3>
155
+ <p>Bright 3-room apartment with balcony.</p>
156
+ <w-button variant="primary">Contact seller</w-button>
157
+ </div>
158
+ </w-card>
159
+ ```
160
+
13
161
  ## Examples
14
162
 
163
+ ### Basic
164
+
165
+ <elements-example>
166
+
167
+ ```html
168
+ <w-card>
169
+ <div style="padding: 16px;">
170
+ <h3>Apartment in Oslo</h3>
171
+ <p>Bright 3-room apartment with balcony.</p>
172
+ </div>
173
+ </w-card>
174
+ ```
175
+
176
+ </elements-example>
177
+
178
+ ### Flat
179
+
180
+ <elements-example>
181
+
182
+ ```html
183
+ <w-card flat>
184
+ <div style="padding: 16px;">
185
+ <h3>Order summary</h3>
186
+ <p>Review the item price, delivery, and total before continuing.</p>
187
+ </div>
188
+ </w-card>
189
+ ```
190
+
191
+ </elements-example>
192
+
193
+ ### Selected
194
+
195
+ <elements-example>
196
+
197
+ ```html
198
+ <w-card selected>
199
+ <div style="padding: 16px;">
200
+ <h3>Standard delivery</h3>
201
+ <p>Delivered in 2-4 business days.</p>
202
+ </div>
203
+ </w-card>
204
+ ```
205
+
206
+ </elements-example>
207
+
208
+ ### Flat Selected
209
+
210
+ <elements-example>
211
+
212
+ ```html
213
+ <w-card flat selected>
214
+ <div style="padding: 16px;">
215
+ <h3>Pickup point</h3>
216
+ <p>Collect the item from a nearby pickup point.</p>
217
+ </div>
218
+ </w-card>
219
+ ```
220
+
221
+ </elements-example>
222
+
223
+ ### Clickable
224
+
225
+ <elements-example>
226
+
227
+ ```html
228
+ <w-card clickable>
229
+ <div style="padding: 16px;">
230
+ <h3>Home delivery</h3>
231
+ <p>Delivered to your door.</p>
232
+ </div>
233
+ </w-card>
234
+ ```
235
+
236
+ </elements-example>
237
+
238
+ ## Styling API
239
+
15
240
  ## `<w-card>` API
16
241
 
17
242
  Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
@@ -21,9 +246,9 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
21
246
  | Name | Type | Default | Summary |
22
247
  |-|-|-|-|
23
248
  | buttonText (JS only) | `unknown` | `-` | - |
24
- | clickable | `boolean` | `false` | - |
25
- | flat | `boolean` | `false` | - |
26
- | selected | `boolean` | `false` | - |
249
+ | clickable | `boolean` | `false` | Whether the whole card is interactive. |
250
+ | flat | `boolean` | `false` | Whether the card uses the flat visual treatment. |
251
+ | selected | `boolean` | `false` | Whether the card is visually selected. |
27
252
 
28
253
  ### Property Details
29
254
 
@@ -36,21 +261,27 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
36
261
 
37
262
  #### clickable
38
263
 
264
+ Whether the whole card is interactive.
39
265
 
266
+ When set, the card becomes keyboard focusable and Enter or Space triggers a click on the card. Use this only when the whole card has one action or represents one selectable choice.
40
267
 
41
268
  - Type: `boolean`
42
269
  - Default: `false`
43
270
 
44
271
  #### flat
45
272
 
273
+ Whether the card uses the flat visual treatment.
46
274
 
275
+ Flat cards use a bordered surface instead of the default elevated surface. Use this for denser layouts or when the card sits inside another surface.
47
276
 
48
277
  - Type: `boolean`
49
278
  - Default: `false`
50
279
 
51
280
  #### selected
52
281
 
282
+ Whether the card is visually selected.
53
283
 
284
+ Use this when the card represents a selected item or choice. This only controls the visual selected state; update it from your application state when the selection changes.
54
285
 
55
286
  - Type: `boolean`
56
287
  - Default: `false`
@@ -1 +1,76 @@
1
1
  ## Examples
2
+
3
+ ### Basic
4
+
5
+ <elements-example>
6
+
7
+ ```html
8
+ <w-card>
9
+ <div style="padding: 16px;">
10
+ <h3>Apartment in Oslo</h3>
11
+ <p>Bright 3-room apartment with balcony.</p>
12
+ </div>
13
+ </w-card>
14
+ ```
15
+
16
+ </elements-example>
17
+
18
+ ### Flat
19
+
20
+ <elements-example>
21
+
22
+ ```html
23
+ <w-card flat>
24
+ <div style="padding: 16px;">
25
+ <h3>Order summary</h3>
26
+ <p>Review the item price, delivery, and total before continuing.</p>
27
+ </div>
28
+ </w-card>
29
+ ```
30
+
31
+ </elements-example>
32
+
33
+ ### Selected
34
+
35
+ <elements-example>
36
+
37
+ ```html
38
+ <w-card selected>
39
+ <div style="padding: 16px;">
40
+ <h3>Standard delivery</h3>
41
+ <p>Delivered in 2-4 business days.</p>
42
+ </div>
43
+ </w-card>
44
+ ```
45
+
46
+ </elements-example>
47
+
48
+ ### Flat Selected
49
+
50
+ <elements-example>
51
+
52
+ ```html
53
+ <w-card flat selected>
54
+ <div style="padding: 16px;">
55
+ <h3>Pickup point</h3>
56
+ <p>Collect the item from a nearby pickup point.</p>
57
+ </div>
58
+ </w-card>
59
+ ```
60
+
61
+ </elements-example>
62
+
63
+ ### Clickable
64
+
65
+ <elements-example>
66
+
67
+ ```html
68
+ <w-card clickable>
69
+ <div style="padding: 16px;">
70
+ <h3>Home delivery</h3>
71
+ <p>Delivered to your door.</p>
72
+ </div>
73
+ </w-card>
74
+ ```
75
+
76
+ </elements-example>
@@ -0,0 +1 @@
1
+ ## Styling API
@@ -1 +1,77 @@
1
1
  ## Usage
2
+
3
+ Card is a layout component for visually grouping related content as one item.
4
+
5
+ Use `w-card` for listings, summaries, recommendations, or selectable choices where the grouped content should feel like a single object. The component does not add padding, headings, spacing between children, or semantic structure. Those must be provided by the content inside the card.
6
+
7
+ ### Basic Card
8
+
9
+ ```html
10
+ <w-card>
11
+ <div style="padding: 16px;">
12
+ <h3>Apartment in Oslo</h3>
13
+ <p>Bright 3-room apartment with balcony.</p>
14
+ </div>
15
+ </w-card>
16
+ ```
17
+
18
+ ### Visual Treatments
19
+
20
+ The default card uses an elevated surface. Use `flat` when the card should sit more quietly in the layout.
21
+
22
+ ```html
23
+ <w-card>
24
+ <div style="padding: 16px;">
25
+ <h3>Elevated card</h3>
26
+ <p>Use this for cards that need more visual separation.</p>
27
+ </div>
28
+ </w-card>
29
+
30
+ <w-card flat>
31
+ <div style="padding: 16px;">
32
+ <h3>Flat card</h3>
33
+ <p>Use this for dense layouts or cards inside another surface.</p>
34
+ </div>
35
+ </w-card>
36
+ ```
37
+
38
+ ### Selected Cards
39
+
40
+ Use `selected` when a card represents a selected item or choice.
41
+
42
+ ```html
43
+ <w-card selected>
44
+ <div style="padding: 16px;">
45
+ <h3>Standard delivery</h3>
46
+ <p>Delivered in 2-4 business days.</p>
47
+ </div>
48
+ </w-card>
49
+ ```
50
+
51
+ The `selected` property only controls the card's visual state. Update it from your application state when the selection changes.
52
+
53
+ ### Clickable Cards
54
+
55
+ Use `clickable` when the whole card should behave as one interactive choice. The card becomes keyboard focusable, and Enter or Space triggers a click on the card.
56
+
57
+ ```html
58
+ <w-card clickable>
59
+ <div style="padding: 16px;">
60
+ <h3>Pick up nearby</h3>
61
+ <p>Collect the item from a pickup point.</p>
62
+ </div>
63
+ </w-card>
64
+ ```
65
+
66
+ Listen for the card's click event and update `selected` yourself.
67
+
68
+ ```html
69
+ <w-card clickable selected>
70
+ <div style="padding: 16px;">
71
+ <h3>Home delivery</h3>
72
+ <p>Delivered to your door.</p>
73
+ </div>
74
+ </w-card>
75
+ ```
76
+
77
+ Do not use `clickable` when the card contains separate links, buttons, form controls, or other interactive elements. In those cases, keep the card non-clickable and make the specific control interactive instead.
@@ -0,0 +1,128 @@
1
+ ### `<w-checkbox>` API
2
+
3
+ #### Properties
4
+
5
+ | Name | Type | Default | Summary |
6
+ |-|-|-|-|
7
+ | _computedInvalid (JS only) | `boolean` | `-` | Computed invalid state: combines own invalid with group invalid |
8
+ | checked | `boolean` | `false` | Whether the checkbox is checked. |
9
+ | disabled | `boolean` | `false` | Whether the checkbox is disabled. |
10
+ | indeterminate | `boolean` | `false` | Whether the checkbox is visually indeterminate. |
11
+ | input (JS only) | `HTMLInputElement \| null` | `-` | - |
12
+ | invalid | `boolean` | `false` | Whether the checkbox is visually invalid. |
13
+ | name | `string \| undefined` | `-` | The name of the checkbox. |
14
+ | required | `boolean` | `false` | Whether the checkbox must be checked before form submission. |
15
+ | shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true }` | - |
16
+ | validationMessage (JS only) | `string` | `-` | Returns the validation message if the checkbox is invalid, otherwise an empty string |
17
+ | validity (JS only) | `ValidityState` | `-` | Returns the validity state of the checkbox |
18
+ | value | `string \| null` | `null` | The value submitted when the checkbox is checked. |
19
+
20
+ #### Property Details
21
+
22
+ ##### _computedInvalid (JS only)
23
+
24
+ Computed invalid state: combines own invalid with group invalid
25
+
26
+ - Type: `boolean`
27
+ - Default: `-`
28
+
29
+ ##### checked
30
+
31
+ Whether the checkbox is checked.
32
+
33
+ Checked checkboxes submit their value with form data. The property is reflected to the `checked` attribute.
34
+
35
+ - Type: `boolean`
36
+ - Default: `false`
37
+
38
+ ##### disabled
39
+
40
+ Whether the checkbox is disabled.
41
+
42
+ Disabled checkboxes cannot be focused, changed, or submitted with form data.
43
+
44
+ - Type: `boolean`
45
+ - Default: `false`
46
+
47
+ ##### indeterminate
48
+
49
+ Whether the checkbox is visually indeterminate.
50
+
51
+ Use this for parent options that represent a mixed set of child selections. Clicking the checkbox clears the indeterminate state and sets the checkbox to checked.
52
+
53
+ - Type: `boolean`
54
+ - Default: `false`
55
+
56
+ ##### input (JS only)
57
+
58
+
59
+
60
+ - Type: `HTMLInputElement | null`
61
+ - Default: `-`
62
+
63
+ ##### invalid
64
+
65
+ Whether the checkbox is visually invalid.
66
+
67
+ Use this to show an externally managed validation error. Required validation also sets the invalid state after the user interacts with the checkbox or tries to submit the form.
68
+
69
+ - Type: `boolean`
70
+ - Default: `false`
71
+
72
+ ##### name
73
+
74
+ The name of the checkbox.
75
+
76
+ When the checkbox is checked and belongs to a form, this name is submitted with the checkbox value. If the checkbox is inside a `w-checkbox-group` with a name, the group name is used when the checkbox does not have its own name.
77
+
78
+ - Type: `string | undefined`
79
+ - Default: `-`
80
+
81
+ ##### required
82
+
83
+ Whether the checkbox must be checked before form submission.
84
+
85
+ A required checkbox is invalid until it is checked. For requiring at least one option in a set, use `required` on `w-checkbox-group`.
86
+
87
+ - Type: `boolean`
88
+ - Default: `false`
89
+
90
+ ##### shadowRootOptions (JS only)
91
+
92
+
93
+
94
+ - Type: `object`
95
+ - Default: `{ ...LitElement.shadowRootOptions, delegatesFocus: true }`
96
+
97
+ ##### validationMessage (JS only)
98
+
99
+ Returns the validation message if the checkbox is invalid, otherwise an empty string
100
+
101
+ - Type: `string`
102
+ - Default: `-`
103
+
104
+ ##### validity (JS only)
105
+
106
+ Returns the validity state of the checkbox
107
+
108
+ - Type: `ValidityState`
109
+ - Default: `-`
110
+
111
+ ##### value
112
+
113
+ The value submitted when the checkbox is checked.
114
+
115
+ If no value attribute is set, the checkbox defaults to `on`. Unchecked and disabled checkboxes do not submit a value.
116
+
117
+ - Type: `string | null`
118
+ - Default: `null`
119
+
120
+ #### Events
121
+
122
+ ##### change
123
+
124
+
125
+
126
+ - Type: `Event`
127
+
128
+
@@ -0,0 +1,134 @@
1
+ # Checkbox (w-checkbox)
2
+
3
+ ## Description
4
+
5
+ Checkbox lets users select one or more options. Use it for independent yes/no choices, multi-select lists, and terms or consent confirmations.
6
+
7
+ ### `<w-checkbox>` API
8
+
9
+ #### Properties
10
+
11
+ | Name | Type | Default | Summary |
12
+ |-|-|-|-|
13
+ | _computedInvalid (JS only) | `boolean` | `-` | Computed invalid state: combines own invalid with group invalid |
14
+ | checked | `boolean` | `false` | Whether the checkbox is checked. |
15
+ | disabled | `boolean` | `false` | Whether the checkbox is disabled. |
16
+ | indeterminate | `boolean` | `false` | Whether the checkbox is visually indeterminate. |
17
+ | input (JS only) | `HTMLInputElement \| null` | `-` | - |
18
+ | invalid | `boolean` | `false` | Whether the checkbox is visually invalid. |
19
+ | name | `string \| undefined` | `-` | The name of the checkbox. |
20
+ | required | `boolean` | `false` | Whether the checkbox must be checked before form submission. |
21
+ | shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true }` | - |
22
+ | validationMessage (JS only) | `string` | `-` | Returns the validation message if the checkbox is invalid, otherwise an empty string |
23
+ | validity (JS only) | `ValidityState` | `-` | Returns the validity state of the checkbox |
24
+ | value | `string \| null` | `null` | The value submitted when the checkbox is checked. |
25
+
26
+ #### Property Details
27
+
28
+ ##### _computedInvalid (JS only)
29
+
30
+ Computed invalid state: combines own invalid with group invalid
31
+
32
+ - Type: `boolean`
33
+ - Default: `-`
34
+
35
+ ##### checked
36
+
37
+ Whether the checkbox is checked.
38
+
39
+ Checked checkboxes submit their value with form data. The property is reflected to the `checked` attribute.
40
+
41
+ - Type: `boolean`
42
+ - Default: `false`
43
+
44
+ ##### disabled
45
+
46
+ Whether the checkbox is disabled.
47
+
48
+ Disabled checkboxes cannot be focused, changed, or submitted with form data.
49
+
50
+ - Type: `boolean`
51
+ - Default: `false`
52
+
53
+ ##### indeterminate
54
+
55
+ Whether the checkbox is visually indeterminate.
56
+
57
+ Use this for parent options that represent a mixed set of child selections. Clicking the checkbox clears the indeterminate state and sets the checkbox to checked.
58
+
59
+ - Type: `boolean`
60
+ - Default: `false`
61
+
62
+ ##### input (JS only)
63
+
64
+
65
+
66
+ - Type: `HTMLInputElement | null`
67
+ - Default: `-`
68
+
69
+ ##### invalid
70
+
71
+ Whether the checkbox is visually invalid.
72
+
73
+ Use this to show an externally managed validation error. Required validation also sets the invalid state after the user interacts with the checkbox or tries to submit the form.
74
+
75
+ - Type: `boolean`
76
+ - Default: `false`
77
+
78
+ ##### name
79
+
80
+ The name of the checkbox.
81
+
82
+ When the checkbox is checked and belongs to a form, this name is submitted with the checkbox value. If the checkbox is inside a `w-checkbox-group` with a name, the group name is used when the checkbox does not have its own name.
83
+
84
+ - Type: `string | undefined`
85
+ - Default: `-`
86
+
87
+ ##### required
88
+
89
+ Whether the checkbox must be checked before form submission.
90
+
91
+ A required checkbox is invalid until it is checked. For requiring at least one option in a set, use `required` on `w-checkbox-group`.
92
+
93
+ - Type: `boolean`
94
+ - Default: `false`
95
+
96
+ ##### shadowRootOptions (JS only)
97
+
98
+
99
+
100
+ - Type: `object`
101
+ - Default: `{ ...LitElement.shadowRootOptions, delegatesFocus: true }`
102
+
103
+ ##### validationMessage (JS only)
104
+
105
+ Returns the validation message if the checkbox is invalid, otherwise an empty string
106
+
107
+ - Type: `string`
108
+ - Default: `-`
109
+
110
+ ##### validity (JS only)
111
+
112
+ Returns the validity state of the checkbox
113
+
114
+ - Type: `ValidityState`
115
+ - Default: `-`
116
+
117
+ ##### value
118
+
119
+ The value submitted when the checkbox is checked.
120
+
121
+ If no value attribute is set, the checkbox defaults to `on`. Unchecked and disabled checkboxes do not submit a value.
122
+
123
+ - Type: `string | null`
124
+ - Default: `null`
125
+
126
+ #### Events
127
+
128
+ ##### change
129
+
130
+
131
+
132
+ - Type: `Event`
133
+
134
+