@elliemae/ds-legacy-slider 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) 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 +181 -0
  4. package/dist/cjs/components/SliderImp.js.map +7 -0
  5. package/dist/cjs/components/Thumb.js +81 -0
  6. package/dist/cjs/components/Thumb.js.map +7 -0
  7. package/dist/cjs/components/TickMarks.js +73 -0
  8. package/dist/cjs/components/TickMarks.js.map +7 -0
  9. package/dist/cjs/components/TickMarksValues.js +68 -0
  10. package/dist/cjs/components/TickMarksValues.js.map +7 -0
  11. package/dist/cjs/components/TooltipWithLabelAndValue.js +84 -0
  12. package/dist/cjs/components/TooltipWithLabelAndValue.js.map +7 -0
  13. package/dist/cjs/components/Track.js +77 -0
  14. package/dist/cjs/components/Track.js.map +7 -0
  15. package/dist/cjs/components/context.js +37 -0
  16. package/dist/cjs/components/context.js.map +7 -0
  17. package/dist/cjs/components/styled.js +104 -0
  18. package/dist/cjs/components/styled.js.map +7 -0
  19. package/dist/cjs/components/useOptionalCustomTickMarksValues.js +74 -0
  20. package/dist/cjs/components/useOptionalCustomTickMarksValues.js.map +7 -0
  21. package/dist/cjs/components/useSelectedValuesArray.js +64 -0
  22. package/dist/cjs/components/useSelectedValuesArray.js.map +7 -0
  23. package/dist/cjs/components/utils.js +60 -0
  24. package/dist/cjs/components/utils.js.map +7 -0
  25. package/dist/cjs/index.js +38 -0
  26. package/dist/cjs/index.js.map +7 -0
  27. package/dist/cjs/package.json +7 -0
  28. package/dist/cjs/prop-types.js +81 -0
  29. package/dist/cjs/prop-types.js.map +7 -0
  30. package/dist/esm/DSSlider.js +18 -0
  31. package/dist/esm/DSSlider.js.map +7 -0
  32. package/dist/esm/components/SliderImp.js +151 -0
  33. package/dist/esm/components/SliderImp.js.map +7 -0
  34. package/dist/esm/components/Thumb.js +51 -0
  35. package/dist/esm/components/Thumb.js.map +7 -0
  36. package/dist/esm/components/TickMarks.js +43 -0
  37. package/dist/esm/components/TickMarks.js.map +7 -0
  38. package/dist/esm/components/TickMarksValues.js +38 -0
  39. package/dist/esm/components/TickMarksValues.js.map +7 -0
  40. package/dist/esm/components/TooltipWithLabelAndValue.js +54 -0
  41. package/dist/esm/components/TooltipWithLabelAndValue.js.map +7 -0
  42. package/dist/esm/components/Track.js +47 -0
  43. package/dist/esm/components/Track.js.map +7 -0
  44. package/dist/esm/components/context.js +7 -0
  45. package/dist/esm/components/context.js.map +7 -0
  46. package/dist/esm/components/styled.js +74 -0
  47. package/dist/esm/components/styled.js.map +7 -0
  48. package/dist/esm/components/useOptionalCustomTickMarksValues.js +44 -0
  49. package/dist/esm/components/useOptionalCustomTickMarksValues.js.map +7 -0
  50. package/dist/esm/components/useSelectedValuesArray.js +34 -0
  51. package/dist/esm/components/useSelectedValuesArray.js.map +7 -0
  52. package/dist/esm/components/utils.js +30 -0
  53. package/dist/esm/components/utils.js.map +7 -0
  54. package/dist/esm/index.js +7 -0
  55. package/dist/esm/index.js.map +7 -0
  56. package/dist/esm/package.json +7 -0
  57. package/dist/esm/prop-types.js +51 -0
  58. package/dist/esm/prop-types.js.map +7 -0
  59. package/dist/types/DSSlider.d.ts +37 -0
  60. package/dist/types/components/SliderImp.d.ts +4 -0
  61. package/dist/types/components/Thumb.d.ts +13 -0
  62. package/dist/types/components/TickMarks.d.ts +2 -0
  63. package/dist/types/components/TickMarksValues.d.ts +2 -0
  64. package/dist/types/components/TooltipWithLabelAndValue.d.ts +12 -0
  65. package/dist/types/components/Track.d.ts +5 -0
  66. package/dist/types/components/context.d.ts +2 -0
  67. package/dist/types/components/styled.d.ts +8 -0
  68. package/dist/types/components/useOptionalCustomTickMarksValues.d.ts +7 -0
  69. package/dist/types/components/useSelectedValuesArray.d.ts +7 -0
  70. package/dist/types/components/utils.d.ts +2 -0
  71. package/dist/types/index.d.ts +2 -0
  72. package/dist/types/prop-types.d.ts +70 -0
  73. package/package.json +113 -0
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var DSSlider_exports = {};
30
+ __export(DSSlider_exports, {
31
+ DSSlider: () => DSSlider,
32
+ DSSliderWithSchema: () => DSSliderWithSchema,
33
+ default: () => DSSlider_default
34
+ });
35
+ module.exports = __toCommonJS(DSSlider_exports);
36
+ var React = __toESM(require("react"));
37
+ var import_jsx_runtime = require("react/jsx-runtime");
38
+ var import_ds_legacy_props_helpers = require("@elliemae/ds-legacy-props-helpers");
39
+ var import_SliderImp = __toESM(require("./components/SliderImp.js"));
40
+ var import_prop_types = require("./prop-types.js");
41
+ const DSSlider = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SliderImp.default, { ...props });
42
+ DSSlider.defaultProps = import_prop_types.defaultProps;
43
+ DSSlider.propTypes = import_prop_types.sliderPropTypes;
44
+ DSSlider.displayName = "DSSlider";
45
+ const DSSliderWithSchema = (0, import_ds_legacy_props_helpers.describe)(DSSlider);
46
+ DSSliderWithSchema.propTypes = import_prop_types.sliderPropTypes;
47
+ var DSSlider_default = DSSlider;
48
+ //# sourceMappingURL=DSSlider.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/DSSlider.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-legacy-props-helpers';\nimport SliderImp from './components/SliderImp.js';\nimport { defaultProps, sliderPropTypes, type DSSliderT } from './prop-types.js';\n\nconst DSSlider = (props: DSSliderT.Props) => <SliderImp {...props} />;\n\nDSSlider.defaultProps = defaultProps;\nDSSlider.propTypes = sliderPropTypes;\nDSSlider.displayName = 'DSSlider';\nconst DSSliderWithSchema = describe(DSSlider);\nDSSliderWithSchema.propTypes = sliderPropTypes;\n\nexport { DSSlider, DSSliderWithSchema };\nexport default DSSlider;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKsB;AAJ7C,qCAAyB;AACzB,uBAAsB;AACtB,wBAA8D;AAE9D,MAAM,WAAW,CAAC,UAA2B,4CAAC,iBAAAA,SAAA,EAAW,GAAG,OAAO;AAEnE,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,MAAM,yBAAqB,yCAAS,QAAQ;AAC5C,mBAAmB,YAAY;AAG/B,IAAO,mBAAQ;",
6
+ "names": ["SliderImp"]
7
+ }
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var SliderImp_exports = {};
30
+ __export(SliderImp_exports, {
31
+ default: () => SliderImp_default
32
+ });
33
+ module.exports = __toCommonJS(SliderImp_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = __toESM(require("react"));
37
+ var import_uuid = require("uuid");
38
+ var import_react_range = require("react-range");
39
+ var import_ds_legacy_utilities = require("@elliemae/ds-legacy-utilities");
40
+ var import_ds_legacy_truncated_tooltip_text = require("@elliemae/ds-legacy-truncated-tooltip-text");
41
+ var import_ds_legacy_grid = require("@elliemae/ds-legacy-grid");
42
+ var import_ds_legacy_system = require("@elliemae/ds-legacy-system");
43
+ var import_Track = __toESM(require("./Track.js"));
44
+ var import_Thumb = __toESM(require("./Thumb.js"));
45
+ var import_styled = require("./styled.js");
46
+ var import_context = require("./context.js");
47
+ var import_useOptionalCustomTickMarksValues = require("./useOptionalCustomTickMarksValues.js");
48
+ var import_useSelectedValuesArray = require("./useSelectedValuesArray.js");
49
+ var import_TooltipWithLabelAndValue = require("./TooltipWithLabelAndValue.js");
50
+ const useResetInternalValueOnWithTwoHandlesChange = ({
51
+ withTwoHandles,
52
+ setRangeValues,
53
+ parsedMinValue,
54
+ parsedMaxValue
55
+ }) => {
56
+ const prevWithTwoHandles = (0, import_ds_legacy_utilities.usePrevious)(withTwoHandles);
57
+ import_react.default.useEffect(() => {
58
+ if (!prevWithTwoHandles && withTwoHandles) {
59
+ setRangeValues([parsedMinValue, parsedMaxValue]);
60
+ } else if (prevWithTwoHandles && !withTwoHandles) {
61
+ setRangeValues([parsedMinValue]);
62
+ }
63
+ }, [withTwoHandles]);
64
+ };
65
+ const SliderImp = (props) => {
66
+ const {
67
+ containerProps,
68
+ disabled,
69
+ label,
70
+ labelWithValue,
71
+ onChange,
72
+ withTickMarks,
73
+ withTickMarksValues,
74
+ withTwoHandles,
75
+ customTickMarksValues,
76
+ zIndex,
77
+ controlledValue
78
+ } = props;
79
+ const ref = import_react.default.useRef();
80
+ const sliderUUID = import_react.default.useMemo(() => (0, import_uuid.v4)(), []);
81
+ const { parsedMinValue, parsedMaxValue, parsedStep, parsedValuesArray } = (0, import_useOptionalCustomTickMarksValues.useOptionalCustomTickMarksValues)(props);
82
+ const [rangeValues, setRangeValues] = (0, import_ds_legacy_utilities.useControlledUncontrolledState)({
83
+ defaultState: withTwoHandles ? [parsedMinValue, parsedMaxValue] : [parsedMinValue],
84
+ ...controlledValue !== void 0 && { controlledState: controlledValue }
85
+ // due to a strange interaction with useResetInternalValueOnWithTwoHandlesChange and particularly with usePrevious
86
+ // if we use the "onChange" to notify the parent component of the change, every time the setRangeValues is invoked
87
+ // this will break "first render default value" due to useResetInternalValueOnWithTwoHandlesChange,
88
+ // since usePrevious only work if no extra-render happen,
89
+ // during the first render will triggering an `onChange` with "resetted rangeValues", effectively breaking the "first render default value"
90
+ // all of this is extremely brittle, this component needs to be re-coded from scratch, but short term, we can't use onChange here
91
+ // onChange,
92
+ });
93
+ const [fullSelectedValues] = (0, import_useSelectedValuesArray.useSelectedValuesArray)({ parsedValuesArray, rangeValues, customTickMarksValues });
94
+ useResetInternalValueOnWithTwoHandlesChange({
95
+ withTwoHandles,
96
+ setRangeValues,
97
+ parsedMinValue,
98
+ parsedMaxValue
99
+ });
100
+ const theme = import_react.default.useContext(import_ds_legacy_system.ThemeContext);
101
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_legacy_truncated_tooltip_text.TooltipTextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
102
+ import_ds_legacy_grid.Grid,
103
+ {
104
+ width: "100%",
105
+ style: { maxWidth: "100%" },
106
+ containerProps,
107
+ "data-testid": "slider",
108
+ alignItems: "center",
109
+ rows: ["auto", "auto"],
110
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
111
+ import_context.SliderContext.Provider,
112
+ {
113
+ value: {
114
+ disabled,
115
+ sliderUUID,
116
+ label,
117
+ labelWithValue,
118
+ minValue: parsedMinValue,
119
+ maxValue: parsedMaxValue,
120
+ step: parsedStep,
121
+ parsedValuesArray,
122
+ withTickMarks,
123
+ withTickMarksValues,
124
+ withTwoHandles,
125
+ customTickMarksValues,
126
+ rangeValues,
127
+ fullSelectedValues,
128
+ zIndex: zIndex ?? theme.zIndex.tooltip
129
+ },
130
+ children: [
131
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
132
+ import_TooltipWithLabelAndValue.TooltipWithLabelAndValue,
133
+ {
134
+ containerRef: ref,
135
+ rangeValues,
136
+ label,
137
+ labelWithValue,
138
+ withTwoHandles,
139
+ customTickMarksValues,
140
+ parsedStep,
141
+ disabled
142
+ }
143
+ ),
144
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledRangeWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
145
+ import_react_range.Range,
146
+ {
147
+ step: parsedStep,
148
+ min: parsedMinValue,
149
+ max: parsedMaxValue,
150
+ values: rangeValues,
151
+ disabled,
152
+ onChange: (values) => {
153
+ if (withTwoHandles && values[0] === values[1])
154
+ return;
155
+ setRangeValues(values);
156
+ onChange(values);
157
+ },
158
+ renderTrack: ({ props: trackProps, children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Track.default, { props: trackProps, children }),
159
+ renderThumb: (renderArgs) => {
160
+ const { index, props: thumbProps, isDragged } = renderArgs;
161
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
162
+ import_Thumb.default,
163
+ {
164
+ props: thumbProps,
165
+ isDragged,
166
+ index
167
+ },
168
+ `${sliderUUID}-${thumbProps.key}`
169
+ );
170
+ },
171
+ allowOverlap: false
172
+ }
173
+ ) })
174
+ ]
175
+ }
176
+ )
177
+ }
178
+ ) }) });
179
+ };
180
+ var SliderImp_default = SliderImp;
181
+ //# sourceMappingURL=SliderImp.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/SliderImp.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { Range } from 'react-range';\nimport { usePrevious, useControlledUncontrolledState } from '@elliemae/ds-legacy-utilities';\nimport { TooltipTextProvider } from '@elliemae/ds-legacy-truncated-tooltip-text';\nimport { Grid } from '@elliemae/ds-legacy-grid';\nimport { ThemeContext } from '@elliemae/ds-legacy-system';\nimport Track from './Track.js';\nimport Thumb from './Thumb.js';\nimport { StyledRangeWrapper } from './styled.js';\nimport { SliderContext } from './context.js';\nimport type { DSSliderT } from '../prop-types.js';\nimport { useOptionalCustomTickMarksValues } from './useOptionalCustomTickMarksValues.js';\nimport { useSelectedValuesArray } from './useSelectedValuesArray.js';\nimport { TooltipWithLabelAndValue } from './TooltipWithLabelAndValue.js';\n\n// the intention is to only invoke this when the \"withTwoHandles\" change from true to false or viceversa\n// the current implementation is not working as intended, but changing this is a bigger change outside the scope of this PR.\n// this is specifically triggering an extra time after the first render,\n// forcing the value to start from the min value or [min, max] value\nconst useResetInternalValueOnWithTwoHandlesChange = ({\n withTwoHandles,\n setRangeValues,\n parsedMinValue,\n parsedMaxValue,\n}: {\n withTwoHandles: boolean;\n setRangeValues: (newVal: DSSliderT.RangeTuple) => void;\n parsedMinValue: number;\n parsedMaxValue: number;\n}) => {\n const prevWithTwoHandles = usePrevious(withTwoHandles);\n React.useEffect(() => {\n if (!prevWithTwoHandles && withTwoHandles) {\n setRangeValues([parsedMinValue, parsedMaxValue]);\n } else if (prevWithTwoHandles && !withTwoHandles) {\n setRangeValues([parsedMinValue]);\n }\n // this is legacy code, we can't change this to avoid breaking changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [withTwoHandles]);\n};\n\nconst SliderImp = (props: DSSliderT.InternalProps): JSX.Element => {\n const {\n containerProps,\n disabled,\n label,\n labelWithValue,\n onChange,\n withTickMarks,\n withTickMarksValues,\n withTwoHandles,\n customTickMarksValues,\n zIndex,\n controlledValue,\n } = props;\n const ref = React.useRef() as React.MutableRefObject<HTMLDivElement>;\n const sliderUUID = React.useMemo(() => uuidv4(), []);\n\n const { parsedMinValue, parsedMaxValue, parsedStep, parsedValuesArray } = useOptionalCustomTickMarksValues(props);\n\n const [rangeValues, setRangeValues] = useControlledUncontrolledState<DSSliderT.RangeTuple>({\n defaultState: withTwoHandles ? [parsedMinValue, parsedMaxValue] : [parsedMinValue],\n ...(controlledValue !== undefined && { controlledState: controlledValue }),\n // due to a strange interaction with useResetInternalValueOnWithTwoHandlesChange and particularly with usePrevious\n // if we use the \"onChange\" to notify the parent component of the change, every time the setRangeValues is invoked\n // this will break \"first render default value\" due to useResetInternalValueOnWithTwoHandlesChange,\n // since usePrevious only work if no extra-render happen,\n // during the first render will triggering an `onChange` with \"resetted rangeValues\", effectively breaking the \"first render default value\"\n // all of this is extremely brittle, this component needs to be re-coded from scratch, but short term, we can't use onChange here\n // onChange,\n });\n\n // this is used to change the text color of the tickmarks values\n const [fullSelectedValues] = useSelectedValuesArray({ parsedValuesArray, rangeValues, customTickMarksValues });\n\n // (hystorically) for some reason we have chosen to\n // not notify the parent component of the change when we reset the value due to the \"withTwoHandles\" change\n // if useControlledUncontrolledState receives onChange, it will notify the parent component of the change...\n useResetInternalValueOnWithTwoHandlesChange({\n withTwoHandles,\n setRangeValues,\n parsedMinValue,\n parsedMaxValue,\n });\n\n const theme = React.useContext(ThemeContext);\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 alignItems=\"center\"\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: zIndex ?? theme.zIndex.tooltip,\n }}\n >\n <TooltipWithLabelAndValue\n containerRef={ref}\n rangeValues={rangeValues}\n label={label}\n labelWithValue={labelWithValue}\n withTwoHandles={withTwoHandles}\n customTickMarksValues={customTickMarksValues}\n parsedStep={parsedStep}\n disabled={disabled}\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 as DSSliderT.RangeTuple);\n onChange(values as DSSliderT.RangeTuple);\n }}\n renderTrack={({ props: trackProps, children }) => <Track props={trackProps}>{children}</Track>}\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\nexport default SliderImp;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "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",
6
+ "names": ["React", "uuidv4", "Track", "Thumb"]
7
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var Thumb_exports = {};
30
+ __export(Thumb_exports, {
31
+ default: () => Thumb_default
32
+ });
33
+ module.exports = __toCommonJS(Thumb_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = require("react");
37
+ var import_prop_types = __toESM(require("prop-types"));
38
+ var import_ds_legacy_tooltip = require("@elliemae/ds-legacy-tooltip");
39
+ var import_context = require("./context.js");
40
+ var import_utils = require("./utils.js");
41
+ var import_styled = require("./styled.js");
42
+ const Thumb = ({ index, props, isDragged }) => {
43
+ const [isHovered, setIsHovered] = (0, import_react.useState)(false);
44
+ const { disabled, rangeValues, zIndex, customTickMarksValues, step, minValue } = (0, import_react.useContext)(import_context.SliderContext);
45
+ const cleanedProps = { ...props };
46
+ return (
47
+ // ...props is needed because it's received from the library
48
+ // ...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
49
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
+ import_styled.ThumbStyled,
51
+ {
52
+ ...cleanedProps,
53
+ "data-testid": "slider-thumb",
54
+ disabled,
55
+ style: { ...cleanedProps.style, zIndex },
56
+ index,
57
+ onMouseEnter: () => setIsHovered(true),
58
+ onMouseLeave: () => setIsHovered(false),
59
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
60
+ import_ds_legacy_tooltip.DSTooltipV3,
61
+ {
62
+ text: (0, import_utils.conformedThumbLabel)(rangeValues, customTickMarksValues, index, step, minValue),
63
+ showPopover: isDragged || isHovered,
64
+ customOffset: [0, 20],
65
+ withoutAnimation: true
66
+ },
67
+ (0, import_utils.conformedThumbLabel)(rangeValues, customTickMarksValues, index, step, minValue)
68
+ )
69
+ }
70
+ )
71
+ );
72
+ };
73
+ Thumb.propTypes = {
74
+ index: import_prop_types.default.number,
75
+ props: import_prop_types.default.shape({
76
+ style: import_prop_types.default.shape({}).isRequired
77
+ }).isRequired,
78
+ isDragged: import_prop_types.default.bool
79
+ };
80
+ var Thumb_default = Thumb;
81
+ //# sourceMappingURL=Thumb.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/Thumb.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React, { useContext, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { DSTooltipV3 } from '@elliemae/ds-legacy-tooltip';\nimport { SliderContext } from './context.js';\nimport { conformedThumbLabel } from './utils.js';\nimport { ThumbStyled, TooltipContainerStyled, TooltipArrow } from './styled.js';\n\nconst Thumb = ({ index, props, isDragged }) => {\n const [isHovered, setIsHovered] = useState(false);\n const { disabled, rangeValues, zIndex, customTickMarksValues, step, minValue } = 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 <DSTooltipV3\n key={conformedThumbLabel(rangeValues, customTickMarksValues, index, step, minValue)}\n text={conformedThumbLabel(rangeValues, customTickMarksValues, index, step, minValue)}\n showPopover={isDragged || isHovered}\n customOffset={[0, 20]}\n withoutAnimation\n ></DSTooltipV3>\n </ThumbStyled>\n );\n};\n\n/* {createPortal(\n <TooltipContainerStyled isDragged={isDragged} isHovered={isHovered}>\n <TooltipText>{</TooltipText>\n <TooltipArrow />\n </TooltipContainerStyled>,\n document.body,\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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD4BjB;AA5BN,mBAA4C;AAE5C,wBAAsB;AACtB,+BAA4B;AAC5B,qBAA8B;AAC9B,mBAAoC;AACpC,oBAAkE;AAElE,MAAM,QAAQ,CAAC,EAAE,OAAO,OAAO,UAAU,MAAM;AAC7C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,KAAK;AAChD,QAAM,EAAE,UAAU,aAAa,QAAQ,uBAAuB,MAAM,SAAS,QAAI,yBAAW,4BAAa;AAEzG,QAAM,eAAe,EAAE,GAAG,MAAM;AAGhC;AAAA;AAAA;AAAA,IAGE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,eAAY;AAAA,QACZ;AAAA,QAEA,OAAO,EAAE,GAAG,aAAa,OAAO,OAAO;AAAA,QACvC;AAAA,QACA,cAAc,MAAM,aAAa,IAAI;AAAA,QACrC,cAAc,MAAM,aAAa,KAAK;AAAA,QAEtC;AAAA,UAAC;AAAA;AAAA,YAEC,UAAM,kCAAoB,aAAa,uBAAuB,OAAO,MAAM,QAAQ;AAAA,YACnF,aAAa,aAAa;AAAA,YAC1B,cAAc,CAAC,GAAG,EAAE;AAAA,YACpB,kBAAgB;AAAA;AAAA,cAJX,kCAAoB,aAAa,uBAAuB,OAAO,MAAM,QAAQ;AAAA,QAKnF;AAAA;AAAA,IACH;AAAA;AAEJ;AAUA,MAAM,YAAY;AAAA,EAChB,OAAO,kBAAAA,QAAU;AAAA,EACjB,OAAO,kBAAAA,QAAU,MAAM;AAAA,IACrB,OAAO,kBAAAA,QAAU,MAAM,CAAC,CAAC,EAAE;AAAA,EAC7B,CAAC,EAAE;AAAA,EACH,WAAW,kBAAAA,QAAU;AACvB;AAEA,IAAO,gBAAQ;",
6
+ "names": ["PropTypes"]
7
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var TickMarks_exports = {};
30
+ __export(TickMarks_exports, {
31
+ default: () => TickMarks_default
32
+ });
33
+ module.exports = __toCommonJS(TickMarks_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = require("react");
37
+ var import_ds_legacy_system = require("@elliemae/ds-legacy-system");
38
+ var import_context = require("./context.js");
39
+ const TickMarks = () => {
40
+ const { minValue, maxValue, rangeValues, step, withTwoHandles, zIndex } = (0, import_react.useContext)(import_context.SliderContext);
41
+ const dots = [];
42
+ for (let index = minValue || 0; index <= maxValue; index += step) {
43
+ const isActive = withTwoHandles ? rangeValues[0] <= index && index < rangeValues[1] : rangeValues[0] > index;
44
+ dots.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dot, { "data-testid": "slider-dot", isActive }, index));
45
+ }
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DotsContainer, { "data-testid": "slider-tick-marks", zIndex, children: dots });
47
+ };
48
+ const Dot = import_ds_legacy_system.styled.div`
49
+ &:after {
50
+ content: '';
51
+ background: ${(props) => props.isActive ? props.theme.colors.brand[300] : props.theme.colors.neutral[400]};
52
+ border-radius: ${(props) => (0, import_ds_legacy_system.__UNSAFE_SPACE_TO_DIMSUM)(props.theme.space.xxs)};
53
+ display: block;
54
+ position: relative;
55
+ width: 2px;
56
+ height: 2px;
57
+ }
58
+ `;
59
+ const DotsContainer = import_ds_legacy_system.styled.div`
60
+ padding: 0 calc(${(props) => (0, import_ds_legacy_system.__UNSAFE_SPACE_TO_DIMSUM)(props.theme.space.xxs)} * 0.5);
61
+ align-items: center;
62
+ display: flex;
63
+ justify-content: space-between;
64
+ pointer-events: none;
65
+ position: absolute;
66
+ top: 0;
67
+ left: 0;
68
+ right: 0;
69
+ bottom: 0;
70
+ z-index: ${(props) => props.zIndex - 1};
71
+ `;
72
+ var TickMarks_default = TickMarks;
73
+ //# sourceMappingURL=TickMarks.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/TickMarks.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable indent */\nimport React, { useContext } from 'react';\nimport { styled, __UNSAFE_SPACE_TO_DIMSUM } from '@elliemae/ds-legacy-system';\nimport { SliderContext } from './context.js';\n\nconst TickMarks = () => {\n const { minValue, maxValue, rangeValues, step, withTwoHandles, zIndex } = useContext(SliderContext);\n const dots = [];\n\n for (let index = minValue || 0; index <= maxValue; index += step) {\n const isActive = withTwoHandles ? rangeValues[0] <= index && index < rangeValues[1] : rangeValues[0] > index;\n dots.push(<Dot data-testid=\"slider-dot\" isActive={isActive} key={index} />);\n }\n\n return (\n <DotsContainer data-testid=\"slider-tick-marks\" zIndex={zIndex}>\n {dots}\n </DotsContainer>\n );\n};\n\nconst Dot = styled.div`\n &:after {\n content: '';\n background: ${(props) => (props.isActive ? props.theme.colors.brand[300] : props.theme.colors.neutral[400])};\n border-radius: ${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)};\n display: block;\n position: relative;\n width: 2px;\n height: 2px;\n }\n`;\n\nconst DotsContainer = styled.div`\n padding: 0 calc(${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)} * 0.5);\n align-items: center;\n display: flex;\n justify-content: space-between;\n pointer-events: none;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: ${(props) => props.zIndex - 1};\n`;\n\nexport default TickMarks;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADWT;AAVd,mBAAkC;AAClC,8BAAiD;AACjD,qBAA8B;AAE9B,MAAM,YAAY,MAAM;AACtB,QAAM,EAAE,UAAU,UAAU,aAAa,MAAM,gBAAgB,OAAO,QAAI,yBAAW,4BAAa;AAClG,QAAM,OAAO,CAAC;AAEd,WAAS,QAAQ,YAAY,GAAG,SAAS,UAAU,SAAS,MAAM;AAChE,UAAM,WAAW,iBAAiB,YAAY,CAAC,KAAK,SAAS,QAAQ,YAAY,CAAC,IAAI,YAAY,CAAC,IAAI;AACvG,SAAK,KAAK,4CAAC,OAAI,eAAY,cAAa,YAAyB,KAAO,CAAE;AAAA,EAC5E;AAEA,SACE,4CAAC,iBAAc,eAAY,qBAAoB,QAC5C,gBACH;AAEJ;AAEA,MAAM,MAAM,+BAAO;AAAA;AAAA;AAAA,kBAGD,CAAC,UAAW,MAAM,WAAW,MAAM,MAAM,OAAO,MAAM,GAAG,IAAI,MAAM,MAAM,OAAO,QAAQ,GAAG;AAAA,qBACxF,CAAC,cAAU,kDAAyB,MAAM,MAAM,MAAM,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQ9E,MAAM,gBAAgB,+BAAO;AAAA,oBACT,CAAC,cAAU,kDAAyB,MAAM,MAAM,MAAM,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAUhE,CAAC,UAAU,MAAM,SAAS;AAAA;AAGvC,IAAO,oBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var TickMarksValues_exports = {};
30
+ __export(TickMarksValues_exports, {
31
+ default: () => TickMarksValues_default
32
+ });
33
+ module.exports = __toCommonJS(TickMarksValues_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = require("react");
37
+ var import_ds_legacy_system = require("@elliemae/ds-legacy-system");
38
+ var import_context = require("./context.js");
39
+ const TickMarks = () => {
40
+ const { parsedValuesArray, fullSelectedValues, sliderUUID } = (0, import_react.useContext)(import_context.SliderContext);
41
+ const TickMarksLabels = (0, import_react.useMemo)(
42
+ () => parsedValuesArray.map((value) => {
43
+ const isSelected = fullSelectedValues.findIndex((selectedVal) => selectedVal === value) >= 0;
44
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TickMarkValue, { isSelected, children: value }, `${sliderUUID}-${value}`);
45
+ }),
46
+ [parsedValuesArray, sliderUUID, fullSelectedValues]
47
+ );
48
+ const PureTickMArksValues = (0, import_react.useMemo)(
49
+ () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TickMarksContainer, { "data-testid": "slider-tick-marks-values", children: TickMarksLabels }),
50
+ [TickMarksLabels]
51
+ );
52
+ return PureTickMArksValues;
53
+ };
54
+ const TickMarkValue = import_ds_legacy_system.styled.div`
55
+ min-height: ${(props) => (0, import_ds_legacy_system.__UNSAFE_SPACE_TO_DIMSUM)(props.theme.space.s)};
56
+ overflow: visible;
57
+ transform: translateX(-100%);
58
+ width: ${(props) => (0, import_ds_legacy_system.__UNSAFE_SPACE_TO_DIMSUM)(props.theme.space.xxs)};
59
+ color: ${(props) => props.isSelected ? props.theme.colors.neutral[800] : props.theme.colors.neutral[500]};
60
+ `;
61
+ const TickMarksContainer = import_ds_legacy_system.styled.div`
62
+ display: flex;
63
+ justify-content: space-between;
64
+ // this next property-value rever the sanitize.css value
65
+ overflow-wrap: normal;
66
+ `;
67
+ var TickMarksValues_default = TickMarks;
68
+ //# sourceMappingURL=TickMarksValues.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/TickMarksValues.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable no-plusplus */\nimport React, { useContext, useMemo } from 'react';\nimport { styled, __UNSAFE_SPACE_TO_DIMSUM } from '@elliemae/ds-legacy-system';\nimport { SliderContext } from './context.js';\n\nconst TickMarks = () => {\n const { parsedValuesArray, fullSelectedValues, sliderUUID } = useContext(SliderContext);\n\n const TickMarksLabels = useMemo(\n () =>\n parsedValuesArray.map((value) => {\n const isSelected = fullSelectedValues.findIndex((selectedVal) => selectedVal === value) >= 0;\n return (\n <TickMarkValue key={`${sliderUUID}-${value}`} isSelected={isSelected}>\n {value}\n </TickMarkValue>\n );\n }),\n\n [parsedValuesArray, sliderUUID, fullSelectedValues],\n );\n\n const PureTickMArksValues = useMemo(\n () => <TickMarksContainer data-testid=\"slider-tick-marks-values\">{TickMarksLabels}</TickMarksContainer>,\n [TickMarksLabels],\n );\n\n return PureTickMArksValues;\n};\n\nconst TickMarkValue = styled.div`\n min-height: ${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.s)};\n overflow: visible;\n transform: translateX(-100%);\n width: ${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)};\n color: ${(props) => (props.isSelected ? props.theme.colors.neutral[800] : props.theme.colors.neutral[500])};\n`;\n\nconst TickMarksContainer = styled.div`\n display: flex;\n justify-content: space-between;\n // this next property-value rever the sanitize.css value\n overflow-wrap: normal;\n`;\n\nexport default TickMarks;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADab;AAZV,mBAA2C;AAC3C,8BAAiD;AACjD,qBAA8B;AAE9B,MAAM,YAAY,MAAM;AACtB,QAAM,EAAE,mBAAmB,oBAAoB,WAAW,QAAI,yBAAW,4BAAa;AAEtF,QAAM,sBAAkB;AAAA,IACtB,MACE,kBAAkB,IAAI,CAAC,UAAU;AAC/B,YAAM,aAAa,mBAAmB,UAAU,CAAC,gBAAgB,gBAAgB,KAAK,KAAK;AAC3F,aACE,4CAAC,iBAA6C,YAC3C,mBADiB,GAAG,cAAc,OAErC;AAAA,IAEJ,CAAC;AAAA,IAEH,CAAC,mBAAmB,YAAY,kBAAkB;AAAA,EACpD;AAEA,QAAM,0BAAsB;AAAA,IAC1B,MAAM,4CAAC,sBAAmB,eAAY,4BAA4B,2BAAgB;AAAA,IAClF,CAAC,eAAe;AAAA,EAClB;AAEA,SAAO;AACT;AAEA,MAAM,gBAAgB,+BAAO;AAAA,gBACb,CAAC,cAAU,kDAAyB,MAAM,MAAM,MAAM,CAAC;AAAA;AAAA;AAAA,WAG5D,CAAC,cAAU,kDAAyB,MAAM,MAAM,MAAM,GAAG;AAAA,WACzD,CAAC,UAAW,MAAM,aAAa,MAAM,MAAM,OAAO,QAAQ,GAAG,IAAI,MAAM,MAAM,OAAO,QAAQ,GAAG;AAAA;AAG1G,MAAM,qBAAqB,+BAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOlC,IAAO,0BAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var TooltipWithLabelAndValue_exports = {};
30
+ __export(TooltipWithLabelAndValue_exports, {
31
+ TooltipWithLabelAndValue: () => TooltipWithLabelAndValue
32
+ });
33
+ module.exports = __toCommonJS(TooltipWithLabelAndValue_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = __toESM(require("react"));
37
+ var import_ds_legacy_truncated_tooltip_text = __toESM(require("@elliemae/ds-legacy-truncated-tooltip-text"));
38
+ var import_styled = require("./styled.js");
39
+ var import_utils = require("./utils.js");
40
+ const useWidthForLabel = ({ ref }) => {
41
+ const [width, setWidth] = import_react.default.useState(0);
42
+ const resizeHandler = () => {
43
+ setWidth(0);
44
+ setWidth(ref.current?.clientWidth);
45
+ };
46
+ import_react.default.useEffect(() => {
47
+ window.addEventListener("resize", resizeHandler);
48
+ return () => window.removeEventListener("resize", resizeHandler);
49
+ });
50
+ import_react.default.useEffect(() => {
51
+ setWidth(ref.current?.clientWidth);
52
+ }, [ref.current?.clientWidth]);
53
+ return { ref, width };
54
+ };
55
+ const TooltipWithLabelAndValue = (props) => {
56
+ const {
57
+ containerRef,
58
+ rangeValues,
59
+ label,
60
+ labelWithValue,
61
+ withTwoHandles,
62
+ customTickMarksValues,
63
+ parsedStep,
64
+ disabled
65
+ } = props;
66
+ const { width } = useWidthForLabel({ ref: containerRef });
67
+ const [finalLabelText, finalValueText] = import_react.default.useMemo(
68
+ () => (0, import_utils.conformedLabel)(rangeValues, label, labelWithValue, withTwoHandles, customTickMarksValues, parsedStep),
69
+ [rangeValues, label, labelWithValue, withTwoHandles, customTickMarksValues, parsedStep]
70
+ );
71
+ if (!finalLabelText)
72
+ return null;
73
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.LabelWrapper, { width, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ import_ds_legacy_truncated_tooltip_text.default,
75
+ {
76
+ value: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.LabelText, { children: finalLabelText }),
78
+ finalLabelText && " ",
79
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.ValueText, { disabled, children: finalValueText })
80
+ ] })
81
+ }
82
+ ) });
83
+ };
84
+ //# sourceMappingURL=TooltipWithLabelAndValue.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/TooltipWithLabelAndValue.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React from 'react';\nimport DSTruncatedTooltipText from '@elliemae/ds-legacy-truncated-tooltip-text';\nimport { LabelWrapper, LabelText, ValueText } from './styled.js';\nimport { conformedLabel } from './utils.js';\nimport type { DSSliderT } from '../prop-types.js';\n\nconst useWidthForLabel = ({ ref }: { ref: React.MutableRefObject<HTMLDivElement> }) => {\n const [width, setWidth] = React.useState(0);\n const resizeHandler = () => {\n setWidth(0);\n setWidth(ref.current?.clientWidth);\n };\n React.useEffect(() => {\n window.addEventListener('resize', resizeHandler);\n return () => window.removeEventListener('resize', resizeHandler);\n });\n React.useEffect(() => {\n setWidth(ref.current?.clientWidth);\n // this is legacy code, we can't change this to avoid breaking changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [ref.current?.clientWidth]);\n return { ref, width };\n};\n\nexport const TooltipWithLabelAndValue = (props: {\n containerRef: React.MutableRefObject<HTMLDivElement>;\n rangeValues: DSSliderT.RangeTuple;\n label: string;\n labelWithValue: boolean;\n withTwoHandles: boolean;\n customTickMarksValues: DSSliderT.CustomTickMarkValue[];\n parsedStep: number;\n disabled: boolean;\n}) => {\n const {\n containerRef,\n rangeValues,\n label,\n labelWithValue,\n withTwoHandles,\n customTickMarksValues,\n parsedStep,\n disabled,\n } = props;\n const { width } = useWidthForLabel({ ref: containerRef });\n\n const [finalLabelText, finalValueText] = React.useMemo(\n () => conformedLabel(rangeValues, label, labelWithValue, withTwoHandles, customTickMarksValues, parsedStep),\n [rangeValues, label, labelWithValue, withTwoHandles, customTickMarksValues, parsedStep],\n );\n\n if (!finalLabelText) return null;\n return (\n <LabelWrapper width={width}>\n <DSTruncatedTooltipText\n value={\n <>\n <LabelText>{finalLabelText}</LabelText>\n {finalLabelText && ' '}\n <ValueText disabled={disabled}>{finalValueText}</ValueText>\n </>\n }\n />\n </LabelWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwDb;AAxDV,mBAAkB;AAClB,8CAAmC;AACnC,oBAAmD;AACnD,mBAA+B;AAG/B,MAAM,mBAAmB,CAAC,EAAE,IAAI,MAAuD;AACrF,QAAM,CAAC,OAAO,QAAQ,IAAI,aAAAA,QAAM,SAAS,CAAC;AAC1C,QAAM,gBAAgB,MAAM;AAC1B,aAAS,CAAC;AACV,aAAS,IAAI,SAAS,WAAW;AAAA,EACnC;AACA,eAAAA,QAAM,UAAU,MAAM;AACpB,WAAO,iBAAiB,UAAU,aAAa;AAC/C,WAAO,MAAM,OAAO,oBAAoB,UAAU,aAAa;AAAA,EACjE,CAAC;AACD,eAAAA,QAAM,UAAU,MAAM;AACpB,aAAS,IAAI,SAAS,WAAW;AAAA,EAGnC,GAAG,CAAC,IAAI,SAAS,WAAW,CAAC;AAC7B,SAAO,EAAE,KAAK,MAAM;AACtB;AAEO,MAAM,2BAA2B,CAAC,UASnC;AACJ,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,MAAM,IAAI,iBAAiB,EAAE,KAAK,aAAa,CAAC;AAExD,QAAM,CAAC,gBAAgB,cAAc,IAAI,aAAAA,QAAM;AAAA,IAC7C,UAAM,6BAAe,aAAa,OAAO,gBAAgB,gBAAgB,uBAAuB,UAAU;AAAA,IAC1G,CAAC,aAAa,OAAO,gBAAgB,gBAAgB,uBAAuB,UAAU;AAAA,EACxF;AAEA,MAAI,CAAC;AAAgB,WAAO;AAC5B,SACE,4CAAC,8BAAa,OACZ;AAAA,IAAC,wCAAAC;AAAA,IAAA;AAAA,MACC,OACE,4EACE;AAAA,oDAAC,2BAAW,0BAAe;AAAA,QAC1B,kBAAkB;AAAA,QACnB,4CAAC,2BAAU,UAAqB,0BAAe;AAAA,SACjD;AAAA;AAAA,EAEJ,GACF;AAEJ;",
6
+ "names": ["React", "DSTruncatedTooltipText"]
7
+ }