@warp-ds/elements 2.2.0-next.2 → 2.2.0-next.20

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 (452) hide show
  1. package/README.md +228 -28
  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 +7005 -0
  7. package/dist/index.d.ts +1826 -18
  8. package/dist/packages/affix/affix.stories.d.ts +10 -0
  9. package/dist/packages/affix/affix.stories.js +25 -0
  10. package/dist/packages/affix/affix.test.d.ts +1 -0
  11. package/dist/packages/affix/affix.test.js +9 -0
  12. package/dist/packages/affix/index.d.ts +47 -24
  13. package/dist/packages/affix/index.js +2448 -2240
  14. package/dist/packages/affix/index.js.map +4 -4
  15. package/dist/packages/affix/react.d.ts +2 -0
  16. package/dist/packages/affix/react.js +8 -0
  17. package/dist/packages/affix/styles.d.ts +1 -0
  18. package/dist/packages/affix/styles.js +2 -0
  19. package/dist/packages/alert/alert.stories.d.ts +15 -0
  20. package/dist/packages/alert/alert.stories.js +68 -0
  21. package/dist/packages/alert/alert.test.d.ts +1 -0
  22. package/dist/packages/alert/alert.test.js +16 -0
  23. package/dist/packages/alert/index.d.ts +22 -17
  24. package/dist/packages/alert/index.js +2452 -2446
  25. package/dist/packages/alert/index.js.map +4 -4
  26. package/dist/packages/alert/react.d.ts +2 -0
  27. package/dist/packages/alert/react.js +8 -0
  28. package/dist/packages/alert/styles.d.ts +1 -0
  29. package/dist/packages/alert/styles.js +2 -0
  30. package/dist/packages/attention/attention.stories.d.ts +15 -0
  31. package/dist/packages/attention/attention.stories.js +188 -0
  32. package/dist/packages/attention/attention.test.d.ts +1 -0
  33. package/dist/packages/attention/attention.test.js +11 -0
  34. package/dist/packages/attention/index.d.ts +62 -90
  35. package/dist/packages/attention/index.js +3360 -3984
  36. package/dist/packages/attention/index.js.map +4 -4
  37. package/dist/packages/attention/layout-styles.d.ts +1 -0
  38. package/dist/packages/attention/layout-styles.js +905 -0
  39. package/dist/packages/attention/locales/da/messages.mjs +1 -0
  40. package/dist/packages/attention/locales/en/messages.mjs +1 -0
  41. package/dist/packages/attention/locales/fi/messages.mjs +1 -0
  42. package/dist/packages/attention/locales/nb/messages.mjs +1 -0
  43. package/dist/packages/attention/locales/sv/messages.mjs +1 -0
  44. package/dist/packages/attention/react.d.ts +1 -0
  45. package/dist/packages/attention/react.js +9 -0
  46. package/dist/packages/attention/styles.d.ts +1 -0
  47. package/dist/packages/attention/styles.js +2 -0
  48. package/dist/packages/badge/badge.stories.d.ts +17 -0
  49. package/dist/packages/badge/badge.stories.js +68 -0
  50. package/dist/packages/badge/badge.test.d.ts +1 -0
  51. package/dist/packages/badge/badge.test.js +9 -0
  52. package/dist/packages/badge/index.d.ts +12 -11
  53. package/dist/packages/badge/index.js +2441 -300
  54. package/dist/packages/badge/index.js.map +4 -4
  55. package/dist/packages/badge/react.d.ts +2 -0
  56. package/dist/packages/badge/react.js +8 -0
  57. package/dist/packages/badge/styles.d.ts +1 -0
  58. package/dist/packages/badge/styles.js +2 -0
  59. package/dist/packages/box/box.stories.d.ts +14 -0
  60. package/dist/packages/box/box.stories.js +59 -0
  61. package/dist/packages/box/box.test.d.ts +1 -0
  62. package/dist/packages/box/box.test.js +9 -0
  63. package/dist/packages/box/index.d.ts +17 -20
  64. package/dist/packages/box/index.js +2443 -299
  65. package/dist/packages/box/index.js.map +4 -4
  66. package/dist/packages/box/react.d.ts +2 -0
  67. package/dist/packages/box/react.js +8 -0
  68. package/dist/packages/box/slot.test.d.ts +1 -0
  69. package/dist/packages/box/slot.test.js +9 -0
  70. package/dist/packages/box/styles.d.ts +1 -0
  71. package/dist/packages/box/styles.js +2 -0
  72. package/dist/packages/breadcrumbs/breadcrumbs.stories.d.ts +12 -0
  73. package/dist/packages/breadcrumbs/breadcrumbs.stories.js +60 -0
  74. package/dist/packages/breadcrumbs/breadcrumbs.test.d.ts +1 -0
  75. package/dist/packages/breadcrumbs/breadcrumbs.test.js +16 -0
  76. package/dist/packages/breadcrumbs/index.d.ts +19 -16
  77. package/dist/packages/breadcrumbs/index.js +2402 -2051
  78. package/dist/packages/breadcrumbs/index.js.map +4 -4
  79. package/dist/packages/breadcrumbs/locales/da/messages.mjs +1 -0
  80. package/dist/packages/breadcrumbs/locales/en/messages.mjs +1 -0
  81. package/dist/packages/breadcrumbs/locales/fi/messages.mjs +1 -0
  82. package/dist/packages/breadcrumbs/locales/nb/messages.mjs +1 -0
  83. package/dist/packages/breadcrumbs/locales/sv/messages.mjs +1 -0
  84. package/dist/packages/breadcrumbs/react.d.ts +2 -0
  85. package/dist/packages/breadcrumbs/react.js +8 -0
  86. package/dist/packages/breadcrumbs/styles.d.ts +1 -0
  87. package/dist/packages/breadcrumbs/styles.js +2 -0
  88. package/dist/packages/button/button.stories.d.ts +21 -0
  89. package/dist/packages/button/button.stories.js +119 -0
  90. package/dist/packages/button/button.test.d.ts +1 -0
  91. package/dist/packages/button/button.test.js +25 -0
  92. package/dist/packages/button/index.d.ts +106 -56
  93. package/dist/packages/button/index.js +2618 -2130
  94. package/dist/packages/button/index.js.map +4 -4
  95. package/dist/packages/button/locales/da/messages.mjs +1 -0
  96. package/dist/packages/button/locales/en/messages.mjs +1 -0
  97. package/dist/packages/button/locales/fi/messages.mjs +1 -0
  98. package/dist/packages/button/locales/nb/messages.mjs +1 -0
  99. package/dist/packages/button/locales/sv/messages.mjs +1 -0
  100. package/dist/packages/button/react.d.ts +2 -0
  101. package/dist/packages/button/react.js +8 -0
  102. package/dist/packages/button/styles.d.ts +1 -0
  103. package/dist/packages/button/styles.js +2 -0
  104. package/dist/packages/card/card.stories.d.ts +15 -0
  105. package/dist/packages/card/card.stories.js +82 -0
  106. package/dist/packages/card/card.test.d.ts +1 -0
  107. package/dist/packages/card/card.test.js +9 -0
  108. package/dist/packages/card/index.d.ts +28 -16
  109. package/dist/packages/card/index.js +2403 -2067
  110. package/dist/packages/card/index.js.map +4 -4
  111. package/dist/packages/card/locales/da/messages.mjs +1 -0
  112. package/dist/packages/card/locales/en/messages.mjs +1 -0
  113. package/dist/packages/card/locales/fi/messages.mjs +1 -0
  114. package/dist/packages/card/locales/nb/messages.mjs +1 -0
  115. package/dist/packages/card/locales/sv/messages.mjs +1 -0
  116. package/dist/packages/card/react.d.ts +2 -0
  117. package/dist/packages/card/react.js +8 -0
  118. package/dist/packages/card/styles.d.ts +1 -0
  119. package/dist/packages/card/styles.js +2 -0
  120. package/dist/packages/combobox/combobox.stories.d.ts +14 -0
  121. package/dist/packages/combobox/combobox.stories.js +95 -0
  122. package/dist/packages/combobox/index.d.ts +95 -0
  123. package/dist/packages/combobox/index.js +2492 -0
  124. package/dist/packages/combobox/index.js.map +7 -0
  125. package/dist/packages/combobox/locales/da/messages.d.mts +1 -0
  126. package/dist/packages/combobox/locales/da/messages.mjs +1 -0
  127. package/dist/packages/combobox/locales/en/messages.d.mts +1 -0
  128. package/dist/packages/combobox/locales/en/messages.mjs +1 -0
  129. package/dist/packages/combobox/locales/fi/messages.d.mts +1 -0
  130. package/dist/packages/combobox/locales/fi/messages.mjs +1 -0
  131. package/dist/packages/combobox/locales/nb/messages.d.mts +1 -0
  132. package/dist/packages/combobox/locales/nb/messages.mjs +1 -0
  133. package/dist/packages/combobox/locales/sv/messages.d.mts +1 -0
  134. package/dist/packages/combobox/locales/sv/messages.mjs +1 -0
  135. package/dist/packages/combobox/styles.d.ts +1 -0
  136. package/dist/packages/combobox/styles.js +2 -0
  137. package/dist/packages/datepicker/DatePicker.test.d.ts +1 -0
  138. package/dist/packages/datepicker/DatePicker.test.js +68 -0
  139. package/dist/packages/datepicker/datepicker.d.ts +102 -0
  140. package/dist/packages/datepicker/datepicker.js +2785 -0
  141. package/dist/packages/datepicker/datepicker.js.map +7 -0
  142. package/dist/packages/datepicker/datepicker.stories.d.ts +12 -0
  143. package/dist/packages/datepicker/datepicker.stories.js +51 -0
  144. package/dist/packages/datepicker/datepicker.test.d.ts +2 -0
  145. package/dist/packages/datepicker/datepicker.test.js +62 -0
  146. package/dist/packages/datepicker/index.d.ts +1 -0
  147. package/dist/packages/datepicker/index.js +2785 -0
  148. package/dist/packages/datepicker/index.js.map +7 -0
  149. package/dist/packages/datepicker/locales/da/messages.d.mts +1 -0
  150. package/dist/packages/datepicker/locales/da/messages.mjs +1 -0
  151. package/dist/packages/datepicker/locales/en/messages.d.mts +1 -0
  152. package/dist/packages/datepicker/locales/en/messages.mjs +1 -0
  153. package/dist/packages/datepicker/locales/fi/messages.d.mts +1 -0
  154. package/dist/packages/datepicker/locales/fi/messages.mjs +1 -0
  155. package/dist/packages/datepicker/locales/nb/messages.d.mts +1 -0
  156. package/dist/packages/datepicker/locales/nb/messages.mjs +1 -0
  157. package/dist/packages/datepicker/locales/sv/messages.d.mts +1 -0
  158. package/dist/packages/datepicker/locales/sv/messages.mjs +1 -0
  159. package/dist/packages/datepicker/react.d.ts +2 -0
  160. package/dist/packages/datepicker/react.js +8 -0
  161. package/dist/packages/datepicker/styles/w-datepicker-calendar.styles.d.ts +1 -0
  162. package/dist/packages/datepicker/styles/w-datepicker-calendar.styles.js +15 -0
  163. package/dist/packages/datepicker/styles/w-datepicker-day.styles.d.ts +1 -0
  164. package/dist/packages/datepicker/styles/w-datepicker-day.styles.js +64 -0
  165. package/dist/packages/datepicker/styles/w-datepicker-month.styles.d.ts +1 -0
  166. package/dist/packages/datepicker/styles/w-datepicker-month.styles.js +72 -0
  167. package/dist/packages/datepicker/styles/w-datepicker.styles.d.ts +1 -0
  168. package/dist/packages/datepicker/styles/w-datepicker.styles.js +101 -0
  169. package/dist/packages/datepicker/utils.d.ts +13 -0
  170. package/dist/packages/datepicker/utils.js +28 -0
  171. package/dist/packages/dead-toggle/dead-toggle.stories.d.ts +10 -0
  172. package/dist/packages/dead-toggle/dead-toggle.stories.js +23 -0
  173. package/dist/packages/dead-toggle/dead-toggle.test.d.ts +1 -0
  174. package/dist/packages/dead-toggle/dead-toggle.test.js +9 -0
  175. package/dist/packages/dead-toggle/index.d.ts +16 -0
  176. package/dist/packages/dead-toggle/index.js +2487 -0
  177. package/dist/packages/dead-toggle/index.js.map +7 -0
  178. package/dist/packages/dead-toggle/react.d.ts +2 -0
  179. package/dist/packages/dead-toggle/react.js +8 -0
  180. package/dist/packages/expandable/expandable.stories.d.ts +19 -0
  181. package/dist/packages/expandable/expandable.stories.js +133 -0
  182. package/dist/packages/expandable/expandable.test.d.ts +1 -0
  183. package/dist/packages/expandable/expandable.test.js +24 -0
  184. package/dist/packages/expandable/index.d.ts +52 -50
  185. package/dist/packages/expandable/index.js +2424 -2286
  186. package/dist/packages/expandable/index.js.map +4 -4
  187. package/dist/packages/expandable/react.d.ts +2 -0
  188. package/dist/packages/expandable/react.js +8 -0
  189. package/dist/packages/expandable/styles.d.ts +1 -0
  190. package/dist/packages/expandable/styles.js +2 -0
  191. package/dist/packages/i18n.js +44 -0
  192. package/dist/packages/link/index.d.ts +34 -0
  193. package/dist/packages/link/index.js +2646 -0
  194. package/dist/packages/link/index.js.map +7 -0
  195. package/dist/packages/link/link.stories.d.ts +20 -0
  196. package/dist/packages/link/link.stories.js +121 -0
  197. package/dist/packages/link/link.test.d.ts +1 -0
  198. package/dist/packages/link/link.test.js +9 -0
  199. package/dist/packages/link/react.d.ts +2 -0
  200. package/dist/packages/link/react.js +8 -0
  201. package/dist/packages/link/styles.d.ts +1 -0
  202. package/dist/packages/link/styles.js +200 -0
  203. package/dist/packages/modal/index.d.ts +4 -5
  204. package/dist/packages/modal/index.js +2649 -2575
  205. package/dist/packages/modal/index.js.map +4 -4
  206. package/dist/packages/modal/locales/da/messages.mjs +1 -0
  207. package/dist/packages/modal/locales/en/messages.mjs +1 -0
  208. package/dist/packages/modal/locales/fi/messages.mjs +1 -0
  209. package/dist/packages/modal/locales/nb/messages.mjs +1 -0
  210. package/dist/packages/modal/locales/sv/messages.mjs +1 -0
  211. package/dist/packages/modal/modal-footer.d.ts +13 -11
  212. package/dist/packages/modal/modal-footer.js +2460 -0
  213. package/dist/packages/modal/modal-footer.js.map +7 -0
  214. package/dist/packages/modal/modal-header.d.ts +25 -31
  215. package/dist/packages/modal/modal-header.js +2584 -0
  216. package/dist/packages/modal/modal-header.js.map +7 -0
  217. package/dist/packages/modal/modal-main.d.ts +27 -31
  218. package/dist/packages/modal/modal-main.js +2572 -0
  219. package/dist/packages/modal/modal-main.js.map +7 -0
  220. package/dist/packages/modal/modal.stories.d.ts +19 -0
  221. package/dist/packages/modal/modal.stories.js +160 -0
  222. package/dist/packages/modal/react.d.ts +4 -0
  223. package/dist/packages/modal/react.js +18 -0
  224. package/dist/packages/modal/util.d.ts +7 -17
  225. package/dist/packages/modal/util.js +21 -0
  226. package/dist/packages/pageindicator/index.d.ts +10 -0
  227. package/dist/packages/pageindicator/index.js +32 -0
  228. package/dist/packages/pageindicator/index.js.map +7 -0
  229. package/dist/packages/pageindicator/pageindicator.stories.d.ts +32 -0
  230. package/dist/packages/pageindicator/pageindicator.stories.js +71 -0
  231. package/dist/packages/pageindicator/react.d.ts +2 -0
  232. package/dist/packages/pageindicator/react.js +8 -0
  233. package/dist/packages/pageindicator/style.d.ts +1 -0
  234. package/dist/packages/pageindicator/style.js +26 -0
  235. package/dist/packages/pagination/index.d.ts +32 -0
  236. package/dist/packages/pagination/index.js +2494 -0
  237. package/dist/packages/pagination/index.js.map +7 -0
  238. package/dist/packages/pagination/locales/da/messages.d.mts +1 -0
  239. package/dist/packages/pagination/locales/da/messages.mjs +1 -0
  240. package/dist/packages/pagination/locales/en/messages.d.mts +1 -0
  241. package/dist/packages/pagination/locales/en/messages.mjs +1 -0
  242. package/dist/packages/pagination/locales/fi/messages.d.mts +1 -0
  243. package/dist/packages/pagination/locales/fi/messages.mjs +1 -0
  244. package/dist/packages/pagination/locales/nb/messages.d.mts +1 -0
  245. package/dist/packages/pagination/locales/nb/messages.mjs +1 -0
  246. package/dist/packages/pagination/locales/sv/messages.d.mts +1 -0
  247. package/dist/packages/pagination/locales/sv/messages.mjs +1 -0
  248. package/dist/packages/pagination/pagination.stories.d.ts +14 -0
  249. package/dist/packages/pagination/pagination.stories.js +56 -0
  250. package/dist/packages/pagination/pagination.test.d.ts +1 -0
  251. package/dist/packages/pagination/pagination.test.js +76 -0
  252. package/dist/packages/pagination/react.d.ts +2 -0
  253. package/dist/packages/pagination/react.js +8 -0
  254. package/dist/packages/pagination/styles.d.ts +1 -0
  255. package/dist/packages/pagination/styles.js +2 -0
  256. package/dist/packages/pill/index.d.ts +39 -23
  257. package/dist/packages/pill/index.js +2408 -2175
  258. package/dist/packages/pill/index.js.map +4 -4
  259. package/dist/packages/pill/locales/da/messages.mjs +1 -0
  260. package/dist/packages/pill/locales/en/messages.mjs +1 -0
  261. package/dist/packages/pill/locales/fi/messages.mjs +1 -0
  262. package/dist/packages/pill/locales/nb/messages.mjs +1 -0
  263. package/dist/packages/pill/locales/sv/messages.mjs +1 -0
  264. package/dist/packages/pill/pill.stories.d.ts +12 -0
  265. package/dist/packages/pill/pill.stories.js +33 -0
  266. package/dist/packages/pill/pill.test.d.ts +1 -0
  267. package/dist/packages/pill/pill.test.js +23 -0
  268. package/dist/packages/pill/styles.d.ts +1 -0
  269. package/dist/packages/pill/styles.js +2 -0
  270. package/dist/packages/rip-and-tear-checkbox/checkbox.d.ts +64 -0
  271. package/dist/packages/rip-and-tear-checkbox/checkbox.js +160 -0
  272. package/dist/packages/rip-and-tear-checkbox/checkbox.js.map +7 -0
  273. package/dist/packages/rip-and-tear-checkbox/index.d.ts +1 -0
  274. package/dist/packages/rip-and-tear-checkbox/index.js +160 -0
  275. package/dist/packages/rip-and-tear-checkbox/index.js.map +7 -0
  276. package/dist/packages/rip-and-tear-checkbox/styles.d.ts +1 -0
  277. package/dist/packages/rip-and-tear-checkbox/styles.js +116 -0
  278. package/dist/packages/rip-and-tear-radio/base-element.d.ts +46 -0
  279. package/dist/packages/rip-and-tear-radio/base-element.js +100 -0
  280. package/dist/packages/rip-and-tear-radio/custom-error-validator.d.ts +6 -0
  281. package/dist/packages/rip-and-tear-radio/custom-error-validator.js +22 -0
  282. package/dist/packages/rip-and-tear-radio/form-associated-element.d.ts +103 -0
  283. package/dist/packages/rip-and-tear-radio/form-associated-element.js +282 -0
  284. package/dist/packages/rip-and-tear-radio/host-styles.d.ts +1 -0
  285. package/dist/packages/rip-and-tear-radio/host-styles.js +12 -0
  286. package/dist/packages/rip-and-tear-radio/index.d.ts +1 -0
  287. package/dist/packages/rip-and-tear-radio/index.js +270 -0
  288. package/dist/packages/rip-and-tear-radio/index.js.map +7 -0
  289. package/dist/packages/rip-and-tear-radio/invalid.d.ts +8 -0
  290. package/dist/packages/rip-and-tear-radio/invalid.js +5 -0
  291. package/dist/packages/rip-and-tear-radio/math.d.ts +1 -0
  292. package/dist/packages/rip-and-tear-radio/math.js +4 -0
  293. package/dist/packages/rip-and-tear-radio/radio-group-styles.d.ts +1 -0
  294. package/dist/packages/rip-and-tear-radio/radio-group-styles.js +60 -0
  295. package/dist/packages/rip-and-tear-radio/radio-group-styles.js.map +7 -0
  296. package/dist/packages/rip-and-tear-radio/radio-group.d.ts +72 -0
  297. package/dist/packages/rip-and-tear-radio/radio-group.js +270 -0
  298. package/dist/packages/rip-and-tear-radio/radio-group.js.map +7 -0
  299. package/dist/packages/rip-and-tear-radio/radio-styles.d.ts +1 -0
  300. package/dist/packages/rip-and-tear-radio/radio-styles.js +170 -0
  301. package/dist/packages/rip-and-tear-radio/radio-styles.js.map +7 -0
  302. package/dist/packages/rip-and-tear-radio/radio.d.ts +38 -0
  303. package/dist/packages/rip-and-tear-radio/radio.js +183 -0
  304. package/dist/packages/rip-and-tear-radio/radio.js.map +7 -0
  305. package/dist/packages/rip-and-tear-radio/radio.stories.d.ts +8 -0
  306. package/dist/packages/rip-and-tear-radio/radio.stories.js +275 -0
  307. package/dist/packages/rip-and-tear-radio/radio.stories.js.map +7 -0
  308. package/dist/packages/rip-and-tear-radio/required-validator.d.ts +11 -0
  309. package/dist/packages/rip-and-tear-radio/required-validator.js +34 -0
  310. package/dist/packages/rip-and-tear-radio/slot.d.ts +20 -0
  311. package/dist/packages/rip-and-tear-radio/slot.js +71 -0
  312. package/dist/packages/rip-and-tear-radio/watch.d.ts +26 -0
  313. package/dist/packages/rip-and-tear-radio/watch.js +39 -0
  314. package/dist/packages/select/index.d.ts +54 -48
  315. package/dist/packages/select/index.js +2421 -2236
  316. package/dist/packages/select/index.js.map +4 -4
  317. package/dist/packages/select/locales/da/messages.mjs +1 -0
  318. package/dist/packages/select/locales/en/messages.mjs +1 -0
  319. package/dist/packages/select/locales/fi/messages.mjs +1 -0
  320. package/dist/packages/select/locales/nb/messages.mjs +1 -0
  321. package/dist/packages/select/locales/sv/messages.mjs +1 -0
  322. package/dist/packages/select/react.d.ts +2 -0
  323. package/dist/packages/select/react.js +8 -0
  324. package/dist/packages/select/select.stories.d.ts +10 -0
  325. package/dist/packages/select/select.stories.js +31 -0
  326. package/dist/packages/select/select.test.d.ts +1 -0
  327. package/dist/packages/select/select.test.js +31 -0
  328. package/dist/packages/select/styles.d.ts +1 -0
  329. package/dist/packages/select/styles.js +2 -0
  330. package/dist/packages/slider/Slider.d.ts +2 -0
  331. package/dist/packages/slider/Slider.js +8 -0
  332. package/dist/packages/slider/SliderThumb.d.ts +2 -0
  333. package/dist/packages/slider/SliderThumb.js +8 -0
  334. package/dist/packages/slider/index.d.ts +2 -0
  335. package/dist/packages/slider/index.js +2791 -0
  336. package/dist/packages/slider/index.js.map +7 -0
  337. package/dist/packages/slider/oddbird-css-anchor-positioning.d.ts +2 -0
  338. package/dist/packages/slider/oddbird-css-anchor-positioning.js +3 -0
  339. package/dist/packages/slider/slider-thumb.d.ts +57 -0
  340. package/dist/packages/slider/slider-thumb.js +2663 -0
  341. package/dist/packages/slider/slider-thumb.js.map +7 -0
  342. package/dist/packages/slider/slider.d.ts +46 -0
  343. package/dist/packages/slider/slider.js +2569 -0
  344. package/dist/packages/slider/slider.js.map +7 -0
  345. package/dist/packages/slider/slider.stories.d.ts +17 -0
  346. package/dist/packages/slider/slider.stories.js +203 -0
  347. package/dist/packages/slider/slider.test.d.ts +4 -0
  348. package/dist/packages/slider/slider.test.js +83 -0
  349. package/dist/packages/slider/styles/w-slider-thumb.styles.d.ts +1 -0
  350. package/dist/packages/slider/styles/w-slider-thumb.styles.js +132 -0
  351. package/dist/packages/slider/styles/w-slider.styles.d.ts +1 -0
  352. package/dist/packages/slider/styles/w-slider.styles.js +118 -0
  353. package/dist/packages/slider/styles.d.ts +1 -0
  354. package/dist/packages/slider/styles.js +2 -0
  355. package/dist/packages/steps/index.d.ts +36 -0
  356. package/dist/packages/steps/index.js +2465 -0
  357. package/dist/packages/steps/index.js.map +7 -0
  358. package/dist/packages/steps/locales/da/messages.d.mts +1 -0
  359. package/dist/packages/steps/locales/da/messages.mjs +1 -0
  360. package/dist/packages/steps/locales/en/messages.d.mts +1 -0
  361. package/dist/packages/steps/locales/en/messages.mjs +1 -0
  362. package/dist/packages/steps/locales/fi/messages.d.mts +1 -0
  363. package/dist/packages/steps/locales/fi/messages.mjs +1 -0
  364. package/dist/packages/steps/locales/nb/messages.d.mts +1 -0
  365. package/dist/packages/steps/locales/nb/messages.mjs +1 -0
  366. package/dist/packages/steps/locales/sv/messages.d.mts +1 -0
  367. package/dist/packages/steps/locales/sv/messages.mjs +1 -0
  368. package/dist/packages/steps/react.d.ts +3 -0
  369. package/dist/packages/steps/react.js +13 -0
  370. package/dist/packages/steps/steps.stories.d.ts +12 -0
  371. package/dist/packages/steps/steps.stories.js +172 -0
  372. package/dist/packages/steps/styles.d.ts +1 -0
  373. package/dist/packages/steps/styles.js +2 -0
  374. package/dist/packages/styles.d.ts +2 -0
  375. package/dist/packages/styles.js +2442 -0
  376. package/dist/packages/switch/index.d.ts +15 -0
  377. package/dist/packages/switch/index.js +2455 -0
  378. package/dist/packages/switch/index.js.map +7 -0
  379. package/dist/packages/switch/react.d.ts +2 -0
  380. package/dist/packages/switch/react.js +8 -0
  381. package/dist/packages/switch/styles.d.ts +1 -0
  382. package/dist/packages/switch/styles.js +2 -0
  383. package/dist/packages/switch/switch.stories.d.ts +9 -0
  384. package/dist/packages/switch/switch.stories.js +34 -0
  385. package/dist/packages/tabs/index.d.ts +4 -0
  386. package/dist/packages/tabs/index.js +2470 -0
  387. package/dist/packages/tabs/index.js.map +7 -0
  388. package/dist/packages/tabs/react.d.ts +4 -0
  389. package/dist/packages/tabs/react.js +18 -0
  390. package/dist/packages/tabs/styles.d.ts +1 -0
  391. package/dist/packages/tabs/styles.js +2 -0
  392. package/dist/packages/tabs/tab-panel.d.ts +20 -0
  393. package/dist/packages/tabs/tab-panel.js +2441 -0
  394. package/dist/packages/tabs/tab-panel.js.map +7 -0
  395. package/dist/packages/tabs/tab.d.ts +18 -0
  396. package/dist/packages/tabs/tab.js +2463 -0
  397. package/dist/packages/tabs/tab.js.map +7 -0
  398. package/dist/packages/tabs/tabs.d.ts +38 -0
  399. package/dist/packages/tabs/tabs.js +2448 -0
  400. package/dist/packages/tabs/tabs.js.map +7 -0
  401. package/dist/packages/tabs/tabs.stories.d.ts +8 -0
  402. package/dist/packages/tabs/tabs.stories.js +2545 -0
  403. package/dist/packages/tabs/tabs.stories.js.map +7 -0
  404. package/dist/packages/textfield/index.d.ts +78 -74
  405. package/dist/packages/textfield/index.js +2514 -422
  406. package/dist/packages/textfield/index.js.map +4 -4
  407. package/dist/packages/textfield/react.d.ts +2 -0
  408. package/dist/packages/textfield/react.js +8 -0
  409. package/dist/packages/textfield/styles/w-textfield.styles.d.ts +1 -0
  410. package/dist/packages/textfield/styles/w-textfield.styles.js +46 -0
  411. package/dist/packages/textfield/styles.d.ts +1 -0
  412. package/dist/packages/textfield/styles.js +2 -0
  413. package/dist/packages/textfield/textfield.stories.d.ts +18 -0
  414. package/dist/packages/textfield/textfield.stories.js +105 -0
  415. package/dist/packages/textfield/textfield.test.d.ts +2 -0
  416. package/dist/packages/textfield/textfield.test.js +68 -0
  417. package/dist/packages/toast/api.d.ts +4 -45
  418. package/dist/packages/toast/api.js +41 -0
  419. package/dist/packages/toast/index.d.ts +3 -0
  420. package/dist/packages/toast/index.js +2466 -2787
  421. package/dist/packages/toast/index.js.map +4 -4
  422. package/dist/packages/toast/locales/da/messages.mjs +1 -0
  423. package/dist/packages/toast/locales/en/messages.mjs +1 -0
  424. package/dist/packages/toast/locales/fi/messages.mjs +1 -0
  425. package/dist/packages/toast/locales/nb/messages.mjs +1 -0
  426. package/dist/packages/toast/locales/sv/messages.mjs +1 -0
  427. package/dist/packages/toast/styles.d.ts +1 -0
  428. package/dist/packages/toast/styles.js +2 -0
  429. package/dist/packages/toast/toast-container.d.ts +12 -63
  430. package/dist/packages/toast/toast-container.js +153 -0
  431. package/dist/packages/toast/toast.d.ts +34 -29
  432. package/dist/packages/toast/toast.js +200 -0
  433. package/dist/packages/toast/toast.stories.d.ts +12 -0
  434. package/dist/packages/toast/toast.stories.js +50 -0
  435. package/dist/packages/toast/types.d.ts +15 -0
  436. package/dist/packages/toast/types.js +1 -0
  437. package/dist/packages/utils/expand-transition.d.ts +3 -2
  438. package/dist/packages/utils/expand-transition.js +59 -0
  439. package/dist/packages/utils/index.d.ts +1 -1
  440. package/dist/packages/utils/index.js +2 -0
  441. package/dist/packages/utils/index.js.map +7 -0
  442. package/dist/packages/utils/unstyled-heading.d.ts +3 -3
  443. package/dist/packages/utils/unstyled-heading.js +22 -0
  444. package/dist/packages/utils/window-exists.js +1 -0
  445. package/dist/setup-tests.d.ts +1 -0
  446. package/dist/setup-tests.js +1 -0
  447. package/dist/vscode.css-custom-data.json +6 -0
  448. package/dist/vscode.html-custom-data.json +733 -0
  449. package/dist/web-types.json +1685 -0
  450. package/package.json +93 -38
  451. package/dist/index.js +0 -6838
  452. package/dist/index.js.map +0 -7
package/README.md CHANGED
@@ -14,64 +14,264 @@ start by reviewing the [contributing guidelines](CONTRIBUTING.md).
14
14
 
15
15
  ### Installation
16
16
 
17
- Install by using npm/pnpm or by adding a script link:
17
+ Warp custom elements are supplied by the Eik CDN.
18
+ In addition, you can install the `@warp-ds/elements` package to get intellisense
19
+ in your editor.
18
20
 
19
- #### Install using npm
21
+ #### Step 1.
22
+
23
+ Add the following script and style to the very top of your document head to ensure performant loading
24
+
25
+ ```html
26
+ <link rel="stylesheet" href="https://assets.finn.no/pkg/@warp-ds/elements/2.2.0-next.13/styles.css" crossorigin />
27
+ <script src="https://assets.finn.no/pkg/@warp-ds/elements/2.2.0-next.13/index.js" type="module"></script>
28
+ ```
29
+
30
+ #### Step 2.
31
+
32
+ Be sure to preload whichever brand fonts you need for a page and load the correct font file:
33
+
34
+ ```html
35
+ <!-- Finn example -->
36
+ <link rel="preload" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/FINNTypeAlleTegn-Light.woff2" as="font" type="font/woff2" crossorigin>
37
+ <link rel="preload" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/FINNTypeAlleTegn-Medium.woff2" as="font" type="font/woff2" crossorigin>
38
+ <link rel="stylesheet" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/finn-no.css" crossorigin>
39
+ ```
40
+
41
+ ```html
42
+ <!-- Tori example -->
43
+ <link rel="preload" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/ToriSans-Regular.woff2" as="font" type="font/woff2" crossorigin>
44
+ <link rel="preload" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/ToriSans-Bold.woff2" as="font" type="font/woff2" crossorigin>
45
+ <link rel="preload" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/ToriSans-Italic.woff2" as="font" type="font/woff2" crossorigin>
46
+ <link rel="stylesheet" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/tori-fi.css" crossorigin>
47
+ ```
48
+
49
+ ```html
50
+ <!-- DBA example -->
51
+ <link rel="preload" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/ProximaNova-Regular.woff2" as="font" type="font/woff2" crossorigin>
52
+ <link rel="preload" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/ProximaNova-Bold.woff2" as="font" type="font/woff2" crossorigin>
53
+ <link rel="stylesheet" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/dba-dk.css" crossorigin>
54
+ ```
55
+
56
+ ```html
57
+ <!-- Blocket example -->
58
+ <link rel="preload" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/BlocketSans-Regular.woff2" as="font" type="font/woff2" crossorigin>
59
+ <link rel="preload" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/BlocketSans-Bold.woff2" as="font" type="font/woff2" crossorigin>
60
+ <link rel="preload" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/BlocketSans-Medium.woff2" as="font" type="font/woff2" crossorigin>
61
+ <link rel="stylesheet" href="https://assets.finn.no/pkg/@warp-ds/fonts/v1/blocket-se.css" crossorigin>
62
+ ```
63
+
64
+ #### Step 3.
65
+
66
+ You'll also want to load Warp tokens and resets CSS files to ensure consistent and correct styling for the brand.
67
+
68
+ ```html
69
+ <!-- Finn example -->
70
+ <link rel="stylesheet" href="https://assets.finn.no/pkg/@warp-ds/css/v2/tokens/finn-no.css" crossorigin>
71
+ <link rel="stylesheet" href="https://assets.finn.no/pkg/@warp-ds/css/v2/resets.css" crossorigin>
72
+ ```
73
+
74
+ ```html
75
+ <!-- Tori example -->
76
+ <link rel="stylesheet" href="https://assets.finn.no/pkg/@warp-ds/css/v2/tokens/tori-fi.css" crossorigin>
77
+ <link rel="stylesheet" href="https://assets.finn.no/pkg/@warp-ds/css/v2/resets.css" crossorigin>
78
+ ```
79
+
80
+ ```html
81
+ <!-- DBA example -->
82
+ <link rel="stylesheet" href="https://assets.finn.no/pkg/@warp-ds/css/v2/tokens/dba-dk.css" crossorigin>
83
+ <link rel="stylesheet" href="https://assets.finn.no/pkg/@warp-ds/css/v2/resets.css" crossorigin>
84
+ ```
85
+
86
+ ```html
87
+ <!-- Blocket example -->
88
+ <link rel="stylesheet" href="https://assets.finn.no/pkg/@warp-ds/css/v2/tokens/blocket-se.css" crossorigin>
89
+ <link rel="stylesheet" href="https://assets.finn.no/pkg/@warp-ds/css/v2/resets.css" crossorigin>
90
+ ```
91
+
92
+ #### Step 4.
93
+
94
+ Next, to add intellisense to your editor install `@warp-ds/elements` by using npm/pnpm. See the Editor integration below.
95
+
96
+ ##### Install using npm
20
97
 
21
98
  ```sh
22
99
  npm install @warp-ds/elements
23
100
  ```
24
101
 
25
- #### Install using pnpm
102
+ ##### Install using pnpm
26
103
 
27
104
  ```sh
28
105
  pnpm add @warp-ds/elements
29
106
  ```
30
107
 
31
- #### Using a direct link to Eik
108
+ And then head on down to the editor configuration section below to complete setup.
109
+
110
+ ### Using Warp elements with Borealis
111
+
112
+ If you are using Borealis modules from the Web Platform Team (and you should be) and keeping your app dependencies up to date (and you should be), then steps 2 and 3 are already taken care of for you, you just need to do steps 1 and 4.
113
+
114
+ ### Documentation
115
+
116
+ For information on the components available in the package and how to use them,
117
+ see the [Warp Design System documentation](https://warp-ds.github.io/tech-docs/).
118
+
119
+ ### Editor integration
120
+
121
+ #### Typescript
122
+
123
+ Install the `@warp-ds/elements` package
124
+
125
+ ```
126
+ npm install @warp-ds/elements
127
+ ```
128
+
129
+ Add `@warp-ds/elements` to tsconfig types in compilerOptions.
130
+
131
+ ```json
132
+ {
133
+ "compilerOptions": {
134
+ "types": ["react", "react-dom", "@warp-ds/elements"]
135
+ }
136
+ }
137
+ ```
138
+
139
+ #### Visual Studio Code
140
+
141
+ This module includes [Custom HTML and CSS data for Visual Studio Code](https://code.visualstudio.com/blogs/2020/02/24/custom-data-format).
142
+
143
+ ##### Using Warp Elements in a plain HTML page
144
+
145
+ When developing, install Warp Elements locally using npm
146
+
147
+ ```
148
+ npm install @warp-ds/elements
149
+ ```
150
+
151
+ Add the following snippet to settings.json in vscode to tell it about Warp components
152
+
153
+ .vscode/settings.json
154
+
155
+ ```json
156
+ {
157
+ "html.customData": [
158
+ "./node_modules/@warp-ds/elements/dist/vscode.html-custom-data.json"
159
+ ],
160
+ "css.customData": [
161
+ "./node_modules/@warp-ds/elements/dist/vscode.css-custom-data.json"
162
+ ]
163
+ }
164
+ ```
165
+
166
+ restart vscode
167
+
168
+ Now, inside any .html files, you will get intellisense when using Warp Elements
32
169
 
33
170
  ```html
34
- <script src="https://assets.finn.no/pkg/@warp-ds/elements/v1"></script>
171
+ <w-button variant=""><w-button>
172
+ ```
173
+
174
+ ##### Using Warp Elements in JavaScript template literals
175
+
176
+ IntelliSense in JavaScript strings is not supported without additional plugins and syntax, such as comment hints (`/* html */`) or a tagged template literal similar to Lit.
177
+
178
+ ##### Using Warp Elements in Lit html tagged template literals
179
+
180
+ When developing, install Warp Elements locally using npm
181
+
182
+ ```
183
+ npm install @warp-ds/elements
35
184
  ```
36
- ### Import components
37
- This project builds both the whole Elements package and separate component packages that are published to EIK, making it possible for the user to choose to either import all of the components:
185
+
186
+ Add the following snippet to settings.json in vscode to tell it about Warp components
187
+
188
+ .vscode/settings.json
189
+
190
+ ```json
191
+ {
192
+ "html.customData": [
193
+ "./node_modules/@warp-ds/elements/dist/vscode.html-custom-data.json"
194
+ ],
195
+ "css.customData": [
196
+ "./node_modules/@warp-ds/elements/dist/vscode.css-custom-data.json"
197
+ ]
198
+ }
199
+ ```
200
+
201
+ Install the lit-plugin vscode extension and restart vscode
202
+
203
+ Now, inside any html`` tagged template literals, you will get intellisense when using Warp Elements.
204
+
205
+ ```html
206
+ <w-button variant=""><w-button>
207
+ ```
208
+
209
+ ##### Using Warp Elements in a React app, v19 or later
210
+
211
+ ```
212
+ npm install @warp-ds/elements
213
+ ```
214
+
215
+ Now, inside your react components, you will get intellisense when using Warp Elements.
216
+
217
+ ```html
218
+ <w-button variant=""><w-button>
219
+ ```
220
+
221
+ ##### Using Warp Elements in a React app, v18 or earlier
222
+
223
+ React 18 and earlier do not support custom elements.
224
+
225
+ If you are on React 18 or early, we strongly urge you to please consider upgrading to React v19.
226
+
227
+ If you cannot upgrade right away, Warp supplies custom element wrappers to add backwards compatibility. Use them like so:
228
+
229
+ ```
230
+ npm install @warp-ds/elements
231
+ ```
232
+
233
+ Wherever you need to use a component in your app, import the appropriate element from the React namespace
234
+
38
235
  ```js
39
- import '@warp-ds/elements';
236
+ import { Button } from "@warp-ds/elements/react/button";
40
237
  ```
41
- or a specific component:
238
+
239
+ and use the component
240
+
42
241
  ```js
43
- import '@warp-ds/elements/components/toast';
242
+ <Button variant="primary"></Button>
44
243
  ```
45
244
 
46
- ### Documentation
245
+ you should get intellisense when using Warp Elements.
47
246
 
48
- For information on the components available in the package and how to use them,
49
- see the [Warp Design System documentation](https://warp-ds.github.io/tech-docs/).
247
+ #### JetBrains products
50
248
 
51
- ## Releases
249
+ We ship `web-types.json` which should get picked up automatically by JetBrains IDEA and similar products.
52
250
 
53
- This project is continuously published to [NPM](https://www.npmjs.com/package/@warp-ds/elements) and [Eik](https://assets.finn.no/pkg/@warp-ds/elements) using a `next` tag (e.g. `1.1.0-next.1`).
54
- Anyone needing to use the latest changes of this package can point to the `next` version while waiting for the stable release.
251
+ You should see code completions and inline docs for Warp elements when writing HTML.
55
252
 
56
- ## Changelog
253
+ ### Ensure elements are ready (and avoid CLS and FOUCE)
57
254
 
58
- Detailed changes for each release can be found in the [CHANGELOG](CHANGELOG.md) file.
255
+ To avoid issues like CLS (cumulative layout shift) and FOUCE (flash of unstyled custom elements), its important that Warp Elements is loaded before the page is rendered. For this reason, elements should not be bundled into the rest of your client side application and code and should be loaded in the document head, as early as possible (see installation above). When this is done correctly, elements will be loaded and ready about the same time as the rest of the page styles and wont cause delays in page load times. However, due to the way browsers work, a page render will occur without the components and an immediate re-render will occur with the components. This causes things to jump around on the page which in turn impacts lighthouse and other performance scores. Warp elements ships with a tool to prevent the initial render without components and only do the second, with components, render. This tool is called Warp Cloak and its usage is described below.
59
256
 
60
- ## How to test component-classes locally
257
+ #### The Warp cloaking device
61
258
 
62
- It is possible to test changes that have been made to component-classes from the [@warp-ds/css](https://github.com/warp-ds/css) package but that has not yet been published to Eik. You simply need to link the `@warp-ds/css` package in this repository and add `@unocss-placeholder` inside the static styles of the component that you want to test:
259
+ To use the Warp cloaking device to avoid CLS and FOUCE, simply add the warp-cloak class to your pages body, html or a wrapper div that contains all the pages visible elements (including the header and footer)
63
260
 
64
- ```js
65
- static styles = [
66
- css`
67
- @unocss-placeholder
68
- `,
69
- ]
261
+ ```html
262
+ <body class="warp-cloak">
70
263
  ```
71
264
 
72
- Run `pnpm dev` to see the linked styles in action.
265
+ That's it, your components should render just 1x, fully ready with no CLS and FOUCE.
73
266
 
74
- Once you have tested it locally, make sure to remove the `@unocss-placeholder` from the static styles before pushing any changes to the repository.
267
+ ## Releases
268
+
269
+ This project is continuously published to [NPM](https://www.npmjs.com/package/@warp-ds/elements) and [Eik](https://assets.finn.no/pkg/@warp-ds/elements) using a `next` tag (e.g. `2.2.0-next.13`).
270
+ Anyone needing to use the latest changes of this package can point to the `next` version while waiting for the stable release.
271
+
272
+ ## Changelog
273
+
274
+ Detailed changes for each release can be found in the [CHANGELOG](CHANGELOG.md) file.
75
275
 
76
276
  ## License
77
277
 
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Massages storybook args before being spread to HTML attributes.
3
+ *
4
+ * - Empty strings are treated as not set.
5
+ * - Boolean false don't get set.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { html } from 'lit';
10
+ * import { spread } from '@open-wc/lit-helpers';
11
+ * import { prespread } from '../../.storybook/utilities.js';
12
+ *
13
+ * type Args = {
14
+ * required: boolean;
15
+ * };
16
+ *
17
+ * const meta: Meta<Args> = {
18
+ * component: 'w-component',
19
+ * render(args) {
20
+ * return html`<w-component ${spread(prespread(args))}></w-component>`;
21
+ * },
22
+ * argTypes: {
23
+ * required: { type: 'boolean' },
24
+ * },
25
+ * };
26
+ * ```
27
+ */
28
+ export declare function prespread(args: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Massages storybook args before being spread to HTML attributes.
3
+ *
4
+ * - Empty strings are treated as not set.
5
+ * - Boolean false don't get set.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { html } from 'lit';
10
+ * import { spread } from '@open-wc/lit-helpers';
11
+ * import { prespread } from '../../.storybook/utilities.js';
12
+ *
13
+ * type Args = {
14
+ * required: boolean;
15
+ * };
16
+ *
17
+ * const meta: Meta<Args> = {
18
+ * component: 'w-component',
19
+ * render(args) {
20
+ * return html`<w-component ${spread(prespread(args))}></w-component>`;
21
+ * },
22
+ * argTypes: {
23
+ * required: { type: 'boolean' },
24
+ * },
25
+ * };
26
+ * ```
27
+ */
28
+ export function prespread(args) {
29
+ const newArgs = {
30
+ ...args,
31
+ };
32
+ for (const field of Object.keys(newArgs)) {
33
+ const value = args[field];
34
+ // Add Lit syntax for boolean attributes
35
+ if (typeof value === 'boolean') {
36
+ newArgs[`?${field}`] = value;
37
+ delete newArgs[field];
38
+ }
39
+ // Add Lit syntax for complex properties
40
+ if (typeof value === 'object') {
41
+ newArgs[`.${field}`] = value;
42
+ delete newArgs[field];
43
+ }
44
+ // The manifest has a bunch of default empty strings (which we should probably investigate)
45
+ // that turn on features that should be off in Storybook canvases.
46
+ // Remove the empty strings.
47
+ if (newArgs[field] === '') {
48
+ delete newArgs[field];
49
+ }
50
+ }
51
+ return newArgs;
52
+ }
package/dist/api.js CHANGED
@@ -1,50 +1,2 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
-
18
- // packages/utils/window-exists.js
19
- var windowExists = typeof window !== "undefined";
20
-
21
- // packages/toast/api.js
22
- function toast(message, options) {
23
- if (!windowExists) return;
24
- const toast2 = customElements.get("w-toast-container").init();
25
- const data = __spreadValues({
26
- id: Date.now().toString(36) + Math.random().toString(36).slice(2, 5),
27
- text: message,
28
- duration: 5e3,
29
- type: "success"
30
- }, options);
31
- toast2.set(data);
32
- return data;
33
- }
34
- function removeToast(id) {
35
- if (!windowExists) return;
36
- const toast2 = customElements.get("w-toast-container").init();
37
- return toast2.del(id);
38
- }
39
- function updateToast(id, options) {
40
- if (!windowExists) return;
41
- const toast2 = customElements.get("w-toast-container").init();
42
- toast2.set(__spreadValues(__spreadValues({}, toast2.get(id)), options));
43
- return toast2.get(id);
44
- }
45
- export {
46
- removeToast,
47
- toast,
48
- updateToast
49
- };
1
+ var e=typeof window!="undefined";function r(){return customElements.get("w-toast-container")}function p(t,o){if(!e)return;let n=r().init(),s={id:Date.now().toString(36)+Math.random().toString(36).slice(2,5),text:t,duration:5e3,type:"success",...o};return n.set(s),s}function u(t){return e?r().init().del(t):void 0}function c(t,o){if(!e)return;let n=r().init();return n.set({...n.get(t),...o}),n.get(t)}export{u as removeToast,p as toast,c as updateToast};
50
2
  //# sourceMappingURL=api.js.map
package/dist/api.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../packages/utils/window-exists.js", "../packages/toast/api.js"],
4
- "sourcesContent": ["export const windowExists = typeof window !== 'undefined';\n", "import { windowExists } from '../utils/window-exists';\n\n/**\n * Toast helper function options\n * @typedef {Object} ToastOptions\n * @property {(number|string)} [id] Custom identifier\n * @property {('success'|'error'|'warning')} [type] Type of toast\n * @property {String} [text] The toast message. Only needed when updating text on existing toast\n * @property {(number|string)} [duration] Duration of toast in milliseconds. Defaults to 5000. For accessibility reasons, toasts should never be interactive and therefore need to auto remove. If you must disable auto remove, set duration to Number.POSITIVE_INFINITY.\n * @property {Boolean} [canclose] Whether the toast can be dismissed. Defaults to false. WARNING! For accessibility reasons, toasts should not be interactive and canclose should always be false. If the toast absolutely must be dismissable, set this to true.\n */\n\n/**\n * Creates a new toast\n * @param {String} message Message\n * @param {ToastOptions?} options Toast options\n * @returns {ToastOptions} Toast details\n */\nexport function toast(message, options) {\n if (!windowExists) return;\n const toast = customElements.get('w-toast-container').init();\n\n const data = {\n id: Date.now().toString(36) + Math.random().toString(36).slice(2, 5),\n text: message,\n duration: 5000,\n type: 'success',\n ...options,\n };\n\n toast.set(data);\n return data;\n}\n\n/**\n * Remove an existing toast\n * @param {String|Number} id Toast identifier\n * @return {Promise<Boolean>} Resolves to true if deleted, false if not found\n */\nexport function removeToast(id) {\n if (!windowExists) return;\n const toast = customElements.get('w-toast-container').init();\n return toast.del(id);\n}\n\n/**\n * Update an existing toast\n * @param {String|Number} id Toast identifier\n * @param {ToastOptions?} options Toast options\n * @returns {WarpToastContainer} Toast details\n */\nexport function updateToast(id, options) {\n if (!windowExists) return;\n const toast = customElements.get('w-toast-container').init();\n toast.set({ ...toast.get(id), ...options });\n return toast.get(id);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAO,IAAM,eAAe,OAAO,WAAW;;;ACkBvC,SAAS,MAAM,SAAS,SAAS;AACtC,MAAI,CAAC,aAAc;AACnB,QAAMA,SAAQ,eAAe,IAAI,mBAAmB,EAAE,KAAK;AAE3D,QAAM,OAAO;AAAA,IACX,IAAI,KAAK,IAAI,EAAE,SAAS,EAAE,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,CAAC;AAAA,IACnE,MAAM;AAAA,IACN,UAAU;AAAA,IACV,MAAM;AAAA,KACH;AAGL,EAAAA,OAAM,IAAI,IAAI;AACd,SAAO;AACT;AAOO,SAAS,YAAY,IAAI;AAC9B,MAAI,CAAC,aAAc;AACnB,QAAMA,SAAQ,eAAe,IAAI,mBAAmB,EAAE,KAAK;AAC3D,SAAOA,OAAM,IAAI,EAAE;AACrB;AAQO,SAAS,YAAY,IAAI,SAAS;AACvC,MAAI,CAAC,aAAc;AACnB,QAAMA,SAAQ,eAAe,IAAI,mBAAmB,EAAE,KAAK;AAC3D,EAAAA,OAAM,IAAI,kCAAKA,OAAM,IAAI,EAAE,IAAM,QAAS;AAC1C,SAAOA,OAAM,IAAI,EAAE;AACrB;",
6
- "names": ["toast"]
3
+ "sources": ["../packages/utils/window-exists.js", "../packages/toast/api.ts"],
4
+ "sourcesContent": ["export const windowExists = typeof window !== 'undefined';\n", "import { windowExists } from '../utils/window-exists';\n\nimport { WarpToastContainer } from './toast-container';\nimport type { ToastOptions, ToastInternal } from './types';\n\nfunction getToastContainer() {\n const container = customElements.get('w-toast-container');\n return container as typeof WarpToastContainer;\n}\n\n/**\n * Creates a new toast\n */\nexport function toast(message: string, options?: ToastOptions) {\n if (!windowExists) return;\n\n const toast = getToastContainer().init() as WarpToastContainer;\n\n const data: ToastOptions = {\n id: Date.now().toString(36) + Math.random().toString(36).slice(2, 5),\n text: message,\n duration: 5000,\n type: 'success',\n ...options,\n };\n\n toast.set(data);\n return data;\n}\n\n/**\n * Remove an existing toast\n */\nexport function removeToast(id: string | number): Promise<boolean> | undefined {\n if (!windowExists) return;\n\n const toast = getToastContainer().init() as WarpToastContainer;\n return toast.del(id);\n}\n\n/**\n * Update an existing toast\n */\nexport function updateToast(id: string | number, options?: ToastOptions): ToastInternal | undefined {\n if (!windowExists) return;\n\n const toast = getToastContainer().init() as WarpToastContainer;\n toast.set({ ...toast.get(id), ...options });\n return toast.get(id);\n}\n"],
5
+ "mappings": "AAAO,IAAMA,EAAe,OAAO,QAAW,YCK9C,SAASC,GAAoB,CAE3B,OADkB,eAAe,IAAI,mBAAmB,CAE1D,CAKO,SAASC,EAAMC,EAAiBC,EAAwB,CAC7D,GAAI,CAACC,EAAc,OAEnB,IAAMH,EAAQD,EAAkB,EAAE,KAAK,EAEjCK,EAAqB,CACzB,GAAI,KAAK,IAAI,EAAE,SAAS,EAAE,EAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,EAAG,CAAC,EACnE,KAAMH,EACN,SAAU,IACV,KAAM,UACN,GAAGC,CACL,EAEA,OAAAF,EAAM,IAAII,CAAI,EACPA,CACT,CAKO,SAASC,EAAYC,EAAmD,CAC7E,OAAKH,EAESJ,EAAkB,EAAE,KAAK,EAC1B,IAAIO,CAAE,EAHA,MAIrB,CAKO,SAASC,EAAYD,EAAqBJ,EAAmD,CAClG,GAAI,CAACC,EAAc,OAEnB,IAAMH,EAAQD,EAAkB,EAAE,KAAK,EACvC,OAAAC,EAAM,IAAI,CAAE,GAAGA,EAAM,IAAIM,CAAE,EAAG,GAAGJ,CAAQ,CAAC,EACnCF,EAAM,IAAIM,CAAE,CACrB",
6
+ "names": ["windowExists", "getToastContainer", "toast", "message", "options", "windowExists", "data", "removeToast", "id", "updateToast"]
7
7
  }