@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
@@ -1,6 +1,6 @@
1
1
  # Button
2
2
 
3
- `button` is a themeable button. It renders a native `<button>` — or an `<a>` when `href` is set — and decorates it with the library's `--el-*` design tokens. It supports semantic variants, sizes, outline / pill / circle shapes, prefix & suffix icon slots, an optional dropdown caret and a loading spinner. The API is modelled on [Shoelace's `<sl-button>`](https://shoelace.style/components/button).
3
+ `button` is a themeable button. It renders a native `<button>` — or an `<a>` when `href` is set — and decorates it with the library's `--el-*` design tokens. It speaks the library's shared vocabulary: a semantic `variant`, an `appearance` and a `size`. It also supports pill / circle shapes, prefix & suffix icon slots, an optional dropdown caret and a loading spinner.
4
4
 
5
5
  Without a theme imported the button stays close to a plain native control (muted surface, no decoration); import a theme to skin it.
6
6
 
@@ -19,13 +19,17 @@ import '@webtides/element-library/button/define';
19
19
  ```
20
20
 
21
21
  ```html
22
- <el-button variant="primary">Save changes</el-button>
22
+ <el-button variant="brand">Save changes</el-button>
23
+
24
+ <!-- Outlined, or as text only -->
25
+ <el-button variant="danger" appearance="outlined">Delete</el-button>
26
+ <el-button variant="brand" appearance="plain">Learn more</el-button>
23
27
 
24
28
  <!-- As a link -->
25
29
  <el-button href="/docs" target="_blank">Read the docs</el-button>
26
30
 
27
31
  <!-- With icons in the prefix / suffix slots -->
28
- <el-button variant="primary">
32
+ <el-button variant="brand">
29
33
  <el-svg-use slot="prefix" name="icon-user" spritePath=""></el-svg-use>
30
34
  Account
31
35
  </el-button>
@@ -39,22 +43,24 @@ import '@webtides/element-library/button/define';
39
43
 
40
44
  | Name | Type | Default | Description |
41
45
  | --- | --- | --- | --- |
42
- | `variant` | `string` | `'default'` | `default`, `primary`, `success`, `neutral`, `warning`, `danger` or `text`. |
43
- | `size` | `string` | `'medium'` | `small`, `medium` or `large`. |
44
- | `outline` | `boolean` | `false` | Transparent fill with a colored border. |
46
+ | `variant` | `string` | `'neutral'` | `neutral`, `brand`, `success`, `warning` or `danger`. Picks the colours. Reflected. |
47
+ | `appearance` | `string` | `'filled'` | `filled`, `outlined` or `plain`. How the colours of the variant are painted. Reflected. |
48
+ | `size` | `string` | `'medium'` | `small`, `medium` or `large`. Reflected. |
45
49
  | `pill` | `boolean` | `false` | Fully rounded ends. |
46
50
  | `circle` | `boolean` | `false` | Square, fully-rounded icon button (use with a single icon). |
47
51
  | `caret` | `boolean` | `false` | Appends a dropdown caret after the label. |
48
52
  | `loading` | `boolean` | `false` | Shows a spinner and blocks interaction. |
49
- | `disabled` | `boolean` | `false` | Disables the button. |
50
- | `type` | `string` | `'button'` | `button`, `submit` or `reset`. `submit` / `reset` act on the nearest `<form>`. Button-only. |
51
- | `name` | `string` | `''` | Name submitted with the owning form. Button-only. |
52
- | `value` | `string` | `''` | Value submitted with the owning form. Button-only. |
53
+ | `disabled` | `boolean` | `false` | Disables the button. Reflected: the attribute is there while the button is disabled, see [In a form](#in-a-form). |
54
+ | `type` | `string` | `'button'` | `button`, `submit` or `reset`. `submit` / `reset` act on the form of the button, see [In a form](#in-a-form). Button-only. |
55
+ | `name` | `string` | `''` | Name submitted with the form, when the form is submitted with this button. Button-only. |
56
+ | `value` | `string` | `''` | Value submitted under that name. Button-only. |
53
57
  | `href` | `string` | `''` | When set, the button renders as a link to this URL. |
54
58
  | `target` | `string` | `''` | Where to open the linked URL. Link-only. |
55
59
  | `rel` | `string` | `'noreferrer noopener'` | `rel` for the link (only emitted alongside `target`). Link-only. |
56
60
  | `download` | `string` | `''` | Tells the browser to download the linked URL. Link-only. |
57
61
 
62
+ The attributes `form`, `formaction`, `formenctype`, `formmethod`, `formnovalidate` and `formtarget` do what they do on a native button, see [In a form](#in-a-form). They are attributes only, not properties.
63
+
58
64
  #### Methods
59
65
 
60
66
  | Name | Description |
@@ -89,3 +95,125 @@ _None custom — native `click`, `focus` and `blur` behave as usual._
89
95
  #### CSS Custom Properties
90
96
 
91
97
  Reads the standard library design tokens (`--el-color-accent`, `--el-color-bg`, `--el-color-border`, `--el-control-height`, `--el-radius-md`, `--el-space-*`, `--el-font-*`, `--el-focus-ring-*`, …). Skin the button by setting these at the document level via a theme.
98
+
99
+ Each variant reads one colour: `--el-color-accent` (`brand`), `--el-color-success`, `--el-color-warning` and `--el-color-danger`. `neutral` reads the surface tokens: `--el-color-bg-muted` for the fill, `--el-color-border` for the border and `--el-color-fg` for the text. The label on a brand, success or danger fill is `--el-color-bg`; a warning fill carries dark text, because a warning colour stays light in both colour schemes.
100
+
101
+ On a touch screen (`@media (any-pointer: coarse)`) the button is at least `--el-touch-target` wide and high, in every size and shape; a `circle` stays round. Without that token, and on a fine pointer, the sizes stay as they are.
102
+
103
+ A pressed button (`:active`) is darker than a hovered one; an `outlined` or `plain` button gets a tint of its text color instead. The hover styles only apply where the pointer can hover (`@media (hover: hover)`), so none stays behind after a tap on a touch screen.
104
+
105
+ The label of an `outlined` or `plain` `warning` button is `--el-color-warning` mixed half and half with `--el-color-fg`; the border keeps the token. A warning colour that carries dark text as a fill is too light for text on a light background.
106
+
107
+ Without a theme a fill and the label on it are a pair that does not depend on the page. The neutral pair follows the colour scheme (`light-dark()`): a light grey with a dark label, and a dark grey with a light label in a dark scheme. The other four are one pair for both schemes. A label without a fill has the text colour of the page, and the warning colour is mixed with that one.
108
+
109
+ The keyboard focus shows as a ring around the button: `--el-focus-ring-width` wide, in `--el-color-focus-ring`, and `--el-focus-ring-offset` away from its edge. Without `--el-color-focus-ring` the ring is inside of the button, in the colour of its label, the width of the border inside of the border. Nothing says which colours the page around the button has then, and the label can be read on the surface of the button: on its fill, and on the page where it has none. The ring inside is the `::after` of the control (`::part(base)::after`). Where the user forces colours, the ring is around the button in both cases, in a colour of the system.
110
+
111
+ ## Variant, appearance and size
112
+
113
+ The three properties are independent of each other, and every combination works.
114
+
115
+ | `appearance` | What is painted |
116
+ | --- | --- |
117
+ | `filled` | The fill of the variant, its border, and the text colour for that fill. |
118
+ | `outlined` | No fill. The border and the text have the colour of the variant; `neutral` has the border colour of the theme. |
119
+ | `plain` | No fill and no border, only the text in the colour of the variant. Underlined on hover, like a link. |
120
+
121
+ `variant`, `appearance` and `size` are reflected: the element writes them onto itself as attributes, the defaults included (`<el-button variant="neutral" appearance="filled" size="medium">`), so that they can be selected from a stylesheet (`el-button[variant='brand']`). A value the button does not know is painted like the default.
122
+
123
+ The `hidden` attribute hides the button.
124
+
125
+ ## In a form
126
+
127
+ An `el-button` of the type `submit` submits its form as a native submit button does, and one of the type `reset` resets it.
128
+
129
+ ```html
130
+ <form>
131
+ <el-input-field name="title" label="Title" required="true"></el-input-field>
132
+ <el-button type="submit" name="action" value="draft" formnovalidate>Save as draft</el-button>
133
+ <el-button type="submit" name="action" value="publish" variant="brand">Publish</el-button>
134
+ </form>
135
+
136
+ <!-- From outside of the form -->
137
+ <el-button type="submit" form="settings">Save</el-button>
138
+ ```
139
+
140
+ - **The form of the button** is the nearest `<form>` around it, or the one its `form` attribute names by id.
141
+ - **`name` and `value`** are in the data of the form when it is submitted with this button, and with no other. Both are text, submitted as they are written.
142
+ - **`formaction`, `formenctype`, `formmethod`, `formnovalidate` and `formtarget`** say how the form is submitted with this button. A "Cancel" with `formnovalidate` submits a form that is not valid.
143
+ - **Enter in a field** submits the form with its first submit button, as the platform does. While that button is disabled or loading, Enter does not submit.
144
+ - **A `click` listener that calls `preventDefault()`** keeps the button from submitting or resetting, as it does with a native button: on the `el-button`, on an element in it or around it. The button acts once every listener has had the click, inside of that click. After a listener that stops the click on its way (`stopPropagation()`), it acts a task later.
145
+ - **A `<fieldset disabled>`** around the button disables it: it fires no click, takes no focus and is painted as disabled. Its `disabled` property keeps saying what the page has set.
146
+ - **`form.elements`** lists the button. The element is form-associated.
147
+
148
+ #### The native submit button
149
+
150
+ A form is submitted with a submit button that belongs to it. The control of `el-button` is in a shadow root and has no form, so a button of the type `submit` submits with a hidden native `<button type="submit">` that is a child of the element. That button carries the `name`, the `value` and the attributes above.
151
+
152
+ - The element makes it when the form is first submitted with the button: with a click on the `el-button`, or with Enter in an `<input>` or a `<select>` of the form. Until then the children of the `el-button` are what the page wrote. After that it stays, as the last child.
153
+ - It is the `submitter` of the `submit` event: `event.submitter.closest('el-button')` is the `el-button`.
154
+ - Enter in a field clicks it, so a `click` listener on the `el-button` hears that click, with the native button as its target. A native submit button hears the same click.
155
+ - When the page replaces the content of the `el-button`, the element makes it again with the next submit.
156
+ - `form.querySelector('[type="submit"]')` does not find it before the first submit. `form.elements` lists the `el-button` from the start.
157
+
158
+ #### On a page that a framework hydrates
159
+
160
+ A framework that hydrates a server-rendered page expects the children it rendered, and no other. The element adds its native submit button for a submit only, so a server-rendered `el-button` hydrates also when the element has started before the framework does (Svelte 5: no `hydration_mismatch`). The page has nothing to write for that.
161
+
162
+ One case is left: a submit before the hydration that does not leave the page, such as a click on the button of a form that is not valid. The native button is there afterwards, and the framework finds a child it did not render. A page that writes the native submit button itself, as in [Before the script has run](#before-the-script-has-run), does not have that case: the framework has rendered the button and expects it.
163
+
164
+ #### The `disabled` attribute
165
+
166
+ For the platform an attribute that is there disables a form-associated element, whatever its value. So the attribute follows the property: the element has `disabled="true"` while it is disabled, and no `disabled` attribute while it is not. `disabled="false"` and a `disabled` without a value are read as not disabled, as before, and are taken off the element.
167
+
168
+ #### Before the script has run
169
+
170
+ In server-rendered markup a click on the button does not submit the form: the control is in the shadow root, and the script is what hands the click on ([#86](https://github.com/webtides/element-library/issues/86)). Enter in a field does, when the page writes the native submit button itself. The element takes that one and adds no second:
171
+
172
+ ```html
173
+ <el-button type="submit" name="action" value="save">
174
+ Save
175
+ <button type="submit" hidden name="action" value="save"></button>
176
+ </el-button>
177
+ ```
178
+
179
+ ## ARIA attributes
180
+
181
+ The element itself has no role. What takes the focus and what a screen reader announces is the `<button>` or `<a>` inside it, so the ARIA attributes you put on `el-button` are passed on to that control:
182
+
183
+ ```html
184
+ <!-- An icon button gets its name -->
185
+ <el-button circle="true" aria-label="Add">+</el-button>
186
+
187
+ <!-- A toggle, a button that opens something -->
188
+ <el-button aria-pressed="true">Bold</el-button>
189
+ <el-button aria-expanded="false" aria-controls="filters">Filters</el-button>
190
+
191
+ <!-- Described by a text elsewhere in the page -->
192
+ <el-button variant="danger" aria-describedby="delete-hint">Delete</el-button>
193
+ <p id="delete-hint">This cannot be undone.</p>
194
+ ```
195
+
196
+ | Attributes | How they reach the control |
197
+ | --- | --- |
198
+ | `aria-label`, `aria-description`, `aria-expanded`, `aria-haspopup`, `aria-pressed`, `aria-current` | As the same attribute, with every change. |
199
+ | `aria-labelledby`, `aria-describedby`, `aria-controls` | As references to the elements they name. An id does not reach out of the shadow root the control is in. |
200
+
201
+ - The attributes stay on the element as well, where a stylesheet can select them: `el-button[aria-pressed='true']`.
202
+ - An empty attribute counts as not set.
203
+ - `aria-disabled` and `aria-busy` are not passed on. The button sets them itself, from `disabled` and `loading`.
204
+ - The elements behind an id are looked up in the document, or in the shadow root the button is used in, when the button renders. An element that comes into the page later is found once the attribute is set again.
205
+ - The references need a browser that knows them (`ariaDescribedByElements`: Chrome 135, Firefox 136, Safari 16.4). In an older one the three relations are not there, as before; the other attributes work everywhere.
206
+ - In server-rendered markup the first group is on the control from the start. The references need the JavaScript of the element.
207
+
208
+ ## Migrating from the `variant` / `outline` API
209
+
210
+ Before, the button had seven variants and an `outline` flag. The old values are not mapped; a button that still uses them is painted neutral and filled.
211
+
212
+ | Before | Now |
213
+ | -------------------------------------------------- | ------------------------------------------------ |
214
+ | `variant="default"` (or none) | `variant="neutral"` (or none) |
215
+ | `variant="primary"` | `variant="brand"` |
216
+ | `variant="success"`, `"warning"`, `"danger"` | unchanged |
217
+ | `variant="text"` | `variant="brand" appearance="plain"` |
218
+ | `outline="true"` | `appearance="outlined"` |
219
+ | `variant="neutral"` (dark fill in the text colour) | no successor: `neutral` is the muted default now |
@@ -1,6 +1,11 @@
1
+ import hostStyle from '../../styles/host.style.js';
2
+ import sizeStyle from '../../styles/size.style.js';
3
+ import variantsStyle from '../../styles/variants.style.js';
4
+ import appearanceStyle from '../../styles/appearance.style.js';
5
+
1
6
  const css = String.raw;
2
7
 
3
- export default css`
8
+ const style = css`
4
9
  :host {
5
10
  display: inline-block;
6
11
  vertical-align: middle;
@@ -9,23 +14,28 @@ export default css`
9
14
  /* ── Base control ─────────────────────────────────────────────────────── */
10
15
 
11
16
  .button {
12
- /* Tokens with headless fallbacks: an unthemed button still renders as a usable
17
+ /* The size comes from the size module, the colours from the variants and appearance
18
+ modules. All of them carry fallbacks: an unthemed button still renders as a usable
13
19
  native-ish control rather than disappearing. */
14
20
  position: relative;
15
21
  display: inline-flex;
16
22
  align-items: center;
17
23
  justify-content: center;
18
24
  gap: var(--el-space-2, 0.5em);
19
- box-sizing: border-box;
20
25
  width: 100%;
21
- min-height: var(--el-control-height, 2.5rem);
22
- padding: var(--el-space-2, 0.5em) var(--el-space-4, 1em);
26
+ min-height: var(--_el-size-height);
27
+ padding: var(--_el-size-padding-block) var(--_el-size-padding-inline);
23
28
  border: var(--el-border-width, 1px) solid transparent;
24
- border-radius: var(--el-radius-md, 4px);
25
- background: var(--el-color-bg-muted, #e5e7eb);
26
- color: var(--el-color-fg, currentColor);
29
+ /* The radius of the shape on all four corners. A row of joined buttons (el-button-group)
30
+ takes it away from the corners that face a neighbour, with --_el-group-radius-start
31
+ and --_el-group-radius-end on what is slotted into it. */
32
+ --_el-button-radius: var(--el-radius-md, 4px);
33
+ border-start-start-radius: var(--_el-group-radius-start, var(--_el-button-radius));
34
+ border-end-start-radius: var(--_el-group-radius-start, var(--_el-button-radius));
35
+ border-start-end-radius: var(--_el-group-radius-end, var(--_el-button-radius));
36
+ border-end-end-radius: var(--_el-group-radius-end, var(--_el-button-radius));
27
37
  font-family: var(--el-font-family, inherit);
28
- font-size: var(--el-font-size-md, 1rem);
38
+ font-size: var(--_el-size-font-size);
29
39
  font-weight: 600;
30
40
  line-height: var(--el-line-height, 1.5);
31
41
  text-align: center;
@@ -37,6 +47,10 @@ export default css`
37
47
  background var(--el-duration-md, 0s) var(--el-ease, linear),
38
48
  border-color var(--el-duration-md, 0s) var(--el-ease, linear),
39
49
  color var(--el-duration-md, 0s) var(--el-ease, linear);
50
+ /* Whether a theme gives the focus ring a colour: transparent with --el-color-focus-ring.
51
+ Without the token the var() has no value and the property is invalid, so what reads it
52
+ takes its fallback. A stylesheet cannot ask whether a property is set in another way. */
53
+ --_el-button-ring-themed: color-mix(in srgb, var(--el-color-focus-ring) 0%, transparent);
40
54
  }
41
55
 
42
56
  /* display:contents promotes the slotted content to be the flex items directly, so empty
@@ -47,149 +61,110 @@ export default css`
47
61
  display: contents;
48
62
  }
49
63
 
50
- .button:hover {
51
- /* Subtle, token-free hover that works on any background fill. */
52
- filter: brightness(0.95);
53
- }
54
-
55
- .button:focus-visible {
56
- outline: var(--el-focus-ring-width, 2px) solid var(--el-color-focus-ring, currentColor);
57
- outline-offset: var(--el-focus-ring-offset, 2px);
58
- }
59
-
60
- /* ── Sizes ────────────────────────────────────────────────────────────── */
61
-
62
- .button--small {
63
- min-height: calc(var(--el-control-height, 2.5rem) * 0.8);
64
- padding: var(--el-space-1, 0.25em) var(--el-space-3, 0.75em);
65
- font-size: var(--el-font-size-sm, 0.875rem);
66
- }
67
-
68
- .button--large {
69
- min-height: calc(var(--el-control-height, 2.5rem) * 1.25);
70
- padding: var(--el-space-3, 0.75em) var(--el-space-5, 1.5em);
71
- font-size: calc(var(--el-font-size-md, 1rem) * 1.125);
72
- }
73
-
74
- /* ── Solid variants ───────────────────────────────────────────────────── */
64
+ /* ── States ───────────────────────────────────────────────────────────── */
75
65
 
76
- /* Filled buttons read the label against the surface color, the same contrast trick the
77
- checkbox checkmark uses: in light schemes bg is light → light text on a colored fill,
78
- in dark schemes bg is dark → dark text. So a single token works in both. */
79
- .button--primary {
80
- background: var(--el-color-accent, #2563eb);
81
- border-color: var(--el-color-accent, #2563eb);
82
- color: var(--el-color-bg, #fff);
83
- }
84
-
85
- .button--success {
86
- background: var(--el-color-success, #16a34a);
87
- border-color: var(--el-color-success, #16a34a);
88
- color: var(--el-color-bg, #fff);
66
+ /* Hover styles only where the pointer can hover. A touch screen keeps :hover on the button
67
+ after a tap until the next tap lands elsewhere, so there they would stay behind. */
68
+ @media (hover: hover) {
69
+ .button:hover {
70
+ /* Subtle, token-free hover that works on any background fill. */
71
+ filter: brightness(0.95);
72
+ }
89
73
  }
90
74
 
91
- .button--danger {
92
- background: var(--el-color-danger, #dc2626);
93
- border-color: var(--el-color-danger, #dc2626);
94
- color: var(--el-color-bg, #fff);
75
+ /* Pressed: one step darker than hover, and the only feedback a touch screen gets. */
76
+ .button:active {
77
+ filter: brightness(0.88);
95
78
  }
96
79
 
97
- .button--neutral {
98
- background: var(--el-color-fg, #374151);
99
- border-color: var(--el-color-fg, #374151);
100
- color: var(--el-color-bg, #fff);
80
+ /* The ring of a theme is around the control, in the colour the theme gives it. Without that
81
+ colour the outline is there and shows nothing; where the user forces colours, the browser
82
+ gives it one. */
83
+ .button:focus-visible {
84
+ outline: var(--el-focus-ring-width, 2px) solid var(--el-color-focus-ring, transparent);
85
+ outline-offset: var(--el-focus-ring-offset, 2px);
101
86
  }
102
87
 
103
- /* No dedicated warning token exists yet; fall back to amber. Amber stays light in both
104
- color schemes, so dark text keeps the label readable regardless of theme. */
105
- .button--warning {
106
- background: var(--el-color-warning, #f59e0b);
107
- border-color: var(--el-color-warning, #f59e0b);
108
- color: #1c1917;
88
+ /* Without a theme the ring is inside of the control, in the colour of the label. Nothing says
89
+ which colours the page around the control has, and the label can be read on the surface of
90
+ the control: on its fill, and on the page where it has none. As far inside of the edge as
91
+ the ring of a theme is outside of it. A shadow and not a border: forced colours take it
92
+ away and leave the outline. */
93
+ .button:focus-visible::after {
94
+ content: '';
95
+ position: absolute;
96
+ inset: var(--el-border-width, 1px);
97
+ border-radius: inherit;
98
+ box-shadow: inset 0 0 0 var(--el-focus-ring-width, 2px) var(--_el-button-ring-themed, currentColor);
99
+ pointer-events: none;
109
100
  }
110
101
 
111
- /* default keeps the muted surface but gains a themed border for definition. */
112
- .button--default {
113
- border-color: var(--el-color-border, transparent);
114
- }
102
+ /* Without a fill there is nothing to darken. An outlined button gets a faint tint of its
103
+ text colour instead, a plain one an underline like a link, and the tint when pressed. */
104
+ @media (hover: hover) {
105
+ :host([appearance='outlined']) .button:hover {
106
+ background: color-mix(in srgb, currentColor 12%, transparent);
107
+ filter: none;
108
+ }
115
109
 
116
- /* text — no chrome, color-only, like a link that behaves as a button. */
117
- .button--text {
118
- background: transparent;
119
- border-color: transparent;
120
- color: var(--el-color-accent, currentColor);
110
+ :host([appearance='plain']) .button:hover {
111
+ filter: none;
112
+ text-decoration: underline;
113
+ }
121
114
  }
122
115
 
123
- .button--text:hover {
116
+ :host([appearance='outlined']) .button:active {
117
+ background: color-mix(in srgb, currentColor 24%, transparent);
124
118
  filter: none;
125
- text-decoration: underline;
126
119
  }
127
120
 
128
- /* ── Outline ──────────────────────────────────────────────────────────── */
129
-
130
- .button--outline {
131
- background: transparent;
132
- }
133
-
134
- .button--outline.button--default {
135
- border-color: var(--el-color-border, currentColor);
136
- color: var(--el-color-fg, currentColor);
137
- }
138
-
139
- .button--outline.button--primary {
140
- border-color: var(--el-color-accent, currentColor);
141
- color: var(--el-color-accent, currentColor);
142
- }
143
-
144
- .button--outline.button--success {
145
- border-color: var(--el-color-success, currentColor);
146
- color: var(--el-color-success, currentColor);
147
- }
148
-
149
- .button--outline.button--danger {
150
- border-color: var(--el-color-danger, currentColor);
151
- color: var(--el-color-danger, currentColor);
152
- }
153
-
154
- .button--outline.button--neutral {
155
- border-color: var(--el-color-fg, currentColor);
156
- color: var(--el-color-fg, currentColor);
157
- }
158
-
159
- .button--outline.button--warning {
160
- border-color: var(--el-color-warning, #f59e0b);
161
- color: var(--el-color-warning, #b45309);
162
- }
163
-
164
- .button--outline:hover {
165
- /* Fill on hover by lifting the brightness of a faint tint of the current text color. */
121
+ :host([appearance='plain']) .button:active {
166
122
  background: color-mix(in srgb, currentColor 12%, transparent);
167
123
  filter: none;
124
+ text-decoration: underline;
168
125
  }
169
126
 
170
127
  /* ── Shapes ───────────────────────────────────────────────────────────── */
171
128
 
172
129
  .button--pill {
173
- border-radius: 999px;
130
+ --_el-button-radius: 999px;
174
131
  }
175
132
 
176
133
  .button--circle {
177
- width: var(--el-control-height, 2.5rem);
178
- height: var(--el-control-height, 2.5rem);
134
+ --_el-button-radius: 50%;
135
+ width: var(--_el-size-height);
136
+ height: var(--_el-size-height);
179
137
  min-height: 0;
180
138
  padding: 0;
181
- border-radius: 50%;
182
139
  aspect-ratio: 1;
183
140
  }
184
141
 
185
- .button--circle.button--small {
186
- width: calc(var(--el-control-height, 2.5rem) * 0.8);
187
- height: calc(var(--el-control-height, 2.5rem) * 0.8);
142
+ /* ── In a group ───────────────────────────────────────────────────────── */
143
+
144
+ /* A filled button with a neighbour in front of it draws the line between the two: its border
145
+ at the start has the colour the group gives it (--_el-group-divider), which shows between
146
+ two fills of one colour. Outside of a group it is the border colour of the fill, as on
147
+ the other three sides. The rule weighs as much as the one of the appearance module for a
148
+ filled surface and comes after it; the ones for outlined and plain weigh more, so those
149
+ keep their border. */
150
+ :host .button {
151
+ border-inline-start-color: var(--_el-group-divider, var(--_el-variant-fill-border));
188
152
  }
189
153
 
190
- .button--circle.button--large {
191
- width: calc(var(--el-control-height, 2.5rem) * 1.25);
192
- height: calc(var(--el-control-height, 2.5rem) * 1.25);
154
+ /* ── Touch screens ────────────────────────────────────────────────────── */
155
+
156
+ /* On a coarse pointer no size or shape falls below --el-touch-target in either direction.
157
+ Without the token the sizes stay as they are. */
158
+ @media (any-pointer: coarse) {
159
+ .button {
160
+ min-width: var(--el-touch-target, auto);
161
+ min-height: max(var(--_el-size-height), var(--el-touch-target, 0px));
162
+ }
163
+
164
+ /* A circle has a fixed width and height. The minimum wins over both, so it stays round. */
165
+ .button--circle {
166
+ min-height: var(--el-touch-target, auto);
167
+ }
193
168
  }
194
169
 
195
170
  /* ── Caret ────────────────────────────────────────────────────────────── */
@@ -218,6 +193,8 @@ export default css`
218
193
  position: absolute;
219
194
  top: 50%;
220
195
  left: 50%;
196
+ /* The ring is drawn around the 1em box, not inside it. */
197
+ box-sizing: content-box;
221
198
  width: 1em;
222
199
  height: 1em;
223
200
  margin: -0.5em 0 0 -0.5em;
@@ -249,3 +226,5 @@ export default css`
249
226
  filter: none;
250
227
  }
251
228
  `;
229
+
230
+ export default [hostStyle(), sizeStyle(), variantsStyle(), appearanceStyle('.button'), style].join('\n');
@@ -0,0 +1,24 @@
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-button-group`: a row of `el-button` that reads as one control. A group to assistive technology (`role="group"`), named by `label`. ([#124](https://github.com/webtides/element-library/issues/124))
20
+ - The buttons touch and share the border between them. The corners that face a neighbour are square, the outer corners of the row keep the radius of the buttons; the row is mirrored in a text that runs from right to left.
21
+ - Two filled buttons are divided by a line, a quarter of the text colour on the fill, which shows between two fills of one colour.
22
+ - The button that has the focus lies over its neighbours, so its focus ring is not covered.
23
+ - A button inside of a slotted element is joined as that element is, which makes the anchor of an `el-popover` a part of the row. What is in the panel of the popover is not.
24
+ - The group joins its buttons with its stylesheet alone: it runs no script on them, and a server-rendered group does not change when the elements take over.
@@ -0,0 +1,3 @@
1
+ import { define } from './button-group.js';
2
+
3
+ define();
@@ -0,0 +1,53 @@
1
+ import { TemplateElement, defineElement, html, spreadAttributes } from '@webtides/element-js';
2
+ import style from './button-group.style.js';
3
+
4
+ /**
5
+ * A button group: a row of `el-button` that reads as one control, the actions of a toolbar, a
6
+ * button with a second one for more options, the steps back and forward. The buttons touch, only
7
+ * the outer corners of the row are rounded, and a line divides two neighbours. To assistive
8
+ * technology it is a group, with a name.
9
+ *
10
+ * The group joins its buttons with its stylesheet alone. It runs no script on them, so a
11
+ * server-rendered group does not change when the elements take over.
12
+ *
13
+ * @element el-button-group
14
+ *
15
+ * @slot - The buttons of the group: `el-button` elements, or elements that hold one (an
16
+ * `el-popover` with its anchor).
17
+ *
18
+ * @csspart base - The row. It carries `role="group"` and the label.
19
+ *
20
+ * @property {string} label - The accessible name of the group, "Text alignment". Unset, the group
21
+ * has no name. Default `''`.
22
+ */
23
+ export default class ButtonGroup extends TemplateElement {
24
+ constructor() {
25
+ super({
26
+ styles: [style],
27
+ shadowRender: true,
28
+ });
29
+ }
30
+
31
+ properties() {
32
+ return {
33
+ label: '',
34
+ };
35
+ }
36
+
37
+ template() {
38
+ return html`
39
+ <div
40
+ part="base"
41
+ class="button-group"
42
+ role="group"
43
+ ${spreadAttributes({ 'aria-label': this.label || undefined })}
44
+ >
45
+ <slot></slot>
46
+ </div>
47
+ `;
48
+ }
49
+ }
50
+
51
+ export function define() {
52
+ defineElement('el-button-group', ButtonGroup);
53
+ }