@warp-ds/elements 2.2.0-next.1 → 2.2.0-next.11

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 (396) hide show
  1. package/README.md +27 -17
  2. package/dist/.storybook/utilities.d.ts +28 -0
  3. package/dist/.storybook/utilities.js +52 -0
  4. package/dist/api.js +1 -49
  5. package/dist/api.js.map +4 -4
  6. package/dist/custom-elements.json +4282 -0
  7. package/dist/packages/affix/affix.stories.d.ts +10 -0
  8. package/dist/packages/affix/affix.stories.js +25 -0
  9. package/dist/packages/affix/affix.test.d.ts +1 -0
  10. package/dist/packages/affix/affix.test.js +9 -0
  11. package/dist/packages/affix/index.d.ts +52 -24
  12. package/dist/packages/affix/index.js +2448 -2240
  13. package/dist/packages/affix/index.js.map +4 -4
  14. package/dist/packages/affix/react.d.ts +2 -0
  15. package/dist/packages/affix/react.js +8 -0
  16. package/dist/packages/affix/styles.d.ts +1 -0
  17. package/dist/packages/affix/styles.js +2 -0
  18. package/dist/packages/alert/alert.stories.d.ts +15 -0
  19. package/dist/packages/alert/alert.stories.js +68 -0
  20. package/dist/packages/alert/alert.test.d.ts +1 -0
  21. package/dist/packages/alert/alert.test.js +16 -0
  22. package/dist/packages/alert/index.d.ts +27 -17
  23. package/dist/packages/alert/index.js +2452 -2446
  24. package/dist/packages/alert/index.js.map +4 -4
  25. package/dist/packages/alert/react.d.ts +2 -0
  26. package/dist/packages/alert/react.js +8 -0
  27. package/dist/packages/alert/styles.d.ts +1 -0
  28. package/dist/packages/alert/styles.js +2 -0
  29. package/dist/packages/attention/attention.stories.d.ts +15 -0
  30. package/dist/packages/attention/attention.stories.js +188 -0
  31. package/dist/packages/attention/attention.test.d.ts +1 -0
  32. package/dist/packages/attention/attention.test.js +11 -0
  33. package/dist/packages/attention/index.d.ts +62 -90
  34. package/dist/packages/attention/index.js +3360 -3984
  35. package/dist/packages/attention/index.js.map +4 -4
  36. package/dist/packages/attention/layout-styles.d.ts +1 -0
  37. package/dist/packages/attention/layout-styles.js +905 -0
  38. package/dist/packages/attention/locales/da/messages.mjs +1 -0
  39. package/dist/packages/attention/locales/en/messages.mjs +1 -0
  40. package/dist/packages/attention/locales/fi/messages.mjs +1 -0
  41. package/dist/packages/attention/locales/nb/messages.mjs +1 -0
  42. package/dist/packages/attention/locales/sv/messages.mjs +1 -0
  43. package/dist/packages/attention/react.d.ts +1 -0
  44. package/dist/packages/attention/react.js +9 -0
  45. package/dist/packages/attention/styles.d.ts +1 -0
  46. package/dist/packages/attention/styles.js +2 -0
  47. package/dist/packages/badge/badge.stories.d.ts +17 -0
  48. package/dist/packages/badge/badge.stories.js +68 -0
  49. package/dist/packages/badge/badge.test.d.ts +1 -0
  50. package/dist/packages/badge/badge.test.js +9 -0
  51. package/dist/packages/badge/index.d.ts +17 -11
  52. package/dist/packages/badge/index.js +2441 -300
  53. package/dist/packages/badge/index.js.map +4 -4
  54. package/dist/packages/badge/react.d.ts +2 -0
  55. package/dist/packages/badge/react.js +8 -0
  56. package/dist/packages/badge/styles.d.ts +1 -0
  57. package/dist/packages/badge/styles.js +2 -0
  58. package/dist/packages/box/box.stories.d.ts +14 -0
  59. package/dist/packages/box/box.stories.js +59 -0
  60. package/dist/packages/box/box.test.d.ts +1 -0
  61. package/dist/packages/box/box.test.js +9 -0
  62. package/dist/packages/box/index.d.ts +22 -20
  63. package/dist/packages/box/index.js +2441 -304
  64. package/dist/packages/box/index.js.map +4 -4
  65. package/dist/packages/box/react.d.ts +2 -0
  66. package/dist/packages/box/react.js +8 -0
  67. package/dist/packages/box/slot.test.d.ts +1 -0
  68. package/dist/packages/box/slot.test.js +9 -0
  69. package/dist/packages/box/styles.d.ts +1 -0
  70. package/dist/packages/box/styles.js +2 -0
  71. package/dist/packages/breadcrumbs/breadcrumbs.stories.d.ts +12 -0
  72. package/dist/packages/breadcrumbs/breadcrumbs.stories.js +60 -0
  73. package/dist/packages/breadcrumbs/breadcrumbs.test.d.ts +1 -0
  74. package/dist/packages/breadcrumbs/breadcrumbs.test.js +16 -0
  75. package/dist/packages/breadcrumbs/index.d.ts +24 -16
  76. package/dist/packages/breadcrumbs/index.js +2402 -2051
  77. package/dist/packages/breadcrumbs/index.js.map +4 -4
  78. package/dist/packages/breadcrumbs/locales/da/messages.mjs +1 -0
  79. package/dist/packages/breadcrumbs/locales/en/messages.mjs +1 -0
  80. package/dist/packages/breadcrumbs/locales/fi/messages.mjs +1 -0
  81. package/dist/packages/breadcrumbs/locales/nb/messages.mjs +1 -0
  82. package/dist/packages/breadcrumbs/locales/sv/messages.mjs +1 -0
  83. package/dist/packages/breadcrumbs/react.d.ts +2 -0
  84. package/dist/packages/breadcrumbs/react.js +8 -0
  85. package/dist/packages/breadcrumbs/styles.d.ts +1 -0
  86. package/dist/packages/breadcrumbs/styles.js +2 -0
  87. package/dist/packages/button/button.stories.d.ts +21 -0
  88. package/dist/packages/button/button.stories.js +119 -0
  89. package/dist/packages/button/button.test.d.ts +1 -0
  90. package/dist/packages/button/button.test.js +24 -0
  91. package/dist/packages/button/index.d.ts +111 -56
  92. package/dist/packages/button/index.js +2612 -2130
  93. package/dist/packages/button/index.js.map +4 -4
  94. package/dist/packages/button/locales/da/messages.mjs +1 -0
  95. package/dist/packages/button/locales/en/messages.mjs +1 -0
  96. package/dist/packages/button/locales/fi/messages.mjs +1 -0
  97. package/dist/packages/button/locales/nb/messages.mjs +1 -0
  98. package/dist/packages/button/locales/sv/messages.mjs +1 -0
  99. package/dist/packages/button/react.d.ts +2 -0
  100. package/dist/packages/button/react.js +8 -0
  101. package/dist/packages/button/styles.d.ts +1 -0
  102. package/dist/packages/button/styles.js +2 -0
  103. package/dist/packages/card/card.stories.d.ts +15 -0
  104. package/dist/packages/card/card.stories.js +82 -0
  105. package/dist/packages/card/card.test.d.ts +1 -0
  106. package/dist/packages/card/card.test.js +9 -0
  107. package/dist/packages/card/index.d.ts +33 -16
  108. package/dist/packages/card/index.js +2403 -2067
  109. package/dist/packages/card/index.js.map +4 -4
  110. package/dist/packages/card/locales/da/messages.mjs +1 -0
  111. package/dist/packages/card/locales/en/messages.mjs +1 -0
  112. package/dist/packages/card/locales/fi/messages.mjs +1 -0
  113. package/dist/packages/card/locales/nb/messages.mjs +1 -0
  114. package/dist/packages/card/locales/sv/messages.mjs +1 -0
  115. package/dist/packages/card/react.d.ts +2 -0
  116. package/dist/packages/card/react.js +8 -0
  117. package/dist/packages/card/styles.d.ts +1 -0
  118. package/dist/packages/card/styles.js +2 -0
  119. package/dist/packages/datepicker/DatePicker.test.d.ts +1 -0
  120. package/dist/packages/datepicker/DatePicker.test.js +68 -0
  121. package/dist/packages/datepicker/datepicker.d.ts +107 -0
  122. package/dist/packages/datepicker/datepicker.js +2785 -0
  123. package/dist/packages/datepicker/datepicker.js.map +7 -0
  124. package/dist/packages/datepicker/datepicker.stories.d.ts +11 -0
  125. package/dist/packages/datepicker/datepicker.stories.js +50 -0
  126. package/dist/packages/datepicker/datepicker.test.d.ts +2 -0
  127. package/dist/packages/datepicker/datepicker.test.js +62 -0
  128. package/dist/packages/datepicker/index.d.ts +1 -0
  129. package/dist/packages/datepicker/index.js +2785 -0
  130. package/dist/packages/datepicker/index.js.map +7 -0
  131. package/dist/packages/datepicker/locales/da/messages.d.mts +1 -0
  132. package/dist/packages/datepicker/locales/da/messages.mjs +1 -0
  133. package/dist/packages/datepicker/locales/en/messages.d.mts +1 -0
  134. package/dist/packages/datepicker/locales/en/messages.mjs +1 -0
  135. package/dist/packages/datepicker/locales/fi/messages.d.mts +1 -0
  136. package/dist/packages/datepicker/locales/fi/messages.mjs +1 -0
  137. package/dist/packages/datepicker/locales/nb/messages.d.mts +1 -0
  138. package/dist/packages/datepicker/locales/nb/messages.mjs +1 -0
  139. package/dist/packages/datepicker/locales/sv/messages.d.mts +1 -0
  140. package/dist/packages/datepicker/locales/sv/messages.mjs +1 -0
  141. package/dist/packages/datepicker/react.d.ts +2 -0
  142. package/dist/packages/datepicker/react.js +8 -0
  143. package/dist/packages/datepicker/styles/w-datepicker-calendar.styles.d.ts +1 -0
  144. package/dist/packages/datepicker/styles/w-datepicker-calendar.styles.js +15 -0
  145. package/dist/packages/datepicker/styles/w-datepicker-day.styles.d.ts +1 -0
  146. package/dist/packages/datepicker/styles/w-datepicker-day.styles.js +64 -0
  147. package/dist/packages/datepicker/styles/w-datepicker-month.styles.d.ts +1 -0
  148. package/dist/packages/datepicker/styles/w-datepicker-month.styles.js +72 -0
  149. package/dist/packages/datepicker/styles/w-datepicker.styles.d.ts +1 -0
  150. package/dist/packages/datepicker/styles/w-datepicker.styles.js +101 -0
  151. package/dist/packages/datepicker/utils.d.ts +13 -0
  152. package/dist/packages/datepicker/utils.js +28 -0
  153. package/dist/packages/dead-toggle/dead-toggle.stories.d.ts +10 -0
  154. package/dist/packages/dead-toggle/dead-toggle.stories.js +23 -0
  155. package/dist/packages/dead-toggle/dead-toggle.test.d.ts +1 -0
  156. package/dist/packages/dead-toggle/dead-toggle.test.js +9 -0
  157. package/dist/packages/dead-toggle/index.d.ts +21 -0
  158. package/dist/packages/dead-toggle/index.js +2487 -0
  159. package/dist/packages/dead-toggle/index.js.map +7 -0
  160. package/dist/packages/dead-toggle/react.d.ts +2 -0
  161. package/dist/packages/dead-toggle/react.js +8 -0
  162. package/dist/packages/expandable/expandable.stories.d.ts +19 -0
  163. package/dist/packages/expandable/expandable.stories.js +133 -0
  164. package/dist/packages/expandable/expandable.test.d.ts +1 -0
  165. package/dist/packages/expandable/expandable.test.js +24 -0
  166. package/dist/packages/expandable/index.d.ts +55 -50
  167. package/dist/packages/expandable/index.js +2416 -2287
  168. package/dist/packages/expandable/index.js.map +4 -4
  169. package/dist/packages/expandable/react.d.ts +2 -0
  170. package/dist/packages/expandable/react.js +8 -0
  171. package/dist/packages/expandable/styles.d.ts +1 -0
  172. package/dist/packages/expandable/styles.js +2 -0
  173. package/dist/packages/i18n.js +44 -0
  174. package/dist/packages/link/index.d.ts +39 -0
  175. package/dist/packages/link/index.js +2646 -0
  176. package/dist/packages/link/index.js.map +7 -0
  177. package/dist/packages/link/link.stories.d.ts +20 -0
  178. package/dist/packages/link/link.stories.js +121 -0
  179. package/dist/packages/link/link.test.d.ts +1 -0
  180. package/dist/packages/link/link.test.js +9 -0
  181. package/dist/packages/link/react.d.ts +2 -0
  182. package/dist/packages/link/react.js +8 -0
  183. package/dist/packages/link/styles.d.ts +1 -0
  184. package/dist/packages/link/styles.js +200 -0
  185. package/dist/packages/modal/index.d.ts +4 -5
  186. package/dist/packages/modal/index.js +2649 -2569
  187. package/dist/packages/modal/index.js.map +4 -4
  188. package/dist/packages/modal/locales/da/messages.mjs +1 -0
  189. package/dist/packages/modal/locales/en/messages.mjs +1 -0
  190. package/dist/packages/modal/locales/fi/messages.mjs +1 -0
  191. package/dist/packages/modal/locales/nb/messages.mjs +1 -0
  192. package/dist/packages/modal/locales/sv/messages.mjs +1 -0
  193. package/dist/packages/modal/modal-footer.d.ts +18 -11
  194. package/dist/packages/modal/modal-footer.js +2460 -0
  195. package/dist/packages/modal/modal-footer.js.map +7 -0
  196. package/dist/packages/modal/modal-header.d.ts +30 -31
  197. package/dist/packages/modal/modal-header.js +2584 -0
  198. package/dist/packages/modal/modal-header.js.map +7 -0
  199. package/dist/packages/modal/modal-main.d.ts +32 -31
  200. package/dist/packages/modal/modal-main.js +2572 -0
  201. package/dist/packages/modal/modal-main.js.map +7 -0
  202. package/dist/packages/modal/modal.stories.d.ts +19 -0
  203. package/dist/packages/modal/modal.stories.js +160 -0
  204. package/dist/packages/modal/react.d.ts +4 -0
  205. package/dist/packages/modal/react.js +18 -0
  206. package/dist/packages/modal/util.d.ts +7 -17
  207. package/dist/packages/modal/util.js +21 -0
  208. package/dist/packages/pageindicator/index.d.ts +14 -0
  209. package/dist/packages/pageindicator/index.js +32 -0
  210. package/dist/packages/pageindicator/index.js.map +7 -0
  211. package/dist/packages/pageindicator/pageindicator.stories.d.ts +32 -0
  212. package/dist/packages/pageindicator/pageindicator.stories.js +71 -0
  213. package/dist/packages/pageindicator/react.d.ts +2 -0
  214. package/dist/packages/pageindicator/react.js +8 -0
  215. package/dist/packages/pageindicator/style.d.ts +1 -0
  216. package/dist/packages/pageindicator/style.js +26 -0
  217. package/dist/packages/pagination/index.d.ts +37 -0
  218. package/dist/packages/pagination/index.js +2494 -0
  219. package/dist/packages/pagination/index.js.map +7 -0
  220. package/dist/packages/pagination/locales/da/messages.d.mts +1 -0
  221. package/dist/packages/pagination/locales/da/messages.mjs +1 -0
  222. package/dist/packages/pagination/locales/en/messages.d.mts +1 -0
  223. package/dist/packages/pagination/locales/en/messages.mjs +1 -0
  224. package/dist/packages/pagination/locales/fi/messages.d.mts +1 -0
  225. package/dist/packages/pagination/locales/fi/messages.mjs +1 -0
  226. package/dist/packages/pagination/locales/nb/messages.d.mts +1 -0
  227. package/dist/packages/pagination/locales/nb/messages.mjs +1 -0
  228. package/dist/packages/pagination/locales/sv/messages.d.mts +1 -0
  229. package/dist/packages/pagination/locales/sv/messages.mjs +1 -0
  230. package/dist/packages/pagination/pagination.stories.d.ts +14 -0
  231. package/dist/packages/pagination/pagination.stories.js +56 -0
  232. package/dist/packages/pagination/pagination.test.d.ts +1 -0
  233. package/dist/packages/pagination/pagination.test.js +76 -0
  234. package/dist/packages/pagination/react.d.ts +2 -0
  235. package/dist/packages/pagination/react.js +8 -0
  236. package/dist/packages/pagination/styles.d.ts +1 -0
  237. package/dist/packages/pagination/styles.js +2 -0
  238. package/dist/packages/pill/index.d.ts +44 -23
  239. package/dist/packages/pill/index.js +2408 -2175
  240. package/dist/packages/pill/index.js.map +4 -4
  241. package/dist/packages/pill/locales/da/messages.mjs +1 -0
  242. package/dist/packages/pill/locales/en/messages.mjs +1 -0
  243. package/dist/packages/pill/locales/fi/messages.mjs +1 -0
  244. package/dist/packages/pill/locales/nb/messages.mjs +1 -0
  245. package/dist/packages/pill/locales/sv/messages.mjs +1 -0
  246. package/dist/packages/pill/pill.stories.d.ts +12 -0
  247. package/dist/packages/pill/pill.stories.js +33 -0
  248. package/dist/packages/pill/pill.test.d.ts +1 -0
  249. package/dist/packages/pill/pill.test.js +23 -0
  250. package/dist/packages/pill/styles.d.ts +1 -0
  251. package/dist/packages/pill/styles.js +2 -0
  252. package/dist/packages/rip-and-tear-checkbox/checkbox.d.ts +64 -0
  253. package/dist/packages/rip-and-tear-checkbox/checkbox.js +210 -0
  254. package/dist/packages/rip-and-tear-checkbox/index.d.ts +6 -0
  255. package/dist/packages/rip-and-tear-checkbox/index.js +160 -0
  256. package/dist/packages/rip-and-tear-checkbox/index.js.map +7 -0
  257. package/dist/packages/rip-and-tear-checkbox/styles.d.ts +1 -0
  258. package/dist/packages/rip-and-tear-checkbox/styles.js +116 -0
  259. package/dist/packages/rip-and-tear-radio/base-element.d.ts +46 -0
  260. package/dist/packages/rip-and-tear-radio/base-element.js +100 -0
  261. package/dist/packages/rip-and-tear-radio/custom-error-validator.d.ts +6 -0
  262. package/dist/packages/rip-and-tear-radio/custom-error-validator.js +22 -0
  263. package/dist/packages/rip-and-tear-radio/form-associated-element.d.ts +103 -0
  264. package/dist/packages/rip-and-tear-radio/form-associated-element.js +282 -0
  265. package/dist/packages/rip-and-tear-radio/host-styles.d.ts +1 -0
  266. package/dist/packages/rip-and-tear-radio/host-styles.js +12 -0
  267. package/dist/packages/rip-and-tear-radio/index.d.ts +8 -0
  268. package/dist/packages/rip-and-tear-radio/index.js +272 -0
  269. package/dist/packages/rip-and-tear-radio/index.js.map +7 -0
  270. package/dist/packages/rip-and-tear-radio/invalid.d.ts +8 -0
  271. package/dist/packages/rip-and-tear-radio/invalid.js +5 -0
  272. package/dist/packages/rip-and-tear-radio/math.d.ts +1 -0
  273. package/dist/packages/rip-and-tear-radio/math.js +4 -0
  274. package/dist/packages/rip-and-tear-radio/radio-group-styles.d.ts +1 -0
  275. package/dist/packages/rip-and-tear-radio/radio-group-styles.js +60 -0
  276. package/dist/packages/rip-and-tear-radio/radio-group.d.ts +72 -0
  277. package/dist/packages/rip-and-tear-radio/radio-group.js +339 -0
  278. package/dist/packages/rip-and-tear-radio/radio-styles.d.ts +1 -0
  279. package/dist/packages/rip-and-tear-radio/radio-styles.js +172 -0
  280. package/dist/packages/rip-and-tear-radio/radio.d.ts +38 -0
  281. package/dist/packages/rip-and-tear-radio/radio.js +107 -0
  282. package/dist/packages/rip-and-tear-radio/required-validator.d.ts +11 -0
  283. package/dist/packages/rip-and-tear-radio/required-validator.js +34 -0
  284. package/dist/packages/rip-and-tear-radio/slot.d.ts +20 -0
  285. package/dist/packages/rip-and-tear-radio/slot.js +71 -0
  286. package/dist/packages/rip-and-tear-radio/watch.d.ts +26 -0
  287. package/dist/packages/rip-and-tear-radio/watch.js +39 -0
  288. package/dist/packages/select/index.d.ts +59 -48
  289. package/dist/packages/select/index.js +2421 -2236
  290. package/dist/packages/select/index.js.map +4 -4
  291. package/dist/packages/select/locales/da/messages.mjs +1 -0
  292. package/dist/packages/select/locales/en/messages.mjs +1 -0
  293. package/dist/packages/select/locales/fi/messages.mjs +1 -0
  294. package/dist/packages/select/locales/nb/messages.mjs +1 -0
  295. package/dist/packages/select/locales/sv/messages.mjs +1 -0
  296. package/dist/packages/select/react.d.ts +2 -0
  297. package/dist/packages/select/react.js +8 -0
  298. package/dist/packages/select/select.stories.d.ts +10 -0
  299. package/dist/packages/select/select.stories.js +31 -0
  300. package/dist/packages/select/select.test.d.ts +1 -0
  301. package/dist/packages/select/select.test.js +31 -0
  302. package/dist/packages/select/styles.d.ts +1 -0
  303. package/dist/packages/select/styles.js +2 -0
  304. package/dist/packages/steps/index.d.ts +43 -0
  305. package/dist/packages/steps/index.js +2465 -0
  306. package/dist/packages/steps/index.js.map +7 -0
  307. package/dist/packages/steps/locales/da/messages.d.mts +1 -0
  308. package/dist/packages/steps/locales/da/messages.mjs +1 -0
  309. package/dist/packages/steps/locales/en/messages.d.mts +1 -0
  310. package/dist/packages/steps/locales/en/messages.mjs +1 -0
  311. package/dist/packages/steps/locales/fi/messages.d.mts +1 -0
  312. package/dist/packages/steps/locales/fi/messages.mjs +1 -0
  313. package/dist/packages/steps/locales/nb/messages.d.mts +1 -0
  314. package/dist/packages/steps/locales/nb/messages.mjs +1 -0
  315. package/dist/packages/steps/locales/sv/messages.d.mts +1 -0
  316. package/dist/packages/steps/locales/sv/messages.mjs +1 -0
  317. package/dist/packages/steps/react.d.ts +3 -0
  318. package/dist/packages/steps/react.js +13 -0
  319. package/dist/packages/steps/steps.stories.d.ts +12 -0
  320. package/dist/packages/steps/steps.stories.js +172 -0
  321. package/dist/packages/steps/styles.d.ts +1 -0
  322. package/dist/packages/steps/styles.js +2 -0
  323. package/dist/packages/styles.d.ts +2 -0
  324. package/dist/packages/styles.js +2442 -0
  325. package/dist/packages/switch/index.d.ts +20 -0
  326. package/dist/packages/switch/index.js +2455 -0
  327. package/dist/packages/switch/index.js.map +7 -0
  328. package/dist/packages/switch/react.d.ts +2 -0
  329. package/dist/packages/switch/react.js +8 -0
  330. package/dist/packages/switch/styles.d.ts +1 -0
  331. package/dist/packages/switch/styles.js +2 -0
  332. package/dist/packages/switch/switch.stories.d.ts +9 -0
  333. package/dist/packages/switch/switch.stories.js +34 -0
  334. package/dist/packages/tabs/index.d.ts +4 -0
  335. package/dist/packages/tabs/index.js +2470 -0
  336. package/dist/packages/tabs/index.js.map +7 -0
  337. package/dist/packages/tabs/react.d.ts +4 -0
  338. package/dist/packages/tabs/react.js +18 -0
  339. package/dist/packages/tabs/styles.d.ts +1 -0
  340. package/dist/packages/tabs/styles.js +2 -0
  341. package/dist/packages/tabs/tab-panel.d.ts +20 -0
  342. package/dist/packages/tabs/tab-panel.js +51 -0
  343. package/dist/packages/tabs/tab.d.ts +23 -0
  344. package/dist/packages/tabs/tab.js +103 -0
  345. package/dist/packages/tabs/tabs.d.ts +38 -0
  346. package/dist/packages/tabs/tabs.js +238 -0
  347. package/dist/packages/tabs/tabs.stories.d.ts +8 -0
  348. package/dist/packages/tabs/tabs.stories.js +84 -0
  349. package/dist/packages/textfield/index.d.ts +72 -74
  350. package/dist/packages/textfield/index.js +2456 -413
  351. package/dist/packages/textfield/index.js.map +4 -4
  352. package/dist/packages/textfield/react.d.ts +2 -0
  353. package/dist/packages/textfield/react.js +8 -0
  354. package/dist/packages/textfield/styles.d.ts +1 -0
  355. package/dist/packages/textfield/styles.js +2 -0
  356. package/dist/packages/textfield/textfield.stories.d.ts +17 -0
  357. package/dist/packages/textfield/textfield.stories.js +86 -0
  358. package/dist/packages/textfield/textfield.test.d.ts +1 -0
  359. package/dist/packages/textfield/textfield.test.js +9 -0
  360. package/dist/packages/toast/api.d.ts +4 -45
  361. package/dist/packages/toast/api.js +41 -0
  362. package/dist/packages/toast/index.d.ts +3 -0
  363. package/dist/packages/toast/index.js +2466 -2787
  364. package/dist/packages/toast/index.js.map +4 -4
  365. package/dist/packages/toast/locales/da/messages.mjs +1 -0
  366. package/dist/packages/toast/locales/en/messages.mjs +1 -0
  367. package/dist/packages/toast/locales/fi/messages.mjs +1 -0
  368. package/dist/packages/toast/locales/nb/messages.mjs +1 -0
  369. package/dist/packages/toast/locales/sv/messages.mjs +1 -0
  370. package/dist/packages/toast/styles.d.ts +1 -0
  371. package/dist/packages/toast/styles.js +2 -0
  372. package/dist/packages/toast/toast-container.d.ts +12 -63
  373. package/dist/packages/toast/toast-container.js +153 -0
  374. package/dist/packages/toast/toast.d.ts +34 -29
  375. package/dist/packages/toast/toast.js +200 -0
  376. package/dist/packages/toast/toast.stories.d.ts +12 -0
  377. package/dist/packages/toast/toast.stories.js +50 -0
  378. package/dist/packages/toast/types.d.ts +15 -0
  379. package/dist/packages/toast/types.js +1 -0
  380. package/dist/packages/utils/expand-transition.d.ts +3 -2
  381. package/dist/packages/utils/expand-transition.js +59 -0
  382. package/dist/packages/utils/index.d.ts +1 -1
  383. package/dist/packages/utils/index.js +2 -0
  384. package/dist/packages/utils/index.js.map +7 -0
  385. package/dist/packages/utils/unstyled-heading.d.ts +3 -3
  386. package/dist/packages/utils/unstyled-heading.js +22 -0
  387. package/dist/packages/utils/window-exists.js +1 -0
  388. package/dist/setup-tests.d.ts +1 -0
  389. package/dist/setup-tests.js +1 -0
  390. package/dist/vscode.css-custom-data.json +6 -0
  391. package/dist/vscode.html-custom-data.json +421 -0
  392. package/dist/web-types.json +949 -0
  393. package/package.json +88 -32
  394. package/dist/index.d.ts +0 -18
  395. package/dist/index.js +0 -6832
  396. package/dist/index.js.map +0 -7
@@ -0,0 +1,282 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { isServer } from 'lit';
8
+ import { property } from 'lit/decorators.js';
9
+ import BaseElement from './base-element.js';
10
+ import { CustomErrorValidator } from './custom-error-validator.js';
11
+ import { WInvalidEvent } from './invalid';
12
+ // setFormValue omitted so that we can use `setValue`
13
+ export class BaseFormAssociatedElement extends BaseElement {
14
+ static { this.formAssociated = true; }
15
+ /**
16
+ * Validators are static because they have `observedAttributes`, essentially attributes to "watch"
17
+ * for changes. Whenever these attributes change, we want to be notified and update the validator.
18
+ */
19
+ static get validators() {
20
+ return [CustomErrorValidator()];
21
+ }
22
+ // Append all Validator "observedAttributes" into the "observedAttributes" so they can run.
23
+ static get observedAttributes() {
24
+ const parentAttrs = new Set(super.observedAttributes || []);
25
+ for (const validator of this.validators) {
26
+ if (!validator.observedAttributes) {
27
+ continue;
28
+ }
29
+ for (const attr of validator.observedAttributes) {
30
+ parentAttrs.add(attr);
31
+ }
32
+ }
33
+ return [...parentAttrs];
34
+ }
35
+ constructor() {
36
+ super();
37
+ // Form attributes
38
+ /** The name of the input, submitted as a name/value pair with form data. */
39
+ this.name = null;
40
+ /** Disables the form control. */
41
+ this.disabled = false;
42
+ this.required = false;
43
+ this.assumeInteractionOn = ['input'];
44
+ this.validators = [];
45
+ // Should these be private?
46
+ this.valueHasChanged = false;
47
+ this.hasInteracted = false;
48
+ // This works around a limitation in Safari. It is a hacky way for us to preserve custom errors generated by the user.
49
+ this.customError = null;
50
+ this.emittedEvents = [];
51
+ this.emitInvalid = (e) => {
52
+ if (e.target !== this)
53
+ return;
54
+ // An "invalid" event counts as interacted, this is usually triggered by a button "submitting"
55
+ this.hasInteracted = true;
56
+ this.dispatchEvent(new WInvalidEvent());
57
+ };
58
+ this.handleInteraction = (event) => {
59
+ const emittedEvents = this.emittedEvents;
60
+ if (!emittedEvents.includes(event.type)) {
61
+ emittedEvents.push(event.type);
62
+ }
63
+ // Mark it as user-interacted as soon as all associated events have been emitted
64
+ if (emittedEvents.length === this.assumeInteractionOn?.length) {
65
+ this.hasInteracted = true;
66
+ }
67
+ };
68
+ if (!isServer) {
69
+ this.addEventListener('invalid', this.emitInvalid);
70
+ }
71
+ }
72
+ connectedCallback() {
73
+ super.connectedCallback();
74
+ this.updateValidity();
75
+ // Lazily evaluate after the constructor to allow people to override the `assumeInteractionOn`
76
+ this.assumeInteractionOn.forEach((event) => {
77
+ this.addEventListener(event, this.handleInteraction);
78
+ });
79
+ }
80
+ firstUpdated(...args) {
81
+ super.firstUpdated(...args);
82
+ this.updateValidity();
83
+ }
84
+ willUpdate(changedProperties) {
85
+ if (!isServer && changedProperties.has('customError')) {
86
+ // We use null because it we really don't want it to show up in the attributes because `custom-error` does reflect
87
+ if (!this.customError) {
88
+ this.customError = null;
89
+ }
90
+ this.setCustomValidity(this.customError || '');
91
+ }
92
+ if (changedProperties.has('value') || changedProperties.has('disabled')) {
93
+ // @ts-expect-error Some components will use an accessors, other use a property, so we don't want to limit them.
94
+ const value = this.value;
95
+ // Accounts for the snowflake case on `<wa-select>`
96
+ if (Array.isArray(value)) {
97
+ if (this.name) {
98
+ const formData = new FormData();
99
+ for (const val of value) {
100
+ formData.append(this.name, val);
101
+ }
102
+ this.setValue(formData, formData);
103
+ }
104
+ }
105
+ else {
106
+ this.setValue(value, value);
107
+ }
108
+ }
109
+ if (changedProperties.has('disabled')) {
110
+ this.customStates.set('disabled', this.disabled);
111
+ if (this.hasAttribute('disabled') || (!isServer && !this.matches(':disabled'))) {
112
+ this.toggleAttribute('disabled', this.disabled);
113
+ }
114
+ }
115
+ this.updateValidity();
116
+ super.willUpdate(changedProperties);
117
+ }
118
+ get labels() {
119
+ return this.internals.labels;
120
+ }
121
+ getForm() {
122
+ return this.internals.form;
123
+ }
124
+ get validity() {
125
+ return this.internals.validity;
126
+ }
127
+ // Not sure if this supports `novalidate`. Will need to test.
128
+ get willValidate() {
129
+ return this.internals.willValidate;
130
+ }
131
+ get validationMessage() {
132
+ return this.internals.validationMessage;
133
+ }
134
+ checkValidity() {
135
+ this.updateValidity();
136
+ return this.internals.checkValidity();
137
+ }
138
+ reportValidity() {
139
+ this.updateValidity();
140
+ // This seems reasonable. `reportValidity()` is kind of like "we expect you to have interacted"
141
+ this.hasInteracted = true;
142
+ return this.internals.reportValidity();
143
+ }
144
+ /**
145
+ * Override this to change where constraint validation popups are anchored.
146
+ */
147
+ get validationTarget() {
148
+ return (this.input || undefined);
149
+ }
150
+ setValidity(...args) {
151
+ const flags = args[0];
152
+ const message = args[1];
153
+ let anchor = args[2];
154
+ if (!anchor) {
155
+ anchor = this.validationTarget;
156
+ }
157
+ this.internals.setValidity(flags, message, anchor || undefined);
158
+ this.requestUpdate('validity');
159
+ this.setCustomStates();
160
+ }
161
+ setCustomStates() {
162
+ const required = Boolean(this.required);
163
+ const isValid = this.internals.validity.valid;
164
+ const hasInteracted = this.hasInteracted;
165
+ this.customStates.set('required', required);
166
+ this.customStates.set('optional', !required);
167
+ this.customStates.set('invalid', !isValid);
168
+ this.customStates.set('valid', isValid);
169
+ this.customStates.set('user-invalid', !isValid && hasInteracted);
170
+ this.customStates.set('user-valid', isValid && hasInteracted);
171
+ }
172
+ /**
173
+ * Do not use this when creating a "Validator". This is intended for end users of components.
174
+ * We track manually defined custom errors so we don't clear them on accident in our validators.
175
+ *
176
+ */
177
+ setCustomValidity(message) {
178
+ if (!message) {
179
+ // We use null because it we really don't want it to show up in the attributes because `custom-error` does reflect
180
+ this.customError = null;
181
+ this.setValidity({});
182
+ return;
183
+ }
184
+ this.customError = message;
185
+ this.setValidity({ customError: true }, message, this.validationTarget);
186
+ }
187
+ formResetCallback() {
188
+ this.resetValidity();
189
+ this.hasInteracted = false;
190
+ this.valueHasChanged = false;
191
+ this.emittedEvents = [];
192
+ this.updateValidity();
193
+ }
194
+ formDisabledCallback(isDisabled) {
195
+ this.disabled = isDisabled;
196
+ this.updateValidity();
197
+ }
198
+ /**
199
+ * Called when the browser is trying to restore element’s state to state in which case reason is "restore", or when
200
+ * the browser is trying to fulfill autofill on behalf of user in which case reason is "autocomplete". In the case of
201
+ * "restore", state is a string, File, or FormData object previously set as the second argument to setFormValue.
202
+ */
203
+ formStateRestoreCallback(state, reason) {
204
+ // @ts-expect-error We purposely do not have a value property. It makes things hard to extend.
205
+ this.value = state;
206
+ if (reason === 'restore') {
207
+ this.resetValidity();
208
+ }
209
+ this.updateValidity();
210
+ }
211
+ setValue(...args) {
212
+ const [value, state] = args;
213
+ this.internals.setFormValue(value, state);
214
+ }
215
+ get allValidators() {
216
+ const staticValidators = this.constructor.validators || [];
217
+ const validators = this.validators || [];
218
+ return [...staticValidators, ...validators];
219
+ }
220
+ /**
221
+ * Reset validity is a way of removing manual custom errors and native validation.
222
+ */
223
+ resetValidity() {
224
+ this.setCustomValidity('');
225
+ this.setValidity({});
226
+ }
227
+ updateValidity() {
228
+ if (this.disabled ||
229
+ this.hasAttribute('disabled') ||
230
+ !this.willValidate //
231
+ ) {
232
+ this.resetValidity();
233
+ return;
234
+ }
235
+ const validators = this.allValidators;
236
+ if (!validators?.length) {
237
+ // If there's no validators, we do nothing. We also don't want to mess with custom errors, so we just stop here.
238
+ return;
239
+ }
240
+ const flags = {
241
+ // Don't trust custom errors from the Browser. Safari breaks the spec.
242
+ customError: Boolean(this.customError),
243
+ };
244
+ const formControl = this.validationTarget || this.input || undefined;
245
+ let finalMessage = '';
246
+ for (const validator of validators) {
247
+ const { isValid, message, invalidKeys } = validator.checkValidity(this);
248
+ if (isValid) {
249
+ continue;
250
+ }
251
+ if (!finalMessage) {
252
+ finalMessage = message;
253
+ }
254
+ if (invalidKeys?.length >= 0) {
255
+ invalidKeys.forEach((str) => (flags[str] = true));
256
+ }
257
+ }
258
+ // This is a workaround for preserving custom errors
259
+ if (!finalMessage) {
260
+ finalMessage = this.validationMessage;
261
+ }
262
+ this.setValidity(flags, finalMessage, formControl);
263
+ }
264
+ }
265
+ __decorate([
266
+ property({ reflect: true })
267
+ ], BaseFormAssociatedElement.prototype, "name", void 0);
268
+ __decorate([
269
+ property({ type: Boolean })
270
+ ], BaseFormAssociatedElement.prototype, "disabled", void 0);
271
+ __decorate([
272
+ property({ state: true, attribute: false })
273
+ ], BaseFormAssociatedElement.prototype, "valueHasChanged", void 0);
274
+ __decorate([
275
+ property({ state: true, attribute: false })
276
+ ], BaseFormAssociatedElement.prototype, "hasInteracted", void 0);
277
+ __decorate([
278
+ property({ attribute: 'custom-error', reflect: true })
279
+ ], BaseFormAssociatedElement.prototype, "customError", void 0);
280
+ __decorate([
281
+ property({ attribute: false, state: true, type: Object })
282
+ ], BaseFormAssociatedElement.prototype, "validity", null);
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,12 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ box-sizing: border-box !important;
5
+ }
6
+
7
+ :host *,
8
+ :host *::before,
9
+ :host *::after {
10
+ box-sizing: inherit !important;
11
+ }
12
+ `;
@@ -0,0 +1,8 @@
1
+ import { WRadio } from './radio';
2
+ import { WRadioGroup } from './radio-group';
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ 'w-radio': WRadio;
6
+ 'w-radio-group': WRadioGroup;
7
+ }
8
+ }
@@ -0,0 +1,272 @@
1
+ var O=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var V=s=>{throw TypeError(s)};var l=(s,r,t,e)=>{for(var a=e>1?void 0:e?B(r,t):r,i=s.length-1,o;i>=0;i--)(o=s[i])&&(a=(e?o(r,t,a):o(a))||a);return e&&a&&O(r,t,a),a};var x=(s,r,t)=>r.has(s)||V("Cannot "+t);var C=(s,r,t)=>(x(s,r,"read from private field"),t?t.call(s):r.get(s)),S=(s,r,t)=>r.has(s)?V("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(s):r.set(s,t),A=(s,r,t,e)=>(x(s,r,"write to private field"),e?e.call(s,t):r.set(s,t),t);import{html as j}from"lit";import{property as y,state as M}from"lit/decorators.js";import{isServer as k}from"lit";import{property as b}from"lit/decorators.js";import{LitElement as $,unsafeCSS as _}from"lit";import{property as T}from"lit/decorators.js";import{css as P}from"lit";var R=P`
2
+ :host {
3
+ box-sizing: border-box !important;
4
+ }
5
+
6
+ :host *,
7
+ :host *::before,
8
+ :host *::after {
9
+ box-sizing: inherit !important;
10
+ }
11
+ `;var v,p=class extends ${constructor(){super();S(this,v,!1);this.initialReflectedProperties=new Map;this.customStates={set:(t,e)=>{var a;(a=this.internals)!=null&&a.states&&(e?this.internals.states.add(t):this.internals.states.delete(t))},has:t=>{var e;return(e=this.internals)!=null&&e.states?this.internals.states.has(t):!1}};try{this.internals=this.attachInternals()}catch(e){console.error("Element internals are not supported in your browser. Consider using a polyfill")}this.customStates.set("wa-defined",!0);let t=this.constructor;for(let[e,a]of t.elementProperties)a.default==="inherit"&&a.initial!==void 0&&typeof e=="string"&&this.customStates.set(`initial-${e}-${a.initial}`,!0)}static get styles(){let t=Array.isArray(this.css)?this.css:this.css?[this.css]:[];return[R,...t].map(e=>typeof e=="string"?_(e):e)}attributeChangedCallback(t,e,a){C(this,v)||(this.constructor.elementProperties.forEach((i,o)=>{i.reflect&&this[o]!=null&&this.initialReflectedProperties.set(o,this[o])}),A(this,v,!0)),super.attributeChangedCallback(t,e,a)}willUpdate(t){super.willUpdate(t),this.initialReflectedProperties.forEach((e,a)=>{t.has(a)&&this[a]==null&&(this[a]=e)})}relayNativeEvent(t,e){t.stopImmediatePropagation(),this.dispatchEvent(new t.constructor(t.type,{...t,...e}))}};v=new WeakMap,l([T()],p.prototype,"dir",2),l([T()],p.prototype,"lang",2);var L=()=>({observedAttributes:["custom-error"],checkValidity(s){let r={message:"",isValid:!0,invalidKeys:[]};return s.customError&&(r.message=s.customError,r.isValid=!1,r.invalidKeys=["customError"]),r}});var w=class extends Event{constructor(){super("w-invalid",{bubbles:!0,cancelable:!1,composed:!0})}};var c=class extends p{constructor(){super();this.name=null;this.disabled=!1;this.required=!1;this.assumeInteractionOn=["input"];this.validators=[];this.valueHasChanged=!1;this.hasInteracted=!1;this.customError=null;this.emittedEvents=[];this.emitInvalid=t=>{t.target===this&&(this.hasInteracted=!0,this.dispatchEvent(new w))};this.handleInteraction=t=>{var a;let e=this.emittedEvents;e.includes(t.type)||e.push(t.type),e.length===((a=this.assumeInteractionOn)==null?void 0:a.length)&&(this.hasInteracted=!0)};k||this.addEventListener("invalid",this.emitInvalid)}static get validators(){return[L()]}static get observedAttributes(){let t=new Set(super.observedAttributes||[]);for(let e of this.validators)if(e.observedAttributes)for(let a of e.observedAttributes)t.add(a);return[...t]}connectedCallback(){super.connectedCallback(),this.updateValidity(),this.assumeInteractionOn.forEach(t=>{this.addEventListener(t,this.handleInteraction)})}firstUpdated(...t){super.firstUpdated(...t),this.updateValidity()}willUpdate(t){if(!k&&t.has("customError")&&(this.customError||(this.customError=null),this.setCustomValidity(this.customError||"")),t.has("value")||t.has("disabled")){let e=this.value;if(Array.isArray(e)){if(this.name){let a=new FormData;for(let i of e)a.append(this.name,i);this.setValue(a,a)}}else this.setValue(e,e)}t.has("disabled")&&(this.customStates.set("disabled",this.disabled),(this.hasAttribute("disabled")||!k&&!this.matches(":disabled"))&&this.toggleAttribute("disabled",this.disabled)),this.updateValidity(),super.willUpdate(t)}get labels(){return this.internals.labels}getForm(){return this.internals.form}get validity(){return this.internals.validity}get willValidate(){return this.internals.willValidate}get validationMessage(){return this.internals.validationMessage}checkValidity(){return this.updateValidity(),this.internals.checkValidity()}reportValidity(){return this.updateValidity(),this.hasInteracted=!0,this.internals.reportValidity()}get validationTarget(){return this.input||void 0}setValidity(...t){let e=t[0],a=t[1],i=t[2];i||(i=this.validationTarget),this.internals.setValidity(e,a,i||void 0),this.requestUpdate("validity"),this.setCustomStates()}setCustomStates(){let t=!!this.required,e=this.internals.validity.valid,a=this.hasInteracted;this.customStates.set("required",t),this.customStates.set("optional",!t),this.customStates.set("invalid",!e),this.customStates.set("valid",e),this.customStates.set("user-invalid",!e&&a),this.customStates.set("user-valid",e&&a)}setCustomValidity(t){if(!t){this.customError=null,this.setValidity({});return}this.customError=t,this.setValidity({customError:!0},t,this.validationTarget)}formResetCallback(){this.resetValidity(),this.hasInteracted=!1,this.valueHasChanged=!1,this.emittedEvents=[],this.updateValidity()}formDisabledCallback(t){this.disabled=t,this.updateValidity()}formStateRestoreCallback(t,e){this.value=t,e==="restore"&&this.resetValidity(),this.updateValidity()}setValue(...t){let[e,a]=t;this.internals.setFormValue(e,a)}get allValidators(){let t=this.constructor.validators||[],e=this.validators||[];return[...t,...e]}resetValidity(){this.setCustomValidity(""),this.setValidity({})}updateValidity(){if(this.disabled||this.hasAttribute("disabled")||!this.willValidate){this.resetValidity();return}let t=this.allValidators;if(!(t!=null&&t.length))return;let e={customError:!!this.customError},a=this.validationTarget||this.input||void 0,i="";for(let o of t){let{isValid:n,message:g,invalidKeys:h}=o.checkValidity(this);n||(i||(i=g),(h==null?void 0:h.length)>=0&&h.forEach(f=>e[f]=!0))}i||(i=this.validationMessage),this.setValidity(e,i,a)}};c.formAssociated=!0,l([b({reflect:!0})],c.prototype,"name",2),l([b({type:Boolean})],c.prototype,"disabled",2),l([b({state:!0,attribute:!1})],c.prototype,"valueHasChanged",2),l([b({state:!0,attribute:!1})],c.prototype,"hasInteracted",2),l([b({attribute:"custom-error",reflect:!0})],c.prototype,"customError",2),l([b({attribute:!1,state:!0,type:Object})],c.prototype,"validity",1);import{css as K}from"lit";var I=K`
12
+ :host {
13
+ color: var(--wa-form-control-value-color);
14
+ display: inline-flex;
15
+ flex-direction: row;
16
+ align-items: top;
17
+ font-family: inherit;
18
+ font-weight: var(--wa-form-control-value-font-weight);
19
+ line-height: var(--wa-form-control-value-line-height);
20
+ cursor: pointer;
21
+ user-select: none;
22
+ -webkit-user-select: none;
23
+ }
24
+
25
+ :host(:focus) {
26
+ outline: none;
27
+ }
28
+
29
+ [part~='label'] {
30
+ display: inline;
31
+ }
32
+
33
+ [part~='hint'] {
34
+ margin-block-start: 0.5em;
35
+ }
36
+
37
+ /* Default appearance */
38
+ :host([appearance='default']) {
39
+ .control {
40
+ flex: 0 0 auto;
41
+ position: relative;
42
+ display: inline-flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ width: var(--wa-form-control-toggle-size, 2rem);
46
+ height: var(--wa-form-control-toggle-size, 2rem);
47
+ border-color: var(--wa-form-control-border-color, gray);
48
+ border-radius: 50%;
49
+ border-style: var(--wa-form-control-border-style, solid);
50
+ border-width: var(--wa-form-control-border-width, 1px);
51
+ background-color: var(--wa-form-control-background-color, white);
52
+ color: transparent;
53
+ transition-property: all;
54
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
55
+ transition-duration: 150ms;
56
+
57
+ margin-inline-end: 0.5em;
58
+ }
59
+ }
60
+
61
+ :host([appearance='clickable']) .control {
62
+ position: absolute;
63
+ inset: 0;
64
+ height: 100%;
65
+ width: 100%;
66
+ cursor: pointer;
67
+ }
68
+
69
+ /* Checked */
70
+ :host(:state(checked)):not(:host([appearance='clickable'])) .control {
71
+ /* color: var(--checked-icon-color, white); */
72
+ border-color: var(--wa-form-control-activated-color, blue);
73
+ background-color: var(--wa-form-control-background-color, white);
74
+ border-width: 0.6rem;
75
+ }
76
+
77
+ /* Focus */
78
+ :host(:focus-visible) .control {
79
+ outline: 2px solid var(--w-s-color-border-focus);
80
+ outline-offset: var(--w-outline-offset, 1px);
81
+ }
82
+
83
+ :host([appearance='clickable']:focus-visible) .control {
84
+ outline-offset: -4px;
85
+ border-radius: 8px;
86
+ }
87
+
88
+ /* Disabled */
89
+ :host(:state(disabled)) {
90
+ opacity: 0.5;
91
+ cursor: not-allowed;
92
+ }
93
+
94
+ /* Button appearance */
95
+ :host([appearance='button']) {
96
+ align-items: center;
97
+ min-height: var(--wa-form-control-height);
98
+ background-color: var(--wa-color-surface-default);
99
+ border: var(--wa-form-control-border-width) var(--wa-form-control-border-style) var(--wa-form-control-border-color);
100
+ border-radius: var(--wa-border-radius-m);
101
+ padding: 0 var(--wa-form-control-padding-inline);
102
+ transition:
103
+ background-color var(--wa-transition-fast),
104
+ border-color var(--wa-transition-fast);
105
+
106
+ .control {
107
+ display: none;
108
+ }
109
+ }
110
+
111
+ /* Horizontal grouping - remove inner border radius */
112
+ :host([appearance='button'][data-wa-radio-horizontal][data-wa-radio-inner]) {
113
+ border-radius: 0;
114
+ }
115
+
116
+ :host([appearance='button'][data-wa-radio-horizontal][data-wa-radio-first]) {
117
+ border-start-end-radius: 0;
118
+ border-end-end-radius: 0;
119
+ }
120
+
121
+ :host([appearance='button'][data-wa-radio-horizontal][data-wa-radio-last]) {
122
+ border-start-start-radius: 0;
123
+ border-end-start-radius: 0;
124
+ }
125
+
126
+ /* Vertical grouping - remove inner border radius */
127
+ :host([appearance='button'][data-wa-radio-vertical][data-wa-radio-inner]) {
128
+ border-radius: 0;
129
+ }
130
+
131
+ :host([appearance='button'][data-wa-radio-vertical][data-wa-radio-first]) {
132
+ border-end-start-radius: 0;
133
+ border-end-end-radius: 0;
134
+ }
135
+
136
+ :host([appearance='button'][data-wa-radio-vertical][data-wa-radio-last]) {
137
+ border-start-start-radius: 0;
138
+ border-start-end-radius: 0;
139
+ }
140
+
141
+ @media (hover: hover) {
142
+ :host([appearance='button']:hover:not(:state(disabled), :state(checked))) {
143
+ background-color: color-mix(in srgb, var(--wa-color-surface-default) 95%, var(--wa-color-mix-hover));
144
+ }
145
+ }
146
+
147
+ :host([appearance='button']:focus-visible) {
148
+ outline: var(--wa-focus-ring);
149
+ outline-offset: var(--wa-focus-ring-offset);
150
+ }
151
+
152
+ :host([appearance='button']:state(checked)) {
153
+ border-color: var(--wa-form-control-activated-color);
154
+ background-color: var(--wa-color-brand-fill-quiet);
155
+ }
156
+
157
+ :host([appearance='button']:state(checked):focus-visible) {
158
+ outline: var(--wa-focus-ring-style) var(--wa-focus-ring-width) var(--wa-color-brand-border-loud);
159
+ outline-offset: var(--wa-focus-ring-offset);
160
+ }
161
+
162
+ /* Remove inner borders and handle overlap */
163
+ :host([appearance='button'][data-wa-radio-horizontal]:not([data-wa-radio-first])) {
164
+ margin-inline-start: calc(-1 * var(--wa-form-control-border-width));
165
+ }
166
+
167
+ :host([appearance='button'][data-wa-radio-vertical]:not([data-wa-radio-first])) {
168
+ margin-block-start: calc(-1 * var(--wa-form-control-border-width));
169
+ }
170
+
171
+ /* Ensure interactive states are visible above adjacent buttons */
172
+ :host([appearance='button']:hover),
173
+ :host([appearance='button']:state(checked)) {
174
+ position: relative;
175
+ z-index: 1;
176
+ }
177
+
178
+ :host([appearance='button']:focus-visible) {
179
+ z-index: 2;
180
+ }
181
+ `;var u=class extends c{constructor(){super();this.checked=!1;this.forceDisabled=!1;this.form=null;this.appearance="default";this.size="medium";this.disabled=!1;this.handleClick=()=>{!this.disabled&&!this.forceDisabled&&(this.checked=!0)};this.addEventListener("click",this.handleClick)}connectedCallback(){super.connectedCallback(),this.setInitialAttributes()}setInitialAttributes(){this.setAttribute("role","radio"),this.tabIndex=0,this.setAttribute("aria-disabled",this.disabled||this.forceDisabled?"true":"false")}updated(t){if(super.updated(t),t.has("checked")&&(this.customStates.set("checked",this.checked),this.setAttribute("aria-checked",this.checked?"true":"false"),!this.disabled&&!this.forceDisabled&&(this.tabIndex=this.checked?0:-1)),t.has("disabled")||t.has("forceDisabled")){let e=this.disabled||this.forceDisabled;this.customStates.set("disabled",e),this.setAttribute("aria-disabled",e?"true":"false"),e?this.tabIndex=-1:this.tabIndex=this.checked?0:-1}}setValue(){}render(){return j`
182
+ <span part="control" class="control"></span>
183
+ <slot part="label" class="label"></slot>
184
+ `}};u.css=[I],l([M()],u.prototype,"checked",2),l([M()],u.prototype,"forceDisabled",2),l([y({reflect:!0})],u.prototype,"form",2),l([y({reflect:!0})],u.prototype,"value",2),l([y({reflect:!0})],u.prototype,"appearance",2),l([y({reflect:!0})],u.prototype,"size",2),l([y({type:Boolean})],u.prototype,"disabled",2);import{html as J}from"lit";import{property as m,query as Q,state as U}from"lit/decorators.js";import{classMap as F}from"lit/directives/class-map.js";var H="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var D=(s=21)=>{let r="",t=crypto.getRandomValues(new Uint8Array(s|=0));for(;s--;)r+=H[t[s]&63];return r};function q(s=""){return`${s}${D()}`}import{css as X}from"lit";var N=X`
185
+ :host {
186
+ display: block;
187
+ }
188
+
189
+ .form-control {
190
+ position: relative;
191
+ border: none;
192
+ padding: 0;
193
+ margin: 0;
194
+ }
195
+
196
+ .label {
197
+ font-size: var(--w-font-size-s);
198
+ line-height: var(--w-line-height-s);
199
+ font-weight: 700;
200
+ -webkit-font-smoothing: antialiased;
201
+ -moz-osx-font-smoothing: grayscale;
202
+ font-smoothing: grayscale;
203
+ cursor: pointer;
204
+ padding-bottom: 0.4rem;
205
+ color: var(--w-s-color-text);
206
+ display: block;
207
+ }
208
+
209
+ .radio-group-required .label::after {
210
+ content: var(--wa-form-control-required-content);
211
+ margin-inline-start: var(--wa-form-control-required-content-offset);
212
+ }
213
+
214
+ .button-group {
215
+ display: flex;
216
+ }
217
+
218
+ [part~='form-control-input'] {
219
+ display: flex;
220
+ flex-direction: column;
221
+ flex-wrap: wrap;
222
+ gap: 0.75em;
223
+ }
224
+
225
+ /* Horizontal */
226
+ :host([orientation='horizontal']) [part~='form-control-input'] {
227
+ flex-direction: row;
228
+ gap: 1em;
229
+ }
230
+
231
+ /* Help text */
232
+ [part~='hint'] {
233
+ margin-block-start: 0.5em;
234
+ }
235
+
236
+ /* Radios have the "button" appearance */
237
+ :host fieldset.has-radio-buttons {
238
+ [part~='form-control-input'] {
239
+ gap: 0;
240
+ }
241
+ }
242
+ `;var z=(s={})=>{let{validationElement:r,validationProperty:t}=s;r||(r=Object.assign(document.createElement("input"),{required:!0})),t||(t="value");let e={observedAttributes:["required"],message:r.validationMessage,checkValidity(a){var h;let i={message:"",isValid:!0,invalidKeys:[]};return((h=a.required)!=null?h:a.hasAttribute("required"))&&!a[t]&&(i.message=typeof e.message=="function"?e.message(a):e.message||"",i.isValid=!1,i.invalidKeys.push("valueMissing")),i}};return e};var E=class{constructor(r,...t){this.slotNames=[];this.handleSlotChange=r=>{let t=r.target;(this.slotNames.includes("[default]")&&!t.name||t.name&&this.slotNames.includes(t.name))&&this.host.requestUpdate()};(this.host=r).addController(this),this.slotNames=t}hasDefaultSlot(){return[...this.host.childNodes].some(r=>{if(r.nodeType===Node.TEXT_NODE&&r.textContent.trim()!=="")return!0;if(r.nodeType===Node.ELEMENT_NODE){let t=r;if(t.tagName.toLowerCase()==="w-visually-hidden")return!1;if(!t.hasAttribute("slot"))return!0}return!1})}hasNamedSlot(r){return this.host.querySelector(`:scope > [slot="${r}"]`)!==null}test(r){return r==="[default]"?this.hasDefaultSlot():this.hasNamedSlot(r)}hostConnected(){this.host.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}hostDisconnected(){this.host.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}};var d=class extends c{constructor(){super();this.hasSlotController=new E(this,"hint","label");this.hasRadioButtons=!1;this.label="";this.hint="";this.name=null;this.disabled=!1;this.orientation="vertical";this._value=null;this.defaultValue=this.getAttribute("value")||null;this.size="medium";this.required=!1;this.withLabel=!1;this.withHint=!1;this.handleRadioClick=t=>{let e=t.target.closest("w-radio");if(!e||e.disabled||e.forceDisabled||this.disabled)return;let a=this.value;this.value=e.value,e.checked=!0;let i=this.getAllRadios();for(let o of i)e!==o&&(o.checked=!1,o.setAttribute("tabindex","-1"));this.value!==a&&this.updateComplete.then(()=>{this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})};this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("click",this.handleRadioClick)}static get validators(){let t=[z({validationElement:Object.assign(document.createElement("input"),{required:!0,type:"radio",name:q("__w-radio")})})];return[...super.validators,...t]}get value(){var t;return this.valueHasChanged?this._value:(t=this._value)!=null?t:this.defaultValue}set value(t){typeof t=="number"&&(t=String(t)),this.valueHasChanged=!0,this._value=t}get validationTarget(){let t=this.querySelector(":is(w-radio):not([disabled])");if(t)return t}updated(t){(t.has("disabled")||t.has("value"))&&this.syncRadioElements()}formResetCallback(...t){this.value=this.defaultValue,super.formResetCallback(...t),this.syncRadioElements()}getAllRadios(){return[...this.querySelectorAll("w-radio")]}handleLabelClick(){this.focus()}async syncRadioElements(){let t=this.getAllRadios(),e=!1;if(t.forEach((a,i)=>{a.appearance==="button"&&(e=!0),a.setAttribute("size",this.size),a.toggleAttribute("data-w-radio-horizontal",this.orientation!=="vertical"),a.toggleAttribute("data-w-radio-vertical",this.orientation==="vertical"),a.toggleAttribute("data-w-radio-first",i===0),a.toggleAttribute("data-w-radio-inner",i!==0&&i!==t.length-1),a.toggleAttribute("data-w-radio-last",i===t.length-1),a.forceDisabled=this.disabled}),this.hasRadioButtons=e,await Promise.all(t.map(async a=>{await a.updateComplete,!a.disabled&&a.value===this.value?a.checked=!0:a.checked=!1})),this.disabled)t.forEach(a=>{a.tabIndex=-1});else{let a=t.filter(o=>!o.disabled),i=a.find(o=>o.checked);a.length>0&&(i?a.forEach(o=>{o.tabIndex=o.checked?0:-1}):a.forEach((o,n)=>{o.tabIndex=n===0?0:-1})),t.filter(o=>o.disabled).forEach(o=>{o.tabIndex=-1})}}handleKeyDown(t){var h;if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," "].includes(t.key)||this.disabled)return;let e=this.getAllRadios().filter(f=>!f.disabled);if(e.length<=0)return;t.preventDefault();let a=this.value,i=(h=e.find(f=>f.checked))!=null?h:e[0],o=t.key===" "?0:["ArrowUp","ArrowLeft"].includes(t.key)?-1:1,n=e.indexOf(i)+o;n||(n=0),n<0&&(n=e.length-1),n>e.length-1&&(n=0);let g=e.some(f=>f.tagName.toLowerCase()==="w-radio-button");this.getAllRadios().forEach(f=>{f.checked=!1,g||f.setAttribute("tabindex","-1")}),this.value=e[n].value,e[n].checked=!0,g?e[n].shadowRoot.querySelector("button").focus():(e[n].setAttribute("tabindex","0"),e[n].focus()),this.value!==a&&this.updateComplete.then(()=>{this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),t.preventDefault()}focus(t){if(this.disabled)return;let e=this.getAllRadios(),a=e.find(n=>n.checked),i=e.find(n=>!n.disabled),o=a||i;o&&o.focus(t)}render(){let t=this.hasUpdated?this.hasSlotController.test("label"):this.withLabel,e=this.hasUpdated?this.hasSlotController.test("hint"):this.withHint,a=this.label?!0:!!t,i=this.hint?!0:!!e;return J`
243
+ <fieldset
244
+ part="form-control"
245
+ class=${F({"form-control":!0,"form-control-radio-group":!0,"form-control-has-label":a,"has-radio-buttons":this.hasRadioButtons})}
246
+ role="radiogroup"
247
+ aria-labelledby="label"
248
+ aria-describedby="hint"
249
+ aria-errormessage="error-message"
250
+ aria-orientation=${this.orientation}>
251
+ <label
252
+ part="form-control-label"
253
+ id="label"
254
+ class="label"
255
+ aria-hidden=${a?"false":"true"}
256
+ @click=${this.handleLabelClick}>
257
+ <slot name="label">${this.label}</slot>
258
+ </label>
259
+
260
+ <slot part="form-control-input" @slotchange=${this.syncRadioElements}></slot>
261
+
262
+ <slot
263
+ id="hint"
264
+ name="hint"
265
+ part="hint"
266
+ class=${F({"has-slotted":i})}
267
+ aria-hidden=${i?"false":"true"}
268
+ >${this.hint}</slot
269
+ >
270
+ </fieldset>
271
+ `}};d.css=[N],d.shadowRootOptions={...c.shadowRootOptions,delegatesFocus:!0},l([U()],d.prototype,"hasRadioButtons",2),l([Q("slot:not([name])")],d.prototype,"defaultSlot",2),l([m()],d.prototype,"label",2),l([m({attribute:"hint"})],d.prototype,"hint",2),l([m({reflect:!0})],d.prototype,"name",2),l([m({type:Boolean,reflect:!0})],d.prototype,"disabled",2),l([m({reflect:!0})],d.prototype,"orientation",2),l([U()],d.prototype,"value",1),l([m({attribute:"value",reflect:!0})],d.prototype,"defaultValue",2),l([m({reflect:!0})],d.prototype,"size",2),l([m({type:Boolean,reflect:!0})],d.prototype,"required",2),l([m({type:Boolean,attribute:"with-label"})],d.prototype,"withLabel",2),l([m({type:Boolean,attribute:"with-hint"})],d.prototype,"withHint",2);customElements.get("w-radio")||(customElements.define("w-radio",u),customElements.define("w-radio-group",d));
272
+ //# sourceMappingURL=index.js.map