@elliemae/ds-slider 3.0.4-rc.4 → 3.1.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/SliderImp.js +3 -1
- package/dist/cjs/components/SliderImp.js.map +2 -2
- package/dist/cjs/components/Thumb.js +8 -12
- package/dist/cjs/components/Thumb.js.map +2 -2
- package/dist/cjs/components/styled.js +2 -1
- package/dist/cjs/components/styled.js.map +2 -2
- package/dist/cjs/prop-types.js +1 -2
- package/dist/cjs/prop-types.js.map +2 -2
- package/dist/esm/components/SliderImp.js +4 -2
- package/dist/esm/components/SliderImp.js.map +2 -2
- package/dist/esm/components/Thumb.js +10 -14
- package/dist/esm/components/Thumb.js.map +2 -2
- package/dist/esm/components/styled.js +2 -1
- package/dist/esm/components/styled.js.map +2 -2
- package/dist/esm/prop-types.js +1 -2
- package/dist/esm/prop-types.js.map +2 -2
- package/package.json +6 -6
|
@@ -35,6 +35,7 @@ var import_Thumb = __toESM(require("./Thumb"));
|
|
|
35
35
|
var import_styled = require("./styled");
|
|
36
36
|
var import_utils = require("./utils");
|
|
37
37
|
var import_context = require("./context");
|
|
38
|
+
var import_styled_components = require("styled-components");
|
|
38
39
|
const getSubArrayFromRange = (arr, [minVal, maxVal], isCustomTickMarksValues = false) => {
|
|
39
40
|
const trueMinVal = isCustomTickMarksValues ? arr[minVal] : minVal;
|
|
40
41
|
const minIndex = arr.findIndex((el) => el === trueMinVal);
|
|
@@ -127,6 +128,7 @@ const SliderImp = (props) => {
|
|
|
127
128
|
const SliderLabel = /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_styled.LabelText, null, finalLabelText), finalLabelText && " ", /* @__PURE__ */ import_react.default.createElement(import_styled.ValueText, {
|
|
128
129
|
disabled
|
|
129
130
|
}, finalValueText));
|
|
131
|
+
const theme = (0, import_react.useContext)(import_styled_components.ThemeContext);
|
|
130
132
|
return /* @__PURE__ */ import_react.default.createElement(import_ds_truncated_tooltip_text.TooltipTextProvider, null, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
131
133
|
ref
|
|
132
134
|
}, /* @__PURE__ */ import_react.default.createElement(import_ds_grid.Grid, {
|
|
@@ -151,7 +153,7 @@ const SliderImp = (props) => {
|
|
|
151
153
|
customTickMarksValues,
|
|
152
154
|
rangeValues,
|
|
153
155
|
fullSelectedValues,
|
|
154
|
-
zIndex
|
|
156
|
+
zIndex: zIndex ?? theme.zIndex.tooltip
|
|
155
157
|
}
|
|
156
158
|
}, finalLabelText && /* @__PURE__ */ import_react.default.createElement(import_styled.LabelWrapper, {
|
|
157
159
|
width
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/SliderImp.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React, { useState, useEffect, useRef, useMemo, useContext } 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';\nimport { ThemeContext } from 'styled-components';\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 const theme = 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 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 {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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAwE;AACxE,kBAA6B;AAC7B,yBAAsB;AACtB,0BAA4B;AAC5B,uCAEO;AACP,qBAAqB;AACrB,mBAAkB;AAClB,mBAAkB;AAClB,oBAKO;AACP,mBAA+B;AAC/B,qBAA8B;AAC9B,+BAA6B;AAE7B,MAAM,uBAAuB,CAC3B,KACA,CAAC,QAAQ,SACT,0BAA0B,UACvB;AACH,QAAM,aAAa,0BAA0B,IAAI,UAAU;AAC3D,QAAM,WAAW,IAAI,UAAU,CAAC,OAAO,OAAO,UAAU;AAExD,MAAI,WAAW,QAAW;AAExB,UAAM,aAAa,0BAA0B,IAAI,UAAU;AAC3D,UAAM,WAAW,IAAI,UAAU,CAAC,OAAO,OAAO,UAAU;AAExD,QAAI,YAAY,KAAK,WAAW;AAC9B,aAAO,IAAI,MAAM,UAAU,WAAW,CAAC;AACzC,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,CAAC,UAAU;AACpB;AAEA,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,yBAAO;AACnB,QAAM,CAAC,OAAO,YAAY,2BAAS,CAAC;AACpC,QAAM,aAAa,0BAAQ,MAAM,oBAAO,GAAG,CAAC,CAAC;AAE7C,QAAM,iBAAiB,0BAAQ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N,KAAK;AAAA,IACL,KAAK;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,IACA,UAAU,CAAC,WAAW;AACpB,UAAI,kBAAkB,OAAO,OAAO,OAAO;AAAI;AAC/C,qBAAe,MAAM;AACrB,eAAS,MAAM;AAAA,IACjB;AAAA,IACA,aAAa,CAAC,EAAE,OAAO,YAAY,eACjC,mDAAC;AAAA,MAAM,OAAO;AAAA,OAAa,QAAS;AAAA,IAEtC,aAAa,CAAC,eAAe;AAC3B,YAAM,EAAE,OAAO,OAAO,YAAY,cAAc;AAChD,aACE,mDAAC;AAAA,QACC,KAAK,GAAG,cAAc,WAAW;AAAA,QACjC,OAAO;AAAA,QACP;AAAA,QACA;AAAA,OACF;AAAA,IAEJ;AAAA,IACA,cAAc;AAAA,GAChB,CACF,CACF,CACF,CACF,CACF;AAEJ;AAIA,IAAO,oBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -49,14 +49,7 @@ var import_utils = require("./utils");
|
|
|
49
49
|
var import_styled = require("./styled");
|
|
50
50
|
const Thumb = ({ index, props, isDragged }) => {
|
|
51
51
|
const [isHovered, setIsHovered] = (0, import_react.useState)(false);
|
|
52
|
-
const {
|
|
53
|
-
disabled,
|
|
54
|
-
rangeValues,
|
|
55
|
-
zIndex,
|
|
56
|
-
customTickMarksValues,
|
|
57
|
-
step,
|
|
58
|
-
minValue
|
|
59
|
-
} = (0, import_react.useContext)(import_context.SliderContext);
|
|
52
|
+
const { disabled, rangeValues, zIndex, customTickMarksValues, step, minValue } = (0, import_react.useContext)(import_context.SliderContext);
|
|
60
53
|
const cleanedProps = __spreadValues({}, props);
|
|
61
54
|
return /* @__PURE__ */ import_react.default.createElement(import_styled.ThumbStyled, __spreadProps(__spreadValues({}, cleanedProps), {
|
|
62
55
|
"data-testid": "slider-thumb",
|
|
@@ -65,10 +58,13 @@ const Thumb = ({ index, props, isDragged }) => {
|
|
|
65
58
|
index,
|
|
66
59
|
onMouseEnter: () => setIsHovered(true),
|
|
67
60
|
onMouseLeave: () => setIsHovered(false)
|
|
68
|
-
}), /* @__PURE__ */ import_react.default.createElement(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
61
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_ds_tooltip.DSTooltipV3, {
|
|
62
|
+
key: (0, import_utils.conformedThumbLabel)(rangeValues, customTickMarksValues, index, step, minValue),
|
|
63
|
+
text: (0, import_utils.conformedThumbLabel)(rangeValues, customTickMarksValues, index, step, minValue),
|
|
64
|
+
showPopover: isDragged || isHovered,
|
|
65
|
+
customOffset: [0, 20],
|
|
66
|
+
withoutAnimation: true
|
|
67
|
+
}));
|
|
72
68
|
};
|
|
73
69
|
Thumb.propTypes = {
|
|
74
70
|
index: import_prop_types.default.number,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Thumb.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA4C;
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { DSTooltipV3 } 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 { 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;ADAvB,mBAA4C;AAE5C,wBAAsB;AACtB,wBAA4B;AAC5B,qBAA8B;AAC9B,mBAAoC;AACpC,oBAAkE;AAElE,MAAM,QAAQ,CAAC,EAAE,OAAO,OAAO,gBAAgB;AAC7C,QAAM,CAAC,WAAW,gBAAgB,2BAAS,KAAK;AAChD,QAAM,EAAE,UAAU,aAAa,QAAQ,uBAAuB,MAAM,aAAa,6BAAW,4BAAa;AAEzG,QAAM,eAAe,mBAAK;AAG1B,SAGE,mDAAC,4DACK,eADL;AAAA,IAEC,eAAY;AAAA,IACZ;AAAA,IAEA,OAAO,iCAAK,aAAa,QAAlB,EAAyB,OAAO;AAAA,IACvC;AAAA,IACA,cAAc,MAAM,aAAa,IAAI;AAAA,IACrC,cAAc,MAAM,aAAa,KAAK;AAAA,MAEtC,mDAAC;AAAA,IACC,KAAK,sCAAoB,aAAa,uBAAuB,OAAO,MAAM,QAAQ;AAAA,IAClF,MAAM,sCAAoB,aAAa,uBAAuB,OAAO,MAAM,QAAQ;AAAA,IACnF,aAAa,aAAa;AAAA,IAC1B,cAAc,CAAC,GAAG,EAAE;AAAA,IACpB,kBAAgB;AAAA,GACjB,CACH;AAEJ;AAUA,MAAM,YAAY;AAAA,EAChB,OAAO,0BAAU;AAAA,EACjB,OAAO,0BAAU,MAAM;AAAA,IACrB,OAAO,0BAAU,MAAM,CAAC,CAAC,EAAE;AAAA,EAC7B,CAAC,EAAE;AAAA,EACH,WAAW,0BAAU;AACvB;AAEA,IAAO,gBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,6 +36,7 @@ var import_ds_tooltip = require("@elliemae/ds-tooltip");
|
|
|
36
36
|
const ThumbStyled = import_styled_components.default.div`
|
|
37
37
|
height: 20px;
|
|
38
38
|
width: 20px;
|
|
39
|
+
top: 0;
|
|
39
40
|
background-color: ${(props) => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral["000"]};
|
|
40
41
|
border-radius: 10px;
|
|
41
42
|
border: 1px solid ${(props) => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral[400]};
|
|
@@ -69,7 +70,7 @@ const TooltipArrow = import_styled_components.default.div`
|
|
|
69
70
|
border-right: calc(${(props) => (0, import_ds_system.__UNSAFE_SPACE_TO_DIMSUM)(props.theme.space.xxs)} * 2.5) solid transparent;
|
|
70
71
|
|
|
71
72
|
border-top: calc(${(props) => (0, import_ds_system.__UNSAFE_SPACE_TO_DIMSUM)(props.theme.space.xxs)} * 2.5) solid
|
|
72
|
-
${(props) => props.theme.colors.neutral[
|
|
73
|
+
${(props) => props.theme.colors.neutral["000"]};
|
|
73
74
|
`;
|
|
74
75
|
const LabelWrapper = import_styled_components.default.div`
|
|
75
76
|
margin-bottom: ${(props) => props.theme.space.xxs};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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[
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;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,
|
|
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 top: 0;\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['000']};\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;AAAA;ACAA,YAAuB;ADCvB,+BAAmB;AACnB,uBAAyC;AACzC,wBAAiC;AAE1B,MAAM,cAAc,iCAAO;AAAA;AAAA;AAAA;AAAA,sBAIZ,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,kCAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAS7C,CAAC,EAAE,WAAW,gBAAiB,aAAa,YAAY,YAAY;AAAA;AAG7E,MAAM,eAAe,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKb,CAAC,UAAU,+CAAyB,MAAM,MAAM,MAAM,GAAG;AAAA,uBACxD,CAAC,UAAU,+CAAyB,MAAM,MAAM,MAAM,GAAG;AAAA;AAAA,qBAE3D,CAAC,UAAU,+CAAyB,MAAM,MAAM,MAAM,GAAG;AAAA,MACxE,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
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/prop-types.js
CHANGED
|
@@ -39,8 +39,7 @@ const defaultProps = {
|
|
|
39
39
|
withTickMarks: false,
|
|
40
40
|
withTickMarksValues: false,
|
|
41
41
|
withTwoHandles: false,
|
|
42
|
-
customTickMarksValues: []
|
|
43
|
-
zIndex: 0
|
|
42
|
+
customTickMarksValues: []
|
|
44
43
|
};
|
|
45
44
|
const sliderPropTypes = {
|
|
46
45
|
containerProps: import_react_desc.PropTypes.shape({}).description("props to inject to slider wrapper"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAA0B;AAEnB,MAAM,eAAe;AAAA,EAC1B,gBAAgB,CAAC;AAAA,EACjB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU,MAAM;AAAA,EAAC;AAAA,EACjB,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,gBAAgB;AAAA,EAChB,uBAAuB,CAAC;
|
|
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};\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;AAAA;ACAA,YAAuB;ADAvB,wBAA0B;AAEnB,MAAM,eAAe;AAAA,EAC1B,gBAAgB,CAAC;AAAA,EACjB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU,MAAM;AAAA,EAAC;AAAA,EACjB,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,gBAAgB;AAAA,EAChB,uBAAuB,CAAC;AAC1B;AAEO,MAAM,kBAAkB;AAAA,EAE7B,gBAAgB,4BAAU,MAAM,CAAC,CAAC,EAAE,YAClC,mCACF;AAAA,EAEA,UAAU,4BAAU,KAAK,YAAY,gBAAgB;AAAA,EAErD,OAAO,4BAAU,OAAO,YAAY,kBAAkB;AAAA,EAEtD,gBAAgB,4BAAU,KAAK,YAC7B,0DACF;AAAA,EAEA,UAAU,4BAAU,OAAO,YAAY,sBAAsB;AAAA,EAE7D,UAAU,4BAAU,OAAO,YAAY,sBAAsB;AAAA,EAE7D,MAAM,4BAAU,OAAO,YAAY,iCAAiC;AAAA,EAEpE,UAAU,4BAAU,KAAK,YAAY,gBAAgB;AAAA,EAErD,eAAe,4BAAU,KAAK,YAAY,8BAA8B;AAAA,EAExE,qBAAqB,4BAAU,KAAK,YAAY,4BAA4B;AAAA,EAE5E,gBAAgB,4BAAU,KAAK,YAAY,iBAAiB;AAAA,EAE5D,uBAAuB,4BAAU,QAC/B,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU,MAAM,CAAC,CAC1D,EAAE,YAAY,iCAAiC;AAAA,EAE/C,QAAQ,4BAAU,OAAO,YAAY,mBAAmB;AAC1D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import React2, { useState, useEffect, useRef, useMemo } from "react";
|
|
2
|
+
import React2, { useState, useEffect, useRef, useMemo, useContext } from "react";
|
|
3
3
|
import { v4 as uuidv4 } from "uuid";
|
|
4
4
|
import { Range } from "react-range";
|
|
5
5
|
import { usePrevious } from "@elliemae/ds-utilities";
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from "./styled";
|
|
18
18
|
import { conformedLabel } from "./utils";
|
|
19
19
|
import { SliderContext } from "./context";
|
|
20
|
+
import { ThemeContext } from "styled-components";
|
|
20
21
|
const getSubArrayFromRange = (arr, [minVal, maxVal], isCustomTickMarksValues = false) => {
|
|
21
22
|
const trueMinVal = isCustomTickMarksValues ? arr[minVal] : minVal;
|
|
22
23
|
const minIndex = arr.findIndex((el) => el === trueMinVal);
|
|
@@ -109,6 +110,7 @@ const SliderImp = (props) => {
|
|
|
109
110
|
const SliderLabel = /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(LabelText, null, finalLabelText), finalLabelText && " ", /* @__PURE__ */ React2.createElement(ValueText, {
|
|
110
111
|
disabled
|
|
111
112
|
}, finalValueText));
|
|
113
|
+
const theme = useContext(ThemeContext);
|
|
112
114
|
return /* @__PURE__ */ React2.createElement(TooltipTextProvider, null, /* @__PURE__ */ React2.createElement("div", {
|
|
113
115
|
ref
|
|
114
116
|
}, /* @__PURE__ */ React2.createElement(Grid, {
|
|
@@ -133,7 +135,7 @@ const SliderImp = (props) => {
|
|
|
133
135
|
customTickMarksValues,
|
|
134
136
|
rangeValues,
|
|
135
137
|
fullSelectedValues,
|
|
136
|
-
zIndex
|
|
138
|
+
zIndex: zIndex ?? theme.zIndex.tooltip
|
|
137
139
|
}
|
|
138
140
|
}, finalLabelText && /* @__PURE__ */ React2.createElement(LabelWrapper, {
|
|
139
141
|
width
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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,UAAU;AAExD,MAAI,WAAW,QAAW;AAExB,UAAM,aAAa,0BAA0B,IAAI,UAAU;AAC3D,UAAM,WAAW,IAAI,UAAU,CAAC,OAAO,OAAO,UAAU;AAExD,QAAI,YA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;AAAA,KAErB,qCAAC,cAAc,UAAd;AAAA,IACC,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,
|
|
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, useContext } 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';\nimport { ThemeContext } from 'styled-components';\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 const theme = 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 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 {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 );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EAAE,OAAO,OAAO,YAAY,cAAc;AAChD,aACE,qCAAC;AAAA,QACC,KAAK,GAAG,cAAc,WAAW;AAAA,QACjC,OAAO;AAAA,QACP;AAAA,QACA;AAAA,OACF;AAAA,IAEJ;AAAA,IACA,cAAc;AAAA,GAChB,CACF,CACF,CACF,CACF,CACF;AAEJ;AAIA,IAAO,oBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -20,20 +20,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20
20
|
import * as React from "react";
|
|
21
21
|
import React2, { useContext, useState } from "react";
|
|
22
22
|
import PropTypes from "prop-types";
|
|
23
|
-
import {
|
|
23
|
+
import { DSTooltipV3 } from "@elliemae/ds-tooltip";
|
|
24
24
|
import { SliderContext } from "./context";
|
|
25
25
|
import { conformedThumbLabel } from "./utils";
|
|
26
|
-
import { ThumbStyled
|
|
26
|
+
import { ThumbStyled } from "./styled";
|
|
27
27
|
const Thumb = ({ index, props, isDragged }) => {
|
|
28
28
|
const [isHovered, setIsHovered] = useState(false);
|
|
29
|
-
const {
|
|
30
|
-
disabled,
|
|
31
|
-
rangeValues,
|
|
32
|
-
zIndex,
|
|
33
|
-
customTickMarksValues,
|
|
34
|
-
step,
|
|
35
|
-
minValue
|
|
36
|
-
} = useContext(SliderContext);
|
|
29
|
+
const { disabled, rangeValues, zIndex, customTickMarksValues, step, minValue } = useContext(SliderContext);
|
|
37
30
|
const cleanedProps = __spreadValues({}, props);
|
|
38
31
|
return /* @__PURE__ */ React2.createElement(ThumbStyled, __spreadProps(__spreadValues({}, cleanedProps), {
|
|
39
32
|
"data-testid": "slider-thumb",
|
|
@@ -42,10 +35,13 @@ const Thumb = ({ index, props, isDragged }) => {
|
|
|
42
35
|
index,
|
|
43
36
|
onMouseEnter: () => setIsHovered(true),
|
|
44
37
|
onMouseLeave: () => setIsHovered(false)
|
|
45
|
-
}), /* @__PURE__ */ React2.createElement(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
}), /* @__PURE__ */ React2.createElement(DSTooltipV3, {
|
|
39
|
+
key: conformedThumbLabel(rangeValues, customTickMarksValues, index, step, minValue),
|
|
40
|
+
text: conformedThumbLabel(rangeValues, customTickMarksValues, index, step, minValue),
|
|
41
|
+
showPopover: isDragged || isHovered,
|
|
42
|
+
customOffset: [0, 20],
|
|
43
|
+
withoutAnimation: true
|
|
44
|
+
}));
|
|
49
45
|
};
|
|
50
46
|
Thumb.propTypes = {
|
|
51
47
|
index: PropTypes.number,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACAA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { DSTooltipV3 } 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 { 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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACAA;AAEA;AACA;AACA;AACA;AACA;AAEA,MAAM,QAAQ,CAAC,EAAE,OAAO,OAAO,gBAAgB;AAC7C,QAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;AAChD,QAAM,EAAE,UAAU,aAAa,QAAQ,uBAAuB,MAAM,aAAa,WAAW,aAAa;AAEzG,QAAM,eAAe,mBAAK;AAG1B,SAGE,qCAAC,8CACK,eADL;AAAA,IAEC,eAAY;AAAA,IACZ;AAAA,IAEA,OAAO,iCAAK,aAAa,QAAlB,EAAyB,OAAO;AAAA,IACvC;AAAA,IACA,cAAc,MAAM,aAAa,IAAI;AAAA,IACrC,cAAc,MAAM,aAAa,KAAK;AAAA,MAEtC,qCAAC;AAAA,IACC,KAAK,oBAAoB,aAAa,uBAAuB,OAAO,MAAM,QAAQ;AAAA,IAClF,MAAM,oBAAoB,aAAa,uBAAuB,OAAO,MAAM,QAAQ;AAAA,IACnF,aAAa,aAAa;AAAA,IAC1B,cAAc,CAAC,GAAG,EAAE;AAAA,IACpB,kBAAgB;AAAA,GACjB,CACH;AAEJ;AAUA,MAAM,YAAY;AAAA,EAChB,OAAO,UAAU;AAAA,EACjB,OAAO,UAAU,MAAM;AAAA,IACrB,OAAO,UAAU,MAAM,CAAC,CAAC,EAAE;AAAA,EAC7B,CAAC,EAAE;AAAA,EACH,WAAW,UAAU;AACvB;AAEA,IAAO,gBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,6 +5,7 @@ import { TooltipContainer } from "@elliemae/ds-tooltip";
|
|
|
5
5
|
const ThumbStyled = styled.div`
|
|
6
6
|
height: 20px;
|
|
7
7
|
width: 20px;
|
|
8
|
+
top: 0;
|
|
8
9
|
background-color: ${(props) => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral["000"]};
|
|
9
10
|
border-radius: 10px;
|
|
10
11
|
border: 1px solid ${(props) => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral[400]};
|
|
@@ -38,7 +39,7 @@ const TooltipArrow = styled.div`
|
|
|
38
39
|
border-right: calc(${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)} * 2.5) solid transparent;
|
|
39
40
|
|
|
40
41
|
border-top: calc(${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs)} * 2.5) solid
|
|
41
|
-
${(props) => props.theme.colors.neutral[
|
|
42
|
+
${(props) => props.theme.colors.neutral["000"]};
|
|
42
43
|
`;
|
|
43
44
|
const LabelWrapper = styled.div`
|
|
44
45
|
margin-bottom: ${(props) => props.theme.space.xxs};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/styled.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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[
|
|
5
|
-
"mappings": "AAAA;ACCA;AACA;AACA;AAEO,MAAM,cAAc,OAAO;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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 top: 0;\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['000']};\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"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AACA;AAEO,MAAM,cAAc,OAAO;AAAA;AAAA;AAAA;AAAA,sBAIZ,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,OAAO,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAS7C,CAAC,EAAE,WAAW,gBAAiB,aAAa,YAAY,YAAY;AAAA;AAG7E,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKb,CAAC,UAAU,yBAAyB,MAAM,MAAM,MAAM,GAAG;AAAA,uBACxD,CAAC,UAAU,yBAAyB,MAAM,MAAM,MAAM,GAAG;AAAA;AAAA,qBAE3D,CAAC,UAAU,yBAAyB,MAAM,MAAM,MAAM,GAAG;AAAA,MACxE,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ;AAAA;AAGrC,MAAM,eAAe,OAAO;AAAA,mBAChB,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA,WAErC,CAAC,UAAU,GAAG,MAAM,SAAS;AAAA;AAGjC,MAAM,YAAY,OAAO;AAAA,WACrB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ;AAAA;AAG1C,MAAM,YAAY,OAAO;AAAA,WACrB,CAAC,EAAE,UAAU,YAAY,MAAM,OAAO,QAAQ,WAAW,MAAM;AAAA;AAGnE,MAAM,qBAAqB,OAAO;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/prop-types.js
CHANGED
|
@@ -13,8 +13,7 @@ const defaultProps = {
|
|
|
13
13
|
withTickMarks: false,
|
|
14
14
|
withTickMarksValues: false,
|
|
15
15
|
withTwoHandles: false,
|
|
16
|
-
customTickMarksValues: []
|
|
17
|
-
zIndex: 0
|
|
16
|
+
customTickMarksValues: []
|
|
18
17
|
};
|
|
19
18
|
const sliderPropTypes = {
|
|
20
19
|
containerProps: PropTypes.shape({}).description("props to inject to slider wrapper"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/prop-types.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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
|
|
5
|
-
"mappings": "AAAA;ACAA;AAEO,MAAM,eAAe;AAAA,EAC1B,gBAAgB,CAAC;AAAA,EACjB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU,MAAM;AAAA,EAAC;AAAA,EACjB,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,gBAAgB;AAAA,EAChB,uBAAuB,CAAC;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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};\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"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEO,MAAM,eAAe;AAAA,EAC1B,gBAAgB,CAAC;AAAA,EACjB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU,MAAM;AAAA,EAAC;AAAA,EACjB,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,gBAAgB;AAAA,EAChB,uBAAuB,CAAC;AAC1B;AAEO,MAAM,kBAAkB;AAAA,EAE7B,gBAAgB,UAAU,MAAM,CAAC,CAAC,EAAE,YAClC,mCACF;AAAA,EAEA,UAAU,UAAU,KAAK,YAAY,gBAAgB;AAAA,EAErD,OAAO,UAAU,OAAO,YAAY,kBAAkB;AAAA,EAEtD,gBAAgB,UAAU,KAAK,YAC7B,0DACF;AAAA,EAEA,UAAU,UAAU,OAAO,YAAY,sBAAsB;AAAA,EAE7D,UAAU,UAAU,OAAO,YAAY,sBAAsB;AAAA,EAE7D,MAAM,UAAU,OAAO,YAAY,iCAAiC;AAAA,EAEpE,UAAU,UAAU,KAAK,YAAY,gBAAgB;AAAA,EAErD,eAAe,UAAU,KAAK,YAAY,8BAA8B;AAAA,EAExE,qBAAqB,UAAU,KAAK,YAAY,4BAA4B;AAAA,EAE5E,gBAAgB,UAAU,KAAK,YAAY,iBAAiB;AAAA,EAE5D,uBAAuB,UAAU,QAC/B,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC,CAC1D,EAAE,YAAY,iCAAiC;AAAA,EAE/C,QAAQ,UAAU,OAAO,YAAY,mBAAmB;AAC1D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-slider",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0-next.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Slider",
|
|
6
6
|
"files": [
|
|
@@ -82,11 +82,11 @@
|
|
|
82
82
|
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@elliemae/ds-grid": "3.0
|
|
86
|
-
"@elliemae/ds-system": "3.0
|
|
87
|
-
"@elliemae/ds-tooltip": "3.0
|
|
88
|
-
"@elliemae/ds-truncated-tooltip-text": "3.0
|
|
89
|
-
"@elliemae/ds-utilities": "3.0
|
|
85
|
+
"@elliemae/ds-grid": "3.1.0-next.2",
|
|
86
|
+
"@elliemae/ds-system": "3.1.0-next.2",
|
|
87
|
+
"@elliemae/ds-tooltip": "3.1.0-next.2",
|
|
88
|
+
"@elliemae/ds-truncated-tooltip-text": "3.1.0-next.2",
|
|
89
|
+
"@elliemae/ds-utilities": "3.1.0-next.2",
|
|
90
90
|
"prop-types": "~15.8.1",
|
|
91
91
|
"react-desc": "~4.1.3",
|
|
92
92
|
"react-range": "~1.8.12",
|