@warp-ds/elements 2.3.0-next.9 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/dist/custom-elements.json +156 -3728
  2. package/dist/index.d.ts +34 -717
  3. package/dist/packages/affix/index.js.map +2 -2
  4. package/dist/packages/alert/index.js.map +2 -2
  5. package/dist/packages/attention/attention.stories.js +4 -1
  6. package/dist/packages/attention/index.js +55 -19
  7. package/dist/packages/attention/index.js.map +3 -3
  8. package/dist/packages/attention/styles.js +1 -1
  9. package/dist/packages/badge/index.js.map +2 -2
  10. package/dist/packages/box/index.js.map +2 -2
  11. package/dist/packages/breadcrumbs/index.js.map +2 -2
  12. package/dist/packages/button/button.react.stories.d.ts +1 -1
  13. package/dist/packages/button/button.stories.d.ts +4 -4
  14. package/dist/packages/button/button.stories.js +4 -4
  15. package/dist/packages/button/button.test.js +30 -1
  16. package/dist/packages/button/index.d.ts +2 -0
  17. package/dist/packages/button/index.js +49 -13
  18. package/dist/packages/button/index.js.map +3 -3
  19. package/dist/packages/card/index.js.map +2 -2
  20. package/dist/packages/datepicker/datepicker.d.ts +1 -0
  21. package/dist/packages/datepicker/datepicker.js +439 -2732
  22. package/dist/packages/datepicker/datepicker.react.stories.d.ts +1 -1
  23. package/dist/packages/datepicker/datepicker.test.js +27 -0
  24. package/dist/packages/datepicker/index.js +2785 -1
  25. package/dist/packages/datepicker/{datepicker.js.map → index.js.map} +3 -3
  26. package/dist/packages/expandable/index.js.map +2 -2
  27. package/dist/packages/link/index.d.ts +2 -8
  28. package/dist/packages/link/index.js +43 -7
  29. package/dist/packages/link/index.js.map +4 -4
  30. package/dist/packages/link/link.react.stories.d.ts +6 -4
  31. package/dist/packages/link/link.react.stories.js +22 -12
  32. package/dist/packages/link/link.stories.d.ts +5 -3
  33. package/dist/packages/link/link.stories.js +22 -12
  34. package/dist/packages/link/styles.js +36 -0
  35. package/dist/packages/modal/index.js.map +2 -2
  36. package/dist/packages/modal/modal-header.js.map +2 -2
  37. package/dist/packages/modal/modal.stories.d.ts +3 -3
  38. package/dist/packages/modal/modal.stories.js +32 -32
  39. package/dist/packages/pill/index.js.map +2 -2
  40. package/dist/packages/select/index.d.ts +26 -5
  41. package/dist/packages/select/index.js +17 -16
  42. package/dist/packages/select/index.js.map +3 -3
  43. package/dist/packages/select/select.react.stories.d.ts +1 -1
  44. package/dist/packages/select/select.stories.d.ts +1 -1
  45. package/dist/packages/select/select.stories.js +3 -4
  46. package/dist/packages/select/select.test.js +30 -0
  47. package/dist/packages/textfield/index.d.ts +4 -0
  48. package/dist/packages/textfield/index.js +20 -19
  49. package/dist/packages/textfield/index.js.map +3 -3
  50. package/dist/packages/textfield/textfield.react.stories.d.ts +1 -1
  51. package/dist/packages/textfield/textfield.stories.d.ts +1 -0
  52. package/dist/packages/textfield/textfield.stories.js +17 -0
  53. package/dist/web-types.json +44 -707
  54. package/package.json +11 -89
  55. package/dist/packages/combobox/combobox.react.stories.d.ts +0 -28
  56. package/dist/packages/combobox/combobox.react.stories.js +0 -90
  57. package/dist/packages/combobox/combobox.stories.d.ts +0 -18
  58. package/dist/packages/combobox/combobox.stories.js +0 -117
  59. package/dist/packages/combobox/index.d.ts +0 -85
  60. package/dist/packages/combobox/index.js +0 -2492
  61. package/dist/packages/combobox/index.js.map +0 -7
  62. package/dist/packages/combobox/locales/da/messages.d.mts +0 -1
  63. package/dist/packages/combobox/locales/da/messages.mjs +0 -1
  64. package/dist/packages/combobox/locales/en/messages.d.mts +0 -1
  65. package/dist/packages/combobox/locales/en/messages.mjs +0 -1
  66. package/dist/packages/combobox/locales/fi/messages.d.mts +0 -1
  67. package/dist/packages/combobox/locales/fi/messages.mjs +0 -1
  68. package/dist/packages/combobox/locales/nb/messages.d.mts +0 -1
  69. package/dist/packages/combobox/locales/nb/messages.mjs +0 -1
  70. package/dist/packages/combobox/locales/sv/messages.d.mts +0 -1
  71. package/dist/packages/combobox/locales/sv/messages.mjs +0 -1
  72. package/dist/packages/combobox/react.d.ts +0 -7
  73. package/dist/packages/combobox/react.js +0 -17
  74. package/dist/packages/combobox/styles.d.ts +0 -1
  75. package/dist/packages/combobox/styles.js +0 -2
  76. package/dist/packages/dead-toggle/dead-toggle.react.stories.d.ts +0 -15
  77. package/dist/packages/dead-toggle/dead-toggle.react.stories.js +0 -34
  78. package/dist/packages/dead-toggle/dead-toggle.stories.d.ts +0 -14
  79. package/dist/packages/dead-toggle/dead-toggle.stories.js +0 -45
  80. package/dist/packages/dead-toggle/dead-toggle.test.d.ts +0 -1
  81. package/dist/packages/dead-toggle/dead-toggle.test.js +0 -9
  82. package/dist/packages/dead-toggle/index.d.ts +0 -17
  83. package/dist/packages/dead-toggle/index.js +0 -2547
  84. package/dist/packages/dead-toggle/index.js.map +0 -7
  85. package/dist/packages/dead-toggle/react.d.ts +0 -2
  86. package/dist/packages/dead-toggle/react.js +0 -11
  87. package/dist/packages/pageindicator/index.d.ts +0 -10
  88. package/dist/packages/pageindicator/index.js +0 -32
  89. package/dist/packages/pageindicator/index.js.map +0 -7
  90. package/dist/packages/pageindicator/pageindicator.react.stories.d.ts +0 -19
  91. package/dist/packages/pageindicator/pageindicator.react.stories.js +0 -20
  92. package/dist/packages/pageindicator/pageindicator.stories.d.ts +0 -32
  93. package/dist/packages/pageindicator/pageindicator.stories.js +0 -71
  94. package/dist/packages/pageindicator/react.d.ts +0 -2
  95. package/dist/packages/pageindicator/react.js +0 -11
  96. package/dist/packages/pageindicator/style.d.ts +0 -1
  97. package/dist/packages/pageindicator/style.js +0 -26
  98. package/dist/packages/pagination/index.d.ts +0 -32
  99. package/dist/packages/pagination/index.js +0 -2500
  100. package/dist/packages/pagination/index.js.map +0 -7
  101. package/dist/packages/pagination/locales/da/messages.d.mts +0 -1
  102. package/dist/packages/pagination/locales/da/messages.mjs +0 -1
  103. package/dist/packages/pagination/locales/en/messages.d.mts +0 -1
  104. package/dist/packages/pagination/locales/en/messages.mjs +0 -1
  105. package/dist/packages/pagination/locales/fi/messages.d.mts +0 -1
  106. package/dist/packages/pagination/locales/fi/messages.mjs +0 -1
  107. package/dist/packages/pagination/locales/nb/messages.d.mts +0 -1
  108. package/dist/packages/pagination/locales/nb/messages.mjs +0 -1
  109. package/dist/packages/pagination/locales/sv/messages.d.mts +0 -1
  110. package/dist/packages/pagination/locales/sv/messages.mjs +0 -1
  111. package/dist/packages/pagination/pagination.react.stories.d.ts +0 -21
  112. package/dist/packages/pagination/pagination.react.stories.js +0 -45
  113. package/dist/packages/pagination/pagination.stories.d.ts +0 -14
  114. package/dist/packages/pagination/pagination.stories.js +0 -56
  115. package/dist/packages/pagination/pagination.test.d.ts +0 -1
  116. package/dist/packages/pagination/pagination.test.js +0 -76
  117. package/dist/packages/pagination/react.d.ts +0 -5
  118. package/dist/packages/pagination/react.js +0 -15
  119. package/dist/packages/pagination/styles.d.ts +0 -1
  120. package/dist/packages/pagination/styles.js +0 -2
  121. package/dist/packages/rip-and-tear-checkbox/checkbox-group.d.ts +0 -10
  122. package/dist/packages/rip-and-tear-checkbox/checkbox-group.js +0 -7
  123. package/dist/packages/rip-and-tear-checkbox/checkbox-group.js.map +0 -7
  124. package/dist/packages/rip-and-tear-checkbox/checkbox.d.ts +0 -66
  125. package/dist/packages/rip-and-tear-checkbox/checkbox.js +0 -2591
  126. package/dist/packages/rip-and-tear-checkbox/checkbox.js.map +0 -7
  127. package/dist/packages/rip-and-tear-checkbox/checkbox.stories.d.ts +0 -11
  128. package/dist/packages/rip-and-tear-checkbox/checkbox.stories.js +0 -25
  129. package/dist/packages/rip-and-tear-checkbox/index.d.ts +0 -1
  130. package/dist/packages/rip-and-tear-checkbox/index.js +0 -6
  131. package/dist/packages/rip-and-tear-checkbox/react.d.ts +0 -7
  132. package/dist/packages/rip-and-tear-checkbox/react.js +0 -20
  133. package/dist/packages/rip-and-tear-checkbox/rip-and-tear-checkbox.react.stories.d.ts +0 -12
  134. package/dist/packages/rip-and-tear-checkbox/rip-and-tear-checkbox.react.stories.js +0 -10
  135. package/dist/packages/rip-and-tear-checkbox/styles.d.ts +0 -0
  136. package/dist/packages/rip-and-tear-checkbox/styles.js +0 -0
  137. package/dist/packages/rip-and-tear-radio/base-element.d.ts +0 -46
  138. package/dist/packages/rip-and-tear-radio/base-element.js +0 -100
  139. package/dist/packages/rip-and-tear-radio/custom-error-validator.d.ts +0 -6
  140. package/dist/packages/rip-and-tear-radio/custom-error-validator.js +0 -22
  141. package/dist/packages/rip-and-tear-radio/form-associated-element.d.ts +0 -103
  142. package/dist/packages/rip-and-tear-radio/form-associated-element.js +0 -282
  143. package/dist/packages/rip-and-tear-radio/host-styles.d.ts +0 -1
  144. package/dist/packages/rip-and-tear-radio/host-styles.js +0 -12
  145. package/dist/packages/rip-and-tear-radio/index.d.ts +0 -1
  146. package/dist/packages/rip-and-tear-radio/index.js +0 -6
  147. package/dist/packages/rip-and-tear-radio/invalid.d.ts +0 -8
  148. package/dist/packages/rip-and-tear-radio/invalid.js +0 -5
  149. package/dist/packages/rip-and-tear-radio/math.d.ts +0 -1
  150. package/dist/packages/rip-and-tear-radio/math.js +0 -4
  151. package/dist/packages/rip-and-tear-radio/radio-group-styles.d.ts +0 -1
  152. package/dist/packages/rip-and-tear-radio/radio-group-styles.js +0 -59
  153. package/dist/packages/rip-and-tear-radio/radio-group-styles.js.map +0 -7
  154. package/dist/packages/rip-and-tear-radio/radio-group.d.ts +0 -72
  155. package/dist/packages/rip-and-tear-radio/radio-group.js +0 -2648
  156. package/dist/packages/rip-and-tear-radio/radio-group.js.map +0 -7
  157. package/dist/packages/rip-and-tear-radio/radio-styles.d.ts +0 -0
  158. package/dist/packages/rip-and-tear-radio/radio-styles.js +0 -1
  159. package/dist/packages/rip-and-tear-radio/radio-styles.js.map +0 -7
  160. package/dist/packages/rip-and-tear-radio/radio.d.ts +0 -38
  161. package/dist/packages/rip-and-tear-radio/radio.js +0 -2562
  162. package/dist/packages/rip-and-tear-radio/radio.js.map +0 -7
  163. package/dist/packages/rip-and-tear-radio/radio.stories.d.ts +0 -8
  164. package/dist/packages/rip-and-tear-radio/radio.stories.js +0 -2653
  165. package/dist/packages/rip-and-tear-radio/radio.stories.js.map +0 -7
  166. package/dist/packages/rip-and-tear-radio/react.d.ts +0 -9
  167. package/dist/packages/rip-and-tear-radio/react.js +0 -22
  168. package/dist/packages/rip-and-tear-radio/required-validator.d.ts +0 -11
  169. package/dist/packages/rip-and-tear-radio/required-validator.js +0 -34
  170. package/dist/packages/rip-and-tear-radio/rip-and-tear-radio.react.stories.d.ts +0 -9
  171. package/dist/packages/rip-and-tear-radio/rip-and-tear-radio.react.stories.js +0 -10
  172. package/dist/packages/rip-and-tear-radio/slot.d.ts +0 -20
  173. package/dist/packages/rip-and-tear-radio/slot.js +0 -71
  174. package/dist/packages/rip-and-tear-radio/watch.d.ts +0 -26
  175. package/dist/packages/rip-and-tear-radio/watch.js +0 -39
  176. package/dist/packages/slider/Slider.d.ts +0 -2
  177. package/dist/packages/slider/Slider.js +0 -8
  178. package/dist/packages/slider/SliderThumb.d.ts +0 -2
  179. package/dist/packages/slider/SliderThumb.js +0 -8
  180. package/dist/packages/slider/index.d.ts +0 -2
  181. package/dist/packages/slider/index.js +0 -2
  182. package/dist/packages/slider/oddbird-css-anchor-positioning.d.ts +0 -2
  183. package/dist/packages/slider/oddbird-css-anchor-positioning.js +0 -3
  184. package/dist/packages/slider/react.d.ts +0 -8
  185. package/dist/packages/slider/react.js +0 -20
  186. package/dist/packages/slider/slider-thumb.d.ts +0 -57
  187. package/dist/packages/slider/slider-thumb.js +0 -2705
  188. package/dist/packages/slider/slider-thumb.js.map +0 -7
  189. package/dist/packages/slider/slider.d.ts +0 -46
  190. package/dist/packages/slider/slider.js +0 -2587
  191. package/dist/packages/slider/slider.js.map +0 -7
  192. package/dist/packages/slider/slider.react.stories.d.ts +0 -18
  193. package/dist/packages/slider/slider.react.stories.js +0 -118
  194. package/dist/packages/slider/slider.stories.d.ts +0 -18
  195. package/dist/packages/slider/slider.stories.js +0 -197
  196. package/dist/packages/slider/slider.test.d.ts +0 -4
  197. package/dist/packages/slider/slider.test.js +0 -83
  198. package/dist/packages/slider/styles/w-slider-thumb.styles.d.ts +0 -1
  199. package/dist/packages/slider/styles/w-slider-thumb.styles.js +0 -167
  200. package/dist/packages/slider/styles/w-slider.styles.d.ts +0 -1
  201. package/dist/packages/slider/styles/w-slider.styles.js +0 -134
  202. package/dist/packages/slider/styles.d.ts +0 -1
  203. package/dist/packages/slider/styles.js +0 -2
  204. package/dist/packages/steps/index.d.ts +0 -36
  205. package/dist/packages/steps/index.js +0 -2465
  206. package/dist/packages/steps/index.js.map +0 -7
  207. package/dist/packages/steps/locales/da/messages.d.mts +0 -1
  208. package/dist/packages/steps/locales/da/messages.mjs +0 -1
  209. package/dist/packages/steps/locales/en/messages.d.mts +0 -1
  210. package/dist/packages/steps/locales/en/messages.mjs +0 -1
  211. package/dist/packages/steps/locales/fi/messages.d.mts +0 -1
  212. package/dist/packages/steps/locales/fi/messages.mjs +0 -1
  213. package/dist/packages/steps/locales/nb/messages.d.mts +0 -1
  214. package/dist/packages/steps/locales/nb/messages.mjs +0 -1
  215. package/dist/packages/steps/locales/sv/messages.d.mts +0 -1
  216. package/dist/packages/steps/locales/sv/messages.mjs +0 -1
  217. package/dist/packages/steps/react.d.ts +0 -3
  218. package/dist/packages/steps/react.js +0 -16
  219. package/dist/packages/steps/steps.react.stories.d.ts +0 -15
  220. package/dist/packages/steps/steps.react.stories.js +0 -112
  221. package/dist/packages/steps/steps.stories.d.ts +0 -12
  222. package/dist/packages/steps/steps.stories.js +0 -172
  223. package/dist/packages/steps/styles.d.ts +0 -1
  224. package/dist/packages/steps/styles.js +0 -2
  225. package/dist/packages/switch/index.d.ts +0 -15
  226. package/dist/packages/switch/index.js +0 -2455
  227. package/dist/packages/switch/index.js.map +0 -7
  228. package/dist/packages/switch/react.d.ts +0 -5
  229. package/dist/packages/switch/react.js +0 -15
  230. package/dist/packages/switch/styles.d.ts +0 -1
  231. package/dist/packages/switch/styles.js +0 -2
  232. package/dist/packages/switch/switch.react.stories.d.ts +0 -15
  233. package/dist/packages/switch/switch.react.stories.js +0 -29
  234. package/dist/packages/switch/switch.stories.d.ts +0 -9
  235. package/dist/packages/switch/switch.stories.js +0 -34
  236. package/dist/packages/tabs/index.d.ts +0 -4
  237. package/dist/packages/tabs/index.js +0 -3
  238. package/dist/packages/tabs/react.d.ts +0 -12
  239. package/dist/packages/tabs/react.js +0 -31
  240. package/dist/packages/tabs/styles.d.ts +0 -1
  241. package/dist/packages/tabs/styles.js +0 -2
  242. package/dist/packages/tabs/tab-panel.d.ts +0 -20
  243. package/dist/packages/tabs/tab-panel.js +0 -51
  244. package/dist/packages/tabs/tab.d.ts +0 -18
  245. package/dist/packages/tabs/tab.js +0 -2464
  246. package/dist/packages/tabs/tab.js.map +0 -7
  247. package/dist/packages/tabs/tabs.d.ts +0 -40
  248. package/dist/packages/tabs/tabs.js +0 -2448
  249. package/dist/packages/tabs/tabs.js.map +0 -7
  250. package/dist/packages/tabs/tabs.react.stories.d.ts +0 -15
  251. package/dist/packages/tabs/tabs.react.stories.js +0 -51
  252. package/dist/packages/tabs/tabs.stories.d.ts +0 -11
  253. package/dist/packages/tabs/tabs.stories.js +0 -93
  254. package/dist/packages/textarea/index.d.ts +0 -1
  255. package/dist/packages/textarea/index.js +0 -1
  256. package/dist/packages/textarea/locales/da/messages.d.mts +0 -1
  257. package/dist/packages/textarea/locales/da/messages.mjs +0 -1
  258. package/dist/packages/textarea/locales/en/messages.d.mts +0 -1
  259. package/dist/packages/textarea/locales/en/messages.mjs +0 -1
  260. package/dist/packages/textarea/locales/fi/messages.d.mts +0 -1
  261. package/dist/packages/textarea/locales/fi/messages.mjs +0 -1
  262. package/dist/packages/textarea/locales/nb/messages.d.mts +0 -1
  263. package/dist/packages/textarea/locales/nb/messages.mjs +0 -1
  264. package/dist/packages/textarea/locales/sv/messages.d.mts +0 -1
  265. package/dist/packages/textarea/locales/sv/messages.mjs +0 -1
  266. package/dist/packages/textarea/react.d.ts +0 -11
  267. package/dist/packages/textarea/react.js +0 -21
  268. package/dist/packages/textarea/styles.d.ts +0 -1
  269. package/dist/packages/textarea/styles.js +0 -2
  270. package/dist/packages/textarea/textarea.d.ts +0 -48
  271. package/dist/packages/textarea/textarea.js +0 -2475
  272. package/dist/packages/textarea/textarea.js.map +0 -7
  273. package/dist/packages/textarea/textarea.react.stories.d.ts +0 -33
  274. package/dist/packages/textarea/textarea.react.stories.js +0 -41
  275. package/dist/packages/textarea/textarea.stories.d.ts +0 -19
  276. package/dist/packages/textarea/textarea.stories.js +0 -85
  277. package/dist/packages/textarea/textarea.test.d.ts +0 -1
  278. package/dist/packages/textarea/textarea.test.js +0 -49
  279. package/dist/packages/toggle-styles.d.ts +0 -1
  280. package/dist/packages/toggle-styles.js +0 -108
  281. package/dist/setup-tests.d.ts +0 -1
  282. package/dist/setup-tests.js +0 -1
@@ -1,197 +0,0 @@
1
- import { getStorybookHelpers } from '@wc-toolkit/storybook-helpers';
2
- import { html } from 'lit';
3
- import '../affix/index.js';
4
- import '../attention/index.js';
5
- import '../textfield/index.js';
6
- import './index.js';
7
- const { events: sliderEvents, args: sliderArgs, argTypes: sliderArgTypes, } = getStorybookHelpers('w-slider');
8
- const meta = {
9
- title: 'Forms/Slider and Range Slider',
10
- args: sliderArgs,
11
- argTypes: sliderArgTypes,
12
- parameters: {
13
- actions: {
14
- handles: sliderEvents,
15
- },
16
- },
17
- };
18
- export default meta;
19
- export const Single = {
20
- render() {
21
- return html `
22
- <w-slider label="Single" min="0" max="100">
23
- <w-slider-thumb name="value"></w-slider-thumb>
24
- </w-slider>
25
- `;
26
- },
27
- };
28
- export const Range = {
29
- render() {
30
- return html `
31
- <w-slider label="Range" min="0" max="100">
32
- <w-slider-thumb slot="from" aria-label="From value" name="from"></w-slider-thumb>
33
- <w-slider-thumb slot="to" aria-label="To value" name="to"></w-slider-thumb>
34
- </w-slider>
35
- `;
36
- },
37
- };
38
- // Take a suffix attribute on `<w-slider>` I think, have `<w-slider-thumb>` get from that.
39
- export const SuffixSquareMeters = {
40
- args: {
41
- locale: 'nb',
42
- suffix: 'm²',
43
- },
44
- render({ locale, suffix }) {
45
- return html `
46
- <w-slider label="Apartment size" min="0" max="250" suffix="${suffix}" data-testid="sqm">
47
- <w-slider-thumb slot="from" aria-label="From size" name="from"></w-slider-thumb>
48
- <w-slider-thumb slot="to" aria-label="To size" name="to"></w-slider-thumb>
49
- </w-slider>
50
- <script type="module">
51
- const sqmSlider = document.querySelector('w-slider[data-testid="sqm"]');
52
- sqmSlider.formatter = window.getNumberFormatter('${locale}').format;
53
- </script>
54
- `;
55
- },
56
- };
57
- export const SuffixCurrency = {
58
- args: {
59
- locale: 'nb',
60
- suffix: 'kr',
61
- },
62
- render({ locale, suffix }) {
63
- return html `
64
- <w-slider label="Price" min="0" max="250000" suffix="${suffix}" data-testid="currency">
65
- <w-slider-thumb slot="from" aria-label="From price" name="from"></w-slider-thumb>
66
- <w-slider-thumb slot="to" aria-label="To price" name="to"></w-slider-thumb>
67
- </w-slider>
68
- <script type="module">
69
- const currencySlider = document.querySelector('w-slider[data-testid="currency"]');
70
- currencySlider.formatter = window.getNumberFormatter('${locale}').format;
71
- </script>
72
- `;
73
- },
74
- };
75
- export const SuffixKilometers = {
76
- args: {
77
- locale: 'nb',
78
- suffix: 'km',
79
- },
80
- render({ locale, suffix }) {
81
- return html `
82
- <w-slider label="Distance" min="0" max="250000" suffix="${suffix}" data-testid="km">
83
- <w-slider-thumb slot="from" aria-label="From distance" name="from"></w-slider-thumb>
84
- <w-slider-thumb slot="to" aria-label="To distance" name="to"></w-slider-thumb>
85
- </w-slider>
86
- <script type="module">
87
- const kmSlider = document.querySelector('w-slider[data-testid="km"]');
88
- kmSlider.formatter = window.getNumberFormatter('${locale}').format;
89
- </script>
90
- `;
91
- },
92
- };
93
- export const Marks = {
94
- args: {
95
- locale: 'nb',
96
- step: '5',
97
- markers: '5',
98
- },
99
- render({ markers, step }) {
100
- return html `
101
- <w-slider label="Single" min="0" max="100" step="${step}" markers="${markers}">
102
- <w-slider-thumb name="value"></w-slider-thumb>
103
- </w-slider>
104
- `;
105
- },
106
- };
107
- export const Step = {
108
- args: {
109
- step: 5,
110
- },
111
- render({ step }) {
112
- return html `
113
- <w-slider label="Single" step="${step}" min="0" max="100">
114
- <w-slider-thumb name="value"></w-slider-thumb>
115
- </w-slider>
116
- `;
117
- },
118
- };
119
- export const OverUnder = {
120
- args: {},
121
- render() {
122
- return html `
123
- <form id="overunder" style="margin-bottom: 16px" lang="nb">
124
- <w-slider label="Produksjonsår" min="1950" max="2025" data-testid="overunder">
125
- <w-slider-thumb
126
- slot="from"
127
- aria-label="Fra år"
128
- aria-description="1950 inkluderer kjøretøy produsert fram til 1950"
129
- name="from"></w-slider-thumb>
130
- <w-slider-thumb
131
- slot="to"
132
- aria-label="Til år"
133
- aria-description="2025 inkluderer kjøretøy produsert etter 2025"
134
- name="to"></w-slider-thumb>
135
- </w-slider>
136
- </form>
137
- <p>Drag the slider to show the value below. See the Code tab for how to format the labels.</p>
138
- <output>
139
- <dl>
140
- <dt>From:</dt>
141
- <dd id="overunder-from"></dd>
142
- <dt>To:</dt>
143
- <dd id="overunder-to"></dd>
144
- </dl>
145
- </output>
146
- <script>
147
- /** Here is how you can show labels to indicate min and max values are "up to and including" and "this value and above". */
148
- const overunderSlider = document.querySelector('w-slider[data-testid="overunder"]');
149
- overunderSlider.formatter = function (value) {
150
- if (value === '1950') {
151
- return 'Før 1950';
152
- }
153
- if (value === '2025') {
154
- return 'Etter 2025';
155
- }
156
- return value;
157
- };
158
-
159
- /** Code to show the form values in output */
160
- document.forms['overunder'].addEventListener('input', function () {
161
- const formData = new FormData(this);
162
- const from = formData.get('from');
163
- const to = formData.get('to');
164
- document.getElementById('overunder-from').innerText = from;
165
- document.getElementById('overunder-to').innerText = to;
166
- });
167
- </script>
168
- `;
169
- },
170
- };
171
- export const SingleError = {
172
- args: {
173
- locale: 'nb',
174
- },
175
- render() {
176
- return html `
177
- <w-slider label="Single" min="0" max="100">
178
- <p slot="description">Try typing a value over 100</p>
179
- <w-slider-thumb></w-slider-thumb>
180
- </w-slider>
181
- `;
182
- },
183
- };
184
- export const RangeError = {
185
- args: {
186
- locale: 'nb',
187
- },
188
- render() {
189
- return html `
190
- <w-slider label="Production year" min="1950" max="2025" over under>
191
- <p slot="description">Try typing a from value higher than a to value</p>
192
- <w-slider-thumb slot="from" name="from"></w-slider-thumb>
193
- <w-slider-thumb slot="to" name="to"></w-slider-thumb>
194
- </w-slider>
195
- `;
196
- },
197
- };
@@ -1,4 +0,0 @@
1
- import '../attention/index.js';
2
- import '../affix/index.js';
3
- import '../textfield/index.js';
4
- import './index.js';
@@ -1,83 +0,0 @@
1
- import { userEvent } from '@vitest/browser/context';
2
- import { html } from 'lit';
3
- import { expect, test } from 'vitest';
4
- import { render } from 'vitest-browser-lit';
5
- import '../attention/index.js';
6
- import '../affix/index.js';
7
- import '../textfield/index.js';
8
- import './index.js';
9
- test('single slider starts with a default value equal to max', async () => {
10
- const component = html `
11
- <form data-testid="form">
12
- <w-slider label="Single" min="0" max="100">
13
- <w-slider-thumb name="value"></w-slider-thumb>
14
- </w-slider>
15
- </form>
16
- `;
17
- const page = render(component);
18
- await expect.element(page.getByLabelText('Single').first()).toHaveValue('100');
19
- });
20
- test('range slider starts with a default from value equal to min, and to value equal to max', async () => {
21
- const component = html `
22
- <form data-testid="form">
23
- <w-slider label="Range" min="0" max="100">
24
- <w-slider-thumb aria-label="From" name="rangefrom" slot="from"></w-slider-thumb>
25
- <w-slider-thumb aria-label="To" name="rangeto" slot="to"></w-slider-thumb>
26
- </w-slider>
27
- </form>
28
- `;
29
- const page = render(component);
30
- await expect.element(page.getByLabelText('From').first()).toHaveValue('0');
31
- await expect.element(page.getByLabelText('To').first()).toHaveValue('100');
32
- });
33
- test('can set slider value via the range input', async () => {
34
- const component = html `
35
- <form data-testid="form">
36
- <w-slider label="Single" min="0" max="100">
37
- <w-slider-thumb name="value"></w-slider-thumb>
38
- </w-slider>
39
- </form>
40
- `;
41
- const page = render(component);
42
- await userEvent.type(page.getByLabelText('Single').first(), '{ArrowLeft}{ArrowLeft}{ArrowLeft}');
43
- await expect.element(page.getByLabelText('Single').first()).toHaveValue('97');
44
- await expect.element(page.getByRole('spinbutton')).toHaveValue(97); // keeps value in sync between inputs
45
- const formData = new FormData(page.getByTestId('form').element());
46
- expect(formData.get('value')).toBe('97');
47
- });
48
- test('can set slider value via the number input', async () => {
49
- const component = html `
50
- <form data-testid="form">
51
- <w-slider label="Single" min="0" max="100">
52
- <w-slider-thumb name="value"></w-slider-thumb>
53
- </w-slider>
54
- </form>
55
- `;
56
- const page = render(component);
57
- await page.getByRole('spinbutton').fill('50');
58
- await expect.element(page.getByRole('spinbutton')).toHaveValue(50);
59
- await expect.element(page.getByLabelText('Single').first()).toHaveValue('50'); // keeps value in sync between inputs
60
- const formData = new FormData(page.getByTestId('form').element());
61
- expect(formData.get('value')).toBe('50');
62
- });
63
- test('deleting from number input works as expected', async () => {
64
- const component = html `
65
- <form data-testid="form">
66
- <w-slider label="Production year" min="1950" max="2025" over under>
67
- <p slot="description">Try typing a from value higher than a to value</p>
68
- <w-slider-thumb slot="from" name="from"></w-slider-thumb>
69
- <w-slider-thumb slot="to" name="to"></w-slider-thumb>
70
- </w-slider>
71
- </form>
72
- `;
73
- const page = render(component);
74
- await expect.element(page.getByRole('spinbutton').last()).toHaveValue(2025);
75
- await userEvent.type(page.getByRole('spinbutton').last(), '{Backspace}');
76
- await expect.element(page.getByRole('spinbutton').last()).toHaveValue(202);
77
- await userEvent.type(page.getByRole('spinbutton').last(), '{Backspace}');
78
- await expect.element(page.getByRole('spinbutton').last()).toHaveValue(20);
79
- await userEvent.type(page.getByRole('spinbutton').last(), '{Backspace}');
80
- await expect.element(page.getByRole('spinbutton').last()).toHaveValue(2);
81
- await userEvent.type(page.getByRole('spinbutton').last(), '{Backspace}');
82
- await expect.element(page.getByRole('spinbutton').last()).not.toHaveValue();
83
- });
@@ -1 +0,0 @@
1
- export declare const wSliderThumbStyles: import("lit").CSSResult;
@@ -1,167 +0,0 @@
1
- import { css } from 'lit';
2
- /* For some reason the pseudoselectors for webkit and moz must be separate blocks :shrug: */
3
- export const wSliderThumbStyles = css `
4
- .w-slider-thumb {
5
- position: relative;
6
- display: grid;
7
- pointer-events: none; /* For range inputs we position two of these on top of each other. Let clicks go through the top one. */
8
- grid-template-areas:
9
- 'slider slider slider'
10
- 'frommarker . tomarker'
11
- 'fromtextfield . totextfield';
12
- grid-template-columns: 1fr 24px 1fr;
13
- }
14
-
15
- .w-slider-thumb__range {
16
- appearance: none;
17
- background-color: transparent;
18
- grid-area: slider;
19
- height: 44px; /* touch target */
20
- margin-left: 0;
21
- pointer-events: none; /* let clicks pass through for range slider where we place two inputs over each other */
22
- }
23
-
24
- .w-slider-thumb__range::-webkit-slider-runnable-track {
25
- box-shadow: none;
26
- color: var(--w-s-color-text);
27
- height: var(--w-slider-track-height);
28
- }
29
-
30
- /*
31
- Use anchor positioning to place the tooltip target in relation to the slider thumb.
32
- We use a polyfill to bring support to older Safari, Firefox at time of writing.
33
- */
34
- .w-slider-thumb__range::-webkit-slider-thumb {
35
- anchor-name: --thumb;
36
-
37
- appearance: none;
38
- cursor: pointer;
39
- background: var(--w-s-color-background-primary);
40
- border-radius: 50%;
41
- height: var(--w-slider-thumb-size);
42
- margin-top: calc(-1 * calc(var(--w-slider-thumb-offset) - calc(var(--w-slider-track-height) / 2)));
43
- pointer-events: initial;
44
- width: var(--w-slider-thumb-size);
45
- z-index: 1;
46
- }
47
-
48
- .w-slider-thumb__range::-moz-range-thumb {
49
- anchor-name: --thumb;
50
-
51
- appearance: none;
52
- cursor: pointer;
53
- background: var(--w-s-color-background-primary);
54
- border-radius: 50%;
55
- border-color: transparent;
56
- height: var(--w-slider-thumb-size);
57
- margin-top: calc(-1 * calc(var(--w-slider-thumb-offset) - calc(var(--w-slider-track-height) / 2)));
58
- pointer-events: initial;
59
- width: var(--w-slider-thumb-size);
60
- z-index: 1;
61
-
62
- box-shadow: none;
63
- }
64
-
65
- .w-slider-thumb__range:active::-webkit-slider-thumb,
66
- .w-slider-thumb__range:hover::-webkit-slider-thumb {
67
- background: var(--w-s-color-background-primary-hover);
68
- box-shadow: var(--w-shadow-slider-handle-hover);
69
- }
70
-
71
- .w-slider-thumb__range:focus,
72
- .w-slider-thumb__range:focus-visible {
73
- outline: none;
74
- }
75
-
76
- .w-slider-thumb__range:focus-visible::-webkit-slider-thumb {
77
- outline: 2px solid var(--w-s-color-border-focus);
78
- outline-offset: var(--w-outline-offset, 1px);
79
- box-shadow: none;
80
- }
81
-
82
- .w-slider-thumb__range:active::-moz-range-thumb,
83
- .w-slider-thumb__range:hover::-moz-range-thumb {
84
- background: var(--w-s-color-background-primary-hover);
85
- box-shadow: var(--w-shadow-slider-handle-hover);
86
- }
87
-
88
- .w-slider-thumb__range:focus-visible::-moz-range-thumb {
89
- outline: 2px solid var(--w-s-color-border-focus);
90
- outline-offset: var(--w-outline-offset, 1px);
91
- box-shadow: none;
92
- }
93
-
94
- .w-slider-thumb__tooltip-target {
95
- display: block;
96
- pointer-events: none;
97
- position: absolute;
98
- border: 2px solid transparent;
99
- border-radius: 20px;
100
- width: 8px;
101
- height: 8px;
102
- position-anchor: --thumb;
103
- position-area: center; /* Position the tooltip target right on the range thumb */
104
- }
105
-
106
- /* Uncomment this to debug the invisible anchor target */
107
- /* .w-slider-thumb__tooltip-target { border-color: lime; } */
108
-
109
- .w-slider-thumb__from-marker,
110
- .w-slider-thumb__to-marker {
111
- margin-inline: 2px; /* visual alignment with input border, slider thumb */
112
- color: var(--w-s-color-text-subtle);
113
- font-size: var(--w-font-size-s);
114
- line-height: var(--w-line-height-s);
115
- }
116
-
117
- .w-slider-thumb__from-marker {
118
- grid-area: frommarker;
119
- }
120
-
121
- .w-slider-thumb__to-marker {
122
- grid-area: tomarker;
123
- text-align: right;
124
- }
125
-
126
- .w-slider-thumb__textfield {
127
- margin-top: 10px;
128
- pointer-events: auto;
129
- grid-row: 3 / 4;
130
- grid-column: 1 / 3; /* Single sliders should have the text field use the fromtextfield _and_ gap portion of the CSS grid. */
131
- }
132
-
133
- :host([name='from']) .w-slider-thumb__textfield {
134
- grid-column: 1 / 2; /* Range sliders should leave the gap empty. */
135
- }
136
-
137
- :host([name='from']) .w-slider-thumb__range {
138
- margin-left: var(--w-slider-thumb-size);
139
- }
140
-
141
- :host([name='to']) .w-slider-thumb__range {
142
- margin-right: var(--w-slider-thumb-size);
143
- }
144
-
145
- :host([name='from']) .w-slider-thumb__range::-webkit-slider-thumb,
146
- :host([name='from']) .w-slider-thumb__tooltip-target {
147
- transform: translateX(calc(-1 * var(--w-slider-thumb-size) - 1px));
148
- }
149
-
150
- :host([name='from']) .w-slider-thumb__range::-moz-range-thumb {
151
- transform: translateX(calc(-1 * var(--w-slider-thumb-size) - 1px));
152
- }
153
-
154
- :host([name='to']) .w-slider-thumb__textfield {
155
- grid-row: 3 / 4;
156
- grid-column: 3 / 4;
157
- }
158
-
159
- :host([name='to']) .w-slider-thumb__tooltip-target,
160
- :host([name='to']) .w-slider-thumb__range::-webkit-slider-thumb {
161
- transform: translateX(calc(var(--w-slider-thumb-size) - 1px));
162
- }
163
-
164
- :host([name='to']) .w-slider-thumb__range::-moz-range-thumb {
165
- transform: translateX(calc(var(--w-slider-thumb-size) - 1px));
166
- }
167
- `;
@@ -1 +0,0 @@
1
- export declare const wSliderStyles: import("lit").CSSResult;
@@ -1,134 +0,0 @@
1
- import { css } from 'lit';
2
- export const wSliderStyles = css `
3
- .w-slider {
4
- position: relative;
5
- border: none;
6
- padding: 0;
7
- margin: 0;
8
- display: grid;
9
- width: 100%;
10
- grid-template-areas:
11
- 'label'
12
- 'description'
13
- 'slider';
14
- grid-template-columns: 1fr;
15
-
16
- --w-slider-track-background: var(--w-s-color-background-disabled-subtle);
17
- --w-slider-track-active-background: var(--w-s-color-background-primary);
18
- --w-slider-track-height: 4px;
19
- --w-slider-track-active-height: 6px;
20
- --w-slider-thumb-background: var(--w-s-color-background-primary);
21
- --w-slider-thumb-background-hover: var(--w-s-color-background-primary-hover);
22
- --w-slider-thumb-size: 28px;
23
- --w-slider-thumb-offset: calc(var(--w-slider-thumb-size) / 2);
24
- --w-slider-marker-color: var(--w-s-color-border);
25
-
26
- /* Math corner to calculate the fill of the slider and placement of markers. */
27
-
28
- /* The --min value can be non-zero, f. ex. choosing a year from 1950 to 2025. Normalize the values so we start at 0 and run to max - min. */
29
- --_value-range: calc(var(--max) - var(--min));
30
-
31
- /** Round up to the nearest --step, which defaults to 1 (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/range#step) */
32
- --_from-in-range: round(up, max(calc(var(--from) - var(--min)), 0), var(--step, 1));
33
-
34
- /* limit to maximum value in range so typing a value larger than max doesn't explode layouts */
35
- --_to-in-range: round(up, min(calc(var(--to) - var(--min)), var(--_value-range)), var(--step, 1));
36
-
37
- /* Position the starting point of the fill in the case of a non-zero --from value in a range slider.
38
- * In other words, given a width of 100% how many percent should be left unfilled/blank
39
- * at the beginning of the range slider (dashes in this ASCII-range-slider: |---O******O|) */
40
- --_from-as-percent-of-max: calc(var(--_from-in-range) / var(--_value-range) * 100);
41
- --_blank-values-before: var(--_from-as-percent-of-max);
42
-
43
- /* Set the width of the fill as a percentage.
44
- * In other words, given a width of 100% how many percent should be left unfilled/blank
45
- * at the end of the slider (dashes in this ASCII-slider: |******O---|) */
46
- --_to-as-percent-of-max: calc(var(--_to-in-range) / var(--_value-range) * 100);
47
- --_filled-values: calc(var(--_to-as-percent-of-max) - var(--_blank-values-before));
48
-
49
- /* Vertical position of range and markers */
50
- --_range-top: calc(
51
- var(--w-slider-thumb-size) / 2 + calc(var(--w-slider-track-active-height) - calc(var(--w-slider-track-height) / 2) + 1px)
52
- );
53
- }
54
-
55
- .w-slider__label {
56
- grid-area: label;
57
- font-size: var(--w-font-size-s);
58
- line-height: var(--w-line-height-s);
59
- font-weight: bold;
60
- padding-bottom: 8px;
61
- color: var(--w-s-color-text);
62
- }
63
-
64
- .w-slider__description {
65
- grid-area: description;
66
- }
67
-
68
- .w-slider__range {
69
- align-self: center;
70
- background: var(--w-slider-track-background);
71
- border-radius: 4px;
72
- height: var(--w-slider-track-active-height);
73
- position: absolute;
74
- /* For range sliders to avoid overlapping the slider thumbs we transform them to
75
- be visually to the left and right of their respective input[type="range"]. This
76
- padding is here so the active-range element is the same width as the input fields. */
77
- padding-inline-start: var(--active-range-inline-start-padding, 0);
78
- padding-inline-end: var(--active-range-inline-end-padding, 0);
79
- top: var(--_range-top);
80
- left: 0;
81
- right: 0;
82
- grid-area: slider;
83
- }
84
-
85
- .w-slider__active-range {
86
- box-sizing: content-box;
87
- background: var(--w-slider-track-active-background);
88
- height: var(--w-slider-track-active-height);
89
-
90
- border-start-start-radius: var(--active-range-border-radius, 0);
91
- border-end-start-radius: var(--active-range-border-radius, 0);
92
-
93
- margin-left: calc(calc(var(--_blank-values-before) * 1%) - var(--active-range-inline-start-padding, 0px));
94
- width: calc(calc(var(--_filled-values) * 1%) + var(--active-range-inline-end-padding, 0px));
95
- z-index: 1;
96
- }
97
-
98
- .w-slider__markers {
99
- --_marker-height: 7px;
100
- --_marker-width: 1px;
101
-
102
- align-self: center;
103
-
104
- /* Creates a linear gradient with --_marker-width wide markers
105
- followed by enough transparent that we can repeat the gradient
106
- along the X axis and have markers visible where we want them. */
107
- background: linear-gradient(
108
- to right,
109
- var(--w-slider-marker-color) var(--_marker-width),
110
- rgba(0, 0, 0, 0) 1px calc(100% - 1px),
111
- var(--w-slider-marker-color) 100%
112
- ) repeat-x;
113
- --_step-width-as-percent: calc(var(--markers) / var(--_value-range) * 100);
114
- background-size: calc(var(--_step-width-as-percent) * 1%) var(--_marker-height);
115
-
116
- background-position: bottom 0 left 8px right 8px;
117
- position: absolute;
118
- top: calc(var(--_range-top) + 2px);
119
- left: 1px;
120
- right: 1px;
121
- grid-area: slider;
122
- height: var(--_marker-height);
123
- margin-inline: var(--w-slider-thumb-offset);
124
- }
125
-
126
- slot::slotted(w-slider-thumb) {
127
- position: static;
128
- top: 0;
129
- left: 0;
130
- right: 0;
131
- bottom: 0;
132
- grid-area: slider;
133
- }
134
- `;
@@ -1 +0,0 @@
1
- export declare const styles: import("lit").CSSResult;
@@ -1,2 +0,0 @@
1
- import { css } from 'lit';
2
- export const styles = css `*,:before,:after{--w-rotate:0;--w-rotate-x:0;--w-rotate-y:0;--w-rotate-z:0;--w-scale-x:1;--w-scale-y:1;--w-scale-z:1;--w-skew-x:0;--w-skew-y:0;--w-translate-x:0;--w-translate-y:0;--w-translate-z:0}.hidden{display:none}.absolute{position:absolute}.relative{position:relative}.static{position:static}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}`;
@@ -1,36 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import '@warp-ds/icons/elements/check-16';
3
- /**
4
- * Steps are used to show progress through a process or to guide users through a multi-step task.
5
- *
6
- * [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/components-steps--docs)
7
- */
8
- declare class WarpSteps extends LitElement {
9
- horizontal: boolean;
10
- right: boolean;
11
- static styles: import("lit").CSSResult[];
12
- constructor();
13
- updated(): void;
14
- updateStepsContext(): void;
15
- render(): import("lit").TemplateResult<1>;
16
- }
17
- interface StepsContext {
18
- horizontal?: boolean;
19
- right?: boolean;
20
- isLast?: boolean;
21
- isFirst?: boolean;
22
- }
23
- /**
24
- * Individual step component that shows a single step in a process
25
- */
26
- declare class WarpStep extends LitElement {
27
- active: boolean;
28
- completed: boolean;
29
- private _context;
30
- static styles: import("lit").CSSResult[];
31
- constructor();
32
- setContext(context: StepsContext): void;
33
- getAriaLabel(): string;
34
- render(): import("lit").TemplateResult<1>;
35
- }
36
- export { WarpSteps, WarpStep };