@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,93 @@
1
+ import hostStyle from '../../styles/host.style.js';
2
+
3
+ const css = String.raw;
4
+
5
+ const style = css`
6
+ :host {
7
+ /* As wide as its container. */
8
+ display: block;
9
+ }
10
+
11
+ .progress-bar {
12
+ height: var(--el-progress-bar-height, 0.5rem);
13
+ /* The radius of the theme, which rounds the ends of a bar of this height fully in most
14
+ themes and leaves them square in a theme without radii. */
15
+ border-radius: var(--el-radius-md, 4px);
16
+ /* Without a theme both colours come from the text colour, so the bar shows on any
17
+ background. The track is a share of it, as the track of the spinner is. */
18
+ background: var(--el-progress-bar-track-color, color-mix(in srgb, currentColor 20%, transparent));
19
+ overflow: hidden;
20
+ }
21
+
22
+ /* A block with a width: it starts where the text starts, at the right in a text that runs
23
+ from right to left. */
24
+ .indicator {
25
+ height: 100%;
26
+ border-radius: inherit;
27
+ background: var(--el-progress-bar-indicator-color, var(--el-color-accent, currentColor));
28
+ transition: width var(--el-duration-md, 0s) var(--el-ease, linear);
29
+ }
30
+
31
+ /* ── Indeterminate ────────────────────────────────────────────────────── */
32
+
33
+ /* Two fifths of the track pass over it, from before the start to behind the end. */
34
+ .progress-bar--indeterminate .indicator {
35
+ width: 40%;
36
+ animation: el-progress-bar-pass 1.6s ease-in-out infinite;
37
+ }
38
+
39
+ :host(:dir(rtl)) .progress-bar--indeterminate .indicator {
40
+ animation-name: el-progress-bar-pass-rtl;
41
+ }
42
+
43
+ /* The way is in widths of the indicator: the track is two and a half of them. */
44
+ @keyframes el-progress-bar-pass {
45
+ from {
46
+ transform: translateX(-100%);
47
+ }
48
+ to {
49
+ transform: translateX(250%);
50
+ }
51
+ }
52
+
53
+ @keyframes el-progress-bar-pass-rtl {
54
+ from {
55
+ transform: translateX(100%);
56
+ }
57
+ to {
58
+ transform: translateX(-250%);
59
+ }
60
+ }
61
+
62
+ /* Nothing crosses the page for a user who prefers reduced motion. The whole track fades and
63
+ comes back instead: a bar that stands still would read as a task that is done, or stuck. */
64
+ @media (prefers-reduced-motion: reduce) {
65
+ .progress-bar--indeterminate .indicator,
66
+ :host(:dir(rtl)) .progress-bar--indeterminate .indicator {
67
+ width: 100%;
68
+ animation: el-progress-bar-fade 2s ease-in-out infinite;
69
+ }
70
+ }
71
+
72
+ @keyframes el-progress-bar-fade {
73
+ 50% {
74
+ opacity: 0.4;
75
+ }
76
+ }
77
+
78
+ /* ── Forced colours ───────────────────────────────────────────────────── */
79
+
80
+ /* Forced colours take both fills away. A border draws the track, and the colour of a
81
+ selection, which is a system colour and stays, fills it. */
82
+ @media (forced-colors: active) {
83
+ .progress-bar {
84
+ border: 1px solid CanvasText;
85
+ }
86
+
87
+ .indicator {
88
+ background: Highlight;
89
+ }
90
+ }
91
+ `;
92
+
93
+ export default [hostStyle(), style].join('\n');
@@ -0,0 +1,23 @@
1
+ # Change Log
2
+
3
+ All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/).
6
+
7
+ <!--
8
+ When your PR touches this component, add an entry under Unreleased and
9
+ mirror it (prefixed with the component name) in root CHANGELOG.md.
10
+ Uncomment headings as needed.
11
+ -->
12
+
13
+ ## Unreleased
14
+
15
+ ## [0.3.0] - 2026-11-17
16
+
17
+ ### Added
18
+
19
+ - Initial `el-progress-ring`: a ring that closes with the progress of a task, for a place with little room. Exposed as a progress bar (`role="progressbar"`) with its value, and named by `label`, "Progress" by default. ([#122](https://github.com/webtides/element-library/issues/122))
20
+ - `value` of `max` (default `100`) is the share of the ring that is drawn, clockwise from the top. A value outside of the range is shown as the nearest one inside. The ring moves to a new value in the duration of the theme.
21
+ - The default slot is the middle of the ring, for a short text ("45 %"), set in figures of one width. It is not read out: the value is.
22
+ - The ring is a square of `--el-progress-ring-size` (`4rem`) with a line of `--el-progress-ring-track-width` (`0.25rem`) inside of it. The part that is drawn has the accent colour of the theme, and the text colour without a theme; the whole ring is a fifth of the text colour. `--el-progress-ring-indicator-color` and `--el-progress-ring-track-color` set the two.
23
+ - When colours are forced the whole ring is a thin line in the text colour, and the part that is drawn keeps its width in the colour of a selection.
@@ -0,0 +1,3 @@
1
+ import { define } from './progress-ring.js';
2
+
3
+ define();
@@ -0,0 +1,83 @@
1
+ import { TemplateElement, defineElement, html } from '@webtides/element-js';
2
+ import style from './progress-ring.style.js';
3
+ import { progressOf } from '../../utils/progress.js';
4
+
5
+ /**
6
+ * A progress ring: a ring that closes with the progress of a task, for a place with little room, a
7
+ * tile of a dashboard, a card, the side of a heading. `value` of `max` says how far the task is,
8
+ * and the middle of the ring has room for a short text. It speaks the vocabulary of the progress
9
+ * bar; a wait of unknown length is a spinner.
10
+ *
11
+ * @element el-progress-ring
12
+ *
13
+ * @slot - A short text in the middle of the ring, "45 %". Not read out: the value is.
14
+ *
15
+ * @csspart base - The ring and its middle. It carries `role="progressbar"`, the value and the
16
+ * label.
17
+ * @csspart track - The whole ring, a `<circle>`.
18
+ * @csspart indicator - The part of the ring that is drawn, a `<circle>`.
19
+ * @csspart label - The middle of the ring, around the slot.
20
+ *
21
+ * @cssproperty --el-progress-ring-size - The width and the height of the ring. Unset, it is
22
+ * `4rem`.
23
+ * @cssproperty --el-progress-ring-track-width - The thickness of the ring. Unset, it is `0.25rem`.
24
+ * @cssproperty --el-progress-ring-indicator-color - The part that is drawn. Unset, it is
25
+ * `--el-color-accent`, and the text colour without a theme.
26
+ * @cssproperty --el-progress-ring-track-color - The whole ring. Unset, it is a fifth of the text
27
+ * colour.
28
+ *
29
+ * @property {number} value - How far the task is, from `0` to `max`. A value outside of that range
30
+ * is shown as the nearest one inside. Default `0`.
31
+ * @property {number} max - The value of a task that is done. Default `100`.
32
+ * @property {string} label - The accessible name of the ring. Default `'Progress'`.
33
+ */
34
+ export default class ProgressRing extends TemplateElement {
35
+ constructor() {
36
+ super({
37
+ styles: [style],
38
+ shadowRender: true,
39
+ });
40
+ }
41
+
42
+ properties() {
43
+ return {
44
+ value: 0,
45
+ max: 100,
46
+ label: 'Progress',
47
+ };
48
+ }
49
+
50
+ template() {
51
+ const { value, max, percent } = progressOf(this.value, this.max);
52
+
53
+ // The length of the indicator counts as 100 (pathLength), whatever size the ring has. One
54
+ // dash as long as the ring is pushed back by the share that is not done yet.
55
+ return html`
56
+ <div
57
+ part="base"
58
+ class="progress-ring"
59
+ role="progressbar"
60
+ aria-label="${this.label}"
61
+ aria-valuemin="0"
62
+ aria-valuemax="${max}"
63
+ aria-valuenow="${value}"
64
+ >
65
+ <svg class="ring" aria-hidden="true" focusable="false">
66
+ <circle part="track" class="track"></circle>
67
+ <circle
68
+ part="indicator"
69
+ class="indicator"
70
+ pathLength="100"
71
+ stroke-dasharray="100"
72
+ stroke-dashoffset="${100 - percent}"
73
+ ></circle>
74
+ </svg>
75
+ <span part="label" class="label"><slot></slot></span>
76
+ </div>
77
+ `;
78
+ }
79
+ }
80
+
81
+ export function define() {
82
+ defineElement('el-progress-ring', ProgressRing);
83
+ }
@@ -0,0 +1,115 @@
1
+ # Progress Ring
2
+
3
+ `progress-ring` shows how far a task is where there is little room: a tile of a dashboard, a card, the side of a heading. A ring closes with `value` of `max`, clockwise from the top, and its middle has room for a short text.
4
+
5
+ It speaks the vocabulary of `el-progress-bar`: `value`, `max` and `label`. A wait of unknown length is `el-spinner`.
6
+
7
+ Without a theme imported the ring takes both of its colours from the text colour, so it shows on any background. With a theme the part that is drawn has the accent colour.
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/progress-ring/define';
21
+ ```
22
+
23
+ ```html
24
+ <el-progress-ring value="45" label="Storage"></el-progress-ring>
25
+
26
+ <!-- With the figure in the middle -->
27
+ <el-progress-ring value="45" label="Storage">45 %</el-progress-ring>
28
+
29
+ <!-- In the unit of the task: 3 of 12 files -->
30
+ <el-progress-ring value="3" max="12" label="Files">3 / 12</el-progress-ring>
31
+ ```
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
+ | `label` | `string` | `'Progress'` | The accessible name of the ring. |
42
+
43
+ #### Methods
44
+
45
+ _None._
46
+
47
+ #### Events
48
+
49
+ _None._
50
+
51
+ #### Slots
52
+
53
+ | Name | Description |
54
+ | --------- | ------------------------------------------------------------------------ |
55
+ | (default) | A short text in the middle of the ring. Not read out by a screen reader. |
56
+
57
+ #### CSS Parts
58
+
59
+ | Name | Description |
60
+ | ----------- | ---------------------------------------------------------------------------------- |
61
+ | `base` | The ring and its middle. It carries `role="progressbar"`, the value and the label. |
62
+ | `track` | The whole ring, a `<circle>`. |
63
+ | `indicator` | The part of the ring that is drawn, a `<circle>`. |
64
+ | `label` | The middle of the ring, around the slot. |
65
+
66
+ #### CSS Custom Properties
67
+
68
+ | Name | Default | Description |
69
+ | --- | --- | --- |
70
+ | `--el-progress-ring-size` | `4rem` | The width and the height of the ring. |
71
+ | `--el-progress-ring-track-width` | `0.25rem` | The thickness of the ring. |
72
+ | `--el-progress-ring-indicator-color` | `--el-color-accent`, the text colour without a theme | The part that is drawn. |
73
+ | `--el-progress-ring-track-color` | a fifth of the text colour | The whole ring. |
74
+
75
+ ## Value
76
+
77
+ `value` of `max` is the share of the ring that is drawn. `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.
78
+
79
+ A value outside of the range is shown as the nearest one inside: below `0` nothing is drawn, above `max` the ring is closed. 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.
80
+
81
+ The ring starts at the top and runs clockwise, in a text that runs from right to left as well. It moves to a new value in the duration of the theme (`--el-duration-md`), and at once without a theme.
82
+
83
+ There is no `indeterminate`. A ring that turns without a value is `el-spinner`.
84
+
85
+ ## The middle
86
+
87
+ What is slotted into the element stands in the middle of the ring, over it. The ring does not grow with it: keep the text to a few characters, "45 %" or "3 / 12", and set a font size on the element that fits the ring.
88
+
89
+ The figures have one width (`tabular-nums`), so the text does not move while the value counts up.
90
+
91
+ The ring does not write the value into its middle by itself. What is shown there, a percentage, a count, an icon when the task is done, is for the page to say.
92
+
93
+ ## Size and colours
94
+
95
+ The ring is a square of `--el-progress-ring-size`, `4rem` by default. `--el-progress-ring-track-width` is the thickness of the line, which lies inside of that square. In a line of text the ring stands on the middle of the line.
96
+
97
+ The part that is drawn reads `--el-progress-ring-indicator-color`, then `--el-color-accent`, then the text colour. The whole ring reads `--el-progress-ring-track-color`; unset, it is the text colour at a fifth of its strength.
98
+
99
+ 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 a text as well: a colour alone does not reach everyone.
100
+
101
+ The end of the line is cut straight. For a round end: `el-progress-ring::part(indicator) { stroke-linecap: round; }`.
102
+
103
+ The `hidden` attribute hides the ring.
104
+
105
+ ## Accessibility
106
+
107
+ - The ring 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.
108
+ - Its name is the `label`, "Progress" by default. Set `label` to say what is in progress, in the language of the page; two rings on a page need two names.
109
+ - The text in the middle is not read out: the content of a progress bar is presentation, and the value says the same. A text that says more than the value belongs next to the ring.
110
+ - A screen reader announces a new value when its user is on the ring, 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.
111
+ - When colours are forced (the contrast themes of Windows) the whole ring is a thin line in the text colour and the part that is drawn keeps its width, in the colour of a selection.
112
+
113
+ ## Server-side rendering
114
+
115
+ The ring, its role, its value and the share that is drawn are part of the server-rendered markup (Declarative Shadow DOM), so the ring shows its value before its JavaScript has loaded, and without JavaScript.
@@ -0,0 +1,85 @@
1
+ import hostStyle from '../../styles/host.style.js';
2
+
3
+ const css = String.raw;
4
+
5
+ const style = css`
6
+ :host {
7
+ display: inline-block;
8
+ width: var(--el-progress-ring-size, 4rem);
9
+ height: var(--el-progress-ring-size, 4rem);
10
+ vertical-align: middle;
11
+
12
+ --_el-progress-ring-track-width: var(--el-progress-ring-track-width, 0.25rem);
13
+ }
14
+
15
+ .progress-ring {
16
+ position: relative;
17
+ width: 100%;
18
+ height: 100%;
19
+ }
20
+
21
+ /* ── Ring ─────────────────────────────────────────────────────────────── */
22
+
23
+ /* A circle starts at three o'clock. A quarter turn back, and it starts at the top. */
24
+ .ring {
25
+ display: block;
26
+ width: 100%;
27
+ height: 100%;
28
+ transform: rotate(-90deg);
29
+ }
30
+
31
+ /* Both circles are placed and sized here, from the size of the element: the ring is as large
32
+ as its box, and the line lies inside of it. */
33
+ circle {
34
+ cx: 50%;
35
+ cy: 50%;
36
+ r: calc(50% - var(--_el-progress-ring-track-width) / 2);
37
+ fill: none;
38
+ stroke-width: var(--_el-progress-ring-track-width);
39
+ }
40
+
41
+ /* Without a theme both colours come from the text colour, so the ring shows on any
42
+ background. The track is a share of it, as the track of the spinner is. */
43
+ .track {
44
+ stroke: var(--el-progress-ring-track-color, color-mix(in srgb, currentColor 20%, transparent));
45
+ }
46
+
47
+ .indicator {
48
+ stroke: var(--el-progress-ring-indicator-color, var(--el-color-accent, currentColor));
49
+ transition: stroke-dashoffset var(--el-duration-md, 0s) var(--el-ease, linear);
50
+ }
51
+
52
+ /* ── Middle ───────────────────────────────────────────────────────────── */
53
+
54
+ /* Over the ring, in its middle. Figures of one width: the text does not move while the value
55
+ counts up. */
56
+ .label {
57
+ position: absolute;
58
+ inset: 0;
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ font-family: var(--el-font-family, inherit);
63
+ font-variant-numeric: tabular-nums;
64
+ line-height: 1;
65
+ text-align: center;
66
+ }
67
+
68
+ /* ── Forced colours ───────────────────────────────────────────────────── */
69
+
70
+ /* System colours, which stay. The whole ring becomes a thin line in the text colour, and the
71
+ part that is drawn keeps its width, in the colour of a selection: the two are told apart by
72
+ their width, whatever the colours of the user are. */
73
+ @media (forced-colors: active) {
74
+ .track {
75
+ stroke: CanvasText;
76
+ stroke-width: 1px;
77
+ }
78
+
79
+ .indicator {
80
+ stroke: Highlight;
81
+ }
82
+ }
83
+ `;
84
+
85
+ export default [hostStyle(), style].join('\n');
@@ -12,6 +12,22 @@ 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 label of every option, which is its hit area, is at least `--el-touch-target` wide and high. Before, it was as high as its line of text. Unchanged on a fine pointer and without the token.
20
+ - The legend, the help message, the options and the error message stack in a column with a gap of `--el-space-1` (4 px without a theme). Before, only the legend had that distance to what follows, and none without a theme. The messages are set in `--el-font-size-sm` (14 px without a theme; they had the size of the text), as in every field now. A help message without a text takes no room. ([#130](https://github.com/webtides/element-library/issues/130))
21
+
22
+ ### Fixed
23
+
24
+ - The error message is announced by screen readers: it is an alert (`role="alert"`), and the group, like each of its radios, names it in `aria-describedby` while it is shown. Before, the group pointed at it with `aria-errormessage` only. ([#94](https://github.com/webtides/element-library/issues/94))
25
+ - 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))
26
+ - A second field with the same `name` on the page is described by its own messages. Their ids are made per field, not from the name (BREAKING for a page that names `<name>-help-message` itself). See `form-field`. ([#133](https://github.com/webtides/element-library/issues/133))
27
+ - An error the page renders the group with is kept. A group with `valid="false"` and an error message, after a check of the page such as "that plan is sold out", showed nothing: when it connected, the group worked out its validity from `required` and its value and overwrote what the page said. It keeps the error now until the user is in the group again, as the other fields do. ([#139](https://github.com/webtides/element-library/issues/139))
28
+ - The group is touched once the user has left it. It was touched as soon as one of its radios lost the focus, also to the next radio: with the arrow keys, and with a click on another option, where a required group without a choice showed its error message for the time of the click. ([#139](https://github.com/webtides/element-library/issues/139))
29
+ - A value from a script selects its radio also after the user has chosen. The `checked` attribute of a radio is only its default, which the browser no longer follows once the user has chosen that radio: `value` said one option and the form submitted another. The choice is written to the radios after every render now. ([#139](https://github.com/webtides/element-library/issues/139))
30
+
15
31
  ## [0.1.0] - 2026-06-03
16
32
 
17
33
  ### Added
@@ -1,5 +1,6 @@
1
1
  import { html, defineElement } from '@webtides/element-js';
2
2
  import FormField from '../form-field/form-field.js';
3
+ import { focusLeft } from '../../utils/focus.js';
3
4
  import style from './radio-field.style.js';
4
5
 
5
6
  /**
@@ -13,18 +14,15 @@ import style from './radio-field.style.js';
13
14
  * @fires {CustomEvent<string>} input-change - Fired when the selected value changes. `detail` is
14
15
  * the newly selected value. Bubbles.
15
16
  *
16
- * @cssstate touched - Set once the user has focused and blurred the group. Inherits `valid` and
17
- * `invalid` from `FormField`.
17
+ * @cssstate touched - Set once the user has left the group, or the browser has refused a submit
18
+ * because of it. Inherits `valid` and `invalid` from `FormField`.
18
19
  *
19
- * @property {string} value - The selected option's value.
20
+ * @property {string | null} value - The selected option's value.
20
21
  * @property {Array<string | { value: string, label?: string, disabled?: boolean }>} options -
21
22
  * Options to render. Accepts plain strings (`['Yes', 'No']`) or option objects
22
23
  * (`[{ value, label, disabled? }]`). Strings are used as both value and label.
23
24
  */
24
25
  export default class RadioField extends FormField {
25
- /** @private */
26
- uuid = Math.random().toString(36).substr(2, 5);
27
-
28
26
  constructor(options) {
29
27
  super({ shadowRender: false, styles: [style], ...options });
30
28
  }
@@ -37,10 +35,18 @@ export default class RadioField extends FormField {
37
35
  }
38
36
 
39
37
  connected() {
38
+ // The page can render the group as not valid, after a check of its own.
39
+ const renderedInvalid = this.valid === false;
40
40
  super.connected();
41
41
  // Reflect validity (required-but-empty) so :state(invalid) is correct from the start; the
42
42
  // message stays hidden until the group is touched.
43
- this.valid = this._computeValid();
43
+ if (!renderedInvalid) this.valid = this._computeValid();
44
+ }
45
+
46
+ afterUpdate() {
47
+ // Before the form field keeps the state for a reset.
48
+ this._syncControls();
49
+ super.afterUpdate();
44
50
  }
45
51
 
46
52
  events() {
@@ -51,7 +57,10 @@ export default class RadioField extends FormField {
51
57
  this.valid = this._computeValid();
52
58
  },
53
59
  focus: () => this.onFocus(),
54
- blur: () => this.onBlur(),
60
+ // The group is touched once the user has left it, not while the focus moves from
61
+ // one of its radios to the next.
62
+ blur: (event) => focusLeft(this, event) && this.onBlur(),
63
+ invalid: (event) => this._onInvalid(event.target),
55
64
  },
56
65
  };
57
66
  }
@@ -67,6 +76,20 @@ export default class RadioField extends FormField {
67
76
  return true;
68
77
  }
69
78
 
79
+ /**
80
+ * Makes the radios say what the field says, after every render. The `checked` attribute the
81
+ * template writes is only the default of a radio: once the user has chosen, the browser no
82
+ * longer follows the attribute, so a value from outside is written to the radios as well.
83
+ * @private
84
+ */
85
+ _syncControls() {
86
+ const value = this.value == null ? null : String(this.value);
87
+ for (const radio of this.querySelectorAll('input[type="radio"]')) {
88
+ const checked = radio.value === value;
89
+ if (radio.checked !== checked) radio.checked = checked;
90
+ }
91
+ }
92
+
70
93
  onFocus() {
71
94
  this.valid = this._computeValid();
72
95
  }
@@ -89,8 +112,8 @@ export default class RadioField extends FormField {
89
112
  return html`
90
113
  <fieldset
91
114
  class="field ${this.classes().field}"
92
- aria-describedby="${this.name}-help-message"
93
- aria-errormessage="${this.name}-error-message"
115
+ aria-describedby="${this._describedBy()}"
116
+ aria-errormessage="${this._idOf('error-message')}"
94
117
  aria-invalid="${this.valid ? 'false' : 'true'}"
95
118
  >
96
119
  ${this.legendTemplate()} ${this.helpTemplate()}
@@ -125,7 +148,7 @@ export default class RadioField extends FormField {
125
148
  ?checked="${checked}"
126
149
  ?disabled="${optionDisabled}"
127
150
  ?required="${this.required}"
128
- aria-describedby="${this.name}-help-message"
151
+ aria-describedby="${this._describedBy()}"
129
152
  />
130
153
  <span class="radio-indicator" aria-hidden="true"></span>
131
154
  <span class="option-label">${label}</span>
@@ -44,7 +44,7 @@ Inherits all of `form-field`'s properties (`name`, `value`, `required`, `disable
44
44
 
45
45
  | Name | Type | Default | Description |
46
46
  | --- | --- | --- | --- |
47
- | `value` | `string` | `null` | The selected option's value. |
47
+ | `value` | `string \| null` | `null` | The selected option's value. |
48
48
  | `options` | `Array<string \| { value: string, label?: string, disabled?: boolean }>` | `[]` | Options to render. Strings are used as both value and label; objects allow a separate label/disabled. |
49
49
 
50
50
  #### Events
@@ -55,18 +55,23 @@ Inherits all of `form-field`'s properties (`name`, `value`, `required`, `disable
55
55
 
56
56
  #### CSS States
57
57
 
58
- | Name | Description |
59
- | --------- | ------------------------------------------------------------------------- |
60
- | `touched` | Set once the group has been focused and blurred. |
61
- | `valid` | Set while the group passes validation. |
62
- | `invalid` | Set while the group fails validation (e.g. `required` with no selection). |
58
+ | Name | Description |
59
+ | --------- | ---------------------------------------------------------------------------------------- |
60
+ | `touched` | Set once the user has left the group. Moving from one radio to the next does not set it. |
61
+ | `valid` | Set while the group passes validation. |
62
+ | `invalid` | Set while the group fails validation (e.g. `required` with no selection). |
63
63
 
64
64
  #### CSS Custom Properties
65
65
 
66
- Headless by default; reads the library's `--el-*` design tokens (`--el-color-accent`, `--el-color-border`, `--el-color-bg`, `--el-space-*`, `--el-border-width`, `--el-focus-ring-width`, `--el-duration-md`, `--el-ease`, `--el-color-fg-muted`, `--el-color-danger`). Skin it via a theme — see the Storybook _Docs / Theming_ page.
66
+ Headless by default; reads the library's `--el-*` design tokens (`--el-color-accent`, `--el-color-border`, `--el-color-bg`, `--el-space-*`, `--el-border-width`, `--el-focus-ring-width`, `--el-duration-md`, `--el-ease`, `--el-color-fg`, `--el-color-fg-muted`, `--el-color-danger`, `--el-font-size-sm`). Skin it via a theme — see the Storybook _Docs / Theming_ page.
67
+
68
+ 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`.
69
+
70
+ On a touch screen (`@media (any-pointer: coarse)`) the label of every option, which is its 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.
67
71
 
68
72
  ## Accessibility
69
73
 
70
74
  - Uses a native `<fieldset>` + `<legend>`, so the group is announced with its label and radios are mutually exclusive with native arrow-key navigation.
71
75
  - The native radio stays in the accessibility tree and focusable; it is only hidden visually, with keyboard focus reflected onto the custom indicator via `:focus-visible`.
72
- - Validation messages surface only once the group is `touched`.
76
+ - Validation messages surface only once the group is `touched`: once the user has left it, or the page has rendered it as not valid.
77
+ - The error message is an alert (`role="alert"`) and part of the `aria-describedby` of the group while it is shown: a screen reader announces it when it appears and reads it again when the group gets focus.