@baloise/ds-core 20.0.0-next.6 → 20.0.0-next.7

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 (460) hide show
  1. package/components/all.d.ts +2 -0
  2. package/components/all.js +3 -0
  3. package/components/ds-accordion.js +1 -1
  4. package/components/ds-badge.js +1 -1
  5. package/components/ds-button.js +1 -1
  6. package/components/ds-card-content.js +1 -1
  7. package/components/ds-card-title.js +1 -1
  8. package/components/ds-card.js +1 -1
  9. package/components/ds-carousel.js +1 -1
  10. package/components/ds-checkbox-group.js +1 -1
  11. package/components/ds-checkbox.js +1 -1
  12. package/components/ds-close.js +1 -1
  13. package/components/ds-data-item.js +1 -1
  14. package/components/ds-date.js +1 -1
  15. package/components/ds-drawer.js +1 -1
  16. package/components/ds-file-upload.js +1 -1
  17. package/components/ds-footer.js +1 -1
  18. package/components/ds-heading.js +1 -1
  19. package/components/ds-hint.js +1 -1
  20. package/components/ds-input-slider.d.ts +11 -0
  21. package/components/ds-input-slider.js +4 -0
  22. package/components/ds-input.js +1 -1
  23. package/components/ds-item.js +1 -1
  24. package/components/ds-label.js +1 -1
  25. package/components/ds-list.js +1 -1
  26. package/components/ds-logo.js +1 -1
  27. package/components/ds-modal-body.js +1 -1
  28. package/components/ds-modal-header.js +1 -1
  29. package/components/ds-modal.js +1 -1
  30. package/components/ds-navbar.js +1 -1
  31. package/components/ds-notification.js +1 -1
  32. package/components/ds-number-input.js +1 -1
  33. package/components/ds-pagination.js +1 -1
  34. package/components/ds-popup.js +1 -1
  35. package/components/ds-progress-bar.js +1 -1
  36. package/components/ds-radio-group.js +1 -1
  37. package/components/ds-radio.js +1 -1
  38. package/components/ds-segment-item.js +1 -1
  39. package/components/ds-segment.js +1 -1
  40. package/components/ds-select-optgroup.js +1 -1
  41. package/components/ds-select-option.js +1 -1
  42. package/components/ds-select.js +1 -1
  43. package/components/ds-shape.js +1 -1
  44. package/components/ds-snackbar.js +1 -1
  45. package/components/ds-spinner.js +1 -1
  46. package/components/ds-stack.js +1 -1
  47. package/components/ds-step-panel.js +1 -1
  48. package/components/ds-tab-panel.js +1 -1
  49. package/components/ds-tabs.js +1 -1
  50. package/components/ds-tag-group.js +1 -1
  51. package/components/ds-tag.js +1 -1
  52. package/components/ds-text.js +1 -1
  53. package/components/ds-textarea.js +1 -1
  54. package/components/ds-toast.js +1 -1
  55. package/components/ds-toggle.js +1 -1
  56. package/components/ds-tooltip.js +1 -1
  57. package/components/index.js +1 -1
  58. package/components/p--EKmxaBS.js +4 -0
  59. package/components/{p-BfXZJ1Fe.js → p-ABj0eATe.js} +1 -1
  60. package/components/{p-BU0dY8pq.js → p-BwwAKEvn.js} +1 -1
  61. package/components/{p-B1gnrQ9b.js → p-CWDuQL1i.js} +1 -1
  62. package/components/{p-bGV2P6rT.js → p-D5zw5ezD.js} +1 -1
  63. package/components/{p-CjIxf5zy.js → p-DSeYzuO7.js} +1 -1
  64. package/components/{p-Ctnm_MBD.js → p-DY0y8uLL.js} +1 -1
  65. package/components/{p-DokkRjWC.js → p-VsWv65bD.js} +1 -1
  66. package/components/p-gz0Nxl39.js +4 -0
  67. package/components/{p-CYWn3X22.js → p-qaSW94OG.js} +1 -1
  68. package/components/{p-Btdh3fq7.js → p-u5aa74vh.js} +1 -1
  69. package/dist/cjs/{_getTag-B468r9bu.js → _getTag-DxZgmSPS.js} +1 -1
  70. package/dist/cjs/{array-CioNm_V1.js → array-CYn4ALBt.js} +10 -9
  71. package/dist/cjs/{breakpoints.decorator-C-Qm21UK.js → breakpoints.decorator-DY5iYsA5.js} +1 -1
  72. package/dist/cjs/{breakpoints.subject-XNcGwhzh.js → breakpoints.subject-CzhLlIwN.js} +3 -3
  73. package/dist/cjs/{config.decorator-ThGLtT-3.js → config.decorator-C64wi-MA.js} +1 -1
  74. package/dist/cjs/{config.utils-MhZvq4Qm.js → config.utils-BhWbrVRz.js} +1 -1
  75. package/dist/cjs/{create-validator-decorator-BIgFqrMJ.js → create-validator-decorator-Ctd288ve.js} +1 -1
  76. package/dist/cjs/design-system.cjs.js +2 -2
  77. package/dist/cjs/{device-BnjBOLnP.js → device-CIliLOe9.js} +1 -1
  78. package/dist/cjs/ds-accordion.cjs.entry.js +9 -9
  79. package/dist/cjs/ds-alert-container.cjs.entry.js +6 -6
  80. package/dist/cjs/ds-app.cjs.entry.js +6 -6
  81. package/dist/cjs/ds-badge.cjs.entry.js +7 -7
  82. package/dist/cjs/ds-button-group.cjs.entry.js +6 -6
  83. package/dist/cjs/ds-button_2.cjs.entry.js +9 -9
  84. package/dist/cjs/ds-card-actions.cjs.entry.js +4 -4
  85. package/dist/cjs/ds-card-content.cjs.entry.js +3 -3
  86. package/dist/cjs/ds-card-header.cjs.entry.js +5 -5
  87. package/dist/cjs/ds-card-subtitle.cjs.entry.js +6 -6
  88. package/dist/cjs/ds-card-title.cjs.entry.js +6 -6
  89. package/dist/cjs/ds-card.cjs.entry.js +14 -13
  90. package/dist/cjs/ds-carousel-item.cjs.entry.js +6 -6
  91. package/dist/cjs/ds-carousel.cjs.entry.js +8 -8
  92. package/dist/cjs/ds-checkbox-group.cjs.entry.js +34 -16
  93. package/dist/cjs/ds-checkbox.cjs.entry.js +19 -10
  94. package/dist/cjs/ds-content_2.cjs.entry.js +8 -8
  95. package/dist/cjs/ds-data-item.cjs.entry.js +6 -6
  96. package/dist/cjs/ds-data-label.cjs.entry.js +4 -4
  97. package/dist/cjs/ds-data-value.cjs.entry.js +2 -2
  98. package/dist/cjs/ds-data.cjs.entry.js +4 -4
  99. package/dist/cjs/ds-date.cjs.entry.js +10 -10
  100. package/dist/cjs/ds-divider_2.cjs.entry.js +14 -14
  101. package/dist/cjs/ds-drawer_2.cjs.entry.js +10 -10
  102. package/dist/cjs/ds-file-upload.cjs.entry.js +13 -12
  103. package/dist/cjs/ds-footer.cjs.entry.js +7 -7
  104. package/dist/cjs/ds-heading.cjs.entry.js +7 -7
  105. package/dist/cjs/ds-hint-text.cjs.entry.js +2 -2
  106. package/dist/cjs/ds-hint-title.cjs.entry.js +2 -2
  107. package/dist/cjs/ds-hint.cjs.entry.js +11 -11
  108. package/dist/cjs/ds-icon_2.cjs.entry.js +14 -13
  109. package/dist/cjs/ds-input-slider.cjs.entry.js +2885 -0
  110. package/dist/cjs/ds-input.cjs.entry.js +10 -10
  111. package/dist/cjs/ds-item.cjs.entry.js +6 -6
  112. package/dist/cjs/ds-label.cjs.entry.js +11 -11
  113. package/dist/cjs/ds-list.cjs.entry.js +5 -5
  114. package/dist/cjs/ds-modal-body.cjs.entry.js +3 -3
  115. package/dist/cjs/ds-modal-header.cjs.entry.js +3 -3
  116. package/dist/cjs/ds-modal.cjs.entry.js +9 -9
  117. package/dist/cjs/ds-navbar.cjs.entry.js +17 -17
  118. package/dist/cjs/ds-notification.cjs.entry.js +11 -11
  119. package/dist/cjs/ds-number-input.cjs.entry.js +22 -117
  120. package/dist/cjs/ds-pagination.cjs.entry.js +17 -17
  121. package/dist/cjs/ds-progress-bar.cjs.entry.js +14 -14
  122. package/dist/cjs/ds-radio-group.cjs.entry.js +29 -12
  123. package/dist/cjs/ds-radio.cjs.entry.js +19 -10
  124. package/dist/cjs/ds-segment-item.cjs.entry.js +5 -5
  125. package/dist/cjs/ds-segment.cjs.entry.js +13 -13
  126. package/dist/cjs/ds-select-optgroup.cjs.entry.js +5 -5
  127. package/dist/cjs/ds-select-option.cjs.entry.js +5 -5
  128. package/dist/cjs/ds-select.cjs.entry.js +11 -11
  129. package/dist/cjs/ds-shape.cjs.entry.js +5 -5
  130. package/dist/cjs/ds-snackbar.cjs.entry.js +12 -12
  131. package/dist/cjs/ds-step-panel.cjs.entry.js +6 -6
  132. package/dist/cjs/ds-step.cjs.entry.js +5 -5
  133. package/dist/cjs/ds-steps.cjs.entry.js +6 -6
  134. package/dist/cjs/ds-tab-panel.cjs.entry.js +6 -6
  135. package/dist/cjs/ds-tab.cjs.entry.js +5 -5
  136. package/dist/cjs/ds-tabs.cjs.entry.js +12 -12
  137. package/dist/cjs/ds-tag-group.cjs.entry.js +3 -3
  138. package/dist/cjs/ds-tag.cjs.entry.js +8 -8
  139. package/dist/cjs/ds-text.cjs.entry.js +10 -10
  140. package/dist/cjs/ds-textarea.cjs.entry.js +10 -10
  141. package/dist/cjs/ds-toast.cjs.entry.js +11 -11
  142. package/dist/cjs/ds-toggle.cjs.entry.js +7 -7
  143. package/dist/cjs/ds-tooltip.cjs.entry.js +5 -5
  144. package/dist/cjs/{field.util-L-DkeMVk.js → field.util-g9nhtuZH.js} +1 -1
  145. package/dist/cjs/{focus-D3VVgpM7.js → focus-BUszBnbl.js} +1 -1
  146. package/dist/cjs/{form-control-CtMcJUuC.js → form-control-B4Qf8fg-.js} +1 -1
  147. package/dist/cjs/{has-value-DK0oRqXI.js → has-value-rj502MLA.js} +1 -1
  148. package/dist/cjs/{index-sC3JnTlJ.js → index-CqInh7Vc.js} +6 -1
  149. package/dist/cjs/index.cjs.js +7 -7
  150. package/dist/cjs/isArray-DvQst6zQ.js +42 -0
  151. package/dist/cjs/isNaN-DOSPWDkt.js +106 -0
  152. package/dist/cjs/{isObjectLike-h-ta_ikf.js → isObjectLike-BNz6hnAu.js} +0 -37
  153. package/dist/cjs/{listener-BwB_xent.js → listener-1PZJDuOW.js} +1 -1
  154. package/dist/cjs/loader.cjs.js +2 -2
  155. package/dist/cjs/{one-of-BZGRIMtQ.js → one-of-BotLfpAZ.js} +1 -1
  156. package/dist/cjs/{required-COz3Unzu.js → required-BAhZ8oRM.js} +1 -1
  157. package/dist/cjs/{resize.decorator-DWM_fQgv.js → resize.decorator-Sqefy8ta.js} +2 -2
  158. package/dist/cjs/{scroll-CUuEh4xd.js → scroll--5tnvpG1.js} +1 -1
  159. package/dist/cjs/{tslib.es6-CxyosZMg.js → tslib.es6-BIB10hMZ.js} +1 -1
  160. package/dist/cjs/{type-hmc4CJcO.js → type-Br_NbeTX.js} +1 -1
  161. package/dist/collection/collection-manifest.json +1 -0
  162. package/dist/collection/components/accordion/accordion.host.css +1 -1
  163. package/dist/collection/components/alert/snackbar/snackbar.host.css +1 -1
  164. package/dist/collection/components/alert/toast/toast.host.css +1 -1
  165. package/dist/collection/components/badge/badge.host.css +1 -1
  166. package/dist/collection/components/card/card-content/card-content.host.css +1 -1
  167. package/dist/collection/components/card/card.host.css +1 -1
  168. package/dist/collection/components/card/card.js +10 -9
  169. package/dist/collection/components/checkbox/checkbox-group/checkbox-group.js +40 -3
  170. package/dist/collection/components/checkbox/checkbox.host.css +1 -1
  171. package/dist/collection/components/checkbox/checkbox.js +31 -2
  172. package/dist/collection/components/checkbox/test/checkbox.visual.play.js +3 -0
  173. package/dist/collection/components/heading/heading.host.css +1 -1
  174. package/dist/collection/components/input-slider/input-slider.host.css +1 -0
  175. package/dist/collection/components/input-slider/input-slider.interfaces.js +4 -0
  176. package/dist/collection/components/input-slider/input-slider.js +961 -0
  177. package/dist/collection/components/input-slider/input-slider.picker.js +124 -0
  178. package/dist/collection/components/input-slider/input-slider.utils.js +32 -0
  179. package/dist/collection/components/input-slider/test/input-slider.a11y.play.js +36 -0
  180. package/dist/collection/components/input-slider/test/input-slider.component.play.js +87 -0
  181. package/dist/collection/components/input-slider/test/input-slider.visual.play.js +27 -0
  182. package/dist/collection/components/label/label.host.css +1 -1
  183. package/dist/collection/components/label/label.js +2 -2
  184. package/dist/collection/components/list/item/item.host.css +1 -1
  185. package/dist/collection/components/list/list.js +1 -1
  186. package/dist/collection/components/logo/logo.js +2 -2
  187. package/dist/collection/components/modal/modal-body/modal-body.js +1 -1
  188. package/dist/collection/components/modal/modal-header/modal-header.js +1 -1
  189. package/dist/collection/components/modal/modal.js +2 -2
  190. package/dist/collection/components/navbar/navbar.js +3 -3
  191. package/dist/collection/components/notification/notification.host.css +1 -1
  192. package/dist/collection/components/notification/notification.js +3 -3
  193. package/dist/collection/components/number-input/number-input.js +1 -1
  194. package/dist/collection/components/pagination/pagination.js +5 -5
  195. package/dist/collection/components/popup/popup.js +1 -1
  196. package/dist/collection/components/progress-bar/progress-bar.js +2 -2
  197. package/dist/collection/components/radio/radio-group/radio-group.js +40 -3
  198. package/dist/collection/components/radio/radio.host.css +1 -1
  199. package/dist/collection/components/radio/radio.js +31 -2
  200. package/dist/collection/components/radio/test/radio.visual.play.js +3 -0
  201. package/dist/collection/components/segment/segment/segment.js +3 -3
  202. package/dist/collection/components/segment/segment-item.js +1 -1
  203. package/dist/collection/components/select/select-optgroup.js +1 -1
  204. package/dist/collection/components/select/select-option.js +1 -1
  205. package/dist/collection/components/select/select.js +2 -2
  206. package/dist/collection/components/shape/shape.js +1 -1
  207. package/dist/collection/components/spinner/spinner.js +2 -2
  208. package/dist/collection/components/stack/stack.js +2 -2
  209. package/dist/collection/components/steps/step-panel/step-panel.js +1 -1
  210. package/dist/collection/components/tabs/tab-panel/tab-panel.js +1 -1
  211. package/dist/collection/components/tabs/tabs/tabs.js +4 -4
  212. package/dist/collection/components/tag/tag-group/tag-group.js +1 -1
  213. package/dist/collection/components/tag/tag.js +2 -2
  214. package/dist/collection/components/text/text.host.css +1 -1
  215. package/dist/collection/components/text/text.js +3 -3
  216. package/dist/collection/components/textarea/textarea.js +1 -1
  217. package/dist/collection/components/toggle/toggle.js +2 -2
  218. package/dist/collection/components/tooltip/tooltip.js +1 -1
  219. package/dist/collection/global/constants/tags.constant.js +1 -0
  220. package/dist/collection/global/constants/version.constant.js +1 -1
  221. package/dist/design-system/design-system.esm.js +1 -1
  222. package/dist/design-system/index.esm.js +1 -1
  223. package/dist/design-system/{p-afd8bbe699.entry.js → p-00e6b1b780.entry.js} +1 -1
  224. package/dist/design-system/{p-774b89ed0b.entry.js → p-0bf3d4d939.entry.js} +1 -1
  225. package/dist/design-system/{p-dcb749efc7.entry.js → p-0ea6cdd218.entry.js} +1 -1
  226. package/dist/design-system/{p-9f2dd0b55b.entry.js → p-0f2a87fa39.entry.js} +1 -1
  227. package/dist/design-system/{p-0ff0be5b83.entry.js → p-138be1f0cc.entry.js} +1 -1
  228. package/dist/design-system/{p-650289138a.entry.js → p-16b03e0b02.entry.js} +1 -1
  229. package/dist/design-system/{p-d5f8d8f5e1.entry.js → p-1750b3c4f1.entry.js} +1 -1
  230. package/dist/design-system/{p-BkTv_bQR.js → p-1A9jKraP.js} +1 -1
  231. package/dist/design-system/{p-3134821ac6.entry.js → p-1b1e3ad99c.entry.js} +1 -1
  232. package/dist/design-system/p-24c85e99f5.entry.js +4 -0
  233. package/dist/design-system/p-2b038255c5.entry.js +4 -0
  234. package/dist/design-system/{p-6b6531379b.entry.js → p-2bb98dfa2f.entry.js} +1 -1
  235. package/dist/design-system/{p-c37f266740.entry.js → p-2eb6067210.entry.js} +1 -1
  236. package/dist/design-system/p-32e156bc72.entry.js +4 -0
  237. package/dist/design-system/p-3824068ae7.entry.js +4 -0
  238. package/dist/design-system/{p-ad2b17b0a0.entry.js → p-3aa3841834.entry.js} +1 -1
  239. package/dist/design-system/{p-53dda5d400.entry.js → p-3d2539929c.entry.js} +1 -1
  240. package/dist/design-system/{p-372bf379f9.entry.js → p-3d675c6507.entry.js} +1 -1
  241. package/dist/design-system/{p-e7472337ed.entry.js → p-3e3a6799d6.entry.js} +1 -1
  242. package/dist/design-system/{p-7e702193fc.entry.js → p-3e43fa2bc6.entry.js} +1 -1
  243. package/dist/design-system/{p-2f51e1d39b.entry.js → p-4284d6d646.entry.js} +1 -1
  244. package/dist/design-system/{p-8406f6faf1.entry.js → p-44981aaf8d.entry.js} +1 -1
  245. package/dist/design-system/{p-df5899b930.entry.js → p-4b2a59576c.entry.js} +1 -1
  246. package/dist/design-system/{p-0663d7c0f1.entry.js → p-4bfc094a03.entry.js} +1 -1
  247. package/dist/design-system/p-53d9a40010.entry.js +4 -0
  248. package/dist/design-system/p-564ee4d78f.entry.js +4 -0
  249. package/dist/design-system/{p-a62b7985a0.entry.js → p-599a693db3.entry.js} +1 -1
  250. package/dist/design-system/p-5a6c6959fa.entry.js +4 -0
  251. package/dist/design-system/{p-0bd2ce2da3.entry.js → p-5d4a5d0b61.entry.js} +1 -1
  252. package/dist/design-system/{p-13d1ce3158.entry.js → p-5ded2b6438.entry.js} +1 -1
  253. package/dist/design-system/{p-f0119fe693.entry.js → p-5f1a8be21c.entry.js} +1 -1
  254. package/dist/design-system/p-5f28436626.entry.js +4 -0
  255. package/dist/design-system/p-6c60833550.entry.js +4 -0
  256. package/dist/design-system/{p-01430d5c28.entry.js → p-7246bfb9a0.entry.js} +1 -1
  257. package/dist/design-system/p-77e7a6a068.entry.js +4 -0
  258. package/dist/design-system/{p-a8de98dd7b.entry.js → p-78112e7b35.entry.js} +1 -1
  259. package/dist/design-system/p-7ebdd14afc.entry.js +4 -0
  260. package/dist/design-system/p-7f42c18249.entry.js +4 -0
  261. package/dist/design-system/p-85bf3794f9.entry.js +4 -0
  262. package/dist/design-system/p-8a9d617f75.entry.js +4 -0
  263. package/dist/design-system/p-908e7b073a.entry.js +4 -0
  264. package/dist/design-system/{p-7c353652a9.entry.js → p-9f9364d7df.entry.js} +1 -1
  265. package/dist/design-system/p-B-v2Wm-V.js +5 -0
  266. package/dist/design-system/{p-BhdSNuGP.js → p-B8PCdo6e.js} +1 -1
  267. package/dist/design-system/{p-C7i6xLTJ.js → p-C5Rtikeh.js} +1 -1
  268. package/dist/design-system/p-CDhvZoCt.js +4 -0
  269. package/dist/design-system/p-CGHN-3RC.js +4 -0
  270. package/dist/design-system/{p-Dm2lqE3-.js → p-CfgwSore.js} +1 -1
  271. package/dist/design-system/p-ChSKXFK5.js +4 -0
  272. package/dist/design-system/{p-hLAmwHiq.js → p-Chgme2NJ.js} +1 -1
  273. package/dist/design-system/{p-DTxLRTYr.js → p-CrYAd3JT.js} +1 -1
  274. package/dist/design-system/p-CziF75uh.js +4 -0
  275. package/dist/design-system/{p-B1e0kNRJ.js → p-DJBD4skP.js} +2 -2
  276. package/dist/design-system/{p-78NZc8PM.js → p-DOvdnojj.js} +1 -1
  277. package/dist/design-system/p-DYPX3A8m.js +4 -0
  278. package/dist/design-system/p-DiUgZKWs.js +4 -0
  279. package/dist/design-system/{p-HwbqEzpk.js → p-Dk0GEN2t.js} +1 -1
  280. package/dist/design-system/p-DkhJaoXg.js +4 -0
  281. package/dist/design-system/{p-CvTcEsXg.js → p-DoHCSvjl.js} +1 -1
  282. package/dist/design-system/p-DypNSUAh.js +4 -0
  283. package/dist/design-system/{p-DgVaaZT_.js → p-Y0rKqVvm.js} +1 -1
  284. package/dist/design-system/p-Z0zrglhd.js +4 -0
  285. package/dist/design-system/p-a42ecb68a0.entry.js +4 -0
  286. package/dist/design-system/{p-dd38f8f206.entry.js → p-a782c877ea.entry.js} +1 -1
  287. package/dist/design-system/p-a8df8f067b.entry.js +4 -0
  288. package/dist/design-system/{p-a465c1acce.entry.js → p-aa3aee2591.entry.js} +1 -1
  289. package/dist/design-system/p-aa3c0ff536.entry.js +4 -0
  290. package/dist/design-system/{p-6ef31a3c07.entry.js → p-ab8bee7022.entry.js} +1 -1
  291. package/dist/design-system/p-adc58b2821.entry.js +4 -0
  292. package/dist/design-system/{p-8353961d39.entry.js → p-b390490b0d.entry.js} +1 -1
  293. package/dist/design-system/p-b44641ec28.entry.js +4 -0
  294. package/dist/design-system/{p-5d17209d91.entry.js → p-b4738dc266.entry.js} +1 -1
  295. package/dist/design-system/p-b851a43fff.entry.js +4 -0
  296. package/dist/design-system/{p-4e6638d14e.entry.js → p-b8669a617c.entry.js} +1 -1
  297. package/dist/design-system/p-b8f626bf28.entry.js +4 -0
  298. package/dist/design-system/{p-202ecb8f01.entry.js → p-bd543e1baf.entry.js} +1 -1
  299. package/dist/design-system/p-ce67cbbed5.entry.js +4 -0
  300. package/dist/design-system/{p-60d29d8b8e.entry.js → p-d3a80b8422.entry.js} +1 -1
  301. package/dist/design-system/p-d4d9205dda.entry.js +4 -0
  302. package/dist/design-system/p-dbd3d3b3d3.entry.js +4 -0
  303. package/dist/design-system/{p-BATOumsf.js → p-dziB1ufg.js} +1 -1
  304. package/dist/design-system/{p-014d464627.entry.js → p-e0b2d6e296.entry.js} +1 -1
  305. package/dist/design-system/p-e94ee7391c.entry.js +4 -0
  306. package/dist/design-system/{p-10c136d00d.entry.js → p-ee76bf354e.entry.js} +1 -1
  307. package/dist/design-system/p-f7be5b6114.entry.js +4 -0
  308. package/dist/design-system/{p-f4958b9e97.entry.js → p-fa613cd0d1.entry.js} +1 -1
  309. package/dist/design-system/p-faf75173db.entry.js +4 -0
  310. package/dist/design-system/{p-68c9f4f630.entry.js → p-fff38e1ca7.entry.js} +1 -1
  311. package/dist/design-system/{p-LCY5n5tq.js → p-x2KazRjl.js} +1 -1
  312. package/dist/esm/{_getTag-DFxL3s3h.js → _getTag-BkweuRJc.js} +1 -1
  313. package/dist/esm/{array-dJH4dfMr.js → array-BJZA868l.js} +3 -2
  314. package/dist/esm/{breakpoints.decorator-DZ0xN4Np.js → breakpoints.decorator-D9M4v98c.js} +1 -1
  315. package/dist/esm/{breakpoints.subject-BNnXcKMw.js → breakpoints.subject-DHZ7TzYV.js} +3 -3
  316. package/dist/esm/{config.decorator-ZQ0_Zx5y.js → config.decorator-CRYVBTkX.js} +1 -1
  317. package/dist/esm/{config.utils-D9o7rffC.js → config.utils-CR4Xudpz.js} +1 -1
  318. package/dist/esm/{create-validator-decorator-DovxquEu.js → create-validator-decorator-fUav5byo.js} +1 -1
  319. package/dist/esm/design-system.js +3 -3
  320. package/dist/esm/{device-CRuIJzXR.js → device-CapioAfe.js} +1 -1
  321. package/dist/esm/ds-accordion.entry.js +9 -9
  322. package/dist/esm/ds-alert-container.entry.js +6 -6
  323. package/dist/esm/ds-app.entry.js +6 -6
  324. package/dist/esm/ds-badge.entry.js +7 -7
  325. package/dist/esm/ds-button-group.entry.js +6 -6
  326. package/dist/esm/ds-button_2.entry.js +9 -9
  327. package/dist/esm/ds-card-actions.entry.js +4 -4
  328. package/dist/esm/ds-card-content.entry.js +3 -3
  329. package/dist/esm/ds-card-header.entry.js +5 -5
  330. package/dist/esm/ds-card-subtitle.entry.js +6 -6
  331. package/dist/esm/ds-card-title.entry.js +6 -6
  332. package/dist/esm/ds-card.entry.js +14 -13
  333. package/dist/esm/ds-carousel-item.entry.js +6 -6
  334. package/dist/esm/ds-carousel.entry.js +8 -8
  335. package/dist/esm/ds-checkbox-group.entry.js +34 -16
  336. package/dist/esm/ds-checkbox.entry.js +19 -10
  337. package/dist/esm/ds-content_2.entry.js +8 -8
  338. package/dist/esm/ds-data-item.entry.js +6 -6
  339. package/dist/esm/ds-data-label.entry.js +4 -4
  340. package/dist/esm/ds-data-value.entry.js +2 -2
  341. package/dist/esm/ds-data.entry.js +4 -4
  342. package/dist/esm/ds-date.entry.js +10 -10
  343. package/dist/esm/ds-divider_2.entry.js +14 -14
  344. package/dist/esm/ds-drawer_2.entry.js +10 -10
  345. package/dist/esm/ds-file-upload.entry.js +13 -12
  346. package/dist/esm/ds-footer.entry.js +7 -7
  347. package/dist/esm/ds-heading.entry.js +7 -7
  348. package/dist/esm/ds-hint-text.entry.js +2 -2
  349. package/dist/esm/ds-hint-title.entry.js +2 -2
  350. package/dist/esm/ds-hint.entry.js +11 -11
  351. package/dist/esm/ds-icon_2.entry.js +12 -11
  352. package/dist/esm/ds-input-slider.entry.js +2883 -0
  353. package/dist/esm/ds-input.entry.js +10 -10
  354. package/dist/esm/ds-item.entry.js +6 -6
  355. package/dist/esm/ds-label.entry.js +11 -11
  356. package/dist/esm/ds-list.entry.js +5 -5
  357. package/dist/esm/ds-modal-body.entry.js +3 -3
  358. package/dist/esm/ds-modal-header.entry.js +3 -3
  359. package/dist/esm/ds-modal.entry.js +9 -9
  360. package/dist/esm/ds-navbar.entry.js +17 -17
  361. package/dist/esm/ds-notification.entry.js +11 -11
  362. package/dist/esm/ds-number-input.entry.js +15 -110
  363. package/dist/esm/ds-pagination.entry.js +17 -17
  364. package/dist/esm/ds-progress-bar.entry.js +14 -14
  365. package/dist/esm/ds-radio-group.entry.js +29 -12
  366. package/dist/esm/ds-radio.entry.js +19 -10
  367. package/dist/esm/ds-segment-item.entry.js +5 -5
  368. package/dist/esm/ds-segment.entry.js +13 -13
  369. package/dist/esm/ds-select-optgroup.entry.js +5 -5
  370. package/dist/esm/ds-select-option.entry.js +5 -5
  371. package/dist/esm/ds-select.entry.js +11 -11
  372. package/dist/esm/ds-shape.entry.js +5 -5
  373. package/dist/esm/ds-snackbar.entry.js +12 -12
  374. package/dist/esm/ds-step-panel.entry.js +6 -6
  375. package/dist/esm/ds-step.entry.js +5 -5
  376. package/dist/esm/ds-steps.entry.js +6 -6
  377. package/dist/esm/ds-tab-panel.entry.js +6 -6
  378. package/dist/esm/ds-tab.entry.js +5 -5
  379. package/dist/esm/ds-tabs.entry.js +12 -12
  380. package/dist/esm/ds-tag-group.entry.js +3 -3
  381. package/dist/esm/ds-tag.entry.js +8 -8
  382. package/dist/esm/ds-text.entry.js +10 -10
  383. package/dist/esm/ds-textarea.entry.js +10 -10
  384. package/dist/esm/ds-toast.entry.js +11 -11
  385. package/dist/esm/ds-toggle.entry.js +7 -7
  386. package/dist/esm/ds-tooltip.entry.js +5 -5
  387. package/dist/esm/{field.util-BjZzAi09.js → field.util-neIQBS-h.js} +1 -1
  388. package/dist/esm/{focus-ZxHImoOj.js → focus-6OAqvfus.js} +1 -1
  389. package/dist/esm/{form-control-DvJo0GKN.js → form-control-DhinyMa9.js} +1 -1
  390. package/dist/esm/{has-value-DU9L2JaI.js → has-value-Dmsj8ZQw.js} +1 -1
  391. package/dist/esm/{index-C6MVahkC.js → index-B-v2Wm-V.js} +6 -1
  392. package/dist/esm/index.js +10 -10
  393. package/dist/esm/isArray-B8PCdo6e.js +40 -0
  394. package/dist/esm/isNaN-BrbqGXXw.js +104 -0
  395. package/dist/esm/{isObjectLike-BAYao9w7.js → isObjectLike-BnBXjF_n.js} +1 -37
  396. package/dist/esm/{listener-DHP2OPMZ.js → listener-DIZDQOuO.js} +1 -1
  397. package/dist/esm/loader.js +3 -3
  398. package/dist/esm/{one-of-CKPv0Nqm.js → one-of-CjRvS2Tk.js} +1 -1
  399. package/dist/esm/{required-Dqsbx5fH.js → required-Dtml5IID.js} +1 -1
  400. package/dist/esm/{resize.decorator-B8h8D676.js → resize.decorator-eogZBBk6.js} +2 -2
  401. package/dist/esm/{scroll-CsH7NHo5.js → scroll-v2MaEkiZ.js} +1 -1
  402. package/dist/esm/{tslib.es6-C9GKXw-5.js → tslib.es6-n47B6oUi.js} +1 -1
  403. package/dist/esm/{type-DzkhLOG_.js → type-7qEQcw90.js} +1 -1
  404. package/dist/types/components/card/card.d.ts +1 -1
  405. package/dist/types/components/checkbox/checkbox-group/checkbox-group.d.ts +6 -0
  406. package/dist/types/components/checkbox/checkbox.d.ts +4 -0
  407. package/dist/types/components/input-slider/input-slider.d.ts +186 -0
  408. package/dist/types/components/input-slider/input-slider.interfaces.d.ts +18 -0
  409. package/dist/types/components/input-slider/input-slider.picker.d.ts +37 -0
  410. package/dist/types/components/input-slider/input-slider.utils.d.ts +18 -0
  411. package/dist/types/components/input-slider/test/input-slider.a11y.play.d.ts +1 -0
  412. package/dist/types/components/input-slider/test/input-slider.component.play.d.ts +1 -0
  413. package/dist/types/components/input-slider/test/input-slider.visual.play.d.ts +1 -0
  414. package/dist/types/components/radio/radio-group/radio-group.d.ts +6 -0
  415. package/dist/types/components/radio/radio.d.ts +4 -0
  416. package/dist/types/components.d.ts +308 -3
  417. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/index.d.ts +1 -0
  418. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/input-slider.po.d.ts +18 -0
  419. package/docs/cem.json +573 -4
  420. package/docs/components.json +1471 -448
  421. package/docs/html.html-data.json +123 -0
  422. package/docs/tags.json +1 -0
  423. package/package.json +9 -8
  424. package/sbom.cdx.json +10768 -6272
  425. package/components/p-DsvYY32v.js +0 -4
  426. package/dist/design-system/p-11f34d0c7d.entry.js +0 -4
  427. package/dist/design-system/p-163d606781.entry.js +0 -4
  428. package/dist/design-system/p-1VXOIrN2.js +0 -4
  429. package/dist/design-system/p-27d181c5ac.entry.js +0 -4
  430. package/dist/design-system/p-2a35e0b9b0.entry.js +0 -4
  431. package/dist/design-system/p-3292ae6a05.entry.js +0 -4
  432. package/dist/design-system/p-3895178b39.entry.js +0 -4
  433. package/dist/design-system/p-3c6b7a2967.entry.js +0 -4
  434. package/dist/design-system/p-3ef4bd1c59.entry.js +0 -4
  435. package/dist/design-system/p-493b18cc46.entry.js +0 -4
  436. package/dist/design-system/p-4a99464dae.entry.js +0 -4
  437. package/dist/design-system/p-5e51fa8df4.entry.js +0 -4
  438. package/dist/design-system/p-62cb503015.entry.js +0 -4
  439. package/dist/design-system/p-65c221261c.entry.js +0 -4
  440. package/dist/design-system/p-68ebed7eee.entry.js +0 -4
  441. package/dist/design-system/p-6d168ba9ad.entry.js +0 -4
  442. package/dist/design-system/p-787bd92bcc.entry.js +0 -4
  443. package/dist/design-system/p-7c8bf0f33e.entry.js +0 -4
  444. package/dist/design-system/p-BLGVE-7Z.js +0 -4
  445. package/dist/design-system/p-BvEM6oCl.js +0 -4
  446. package/dist/design-system/p-C6MVahkC.js +0 -5
  447. package/dist/design-system/p-CwCAiaMq.js +0 -4
  448. package/dist/design-system/p-DHeVI6dR.js +0 -4
  449. package/dist/design-system/p-b68bc14064.entry.js +0 -4
  450. package/dist/design-system/p-b955a93959.entry.js +0 -4
  451. package/dist/design-system/p-caad93b943.entry.js +0 -4
  452. package/dist/design-system/p-cca79bfeb1.entry.js +0 -4
  453. package/dist/design-system/p-ddf2a7dfee.entry.js +0 -4
  454. package/dist/design-system/p-e85c92ca1a.entry.js +0 -4
  455. package/dist/design-system/p-f62643c33d.entry.js +0 -4
  456. package/dist/design-system/p-fa9568abce.entry.js +0 -4
  457. package/dist/design-system/p-fcd98f22b7.entry.js +0 -4
  458. package/dist/design-system/p-feeef4a8cb.entry.js +0 -4
  459. package/dist/design-system/p-ij4OEkzJ.js +0 -4
  460. package/dist/design-system/p-tl_BegdE.js +0 -4
@@ -0,0 +1,2885 @@
1
+ /*!
2
+ * (C) Helvetia Design System https://design.baloise.dev/ - Apache License 2.0
3
+ */
4
+ 'use strict';
5
+
6
+ var index = require('./index-CqInh7Vc.js');
7
+ var tslib_es6 = require('./tslib.es6-BIB10hMZ.js');
8
+ var isNaN$1 = require('./isNaN-DOSPWDkt.js');
9
+ var attributes = require('./attributes-D57TMQsY.js');
10
+ var hasValue = require('./has-value-rj502MLA.js');
11
+ var field_util = require('./field.util-g9nhtuZH.js');
12
+ var input_interfaces = require('./input.interfaces-YapUUaRx.js');
13
+ var type = require('./type-Br_NbeTX.js');
14
+ var oneOf = require('./one-of-BotLfpAZ.js');
15
+ var config_decorator = require('./config.decorator-C64wi-MA.js');
16
+ require('./_commonjsHelpers-DVhpm0hL.js');
17
+ require('./isObjectLike-BNz6hnAu.js');
18
+ require('./create-validator-decorator-Ctd288ve.js');
19
+ require('./aria-C3Tx6AHY.js');
20
+ require('./label.i18n-C00ZY0P9.js');
21
+ require('./config.utils-BhWbrVRz.js');
22
+
23
+ const INPUT_SLIDER_BRAND_COLORS = ['yellow', 'purple', 'red', 'green', ''];
24
+
25
+ /**
26
+ * Clamps `value` into `[min, max]`. Degrades sanely when `min > max` by
27
+ * treating the effective range as `[min(min, max), max(min, max)]`.
28
+ */
29
+ function clampValue(value, min, max) {
30
+ const lower = Math.min(min, max);
31
+ const upper = Math.max(min, max);
32
+ return Math.min(Math.max(value, lower), upper);
33
+ }
34
+ /**
35
+ * Resolves the initial value: a range input can never be empty, so an unset
36
+ * (`NaN`, this codebase's "empty number" sentinel — see `isValueEmpty`) value
37
+ * defaults to `min`.
38
+ */
39
+ function resolveInitialValue(value, min) {
40
+ return isNaN(value) ? min : value;
41
+ }
42
+ /**
43
+ * Derives the decimal precision implied by a `step` value, so noUiSlider's
44
+ * `format.to` can round away the floating-point noise its internal
45
+ * percentage-based math otherwise produces. `"any"` (continuous mode) falls
46
+ * back to a small fixed precision rather than pretending to be exact.
47
+ */
48
+ function decimalsFromStep(step) {
49
+ if (step === 'any')
50
+ return 2;
51
+ const [, fraction = ''] = step.split('.');
52
+ return fraction.length;
53
+ }
54
+
55
+ var PipsMode;
56
+ (function (PipsMode) {
57
+ PipsMode["Range"] = "range";
58
+ PipsMode["Steps"] = "steps";
59
+ PipsMode["Positions"] = "positions";
60
+ PipsMode["Count"] = "count";
61
+ PipsMode["Values"] = "values";
62
+ })(PipsMode || (PipsMode = {}));
63
+ var PipsType;
64
+ (function (PipsType) {
65
+ PipsType[PipsType["None"] = -1] = "None";
66
+ PipsType[PipsType["NoValue"] = 0] = "NoValue";
67
+ PipsType[PipsType["LargeValue"] = 1] = "LargeValue";
68
+ PipsType[PipsType["SmallValue"] = 2] = "SmallValue";
69
+ })(PipsType || (PipsType = {}));
70
+ //region Helper Methods
71
+ function isValidFormatter(entry) {
72
+ return isValidPartialFormatter(entry) && typeof entry.from === "function";
73
+ }
74
+ function isValidPartialFormatter(entry) {
75
+ // partial formatters only need a to function and not a from function
76
+ return typeof entry === "object" && typeof entry.to === "function";
77
+ }
78
+ function removeElement(el) {
79
+ el.parentElement.removeChild(el);
80
+ }
81
+ function isSet(value) {
82
+ return value !== null && value !== undefined;
83
+ }
84
+ // Bindable version
85
+ function preventDefault(e) {
86
+ e.preventDefault();
87
+ }
88
+ // Removes duplicates from an array.
89
+ function unique(array) {
90
+ return array.filter(function (a) {
91
+ return !this[a] ? (this[a] = true) : false;
92
+ }, {});
93
+ }
94
+ // Round a value to the closest 'to'.
95
+ function closest(value, to) {
96
+ return Math.round(value / to) * to;
97
+ }
98
+ // Current position of an element relative to the document.
99
+ function offset(elem, orientation) {
100
+ var rect = elem.getBoundingClientRect();
101
+ var doc = elem.ownerDocument;
102
+ var docElem = doc.documentElement;
103
+ var pageOffset = getPageOffset(doc);
104
+ // getBoundingClientRect contains left scroll in Chrome on Android.
105
+ // I haven't found a feature detection that proves this. Worst case
106
+ // scenario on mis-match: the 'tap' feature on horizontal sliders breaks.
107
+ if (/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)) {
108
+ pageOffset.x = 0;
109
+ }
110
+ return orientation ? rect.top + pageOffset.y - docElem.clientTop : rect.left + pageOffset.x - docElem.clientLeft;
111
+ }
112
+ // Checks whether a value is numerical.
113
+ function isNumeric(a) {
114
+ return typeof a === "number" && !isNaN(a) && isFinite(a);
115
+ }
116
+ // Sets a class and removes it after [duration] ms.
117
+ function addClassFor(element, className, duration) {
118
+ if (duration > 0) {
119
+ addClass(element, className);
120
+ setTimeout(function () {
121
+ removeClass(element, className);
122
+ }, duration);
123
+ }
124
+ }
125
+ // Limits a value to 0 - 100
126
+ function limit(a) {
127
+ return Math.max(Math.min(a, 100), 0);
128
+ }
129
+ // Wraps a variable as an array, if it isn't one yet.
130
+ // Note that an input array is returned by reference!
131
+ function asArray(a) {
132
+ return Array.isArray(a) ? a : [a];
133
+ }
134
+ // Counts decimals
135
+ function countDecimals(numStr) {
136
+ numStr = String(numStr);
137
+ var pieces = numStr.split(".");
138
+ return pieces.length > 1 ? pieces[1].length : 0;
139
+ }
140
+ // http://youmightnotneedjquery.com/#add_class
141
+ function addClass(el, className) {
142
+ if (el.classList && !/\s/.test(className)) {
143
+ el.classList.add(className);
144
+ }
145
+ else {
146
+ el.className += " " + className;
147
+ }
148
+ }
149
+ // http://youmightnotneedjquery.com/#remove_class
150
+ function removeClass(el, className) {
151
+ if (el.classList && !/\s/.test(className)) {
152
+ el.classList.remove(className);
153
+ }
154
+ else {
155
+ el.className = el.className.replace(new RegExp("(^|\\b)" + className.split(" ").join("|") + "(\\b|$)", "gi"), " ");
156
+ }
157
+ }
158
+ // https://plainjs.com/javascript/attributes/adding-removing-and-testing-for-classes-9/
159
+ function hasClass(el, className) {
160
+ return el.classList ? el.classList.contains(className) : new RegExp("\\b" + className + "\\b").test(el.className);
161
+ }
162
+ // https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY#Notes
163
+ function getPageOffset(doc) {
164
+ var supportPageOffset = window.pageXOffset !== undefined;
165
+ var isCSS1Compat = (doc.compatMode || "") === "CSS1Compat";
166
+ var x = supportPageOffset
167
+ ? window.pageXOffset
168
+ : isCSS1Compat
169
+ ? doc.documentElement.scrollLeft
170
+ : doc.body.scrollLeft;
171
+ var y = supportPageOffset
172
+ ? window.pageYOffset
173
+ : isCSS1Compat
174
+ ? doc.documentElement.scrollTop
175
+ : doc.body.scrollTop;
176
+ return {
177
+ x: x,
178
+ y: y,
179
+ };
180
+ }
181
+ // we provide a function to compute constants instead
182
+ // of accessing window.* as soon as the module needs it
183
+ // so that we do not compute anything if not needed
184
+ function getActions() {
185
+ // Determine the events to bind. IE11 implements pointerEvents without
186
+ // a prefix, which breaks compatibility with the IE10 implementation.
187
+ return window.navigator.pointerEnabled
188
+ ? {
189
+ start: "pointerdown",
190
+ move: "pointermove",
191
+ end: "pointerup",
192
+ }
193
+ : window.navigator.msPointerEnabled
194
+ ? {
195
+ start: "MSPointerDown",
196
+ move: "MSPointerMove",
197
+ end: "MSPointerUp",
198
+ }
199
+ : {
200
+ start: "mousedown touchstart",
201
+ move: "mousemove touchmove",
202
+ end: "mouseup touchend",
203
+ };
204
+ }
205
+ // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
206
+ // Issue #785
207
+ function getSupportsPassive() {
208
+ var supportsPassive = false;
209
+ /* eslint-disable */
210
+ try {
211
+ var opts = Object.defineProperty({}, "passive", {
212
+ get: function () {
213
+ supportsPassive = true;
214
+ },
215
+ });
216
+ // @ts-ignore
217
+ window.addEventListener("test", null, opts);
218
+ }
219
+ catch (e) { }
220
+ /* eslint-enable */
221
+ return supportsPassive;
222
+ }
223
+ function getSupportsTouchActionNone() {
224
+ return window.CSS && CSS.supports && CSS.supports("touch-action", "none");
225
+ }
226
+ //endregion
227
+ //region Range Calculation
228
+ // Determine the size of a sub-range in relation to a full range.
229
+ function subRangeRatio(pa, pb) {
230
+ return 100 / (pb - pa);
231
+ }
232
+ // (percentage) How many percent is this value of this range?
233
+ function fromPercentage(range, value, startRange) {
234
+ return (value * 100) / (range[startRange + 1] - range[startRange]);
235
+ }
236
+ // (percentage) Where is this value on this range?
237
+ function toPercentage(range, value) {
238
+ return fromPercentage(range, range[0] < 0 ? value + Math.abs(range[0]) : value - range[0], 0);
239
+ }
240
+ // (value) How much is this percentage on this range?
241
+ function isPercentage(range, value) {
242
+ return (value * (range[1] - range[0])) / 100 + range[0];
243
+ }
244
+ function getJ(value, arr) {
245
+ var j = 1;
246
+ while (value >= arr[j]) {
247
+ j += 1;
248
+ }
249
+ return j;
250
+ }
251
+ // (percentage) Input a value, find where, on a scale of 0-100, it applies.
252
+ function toStepping(xVal, xPct, value) {
253
+ if (value >= xVal.slice(-1)[0]) {
254
+ return 100;
255
+ }
256
+ var j = getJ(value, xVal);
257
+ var va = xVal[j - 1];
258
+ var vb = xVal[j];
259
+ var pa = xPct[j - 1];
260
+ var pb = xPct[j];
261
+ return pa + toPercentage([va, vb], value) / subRangeRatio(pa, pb);
262
+ }
263
+ // (value) Input a percentage, find where it is on the specified range.
264
+ function fromStepping(xVal, xPct, value) {
265
+ // There is no range group that fits 100
266
+ if (value >= 100) {
267
+ return xVal.slice(-1)[0];
268
+ }
269
+ var j = getJ(value, xPct);
270
+ var va = xVal[j - 1];
271
+ var vb = xVal[j];
272
+ var pa = xPct[j - 1];
273
+ var pb = xPct[j];
274
+ return isPercentage([va, vb], (value - pa) * subRangeRatio(pa, pb));
275
+ }
276
+ // (percentage) Get the step that applies at a certain value.
277
+ function getStep(xPct, xSteps, snap, value) {
278
+ if (value === 100) {
279
+ return value;
280
+ }
281
+ var j = getJ(value, xPct);
282
+ var a = xPct[j - 1];
283
+ var b = xPct[j];
284
+ // If 'snap' is set, steps are used as fixed points on the slider.
285
+ if (snap) {
286
+ // Find the closest position, a or b.
287
+ if (value - a > (b - a) / 2) {
288
+ return b;
289
+ }
290
+ return a;
291
+ }
292
+ if (!xSteps[j - 1]) {
293
+ return value;
294
+ }
295
+ return xPct[j - 1] + closest(value - xPct[j - 1], xSteps[j - 1]);
296
+ }
297
+ //endregion
298
+ //region Spectrum
299
+ var Spectrum = /** @class */ (function () {
300
+ function Spectrum(entry, snap, singleStep) {
301
+ this.xPct = [];
302
+ this.xVal = [];
303
+ this.xSteps = [];
304
+ this.xNumSteps = [];
305
+ this.xHighestCompleteStep = [];
306
+ this.xSteps = [singleStep || false];
307
+ this.xNumSteps = [false];
308
+ this.snap = snap;
309
+ var index;
310
+ var ordered = [];
311
+ // Map the object keys to an array.
312
+ Object.keys(entry).forEach(function (index) {
313
+ ordered.push([asArray(entry[index]), index]);
314
+ });
315
+ // Sort all entries by value (numeric sort).
316
+ ordered.sort(function (a, b) {
317
+ return a[0][0] - b[0][0];
318
+ });
319
+ // Convert all entries to subranges.
320
+ for (index = 0; index < ordered.length; index++) {
321
+ this.handleEntryPoint(ordered[index][1], ordered[index][0]);
322
+ }
323
+ // Store the actual step values.
324
+ // xSteps is sorted in the same order as xPct and xVal.
325
+ this.xNumSteps = this.xSteps.slice(0);
326
+ // Convert all numeric steps to the percentage of the subrange they represent.
327
+ for (index = 0; index < this.xNumSteps.length; index++) {
328
+ this.handleStepPoint(index, this.xNumSteps[index]);
329
+ }
330
+ }
331
+ Spectrum.prototype.getDistance = function (value) {
332
+ var distances = [];
333
+ for (var index = 0; index < this.xNumSteps.length - 1; index++) {
334
+ distances[index] = fromPercentage(this.xVal, value, index);
335
+ }
336
+ return distances;
337
+ };
338
+ // Calculate the percentual distance over the whole scale of ranges.
339
+ // direction: 0 = backwards / 1 = forwards
340
+ Spectrum.prototype.getAbsoluteDistance = function (value, distances, direction) {
341
+ var xPct_index = 0;
342
+ // Calculate range where to start calculation
343
+ if (value < this.xPct[this.xPct.length - 1]) {
344
+ while (value > this.xPct[xPct_index + 1]) {
345
+ xPct_index++;
346
+ }
347
+ }
348
+ else if (value === this.xPct[this.xPct.length - 1]) {
349
+ xPct_index = this.xPct.length - 2;
350
+ }
351
+ // If looking backwards and the value is exactly at a range separator then look one range further
352
+ if (!direction && value === this.xPct[xPct_index + 1]) {
353
+ xPct_index++;
354
+ }
355
+ if (distances === null) {
356
+ distances = [];
357
+ }
358
+ var start_factor;
359
+ var rest_factor = 1;
360
+ var rest_rel_distance = distances[xPct_index];
361
+ var range_pct = 0;
362
+ var rel_range_distance = 0;
363
+ var abs_distance_counter = 0;
364
+ var range_counter = 0;
365
+ // Calculate what part of the start range the value is
366
+ if (direction) {
367
+ start_factor = (value - this.xPct[xPct_index]) / (this.xPct[xPct_index + 1] - this.xPct[xPct_index]);
368
+ }
369
+ else {
370
+ start_factor = (this.xPct[xPct_index + 1] - value) / (this.xPct[xPct_index + 1] - this.xPct[xPct_index]);
371
+ }
372
+ // Do until the complete distance across ranges is calculated
373
+ while (rest_rel_distance > 0) {
374
+ // Calculate the percentage of total range
375
+ range_pct = this.xPct[xPct_index + 1 + range_counter] - this.xPct[xPct_index + range_counter];
376
+ // Detect if the margin, padding or limit is larger then the current range and calculate
377
+ if (distances[xPct_index + range_counter] * rest_factor + 100 - start_factor * 100 > 100) {
378
+ // If larger then take the percentual distance of the whole range
379
+ rel_range_distance = range_pct * start_factor;
380
+ // Rest factor of relative percentual distance still to be calculated
381
+ rest_factor = (rest_rel_distance - 100 * start_factor) / distances[xPct_index + range_counter];
382
+ // Set start factor to 1 as for next range it does not apply.
383
+ start_factor = 1;
384
+ }
385
+ else {
386
+ // If smaller or equal then take the percentual distance of the calculate percentual part of that range
387
+ rel_range_distance = ((distances[xPct_index + range_counter] * range_pct) / 100) * rest_factor;
388
+ // No rest left as the rest fits in current range
389
+ rest_factor = 0;
390
+ }
391
+ if (direction) {
392
+ abs_distance_counter = abs_distance_counter - rel_range_distance;
393
+ // Limit range to first range when distance becomes outside of minimum range
394
+ if (this.xPct.length + range_counter >= 1) {
395
+ range_counter--;
396
+ }
397
+ }
398
+ else {
399
+ abs_distance_counter = abs_distance_counter + rel_range_distance;
400
+ // Limit range to last range when distance becomes outside of maximum range
401
+ if (this.xPct.length - range_counter >= 1) {
402
+ range_counter++;
403
+ }
404
+ }
405
+ // Rest of relative percentual distance still to be calculated
406
+ rest_rel_distance = distances[xPct_index + range_counter] * rest_factor;
407
+ }
408
+ return value + abs_distance_counter;
409
+ };
410
+ Spectrum.prototype.toStepping = function (value) {
411
+ value = toStepping(this.xVal, this.xPct, value);
412
+ return value;
413
+ };
414
+ Spectrum.prototype.fromStepping = function (value) {
415
+ return fromStepping(this.xVal, this.xPct, value);
416
+ };
417
+ Spectrum.prototype.getStep = function (value) {
418
+ value = getStep(this.xPct, this.xSteps, this.snap, value);
419
+ return value;
420
+ };
421
+ Spectrum.prototype.getDefaultStep = function (value, isDown, size) {
422
+ var j = getJ(value, this.xPct);
423
+ // When at the top or stepping down, look at the previous sub-range
424
+ if (value === 100 || (isDown && value === this.xPct[j - 1])) {
425
+ j = Math.max(j - 1, 1);
426
+ }
427
+ return (this.xVal[j] - this.xVal[j - 1]) / size;
428
+ };
429
+ Spectrum.prototype.getNearbySteps = function (value) {
430
+ var j = getJ(value, this.xPct);
431
+ return {
432
+ stepBefore: {
433
+ startValue: this.xVal[j - 2],
434
+ step: this.xNumSteps[j - 2],
435
+ highestStep: this.xHighestCompleteStep[j - 2],
436
+ },
437
+ thisStep: {
438
+ startValue: this.xVal[j - 1],
439
+ step: this.xNumSteps[j - 1],
440
+ highestStep: this.xHighestCompleteStep[j - 1],
441
+ },
442
+ stepAfter: {
443
+ startValue: this.xVal[j],
444
+ step: this.xNumSteps[j],
445
+ highestStep: this.xHighestCompleteStep[j],
446
+ },
447
+ };
448
+ };
449
+ Spectrum.prototype.countStepDecimals = function () {
450
+ var stepDecimals = this.xNumSteps.map(countDecimals);
451
+ return Math.max.apply(null, stepDecimals);
452
+ };
453
+ Spectrum.prototype.hasNoSize = function () {
454
+ return this.xVal[0] === this.xVal[this.xVal.length - 1];
455
+ };
456
+ // Outside testing
457
+ Spectrum.prototype.convert = function (value) {
458
+ return this.getStep(this.toStepping(value));
459
+ };
460
+ Spectrum.prototype.handleEntryPoint = function (index, value) {
461
+ var percentage;
462
+ // Covert min/max syntax to 0 and 100.
463
+ if (index === "min") {
464
+ percentage = 0;
465
+ }
466
+ else if (index === "max") {
467
+ percentage = 100;
468
+ }
469
+ else {
470
+ percentage = parseFloat(index);
471
+ }
472
+ // Check for correct input.
473
+ if (!isNumeric(percentage) || !isNumeric(value[0])) {
474
+ throw new Error("noUiSlider: 'range' value isn't numeric.");
475
+ }
476
+ // Store values.
477
+ this.xPct.push(percentage);
478
+ this.xVal.push(value[0]);
479
+ var value1 = Number(value[1]);
480
+ // NaN will evaluate to false too, but to keep
481
+ // logging clear, set step explicitly. Make sure
482
+ // not to override the 'step' setting with false.
483
+ if (!percentage) {
484
+ if (!isNaN(value1)) {
485
+ this.xSteps[0] = value1;
486
+ }
487
+ }
488
+ else {
489
+ this.xSteps.push(isNaN(value1) ? false : value1);
490
+ }
491
+ this.xHighestCompleteStep.push(0);
492
+ };
493
+ Spectrum.prototype.handleStepPoint = function (i, n) {
494
+ // Ignore 'false' stepping.
495
+ if (!n) {
496
+ return;
497
+ }
498
+ // Step over zero-length ranges (#948);
499
+ if (this.xVal[i] === this.xVal[i + 1]) {
500
+ this.xSteps[i] = this.xHighestCompleteStep[i] = this.xVal[i];
501
+ return;
502
+ }
503
+ // Factor to range ratio
504
+ this.xSteps[i] =
505
+ fromPercentage([this.xVal[i], this.xVal[i + 1]], n, 0) / subRangeRatio(this.xPct[i], this.xPct[i + 1]);
506
+ var totalSteps = (this.xVal[i + 1] - this.xVal[i]) / this.xNumSteps[i];
507
+ var highestStep = Math.ceil(Number(totalSteps.toFixed(3)) - 1);
508
+ var step = this.xVal[i] + this.xNumSteps[i] * highestStep;
509
+ this.xHighestCompleteStep[i] = step;
510
+ };
511
+ return Spectrum;
512
+ }());
513
+ //endregion
514
+ //region Options
515
+ /* Every input option is tested and parsed. This will prevent
516
+ endless validation in internal methods. These tests are
517
+ structured with an item for every option available. An
518
+ option can be marked as required by setting the 'r' flag.
519
+ The testing function is provided with three arguments:
520
+ - The provided value for the option;
521
+ - A reference to the options object;
522
+ - The name for the option;
523
+
524
+ The testing function returns false when an error is detected,
525
+ or true when everything is OK. It can also modify the option
526
+ object, to make sure all values can be correctly looped elsewhere. */
527
+ //region Defaults
528
+ var defaultFormatter = {
529
+ to: function (value) {
530
+ return value === undefined ? "" : value.toFixed(2);
531
+ },
532
+ from: Number,
533
+ };
534
+ var cssClasses = {
535
+ target: "target",
536
+ base: "base",
537
+ origin: "origin",
538
+ handle: "handle",
539
+ handleLower: "handle-lower",
540
+ handleUpper: "handle-upper",
541
+ touchArea: "touch-area",
542
+ horizontal: "horizontal",
543
+ vertical: "vertical",
544
+ background: "background",
545
+ connect: "connect",
546
+ connects: "connects",
547
+ ltr: "ltr",
548
+ rtl: "rtl",
549
+ textDirectionLtr: "txt-dir-ltr",
550
+ textDirectionRtl: "txt-dir-rtl",
551
+ draggable: "draggable",
552
+ drag: "state-drag",
553
+ tap: "state-tap",
554
+ active: "active",
555
+ tooltip: "tooltip",
556
+ pips: "pips",
557
+ pipsHorizontal: "pips-horizontal",
558
+ pipsVertical: "pips-vertical",
559
+ marker: "marker",
560
+ markerHorizontal: "marker-horizontal",
561
+ markerVertical: "marker-vertical",
562
+ markerNormal: "marker-normal",
563
+ markerLarge: "marker-large",
564
+ markerSub: "marker-sub",
565
+ value: "value",
566
+ valueHorizontal: "value-horizontal",
567
+ valueVertical: "value-vertical",
568
+ valueNormal: "value-normal",
569
+ valueLarge: "value-large",
570
+ valueSub: "value-sub",
571
+ };
572
+ // Namespaces of internal event listeners
573
+ var INTERNAL_EVENT_NS = {
574
+ tooltips: ".__tooltips",
575
+ aria: ".__aria",
576
+ };
577
+ //endregion
578
+ function testStep(parsed, entry) {
579
+ if (!isNumeric(entry)) {
580
+ throw new Error("noUiSlider: 'step' is not numeric.");
581
+ }
582
+ // The step option can still be used to set stepping
583
+ // for linear sliders. Overwritten if set in 'range'.
584
+ parsed.singleStep = entry;
585
+ }
586
+ function testKeyboardPageMultiplier(parsed, entry) {
587
+ if (!isNumeric(entry)) {
588
+ throw new Error("noUiSlider: 'keyboardPageMultiplier' is not numeric.");
589
+ }
590
+ parsed.keyboardPageMultiplier = entry;
591
+ }
592
+ function testKeyboardMultiplier(parsed, entry) {
593
+ if (!isNumeric(entry)) {
594
+ throw new Error("noUiSlider: 'keyboardMultiplier' is not numeric.");
595
+ }
596
+ parsed.keyboardMultiplier = entry;
597
+ }
598
+ function testKeyboardDefaultStep(parsed, entry) {
599
+ if (!isNumeric(entry)) {
600
+ throw new Error("noUiSlider: 'keyboardDefaultStep' is not numeric.");
601
+ }
602
+ parsed.keyboardDefaultStep = entry;
603
+ }
604
+ function testRange(parsed, entry) {
605
+ // Filter incorrect input.
606
+ if (typeof entry !== "object" || Array.isArray(entry)) {
607
+ throw new Error("noUiSlider: 'range' is not an object.");
608
+ }
609
+ // Catch missing start or end.
610
+ if (entry.min === undefined || entry.max === undefined) {
611
+ throw new Error("noUiSlider: Missing 'min' or 'max' in 'range'.");
612
+ }
613
+ parsed.spectrum = new Spectrum(entry, parsed.snap || false, parsed.singleStep);
614
+ }
615
+ function testStart(parsed, entry) {
616
+ entry = asArray(entry);
617
+ // Validate input. Values aren't tested, as the public .val method
618
+ // will always provide a valid location.
619
+ if (!Array.isArray(entry) || !entry.length) {
620
+ throw new Error("noUiSlider: 'start' option is incorrect.");
621
+ }
622
+ // Store the number of handles.
623
+ parsed.handles = entry.length;
624
+ // When the slider is initialized, the .val method will
625
+ // be called with the start options.
626
+ parsed.start = entry;
627
+ }
628
+ function testSnap(parsed, entry) {
629
+ if (typeof entry !== "boolean") {
630
+ throw new Error("noUiSlider: 'snap' option must be a boolean.");
631
+ }
632
+ // Enforce 100% stepping within subranges.
633
+ parsed.snap = entry;
634
+ }
635
+ function testAnimate(parsed, entry) {
636
+ if (typeof entry !== "boolean") {
637
+ throw new Error("noUiSlider: 'animate' option must be a boolean.");
638
+ }
639
+ // Enforce 100% stepping within subranges.
640
+ parsed.animate = entry;
641
+ }
642
+ function testAnimationDuration(parsed, entry) {
643
+ if (typeof entry !== "number") {
644
+ throw new Error("noUiSlider: 'animationDuration' option must be a number.");
645
+ }
646
+ parsed.animationDuration = entry;
647
+ }
648
+ function testConnect(parsed, entry) {
649
+ var connect = [false];
650
+ var i;
651
+ // Map legacy options
652
+ if (entry === "lower") {
653
+ entry = [true, false];
654
+ }
655
+ else if (entry === "upper") {
656
+ entry = [false, true];
657
+ }
658
+ // Handle boolean options
659
+ if (entry === true || entry === false) {
660
+ for (i = 1; i < parsed.handles; i++) {
661
+ connect.push(entry);
662
+ }
663
+ connect.push(false);
664
+ }
665
+ // Reject invalid input
666
+ else if (!Array.isArray(entry) || !entry.length || entry.length !== parsed.handles + 1) {
667
+ throw new Error("noUiSlider: 'connect' option doesn't match handle count.");
668
+ }
669
+ else {
670
+ connect = entry;
671
+ }
672
+ parsed.connect = connect;
673
+ }
674
+ function testOrientation(parsed, entry) {
675
+ // Set orientation to an a numerical value for easy
676
+ // array selection.
677
+ switch (entry) {
678
+ case "horizontal":
679
+ parsed.ort = 0;
680
+ break;
681
+ case "vertical":
682
+ parsed.ort = 1;
683
+ break;
684
+ default:
685
+ throw new Error("noUiSlider: 'orientation' option is invalid.");
686
+ }
687
+ }
688
+ function testMargin(parsed, entry) {
689
+ if (!isNumeric(entry)) {
690
+ throw new Error("noUiSlider: 'margin' option must be numeric.");
691
+ }
692
+ // Issue #582
693
+ if (entry === 0) {
694
+ return;
695
+ }
696
+ parsed.margin = parsed.spectrum.getDistance(entry);
697
+ }
698
+ function testLimit(parsed, entry) {
699
+ if (!isNumeric(entry)) {
700
+ throw new Error("noUiSlider: 'limit' option must be numeric.");
701
+ }
702
+ parsed.limit = parsed.spectrum.getDistance(entry);
703
+ if (!parsed.limit || parsed.handles < 2) {
704
+ throw new Error("noUiSlider: 'limit' option is only supported on linear sliders with 2 or more handles.");
705
+ }
706
+ }
707
+ function testPadding(parsed, entry) {
708
+ var index;
709
+ if (!isNumeric(entry) && !Array.isArray(entry)) {
710
+ throw new Error("noUiSlider: 'padding' option must be numeric or array of exactly 2 numbers.");
711
+ }
712
+ if (Array.isArray(entry) && !(entry.length === 2 || isNumeric(entry[0]) || isNumeric(entry[1]))) {
713
+ throw new Error("noUiSlider: 'padding' option must be numeric or array of exactly 2 numbers.");
714
+ }
715
+ if (entry === 0) {
716
+ return;
717
+ }
718
+ if (!Array.isArray(entry)) {
719
+ entry = [entry, entry];
720
+ }
721
+ // 'getDistance' returns false for invalid values.
722
+ parsed.padding = [parsed.spectrum.getDistance(entry[0]), parsed.spectrum.getDistance(entry[1])];
723
+ for (index = 0; index < parsed.spectrum.xNumSteps.length - 1; index++) {
724
+ // last "range" can't contain step size as it is purely an endpoint.
725
+ if (parsed.padding[0][index] < 0 || parsed.padding[1][index] < 0) {
726
+ throw new Error("noUiSlider: 'padding' option must be a positive number(s).");
727
+ }
728
+ }
729
+ var totalPadding = entry[0] + entry[1];
730
+ var firstValue = parsed.spectrum.xVal[0];
731
+ var lastValue = parsed.spectrum.xVal[parsed.spectrum.xVal.length - 1];
732
+ if (totalPadding / (lastValue - firstValue) > 1) {
733
+ throw new Error("noUiSlider: 'padding' option must not exceed 100% of the range.");
734
+ }
735
+ }
736
+ function testDirection(parsed, entry) {
737
+ // Set direction as a numerical value for easy parsing.
738
+ // Invert connection for RTL sliders, so that the proper
739
+ // handles get the connect/background classes.
740
+ switch (entry) {
741
+ case "ltr":
742
+ parsed.dir = 0;
743
+ break;
744
+ case "rtl":
745
+ parsed.dir = 1;
746
+ break;
747
+ default:
748
+ throw new Error("noUiSlider: 'direction' option was not recognized.");
749
+ }
750
+ }
751
+ function testBehaviour(parsed, entry) {
752
+ // Make sure the input is a string.
753
+ if (typeof entry !== "string") {
754
+ throw new Error("noUiSlider: 'behaviour' must be a string containing options.");
755
+ }
756
+ // Check if the string contains any keywords.
757
+ // None are required.
758
+ var tap = entry.indexOf("tap") >= 0;
759
+ var drag = entry.indexOf("drag") >= 0;
760
+ var fixed = entry.indexOf("fixed") >= 0;
761
+ var snap = entry.indexOf("snap") >= 0;
762
+ var hover = entry.indexOf("hover") >= 0;
763
+ var unconstrained = entry.indexOf("unconstrained") >= 0;
764
+ var invertConnects = entry.indexOf("invert-connects") >= 0;
765
+ var dragAll = entry.indexOf("drag-all") >= 0;
766
+ var smoothSteps = entry.indexOf("smooth-steps") >= 0;
767
+ if (fixed) {
768
+ if (parsed.handles !== 2) {
769
+ throw new Error("noUiSlider: 'fixed' behaviour must be used with 2 handles");
770
+ }
771
+ // Use margin to enforce fixed state
772
+ testMargin(parsed, parsed.start[1] - parsed.start[0]);
773
+ }
774
+ if (invertConnects && parsed.handles !== 2) {
775
+ throw new Error("noUiSlider: 'invert-connects' behaviour must be used with 2 handles");
776
+ }
777
+ if (unconstrained && (parsed.margin || parsed.limit)) {
778
+ throw new Error("noUiSlider: 'unconstrained' behaviour cannot be used with margin or limit");
779
+ }
780
+ parsed.events = {
781
+ tap: tap || snap,
782
+ drag: drag,
783
+ dragAll: dragAll,
784
+ smoothSteps: smoothSteps,
785
+ fixed: fixed,
786
+ snap: snap,
787
+ hover: hover,
788
+ unconstrained: unconstrained,
789
+ invertConnects: invertConnects,
790
+ };
791
+ }
792
+ function testTooltips(parsed, entry) {
793
+ if (entry === false) {
794
+ return;
795
+ }
796
+ if (entry === true || isValidPartialFormatter(entry)) {
797
+ parsed.tooltips = [];
798
+ for (var i = 0; i < parsed.handles; i++) {
799
+ parsed.tooltips.push(entry);
800
+ }
801
+ }
802
+ else {
803
+ entry = asArray(entry);
804
+ if (entry.length !== parsed.handles) {
805
+ throw new Error("noUiSlider: must pass a formatter for all handles.");
806
+ }
807
+ entry.forEach(function (formatter) {
808
+ if (typeof formatter !== "boolean" && !isValidPartialFormatter(formatter)) {
809
+ throw new Error("noUiSlider: 'tooltips' must be passed a formatter or 'false'.");
810
+ }
811
+ });
812
+ parsed.tooltips = entry;
813
+ }
814
+ }
815
+ function testHandleAttributes(parsed, entry) {
816
+ if (entry.length !== parsed.handles) {
817
+ throw new Error("noUiSlider: must pass a attributes for all handles.");
818
+ }
819
+ parsed.handleAttributes = entry;
820
+ }
821
+ function testAriaFormat(parsed, entry) {
822
+ if (!isValidPartialFormatter(entry)) {
823
+ throw new Error("noUiSlider: 'ariaFormat' requires 'to' method.");
824
+ }
825
+ parsed.ariaFormat = entry;
826
+ }
827
+ function testFormat(parsed, entry) {
828
+ if (!isValidFormatter(entry)) {
829
+ throw new Error("noUiSlider: 'format' requires 'to' and 'from' methods.");
830
+ }
831
+ parsed.format = entry;
832
+ }
833
+ function testKeyboardSupport(parsed, entry) {
834
+ if (typeof entry !== "boolean") {
835
+ throw new Error("noUiSlider: 'keyboardSupport' option must be a boolean.");
836
+ }
837
+ parsed.keyboardSupport = entry;
838
+ }
839
+ function testDocumentElement(parsed, entry) {
840
+ // This is an advanced option. Passed values are used without validation.
841
+ parsed.documentElement = entry;
842
+ }
843
+ function testCssPrefix(parsed, entry) {
844
+ if (typeof entry !== "string" && entry !== false) {
845
+ throw new Error("noUiSlider: 'cssPrefix' must be a string or `false`.");
846
+ }
847
+ parsed.cssPrefix = entry;
848
+ }
849
+ function testCssClasses(parsed, entry) {
850
+ if (typeof entry !== "object") {
851
+ throw new Error("noUiSlider: 'cssClasses' must be an object.");
852
+ }
853
+ if (typeof parsed.cssPrefix === "string") {
854
+ parsed.cssClasses = {};
855
+ Object.keys(entry).forEach(function (key) {
856
+ parsed.cssClasses[key] = parsed.cssPrefix + entry[key];
857
+ });
858
+ }
859
+ else {
860
+ parsed.cssClasses = entry;
861
+ }
862
+ }
863
+ // Test all developer settings and parse to assumption-safe values.
864
+ function testOptions(options) {
865
+ // To prove a fix for #537, freeze options here.
866
+ // If the object is modified, an error will be thrown.
867
+ // Object.freeze(options);
868
+ var parsed = {
869
+ margin: null,
870
+ limit: null,
871
+ padding: null,
872
+ animate: true,
873
+ animationDuration: 300,
874
+ ariaFormat: defaultFormatter,
875
+ format: defaultFormatter,
876
+ };
877
+ // Tests are executed in the order they are presented here.
878
+ var tests = {
879
+ step: { r: false, t: testStep },
880
+ keyboardPageMultiplier: { r: false, t: testKeyboardPageMultiplier },
881
+ keyboardMultiplier: { r: false, t: testKeyboardMultiplier },
882
+ keyboardDefaultStep: { r: false, t: testKeyboardDefaultStep },
883
+ start: { r: true, t: testStart },
884
+ connect: { r: true, t: testConnect },
885
+ direction: { r: true, t: testDirection },
886
+ snap: { r: false, t: testSnap },
887
+ animate: { r: false, t: testAnimate },
888
+ animationDuration: { r: false, t: testAnimationDuration },
889
+ range: { r: true, t: testRange },
890
+ orientation: { r: false, t: testOrientation },
891
+ margin: { r: false, t: testMargin },
892
+ limit: { r: false, t: testLimit },
893
+ padding: { r: false, t: testPadding },
894
+ behaviour: { r: true, t: testBehaviour },
895
+ ariaFormat: { r: false, t: testAriaFormat },
896
+ format: { r: false, t: testFormat },
897
+ tooltips: { r: false, t: testTooltips },
898
+ keyboardSupport: { r: true, t: testKeyboardSupport },
899
+ documentElement: { r: false, t: testDocumentElement },
900
+ cssPrefix: { r: true, t: testCssPrefix },
901
+ cssClasses: { r: true, t: testCssClasses },
902
+ handleAttributes: { r: false, t: testHandleAttributes },
903
+ };
904
+ var defaults = {
905
+ connect: false,
906
+ direction: "ltr",
907
+ behaviour: "tap",
908
+ orientation: "horizontal",
909
+ keyboardSupport: true,
910
+ cssPrefix: "noUi-",
911
+ cssClasses: cssClasses,
912
+ keyboardPageMultiplier: 5,
913
+ keyboardMultiplier: 1,
914
+ keyboardDefaultStep: 10,
915
+ };
916
+ // AriaFormat defaults to regular format, if any.
917
+ if (options.format && !options.ariaFormat) {
918
+ options.ariaFormat = options.format;
919
+ }
920
+ // Run all options through a testing mechanism to ensure correct
921
+ // input. It should be noted that options might get modified to
922
+ // be handled properly. E.g. wrapping integers in arrays.
923
+ Object.keys(tests).forEach(function (name) {
924
+ // If the option isn't set, but it is required, throw an error.
925
+ if (!isSet(options[name]) && defaults[name] === undefined) {
926
+ if (tests[name].r) {
927
+ throw new Error("noUiSlider: '" + name + "' is required.");
928
+ }
929
+ return;
930
+ }
931
+ tests[name].t(parsed, !isSet(options[name]) ? defaults[name] : options[name]);
932
+ });
933
+ // Forward pips options
934
+ parsed.pips = options.pips;
935
+ // All recent browsers accept unprefixed transform.
936
+ // We need -ms- for IE9 and -webkit- for older Android;
937
+ // Assume use of -webkit- if unprefixed and -ms- are not supported.
938
+ // https://caniuse.com/#feat=transforms2d
939
+ var d = document.createElement("div");
940
+ var msPrefix = d.style.msTransform !== undefined;
941
+ var noPrefix = d.style.transform !== undefined;
942
+ parsed.transformRule = noPrefix ? "transform" : msPrefix ? "msTransform" : "webkitTransform";
943
+ // Pips don't move, so we can place them using left/top.
944
+ var styles = [
945
+ ["left", "top"],
946
+ ["right", "bottom"],
947
+ ];
948
+ parsed.style = styles[parsed.dir][parsed.ort];
949
+ return parsed;
950
+ }
951
+ //endregion
952
+ function scope(target, options, originalOptions) {
953
+ var actions = getActions();
954
+ var supportsTouchActionNone = getSupportsTouchActionNone();
955
+ var supportsPassive = supportsTouchActionNone && getSupportsPassive();
956
+ // All variables local to 'scope' are prefixed with 'scope_'
957
+ // Slider DOM Nodes
958
+ var scope_Target = target;
959
+ var scope_Base;
960
+ var scope_ConnectBase;
961
+ var scope_Handles;
962
+ var scope_Connects;
963
+ var scope_Pips;
964
+ var scope_Tooltips;
965
+ // Slider state values
966
+ var scope_Spectrum = options.spectrum;
967
+ var scope_Values = [];
968
+ var scope_Locations = [];
969
+ var scope_HandleNumbers = [];
970
+ var scope_ActiveHandlesCount = 0;
971
+ var scope_Events = {};
972
+ var scope_ConnectsInverted = false;
973
+ // Document Nodes
974
+ var scope_Document = target.ownerDocument;
975
+ var scope_DocumentElement = options.documentElement || scope_Document.documentElement;
976
+ var scope_Body = scope_Document.body;
977
+ // For horizontal sliders in standard ltr documents,
978
+ // make .noUi-origin overflow to the left so the document doesn't scroll.
979
+ var scope_DirOffset = scope_Document.dir === "rtl" || options.ort === 1 ? 0 : 100;
980
+ // Creates a node, adds it to target, returns the new node.
981
+ function addNodeTo(addTarget, className) {
982
+ var div = scope_Document.createElement("div");
983
+ if (className) {
984
+ addClass(div, className);
985
+ }
986
+ addTarget.appendChild(div);
987
+ return div;
988
+ }
989
+ // Append a origin to the base
990
+ function addOrigin(base, handleNumber) {
991
+ var origin = addNodeTo(base, options.cssClasses.origin);
992
+ var handle = addNodeTo(origin, options.cssClasses.handle);
993
+ addNodeTo(handle, options.cssClasses.touchArea);
994
+ handle.setAttribute("data-handle", String(handleNumber));
995
+ if (options.keyboardSupport) {
996
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
997
+ // 0 = focusable and reachable
998
+ handle.setAttribute("tabindex", "0");
999
+ handle.addEventListener("keydown", function (event) {
1000
+ return eventKeydown(event, handleNumber);
1001
+ });
1002
+ }
1003
+ if (options.handleAttributes !== undefined) {
1004
+ var attributes_1 = options.handleAttributes[handleNumber];
1005
+ Object.keys(attributes_1).forEach(function (attribute) {
1006
+ handle.setAttribute(attribute, attributes_1[attribute]);
1007
+ });
1008
+ }
1009
+ handle.setAttribute("role", "slider");
1010
+ handle.setAttribute("aria-orientation", options.ort ? "vertical" : "horizontal");
1011
+ if (handleNumber === 0) {
1012
+ addClass(handle, options.cssClasses.handleLower);
1013
+ }
1014
+ else if (handleNumber === options.handles - 1) {
1015
+ addClass(handle, options.cssClasses.handleUpper);
1016
+ }
1017
+ origin.handle = handle;
1018
+ return origin;
1019
+ }
1020
+ // Insert nodes for connect elements
1021
+ function addConnect(base, add) {
1022
+ if (!add) {
1023
+ return false;
1024
+ }
1025
+ return addNodeTo(base, options.cssClasses.connect);
1026
+ }
1027
+ // Add handles to the slider base.
1028
+ function addElements(connectOptions, base) {
1029
+ scope_ConnectBase = addNodeTo(base, options.cssClasses.connects);
1030
+ scope_Handles = [];
1031
+ scope_Connects = [];
1032
+ scope_Connects.push(addConnect(scope_ConnectBase, connectOptions[0]));
1033
+ // [::::O====O====O====]
1034
+ // connectOptions = [0, 1, 1, 1]
1035
+ for (var i = 0; i < options.handles; i++) {
1036
+ // Keep a list of all added handles.
1037
+ scope_Handles.push(addOrigin(base, i));
1038
+ scope_HandleNumbers[i] = i;
1039
+ scope_Connects.push(addConnect(scope_ConnectBase, connectOptions[i + 1]));
1040
+ }
1041
+ }
1042
+ // Initialize a single slider.
1043
+ function addSlider(addTarget) {
1044
+ // Apply classes and data to the target.
1045
+ addClass(addTarget, options.cssClasses.target);
1046
+ if (options.dir === 0) {
1047
+ addClass(addTarget, options.cssClasses.ltr);
1048
+ }
1049
+ else {
1050
+ addClass(addTarget, options.cssClasses.rtl);
1051
+ }
1052
+ if (options.ort === 0) {
1053
+ addClass(addTarget, options.cssClasses.horizontal);
1054
+ }
1055
+ else {
1056
+ addClass(addTarget, options.cssClasses.vertical);
1057
+ }
1058
+ var textDirection = getComputedStyle(addTarget).direction;
1059
+ if (textDirection === "rtl") {
1060
+ addClass(addTarget, options.cssClasses.textDirectionRtl);
1061
+ }
1062
+ else {
1063
+ addClass(addTarget, options.cssClasses.textDirectionLtr);
1064
+ }
1065
+ return addNodeTo(addTarget, options.cssClasses.base);
1066
+ }
1067
+ function addTooltip(handle, handleNumber) {
1068
+ if (!options.tooltips || !options.tooltips[handleNumber]) {
1069
+ return false;
1070
+ }
1071
+ return addNodeTo(handle.firstChild, options.cssClasses.tooltip);
1072
+ }
1073
+ function isSliderDisabled() {
1074
+ return scope_Target.hasAttribute("disabled");
1075
+ }
1076
+ // Disable the slider dragging if any handle is disabled
1077
+ function isHandleDisabled(handleNumber) {
1078
+ var handleOrigin = scope_Handles[handleNumber];
1079
+ return handleOrigin.hasAttribute("disabled");
1080
+ }
1081
+ function disable(handleNumber) {
1082
+ if (handleNumber !== null && handleNumber !== undefined) {
1083
+ scope_Handles[handleNumber].setAttribute("disabled", "");
1084
+ scope_Handles[handleNumber].handle.removeAttribute("tabindex");
1085
+ }
1086
+ else {
1087
+ scope_Target.setAttribute("disabled", "");
1088
+ scope_Handles.forEach(function (handle) {
1089
+ handle.handle.removeAttribute("tabindex");
1090
+ });
1091
+ }
1092
+ }
1093
+ function enable(handleNumber) {
1094
+ if (handleNumber !== null && handleNumber !== undefined) {
1095
+ scope_Handles[handleNumber].removeAttribute("disabled");
1096
+ scope_Handles[handleNumber].handle.setAttribute("tabindex", "0");
1097
+ }
1098
+ else {
1099
+ scope_Target.removeAttribute("disabled");
1100
+ scope_Handles.forEach(function (handle) {
1101
+ handle.removeAttribute("disabled");
1102
+ handle.handle.setAttribute("tabindex", "0");
1103
+ });
1104
+ }
1105
+ }
1106
+ function removeTooltips() {
1107
+ if (scope_Tooltips) {
1108
+ removeEvent("update" + INTERNAL_EVENT_NS.tooltips);
1109
+ scope_Tooltips.forEach(function (tooltip) {
1110
+ if (tooltip) {
1111
+ removeElement(tooltip);
1112
+ }
1113
+ });
1114
+ scope_Tooltips = null;
1115
+ }
1116
+ }
1117
+ // The tooltips option is a shorthand for using the 'update' event.
1118
+ function tooltips() {
1119
+ removeTooltips();
1120
+ // Tooltips are added with options.tooltips in original order.
1121
+ scope_Tooltips = scope_Handles.map(addTooltip);
1122
+ bindEvent("update" + INTERNAL_EVENT_NS.tooltips, function (values, handleNumber, unencoded) {
1123
+ if (!scope_Tooltips || !options.tooltips) {
1124
+ return;
1125
+ }
1126
+ if (scope_Tooltips[handleNumber] === false) {
1127
+ return;
1128
+ }
1129
+ var formattedValue = values[handleNumber];
1130
+ if (options.tooltips[handleNumber] !== true) {
1131
+ formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);
1132
+ }
1133
+ scope_Tooltips[handleNumber].innerHTML = formattedValue;
1134
+ });
1135
+ }
1136
+ function aria() {
1137
+ removeEvent("update" + INTERNAL_EVENT_NS.aria);
1138
+ bindEvent("update" + INTERNAL_EVENT_NS.aria, function (values, handleNumber, unencoded, tap, positions) {
1139
+ // Update Aria Values for all handles, as a change in one changes min and max values for the next.
1140
+ scope_HandleNumbers.forEach(function (index) {
1141
+ var handle = scope_Handles[index];
1142
+ var min = checkHandlePosition(scope_Locations, index, 0, true, true, true);
1143
+ var max = checkHandlePosition(scope_Locations, index, 100, true, true, true);
1144
+ var now = positions[index];
1145
+ // Formatted value for display
1146
+ var text = String(options.ariaFormat.to(unencoded[index]));
1147
+ // Map to slider range values
1148
+ min = scope_Spectrum.fromStepping(min).toFixed(1);
1149
+ max = scope_Spectrum.fromStepping(max).toFixed(1);
1150
+ now = scope_Spectrum.fromStepping(now).toFixed(1);
1151
+ handle.children[0].setAttribute("aria-valuemin", min);
1152
+ handle.children[0].setAttribute("aria-valuemax", max);
1153
+ handle.children[0].setAttribute("aria-valuenow", now);
1154
+ handle.children[0].setAttribute("aria-valuetext", text);
1155
+ });
1156
+ });
1157
+ }
1158
+ function getGroup(pips) {
1159
+ // Use the range.
1160
+ if (pips.mode === PipsMode.Range || pips.mode === PipsMode.Steps) {
1161
+ return scope_Spectrum.xVal;
1162
+ }
1163
+ if (pips.mode === PipsMode.Count) {
1164
+ if (pips.values < 2) {
1165
+ throw new Error("noUiSlider: 'values' (>= 2) required for mode 'count'.");
1166
+ }
1167
+ // Divide 0 - 100 in 'count' parts.
1168
+ var interval = pips.values - 1;
1169
+ var spread = 100 / interval;
1170
+ var values = [];
1171
+ // List these parts and have them handled as 'positions'.
1172
+ while (interval--) {
1173
+ values[interval] = interval * spread;
1174
+ }
1175
+ values.push(100);
1176
+ return mapToRange(values, pips.stepped);
1177
+ }
1178
+ if (pips.mode === PipsMode.Positions) {
1179
+ // Map all percentages to on-range values.
1180
+ return mapToRange(pips.values, pips.stepped);
1181
+ }
1182
+ if (pips.mode === PipsMode.Values) {
1183
+ // If the value must be stepped, it needs to be converted to a percentage first.
1184
+ if (pips.stepped) {
1185
+ return pips.values.map(function (value) {
1186
+ // Convert to percentage, apply step, return to value.
1187
+ return scope_Spectrum.fromStepping(scope_Spectrum.getStep(scope_Spectrum.toStepping(value)));
1188
+ });
1189
+ }
1190
+ // Otherwise, we can simply use the values.
1191
+ return pips.values;
1192
+ }
1193
+ return []; // pips.mode = never
1194
+ }
1195
+ function mapToRange(values, stepped) {
1196
+ return values.map(function (value) {
1197
+ return scope_Spectrum.fromStepping(stepped ? scope_Spectrum.getStep(value) : value);
1198
+ });
1199
+ }
1200
+ function generateSpread(pips) {
1201
+ function safeIncrement(value, increment) {
1202
+ // Avoid floating point variance by dropping the smallest decimal places.
1203
+ return Number((value + increment).toFixed(7));
1204
+ }
1205
+ var group = getGroup(pips);
1206
+ var indexes = {};
1207
+ var firstInRange = scope_Spectrum.xVal[0];
1208
+ var lastInRange = scope_Spectrum.xVal[scope_Spectrum.xVal.length - 1];
1209
+ var ignoreFirst = false;
1210
+ var ignoreLast = false;
1211
+ var prevPct = 0;
1212
+ // Create a copy of the group, sort it and filter away all duplicates.
1213
+ group = unique(group.slice().sort(function (a, b) {
1214
+ return a - b;
1215
+ }));
1216
+ // Make sure the range starts with the first element.
1217
+ if (group[0] !== firstInRange) {
1218
+ group.unshift(firstInRange);
1219
+ ignoreFirst = true;
1220
+ }
1221
+ // Likewise for the last one.
1222
+ if (group[group.length - 1] !== lastInRange) {
1223
+ group.push(lastInRange);
1224
+ ignoreLast = true;
1225
+ }
1226
+ group.forEach(function (current, index) {
1227
+ // Get the current step and the lower + upper positions.
1228
+ var step;
1229
+ var i;
1230
+ var q;
1231
+ var low = current;
1232
+ var high = group[index + 1];
1233
+ var newPct;
1234
+ var pctDifference;
1235
+ var pctPos;
1236
+ var type;
1237
+ var steps;
1238
+ var realSteps;
1239
+ var stepSize;
1240
+ var isSteps = pips.mode === PipsMode.Steps;
1241
+ // When using 'steps' mode, use the provided steps.
1242
+ // Otherwise, we'll step on to the next subrange.
1243
+ if (isSteps) {
1244
+ step = scope_Spectrum.xNumSteps[index];
1245
+ }
1246
+ // Default to a 'full' step.
1247
+ if (!step) {
1248
+ step = high - low;
1249
+ }
1250
+ // If high is undefined we are at the last subrange. Make sure it iterates once (#1088)
1251
+ if (high === undefined) {
1252
+ high = low;
1253
+ }
1254
+ // Make sure step isn't 0, which would cause an infinite loop (#654)
1255
+ step = Math.max(step, 0.0000001);
1256
+ // Find all steps in the subrange.
1257
+ for (i = low; i <= high; i = safeIncrement(i, step)) {
1258
+ // Get the percentage value for the current step,
1259
+ // calculate the size for the subrange.
1260
+ newPct = scope_Spectrum.toStepping(i);
1261
+ pctDifference = newPct - prevPct;
1262
+ steps = pctDifference / (pips.density || 1);
1263
+ realSteps = Math.round(steps);
1264
+ // This ratio represents the amount of percentage-space a point indicates.
1265
+ // For a density 1 the points/percentage = 1. For density 2, that percentage needs to be re-divided.
1266
+ // Round the percentage offset to an even number, then divide by two
1267
+ // to spread the offset on both sides of the range.
1268
+ stepSize = pctDifference / realSteps;
1269
+ // Divide all points evenly, adding the correct number to this subrange.
1270
+ // Run up to <= so that 100% gets a point, event if ignoreLast is set.
1271
+ for (q = 1; q <= realSteps; q += 1) {
1272
+ // The ratio between the rounded value and the actual size might be ~1% off.
1273
+ // Correct the percentage offset by the number of points
1274
+ // per subrange. density = 1 will result in 100 points on the
1275
+ // full range, 2 for 50, 4 for 25, etc.
1276
+ pctPos = prevPct + q * stepSize;
1277
+ indexes[pctPos.toFixed(5)] = [scope_Spectrum.fromStepping(pctPos), 0];
1278
+ }
1279
+ // Determine the point type.
1280
+ type = group.indexOf(i) > -1 ? PipsType.LargeValue : isSteps ? PipsType.SmallValue : PipsType.NoValue;
1281
+ // Enforce the 'ignoreFirst' option by overwriting the type for 0.
1282
+ if (!index && ignoreFirst && i !== high) {
1283
+ type = 0;
1284
+ }
1285
+ if (!(i === high && ignoreLast)) {
1286
+ // Mark the 'type' of this point. 0 = plain, 1 = real value, 2 = step value.
1287
+ indexes[newPct.toFixed(5)] = [i, type];
1288
+ }
1289
+ // Update the percentage count.
1290
+ prevPct = newPct;
1291
+ }
1292
+ });
1293
+ return indexes;
1294
+ }
1295
+ function addMarking(spread, filterFunc, formatter) {
1296
+ var _a, _b;
1297
+ var element = scope_Document.createElement("div");
1298
+ var valueSizeClasses = (_a = {},
1299
+ _a[PipsType.None] = "",
1300
+ _a[PipsType.NoValue] = options.cssClasses.valueNormal,
1301
+ _a[PipsType.LargeValue] = options.cssClasses.valueLarge,
1302
+ _a[PipsType.SmallValue] = options.cssClasses.valueSub,
1303
+ _a);
1304
+ var markerSizeClasses = (_b = {},
1305
+ _b[PipsType.None] = "",
1306
+ _b[PipsType.NoValue] = options.cssClasses.markerNormal,
1307
+ _b[PipsType.LargeValue] = options.cssClasses.markerLarge,
1308
+ _b[PipsType.SmallValue] = options.cssClasses.markerSub,
1309
+ _b);
1310
+ var valueOrientationClasses = [options.cssClasses.valueHorizontal, options.cssClasses.valueVertical];
1311
+ var markerOrientationClasses = [options.cssClasses.markerHorizontal, options.cssClasses.markerVertical];
1312
+ addClass(element, options.cssClasses.pips);
1313
+ addClass(element, options.ort === 0 ? options.cssClasses.pipsHorizontal : options.cssClasses.pipsVertical);
1314
+ function getClasses(type, source) {
1315
+ var a = source === options.cssClasses.value;
1316
+ var orientationClasses = a ? valueOrientationClasses : markerOrientationClasses;
1317
+ var sizeClasses = a ? valueSizeClasses : markerSizeClasses;
1318
+ return source + " " + orientationClasses[options.ort] + " " + sizeClasses[type];
1319
+ }
1320
+ function addSpread(offset, value, type) {
1321
+ // Apply the filter function, if it is set.
1322
+ type = filterFunc ? filterFunc(value, type) : type;
1323
+ if (type === PipsType.None) {
1324
+ return;
1325
+ }
1326
+ // Add a marker for every point
1327
+ var node = addNodeTo(element, false);
1328
+ node.className = getClasses(type, options.cssClasses.marker);
1329
+ node.style[options.style] = offset + "%";
1330
+ // Values are only appended for points marked '1' or '2'.
1331
+ if (type > PipsType.NoValue) {
1332
+ node = addNodeTo(element, false);
1333
+ node.className = getClasses(type, options.cssClasses.value);
1334
+ node.setAttribute("data-value", String(value));
1335
+ node.style[options.style] = offset + "%";
1336
+ node.innerHTML = String(formatter.to(value));
1337
+ }
1338
+ }
1339
+ // Append all points.
1340
+ Object.keys(spread).forEach(function (offset) {
1341
+ addSpread(offset, spread[offset][0], spread[offset][1]);
1342
+ });
1343
+ return element;
1344
+ }
1345
+ function removePips() {
1346
+ if (scope_Pips) {
1347
+ removeElement(scope_Pips);
1348
+ scope_Pips = null;
1349
+ }
1350
+ }
1351
+ function pips(pips) {
1352
+ // Fix #669
1353
+ removePips();
1354
+ var spread = generateSpread(pips);
1355
+ var filter = pips.filter;
1356
+ var format = pips.format || {
1357
+ to: function (value) {
1358
+ return String(Math.round(value));
1359
+ },
1360
+ };
1361
+ scope_Pips = scope_Target.appendChild(addMarking(spread, filter, format));
1362
+ return scope_Pips;
1363
+ }
1364
+ // Shorthand for base dimensions.
1365
+ function baseSize() {
1366
+ var rect = scope_Base.getBoundingClientRect();
1367
+ var alt = ("offset" + ["Width", "Height"][options.ort]);
1368
+ return options.ort === 0 ? rect.width || scope_Base[alt] : rect.height || scope_Base[alt];
1369
+ }
1370
+ // Handler for attaching events trough a proxy.
1371
+ function attachEvent(events, element, callback, data) {
1372
+ // This function can be used to 'filter' events to the slider.
1373
+ // element is a node, not a nodeList
1374
+ var method = function (event) {
1375
+ var e = fixEvent(event, data.pageOffset, data.target || element);
1376
+ // fixEvent returns false if this event has a different target
1377
+ // when handling (multi-) touch events;
1378
+ if (!e) {
1379
+ return false;
1380
+ }
1381
+ // doNotReject is passed by all end events to make sure released touches
1382
+ // are not rejected, leaving the slider "stuck" to the cursor;
1383
+ if (isSliderDisabled() && !data.doNotReject) {
1384
+ return false;
1385
+ }
1386
+ // Stop if an active 'tap' transition is taking place.
1387
+ if (hasClass(scope_Target, options.cssClasses.tap) && !data.doNotReject) {
1388
+ return false;
1389
+ }
1390
+ // Ignore right or middle clicks on start #454
1391
+ if (events === actions.start && e.buttons !== undefined && e.buttons > 1) {
1392
+ return false;
1393
+ }
1394
+ // Ignore right or middle clicks on start #454
1395
+ if (data.hover && e.buttons) {
1396
+ return false;
1397
+ }
1398
+ // 'supportsPassive' is only true if a browser also supports touch-action: none in CSS.
1399
+ // iOS safari does not, so it doesn't get to benefit from passive scrolling. iOS does support
1400
+ // touch-action: manipulation, but that allows panning, which breaks
1401
+ // sliders after zooming/on non-responsive pages.
1402
+ // See: https://bugs.webkit.org/show_bug.cgi?id=133112
1403
+ if (!supportsPassive) {
1404
+ e.preventDefault();
1405
+ }
1406
+ e.calcPoint = e.points[options.ort];
1407
+ // Call the event handler with the event [ and additional data ].
1408
+ callback(e, data);
1409
+ return;
1410
+ };
1411
+ var methods = [];
1412
+ // Bind a closure on the target for every event type.
1413
+ events.split(" ").forEach(function (eventName) {
1414
+ element.addEventListener(eventName, method, supportsPassive ? { passive: true } : false);
1415
+ methods.push([eventName, method]);
1416
+ });
1417
+ return methods;
1418
+ }
1419
+ // Provide a clean event with standardized offset values.
1420
+ function fixEvent(e, pageOffset, eventTarget) {
1421
+ // Filter the event to register the type, which can be
1422
+ // touch, mouse or pointer. Offset changes need to be
1423
+ // made on an event specific basis.
1424
+ var touch = e.type.indexOf("touch") === 0;
1425
+ var mouse = e.type.indexOf("mouse") === 0;
1426
+ var pointer = e.type.indexOf("pointer") === 0;
1427
+ var x = 0;
1428
+ var y = 0;
1429
+ // IE10 implemented pointer events with a prefix;
1430
+ if (e.type.indexOf("MSPointer") === 0) {
1431
+ pointer = true;
1432
+ }
1433
+ // Erroneous events seem to be passed in occasionally on iOS/iPadOS after user finishes interacting with
1434
+ // the slider. They appear to be of type MouseEvent, yet they don't have usual properties set. Ignore
1435
+ // events that have no touches or buttons associated with them. (#1057, #1079, #1095)
1436
+ if (e.type === "mousedown" && !e.buttons && !e.touches) {
1437
+ return false;
1438
+ }
1439
+ // The only thing one handle should be concerned about is the touches that originated on top of it.
1440
+ if (touch) {
1441
+ // Returns true if a touch originated on the target.
1442
+ var isTouchOnTarget = function (checkTouch) {
1443
+ var target = checkTouch.target;
1444
+ return (target === eventTarget ||
1445
+ eventTarget.contains(target) ||
1446
+ (e.composed && e.composedPath().shift() === eventTarget));
1447
+ };
1448
+ // In the case of touchstart events, we need to make sure there is still no more than one
1449
+ // touch on the target so we look amongst all touches.
1450
+ if (e.type === "touchstart") {
1451
+ var targetTouches = Array.prototype.filter.call(e.touches, isTouchOnTarget);
1452
+ // Do not support more than one touch per handle.
1453
+ if (targetTouches.length > 1) {
1454
+ return false;
1455
+ }
1456
+ x = targetTouches[0].pageX;
1457
+ y = targetTouches[0].pageY;
1458
+ }
1459
+ else {
1460
+ // In the other cases, find on changedTouches is enough.
1461
+ var targetTouch = Array.prototype.find.call(e.changedTouches, isTouchOnTarget);
1462
+ // Cancel if the target touch has not moved.
1463
+ if (!targetTouch) {
1464
+ return false;
1465
+ }
1466
+ x = targetTouch.pageX;
1467
+ y = targetTouch.pageY;
1468
+ }
1469
+ }
1470
+ pageOffset = pageOffset || getPageOffset(scope_Document);
1471
+ if (mouse || pointer) {
1472
+ x = e.clientX + pageOffset.x;
1473
+ y = e.clientY + pageOffset.y;
1474
+ }
1475
+ e.pageOffset = pageOffset;
1476
+ e.points = [x, y];
1477
+ e.cursor = mouse || pointer; // Fix #435
1478
+ return e;
1479
+ }
1480
+ // Translate a coordinate in the document to a percentage on the slider
1481
+ function calcPointToPercentage(calcPoint) {
1482
+ var location = calcPoint - offset(scope_Base, options.ort);
1483
+ var proposal = (location * 100) / baseSize();
1484
+ // Clamp proposal between 0% and 100%
1485
+ // Out-of-bound coordinates may occur when .noUi-base pseudo-elements
1486
+ // are used (e.g. contained handles feature)
1487
+ proposal = limit(proposal);
1488
+ return options.dir ? 100 - proposal : proposal;
1489
+ }
1490
+ // Find handle closest to a certain percentage on the slider
1491
+ function getClosestHandle(clickedPosition) {
1492
+ var smallestDifference = 100;
1493
+ var handleNumber = false;
1494
+ scope_Handles.forEach(function (handle, index) {
1495
+ // Disabled handles are ignored
1496
+ if (isHandleDisabled(index)) {
1497
+ return;
1498
+ }
1499
+ var handlePosition = scope_Locations[index];
1500
+ var differenceWithThisHandle = Math.abs(handlePosition - clickedPosition);
1501
+ // Initial state
1502
+ var clickAtEdge = differenceWithThisHandle === 100 && smallestDifference === 100;
1503
+ // Difference with this handle is smaller than the previously checked handle
1504
+ var isCloser = differenceWithThisHandle < smallestDifference;
1505
+ var isCloserAfter = differenceWithThisHandle <= smallestDifference && clickedPosition > handlePosition;
1506
+ if (isCloser || isCloserAfter || clickAtEdge) {
1507
+ handleNumber = index;
1508
+ smallestDifference = differenceWithThisHandle;
1509
+ }
1510
+ });
1511
+ return handleNumber;
1512
+ }
1513
+ // Fire 'end' when a mouse or pen leaves the document.
1514
+ function documentLeave(event, data) {
1515
+ if (event.type === "mouseout" &&
1516
+ event.target.nodeName === "HTML" &&
1517
+ event.relatedTarget === null) {
1518
+ eventEnd(event, data);
1519
+ }
1520
+ }
1521
+ // Handle movement on document for handle and range drag.
1522
+ function eventMove(event, data) {
1523
+ // Fix #498
1524
+ // Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).
1525
+ // https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero
1526
+ // IE9 has .buttons and .which zero on mousemove.
1527
+ // Firefox breaks the spec MDN defines.
1528
+ if (navigator.appVersion.indexOf("MSIE 9") === -1 && event.buttons === 0 && data.buttonsProperty !== 0) {
1529
+ return eventEnd(event, data);
1530
+ }
1531
+ // Check if we are moving up or down
1532
+ var movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);
1533
+ // Convert the movement into a percentage of the slider width/height
1534
+ var proposal = (movement * 100) / data.baseSize;
1535
+ moveHandles(movement > 0, proposal, data.locations, data.handleNumbers, data.connect);
1536
+ }
1537
+ // Unbind move events on document, call callbacks.
1538
+ function eventEnd(event, data) {
1539
+ // The handle is no longer active, so remove the class.
1540
+ if (data.handle) {
1541
+ removeClass(data.handle, options.cssClasses.active);
1542
+ scope_ActiveHandlesCount -= 1;
1543
+ }
1544
+ // Unbind the move and end events, which are added on 'start'.
1545
+ data.listeners.forEach(function (c) {
1546
+ scope_DocumentElement.removeEventListener(c[0], c[1]);
1547
+ });
1548
+ if (scope_ActiveHandlesCount === 0) {
1549
+ // Remove dragging class.
1550
+ removeClass(scope_Target, options.cssClasses.drag);
1551
+ setZindex();
1552
+ // Remove cursor styles and text-selection events bound to the body.
1553
+ if (event.cursor) {
1554
+ scope_Body.style.cursor = "";
1555
+ scope_Body.removeEventListener("selectstart", preventDefault);
1556
+ }
1557
+ }
1558
+ if (options.events.smoothSteps) {
1559
+ data.handleNumbers.forEach(function (handleNumber) {
1560
+ setHandle(handleNumber, scope_Locations[handleNumber], true, true, false, false);
1561
+ });
1562
+ data.handleNumbers.forEach(function (handleNumber) {
1563
+ fireEvent("update", handleNumber);
1564
+ });
1565
+ }
1566
+ data.handleNumbers.forEach(function (handleNumber) {
1567
+ fireEvent("change", handleNumber);
1568
+ fireEvent("set", handleNumber);
1569
+ fireEvent("end", handleNumber);
1570
+ });
1571
+ }
1572
+ // Bind move events on document.
1573
+ function eventStart(event, data) {
1574
+ // Ignore event if any handle is disabled
1575
+ if (data.handleNumbers.some(isHandleDisabled)) {
1576
+ return;
1577
+ }
1578
+ var handle;
1579
+ if (data.handleNumbers.length === 1) {
1580
+ var handleOrigin = scope_Handles[data.handleNumbers[0]];
1581
+ handle = handleOrigin.children[0];
1582
+ scope_ActiveHandlesCount += 1;
1583
+ // Mark the handle as 'active' so it can be styled.
1584
+ addClass(handle, options.cssClasses.active);
1585
+ }
1586
+ // A drag should never propagate up to the 'tap' event.
1587
+ event.stopPropagation();
1588
+ // Record the event listeners.
1589
+ var listeners = [];
1590
+ // Attach the move and end events.
1591
+ var moveEvent = attachEvent(actions.move, scope_DocumentElement, eventMove, {
1592
+ // The event target has changed so we need to propagate the original one so that we keep
1593
+ // relying on it to extract target touches.
1594
+ target: event.target,
1595
+ handle: handle,
1596
+ connect: data.connect,
1597
+ listeners: listeners,
1598
+ startCalcPoint: event.calcPoint,
1599
+ baseSize: baseSize(),
1600
+ pageOffset: event.pageOffset,
1601
+ handleNumbers: data.handleNumbers,
1602
+ buttonsProperty: event.buttons,
1603
+ locations: scope_Locations.slice(),
1604
+ });
1605
+ var endEvent = attachEvent(actions.end, scope_DocumentElement, eventEnd, {
1606
+ target: event.target,
1607
+ handle: handle,
1608
+ listeners: listeners,
1609
+ doNotReject: true,
1610
+ handleNumbers: data.handleNumbers,
1611
+ });
1612
+ var outEvent = attachEvent("mouseout", scope_DocumentElement, documentLeave, {
1613
+ target: event.target,
1614
+ handle: handle,
1615
+ listeners: listeners,
1616
+ doNotReject: true,
1617
+ handleNumbers: data.handleNumbers,
1618
+ });
1619
+ // We want to make sure we pushed the listeners in the listener list rather than creating
1620
+ // a new one as it has already been passed to the event handlers.
1621
+ listeners.push.apply(listeners, moveEvent.concat(endEvent, outEvent));
1622
+ // Text selection isn't an issue on touch devices,
1623
+ // so adding cursor styles can be skipped.
1624
+ if (event.cursor) {
1625
+ // Prevent the 'I' cursor and extend the range-drag cursor.
1626
+ scope_Body.style.cursor = getComputedStyle(event.target).cursor;
1627
+ // Mark the target with a dragging state.
1628
+ if (scope_Handles.length > 1) {
1629
+ addClass(scope_Target, options.cssClasses.drag);
1630
+ }
1631
+ // Prevent text selection when dragging the handles.
1632
+ // In noUiSlider <= 9.2.0, this was handled by calling preventDefault on mouse/touch start/move,
1633
+ // which is scroll blocking. The selectstart event is supported by FireFox starting from version 52,
1634
+ // meaning the only holdout is iOS Safari. This doesn't matter: text selection isn't triggered there.
1635
+ // The 'cursor' flag is false.
1636
+ // See: http://caniuse.com/#search=selectstart
1637
+ scope_Body.addEventListener("selectstart", preventDefault, false);
1638
+ }
1639
+ data.handleNumbers.forEach(function (handleNumber) {
1640
+ fireEvent("start", handleNumber);
1641
+ });
1642
+ }
1643
+ // Move closest handle to tapped location.
1644
+ function eventTap(event) {
1645
+ // The tap event shouldn't propagate up
1646
+ event.stopPropagation();
1647
+ var proposal = calcPointToPercentage(event.calcPoint);
1648
+ var handleNumber = getClosestHandle(proposal);
1649
+ // Tackle the case that all handles are 'disabled'.
1650
+ if (handleNumber === false) {
1651
+ return;
1652
+ }
1653
+ // Flag the slider as it is now in a transitional state.
1654
+ // Transition takes a configurable amount of ms (default 300). Re-enable the slider after that.
1655
+ if (!options.events.snap) {
1656
+ addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration);
1657
+ }
1658
+ setHandle(handleNumber, proposal, true, true);
1659
+ setZindex();
1660
+ fireEvent("slide", handleNumber, true);
1661
+ fireEvent("update", handleNumber, true);
1662
+ if (!options.events.snap) {
1663
+ fireEvent("change", handleNumber, true);
1664
+ fireEvent("set", handleNumber, true);
1665
+ }
1666
+ else {
1667
+ eventStart(event, { handleNumbers: [handleNumber] });
1668
+ }
1669
+ }
1670
+ // Fires a 'hover' event for a hovered mouse/pen position.
1671
+ function eventHover(event) {
1672
+ var proposal = calcPointToPercentage(event.calcPoint);
1673
+ var to = scope_Spectrum.getStep(proposal);
1674
+ var value = scope_Spectrum.fromStepping(to);
1675
+ Object.keys(scope_Events).forEach(function (targetEvent) {
1676
+ if ("hover" === targetEvent.split(".")[0]) {
1677
+ scope_Events[targetEvent].forEach(function (callback) {
1678
+ callback.call(scope_Self, value);
1679
+ });
1680
+ }
1681
+ });
1682
+ }
1683
+ // Handles keydown on focused handles
1684
+ // Don't move the document when pressing arrow keys on focused handles
1685
+ function eventKeydown(event, handleNumber) {
1686
+ if (isSliderDisabled() || isHandleDisabled(handleNumber)) {
1687
+ return false;
1688
+ }
1689
+ var horizontalKeys = ["Left", "Right"];
1690
+ var verticalKeys = ["Down", "Up"];
1691
+ var largeStepKeys = ["PageDown", "PageUp"];
1692
+ var edgeKeys = ["Home", "End"];
1693
+ if (options.dir && !options.ort) {
1694
+ // On an right-to-left slider, the left and right keys act inverted
1695
+ horizontalKeys.reverse();
1696
+ }
1697
+ else if (options.ort && !options.dir) {
1698
+ // On a top-to-bottom slider, the up and down keys act inverted
1699
+ verticalKeys.reverse();
1700
+ largeStepKeys.reverse();
1701
+ }
1702
+ // Strip "Arrow" for IE compatibility. https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
1703
+ var key = event.key.replace("Arrow", "");
1704
+ var isLargeDown = key === largeStepKeys[0];
1705
+ var isLargeUp = key === largeStepKeys[1];
1706
+ var isDown = key === verticalKeys[0] || key === horizontalKeys[0] || isLargeDown;
1707
+ var isUp = key === verticalKeys[1] || key === horizontalKeys[1] || isLargeUp;
1708
+ var isMin = key === edgeKeys[0];
1709
+ var isMax = key === edgeKeys[1];
1710
+ if (!isDown && !isUp && !isMin && !isMax) {
1711
+ return true;
1712
+ }
1713
+ event.preventDefault();
1714
+ var to;
1715
+ if (isUp || isDown) {
1716
+ var direction = isDown ? 0 : 1;
1717
+ var steps = getNextStepsForHandle(handleNumber);
1718
+ var step = steps[direction];
1719
+ // At the edge of a slider, do nothing
1720
+ if (step === null) {
1721
+ return false;
1722
+ }
1723
+ // No step set, use the default of 10% of the sub-range
1724
+ if (step === false) {
1725
+ step = scope_Spectrum.getDefaultStep(scope_Locations[handleNumber], isDown, options.keyboardDefaultStep);
1726
+ }
1727
+ if (isLargeUp || isLargeDown) {
1728
+ step *= options.keyboardPageMultiplier;
1729
+ }
1730
+ else {
1731
+ step *= options.keyboardMultiplier;
1732
+ }
1733
+ // Step over zero-length ranges (#948);
1734
+ step = Math.max(step, 0.0000001);
1735
+ // Decrement for down steps
1736
+ step = (isDown ? -1 : 1) * step;
1737
+ to = scope_Values[handleNumber] + step;
1738
+ }
1739
+ else if (isMax) {
1740
+ // End key
1741
+ to = options.spectrum.xVal[options.spectrum.xVal.length - 1];
1742
+ }
1743
+ else {
1744
+ // Home key
1745
+ to = options.spectrum.xVal[0];
1746
+ }
1747
+ setHandle(handleNumber, scope_Spectrum.toStepping(to), true, true);
1748
+ fireEvent("slide", handleNumber);
1749
+ fireEvent("update", handleNumber);
1750
+ fireEvent("change", handleNumber);
1751
+ fireEvent("set", handleNumber);
1752
+ return false;
1753
+ }
1754
+ // Attach events to several slider parts.
1755
+ function bindSliderEvents(behaviour) {
1756
+ // Attach the standard drag event to the handles.
1757
+ if (!behaviour.fixed) {
1758
+ scope_Handles.forEach(function (handle, index) {
1759
+ // These events are only bound to the visual handle
1760
+ // element, not the 'real' origin element.
1761
+ attachEvent(actions.start, handle.children[0], eventStart, {
1762
+ handleNumbers: [index],
1763
+ });
1764
+ });
1765
+ }
1766
+ // Attach the tap event to the slider base.
1767
+ if (behaviour.tap) {
1768
+ attachEvent(actions.start, scope_Base, eventTap, {});
1769
+ }
1770
+ // Fire hover events
1771
+ if (behaviour.hover) {
1772
+ attachEvent(actions.move, scope_Base, eventHover, {
1773
+ hover: true,
1774
+ });
1775
+ }
1776
+ // Make the range draggable.
1777
+ if (behaviour.drag) {
1778
+ scope_Connects.forEach(function (connect, index) {
1779
+ if (connect === false || index === 0 || index === scope_Connects.length - 1) {
1780
+ return;
1781
+ }
1782
+ var handleBefore = scope_Handles[index - 1];
1783
+ var handleAfter = scope_Handles[index];
1784
+ var eventHolders = [connect];
1785
+ var handlesToDrag = [handleBefore, handleAfter];
1786
+ var handleNumbersToDrag = [index - 1, index];
1787
+ addClass(connect, options.cssClasses.draggable);
1788
+ // When the range is fixed, the entire range can
1789
+ // be dragged by the handles. The handle in the first
1790
+ // origin will propagate the start event upward,
1791
+ // but it needs to be bound manually on the other.
1792
+ if (behaviour.fixed) {
1793
+ eventHolders.push(handleBefore.children[0]);
1794
+ eventHolders.push(handleAfter.children[0]);
1795
+ }
1796
+ if (behaviour.dragAll) {
1797
+ handlesToDrag = scope_Handles;
1798
+ handleNumbersToDrag = scope_HandleNumbers;
1799
+ }
1800
+ eventHolders.forEach(function (eventHolder) {
1801
+ attachEvent(actions.start, eventHolder, eventStart, {
1802
+ handles: handlesToDrag,
1803
+ handleNumbers: handleNumbersToDrag,
1804
+ connect: connect,
1805
+ });
1806
+ });
1807
+ });
1808
+ }
1809
+ }
1810
+ // Attach an event to this slider, possibly including a namespace
1811
+ function bindEvent(namespacedEvent, callback) {
1812
+ scope_Events[namespacedEvent] = scope_Events[namespacedEvent] || [];
1813
+ scope_Events[namespacedEvent].push(callback);
1814
+ // If the event bound is 'update,' fire it immediately for all handles.
1815
+ if (namespacedEvent.split(".")[0] === "update") {
1816
+ scope_Handles.forEach(function (a, index) {
1817
+ fireEvent("update", index);
1818
+ });
1819
+ }
1820
+ }
1821
+ function isInternalNamespace(namespace) {
1822
+ return namespace === INTERNAL_EVENT_NS.aria || namespace === INTERNAL_EVENT_NS.tooltips;
1823
+ }
1824
+ // Undo attachment of event
1825
+ function removeEvent(namespacedEvent) {
1826
+ var event = namespacedEvent && namespacedEvent.split(".")[0];
1827
+ var namespace = event ? namespacedEvent.substring(event.length) : namespacedEvent;
1828
+ Object.keys(scope_Events).forEach(function (bind) {
1829
+ var tEvent = bind.split(".")[0];
1830
+ var tNamespace = bind.substring(tEvent.length);
1831
+ if ((!event || event === tEvent) && (!namespace || namespace === tNamespace)) {
1832
+ // only delete protected internal event if intentional
1833
+ if (!isInternalNamespace(tNamespace) || namespace === tNamespace) {
1834
+ delete scope_Events[bind];
1835
+ }
1836
+ }
1837
+ });
1838
+ }
1839
+ // External event handling
1840
+ function fireEvent(eventName, handleNumber, tap) {
1841
+ Object.keys(scope_Events).forEach(function (targetEvent) {
1842
+ var eventType = targetEvent.split(".")[0];
1843
+ if (eventName === eventType) {
1844
+ scope_Events[targetEvent].forEach(function (callback) {
1845
+ callback.call(
1846
+ // Use the slider public API as the scope ('this')
1847
+ scope_Self,
1848
+ // Return values as array, so arg_1[arg_2] is always valid.
1849
+ scope_Values.map(options.format.to),
1850
+ // Handle index, 0 or 1
1851
+ handleNumber,
1852
+ // Un-formatted slider values
1853
+ scope_Values.slice(),
1854
+ // Event is fired by tap, true or false
1855
+ tap || false,
1856
+ // Left offset of the handle, in relation to the slider
1857
+ scope_Locations.slice(),
1858
+ // add the slider public API to an accessible parameter when this is unavailable
1859
+ scope_Self);
1860
+ });
1861
+ }
1862
+ });
1863
+ }
1864
+ // Split out the handle positioning logic so the Move event can use it, too
1865
+ function checkHandlePosition(reference, handleNumber, to, lookBackward, lookForward, getValue, smoothSteps) {
1866
+ var distance;
1867
+ // For sliders with multiple handles, limit movement to the other handle.
1868
+ // Apply the margin option by adding it to the handle positions.
1869
+ if (scope_Handles.length > 1 && !options.events.unconstrained) {
1870
+ if (lookBackward && handleNumber > 0) {
1871
+ distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber - 1], options.margin, false);
1872
+ to = Math.max(to, distance);
1873
+ }
1874
+ if (lookForward && handleNumber < scope_Handles.length - 1) {
1875
+ distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber + 1], options.margin, true);
1876
+ to = Math.min(to, distance);
1877
+ }
1878
+ }
1879
+ // The limit option has the opposite effect, limiting handles to a
1880
+ // maximum distance from another. Limit must be > 0, as otherwise
1881
+ // handles would be unmovable.
1882
+ if (scope_Handles.length > 1 && options.limit) {
1883
+ if (lookBackward && handleNumber > 0) {
1884
+ distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber - 1], options.limit, false);
1885
+ to = Math.min(to, distance);
1886
+ }
1887
+ if (lookForward && handleNumber < scope_Handles.length - 1) {
1888
+ distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber + 1], options.limit, true);
1889
+ to = Math.max(to, distance);
1890
+ }
1891
+ }
1892
+ // The padding option keeps the handles a certain distance from the
1893
+ // edges of the slider. Padding must be > 0.
1894
+ if (options.padding) {
1895
+ if (handleNumber === 0) {
1896
+ distance = scope_Spectrum.getAbsoluteDistance(0, options.padding[0], false);
1897
+ to = Math.max(to, distance);
1898
+ }
1899
+ if (handleNumber === scope_Handles.length - 1) {
1900
+ distance = scope_Spectrum.getAbsoluteDistance(100, options.padding[1], true);
1901
+ to = Math.min(to, distance);
1902
+ }
1903
+ }
1904
+ if (!smoothSteps) {
1905
+ to = scope_Spectrum.getStep(to);
1906
+ }
1907
+ // Limit percentage to the 0 - 100 range
1908
+ to = limit(to);
1909
+ // Return false if handle can't move
1910
+ if (to === reference[handleNumber] && !getValue) {
1911
+ return false;
1912
+ }
1913
+ return to;
1914
+ }
1915
+ // Uses slider orientation to create CSS rules. a = base value;
1916
+ function inRuleOrder(v, a) {
1917
+ var o = options.ort;
1918
+ return (o ? a : v) + ", " + (o ? v : a);
1919
+ }
1920
+ // Moves handle(s) by a percentage
1921
+ // (bool, % to move, [% where handle started, ...], [index in scope_Handles, ...])
1922
+ function moveHandles(upward, proposal, locations, handleNumbers, connect) {
1923
+ var proposals = locations.slice();
1924
+ // Store first handle now, so we still have it in case handleNumbers is reversed
1925
+ var firstHandle = handleNumbers[0];
1926
+ var smoothSteps = options.events.smoothSteps;
1927
+ var b = [!upward, upward];
1928
+ var f = [upward, !upward];
1929
+ // Copy handleNumbers so we don't change the dataset
1930
+ handleNumbers = handleNumbers.slice();
1931
+ // Check to see which handle is 'leading'.
1932
+ // If that one can't move the second can't either.
1933
+ if (upward) {
1934
+ handleNumbers.reverse();
1935
+ }
1936
+ // Step 1: get the maximum percentage that any of the handles can move
1937
+ if (handleNumbers.length > 1) {
1938
+ handleNumbers.forEach(function (handleNumber, o) {
1939
+ var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o], false, smoothSteps);
1940
+ // Stop if one of the handles can't move.
1941
+ if (to === false) {
1942
+ proposal = 0;
1943
+ }
1944
+ else {
1945
+ proposal = to - proposals[handleNumber];
1946
+ proposals[handleNumber] = to;
1947
+ }
1948
+ });
1949
+ }
1950
+ // If using one handle, check backward AND forward
1951
+ else {
1952
+ b = f = [true];
1953
+ }
1954
+ var state = false;
1955
+ // Step 2: Try to set the handles with the found percentage
1956
+ handleNumbers.forEach(function (handleNumber, o) {
1957
+ state =
1958
+ setHandle(handleNumber, locations[handleNumber] + proposal, b[o], f[o], false, smoothSteps) || state;
1959
+ });
1960
+ // Step 3: If a handle moved, fire events
1961
+ if (state) {
1962
+ handleNumbers.forEach(function (handleNumber) {
1963
+ fireEvent("update", handleNumber);
1964
+ fireEvent("slide", handleNumber);
1965
+ });
1966
+ // If target is a connect, then fire drag event
1967
+ if (connect != undefined) {
1968
+ fireEvent("drag", firstHandle);
1969
+ }
1970
+ }
1971
+ }
1972
+ // Takes a base value and an offset. This offset is used for the connect bar size.
1973
+ // In the initial design for this feature, the origin element was 1% wide.
1974
+ // Unfortunately, a rounding bug in Chrome makes it impossible to implement this feature
1975
+ // in this manner: https://bugs.chromium.org/p/chromium/issues/detail?id=798223
1976
+ function transformDirection(a, b) {
1977
+ return options.dir ? 100 - a - b : a;
1978
+ }
1979
+ // Updates scope_Locations and scope_Values, updates visual state
1980
+ function updateHandlePosition(handleNumber, to) {
1981
+ // Update locations.
1982
+ scope_Locations[handleNumber] = to;
1983
+ // Convert the value to the slider stepping/range.
1984
+ scope_Values[handleNumber] = scope_Spectrum.fromStepping(to);
1985
+ var translation = transformDirection(to, 0) - scope_DirOffset;
1986
+ var translateRule = "translate(" + inRuleOrder(translation + "%", "0") + ")";
1987
+ scope_Handles[handleNumber].style[options.transformRule] = translateRule;
1988
+ // sanity check for at least 2 handles (e.g. during setup)
1989
+ if (options.events.invertConnects && scope_Locations.length > 1) {
1990
+ // check if handles passed each other, but don't match the ConnectsInverted state
1991
+ var handlesAreInOrder = scope_Locations.every(function (position, index, locations) {
1992
+ return index === 0 || position >= locations[index - 1];
1993
+ });
1994
+ if (scope_ConnectsInverted !== !handlesAreInOrder) {
1995
+ // invert connects when handles pass each other
1996
+ invertConnects();
1997
+ // invertConnects already updates all connect elements
1998
+ return;
1999
+ }
2000
+ }
2001
+ updateConnect(handleNumber);
2002
+ updateConnect(handleNumber + 1);
2003
+ if (scope_ConnectsInverted) {
2004
+ // When connects are inverted, we also have to update adjacent connects
2005
+ updateConnect(handleNumber - 1);
2006
+ updateConnect(handleNumber + 2);
2007
+ }
2008
+ }
2009
+ // Handles before the slider middle are stacked later = higher,
2010
+ // Handles after the middle later is lower
2011
+ // [[7] [8] .......... | .......... [5] [4]
2012
+ function setZindex() {
2013
+ scope_HandleNumbers.forEach(function (handleNumber) {
2014
+ var dir = scope_Locations[handleNumber] > 50 ? -1 : 1;
2015
+ var zIndex = 3 + (scope_Handles.length + dir * handleNumber);
2016
+ scope_Handles[handleNumber].style.zIndex = String(zIndex);
2017
+ });
2018
+ }
2019
+ // Test suggested values and apply margin, step.
2020
+ // if exactInput is true, don't run checkHandlePosition, then the handle can be placed in between steps (#436)
2021
+ function setHandle(handleNumber, to, lookBackward, lookForward, exactInput, smoothSteps) {
2022
+ if (!exactInput) {
2023
+ to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward, false, smoothSteps);
2024
+ }
2025
+ if (to === false) {
2026
+ return false;
2027
+ }
2028
+ updateHandlePosition(handleNumber, to);
2029
+ return true;
2030
+ }
2031
+ // Updates style attribute for connect nodes
2032
+ function updateConnect(index) {
2033
+ // Skip connects set to false
2034
+ if (!scope_Connects[index]) {
2035
+ return;
2036
+ }
2037
+ // Create a copy of locations, so we can sort them for the local scope logic
2038
+ var locations = scope_Locations.slice();
2039
+ if (scope_ConnectsInverted) {
2040
+ locations.sort(function (a, b) {
2041
+ return a - b;
2042
+ });
2043
+ }
2044
+ var l = 0;
2045
+ var h = 100;
2046
+ if (index !== 0) {
2047
+ l = locations[index - 1];
2048
+ }
2049
+ if (index !== scope_Connects.length - 1) {
2050
+ h = locations[index];
2051
+ }
2052
+ // We use two rules:
2053
+ // 'translate' to change the left/top offset;
2054
+ // 'scale' to change the width of the element;
2055
+ // As the element has a width of 100%, a translation of 100% is equal to 100% of the parent (.noUi-base)
2056
+ var connectWidth = h - l;
2057
+ var translateRule = "translate(" + inRuleOrder(transformDirection(l, connectWidth) + "%", "0") + ")";
2058
+ var scaleRule = "scale(" + inRuleOrder(connectWidth / 100, "1") + ")";
2059
+ scope_Connects[index].style[options.transformRule] =
2060
+ translateRule + " " + scaleRule;
2061
+ }
2062
+ // Parses value passed to .set method. Returns current value if not parse-able.
2063
+ function resolveToValue(to, handleNumber) {
2064
+ // Setting with null indicates an 'ignore'.
2065
+ // Inputting 'false' is invalid.
2066
+ if (to === null || to === false || to === undefined) {
2067
+ return scope_Locations[handleNumber];
2068
+ }
2069
+ // If a formatted number was passed, attempt to decode it.
2070
+ if (typeof to === "number") {
2071
+ to = String(to);
2072
+ }
2073
+ to = options.format.from(to);
2074
+ if (to !== false) {
2075
+ to = scope_Spectrum.toStepping(to);
2076
+ }
2077
+ // If parsing the number failed, use the current value.
2078
+ if (to === false || isNaN(to)) {
2079
+ return scope_Locations[handleNumber];
2080
+ }
2081
+ return to;
2082
+ }
2083
+ // Set the slider value.
2084
+ function valueSet(input, fireSetEvent, exactInput) {
2085
+ var values = asArray(input);
2086
+ var isInit = scope_Locations[0] === undefined;
2087
+ // Event fires by default
2088
+ fireSetEvent = fireSetEvent === undefined ? true : fireSetEvent;
2089
+ // Animation is optional.
2090
+ // Make sure the initial values were set before using animated placement.
2091
+ if (options.animate && !isInit) {
2092
+ addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration);
2093
+ }
2094
+ // First pass, without lookAhead but with lookBackward. Values are set from left to right.
2095
+ scope_HandleNumbers.forEach(function (handleNumber) {
2096
+ setHandle(handleNumber, resolveToValue(values[handleNumber], handleNumber), true, false, exactInput);
2097
+ });
2098
+ var i = scope_HandleNumbers.length === 1 ? 0 : 1;
2099
+ // Spread handles evenly across the slider if the range has no size (min=max)
2100
+ if (isInit && scope_Spectrum.hasNoSize()) {
2101
+ exactInput = true;
2102
+ scope_Locations[0] = 0;
2103
+ if (scope_HandleNumbers.length > 1) {
2104
+ var space_1 = 100 / (scope_HandleNumbers.length - 1);
2105
+ scope_HandleNumbers.forEach(function (handleNumber) {
2106
+ scope_Locations[handleNumber] = handleNumber * space_1;
2107
+ });
2108
+ }
2109
+ }
2110
+ // Secondary passes. Now that all base values are set, apply constraints.
2111
+ // Iterate all handles to ensure constraints are applied for the entire slider (Issue #1009)
2112
+ for (; i < scope_HandleNumbers.length; ++i) {
2113
+ scope_HandleNumbers.forEach(function (handleNumber) {
2114
+ setHandle(handleNumber, scope_Locations[handleNumber], true, true, exactInput);
2115
+ });
2116
+ }
2117
+ setZindex();
2118
+ scope_HandleNumbers.forEach(function (handleNumber) {
2119
+ fireEvent("update", handleNumber);
2120
+ // Fire the event only for handles that received a new value, as per #579
2121
+ if (values[handleNumber] !== null && fireSetEvent) {
2122
+ fireEvent("set", handleNumber);
2123
+ }
2124
+ });
2125
+ }
2126
+ // Reset slider to initial values
2127
+ function valueReset(fireSetEvent) {
2128
+ valueSet(options.start, fireSetEvent);
2129
+ }
2130
+ // Set value for a single handle
2131
+ function valueSetHandle(handleNumber, value, fireSetEvent, exactInput) {
2132
+ // Ensure numeric input
2133
+ handleNumber = Number(handleNumber);
2134
+ if (!(handleNumber >= 0 && handleNumber < scope_HandleNumbers.length)) {
2135
+ throw new Error("noUiSlider: invalid handle number, got: " + handleNumber);
2136
+ }
2137
+ // Look both backward and forward, since we don't want this handle to "push" other handles (#960);
2138
+ // The exactInput argument can be used to ignore slider stepping (#436)
2139
+ setHandle(handleNumber, resolveToValue(value, handleNumber), true, true, exactInput);
2140
+ fireEvent("update", handleNumber);
2141
+ if (fireSetEvent) {
2142
+ fireEvent("set", handleNumber);
2143
+ }
2144
+ }
2145
+ // Get the slider value.
2146
+ function valueGet(unencoded) {
2147
+ if (unencoded === void 0) { unencoded = false; }
2148
+ if (unencoded) {
2149
+ // return a copy of the raw values
2150
+ return scope_Values.length === 1 ? scope_Values[0] : scope_Values.slice(0);
2151
+ }
2152
+ var values = scope_Values.map(options.format.to);
2153
+ // If only one handle is used, return a single value.
2154
+ if (values.length === 1) {
2155
+ return values[0];
2156
+ }
2157
+ return values;
2158
+ }
2159
+ // Removes classes from the root and empties it.
2160
+ function destroy() {
2161
+ // remove protected internal listeners
2162
+ removeEvent(INTERNAL_EVENT_NS.aria);
2163
+ removeEvent(INTERNAL_EVENT_NS.tooltips);
2164
+ Object.keys(options.cssClasses).forEach(function (key) {
2165
+ removeClass(scope_Target, options.cssClasses[key]);
2166
+ });
2167
+ while (scope_Target.firstChild) {
2168
+ scope_Target.removeChild(scope_Target.firstChild);
2169
+ }
2170
+ delete scope_Target.noUiSlider;
2171
+ }
2172
+ function getNextStepsForHandle(handleNumber) {
2173
+ var location = scope_Locations[handleNumber];
2174
+ var nearbySteps = scope_Spectrum.getNearbySteps(location);
2175
+ var value = scope_Values[handleNumber];
2176
+ var increment = nearbySteps.thisStep.step;
2177
+ var decrement = null;
2178
+ // If snapped, directly use defined step value
2179
+ if (options.snap) {
2180
+ return [
2181
+ value - nearbySteps.stepBefore.startValue || null,
2182
+ nearbySteps.stepAfter.startValue - value || null,
2183
+ ];
2184
+ }
2185
+ // If the next value in this step moves into the next step,
2186
+ // the increment is the start of the next step - the current value
2187
+ if (increment !== false) {
2188
+ if (value + increment > nearbySteps.stepAfter.startValue) {
2189
+ increment = nearbySteps.stepAfter.startValue - value;
2190
+ }
2191
+ }
2192
+ // If the value is beyond the starting point
2193
+ if (value > nearbySteps.thisStep.startValue) {
2194
+ decrement = nearbySteps.thisStep.step;
2195
+ }
2196
+ else if (nearbySteps.stepBefore.step === false) {
2197
+ decrement = false;
2198
+ }
2199
+ // If a handle is at the start of a step, it always steps back into the previous step first
2200
+ else {
2201
+ decrement = value - nearbySteps.stepBefore.highestStep;
2202
+ }
2203
+ // Now, if at the slider edges, there is no in/decrement
2204
+ if (location === 100) {
2205
+ increment = null;
2206
+ }
2207
+ else if (location === 0) {
2208
+ decrement = null;
2209
+ }
2210
+ // As per #391, the comparison for the decrement step can have some rounding issues.
2211
+ var stepDecimals = scope_Spectrum.countStepDecimals();
2212
+ // Round per #391
2213
+ if (increment !== null && increment !== false) {
2214
+ increment = Number(increment.toFixed(stepDecimals));
2215
+ }
2216
+ if (decrement !== null && decrement !== false) {
2217
+ decrement = Number(decrement.toFixed(stepDecimals));
2218
+ }
2219
+ return [decrement, increment];
2220
+ }
2221
+ // Get the current step size for the slider.
2222
+ function getNextSteps() {
2223
+ return scope_HandleNumbers.map(getNextStepsForHandle);
2224
+ }
2225
+ // Updatable: margin, limit, padding, step, range, animate, snap
2226
+ function updateOptions(optionsToUpdate, fireSetEvent) {
2227
+ // Spectrum is created using the range, snap, direction and step options.
2228
+ // 'snap' and 'step' can be updated.
2229
+ // If 'snap' and 'step' are not passed, they should remain unchanged.
2230
+ var v = valueGet();
2231
+ var updateAble = [
2232
+ "margin",
2233
+ "limit",
2234
+ "padding",
2235
+ "range",
2236
+ "animate",
2237
+ "snap",
2238
+ "step",
2239
+ "format",
2240
+ "pips",
2241
+ "tooltips",
2242
+ "connect",
2243
+ ];
2244
+ // Only change options that we're actually passed to update.
2245
+ updateAble.forEach(function (name) {
2246
+ // Check for undefined. null removes the value.
2247
+ if (optionsToUpdate[name] !== undefined) {
2248
+ originalOptions[name] = optionsToUpdate[name];
2249
+ }
2250
+ });
2251
+ var newOptions = testOptions(originalOptions);
2252
+ // Load new options into the slider state
2253
+ updateAble.forEach(function (name) {
2254
+ if (optionsToUpdate[name] !== undefined) {
2255
+ options[name] = newOptions[name];
2256
+ }
2257
+ });
2258
+ scope_Spectrum = newOptions.spectrum;
2259
+ // Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)
2260
+ options.margin = newOptions.margin;
2261
+ options.limit = newOptions.limit;
2262
+ options.padding = newOptions.padding;
2263
+ // Update pips, removes existing.
2264
+ if (options.pips) {
2265
+ pips(options.pips);
2266
+ }
2267
+ else {
2268
+ removePips();
2269
+ }
2270
+ // Update tooltips, removes existing.
2271
+ if (options.tooltips) {
2272
+ tooltips();
2273
+ }
2274
+ else {
2275
+ removeTooltips();
2276
+ }
2277
+ // Invalidate the current positioning so valueSet forces an update.
2278
+ scope_Locations = [];
2279
+ valueSet(isSet(optionsToUpdate.start) ? optionsToUpdate.start : v, fireSetEvent);
2280
+ // Update connects only if it was set
2281
+ if (optionsToUpdate.connect) {
2282
+ updateConnectOption();
2283
+ }
2284
+ }
2285
+ function updateConnectOption() {
2286
+ // IE supported way of removing children including event handlers
2287
+ while (scope_ConnectBase.firstChild) {
2288
+ scope_ConnectBase.removeChild(scope_ConnectBase.firstChild);
2289
+ }
2290
+ // Adding new connects according to the new connect options
2291
+ for (var i = 0; i <= options.handles; i++) {
2292
+ scope_Connects[i] = addConnect(scope_ConnectBase, options.connect[i]);
2293
+ updateConnect(i);
2294
+ }
2295
+ // re-adding drag events for the new connect elements
2296
+ // to ignore the other events we have to negate the 'if (!behaviour.fixed)' check
2297
+ bindSliderEvents({ drag: options.events.drag, fixed: true });
2298
+ }
2299
+ // Invert options for connect handles
2300
+ function invertConnects() {
2301
+ scope_ConnectsInverted = !scope_ConnectsInverted;
2302
+ testConnect(options,
2303
+ // inverse the connect boolean array
2304
+ options.connect.map(function (b) { return !b; }));
2305
+ updateConnectOption();
2306
+ }
2307
+ // Initialization steps
2308
+ function setupSlider() {
2309
+ // Create the base element, initialize HTML and set classes.
2310
+ // Add handles and connect elements.
2311
+ scope_Base = addSlider(scope_Target);
2312
+ addElements(options.connect, scope_Base);
2313
+ // Attach user events.
2314
+ bindSliderEvents(options.events);
2315
+ // Use the public value method to set the start values.
2316
+ valueSet(options.start);
2317
+ if (options.pips) {
2318
+ pips(options.pips);
2319
+ }
2320
+ if (options.tooltips) {
2321
+ tooltips();
2322
+ }
2323
+ aria();
2324
+ }
2325
+ setupSlider();
2326
+ var scope_Self = {
2327
+ destroy: destroy,
2328
+ steps: getNextSteps,
2329
+ on: bindEvent,
2330
+ off: removeEvent,
2331
+ get: valueGet,
2332
+ set: valueSet,
2333
+ setHandle: valueSetHandle,
2334
+ reset: valueReset,
2335
+ disable: disable,
2336
+ enable: enable,
2337
+ // Exposed for unit testing, don't use this in your application.
2338
+ __moveHandles: function (upward, proposal, handleNumbers) {
2339
+ moveHandles(upward, proposal, scope_Locations, handleNumbers);
2340
+ },
2341
+ options: originalOptions,
2342
+ updateOptions: updateOptions,
2343
+ target: scope_Target,
2344
+ removePips: removePips,
2345
+ removeTooltips: removeTooltips,
2346
+ getPositions: function () {
2347
+ return scope_Locations.slice();
2348
+ },
2349
+ getTooltips: function () {
2350
+ return scope_Tooltips;
2351
+ },
2352
+ getOrigins: function () {
2353
+ return scope_Handles;
2354
+ },
2355
+ pips: pips, // Issue #594
2356
+ };
2357
+ return scope_Self;
2358
+ }
2359
+ // Run the standard initializer
2360
+ function initialize(target, originalOptions) {
2361
+ if (!target || !target.nodeName) {
2362
+ throw new Error("noUiSlider: create requires a single element, got: " + target);
2363
+ }
2364
+ // Throw an error if the slider was already initialized.
2365
+ if (target.noUiSlider) {
2366
+ throw new Error("noUiSlider: Slider was already initialized.");
2367
+ }
2368
+ // Test the options and create the slider environment;
2369
+ var options = testOptions(originalOptions);
2370
+ var api = scope(target, options, originalOptions);
2371
+ target.noUiSlider = api;
2372
+ return api;
2373
+ }
2374
+ var noUiSlider = {
2375
+ // Exposed for unit testing, don't use this in your application.
2376
+ __spectrum: Spectrum,
2377
+ // A reference to the default classes, allows global changes.
2378
+ // Use the cssClasses option for changes to one slider.
2379
+ cssClasses: cssClasses,
2380
+ create: initialize,
2381
+ };
2382
+
2383
+ class InputSliderPickerController {
2384
+ constructor(config) {
2385
+ // Set while a programmatic setValue() is in flight, so the 'update'/'set' listeners it
2386
+ // triggers don't echo back out as dsInput/dsChange. Only real user interaction — or a test
2387
+ // harness driving the underlying noUiSlider instance directly — should emit those events;
2388
+ // an external `el.value = x` assignment (e.g. an Angular CVA writeValue()) must not.
2389
+ this.suppressEvents = false;
2390
+ this.config = config;
2391
+ this.init();
2392
+ }
2393
+ /**
2394
+ * PUBLIC API
2395
+ * ------------------------------------------------------
2396
+ */
2397
+ setValue(value) {
2398
+ var _a, _b;
2399
+ if (((_a = this.slider) === null || _a === void 0 ? void 0 : _a.get()) === value)
2400
+ return;
2401
+ this.suppressEvents = true;
2402
+ (_b = this.slider) === null || _b === void 0 ? void 0 : _b.set(value);
2403
+ this.suppressEvents = false;
2404
+ }
2405
+ setDisabled(disabled) {
2406
+ var _a, _b;
2407
+ if (disabled) {
2408
+ (_a = this.slider) === null || _a === void 0 ? void 0 : _a.disable();
2409
+ }
2410
+ else {
2411
+ (_b = this.slider) === null || _b === void 0 ? void 0 : _b.enable();
2412
+ }
2413
+ }
2414
+ setInvalid(invalid) {
2415
+ var _a;
2416
+ (_a = this.handleEl) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-invalid', invalid ? 'true' : 'false');
2417
+ }
2418
+ updateRange(min, max, step) {
2419
+ var _a;
2420
+ (_a = this.slider) === null || _a === void 0 ? void 0 : _a.updateOptions({
2421
+ range: { min: Math.min(min, max), max: Math.max(min, max) },
2422
+ step: numericStep(step),
2423
+ format: buildFormat(step),
2424
+ }, false);
2425
+ }
2426
+ focus() {
2427
+ var _a;
2428
+ (_a = this.handleEl) === null || _a === void 0 ? void 0 : _a.focus();
2429
+ }
2430
+ blur() {
2431
+ var _a;
2432
+ (_a = this.handleEl) === null || _a === void 0 ? void 0 : _a.blur();
2433
+ }
2434
+ get handleEl() {
2435
+ var _a;
2436
+ return (_a = this.config.targetEl.querySelector('.noUi-handle')) !== null && _a !== void 0 ? _a : undefined;
2437
+ }
2438
+ destroy() {
2439
+ var _a;
2440
+ (_a = this.slider) === null || _a === void 0 ? void 0 : _a.destroy();
2441
+ this.slider = undefined;
2442
+ }
2443
+ /**
2444
+ * PRIVATE
2445
+ * ------------------------------------------------------
2446
+ */
2447
+ init() {
2448
+ const { targetEl, min, max, step, value, disabled, invalid } = this.config;
2449
+ this.slider = noUiSlider.create(targetEl, {
2450
+ range: { min: Math.min(min, max), max: Math.max(min, max) },
2451
+ start: value,
2452
+ step: numericStep(step),
2453
+ format: buildFormat(step),
2454
+ // 'lower' fills the track from the start to the handle (single-handle "progress" look);
2455
+ // the remainder shows the plain track background — see input-slider.host.scss.
2456
+ connect: 'lower',
2457
+ tooltips: true,
2458
+ keyboardSupport: true,
2459
+ });
2460
+ if (disabled)
2461
+ this.slider.disable();
2462
+ // 'set' (not 'change') is used for the commit event: noUiSlider's own .set() API call —
2463
+ // used by the picker's setValue() and by test helpers driving the widget programmatically —
2464
+ // only fires 'update' + 'set', never 'change'. Real user interactions fire both together,
2465
+ // so 'set' covers both cases while 'change' alone would miss programmatic commits.
2466
+ this.slider.on('update', values => {
2467
+ if (this.suppressEvents)
2468
+ return;
2469
+ this.config.onInput(Number(values[0]));
2470
+ });
2471
+ this.slider.on('set', values => {
2472
+ if (this.suppressEvents)
2473
+ return;
2474
+ this.config.onChange(Number(values[0]));
2475
+ });
2476
+ this.connectLabelToHandle();
2477
+ this.setInvalid(invalid);
2478
+ }
2479
+ // A generic noUiSlider handle has no accessible name of its own; connect it to the
2480
+ // Field's label/description, same as SelectPickerController.connectLabelToTrigger().
2481
+ connectLabelToHandle() {
2482
+ const handle = this.handleEl;
2483
+ if (!handle)
2484
+ return;
2485
+ handle.setAttribute('aria-labelledby', this.config.labelId);
2486
+ handle.setAttribute('aria-describedby', 'description');
2487
+ }
2488
+ }
2489
+ function numericStep(step) {
2490
+ if (step === 'any')
2491
+ return undefined;
2492
+ const parsed = Number(step);
2493
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;
2494
+ }
2495
+ function buildFormat(step) {
2496
+ const decimals = decimalsFromStep(step);
2497
+ return {
2498
+ to: (value) => Number(value.toFixed(decimals)),
2499
+ from: (value) => Number(value),
2500
+ };
2501
+ }
2502
+
2503
+ const inputSliderHostCss = () => `.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.noUi-target{position:relative}.noUi-base,.noUi-connects{width:100%;height:100%;position:relative;z-index:1}.noUi-connects{overflow:hidden;z-index:0}.noUi-connect,.noUi-origin{will-change:transform;position:absolute;z-index:1;top:0;right:0;height:100%;width:100%;-ms-transform-origin:0 0;-webkit-transform-origin:0 0;-webkit-transform-style:preserve-3d;transform-origin:0 0;-webkit-transform-style:flat;transform-style:flat}.noUi-txt-dir-rtl.noUi-horizontal .noUi-origin{left:0;right:auto}.noUi-vertical .noUi-origin{top:-100%;width:0}.noUi-horizontal .noUi-origin{height:0}.noUi-handle{-webkit-backface-visibility:hidden;backface-visibility:hidden;position:absolute}.noUi-touch-area{height:100%;width:100%}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{-webkit-transition:transform .3s;-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s, -webkit-transform .3s}.noUi-state-drag *{cursor:inherit !important}.noUi-horizontal{height:18px}.noUi-horizontal .noUi-handle{width:34px;height:28px;right:-17px;top:-6px}.noUi-vertical{width:18px}.noUi-vertical .noUi-handle{width:28px;height:34px;right:-6px;bottom:-17px}.noUi-txt-dir-rtl.noUi-horizontal .noUi-handle{left:-17px;right:auto}.noUi-target{background:#fafafa;border-radius:4px;border:1px solid #d3d3d3;-webkit-box-shadow:inset 0 1px 1px #f0f0f0,0 3px 6px -5px #bbb;box-shadow:inset 0 1px 1px #f0f0f0,0 3px 6px -5px #bbb}.noUi-connects{border-radius:3px}.noUi-connect{background:#3fb8af}.noUi-draggable{cursor:ew-resize}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-handle{border:1px solid #d9d9d9;border-radius:3px;background:#fff;cursor:default;-webkit-box-shadow:inset 0 0 1px #fff,inset 0 1px 7px #ebebeb,0 3px 6px -3px #bbb;box-shadow:inset 0 0 1px #fff,inset 0 1px 7px #ebebeb,0 3px 6px -3px #bbb}.noUi-active{-webkit-box-shadow:inset 0 0 1px #fff,inset 0 1px 7px #ddd,0 3px 6px -3px #bbb;box-shadow:inset 0 0 1px #fff,inset 0 1px 7px #ddd,0 3px 6px -3px #bbb}.noUi-handle:before,.noUi-handle:after{content:"";display:block;position:absolute;height:14px;width:1px;background:#e8e7e6;left:14px;top:6px}.noUi-handle:after{left:17px}.noUi-vertical .noUi-handle:before,.noUi-vertical .noUi-handle:after{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}[disabled] .noUi-connect{background:#b8b8b8}[disabled].noUi-target,[disabled].noUi-handle,[disabled] .noUi-handle{cursor:not-allowed}.noUi-pips,.noUi-pips *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.noUi-pips{position:absolute;color:#999}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#ccc;font-size:10px}.noUi-marker{position:absolute;background:#ccc}.noUi-marker-sub{background:#aaa}.noUi-marker-large{background:#aaa}.noUi-pips-horizontal{padding:10px 0;height:80px;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate(-50%, 50%);transform:translate(-50%, 50%)}.noUi-rtl .noUi-value-horizontal{-webkit-transform:translate(50%, 50%);transform:translate(50%, 50%)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:2px;height:5px}.noUi-marker-horizontal.noUi-marker-sub{height:10px}.noUi-marker-horizontal.noUi-marker-large{height:15px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate(0, -50%);transform:translate(0, -50%);padding-left:25px}.noUi-rtl .noUi-value-vertical{-webkit-transform:translate(0, 50%);transform:translate(0, 50%)}.noUi-marker-vertical.noUi-marker{width:5px;height:2px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:15px}.noUi-tooltip{display:block;position:absolute;border:1px solid #d9d9d9;border-radius:3px;background:#fff;color:#000;padding:5px;text-align:center;white-space:nowrap}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%, 0);transform:translate(-50%, 0);left:50%;bottom:120%}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0, -50%);transform:translate(0, -50%);top:50%;right:120%}.noUi-horizontal .noUi-origin>.noUi-tooltip{-webkit-transform:translate(50%, 0);transform:translate(50%, 0);left:auto;bottom:10px}.noUi-vertical .noUi-origin>.noUi-tooltip{-webkit-transform:translate(0, -18px);transform:translate(0, -18px);top:auto;right:28px}:host{--_form-field-gap:var(--form-field-gap, var(--mod-form-field-gap, 0.25rem));--_form-label-color:var(--form-label-color, var(--mod-form-label-color, var(--ds-form-label-color-base)));--_form-label-family:var(--form-label-family, var(--mod-form-label-family, var(--ds-form-label-family)));--_form-label-weight:var(--form-label-weight, var(--mod-form-label-weight, var(--ds-form-label-weight)));--_form-label-line-height:var(--form-label-line-height, var(--mod-form-label-line-height, var(--ds-form-label-line-height)));--_form-label-size:var(--form-label-size, var(--mod-form-label-size, var(--ds-form-label-size-device)));--_form-description-color:var(--form-description-color, var(--mod-form-description-color, var(--ds-form-description-color-base)));--_form-description-family:var(--form-description-family, var(--mod-form-description-family, var(--ds-form-description-family)));--_form-description-weight:var(--form-description-weight, var(--mod-form-description-weight, var(--ds-form-description-weight)));--_form-description-line-height:var(--form-description-line-height, var(--mod-form-description-line-height, var(--ds-form-description-line-height)));--_form-description-size:var(--form-description-size, var(--mod-form-description-size, var(--ds-form-description-size-device)));--_input-slider-track-height:var(--input-slider-track-height, var(--mod-input-slider-track-height, 0.75rem));--_input-slider-track-radius:var(--input-slider-track-radius, var(--mod-input-slider-track-radius, var(--ds-alias-radius-rounded)));--_input-slider-track-color:var(--input-slider-track-color, var(--mod-input-slider-track-color, var(--ds-global-color-grey-2)));--_input-slider-connect-color:var(--input-slider-connect-color, var(--mod-input-slider-connect-color, var(--ds-global-color-primary-5)));--_input-slider-thumb-size:var(--input-slider-thumb-size, var(--mod-input-slider-thumb-size, 1.5rem));--_input-slider-thumb-radius:var(--input-slider-thumb-radius, var(--mod-input-slider-thumb-radius, var(--ds-alias-radius-rounded)));--_input-slider-thumb-color:var(--input-slider-thumb-color, var(--mod-input-slider-thumb-color, var(--ds-global-color-white)));--_input-slider-thumb-hover-color:var(--input-slider-thumb-hover-color, var(--mod-input-slider-thumb-hover-color, var(--ds-global-color-sky-1)));--_input-slider-thumb-active-color:var(--input-slider-thumb-active-color, var(--mod-input-slider-thumb-active-color, var(--ds-global-color-sky-1)));--_input-slider-thumb-border-color:var(--input-slider-thumb-border-color, var(--mod-input-slider-thumb-border-color, var(--ds-global-color-primary-5)));--_input-slider-thumb-border-color-hover:var(--input-slider-thumb-border-color-hover, var(--mod-input-slider-thumb-border-color-hover, var(--ds-global-color-sky-5)));--_input-slider-thumb-border-color-active:var(--input-slider-thumb-border-color-active, var(--mod-input-slider-thumb-border-color-active, var(--ds-global-color-primary-6)))}:host{position:relative;display:grid;gap:var(--_form-field-gap)}:host #container{-webkit-box-sizing:border-box;box-sizing:border-box;clear:both;display:-ms-flexbox;display:flex;width:100%;-ms-flex-align:center;align-items:center;min-height:3rem;gap:.25rem}:host :where(fieldset){margin:0;padding:0;border:none}:host :where(legend){padding:0;float:left;width:100%}:host label{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;overflow-wrap:break-word;text-wrap:balance;min-width:0;color:var(--_form-label-color);font-family:var(--_form-label-family);font-weight:var(--_form-label-weight);font-size:var(--_form-label-size);line-height:var(--_form-label-line-height)}:host #description{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:-ms-flexbox;display:flex;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;overflow-wrap:break-word;text-wrap:balance;min-width:0;gap:.25rem;min-height:1.125rem;color:var(--_form-description-color);font-family:var(--_form-description-family);font-weight:var(--_form-description-weight);font-size:var(--_form-description-size);line-height:var(--_form-description-line-height)}:host #description ds-icon{--icon-color:var(--_form-description-color)}:host #container{padding-inline:calc(var(--_input-slider-thumb-size)/2)}:host #slider{width:100%;cursor:pointer;height:var(--_input-slider-track-height);background:var(--_input-slider-track-color);border:none;border-radius:var(--_input-slider-track-radius);-webkit-box-shadow:none;box-shadow:none}:host .noUi-connects{border-radius:var(--_input-slider-track-radius)}:host .noUi-connect{background:var(--_input-slider-connect-color)}:host .noUi-handle{width:var(--_input-slider-thumb-size);height:var(--_input-slider-thumb-size);top:calc((var(--_input-slider-track-height) - var(--_input-slider-thumb-size))/2);right:calc(var(--_input-slider-thumb-size)/-2);background:var(--_input-slider-thumb-color);border:2px solid var(--_input-slider-thumb-border-color);border-radius:var(--_input-slider-thumb-radius);-webkit-box-shadow:#fff 0 0 0 2px;box-shadow:#fff 0 0 0 2px;cursor:-webkit-grab;cursor:grab}:host .noUi-handle::before,:host .noUi-handle::after{display:none}@media (hover: hover)and (pointer: fine){:host .noUi-handle:hover{background:var(--_input-slider-thumb-hover-color);border-color:var(--_input-slider-thumb-border-color-hover)}}:host .noUi-handle:active,:host .noUi-handle.noUi-active{background:var(--_input-slider-thumb-active-color);border-color:var(--_input-slider-thumb-border-color-active);cursor:-webkit-grabbing;cursor:grabbing}:host .noUi-handle:focus-visible{outline:none}@media (hover: hover)and (pointer: fine){:host .noUi-handle:focus-visible{-webkit-box-shadow:var(--ds-alias-interaction-focus-color-border) 0 0 0 2px,var(--ds-alias-interaction-focus-color-base) 0 0 0 5px !important;box-shadow:var(--ds-alias-interaction-focus-color-border) 0 0 0 2px,var(--ds-alias-interaction-focus-color-base) 0 0 0 5px !important}}:host .noUi-tooltip{background:var(--ds-global-color-primary-5);color:var(--ds-global-color-white);font-size:var(--ds-alias-font-size-small);font-weight:var(--ds-alias-text-weight-bold);font-family:var(--ds-alias-text-family-body);border-radius:var(--ds-alias-radius-rounded);line-height:1;padding:.4rem .4rem;bottom:130%;opacity:0;visibility:hidden;pointer-events:none;-webkit-transform:translate(-50%, 4px);transform:translate(-50%, 4px);-webkit-transition:opacity 120ms cubic-bezier(0.4, 0, 1, 1),visibility 0ms linear 120ms,-webkit-transform 120ms cubic-bezier(0.4, 0, 1, 1);transition:opacity 120ms cubic-bezier(0.4, 0, 1, 1),visibility 0ms linear 120ms,-webkit-transform 120ms cubic-bezier(0.4, 0, 1, 1);transition:opacity 120ms cubic-bezier(0.4, 0, 1, 1),transform 120ms cubic-bezier(0.4, 0, 1, 1),visibility 0ms linear 120ms;transition:opacity 120ms cubic-bezier(0.4, 0, 1, 1),transform 120ms cubic-bezier(0.4, 0, 1, 1),visibility 0ms linear 120ms,-webkit-transform 120ms cubic-bezier(0.4, 0, 1, 1);will-change:opacity,transform}:host .noUi-handle.noUi-active .noUi-tooltip,:host .noUi-handle:hover .noUi-tooltip,:host .noUi-handle:active .noUi-tooltip,:host .noUi-handle:focus-visible .noUi-tooltip{opacity:1;visibility:visible;pointer-events:auto;-webkit-transform:translate(-50%, 0);transform:translate(-50%, 0);-webkit-transition:opacity 200ms cubic-bezier(0, 0, 0.2, 1),visibility 0ms linear 0ms,-webkit-transform 200ms cubic-bezier(0, 0, 0.2, 1);transition:opacity 200ms cubic-bezier(0, 0, 0.2, 1),visibility 0ms linear 0ms,-webkit-transform 200ms cubic-bezier(0, 0, 0.2, 1);transition:opacity 200ms cubic-bezier(0, 0, 0.2, 1),transform 200ms cubic-bezier(0, 0, 0.2, 1),visibility 0ms linear 0ms;transition:opacity 200ms cubic-bezier(0, 0, 0.2, 1),transform 200ms cubic-bezier(0, 0, 0.2, 1),visibility 0ms linear 0ms,-webkit-transform 200ms cubic-bezier(0, 0, 0.2, 1)}@media (prefers-reduced-motion: reduce){:host .noUi-tooltip{-webkit-transition:none !important;transition:none !important}}:host(.is-danger){--mod-form-description-color:var(--ds-form-description-color-danger);--mod-input-slider-connect-color:var(--ds-form-container-color-danger-border);--mod-input-slider-thumb-border-color:var(--ds-form-container-color-danger-border)}:host(.is-success){--mod-form-description-color:var(--ds-form-description-color-success);--mod-input-slider-connect-color:var(--ds-form-container-color-success-border);--mod-input-slider-thumb-border-color:var(--ds-form-container-color-success-border)}:host(.is-warning){--mod-form-description-color:var(--ds-form-description-color-warning);--mod-input-slider-connect-color:var(--ds-form-container-color-warning-border);--mod-input-slider-thumb-border-color:var(--ds-form-container-color-warning-border)}:host(.is-brand-yellow){--mod-input-slider-track-color:var(--ds-global-color-yellow-2);--mod-input-slider-connect-color:var(--ds-global-color-yellow-4)}:host(.is-brand-purple){--mod-input-slider-track-color:var(--ds-global-color-purple-2);--mod-input-slider-connect-color:var(--ds-global-color-purple-4)}:host(.is-brand-red){--mod-input-slider-track-color:var(--ds-global-color-red-2);--mod-input-slider-connect-color:var(--ds-global-color-red-4)}:host(.is-brand-green){--mod-input-slider-track-color:var(--ds-global-color-green-2);--mod-input-slider-connect-color:var(--ds-global-color-green-4)}:host(.is-disabled),:host(.is-disabled) #label,:host(.is-disabled) #description,:host(.is-disabled) #slider{pointer-events:none;cursor:default}:host(.is-disabled){--mod-form-label-color:var(--ds-form-label-color-disabled);--mod-form-description-color:var(--ds-form-description-color-disabled);--mod-input-slider-track-color:var(--ds-global-color-grey-1);--mod-input-slider-connect-color:var(--ds-global-color-grey-3);--mod-input-slider-thumb-color:var(--ds-global-color-grey-3);--mod-input-slider-thumb-border-color:var(--ds-global-color-grey-3)}:host(.is-disabled) .noUi-handle{cursor:default}`;
2504
+
2505
+ const InputSlider = class {
2506
+ constructor(hostRef) {
2507
+ index.registerInstance(this, hostRef);
2508
+ this.dsInput = index.createEvent(this, "dsInput");
2509
+ this.dsFocus = index.createEvent(this, "dsFocus");
2510
+ this.dsBlur = index.createEvent(this, "dsBlur");
2511
+ this.dsClick = index.createEvent(this, "dsClick");
2512
+ this.dsChange = index.createEvent(this, "dsChange");
2513
+ if (hostRef.$hostElement$["s-ei"]) {
2514
+ this.internals = hostRef.$hostElement$["s-ei"];
2515
+ }
2516
+ else {
2517
+ this.internals = hostRef.$hostElement$.attachInternals();
2518
+ hostRef.$hostElement$["s-ei"] = this.internals;
2519
+ }
2520
+ this.inheritedAttributes = {};
2521
+ this.initialValue = NaN;
2522
+ this.inputSliderId = `ds-input-slider-${InputSliderIds++}`;
2523
+ this.focused = false;
2524
+ this.language = index.defaultConfig.language;
2525
+ this.region = index.defaultConfig.region;
2526
+ /**
2527
+ * PUBLIC PROPERTY API
2528
+ * ------------------------------------------------------
2529
+ */
2530
+ /**
2531
+ * The value of the slider. Unlike a text input, a slider can never be
2532
+ * empty; when unset it defaults to `min`. Internally starts as `NaN` (this
2533
+ * codebase's established "empty number" sentinel, see `isValueEmpty`) until
2534
+ * `connectedCallback` resolves it — never actually rendered or emitted.
2535
+ */
2536
+ this.value = NaN;
2537
+ /**
2538
+ * The name of the control, which is submitted with the form data.
2539
+ */
2540
+ this.name = this.inputSliderId;
2541
+ /**
2542
+ * The label of the slider, which is displayed above the control.
2543
+ */
2544
+ this.label = '';
2545
+ /**
2546
+ * The description of the slider, which is displayed below the control.
2547
+ */
2548
+ this.description = '';
2549
+ /**
2550
+ * Defines the color of the slider. The default value is `primary`.
2551
+ */
2552
+ this.color = 'primary';
2553
+ /**
2554
+ * Recolors the connect (the filled progress track) with a brand color instead of the default
2555
+ * grey/primary style. Left of the handle uses the darker `-4` shade, right of it the lighter
2556
+ * `-2` shade. Empty (default) keeps the current grey/primary look.
2557
+ */
2558
+ this.brandColor = '';
2559
+ /**
2560
+ * If `true` the component gets an invalid style.
2561
+ */
2562
+ this.invalid = false;
2563
+ /**
2564
+ * The text to display when the slider is in an invalid state.
2565
+ */
2566
+ this.invalidText = '';
2567
+ /**
2568
+ * The minimum value of the slider.
2569
+ */
2570
+ this.min = 0;
2571
+ /**
2572
+ * The maximum value of the slider.
2573
+ */
2574
+ this.max = 100;
2575
+ /**
2576
+ * The granularity the value must adhere to, as a string so `"any"` (free,
2577
+ * continuous dragging with no step snapping) can be expressed alongside
2578
+ * numeric step sizes.
2579
+ */
2580
+ this.step = '1';
2581
+ /**
2582
+ * Set the amount of time, in milliseconds, to wait to trigger the `dsChange` event after each keystroke. This also impacts form bindings such as `ngModel` or `v-model`.
2583
+ */
2584
+ this.debounce = 0;
2585
+ /**
2586
+ * If `true`, the element is not mutable, focusable, or even submitted with the form. The user can neither edit nor focus on the control, nor its form control descendants.
2587
+ */
2588
+ this.disabled = false;
2589
+ /**
2590
+ * If `true` the element can not be mutated. noUiSlider has no native concept of
2591
+ * `readonly`, so this is treated as equivalent to `disabled`.
2592
+ */
2593
+ this.readonly = false;
2594
+ /**
2595
+ * If `true`, the user must fill in a value before submitting a form.
2596
+ */
2597
+ this.required = true;
2598
+ /**
2599
+ * If `true`, in Angular reactive forms the control will not be set invalid
2600
+ */
2601
+ this.autoInvalidOff = false;
2602
+ /**
2603
+ * EVENT HANDLERS
2604
+ * ------------------------------------------------------
2605
+ */
2606
+ this.handleFocus = (ev) => {
2607
+ this.focused = true;
2608
+ if (!this.disabled && !this.readonly) {
2609
+ this.dsFocus.emit(ev);
2610
+ }
2611
+ };
2612
+ this.handleBlur = (ev) => {
2613
+ this.focused = false;
2614
+ if (!this.disabled && !this.readonly) {
2615
+ this.dsBlur.emit(ev);
2616
+ }
2617
+ };
2618
+ this.handleClick = (ev) => {
2619
+ if (!this.disabled && !this.readonly) {
2620
+ this.dsClick.emit(ev);
2621
+ }
2622
+ };
2623
+ }
2624
+ createLogger(log) {
2625
+ this.log = log;
2626
+ }
2627
+ valueChanged(newVal) {
2628
+ var _a;
2629
+ (_a = this.picker) === null || _a === void 0 ? void 0 : _a.setValue(newVal);
2630
+ this.syncFormValue(newVal);
2631
+ }
2632
+ invalidChanged() {
2633
+ var _a;
2634
+ (_a = this.picker) === null || _a === void 0 ? void 0 : _a.setInvalid(this.invalid);
2635
+ }
2636
+ minChanged() {
2637
+ var _a;
2638
+ if (!isNaN$1.isNaN(this.value)) {
2639
+ this.value = clampValue(this.value, this.min, this.max);
2640
+ }
2641
+ (_a = this.picker) === null || _a === void 0 ? void 0 : _a.updateRange(this.min, this.max, this.step);
2642
+ }
2643
+ stepChanged() {
2644
+ var _a;
2645
+ (_a = this.picker) === null || _a === void 0 ? void 0 : _a.updateRange(this.min, this.max, this.step);
2646
+ }
2647
+ debounceChanged() {
2648
+ this.dsChange = index.debounceEvent(this.dsChange, this.debounce);
2649
+ }
2650
+ disabledChanged() {
2651
+ this.syncDisabledState();
2652
+ }
2653
+ readonlyChanged() {
2654
+ this.syncDisabledState();
2655
+ }
2656
+ /**
2657
+ * LIFECYCLE
2658
+ * ------------------------------------------------------
2659
+ */
2660
+ connectedCallback() {
2661
+ this.debounceChanged();
2662
+ this.value = clampValue(resolveInitialValue(this.value, this.min), this.min, this.max);
2663
+ this.initialValue = this.value;
2664
+ this.syncFormValue(this.value);
2665
+ }
2666
+ componentWillLoad() {
2667
+ this.inheritedAttributes = attributes.inheritAttributes(this.el, ['aria-label', 'tabindex', 'title']);
2668
+ }
2669
+ componentDidLoad() {
2670
+ var _a, _b;
2671
+ if (!this.sliderEl)
2672
+ return;
2673
+ this.picker = new InputSliderPickerController({
2674
+ targetEl: this.sliderEl,
2675
+ labelId: 'label',
2676
+ min: this.min,
2677
+ max: this.max,
2678
+ step: this.step,
2679
+ value: this.value,
2680
+ disabled: this.disabled || this.readonly,
2681
+ invalid: this.invalid,
2682
+ onInput: value => {
2683
+ this.dsInput.emit(value);
2684
+ },
2685
+ onChange: value => {
2686
+ this.setValue(value);
2687
+ },
2688
+ });
2689
+ (_a = this.picker.handleEl) === null || _a === void 0 ? void 0 : _a.addEventListener('focus', this.handleFocus);
2690
+ (_b = this.picker.handleEl) === null || _b === void 0 ? void 0 : _b.addEventListener('blur', this.handleBlur);
2691
+ }
2692
+ disconnectedCallback() {
2693
+ var _a;
2694
+ (_a = this.picker) === null || _a === void 0 ? void 0 : _a.destroy();
2695
+ this.picker = undefined;
2696
+ }
2697
+ /**
2698
+ * PUBLIC LISTENERS
2699
+ * ------------------------------------------------------
2700
+ */
2701
+ listenToClick(ev) {
2702
+ if ((this.disabled || this.readonly) && ev.target === this.el) {
2703
+ ev.preventDefault();
2704
+ ev.stopPropagation();
2705
+ }
2706
+ }
2707
+ listenToReset(ev) {
2708
+ const form = ev.target;
2709
+ if (form === null || form === void 0 ? void 0 : form.contains(this.el)) {
2710
+ this.value = this.initialValue;
2711
+ }
2712
+ }
2713
+ /**
2714
+ * @internal define config for the component
2715
+ */
2716
+ async configChanged(state) {
2717
+ this.language = state.language;
2718
+ this.region = state.region;
2719
+ }
2720
+ /**
2721
+ * PUBLIC METHODS
2722
+ * ------------------------------------------------------
2723
+ */
2724
+ /**
2725
+ * Sets focus on `ds-input-slider`'s slider handle. Use this method instead of the global
2726
+ * `element.focus()`.
2727
+ */
2728
+ async setFocus() {
2729
+ var _a;
2730
+ (_a = this.picker) === null || _a === void 0 ? void 0 : _a.focus();
2731
+ }
2732
+ /**
2733
+ * Sets blur on `ds-input-slider`'s slider handle. Use this method instead of the global
2734
+ * `element.blur()`.
2735
+ * @internal
2736
+ */
2737
+ async setBlur() {
2738
+ var _a;
2739
+ (_a = this.picker) === null || _a === void 0 ? void 0 : _a.blur();
2740
+ }
2741
+ /**
2742
+ * Returns the noUiSlider handle element used under the hood.
2743
+ */
2744
+ async getInputElement() {
2745
+ var _a;
2746
+ return (_a = this.picker) === null || _a === void 0 ? void 0 : _a.handleEl;
2747
+ }
2748
+ /**
2749
+ * PRIVATE METHODS
2750
+ * ------------------------------------------------------
2751
+ */
2752
+ setValue(newValue) {
2753
+ if (this.value === newValue)
2754
+ return;
2755
+ this.value = newValue;
2756
+ this.dsChange.emit(newValue);
2757
+ }
2758
+ syncFormValue(value) {
2759
+ this.internals.setFormValue(String(value));
2760
+ }
2761
+ syncDisabledState() {
2762
+ var _a;
2763
+ (_a = this.picker) === null || _a === void 0 ? void 0 : _a.setDisabled(this.disabled || this.readonly);
2764
+ }
2765
+ /**
2766
+ * RENDER
2767
+ * ------------------------------------------------------
2768
+ */
2769
+ render() {
2770
+ return (index.h(field_util.Field, { key: '673117fa1520455f38ee39c6f2218468e6ca8150', disabled: this.disabled || this.readonly, color: this.color, invalid: this.invalid, label: this.label, description: this.description, invalidText: this.invalidText, required: this.required, language: this.language, cssClasses: {
2771
+ 'is-brand-yellow': hasValue.hasValue(this.brandColor) && this.brandColor === 'yellow',
2772
+ 'is-brand-purple': hasValue.hasValue(this.brandColor) && this.brandColor === 'purple',
2773
+ 'is-brand-red': hasValue.hasValue(this.brandColor) && this.brandColor === 'red',
2774
+ 'is-brand-green': hasValue.hasValue(this.brandColor) && this.brandColor === 'green',
2775
+ } }, index.h("div", Object.assign({ key: 'b760944d8141876484054f1454b453e087bc7eda', id: "slider", part: "slider", ref: el => (this.sliderEl = el), onClick: this.handleClick }, this.inheritedAttributes))));
2776
+ }
2777
+ static get formAssociated() { return true; }
2778
+ get el() { return index.getElement(this); }
2779
+ static get watchers() { return {
2780
+ "value": [{
2781
+ "valueChanged": 0
2782
+ }],
2783
+ "invalid": [{
2784
+ "invalidChanged": 0
2785
+ }],
2786
+ "min": [{
2787
+ "minChanged": 0
2788
+ }],
2789
+ "max": [{
2790
+ "minChanged": 0
2791
+ }],
2792
+ "step": [{
2793
+ "stepChanged": 0
2794
+ }],
2795
+ "debounce": [{
2796
+ "debounceChanged": 0
2797
+ }],
2798
+ "disabled": [{
2799
+ "disabledChanged": 0
2800
+ }],
2801
+ "readonly": [{
2802
+ "readonlyChanged": 0
2803
+ }]
2804
+ }; }
2805
+ };
2806
+ tslib_es6.__decorate([
2807
+ tslib_es6.Logger('input-slider'),
2808
+ tslib_es6.__metadata("design:type", Function),
2809
+ tslib_es6.__metadata("design:paramtypes", [Function]),
2810
+ tslib_es6.__metadata("design:returntype", void 0)
2811
+ ], InputSlider.prototype, "createLogger", null);
2812
+ tslib_es6.__decorate([
2813
+ type.Type('number'),
2814
+ tslib_es6.__metadata("design:type", Number)
2815
+ ], InputSlider.prototype, "value", void 0);
2816
+ tslib_es6.__decorate([
2817
+ type.Type('string'),
2818
+ tslib_es6.__metadata("design:type", String)
2819
+ ], InputSlider.prototype, "name", void 0);
2820
+ tslib_es6.__decorate([
2821
+ type.Type('string'),
2822
+ tslib_es6.__metadata("design:type", String)
2823
+ ], InputSlider.prototype, "label", void 0);
2824
+ tslib_es6.__decorate([
2825
+ type.Type('string'),
2826
+ tslib_es6.__metadata("design:type", String)
2827
+ ], InputSlider.prototype, "description", void 0);
2828
+ tslib_es6.__decorate([
2829
+ oneOf.OneOf(input_interfaces.INPUT_COLORS),
2830
+ tslib_es6.__metadata("design:type", String)
2831
+ ], InputSlider.prototype, "color", void 0);
2832
+ tslib_es6.__decorate([
2833
+ oneOf.OneOf(INPUT_SLIDER_BRAND_COLORS),
2834
+ tslib_es6.__metadata("design:type", String)
2835
+ ], InputSlider.prototype, "brandColor", void 0);
2836
+ tslib_es6.__decorate([
2837
+ type.Type('boolean'),
2838
+ tslib_es6.__metadata("design:type", Boolean)
2839
+ ], InputSlider.prototype, "invalid", void 0);
2840
+ tslib_es6.__decorate([
2841
+ type.Type('string'),
2842
+ tslib_es6.__metadata("design:type", String)
2843
+ ], InputSlider.prototype, "invalidText", void 0);
2844
+ tslib_es6.__decorate([
2845
+ type.Type('number'),
2846
+ tslib_es6.__metadata("design:type", Number)
2847
+ ], InputSlider.prototype, "min", void 0);
2848
+ tslib_es6.__decorate([
2849
+ type.Type('number'),
2850
+ tslib_es6.__metadata("design:type", Number)
2851
+ ], InputSlider.prototype, "max", void 0);
2852
+ tslib_es6.__decorate([
2853
+ type.Type('string'),
2854
+ tslib_es6.__metadata("design:type", String)
2855
+ ], InputSlider.prototype, "step", void 0);
2856
+ tslib_es6.__decorate([
2857
+ type.Type('number'),
2858
+ tslib_es6.__metadata("design:type", Number)
2859
+ ], InputSlider.prototype, "debounce", void 0);
2860
+ tslib_es6.__decorate([
2861
+ type.Type('boolean'),
2862
+ tslib_es6.__metadata("design:type", Boolean)
2863
+ ], InputSlider.prototype, "disabled", void 0);
2864
+ tslib_es6.__decorate([
2865
+ type.Type('boolean'),
2866
+ tslib_es6.__metadata("design:type", Boolean)
2867
+ ], InputSlider.prototype, "readonly", void 0);
2868
+ tslib_es6.__decorate([
2869
+ type.Type('boolean'),
2870
+ tslib_es6.__metadata("design:type", Boolean)
2871
+ ], InputSlider.prototype, "required", void 0);
2872
+ tslib_es6.__decorate([
2873
+ type.Type('boolean'),
2874
+ tslib_es6.__metadata("design:type", Boolean)
2875
+ ], InputSlider.prototype, "autoInvalidOff", void 0);
2876
+ tslib_es6.__decorate([
2877
+ config_decorator.ListenToConfig(),
2878
+ tslib_es6.__metadata("design:type", Function),
2879
+ tslib_es6.__metadata("design:paramtypes", [Object]),
2880
+ tslib_es6.__metadata("design:returntype", Promise)
2881
+ ], InputSlider.prototype, "configChanged", null);
2882
+ let InputSliderIds = 0;
2883
+ InputSlider.style = inputSliderHostCss();
2884
+
2885
+ exports.ds_input_slider = InputSlider;