@elliemae/ds-slider-v2 3.80.0-next.2 → 3.80.0-next.22
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/config/useSliderV2.js +8 -0
- package/dist/cjs/config/useSliderV2.js.map +2 -2
- package/dist/cjs/parts/Thumb.js +14 -7
- package/dist/cjs/parts/Thumb.js.map +2 -2
- package/dist/cjs/parts/TickMarksValues.js +3 -0
- package/dist/cjs/parts/TickMarksValues.js.map +2 -2
- package/dist/cjs/parts/Track.js +17 -3
- package/dist/cjs/parts/Track.js.map +2 -2
- package/dist/cjs/parts/styles.js +56 -33
- package/dist/cjs/parts/styles.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +5 -1
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-auto-polymorph-multiple.js +1 -0
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-auto-polymorph-multiple.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-auto-polymorph-single.js +2 -1
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-auto-polymorph-single.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-multiple.js +1 -0
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-multiple.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-single.js +2 -1
- package/dist/cjs/typescript-testing/typescript-slider-v2-valid-single.js.map +2 -2
- package/dist/esm/config/useSliderV2.js +8 -0
- package/dist/esm/config/useSliderV2.js.map +2 -2
- package/dist/esm/parts/Thumb.js +14 -7
- package/dist/esm/parts/Thumb.js.map +2 -2
- package/dist/esm/parts/TickMarksValues.js +3 -0
- package/dist/esm/parts/TickMarksValues.js.map +2 -2
- package/dist/esm/parts/Track.js +17 -3
- package/dist/esm/parts/Track.js.map +2 -2
- package/dist/esm/parts/styles.js +56 -33
- package/dist/esm/parts/styles.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +5 -1
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-auto-polymorph-multiple.js +1 -0
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-auto-polymorph-multiple.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-auto-polymorph-single.js +2 -1
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-auto-polymorph-single.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-multiple.js +1 -0
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-multiple.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-single.js +2 -1
- package/dist/esm/typescript-testing/typescript-slider-v2-valid-single.js.map +2 -2
- package/dist/types/config/useSliderV2.d.ts +8 -0
- package/dist/types/parts/styles.d.ts +6 -2
- package/dist/types/react-desc-prop-types.d.ts +1 -0
- package/package.json +11 -10
|
@@ -51,6 +51,8 @@ const useSliderV2 = (propsFromUser) => {
|
|
|
51
51
|
(0, import_useValidateProps.useValidateProps)(propsWithDefault, import_react_desc_prop_types.DSSliderV2PropTypes, { tickMarkPositions });
|
|
52
52
|
const ownerPropConfig = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefault);
|
|
53
53
|
const [hasUserInteractedAfterFocus, setHasUserInteractedAfterFocus] = import_react.default.useState(false);
|
|
54
|
+
const [isAnyThumbHovered, setIsAnyThumbHovered] = import_react.default.useState(false);
|
|
55
|
+
const [isAnyThumbFocused, setIsAnyThumbFocused] = import_react.default.useState(false);
|
|
54
56
|
return import_react.default.useMemo(
|
|
55
57
|
() => ({
|
|
56
58
|
propsWithDefault,
|
|
@@ -60,6 +62,10 @@ const useSliderV2 = (propsFromUser) => {
|
|
|
60
62
|
tickMarkPositions,
|
|
61
63
|
hasUserInteractedAfterFocus,
|
|
62
64
|
setHasUserInteractedAfterFocus,
|
|
65
|
+
isAnyThumbHovered,
|
|
66
|
+
setIsAnyThumbHovered,
|
|
67
|
+
isAnyThumbFocused,
|
|
68
|
+
setIsAnyThumbFocused,
|
|
63
69
|
...ownerPropConfig
|
|
64
70
|
}),
|
|
65
71
|
[
|
|
@@ -69,6 +75,8 @@ const useSliderV2 = (propsFromUser) => {
|
|
|
69
75
|
rangeValues,
|
|
70
76
|
tickMarkPositions,
|
|
71
77
|
hasUserInteractedAfterFocus,
|
|
78
|
+
isAnyThumbHovered,
|
|
79
|
+
isAnyThumbFocused,
|
|
72
80
|
ownerPropConfig
|
|
73
81
|
]
|
|
74
82
|
);
|
|
@@ -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 {\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;
|
|
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 // Spec v1.5.0 requires hover and focus on the handle to recolour the *active track segment* as\n // well. The track paints itself with a `getTrackBackground()` gradient computed at render, so a\n // CSS `:hover` on the thumb cannot reach it \u2014 the flags have to travel through this context for\n // Track to recompute. One flag pair for the whole slider, not per thumb: in range mode both\n // handles share a single active segment, so there is one surface to recolour.\n isAnyThumbHovered: boolean;\n setIsAnyThumbHovered: (value: boolean) => void;\n isAnyThumbFocused: boolean;\n setIsAnyThumbFocused: (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 const [isAnyThumbHovered, setIsAnyThumbHovered] = React.useState(false);\n const [isAnyThumbFocused, setIsAnyThumbFocused] = React.useState(false);\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n xstyledProps,\n instanceUid,\n rangeValues,\n tickMarkPositions,\n hasUserInteractedAfterFocus,\n setHasUserInteractedAfterFocus,\n isAnyThumbHovered,\n setIsAnyThumbHovered,\n isAnyThumbFocused,\n setIsAnyThumbFocused,\n ...ownerPropConfig,\n }),\n [\n propsWithDefault,\n xstyledProps,\n instanceUid,\n rangeValues,\n tickMarkPositions,\n hasUserInteractedAfterFocus,\n isAnyThumbHovered,\n isAnyThumbFocused,\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;AAuB5B,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;AAC1F,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,aAAAA,QAAM,SAAS,KAAK;AACtE,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,aAAAA,QAAM,SAAS,KAAK;AAEtE,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;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,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
package/dist/cjs/parts/Thumb.js
CHANGED
|
@@ -49,14 +49,16 @@ const conformedThumbLabel = (config) => {
|
|
|
49
49
|
}
|
|
50
50
|
return msg;
|
|
51
51
|
};
|
|
52
|
-
const spanStyle = { height: 20, width:
|
|
52
|
+
const spanStyle = { height: 20, width: 12 };
|
|
53
53
|
const Thumb = ({ index, props: reactRangeOpinionatedProps, isDragged }) => {
|
|
54
54
|
const {
|
|
55
|
-
propsWithDefault: { disabled, applyAriaDisabled, readOnly, customTickMarksValues, step, minValue },
|
|
55
|
+
propsWithDefault: { disabled, applyAriaDisabled, readOnly, hasError, customTickMarksValues, step, minValue },
|
|
56
56
|
rangeValues,
|
|
57
57
|
getOwnerProps,
|
|
58
58
|
hasUserInteractedAfterFocus,
|
|
59
|
-
setHasUserInteractedAfterFocus
|
|
59
|
+
setHasUserInteractedAfterFocus,
|
|
60
|
+
setIsAnyThumbHovered,
|
|
61
|
+
setIsAnyThumbFocused
|
|
60
62
|
} = (0, import_react.useContext)(import_DSSliderV2CTX.default);
|
|
61
63
|
const [isHovered, setIsHovered] = (0, import_react.useState)(false);
|
|
62
64
|
const [isFocused, setIsFocused] = (0, import_react.useState)(false);
|
|
@@ -87,10 +89,12 @@ const Thumb = ({ index, props: reactRangeOpinionatedProps, isDragged }) => {
|
|
|
87
89
|
setIsHovered(true);
|
|
88
90
|
setIsFocused(false);
|
|
89
91
|
setIsTooltipDismissed(false);
|
|
90
|
-
|
|
92
|
+
setIsAnyThumbHovered(true);
|
|
93
|
+
}, [setIsAnyThumbHovered]);
|
|
91
94
|
const handleMouseLeave = (0, import_react.useCallback)(() => {
|
|
92
95
|
setIsHovered(false);
|
|
93
|
-
|
|
96
|
+
setIsAnyThumbHovered(false);
|
|
97
|
+
}, [setIsAnyThumbHovered]);
|
|
94
98
|
const handleKeyDown = (0, import_react.useCallback)(
|
|
95
99
|
(e) => {
|
|
96
100
|
reactRangeOnKeyDownHandler?.(e);
|
|
@@ -113,11 +117,13 @@ const Thumb = ({ index, props: reactRangeOpinionatedProps, isDragged }) => {
|
|
|
113
117
|
const handleFocus = (0, import_react.useCallback)(() => {
|
|
114
118
|
setIsFocused(true);
|
|
115
119
|
setIsTooltipDismissed(false);
|
|
116
|
-
|
|
120
|
+
setIsAnyThumbFocused(true);
|
|
121
|
+
}, [setIsAnyThumbFocused]);
|
|
117
122
|
const handleBlur = (0, import_react.useCallback)(() => {
|
|
118
123
|
setIsFocused(false);
|
|
119
124
|
setHasUserInteractedAfterFocus(false);
|
|
120
|
-
|
|
125
|
+
setIsAnyThumbFocused(false);
|
|
126
|
+
}, [setHasUserInteractedAfterFocus, setIsAnyThumbFocused]);
|
|
121
127
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
122
128
|
import_styles.StyledThumb,
|
|
123
129
|
{
|
|
@@ -127,6 +133,7 @@ const Thumb = ({ index, props: reactRangeOpinionatedProps, isDragged }) => {
|
|
|
127
133
|
disabled,
|
|
128
134
|
$applyAriaDisabled: applyAriaDisabled,
|
|
129
135
|
$readOnly: readOnly,
|
|
136
|
+
$hasError: hasError,
|
|
130
137
|
"aria-disabled": applyAriaDisabled || readOnly,
|
|
131
138
|
onMouseEnter: handleMouseEnter,
|
|
132
139
|
onMouseLeave: handleMouseLeave,
|
|
@@ -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 { 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:
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;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\n// Matches the handle box from Spec v1.5.0 \u2014 this span is the tooltip's anchor and has to cover the\n// handle, not exceed it.\nconst spanStyle = { height: 20, width: 12 };\n\nexport const Thumb = ({ index, props: reactRangeOpinionatedProps, isDragged }: Omit<IRenderThumbParams, 'key'>) => {\n const {\n propsWithDefault: { disabled, applyAriaDisabled, readOnly, hasError, customTickMarksValues, step, minValue },\n rangeValues,\n getOwnerProps,\n hasUserInteractedAfterFocus,\n setHasUserInteractedAfterFocus,\n setIsAnyThumbHovered,\n setIsAnyThumbFocused,\n } = useContext(DSSliderV2Context);\n\n // Local state drives the tooltip, which is per handle. The context setters below mirror the same\n // transitions for the track, which is shared between handles in range mode.\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 setIsAnyThumbHovered(true);\n }, [setIsAnyThumbHovered]);\n const handleMouseLeave = useCallback<React.MouseEventHandler<HTMLDivElement>>(() => {\n setIsHovered(false);\n setIsAnyThumbHovered(false);\n }, [setIsAnyThumbHovered]);\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 setIsAnyThumbFocused(true);\n }, [setIsAnyThumbFocused]);\n const handleBlur = useCallback<React.FocusEventHandler<HTMLDivElement>>(() => {\n setIsFocused(false);\n setHasUserInteractedAfterFocus(false);\n setIsAnyThumbFocused(false);\n }, [setHasUserInteractedAfterFocus, setIsAnyThumbFocused]);\n\n return (\n <StyledThumb\n {...propsFromReactRangeTookAsIs}\n style={sanitizedStyle}\n innerRef={ref}\n disabled={disabled}\n $applyAriaDisabled={applyAriaDisabled}\n $readOnly={readOnly}\n $hasError={hasError}\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,6 +34,7 @@ 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_ds_typography = require("@elliemae/ds-typography");
|
|
37
38
|
var import_DSSliderV2CTX = __toESM(require("../DSSliderV2CTX.js"));
|
|
38
39
|
var import_inRange = require("../utils/inRange.js");
|
|
39
40
|
var import_styles = require("./styles.js");
|
|
@@ -63,6 +64,8 @@ const TickMarksValues = () => {
|
|
|
63
64
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
65
|
import_styles.StyledTickMarkValue,
|
|
65
66
|
{
|
|
67
|
+
component: "div",
|
|
68
|
+
variant: import_ds_typography.TYPOGRAPHY_VARIANTS.B2,
|
|
66
69
|
isSelected,
|
|
67
70
|
getOwnerProps,
|
|
68
71
|
getOwnerPropsArguments,
|
|
@@ -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 { 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;
|
|
4
|
+
"sourcesContent": ["import { useContext, useMemo } from 'react';\nimport { TYPOGRAPHY_VARIANTS } from '@elliemae/ds-typography';\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 // Keeps the element this slot has always rendered. `VariantToAsMap` maps every `b*`\n // variant to `p`, so adopting `b2` would silently turn the step value into a paragraph\n // \u2014 a change nobody asked for, with paragraph margins and the wrong semantics for a\n // number. Spec v1.5.0 says nothing about HTML elements, so the existing one stands.\n component=\"div\"\n variant={TYPOGRAPHY_VARIANTS.B2}\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;ADiCb;AAjCV,mBAAoC;AACpC,2BAAoC;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,YAMC,WAAU;AAAA,YACV,SAAS,yCAAoB;AAAA,YAC7B;AAAA,YACA;AAAA,YACA;AAAA,YAEC,gCAAsB,KAAK,KAAK;AAAA;AAAA,UAX5B,GAAG,WAAW,IAAI,KAAK;AAAA,QAY9B;AAAA,MAEJ,CAAC;AAAA;AAAA,EACH;AAEJ;",
|
|
6
6
|
"names": ["DSSliderV2Context"]
|
|
7
7
|
}
|
package/dist/cjs/parts/Track.js
CHANGED
|
@@ -40,10 +40,21 @@ var import_TickMarksValues = require("./TickMarksValues.js");
|
|
|
40
40
|
var import_styles = require("./styles.js");
|
|
41
41
|
const Track = ({ children, props: reactRangeOpinionatedProps, disabled }) => {
|
|
42
42
|
const {
|
|
43
|
-
propsWithDefault: {
|
|
43
|
+
propsWithDefault: {
|
|
44
|
+
minValue,
|
|
45
|
+
maxValue,
|
|
46
|
+
applyAriaDisabled,
|
|
47
|
+
readOnly,
|
|
48
|
+
hasError,
|
|
49
|
+
withTickMarksValues,
|
|
50
|
+
withTickMarks,
|
|
51
|
+
multiple
|
|
52
|
+
},
|
|
44
53
|
rangeValues,
|
|
45
54
|
getOwnerProps,
|
|
46
|
-
getOwnerPropsArguments
|
|
55
|
+
getOwnerPropsArguments,
|
|
56
|
+
isAnyThumbHovered,
|
|
57
|
+
isAnyThumbFocused
|
|
47
58
|
} = (0, import_react.useContext)(import_DSSliderV2CTX.default);
|
|
48
59
|
const { ref, style: trackStyle, ...propsFromReactRangeTookAsIsForTheTrack } = reactRangeOpinionatedProps;
|
|
49
60
|
const sanitizedStyle = (0, import_react.useMemo)(() => {
|
|
@@ -60,6 +71,9 @@ const Track = ({ children, props: reactRangeOpinionatedProps, disabled }) => {
|
|
|
60
71
|
disabled,
|
|
61
72
|
$readOnly: readOnly,
|
|
62
73
|
$applyAriaDisabled: applyAriaDisabled,
|
|
74
|
+
$hasError: hasError,
|
|
75
|
+
$isAnyThumbHovered: isAnyThumbHovered,
|
|
76
|
+
$isAnyThumbFocused: isAnyThumbFocused,
|
|
63
77
|
minValue,
|
|
64
78
|
maxValue,
|
|
65
79
|
rangeValues,
|
|
@@ -68,7 +82,7 @@ const Track = ({ children, props: reactRangeOpinionatedProps, disabled }) => {
|
|
|
68
82
|
getOwnerPropsArguments,
|
|
69
83
|
children: [
|
|
70
84
|
children,
|
|
71
|
-
withTickMarks &&
|
|
85
|
+
withTickMarks && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TickMarks.TickMarks, {})
|
|
72
86
|
]
|
|
73
87
|
}
|
|
74
88
|
),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/Track.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useContext, useMemo } from 'react';\nimport type { IRenderTrackParams } from 'react-range/lib/types.js';\nimport DSSliderV2Context from '../DSSliderV2CTX.js';\nimport { TickMarks } from './TickMarks.js';\nimport { TickMarksValues } from './TickMarksValues.js';\nimport { StyledTrack } from './styles.js';\n\nexport const Track = ({ children, props: reactRangeOpinionatedProps, disabled }: IRenderTrackParams) => {\n const {\n propsWithDefault: {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import { useContext, useMemo } from 'react';\nimport type { IRenderTrackParams } from 'react-range/lib/types.js';\nimport DSSliderV2Context from '../DSSliderV2CTX.js';\nimport { TickMarks } from './TickMarks.js';\nimport { TickMarksValues } from './TickMarksValues.js';\nimport { StyledTrack } from './styles.js';\n\nexport const Track = ({ children, props: reactRangeOpinionatedProps, disabled }: IRenderTrackParams) => {\n const {\n propsWithDefault: {\n minValue,\n maxValue,\n applyAriaDisabled,\n readOnly,\n hasError,\n withTickMarksValues,\n withTickMarks,\n multiple,\n },\n rangeValues,\n getOwnerProps,\n getOwnerPropsArguments,\n isAnyThumbHovered,\n isAnyThumbFocused,\n } = useContext(DSSliderV2Context);\n\n const { ref, style: trackStyle, ...propsFromReactRangeTookAsIsForTheTrack } = reactRangeOpinionatedProps;\n\n const sanitizedStyle = useMemo(() => {\n // we want to keep the cursor but when disabled, we want it to show as 'not-allowed'\n if (disabled || applyAriaDisabled || readOnly) return { ...trackStyle, cursor: 'not-allowed' };\n return trackStyle;\n }, [applyAriaDisabled, disabled, readOnly, trackStyle]);\n\n return (\n <>\n <StyledTrack\n style={sanitizedStyle}\n {...propsFromReactRangeTookAsIsForTheTrack} // This is needed because it's received from the library\n innerRef={ref}\n disabled={disabled}\n $readOnly={readOnly}\n $applyAriaDisabled={applyAriaDisabled}\n $hasError={hasError}\n $isAnyThumbHovered={isAnyThumbHovered}\n $isAnyThumbFocused={isAnyThumbFocused}\n minValue={minValue}\n maxValue={maxValue}\n rangeValues={rangeValues}\n multiple={multiple}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {children}\n {/*\n * Step marks are not gated on any interaction state. Spec v1.5.0's Design Notes require them\n * to stay visible across both track segments and every interactive state, and neither the\n * Disabled nor the Aria-Disabled row hides them. A previous `(!disabled || !applyAriaDisabled)`\n * guard sat here; it only evaluated false when both flags were true at once, so it never hid\n * anything \u2014 and \"fixing\" it to `&&` would have introduced a spec violation.\n */}\n {withTickMarks && <TickMarks />}\n </StyledTrack>\n {withTickMarksValues && <TickMarksValues />}\n </>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmCnB;AAnCJ,mBAAoC;AAEpC,2BAA8B;AAC9B,uBAA0B;AAC1B,6BAAgC;AAChC,oBAA4B;AAErB,MAAM,QAAQ,CAAC,EAAE,UAAU,OAAO,4BAA4B,SAAS,MAA0B;AACtG,QAAM;AAAA,IACJ,kBAAkB;AAAA,MAChB;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,EACF,QAAI,yBAAW,qBAAAA,OAAiB;AAEhC,QAAM,EAAE,KAAK,OAAO,YAAY,GAAG,uCAAuC,IAAI;AAE9E,QAAM,qBAAiB,sBAAQ,MAAM;AAEnC,QAAI,YAAY,qBAAqB,SAAU,QAAO,EAAE,GAAG,YAAY,QAAQ,cAAc;AAC7F,WAAO;AAAA,EACT,GAAG,CAAC,mBAAmB,UAAU,UAAU,UAAU,CAAC;AAEtD,SACE,4EACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACN,GAAG;AAAA,QACJ,UAAU;AAAA,QACV;AAAA,QACA,WAAW;AAAA,QACX,oBAAoB;AAAA,QACpB,WAAW;AAAA,QACX,oBAAoB;AAAA,QACpB,oBAAoB;AAAA,QACpB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,UAQA,iBAAiB,4CAAC,8BAAU;AAAA;AAAA;AAAA,IAC/B;AAAA,IACC,uBAAuB,4CAAC,0CAAgB;AAAA,KAC3C;AAEJ;",
|
|
6
6
|
"names": ["DSSliderV2Context"]
|
|
7
7
|
}
|
package/dist/cjs/parts/styles.js
CHANGED
|
@@ -41,18 +41,38 @@ module.exports = __toCommonJS(styles_exports);
|
|
|
41
41
|
var React = __toESM(require("react"));
|
|
42
42
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
43
43
|
var import_ds_system = require("@elliemae/ds-system");
|
|
44
|
+
var import_ds_typography = require("@elliemae/ds-typography");
|
|
44
45
|
var import_react_range = require("react-range");
|
|
45
46
|
var import_constants = require("../constants/index.js");
|
|
46
47
|
const StyledWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: import_constants.DSSliderV2Name, slot: import_constants.SLIDER_V2_SLOTS.ROOT })``;
|
|
47
48
|
const StyledRangeWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: import_constants.DSSliderV2Name, slot: import_constants.SLIDER_V2_SLOTS.RANGE_WRAPPER })``;
|
|
49
|
+
const SPEC_ERROR_ACTIVE = 900;
|
|
50
|
+
const SPEC_ERROR_INACTIVE = 200;
|
|
48
51
|
const TrackStates = import_ds_system.css`
|
|
49
|
-
${({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
${({
|
|
53
|
+
theme,
|
|
54
|
+
disabled,
|
|
55
|
+
$applyAriaDisabled,
|
|
56
|
+
$readOnly,
|
|
57
|
+
$hasError,
|
|
58
|
+
$isAnyThumbHovered,
|
|
59
|
+
$isAnyThumbFocused,
|
|
60
|
+
rangeValues,
|
|
61
|
+
multiple,
|
|
62
|
+
minValue,
|
|
63
|
+
maxValue
|
|
64
|
+
}) => {
|
|
65
|
+
const { neutral, brand, danger } = theme.colors;
|
|
66
|
+
const pickColors = () => {
|
|
67
|
+
if (disabled) return { active: neutral[400], inactive: neutral[300] };
|
|
68
|
+
if ($applyAriaDisabled || $readOnly) return { active: neutral[500], inactive: neutral[300] };
|
|
69
|
+
if ($hasError) return { active: danger[SPEC_ERROR_ACTIVE], inactive: danger[SPEC_ERROR_INACTIVE] };
|
|
70
|
+
if ($isAnyThumbFocused) return { active: brand[800], inactive: neutral[400] };
|
|
71
|
+
if ($isAnyThumbHovered) return { active: brand[700], inactive: neutral[400] };
|
|
72
|
+
return { active: brand[600], inactive: neutral[400] };
|
|
73
|
+
};
|
|
74
|
+
const { active, inactive } = pickColors();
|
|
75
|
+
const reactRangeColors = multiple ? [inactive, active, inactive] : [active, inactive];
|
|
56
76
|
return `background: ${(0, import_react_range.getTrackBackground)({
|
|
57
77
|
values: rangeValues,
|
|
58
78
|
colors: reactRangeColors,
|
|
@@ -77,7 +97,7 @@ const StyledDot = (0, import_ds_system.styled)("div", { name: import_constants.D
|
|
|
77
97
|
display: block;
|
|
78
98
|
position: relative;
|
|
79
99
|
width: 2px;
|
|
80
|
-
height:
|
|
100
|
+
height: 4px;
|
|
81
101
|
}
|
|
82
102
|
`;
|
|
83
103
|
const StyledDotsContainer = (0, import_ds_system.styled)("div", { name: import_constants.DSSliderV2Name, slot: import_constants.SLIDER_V2_SLOTS.DOT_CONTAINER })`
|
|
@@ -93,7 +113,10 @@ const StyledDotsContainer = (0, import_ds_system.styled)("div", { name: import_c
|
|
|
93
113
|
bottom: 0;
|
|
94
114
|
z-index: ${(props) => props.theme.zIndex.tooltip - 1};
|
|
95
115
|
`;
|
|
96
|
-
const StyledTickMarkValue = (0, import_ds_system.styled)(
|
|
116
|
+
const StyledTickMarkValue = (0, import_ds_system.styled)(import_ds_typography.DSTypography, {
|
|
117
|
+
name: import_constants.DSSliderV2Name,
|
|
118
|
+
slot: import_constants.SLIDER_V2_SLOTS.TICK_MARK_VALUE
|
|
119
|
+
})`
|
|
97
120
|
display: flex;
|
|
98
121
|
justify-content: center;
|
|
99
122
|
text-align: center;
|
|
@@ -118,41 +141,41 @@ const StyledTickMarksContainer = (0, import_ds_system.styled)("div", {
|
|
|
118
141
|
overflow-wrap: normal;
|
|
119
142
|
`;
|
|
120
143
|
const ThumbStates = import_ds_system.css`
|
|
121
|
-
${({ theme, disabled, $applyAriaDisabled, $readOnly }) => {
|
|
144
|
+
${({ theme, disabled, $applyAriaDisabled, $readOnly, $hasError }) => {
|
|
145
|
+
const { neutral, brand, danger } = theme.colors;
|
|
146
|
+
const background = `background-color: ${neutral["000"]};`;
|
|
147
|
+
const focusRing = `:focus {
|
|
148
|
+
border: 2px solid ${brand[800]};
|
|
149
|
+
outline: unset;
|
|
150
|
+
}`;
|
|
122
151
|
if (disabled)
|
|
123
152
|
return `
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const standardBgColorAndBorder = `
|
|
127
|
-
background-color: ${theme.colors.neutral["000"]};
|
|
128
|
-
border: 1px solid ${theme.colors.neutral[400]};
|
|
153
|
+
${background}
|
|
154
|
+
border: 2px solid ${neutral[400]};
|
|
129
155
|
`;
|
|
130
|
-
const standardFocusRing = `:focus {
|
|
131
|
-
border: 2px solid ${theme.colors.brand[700]};
|
|
132
|
-
outline: unset;
|
|
133
|
-
}`;
|
|
134
156
|
if ($applyAriaDisabled || $readOnly)
|
|
135
157
|
return `
|
|
136
|
-
${
|
|
137
|
-
:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
158
|
+
${background}
|
|
159
|
+
border: 2px solid ${neutral[500]};
|
|
160
|
+
${focusRing}`;
|
|
161
|
+
if ($hasError)
|
|
162
|
+
return `
|
|
163
|
+
${background}
|
|
164
|
+
border: 2px solid ${danger[SPEC_ERROR_ACTIVE]};
|
|
165
|
+
${focusRing}`;
|
|
141
166
|
return `
|
|
142
|
-
${
|
|
143
|
-
:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
:hover:not(:focus){
|
|
147
|
-
border: 1px solid ${theme.colors.brand[600]};
|
|
167
|
+
${background}
|
|
168
|
+
border: 2px solid ${brand[600]};
|
|
169
|
+
:hover {
|
|
170
|
+
border: 2px solid ${brand[700]};
|
|
148
171
|
}
|
|
149
|
-
${
|
|
172
|
+
${focusRing}`;
|
|
150
173
|
}}
|
|
151
174
|
`;
|
|
152
175
|
const StyledThumb = (0, import_ds_system.styled)("div", { name: import_constants.DSSliderV2Name, slot: import_constants.SLIDER_V2_SLOTS.THUMB })`
|
|
153
176
|
height: 20px;
|
|
154
|
-
width:
|
|
155
|
-
border-radius:
|
|
177
|
+
width: 12px;
|
|
178
|
+
border-radius: 2px;
|
|
156
179
|
top: 0;
|
|
157
180
|
z-index: ${(props) => props.theme.zIndex.tooltip};
|
|
158
181
|
${ThumbStates}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/styles.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { Grid } from '@elliemae/ds-grid';\nimport { css, styled } from '@elliemae/ds-system';\nimport { getTrackBackground } from 'react-range';\nimport { DSSliderV2Name, SLIDER_V2_SLOTS } from '../constants/index.js';\n\nexport const StyledWrapper = styled(Grid, { name: DSSliderV2Name, slot: SLIDER_V2_SLOTS.ROOT })``;\n\nexport const StyledRangeWrapper = styled(Grid, { name: DSSliderV2Name, slot: SLIDER_V2_SLOTS.RANGE_WRAPPER })``;\n\ninterface TrackProps {\n disabled: boolean;\n $applyAriaDisabled: boolean;\n $readOnly: boolean;\n multiple: boolean;\n minValue: number;\n maxValue: number;\n rangeValues: [number] | [number, number];\n}\n\nconst TrackStates = css<TrackProps>`\n ${({
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,qBAAqB;AACrB,uBAA4B;AAC5B,yBAAmC;AACnC,uBAAgD;AAEzC,MAAM,oBAAgB,yBAAO,qBAAM,EAAE,MAAM,iCAAgB,MAAM,iCAAgB,KAAK,CAAC;AAEvF,MAAM,yBAAqB,yBAAO,qBAAM,EAAE,MAAM,iCAAgB,MAAM,iCAAgB,cAAc,CAAC;
|
|
4
|
+
"sourcesContent": ["import { Grid } from '@elliemae/ds-grid';\nimport { css, styled } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { getTrackBackground } from 'react-range';\nimport { DSSliderV2Name, SLIDER_V2_SLOTS } from '../constants/index.js';\n\nexport const StyledWrapper = styled(Grid, { name: DSSliderV2Name, slot: SLIDER_V2_SLOTS.ROOT })``;\n\nexport const StyledRangeWrapper = styled(Grid, { name: DSSliderV2Name, slot: SLIDER_V2_SLOTS.RANGE_WRAPPER })``;\n\n// Spec v1.5.0 uses the token names `Error-900` / `Error-200`. There is no `error` palette in the\n// theme \u2014 the key is `danger`, and these are its matching steps. Always reference the token, never\n// the hex: `danger[900]` and `danger[950]` are one step apart and easy to confuse.\nconst SPEC_ERROR_ACTIVE = 900;\nconst SPEC_ERROR_INACTIVE = 200;\n\ninterface TrackProps {\n disabled: boolean;\n $applyAriaDisabled: boolean;\n $readOnly: boolean;\n $hasError: boolean;\n $isAnyThumbHovered: boolean;\n $isAnyThumbFocused: boolean;\n multiple: boolean;\n minValue: number;\n maxValue: number;\n rangeValues: [number] | [number, number];\n}\n\n/**\n * Spec v1.5.0 track colours, one branch per row of the state table.\n *\n * Precedence: disabled > aria-disabled / readOnly > error > focus > hover > idle. The first three\n * come from the standard Dim Sum interaction state hierarchy; focus over hover is because a handle\n * that is both focused and hovered reads as focused.\n *\n * `readOnly` shares the aria-disabled tokens. Spec v1.5.0 defines no read-only row, and the two\n * states are visually identical by design \u2014 see `.github/memories/project_interaction_states.md`.\n *\n * The blocked states keep their own track colours when focused: the spec's `Aria-Disabled + Focus`\n * row marks the track \"unchanged\" and moves only the handle border. Error follows the same shape by\n * analogy; the spec has no `Error + Focus` row.\n */\nconst TrackStates = css<TrackProps>`\n ${({\n theme,\n disabled,\n $applyAriaDisabled,\n $readOnly,\n $hasError,\n $isAnyThumbHovered,\n $isAnyThumbFocused,\n rangeValues,\n multiple,\n minValue,\n maxValue,\n }) => {\n const { neutral, brand, danger } = theme.colors;\n\n const pickColors = () => {\n if (disabled) return { active: neutral[400], inactive: neutral[300] };\n if ($applyAriaDisabled || $readOnly) return { active: neutral[500], inactive: neutral[300] };\n if ($hasError) return { active: danger[SPEC_ERROR_ACTIVE], inactive: danger[SPEC_ERROR_INACTIVE] };\n if ($isAnyThumbFocused) return { active: brand[800], inactive: neutral[400] };\n if ($isAnyThumbHovered) return { active: brand[700], inactive: neutral[400] };\n return { active: brand[600], inactive: neutral[400] };\n };\n const { active, inactive } = pickColors();\n\n // react-range paints the whole track as one gradient, so both segments are handed over together:\n // the range version has an inactive segment on each side of the selection.\n const reactRangeColors = multiple ? [inactive, active, inactive] : [active, inactive];\n\n return `background: ${getTrackBackground({\n values: rangeValues,\n colors: reactRangeColors,\n min: minValue,\n max: maxValue,\n })};`;\n }}\n`;\n\nexport const StyledTrack = styled('div', { name: DSSliderV2Name, slot: SLIDER_V2_SLOTS.TRACK })<TrackProps>`\n position: relative;\n height: ${(props) => props.theme.space.xxxs};\n width: 100%;\n min-width: ${(props) => props.theme.space.xl};\n border-radius: ${(props) => props.theme.space.xxxs};\n ${TrackStates}\n`;\n\nexport const StyledDot = styled('div', { name: DSSliderV2Name, slot: SLIDER_V2_SLOTS.DOT })`\n &:after {\n content: '';\n background: ${(props) => props.theme.colors.neutral['000']};\n border-radius: ${(props) => props.theme.space.xxxs};\n display: block;\n position: relative;\n width: 2px;\n height: 4px;\n }\n`;\n\nexport const StyledDotsContainer = styled('div', { name: DSSliderV2Name, slot: SLIDER_V2_SLOTS.DOT_CONTAINER })`\n padding: 0 2px;\n align-items: center;\n display: flex;\n justify-content: space-between;\n pointer-events: none;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: ${(props) => props.theme.zIndex.tooltip - 1};\n`;\n\n// Spec v1.5.0 asks the step value for `typography-variant: b2-Regular`. Naming a variant means the\n// design system's typography, not an ad-hoc font declaration \u2014 so the slot is the DSTypography\n// itself rather than a div wrapping one. Same shape as `StyledTitleTypography` in\n// ds-card-navigation, and it keeps the node count and the `data-testid` unchanged.\n//\n// This is also what makes the value respond to browser text resize: the variant's sizes are in rem\n// against the theme's root, so a 200% zoom scales them proportionally.\nexport const StyledTickMarkValue = styled(DSTypography, {\n name: DSSliderV2Name,\n slot: SLIDER_V2_SLOTS.TICK_MARK_VALUE,\n})<{\n isSelected: boolean;\n}>`\n display: flex;\n justify-content: center;\n text-align: center;\n min-height: ${(props) => props.theme.space.xs};\n overflow: visible;\n color: ${(props) => (props.isSelected ? props.theme.colors.neutral[800] : props.theme.colors.neutral[500])};\n place-self: baseline;\n transform: translateX(-50%);\n white-space: normal;\n overflow-wrap: break-word;\n word-break: break-word;\n`;\n\nexport const StyledTickMarksContainer = styled('div', {\n name: DSSliderV2Name,\n slot: SLIDER_V2_SLOTS.TICK_MARK_CONTAINER,\n})<{ columnCount: number; columnWidth: string }>`\n display: grid;\n grid-template-columns: repeat(${(props) => props.columnCount}, calc(${(props) => props.columnWidth} - 4px));\n gap: 4px;\n justify-content: space-between;\n // this next property-value reverts the sanitize.css value\n overflow-wrap: normal;\n`;\n\ninterface ThumbProps {\n disabled: boolean;\n $applyAriaDisabled: boolean;\n $readOnly: boolean;\n $hasError: boolean;\n}\n\n/**\n * Spec v1.5.0 handle borders. Background is `N-000` in every state, so it is set once outside the\n * branches.\n *\n * Hover and focus stay as CSS pseudo-classes rather than reading the context flags, because the\n * border is per handle: in range mode hovering one handle must highlight that one only. The context\n * flags exist for the track, which is a single shared surface \u2014 see `useSliderV2.ts`.\n *\n * The cursor is not set here. react-range supplies grab/grabbing through inline styles, and the\n * not-allowed override for the blocked states is applied in `Thumb.tsx`, which is why the\n * `Disabled + Hover` and `Aria-Disabled + Hover` rows need no branch: they are cursor-only.\n */\nconst ThumbStates = css<ThumbProps>`\n ${({ theme, disabled, $applyAriaDisabled, $readOnly, $hasError }) => {\n const { neutral, brand, danger } = theme.colors;\n const background = `background-color: ${neutral['000']};`;\n // Focus survives a blocked state: `applyAriaDisabled` and `readOnly` keep focusability on\n // purpose, so the indicator has to remain visible.\n const focusRing = `:focus {\n border: 2px solid ${brand[800]};\n outline: unset;\n }`;\n\n // Native `disabled` cannot receive focus, which is why the spec marks `Disabled + Focus` N/A.\n if (disabled)\n return `\n ${background}\n border: 2px solid ${neutral[400]};\n `;\n\n if ($applyAriaDisabled || $readOnly)\n return `\n ${background}\n border: 2px solid ${neutral[500]};\n ${focusRing}`;\n\n if ($hasError)\n return `\n ${background}\n border: 2px solid ${danger[SPEC_ERROR_ACTIVE]};\n ${focusRing}`;\n\n return `\n ${background}\n border: 2px solid ${brand[600]};\n :hover {\n border: 2px solid ${brand[700]};\n }\n ${focusRing}`;\n }}\n`;\n\nexport const StyledThumb = styled('div', { name: DSSliderV2Name, slot: SLIDER_V2_SLOTS.THUMB })<ThumbProps>`\n height: 20px;\n width: 12px;\n border-radius: 2px;\n top: 0;\n z-index: ${(props) => props.theme.zIndex.tooltip};\n ${ThumbStates}\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -46,7 +46,8 @@ const defaultProps = {
|
|
|
46
46
|
customTickMarksValues: [],
|
|
47
47
|
multiple: false,
|
|
48
48
|
applyAriaDisabled: false,
|
|
49
|
-
readOnly: false
|
|
49
|
+
readOnly: false,
|
|
50
|
+
hasError: false
|
|
50
51
|
};
|
|
51
52
|
const DSSliderV2PropTypes = {
|
|
52
53
|
...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_constants.DSSliderV2Name, import_constants.SLIDER_V2_SLOTS),
|
|
@@ -70,6 +71,9 @@ const DSSliderV2PropTypes = {
|
|
|
70
71
|
readOnly: import_ds_props_helpers.PropTypes.bool.description(
|
|
71
72
|
"Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION."
|
|
72
73
|
).defaultValue(false),
|
|
74
|
+
hasError: import_ds_props_helpers.PropTypes.bool.description(
|
|
75
|
+
"Whether the slider has error. Yields to disabled, applyAriaDisabled and readOnly when combined with any of them."
|
|
76
|
+
).defaultValue(false),
|
|
73
77
|
minRange: import_ds_props_helpers.PropTypes.number.description(
|
|
74
78
|
"In a multiple selection scenario, this defines the minimum range that must be maintained between the two values."
|
|
75
79
|
).defaultValue(0)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n\nimport type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSSliderV2Name, SLIDER_V2_SLOTS } from './constants/index.js';\n\nexport declare namespace DSSliderV2T {\n /* **************************************************************************************************************\n * SLIDER V2 IS POLYMORPHIC *\n ****************************************************************************************************************\n * DEFINE COMMONS INTERFACES *\n ************************************************************************************************************** */\n export type CommonRequiredProps = {\n minValue: number;\n maxValue: number;\n };\n export type CommonDefaultProps = {\n disabled: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n step: number;\n withTickMarks: boolean;\n withTickMarksValues: boolean;\n customTickMarksValues: string[];\n };\n export interface CommonOptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSSliderV2Name,\n typeof SLIDER_V2_SLOTS\n > {\n className?: string;\n }\n\n /* **************************************************************************************************************\n * DEFINE EACH POLYMORPH INTERFACE *\n ****************************************************************************************************************\n * make sure to expand the relevant commons interfaces!!! *\n ************************************************************************************************************** */\n\n /* **************************************************************************************************************\n * MULTIPLE(range version) *\n ************************************************************************************************************** */\n\n // MULTIPLE POLYMORPH TYPES\n export type RequiredPropsMultiple = CommonRequiredProps & {\n value: [number, number];\n };\n export type DefaultPropsMultiple = CommonDefaultProps & {\n multiple: true; // this must be ACTUALLY true, it's used as the distinguisher from typescript\n onValueChange: (newValue: [number, number]) => void;\n minRange: number; // for the \"multiple\" version, the minimum range is a default prop\n };\n export type OptionalPropsMultiple = CommonOptionalProps;\n /* **************************************************************************************************************\n * each polimorphism needs it's own \"Props\" and \"InternalProps\" defined!!! *\n ************************************************************************************************************** */\n export type PropsMultiple = Partial<DefaultPropsMultiple> &\n OptionalPropsMultiple &\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultPropsMultiple | keyof OptionalPropsMultiple | keyof XstyledProps | keyof RequiredPropsMultiple\n > &\n XstyledProps &\n RequiredPropsMultiple;\n export type InternalPropsMultiple = DefaultPropsMultiple &\n OptionalPropsMultiple &\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultPropsMultiple | keyof OptionalPropsMultiple | keyof XstyledProps | keyof RequiredPropsMultiple\n > &\n XstyledProps &\n RequiredPropsMultiple;\n\n /* **************************************************************************************************************\n * SINGLE(number picker version) *\n ************************************************************************************************************** */\n // SINGLE POLYMORPH TYPES\n export type RequiredPropsSingle = CommonRequiredProps & {\n value: number;\n };\n export type DefaultPropsSingle = CommonDefaultProps & {\n multiple: false; // this must be ACTUALLY false, it's used as the distinguisher from typescript\n onValueChange: (newValue: number) => void;\n };\n export type OptionalPropsSingle = CommonOptionalProps & {\n // for the \"single\" version, the minimum range is not applicable\n // keeping this minRange here helps typescript to discriminate if the component is being used in \"single\" or \"multiple\" mode\n // by setting it to \"never\", we ensure that if someone tries to use \"minRange\" with the single version, TypeScript will throw an error\n minRange?: never;\n };\n /* **************************************************************************************************************\n * each polimorphism needs it's own \"Props\" and \"InternalProps\" defined!!! *\n ************************************************************************************************************** */\n export type PropsSingle = Partial<DefaultPropsSingle> &\n OptionalPropsSingle &\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultPropsSingle | keyof OptionalPropsSingle | keyof XstyledProps | keyof RequiredPropsSingle\n > &\n XstyledProps &\n RequiredPropsSingle;\n export type InternalPropsSingle = DefaultPropsSingle &\n OptionalPropsSingle &\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultPropsSingle | keyof OptionalPropsSingle | keyof XstyledProps | keyof RequiredPropsSingle\n > &\n XstyledProps &\n RequiredPropsSingle;\n\n /* **************************************************************************************************************\n * WRAP UP THE POLYMORPHIC CONTRACT *\n ************************************************************************************************************** */\n export type DefaultProps = DefaultPropsMultiple | DefaultPropsSingle;\n export type RequiredProps = RequiredPropsMultiple | RequiredPropsSingle;\n export type OptionalProps = OptionalPropsMultiple | OptionalPropsSingle;\n export type Props = PropsMultiple | PropsSingle;\n export type InternalProps = InternalPropsMultiple | InternalPropsSingle;\n}\n\nexport const defaultProps: DSSliderV2T.DefaultProps = {\n disabled: false,\n step: 5,\n onValueChange: () => {},\n withTickMarks: false,\n withTickMarksValues: false,\n customTickMarksValues: [],\n multiple: false,\n applyAriaDisabled: false,\n readOnly: false,\n};\n\nexport const DSSliderV2PropTypes: DSPropTypesSchema<DSSliderV2T.Props> = {\n ...getPropsPerSlotPropTypes(DSSliderV2Name, SLIDER_V2_SLOTS),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n value: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number)]).description(\n 'The current value of the slider. Can be a single number or an array of two numbers for multiple sliders.',\n ).isRequired,\n onValueChange: PropTypes.func\n .description('change handler, if multiple is true it will receive an array of two numbers')\n .signature('(value: number) => void | (value: [number, number]) => void')\n .defaultValue(() => {}),\n disabled: PropTypes.bool.description('disable slider').defaultValue(false),\n minValue: PropTypes.number.description('min value for slider').defaultValue(0),\n maxValue: PropTypes.number.description('max value for slider').defaultValue(100),\n step: PropTypes.number.description('steps of values from min to max').defaultValue(5),\n withTickMarks: PropTypes.bool.description('add tick marks between steps').defaultValue(false),\n withTickMarksValues: PropTypes.bool.description('add step value to tickmark').defaultValue(false),\n customTickMarksValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))\n .description('Explicitly set tickmark values for custom tickmarks')\n .defaultValue([]),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n readOnly: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n minRange: PropTypes.number\n .description(\n 'In a multiple selection scenario, this defines the minimum range that must be maintained between the two values.',\n )\n .defaultValue(0),\n};\n\nexport const DSSliderV2PropTypesSchema = DSSliderV2PropTypes as unknown as ValidationMap<DSSliderV2T.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,8BAKO;AAEP,uBAAgD;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n\nimport type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSSliderV2Name, SLIDER_V2_SLOTS } from './constants/index.js';\n\nexport declare namespace DSSliderV2T {\n /* **************************************************************************************************************\n * SLIDER V2 IS POLYMORPHIC *\n ****************************************************************************************************************\n * DEFINE COMMONS INTERFACES *\n ************************************************************************************************************** */\n export type CommonRequiredProps = {\n minValue: number;\n maxValue: number;\n };\n export type CommonDefaultProps = {\n disabled: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n hasError: boolean;\n step: number;\n withTickMarks: boolean;\n withTickMarksValues: boolean;\n customTickMarksValues: string[];\n };\n export interface CommonOptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSSliderV2Name,\n typeof SLIDER_V2_SLOTS\n > {\n className?: string;\n }\n\n /* **************************************************************************************************************\n * DEFINE EACH POLYMORPH INTERFACE *\n ****************************************************************************************************************\n * make sure to expand the relevant commons interfaces!!! *\n ************************************************************************************************************** */\n\n /* **************************************************************************************************************\n * MULTIPLE(range version) *\n ************************************************************************************************************** */\n\n // MULTIPLE POLYMORPH TYPES\n export type RequiredPropsMultiple = CommonRequiredProps & {\n value: [number, number];\n };\n export type DefaultPropsMultiple = CommonDefaultProps & {\n multiple: true; // this must be ACTUALLY true, it's used as the distinguisher from typescript\n onValueChange: (newValue: [number, number]) => void;\n minRange: number; // for the \"multiple\" version, the minimum range is a default prop\n };\n export type OptionalPropsMultiple = CommonOptionalProps;\n /* **************************************************************************************************************\n * each polimorphism needs it's own \"Props\" and \"InternalProps\" defined!!! *\n ************************************************************************************************************** */\n export type PropsMultiple = Partial<DefaultPropsMultiple> &\n OptionalPropsMultiple &\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultPropsMultiple | keyof OptionalPropsMultiple | keyof XstyledProps | keyof RequiredPropsMultiple\n > &\n XstyledProps &\n RequiredPropsMultiple;\n export type InternalPropsMultiple = DefaultPropsMultiple &\n OptionalPropsMultiple &\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultPropsMultiple | keyof OptionalPropsMultiple | keyof XstyledProps | keyof RequiredPropsMultiple\n > &\n XstyledProps &\n RequiredPropsMultiple;\n\n /* **************************************************************************************************************\n * SINGLE(number picker version) *\n ************************************************************************************************************** */\n // SINGLE POLYMORPH TYPES\n export type RequiredPropsSingle = CommonRequiredProps & {\n value: number;\n };\n export type DefaultPropsSingle = CommonDefaultProps & {\n multiple: false; // this must be ACTUALLY false, it's used as the distinguisher from typescript\n onValueChange: (newValue: number) => void;\n };\n export type OptionalPropsSingle = CommonOptionalProps & {\n // for the \"single\" version, the minimum range is not applicable\n // keeping this minRange here helps typescript to discriminate if the component is being used in \"single\" or \"multiple\" mode\n // by setting it to \"never\", we ensure that if someone tries to use \"minRange\" with the single version, TypeScript will throw an error\n minRange?: never;\n };\n /* **************************************************************************************************************\n * each polimorphism needs it's own \"Props\" and \"InternalProps\" defined!!! *\n ************************************************************************************************************** */\n export type PropsSingle = Partial<DefaultPropsSingle> &\n OptionalPropsSingle &\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultPropsSingle | keyof OptionalPropsSingle | keyof XstyledProps | keyof RequiredPropsSingle\n > &\n XstyledProps &\n RequiredPropsSingle;\n export type InternalPropsSingle = DefaultPropsSingle &\n OptionalPropsSingle &\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultPropsSingle | keyof OptionalPropsSingle | keyof XstyledProps | keyof RequiredPropsSingle\n > &\n XstyledProps &\n RequiredPropsSingle;\n\n /* **************************************************************************************************************\n * WRAP UP THE POLYMORPHIC CONTRACT *\n ************************************************************************************************************** */\n export type DefaultProps = DefaultPropsMultiple | DefaultPropsSingle;\n export type RequiredProps = RequiredPropsMultiple | RequiredPropsSingle;\n export type OptionalProps = OptionalPropsMultiple | OptionalPropsSingle;\n export type Props = PropsMultiple | PropsSingle;\n export type InternalProps = InternalPropsMultiple | InternalPropsSingle;\n}\n\nexport const defaultProps: DSSliderV2T.DefaultProps = {\n disabled: false,\n step: 5,\n onValueChange: () => {},\n withTickMarks: false,\n withTickMarksValues: false,\n customTickMarksValues: [],\n multiple: false,\n applyAriaDisabled: false,\n readOnly: false,\n hasError: false,\n};\n\nexport const DSSliderV2PropTypes: DSPropTypesSchema<DSSliderV2T.Props> = {\n ...getPropsPerSlotPropTypes(DSSliderV2Name, SLIDER_V2_SLOTS),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n value: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number)]).description(\n 'The current value of the slider. Can be a single number or an array of two numbers for multiple sliders.',\n ).isRequired,\n onValueChange: PropTypes.func\n .description('change handler, if multiple is true it will receive an array of two numbers')\n .signature('(value: number) => void | (value: [number, number]) => void')\n .defaultValue(() => {}),\n disabled: PropTypes.bool.description('disable slider').defaultValue(false),\n minValue: PropTypes.number.description('min value for slider').defaultValue(0),\n maxValue: PropTypes.number.description('max value for slider').defaultValue(100),\n step: PropTypes.number.description('steps of values from min to max').defaultValue(5),\n withTickMarks: PropTypes.bool.description('add tick marks between steps').defaultValue(false),\n withTickMarksValues: PropTypes.bool.description('add step value to tickmark').defaultValue(false),\n customTickMarksValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))\n .description('Explicitly set tickmark values for custom tickmarks')\n .defaultValue([]),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n readOnly: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n hasError: PropTypes.bool\n .description(\n 'Whether the slider has error. Yields to disabled, applyAriaDisabled and readOnly when combined with any of them.',\n )\n .defaultValue(false),\n minRange: PropTypes.number\n .description(\n 'In a multiple selection scenario, this defines the minimum range that must be maintained between the two values.',\n )\n .defaultValue(0),\n};\n\nexport const DSSliderV2PropTypesSchema = DSSliderV2PropTypes as unknown as ValidationMap<DSSliderV2T.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,8BAKO;AAEP,uBAAgD;AAoHzC,MAAM,eAAyC;AAAA,EACpD,UAAU;AAAA,EACV,MAAM;AAAA,EACN,eAAe,MAAM;AAAA,EAAC;AAAA,EACtB,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,uBAAuB,CAAC;AAAA,EACxB,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AACZ;AAEO,MAAM,sBAA4D;AAAA,EACvE,OAAG,kDAAyB,iCAAgB,gCAAe;AAAA,EAC3D,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,QAAQ,kCAAU,MAAM,CAAC,CAAC,EAAE;AAAA,IAClF;AAAA,EACF,EAAE;AAAA,EACF,eAAe,kCAAU,KACtB,YAAY,6EAA6E,EACzF,UAAU,6DAA6D,EACvE,aAAa,MAAM;AAAA,EAAC,CAAC;AAAA,EACxB,UAAU,kCAAU,KAAK,YAAY,gBAAgB,EAAE,aAAa,KAAK;AAAA,EACzE,UAAU,kCAAU,OAAO,YAAY,sBAAsB,EAAE,aAAa,CAAC;AAAA,EAC7E,UAAU,kCAAU,OAAO,YAAY,sBAAsB,EAAE,aAAa,GAAG;AAAA,EAC/E,MAAM,kCAAU,OAAO,YAAY,iCAAiC,EAAE,aAAa,CAAC;AAAA,EACpF,eAAe,kCAAU,KAAK,YAAY,8BAA8B,EAAE,aAAa,KAAK;AAAA,EAC5F,qBAAqB,kCAAU,KAAK,YAAY,4BAA4B,EAAE,aAAa,KAAK;AAAA,EAChG,uBAAuB,kCAAU,QAAQ,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,CAAC,EAC/F,YAAY,qDAAqD,EACjE,aAAa,CAAC,CAAC;AAAA,EAClB,mBAAmB,kCAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,UAAU,kCAAU,KACjB;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,UAAU,kCAAU,KACjB;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,UAAU,kCAAU,OACjB;AAAA,IACC;AAAA,EACF,EACC,aAAa,CAAC;AACnB;AAEO,MAAM,4BAA4B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/typescript-testing/typescript-slider-v2-valid-auto-polymorph-multiple.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-slider-v2-valid-auto-polymorph-multiple.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSSliderV2 } from '../index.js';\nimport type { DSSliderV2T } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSSliderV2T.Props;\ntype ComponentPropsInternals = DSSliderV2T.InternalProps;\ntype ComponentPropsDefaultProps = DSSliderV2T.DefaultProps;\ntype ComponentPropsOptionalProps = DSSliderV2T.OptionalProps;\ntype ComponentPropsRequiredProps = DSSliderV2T.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n value: [10, 50],\n minValue: 0,\n maxValue: 100,\n};\nconst testOptionalProps: ComponentPropsOptionalProps = {};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n multiple: true,\n applyAriaDisabled: false,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n multiple: true,\n disabled: false,\n step: 5,\n onValueChange: () => {},\n withTickMarks: false,\n withTickMarksValues: false,\n customTickMarksValues: [],\n applyAriaDisabled: false,\n readOnly: false,\n minRange: 10,\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n value: [10, 50],\n minValue: 0,\n maxValue: 100,\n multiple: true,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n value: [10, 50],\n minValue: 0,\n maxValue: 100,\n multiple: true,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n value: [10, 50] as [number, number],\n minValue: 0,\n maxValue: 100,\n multiple: true,\n} as const;\n\nconst onValueChange = (value: [number, number]) => {};\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSSliderV2 {...testExplicitDefinition} />\n <DSSliderV2 {...testInferedTypeCompatibility} />\n <DSSliderV2 {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSSliderV2 multiple value={[0, 100]} minValue={0} maxValue={100} onValueChange={onValueChange} />\n </>\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSSliderV2 } from '../index.js';\nimport type { DSSliderV2T } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSSliderV2T.Props;\ntype ComponentPropsInternals = DSSliderV2T.InternalProps;\ntype ComponentPropsDefaultProps = DSSliderV2T.DefaultProps;\ntype ComponentPropsOptionalProps = DSSliderV2T.OptionalProps;\ntype ComponentPropsRequiredProps = DSSliderV2T.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n value: [10, 50],\n minValue: 0,\n maxValue: 100,\n};\nconst testOptionalProps: ComponentPropsOptionalProps = {};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n multiple: true,\n applyAriaDisabled: false,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n multiple: true,\n disabled: false,\n step: 5,\n onValueChange: () => {},\n withTickMarks: false,\n withTickMarksValues: false,\n customTickMarksValues: [],\n applyAriaDisabled: false,\n readOnly: false,\n hasError: false,\n minRange: 10,\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n value: [10, 50],\n minValue: 0,\n maxValue: 100,\n multiple: true,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n value: [10, 50],\n minValue: 0,\n maxValue: 100,\n multiple: true,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n value: [10, 50] as [number, number],\n minValue: 0,\n maxValue: 100,\n multiple: true,\n} as const;\n\nconst onValueChange = (value: [number, number]) => {};\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSSliderV2 {...testExplicitDefinition} />\n <DSSliderV2 {...testInferedTypeCompatibility} />\n <DSSliderV2 {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSSliderV2 multiple value={[0, 100]} minValue={0} maxValue={100} onValueChange={onValueChange} />\n </>\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACwFrB;AAvFF,eAA2B;AAU3B,MAAM,oBAAiD;AAAA,EACrD,OAAO,CAAC,IAAI,EAAE;AAAA,EACd,UAAU;AAAA,EACV,UAAU;AACZ;AACA,MAAM,oBAAiD,CAAC;AAIxD,MAAM,sBAA2D;AAAA,EAC/D,UAAU;AAAA,EACV,mBAAmB;AACrB;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,eAAe,MAAM;AAAA,EAAC;AAAA,EACtB,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,uBAAuB,CAAC;AAAA,EACxB,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AACZ;AACA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,OAAO,CAAC,IAAI,EAAE;AAAA,EACd,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AACZ;AAGA,MAAM,+BAA+B;AAAA,EACnC,OAAO,CAAC,IAAI,EAAE;AAAA,EACd,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AACZ;AAEA,MAAM,wBAAwB;AAAA,EAC5B,OAAO,CAAC,IAAI,EAAE;AAAA,EACd,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AACZ;AAEA,MAAM,gBAAgB,CAAC,UAA4B;AAAC;AAEpD,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,uBAAY,GAAG,wBAAwB;AAAA,EACxC,4CAAC,uBAAY,GAAG,8BAA8B;AAAA,EAC9C,4CAAC,uBAAY,GAAG,uBAAuB;AAAA,EAEvC,4CAAC,uBAAW,UAAQ,MAAC,OAAO,CAAC,GAAG,GAAG,GAAG,UAAU,GAAG,UAAU,KAAK,eAA8B;AAAA,GAClG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|