@webtides/element-library 0.1.2 → 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 +390 -3
  2. package/README.md +61 -41
  3. package/all.js +28 -0
  4. package/catalog.d.ts +14 -0
  5. package/catalog.js +63 -0
  6. package/custom-elements.json +16604 -3420
  7. package/package.json +37 -25
  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
@@ -0,0 +1,255 @@
1
+ import { TemplateElement, defineElement, html } from '@webtides/element-js';
2
+ import style from './popover.style.js';
3
+ import Events from './popover.events.js';
4
+ import { followAnchor, placeAtAnchor } from '../../utils/floating.js';
5
+
6
+ /**
7
+ * A panel that floats next to an anchor: a click on the anchor opens it, a second click, a click
8
+ * beside it or `Escape` closes it. Built on the native popover of the platform, which owns the top
9
+ * layer (nothing clips the panel or lies on top of it), the closing and the return of the focus.
10
+ * The component adds the anchor and the place of the panel: at the side of the anchor that
11
+ * `placement` names, on the other side when there is no room, and never outside the viewport.
12
+ *
13
+ * @element el-popover
14
+ *
15
+ * @fires {CustomEvent} popover-show - Fired when the panel has opened.
16
+ * @fires {CustomEvent} popover-hide - Fired when the panel has closed.
17
+ *
18
+ * @slot - The content of the panel.
19
+ * @slot anchor - The element the panel belongs to and opens from, a button as a rule. It gets
20
+ * `aria-expanded`.
21
+ *
22
+ * @csspart anchor - Forwarded onto the `anchor` slot.
23
+ * @csspart panel - The floating panel: background, border, radius, elevation, width.
24
+ * @csspart arrow - The arrow that points to the anchor, present only while `arrow` is `true`.
25
+ *
26
+ * @cssstate open - Set while the panel is shown. Style with `:host(:state(open))` or
27
+ * `el-popover:state(open)` from outside.
28
+ *
29
+ * @property {boolean} open - Whether the panel is shown. Reflected to the `open` attribute.
30
+ * @property {'top'|'top-start'|'top-end'|'bottom'|'bottom-start'|'bottom-end'|'left'|'left-start'|'left-end'|'right'|'right-start'|'right-end'} placement -
31
+ * The side of the anchor the panel is placed at, and with `-start` or `-end` the edge of the
32
+ * anchor it is aligned with. Without room there, the panel goes to the opposite side. Default
33
+ * `'bottom'`.
34
+ * @property {number} distance - The gap between the anchor and the panel, or the tip of its arrow,
35
+ * in pixels. Default `8`.
36
+ * @property {boolean} arrow - Whether the panel has an arrow that points to the anchor. Default
37
+ * `false`.
38
+ */
39
+ export default class Popover extends TemplateElement {
40
+ constructor() {
41
+ super({ styles: [style], shadowRender: true, propertyOptions: { open: { reflect: true } } });
42
+ }
43
+
44
+ properties() {
45
+ return {
46
+ open: false,
47
+ placement: 'bottom',
48
+ distance: 8,
49
+ arrow: false,
50
+ };
51
+ }
52
+
53
+ connected() {
54
+ this._syncAnchor();
55
+ // The watcher does not run for the first value, so a popover that is open from the start is
56
+ // shown here.
57
+ if (this.open) this._applyOpen();
58
+ }
59
+
60
+ disconnected() {
61
+ this._stopPositioning();
62
+ }
63
+
64
+ afterUpdate() {
65
+ // A new placement or distance, an arrow that came or went, other content in the panel.
66
+ if (this.open) this._position();
67
+ }
68
+
69
+ watch() {
70
+ return {
71
+ open: (open) => {
72
+ if (open) this._applyOpen();
73
+ else this._applyClose();
74
+ },
75
+ };
76
+ }
77
+
78
+ events() {
79
+ return {
80
+ '[data-anchor]': {
81
+ pointerdown: () => {
82
+ this._openAtPointerDown = this.open;
83
+ },
84
+ click: (event) => {
85
+ // The platform closes an open panel when the pointer is released beside it, and
86
+ // the anchor is beside it. Whether the panel has reported that when the click
87
+ // arrives is a matter of timing (Chromium reports it after the click), and a
88
+ // click that found it closed would open it again. So a click of a pointer goes
89
+ // by what was the case when the pointer went down. A click of the keyboard has
90
+ // no pointer (`detail` is 0) and goes by what is the case now.
91
+ const byPointer = event.detail > 0 && this._openAtPointerDown !== undefined;
92
+ const wasOpen = byPointer ? this._openAtPointerDown : this.open;
93
+ this._openAtPointerDown = undefined;
94
+ this.open = !wasOpen;
95
+ },
96
+ slotchange: () => this._syncAnchor(),
97
+ },
98
+ "[part~='panel']": {
99
+ beforetoggle: (event) => {
100
+ // Still open at this point, so the focus is where it was. Once the panel is
101
+ // closed, an element that had the focus inside it has lost it to the page.
102
+ if (event.newState === 'closed') this._focusWasInPanel = this._hasFocusInPanel();
103
+ },
104
+ toggle: (event) => {
105
+ // The platform has closed the panel: a click beside it, Escape, or another
106
+ // popover that opened.
107
+ if (event.newState === 'closed' && this.open) this.open = false;
108
+ },
109
+ },
110
+ };
111
+ }
112
+
113
+ /**
114
+ * Opens the panel.
115
+ * @returns {void}
116
+ */
117
+ show() {
118
+ this.open = true;
119
+ }
120
+
121
+ /**
122
+ * Closes the panel.
123
+ * @returns {void}
124
+ */
125
+ hide() {
126
+ this.open = false;
127
+ }
128
+
129
+ /**
130
+ * Opens the panel when it is closed, and closes it when it is open.
131
+ * @returns {void}
132
+ */
133
+ toggle() {
134
+ this.open = !this.open;
135
+ }
136
+
137
+ /**
138
+ * The element the panel is placed at: what is in the `anchor` slot, or the popover itself.
139
+ * @private
140
+ * @returns {Element}
141
+ */
142
+ _anchor() {
143
+ return this.$refs.anchor?.assignedElements({ flatten: true })[0] ?? this;
144
+ }
145
+
146
+ /**
147
+ * Tells on the anchor whether the panel is open. Only an anchor that can say so gets the
148
+ * attribute: a button, a link, an element with a role of its own, or a custom element, which
149
+ * may pass it on to the control inside it. On a `<span>` it would be an error.
150
+ * @private
151
+ */
152
+ _syncAnchor() {
153
+ const anchor = this._anchor();
154
+ if (anchor === this) return;
155
+ const canTell =
156
+ anchor.localName.includes('-') || anchor.matches('button, a[href], input[type="button"], [role]');
157
+ if (canTell) anchor.setAttribute('aria-expanded', this.open ? 'true' : 'false');
158
+ }
159
+
160
+ /**
161
+ * Whether the focus is in the content of the panel, that is in the popover but not in its anchor.
162
+ * @private
163
+ * @returns {boolean}
164
+ */
165
+ _hasFocusInPanel() {
166
+ // Not `:focus-within`: the popover does not match it for a focus inside its open panel,
167
+ // which is in the top layer.
168
+ const active = this.getRootNode().activeElement;
169
+ if (!active || active === this || !this.contains(active)) return false;
170
+ const anchor = this._anchor();
171
+ return anchor === this || !anchor.contains(active);
172
+ }
173
+
174
+ /**
175
+ * Gives the focus back to the anchor when it was in the panel that has just closed. The platform
176
+ * does that for the content of a popover, but the content here is slotted: it belongs to the
177
+ * page and not to the panel, and the focus would be left on nothing.
178
+ * @private
179
+ */
180
+ _restoreFocus() {
181
+ if (!this._focusWasInPanel) return;
182
+ this._focusWasInPanel = false;
183
+ const anchor = this._anchor();
184
+ if (anchor !== this) anchor.focus?.();
185
+ }
186
+
187
+ /** @private */
188
+ _applyOpen() {
189
+ const panel = this.$refs.panel;
190
+ if (!panel || !this.isConnected) return;
191
+
192
+ if (!panel.matches(':popover-open')) panel.showPopover();
193
+ this._internals.states.add('open');
194
+ this._syncAnchor();
195
+ this._startPositioning();
196
+ this.dispatch(Events.SHOW);
197
+ }
198
+
199
+ /** @private */
200
+ _applyClose() {
201
+ const panel = this.$refs.panel;
202
+ if (!panel) return;
203
+
204
+ this._stopPositioning();
205
+ if (panel.matches(':popover-open')) panel.hidePopover();
206
+ this._internals.states.delete('open');
207
+ this._syncAnchor();
208
+ this._restoreFocus();
209
+ this.dispatch(Events.HIDE);
210
+ }
211
+
212
+ /**
213
+ * Places the panel now, and again whenever the anchor moves: on scroll, on resize, when the
214
+ * anchor or the panel changes its size.
215
+ * @private
216
+ */
217
+ _startPositioning() {
218
+ this._stopPositioning();
219
+ this._stopAutoUpdate = followAnchor(this._anchor(), this.$refs.panel, () => this._position());
220
+ }
221
+
222
+ /** @private */
223
+ _stopPositioning() {
224
+ this._stopAutoUpdate?.();
225
+ this._stopAutoUpdate = undefined;
226
+ }
227
+
228
+ /** @private */
229
+ async _position() {
230
+ const panel = this.$refs.panel;
231
+ if (!panel || !this.open) return;
232
+
233
+ await placeAtAnchor(this._anchor(), panel, {
234
+ placement: this.placement,
235
+ distance: this.distance,
236
+ arrowElement: this.$refs.arrow,
237
+ });
238
+ }
239
+
240
+ template() {
241
+ return html`
242
+ <slot part="anchor" name="anchor" ref="anchor" data-anchor></slot>
243
+ <div part="panel" ref="panel" popover="auto">
244
+ <slot></slot>
245
+ ${this.arrow ? html`<div part="arrow" ref="arrow" class="arrow"></div>` : ''}
246
+ </div>
247
+ `;
248
+ }
249
+ }
250
+
251
+ export function define() {
252
+ defineElement('el-popover', Popover);
253
+ }
254
+
255
+ export { Events };
@@ -0,0 +1,132 @@
1
+ # Popover
2
+
3
+ `popover` is a panel that floats next to an anchor. A click on the anchor opens it; a second click, a click beside it or `Escape` closes it.
4
+
5
+ It is built on the native popover of the platform (`popover="auto"`), which owns the top layer, the closing and the keyboard: nothing clips the panel or lies on top of it, whatever `overflow` or `z-index` its surroundings have. The component adds the anchor and the place of the panel, which it computes with [Floating UI](https://floating-ui.com): at the side of the anchor that `placement` names, on the other side when there is no room, and never outside the viewport.
6
+
7
+ Without a theme imported the panel has the system colours for its surface and its text, so that it can be read over the page.
8
+
9
+ ## How to use
10
+
11
+ #### Install
12
+
13
+ ```sh
14
+ npm i --save @webtides/element-library
15
+ ```
16
+
17
+ #### Use
18
+
19
+ ```js
20
+ import '@webtides/element-library/popover/define';
21
+ ```
22
+
23
+ ```html
24
+ <el-popover>
25
+ <button slot="anchor" type="button">Options</button>
26
+ <p>The content of the panel.</p>
27
+ </el-popover>
28
+
29
+ <!-- Above the anchor, aligned with its start, with an arrow -->
30
+ <el-popover placement="top-start" arrow="true">
31
+ <button slot="anchor" type="button">Help</button>
32
+ <p>Any content, links and controls included.</p>
33
+ </el-popover>
34
+ ```
35
+
36
+ > Boolean attributes are passed as strings (`arrow="true"`), matching the rest of the library.
37
+
38
+ ## API
39
+
40
+ #### Properties/Attributes
41
+
42
+ | Name | Type | Default | Description |
43
+ | ----------- | --------- | ---------- | ----------------------------------------------------------------------------- |
44
+ | `open` | `boolean` | `false` | Whether the panel is shown. Reflected to the `open` attribute. |
45
+ | `placement` | `string` | `'bottom'` | `top`, `bottom`, `left` or `right`, each also with `-start` or `-end`. |
46
+ | `distance` | `number` | `8` | The gap between the anchor and the panel, or the tip of its arrow, in pixels. |
47
+ | `arrow` | `boolean` | `false` | Whether the panel has an arrow that points to the anchor. |
48
+
49
+ #### Methods
50
+
51
+ | Name | Description |
52
+ | ---------- | ------------------------------------------------------- |
53
+ | `show()` | Opens the panel. |
54
+ | `hide()` | Closes the panel. |
55
+ | `toggle()` | Opens the panel when it is closed, closes it when open. |
56
+
57
+ #### Events
58
+
59
+ | Name | Description |
60
+ | -------------- | --------------------- |
61
+ | `popover-show` | The panel has opened. |
62
+ | `popover-hide` | The panel has closed. |
63
+
64
+ Both bubble and cross shadow boundaries. They fire for every way of opening and closing: the anchor, the methods, the `open` property, `Escape`, a click beside the panel.
65
+
66
+ #### Slots
67
+
68
+ | Name | Description |
69
+ | ----------- | -------------------------------------------------------------------- |
70
+ | _(default)_ | The content of the panel. |
71
+ | `anchor` | The element the panel belongs to and opens from, a button as a rule. |
72
+
73
+ #### CSS Parts
74
+
75
+ | Name | Description |
76
+ | -------- | ----------------------------------------------------------------- |
77
+ | `anchor` | The `<slot>` holding the anchor. |
78
+ | `panel` | The floating panel: background, border, radius, elevation, width. |
79
+ | `arrow` | The arrow (present only while `arrow`). |
80
+
81
+ #### CSS States
82
+
83
+ | Name | Description |
84
+ | ------ | ---------------------------------------------------------------------------------- |
85
+ | `open` | Present on the host while the panel is shown. Style with `el-popover:state(open)`. |
86
+
87
+ #### CSS Custom Properties
88
+
89
+ The panel reads `--el-color-bg` and `--el-color-fg` (the system colours `Canvas` and `CanvasText` without a theme), `--el-color-border`, `--el-border-width`, `--el-radius-lg`, `--el-space-3` for its padding and `--el-shadow-lg`. The arrow has the surface of the panel, and its border on the two sides that stick out.
90
+
91
+ The panel is as wide as its content, up to `20rem`, and never wider than the viewport. Change that on the part:
92
+
93
+ ```css
94
+ el-popover::part(panel) {
95
+ max-width: 30rem;
96
+ }
97
+ ```
98
+
99
+ ## Placement
100
+
101
+ `placement` names the side of the anchor: `top`, `bottom`, `left` or `right`. On that side the panel is centred on the anchor; with `-start` or `-end` it is aligned with that edge of the anchor instead (`bottom-start`: below, left edges in line, in a left-to-right page).
102
+
103
+ The placement is a wish. The panel goes to the opposite side when it has no room on its own, and it is pushed back along the edge of the viewport when it would leave it, to 8 px from the edge. The arrow stays on the anchor through both.
104
+
105
+ While the panel is open it follows its anchor: when the page or a box around it scrolls, when the window is resized, when the anchor or the panel changes its size. Nothing is computed while it is closed.
106
+
107
+ `distance` is the gap between the anchor and the panel in pixels. With an arrow it is the gap between the anchor and the tip of the arrow.
108
+
109
+ ## Opening and closing
110
+
111
+ - A click on the anchor opens and closes the panel. That includes Enter and Space on an anchor that is a button.
112
+ - `Escape` and a click beside the panel close it. The platform does that, as for every native popover.
113
+ - One popover is open at a time: opening another one closes this one. A popover inside the panel of another one keeps its parent open.
114
+ - `open`, `show()`, `hide()` and `toggle()` do the same from a script. A popover with `open="true"` is open from the start, once its JavaScript has run.
115
+
116
+ The component has no hover mode and does not open on focus.
117
+
118
+ ## Accessibility
119
+
120
+ - Use a `<button>` as the anchor. It is what a keyboard can reach and activate, and the popover writes `aria-expanded` onto it, so that a screen reader announces whether the panel is open. A link, an element with a role of its own and a custom element get the attribute as well; an element that cannot carry it, a `<span>` for example, does not.
121
+ - An `el-button` as the anchor passes the attribute on to the control inside it.
122
+ - The panel has no role. Its content comes right after the anchor in the page, for the keyboard and for a screen reader: Tab from the anchor goes into the panel. The focus is not moved when the panel opens.
123
+ - `Escape` closes the panel. If the focus was inside it, it goes back to the anchor. After a click beside the panel the focus stays where the click put it.
124
+ - The component adds nothing that takes the focus itself, so the focus ring is the one of the anchor and of the content.
125
+
126
+ ## Server-side rendering
127
+
128
+ The anchor and the closed panel are part of the server-rendered markup (Declarative Shadow DOM). The panel is a native popover and stays hidden until it is opened, so nothing flashes before the JavaScript has loaded. Opening and placing need the JavaScript: a popover that is rendered with `open="true"` appears when its element is defined.
129
+
130
+ ## Browser support
131
+
132
+ The popover needs the native Popover API: Chrome 114, Firefox 125, Safari 17. The place of the panel is computed in script, so it does not depend on CSS anchor positioning.
@@ -0,0 +1,41 @@
1
+ import hostStyle from '../../styles/host.style.js';
2
+ import arrowStyle from '../../styles/arrow.style.js';
3
+
4
+ const css = String.raw;
5
+
6
+ const style = css`
7
+ :host {
8
+ display: inline-block;
9
+ }
10
+
11
+ [part~='panel'] {
12
+ /* The platform centres a popover in the viewport and gives it a look of its own. The panel
13
+ is placed at the anchor instead: the script sets left and top, in the coordinates of the
14
+ viewport. Whether it is shown stays with the platform, so there is no display here. */
15
+ position: fixed;
16
+ inset: auto;
17
+ top: 0;
18
+ left: 0;
19
+ margin: 0;
20
+ width: max-content;
21
+ max-width: min(20rem, calc(100vw - 1rem));
22
+ /* The arrow sticks out. */
23
+ overflow: visible;
24
+ padding: var(--el-space-3, 0.75rem);
25
+ /* System colours as the headless fallback: a floating surface has to be readable over the
26
+ page, so transparent is no option here. */
27
+ background: var(--el-color-bg, Canvas);
28
+ color: var(--el-color-fg, CanvasText);
29
+ border: var(--el-border-width, 1px) solid var(--el-color-border, currentColor);
30
+ border-radius: var(--el-radius-lg, 0);
31
+ box-shadow: var(--el-shadow-lg, none);
32
+ /* A popover can stand in a row of joined buttons (el-button-group), which joins its
33
+ anchor with properties that inherit. What is in the panel is not part of that row:
34
+ they stop here. */
35
+ --_el-group-radius-start: initial;
36
+ --_el-group-radius-end: initial;
37
+ --_el-group-divider: initial;
38
+ }
39
+ `;
40
+
41
+ export default [hostStyle(), style, arrowStyle("[part~='panel']")].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-progress-bar`: a track that fills with the progress of a task, an upload, an import, the steps of a form. Exposed as a progress bar (`role="progressbar"`) with its value, and named by `label`, "Progress" by default. ([#121](https://github.com/webtides/element-library/issues/121))
20
+ - `value` of `max` (default `100`) is the share of the track that is filled. A value outside of the range is shown as the nearest one inside. The part that is filled starts where the text starts, and moves to a new value in the duration of the theme.
21
+ - `indeterminate` is the bar for a task whose progress is not known yet: it has no value, and two fifths of the track pass over it. For a user who prefers reduced motion the whole track fades and comes back instead.
22
+ - The part that is filled has the accent colour of the theme, and the text colour without a theme; the track is a fifth of the text colour. `--el-progress-bar-indicator-color`, `--el-progress-bar-track-color` and `--el-progress-bar-height` set the colours and the height.
23
+ - When colours are forced the track is drawn with a border and filled in the colour of a selection.
@@ -0,0 +1,3 @@
1
+ import { define } from './progress-bar.js';
2
+
3
+ define();
@@ -0,0 +1,80 @@
1
+ import { TemplateElement, defineElement, html } from '@webtides/element-js';
2
+ import style from './progress-bar.style.js';
3
+ import { progressOf } from '../../utils/progress.js';
4
+
5
+ /**
6
+ * A progress bar: a track that fills with the progress of a task, an upload, an import, the steps
7
+ * of a form. `value` of `max` says how far the task is. `indeterminate` is the bar for a task
8
+ * whose progress is not known yet: a part of the track that moves, in the place where the bar with
9
+ * a value will stand.
10
+ *
11
+ * @element el-progress-bar
12
+ *
13
+ * @csspart base - The track. It carries `role="progressbar"`, the value and the label.
14
+ * @csspart indicator - The part of the track that is filled.
15
+ *
16
+ * @cssproperty --el-progress-bar-height - The height of the bar. Unset, it is `0.5rem`.
17
+ * @cssproperty --el-progress-bar-indicator-color - The part that is filled. Unset, it is
18
+ * `--el-color-accent`, and the text colour without a theme.
19
+ * @cssproperty --el-progress-bar-track-color - The track. Unset, it is a fifth of the text colour.
20
+ *
21
+ * @property {number} value - How far the task is, from `0` to `max`. A value outside of that range
22
+ * is shown as the nearest one inside. Default `0`.
23
+ * @property {number} max - The value of a task that is done. Default `100`.
24
+ * @property {boolean} indeterminate - The progress is not known: the bar has no value and a part
25
+ * of the track moves. Default `false`.
26
+ * @property {string} label - The accessible name of the bar. Default `'Progress'`.
27
+ */
28
+ export default class ProgressBar extends TemplateElement {
29
+ constructor() {
30
+ super({
31
+ styles: [style],
32
+ shadowRender: true,
33
+ });
34
+ }
35
+
36
+ properties() {
37
+ return {
38
+ value: 0,
39
+ max: 100,
40
+ indeterminate: false,
41
+ label: 'Progress',
42
+ };
43
+ }
44
+
45
+ template() {
46
+ if (this.indeterminate) {
47
+ // Without a value: that is how a progress of unknown length is exposed.
48
+ return html`
49
+ <div
50
+ part="base"
51
+ class="progress-bar progress-bar--indeterminate"
52
+ role="progressbar"
53
+ aria-label="${this.label}"
54
+ >
55
+ <div part="indicator" class="indicator"></div>
56
+ </div>
57
+ `;
58
+ }
59
+
60
+ const { value, max, percent } = progressOf(this.value, this.max);
61
+
62
+ return html`
63
+ <div
64
+ part="base"
65
+ class="progress-bar"
66
+ role="progressbar"
67
+ aria-label="${this.label}"
68
+ aria-valuemin="0"
69
+ aria-valuemax="${max}"
70
+ aria-valuenow="${value}"
71
+ >
72
+ <div part="indicator" class="indicator" style="${`width: ${percent}%`}"></div>
73
+ </div>
74
+ `;
75
+ }
76
+ }
77
+
78
+ export function define() {
79
+ defineElement('el-progress-bar', ProgressBar);
80
+ }
@@ -0,0 +1,110 @@
1
+ # Progress Bar
2
+
3
+ `progress-bar` shows how far a task is: an upload, an import, the steps of a form. A track fills with `value` of `max`. With `indeterminate` it is the bar for a task whose progress is not known yet.
4
+
5
+ Without a theme imported the bar takes both of its colours from the text colour, so it shows on any background. With a theme the part that is filled has the accent colour.
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/progress-bar/define';
19
+ ```
20
+
21
+ ```html
22
+ <el-progress-bar value="40" label="Upload"></el-progress-bar>
23
+
24
+ <!-- In the unit of the task: 3 of 12 files -->
25
+ <el-progress-bar value="3" max="12" label="Files"></el-progress-bar>
26
+
27
+ <!-- The progress is not known yet -->
28
+ <el-progress-bar indeterminate="true" label="Import"></el-progress-bar>
29
+ ```
30
+
31
+ > Boolean attributes are passed as strings (`indeterminate="true"`), matching the rest of the library.
32
+
33
+ ## API
34
+
35
+ #### Properties/Attributes
36
+
37
+ | Name | Type | Default | Description |
38
+ | --- | --- | --- | --- |
39
+ | `value` | `number` | `0` | How far the task is, from `0` to `max`. |
40
+ | `max` | `number` | `100` | The value of a task that is done. |
41
+ | `indeterminate` | `boolean` | `false` | The progress is not known: the bar has no value, a part of the track moves. |
42
+ | `label` | `string` | `'Progress'` | The accessible name of the bar. |
43
+
44
+ #### Methods
45
+
46
+ _None._
47
+
48
+ #### Events
49
+
50
+ _None._
51
+
52
+ #### Slots
53
+
54
+ _None._
55
+
56
+ #### CSS Parts
57
+
58
+ | Name | Description |
59
+ | ----------- | ------------------------------------------------------------------------ |
60
+ | `base` | The track. It carries `role="progressbar"`, the value and the label. |
61
+ | `indicator` | The part of the track that is filled, or that moves with no value known. |
62
+
63
+ #### CSS Custom Properties
64
+
65
+ | Name | Default | Description |
66
+ | --- | --- | --- |
67
+ | `--el-progress-bar-height` | `0.5rem` | The height of the bar. |
68
+ | `--el-progress-bar-indicator-color` | `--el-color-accent`, the text colour without a theme | The part that is filled. |
69
+ | `--el-progress-bar-track-color` | a fifth of the text colour | The track. |
70
+
71
+ ## Value
72
+
73
+ `value` of `max` is the share of the track that is filled. `max` is `100` by default, so a `value` is a percentage. With another `max` both count in the unit of the task: `value="3" max="12"` for the third of twelve files.
74
+
75
+ A value outside of the range is shown as the nearest one inside: below `0` the track is empty, above `max` it is full. A `value` that is no number counts as `0`, a `max` that is no number above zero as `100`. The properties are left as they were set.
76
+
77
+ The part that is filled starts where the text starts: at the left, and at the right in a text that runs from right to left. It moves to a new value in the duration of the theme (`--el-duration-md`), and at once without a theme.
78
+
79
+ The bar has no text of its own. Write what the task is, and how far it is, next to the bar.
80
+
81
+ ## Indeterminate
82
+
83
+ `indeterminate` is for a task that has started and cannot say yet how far it is: a part of the track passes over it, again and again. When the progress is known, set `indeterminate` to `false` and the bar shows `value`, in the same place and at the same size.
84
+
85
+ For a wait that never gets a value, a page or a section that loads, `el-spinner` is the smaller sign.
86
+
87
+ For a user who prefers reduced motion (`prefers-reduced-motion: reduce`) nothing crosses the page: the whole track fades and comes back instead. It does not stand still, since a full bar that does not move reads as a task that is done.
88
+
89
+ ## Size and colours
90
+
91
+ The bar is as wide as its container; give the element a width or a `max-width` for another one. `--el-progress-bar-height` is its height, `0.5rem` by default.
92
+
93
+ The part that is filled reads `--el-progress-bar-indicator-color`, then `--el-color-accent`, then the text colour. The track reads `--el-progress-bar-track-color`; unset, it is the text colour at a fifth of its strength.
94
+
95
+ There is no `variant`. To say that a task went well or failed, set the colour of the indicator (`--el-color-success`, `--el-color-danger`) and say it in the text next to the bar as well: a colour alone does not reach everyone.
96
+
97
+ The ends have the radius of the theme (`--el-radius-md`). For fully rounded ends on a higher bar: `el-progress-bar::part(base) { border-radius: 999px; }`.
98
+
99
+ The `hidden` attribute hides the bar.
100
+
101
+ ## Accessibility
102
+
103
+ - The track is a progress bar to assistive technology (`role="progressbar"`) with `aria-valuemin`, `aria-valuemax` and `aria-valuenow`, from which a screen reader computes the percentage. While `indeterminate` it has no `aria-valuenow`, which is how a progress of unknown length is exposed.
104
+ - Its name is the `label`, "Progress" by default. Set `label` to say what is in progress, in the language of the page; two bars on a page need two names.
105
+ - A screen reader announces a new value when its user is on the bar, not on its own. To tell that a task is done, write the message into a live region of the page, or show a toast. Set `aria-busy="true"` on the region that is being loaded.
106
+ - When colours are forced (the contrast themes of Windows) the track is drawn with a border and filled in the colour of a selection.
107
+
108
+ ## Server-side rendering
109
+
110
+ The track, its role, its value and the width of what is filled are part of the server-rendered markup (Declarative Shadow DOM), so the bar shows its value before its JavaScript has loaded, and without JavaScript.