@elliemae/ds-slider 2.3.0-next.0 → 3.0.0-alpha.0

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 (78) hide show
  1. package/dist/cjs/DSSlider.js +48 -0
  2. package/dist/cjs/DSSlider.js.map +7 -0
  3. package/dist/cjs/components/SliderImp.js +195 -0
  4. package/dist/cjs/components/SliderImp.js.map +7 -0
  5. package/dist/cjs/components/Thumb.js +72 -0
  6. package/dist/cjs/components/Thumb.js.map +7 -0
  7. package/dist/cjs/components/TickMarks.js +87 -0
  8. package/dist/cjs/components/TickMarks.js.map +7 -0
  9. package/dist/cjs/components/TickMarksValues.js +64 -0
  10. package/dist/cjs/components/TickMarksValues.js.map +7 -0
  11. package/dist/cjs/components/Track.js +78 -0
  12. package/dist/cjs/components/Track.js.map +7 -0
  13. package/dist/cjs/components/context.js +36 -0
  14. package/dist/cjs/components/context.js.map +7 -0
  15. package/dist/cjs/components/styled.js +96 -0
  16. package/dist/cjs/components/styled.js.map +7 -0
  17. package/dist/cjs/components/utils.js +59 -0
  18. package/dist/cjs/components/utils.js.map +7 -0
  19. package/dist/cjs/index.js +36 -0
  20. package/dist/cjs/index.js.map +7 -0
  21. package/dist/cjs/prop-types.js +67 -0
  22. package/dist/cjs/prop-types.js.map +7 -0
  23. package/dist/esm/DSSlider.js +19 -0
  24. package/dist/esm/DSSlider.js.map +7 -0
  25. package/dist/esm/components/SliderImp.js +173 -0
  26. package/dist/esm/components/SliderImp.js.map +7 -0
  27. package/dist/esm/components/Thumb.js +43 -0
  28. package/dist/esm/components/Thumb.js.map +7 -0
  29. package/dist/esm/components/TickMarks.js +58 -0
  30. package/dist/esm/components/TickMarks.js.map +7 -0
  31. package/dist/esm/components/TickMarksValues.js +35 -0
  32. package/dist/esm/components/TickMarksValues.js.map +7 -0
  33. package/dist/esm/components/Track.js +49 -0
  34. package/dist/esm/components/Track.js.map +7 -0
  35. package/dist/esm/components/context.js +7 -0
  36. package/dist/esm/components/context.js.map +7 -0
  37. package/dist/esm/components/styled.js +67 -0
  38. package/dist/esm/components/styled.js.map +7 -0
  39. package/dist/esm/components/utils.js +30 -0
  40. package/dist/esm/components/utils.js.map +7 -0
  41. package/dist/esm/index.js +7 -0
  42. package/dist/esm/index.js.map +7 -0
  43. package/dist/esm/prop-types.js +38 -0
  44. package/dist/esm/prop-types.js.map +7 -0
  45. package/{types → dist/types}/DSSlider.d.ts +0 -0
  46. package/{types → dist/types}/components/SliderImp.d.ts +0 -0
  47. package/{types → dist/types}/components/Thumb.d.ts +0 -0
  48. package/{types → dist/types}/components/TickMarks.d.ts +0 -0
  49. package/{types → dist/types}/components/TickMarksValues.d.ts +0 -0
  50. package/{types → dist/types}/components/Track.d.ts +0 -0
  51. package/{types → dist/types}/components/context.d.ts +0 -0
  52. package/{types → dist/types}/components/styled.d.ts +0 -0
  53. package/{types → dist/types}/components/utils.d.ts +0 -0
  54. package/{types → dist/types}/index.d.ts +0 -0
  55. package/{types → dist/types}/prop-types.d.ts +0 -0
  56. package/package.json +48 -40
  57. package/cjs/DSSlider.js +0 -33
  58. package/cjs/components/SliderImp.js +0 -199
  59. package/cjs/components/Thumb.js +0 -71
  60. package/cjs/components/TickMarks.js +0 -46
  61. package/cjs/components/TickMarksValues.js +0 -43
  62. package/cjs/components/Track.js +0 -67
  63. package/cjs/components/context.js +0 -13
  64. package/cjs/components/styled.js +0 -61
  65. package/cjs/components/utils.js +0 -49
  66. package/cjs/index.js +0 -11
  67. package/cjs/prop-types.js +0 -64
  68. package/esm/DSSlider.js +0 -23
  69. package/esm/components/SliderImp.js +0 -192
  70. package/esm/components/Thumb.js +0 -64
  71. package/esm/components/TickMarks.js +0 -39
  72. package/esm/components/TickMarksValues.js +0 -36
  73. package/esm/components/Track.js +0 -59
  74. package/esm/components/context.js +0 -5
  75. package/esm/components/styled.js +0 -47
  76. package/esm/components/utils.js +0 -44
  77. package/esm/index.js +0 -1
  78. package/esm/prop-types.js +0 -59
@@ -0,0 +1,36 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var context_exports = {};
29
+ __export(context_exports, {
30
+ SliderContext: () => SliderContext
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_react = __toESM(require("react"));
34
+ const SliderContext = import_react.default.createContext();
35
+ module.exports = __toCommonJS(context_exports);
36
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/context.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React from 'react';\n\nexport const SliderContext = React.createContext();\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAEX,MAAM,gBAAgB,qBAAM;",
6
+ "names": []
7
+ }
@@ -0,0 +1,96 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var styled_exports = {};
29
+ __export(styled_exports, {
30
+ LabelText: () => LabelText,
31
+ LabelWrapper: () => LabelWrapper,
32
+ StyledRangeWrapper: () => StyledRangeWrapper,
33
+ ThumbStyled: () => ThumbStyled,
34
+ TooltipArrow: () => TooltipArrow,
35
+ TooltipContainerStyled: () => TooltipContainerStyled,
36
+ ValueText: () => ValueText
37
+ });
38
+ var React = __toESM(require("react"));
39
+ var import_styled_components = __toESM(require("styled-components"));
40
+ var import_ds_system = require("@elliemae/ds-system");
41
+ var import_ds_tooltip = require("@elliemae/ds-tooltip");
42
+ const ThumbStyled = import_styled_components.default.div`
43
+ height: 20px;
44
+ width: 20px;
45
+ background-color: ${(props) => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral["000"]};
46
+ border-radius: 10px;
47
+ border: 1px solid ${(props) => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral[400]};
48
+
49
+ :focus {
50
+ border: 1px solid ${(props) => props.theme.colors.brand[600]};
51
+ outline: unset;
52
+ }
53
+
54
+ :hover {
55
+ background-color: ${({ disabled, theme }) => disabled ? theme.colors.neutral[100] : theme.colors.brand[200]};
56
+ }
57
+ `;
58
+ const TooltipContainerStyled = (0, import_styled_components.default)(import_ds_tooltip.TooltipContainer)`
59
+ position: relative;
60
+ display: flex;
61
+ align-items: center;
62
+ flex-direction: column;
63
+ top: -35px;
64
+ width: max-content;
65
+ left: 50%;
66
+ transform: translateX(-50%);
67
+ visibility: ${({ isDragged, isHovered }) => isDragged || isHovered ? "visible" : "hidden"};
68
+ `;
69
+ const TooltipArrow = import_styled_components.default.div`
70
+ position: absolute;
71
+ width: 0;
72
+ height: 0;
73
+ top: 20px;
74
+ border-left: calc(${(props) => (0, import_ds_system.__UNSAFE_SPACE_TO_DIMSUM)(props.theme.space.xxs)} * 2.5) solid transparent;
75
+ border-right: calc(${(props) => (0, import_ds_system.__UNSAFE_SPACE_TO_DIMSUM)(props.theme.space.xxs)} * 2.5) solid transparent;
76
+
77
+ border-top: calc(${(props) => (0, import_ds_system.__UNSAFE_SPACE_TO_DIMSUM)(props.theme.space.xxs)} * 2.5) solid
78
+ ${(props) => props.theme.colors.neutral[0]};
79
+ `;
80
+ const LabelWrapper = import_styled_components.default.div`
81
+ margin-bottom: ${(props) => props.theme.space.xxs};
82
+ max-width: 100%;
83
+ width: ${(props) => `${props.width || 0}px`};
84
+ `;
85
+ const LabelText = import_styled_components.default.span`
86
+ color: ${(props) => props.theme.colors.neutral[600]};
87
+ `;
88
+ const ValueText = import_styled_components.default.span`
89
+ color: ${({ disabled, theme }) => theme.colors.neutral[disabled ? 500 : 800]};
90
+ `;
91
+ const StyledRangeWrapper = import_styled_components.default.div`
92
+ min-height: 28px;
93
+ margin: 0 10px;
94
+ `;
95
+ module.exports = __toCommonJS(styled_exports);
96
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/styled.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable indent */\nimport styled from 'styled-components';\nimport { __UNSAFE_SPACE_TO_DIMSUM } from '@elliemae/ds-system';\nimport { TooltipContainer } from '@elliemae/ds-tooltip';\n\nexport const ThumbStyled = styled.div`\n height: 20px;\n width: 20px;\n background-color: ${(props) =>\n props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral['000']};\n border-radius: 10px;\n border: 1px solid ${(props) => (props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral[400])};\n\n :focus {\n border: 1px solid ${(props) => props.theme.colors.brand[600]};\n outline: unset;\n }\n\n :hover {\n background-color: ${({ disabled, theme }) => (disabled ? theme.colors.neutral[100] : theme.colors.brand[200])};\n }\n`;\n\nexport const TooltipContainerStyled = styled(TooltipContainer)`\n position: relative;\n display: flex;\n align-items: center;\n flex-direction: column;\n top: -35px;\n width: max-content;\n left: 50%;\n transform: translateX(-50%);\n visibility: ${({ isDragged, isHovered }) => (isDragged || isHovered ? 'visible' : 'hidden')};\n`;\n// TODO: didn't work with DSTooltip, see how to improve\nexport const TooltipArrow = styled.div`\n position: absolute;\n width: 0;\n height: 0;\n top: 20px;\n border-left: calc(${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)} * 2.5) solid transparent;\n border-right: calc(${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)} * 2.5) solid transparent;\n\n border-top: calc(${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)} * 2.5) solid\n ${(props) => props.theme.colors.neutral[0]};\n`;\n\nexport const LabelWrapper = styled.div`\n margin-bottom: ${(props) => props.theme.space.xxs};\n max-width: 100%;\n width: ${(props) => `${props.width || 0}px`};\n`;\n\nexport const LabelText = styled.span`\n color: ${(props) => props.theme.colors.neutral[600]};\n`;\n\nexport const ValueText = styled.span`\n color: ${({ disabled, theme }) => theme.colors.neutral[disabled ? 500 : 800]};\n`;\n\nexport const StyledRangeWrapper = styled.div`\n min-height: 28px;\n margin: 0 10px;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,+BAAmB;AACnB,uBAAyC;AACzC,wBAAiC;AAE1B,MAAM,cAAc,iCAAO;AAAA;AAAA;AAAA,sBAGZ,CAAC,UACnB,MAAM,WAAW,MAAM,MAAM,OAAO,QAAQ,OAAO,MAAM,MAAM,OAAO,QAAQ;AAAA;AAAA,sBAE5D,CAAC,UAAW,MAAM,WAAW,MAAM,MAAM,OAAO,QAAQ,OAAO,MAAM,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA,wBAGxF,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,wBAKpC,CAAC,EAAE,UAAU,YAAa,WAAW,MAAM,OAAO,QAAQ,OAAO,MAAM,OAAO,MAAM;AAAA;AAAA;AAIrG,MAAM,yBAAyB,sCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAS7B,CAAC,EAAE,WAAW,gBAAiB,aAAa,YAAY,YAAY;AAAA;AAG7E,MAAM,eAAe,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKb,CAAC,UAAU,+CAAyB,MAAM,MAAM,MAAM;AAAA,uBACrD,CAAC,UAAU,+CAAyB,MAAM,MAAM,MAAM;AAAA;AAAA,qBAExD,CAAC,UAAU,+CAAyB,MAAM,MAAM,MAAM;AAAA,MACrE,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ;AAAA;AAGrC,MAAM,eAAe,iCAAO;AAAA,mBAChB,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA,WAErC,CAAC,UAAU,GAAG,MAAM,SAAS;AAAA;AAGjC,MAAM,YAAY,iCAAO;AAAA,WACrB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ;AAAA;AAG1C,MAAM,YAAY,iCAAO;AAAA,WACrB,CAAC,EAAE,UAAU,YAAY,MAAM,OAAO,QAAQ,WAAW,MAAM;AAAA;AAGnE,MAAM,qBAAqB,iCAAO;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,59 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var utils_exports = {};
29
+ __export(utils_exports, {
30
+ conformedLabel: () => conformedLabel,
31
+ conformedThumbLabel: () => conformedThumbLabel
32
+ });
33
+ var React = __toESM(require("react"));
34
+ var import_ds_utilities = require("@elliemae/ds-utilities");
35
+ const conformedLabel = (rangeValues, label = "", labelWithValue = false, withTwoHandles = false, customTickMarksValues = [], step = 1, minValue = 0) => {
36
+ const msg = label.trim();
37
+ let value = "";
38
+ if (!(0, import_ds_utilities.isEmpty)(customTickMarksValues) && labelWithValue && label) {
39
+ const firstValue = customTickMarksValues[(rangeValues[0] - minValue) / step];
40
+ const secondValue = customTickMarksValues[(rangeValues[1] - minValue) / step];
41
+ value = `${firstValue || rangeValues[0].toFixed(1)} ${withTwoHandles ? `, ${secondValue || rangeValues[1].toFixed(1)}` : ""} `;
42
+ } else if (labelWithValue && label) {
43
+ value = `${rangeValues[0].toFixed(1)} ${withTwoHandles ? `, ${rangeValues[1]?.toFixed(1)}` : ""} `;
44
+ }
45
+ value = value.trim();
46
+ return [msg, value];
47
+ };
48
+ const conformedThumbLabel = (rangeValues, customTickMarksValues = [], index = 0, step = 1, minValue = 0) => {
49
+ let msg = `Value: `;
50
+ if (!(0, import_ds_utilities.isEmpty)(customTickMarksValues)) {
51
+ const foundValue = customTickMarksValues[(rangeValues[index] - minValue) / step];
52
+ msg += `${foundValue || rangeValues[index].toFixed(1)}`;
53
+ } else {
54
+ msg += `${rangeValues[index].toFixed(1)}`;
55
+ }
56
+ return msg;
57
+ };
58
+ module.exports = __toCommonJS(utils_exports);
59
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/utils.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable max-params */\nimport { isEmpty } from '@elliemae/ds-utilities';\n\nexport const conformedLabel = (\n rangeValues,\n label = '',\n labelWithValue = false,\n withTwoHandles = false,\n customTickMarksValues = [],\n step = 1,\n minValue = 0,\n) => {\n const msg = label.trim();\n let value = '';\n if (!isEmpty(customTickMarksValues) && labelWithValue && label) {\n const firstValue =\n customTickMarksValues[(rangeValues[0] - minValue) / step];\n const secondValue =\n customTickMarksValues[(rangeValues[1] - minValue) / step];\n value = `${firstValue || rangeValues[0].toFixed(1)} ${\n withTwoHandles ? `, ${secondValue || rangeValues[1].toFixed(1)}` : ''\n } `;\n } else if (labelWithValue && label) {\n value = `${rangeValues[0].toFixed(1)} ${\n withTwoHandles ? `, ${rangeValues[1]?.toFixed(1)}` : ''\n } `;\n }\n value = value.trim();\n\n return [msg, value];\n};\n\nexport const conformedThumbLabel = (\n rangeValues,\n customTickMarksValues = [],\n index = 0,\n step = 1,\n minValue = 0,\n) => {\n let msg = `Value: `;\n if (!isEmpty(customTickMarksValues)) {\n const foundValue =\n customTickMarksValues[(rangeValues[index] - minValue) / step];\n msg += `${foundValue || rangeValues[index].toFixed(1)}`;\n } else {\n msg += `${rangeValues[index].toFixed(1)}`;\n }\n\n return msg;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,0BAAwB;AAEjB,MAAM,iBAAiB,CAC5B,aACA,QAAQ,IACR,iBAAiB,OACjB,iBAAiB,OACjB,wBAAwB,IACxB,OAAO,GACP,WAAW,MACR;AACH,QAAM,MAAM,MAAM;AAClB,MAAI,QAAQ;AACZ,MAAI,CAAC,iCAAQ,0BAA0B,kBAAkB,OAAO;AAC9D,UAAM,aACJ,sBAAuB,aAAY,KAAK,YAAY;AACtD,UAAM,cACJ,sBAAuB,aAAY,KAAK,YAAY;AACtD,YAAQ,GAAG,cAAc,YAAY,GAAG,QAAQ,MAC9C,iBAAiB,KAAK,eAAe,YAAY,GAAG,QAAQ,OAAO;AAAA,aAE5D,kBAAkB,OAAO;AAClC,YAAQ,GAAG,YAAY,GAAG,QAAQ,MAChC,iBAAiB,KAAK,YAAY,IAAI,QAAQ,OAAO;AAAA;AAGzD,UAAQ,MAAM;AAEd,SAAO,CAAC,KAAK;AAAA;AAGR,MAAM,sBAAsB,CACjC,aACA,wBAAwB,IACxB,QAAQ,GACR,OAAO,GACP,WAAW,MACR;AACH,MAAI,MAAM;AACV,MAAI,CAAC,iCAAQ,wBAAwB;AACnC,UAAM,aACJ,sBAAuB,aAAY,SAAS,YAAY;AAC1D,WAAO,GAAG,cAAc,YAAY,OAAO,QAAQ;AAAA,SAC9C;AACL,WAAO,GAAG,YAAY,OAAO,QAAQ;AAAA;AAGvC,SAAO;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,36 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var src_exports = {};
29
+ __export(src_exports, {
30
+ default: () => import_DSSlider.default
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_DSSlider = __toESM(require("./DSSlider"));
34
+ __reExport(src_exports, require("./DSSlider"));
35
+ module.exports = __toCommonJS(src_exports);
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export { default } from './DSSlider';\nexport * from './DSSlider';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,sBAAwB;AACxB,wBAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,67 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var prop_types_exports = {};
29
+ __export(prop_types_exports, {
30
+ defaultProps: () => defaultProps,
31
+ sliderPropTypes: () => sliderPropTypes
32
+ });
33
+ var React = __toESM(require("react"));
34
+ var import_react_desc = require("react-desc");
35
+ const defaultProps = {
36
+ containerProps: {},
37
+ disabled: false,
38
+ label: "",
39
+ labelWithValue: false,
40
+ minValue: 0,
41
+ maxValue: 100,
42
+ step: 5,
43
+ onChange: () => {
44
+ },
45
+ withTickMarks: false,
46
+ withTickMarksValues: false,
47
+ withTwoHandles: false,
48
+ customTickMarksValues: [],
49
+ zIndex: 0
50
+ };
51
+ const sliderPropTypes = {
52
+ containerProps: import_react_desc.PropTypes.shape({}).description("props to inject to slider wrapper"),
53
+ disabled: import_react_desc.PropTypes.bool.description("disable slider"),
54
+ label: import_react_desc.PropTypes.string.description("label for slider"),
55
+ labelWithValue: import_react_desc.PropTypes.bool.description("if the label comes with value attached for slider or not"),
56
+ minValue: import_react_desc.PropTypes.number.description("min value for slider"),
57
+ maxValue: import_react_desc.PropTypes.number.description("max value for slider"),
58
+ step: import_react_desc.PropTypes.number.description("steps of values from min to max"),
59
+ onChange: import_react_desc.PropTypes.func.description("change handler"),
60
+ withTickMarks: import_react_desc.PropTypes.bool.description("add tick marks between steps"),
61
+ withTickMarksValues: import_react_desc.PropTypes.bool.description("add step value to tickmark"),
62
+ withTwoHandles: import_react_desc.PropTypes.bool.description("add two handles"),
63
+ customTickMarksValues: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number])).description("change manually tickmark values"),
64
+ zIndex: import_react_desc.PropTypes.number.description("z index for thumb")
65
+ };
66
+ module.exports = __toCommonJS(prop_types_exports);
67
+ //# sourceMappingURL=prop-types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/prop-types.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { PropTypes } from 'react-desc';\n\nexport const defaultProps = {\n containerProps: {},\n disabled: false,\n label: '',\n labelWithValue: false,\n minValue: 0,\n maxValue: 100,\n step: 5,\n onChange: () => {},\n withTickMarks: false,\n withTickMarksValues: false,\n withTwoHandles: false,\n customTickMarksValues: [],\n zIndex: 0,\n};\n\nexport const sliderPropTypes = {\n /** props to inject to slider wrapper */\n containerProps: PropTypes.shape({}).description(\n 'props to inject to slider wrapper',\n ),\n /** disable slider */\n disabled: PropTypes.bool.description('disable slider'),\n /** label for slider */\n label: PropTypes.string.description('label for slider'),\n /** if the label comes with value attached for slider or not */\n labelWithValue: PropTypes.bool.description(\n 'if the label comes with value attached for slider or not',\n ),\n /** min value for slider */\n minValue: PropTypes.number.description('min value for slider'),\n /** max value for slider */\n maxValue: PropTypes.number.description('max value for slider'),\n /** steps of values from min to max */\n step: PropTypes.number.description('steps of values from min to max'),\n /** change handler */\n onChange: PropTypes.func.description('change handler'),\n /** add tick marks between steps */\n withTickMarks: PropTypes.bool.description('add tick marks between steps'),\n /** add step value to tickmark */\n withTickMarksValues: PropTypes.bool.description('add step value to tickmark'),\n /** add two handles */\n withTwoHandles: PropTypes.bool.description('add two handles'),\n /** change manually tickmark values */\n customTickMarksValues: PropTypes.arrayOf(\n PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n ).description('change manually tickmark values'),\n /** z index for thumb */\n zIndex: PropTypes.number.description('z index for thumb'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAA0B;AAEnB,MAAM,eAAe;AAAA,EAC1B,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU,MAAM;AAAA;AAAA,EAChB,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,gBAAgB;AAAA,EAChB,uBAAuB;AAAA,EACvB,QAAQ;AAAA;AAGH,MAAM,kBAAkB;AAAA,EAE7B,gBAAgB,4BAAU,MAAM,IAAI,YAClC;AAAA,EAGF,UAAU,4BAAU,KAAK,YAAY;AAAA,EAErC,OAAO,4BAAU,OAAO,YAAY;AAAA,EAEpC,gBAAgB,4BAAU,KAAK,YAC7B;AAAA,EAGF,UAAU,4BAAU,OAAO,YAAY;AAAA,EAEvC,UAAU,4BAAU,OAAO,YAAY;AAAA,EAEvC,MAAM,4BAAU,OAAO,YAAY;AAAA,EAEnC,UAAU,4BAAU,KAAK,YAAY;AAAA,EAErC,eAAe,4BAAU,KAAK,YAAY;AAAA,EAE1C,qBAAqB,4BAAU,KAAK,YAAY;AAAA,EAEhD,gBAAgB,4BAAU,KAAK,YAAY;AAAA,EAE3C,uBAAuB,4BAAU,QAC/B,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU,UACjD,YAAY;AAAA,EAEd,QAAQ,4BAAU,OAAO,YAAY;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { describe } from "react-desc";
4
+ import SliderImp from "./components/SliderImp";
5
+ import { defaultProps, sliderPropTypes } from "./prop-types";
6
+ const DSSlider = (props) => /* @__PURE__ */ React2.createElement(SliderImp, {
7
+ ...props
8
+ });
9
+ DSSlider.defaultProps = defaultProps;
10
+ DSSlider.propTypes = sliderPropTypes;
11
+ const DSSliderWithSchema = describe(DSSlider);
12
+ DSSliderWithSchema.propTypes = sliderPropTypes;
13
+ var DSSlider_default = DSSlider;
14
+ export {
15
+ DSSlider,
16
+ DSSliderWithSchema,
17
+ DSSlider_default as default
18
+ };
19
+ //# sourceMappingURL=DSSlider.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSSlider.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe } from 'react-desc';\nimport SliderImp from './components/SliderImp';\nimport { defaultProps, sliderPropTypes } from './prop-types';\n\nconst DSSlider = (props) => <SliderImp {...props} />;\n\nDSSlider.defaultProps = defaultProps;\nDSSlider.propTypes = sliderPropTypes;\n\nconst DSSliderWithSchema = describe(DSSlider);\nDSSliderWithSchema.propTypes = sliderPropTypes;\n\nexport { DSSlider, DSSliderWithSchema };\nexport default DSSlider;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,WAAW,CAAC,UAAU,qCAAC,WAAD;AAAA,KAAe;AAAA;AAE3C,SAAS,eAAe;AACxB,SAAS,YAAY;AAErB,MAAM,qBAAqB,SAAS;AACpC,mBAAmB,YAAY;AAG/B,IAAO,mBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,173 @@
1
+ import * as React from "react";
2
+ import React2, { useState, useEffect, useRef, useMemo } from "react";
3
+ import { v4 as uuidv4 } from "uuid";
4
+ import { Range } from "react-range";
5
+ import { usePrevious } from "@elliemae/ds-utilities";
6
+ import DSTruncatedTooltipText, {
7
+ TooltipTextProvider
8
+ } from "@elliemae/ds-truncated-tooltip-text";
9
+ import { Grid } from "@elliemae/ds-grid";
10
+ import Track from "./Track";
11
+ import Thumb from "./Thumb";
12
+ import {
13
+ LabelWrapper,
14
+ StyledRangeWrapper,
15
+ LabelText,
16
+ ValueText
17
+ } from "./styled";
18
+ import { conformedLabel } from "./utils";
19
+ import { SliderContext } from "./context";
20
+ const getSubArrayFromRange = (arr, [minVal, maxVal], isCustomTickMarksValues = false) => {
21
+ const trueMinVal = isCustomTickMarksValues ? arr[minVal] : minVal;
22
+ const minIndex = arr.findIndex((el) => el === trueMinVal);
23
+ if (maxVal !== void 0) {
24
+ const trueMaxVal = isCustomTickMarksValues ? arr[maxVal] : maxVal;
25
+ const maxIndex = arr.findIndex((el) => el === trueMaxVal);
26
+ if (minIndex >= 0 && maxIndex > minIndex)
27
+ return arr.slice(minIndex, maxIndex + 1);
28
+ return [];
29
+ }
30
+ return [trueMinVal];
31
+ };
32
+ const SliderImp = (props) => {
33
+ const {
34
+ containerProps,
35
+ disabled,
36
+ label,
37
+ labelWithValue,
38
+ minValue,
39
+ maxValue,
40
+ step,
41
+ onChange,
42
+ withTickMarks,
43
+ withTickMarksValues,
44
+ withTwoHandles,
45
+ customTickMarksValues,
46
+ zIndex
47
+ } = props;
48
+ const ref = useRef();
49
+ const [width, setWidth] = useState(0);
50
+ const sliderUUID = useMemo(() => uuidv4(), []);
51
+ const parsedMinValue = useMemo(() => {
52
+ if (customTickMarksValues?.length)
53
+ return 0;
54
+ return minValue;
55
+ }, [customTickMarksValues?.length, minValue]);
56
+ const parsedMaxValue = useMemo(() => {
57
+ if (customTickMarksValues?.length)
58
+ return customTickMarksValues?.length - 1;
59
+ return maxValue;
60
+ }, [customTickMarksValues?.length, maxValue]);
61
+ const parsedStep = useMemo(() => {
62
+ if (customTickMarksValues?.length)
63
+ return 1;
64
+ return step;
65
+ }, [customTickMarksValues?.length, step]);
66
+ const parsedValuesArray = useMemo(() => {
67
+ if (customTickMarksValues?.length)
68
+ return customTickMarksValues;
69
+ const newLength = Math.ceil(maxValue / step);
70
+ const valuesArray = [];
71
+ for (let i = 0; i <= newLength; i += 1) {
72
+ valuesArray.push(step * i);
73
+ }
74
+ return valuesArray;
75
+ }, [customTickMarksValues?.length, minValue, maxValue, step]);
76
+ const [rangeValues, setRangeValues] = useState(withTwoHandles ? [parsedMinValue, parsedMaxValue] : [parsedMinValue]);
77
+ const [fullSelectedValues, setFullSelectedValues] = useState([]);
78
+ useEffect(() => {
79
+ const selectedRangeValues = getSubArrayFromRange(parsedValuesArray, rangeValues, !!customTickMarksValues?.length);
80
+ setFullSelectedValues(selectedRangeValues);
81
+ }, [parsedValuesArray, rangeValues, customTickMarksValues?.length]);
82
+ const prevWithTwoHandles = usePrevious(withTwoHandles);
83
+ const resizeHandler = () => {
84
+ setWidth(0);
85
+ setWidth(ref.current?.clientWidth);
86
+ };
87
+ useEffect(() => {
88
+ window.addEventListener("resize", resizeHandler);
89
+ return () => window.removeEventListener("resize", resizeHandler);
90
+ });
91
+ useEffect(() => {
92
+ if (!prevWithTwoHandles && withTwoHandles) {
93
+ setRangeValues([parsedMinValue, parsedMaxValue]);
94
+ } else if (prevWithTwoHandles && !withTwoHandles) {
95
+ setRangeValues([parsedMinValue]);
96
+ }
97
+ }, [withTwoHandles]);
98
+ useEffect(() => {
99
+ setWidth(ref.current?.clientWidth);
100
+ }, [ref.current?.clientWidth]);
101
+ const [finalLabelText, finalValueText] = useMemo(() => conformedLabel(rangeValues, label, labelWithValue, withTwoHandles, customTickMarksValues, parsedStep), [
102
+ rangeValues,
103
+ label,
104
+ labelWithValue,
105
+ withTwoHandles,
106
+ customTickMarksValues,
107
+ parsedStep
108
+ ]);
109
+ const SliderLabel = /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(LabelText, null, finalLabelText), finalLabelText && " ", /* @__PURE__ */ React2.createElement(ValueText, {
110
+ disabled
111
+ }, finalValueText));
112
+ return /* @__PURE__ */ React2.createElement(TooltipTextProvider, null, /* @__PURE__ */ React2.createElement("div", {
113
+ ref
114
+ }, /* @__PURE__ */ React2.createElement(Grid, {
115
+ width: "100%",
116
+ style: { maxWidth: "100%" },
117
+ containerProps,
118
+ "data-testid": "slider",
119
+ rows: ["auto", "auto"]
120
+ }, /* @__PURE__ */ React2.createElement(SliderContext.Provider, {
121
+ value: {
122
+ disabled,
123
+ sliderUUID,
124
+ label,
125
+ labelWithValue,
126
+ minValue: parsedMinValue,
127
+ maxValue: parsedMaxValue,
128
+ step: parsedStep,
129
+ parsedValuesArray,
130
+ withTickMarks,
131
+ withTickMarksValues,
132
+ withTwoHandles,
133
+ customTickMarksValues,
134
+ rangeValues,
135
+ fullSelectedValues,
136
+ zIndex
137
+ }
138
+ }, finalLabelText && /* @__PURE__ */ React2.createElement(LabelWrapper, {
139
+ width
140
+ }, /* @__PURE__ */ React2.createElement(DSTruncatedTooltipText, {
141
+ value: SliderLabel
142
+ })), /* @__PURE__ */ React2.createElement(StyledRangeWrapper, null, /* @__PURE__ */ React2.createElement(Range, {
143
+ step: parsedStep,
144
+ min: parsedMinValue,
145
+ max: parsedMaxValue,
146
+ values: rangeValues,
147
+ disabled,
148
+ onChange: (values) => {
149
+ if (withTwoHandles && values[0] === values[1])
150
+ return;
151
+ setRangeValues(values);
152
+ onChange(values);
153
+ },
154
+ renderTrack: ({ props: trackProps, children }) => /* @__PURE__ */ React2.createElement(Track, {
155
+ props: trackProps
156
+ }, children),
157
+ renderThumb: (renderArgs) => {
158
+ const { index, props: thumbProps, isDragged } = renderArgs;
159
+ return /* @__PURE__ */ React2.createElement(Thumb, {
160
+ key: `${sliderUUID}-${thumbProps.key}`,
161
+ props: thumbProps,
162
+ isDragged,
163
+ index
164
+ });
165
+ },
166
+ allowOverlap: false
167
+ }))))));
168
+ };
169
+ var SliderImp_default = SliderImp;
170
+ export {
171
+ SliderImp_default as default
172
+ };
173
+ //# sourceMappingURL=SliderImp.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/SliderImp.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React, { useState, useEffect, useRef, useMemo } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { Range } from 'react-range';\nimport { usePrevious } from '@elliemae/ds-utilities';\nimport DSTruncatedTooltipText, {\n TooltipTextProvider,\n} from '@elliemae/ds-truncated-tooltip-text';\nimport { Grid } from '@elliemae/ds-grid';\nimport Track from './Track';\nimport Thumb from './Thumb';\nimport {\n LabelWrapper,\n StyledRangeWrapper,\n LabelText,\n ValueText,\n} from './styled';\nimport { conformedLabel } from './utils';\nimport { SliderContext } from './context';\n\nconst getSubArrayFromRange = (\n arr,\n [minVal, maxVal], // maxValue is undefined when only one handler\n isCustomTickMarksValues = false,\n) => {\n const trueMinVal = isCustomTickMarksValues ? arr[minVal] : minVal;\n const minIndex = arr.findIndex((el) => el === trueMinVal);\n\n if (maxVal !== undefined) {\n // if two handlers, return the found slice\n const trueMaxVal = isCustomTickMarksValues ? arr[maxVal] : maxVal;\n const maxIndex = arr.findIndex((el) => el === trueMaxVal);\n\n if (minIndex >= 0 && maxIndex > minIndex)\n return arr.slice(minIndex, maxIndex + 1);\n return [];\n }\n // if only one handler, return the value in an array\n return [trueMinVal];\n};\n\nconst SliderImp = (props) => {\n const {\n containerProps,\n disabled,\n label,\n labelWithValue,\n minValue,\n maxValue,\n step,\n onChange,\n withTickMarks,\n withTickMarksValues,\n withTwoHandles,\n customTickMarksValues,\n zIndex,\n } = props;\n const ref = useRef();\n const [width, setWidth] = useState(0);\n const sliderUUID = useMemo(() => uuidv4(), []);\n\n const parsedMinValue = useMemo(() => {\n // ensure this works correctly with customTickMarksValues array\n if (customTickMarksValues?.length) return 0;\n return minValue;\n }, [customTickMarksValues?.length, minValue]);\n const parsedMaxValue = useMemo(() => {\n // ensure this works correctly with customTickMarksValues array\n if (customTickMarksValues?.length) return customTickMarksValues?.length - 1;\n return maxValue;\n }, [customTickMarksValues?.length, maxValue]);\n const parsedStep = useMemo(() => {\n // ensure this works correctly with customTickMarksValues array\n if (customTickMarksValues?.length) return 1;\n return step;\n }, [customTickMarksValues?.length, step]);\n\n const parsedValuesArray = useMemo(() => {\n // ensure this works correctly with customTickMarksValues array\n if (customTickMarksValues?.length) return customTickMarksValues;\n const newLength = Math.ceil(maxValue / step);\n const valuesArray = [];\n for (let i = 0; i <= newLength; i += 1) {\n valuesArray.push(step * i);\n }\n\n return valuesArray;\n }, [customTickMarksValues?.length, minValue, maxValue, step]);\n\n const [rangeValues, setRangeValues] = useState(\n withTwoHandles ? [parsedMinValue, parsedMaxValue] : [parsedMinValue],\n );\n // track the full slice of values selected instead of only the limits\n // this is important to handle the selected range labels colors\n const [fullSelectedValues, setFullSelectedValues] = useState([]);\n useEffect(() => {\n const selectedRangeValues = getSubArrayFromRange(\n parsedValuesArray,\n rangeValues,\n !!customTickMarksValues?.length,\n );\n setFullSelectedValues(selectedRangeValues);\n }, [parsedValuesArray, rangeValues, customTickMarksValues?.length]);\n\n const prevWithTwoHandles = usePrevious(withTwoHandles);\n const resizeHandler = () => {\n setWidth(0);\n setWidth(ref.current?.clientWidth);\n };\n useEffect(() => {\n window.addEventListener('resize', resizeHandler);\n return () => window.removeEventListener('resize', resizeHandler);\n });\n useEffect(() => {\n if (!prevWithTwoHandles && withTwoHandles) {\n setRangeValues([parsedMinValue, parsedMaxValue]);\n } else if (prevWithTwoHandles && !withTwoHandles) {\n setRangeValues([parsedMinValue]);\n }\n }, [withTwoHandles]);\n\n useEffect(() => {\n setWidth(ref.current?.clientWidth);\n }, [ref.current?.clientWidth]);\n\n const [finalLabelText, finalValueText] = useMemo(\n () =>\n conformedLabel(\n rangeValues,\n label,\n labelWithValue,\n withTwoHandles,\n customTickMarksValues,\n parsedStep,\n ),\n [\n rangeValues,\n label,\n labelWithValue,\n withTwoHandles,\n customTickMarksValues,\n parsedStep,\n ],\n );\n\n const SliderLabel = (\n <>\n <LabelText>{finalLabelText}</LabelText>\n {finalLabelText && ' '}\n <ValueText disabled={disabled}>{finalValueText}</ValueText>\n </>\n );\n\n return (\n <TooltipTextProvider>\n <div ref={ref}>\n <Grid\n width=\"100%\"\n style={{ maxWidth: '100%' }}\n containerProps={containerProps}\n data-testid=\"slider\"\n rows={['auto', 'auto']}\n >\n <SliderContext.Provider\n value={{\n disabled,\n sliderUUID,\n label,\n labelWithValue,\n minValue: parsedMinValue,\n maxValue: parsedMaxValue,\n step: parsedStep,\n parsedValuesArray,\n withTickMarks,\n withTickMarksValues,\n withTwoHandles,\n customTickMarksValues,\n rangeValues,\n fullSelectedValues,\n zIndex,\n }}\n >\n {finalLabelText && (\n <LabelWrapper width={width}>\n <DSTruncatedTooltipText value={SliderLabel} />\n </LabelWrapper>\n )}\n <StyledRangeWrapper>\n <Range\n step={parsedStep}\n min={parsedMinValue}\n max={parsedMaxValue}\n values={rangeValues}\n disabled={disabled}\n onChange={(values) => {\n if (withTwoHandles && values[0] === values[1]) return;\n setRangeValues(values);\n onChange(values);\n }}\n renderTrack={({ props: trackProps, children }) => (\n <Track props={trackProps}>{children}</Track>\n )}\n renderThumb={(renderArgs) => {\n const { index, props: thumbProps, isDragged } = renderArgs;\n return (\n <Thumb\n key={`${sliderUUID}-${thumbProps.key}`}\n props={thumbProps}\n isDragged={isDragged}\n index={index}\n />\n );\n }}\n allowOverlap={false}\n />\n </StyledRangeWrapper>\n </SliderContext.Provider>\n </Grid>\n </div>\n </TooltipTextProvider>\n );\n};\n\n// SliderImp.propTypes = sliderPropTypes;\n\nexport default SliderImp;\n"],
5
+ "mappings": "AAAA;ACEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAGA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA;AACA;AAEA,MAAM,uBAAuB,CAC3B,KACA,CAAC,QAAQ,SACT,0BAA0B,UACvB;AACH,QAAM,aAAa,0BAA0B,IAAI,UAAU;AAC3D,QAAM,WAAW,IAAI,UAAU,CAAC,OAAO,OAAO;AAE9C,MAAI,WAAW,QAAW;AAExB,UAAM,aAAa,0BAA0B,IAAI,UAAU;AAC3D,UAAM,WAAW,IAAI,UAAU,CAAC,OAAO,OAAO;AAE9C,QAAI,YAAY,KAAK,WAAW;AAC9B,aAAO,IAAI,MAAM,UAAU,WAAW;AACxC,WAAO;AAAA;AAGT,SAAO,CAAC;AAAA;AAGV,MAAM,YAAY,CAAC,UAAU;AAC3B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AACJ,QAAM,MAAM;AACZ,QAAM,CAAC,OAAO,YAAY,SAAS;AACnC,QAAM,aAAa,QAAQ,MAAM,UAAU;AAE3C,QAAM,iBAAiB,QAAQ,MAAM;AAEnC,QAAI,uBAAuB;AAAQ,aAAO;AAC1C,WAAO;AAAA,KACN,CAAC,uBAAuB,QAAQ;AACnC,QAAM,iBAAiB,QAAQ,MAAM;AAEnC,QAAI,uBAAuB;AAAQ,aAAO,uBAAuB,SAAS;AAC1E,WAAO;AAAA,KACN,CAAC,uBAAuB,QAAQ;AACnC,QAAM,aAAa,QAAQ,MAAM;AAE/B,QAAI,uBAAuB;AAAQ,aAAO;AAC1C,WAAO;AAAA,KACN,CAAC,uBAAuB,QAAQ;AAEnC,QAAM,oBAAoB,QAAQ,MAAM;AAEtC,QAAI,uBAAuB;AAAQ,aAAO;AAC1C,UAAM,YAAY,KAAK,KAAK,WAAW;AACvC,UAAM,cAAc;AACpB,aAAS,IAAI,GAAG,KAAK,WAAW,KAAK,GAAG;AACtC,kBAAY,KAAK,OAAO;AAAA;AAG1B,WAAO;AAAA,KACN,CAAC,uBAAuB,QAAQ,UAAU,UAAU;AAEvD,QAAM,CAAC,aAAa,kBAAkB,SACpC,iBAAiB,CAAC,gBAAgB,kBAAkB,CAAC;AAIvD,QAAM,CAAC,oBAAoB,yBAAyB,SAAS;AAC7D,YAAU,MAAM;AACd,UAAM,sBAAsB,qBAC1B,mBACA,aACA,CAAC,CAAC,uBAAuB;AAE3B,0BAAsB;AAAA,KACrB,CAAC,mBAAmB,aAAa,uBAAuB;AAE3D,QAAM,qBAAqB,YAAY;AACvC,QAAM,gBAAgB,MAAM;AAC1B,aAAS;AACT,aAAS,IAAI,SAAS;AAAA;AAExB,YAAU,MAAM;AACd,WAAO,iBAAiB,UAAU;AAClC,WAAO,MAAM,OAAO,oBAAoB,UAAU;AAAA;AAEpD,YAAU,MAAM;AACd,QAAI,CAAC,sBAAsB,gBAAgB;AACzC,qBAAe,CAAC,gBAAgB;AAAA,eACvB,sBAAsB,CAAC,gBAAgB;AAChD,qBAAe,CAAC;AAAA;AAAA,KAEjB,CAAC;AAEJ,YAAU,MAAM;AACd,aAAS,IAAI,SAAS;AAAA,KACrB,CAAC,IAAI,SAAS;AAEjB,QAAM,CAAC,gBAAgB,kBAAkB,QACvC,MACE,eACE,aACA,OACA,gBACA,gBACA,uBACA,aAEJ;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAIJ,QAAM,cACJ,4DACE,qCAAC,WAAD,MAAY,iBACX,kBAAkB,KACnB,qCAAC,WAAD;AAAA,IAAW;AAAA,KAAqB;AAIpC,SACE,qCAAC,qBAAD,MACE,qCAAC,OAAD;AAAA,IAAK;AAAA,KACH,qCAAC,MAAD;AAAA,IACE,OAAM;AAAA,IACN,OAAO,EAAE,UAAU;AAAA,IACnB;AAAA,IACA,eAAY;AAAA,IACZ,MAAM,CAAC,QAAQ;AAAA,KAEf,qCAAC,cAAc,UAAf;AAAA,IACE,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,UAAU;AAAA,MACV,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,KAGD,kBACC,qCAAC,cAAD;AAAA,IAAc;AAAA,KACZ,qCAAC,wBAAD;AAAA,IAAwB,OAAO;AAAA,OAGnC,qCAAC,oBAAD,MACE,qCAAC,OAAD;AAAA,IACE,MAAM;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,IACA,UAAU,CAAC,WAAW;AACpB,UAAI,kBAAkB,OAAO,OAAO,OAAO;AAAI;AAC/C,qBAAe;AACf,eAAS;AAAA;AAAA,IAEX,aAAa,CAAC,EAAE,OAAO,YAAY,eACjC,qCAAC,OAAD;AAAA,MAAO,OAAO;AAAA,OAAa;AAAA,IAE7B,aAAa,CAAC,eAAe;AAC3B,YAAM,EAAE,OAAO,OAAO,YAAY,cAAc;AAChD,aACE,qCAAC,OAAD;AAAA,QACE,KAAK,GAAG,cAAc,WAAW;AAAA,QACjC,OAAO;AAAA,QACP;AAAA,QACA;AAAA;AAAA;AAAA,IAIN,cAAc;AAAA;AAAA;AAY9B,IAAO,oBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,43 @@
1
+ import * as React from "react";
2
+ import React2, { useContext, useState } from "react";
3
+ import PropTypes from "prop-types";
4
+ import { TooltipText } from "@elliemae/ds-tooltip";
5
+ import { SliderContext } from "./context";
6
+ import { conformedThumbLabel } from "./utils";
7
+ import { ThumbStyled, TooltipContainerStyled, TooltipArrow } from "./styled";
8
+ const Thumb = ({ index, props, isDragged }) => {
9
+ const [isHovered, setIsHovered] = useState(false);
10
+ const {
11
+ disabled,
12
+ rangeValues,
13
+ zIndex,
14
+ customTickMarksValues,
15
+ step,
16
+ minValue
17
+ } = useContext(SliderContext);
18
+ const cleanedProps = { ...props };
19
+ return /* @__PURE__ */ React2.createElement(ThumbStyled, {
20
+ ...cleanedProps,
21
+ "data-testid": "slider-thumb",
22
+ disabled,
23
+ style: { ...cleanedProps.style, zIndex },
24
+ index,
25
+ onMouseEnter: () => setIsHovered(true),
26
+ onMouseLeave: () => setIsHovered(false)
27
+ }, /* @__PURE__ */ React2.createElement(TooltipContainerStyled, {
28
+ isDragged,
29
+ isHovered
30
+ }, /* @__PURE__ */ React2.createElement(TooltipText, null, conformedThumbLabel(rangeValues, customTickMarksValues, index, step, minValue)), /* @__PURE__ */ React2.createElement(TooltipArrow, null)));
31
+ };
32
+ Thumb.propTypes = {
33
+ index: PropTypes.number,
34
+ props: PropTypes.shape({
35
+ style: PropTypes.shape({}).isRequired
36
+ }).isRequired,
37
+ isDragged: PropTypes.bool
38
+ };
39
+ var Thumb_default = Thumb;
40
+ export {
41
+ Thumb_default as default
42
+ };
43
+ //# sourceMappingURL=Thumb.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/Thumb.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { TooltipText } from '@elliemae/ds-tooltip';\nimport { SliderContext } from './context';\nimport { conformedThumbLabel } from './utils';\nimport { ThumbStyled, TooltipContainerStyled, TooltipArrow } from './styled';\n\nconst Thumb = ({ index, props, isDragged }) => {\n const [isHovered, setIsHovered] = useState(false);\n const {\n disabled,\n rangeValues,\n zIndex,\n customTickMarksValues,\n step,\n minValue,\n } = useContext(SliderContext);\n\n const cleanedProps = { ...props };\n // delete cleanedProps.key;\n // delete cleanedProps.draggable;\n return (\n // ...props is needed because it's received from the library\n // ...props.style has it own style from the library but has a bug with the zIndex for two thumbs, so that's why it has to be overwrite\n <ThumbStyled\n {...cleanedProps}\n data-testid=\"slider-thumb\"\n disabled={disabled}\n // eslint-disable-next-line react/prop-types\n style={{ ...cleanedProps.style, zIndex }}\n index={index}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n <TooltipContainerStyled isDragged={isDragged} isHovered={isHovered}>\n <TooltipText>\n {conformedThumbLabel(\n rangeValues,\n customTickMarksValues,\n index,\n step,\n minValue,\n )}\n </TooltipText>\n <TooltipArrow />\n </TooltipContainerStyled>\n </ThumbStyled>\n );\n};\n\nThumb.propTypes = {\n index: PropTypes.number,\n props: PropTypes.shape({\n style: PropTypes.shape({}).isRequired,\n }).isRequired,\n isDragged: PropTypes.bool,\n};\n\nexport default Thumb;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,QAAQ,CAAC,EAAE,OAAO,OAAO,gBAAgB;AAC7C,QAAM,CAAC,WAAW,gBAAgB,SAAS;AAC3C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,WAAW;AAEf,QAAM,eAAe,KAAK;AAG1B,SAGE,qCAAC,aAAD;AAAA,OACM;AAAA,IACJ,eAAY;AAAA,IACZ;AAAA,IAEA,OAAO,KAAK,aAAa,OAAO;AAAA,IAChC;AAAA,IACA,cAAc,MAAM,aAAa;AAAA,IACjC,cAAc,MAAM,aAAa;AAAA,KAEjC,qCAAC,wBAAD;AAAA,IAAwB;AAAA,IAAsB;AAAA,KAC5C,qCAAC,aAAD,MACG,oBACC,aACA,uBACA,OACA,MACA,YAGJ,qCAAC,cAAD;AAAA;AAMR,MAAM,YAAY;AAAA,EAChB,OAAO,UAAU;AAAA,EACjB,OAAO,UAAU,MAAM;AAAA,IACrB,OAAO,UAAU,MAAM,IAAI;AAAA,KAC1B;AAAA,EACH,WAAW,UAAU;AAAA;AAGvB,IAAO,gBAAQ;",
6
+ "names": []
7
+ }