@webtides/element-library 0.2.0 → 0.3.0

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 (398) hide show
  1. package/CHANGELOG.md +384 -3
  2. package/README.md +61 -41
  3. package/all.js +28 -0
  4. package/catalog.d.ts +14 -0
  5. package/catalog.js +55 -27
  6. package/custom-elements.json +16604 -3420
  7. package/package.json +35 -28
  8. package/src/components/accordion/accordion.changelog.md +10 -0
  9. package/src/components/accordion/accordion.js +10 -7
  10. package/src/components/accordion/accordion.readme.md +2 -0
  11. package/src/components/accordion/accordion.style.js +8 -0
  12. package/src/components/amount-field/amount-field.changelog.md +23 -3
  13. package/src/components/amount-field/amount-field.js +53 -26
  14. package/src/components/amount-field/amount-field.readme.md +82 -20
  15. package/src/components/amount-field/amount-field.style.js +111 -47
  16. package/src/components/avatar/avatar.changelog.md +23 -0
  17. package/src/components/avatar/avatar.define.js +3 -0
  18. package/src/components/avatar/avatar.js +115 -0
  19. package/src/components/avatar/avatar.readme.md +132 -0
  20. package/src/components/avatar/avatar.style.js +67 -0
  21. package/src/components/badge/badge.changelog.md +23 -0
  22. package/src/components/badge/badge.define.js +3 -0
  23. package/src/components/badge/badge.js +59 -0
  24. package/src/components/badge/badge.readme.md +109 -0
  25. package/src/components/badge/badge.style.js +63 -0
  26. package/src/components/breadcrumb/breadcrumb.changelog.md +22 -0
  27. package/src/components/breadcrumb/breadcrumb.define.js +3 -0
  28. package/src/components/breadcrumb/breadcrumb.js +47 -0
  29. package/src/components/breadcrumb/breadcrumb.readme.md +108 -0
  30. package/src/components/breadcrumb/breadcrumb.style.js +20 -0
  31. package/src/components/breadcrumb-item/breadcrumb-item.changelog.md +23 -0
  32. package/src/components/breadcrumb-item/breadcrumb-item.define.js +3 -0
  33. package/src/components/breadcrumb-item/breadcrumb-item.js +82 -0
  34. package/src/components/breadcrumb-item/breadcrumb-item.readme.md +106 -0
  35. package/src/components/breadcrumb-item/breadcrumb-item.style.js +92 -0
  36. package/src/components/button/button.changelog.md +34 -1
  37. package/src/components/button/button.js +285 -29
  38. package/src/components/button/button.readme.md +130 -10
  39. package/src/components/button/button.style.js +99 -120
  40. package/src/components/button-group/button-group.changelog.md +24 -0
  41. package/src/components/button-group/button-group.define.js +3 -0
  42. package/src/components/button-group/button-group.js +53 -0
  43. package/src/components/button-group/button-group.readme.md +114 -0
  44. package/src/components/button-group/button-group.style.js +41 -0
  45. package/src/components/card/card.changelog.md +23 -0
  46. package/src/components/card/card.define.js +3 -0
  47. package/src/components/card/card.js +73 -0
  48. package/src/components/card/card.readme.md +136 -0
  49. package/src/components/card/card.style.js +99 -0
  50. package/src/components/carousel/carousel.changelog.md +20 -0
  51. package/src/components/carousel/carousel.js +89 -40
  52. package/src/components/carousel/carousel.readme.md +39 -6
  53. package/src/components/carousel/carousel.style.js +21 -77
  54. package/src/components/carousel/glide/components/ShadowAnchors.js +3 -1
  55. package/src/components/carousel/glide/components/ShadowClones.js +21 -24
  56. package/src/components/carousel/glide/components/ShadowGaps.js +2 -2
  57. package/src/components/carousel/glide/components/ShadowHtml.js +22 -3
  58. package/src/components/checkbox-field/checkbox-field.changelog.md +19 -0
  59. package/src/components/checkbox-field/checkbox-field.js +25 -10
  60. package/src/components/checkbox-field/checkbox-field.readme.md +17 -4
  61. package/src/components/checkbox-field/checkbox-field.style.js +15 -3
  62. package/src/components/checkbox-group-field/checkbox-group-field.changelog.md +25 -0
  63. package/src/components/checkbox-group-field/checkbox-group-field.define.js +3 -0
  64. package/src/components/checkbox-group-field/checkbox-group-field.js +217 -0
  65. package/src/components/checkbox-group-field/checkbox-group-field.readme.md +95 -0
  66. package/src/components/checkbox-group-field/checkbox-group-field.style.js +62 -0
  67. package/src/components/color-field/color-field.changelog.md +24 -0
  68. package/src/components/color-field/color-field.define.js +3 -0
  69. package/src/components/color-field/color-field.js +184 -0
  70. package/src/components/color-field/color-field.readme.md +95 -0
  71. package/src/components/color-field/color-field.style.js +39 -0
  72. package/src/components/combobox-field/combobox-field.changelog.md +23 -0
  73. package/src/components/combobox-field/combobox-field.define.js +3 -0
  74. package/src/components/combobox-field/combobox-field.js +97 -0
  75. package/src/components/combobox-field/combobox-field.readme.md +93 -0
  76. package/src/components/combobox-field/combobox-field.style.js +56 -0
  77. package/src/components/copy-button/copy-button.changelog.md +24 -0
  78. package/src/components/copy-button/copy-button.define.js +3 -0
  79. package/src/components/copy-button/copy-button.events.js +4 -0
  80. package/src/components/copy-button/copy-button.js +237 -0
  81. package/src/components/copy-button/copy-button.readme.md +134 -0
  82. package/src/components/copy-button/copy-button.style.js +109 -0
  83. package/src/components/date-field/date-field.changelog.md +24 -0
  84. package/src/components/date-field/date-field.define.js +3 -0
  85. package/src/components/date-field/date-field.js +119 -0
  86. package/src/components/date-field/date-field.readme.md +110 -0
  87. package/src/components/date-field/date-field.style.js +53 -0
  88. package/src/components/dialog/dialog.changelog.md +16 -1
  89. package/src/components/dialog/dialog.js +252 -57
  90. package/src/components/dialog/dialog.readme.md +36 -4
  91. package/src/components/dialog/dialog.style.js +9 -109
  92. package/src/components/divider/divider.changelog.md +23 -0
  93. package/src/components/divider/divider.define.js +3 -0
  94. package/src/components/divider/divider.js +48 -0
  95. package/src/components/divider/divider.readme.md +101 -0
  96. package/src/components/divider/divider.style.js +50 -0
  97. package/src/components/drawer/drawer.changelog.md +25 -0
  98. package/src/components/drawer/drawer.define.js +3 -0
  99. package/src/components/drawer/drawer.events.js +8 -0
  100. package/src/components/drawer/drawer.js +80 -0
  101. package/src/components/drawer/drawer.readme.md +194 -0
  102. package/src/components/drawer/drawer.style.js +83 -0
  103. package/src/components/dropdown/dropdown.js +9 -7
  104. package/src/components/empty-state/empty-state.changelog.md +22 -0
  105. package/src/components/empty-state/empty-state.define.js +3 -0
  106. package/src/components/empty-state/empty-state.js +55 -0
  107. package/src/components/empty-state/empty-state.readme.md +114 -0
  108. package/src/components/empty-state/empty-state.style.js +60 -0
  109. package/src/components/file-field/file-field.changelog.md +24 -0
  110. package/src/components/file-field/file-field.define.js +3 -0
  111. package/src/components/file-field/file-field.js +205 -0
  112. package/src/components/file-field/file-field.readme.md +103 -0
  113. package/src/components/file-field/file-field.style.js +28 -0
  114. package/src/components/form-field/form-field.changelog.md +25 -0
  115. package/src/components/form-field/form-field.js +212 -15
  116. package/src/components/form-field/form-field.readme.md +82 -18
  117. package/src/components/form-field/form-field.style.js +6 -24
  118. package/src/components/input-field/input-field.changelog.md +24 -0
  119. package/src/components/input-field/input-field.js +82 -6
  120. package/src/components/input-field/input-field.readme.md +34 -5
  121. package/src/components/input-field/input-field.style.js +32 -13
  122. package/src/components/notification/notification.changelog.md +21 -1
  123. package/src/components/notification/notification.js +80 -74
  124. package/src/components/notification/notification.readme.md +54 -13
  125. package/src/components/notification/notification.style.js +37 -22
  126. package/src/components/otp-field/otp-field.changelog.md +23 -0
  127. package/src/components/otp-field/otp-field.define.js +3 -0
  128. package/src/components/otp-field/otp-field.events.js +3 -0
  129. package/src/components/otp-field/otp-field.js +172 -0
  130. package/src/components/otp-field/otp-field.readme.md +111 -0
  131. package/src/components/otp-field/otp-field.style.js +53 -0
  132. package/src/components/pagination/pagination.changelog.md +30 -0
  133. package/src/components/pagination/pagination.define.js +3 -0
  134. package/src/components/pagination/pagination.events.js +3 -0
  135. package/src/components/pagination/pagination.js +282 -0
  136. package/src/components/pagination/pagination.readme.md +167 -0
  137. package/src/components/pagination/pagination.style.js +162 -0
  138. package/src/components/password-field/password-field.changelog.md +24 -0
  139. package/src/components/password-field/password-field.js +7 -1
  140. package/src/components/password-field/password-field.readme.md +15 -6
  141. package/src/components/password-field/password-field.style.js +36 -13
  142. package/src/components/popover/popover.changelog.md +24 -0
  143. package/src/components/popover/popover.define.js +3 -0
  144. package/src/components/popover/popover.events.js +4 -0
  145. package/src/components/popover/popover.js +255 -0
  146. package/src/components/popover/popover.readme.md +132 -0
  147. package/src/components/popover/popover.style.js +41 -0
  148. package/src/components/progress-bar/progress-bar.changelog.md +23 -0
  149. package/src/components/progress-bar/progress-bar.define.js +3 -0
  150. package/src/components/progress-bar/progress-bar.js +80 -0
  151. package/src/components/progress-bar/progress-bar.readme.md +110 -0
  152. package/src/components/progress-bar/progress-bar.style.js +93 -0
  153. package/src/components/progress-ring/progress-ring.changelog.md +23 -0
  154. package/src/components/progress-ring/progress-ring.define.js +3 -0
  155. package/src/components/progress-ring/progress-ring.js +83 -0
  156. package/src/components/progress-ring/progress-ring.readme.md +115 -0
  157. package/src/components/progress-ring/progress-ring.style.js +85 -0
  158. package/src/components/radio-field/radio-field.changelog.md +16 -0
  159. package/src/components/radio-field/radio-field.js +34 -11
  160. package/src/components/radio-field/radio-field.readme.md +13 -8
  161. package/src/components/radio-field/radio-field.style.js +17 -65
  162. package/src/components/range-field/range-field.changelog.md +24 -0
  163. package/src/components/range-field/range-field.define.js +3 -0
  164. package/src/components/range-field/range-field.js +167 -0
  165. package/src/components/range-field/range-field.readme.md +87 -0
  166. package/src/components/range-field/range-field.style.js +41 -0
  167. package/src/components/rating-field/rating-field.changelog.md +24 -0
  168. package/src/components/rating-field/rating-field.define.js +3 -0
  169. package/src/components/rating-field/rating-field.js +195 -0
  170. package/src/components/rating-field/rating-field.readme.md +82 -0
  171. package/src/components/rating-field/rating-field.style.js +79 -0
  172. package/src/components/select-field/select-field.changelog.md +17 -0
  173. package/src/components/select-field/select-field.js +100 -8
  174. package/src/components/select-field/select-field.readme.md +32 -6
  175. package/src/components/select-field/select-field.style.js +19 -9
  176. package/src/components/skeleton/skeleton.changelog.md +22 -0
  177. package/src/components/skeleton/skeleton.define.js +3 -0
  178. package/src/components/skeleton/skeleton.js +49 -0
  179. package/src/components/skeleton/skeleton.readme.md +115 -0
  180. package/src/components/skeleton/skeleton.style.js +79 -0
  181. package/src/components/slider/slider.changelog.md +15 -0
  182. package/src/components/slider/slider.js +37 -5
  183. package/src/components/slider/slider.readme.md +28 -6
  184. package/src/components/slider/slider.style.js +7 -71
  185. package/src/components/spinner/spinner.changelog.md +22 -0
  186. package/src/components/spinner/spinner.define.js +3 -0
  187. package/src/components/spinner/spinner.js +48 -0
  188. package/src/components/spinner/spinner.readme.md +98 -0
  189. package/src/components/spinner/spinner.style.js +44 -0
  190. package/src/components/switch-field/switch-field.changelog.md +16 -0
  191. package/src/components/switch-field/switch-field.js +17 -9
  192. package/src/components/switch-field/switch-field.readme.md +11 -4
  193. package/src/components/switch-field/switch-field.style.js +13 -13
  194. package/src/components/tab-group/tab-group.changelog.md +19 -0
  195. package/src/components/tab-group/tab-group.js +122 -10
  196. package/src/components/tab-group/tab-group.readme.md +25 -4
  197. package/src/components/tab-link/tab-link.changelog.md +16 -0
  198. package/src/components/tab-link/tab-link.js +51 -8
  199. package/src/components/tab-link/tab-link.readme.md +14 -8
  200. package/src/components/tab-link/tab-link.style.js +13 -0
  201. package/src/components/tab-panel/tab-panel.changelog.md +8 -2
  202. package/src/components/tab-panel/tab-panel.js +7 -3
  203. package/src/components/tab-panel/tab-panel.readme.md +7 -5
  204. package/src/components/tag/tag.changelog.md +24 -0
  205. package/src/components/tag/tag.define.js +3 -0
  206. package/src/components/tag/tag.events.js +3 -0
  207. package/src/components/tag/tag.js +116 -0
  208. package/src/components/tag/tag.readme.md +119 -0
  209. package/src/components/tag/tag.style.js +101 -0
  210. package/src/components/tag-field/tag-field.changelog.md +25 -0
  211. package/src/components/tag-field/tag-field.define.js +3 -0
  212. package/src/components/tag-field/tag-field.js +359 -0
  213. package/src/components/tag-field/tag-field.readme.md +113 -0
  214. package/src/components/tag-field/tag-field.style.js +62 -0
  215. package/src/components/textarea-field/textarea-field.changelog.md +28 -4
  216. package/src/components/textarea-field/textarea-field.js +68 -14
  217. package/src/components/textarea-field/textarea-field.readme.md +45 -9
  218. package/src/components/textarea-field/textarea-field.style.js +45 -2
  219. package/src/components/toast/toast.changelog.md +24 -0
  220. package/src/components/toast/toast.define.js +3 -0
  221. package/src/components/toast/toast.js +193 -0
  222. package/src/components/toast/toast.readme.md +189 -0
  223. package/src/components/toast/toast.style.js +74 -0
  224. package/src/components/tooltip/tooltip.changelog.md +24 -0
  225. package/src/components/tooltip/tooltip.define.js +3 -0
  226. package/src/components/tooltip/tooltip.events.js +4 -0
  227. package/src/components/tooltip/tooltip.js +377 -0
  228. package/src/components/tooltip/tooltip.readme.md +172 -0
  229. package/src/components/tooltip/tooltip.style.js +107 -0
  230. package/src/components/transition-classes/transition-classes.js +6 -6
  231. package/src/styles/appearance.style.js +42 -0
  232. package/src/styles/arrow.style.js +65 -0
  233. package/src/styles/choice-group.style.js +94 -0
  234. package/src/styles/form-control.style.js +79 -0
  235. package/src/styles/host.style.js +55 -0
  236. package/src/styles/layers.css +31 -0
  237. package/src/styles/modal.style.js +146 -0
  238. package/src/styles/native.css +275 -0
  239. package/src/styles/size.style.js +48 -0
  240. package/src/styles/slide-controls.style.js +225 -0
  241. package/src/styles/utilities.css +30 -0
  242. package/src/styles/variants.style.js +78 -0
  243. package/src/themes/default.css +86 -142
  244. package/src/themes/high-contrast.css +72 -129
  245. package/src/themes/sketchy.css +95 -175
  246. package/src/utils/floating.js +71 -0
  247. package/src/utils/focus.js +18 -0
  248. package/src/utils/progress.js +25 -0
  249. package/src/utils/slots.js +21 -0
  250. package/src/utils/text-entry-attributes.js +51 -0
  251. package/types/all.d.ts +54 -1
  252. package/types/index.d.ts +1 -0
  253. package/types/src/components/accordion/accordion.d.ts +6 -4
  254. package/types/src/components/accordion/accordion.events.d.ts +3 -3
  255. package/types/src/components/accordion-group/accordion-group.d.ts +4 -3
  256. package/types/src/components/amount-field/amount-field.d.ts +30 -16
  257. package/types/src/components/avatar/avatar.d.ts +57 -0
  258. package/types/src/components/avatar/avatar.define.d.ts +1 -0
  259. package/types/src/components/avatar/avatar.style.d.ts +2 -0
  260. package/types/src/components/badge/badge.d.ts +32 -0
  261. package/types/src/components/badge/badge.define.d.ts +1 -0
  262. package/types/src/components/badge/badge.style.d.ts +2 -0
  263. package/types/src/components/breadcrumb/breadcrumb.d.ts +27 -0
  264. package/types/src/components/breadcrumb/breadcrumb.define.d.ts +1 -0
  265. package/types/src/components/breadcrumb/breadcrumb.style.d.ts +2 -0
  266. package/types/src/components/breadcrumb-item/breadcrumb-item.d.ts +38 -0
  267. package/types/src/components/breadcrumb-item/breadcrumb-item.define.d.ts +1 -0
  268. package/types/src/components/breadcrumb-item/breadcrumb-item.style.d.ts +2 -0
  269. package/types/src/components/button/button.d.ts +129 -14
  270. package/types/src/components/button-group/button-group.d.ts +28 -0
  271. package/types/src/components/button-group/button-group.define.d.ts +1 -0
  272. package/types/src/components/button-group/button-group.style.d.ts +2 -0
  273. package/types/src/components/card/card.d.ts +40 -0
  274. package/types/src/components/card/card.define.d.ts +1 -0
  275. package/types/src/components/card/card.style.d.ts +2 -0
  276. package/types/src/components/carousel/carousel.d.ts +22 -8
  277. package/types/src/components/carousel/carousel.events.d.ts +3 -3
  278. package/types/src/components/carousel/glide/components/ShadowAnchors.d.ts +1 -1
  279. package/types/src/components/carousel/glide/components/ShadowClones.d.ts +8 -1
  280. package/types/src/components/carousel/glide/components/ShadowGaps.d.ts +1 -1
  281. package/types/src/components/carousel/glide/components/ShadowHtml.d.ts +1 -1
  282. package/types/src/components/carousel/glide/components/glide-html.d.ts +1 -1
  283. package/types/src/components/checkbox-field/checkbox-field.d.ts +22 -15
  284. package/types/src/components/checkbox-group-field/checkbox-group-field.d.ts +100 -0
  285. package/types/src/components/checkbox-group-field/checkbox-group-field.define.d.ts +1 -0
  286. package/types/src/components/checkbox-group-field/checkbox-group-field.style.d.ts +2 -0
  287. package/types/src/components/color-field/color-field.d.ts +102 -0
  288. package/types/src/components/color-field/color-field.define.d.ts +1 -0
  289. package/types/src/components/color-field/color-field.style.d.ts +2 -0
  290. package/types/src/components/combobox-field/combobox-field.d.ts +84 -0
  291. package/types/src/components/combobox-field/combobox-field.define.d.ts +1 -0
  292. package/types/src/components/combobox-field/combobox-field.style.d.ts +2 -0
  293. package/types/src/components/copy-button/copy-button.d.ts +93 -0
  294. package/types/src/components/copy-button/copy-button.define.d.ts +1 -0
  295. package/types/src/components/copy-button/copy-button.events.d.ts +5 -0
  296. package/types/src/components/copy-button/copy-button.style.d.ts +2 -0
  297. package/types/src/components/date-field/date-field.d.ts +102 -0
  298. package/types/src/components/date-field/date-field.define.d.ts +1 -0
  299. package/types/src/components/date-field/date-field.style.d.ts +2 -0
  300. package/types/src/components/dialog/dialog.d.ts +101 -19
  301. package/types/src/components/dialog/dialog.events.d.ts +8 -8
  302. package/types/src/components/divider/divider.d.ts +27 -0
  303. package/types/src/components/divider/divider.define.d.ts +1 -0
  304. package/types/src/components/divider/divider.style.d.ts +2 -0
  305. package/types/src/components/drawer/drawer.d.ts +70 -0
  306. package/types/src/components/drawer/drawer.define.d.ts +1 -0
  307. package/types/src/components/drawer/drawer.events.d.ts +9 -0
  308. package/types/src/components/drawer/drawer.style.d.ts +2 -0
  309. package/types/src/components/dropdown/dropdown.d.ts +5 -3
  310. package/types/src/components/empty-state/empty-state.d.ts +29 -0
  311. package/types/src/components/empty-state/empty-state.define.d.ts +1 -0
  312. package/types/src/components/empty-state/empty-state.style.d.ts +2 -0
  313. package/types/src/components/file-field/file-field.d.ts +115 -0
  314. package/types/src/components/file-field/file-field.define.d.ts +1 -0
  315. package/types/src/components/file-field/file-field.style.d.ts +2 -0
  316. package/types/src/components/form-field/form-field.d.ts +129 -14
  317. package/types/src/components/form-field/form-field.events.d.ts +4 -4
  318. package/types/src/components/input-field/input-field.d.ts +52 -5
  319. package/types/src/components/lazy-src/lazy-src.d.ts +7 -5
  320. package/types/src/components/lazy-src/lazy-src.events.d.ts +5 -5
  321. package/types/src/components/notification/notification.d.ts +18 -18
  322. package/types/src/components/notification/notification.events.d.ts +6 -6
  323. package/types/src/components/otp-field/otp-field.d.ts +130 -0
  324. package/types/src/components/otp-field/otp-field.define.d.ts +1 -0
  325. package/types/src/components/otp-field/otp-field.events.d.ts +4 -0
  326. package/types/src/components/otp-field/otp-field.style.d.ts +2 -0
  327. package/types/src/components/pagination/pagination.d.ts +117 -0
  328. package/types/src/components/pagination/pagination.define.d.ts +1 -0
  329. package/types/src/components/pagination/pagination.events.d.ts +4 -0
  330. package/types/src/components/pagination/pagination.style.d.ts +2 -0
  331. package/types/src/components/password-field/password-field.d.ts +29 -12
  332. package/types/src/components/popover/popover.d.ts +123 -0
  333. package/types/src/components/popover/popover.define.d.ts +1 -0
  334. package/types/src/components/popover/popover.events.d.ts +5 -0
  335. package/types/src/components/popover/popover.style.d.ts +2 -0
  336. package/types/src/components/progress-bar/progress-bar.d.ts +35 -0
  337. package/types/src/components/progress-bar/progress-bar.define.d.ts +1 -0
  338. package/types/src/components/progress-bar/progress-bar.style.d.ts +2 -0
  339. package/types/src/components/progress-ring/progress-ring.d.ts +40 -0
  340. package/types/src/components/progress-ring/progress-ring.define.d.ts +1 -0
  341. package/types/src/components/progress-ring/progress-ring.style.d.ts +2 -0
  342. package/types/src/components/radio-field/radio-field.d.ts +21 -9
  343. package/types/src/components/range-field/range-field.d.ts +94 -0
  344. package/types/src/components/range-field/range-field.define.d.ts +1 -0
  345. package/types/src/components/range-field/range-field.style.d.ts +2 -0
  346. package/types/src/components/rating-field/rating-field.d.ts +96 -0
  347. package/types/src/components/rating-field/rating-field.define.d.ts +1 -0
  348. package/types/src/components/rating-field/rating-field.style.d.ts +2 -0
  349. package/types/src/components/scroll-to/scroll-to.d.ts +3 -2
  350. package/types/src/components/scroll-to-top/scroll-to-top.d.ts +4 -2
  351. package/types/src/components/select-field/select-field.d.ts +55 -5
  352. package/types/src/components/skeleton/skeleton.d.ts +29 -0
  353. package/types/src/components/skeleton/skeleton.define.d.ts +1 -0
  354. package/types/src/components/skeleton/skeleton.style.d.ts +2 -0
  355. package/types/src/components/slider/slider.d.ts +14 -8
  356. package/types/src/components/slider/slider.events.d.ts +4 -4
  357. package/types/src/components/spinner/spinner.d.ts +28 -0
  358. package/types/src/components/spinner/spinner.define.d.ts +1 -0
  359. package/types/src/components/spinner/spinner.style.d.ts +2 -0
  360. package/types/src/components/sticky/sticky.d.ts +4 -2
  361. package/types/src/components/svg-use/svg-use.d.ts +4 -2
  362. package/types/src/components/switch-field/switch-field.d.ts +17 -15
  363. package/types/src/components/tab-group/tab-group.d.ts +44 -3
  364. package/types/src/components/tab-link/tab-link.d.ts +33 -10
  365. package/types/src/components/tab-panel/tab-panel.d.ts +8 -5
  366. package/types/src/components/tag/tag.d.ts +53 -0
  367. package/types/src/components/tag/tag.define.d.ts +1 -0
  368. package/types/src/components/tag/tag.events.d.ts +4 -0
  369. package/types/src/components/tag/tag.style.d.ts +2 -0
  370. package/types/src/components/tag-field/tag-field.d.ts +178 -0
  371. package/types/src/components/tag-field/tag-field.define.d.ts +1 -0
  372. package/types/src/components/tag-field/tag-field.style.d.ts +2 -0
  373. package/types/src/components/textarea-field/textarea-field.d.ts +44 -4
  374. package/types/src/components/toast/toast.d.ts +110 -0
  375. package/types/src/components/toast/toast.define.d.ts +1 -0
  376. package/types/src/components/toast/toast.style.d.ts +2 -0
  377. package/types/src/components/tooltip/tooltip.d.ts +161 -0
  378. package/types/src/components/tooltip/tooltip.define.d.ts +1 -0
  379. package/types/src/components/tooltip/tooltip.events.d.ts +5 -0
  380. package/types/src/components/tooltip/tooltip.style.d.ts +2 -0
  381. package/types/src/components/transition-classes/transition-classes.d.ts +9 -8
  382. package/types/src/styles/appearance.style.d.ts +18 -0
  383. package/types/src/styles/arrow.style.d.ts +15 -0
  384. package/types/src/styles/choice-group.style.d.ts +23 -0
  385. package/types/src/styles/form-control.style.d.ts +26 -0
  386. package/types/src/styles/host.style.d.ts +24 -0
  387. package/types/src/styles/modal.style.d.ts +20 -0
  388. package/types/src/styles/size.style.d.ts +20 -0
  389. package/types/src/styles/slide-controls.style.d.ts +20 -0
  390. package/types/src/styles/variants.style.d.ts +32 -0
  391. package/types/src/utils/body-scroll.d.ts +12 -2
  392. package/types/src/utils/floating.d.ts +36 -0
  393. package/types/src/utils/focus.d.ts +16 -0
  394. package/types/src/utils/progress.d.ts +19 -0
  395. package/types/src/utils/slots.d.ts +19 -0
  396. package/types/src/utils/text-entry-attributes.d.ts +18 -0
  397. package/types/src/utils/transitions.d.ts +2 -2
  398. package/web-types.json +6590 -1584
@@ -1,6 +1,6 @@
1
1
  # Dialog
2
2
 
3
- `dialog` is a modal dialog built on the native `<dialog>` element. The platform handles focus trapping, making the background `inert`, top-layer rendering (no `z-index` juggling), focus restoration on close, and `<form method="dialog">` auto-close. On top of that the component adds an animated, cancelable open/close lifecycle and ref-counted body-scroll locking.
3
+ `dialog` is a modal dialog built on the native `<dialog>` element. The platform handles focus trapping, making the background `inert`, top-layer rendering (no `z-index` juggling) and focus restoration on close. On top of that the component adds an animated, cancelable open/close lifecycle and ref-counted body-scroll locking, and it closes for a `<form method="dialog">` inside it.
4
4
 
5
5
  It is headless by default — without a theme it imposes no colors, borders, shadows or backdrop. Opt in by importing a theme (or setting the `--el-*` tokens yourself).
6
6
 
@@ -45,8 +45,8 @@ Open and close it imperatively with the `show()` / `hide()` methods (both return
45
45
 
46
46
  | Name | Returns | Description |
47
47
  | ---------------------- | --------------- | -------------------------------------------------------------- |
48
- | `show()` | `Promise<void>` | Opens the dialog; resolves after the open transition. |
49
- | `hide()` | `Promise<void>` | Closes the dialog; resolves after the close transition. |
48
+ | `show()` | `Promise<void>` | Opens the dialog; resolves once it has come to rest. |
49
+ | `hide()` | `Promise<void>` | Closes the dialog; resolves once it has come to rest. |
50
50
  | `requestClose(source)` | `void` | Requests a close, emitting the cancelable request-close event. |
51
51
 
52
52
  #### Events
@@ -60,6 +60,36 @@ Open and close it imperatively with the `show()` / `hide()` methods (both return
60
60
  | `dialog-initial-focus` | yes | — | Focus has moved into the dialog; prevent to override. |
61
61
  | `dialog-request-close` | yes | `{ source: 'close-button' \| 'keyboard' \| 'overlay' }` | A close was requested; `preventDefault()` to keep open. |
62
62
 
63
+ #### Opening and closing in quick succession
64
+
65
+ `open` can change while the dialog is on its way in or out, by a button that is clicked twice for example. The last value wins:
66
+
67
+ - A dialog that is closed on its way in turns back. One that is opened on its way out turns round and is shown again; it has kept the focus and the lock on the page.
68
+ - `dialog-after-show` and `dialog-after-hide` fire when the dialog has got there. A way that is cut short has none: after `dialog-show` comes `dialog-after-show` or `dialog-hide`, after `dialog-hide` comes `dialog-after-hide` or `dialog-show`. `dialog-initial-focus` fires when the platform has moved the focus, which it does not for a dialog that turns round.
69
+ - The promises of `show()` and `hide()` resolve when the dialog is at rest, and never reject. When the other call has overtaken, that is at the other end, so read `open` afterwards where it matters.
70
+ - A change of `open` takes effect with the next frame. Two changes before that which cancel each other do nothing.
71
+
72
+ #### Closing from a form
73
+
74
+ A form with `method="dialog"` inside the dialog closes it when it is submitted, as it does in a native `<dialog>`: by its submit button, by `Enter` in one of its fields, or by a button that belongs to it through the `form` attribute, in the footer for example. A button with `formmethod="dialog"` does the same in a form with another method.
75
+
76
+ ```html
77
+ <el-dialog label="Rename">
78
+ <form id="rename" method="dialog">
79
+ <label>Name <input name="name" required /></label>
80
+ </form>
81
+ <button slot="footer" form="rename" value="cancel" formnovalidate>Cancel</button>
82
+ <button slot="footer" form="rename" value="save">Save</button>
83
+ </el-dialog>
84
+ ```
85
+
86
+ - Nothing is sent. Read the fields in a listener of `submit`; `event.submitter` is the button that was used. There is no `returnValue`.
87
+ - A form that is not valid is not submitted, so the dialog stays open. A button with `formnovalidate` skips the validation.
88
+ - It closes without `dialog-request-close`. A listener that calls `preventDefault()` on the `submit` keeps the dialog open.
89
+ - An `el-button` of the type `submit` does the same as a native button: inside the form, or in the footer with the `form` attribute, and with `formnovalidate` and `formmethod="dialog"`.
90
+ - In a dialog inside a dialog, the form closes the one it is in.
91
+ - `form.submit()` from a script fires no `submit`, so the dialog stays open; call `hide()` there. The same goes for a form inside the shadow root of another component, whose `submit` does not leave it.
92
+
63
93
  #### Slots
64
94
 
65
95
  | Name | Description |
@@ -99,6 +129,8 @@ Headless by default; reads the library's `--el-*` design tokens (e.g. `--el-colo
99
129
 
100
130
  See the Storybook _Docs / Theming_ page for the full token reference.
101
131
 
132
+ On a touch screen (`@media (any-pointer: coarse)`) the close button is at least `--el-touch-target` wide and high. Its icon keeps its size, and the header grows with the button. Without that token, and on a fine pointer, the sizes stay as they are.
133
+
102
134
  ## Accessibility
103
135
 
104
136
  - Opening calls `showModal()`, so focus is trapped, the rest of the page is `inert`, and focus is restored to the previously focused element on close.
@@ -109,7 +141,7 @@ See the Storybook _Docs / Theming_ page for the full token reference.
109
141
 
110
142
  ## Scroll locking
111
143
 
112
- While a dialog is open, page scrolling is locked (ref-counted, so stacked dialogs cooperate). Hiding the scrollbar would normally widen the page and cause a layout shift, so the dialog pads the document by the removed scrollbar's width to keep the content steady. This is a no-op on overlay-scrollbar systems (e.g. macOS), where the scrollbar takes no layout space.
144
+ While a dialog is open, page scrolling is locked (ref-counted, so stacked dialogs cooperate). A dialog that is taken out of the page while it is open gives its lock back, and opens as a modal again when it is put back while `open`. Hiding the scrollbar would normally widen the page and cause a layout shift, so the dialog pads the document by the removed scrollbar's width to keep the content steady. This is a no-op on overlay-scrollbar systems (e.g. macOS), where the scrollbar takes no layout space.
113
145
 
114
146
  This compensation covers normal page content, but `position: fixed` elements pinned to the right edge (a floating action button, a sticky toolbar) are positioned against the viewport and still shift by the scrollbar width when it disappears. To avoid that entirely, reserve the scrollbar gutter on your document up front:
115
147
 
@@ -1,22 +1,16 @@
1
- const css = String.raw;
1
+ import modalStyle from '../../styles/modal.style.js';
2
2
 
3
- export default css`
4
- :host {
5
- display: contents;
6
- }
3
+ const css = String.raw;
7
4
 
8
- /*
9
- * The native <dialog> is the top-layer surface (the "panel"). It is headless by default —
10
- * every visual token falls back to a null-ish value so an unthemed dialog imposes nothing.
11
- */
5
+ /*
6
+ * What is the dialog's own: a box in the middle of the viewport, which fades in and rises a little.
7
+ * The paint of the surface, the backdrop and the parts are in the modal module.
8
+ */
9
+ const style = css`
12
10
  dialog {
13
11
  margin: auto;
14
- padding: 0;
15
12
  border: var(--el-border-width, 0) solid var(--el-color-border, transparent);
16
13
  border-radius: var(--el-radius-lg, 0);
17
- background: var(--el-color-bg, transparent);
18
- color: var(--el-color-fg, inherit);
19
- box-shadow: var(--el-shadow-lg, none);
20
14
 
21
15
  width: var(--el-dialog-width, 31rem);
22
16
  max-width: calc(100vw - 2 * var(--el-space-4, 1rem));
@@ -24,101 +18,7 @@ export default css`
24
18
 
25
19
  opacity: 0;
26
20
  transform: translateY(var(--el-dialog-enter-offset, 0.5rem));
27
- transition:
28
- opacity var(--el-duration-md, 0s) var(--el-ease, ease),
29
- transform var(--el-duration-md, 0s) var(--el-ease, ease);
30
- }
31
-
32
- /* Lay the box out only while open so the UA's \`dialog:not([open]) { display: none }\` still hides it. */
33
- dialog[open] {
34
- display: flex;
35
- flex-direction: column;
36
- }
37
-
38
- dialog.showing {
39
- opacity: 1;
40
- transform: none;
41
- }
42
-
43
- dialog::backdrop {
44
- background: var(--el-dialog-overlay-background, transparent);
45
- opacity: 0;
46
- transition: opacity var(--el-duration-md, 0s) var(--el-ease, ease);
47
- }
48
-
49
- dialog.showing::backdrop {
50
- opacity: 1;
51
- }
52
-
53
- [part~='header'] {
54
- display: flex;
55
- align-items: center;
56
- gap: var(--el-space-2, 0.5rem);
57
- padding: var(--el-space-4, 1rem);
58
- }
59
-
60
- [part~='title'] {
61
- flex: 1 1 auto;
62
- margin: 0;
63
- font-size: var(--el-font-size-lg, 1.125rem);
64
- font-weight: var(--el-font-weight-semibold, 600);
65
- line-height: 1.2;
66
- }
67
-
68
- [part~='header-actions'] {
69
- display: flex;
70
- flex: 0 0 auto;
71
- align-items: center;
72
- gap: var(--el-space-2, 0.5rem);
73
- }
74
-
75
- [part~='close-button'] {
76
- display: inline-flex;
77
- align-items: center;
78
- justify-content: center;
79
- padding: 0;
80
- border: none;
81
- border-radius: var(--el-radius-md, 0);
82
- background: transparent;
83
- color: inherit;
84
- cursor: pointer;
85
- line-height: 0;
86
- }
87
-
88
- [part~='close-button'] svg {
89
- width: 1.25rem;
90
- height: 1.25rem;
91
- }
92
-
93
- [part~='body'] {
94
- flex: 1 1 auto;
95
- overflow: auto;
96
- padding: var(--el-space-4, 1rem);
97
- }
98
-
99
- /* Header present: let the header own the top padding so the body doesn't double it. */
100
- [part~='header'] + [part~='body'] {
101
- padding-top: 0;
102
- }
103
-
104
- [part~='footer'] {
105
- display: flex;
106
- flex: 0 0 auto;
107
- justify-content: flex-end;
108
- gap: var(--el-space-2, 0.5rem);
109
- padding: var(--el-space-4, 1rem);
110
- padding-top: 0;
111
- }
112
-
113
- /* Collapse the footer entirely when nothing is slotted into it. */
114
- [part~='footer']:not(:has(*)) {
115
- display: none;
116
- }
117
-
118
- @media (prefers-reduced-motion: reduce) {
119
- dialog,
120
- dialog::backdrop {
121
- transition-duration: 0s;
122
- }
123
21
  }
124
22
  `;
23
+
24
+ export default [modalStyle(), style].join('\n');
@@ -0,0 +1,23 @@
1
+ # Change Log
2
+
3
+ All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/).
6
+
7
+ <!--
8
+ When your PR touches this component, add an entry under Unreleased and
9
+ mirror it (prefixed with the component name) in root CHANGELOG.md.
10
+ Uncomment headings as needed.
11
+ -->
12
+
13
+ ## Unreleased
14
+
15
+ ## [0.3.0] - 2026-11-17
16
+
17
+ ### Added
18
+
19
+ - Initial `el-divider`: a line between two groups of content, the regions of a card, the entries of a menu, the controls of a toolbar. The line is a native `<hr>`, a separator to assistive technology. ([#120](https://github.com/webtides/element-library/issues/120))
20
+ - `orientation` is `horizontal` (the default) or `vertical`, reflected. A horizontal divider is as wide as its container. A vertical one is as high as the row of the flex or grid container it stands in, whatever the alignment of the row, and as high as the text in a line of text; it says so with `aria-orientation`.
21
+ - The line has the colour and the width of the borders of the theme (`--el-color-border`, `--el-border-width`), and is `1px` in a fifth of the text colour without a theme. `--el-divider-color` and `--el-divider-width` set other ones.
22
+ - It has no space around it: a margin on the element, or the gap of the layout, sets the distance to the content.
23
+ - The line is a border, so it stays when colours are forced.
@@ -0,0 +1,3 @@
1
+ import { define } from './divider.js';
2
+
3
+ define();
@@ -0,0 +1,48 @@
1
+ import { TemplateElement, defineElement, html } from '@webtides/element-js';
2
+ import style from './divider.style.js';
3
+
4
+ /**
5
+ * A divider: a line between two groups of content, the regions of a card, the entries of a menu,
6
+ * the controls of a toolbar. Horizontal by default, as wide as its container; vertical it is as
7
+ * high as the row it stands in. The line is a native `<hr>`, which is a separator to assistive
8
+ * technology.
9
+ *
10
+ * @element el-divider
11
+ *
12
+ * @csspart base - The line, an `<hr>`.
13
+ *
14
+ * @cssproperty --el-divider-color - The colour of the line. Unset, it is `--el-color-border`, and
15
+ * a fifth of the text colour without a theme.
16
+ * @cssproperty --el-divider-width - The thickness of the line. Unset, it is `--el-border-width`,
17
+ * and `1px` without a theme.
18
+ *
19
+ * @property {'horizontal'|'vertical'} orientation - The direction of the line. Default
20
+ * `'horizontal'`. Reflected to the `orientation` attribute.
21
+ */
22
+ export default class Divider extends TemplateElement {
23
+ constructor() {
24
+ super({
25
+ styles: [style],
26
+ shadowRender: true,
27
+ // The stylesheet selects the host by this attribute.
28
+ propertyOptions: {
29
+ orientation: { reflect: true },
30
+ },
31
+ });
32
+ }
33
+
34
+ properties() {
35
+ return {
36
+ orientation: 'horizontal',
37
+ };
38
+ }
39
+
40
+ template() {
41
+ const orientation = this.orientation === 'vertical' ? 'vertical' : 'horizontal';
42
+ return html`<hr part="base" class="divider" aria-orientation="${orientation}" />`;
43
+ }
44
+ }
45
+
46
+ export function define() {
47
+ defineElement('el-divider', Divider);
48
+ }
@@ -0,0 +1,101 @@
1
+ # Divider
2
+
3
+ `divider` is a line between two groups of content: the regions of a card, the entries of a menu, the controls of a toolbar. It is horizontal by default and vertical with `orientation`.
4
+
5
+ The line has the colour and the width of the borders of the theme. Without a theme imported it is `1px` in a fifth of the text colour, so it shows on any background.
6
+
7
+ ## How to use
8
+
9
+ #### Install
10
+
11
+ ```sh
12
+ npm i --save @webtides/element-library
13
+ ```
14
+
15
+ #### Use
16
+
17
+ ```js
18
+ import '@webtides/element-library/divider/define';
19
+ ```
20
+
21
+ ```html
22
+ <p>Billing address</p>
23
+ <el-divider></el-divider>
24
+ <p>Shipping address</p>
25
+
26
+ <!-- Between the controls of a row -->
27
+ <div style="display: flex; gap: 1rem">
28
+ <a href="/edit">Edit</a>
29
+ <el-divider orientation="vertical"></el-divider>
30
+ <a href="/remove">Remove</a>
31
+ </div>
32
+ ```
33
+
34
+ ## API
35
+
36
+ #### Properties/Attributes
37
+
38
+ | Name | Type | Default | Description |
39
+ | ------------- | -------- | -------------- | -------------------------------------- |
40
+ | `orientation` | `string` | `'horizontal'` | `horizontal` or `vertical`. Reflected. |
41
+
42
+ #### Methods
43
+
44
+ _None._
45
+
46
+ #### Events
47
+
48
+ _None._
49
+
50
+ #### Slots
51
+
52
+ _None._
53
+
54
+ #### CSS Parts
55
+
56
+ | Name | Description |
57
+ | ------ | ------------------- |
58
+ | `base` | The line, an `<hr>` |
59
+
60
+ #### CSS Custom Properties
61
+
62
+ | Name | Default | Description |
63
+ | -------------------- | --------------------------------------------------------------- | -------------------------- |
64
+ | `--el-divider-color` | `--el-color-border`, a fifth of the text colour without a theme | The colour of the line. |
65
+ | `--el-divider-width` | `--el-border-width`, `1px` without a theme | The thickness of the line. |
66
+
67
+ ## Space around the line
68
+
69
+ A divider has no space around it. Where it stands in a layout with a `gap`, the gap is the distance to the content on both sides. Anywhere else, set a margin on the element:
70
+
71
+ ```css
72
+ el-divider {
73
+ margin-block: 1.5rem;
74
+ }
75
+
76
+ el-divider[orientation='vertical'] {
77
+ margin-block: 0;
78
+ margin-inline: 0.75rem;
79
+ }
80
+ ```
81
+
82
+ ## Orientation
83
+
84
+ A horizontal divider is as wide as its container.
85
+
86
+ A vertical divider is as high as the row it stands in: in a flex or grid container it stretches to the height of the row, whatever `align-items` says for the other items. In a line of text it is as high as the text (`1em`). For any other height, set one on the element.
87
+
88
+ `orientation` is reflected: the element writes it onto itself as an attribute, the default included (`<el-divider orientation="horizontal">`), so that it can be selected from a stylesheet. A value other than `vertical` gives a horizontal line.
89
+
90
+ The `hidden` attribute hides the divider.
91
+
92
+ ## Accessibility
93
+
94
+ - The line is a native `<hr>`, which is a separator to assistive technology: a screen reader can announce it and tell its user that a new group begins. A vertical divider says so with `aria-orientation`.
95
+ - Where the line is decoration only (the groups are told apart by headings, or the items of the row are a list anyway), put `aria-hidden="true"` on the element, so that a screen reader does not announce it.
96
+ - The line is a border, not a background. It stays when colours are forced (the contrast themes of Windows), repainted in the text colour of the system.
97
+ - The fallback colour without a theme is faint on purpose. A line that carries meaning on its own, without a heading or a space that says the same, needs a contrast of 3 : 1 against the background: set `--el-divider-color`.
98
+
99
+ ## Server-side rendering
100
+
101
+ The line and its orientation are part of the server-rendered markup (Declarative Shadow DOM), so the divider shows before its JavaScript has loaded, and without JavaScript.
@@ -0,0 +1,50 @@
1
+ import hostStyle from '../../styles/host.style.js';
2
+
3
+ const css = String.raw;
4
+
5
+ const style = css`
6
+ :host {
7
+ /* As wide as its container, and without a space around it: the margin of the element, or
8
+ the gap of the layout it stands in, sets the distance to the content. */
9
+ display: block;
10
+
11
+ --_el-divider-line: var(--el-divider-width, var(--el-border-width, 1px)) solid
12
+ var(--el-divider-color, var(--el-color-border, color-mix(in srgb, currentColor 20%, transparent)));
13
+ }
14
+
15
+ .divider {
16
+ /* The line is a border, not a background: forced colours take a background away and
17
+ repaint a border. Everything else of the look the browser gives an hr is taken back,
18
+ its grey text colour too: without a theme the line is a share of the text colour of
19
+ the page. */
20
+ display: block;
21
+ flex: none;
22
+ width: auto;
23
+ height: 0;
24
+ margin: 0;
25
+ border: none;
26
+ border-block-start: var(--_el-divider-line);
27
+ color: inherit;
28
+ overflow: visible;
29
+ }
30
+
31
+ /* ── Vertical ─────────────────────────────────────────────────────────── */
32
+
33
+ /* In a row of a flex or grid container it is as high as the row, whatever the alignment of
34
+ the row is. In a line of text it is as high as the text. */
35
+ :host([orientation='vertical']) {
36
+ display: inline-flex;
37
+ align-self: stretch;
38
+ min-height: 1em;
39
+ vertical-align: middle;
40
+ }
41
+
42
+ /* The line stretches to the height of the host, as a flex item does. */
43
+ :host([orientation='vertical']) .divider {
44
+ height: auto;
45
+ border-block-start: none;
46
+ border-inline-start: var(--_el-divider-line);
47
+ }
48
+ `;
49
+
50
+ export default [hostStyle(), style].join('\n');
@@ -0,0 +1,25 @@
1
+ # Change Log
2
+
3
+ All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/).
6
+
7
+ <!--
8
+ When your PR touches this component, add an entry under Unreleased and
9
+ mirror it (prefixed with the component name) in root CHANGELOG.md.
10
+ Uncomment headings as needed.
11
+ -->
12
+
13
+ ## Unreleased
14
+
15
+ ## [0.3.0] - 2026-11-17
16
+
17
+ ### Added
18
+
19
+ - Initial `el-drawer`: a panel that slides in from an edge of the viewport and lies over the page, for a navigation, a filter or the details of a row. It is `el-dialog` at another place: a modal on the native `<dialog>` element, so the platform keeps the focus inside, makes the page behind it `inert`, renders it in the top layer and gives the focus back when it closes. ([#73](https://github.com/webtides/element-library/issues/73))
20
+ - `placement` (`start`, `end`, `top` or `bottom`; `end` by default, reflected): the edge the drawer lies along and slides in from. `start` and `end` are the ends of a line of text, so they swap in a right-to-left page. A drawer at the start or the end goes from the top to the bottom, one at the top or the bottom goes across the viewport.
21
+ - `--el-drawer-size`: the width of a drawer at the start or the end (`25rem` without it), the height of one at the top or the bottom (the height of its content without it). The drawer is never larger than the viewport.
22
+ - What `el-dialog` has, under the names of the drawer: `open` (reflected, with the `open` custom state), `label`, `no-header`, `close-label`; `show()` and `hide()`, which resolve once the drawer has slid in or out, and `requestClose(source)`; the events `drawer-show`, `drawer-after-show`, `drawer-hide`, `drawer-after-hide`, `drawer-initial-focus` and the cancelable `drawer-request-close` for the close button, `Escape` and a click on the backdrop; the slots `label`, `header-actions` and `footer`; the parts `base`, `header`, `title`, `header-actions`, `close-button`, `body` and `footer`.
23
+ - A form with `method="dialog"` inside the drawer closes it when it is submitted, as in `el-dialog`, and without `drawer-request-close`. ([#111](https://github.com/webtides/element-library/issues/111))
24
+ - The page does not scroll while a drawer is open. The lock is the one of `el-dialog`, so the two work together.
25
+ - The surface takes its colours and its shadow from the tokens, with a border on the edge that faces the page and square corners. The backdrop is the one of the dialog (`--el-dialog-overlay-background`). The slide takes `--el-duration-md`; a user who prefers reduced motion gets none.
@@ -0,0 +1,3 @@
1
+ import { define } from './drawer.js';
2
+
3
+ define();
@@ -0,0 +1,8 @@
1
+ export default {
2
+ SHOW: 'drawer-show',
3
+ AFTER_SHOW: 'drawer-after-show',
4
+ HIDE: 'drawer-hide',
5
+ AFTER_HIDE: 'drawer-after-hide',
6
+ INITIAL_FOCUS: 'drawer-initial-focus',
7
+ REQUEST_CLOSE: 'drawer-request-close',
8
+ };
@@ -0,0 +1,80 @@
1
+ import { defineElement } from '@webtides/element-js';
2
+ import Dialog from '../dialog/dialog.js';
3
+ import style from './drawer.style.js';
4
+ import Events from './drawer.events.js';
5
+
6
+ /**
7
+ * A panel that slides in from an edge of the viewport and lies over the page: for a navigation, a
8
+ * filter, the details of a row. It is the dialog of the library at another place, a modal built on
9
+ * the native `<dialog>` element. The platform keeps the focus inside, makes the page behind it
10
+ * `inert`, renders it in the top layer and gives the focus back when it closes. The component adds
11
+ * the edge it comes from, the slide, a close that a listener can refuse, and the lock on the
12
+ * scrolling of the page.
13
+ *
14
+ * @element el-drawer
15
+ *
16
+ * @fires {CustomEvent} drawer-show - Fired when the drawer starts to open.
17
+ * @fires {CustomEvent} drawer-after-show - Fired once the drawer has slid in.
18
+ * @fires {CustomEvent} drawer-hide - Fired when the drawer starts to close.
19
+ * @fires {CustomEvent} drawer-after-hide - Fired once the drawer has slid out.
20
+ * @fires {CustomEvent} drawer-initial-focus - Fired after the drawer has been opened and the
21
+ * platform has moved the focus into it. Move the focus in a listener to have it elsewhere.
22
+ * @fires {CustomEvent<{ source: 'close-button' | 'keyboard' | 'overlay' }>} drawer-request-close -
23
+ * Fired before the drawer closes for the close button, `Escape` or a click on the backdrop.
24
+ * Cancelable: call `preventDefault()` to keep the drawer open.
25
+ *
26
+ * @slot - The content of the drawer (body).
27
+ * @slot label - The title of the drawer. Takes precedence over the `label` attribute.
28
+ * @slot header-actions - Controls in the header, before the close button.
29
+ * @slot footer - The footer, for buttons as a rule. It is left out when it is empty.
30
+ *
31
+ * @csspart base - The native `<dialog>` element: the surface of the drawer (background, border,
32
+ * shadow). The backdrop is its `::backdrop` pseudo-element.
33
+ * @csspart header - The header row with the title, the header actions and the close button.
34
+ * @csspart title - The title heading.
35
+ * @csspart header-actions - The container of the `header-actions` slot.
36
+ * @csspart close-button - The built-in close button.
37
+ * @csspart body - The body with the default slot. It scrolls when the content is longer.
38
+ * @csspart footer - The footer with the `footer` slot.
39
+ *
40
+ * @cssstate open - Set while the drawer is open. Style with `:host(:state(open))` or
41
+ * `el-drawer:state(open)` from outside.
42
+ *
43
+ * @property {boolean} open - Whether the drawer is open. Reflected to the `open` attribute.
44
+ * @property {string} label - The title of the drawer (used when the `label` slot is empty), and
45
+ * its accessible name when `no-header` is set.
46
+ * @property {'start'|'end'|'top'|'bottom'} placement - The edge of the viewport the drawer comes
47
+ * from. `start` and `end` are the two ends of a line of text: left and right, and the other way
48
+ * round in a right-to-left page. Default `'end'`. Reflected to the `placement` attribute.
49
+ * @property {boolean} noHeader - Removes the header (title and built-in close button). Provide a
50
+ * way to close the drawer when set. Reflected to the `no-header` attribute.
51
+ * @property {string} closeLabel - Accessible label of the built-in close button. Default `'Close'`.
52
+ */
53
+ export default class Drawer extends Dialog {
54
+ constructor(options = {}) {
55
+ super({
56
+ styles: [style],
57
+ ...options,
58
+ // The stylesheet selects the host by this attribute.
59
+ propertyOptions: { placement: { reflect: true }, ...options.propertyOptions },
60
+ });
61
+ }
62
+
63
+ properties() {
64
+ return {
65
+ ...super.properties(),
66
+ placement: 'end',
67
+ };
68
+ }
69
+
70
+ /** @protected */
71
+ get _eventNames() {
72
+ return Events;
73
+ }
74
+ }
75
+
76
+ export function define() {
77
+ defineElement('el-drawer', Drawer);
78
+ }
79
+
80
+ export { Events };