@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
@@ -0,0 +1,72 @@
1
+ ## Styling API
2
+
3
+ This component supports styling through **component tokens** (CSS custom properties with a --w-c- prefix) and **parts**.
4
+
5
+ ### Parts
6
+
7
+ Use `::part(...)` from outside the component.
8
+
9
+ - `base` — the clickable element (`<button>` or `<w-link>`)
10
+
11
+ Example:
12
+
13
+ ```css
14
+ w-button::part(base) {
15
+ text-transform: uppercase;
16
+ }
17
+ ```
18
+
19
+ ### Component tokens
20
+
21
+ Set these on `w-button` to override visuals.
22
+
23
+ ```css
24
+ w-button {
25
+ --w-c-button-bg: var(--w-s-color-background-primary);
26
+ --w-c-button-color: var(--w-s-color-text-inverted);
27
+ }
28
+ ```
29
+
30
+ #### Layout & typography
31
+
32
+ - `--w-c-button-radius`
33
+ - `--w-c-button-font-size`
34
+ - `--w-c-button-line-height`
35
+ - `--w-c-button-font-weight`
36
+ - `--w-c-button-padding-x`
37
+ - `--w-c-button-padding-y`
38
+
39
+ #### Background
40
+
41
+ - `--w-c-button-bg`
42
+ - `--w-c-button-bg-hover`
43
+ - `--w-c-button-bg-active`
44
+
45
+ #### Text color
46
+
47
+ - `--w-c-button-color`
48
+ - `--w-c-button-color-hover`
49
+ - `--w-c-button-color-active`
50
+
51
+ #### Border
52
+
53
+ - `--w-c-button-border-width`
54
+ - `--w-c-button-border-color`
55
+ - `--w-c-button-border-color-hover`
56
+ - `--w-c-button-border-color-active`
57
+
58
+ #### Focus
59
+
60
+ - `--w-c-button-outline-width`
61
+ - `--w-c-button-outline-color`
62
+ - `--w-c-button-outline-offset`
63
+
64
+ #### Motion
65
+
66
+ - `--w-c-button-transition`
67
+
68
+ ### Notes
69
+
70
+ - Variant defaults are set internally using fallbacks, so overriding tokens works across variants.
71
+ - The `quiet` boolean is supported for backwards compatibility. Prefer `variant="quiet"` going forward.
72
+ - When `loading` is set, the button is treated as disabled (no pointer interaction).
@@ -1 +1,90 @@
1
1
  ## Usage
2
+
3
+ Button is used for actions. Use it when the user can submit, save, confirm, cancel, open, close, or trigger something on the current page.
4
+
5
+ Use a link instead when the user is navigating to another page. If the control should look like a button but navigate like a link, use `w-link`.
6
+
7
+ ### Basic Button
8
+
9
+ ```html
10
+ <w-button>Save</w-button>
11
+ ```
12
+
13
+ The default `variant` is `secondary` and the default `type` is `button`.
14
+
15
+ ### Variants
16
+
17
+ Choose the variant based on the action's priority and context:
18
+
19
+ - `primary`: the main action in a view or flow
20
+ - `secondary`: secondary or tertiary actions; this is the default
21
+ - `negative`: destructive or high-risk actions
22
+ - `negativeQuiet`: low-emphasis destructive actions
23
+ - `utility`: compact utility actions
24
+ - `utilityQuiet`: low-emphasis utility actions
25
+ - `quiet`: low-emphasis actions, often near other buttons
26
+ - `link`: (@deprecated) action styled like an inline link
27
+ - `pill`: circular icon-style controls
28
+ - `overlay`, `overlayQuiet`, `overlayInverted`, `overlayInvertedQuiet`: controls placed on top of media or elevated surfaces
29
+
30
+ ```html
31
+ <w-button variant="primary">Publish</w-button>
32
+ <w-button variant="secondary">Cancel</w-button>
33
+ <w-button variant="negative">Delete</w-button>
34
+ <w-button variant="utility">Filter</w-button>
35
+ ```
36
+
37
+ ### Sizes And Width
38
+
39
+ Use `small` for compact layouts. Use `full-width` when the button should fill its parent, such as in narrow mobile layouts.
40
+
41
+ ```html
42
+ <w-button variant="primary" small>Save</w-button>
43
+ <w-button variant="primary" full-width>Continue</w-button>
44
+ ```
45
+
46
+ ### Icon-Only Buttons
47
+
48
+ Use `variant="pill"` for circular icon-only controls. Include accessible text in the slotted content so the internal button has a name.
49
+
50
+ ```html
51
+ <w-button variant="pill" icon-only>
52
+ <w-icon name="Close"></w-icon>
53
+ <span class="sr-only">Close</span>
54
+ </w-button>
55
+ ```
56
+
57
+ ### Loading
58
+
59
+ Use `loading` after the user triggers an action and the action is in progress.
60
+
61
+ ```html
62
+ <w-button variant="primary" loading>Saving</w-button>
63
+ ```
64
+
65
+ Keep the button text descriptive while loading. Do not rely on the loading animation alone to explain what is happening.
66
+
67
+ ### Form Buttons
68
+
69
+ Use `type="submit"` to submit the containing form and `type="reset"` to reset it. Use `name` and `value` when the button value should be included in form handling.
70
+
71
+ ```html
72
+ <form>
73
+ <w-button type="submit" name="intent" value="save">Save</w-button>
74
+ <w-button type="reset">Reset</w-button>
75
+ </form>
76
+ ```
77
+
78
+ ### Link Styled As Button
79
+
80
+ Use an `a` tag if you need a link that looks and behaves like a link, do not use `w-button`.
81
+
82
+ ### Link Styled As Button
83
+
84
+ Use `w-link` if you need a link that looks like a button.
85
+
86
+ ### Disabled Actions
87
+
88
+ Avoid disabled buttons where possible. Disabled controls often make it harder for users to understand what is missing or how to continue.
89
+
90
+ Prefer an enabled button with clear validation or explanatory feedback near the related field.
@@ -1 +1,75 @@
1
1
  ## Accessibility
2
+
3
+ Card is a visual container. It does not create a heading, landmark, list item, link, button, or other semantic structure for the slotted content.
4
+
5
+ ### Provide Semantic Content
6
+
7
+ Use semantic HTML inside the card so assistive technologies can understand the content.
8
+
9
+ ```html
10
+ <w-card>
11
+ <article style="padding: 16px;" aria-labelledby="listing-heading">
12
+ <h3 id="listing-heading">Apartment in Oslo</h3>
13
+ <p>Bright 3-room apartment with balcony.</p>
14
+ </article>
15
+ </w-card>
16
+ ```
17
+
18
+ Do not rely on the card surface, border, or selected styling to communicate meaning.
19
+
20
+ ### Selected State
21
+
22
+ Use `selected` only when the card represents a selected item or choice.
23
+
24
+ ```html
25
+ <w-card selected>
26
+ <div style="padding: 16px;">
27
+ <h3>Standard delivery</h3>
28
+ <p>Delivered in 2-4 business days.</p>
29
+ </div>
30
+ </w-card>
31
+ ```
32
+
33
+ The selected state should also be clear from the surrounding context, such as a group label, heading, or visible text.
34
+
35
+ ### Clickable Cards
36
+
37
+ Use `clickable` only when the whole card has one action or represents one selectable choice.
38
+
39
+ ```html
40
+ <w-card clickable>
41
+ <div style="padding: 16px;">
42
+ <h3>Home delivery</h3>
43
+ <p>Delivered to your door.</p>
44
+ </div>
45
+ </w-card>
46
+ ```
47
+
48
+ 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.
49
+
50
+ ### Prefer Specific Interactive Elements
51
+
52
+ If only part of the card is interactive, use the appropriate element for that action.
53
+
54
+ Use a link for navigation:
55
+
56
+ ```html
57
+ <w-card>
58
+ <div style="padding: 16px;">
59
+ <h3><a href="/listings/123">Apartment in Oslo</a></h3>
60
+ <p>Bright 3-room apartment with balcony.</p>
61
+ </div>
62
+ </w-card>
63
+ ```
64
+
65
+ Use a button for an action on the current page:
66
+
67
+ ```html
68
+ <w-card>
69
+ <div style="padding: 16px;">
70
+ <h3>Apartment in Oslo</h3>
71
+ <p>Bright 3-room apartment with balcony.</p>
72
+ <w-button variant="primary">Contact seller</w-button>
73
+ </div>
74
+ </w-card>
75
+ ```
@@ -7,9 +7,9 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
7
7
  | Name | Type | Default | Summary |
8
8
  |-|-|-|-|
9
9
  | buttonText (JS only) | `unknown` | `-` | - |
10
- | clickable | `boolean` | `false` | - |
11
- | flat | `boolean` | `false` | - |
12
- | selected | `boolean` | `false` | - |
10
+ | clickable | `boolean` | `false` | Whether the whole card is interactive. |
11
+ | flat | `boolean` | `false` | Whether the card uses the flat visual treatment. |
12
+ | selected | `boolean` | `false` | Whether the card is visually selected. |
13
13
 
14
14
  ### Property Details
15
15
 
@@ -22,21 +22,27 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
22
22
 
23
23
  #### clickable
24
24
 
25
+ Whether the whole card is interactive.
25
26
 
27
+ 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.
26
28
 
27
29
  - Type: `boolean`
28
30
  - Default: `false`
29
31
 
30
32
  #### flat
31
33
 
34
+ Whether the card uses the flat visual treatment.
32
35
 
36
+ 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.
33
37
 
34
38
  - Type: `boolean`
35
39
  - Default: `false`
36
40
 
37
41
  #### selected
38
42
 
43
+ Whether the card is visually selected.
39
44
 
45
+ 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.
40
46
 
41
47
  - Type: `boolean`
42
48
  - Default: `false`
@@ -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