@elliemae/ds-slider-v2 3.70.0-next.7 → 3.70.0-next.70
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/DSSliderV2.js.map +2 -2
- package/dist/cjs/DSSliderV2CTX.js.map +2 -2
- package/dist/cjs/config/useSliderV2.js +1 -4
- package/dist/cjs/config/useSliderV2.js.map +2 -2
- package/dist/cjs/config/useTickMarksValues.js.map +2 -2
- package/dist/cjs/config/useValidateProps.js +13 -0
- package/dist/cjs/config/useValidateProps.js.map +2 -2
- package/dist/cjs/package.json +1 -4
- package/dist/cjs/parts/MainContent.js +40 -19
- package/dist/cjs/parts/MainContent.js.map +2 -2
- package/dist/cjs/parts/Thumb.js +79 -46
- package/dist/cjs/parts/Thumb.js.map +2 -2
- package/dist/cjs/parts/TickMarks.js +10 -27
- package/dist/cjs/parts/TickMarks.js.map +2 -2
- package/dist/cjs/parts/TickMarksValues.js +15 -19
- package/dist/cjs/parts/TickMarksValues.js.map +2 -2
- package/dist/cjs/parts/Track.js +14 -8
- package/dist/cjs/parts/Track.js.map +2 -2
- package/dist/cjs/{styles.js → parts/styles.js} +54 -25
- package/dist/cjs/parts/styles.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +9 -3
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-auto-polymorph-multiple.js +96 -0
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-auto-polymorph-multiple.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-auto-polymorph-single.js +97 -0
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-auto-polymorph-single.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-multiple.js +98 -0
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-multiple.js.map +7 -0
- package/dist/cjs/typescript-testing/{typescript-slider-v2-valid.js → typescript-slider-v2-valid-single.js} +2 -5
- package/dist/cjs/typescript-testing/{typescript-slider-v2-valid.js.map → typescript-slider-v2-valid-single.js.map} +3 -3
- package/dist/esm/DSSliderV2.js.map +2 -2
- package/dist/esm/DSSliderV2CTX.js.map +2 -2
- package/dist/esm/config/useSliderV2.js +1 -4
- package/dist/esm/config/useSliderV2.js.map +2 -2
- package/dist/esm/config/useTickMarksValues.js.map +2 -2
- package/dist/esm/config/useValidateProps.js +13 -0
- package/dist/esm/config/useValidateProps.js.map +2 -2
- package/dist/esm/package.json +1 -4
- package/dist/esm/parts/MainContent.js +41 -20
- package/dist/esm/parts/MainContent.js.map +2 -2
- package/dist/esm/parts/Thumb.js +78 -45
- package/dist/esm/parts/Thumb.js.map +2 -2
- package/dist/esm/parts/TickMarks.js +11 -28
- package/dist/esm/parts/TickMarks.js.map +2 -2
- package/dist/esm/parts/TickMarksValues.js +15 -19
- package/dist/esm/parts/TickMarksValues.js.map +2 -2
- package/dist/esm/parts/Track.js +15 -9
- package/dist/esm/parts/Track.js.map +2 -2
- package/dist/esm/{styles.js → parts/styles.js} +55 -26
- package/dist/esm/parts/styles.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +9 -3
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-auto-polymorph-multiple.js +73 -0
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-auto-polymorph-multiple.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-auto-polymorph-single.js +74 -0
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-auto-polymorph-single.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-multiple.js +75 -0
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-multiple.js.map +7 -0
- package/dist/esm/typescript-testing/{typescript-slider-v2-valid.js → typescript-slider-v2-valid-single.js} +2 -5
- package/dist/esm/typescript-testing/{typescript-slider-v2-valid.js.map → typescript-slider-v2-valid-single.js.map} +3 -3
- package/dist/types/DSSliderV2.d.ts +3 -2
- package/dist/types/DSSliderV2CTX.d.ts +1 -1
- package/dist/types/config/useSliderV2.d.ts +6 -6
- package/dist/types/config/useTickMarksValues.d.ts +1 -1
- package/dist/types/config/useValidateProps.d.ts +1 -1
- package/dist/types/parts/MainContent.d.ts +1 -1
- package/dist/types/parts/Thumb.d.ts +8 -1
- package/dist/types/parts/TickMarks.d.ts +1 -1
- package/dist/types/parts/TickMarksValues.d.ts +1 -1
- package/dist/types/parts/Track.d.ts +1 -1
- package/dist/types/{styles.d.ts → parts/styles.d.ts} +12 -9
- package/dist/types/react-desc-prop-types.d.ts +36 -16
- package/package.json +15 -15
- package/dist/cjs/styles.js.map +0 -7
- package/dist/cjs/utils/thumbLabels.js +0 -51
- package/dist/cjs/utils/thumbLabels.js.map +0 -7
- package/dist/esm/styles.js.map +0 -7
- package/dist/esm/utils/thumbLabels.js +0 -21
- package/dist/esm/utils/thumbLabels.js.map +0 -7
- package/dist/types/tests/DSSliderV2.PUI-15228.test.d.ts +0 -1
- package/dist/types/tests/DSSliderV2.PUI-15992.test.d.ts +0 -1
- package/dist/types/tests/DSSliderV2.a11y.test.d.ts +0 -1
- package/dist/types/tests/DSSliderV2.clickjump.test.d.ts +0 -1
- package/dist/types/tests/DSSliderV2.data-testid.test.d.ts +0 -1
- package/dist/types/tests/DSSliderV2.events.test.d.ts +0 -1
- package/dist/types/tests/DSSliderV2.exports.test.d.ts +0 -1
- package/dist/types/tests/DSSliderV2.keyboard.test.d.ts +0 -1
- package/dist/types/tests/DSSliderv2.api.test.d.ts +0 -1
- package/dist/types/tests/axe-core.test.d.ts +0 -1
- package/dist/types/typescript-testing/typescript-slider-v2-valid.d.ts +0 -1
- package/dist/types/utils/thumbLabels.d.ts +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSSliderV2.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { type DSSliderV2T, DSSliderV2PropTypesSchema } from './react-desc-prop-types.js';\nimport { useSliderV2 } from './config/useSliderV2.js';\nimport { DSSliderV2Name } from './constants/index.js';\n\nimport DSSliderV2Context from './DSSliderV2CTX.js';\nimport { MainContent } from './parts/MainContent.js';\n\nconst DSSliderV2 =
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADcjB;AAbN,8BAAyB;AACzB,mCAA4D;AAC5D,yBAA4B;AAC5B,uBAA+B;AAE/B,2BAA8B;AAC9B,yBAA4B;AAE5B,MAAM,aAAa,
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { type DSSliderV2T, DSSliderV2PropTypesSchema } from './react-desc-prop-types.js';\nimport { useSliderV2 } from './config/useSliderV2.js';\nimport { DSSliderV2Name } from './constants/index.js';\n\nimport DSSliderV2Context from './DSSliderV2CTX.js';\nimport { MainContent } from './parts/MainContent.js';\n\nconst DSSliderV2 = (props: DSSliderV2T.Props) => {\n const ctx = useSliderV2(props);\n\n return (\n <DSSliderV2Context.Provider value={ctx}>\n <MainContent />\n </DSSliderV2Context.Provider>\n );\n};\n\nDSSliderV2.displayName = DSSliderV2Name;\nconst DSSliderV2WithSchema = describe(DSSliderV2);\nDSSliderV2WithSchema.propTypes = DSSliderV2PropTypesSchema;\n\nexport { DSSliderV2, DSSliderV2WithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADcjB;AAbN,8BAAyB;AACzB,mCAA4D;AAC5D,yBAA4B;AAC5B,uBAA+B;AAE/B,2BAA8B;AAC9B,yBAA4B;AAE5B,MAAM,aAAa,CAAC,UAA6B;AAC/C,QAAM,UAAM,gCAAY,KAAK;AAE7B,SACE,4CAAC,qBAAAA,QAAkB,UAAlB,EAA2B,OAAO,KACjC,sDAAC,kCAAY,GACf;AAEJ;AAEA,WAAW,cAAc;AACzB,MAAM,2BAAuB,kCAAS,UAAU;AAChD,qBAAqB,YAAY;",
|
|
6
6
|
"names": ["DSSliderV2Context"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSSliderV2CTX.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { createContext } from 'react';\nimport type { DSSliderV2CTX } from './config/useSliderV2.js';\n\nconst defaultContext = {} as DSSliderV2CTX
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAG9B,MAAM,iBAAiB,CAAC;AAGjB,MAAM,wBAAoB,
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react';\nimport type { DSSliderV2CTX } from './config/useSliderV2.js';\n\nconst defaultContext = {} as DSSliderV2CTX;\n\n/** Context for cross component communication */\nexport const DSSliderV2Context = createContext<DSSliderV2CTX>(defaultContext);\n\nexport default DSSliderV2Context;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAG9B,MAAM,iBAAiB,CAAC;AAGjB,MAAM,wBAAoB,4BAA6B,cAAc;AAE5E,IAAO,wBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -39,10 +39,7 @@ var import_react_desc_prop_types = require("../react-desc-prop-types.js");
|
|
|
39
39
|
var import_useValidateProps = require("./useValidateProps.js");
|
|
40
40
|
var import_useTickMarksValues = require("./useTickMarksValues.js");
|
|
41
41
|
const useSliderV2 = (propsFromUser) => {
|
|
42
|
-
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(
|
|
43
|
-
propsFromUser,
|
|
44
|
-
import_react_desc_prop_types.defaultProps
|
|
45
|
-
);
|
|
42
|
+
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(propsFromUser, import_react_desc_prop_types.defaultProps);
|
|
46
43
|
const { multiple, value } = propsWithDefault;
|
|
47
44
|
const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(propsWithDefault);
|
|
48
45
|
const instanceUid = import_react.default.useMemo(() => `slider-v2-${(0, import_uid.uid)(5)}`, []);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useSliderV2.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\nimport { useGetXstyledProps, useMemoMergePropsWithDefault, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { type DSSliderV2T, DSSliderV2PropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\nimport { useTickMarksValues } from './useTickMarksValues.js';\n\nexport interface DSSliderV2CTX
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAElB,8BAAgF;AAChF,iBAAoB;AACpB,mCAAoE;AACpE,8BAAiC;AACjC,gCAAmC;AAc5B,MAAM,cAAc,
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\nimport { useGetXstyledProps, useMemoMergePropsWithDefault, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { type DSSliderV2T, DSSliderV2PropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\nimport { useTickMarksValues } from './useTickMarksValues.js';\n\nexport interface DSSliderV2CTX {\n propsWithDefault: DSSliderV2T.InternalProps;\n xstyledProps: XstyledProps;\n instanceUid: string;\n rangeValues: [number, number] | [number];\n tickMarkPositions: number[];\n getOwnerProps: () => DSSliderV2T.InternalProps;\n getOwnerPropsArguments: () => Record<string, unknown>;\n hasUserInteractedAfterFocus: boolean;\n setHasUserInteractedAfterFocus: (value: boolean) => void;\n}\n\nexport const useSliderV2 = (propsFromUser: DSSliderV2T.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSSliderV2T.InternalProps>(propsFromUser, defaultProps);\n\n const { multiple, value } = propsWithDefault;\n\n // =============================================================================\n // XSTYLED PROPS\n // =============================================================================\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n const instanceUid = React.useMemo(() => `slider-v2-${uid(5)}`, []);\n\n const rangeValues = React.useMemo(() => {\n if (multiple === true) return value;\n return [value] as [number];\n }, [multiple, value]);\n\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n const tickMarkPositions = useTickMarksValues(propsWithDefault);\n\n // ===========================================================================\n // VALIDATE PROPS\n // ===========================================================================\n useValidateProps(propsWithDefault, DSSliderV2PropTypes, { tickMarkPositions });\n\n const ownerPropConfig = useOwnerProps(propsWithDefault);\n const [hasUserInteractedAfterFocus, setHasUserInteractedAfterFocus] = React.useState(false);\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n xstyledProps,\n instanceUid,\n rangeValues,\n tickMarkPositions,\n hasUserInteractedAfterFocus,\n setHasUserInteractedAfterFocus,\n ...ownerPropConfig,\n }),\n [\n propsWithDefault,\n xstyledProps,\n instanceUid,\n rangeValues,\n tickMarkPositions,\n hasUserInteractedAfterFocus,\n ownerPropConfig,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAElB,8BAAgF;AAChF,iBAAoB;AACpB,mCAAoE;AACpE,8BAAiC;AACjC,gCAAmC;AAc5B,MAAM,cAAc,CAAC,kBAAqC;AAI/D,QAAM,uBAAmB,sDAAwD,eAAe,yCAAY;AAE5G,QAAM,EAAE,UAAU,MAAM,IAAI;AAK5B,QAAM,mBAAe,4CAAmB,gBAAgB;AAIxD,QAAM,cAAc,aAAAA,QAAM,QAAQ,MAAM,iBAAa,gBAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AAEjE,QAAM,cAAc,aAAAA,QAAM,QAAQ,MAAM;AACtC,QAAI,aAAa,KAAM,QAAO;AAC9B,WAAO,CAAC,KAAK;AAAA,EACf,GAAG,CAAC,UAAU,KAAK,CAAC;AAKpB,QAAM,wBAAoB,8CAAmB,gBAAgB;AAK7D,gDAAiB,kBAAkB,kDAAqB,EAAE,kBAAkB,CAAC;AAE7E,QAAM,sBAAkB,uCAAc,gBAAgB;AACtD,QAAM,CAAC,6BAA6B,8BAA8B,IAAI,aAAAA,QAAM,SAAS,KAAK;AAE1F,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useTickMarksValues.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport type { DSSliderV2T } from '../react-desc-prop-types.js';\n\n// Tick mark values will be generated from the minValue, maxValue and step props\nconst getDefaultTickMarksValues = ({\n minValue,\n maxValue,\n step,\n}: {\n minValue: number;\n maxValue: number;\n step: number;\n}) => {\n const parsedValuesArray: number[] = [];\n for (let value = minValue; value <= maxValue; value += step) {\n parsedValuesArray.push(value);\n }\n return parsedValuesArray;\n};\n\nexport const useTickMarksValues =
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAIlB,MAAM,4BAA4B,CAAC;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AACF,MAIM;AACJ,QAAM,oBAA8B,CAAC;AACrC,WAAS,QAAQ,UAAU,SAAS,UAAU,SAAS,MAAM;AAC3D,sBAAkB,KAAK,KAAK;AAAA,EAC9B;AACA,SAAO;AACT;AAEO,MAAM,qBAAqB,
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport type { DSSliderV2T } from '../react-desc-prop-types.js';\n\n// Tick mark values will be generated from the minValue, maxValue and step props\nconst getDefaultTickMarksValues = ({\n minValue,\n maxValue,\n step,\n}: {\n minValue: number;\n maxValue: number;\n step: number;\n}) => {\n const parsedValuesArray: number[] = [];\n for (let value = minValue; value <= maxValue; value += step) {\n parsedValuesArray.push(value);\n }\n return parsedValuesArray;\n};\n\nexport const useTickMarksValues = (props: DSSliderV2T.InternalProps) => {\n const { minValue, maxValue, step } = props;\n return React.useMemo(() => getDefaultTickMarksValues({ minValue, maxValue, step }), [maxValue, minValue, step]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAIlB,MAAM,4BAA4B,CAAC;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AACF,MAIM;AACJ,QAAM,oBAA8B,CAAC;AACrC,WAAS,QAAQ,UAAU,SAAS,UAAU,SAAS,MAAM;AAC3D,sBAAkB,KAAK,KAAK;AAAA,EAC9B;AACA,SAAO;AACT;AAEO,MAAM,qBAAqB,CAAC,UAAqC;AACtE,QAAM,EAAE,UAAU,UAAU,KAAK,IAAI;AACrC,SAAO,aAAAA,QAAM,QAAQ,MAAM,0BAA0B,EAAE,UAAU,UAAU,KAAK,CAAC,GAAG,CAAC,UAAU,UAAU,IAAI,CAAC;AAChH;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -41,5 +41,18 @@ const useValidateProps = (props, propTypes, { tickMarkPositions }) => {
|
|
|
41
41
|
`The length of the customTickMarksValues prop must be equal to the length of the tickMarkPositions array (${tickMarkPositions.length}).`
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
|
+
if (props.multiple === false && Array.isArray(props.value) || props.multiple === true && !Array.isArray(props.value)) {
|
|
45
|
+
throw new Error(
|
|
46
|
+
`The "multiple" prop must match the value contract exactly. Received "multiple": ${props.multiple}, value: ${JSON.stringify(props.value)}. Either the value must not be an array, or the flag should be true.`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
if (props.minRange && props.step && props.minRange % props.step !== 0) {
|
|
50
|
+
console.warn(`The minRange prop (${props.minRange}) must be perfectly divisible by the step prop (${props.step}).`);
|
|
51
|
+
}
|
|
52
|
+
if (props.minRange && props.minRange > props.maxValue - props.minValue) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
`The minRange prop (${props.minRange}) must be within the feasable range selection, maxValue(${props.maxValue}) - minValue(${props.minValue}) = ${props.maxValue - props.minValue}).`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
44
57
|
};
|
|
45
58
|
//# sourceMappingURL=useValidateProps.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useValidateProps.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable no-console */\nimport { useValidateTypescriptPropTypes, type ValidationMap } from '@elliemae/ds-props-helpers';\nimport { type DSSliderV2T } from '../react-desc-prop-types.js';\nimport { DSSliderV2Name } from '../constants/index.js';\n\nexport const useValidateProps = (\n props: DSSliderV2T.InternalProps,\n propTypes: ValidationMap<unknown>,\n { tickMarkPositions }: { tickMarkPositions: number[] },\n): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSSliderV2Name);\n\n if (props.customTickMarksValues.length && props.customTickMarksValues.length !== tickMarkPositions.length) {\n throw new Error(\n `The length of the customTickMarksValues prop must be equal to the length of the tickMarkPositions array (${tickMarkPositions.length}).`,\n );\n }\n\n // Our polymorphism requires the flag to match the value, if props.multiple is false, value can not be [number,number], it will break the internals assumptions and the contract.\n if (\n (props.multiple === false && Array.isArray(props.value)) ||\n (props.multiple === true && !Array.isArray(props.value))\n ) {\n throw new Error(\n `The \"multiple\" prop must match the value contract exactly. Received \"multiple\": ${props.multiple}, value: ${JSON.stringify(props.value)}. Either the value must not be an array, or the flag should be true.`,\n );\n }\n\n // Introducing the `minRange` props, we want to have a warning for final users if they happen to provide a min range that is not perfectly divisible by the step value\n // this is not an hard error because\n // - minRange 9, step 10 can still be coherently mathematically and logically described, is consistent and predictable even if strange and maybe confusing\n // - minRange 11, step 10 can still be coherently mathematically and logically described, is consistent and predictable even if strange and maybe confusing\n // a warning instead of an hard stop here makes sense.\n if (props.minRange && props.step && props.minRange % props.step !== 0) {\n console.warn(`The minRange prop (${props.minRange}) must be perfectly divisible by the step prop (${props.step}).`);\n }\n // We want to make sure the minRange is withing the min and max values, as defining a minRange above the maximum available space is a logic fallacy that needs adressing\n // this is an hard error because there is no hard truth that can be objectively enforced\n // some may say \"I think maxValue should win\" and other may say \"minRange is the metric to enforce\"\n // opinions are the killers of predictability and maintainability and scaling. The only opinion here is, if you want to enforce either, you configure the value accordingly.\n if (props.minRange && props.minRange > props.maxValue - props.minValue) {\n throw new Error(\n `The minRange prop (${props.minRange}) must be within the feasable range selection, maxValue(${props.maxValue}) - minValue(${props.minValue}) = ${props.maxValue - props.minValue}).`,\n );\n }\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAAmE;AAEnE,uBAA+B;AAExB,MAAM,mBAAmB,CAC9B,OACA,WACA,EAAE,kBAAkB,MACX;AAET,8DAA+B,OAAO,WAAW,+BAAc;AAE/D,MAAI,MAAM,sBAAsB,UAAU,MAAM,sBAAsB,WAAW,kBAAkB,QAAQ;AACzG,UAAM,IAAI;AAAA,MACR,4GAA4G,kBAAkB,MAAM;AAAA,IACtI;AAAA,EACF;AAGA,MACG,MAAM,aAAa,SAAS,MAAM,QAAQ,MAAM,KAAK,KACrD,MAAM,aAAa,QAAQ,CAAC,MAAM,QAAQ,MAAM,KAAK,GACtD;AACA,UAAM,IAAI;AAAA,MACR,mFAAmF,MAAM,QAAQ,YAAY,KAAK,UAAU,MAAM,KAAK,CAAC;AAAA,IAC1I;AAAA,EACF;AAOA,MAAI,MAAM,YAAY,MAAM,QAAQ,MAAM,WAAW,MAAM,SAAS,GAAG;AACrE,YAAQ,KAAK,sBAAsB,MAAM,QAAQ,mDAAmD,MAAM,IAAI,IAAI;AAAA,EACpH;AAKA,MAAI,MAAM,YAAY,MAAM,WAAW,MAAM,WAAW,MAAM,UAAU;AACtE,UAAM,IAAI;AAAA,MACR,sBAAsB,MAAM,QAAQ,2DAA2D,MAAM,QAAQ,gBAAgB,MAAM,QAAQ,OAAO,MAAM,WAAW,MAAM,QAAQ;AAAA,IACnL;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/package.json
CHANGED
|
@@ -36,12 +36,27 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
36
36
|
var import_react = require("react");
|
|
37
37
|
var import_react_range = require("react-range");
|
|
38
38
|
var import_DSSliderV2CTX = __toESM(require("../DSSliderV2CTX.js"));
|
|
39
|
-
var import_styles = require("
|
|
40
|
-
var import_Track = require("./Track.js");
|
|
39
|
+
var import_styles = require("./styles.js");
|
|
41
40
|
var import_Thumb = require("./Thumb.js");
|
|
41
|
+
var import_Track = require("./Track.js");
|
|
42
|
+
const isMultipleOnChangeCallback = (values, onValueChange) => Array.isArray(values) && values.length !== 1;
|
|
43
|
+
const renderTrack = (args) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Track.Track, { ...args });
|
|
44
|
+
const renderThumb = ({ props: { key }, props, ...args }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Thumb.Thumb, { props, ...args }, key);
|
|
45
|
+
const wrapperRows = ["auto", "auto"];
|
|
46
|
+
const rangeWrapperRows = ["28px", "auto"];
|
|
42
47
|
const MainContent = () => {
|
|
43
48
|
const {
|
|
44
|
-
propsWithDefault: {
|
|
49
|
+
propsWithDefault: {
|
|
50
|
+
step,
|
|
51
|
+
minValue,
|
|
52
|
+
maxValue,
|
|
53
|
+
disabled,
|
|
54
|
+
applyAriaDisabled,
|
|
55
|
+
readOnly,
|
|
56
|
+
onValueChange,
|
|
57
|
+
className,
|
|
58
|
+
minRange
|
|
59
|
+
},
|
|
45
60
|
xstyledProps,
|
|
46
61
|
rangeValues,
|
|
47
62
|
getOwnerProps,
|
|
@@ -49,12 +64,28 @@ const MainContent = () => {
|
|
|
49
64
|
setHasUserInteractedAfterFocus,
|
|
50
65
|
hasUserInteractedAfterFocus
|
|
51
66
|
} = (0, import_react.useContext)(import_DSSliderV2CTX.default);
|
|
67
|
+
const handleOnChange = (0, import_react.useCallback)(
|
|
68
|
+
(values) => {
|
|
69
|
+
if (applyAriaDisabled || readOnly) return;
|
|
70
|
+
if (isMultipleOnChangeCallback(values, onValueChange)) {
|
|
71
|
+
const [newMin, newMax] = values;
|
|
72
|
+
const newRange = newMax - newMin;
|
|
73
|
+
if (newRange >= (minRange ?? 0)) onValueChange(values);
|
|
74
|
+
} else {
|
|
75
|
+
onValueChange(values[0]);
|
|
76
|
+
}
|
|
77
|
+
if (!hasUserInteractedAfterFocus) {
|
|
78
|
+
setHasUserInteractedAfterFocus(true);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
[applyAriaDisabled, hasUserInteractedAfterFocus, onValueChange, readOnly, setHasUserInteractedAfterFocus, minRange]
|
|
82
|
+
);
|
|
52
83
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
84
|
import_styles.StyledWrapper,
|
|
54
85
|
{
|
|
55
86
|
width: "100%",
|
|
56
87
|
alignItems: "center",
|
|
57
|
-
rows:
|
|
88
|
+
rows: wrapperRows,
|
|
58
89
|
getOwnerProps,
|
|
59
90
|
getOwnerPropsArguments,
|
|
60
91
|
className,
|
|
@@ -62,7 +93,7 @@ const MainContent = () => {
|
|
|
62
93
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
63
94
|
import_styles.StyledRangeWrapper,
|
|
64
95
|
{
|
|
65
|
-
rows:
|
|
96
|
+
rows: rangeWrapperRows,
|
|
66
97
|
alignItems: "center",
|
|
67
98
|
margin: "0 16px",
|
|
68
99
|
minHeight: "28px",
|
|
@@ -76,20 +107,10 @@ const MainContent = () => {
|
|
|
76
107
|
max: maxValue,
|
|
77
108
|
values: rangeValues,
|
|
78
109
|
disabled,
|
|
79
|
-
onChange:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
} else {
|
|
84
|
-
onValueChange(values);
|
|
85
|
-
}
|
|
86
|
-
if (!hasUserInteractedAfterFocus) {
|
|
87
|
-
setHasUserInteractedAfterFocus(true);
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
renderTrack: (args) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Track.Track, { ...args }),
|
|
91
|
-
renderThumb: (args) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Thumb.Thumb, { ...args }),
|
|
92
|
-
allowOverlap: true,
|
|
110
|
+
onChange: handleOnChange,
|
|
111
|
+
renderTrack,
|
|
112
|
+
renderThumb,
|
|
113
|
+
allowOverlap: false,
|
|
93
114
|
draggableTrack: true
|
|
94
115
|
}
|
|
95
116
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/MainContent.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useContext } from 'react';\nimport { Range } from 'react-range';\nimport DSSliderV2Context from '../DSSliderV2CTX.js';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import { useContext, useCallback } from 'react';\nimport { Range } from 'react-range';\nimport type { IRenderThumbParams, IRenderTrackParams } from 'react-range/lib/types.js';\nimport DSSliderV2Context from '../DSSliderV2CTX.js';\nimport type { DSSliderV2T } from '../react-desc-prop-types.js';\nimport { StyledRangeWrapper, StyledWrapper } from './styles.js';\nimport { Thumb } from './Thumb.js';\nimport { Track } from './Track.js';\n\n// typeguard, making the same assumption the previous version was making: if the values are an array, the user must be expecting a multiple slider value onchange\nconst isMultipleOnChangeCallback = (\n values: unknown,\n onValueChange: unknown,\n): onValueChange is DSSliderV2T.PropsMultiple['onValueChange'] => Array.isArray(values) && values.length !== 1;\n\n// DO NOT CAPITALIZE THIS TWO VARIABLES\n// react-range DO NOT WANT COMPONENTS, IT WANTS FUNCTIONS\n// IF THIS GETS CAPITALIZED, THE COMPILER WILL CONVERT IT TO A COMPONENT\n// AND THEN YOU GET \"hooks can only be used inside the body of a component\" ERROR\nconst renderTrack = (args: IRenderTrackParams) => <Track {...args} />;\nconst renderThumb = ({ props: { key }, props, ...args }: IRenderThumbParams) => (\n <Thumb key={key} props={props} {...args} />\n);\n\nconst wrapperRows = ['auto', 'auto'];\nconst rangeWrapperRows = ['28px', 'auto'];\nexport const MainContent = () => {\n const {\n propsWithDefault: {\n step,\n minValue,\n maxValue,\n disabled,\n applyAriaDisabled,\n readOnly,\n onValueChange,\n className,\n minRange,\n },\n xstyledProps,\n rangeValues,\n getOwnerProps,\n getOwnerPropsArguments,\n setHasUserInteractedAfterFocus,\n hasUserInteractedAfterFocus,\n } = useContext(DSSliderV2Context);\n\n const handleOnChange = useCallback<Range['props']['onChange']>(\n (values) => {\n if (applyAriaDisabled || readOnly) return;\n if (isMultipleOnChangeCallback(values, onValueChange)) {\n const [newMin, newMax] = values;\n const newRange = newMax - newMin;\n if (newRange >= (minRange ?? 0)) onValueChange(values as [number, number]);\n } else {\n onValueChange(values[0]);\n }\n if (!hasUserInteractedAfterFocus) {\n setHasUserInteractedAfterFocus(true);\n }\n },\n [applyAriaDisabled, hasUserInteractedAfterFocus, onValueChange, readOnly, setHasUserInteractedAfterFocus, minRange],\n );\n\n return (\n <StyledWrapper\n width=\"100%\"\n alignItems=\"center\"\n rows={wrapperRows}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n className={className}\n {...xstyledProps}\n >\n <StyledRangeWrapper\n rows={rangeWrapperRows}\n alignItems=\"center\"\n margin=\"0 16px\"\n minHeight=\"28px\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <Range\n step={step}\n min={minValue}\n max={maxValue}\n values={rangeValues}\n disabled={disabled}\n onChange={handleOnChange}\n renderTrack={renderTrack}\n renderThumb={renderThumb}\n allowOverlap={false}\n draggableTrack\n />\n </StyledRangeWrapper>\n </StyledWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmB2B;AAnBlD,mBAAwC;AACxC,yBAAsB;AAEtB,2BAA8B;AAE9B,oBAAkD;AAClD,mBAAsB;AACtB,mBAAsB;AAGtB,MAAM,6BAA6B,CACjC,QACA,kBACgE,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW;AAM7G,MAAM,cAAc,CAAC,SAA6B,4CAAC,sBAAO,GAAG,MAAM;AACnE,MAAM,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,GAAG,OAAO,GAAG,KAAK,MACpD,4CAAC,sBAAgB,OAAe,GAAG,QAAvB,GAA6B;AAG3C,MAAM,cAAc,CAAC,QAAQ,MAAM;AACnC,MAAM,mBAAmB,CAAC,QAAQ,MAAM;AACjC,MAAM,cAAc,MAAM;AAC/B,QAAM;AAAA,IACJ,kBAAkB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,qBAAAA,OAAiB;AAEhC,QAAM,qBAAiB;AAAA,IACrB,CAAC,WAAW;AACV,UAAI,qBAAqB,SAAU;AACnC,UAAI,2BAA2B,QAAQ,aAAa,GAAG;AACrD,cAAM,CAAC,QAAQ,MAAM,IAAI;AACzB,cAAM,WAAW,SAAS;AAC1B,YAAI,aAAa,YAAY,GAAI,eAAc,MAA0B;AAAA,MAC3E,OAAO;AACL,sBAAc,OAAO,CAAC,CAAC;AAAA,MACzB;AACA,UAAI,CAAC,6BAA6B;AAChC,uCAA+B,IAAI;AAAA,MACrC;AAAA,IACF;AAAA,IACA,CAAC,mBAAmB,6BAA6B,eAAe,UAAU,gCAAgC,QAAQ;AAAA,EACpH;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,YAAW;AAAA,MACX,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,YAAW;AAAA,UACX,QAAO;AAAA,UACP,WAAU;AAAA,UACV;AAAA,UACA;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,KAAK;AAAA,cACL,KAAK;AAAA,cACL,QAAQ;AAAA,cACR;AAAA,cACA,UAAU;AAAA,cACV;AAAA,cACA;AAAA,cACA,cAAc;AAAA,cACd,gBAAc;AAAA;AAAA,UAChB;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": ["DSSliderV2Context"]
|
|
7
7
|
}
|
package/dist/cjs/parts/Thumb.js
CHANGED
|
@@ -28,17 +28,29 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var Thumb_exports = {};
|
|
30
30
|
__export(Thumb_exports, {
|
|
31
|
-
Thumb: () => Thumb
|
|
31
|
+
Thumb: () => Thumb,
|
|
32
|
+
conformedThumbLabel: () => conformedThumbLabel
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(Thumb_exports);
|
|
34
35
|
var React = __toESM(require("react"));
|
|
35
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var import_react = require("react");
|
|
37
37
|
var import_ds_tooltip_v3 = require("@elliemae/ds-tooltip-v3");
|
|
38
|
-
var
|
|
39
|
-
var import_styles = require("../styles.js");
|
|
38
|
+
var import_react = require("react");
|
|
40
39
|
var import_DSSliderV2CTX = __toESM(require("../DSSliderV2CTX.js"));
|
|
41
|
-
|
|
40
|
+
var import_styles = require("./styles.js");
|
|
41
|
+
const conformedThumbLabel = (config) => {
|
|
42
|
+
const { rangeValues, customTickMarksValues, index, step, minValue } = config;
|
|
43
|
+
let msg = `Value: `;
|
|
44
|
+
if (customTickMarksValues.length) {
|
|
45
|
+
const foundValue = customTickMarksValues[Math.floor((rangeValues[index] - minValue) / step)];
|
|
46
|
+
msg += `${foundValue ?? rangeValues[index].toFixed(1)}`;
|
|
47
|
+
} else {
|
|
48
|
+
msg += `${rangeValues[index].toFixed(1)}`;
|
|
49
|
+
}
|
|
50
|
+
return msg;
|
|
51
|
+
};
|
|
52
|
+
const spanStyle = { height: 20, width: 20 };
|
|
53
|
+
const Thumb = ({ index, props: reactRangeOpinionatedProps, isDragged }) => {
|
|
42
54
|
const {
|
|
43
55
|
propsWithDefault: { disabled, applyAriaDisabled, readOnly, customTickMarksValues, step, minValue },
|
|
44
56
|
rangeValues,
|
|
@@ -49,17 +61,16 @@ const Thumb = ({ index, props, isDragged }) => {
|
|
|
49
61
|
const [isHovered, setIsHovered] = (0, import_react.useState)(false);
|
|
50
62
|
const [isFocused, setIsFocused] = (0, import_react.useState)(false);
|
|
51
63
|
const [isTooltipDismissed, setIsTooltipDismissed] = (0, import_react.useState)(false);
|
|
52
|
-
const {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
);
|
|
64
|
+
const {
|
|
65
|
+
ref,
|
|
66
|
+
style: thumbStyle,
|
|
67
|
+
key: unusedKeyDueToLibTypescriptIssues,
|
|
68
|
+
onKeyDown: reactRangeOnKeyDownHandler,
|
|
69
|
+
onKeyUp: reactRangeOnKeyUpHandler,
|
|
70
|
+
...propsFromReactRangeTookAsIs
|
|
71
|
+
} = reactRangeOpinionatedProps;
|
|
72
|
+
const showPopover = (isDragged || isHovered || isFocused) && !isTooltipDismissed;
|
|
73
|
+
const label = conformedThumbLabel({ rangeValues, customTickMarksValues, index, step, minValue });
|
|
63
74
|
const getOwnerPropsArguments = (0, import_react.useCallback)(
|
|
64
75
|
() => ({
|
|
65
76
|
index,
|
|
@@ -67,43 +78,65 @@ const Thumb = ({ index, props, isDragged }) => {
|
|
|
67
78
|
}),
|
|
68
79
|
[index, hasUserInteractedAfterFocus]
|
|
69
80
|
);
|
|
70
|
-
const
|
|
81
|
+
const sanitizedStyle = (0, import_react.useMemo)(() => {
|
|
82
|
+
const { zIndex, ...libInherithedStyles } = thumbStyle;
|
|
83
|
+
if (disabled || applyAriaDisabled || readOnly) return { ...libInherithedStyles, cursor: "not-allowed" };
|
|
84
|
+
return libInherithedStyles;
|
|
85
|
+
}, [applyAriaDisabled, disabled, readOnly, thumbStyle]);
|
|
86
|
+
const handleMouseEnter = (0, import_react.useCallback)(() => {
|
|
87
|
+
setIsHovered(true);
|
|
88
|
+
setIsFocused(false);
|
|
89
|
+
setIsTooltipDismissed(false);
|
|
90
|
+
}, []);
|
|
91
|
+
const handleMouseLeave = (0, import_react.useCallback)(() => {
|
|
92
|
+
setIsHovered(false);
|
|
93
|
+
}, []);
|
|
94
|
+
const handleKeyDown = (0, import_react.useCallback)(
|
|
95
|
+
(e) => {
|
|
96
|
+
reactRangeOnKeyDownHandler?.(e);
|
|
97
|
+
if (e.key === "Escape" && showPopover) {
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
setIsTooltipDismissed(true);
|
|
100
|
+
setIsFocused(true);
|
|
101
|
+
} else {
|
|
102
|
+
setIsTooltipDismissed(false);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
[showPopover, reactRangeOnKeyDownHandler]
|
|
106
|
+
);
|
|
107
|
+
const handleKeyUp = (0, import_react.useCallback)(
|
|
108
|
+
(e) => {
|
|
109
|
+
reactRangeOnKeyUpHandler?.(e);
|
|
110
|
+
},
|
|
111
|
+
[reactRangeOnKeyUpHandler]
|
|
112
|
+
);
|
|
113
|
+
const handleFocus = (0, import_react.useCallback)(() => {
|
|
114
|
+
setIsFocused(true);
|
|
115
|
+
setIsTooltipDismissed(false);
|
|
116
|
+
}, []);
|
|
117
|
+
const handleBlur = (0, import_react.useCallback)(() => {
|
|
118
|
+
setIsFocused(false);
|
|
119
|
+
setHasUserInteractedAfterFocus(false);
|
|
120
|
+
}, [setHasUserInteractedAfterFocus]);
|
|
71
121
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
122
|
import_styles.StyledThumb,
|
|
73
123
|
{
|
|
74
|
-
...
|
|
75
|
-
style:
|
|
124
|
+
...propsFromReactRangeTookAsIs,
|
|
125
|
+
style: sanitizedStyle,
|
|
76
126
|
innerRef: ref,
|
|
77
127
|
disabled,
|
|
78
|
-
applyAriaDisabled: applyAriaDisabled
|
|
79
|
-
|
|
80
|
-
"aria-
|
|
81
|
-
onMouseEnter:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
onKeyDownCapture: (e) => {
|
|
88
|
-
if (e.key === "Escape" && showPopover) {
|
|
89
|
-
e.stopPropagation();
|
|
90
|
-
setIsTooltipDismissed(true);
|
|
91
|
-
} else {
|
|
92
|
-
setIsFocused(true);
|
|
93
|
-
setIsTooltipDismissed(false);
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
onFocus: () => {
|
|
97
|
-
setIsFocused(true);
|
|
98
|
-
setIsTooltipDismissed(false);
|
|
99
|
-
},
|
|
100
|
-
onBlur: () => {
|
|
101
|
-
setIsFocused(false);
|
|
102
|
-
setHasUserInteractedAfterFocus(false);
|
|
103
|
-
},
|
|
128
|
+
$applyAriaDisabled: applyAriaDisabled,
|
|
129
|
+
$readOnly: readOnly,
|
|
130
|
+
"aria-disabled": applyAriaDisabled || readOnly,
|
|
131
|
+
onMouseEnter: handleMouseEnter,
|
|
132
|
+
onMouseLeave: handleMouseLeave,
|
|
133
|
+
onKeyDown: handleKeyDown,
|
|
134
|
+
onKeyUp: handleKeyUp,
|
|
135
|
+
onFocus: handleFocus,
|
|
136
|
+
onBlur: handleBlur,
|
|
104
137
|
getOwnerProps,
|
|
105
138
|
getOwnerPropsArguments,
|
|
106
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_tooltip_v3.DSTooltipV3, { text: label, showPopover, withoutAnimation: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style:
|
|
139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_tooltip_v3.DSTooltipV3, { text: label, showPopover, withoutAnimation: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: spanStyle }) }, label)
|
|
107
140
|
}
|
|
108
141
|
);
|
|
109
142
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/Thumb.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import { DSTooltipV3 } from '@elliemae/ds-tooltip-v3';\nimport { useCallback, useContext, useMemo, useState } from 'react';\nimport type { IRenderThumbParams } from 'react-range/lib/types.js';\nimport DSSliderV2Context from '../DSSliderV2CTX.js';\nimport { StyledThumb } from './styles.js';\n\nexport const conformedThumbLabel = (config: {\n rangeValues: [number] | [number, number];\n customTickMarksValues: string[];\n index: number;\n step: number;\n minValue: number;\n}) => {\n const { rangeValues, customTickMarksValues, index, step, minValue } = config;\n let msg = `Value: `;\n if (customTickMarksValues.length) {\n const foundValue = customTickMarksValues[Math.floor((rangeValues[index] - minValue) / step)];\n msg += `${foundValue ?? rangeValues[index].toFixed(1)}`;\n } else {\n msg += `${rangeValues[index].toFixed(1)}`;\n }\n\n return msg;\n};\n\nconst spanStyle = { height: 20, width: 20 };\n\nexport const Thumb = ({ index, props: reactRangeOpinionatedProps, isDragged }: Omit<IRenderThumbParams, 'key'>) => {\n const {\n propsWithDefault: { disabled, applyAriaDisabled, readOnly, customTickMarksValues, step, minValue },\n rangeValues,\n getOwnerProps,\n hasUserInteractedAfterFocus,\n setHasUserInteractedAfterFocus,\n } = useContext(DSSliderV2Context);\n\n const [isHovered, setIsHovered] = useState(false);\n const [isFocused, setIsFocused] = useState(false);\n const [isTooltipDismissed, setIsTooltipDismissed] = useState(false);\n\n const {\n ref,\n style: thumbStyle,\n key: unusedKeyDueToLibTypescriptIssues,\n onKeyDown: reactRangeOnKeyDownHandler,\n onKeyUp: reactRangeOnKeyUpHandler,\n ...propsFromReactRangeTookAsIs\n } = reactRangeOpinionatedProps;\n const showPopover = (isDragged || isHovered || isFocused) && !isTooltipDismissed;\n\n const label = conformedThumbLabel({ rangeValues, customTickMarksValues, index, step, minValue });\n\n const getOwnerPropsArguments = useCallback(\n () => ({\n index,\n shouldUseExtendedAriaValueText: !hasUserInteractedAfterFocus,\n }),\n [index, hasUserInteractedAfterFocus],\n );\n\n const sanitizedStyle = useMemo(() => {\n // as per https://jira.elliemae.io/browse/PUI-14390 and https://github.com/intcx/PLATFORM-UI.dimsum/pull/7046\n // we also want z-index: ${(props) => props.theme.zIndex.tooltip}; from the theme\n // I keep the same, just refactoring so the styles concerns are part of the styled component as expected\n // my understanding is that libInherithedStyles main purposes are:\n // - to position the element on the track with a transform: translate\n // - to handle the cursor:grab/grabbing based on interaction state\n const { zIndex, ...libInherithedStyles } = thumbStyle;\n // we want to keep the cursor grab/grabbing thing, but we want our own \"disabled\" cursor...\n if (disabled || applyAriaDisabled || readOnly) return { ...libInherithedStyles, cursor: 'not-allowed' };\n return libInherithedStyles;\n }, [applyAriaDisabled, disabled, readOnly, thumbStyle]);\n\n const handleMouseEnter = useCallback<React.MouseEventHandler<HTMLDivElement>>(() => {\n setIsHovered(true);\n setIsFocused(false);\n setIsTooltipDismissed(false);\n }, []);\n const handleMouseLeave = useCallback<React.MouseEventHandler<HTMLDivElement>>(() => {\n setIsHovered(false);\n }, []);\n\n const handleKeyDown = useCallback<React.KeyboardEventHandler<HTMLDivElement>>(\n (e) => {\n reactRangeOnKeyDownHandler?.(e);\n if (e.key === 'Escape' && showPopover) {\n // stoping propagation here is load-bearing\n // we are checking \"showPopover\" because if \"the popover exist\" it means the tooltip exist\n // if it exist and we are in a dialog, the first esc needs to close the tooltip, not the dialog.\n e.stopPropagation();\n setIsTooltipDismissed(true);\n setIsFocused(true);\n } else {\n setIsTooltipDismissed(false);\n }\n },\n [showPopover, reactRangeOnKeyDownHandler],\n );\n const handleKeyUp = useCallback<React.KeyboardEventHandler<HTMLDivElement>>(\n (e) => {\n reactRangeOnKeyUpHandler?.(e);\n // if we need to do anything on keyup too, this is where we will do it.\n },\n [reactRangeOnKeyUpHandler],\n );\n const handleFocus = useCallback<React.FocusEventHandler<HTMLDivElement>>(() => {\n setIsFocused(true);\n setIsTooltipDismissed(false);\n }, []);\n const handleBlur = useCallback<React.FocusEventHandler<HTMLDivElement>>(() => {\n setIsFocused(false);\n setHasUserInteractedAfterFocus(false);\n }, [setHasUserInteractedAfterFocus]);\n\n return (\n <StyledThumb\n {...propsFromReactRangeTookAsIs}\n style={sanitizedStyle}\n innerRef={ref}\n disabled={disabled}\n $applyAriaDisabled={applyAriaDisabled}\n $readOnly={readOnly}\n // dicussed with SME on 13/jul/2026, even if role='slider' technically accepts aria-readonly\n // - SRs support for aria-readonly is loose\n // - having both aria-readonly and aria-disabled is a violation\n // - aria-disabled transmit the same interaction pattern\n // therefore, we will not set aria-readonly and will rely on aria-disabled to convey the interaction pattern\n // aria-readonly={readOnly}\n aria-disabled={applyAriaDisabled || readOnly} // || readOnly as per previous comment\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onKeyDown={handleKeyDown}\n onKeyUp={handleKeyUp}\n onFocus={handleFocus}\n onBlur={handleBlur}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <DSTooltipV3 key={label} text={label} showPopover={showPopover} withoutAnimation>\n <span style={spanStyle}></span>\n </DSTooltipV3>\n </StyledThumb>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["DSSliderV2Context"]
|
|
7
7
|
}
|
|
@@ -34,34 +34,17 @@ module.exports = __toCommonJS(TickMarks_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = require("react");
|
|
37
|
-
var import_styles = require("../styles.js");
|
|
38
|
-
var import_inRange = require("../utils/inRange.js");
|
|
39
37
|
var import_DSSliderV2CTX = __toESM(require("../DSSliderV2CTX.js"));
|
|
38
|
+
var import_styles = require("./styles.js");
|
|
40
39
|
const TickMarks = () => {
|
|
41
|
-
const {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const isActive = (0, import_inRange.inRange)(value, rangeValues);
|
|
51
|
-
dotsArr.push(
|
|
52
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
|
-
import_styles.StyledDot,
|
|
54
|
-
{
|
|
55
|
-
isActive,
|
|
56
|
-
getOwnerProps,
|
|
57
|
-
getOwnerPropsArguments
|
|
58
|
-
},
|
|
59
|
-
value
|
|
60
|
-
)
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
return dotsArr;
|
|
64
|
-
}, [getOwnerProps, getOwnerPropsArguments, maxValue, minValue, rangeValues, step]);
|
|
65
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledDotsContainer, { getOwnerProps, getOwnerPropsArguments, children: dots });
|
|
40
|
+
const { tickMarkPositions, instanceUid, getOwnerProps, getOwnerPropsArguments } = (0, import_react.useContext)(import_DSSliderV2CTX.default);
|
|
41
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledDotsContainer, { getOwnerProps, getOwnerPropsArguments, children: tickMarkPositions.map((val) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
42
|
+
import_styles.StyledDot,
|
|
43
|
+
{
|
|
44
|
+
getOwnerProps,
|
|
45
|
+
getOwnerPropsArguments
|
|
46
|
+
},
|
|
47
|
+
`${instanceUid}-track-dot-${val}`
|
|
48
|
+
)) });
|
|
66
49
|
};
|
|
67
50
|
//# sourceMappingURL=TickMarks.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/TickMarks.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/no-array-index-key */\nimport { useContext } from 'react';\nimport DSSliderV2Context from '../DSSliderV2CTX.js';\nimport { StyledDot, StyledDotsContainer } from './styles.js';\n\nexport const TickMarks = () => {\n const { tickMarkPositions, instanceUid, getOwnerProps, getOwnerPropsArguments } = useContext(DSSliderV2Context);\n\n return (\n <StyledDotsContainer getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n {tickMarkPositions.map((val) => (\n <StyledDot\n key={`${instanceUid}-track-dot-${val}`}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n ))}\n </StyledDotsContainer>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADWf;AAVR,mBAA2B;AAC3B,2BAA8B;AAC9B,oBAA+C;AAExC,MAAM,YAAY,MAAM;AAC7B,QAAM,EAAE,mBAAmB,aAAa,eAAe,uBAAuB,QAAI,yBAAW,qBAAAA,OAAiB;AAE9G,SACE,4CAAC,qCAAoB,eAA8B,wBAChD,4BAAkB,IAAI,CAAC,QACtB;AAAA,IAAC;AAAA;AAAA,MAEC;AAAA,MACA;AAAA;AAAA,IAFK,GAAG,WAAW,cAAc,GAAG;AAAA,EAGtC,CACD,GACH;AAEJ;",
|
|
6
6
|
"names": ["DSSliderV2Context"]
|
|
7
7
|
}
|
|
@@ -34,9 +34,9 @@ module.exports = __toCommonJS(TickMarksValues_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = require("react");
|
|
37
|
-
var import_styles = require("../styles.js");
|
|
38
|
-
var import_inRange = require("../utils/inRange.js");
|
|
39
37
|
var import_DSSliderV2CTX = __toESM(require("../DSSliderV2CTX.js"));
|
|
38
|
+
var import_inRange = require("../utils/inRange.js");
|
|
39
|
+
var import_styles = require("./styles.js");
|
|
40
40
|
const TickMarksValues = () => {
|
|
41
41
|
const {
|
|
42
42
|
propsWithDefault: { customTickMarksValues, maxValue, minValue },
|
|
@@ -51,22 +51,6 @@ const TickMarksValues = () => {
|
|
|
51
51
|
const calculatedColumnWidthPercentage = `${distanceBetweenDots / (maxValue - minValue) * 100}%`;
|
|
52
52
|
return { columnWidth: calculatedColumnWidthPercentage };
|
|
53
53
|
}, [maxValue, minValue, tickMarkPositions.length]);
|
|
54
|
-
const markValues = (0, import_react.useMemo)(
|
|
55
|
-
() => tickMarkPositions.map((value, index) => {
|
|
56
|
-
const isSelected = (0, import_inRange.inRange)(value, rangeValues);
|
|
57
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
-
import_styles.StyledTickMarkValue,
|
|
59
|
-
{
|
|
60
|
-
isSelected,
|
|
61
|
-
getOwnerProps,
|
|
62
|
-
getOwnerPropsArguments,
|
|
63
|
-
children: customTickMarksValues[index] ?? value
|
|
64
|
-
},
|
|
65
|
-
`${instanceUid}-${value}`
|
|
66
|
-
);
|
|
67
|
-
}),
|
|
68
|
-
[tickMarkPositions, rangeValues, instanceUid, getOwnerProps, getOwnerPropsArguments, customTickMarksValues]
|
|
69
|
-
);
|
|
70
54
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
55
|
import_styles.StyledTickMarksContainer,
|
|
72
56
|
{
|
|
@@ -74,7 +58,19 @@ const TickMarksValues = () => {
|
|
|
74
58
|
getOwnerPropsArguments,
|
|
75
59
|
columnCount: tickMarkPositions.length,
|
|
76
60
|
columnWidth,
|
|
77
|
-
children:
|
|
61
|
+
children: tickMarkPositions.map((value, index) => {
|
|
62
|
+
const isSelected = (0, import_inRange.inRange)(value, rangeValues);
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
import_styles.StyledTickMarkValue,
|
|
65
|
+
{
|
|
66
|
+
isSelected,
|
|
67
|
+
getOwnerProps,
|
|
68
|
+
getOwnerPropsArguments,
|
|
69
|
+
children: customTickMarksValues[index] ?? value
|
|
70
|
+
},
|
|
71
|
+
`${instanceUid}-${value}`
|
|
72
|
+
);
|
|
73
|
+
})
|
|
78
74
|
}
|
|
79
75
|
);
|
|
80
76
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/TickMarksValues.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import { useContext, useMemo } from 'react';\nimport DSSliderV2Context from '../DSSliderV2CTX.js';\nimport { inRange } from '../utils/inRange.js';\nimport { StyledTickMarkValue, StyledTickMarksContainer } from './styles.js';\n\nexport const TickMarksValues = () => {\n const {\n propsWithDefault: { customTickMarksValues, maxValue, minValue },\n rangeValues,\n tickMarkPositions,\n instanceUid,\n getOwnerProps,\n getOwnerPropsArguments,\n } = useContext(DSSliderV2Context);\n\n const { columnWidth } = useMemo(() => {\n const distanceBetweenDots = (maxValue - minValue) / (tickMarkPositions.length - 1);\n const calculatedColumnWidthPercentage = `${(distanceBetweenDots / (maxValue - minValue)) * 100}%`;\n return { columnWidth: calculatedColumnWidthPercentage };\n }, [maxValue, minValue, tickMarkPositions.length]);\n\n return (\n <StyledTickMarksContainer\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n columnCount={tickMarkPositions.length}\n columnWidth={columnWidth}\n >\n {tickMarkPositions.map((value, index) => {\n const isSelected = inRange(value, rangeValues);\n\n return (\n <StyledTickMarkValue\n key={`${instanceUid}-${value}`}\n isSelected={isSelected}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {customTickMarksValues[index] ?? value}\n </StyledTickMarkValue>\n );\n })}\n </StyledTickMarksContainer>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgCb;AAhCV,mBAAoC;AACpC,2BAA8B;AAC9B,qBAAwB;AACxB,oBAA8D;AAEvD,MAAM,kBAAkB,MAAM;AACnC,QAAM;AAAA,IACJ,kBAAkB,EAAE,uBAAuB,UAAU,SAAS;AAAA,IAC9D;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,qBAAAA,OAAiB;AAEhC,QAAM,EAAE,YAAY,QAAI,sBAAQ,MAAM;AACpC,UAAM,uBAAuB,WAAW,aAAa,kBAAkB,SAAS;AAChF,UAAM,kCAAkC,GAAI,uBAAuB,WAAW,YAAa,GAAG;AAC9F,WAAO,EAAE,aAAa,gCAAgC;AAAA,EACxD,GAAG,CAAC,UAAU,UAAU,kBAAkB,MAAM,CAAC;AAEjD,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,aAAa,kBAAkB;AAAA,MAC/B;AAAA,MAEC,4BAAkB,IAAI,CAAC,OAAO,UAAU;AACvC,cAAM,iBAAa,wBAAQ,OAAO,WAAW;AAE7C,eACE;AAAA,UAAC;AAAA;AAAA,YAEC;AAAA,YACA;AAAA,YACA;AAAA,YAEC,gCAAsB,KAAK,KAAK;AAAA;AAAA,UAL5B,GAAG,WAAW,IAAI,KAAK;AAAA,QAM9B;AAAA,MAEJ,CAAC;AAAA;AAAA,EACH;AAEJ;",
|
|
6
6
|
"names": ["DSSliderV2Context"]
|
|
7
7
|
}
|