@scania/tegel 0.0.1-beta.7 → 0.0.2

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 (491) hide show
  1. package/dist/cjs/{index-e1c79686.js → index-b98965c7.js} +7 -0
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/sdds-accordion-item.cjs.entry.js +21 -21
  4. package/dist/cjs/sdds-accordion.cjs.entry.js +12 -12
  5. package/dist/cjs/sdds-badges.cjs.entry.js +45 -46
  6. package/dist/cjs/sdds-banner.cjs.entry.js +79 -0
  7. package/dist/cjs/sdds-block.cjs.entry.js +32 -0
  8. package/dist/cjs/sdds-body-cell_2.cjs.entry.js +160 -160
  9. package/dist/cjs/sdds-breadcrumb-item.cjs.entry.js +25 -0
  10. package/dist/cjs/sdds-breadcrumb.cjs.entry.js +23 -0
  11. package/dist/cjs/sdds-button.cjs.entry.js +25 -24
  12. package/dist/cjs/sdds-card.cjs.entry.js +56 -0
  13. package/dist/cjs/sdds-checkbox.cjs.entry.js +55 -0
  14. package/dist/cjs/sdds-datetime.cjs.entry.js +78 -49
  15. package/dist/cjs/sdds-dropdown-filter.cjs.entry.js +83 -83
  16. package/dist/cjs/sdds-dropdown_2.cjs.entry.js +327 -321
  17. package/dist/cjs/sdds-header-cell.cjs.entry.js +130 -132
  18. package/dist/cjs/sdds-icon.cjs.entry.js +30 -30
  19. package/dist/cjs/sdds-inline-tab.cjs.entry.js +22 -0
  20. package/dist/cjs/sdds-inline-tabs-fullbleed.cjs.entry.js +89 -87
  21. package/dist/cjs/sdds-inline-tabs.cjs.entry.js +212 -202
  22. package/dist/cjs/sdds-link.cjs.entry.js +28 -0
  23. package/dist/cjs/sdds-message.cjs.entry.js +41 -0
  24. package/dist/cjs/sdds-modal.cjs.entry.js +42 -40
  25. package/dist/cjs/sdds-navigation-tabs.cjs.entry.js +89 -86
  26. package/dist/cjs/sdds-popover-canvas.cjs.entry.js +74 -66
  27. package/dist/cjs/sdds-popover-menu.cjs.entry.js +75 -65
  28. package/dist/cjs/sdds-radio-button.cjs.entry.js +32 -0
  29. package/dist/cjs/sdds-slider.cjs.entry.js +348 -327
  30. package/dist/cjs/sdds-spinner.cjs.entry.js +11 -11
  31. package/dist/cjs/sdds-table-body-row-expandable.cjs.entry.js +73 -72
  32. package/dist/cjs/sdds-table-body.cjs.entry.js +235 -235
  33. package/dist/cjs/sdds-table-footer.cjs.entry.js +155 -156
  34. package/dist/cjs/sdds-table-header.cjs.entry.js +90 -91
  35. package/dist/cjs/sdds-table-toolbar.cjs.entry.js +56 -57
  36. package/dist/cjs/sdds-table.cjs.entry.js +58 -59
  37. package/dist/cjs/sdds-textarea.cjs.entry.js +57 -44
  38. package/dist/cjs/sdds-textfield.cjs.entry.js +73 -64
  39. package/dist/cjs/sdds-toast.cjs.entry.js +86 -0
  40. package/dist/cjs/sdds-toggle.cjs.entry.js +44 -0
  41. package/dist/cjs/sdds-tooltip.cjs.entry.js +94 -85
  42. package/dist/cjs/tegel.cjs.js +2 -2
  43. package/dist/collection/collection-manifest.json +12 -0
  44. package/dist/collection/components/accordion/accordion-item/accordion-item.css +30 -11
  45. package/dist/collection/components/accordion/accordion-item/accordion-item.js +142 -142
  46. package/dist/collection/components/accordion/accordion.css +2 -16
  47. package/dist/collection/components/accordion/accordion.js +62 -62
  48. package/dist/collection/components/accordion/accordion.stories.js +90 -0
  49. package/dist/collection/components/badge/badge.stories.js +102 -0
  50. package/dist/collection/components/badge/badges.css +2 -2
  51. package/dist/collection/components/badge/badges.js +147 -150
  52. package/dist/collection/components/banner/banner.stories.js +92 -0
  53. package/dist/collection/components/banner/sdds-banner.css +88 -0
  54. package/dist/collection/components/banner/sdds-banner.js +330 -0
  55. package/dist/collection/components/banner/sdds-banner.stories.js +129 -0
  56. package/dist/collection/components/block/block-native.stories.js +48 -0
  57. package/dist/collection/components/block/sdds-block.css +22 -0
  58. package/dist/collection/components/block/sdds-block.js +55 -0
  59. package/dist/collection/components/block/sdds-block.stories.js +48 -0
  60. package/dist/collection/components/breadcrumb/breadcrumb-component.css +30 -0
  61. package/dist/collection/components/breadcrumb/breadcrumb-item/breadcrumb-item.css +43 -0
  62. package/dist/collection/components/breadcrumb/breadcrumb-item/breadcrumb-item.js +83 -0
  63. package/dist/collection/components/breadcrumb/breadcrumb.js +22 -0
  64. package/dist/collection/components/breadcrumb/breadcrumb.stories.js +26 -0
  65. package/dist/collection/components/button/button-component.js +152 -151
  66. package/dist/collection/components/button/button-native.stories.js +187 -0
  67. package/dist/collection/components/button/button-webcomponent.stories.js +189 -0
  68. package/dist/collection/components/button/button.css +63 -51
  69. package/dist/collection/components/card/card.stories.js +167 -0
  70. package/dist/collection/components/card/sdds-card.css +78 -0
  71. package/dist/collection/components/card/sdds-card.js +276 -0
  72. package/dist/collection/components/card/sdds-card.stories.js +168 -0
  73. package/dist/collection/components/checkbox/checkbox.stories.js +54 -0
  74. package/dist/collection/components/checkbox/sdds-checkbox.css +95 -0
  75. package/dist/collection/components/checkbox/sdds-checkbox.js +239 -0
  76. package/dist/collection/components/checkbox/sdds-checkbox.stories.js +71 -0
  77. package/dist/collection/components/chips/chips.stories.js +106 -0
  78. package/dist/collection/components/data-table/native-table.stories.js +160 -0
  79. package/dist/collection/components/data-table/table/table.js +252 -253
  80. package/dist/collection/components/data-table/table-body/table-body.css +1 -1
  81. package/dist/collection/components/data-table/table-body/table-body.js +425 -425
  82. package/dist/collection/components/data-table/table-body-cell/table-body-cell.css +3 -3
  83. package/dist/collection/components/data-table/table-body-cell/table-body-cell.js +168 -169
  84. package/dist/collection/components/data-table/table-body-row/table-body-row.css +24 -45
  85. package/dist/collection/components/data-table/table-body-row/table-body-row.js +165 -164
  86. package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.css +23 -24
  87. package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.js +156 -155
  88. package/dist/collection/components/data-table/table-component-basic.stories.js +161 -0
  89. package/dist/collection/components/data-table/table-component-batch-actions.stories.js +128 -0
  90. package/dist/collection/components/data-table/table-component-bodydata.stories.js +58 -0
  91. package/dist/collection/components/data-table/table-component-custom-width.stories.js +197 -0
  92. package/dist/collection/components/data-table/table-component-event-listeners.stories.js +151 -0
  93. package/dist/collection/components/data-table/table-component-expandable-rows.stories.js +135 -0
  94. package/dist/collection/components/data-table/table-component-filtering.stories.js +137 -0
  95. package/dist/collection/components/data-table/table-component-multiselect.stories.js +158 -0
  96. package/dist/collection/components/data-table/table-component-pagination.stories.js +127 -0
  97. package/dist/collection/components/data-table/table-component-sorting.stories.js +126 -0
  98. package/dist/collection/components/data-table/table-footer/table-footer.css +9 -5
  99. package/dist/collection/components/data-table/table-footer/table-footer.js +354 -355
  100. package/dist/collection/components/data-table/table-header/table-header.css +22 -36
  101. package/dist/collection/components/data-table/table-header/table-header.js +152 -153
  102. package/dist/collection/components/data-table/table-header-cell/table-header-cell.css +9 -8
  103. package/dist/collection/components/data-table/table-header-cell/table-header-cell.js +317 -320
  104. package/dist/collection/components/data-table/table-toolbar/table-toolbar.css +7 -6
  105. package/dist/collection/components/data-table/table-toolbar/table-toolbar.js +141 -142
  106. package/dist/collection/components/datetime/datetime.css +68 -58
  107. package/dist/collection/components/datetime/datetime.js +344 -243
  108. package/dist/collection/components/datetime/datetime.stories.js +207 -0
  109. package/dist/collection/components/divider/divider.stories.js +133 -0
  110. package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.js +339 -339
  111. package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.stories.js +130 -0
  112. package/dist/collection/components/dropdown/dropdown-native.stories.js +90 -0
  113. package/dist/collection/components/dropdown/dropdown-option/dropdown-option.js +185 -185
  114. package/dist/collection/components/dropdown/dropdown-wc-default.stories.js +167 -0
  115. package/dist/collection/components/dropdown/dropdown-wc-multiselect.stories.js +146 -0
  116. package/dist/collection/components/dropdown/dropdown.css +146 -86
  117. package/dist/collection/components/dropdown/dropdown.js +576 -553
  118. package/dist/collection/components/footer/footer.stories.js +117 -0
  119. package/dist/collection/components/header/header-all.stories.js +217 -0
  120. package/dist/collection/components/header/header-default.stories.js +47 -0
  121. package/dist/collection/components/header/header-inline.stories.js +113 -0
  122. package/dist/collection/components/header/header-search.stories.js +263 -0
  123. package/dist/collection/components/header/header-toolbar.stories.js +204 -0
  124. package/dist/collection/components/icon/icon-font.stories.js +57 -0
  125. package/dist/collection/components/icon/icon-web-component.stories.js +51 -0
  126. package/dist/collection/components/icon/icon.js +89 -89
  127. package/dist/collection/components/link/link.stories.js +45 -0
  128. package/dist/collection/components/link/sdds-link.css +36 -0
  129. package/dist/collection/components/link/sdds-link.js +121 -0
  130. package/dist/collection/components/link/sdds-link.stories.js +70 -0
  131. package/dist/collection/components/message/message.stories.js +108 -0
  132. package/dist/collection/components/message/sdds-message.css +70 -0
  133. package/dist/collection/components/message/sdds-message.js +135 -0
  134. package/dist/collection/components/message/sdds-message.stories.js +106 -0
  135. package/dist/collection/components/modal/modal-native.stories.js +129 -0
  136. package/dist/collection/components/modal/modal-webcomponent.stories.js +86 -0
  137. package/dist/collection/components/modal/modal.css +63 -37
  138. package/dist/collection/components/modal/modal.js +148 -146
  139. package/dist/collection/components/popover-canvas/popover-canvas.css +3 -3
  140. package/dist/collection/components/popover-canvas/popover-canvas.js +219 -190
  141. package/dist/collection/components/popover-canvas/popover-canvas.stories.js +89 -0
  142. package/dist/collection/components/popover-menu/popover-menu-icons.stories.js +121 -0
  143. package/dist/collection/components/popover-menu/popover-menu.css +2 -2
  144. package/dist/collection/components/popover-menu/popover-menu.js +220 -189
  145. package/dist/collection/components/popover-menu/popover-menu.stories.js +114 -0
  146. package/dist/collection/components/radio-button/radio-button-component.css +123 -0
  147. package/dist/collection/components/radio-button/radio-button-component.stories.js +91 -0
  148. package/dist/collection/components/radio-button/radio-button.js +160 -0
  149. package/dist/collection/components/radio-button/radio-button.stories.js +68 -0
  150. package/dist/collection/components/side-menu/side-menu.stories.js +182 -0
  151. package/dist/collection/components/slider/slider.css +56 -19
  152. package/dist/collection/components/slider/slider.js +721 -682
  153. package/dist/collection/components/slider/slider.stories.js +208 -0
  154. package/dist/collection/components/spinner/spinner.js +61 -61
  155. package/dist/collection/components/spinner/spinner.stories.js +59 -0
  156. package/dist/collection/components/stepper/stepper.stories.js +139 -0
  157. package/dist/collection/components/tabs/inline-tabs-default/inline-tab/inline-tab.css +3 -0
  158. package/dist/collection/components/tabs/inline-tabs-default/inline-tab/inline-tab.js +80 -0
  159. package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.css +21 -24
  160. package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.js +312 -302
  161. package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.stories.js +71 -0
  162. package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.css +36 -67
  163. package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.js +128 -126
  164. package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.js +46 -0
  165. package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.css +22 -18
  166. package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.js +128 -103
  167. package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.stories.js +32 -0
  168. package/dist/collection/components/textarea/textarea.css +60 -45
  169. package/dist/collection/components/textarea/textarea.js +394 -328
  170. package/dist/collection/components/textarea/textarea.stories.js +169 -0
  171. package/dist/collection/components/textfield/textfield.css +92 -84
  172. package/dist/collection/components/textfield/textfield.js +430 -350
  173. package/dist/collection/components/textfield/textfield.stories.js +239 -0
  174. package/dist/collection/components/toast/sdds-toast.css +102 -0
  175. package/dist/collection/components/toast/sdds-toast.js +256 -0
  176. package/dist/collection/components/toast/sdds-toast.stories.js +86 -0
  177. package/dist/collection/components/toast/toast.stories.js +129 -0
  178. package/dist/collection/components/toggle/sdds-toggle.css +104 -0
  179. package/dist/collection/components/toggle/sdds-toggle.js +261 -0
  180. package/dist/collection/components/toggle/sdds-toggle.stories.js +92 -0
  181. package/dist/collection/components/toggle/toggle.stories.js +72 -0
  182. package/dist/collection/components/tooltip/tooltip.css +3 -3
  183. package/dist/collection/components/tooltip/tooltip.js +229 -200
  184. package/dist/collection/components/tooltip/tooltip.stories.js +115 -0
  185. package/dist/collection/components/utility/colour/background-color.stories.js +96 -0
  186. package/dist/collection/components/utility/colour/text-color.stories.js +94 -0
  187. package/dist/collection/foundations-stories/colour/colour-brand.stories.js +38 -0
  188. package/dist/collection/foundations-stories/colour/colour-scales.stories.js +71 -0
  189. package/dist/collection/foundations-stories/colour/colour-semantic.stories.js +40 -0
  190. package/dist/collection/foundations-stories/grid/grid.stories.js +386 -0
  191. package/dist/collection/foundations-stories/spacing/spacing-element.stories.js +100 -0
  192. package/dist/collection/foundations-stories/spacing/spacing-layout.stories.js +94 -0
  193. package/dist/collection/foundations-stories/typography/typography-body.stories.js +16 -0
  194. package/dist/collection/foundations-stories/typography/typography-detail.stories.js +17 -0
  195. package/dist/collection/foundations-stories/typography/typography-headline.stories.js +39 -0
  196. package/dist/collection/foundations-stories/typography/typography-paragraph.stories.js +12 -0
  197. package/dist/collection/index.js +1 -1
  198. package/dist/collection/utils/utils.js +12 -12
  199. package/dist/components/dropdown-option.js +94 -94
  200. package/dist/components/dropdown.js +296 -289
  201. package/dist/components/icon.js +49 -49
  202. package/dist/components/index.d.ts +12 -0
  203. package/dist/components/index.js +12 -0
  204. package/dist/components/sdds-accordion-item.js +46 -46
  205. package/dist/components/sdds-accordion.js +29 -29
  206. package/dist/components/sdds-badges.js +66 -67
  207. package/dist/components/sdds-banner.d.ts +11 -0
  208. package/dist/components/sdds-banner.js +119 -0
  209. package/dist/components/sdds-block.d.ts +11 -0
  210. package/dist/components/sdds-block.js +48 -0
  211. package/dist/components/sdds-breadcrumb-item.d.ts +11 -0
  212. package/dist/components/sdds-breadcrumb-item.js +43 -0
  213. package/dist/components/sdds-breadcrumb.d.ts +11 -0
  214. package/dist/components/sdds-breadcrumb.js +37 -0
  215. package/dist/components/sdds-button.js +48 -47
  216. package/dist/components/sdds-card.d.ts +11 -0
  217. package/dist/components/sdds-card.js +84 -0
  218. package/dist/components/sdds-checkbox.d.ts +11 -0
  219. package/dist/components/sdds-checkbox.js +76 -0
  220. package/dist/components/sdds-datetime.js +112 -73
  221. package/dist/components/sdds-dropdown-filter.js +127 -127
  222. package/dist/components/sdds-header-cell.js +161 -164
  223. package/dist/components/sdds-inline-tab.d.ts +11 -0
  224. package/dist/components/sdds-inline-tab.js +40 -0
  225. package/dist/components/sdds-inline-tabs-fullbleed.js +108 -106
  226. package/dist/components/sdds-inline-tabs.js +236 -226
  227. package/dist/components/sdds-link.d.ts +11 -0
  228. package/dist/components/sdds-link.js +6 -0
  229. package/dist/components/sdds-link2.js +44 -0
  230. package/dist/components/sdds-message.d.ts +11 -0
  231. package/dist/components/sdds-message.js +67 -0
  232. package/dist/components/sdds-modal.js +68 -60
  233. package/dist/components/sdds-navigation-tabs.js +108 -104
  234. package/dist/components/sdds-popover-canvas.js +98 -87
  235. package/dist/components/sdds-popover-menu.js +99 -86
  236. package/dist/components/sdds-radio-button.d.ts +11 -0
  237. package/dist/components/sdds-radio-button.js +52 -0
  238. package/dist/components/sdds-slider.js +385 -357
  239. package/dist/components/sdds-spinner.js +27 -27
  240. package/dist/components/sdds-table-body-row-expandable.js +96 -95
  241. package/dist/components/sdds-table-body.js +281 -281
  242. package/dist/components/sdds-table-footer.js +186 -187
  243. package/dist/components/sdds-table-header.js +115 -116
  244. package/dist/components/sdds-table-toolbar.js +78 -79
  245. package/dist/components/sdds-table.js +81 -82
  246. package/dist/components/sdds-textarea.js +92 -73
  247. package/dist/components/sdds-textfield.js +109 -93
  248. package/dist/components/sdds-toast.d.ts +11 -0
  249. package/dist/components/sdds-toast.js +117 -0
  250. package/dist/components/sdds-toggle.d.ts +11 -0
  251. package/dist/components/sdds-toggle.js +69 -0
  252. package/dist/components/sdds-tooltip.js +117 -106
  253. package/dist/components/table-body-cell.js +95 -96
  254. package/dist/components/table-body-row.js +114 -113
  255. package/dist/esm/{index-b67b15a6.js → index-32571711.js} +7 -0
  256. package/dist/esm/loader.js +2 -2
  257. package/dist/esm/polyfills/core-js.js +0 -0
  258. package/dist/esm/polyfills/dom.js +0 -0
  259. package/dist/esm/polyfills/es5-html-element.js +0 -0
  260. package/dist/esm/polyfills/index.js +0 -0
  261. package/dist/esm/polyfills/system.js +0 -0
  262. package/dist/esm/sdds-accordion-item.entry.js +21 -21
  263. package/dist/esm/sdds-accordion.entry.js +12 -12
  264. package/dist/esm/sdds-badges.entry.js +45 -46
  265. package/dist/esm/sdds-banner.entry.js +75 -0
  266. package/dist/esm/sdds-block.entry.js +28 -0
  267. package/dist/esm/sdds-body-cell_2.entry.js +160 -160
  268. package/dist/esm/sdds-breadcrumb-item.entry.js +21 -0
  269. package/dist/esm/sdds-breadcrumb.entry.js +19 -0
  270. package/dist/esm/sdds-button.entry.js +25 -24
  271. package/dist/esm/sdds-card.entry.js +52 -0
  272. package/dist/esm/sdds-checkbox.entry.js +51 -0
  273. package/dist/esm/sdds-datetime.entry.js +78 -49
  274. package/dist/esm/sdds-dropdown-filter.entry.js +83 -83
  275. package/dist/esm/sdds-dropdown_2.entry.js +327 -321
  276. package/dist/esm/sdds-header-cell.entry.js +130 -132
  277. package/dist/esm/sdds-icon.entry.js +30 -30
  278. package/dist/esm/sdds-inline-tab.entry.js +18 -0
  279. package/dist/esm/sdds-inline-tabs-fullbleed.entry.js +89 -87
  280. package/dist/esm/sdds-inline-tabs.entry.js +212 -202
  281. package/dist/esm/sdds-link.entry.js +24 -0
  282. package/dist/esm/sdds-message.entry.js +37 -0
  283. package/dist/esm/sdds-modal.entry.js +42 -40
  284. package/dist/esm/sdds-navigation-tabs.entry.js +89 -86
  285. package/dist/esm/sdds-popover-canvas.entry.js +74 -66
  286. package/dist/esm/sdds-popover-menu.entry.js +75 -65
  287. package/dist/esm/sdds-radio-button.entry.js +28 -0
  288. package/dist/esm/sdds-slider.entry.js +348 -327
  289. package/dist/esm/sdds-spinner.entry.js +11 -11
  290. package/dist/esm/sdds-table-body-row-expandable.entry.js +73 -72
  291. package/dist/esm/sdds-table-body.entry.js +235 -235
  292. package/dist/esm/sdds-table-footer.entry.js +155 -156
  293. package/dist/esm/sdds-table-header.entry.js +90 -91
  294. package/dist/esm/sdds-table-toolbar.entry.js +56 -57
  295. package/dist/esm/sdds-table.entry.js +58 -59
  296. package/dist/esm/sdds-textarea.entry.js +57 -44
  297. package/dist/esm/sdds-textfield.entry.js +73 -64
  298. package/dist/esm/sdds-toast.entry.js +82 -0
  299. package/dist/esm/sdds-toggle.entry.js +40 -0
  300. package/dist/esm/sdds-tooltip.entry.js +94 -85
  301. package/dist/esm/tegel.js +2 -2
  302. package/dist/tegel/p-05d3cfc8.entry.js +1 -0
  303. package/dist/tegel/p-13a25c7f.entry.js +1 -0
  304. package/dist/tegel/p-13b783f1.js +2 -0
  305. package/dist/tegel/p-1dda8de9.entry.js +1 -0
  306. package/dist/tegel/p-2248b59e.entry.js +1 -0
  307. package/dist/tegel/p-232e5c9a.entry.js +1 -0
  308. package/dist/tegel/p-2375f0eb.entry.js +1 -0
  309. package/dist/tegel/p-29deedc6.entry.js +1 -0
  310. package/dist/tegel/p-2f52021b.entry.js +1 -0
  311. package/dist/tegel/p-3344582d.entry.js +1 -0
  312. package/dist/tegel/{p-040efb32.entry.js → p-4b14324d.entry.js} +1 -1
  313. package/dist/tegel/p-561fbe77.entry.js +1 -0
  314. package/dist/tegel/p-5a215722.entry.js +1 -0
  315. package/dist/tegel/p-5f7b1539.entry.js +1 -0
  316. package/dist/tegel/p-6f382b38.entry.js +1 -0
  317. package/dist/tegel/p-765e2719.entry.js +1 -0
  318. package/dist/tegel/p-76f60546.entry.js +1 -0
  319. package/dist/tegel/p-7a5244b6.entry.js +1 -0
  320. package/dist/tegel/p-816ff5f7.entry.js +1 -0
  321. package/dist/tegel/p-81d2d57b.entry.js +1 -0
  322. package/dist/tegel/p-87650f36.entry.js +1 -0
  323. package/dist/tegel/p-8e6f885c.entry.js +1 -0
  324. package/dist/tegel/p-8e9dcc20.entry.js +1 -0
  325. package/dist/tegel/p-997fc919.entry.js +1 -0
  326. package/dist/tegel/p-9a057c9a.entry.js +1 -0
  327. package/dist/tegel/p-9a95e92c.entry.js +1 -0
  328. package/dist/tegel/p-a75ff060.entry.js +1 -0
  329. package/dist/tegel/p-bf1216f9.entry.js +1 -0
  330. package/dist/tegel/p-bf597564.entry.js +1 -0
  331. package/dist/tegel/p-d2217bf0.entry.js +1 -0
  332. package/dist/tegel/p-e335137d.entry.js +1 -0
  333. package/dist/tegel/p-e34cce75.entry.js +1 -0
  334. package/dist/tegel/p-e55d09f2.entry.js +1 -0
  335. package/dist/tegel/p-ebbffa8a.entry.js +1 -0
  336. package/dist/tegel/{p-a5919930.entry.js → p-ed076d47.entry.js} +1 -1
  337. package/dist/tegel/p-ef887910.entry.js +1 -0
  338. package/dist/tegel/p-f4b70868.entry.js +1 -0
  339. package/dist/tegel/p-f52a0b63.entry.js +1 -0
  340. package/dist/tegel/p-f5bf214b.entry.js +1 -0
  341. package/dist/tegel/p-fd1b5923.entry.js +1 -0
  342. package/dist/tegel/tegel.css +13 -5
  343. package/dist/tegel/tegel.esm.js +1 -1
  344. package/dist/types/components/accordion/accordion-item/accordion-item.d.ts +17 -17
  345. package/dist/types/components/accordion/accordion.d.ts +7 -7
  346. package/dist/types/components/accordion/accordion.stories.d.ts +77 -0
  347. package/dist/types/components/badge/badge.stories.d.ts +66 -0
  348. package/dist/types/components/badge/badges.d.ts +16 -16
  349. package/dist/types/components/banner/banner.stories.d.ts +68 -0
  350. package/dist/types/components/banner/sdds-banner.d.ts +48 -0
  351. package/dist/types/components/banner/sdds-banner.stories.d.ts +109 -0
  352. package/dist/types/components/block/block-native.stories.d.ts +31 -0
  353. package/dist/types/components/block/sdds-block.d.ts +9 -0
  354. package/dist/types/components/block/sdds-block.stories.d.ts +32 -0
  355. package/dist/types/components/breadcrumb/breadcrumb-item/breadcrumb-item.d.ts +9 -0
  356. package/dist/types/components/breadcrumb/breadcrumb.d.ts +5 -0
  357. package/dist/types/components/breadcrumb/breadcrumb.stories.d.ts +12 -0
  358. package/dist/types/components/button/button-component.d.ts +18 -15
  359. package/dist/types/components/button/button-native.stories.d.ts +148 -0
  360. package/dist/types/components/button/button-webcomponent.stories.d.ts +147 -0
  361. package/dist/types/components/card/card.stories.d.ts +138 -0
  362. package/dist/types/components/card/sdds-card.d.ts +39 -0
  363. package/dist/types/components/card/sdds-card.stories.d.ts +139 -0
  364. package/dist/types/components/checkbox/checkbox.stories.d.ts +39 -0
  365. package/dist/types/components/checkbox/sdds-checkbox.d.ts +38 -0
  366. package/dist/types/components/checkbox/sdds-checkbox.stories.d.ts +40 -0
  367. package/dist/types/components/chips/chips.stories.d.ts +77 -0
  368. package/dist/types/components/data-table/native-table.stories.d.ts +133 -0
  369. package/dist/types/components/data-table/table/table.d.ts +47 -47
  370. package/dist/types/components/data-table/table-body/table-body.d.ts +54 -54
  371. package/dist/types/components/data-table/table-body-cell/table-body-cell.d.ts +24 -24
  372. package/dist/types/components/data-table/table-body-row/table-body-row.d.ts +27 -27
  373. package/dist/types/components/data-table/table-body-row-expandable/table-body-row-expandable.d.ts +27 -27
  374. package/dist/types/components/data-table/table-component-basic.stories.d.ts +101 -0
  375. package/dist/types/components/data-table/table-component-batch-actions.stories.d.ts +99 -0
  376. package/dist/types/components/data-table/table-component-bodydata.stories.d.ts +38 -0
  377. package/dist/types/components/data-table/table-component-custom-width.stories.d.ts +148 -0
  378. package/dist/types/components/data-table/table-component-event-listeners.stories.d.ts +88 -0
  379. package/dist/types/components/data-table/table-component-expandable-rows.stories.d.ts +88 -0
  380. package/dist/types/components/data-table/table-component-filtering.stories.d.ts +101 -0
  381. package/dist/types/components/data-table/table-component-multiselect.stories.d.ts +101 -0
  382. package/dist/types/components/data-table/table-component-pagination.stories.d.ts +101 -0
  383. package/dist/types/components/data-table/table-component-sorting.stories.d.ts +100 -0
  384. package/dist/types/components/data-table/table-footer/table-footer.d.ts +50 -50
  385. package/dist/types/components/data-table/table-header/table-header.d.ts +27 -27
  386. package/dist/types/components/data-table/table-header-cell/table-header-cell.d.ts +44 -45
  387. package/dist/types/components/data-table/table-toolbar/table-toolbar.d.ts +22 -22
  388. package/dist/types/components/datetime/datetime.d.ts +42 -32
  389. package/dist/types/components/datetime/datetime.stories.d.ts +127 -0
  390. package/dist/types/components/divider/divider.stories.d.ts +65 -0
  391. package/dist/types/components/dropdown/dropdown-filter/dropdown-filter.d.ts +42 -42
  392. package/dist/types/components/dropdown/dropdown-filter/dropdown-filter.stories.d.ts +73 -0
  393. package/dist/types/components/dropdown/dropdown-native.stories.d.ts +57 -0
  394. package/dist/types/components/dropdown/dropdown-option/dropdown-option.d.ts +19 -19
  395. package/dist/types/components/dropdown/dropdown-wc-default.stories.d.ts +129 -0
  396. package/dist/types/components/dropdown/dropdown-wc-multiselect.stories.d.ts +115 -0
  397. package/dist/types/components/dropdown/dropdown.d.ts +58 -56
  398. package/dist/types/components/footer/footer.stories.d.ts +45 -0
  399. package/dist/types/components/header/header-all.stories.d.ts +29 -0
  400. package/dist/types/components/header/header-default.stories.d.ts +29 -0
  401. package/dist/types/components/header/header-inline.stories.d.ts +29 -0
  402. package/dist/types/components/header/header-search.stories.d.ts +29 -0
  403. package/dist/types/components/header/header-toolbar.stories.d.ts +29 -0
  404. package/dist/types/components/icon/icon-font.stories.d.ts +38 -0
  405. package/dist/types/components/icon/icon-web-component.stories.d.ts +38 -0
  406. package/dist/types/components/icon/icon.d.ts +12 -12
  407. package/dist/types/components/link/link.stories.d.ts +33 -0
  408. package/dist/types/components/link/sdds-link.d.ts +13 -0
  409. package/dist/types/components/link/sdds-link.stories.d.ts +58 -0
  410. package/dist/types/components/message/message.stories.d.ts +69 -0
  411. package/dist/types/components/message/sdds-message.d.ts +14 -0
  412. package/dist/types/components/message/sdds-message.stories.d.ts +87 -0
  413. package/dist/types/components/modal/modal-native.stories.d.ts +59 -0
  414. package/dist/types/components/modal/modal-webcomponent.stories.d.ts +52 -0
  415. package/dist/types/components/modal/modal.d.ts +17 -16
  416. package/dist/types/components/popover-canvas/popover-canvas.d.ts +24 -18
  417. package/dist/types/components/popover-canvas/popover-canvas.stories.d.ts +25 -0
  418. package/dist/types/components/popover-menu/popover-menu-icons.stories.d.ts +27 -0
  419. package/dist/types/components/popover-menu/popover-menu.d.ts +24 -18
  420. package/dist/types/components/popover-menu/popover-menu.stories.d.ts +27 -0
  421. package/dist/types/components/radio-button/radio-button-component.stories.d.ts +39 -0
  422. package/dist/types/components/radio-button/radio-button.d.ts +26 -0
  423. package/dist/types/components/radio-button/radio-button.stories.d.ts +33 -0
  424. package/dist/types/components/side-menu/side-menu.stories.d.ts +42 -0
  425. package/dist/types/components/slider/slider.d.ts +86 -82
  426. package/dist/types/components/slider/slider.stories.d.ts +169 -0
  427. package/dist/types/components/spinner/spinner.d.ts +7 -7
  428. package/dist/types/components/spinner/spinner.stories.d.ts +37 -0
  429. package/dist/types/components/stepper/stepper.stories.d.ts +56 -0
  430. package/dist/types/components/tabs/inline-tabs-default/inline-tab/inline-tab.d.ts +6 -0
  431. package/dist/types/components/tabs/inline-tabs-default/inline-tabs.d.ts +40 -41
  432. package/dist/types/components/tabs/inline-tabs-default/inline-tabs.stories.d.ts +49 -0
  433. package/dist/types/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.d.ts +20 -20
  434. package/dist/types/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.d.ts +30 -0
  435. package/dist/types/components/tabs/navigation-tabs/navigation-tabs.d.ts +20 -18
  436. package/dist/types/components/tabs/navigation-tabs/navigation-tabs.stories.d.ts +13 -0
  437. package/dist/types/components/textarea/textarea.d.ts +48 -41
  438. package/dist/types/components/textarea/textarea.stories.d.ts +116 -0
  439. package/dist/types/components/textfield/textfield.d.ts +52 -42
  440. package/dist/types/components/textfield/textfield.stories.d.ts +180 -0
  441. package/dist/types/components/toast/sdds-toast.d.ts +36 -0
  442. package/dist/types/components/toast/sdds-toast.stories.d.ts +56 -0
  443. package/dist/types/components/toast/toast.stories.d.ts +69 -0
  444. package/dist/types/components/toggle/sdds-toggle.d.ts +34 -0
  445. package/dist/types/components/toggle/sdds-toggle.stories.d.ts +74 -0
  446. package/dist/types/components/toggle/toggle.stories.d.ts +55 -0
  447. package/dist/types/components/tooltip/tooltip.d.ts +24 -20
  448. package/dist/types/components/tooltip/tooltip.stories.d.ts +54 -0
  449. package/dist/types/components/utility/colour/background-color.stories.d.ts +58 -0
  450. package/dist/types/components/utility/colour/text-color.stories.d.ts +58 -0
  451. package/dist/types/components.d.ts +939 -48
  452. package/dist/types/foundations-stories/colour/colour-brand.stories.d.ts +13 -0
  453. package/dist/types/foundations-stories/colour/colour-scales.stories.d.ts +13 -0
  454. package/dist/types/foundations-stories/colour/colour-semantic.stories.d.ts +13 -0
  455. package/dist/types/foundations-stories/grid/grid.stories.d.ts +35 -0
  456. package/dist/types/foundations-stories/spacing/spacing-element.stories.d.ts +8 -0
  457. package/dist/types/foundations-stories/spacing/spacing-layout.stories.d.ts +8 -0
  458. package/dist/types/foundations-stories/typography/typography-body.stories.d.ts +8 -0
  459. package/dist/types/foundations-stories/typography/typography-detail.stories.d.ts +8 -0
  460. package/dist/types/foundations-stories/typography/typography-headline.stories.d.ts +21 -0
  461. package/dist/types/foundations-stories/typography/typography-paragraph.stories.d.ts +8 -0
  462. package/dist/types/index.d.ts +1 -1
  463. package/dist/types/utils/utils.d.ts +2 -2
  464. package/package.json +1 -1
  465. package/readme.md +41 -8
  466. package/dist/tegel/p-12ca5cfa.entry.js +0 -1
  467. package/dist/tegel/p-157e1618.js +0 -2
  468. package/dist/tegel/p-1fe61cf6.entry.js +0 -1
  469. package/dist/tegel/p-2f376504.entry.js +0 -1
  470. package/dist/tegel/p-44ced895.entry.js +0 -1
  471. package/dist/tegel/p-4880f03d.entry.js +0 -1
  472. package/dist/tegel/p-4aba73a3.entry.js +0 -1
  473. package/dist/tegel/p-4b58a02c.entry.js +0 -1
  474. package/dist/tegel/p-4cb85347.entry.js +0 -1
  475. package/dist/tegel/p-52031b5a.entry.js +0 -1
  476. package/dist/tegel/p-677baf7f.entry.js +0 -1
  477. package/dist/tegel/p-71797eaf.entry.js +0 -1
  478. package/dist/tegel/p-7373284c.entry.js +0 -1
  479. package/dist/tegel/p-7451779b.entry.js +0 -1
  480. package/dist/tegel/p-77aeea3b.entry.js +0 -1
  481. package/dist/tegel/p-8582d6a7.entry.js +0 -1
  482. package/dist/tegel/p-96021bd0.entry.js +0 -1
  483. package/dist/tegel/p-9d8caf51.entry.js +0 -1
  484. package/dist/tegel/p-b01cface.entry.js +0 -1
  485. package/dist/tegel/p-bf896643.entry.js +0 -1
  486. package/dist/tegel/p-c311725c.entry.js +0 -1
  487. package/dist/tegel/p-cf72dfd9.entry.js +0 -1
  488. package/dist/tegel/p-d91caec6.entry.js +0 -1
  489. package/dist/tegel/p-e10eec33.entry.js +0 -1
  490. package/dist/tegel/p-f2262a69.entry.js +0 -1
  491. package/dist/tegel/p-f2f7aa45.entry.js +0 -1
@@ -1,682 +1,721 @@
1
- import { h } from '@stencil/core';
2
- export class Slider {
3
- constructor() {
4
- this.wrapperElement = null;
5
- this.scrubberElement = null;
6
- this.scrubberInnerElement = null;
7
- this.dividersElement = null;
8
- this.trackElement = null;
9
- this.trackFillElement = null;
10
- this.minusElement = null;
11
- this.plusElement = null;
12
- this.inputElement = null;
13
- this.nativeRangeInputElement = null;
14
- this.scrubberGrabPos = { x: 0, y: 0 };
15
- this.scrubberGrabbed = false;
16
- this.scrubberLeft = 0;
17
- this.tickValues = [];
18
- this.disabledState = false;
19
- this.readonlyState = false;
20
- this.useControls = false;
21
- this.useInput = false;
22
- this.useSmall = false;
23
- this.useSnapping = false;
24
- this.supposedValueSlot = -1;
25
- this.eventListenersAdded = false;
26
- this.resizeObserverAdded = false;
27
- this.label = '';
28
- this.value = '0';
29
- this.min = '0';
30
- this.max = '100';
31
- this.ticks = '0';
32
- this.showTickNumbers = false;
33
- this.tooltip = null;
34
- this.disabled = null;
35
- this.readOnly = null;
36
- this.controls = null;
37
- this.input = null;
38
- this.step = '1';
39
- this.name = '';
40
- this.size = '';
41
- this.snap = null;
42
- }
43
- /** Public method to re-initialise the slider if some configuration props are changed */
44
- async reset() {
45
- // @TODO: maybe refactor to use watch-decorators instead
46
- this.componentWillLoad();
47
- this.componentDidLoad();
48
- }
49
- handleKeydown(event) {
50
- switch (event.key) {
51
- case 'ArrowLeft':
52
- this.stepLeft();
53
- break;
54
- case 'ArrowRight':
55
- this.stepRight();
56
- break;
57
- default:
58
- break;
59
- }
60
- }
61
- handleMouseUp() {
62
- if (!this.scrubberGrabbed) {
63
- return;
64
- }
65
- this.scrubberGrabbed = false;
66
- this.scrubberInnerElement.classList.remove('pressed');
67
- this.updateValue();
68
- this.trackElement.focus();
69
- }
70
- handleTouchEnd() {
71
- if (!this.scrubberGrabbed) {
72
- return;
73
- }
74
- this.scrubberGrabbed = false;
75
- this.scrubberInnerElement.classList.remove('pressed');
76
- this.updateValue();
77
- this.trackElement.focus();
78
- }
79
- handleMouseMove(event) {
80
- if (!this.scrubberGrabbed) {
81
- return;
82
- }
83
- const numTicks = parseInt(this.ticks);
84
- const trackRect = this.trackElement.getBoundingClientRect();
85
- let localLeft = event.clientX - trackRect.left;
86
- this.supposedValueSlot = -1;
87
- if (this.useSnapping && numTicks > 0) {
88
- const v = Math.round(this.getTrackWidth() / (numTicks + 1));
89
- localLeft = Math.round(localLeft / v) * v;
90
- this.supposedValueSlot = Math.round(localLeft / v);
91
- }
92
- this.scrubberLeft = this.constrainScrubber(localLeft);
93
- this.scrubberElement.style.left = `${this.scrubberLeft}px`;
94
- this.updateValue();
95
- this.updateTrack();
96
- }
97
- handleTouchMove(event) {
98
- event.preventDefault();
99
- if (!this.scrubberGrabbed) {
100
- return;
101
- }
102
- const numTicks = parseInt(this.ticks);
103
- const trackRect = this.trackElement.getBoundingClientRect();
104
- let localLeft = event.touches[0].clientX - trackRect.left;
105
- this.supposedValueSlot = -1;
106
- if (this.useSnapping && numTicks > 0) {
107
- const v = Math.round(this.getTrackWidth() / (numTicks + 1));
108
- localLeft = Math.round(localLeft / v) * v;
109
- this.supposedValueSlot = Math.round(localLeft / v);
110
- }
111
- this.scrubberLeft = this.constrainScrubber(localLeft);
112
- this.scrubberElement.style.left = `${this.scrubberLeft}px`;
113
- this.updateValue();
114
- this.updateTrack();
115
- }
116
- updateTrack() {
117
- const trackWidth = this.getTrackWidth();
118
- const percentageFilled = (this.scrubberLeft / trackWidth) * 100;
119
- this.trackFillElement.style.width = `${percentageFilled}%`;
120
- }
121
- dispatchChangeEvent() {
122
- this.sliderChangeEmitter.emit({ value: this.value });
123
- }
124
- updateValue() {
125
- const trackWidth = this.getTrackWidth();
126
- /* if snapping (supposedValueSlot > 0) is enabled, make sure we display the supposed value (instead of maybe getting a -1/+1 depending on rounding) */
127
- if (this.supposedValueSlot > 0) {
128
- const supposedValue = this.tickValues[this.supposedValueSlot];
129
- this.value = `${supposedValue}`;
130
- }
131
- else {
132
- const percentage = this.scrubberLeft / trackWidth;
133
- this.value = `${Math.trunc(this.getMin() + percentage * (this.getMax() - this.getMin()))}`;
134
- }
135
- this.dispatchChangeEvent();
136
- }
137
- updateValueForced(value) {
138
- this.value = value;
139
- this.dispatchChangeEvent();
140
- }
141
- getMin() {
142
- return parseFloat(this.min);
143
- }
144
- getMax() {
145
- return parseFloat(this.max);
146
- }
147
- constrainScrubber(x) {
148
- const width = this.getTrackWidth();
149
- if (x < 0) {
150
- return 0;
151
- }
152
- if (x > width) {
153
- return width;
154
- }
155
- return x;
156
- }
157
- getTrackWidth() {
158
- const trackRect = this.trackElement.getBoundingClientRect();
159
- return trackRect.right - trackRect.left;
160
- }
161
- calculateScrubberLeftFromValue(value) {
162
- const initValue = value;
163
- const trackWidth = this.getTrackWidth();
164
- const normalizedValue = initValue - this.getMin();
165
- const normalizedMax = this.getMax() - this.getMin();
166
- const calculatedLeft = (normalizedValue / normalizedMax) * trackWidth;
167
- this.scrubberLeft = calculatedLeft;
168
- this.scrubberElement.style.left = `${this.scrubberLeft}px`;
169
- }
170
- componentDidLoad() {
171
- if (!this.resizeObserverAdded) {
172
- this.resizeObserverAdded = true;
173
- const resizeObserver = new ResizeObserver(( /* entries */) => {
174
- this.calculateScrubberLeftFromValue(this.value);
175
- this.updateTrack();
176
- });
177
- resizeObserver.observe(this.wrapperElement);
178
- }
179
- if (!this.eventListenersAdded) {
180
- this.eventListenersAdded = true;
181
- this.scrubberElement.addEventListener('mousedown', event => {
182
- event.preventDefault();
183
- this.grabScrubber(event.offsetX, event.offsetY);
184
- });
185
- this.scrubberElement.addEventListener('touchstart', event => {
186
- const rect = this.scrubberElement.getBoundingClientRect();
187
- const x = event.targetTouches[0].pageX - rect.left;
188
- const y = event.targetTouches[0].pageY - rect.top;
189
- this.grabScrubber(x, y);
190
- });
191
- if (this.useControls) {
192
- this.minusElement.addEventListener('click', () => {
193
- this.stepLeft();
194
- });
195
- this.plusElement.addEventListener('click', () => {
196
- this.stepRight();
197
- });
198
- }
199
- if (this.inputElement) {
200
- this.inputElement.addEventListener('keydown', event => {
201
- event.stopPropagation();
202
- if (event.key === 'Enter') {
203
- let newValue = parseInt(this.inputElement.value);
204
- if (newValue < this.getMin()) {
205
- newValue = this.getMin();
206
- }
207
- else if (newValue > this.getMax()) {
208
- newValue = this.getMax();
209
- }
210
- this.calculateScrubberLeftFromValue(newValue);
211
- this.updateValueForced(newValue);
212
- this.updateTrack();
213
- this.inputElement.blur();
214
- this.wrapperElement.focus();
215
- }
216
- });
217
- }
218
- }
219
- this.calculateScrubberLeftFromValue(this.value);
220
- this.updateTrack();
221
- }
222
- grabScrubber(xOffset, yOffset) {
223
- if (this.readonlyState) {
224
- return;
225
- }
226
- this.scrubberGrabPos = {
227
- x: xOffset,
228
- y: yOffset,
229
- };
230
- this.scrubberGrabbed = true;
231
- this.scrubberInnerElement.classList.add('pressed');
232
- }
233
- calculateInputSizeFromMax() {
234
- return this.max.length;
235
- }
236
- controlsStep(delta) {
237
- if (this.readonlyState) {
238
- return;
239
- }
240
- const trackWidth = this.getTrackWidth();
241
- const percentage = this.scrubberLeft / trackWidth;
242
- const numTicks = parseInt(this.ticks);
243
- let currentValue = this.getMin() + percentage * (this.getMax() - this.getMin());
244
- currentValue += delta;
245
- if (currentValue < this.getMin()) {
246
- currentValue = this.getMin();
247
- }
248
- else if (currentValue > this.getMax()) {
249
- currentValue = this.getMax();
250
- }
251
- this.value = `${currentValue}`;
252
- /* if snapping is enabled, instead just increment or decrement the current "fixed" value from our ticknumber array */
253
- if (this.useSnapping && numTicks > 0) {
254
- const stepDir = delta > 0 ? 1 : -1;
255
- this.supposedValueSlot += stepDir;
256
- if (this.supposedValueSlot < 0) {
257
- this.supposedValueSlot = 0;
258
- }
259
- else if (this.supposedValueSlot > numTicks + 1) {
260
- this.supposedValueSlot = numTicks + 1;
261
- }
262
- }
263
- this.calculateScrubberLeftFromValue(currentValue);
264
- this.updateTrack();
265
- this.updateValue();
266
- }
267
- stepLeft() {
268
- this.controlsStep(-parseInt(this.step));
269
- }
270
- stepRight() {
271
- this.controlsStep(parseInt(this.step));
272
- }
273
- componentWillLoad() {
274
- const numTicks = parseInt(this.ticks);
275
- if (numTicks > 0) {
276
- this.tickValues = [this.getMin()];
277
- const step = (this.getMax() - this.getMin()) / (numTicks + 1);
278
- for (let i = 1; i < numTicks + 1; i++) {
279
- this.tickValues.push(this.getMin() + Math.round(step * i));
280
- }
281
- this.tickValues.push(this.getMax());
282
- }
283
- if (this.disabled !== null) {
284
- this.disabledState = true;
285
- }
286
- else {
287
- this.disabledState = false;
288
- }
289
- if (this.readOnly !== null) {
290
- this.readonlyState = true;
291
- }
292
- else {
293
- this.readonlyState = false;
294
- }
295
- this.useInput = false;
296
- this.useControls = false;
297
- if (this.controls !== null) {
298
- this.useControls = true;
299
- }
300
- else if (this.input !== null) {
301
- this.useInput = true;
302
- }
303
- this.useSmall = false;
304
- if (this.size === 'sm') {
305
- this.useSmall = true;
306
- }
307
- this.useSnapping = false;
308
- if (this.snap !== null) {
309
- this.useSnapping = true;
310
- }
311
- const min = this.getMin();
312
- const max = this.getMax();
313
- if (min > max) {
314
- console.warn('min-prop must have a higher value than max-prop for the component to work correctly.');
315
- this.disabledState = true;
316
- }
317
- }
318
- render() {
319
- return (h("div", { class: 'sdds-slider-wrapper ' + (this.readonlyState && 'read-only') }, h("input", { ref: el => (this.nativeRangeInputElement = el), class: "sdds-slider-native-element", type: "range", value: this.value, name: this.name, min: this.min, max: this.max }), h("div", { class: `sdds-slider ${this.disabledState ? 'disabled' : ''} ${this.useSmall ? 'sdds-slider-small' : ''}`, ref: el => (this.wrapperElement = el) }, this.useInput && (h("div", { class: "sdds-slider__input-values" }, h("div", { ref: el => (this.minusElement = el), class: "sdds-slider__input-value" }, this.min))), this.useControls && (h("div", { class: "sdds-slider__controls" }, h("div", { ref: el => (this.minusElement = el), class: "sdds-slider__control sdds-slider__control-minus" }, h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M1.98975 8.00005C1.98975 8.27619 2.2136 8.50005 2.48975 8.50005H13.5104C13.7866 8.50005 14.0104 8.27619 14.0104 8.00005C14.0104 7.72391 13.7866 7.50005 13.5104 7.50005L2.48975 7.50005C2.2136 7.50005 1.98975 7.72391 1.98975 8.00005Z", fill: "#0D0F13" }))))), h("div", { class: "sdds-slider-inner" }, h("label", { class: this.tickValues.length > 0 && 'offset' }, this.label), this.tickValues.length > 0 && (h("div", { class: "sdds-slider__value-dividers-wrapper" }, h("div", { ref: el => (this.dividersElement = el), class: "sdds-slider__value-dividers" }, this.tickValues.map(value => (h("div", { class: "sdds-slider__value-divider" }, this.showTickNumbers && h("span", null, value))))))), h("div", { class: "sdds-slider__track", ref: el => (this.trackElement = el), tabindex: "1" }, h("div", { class: "sdds-slider__track-fill", ref: el => (this.trackFillElement = el) }), h("div", { class: "sdds-slider__scrubber", ref: el => (this.scrubberElement = el) }, this.tooltip !== null && (h("div", { class: "sdds-slider__value" }, this.value, h("svg", { width: "18", height: "14", viewBox: "0 0 18 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M8.15882 12.6915L0.990487 1.54076C0.562658 0.875246 1.0405 0 1.83167 0H16.1683C16.9595 0 17.4373 0.875246 17.0095 1.54076L9.84118 12.6915C9.44754 13.3038 8.55246 13.3038 8.15882 12.6915Z", fill: "#37414F" })))), h("div", { class: "sdds-slider__scrubber-inner", ref: el => (this.scrubberInnerElement = el) })))), this.useInput && (h("div", { class: "sdds-slider__input-values" }, h("div", { ref: el => (this.minusElement = el), class: "sdds-slider__input-value", tabindex: "2" }, this.max), h("div", { class: "sdds-slider__input-field-wrapper" }, h("input", { onFocus: e => {
320
- if (this.readonlyState) {
321
- e.preventDefault();
322
- this.inputElement.blur();
323
- }
324
- }, size: this.calculateInputSizeFromMax(), class: "sdds-slider__input-field", value: this.value, ref: el => (this.inputElement = el) })))), this.useControls && (h("div", { class: "sdds-slider__controls" }, h("div", { ref: el => (this.plusElement = el), class: "sdds-slider__control sdds-slider__control-plus" }, h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M8.50005 13.5104C8.50005 13.7865 8.27619 14.0104 8.00005 14.0104C7.7239 14.0104 7.50005 13.7865 7.50005 13.5104V8.5H2.48975C2.2136 8.5 1.98975 8.27614 1.98975 8C1.98975 7.72386 2.2136 7.5 2.48975 7.5H7.50005V2.48965C7.50005 2.21351 7.7239 1.98965 8.00005 1.98965C8.27619 1.98965 8.50005 2.21351 8.50005 2.48965V7.5H13.5104C13.7866 7.5 14.0104 7.72386 14.0104 8C14.0104 8.27614 13.7866 8.5 13.5104 8.5H8.50005V13.5104Z", fill: "#0D0F13" }))))))));
325
- }
326
- static get is() { return "sdds-slider"; }
327
- static get originalStyleUrls() {
328
- return {
329
- "$": ["slider.scss"]
330
- };
331
- }
332
- static get styleUrls() {
333
- return {
334
- "$": ["slider.css"]
335
- };
336
- }
337
- static get properties() {
338
- return {
339
- "label": {
340
- "type": "string",
341
- "mutable": false,
342
- "complexType": {
343
- "original": "string",
344
- "resolved": "string",
345
- "references": {}
346
- },
347
- "required": false,
348
- "optional": false,
349
- "docs": {
350
- "tags": [],
351
- "text": "Text for label"
352
- },
353
- "attribute": "label",
354
- "reflect": false,
355
- "defaultValue": "''"
356
- },
357
- "value": {
358
- "type": "string",
359
- "mutable": false,
360
- "complexType": {
361
- "original": "string",
362
- "resolved": "string",
363
- "references": {}
364
- },
365
- "required": false,
366
- "optional": false,
367
- "docs": {
368
- "tags": [],
369
- "text": "Initial value"
370
- },
371
- "attribute": "value",
372
- "reflect": false,
373
- "defaultValue": "'0'"
374
- },
375
- "min": {
376
- "type": "string",
377
- "mutable": false,
378
- "complexType": {
379
- "original": "string",
380
- "resolved": "string",
381
- "references": {}
382
- },
383
- "required": false,
384
- "optional": false,
385
- "docs": {
386
- "tags": [],
387
- "text": "Minimum value"
388
- },
389
- "attribute": "min",
390
- "reflect": false,
391
- "defaultValue": "'0'"
392
- },
393
- "max": {
394
- "type": "string",
395
- "mutable": false,
396
- "complexType": {
397
- "original": "string",
398
- "resolved": "string",
399
- "references": {}
400
- },
401
- "required": false,
402
- "optional": false,
403
- "docs": {
404
- "tags": [],
405
- "text": "Maximum value"
406
- },
407
- "attribute": "max",
408
- "reflect": false,
409
- "defaultValue": "'100'"
410
- },
411
- "ticks": {
412
- "type": "string",
413
- "mutable": false,
414
- "complexType": {
415
- "original": "string",
416
- "resolved": "string",
417
- "references": {}
418
- },
419
- "required": false,
420
- "optional": false,
421
- "docs": {
422
- "tags": [],
423
- "text": "Number of tick markers (tick for min- and max-value will be added automatically)"
424
- },
425
- "attribute": "ticks",
426
- "reflect": false,
427
- "defaultValue": "'0'"
428
- },
429
- "showTickNumbers": {
430
- "type": "boolean",
431
- "mutable": false,
432
- "complexType": {
433
- "original": "boolean",
434
- "resolved": "boolean",
435
- "references": {}
436
- },
437
- "required": false,
438
- "optional": false,
439
- "docs": {
440
- "tags": [],
441
- "text": "Decide to show numbers above the tick markers or not"
442
- },
443
- "attribute": "show-tick-numbers",
444
- "reflect": false,
445
- "defaultValue": "false"
446
- },
447
- "tooltip": {
448
- "type": "boolean",
449
- "mutable": false,
450
- "complexType": {
451
- "original": "boolean",
452
- "resolved": "boolean",
453
- "references": {}
454
- },
455
- "required": false,
456
- "optional": false,
457
- "docs": {
458
- "tags": [],
459
- "text": "Decide to show the tooltip or not"
460
- },
461
- "attribute": "tooltip",
462
- "reflect": false,
463
- "defaultValue": "null"
464
- },
465
- "disabled": {
466
- "type": "boolean",
467
- "mutable": false,
468
- "complexType": {
469
- "original": "boolean",
470
- "resolved": "boolean",
471
- "references": {}
472
- },
473
- "required": false,
474
- "optional": false,
475
- "docs": {
476
- "tags": [],
477
- "text": "Sets the disabled state for the whole component"
478
- },
479
- "attribute": "disabled",
480
- "reflect": false,
481
- "defaultValue": "null"
482
- },
483
- "readOnly": {
484
- "type": "boolean",
485
- "mutable": false,
486
- "complexType": {
487
- "original": "boolean",
488
- "resolved": "boolean",
489
- "references": {}
490
- },
491
- "required": false,
492
- "optional": false,
493
- "docs": {
494
- "tags": [],
495
- "text": "Sets the read only state for the whole component"
496
- },
497
- "attribute": "read-only",
498
- "reflect": false,
499
- "defaultValue": "null"
500
- },
501
- "controls": {
502
- "type": "boolean",
503
- "mutable": false,
504
- "complexType": {
505
- "original": "boolean",
506
- "resolved": "boolean",
507
- "references": {}
508
- },
509
- "required": false,
510
- "optional": false,
511
- "docs": {
512
- "tags": [],
513
- "text": "Decide to show the controls or not"
514
- },
515
- "attribute": "controls",
516
- "reflect": false,
517
- "defaultValue": "null"
518
- },
519
- "input": {
520
- "type": "boolean",
521
- "mutable": false,
522
- "complexType": {
523
- "original": "boolean",
524
- "resolved": "boolean",
525
- "references": {}
526
- },
527
- "required": false,
528
- "optional": false,
529
- "docs": {
530
- "tags": [],
531
- "text": "Decide to show the input field or not"
532
- },
533
- "attribute": "input",
534
- "reflect": false,
535
- "defaultValue": "null"
536
- },
537
- "step": {
538
- "type": "string",
539
- "mutable": false,
540
- "complexType": {
541
- "original": "string",
542
- "resolved": "string",
543
- "references": {}
544
- },
545
- "required": false,
546
- "optional": false,
547
- "docs": {
548
- "tags": [],
549
- "text": "Defines how much to increment/decrement the value when using controls"
550
- },
551
- "attribute": "step",
552
- "reflect": false,
553
- "defaultValue": "'1'"
554
- },
555
- "name": {
556
- "type": "string",
557
- "mutable": false,
558
- "complexType": {
559
- "original": "string",
560
- "resolved": "string",
561
- "references": {}
562
- },
563
- "required": false,
564
- "optional": false,
565
- "docs": {
566
- "tags": [],
567
- "text": "Name property (will be inherited by the native slider component)"
568
- },
569
- "attribute": "name",
570
- "reflect": false,
571
- "defaultValue": "''"
572
- },
573
- "size": {
574
- "type": "string",
575
- "mutable": false,
576
- "complexType": {
577
- "original": "'sm' | ''",
578
- "resolved": "\"\" | \"sm\"",
579
- "references": {}
580
- },
581
- "required": false,
582
- "optional": false,
583
- "docs": {
584
- "tags": [],
585
- "text": "Sets the size of the scrubber"
586
- },
587
- "attribute": "size",
588
- "reflect": false,
589
- "defaultValue": "''"
590
- },
591
- "snap": {
592
- "type": "boolean",
593
- "mutable": false,
594
- "complexType": {
595
- "original": "boolean",
596
- "resolved": "boolean",
597
- "references": {}
598
- },
599
- "required": false,
600
- "optional": false,
601
- "docs": {
602
- "tags": [],
603
- "text": "Snap to the ticks grid"
604
- },
605
- "attribute": "snap",
606
- "reflect": false,
607
- "defaultValue": "null"
608
- }
609
- };
610
- }
611
- static get events() {
612
- return [{
613
- "method": "sliderChangeEmitter",
614
- "name": "sliderChange",
615
- "bubbles": true,
616
- "cancelable": true,
617
- "composed": true,
618
- "docs": {
619
- "tags": [],
620
- "text": "Change event for the textfield"
621
- },
622
- "complexType": {
623
- "original": "any",
624
- "resolved": "any",
625
- "references": {}
626
- }
627
- }];
628
- }
629
- static get methods() {
630
- return {
631
- "reset": {
632
- "complexType": {
633
- "signature": "() => Promise<void>",
634
- "parameters": [],
635
- "references": {
636
- "Promise": {
637
- "location": "global"
638
- }
639
- },
640
- "return": "Promise<void>"
641
- },
642
- "docs": {
643
- "text": "Public method to re-initialise the slider if some configuration props are changed",
644
- "tags": []
645
- }
646
- }
647
- };
648
- }
649
- static get listeners() {
650
- return [{
651
- "name": "keydown",
652
- "method": "handleKeydown",
653
- "target": undefined,
654
- "capture": false,
655
- "passive": false
656
- }, {
657
- "name": "mouseup",
658
- "method": "handleMouseUp",
659
- "target": "window",
660
- "capture": false,
661
- "passive": true
662
- }, {
663
- "name": "touchend",
664
- "method": "handleTouchEnd",
665
- "target": "window",
666
- "capture": false,
667
- "passive": true
668
- }, {
669
- "name": "mousemove",
670
- "method": "handleMouseMove",
671
- "target": "window",
672
- "capture": false,
673
- "passive": true
674
- }, {
675
- "name": "touchmove",
676
- "method": "handleTouchMove",
677
- "target": "window",
678
- "capture": false,
679
- "passive": true
680
- }];
681
- }
682
- }
1
+ import { h } from '@stencil/core';
2
+ export class Slider {
3
+ constructor() {
4
+ this.wrapperElement = null;
5
+ this.scrubberElement = null;
6
+ this.scrubberInnerElement = null;
7
+ this.dividersElement = null;
8
+ this.trackElement = null;
9
+ this.trackFillElement = null;
10
+ this.minusElement = null;
11
+ this.plusElement = null;
12
+ this.inputElement = null;
13
+ this.nativeRangeInputElement = null;
14
+ this.scrubberGrabPos = { x: 0, y: 0 };
15
+ this.scrubberGrabbed = false;
16
+ this.scrubberLeft = 0;
17
+ this.tickValues = [];
18
+ this.disabledState = false;
19
+ this.readonlyState = false;
20
+ this.useControls = false;
21
+ this.useInput = false;
22
+ this.useSmall = false;
23
+ this.useSnapping = false;
24
+ this.supposedValueSlot = -1;
25
+ this.eventListenersAdded = false;
26
+ this.resizeObserverAdded = false;
27
+ this.label = '';
28
+ this.value = '0';
29
+ this.min = '0';
30
+ this.max = '100';
31
+ this.ticks = '0';
32
+ this.showTickNumbers = false;
33
+ this.tooltip = null;
34
+ this.disabled = null;
35
+ this.readOnly = null;
36
+ this.controls = null;
37
+ this.input = null;
38
+ this.step = '1';
39
+ this.name = '';
40
+ this.size = '';
41
+ this.snap = null;
42
+ this.sliderId = crypto.randomUUID();
43
+ }
44
+ /** Public method to re-initialise the slider if some configuration props are changed */
45
+ async reset() {
46
+ // @TODO: maybe refactor to use watch-decorators instead
47
+ this.componentWillLoad();
48
+ this.componentDidLoad();
49
+ }
50
+ handleKeydown(event) {
51
+ switch (event.key) {
52
+ case 'ArrowLeft':
53
+ this.stepLeft();
54
+ break;
55
+ case 'ArrowRight':
56
+ this.stepRight();
57
+ break;
58
+ default:
59
+ break;
60
+ }
61
+ }
62
+ handleMouseUp() {
63
+ if (!this.scrubberGrabbed) {
64
+ return;
65
+ }
66
+ this.scrubberGrabbed = false;
67
+ this.scrubberInnerElement.classList.remove('pressed');
68
+ this.updateValue();
69
+ this.trackElement.focus();
70
+ }
71
+ handleTouchEnd() {
72
+ if (!this.scrubberGrabbed) {
73
+ return;
74
+ }
75
+ this.scrubberGrabbed = false;
76
+ this.scrubberInnerElement.classList.remove('pressed');
77
+ this.updateValue();
78
+ this.trackElement.focus();
79
+ }
80
+ handleMouseMove(event) {
81
+ if (!this.scrubberGrabbed) {
82
+ return;
83
+ }
84
+ const numTicks = parseInt(this.ticks);
85
+ const trackRect = this.trackElement.getBoundingClientRect();
86
+ let localLeft = event.clientX - trackRect.left;
87
+ this.supposedValueSlot = -1;
88
+ if (this.useSnapping && numTicks > 0) {
89
+ const v = Math.round(this.getTrackWidth() / (numTicks + 1));
90
+ localLeft = Math.round(localLeft / v) * v;
91
+ this.supposedValueSlot = Math.round(localLeft / v);
92
+ }
93
+ this.scrubberLeft = this.constrainScrubber(localLeft);
94
+ this.scrubberElement.style.left = `${this.scrubberLeft}px`;
95
+ this.updateValue();
96
+ this.updateTrack();
97
+ }
98
+ handleTouchMove(event) {
99
+ event.preventDefault();
100
+ if (!this.scrubberGrabbed) {
101
+ return;
102
+ }
103
+ const numTicks = parseInt(this.ticks);
104
+ const trackRect = this.trackElement.getBoundingClientRect();
105
+ let localLeft = event.touches[0].clientX - trackRect.left;
106
+ this.supposedValueSlot = -1;
107
+ if (this.useSnapping && numTicks > 0) {
108
+ const v = Math.round(this.getTrackWidth() / (numTicks + 1));
109
+ localLeft = Math.round(localLeft / v) * v;
110
+ this.supposedValueSlot = Math.round(localLeft / v);
111
+ }
112
+ this.scrubberLeft = this.constrainScrubber(localLeft);
113
+ this.scrubberElement.style.left = `${this.scrubberLeft}px`;
114
+ this.updateValue();
115
+ this.updateTrack();
116
+ }
117
+ updateTrack() {
118
+ const trackWidth = this.getTrackWidth();
119
+ const percentageFilled = (this.scrubberLeft / trackWidth) * 100;
120
+ this.trackFillElement.style.width = `${percentageFilled}%`;
121
+ }
122
+ dispatchChangeEvent() {
123
+ this.sddsChange.emit({ value: this.value });
124
+ }
125
+ updateValue() {
126
+ const trackWidth = this.getTrackWidth();
127
+ /* if snapping (supposedValueSlot > 0) is enabled, make sure we display the supposed value (instead of maybe getting a -1/+1 depending on rounding) */
128
+ if (this.supposedValueSlot > 0) {
129
+ const supposedValue = this.tickValues[this.supposedValueSlot];
130
+ this.value = `${supposedValue}`;
131
+ }
132
+ else {
133
+ const percentage = this.scrubberLeft / trackWidth;
134
+ this.value = `${Math.trunc(this.getMin() + percentage * (this.getMax() - this.getMin()))}`;
135
+ }
136
+ this.dispatchChangeEvent();
137
+ }
138
+ updateValueForced(value) {
139
+ this.value = value;
140
+ this.dispatchChangeEvent();
141
+ }
142
+ getMin() {
143
+ return parseFloat(this.min);
144
+ }
145
+ getMax() {
146
+ return parseFloat(this.max);
147
+ }
148
+ constrainScrubber(x) {
149
+ const width = this.getTrackWidth();
150
+ if (x < 0) {
151
+ return 0;
152
+ }
153
+ if (x > width) {
154
+ return width;
155
+ }
156
+ return x;
157
+ }
158
+ getTrackWidth() {
159
+ const trackRect = this.trackElement.getBoundingClientRect();
160
+ return trackRect.right - trackRect.left;
161
+ }
162
+ calculateScrubberLeftFromValue(value) {
163
+ const initValue = value;
164
+ const trackWidth = this.getTrackWidth();
165
+ const normalizedValue = initValue - this.getMin();
166
+ const normalizedMax = this.getMax() - this.getMin();
167
+ const calculatedLeft = (normalizedValue / normalizedMax) * trackWidth;
168
+ this.scrubberLeft = calculatedLeft;
169
+ this.scrubberElement.style.left = `${this.scrubberLeft}px`;
170
+ }
171
+ componentDidLoad() {
172
+ if (!this.resizeObserverAdded) {
173
+ this.resizeObserverAdded = true;
174
+ const resizeObserver = new ResizeObserver(( /* entries */) => {
175
+ this.calculateScrubberLeftFromValue(this.value);
176
+ this.updateTrack();
177
+ });
178
+ resizeObserver.observe(this.wrapperElement);
179
+ }
180
+ if (!this.eventListenersAdded) {
181
+ this.eventListenersAdded = true;
182
+ this.scrubberElement.addEventListener('mousedown', (event) => {
183
+ event.preventDefault();
184
+ this.grabScrubber(event.offsetX, event.offsetY);
185
+ });
186
+ this.scrubberElement.addEventListener('touchstart', (event) => {
187
+ const rect = this.scrubberElement.getBoundingClientRect();
188
+ const x = event.targetTouches[0].pageX - rect.left;
189
+ const y = event.targetTouches[0].pageY - rect.top;
190
+ this.grabScrubber(x, y);
191
+ });
192
+ if (this.useControls) {
193
+ this.minusElement.addEventListener('click', () => {
194
+ this.stepLeft();
195
+ });
196
+ this.plusElement.addEventListener('click', () => {
197
+ this.stepRight();
198
+ });
199
+ }
200
+ if (this.inputElement) {
201
+ this.inputElement.addEventListener('keydown', (event) => {
202
+ event.stopPropagation();
203
+ if (event.key === 'Enter') {
204
+ let newValue = parseInt(this.inputElement.value);
205
+ if (newValue < this.getMin()) {
206
+ newValue = this.getMin();
207
+ }
208
+ else if (newValue > this.getMax()) {
209
+ newValue = this.getMax();
210
+ }
211
+ this.calculateScrubberLeftFromValue(newValue);
212
+ this.updateValueForced(newValue);
213
+ this.updateTrack();
214
+ this.inputElement.blur();
215
+ this.wrapperElement.focus();
216
+ }
217
+ });
218
+ }
219
+ }
220
+ this.calculateScrubberLeftFromValue(this.value);
221
+ this.updateTrack();
222
+ }
223
+ grabScrubber(xOffset, yOffset) {
224
+ if (this.readonlyState) {
225
+ return;
226
+ }
227
+ this.scrubberGrabPos = {
228
+ x: xOffset,
229
+ y: yOffset,
230
+ };
231
+ this.scrubberGrabbed = true;
232
+ this.scrubberInnerElement.classList.add('pressed');
233
+ }
234
+ calculateInputSizeFromMax() {
235
+ return this.max.length;
236
+ }
237
+ controlsStep(delta) {
238
+ if (this.readonlyState || this.disabled) {
239
+ return;
240
+ }
241
+ const trackWidth = this.getTrackWidth();
242
+ const percentage = this.scrubberLeft / trackWidth;
243
+ const numTicks = parseInt(this.ticks);
244
+ let currentValue = this.getMin() + percentage * (this.getMax() - this.getMin());
245
+ currentValue += delta;
246
+ if (currentValue < this.getMin()) {
247
+ currentValue = this.getMin();
248
+ }
249
+ else if (currentValue > this.getMax()) {
250
+ currentValue = this.getMax();
251
+ }
252
+ this.value = `${currentValue}`;
253
+ /* if snapping is enabled, instead just increment or decrement the current "fixed" value from our ticknumber array */
254
+ if (this.useSnapping && numTicks > 0) {
255
+ const stepDir = delta > 0 ? 1 : -1;
256
+ this.supposedValueSlot += stepDir;
257
+ if (this.supposedValueSlot < 0) {
258
+ this.supposedValueSlot = 0;
259
+ }
260
+ else if (this.supposedValueSlot > numTicks + 1) {
261
+ this.supposedValueSlot = numTicks + 1;
262
+ }
263
+ }
264
+ this.calculateScrubberLeftFromValue(currentValue);
265
+ this.updateTrack();
266
+ this.updateValue();
267
+ }
268
+ stepLeft() {
269
+ this.controlsStep(-parseInt(this.step));
270
+ }
271
+ stepRight() {
272
+ this.controlsStep(parseInt(this.step));
273
+ }
274
+ componentWillLoad() {
275
+ const numTicks = parseInt(this.ticks);
276
+ if (numTicks > 0) {
277
+ this.tickValues = [this.getMin()];
278
+ const step = (this.getMax() - this.getMin()) / (numTicks + 1);
279
+ for (let i = 1; i < numTicks + 1; i++) {
280
+ this.tickValues.push(this.getMin() + Math.round(step * i));
281
+ }
282
+ this.tickValues.push(this.getMax());
283
+ }
284
+ if (this.disabled !== null) {
285
+ this.disabledState = true;
286
+ }
287
+ else {
288
+ this.disabledState = false;
289
+ }
290
+ if (this.readOnly !== null) {
291
+ this.readonlyState = true;
292
+ }
293
+ else {
294
+ this.readonlyState = false;
295
+ }
296
+ this.useInput = false;
297
+ this.useControls = false;
298
+ if (this.controls !== null) {
299
+ this.useControls = true;
300
+ }
301
+ else if (this.input !== null) {
302
+ this.useInput = true;
303
+ }
304
+ this.useSmall = false;
305
+ if (this.size === 'sm') {
306
+ this.useSmall = true;
307
+ }
308
+ this.useSnapping = false;
309
+ if (this.snap !== null) {
310
+ this.useSnapping = true;
311
+ }
312
+ const min = this.getMin();
313
+ const max = this.getMax();
314
+ if (min > max) {
315
+ console.warn('min-prop must have a higher value than max-prop for the component to work correctly.');
316
+ this.disabledState = true;
317
+ }
318
+ }
319
+ render() {
320
+ return (h("div", { class: `sdds-slider-wrapper ${this.readonlyState ? 'read-only' : ''}` }, h("input", { ref: (el) => {
321
+ this.nativeRangeInputElement = el;
322
+ }, class: "sdds-slider-native-element", type: "range", value: this.value, name: this.name, min: this.min, max: this.max, disabled: this.disabled, id: this.sliderId }), h("div", { class: `sdds-slider ${this.disabledState ? 'disabled' : ''} ${this.useSmall ? 'sdds-slider-small' : ''}`, ref: (el) => {
323
+ this.wrapperElement = el;
324
+ } }, this.useInput && (h("div", { class: "sdds-slider__input-values" }, h("div", { ref: (el) => {
325
+ this.minusElement = el;
326
+ }, class: "sdds-slider__input-value" }, this.min))), this.useControls && (h("div", { class: "sdds-slider__controls" }, h("div", { ref: (el) => (this.minusElement = el), class: "sdds-slider__control sdds-slider__control-minus" }, h("sdds-icon", { name: "minus", size: "16px" })))), h("div", { class: "sdds-slider-inner" }, h("label", { class: this.tickValues.length > 0 && 'offset' }, this.label), this.tickValues.length > 0 && (h("div", { class: "sdds-slider__value-dividers-wrapper" }, h("div", { ref: (el) => {
327
+ this.dividersElement = el;
328
+ }, class: "sdds-slider__value-dividers" }, this.tickValues.map((value) => (h("div", { class: "sdds-slider__value-divider" }, this.showTickNumbers && h("span", null, value))))))), h("div", { class: "sdds-slider__track", ref: (el) => {
329
+ this.trackElement = el;
330
+ }, tabindex: this.disabled ? '-1' : '0' }, h("div", { class: "sdds-slider__track-fill", ref: (el) => {
331
+ this.trackFillElement = el;
332
+ } }), h("div", { class: "sdds-slider__scrubber", ref: (el) => {
333
+ this.scrubberElement = el;
334
+ } }, this.tooltip !== null && (h("div", { class: "sdds-slider__value" }, this.value, h("svg", { width: "18", height: "14", viewBox: "0 0 18 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M8.15882 12.6915L0.990487 1.54076C0.562658 0.875246 1.0405 0 1.83167 0H16.1683C16.9595 0 17.4373 0.875246 17.0095 1.54076L9.84118 12.6915C9.44754 13.3038 8.55246 13.3038 8.15882 12.6915Z", fill: "#37414F" })))), h("div", { class: "sdds-slider__scrubber-inner", ref: (el) => {
335
+ this.scrubberInnerElement = el;
336
+ } })))), this.useInput && (h("div", { class: "sdds-slider__input-values" }, h("div", { ref: (el) => {
337
+ this.minusElement = el;
338
+ }, class: "sdds-slider__input-value" }, this.max), h("div", { class: "sdds-slider__input-field-wrapper" }, h("input", { onFocus: (e) => {
339
+ if (this.readonlyState) {
340
+ e.preventDefault();
341
+ this.inputElement.blur();
342
+ }
343
+ }, size: this.calculateInputSizeFromMax(), class: "sdds-slider__input-field", value: this.value, ref: (el) => {
344
+ this.inputElement = el;
345
+ } })))), this.useControls && (h("div", { class: "sdds-slider__controls" }, h("div", { ref: (el) => (this.plusElement = el), class: "sdds-slider__control sdds-slider__control-plus" }, h("sdds-icon", { name: "plus", size: "16px" })))))));
346
+ }
347
+ static get is() { return "sdds-slider"; }
348
+ static get originalStyleUrls() {
349
+ return {
350
+ "$": ["slider.scss"]
351
+ };
352
+ }
353
+ static get styleUrls() {
354
+ return {
355
+ "$": ["slider.css"]
356
+ };
357
+ }
358
+ static get properties() {
359
+ return {
360
+ "label": {
361
+ "type": "string",
362
+ "mutable": false,
363
+ "complexType": {
364
+ "original": "string",
365
+ "resolved": "string",
366
+ "references": {}
367
+ },
368
+ "required": false,
369
+ "optional": false,
370
+ "docs": {
371
+ "tags": [],
372
+ "text": "Text for label"
373
+ },
374
+ "attribute": "label",
375
+ "reflect": false,
376
+ "defaultValue": "''"
377
+ },
378
+ "value": {
379
+ "type": "string",
380
+ "mutable": false,
381
+ "complexType": {
382
+ "original": "string",
383
+ "resolved": "string",
384
+ "references": {}
385
+ },
386
+ "required": false,
387
+ "optional": false,
388
+ "docs": {
389
+ "tags": [],
390
+ "text": "Initial value"
391
+ },
392
+ "attribute": "value",
393
+ "reflect": false,
394
+ "defaultValue": "'0'"
395
+ },
396
+ "min": {
397
+ "type": "string",
398
+ "mutable": false,
399
+ "complexType": {
400
+ "original": "string",
401
+ "resolved": "string",
402
+ "references": {}
403
+ },
404
+ "required": false,
405
+ "optional": false,
406
+ "docs": {
407
+ "tags": [],
408
+ "text": "Minimum value"
409
+ },
410
+ "attribute": "min",
411
+ "reflect": false,
412
+ "defaultValue": "'0'"
413
+ },
414
+ "max": {
415
+ "type": "string",
416
+ "mutable": false,
417
+ "complexType": {
418
+ "original": "string",
419
+ "resolved": "string",
420
+ "references": {}
421
+ },
422
+ "required": false,
423
+ "optional": false,
424
+ "docs": {
425
+ "tags": [],
426
+ "text": "Maximum value"
427
+ },
428
+ "attribute": "max",
429
+ "reflect": false,
430
+ "defaultValue": "'100'"
431
+ },
432
+ "ticks": {
433
+ "type": "string",
434
+ "mutable": false,
435
+ "complexType": {
436
+ "original": "string",
437
+ "resolved": "string",
438
+ "references": {}
439
+ },
440
+ "required": false,
441
+ "optional": false,
442
+ "docs": {
443
+ "tags": [],
444
+ "text": "Number of tick markers (tick for min- and max-value will be added automatically)"
445
+ },
446
+ "attribute": "ticks",
447
+ "reflect": false,
448
+ "defaultValue": "'0'"
449
+ },
450
+ "showTickNumbers": {
451
+ "type": "boolean",
452
+ "mutable": false,
453
+ "complexType": {
454
+ "original": "boolean",
455
+ "resolved": "boolean",
456
+ "references": {}
457
+ },
458
+ "required": false,
459
+ "optional": false,
460
+ "docs": {
461
+ "tags": [],
462
+ "text": "Decide to show numbers above the tick markers or not"
463
+ },
464
+ "attribute": "show-tick-numbers",
465
+ "reflect": false,
466
+ "defaultValue": "false"
467
+ },
468
+ "tooltip": {
469
+ "type": "boolean",
470
+ "mutable": false,
471
+ "complexType": {
472
+ "original": "boolean",
473
+ "resolved": "boolean",
474
+ "references": {}
475
+ },
476
+ "required": false,
477
+ "optional": false,
478
+ "docs": {
479
+ "tags": [],
480
+ "text": "Decide to show the tooltip or not"
481
+ },
482
+ "attribute": "tooltip",
483
+ "reflect": false,
484
+ "defaultValue": "null"
485
+ },
486
+ "disabled": {
487
+ "type": "boolean",
488
+ "mutable": false,
489
+ "complexType": {
490
+ "original": "boolean",
491
+ "resolved": "boolean",
492
+ "references": {}
493
+ },
494
+ "required": false,
495
+ "optional": false,
496
+ "docs": {
497
+ "tags": [],
498
+ "text": "Sets the disabled state for the whole component"
499
+ },
500
+ "attribute": "disabled",
501
+ "reflect": false,
502
+ "defaultValue": "null"
503
+ },
504
+ "readOnly": {
505
+ "type": "boolean",
506
+ "mutable": false,
507
+ "complexType": {
508
+ "original": "boolean",
509
+ "resolved": "boolean",
510
+ "references": {}
511
+ },
512
+ "required": false,
513
+ "optional": false,
514
+ "docs": {
515
+ "tags": [],
516
+ "text": "Sets the read only state for the whole component"
517
+ },
518
+ "attribute": "read-only",
519
+ "reflect": false,
520
+ "defaultValue": "null"
521
+ },
522
+ "controls": {
523
+ "type": "boolean",
524
+ "mutable": false,
525
+ "complexType": {
526
+ "original": "boolean",
527
+ "resolved": "boolean",
528
+ "references": {}
529
+ },
530
+ "required": false,
531
+ "optional": false,
532
+ "docs": {
533
+ "tags": [],
534
+ "text": "Decide to show the controls or not"
535
+ },
536
+ "attribute": "controls",
537
+ "reflect": false,
538
+ "defaultValue": "null"
539
+ },
540
+ "input": {
541
+ "type": "boolean",
542
+ "mutable": false,
543
+ "complexType": {
544
+ "original": "boolean",
545
+ "resolved": "boolean",
546
+ "references": {}
547
+ },
548
+ "required": false,
549
+ "optional": false,
550
+ "docs": {
551
+ "tags": [],
552
+ "text": "Decide to show the input field or not"
553
+ },
554
+ "attribute": "input",
555
+ "reflect": false,
556
+ "defaultValue": "null"
557
+ },
558
+ "step": {
559
+ "type": "string",
560
+ "mutable": false,
561
+ "complexType": {
562
+ "original": "string",
563
+ "resolved": "string",
564
+ "references": {}
565
+ },
566
+ "required": false,
567
+ "optional": false,
568
+ "docs": {
569
+ "tags": [],
570
+ "text": "Defines how much to increment/decrement the value when using controls"
571
+ },
572
+ "attribute": "step",
573
+ "reflect": false,
574
+ "defaultValue": "'1'"
575
+ },
576
+ "name": {
577
+ "type": "string",
578
+ "mutable": false,
579
+ "complexType": {
580
+ "original": "string",
581
+ "resolved": "string",
582
+ "references": {}
583
+ },
584
+ "required": false,
585
+ "optional": false,
586
+ "docs": {
587
+ "tags": [],
588
+ "text": "Name property (will be inherited by the native slider component)"
589
+ },
590
+ "attribute": "name",
591
+ "reflect": false,
592
+ "defaultValue": "''"
593
+ },
594
+ "size": {
595
+ "type": "string",
596
+ "mutable": false,
597
+ "complexType": {
598
+ "original": "'sm' | ''",
599
+ "resolved": "\"\" | \"sm\"",
600
+ "references": {}
601
+ },
602
+ "required": false,
603
+ "optional": false,
604
+ "docs": {
605
+ "tags": [],
606
+ "text": "Sets the size of the scrubber"
607
+ },
608
+ "attribute": "size",
609
+ "reflect": false,
610
+ "defaultValue": "''"
611
+ },
612
+ "snap": {
613
+ "type": "boolean",
614
+ "mutable": false,
615
+ "complexType": {
616
+ "original": "boolean",
617
+ "resolved": "boolean",
618
+ "references": {}
619
+ },
620
+ "required": false,
621
+ "optional": false,
622
+ "docs": {
623
+ "tags": [],
624
+ "text": "Snap to the ticks grid"
625
+ },
626
+ "attribute": "snap",
627
+ "reflect": false,
628
+ "defaultValue": "null"
629
+ },
630
+ "sliderId": {
631
+ "type": "string",
632
+ "mutable": false,
633
+ "complexType": {
634
+ "original": "string",
635
+ "resolved": "string",
636
+ "references": {}
637
+ },
638
+ "required": false,
639
+ "optional": false,
640
+ "docs": {
641
+ "tags": [],
642
+ "text": "Id for the sliders input element, randomly generated if not specified."
643
+ },
644
+ "attribute": "slider-id",
645
+ "reflect": false,
646
+ "defaultValue": "crypto.randomUUID()"
647
+ }
648
+ };
649
+ }
650
+ static get events() {
651
+ return [{
652
+ "method": "sddsChange",
653
+ "name": "sddsChange",
654
+ "bubbles": true,
655
+ "cancelable": true,
656
+ "composed": true,
657
+ "docs": {
658
+ "tags": [],
659
+ "text": "Sends unique checkbox identifier and value when the slider has a change in value."
660
+ },
661
+ "complexType": {
662
+ "original": "{\n value: string;\n }",
663
+ "resolved": "{ value: string; }",
664
+ "references": {}
665
+ }
666
+ }];
667
+ }
668
+ static get methods() {
669
+ return {
670
+ "reset": {
671
+ "complexType": {
672
+ "signature": "() => Promise<void>",
673
+ "parameters": [],
674
+ "references": {
675
+ "Promise": {
676
+ "location": "global"
677
+ }
678
+ },
679
+ "return": "Promise<void>"
680
+ },
681
+ "docs": {
682
+ "text": "Public method to re-initialise the slider if some configuration props are changed",
683
+ "tags": []
684
+ }
685
+ }
686
+ };
687
+ }
688
+ static get listeners() {
689
+ return [{
690
+ "name": "keydown",
691
+ "method": "handleKeydown",
692
+ "target": undefined,
693
+ "capture": false,
694
+ "passive": false
695
+ }, {
696
+ "name": "mouseup",
697
+ "method": "handleMouseUp",
698
+ "target": "window",
699
+ "capture": false,
700
+ "passive": true
701
+ }, {
702
+ "name": "touchend",
703
+ "method": "handleTouchEnd",
704
+ "target": "window",
705
+ "capture": false,
706
+ "passive": true
707
+ }, {
708
+ "name": "mousemove",
709
+ "method": "handleMouseMove",
710
+ "target": "window",
711
+ "capture": false,
712
+ "passive": true
713
+ }, {
714
+ "name": "touchmove",
715
+ "method": "handleTouchMove",
716
+ "target": "window",
717
+ "capture": false,
718
+ "passive": true
719
+ }];
720
+ }
721
+ }