@webtides/element-library 0.2.0 → 0.3.1

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 +399 -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 +16676 -3457
  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 +44 -1
  37. package/src/components/button/button.js +338 -29
  38. package/src/components/button/button.readme.md +138 -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 +25 -0
  59. package/src/components/checkbox-field/checkbox-field.js +32 -11
  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 +22 -0
  191. package/src/components/switch-field/switch-field.js +24 -10
  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 +158 -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,82 @@
1
+ # RatingField
2
+
3
+ `rating-field` takes a rating as a number from 1 to `max`, drawn as a row of stars: the stars up to the chosen one are filled. It renders a native `<fieldset>`/`<legend>` wrapping one `<input type="radio">` per step, so grouping, arrow-key navigation and form submission are all native. It extends `form-field`, inheriting the label, help text, error message, `required` and touched-state handling.
4
+
5
+ It is headless by default: without a theme the stars have the colour of the text.
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/rating-field/define';
19
+ ```
20
+
21
+ ```html
22
+ <el-rating-field name="rating" label="How was your stay?"></el-rating-field>
23
+
24
+ <el-rating-field name="score" label="Score" max="10" value="7" required="true"></el-rating-field>
25
+ ```
26
+
27
+ The radios are one group by their `name`, as native radios are: give the field a name, and a name of its own on a page with several ratings outside of a form.
28
+
29
+ #### The value
30
+
31
+ `value` is the chosen step as text (`"3"`), which is what the form submits, and `null` while nothing is chosen. A value that is no step of the scale, such as `"2.5"` or a `"9"` with five stars, chooses nothing.
32
+
33
+ A rating cannot be taken back to none by the user: a radio group has no way to choose nothing. A script can, with `value = null`, and so can `form.reset()` for a field that was rendered without a rating.
34
+
35
+ ## API
36
+
37
+ #### Properties/Attributes
38
+
39
+ Inherits all of `form-field`'s properties (`name`, `value`, `required`, `disabled`, `label`, `labelScreenReaderOnly`, `errorMessage`, `helpMessage`, `valid`, `touched`) and adds:
40
+
41
+ | Name | Type | Default | Description |
42
+ | ------- | -------- | ------- | ----------------------------------------------------------- |
43
+ | `value` | `string` | `null` | The chosen step, as the text the form submits. |
44
+ | `max` | `number` | `5` | The number of stars. The steps of the scale are 1 to `max`. |
45
+
46
+ #### Events
47
+
48
+ | Name | Detail | Description |
49
+ | -------------- | -------------------- | ------------------------------ |
50
+ | `input-change` | `string` (the value) | Fired when the rating changes. |
51
+
52
+ #### CSS States
53
+
54
+ | Name | Description |
55
+ | --------- | --------------------------------------------------------------------------------------- |
56
+ | `touched` | Set once the user has left the group. Moving from one star to the next does not set it. |
57
+ | `valid` | Set while the field passes validation. |
58
+ | `invalid` | Set while the field fails validation (`required` with nothing chosen). |
59
+
60
+ #### CSS Custom Properties
61
+
62
+ | Name | Description |
63
+ | ------------------- | ----------------------------------------------------------------------------------------- |
64
+ | `--el-rating-color` | The colour of a filled star. Unset, it is `--el-color-accent`. |
65
+ | `--el-rating-size` | The width and the height of a star. Unset, it is `--el-space-5`, `1.5em` without a theme. |
66
+
67
+ Headless by default; reads the library's `--el-*` design tokens (`--el-color-accent`, `--el-color-fg-muted`, `--el-space-1`, `--el-space-5`, `--el-focus-ring-width`, `--el-duration-md`, `--el-ease`, `--el-color-fg`, `--el-color-danger`, `--el-font-size-sm`). Skin it via a theme — see the Storybook _Docs / Theming_ page.
68
+
69
+ A star that is not on is an outline in `--el-color-fg-muted`, a star that is on is filled: the two differ in their shape, not in their colour alone. With a mouse, the stars up to the one under the pointer are shown as on before the click.
70
+
71
+ The label, the help message, the stars and the error message stack in a column, and the texts have one look in every field: see [Layout](../form-field/form-field.readme.md#layout) in the readme of `form-field`.
72
+
73
+ On a touch screen (`@media (any-pointer: coarse)`) every star, with its label as the hit area, is at least `--el-touch-target` wide and high. Without that token, and on a fine pointer, the sizes stay as they are.
74
+
75
+ ## Accessibility
76
+
77
+ - Uses a native `<fieldset>` + `<legend>`, so the group is announced with its label, and native radios: Tab moves into the group, the arrow keys choose a star.
78
+ - Every radio is named by its number (`aria-label`), which needs no translation, and a screen reader adds its place in the group. Say what the ends of the scale mean in the label or in the help message.
79
+ - The native radio stays in the accessibility tree and focusable; it is only hidden visually, with keyboard focus reflected onto its star via `:focus-visible`. The star is hidden from assistive technology (`aria-hidden`).
80
+ - The group and each of its radios name the help message in `aria-describedby`, and the error message while that is shown. The group says whether it is valid (`aria-invalid`).
81
+ - Validation messages surface only once the group is `touched`. The error message is an alert (`role="alert"`): a screen reader announces it when it appears.
82
+ - The field takes a rating. To show one that cannot be changed, such as an average, use an image with a text.
@@ -0,0 +1,79 @@
1
+ import hostStyle from '../../styles/host.style.js';
2
+ import formControlStyle from '../../styles/form-control.style.js';
3
+ import choiceGroupStyle from '../../styles/choice-group.style.js';
4
+
5
+ const css = String.raw;
6
+
7
+ /**
8
+ * The fieldset as the column of the field, the option as the hit area of its radio and the hidden
9
+ * native radio are the shared module `choice-group`. Here: the options beside each other, and the
10
+ * star that is drawn in the place of a radio.
11
+ */
12
+ const style = css`
13
+ el-rating-field {
14
+ /* The row is as wide as its stars and no wider: the pointer is over the row only while it
15
+ is over a star. */
16
+ .options {
17
+ display: flex;
18
+ align-self: flex-start;
19
+ }
20
+
21
+ /* The room between two stars belongs to the star in front of it: the row is one hit area
22
+ without holes, and the stars under the pointer do not flicker while it moves along. */
23
+ .option {
24
+ justify-content: center;
25
+ gap: 0;
26
+ padding-inline-end: var(--el-space-1, 4px);
27
+ }
28
+
29
+ .option:last-child {
30
+ padding-inline-end: 0;
31
+ }
32
+
33
+ /* A star that is not on is an outline, a star that is on is filled: the two differ in
34
+ their shape, not in their colour alone. Fallbacks render usable stars without a theme. */
35
+ .star {
36
+ flex: none;
37
+ width: var(--el-rating-size, var(--el-space-5, 1.5em));
38
+ height: var(--el-rating-size, var(--el-space-5, 1.5em));
39
+ color: var(--el-color-fg-muted, currentColor);
40
+ fill: none;
41
+ stroke: currentColor;
42
+ stroke-width: 1.5;
43
+ stroke-linejoin: round;
44
+ transition:
45
+ color var(--el-duration-md, 0s) var(--el-ease, linear),
46
+ fill var(--el-duration-md, 0s) var(--el-ease, linear);
47
+ }
48
+
49
+ .option.is-on .star {
50
+ color: var(--el-rating-color, var(--el-color-accent, currentColor));
51
+ fill: currentColor;
52
+ }
53
+
54
+ /* With a mouse: the stars up to the one under the pointer are shown as on before the
55
+ click, whatever is chosen. Not while the field is disabled.
56
+
57
+ While the pointer is over the row every star is on, and the ones after the star under
58
+ the pointer are off again. Both rules weigh more than the rule for a chosen star above,
59
+ and the second more than the first. */
60
+ @media (hover: hover) {
61
+ .options:not(.is-disabled):hover .option .star {
62
+ color: var(--el-rating-color, var(--el-color-accent, currentColor));
63
+ fill: currentColor;
64
+ }
65
+
66
+ .options:not(.is-disabled):hover .option:hover ~ .option .star {
67
+ color: var(--el-color-fg-muted, currentColor);
68
+ fill: none;
69
+ }
70
+ }
71
+ }
72
+ `;
73
+
74
+ export default [
75
+ hostStyle('el-rating-field'),
76
+ formControlStyle('el-rating-field'),
77
+ choiceGroupStyle('el-rating-field'),
78
+ style,
79
+ ].join('\n');
@@ -12,6 +12,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
12
12
 
13
13
  ## Unreleased
14
14
 
15
+ ## [0.3.0] - 2026-11-17
16
+
17
+ ### Changed
18
+
19
+ - On a touch screen (`@media (any-pointer: coarse)`) the select is at least `--el-touch-target` high (42 px with the default theme before). Unchanged on a fine pointer and without the token.
20
+ - The label, the help message, the select and the error message stack in a column with a gap of `--el-space-1` (4 px without a theme), as in `el-input-field`. Before, the label and the help message shared a line. The messages are set in `--el-font-size-sm` (14 px without a theme; they had the size of the text), the help message has the muted colour of the theme (`--el-color-fg-muted`) and the label its text colour (`--el-color-fg`); without a theme they keep the colour of the text. A help message without a text takes no room. ([#130](https://github.com/webtides/element-library/issues/130))
21
+
22
+ ### Fixed
23
+
24
+ - `value` selects its option. `<el-select-field value="b" options='["a","b","c"]'>` showed and submitted `a`, and a value set later changed nothing: the template wrote `value` onto the `<select>`, which has no such attribute. The option of the value now carries `selected`, in server-rendered markup as well, and a value that is set later selects its option, also after the user has chosen. `value` wins over an option marked as `selected` in `options`, which is the default of a field without a value. ([#104](https://github.com/webtides/element-library/issues/104))
25
+ - `value` says what is selected. A field without a value takes over what the select shows, the option marked as `selected` or else the first one; before, `value` stayed `null` until the user chose, while the form already submitted that option. No `input-change` is fired for it. While the placeholder is shown, `value` stays `null`. ([#104](https://github.com/webtides/element-library/issues/104))
26
+ - The error message is announced by screen readers: it is an alert (`role="alert"`), and the select names it in `aria-describedby` while it is shown. Before, the select pointed at it with `aria-errormessage` only. ([#94](https://github.com/webtides/element-library/issues/94))
27
+ - A decorated select shows its chevron wherever the theme is loaded. The theme showed the field's own chevron with a rule of the same weight as the rule of the field that hides it, so the later one won: with the theme in the stylesheet of the page and the styles of the field after it, the select had no chevron at all, the native one taken away and its own hidden. The field now follows a property that `styles/native.css` sets. ([#69](https://github.com/webtides/element-library/issues/69))
28
+ - The error message has the danger colour of the theme (`--el-color-danger`). It had the colour of the text and read like a help message, while the messages of an `el-input-field` on the same form were red. Without a theme it keeps the colour of the text, which is what every field does now. ([#128](https://github.com/webtides/element-library/issues/128))
29
+ - The `hidden` attribute hides the field. The field sets a `display` of its own, which won over the attribute. ([#130](https://github.com/webtides/element-library/issues/130))
30
+ - A second field with the same `name` on the page keeps its own label and its own messages. The ids of the select and of the messages are made per field, not from the name (BREAKING for a page that names `input-<name>` or `<name>-help-message` itself). See `form-field`. ([#133](https://github.com/webtides/element-library/issues/133))
31
+
15
32
  ## [0.1.0] - 2026-06-03
16
33
 
17
34
  ### Changed
@@ -1,4 +1,4 @@
1
- import { html, defineElement, classMap, when } from '@webtides/element-js';
1
+ import { html, defineElement, when } from '@webtides/element-js';
2
2
  import FormField from '../form-field/form-field.js';
3
3
  import style from './select-field.style.js';
4
4
 
@@ -12,13 +12,25 @@ import style from './select-field.style.js';
12
12
  * @fires {CustomEvent<string>} input-change - Fired when the selected value changes.
13
13
  * `detail` is the new value. Bubbles.
14
14
  *
15
+ * @property {string | null} value - The value of the selected option. Setting it selects the
16
+ * option with that value, when the field is rendered and later. Without a value the field takes
17
+ * over what the select shows: the option marked `selected` in `options`, or else the first one.
18
+ * It stays `null` while the placeholder is shown. An empty value that none of `options` has
19
+ * counts as no value.
15
20
  * @property {string} placeholder - Placeholder text rendered as the first disabled `<option>`
16
21
  * when no selection has been made.
17
22
  * @property {Array<string | { value: string, label?: string, selected?: boolean }>} options -
18
23
  * Options to render. Accepts plain strings (`['Apple', 'Pear']`) or option objects
19
- * (`[{ value, label, selected? }]`). Strings are used as both value and label.
24
+ * (`[{ value, label, selected? }]`). Strings are used as both value and label. `selected` is the
25
+ * choice of a field without a `value`; a `value` wins over it.
20
26
  */
21
27
  export default class SelectField extends FormField {
28
+ /**
29
+ * The value the field last took over from the select, see `_syncSelection()`.
30
+ * @private
31
+ */
32
+ _adoptedValue = undefined;
33
+
22
34
  constructor() {
23
35
  super({ styles: [style] });
24
36
  }
@@ -31,25 +43,105 @@ export default class SelectField extends FormField {
31
43
  };
32
44
  }
33
45
 
46
+ watch() {
47
+ const watchers = super.watch();
48
+ return {
49
+ ...watchers,
50
+ value: (value, oldValue) => {
51
+ // What the field took over from the select is no change: nobody chose anything.
52
+ if (this._adoptedValue !== undefined && value === this._adoptedValue) {
53
+ this._adoptedValue = undefined;
54
+ return;
55
+ }
56
+ watchers.value(value, oldValue);
57
+ },
58
+ };
59
+ }
60
+
61
+ afterUpdate() {
62
+ // Before the form field keeps the state for a reset: what the field takes over from the
63
+ // select is part of it.
64
+ this._syncSelection();
65
+ super.afterUpdate();
66
+ }
67
+
68
+ /**
69
+ * Makes the select and `value` say the same, after every render.
70
+ *
71
+ * The template marks the option of the value as `selected`, which is all that server-rendered
72
+ * markup and a fresh select need. That attribute is only the default of an option: once the user
73
+ * has chosen, the browser no longer follows it. So the option is selected here as well.
74
+ *
75
+ * Without a value, or without an option for it, the select has its default: the option the
76
+ * markup marks, the last one if there are several, or else the first one that is not disabled.
77
+ * That is what the browser selects in fresh markup. A field without a value then takes over
78
+ * what the select shows, so that `value` says what the form submits. The placeholder has no
79
+ * value, the field keeps its own for it. A value without an option is left alone: its option
80
+ * can still arrive with `options`.
81
+ * @private
82
+ */
83
+ _syncSelection() {
84
+ const select = this.$refs.input;
85
+ if (!select) return;
86
+
87
+ const all = [...select.options];
88
+ // The placeholder is the first option of the select and none of `options`.
89
+ const options = this.placeholder ? all.slice(1) : all;
90
+ const hasValue = this._hasValue();
91
+ const option =
92
+ (hasValue && options.find((candidate) => candidate.value === String(this.value))) ||
93
+ all.filter((candidate) => candidate.defaultSelected).pop() ||
94
+ all.find((candidate) => !candidate.disabled);
95
+ if (option && !option.selected) option.selected = true;
96
+
97
+ if (!hasValue && select.value !== '') {
98
+ this._adoptedValue = select.value;
99
+ this.value = select.value;
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Whether the field has a value that decides which option is selected. `null` is none. An empty
105
+ * value is none either, unless one of `options` has it: element-js writes a `null` back as an
106
+ * empty attribute where the value came from an attribute, and a page that renders
107
+ * `value=""` for "nothing chosen yet" means the same.
108
+ * @private
109
+ * @returns {boolean}
110
+ */
111
+ _hasValue() {
112
+ if (this.value == null) return false;
113
+ return this.value !== '' || this.options.some((option) => String(option.value ?? option) === '');
114
+ }
115
+
116
+ /**
117
+ * Whether an option carries `selected` in the markup: the option of the value, or, for a field
118
+ * without a value, the one that `options` marks.
119
+ * @private
120
+ * @param {string | { value: string, selected?: boolean }} option
121
+ * @returns {boolean}
122
+ */
123
+ _marksSelected(option) {
124
+ if (this._hasValue()) return String(option.value ?? option) === String(this.value);
125
+ return !!option.selected;
126
+ }
127
+
34
128
  /** @private */
35
129
  fieldTemplate() {
36
130
  return html`
37
131
  <select
38
132
  ref="input"
39
- id="input-${this.name}"
133
+ id="${this._idOf('input')}"
40
134
  name="${this.name}"
41
- value="${this.value}"
42
135
  ?required="${this.required}"
43
136
  ?disabled="${this.disabled}"
44
- aria-describedby="${this.name}-help-message"
137
+ aria-describedby="${this._describedBy()}"
45
138
  aria-invalid="${this.valid ? 'false' : 'true'}"
46
- aria-errormessage="${this.name}-error-message"
139
+ aria-errormessage="${this._idOf('error-message')}"
47
140
  >
48
141
  ${when(this.placeholder, html` <option value="" selected disabled>${this.placeholder}</option> `)}
49
142
  ${this.options.map((option) => {
50
- const value = option.value ?? option;
51
143
  return html`
52
- <option value="${value}" ?selected=${option.selected && !!option.selected}>
144
+ <option value="${option.value ?? option}" ?selected="${this._marksSelected(option)}">
53
145
  ${option.label ?? option}
54
146
  </option>
55
147
  `;
@@ -28,14 +28,15 @@ import '@webtides/element-library/select-field/define';
28
28
  required
29
29
  ></el-select-field>
30
30
 
31
- <!-- Object-based options with values and labels -->
31
+ <!-- Object-based options with values and labels, and the value that is selected -->
32
32
  <el-select-field
33
33
  name="size"
34
34
  label="Size"
35
35
  placeholder="Select a size"
36
+ value="md"
36
37
  options='[
37
38
  {"value": "sm", "label": "Small"},
38
- {"value": "md", "label": "Medium", "selected": true},
39
+ {"value": "md", "label": "Medium"},
39
40
  {"value": "lg", "label": "Large"}
40
41
  ]'
41
42
  ></el-select-field>
@@ -48,7 +49,7 @@ import '@webtides/element-library/select-field/define';
48
49
  | Name | Type | Default | Description |
49
50
  | --- | --- | --- | --- |
50
51
  | `name` | `string` | `''` | The name attribute for the select field, used for form submission and identification |
51
- | `value` | `string` | `null` | The current selected value of the select field |
52
+ | `value` | `string` | `null` | The value of the selected option. Setting it selects the option with that value, see [Value](#value) |
52
53
  | `placeholder` | `string` | `''` | Placeholder text displayed as the first disabled option when no selection is made |
53
54
  | `options` | `Array<string\|object>` | `[]` | Array of options. Can be simple strings or objects with `value`, `label`, and `selected` properties |
54
55
  | `required` | `boolean` | `false` | Whether the field is required for form submission |
@@ -84,7 +85,26 @@ When using objects:
84
85
 
85
86
  - `value`: The value submitted with the form (defaults to the string if not provided)
86
87
  - `label`: The text displayed in the dropdown (defaults to the string if not provided)
87
- - `selected`: Whether this option should be pre-selected (optional)
88
+ - `selected`: Whether this option is selected in a field without a `value` (optional)
89
+
90
+ #### Value
91
+
92
+ `value` says which option is selected, and the select follows it: when the field is rendered, in server-rendered markup (the option carries `selected` there, so the choice is right before the script runs), and when the value is set later.
93
+
94
+ ```html
95
+ <el-select-field name="size" label="Size" value="md" options='["sm", "md", "lg"]'></el-select-field>
96
+ ```
97
+
98
+ ```js
99
+ field.value = 'lg'; // selects "lg"
100
+ field.value = null; // back to the default of the select
101
+ ```
102
+
103
+ - **`value` wins over `selected` in `options`.** `selected` is the default of a field that has no value.
104
+ - **Without a value the field takes over what the select shows**, so that `value` always says what the form submits: the option marked as `selected`, or else the first option, as in a native select. That is no change, so no `input-change` is fired for it. While the placeholder is shown, `value` stays `null`.
105
+ - **An empty value** (`''`) selects the option with an empty value if `options` has one, an "Any" entry for example. If it has none, an empty value counts as no value.
106
+ - **A value that no option has** selects nothing: the select shows its default, and `value` stays as it is. Its option is selected as soon as it arrives with `options`.
107
+ - The values are compared as text: `value="2"` selects the option `2`.
88
108
 
89
109
  #### Methods
90
110
 
@@ -103,7 +123,13 @@ When using objects:
103
123
 
104
124
  #### CSS Custom Properties
105
125
 
106
- This component is headless by default and inherits its styling — and the `--el-*` design tokens it reads — from `FormField`, plus a custom dropdown indicator. Skin it by setting those tokens via a theme — see the Storybook _Docs / Theming_ page.
126
+ This component is headless by default and shares its layout — and the `--el-*` design tokens it reads — with every field, plus a custom dropdown indicator. Skin it by setting those tokens via a theme — see the Storybook _Docs / Theming_ page.
127
+
128
+ The control itself (border, radius, padding, focus ring) is decorated by `styles/native.css`, which you import beside the theme; without it the control keeps the look of the browser. The field renders a chevron of its own, hidden as long as the select has the look of the browser. `native.css` takes the native chevron away and shows that one, in `--el-select-indicator-color` (by default `--el-color-fg-muted`).
129
+
130
+ The label, the help message, the control and the error message stack in a column, and the texts have one look in every field: see [Layout](../form-field/form-field.readme.md#layout) in the readme of `form-field`. The error message has the danger colour of the theme (`--el-color-danger`); without a theme it has the colour of the text.
131
+
132
+ On a touch screen (`@media (any-pointer: coarse)`) the select is at least `--el-touch-target` high. Without that token, and on a fine pointer, the sizes stay as they are.
107
133
 
108
134
  #### Slots
109
135
 
@@ -114,7 +140,7 @@ _None_ - The component generates its own select element and options internally
114
140
  - Includes proper ARIA attributes (`aria-describedby`, `aria-invalid`, `aria-errormessage`)
115
141
  - Links labels to select elements via `for` attribute
116
142
  - Supports screen reader only labels
117
- - Error messages are properly associated with the select field
143
+ - The error message is an alert (`role="alert"`) and part of the `aria-describedby` of the select while it is shown: a screen reader announces it when it appears and reads it again when the select gets focus
118
144
  - Placeholder option is disabled to prevent invalid submissions
119
145
 
120
146
  ## Validation
@@ -1,18 +1,19 @@
1
+ import hostStyle from '../../styles/host.style.js';
2
+ import formControlStyle from '../../styles/form-control.style.js';
3
+
1
4
  const css = String.raw;
2
5
 
3
- export default css`
6
+ const style = css`
4
7
  el-select-field {
5
- display: block;
6
-
7
8
  /*
8
- * Hide the custom .dropdown-indicator by default — the unthemed native
9
- * <select> already paints its own chevron, so showing both would
10
- * duplicate. Themes (default.css, high-contrast.css) un-hide and
11
- * position the custom indicator, AND suppress the native chevron via
12
- * appearance: none, so the result is a single, theme-able glyph.
9
+ * The field renders a chevron of its own, hidden by default: the native <select> of the
10
+ * browser already paints one, and showing both would duplicate. styles/native.css takes
11
+ * the native one away and sets this property, so a decorated select has a single chevron
12
+ * that follows the tokens. A property, not a rule there: a rule would have the same
13
+ * weight as this one, and the later of the two would win.
13
14
  */
14
15
  .dropdown-indicator {
15
- display: none;
16
+ display: var(--_el-select-indicator-display, none);
16
17
  }
17
18
 
18
19
  .dropdown-indicator svg {
@@ -20,5 +21,14 @@ export default css`
20
21
  width: 1em;
21
22
  height: 1em;
22
23
  }
24
+
25
+ /* Touch screens: the control is at least --el-touch-target high. Without the token the sizes stay as they are. */
26
+ @media (any-pointer: coarse) {
27
+ select {
28
+ min-height: max(var(--el-control-height, 0px), var(--el-touch-target, 0px));
29
+ }
30
+ }
23
31
  }
24
32
  `;
33
+
34
+ export default [hostStyle('el-select-field'), formControlStyle('el-select-field'), style].join('\n');
@@ -0,0 +1,22 @@
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-skeleton`: a quiet shape in the place of content that is still loading. It has no role and no content; the region that loads says so with `aria-busy`. ([#77](https://github.com/webtides/element-library/issues/77))
20
+ - A line by default: as wide as its container and `1em` high. A width and a height on the element make it a block, `--el-skeleton-radius` a circle.
21
+ - `effect` (`none`, `sheen`, `pulse`), reflected to an attribute of the same name. Both effects stand still for a user who prefers reduced motion.
22
+ - The colour is an eighth of the text colour, so the skeleton shows on any background and without a theme. `--el-skeleton-color` and `--el-skeleton-sheen-color` set other ones.
@@ -0,0 +1,3 @@
1
+ import { define } from './skeleton.js';
2
+
3
+ define();
@@ -0,0 +1,49 @@
1
+ import { TemplateElement, defineElement, html } from '@webtides/element-js';
2
+ import style from './skeleton.style.js';
3
+
4
+ /**
5
+ * A skeleton: a quiet shape in the place of content that is still loading, a line of text, an
6
+ * image, an avatar. By default it is a line: as wide as its container and as high as the text. A
7
+ * width, a height and a radius make it any other shape. It says nothing to assistive technology;
8
+ * the region that loads does, with `aria-busy`.
9
+ *
10
+ * @element el-skeleton
11
+ *
12
+ * @csspart base - The shape.
13
+ *
14
+ * @cssproperty --el-skeleton-color - The colour of the shape. Unset, it is an eighth of the text
15
+ * colour (`--el-color-fg`, and the text colour of the page without a theme).
16
+ * @cssproperty --el-skeleton-sheen-color - The colour of the band that passes over the shape with
17
+ * `effect="sheen"`. Unset, it is a third of the colour of the shape.
18
+ * @cssproperty --el-skeleton-radius - The radius of the shape. Unset, it is `--el-radius-md`.
19
+ *
20
+ * @property {'none'|'sheen'|'pulse'} effect - How the shape moves while it waits: not at all, with
21
+ * a band that passes over it, or by fading. Default `'none'`. Reflected to the `effect`
22
+ * attribute.
23
+ */
24
+ export default class Skeleton extends TemplateElement {
25
+ constructor() {
26
+ super({
27
+ styles: [style],
28
+ shadowRender: true,
29
+ // The stylesheet selects the host by this attribute.
30
+ propertyOptions: {
31
+ effect: { reflect: true },
32
+ },
33
+ });
34
+ }
35
+
36
+ properties() {
37
+ return {
38
+ effect: 'none',
39
+ };
40
+ }
41
+
42
+ template() {
43
+ return html`<span part="base" class="skeleton"></span>`;
44
+ }
45
+ }
46
+
47
+ export function define() {
48
+ defineElement('el-skeleton', Skeleton);
49
+ }
@@ -0,0 +1,115 @@
1
+ # Skeleton
2
+
3
+ `skeleton` is a quiet shape in the place of content that is still loading: a line of text, an image, an avatar. By default it is a line, as wide as its container and as high as the text it stands in for. A width, a height and a radius make it any other shape.
4
+
5
+ It shows without a theme: its colour is a share of the text 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/skeleton/define';
19
+ ```
20
+
21
+ ```html
22
+ <!-- Three lines of text -->
23
+ <div aria-busy="true">
24
+ <el-skeleton effect="sheen" style="width: 40%"></el-skeleton>
25
+ <el-skeleton effect="sheen"></el-skeleton>
26
+ <el-skeleton effect="sheen" style="width: 80%"></el-skeleton>
27
+ </div>
28
+
29
+ <!-- An avatar -->
30
+ <el-skeleton style="width: 3rem; height: 3rem; --el-skeleton-radius: 50%"></el-skeleton>
31
+
32
+ <!-- An image, three to two -->
33
+ <el-skeleton style="height: auto; aspect-ratio: 3 / 2"></el-skeleton>
34
+ ```
35
+
36
+ The skeleton does not space itself: the lines above are apart because their container says so (`display: grid; gap: 0.75rem`, for example).
37
+
38
+ ## API
39
+
40
+ #### Properties/Attributes
41
+
42
+ | Name | Type | Default | Description |
43
+ | -------- | -------- | -------- | -------------------------------------------------------------------------- |
44
+ | `effect` | `string` | `'none'` | `none`, `sheen` or `pulse`. How the shape moves while it waits. Reflected. |
45
+
46
+ #### Methods
47
+
48
+ _None._
49
+
50
+ #### Events
51
+
52
+ _None._
53
+
54
+ #### Slots
55
+
56
+ _None._ A skeleton holds no content.
57
+
58
+ #### CSS Parts
59
+
60
+ | Name | Description |
61
+ | ------ | ----------- |
62
+ | `base` | The shape. |
63
+
64
+ #### CSS Custom Properties
65
+
66
+ | Name | Description |
67
+ | --- | --- |
68
+ | `--el-skeleton-color` | The colour of the shape. Unset, it is an eighth of the text colour: `--el-color-fg`, and the text colour of the page without a theme. |
69
+ | `--el-skeleton-sheen-color` | The colour of the band that passes over the shape with `effect="sheen"`. Unset, it is a third of the colour of the shape. |
70
+ | `--el-skeleton-radius` | The radius of the shape. Unset, it is `--el-radius-md`, and `4px` without a theme. |
71
+
72
+ ## Size and shape
73
+
74
+ The size is set on the element, like on any block:
75
+
76
+ | For | Set |
77
+ | ------------------------------------ | ------------------------------------------------- |
78
+ | a line of text | nothing, or a `width` for a line that ends early |
79
+ | a block of a fixed size | `width` and `height` |
80
+ | a picture that keeps its proportions | `height: auto` and an `aspect-ratio` |
81
+ | a circle | `width`, `height` and `--el-skeleton-radius: 50%` |
82
+
83
+ A line is `1em` high: the size of the text it stands in for, which is less than the height of a line of that text. In a heading it is higher than in a paragraph.
84
+
85
+ There is no `size` and no `variant`: a skeleton has the size of what it stands in for, and no meaning of its own.
86
+
87
+ The `hidden` attribute hides the skeleton.
88
+
89
+ ## Effect
90
+
91
+ | `effect` | What moves |
92
+ | -------- | ------------------------------------------------------------------------------------ |
93
+ | `none` | Nothing. The default. |
94
+ | `sheen` | A lighter band passes over the shape, from the left to the right, every two seconds. |
95
+ | `pulse` | The shape fades and comes back, every two seconds. |
96
+
97
+ The property is reflected: the element writes it onto itself as an attribute, the default included (`<el-skeleton effect="none">`). A value the skeleton does not know stands still.
98
+
99
+ Both effects stand still for a user who prefers reduced motion (`prefers-reduced-motion: reduce`).
100
+
101
+ ## Colour
102
+
103
+ The colour is an eighth of the text colour, not a grey of its own. That way it shows on the background of the page and on a muted fill, in a light scheme and in a dark one, and without a theme. Set `--el-skeleton-color` for another one, on the element or on anything around it.
104
+
105
+ ## Accessibility
106
+
107
+ - A skeleton says nothing to assistive technology: it has no role, no name and no content. That it is there tells a sighted user that something is loading; another user has to be told in another way.
108
+ - Set `aria-busy="true"` on the region whose content is loading, and take it off when the content is there. In a live region the changes are announced once it is off.
109
+ - `aria-busy` alone is not announced by every screen reader. Say what is loading in a text as well, hidden from the eye if need be, with the `el-visually-hidden` class of `styles/utilities.css` for example: `<span class="el-visually-hidden">Loading the members</span>`.
110
+ - Give the skeletons the size of the content they stand in for, so that the page does not move when the content arrives.
111
+ - For a wait without a known shape, a submit for example, `el-spinner` says more: it has a role and a label.
112
+
113
+ ## Server-side rendering
114
+
115
+ The skeleton is fully part of the server-rendered markup (Declarative Shadow DOM) and looks the same before and after its JavaScript has loaded, its effect included.