@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,107 @@
4
4
 
5
5
  Buttons are used to perform actions, with different visuals for different needs.
6
6
 
7
- [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/buttons-link--docs)
8
-
9
7
  ## Usage
10
8
 
9
+ **Do:**
10
+
11
+ - Use the `<w-link>` component when you need a link that looks like a button.
12
+
13
+ **Do Not:**
14
+
15
+ - Use the `<w-link>` component when you need a link that looks like a link. In that case, use the native `<a>` tag.
16
+ - Use the `<w-link>` component when you need a button that looks like a button. In that case, use the native `<w-button>` tag.
17
+
18
+ The following table illustrates use cases and which element to use for the purpose.
19
+
20
+ | If desired behaviour is | and desired styling is | then use |
21
+ | ----------------------- | ---------------------- | ------------ |
22
+ | link | button | `<w-link>` |
23
+ | button | button | `<w-button>` |
24
+ | link | link | `<a>` |
25
+ | button | link | `<w-button>` |
26
+
11
27
  ## Accessibility
12
28
 
13
29
  ## Examples
14
30
 
31
+ ### Primary
32
+
33
+ <elements-example>
34
+
35
+ ```html
36
+ <w-link variant="primary" href="#">Go to the top of this page</w-link>
37
+ ```
38
+
39
+ </elements-example>
40
+
41
+ ### Secondary
42
+
43
+ This is the default appearance.
44
+
45
+ <elements-example>
46
+
47
+ ```html
48
+ <w-link href="#">Go to the top of this page</w-link>
49
+ ```
50
+
51
+ </elements-example>
52
+
53
+ ### Negative
54
+
55
+ <elements-example>
56
+
57
+ ```html
58
+ <w-link variant="negative" href="#">Go to the top of this page</w-link>
59
+ ```
60
+
61
+ </elements-example>
62
+
63
+ ### Utility
64
+
65
+ <elements-example>
66
+
67
+ ```html
68
+ <w-link variant="utility" href="#">Go to the top of this page</w-link>
69
+ ```
70
+
71
+ </elements-example>
72
+
73
+ ### Quiet
74
+
75
+ <elements-example>
76
+
77
+ ```html
78
+ <w-link variant="quiet" href="#">Go to the top of this page</w-link>
79
+ ```
80
+
81
+ </elements-example>
82
+
83
+ ### Small
84
+
85
+ All variants can be small.
86
+
87
+ <elements-example>
88
+
89
+ ```html
90
+ <w-link href="#" small>Go to the top of this page</w-link>
91
+ ```
92
+
93
+ </elements-example>
94
+
95
+ ### Full width
96
+
97
+
98
+ <elements-example>
99
+
100
+ ```html
101
+ <w-link href="#" full-width>Go to the top of this page</w-link>
102
+ ```
103
+
104
+ </elements-example>
105
+
106
+ ## Styling API
107
+
15
108
  ## `<w-link>` API
16
109
 
17
110
  Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
@@ -20,77 +113,73 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
20
113
 
21
114
  | Name | Type | Default | Summary |
22
115
  |-|-|-|-|
23
- | autofocus | `boolean` | `false` | - |
24
- | disabled | `boolean` | `false` | - |
25
- | full-width | `boolean` | `false` | - |
26
- | href | `string` | `-` | - |
27
- | rel | `string` | `-` | - |
28
- | shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }` | - |
29
- | small | `boolean` | `false` | - |
30
- | target | `string` | `-` | - |
31
- | variant | [`ButtonVariant`](#buttonvariant) | `-` | - |
116
+ | autofocus | `boolean` | `false` | Focus the link after it is rendered |
117
+ | disabled | `boolean` | `false` | Applies disabled styling, but you need to disable clicks on your own. |
118
+ | full-width | `boolean` | `false` | Makes the link take up the full width of its parent |
119
+ | href | `string` | `-` | The URL the link points to |
120
+ | rel | `string` | `-` | Relationship of the linked URL. |
121
+ | small | `boolean` | `false` | Render a smaller version |
122
+ | target | `string` | `-` | Where to display the linked URL (e.g. `_blank`) |
123
+ | variant | [`ButtonVariant`](#buttonvariant) | `-` | Visual style for the link/button. |
32
124
 
33
125
  ### Property Details
34
126
 
35
127
  #### autofocus
36
128
 
37
-
129
+ Focus the link after it is rendered
38
130
 
39
131
  - Type: `boolean`
40
132
  - Default: `false`
41
133
 
42
134
  #### disabled
43
135
 
136
+ Applies disabled styling, but you need to disable clicks on your own.
44
137
 
138
+ The component renders an `<a>` element; `disabled` affects styling, but does not inherently prevent navigation. If you need to fully disable interaction, omit `href` and/or prevent default click behavior.
45
139
 
46
140
  - Type: `boolean`
47
141
  - Default: `false`
48
142
 
49
143
  #### full-width
50
144
 
51
-
145
+ Makes the link take up the full width of its parent
52
146
 
53
147
  - Type: `boolean`
54
148
  - Default: `false`
55
149
 
56
150
  #### href
57
151
 
58
-
152
+ The URL the link points to
59
153
 
60
154
  - Type: `string`
61
155
  - Default: `-`
62
156
 
63
157
  #### rel
64
158
 
159
+ Relationship of the linked URL.
65
160
 
161
+ If `target="_blank"` and `rel` is not provided, the component uses `noopener`.
66
162
 
67
163
  - Type: `string`
68
164
  - Default: `-`
69
165
 
70
- #### shadowRootOptions (JS only)
71
-
72
-
73
-
74
- - Type: `object`
75
- - Default: `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }`
76
-
77
166
  #### small
78
167
 
79
-
168
+ Render a smaller version
80
169
 
81
170
  - Type: `boolean`
82
171
  - Default: `false`
83
172
 
84
173
  #### target
85
174
 
86
-
175
+ Where to display the linked URL (e.g. `_blank`)
87
176
 
88
177
  - Type: `string`
89
178
  - Default: `-`
90
179
 
91
180
  #### variant
92
181
 
93
-
182
+ Visual style for the link/button.
94
183
 
95
184
  - Type: [`ButtonVariant`](#buttonvariant)
96
185
  - Default: `-`
@@ -0,0 +1 @@
1
+ ## Styling API
@@ -1 +1,19 @@
1
1
  ## Usage
2
+
3
+ **Do:**
4
+
5
+ - Use the `<w-link>` component when you need a link that looks like a button.
6
+
7
+ **Do Not:**
8
+
9
+ - Use the `<w-link>` component when you need a link that looks like a link. In that case, use the native `<a>` tag.
10
+ - Use the `<w-link>` component when you need a button that looks like a button. In that case, use the native `<w-button>` tag.
11
+
12
+ The following table illustrates use cases and which element to use for the purpose.
13
+
14
+ | If desired behaviour is | and desired styling is | then use |
15
+ | ----------------------- | ---------------------- | ------------ |
16
+ | link | button | `<w-link>` |
17
+ | button | button | `<w-button>` |
18
+ | link | link | `<a>` |
19
+ | button | link | `<w-button>` |
@@ -0,0 +1,51 @@
1
+ ## `<w-modal>` API
2
+
3
+ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
4
+
5
+ ### Properties
6
+
7
+ | Name | Type | Default | Summary |
8
+ |-|-|-|-|
9
+ | content-id | `string` | `-` | - |
10
+ | ignore-backdrop-clicks | `boolean` | `false` | Ignores clicks to the backdrop when set |
11
+ | show | `boolean` | `false` | Controls if the modal should show or hide. |
12
+
13
+ ### Property Details
14
+
15
+ #### content-id
16
+
17
+
18
+
19
+ - Type: `string`
20
+ - Default: `-`
21
+
22
+ #### ignore-backdrop-clicks
23
+
24
+ Ignores clicks to the backdrop when set
25
+
26
+ - Type: `boolean`
27
+ - Default: `false`
28
+
29
+ #### show
30
+
31
+ Controls if the modal should show or hide.
32
+
33
+ You can also call the `open()` and `close()` methods.
34
+
35
+ - Type: `boolean`
36
+ - Default: `false`
37
+
38
+ ### Events
39
+
40
+ #### hidden
41
+
42
+
43
+
44
+ - Type: `CustomEvent`
45
+ #### shown
46
+
47
+
48
+
49
+ - Type: `CustomEvent`
50
+
51
+
@@ -0,0 +1,67 @@
1
+ ## Examples
2
+
3
+
4
+
5
+ ### With a titlebar
6
+
7
+ <elements-example>
8
+
9
+ ```html
10
+ <div>
11
+ <w-button aria-haspopup='dialog'>
12
+ Open a modal
13
+ </w-button>
14
+ <w-modal>
15
+ <w-modal-header
16
+ slot='header'
17
+ title='An example modal'
18
+ ></w-modal-header>
19
+ <div slot='content'>
20
+ <w-button variant='utility' small>
21
+ Toggle back button
22
+ </w-button>
23
+ <p>
24
+ I bomb atomically, Socrates' philosophies and hypotheses...
25
+ </p>
26
+ <p>
27
+ First I'm gonna getcha, once I gotcha, I gat-cha...
28
+ </p>
29
+ </div>
30
+ <w-modal-footer slot='footer'>
31
+ <w-button variant='primary'>
32
+ OK
33
+ </w-button>
34
+ </w-modal-footer>
35
+ </w-modal>
36
+ </div>
37
+ ```
38
+
39
+ </elements-example>
40
+
41
+ ### With an image at the top
42
+
43
+ <elements-example>
44
+
45
+ ```html
46
+ <w-button aria-haspopup="dialog" commandfor="my-modal" command="show-modal">
47
+ Open a modal
48
+ </w-button>
49
+ <w-modal id="my-modal">
50
+ <w-modal-header slot="header" title="Look a doggo!">
51
+ <img
52
+ slot="top"
53
+ class="h-[256] w-full object-cover"
54
+ src="/pages/public/unocssmusical.jpeg"
55
+ alt="AI-generated picture of a band in colourful setup"
56
+ >
57
+ </w-modal-header>
58
+ <div slot="content">
59
+ <p>I bomb atomically, Socrates' philosophies and hypotheses...</p>
60
+ </div>
61
+ <w-modal-footer slot="footer">
62
+ <w-button variant="primary" id="modal-close-button-two">OK</w-button>
63
+ </w-modal-footer>
64
+ </w-modal>
65
+ ```
66
+
67
+ </elements-example>
@@ -0,0 +1,240 @@
1
+ # Modal (w-modal)
2
+
3
+ ## Description
4
+
5
+ Modals (or dialogs) display important information that users need to acknowledge.
6
+
7
+ ## Usage
8
+
9
+ To creat a modal you need three different components:
10
+
11
+ - `<w-modal>` - the parent component.
12
+ - `<w-modal-header>` - for the title and close button.
13
+ - `<w-modal-footer>` - for the actions such as Cancel and Confirm.
14
+
15
+ ### JavaScript API
16
+
17
+ To open and close the modal using JavaScript, get a reference to the `<w-modal>` and call `open()` and `close()` respectively.
18
+
19
+
20
+ <elements-example>
21
+
22
+ ```html
23
+ <w-button data-testid="js-example-show" aria-haspopup="dialog">Show me some lyrics</w-button>
24
+ <w-modal data-testid="js-example-modal">
25
+ <w-modal-header slot="header" title="Triumph by Wu Tang Clan"></w-modal-header>
26
+ <div slot="content">
27
+ <p>
28
+ My beats travel like a vortex through your spine, to the top of your
29
+ cerebral cortex. The rebel, I make more noise than heavy metal. Now,
30
+ lo and behold, another deadly episode, bound to catch another charge
31
+ when I explode Perpendicular to the square we stay in gold like
32
+ Flair, escape from your dragon's lair in particular. Handcuffed in
33
+ the back of a bus, forty of us. Slammin a hype verse til ya head
34
+ burst. Handcuffed in the back of a bus, forty of us. I bomb
35
+ atomically Socrates' philosophies and hypothesis can't define how I
36
+ be dropping these mockeries. I be that insane one from the psycho
37
+ ward, I'm on the trigger, plus I got the Wu-Tang sword. Step through
38
+ your section with the Force like Luke Skywalker, rhyme author,
39
+ orchestrate mind torture.
40
+ </p>
41
+ </div>
42
+ <w-modal-footer slot="footer">
43
+ <div class="flex gap-16">
44
+ <w-button variant="secondary" data-testid="js-example-cancel">Cancel</w-button>
45
+ <w-button variant="primary" data-testid="js-example-confirm">Confirm</w-button>
46
+ </div>
47
+ </w-modal-footer>
48
+ </w-modal>
49
+
50
+ <script>
51
+ const modal = document.querySelector('w-modal[data-testid="js-example-modal"]');
52
+
53
+ const openButton = document.querySelector('w-button[data-testid="js-example-show"]');
54
+ const confirmButton = document.querySelector('w-button[data-testid="js-example-confirm"]');
55
+ const cancelButton = document.querySelector('w-button[data-testid="js-example-cancel"]');
56
+
57
+ openButton.addEventListener('click', () => modal.open());
58
+ confirmButton.addEventListener('click', () => modal.close());
59
+ cancelButton.addEventListener('click', () => modal.close());
60
+ </script>
61
+ ```
62
+
63
+ </elements-example>
64
+
65
+ ### Invoker Commands
66
+
67
+ In [supported browsers](https://caniuse.com/?search=commandfor) (or [if you include the polyfill](https://github.com/keithamus/invokers-polyfill)) you can use the [Invoker Commands API](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API) to potentially skip JavaScript alltogether.
68
+
69
+ The available commands for `<w-modal>` are:
70
+
71
+ - `--show-modal`
72
+ - `--close`
73
+ - `--confirm`
74
+
75
+ <elements-example>
76
+
77
+ ```html
78
+ <w-button commandfor="invoker-modal" command="--show-modal" aria-haspopup="dialog">Show me some lyrics</w-button>
79
+ <w-modal id="invoker-modal">
80
+ <w-modal-header slot="header" title="Triumph by Wu Tang Clan"></w-modal-header>
81
+ <div slot="content">
82
+ <p>
83
+ First I'm gonna getcha, once I gotcha, I gat-cha, You could never
84
+ capture the Method Man's stature. So uhh, tic toc and keep ticking,
85
+ while I get you flipping off what I'm kicking. Yes, the rhythm, the
86
+ rebel, alone in my level heat it up past the boiling point of metal.
87
+ Shackling the masses with drastic rap tactics, graphic displays melt
88
+ the steel like blacksmiths. My beats travel like a vortex through
89
+ your spine, to the top of your cerebral cortex. Yes, the rhythm, the
90
+ rebel, alone in my level heat it up past the boiling point of metal.
91
+ Small change, they putting shame in the game. Murderous material,
92
+ made by a madman, it's the mic wrecker, Inspector, bad man.
93
+ </p>
94
+ </div>
95
+ <w-modal-footer slot="footer">
96
+ <div class="flex gap-16">
97
+ <w-button variant="secondary" commandfor="invoker-modal" command="--close">Dope</w-button>
98
+ <w-button variant="primary" commandfor="invoker-modal" command="--confirm">Dope</w-button>
99
+ </div>
100
+ </w-modal-footer>
101
+ </w-modal>
102
+ ```
103
+
104
+ </elements-example>
105
+
106
+ Since `--confirm` and `--cancel` both close the modal, but mean different things, listen for the `command` event on `w-modal` to do stuff on the `--confirm` event, such as submit a response to an API. You can listen for the other commands as well (including `--show-modal`) if you need to add tracking events for example.
107
+
108
+ ```ts
109
+ const modal = document.querySelector('w-modal');
110
+
111
+ modal.addEventListener('command', function (event: CommandEvent) {
112
+ if (event.command === '--confirm') {
113
+ console.log("Doing stuff!");
114
+ }
115
+ });
116
+ ```
117
+
118
+ ## Accessibility
119
+
120
+ ## Examples
121
+
122
+
123
+
124
+ ### With a titlebar
125
+
126
+ <elements-example>
127
+
128
+ ```html
129
+ <div>
130
+ <w-button aria-haspopup='dialog'>
131
+ Open a modal
132
+ </w-button>
133
+ <w-modal>
134
+ <w-modal-header
135
+ slot='header'
136
+ title='An example modal'
137
+ ></w-modal-header>
138
+ <div slot='content'>
139
+ <w-button variant='utility' small>
140
+ Toggle back button
141
+ </w-button>
142
+ <p>
143
+ I bomb atomically, Socrates' philosophies and hypotheses...
144
+ </p>
145
+ <p>
146
+ First I'm gonna getcha, once I gotcha, I gat-cha...
147
+ </p>
148
+ </div>
149
+ <w-modal-footer slot='footer'>
150
+ <w-button variant='primary'>
151
+ OK
152
+ </w-button>
153
+ </w-modal-footer>
154
+ </w-modal>
155
+ </div>
156
+ ```
157
+
158
+ </elements-example>
159
+
160
+ ### With an image at the top
161
+
162
+ <elements-example>
163
+
164
+ ```html
165
+ <w-button aria-haspopup="dialog" commandfor="my-modal" command="show-modal">
166
+ Open a modal
167
+ </w-button>
168
+ <w-modal id="my-modal">
169
+ <w-modal-header slot="header" title="Look a doggo!">
170
+ <img
171
+ slot="top"
172
+ class="h-[256] w-full object-cover"
173
+ src="/pages/public/unocssmusical.jpeg"
174
+ alt="AI-generated picture of a band in colourful setup"
175
+ >
176
+ </w-modal-header>
177
+ <div slot="content">
178
+ <p>I bomb atomically, Socrates' philosophies and hypotheses...</p>
179
+ </div>
180
+ <w-modal-footer slot="footer">
181
+ <w-button variant="primary" id="modal-close-button-two">OK</w-button>
182
+ </w-modal-footer>
183
+ </w-modal>
184
+ ```
185
+
186
+ </elements-example>
187
+
188
+ ## Styling API
189
+
190
+ ## `<w-modal>` API
191
+
192
+ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
193
+
194
+ ### Properties
195
+
196
+ | Name | Type | Default | Summary |
197
+ |-|-|-|-|
198
+ | content-id | `string` | `-` | - |
199
+ | ignore-backdrop-clicks | `boolean` | `false` | Ignores clicks to the backdrop when set |
200
+ | show | `boolean` | `false` | Controls if the modal should show or hide. |
201
+
202
+ ### Property Details
203
+
204
+ #### content-id
205
+
206
+
207
+
208
+ - Type: `string`
209
+ - Default: `-`
210
+
211
+ #### ignore-backdrop-clicks
212
+
213
+ Ignores clicks to the backdrop when set
214
+
215
+ - Type: `boolean`
216
+ - Default: `false`
217
+
218
+ #### show
219
+
220
+ Controls if the modal should show or hide.
221
+
222
+ You can also call the `open()` and `close()` methods.
223
+
224
+ - Type: `boolean`
225
+ - Default: `false`
226
+
227
+ ### Events
228
+
229
+ #### hidden
230
+
231
+
232
+
233
+ - Type: `CustomEvent`
234
+ #### shown
235
+
236
+
237
+
238
+ - Type: `CustomEvent`
239
+
240
+
@@ -0,0 +1 @@
1
+ ## Styling API
@@ -0,0 +1,110 @@
1
+ ## Usage
2
+
3
+ To creat a modal you need three different components:
4
+
5
+ - `<w-modal>` - the parent component.
6
+ - `<w-modal-header>` - for the title and close button.
7
+ - `<w-modal-footer>` - for the actions such as Cancel and Confirm.
8
+
9
+ ### JavaScript API
10
+
11
+ To open and close the modal using JavaScript, get a reference to the `<w-modal>` and call `open()` and `close()` respectively.
12
+
13
+
14
+ <elements-example>
15
+
16
+ ```html
17
+ <w-button data-testid="js-example-show" aria-haspopup="dialog">Show me some lyrics</w-button>
18
+ <w-modal data-testid="js-example-modal">
19
+ <w-modal-header slot="header" title="Triumph by Wu Tang Clan"></w-modal-header>
20
+ <div slot="content">
21
+ <p>
22
+ My beats travel like a vortex through your spine, to the top of your
23
+ cerebral cortex. The rebel, I make more noise than heavy metal. Now,
24
+ lo and behold, another deadly episode, bound to catch another charge
25
+ when I explode Perpendicular to the square we stay in gold like
26
+ Flair, escape from your dragon's lair in particular. Handcuffed in
27
+ the back of a bus, forty of us. Slammin a hype verse til ya head
28
+ burst. Handcuffed in the back of a bus, forty of us. I bomb
29
+ atomically Socrates' philosophies and hypothesis can't define how I
30
+ be dropping these mockeries. I be that insane one from the psycho
31
+ ward, I'm on the trigger, plus I got the Wu-Tang sword. Step through
32
+ your section with the Force like Luke Skywalker, rhyme author,
33
+ orchestrate mind torture.
34
+ </p>
35
+ </div>
36
+ <w-modal-footer slot="footer">
37
+ <div class="flex gap-16">
38
+ <w-button variant="secondary" data-testid="js-example-cancel">Cancel</w-button>
39
+ <w-button variant="primary" data-testid="js-example-confirm">Confirm</w-button>
40
+ </div>
41
+ </w-modal-footer>
42
+ </w-modal>
43
+
44
+ <script>
45
+ const modal = document.querySelector('w-modal[data-testid="js-example-modal"]');
46
+
47
+ const openButton = document.querySelector('w-button[data-testid="js-example-show"]');
48
+ const confirmButton = document.querySelector('w-button[data-testid="js-example-confirm"]');
49
+ const cancelButton = document.querySelector('w-button[data-testid="js-example-cancel"]');
50
+
51
+ openButton.addEventListener('click', () => modal.open());
52
+ confirmButton.addEventListener('click', () => modal.close());
53
+ cancelButton.addEventListener('click', () => modal.close());
54
+ </script>
55
+ ```
56
+
57
+ </elements-example>
58
+
59
+ ### Invoker Commands
60
+
61
+ In [supported browsers](https://caniuse.com/?search=commandfor) (or [if you include the polyfill](https://github.com/keithamus/invokers-polyfill)) you can use the [Invoker Commands API](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API) to potentially skip JavaScript alltogether.
62
+
63
+ The available commands for `<w-modal>` are:
64
+
65
+ - `--show-modal`
66
+ - `--close`
67
+ - `--confirm`
68
+
69
+ <elements-example>
70
+
71
+ ```html
72
+ <w-button commandfor="invoker-modal" command="--show-modal" aria-haspopup="dialog">Show me some lyrics</w-button>
73
+ <w-modal id="invoker-modal">
74
+ <w-modal-header slot="header" title="Triumph by Wu Tang Clan"></w-modal-header>
75
+ <div slot="content">
76
+ <p>
77
+ First I'm gonna getcha, once I gotcha, I gat-cha, You could never
78
+ capture the Method Man's stature. So uhh, tic toc and keep ticking,
79
+ while I get you flipping off what I'm kicking. Yes, the rhythm, the
80
+ rebel, alone in my level heat it up past the boiling point of metal.
81
+ Shackling the masses with drastic rap tactics, graphic displays melt
82
+ the steel like blacksmiths. My beats travel like a vortex through
83
+ your spine, to the top of your cerebral cortex. Yes, the rhythm, the
84
+ rebel, alone in my level heat it up past the boiling point of metal.
85
+ Small change, they putting shame in the game. Murderous material,
86
+ made by a madman, it's the mic wrecker, Inspector, bad man.
87
+ </p>
88
+ </div>
89
+ <w-modal-footer slot="footer">
90
+ <div class="flex gap-16">
91
+ <w-button variant="secondary" commandfor="invoker-modal" command="--close">Dope</w-button>
92
+ <w-button variant="primary" commandfor="invoker-modal" command="--confirm">Dope</w-button>
93
+ </div>
94
+ </w-modal-footer>
95
+ </w-modal>
96
+ ```
97
+
98
+ </elements-example>
99
+
100
+ Since `--confirm` and `--cancel` both close the modal, but mean different things, listen for the `command` event on `w-modal` to do stuff on the `--confirm` event, such as submit a response to an API. You can listen for the other commands as well (including `--show-modal`) if you need to add tracking events for example.
101
+
102
+ ```ts
103
+ const modal = document.querySelector('w-modal');
104
+
105
+ modal.addEventListener('command', function (event: CommandEvent) {
106
+ if (event.command === '--confirm') {
107
+ console.log("Doing stuff!");
108
+ }
109
+ });
110
+ ```