@chayns-components/core 5.0.53 → 5.0.55

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.js","names":["_chaynsApi","require","_react","_interopRequireWildcard","_styledComponents","_element","_slider","_Slider","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Slider","interval","isDisabled","maxEnabledValue","maxValue","minEnabledValue","minValue","onChange","onSelect","shouldHighlightSteps","shouldShowThumbLabel","step","thumbLabelFormatter","value","fromValue","setFromValue","useState","toValue","setToValue","thumbWidth","setThumbWidth","isBigSlider","setIsBigSlider","previousFromValueRef","useRef","previousToValueRef","fromSliderRef","toSliderRef","fromSliderThumbRef","toSliderThumbRef","fromSliderThumbContentRef","toSliderThumbContentRef","sliderWrapperRef","sliderWrapperSize","useElementSize","theme","useTheme","updateFromValue","useCallback","nextValue","current","updateToValue","normalizeIntervalValue","newValue","Number","Math","round","applyIntervalThumbChange","thumb","rawValue","isFromThumb","previousValue","hasChanged","from","to","undefined","fillSlider","toSlider","fromSlider","String","useEffect","getThumbMaxWidth","maxNumber","handleMouseUp","_fromSliderRef$curren","_toSliderRef$current","handleControlFromSlider","event","target","handleControlToSlider","handleInputChange","effectiveMin","max","effectiveMax","min","isNaN","fromSliderThumbPosition","useMemo","_fromSliderRef$curren2","offsetWidth","width","calculateGradientOffset","sliderWidth","wrapperWidth","toSliderThumbPosition","_toSliderRef$current2","toSliderThumbContentPosition","calculatePopupPosition","sliderValue","popupWidth","fromSliderThumbContentPosition","handleTouchStart","setRefreshScrollEnabled","handleTouchEnd","_fromSliderRef$curren3","_toSliderRef$current3","highlightedStepElements","_fromSliderRef$curren4","elements","isStepDisabled","offset","stepWidth","push","createElement","StyledHighlightedStep","key","$isDisabled","$isFilled","$leftPosition","fromInputBackground","gradientPoints","getPercentage","x","join","StyledSlider","ref","StyledSliderInput","animate","height","initial","exit","$thumbWidth","$isInterval","type","onTouchStart","onTouchEnd","onMouseUp","$background","StyledSliderThumb","$position","$isBigSlider","StyledSliderThumbLabel","$width","displayName","_default","exports"],"sources":["../../../../src/components/slider/Slider.tsx"],"sourcesContent":["import { setRefreshScrollEnabled } from 'chayns-api';\nimport React, {\n ChangeEvent,\n FC,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTheme } from 'styled-components';\nimport { useElementSize } from '../../hooks/element';\nimport {\n calculateGradientOffset,\n calculatePopupPosition,\n fillSlider,\n getThumbMaxWidth,\n} from '../../utils/slider';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport {\n StyledHighlightedStep,\n StyledSlider,\n StyledSliderInput,\n StyledSliderThumb,\n StyledSliderThumbLabel,\n} from './Slider.styles';\n\nexport interface SliderInterval {\n maxValue: number;\n minValue: number;\n}\n\nexport type SliderProps = {\n /**\n * The current interval of the slider.\n * @description\n * The `interval` prop is used to define a range for the slider, allowing users to select a minimum and maximum value.\n * This is particularly useful for scenarios where you want to allow users to select a range of values, such as price ranges or date ranges.\n * When provided, the slider will display two thumbs, one for the minimum value and one for the maximum value.\n * @example\n * <Slider interval={{ minValue: 10, maxValue: 50 }} />\n * @optional\n */\n interval?: SliderInterval;\n /**\n * Disables the slider, preventing user interaction.\n * @description\n * The `isDisabled` prop is used to disable the slider, making it unresponsive to user input.\n * When set to `true`, the slider cannot be moved, and its appearance may change to indicate that it is disabled.\n * This is useful for scenarios where the slider should not be interacted with, such as when the data it controls is not available or when the user does not have permission to change the value.\n * @default false\n * @example\n * <Slider isDisabled={true} />\n * @optional\n */\n isDisabled?: boolean;\n /**\n * The maximum enabled value of the slider.\n * @description\n * The `maxEnabledValue` prop is used to define the maximum value that can be selected on the slider.\n * It is particularly useful when you want to set an upper limit for the slider's range, ensuring that users cannot select values above this threshold.\n * This prop is optional and can be used in conjunction with the `maxValue` prop to create a more flexible slider.\n * @example\n * <Slider maxEnabledValue={75} />\n * @optional\n */\n maxEnabledValue?: number;\n /**\n * The maximum value of the slider.\n * @description\n * The `maxValue` prop defines the upper limit of the slider's range. It is used to set the maximum value that can be selected by the user.\n * This value should be greater than or equal to `minValue`.\n * @example\n * <Slider maxValue={200} />\n */\n maxValue: number;\n /**\n * The minimum enabled value of the slider.\n * @description\n * The `minEnabledValue` prop is used to define the minimum value that can be selected on the slider.\n * It is particularly useful when you want to set a lower limit for the slider's range, ensuring that users cannot select values below this threshold.\n * This prop is optional and can be used in conjunction with the `minValue` prop to create a more flexible slider.\n * @example\n * <Slider minEnabledValue={25} />\n * @optional\n */\n minEnabledValue?: number;\n /**\n * The minimum value of the slider.\n * @description\n * The `minValue` prop defines the lower limit of the slider's range. It is used to set the minimum value that can be selected by the user.\n * This value should be less than or equal to `maxValue`.\n * @example\n * <Slider minValue={0} />\n */\n minValue: number;\n /**\n * Callback function that is called when the slider value changes.\n * @description\n * The `onChange` prop is a callback function that is triggered whenever the slider value changes.\n * It receives the new value or interval of the slider as an argument, allowing you to update your application state or perform other actions based on the new value.\n * If the slider is configured as an interval, it will receive an object with `minValue` and `maxValue`.\n * @example\n * <Slider onChange={(value, interval) => console.log('Slider changed', { value, interval })} />\n */\n onChange?: (value?: number, interval?: SliderInterval) => void;\n /**\n * Callback function that is called when the slider selection is finalized.\n * @description\n * The `onSelect` prop is a callback function that is triggered when the user finishes interacting with the slider, such as releasing the mouse or touch after dragging the thumb.\n * It receives the selected value or interval as arguments, allowing you to perform actions based on the final selection.\n * If the slider is configured as an interval, it will receive an object with `minValue` and `maxValue`.\n * @example\n * <Slider onSelect={(value, interval) => console.log('Slider selected', { value, interval })} />\n */\n onSelect?: (value?: number, interval?: SliderInterval) => void;\n /**\n * Indicates whether the slider should highlight steps.\n * @description\n * The `shouldHighlightSteps` prop determines whether the slider should visually indicate the steps between values.\n * When set to `true`, the slider will show visual markers for each step, making it easier for users to see the increments.\n * @default false\n * @example\n * <Slider shouldHighlightSteps={true} />\n * @optional\n */\n shouldHighlightSteps?: boolean;\n /**\n * Indicates whether the slider should show a label on the thumb.\n * @description\n * The `shouldShowThumbLabel` prop determines whether the slider should display a label on the thumb that shows the current value.\n * When set to `true`, a label will be shown above the thumb, providing users with immediate feedback on the selected value.\n * @default false\n * @example\n * <Slider shouldShowThumbLabel={true} />\n * @optional\n */\n shouldShowThumbLabel?: boolean;\n /**\n * The step size for the slider.\n * @description\n * The `step` prop defines the increment by which the slider value changes when the user interacts with it.\n * It is used to control the granularity of the slider's movement. For example, if `step` is set to 1, the slider will move in increments of 1.\n * @default 1\n * @example\n * <Slider step={5} />\n * @optional\n */\n step?: number;\n /**\n * A function to format the thumb label.\n * @description\n * The `thumbLabelFormatter` prop is a function that formats the value displayed on the thumb label.\n * It receives the current value as an argument and should return a string that will be displayed on the thumb label.\n * This is useful for customizing the appearance of the label, such as adding currency symbols or units.\n * @example\n * <Slider thumbLabelFormatter={(value) => `${value} €`} />\n * @optional\n */\n thumbLabelFormatter?: (value: number) => string;\n /**\n * The current value of the slider.\n * @description\n * The `value` prop is used to set the current value of the slider when it is not configured as an interval.\n * It should be a number between `minValue` and `maxValue`. If the slider is configured as an interval, this prop will be ignored.\n * @example\n * <Slider value={50} />\n * @optional\n */\n value?: number;\n};\n\nconst Slider: FC<SliderProps> = ({\n interval,\n isDisabled,\n maxEnabledValue,\n maxValue,\n minEnabledValue,\n minValue,\n onChange,\n onSelect,\n shouldHighlightSteps = false,\n shouldShowThumbLabel = false,\n step = 1,\n thumbLabelFormatter,\n value,\n}) => {\n const [fromValue, setFromValue] = useState(minEnabledValue ?? minValue);\n const [toValue, setToValue] = useState(maxEnabledValue ?? maxValue);\n const [thumbWidth, setThumbWidth] = useState(20);\n const [isBigSlider, setIsBigSlider] = useState(false);\n\n const previousFromValueRef = useRef(fromValue);\n const previousToValueRef = useRef(toValue);\n const fromSliderRef = useRef<HTMLInputElement>(null);\n const toSliderRef = useRef<HTMLInputElement>(null);\n const fromSliderThumbRef = useRef<HTMLDivElement>(null);\n const toSliderThumbRef = useRef<HTMLDivElement>(null);\n const fromSliderThumbContentRef = useRef<HTMLDivElement>(null);\n const toSliderThumbContentRef = useRef<HTMLDivElement>(null);\n const sliderWrapperRef = useRef<HTMLDivElement>(null);\n\n const sliderWrapperSize = useElementSize(sliderWrapperRef);\n\n const theme = useTheme() as Theme;\n\n const updateFromValue = useCallback((nextValue: number) => {\n previousFromValueRef.current = nextValue;\n setFromValue(nextValue);\n }, []);\n\n const updateToValue = useCallback((nextValue: number) => {\n previousToValueRef.current = nextValue;\n setToValue(nextValue);\n }, []);\n\n const normalizeIntervalValue = useCallback(\n (nextValue: number) => {\n let newValue = Number(nextValue);\n\n if (newValue > maxValue || newValue > maxValue - (maxValue % step)) {\n newValue = maxValue;\n } else if (newValue < minValue) {\n newValue = minValue;\n } else {\n newValue = Math.round(newValue / step) * step;\n }\n\n return newValue;\n },\n [maxValue, minValue, step],\n );\n\n const applyIntervalThumbChange = useCallback(\n (thumb: 'from' | 'to', rawValue: number) => {\n if (!fromSliderRef.current || !toSliderRef.current) {\n return;\n }\n\n const newValue = normalizeIntervalValue(rawValue);\n const isFromThumb = thumb === 'from';\n const previousValue = isFromThumb\n ? previousFromValueRef.current\n : previousToValueRef.current;\n const hasChanged = newValue !== previousValue;\n\n if (isFromThumb) {\n updateFromValue(newValue);\n } else {\n updateToValue(newValue);\n }\n\n const from = Number(fromSliderRef.current.value);\n const to = Number(toSliderRef.current.value);\n\n if (hasChanged && typeof onChange === 'function') {\n onChange(undefined, {\n minValue: isFromThumb ? newValue : from,\n maxValue: isFromThumb ? to : newValue,\n });\n }\n\n fillSlider({\n toSlider: toSliderRef.current,\n fromSlider: fromSliderRef.current,\n ...(isFromThumb ? { fromValue: newValue } : { toValue: newValue }),\n theme,\n });\n\n if (isFromThumb) {\n fromSliderRef.current.value = String(newValue > to ? to : newValue);\n } else {\n toSliderRef.current.value = String(from <= newValue ? newValue : from);\n }\n },\n [normalizeIntervalValue, onChange, theme, updateFromValue, updateToValue],\n );\n\n useEffect(() => {\n if (shouldShowThumbLabel) {\n setThumbWidth(getThumbMaxWidth({ maxNumber: maxValue, thumbLabelFormatter }));\n }\n }, [maxValue, shouldShowThumbLabel, thumbLabelFormatter]);\n\n /**\n * This function sets the value\n */\n useEffect(() => {\n if (\n typeof value === 'number' &&\n value >= minValue &&\n value <= maxValue &&\n (typeof minEnabledValue !== 'number' || value >= minEnabledValue) &&\n (typeof maxEnabledValue !== 'number' || value <= maxEnabledValue)\n ) {\n updateFromValue(value);\n }\n }, [maxEnabledValue, maxValue, minEnabledValue, minValue, updateFromValue, value]);\n\n useEffect(() => {\n if (fromValue > toValue) {\n updateFromValue(toValue);\n }\n\n if (toValue < fromValue) {\n updateToValue(fromValue);\n }\n }, [fromValue, toValue, updateFromValue, updateToValue]);\n\n const handleMouseUp = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n const from = Number(fromSliderRef.current?.value);\n const to = Number(toSliderRef.current?.value);\n\n if (typeof onSelect === 'function') {\n onSelect(\n interval ? undefined : from,\n interval ? { maxValue: to, minValue: from } : undefined,\n );\n }\n }, [interval, isDisabled, onSelect]);\n\n const handleControlFromSlider = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n applyIntervalThumbChange('from', Number(event.target.value));\n },\n [applyIntervalThumbChange],\n );\n\n const handleControlToSlider = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (isDisabled) {\n return;\n }\n\n applyIntervalThumbChange('to', Number(event.target.value));\n },\n [applyIntervalThumbChange, isDisabled],\n );\n\n useEffect(() => {\n if (!fromSliderRef.current || !toSliderRef.current || !interval) {\n return;\n }\n\n updateFromValue(interval.minValue);\n updateToValue(interval.maxValue);\n\n fromSliderRef.current.value = String(interval.minValue);\n toSliderRef.current.value = String(interval.maxValue);\n\n fillSlider({\n fromSlider: fromSliderRef.current,\n toSlider: toSliderRef.current,\n theme,\n });\n // Note: An interval can't be in the deps because of rerender\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [theme]);\n\n /**\n * This function updates the value\n */\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (isDisabled) {\n return;\n }\n\n // If interval mode is active, delegate to the \"from\" handler and return early\n if (interval) {\n handleControlFromSlider(event);\n\n return;\n }\n\n // Respect optionally enabled bounds in addition to absolute min/max\n const effectiveMin =\n typeof minEnabledValue === 'number'\n ? Math.max(minValue, minEnabledValue)\n : minValue;\n\n const effectiveMax =\n typeof maxEnabledValue === 'number'\n ? Math.min(maxValue, maxEnabledValue)\n : maxValue;\n\n let newValue = Number(event.target.value);\n\n // Clamp to effective range first\n if (Number.isNaN(newValue)) {\n newValue = effectiveMin;\n }\n\n if (newValue < effectiveMin) newValue = effectiveMin;\n else if (newValue > effectiveMax - (effectiveMax % step)) newValue = effectiveMax;\n else newValue = Math.round(newValue / step) * step;\n\n if (typeof onChange === 'function' && newValue !== previousFromValueRef.current) {\n onChange(newValue);\n }\n\n updateFromValue(newValue);\n },\n [\n handleControlFromSlider,\n interval,\n isDisabled,\n maxEnabledValue,\n maxValue,\n minEnabledValue,\n minValue,\n onChange,\n step,\n updateFromValue,\n ],\n );\n\n const fromSliderThumbPosition = useMemo(() => {\n if (\n typeof fromSliderRef.current?.offsetWidth === 'number' &&\n typeof sliderWrapperSize?.width === 'number'\n ) {\n return calculateGradientOffset({\n maxValue,\n minValue,\n sliderWidth: fromSliderRef.current.offsetWidth,\n thumbWidth: 20,\n value: fromValue,\n wrapperWidth: sliderWrapperSize.width,\n });\n }\n\n return 0;\n }, [fromValue, maxValue, minValue, sliderWrapperSize?.width]);\n\n const toSliderThumbPosition = useMemo(() => {\n if (\n typeof toSliderRef.current?.offsetWidth === 'number' &&\n typeof sliderWrapperSize?.width === 'number'\n ) {\n return calculateGradientOffset({\n maxValue,\n minValue,\n sliderWidth: toSliderRef.current.offsetWidth,\n thumbWidth: 20,\n value: toValue,\n wrapperWidth: sliderWrapperSize.width,\n });\n }\n\n return 0;\n }, [maxValue, minValue, sliderWrapperSize?.width, toValue]);\n\n const toSliderThumbContentPosition = useMemo(\n () =>\n calculatePopupPosition({\n min: minValue,\n max: maxValue,\n sliderValue: toValue,\n popupWidth: thumbWidth,\n }),\n [maxValue, minValue, thumbWidth, toValue],\n );\n\n const fromSliderThumbContentPosition = useMemo(\n () =>\n calculatePopupPosition({\n min: minValue,\n max: maxValue,\n sliderValue: fromValue,\n popupWidth: thumbWidth,\n }),\n [fromValue, maxValue, minValue, thumbWidth],\n );\n\n const handleTouchStart = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n void setRefreshScrollEnabled(false);\n\n if (shouldShowThumbLabel) {\n setIsBigSlider(true);\n }\n }, [isDisabled, shouldShowThumbLabel]);\n\n const handleTouchEnd = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n void setRefreshScrollEnabled(true);\n\n const from = Number(fromSliderRef.current?.value);\n const to = Number(toSliderRef.current?.value);\n\n if (typeof onSelect === 'function') {\n onSelect(\n interval ? undefined : from,\n interval ? { maxValue: to, minValue: from } : undefined,\n );\n }\n\n if (shouldShowThumbLabel) {\n setIsBigSlider(false);\n }\n }, [interval, isDisabled, onSelect, shouldShowThumbLabel]);\n\n const highlightedStepElements = useMemo(() => {\n const sliderWidth = fromSliderRef.current?.offsetWidth ?? 0;\n const wrapperWidth = sliderWrapperSize?.width ?? 0;\n\n if (!shouldHighlightSteps || interval || sliderWidth === 0 || wrapperWidth === 0) {\n return null;\n }\n\n const elements: ReactNode[] = [];\n\n for (let i = minValue; i <= maxValue; i += step) {\n const isStepDisabled =\n (typeof minEnabledValue === 'number' && i < minEnabledValue) ||\n (typeof maxEnabledValue === 'number' && i > maxEnabledValue);\n\n const offset = (wrapperWidth - sliderWidth) / 2;\n const stepWidth = (sliderWidth / (maxValue - minValue)) * step;\n\n elements.push(\n <StyledHighlightedStep\n key={`step--${i}`}\n $isDisabled={isStepDisabled}\n $isFilled={i < fromValue}\n $leftPosition={offset + stepWidth * i}\n />,\n );\n }\n\n return elements;\n }, [\n fromValue,\n interval,\n maxEnabledValue,\n maxValue,\n minEnabledValue,\n minValue,\n shouldHighlightSteps,\n sliderWrapperSize?.width,\n step,\n ]);\n\n const fromInputBackground = useMemo(() => {\n if (interval) return undefined;\n\n const gradientPoints: string[] = [];\n\n const getPercentage = (x: number) => ((x - minValue) / (maxValue - minValue)) * 100;\n\n if (typeof minEnabledValue === 'number') {\n gradientPoints.push('rgb(215, 215, 215) 0%');\n gradientPoints.push(`rgb(215, 215, 215) ${getPercentage(minEnabledValue)}%`);\n gradientPoints.push(`${theme['409'] ?? ''} ${getPercentage(minEnabledValue)}%`);\n } else {\n gradientPoints.push(`${theme['409'] ?? ''} 0%`);\n }\n\n gradientPoints.push(`${theme['409'] ?? ''} ${getPercentage(fromValue)}%`);\n gradientPoints.push(`${theme['403'] ?? ''} ${getPercentage(fromValue)}%`);\n\n if (typeof maxEnabledValue === 'number') {\n gradientPoints.push(`${theme['403'] ?? ''} ${getPercentage(maxEnabledValue)}%`);\n gradientPoints.push(`rgb(215, 215, 215) ${getPercentage(maxEnabledValue)}%`);\n gradientPoints.push('rgb(215, 215, 215) 100%');\n } else {\n gradientPoints.push(`${theme['403'] ?? ''} 100%`);\n }\n\n return `linear-gradient(to right, ${gradientPoints.join(', ')})`;\n }, [fromValue, interval, maxEnabledValue, maxValue, minEnabledValue, minValue, theme]);\n\n return useMemo(\n () => (\n <StyledSlider ref={sliderWrapperRef} $isDisabled={isDisabled}>\n {highlightedStepElements}\n <StyledSliderInput\n animate={{ height: isBigSlider ? 30 : 10 }}\n initial={{ height: 10 }}\n exit={{ height: 10 }}\n $thumbWidth={40}\n ref={fromSliderRef}\n $isInterval={!!interval}\n type=\"range\"\n value={fromValue}\n step={0.01}\n max={maxValue}\n min={minValue}\n onTouchStart={handleTouchStart}\n onTouchEnd={handleTouchEnd}\n onChange={handleInputChange}\n onMouseUp={handleMouseUp}\n $background={fromInputBackground}\n />\n <StyledSliderThumb\n ref={fromSliderThumbRef}\n $position={fromSliderThumbPosition}\n $isBigSlider={isBigSlider}\n >\n {shouldShowThumbLabel && (\n <StyledSliderThumbLabel\n $width={thumbWidth}\n $isBigSlider={isBigSlider}\n $position={fromSliderThumbContentPosition}\n ref={fromSliderThumbContentRef}\n >\n {typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(fromValue)\n : fromValue}\n </StyledSliderThumbLabel>\n )}\n </StyledSliderThumb>\n {interval && (\n <StyledSliderThumb\n ref={toSliderThumbRef}\n $position={toSliderThumbPosition}\n $isBigSlider={isBigSlider}\n >\n {shouldShowThumbLabel && (\n <StyledSliderThumbLabel\n $width={thumbWidth}\n $isBigSlider={isBigSlider}\n $position={toSliderThumbContentPosition}\n ref={toSliderThumbContentRef}\n >\n {typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(toValue)\n : toValue}\n </StyledSliderThumbLabel>\n )}\n </StyledSliderThumb>\n )}\n {interval && (\n <StyledSliderInput\n animate={{ height: isBigSlider ? 30 : 10 }}\n initial={{ height: 10 }}\n exit={{ height: 10 }}\n $thumbWidth={40}\n ref={toSliderRef}\n $isInterval={!!interval}\n type=\"range\"\n value={toValue}\n step={0.01}\n max={maxValue}\n min={minValue}\n onTouchStart={handleTouchStart}\n onTouchEnd={handleTouchEnd}\n onChange={handleControlToSlider}\n onMouseUp={handleMouseUp}\n />\n )}\n </StyledSlider>\n ),\n [\n fromInputBackground,\n fromSliderThumbContentPosition,\n fromSliderThumbPosition,\n fromValue,\n handleControlToSlider,\n handleInputChange,\n handleMouseUp,\n handleTouchEnd,\n handleTouchStart,\n highlightedStepElements,\n interval,\n isBigSlider,\n isDisabled,\n maxValue,\n minValue,\n shouldShowThumbLabel,\n thumbLabelFormatter,\n thumbWidth,\n toSliderThumbContentPosition,\n toSliderThumbPosition,\n toValue,\n ],\n );\n};\n\nSlider.displayName = 'Slider';\n\nexport default Slider;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,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,4BAA4B,EAC5BF,qBAAqB,EACrBnE,OAAO,CAEf,CAAC;AACL,CAAC;AAEDjB,MAAM,CAACqI,WAAW,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhJ,OAAA,GAEfS,MAAM","ignoreList":[]}
1
+ {"version":3,"file":"Slider.js","names":["_chaynsApi","require","_react","_interopRequireWildcard","_styledComponents","_element","_slider","_Slider","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Slider","interval","isDisabled","maxEnabledValue","maxValue","minEnabledValue","minValue","onChange","onSelect","shouldHighlightSteps","shouldShowThumbLabel","step","thumbLabelFormatter","value","fromValue","setFromValue","useState","toValue","setToValue","thumbWidth","setThumbWidth","isBigSlider","setIsBigSlider","previousFromValueRef","useRef","previousToValueRef","fromSliderRef","toSliderRef","fromSliderThumbRef","toSliderThumbRef","fromSliderThumbContentRef","toSliderThumbContentRef","sliderWrapperRef","sliderWrapperSize","useElementSize","theme","useTheme","updateFromValue","useCallback","nextValue","current","updateToValue","normalizeIntervalValue","newValue","Number","Math","round","applyIntervalThumbChange","thumb","rawValue","isFromThumb","previousValue","hasChanged","from","to","undefined","fillSlider","toSlider","fromSlider","String","useEffect","getThumbMaxWidth","maxNumber","handleMouseUp","_fromSliderRef$curren","_toSliderRef$current","handleControlFromSlider","event","target","handleControlToSlider","handleInputChange","effectiveMin","max","effectiveMax","min","isNaN","fromSliderThumbPosition","useMemo","_fromSliderRef$curren2","offsetWidth","width","calculateGradientOffset","sliderWidth","wrapperWidth","toSliderThumbPosition","_toSliderRef$current2","toSliderThumbContentPosition","calculatePopupPosition","sliderValue","popupWidth","fromSliderThumbContentPosition","handleTouchStart","setRefreshScrollEnabled","handleTouchEnd","_fromSliderRef$curren3","_toSliderRef$current3","highlightedStepElements","_fromSliderRef$curren4","elements","isStepDisabled","offset","stepWidth","push","createElement","StyledHighlightedStep","key","$isDisabled","$isFilled","$leftPosition","fromInputBackground","gradientPoints","getPercentage","x","join","StyledSlider","ref","StyledSliderInput","animate","height","initial","exit","$thumbWidth","$isInterval","type","onTouchStart","onTouchEnd","onMouseUp","$background","StyledSliderThumb","$position","$isBigSlider","StyledSliderThumbLabel","$width","displayName","_default","exports"],"sources":["../../../../src/components/slider/Slider.tsx"],"sourcesContent":["import { setRefreshScrollEnabled } from 'chayns-api';\nimport React, {\n ChangeEvent,\n FC,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTheme } from 'styled-components';\nimport { useElementSize } from '../../hooks/element';\nimport {\n calculateGradientOffset,\n calculatePopupPosition,\n fillSlider,\n getThumbMaxWidth,\n} from '../../utils/slider';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport {\n StyledHighlightedStep,\n StyledSlider,\n StyledSliderInput,\n StyledSliderThumb,\n StyledSliderThumbLabel,\n} from './Slider.styles';\n\nexport interface SliderInterval {\n maxValue: number;\n minValue: number;\n}\n\nexport type SliderProps = {\n /**\n * The current interval of the slider.\n * @description\n * The `interval` prop is used to define a range for the slider, allowing users to select a minimum and maximum value.\n * This is particularly useful for scenarios where you want to allow users to select a range of values, such as price ranges or date ranges.\n * When provided, the slider will display two thumbs, one for the minimum value and one for the maximum value.\n * @example\n * <Slider interval={{ minValue: 10, maxValue: 50 }} />\n * @optional\n */\n interval?: SliderInterval;\n /**\n * Disables the slider, preventing user interaction.\n * @description\n * The `isDisabled` prop is used to disable the slider, making it unresponsive to user input.\n * When set to `true`, the slider cannot be moved, and its appearance may change to indicate that it is disabled.\n * This is useful for scenarios where the slider should not be interacted with, such as when the data it controls is not available or when the user does not have permission to change the value.\n * @default false\n * @example\n * <Slider isDisabled={true} />\n * @optional\n */\n isDisabled?: boolean;\n /**\n * The maximum enabled value of the slider.\n * @description\n * The `maxEnabledValue` prop is used to define the maximum value that can be selected on the slider.\n * It is particularly useful when you want to set an upper limit for the slider's range, ensuring that users cannot select values above this threshold.\n * This prop is optional and can be used in conjunction with the `maxValue` prop to create a more flexible slider.\n * @example\n * <Slider maxEnabledValue={75} />\n * @optional\n */\n maxEnabledValue?: number;\n /**\n * The maximum value of the slider.\n * @description\n * The `maxValue` prop defines the upper limit of the slider's range. It is used to set the maximum value that can be selected by the user.\n * This value should be greater than or equal to `minValue`.\n * @example\n * <Slider maxValue={200} />\n */\n maxValue: number;\n /**\n * The minimum enabled value of the slider.\n * @description\n * The `minEnabledValue` prop is used to define the minimum value that can be selected on the slider.\n * It is particularly useful when you want to set a lower limit for the slider's range, ensuring that users cannot select values below this threshold.\n * This prop is optional and can be used in conjunction with the `minValue` prop to create a more flexible slider.\n * @example\n * <Slider minEnabledValue={25} />\n * @optional\n */\n minEnabledValue?: number;\n /**\n * The minimum value of the slider.\n * @description\n * The `minValue` prop defines the lower limit of the slider's range. It is used to set the minimum value that can be selected by the user.\n * This value should be less than or equal to `maxValue`.\n * @example\n * <Slider minValue={0} />\n */\n minValue: number;\n /**\n * Callback function that is called when the slider value changes.\n * @description\n * The `onChange` prop is a callback function that is triggered whenever the slider value changes.\n * It receives the new value or interval of the slider as an argument, allowing you to update your application state or perform other actions based on the new value.\n * If the slider is configured as an interval, it will receive an object with `minValue` and `maxValue`.\n * @example\n * <Slider onChange={(value, interval) => console.log('Slider changed', { value, interval })} />\n */\n onChange?: (value?: number, interval?: SliderInterval) => void;\n /**\n * Callback function that is called when the slider selection is finalized.\n * @description\n * The `onSelect` prop is a callback function that is triggered when the user finishes interacting with the slider, such as releasing the mouse or touch after dragging the thumb.\n * It receives the selected value or interval as arguments, allowing you to perform actions based on the final selection.\n * If the slider is configured as an interval, it will receive an object with `minValue` and `maxValue`.\n * @example\n * <Slider onSelect={(value, interval) => console.log('Slider selected', { value, interval })} />\n */\n onSelect?: (value?: number, interval?: SliderInterval) => void;\n /**\n * Indicates whether the slider should highlight steps.\n * @description\n * The `shouldHighlightSteps` prop determines whether the slider should visually indicate the steps between values.\n * When set to `true`, the slider will show visual markers for each step, making it easier for users to see the increments.\n * @default false\n * @example\n * <Slider shouldHighlightSteps={true} />\n * @optional\n */\n shouldHighlightSteps?: boolean;\n /**\n * Indicates whether the slider should show a label on the thumb.\n * @description\n * The `shouldShowThumbLabel` prop determines whether the slider should display a label on the thumb that shows the current value.\n * When set to `true`, a label will be shown above the thumb, providing users with immediate feedback on the selected value.\n * @default false\n * @example\n * <Slider shouldShowThumbLabel={true} />\n * @optional\n */\n shouldShowThumbLabel?: boolean;\n /**\n * The step size for the slider.\n * @description\n * The `step` prop defines the increment by which the slider value changes when the user interacts with it.\n * It is used to control the granularity of the slider's movement. For example, if `step` is set to 1, the slider will move in increments of 1.\n * @default 1\n * @example\n * <Slider step={5} />\n * @optional\n */\n step?: number;\n /**\n * A function to format the thumb label.\n * @description\n * The `thumbLabelFormatter` prop is a function that formats the value displayed on the thumb label.\n * It receives the current value as an argument and should return a string that will be displayed on the thumb label.\n * This is useful for customizing the appearance of the label, such as adding currency symbols or units.\n * @example\n * <Slider thumbLabelFormatter={(value) => `${value} €`} />\n * @optional\n */\n thumbLabelFormatter?: (value: number, isMeasuring?: boolean) => string;\n /**\n * The current value of the slider.\n * @description\n * The `value` prop is used to set the current value of the slider when it is not configured as an interval.\n * It should be a number between `minValue` and `maxValue`. If the slider is configured as an interval, this prop will be ignored.\n * @example\n * <Slider value={50} />\n * @optional\n */\n value?: number;\n};\n\nconst Slider: FC<SliderProps> = ({\n interval,\n isDisabled,\n maxEnabledValue,\n maxValue,\n minEnabledValue,\n minValue,\n onChange,\n onSelect,\n shouldHighlightSteps = false,\n shouldShowThumbLabel = false,\n step = 1,\n thumbLabelFormatter,\n value,\n}) => {\n const [fromValue, setFromValue] = useState(minEnabledValue ?? minValue);\n const [toValue, setToValue] = useState(maxEnabledValue ?? maxValue);\n const [thumbWidth, setThumbWidth] = useState(20);\n const [isBigSlider, setIsBigSlider] = useState(false);\n\n const previousFromValueRef = useRef(fromValue);\n const previousToValueRef = useRef(toValue);\n const fromSliderRef = useRef<HTMLInputElement>(null);\n const toSliderRef = useRef<HTMLInputElement>(null);\n const fromSliderThumbRef = useRef<HTMLDivElement>(null);\n const toSliderThumbRef = useRef<HTMLDivElement>(null);\n const fromSliderThumbContentRef = useRef<HTMLDivElement>(null);\n const toSliderThumbContentRef = useRef<HTMLDivElement>(null);\n const sliderWrapperRef = useRef<HTMLDivElement>(null);\n\n const sliderWrapperSize = useElementSize(sliderWrapperRef);\n\n const theme = useTheme() as Theme;\n\n const updateFromValue = useCallback((nextValue: number) => {\n previousFromValueRef.current = nextValue;\n setFromValue(nextValue);\n }, []);\n\n const updateToValue = useCallback((nextValue: number) => {\n previousToValueRef.current = nextValue;\n setToValue(nextValue);\n }, []);\n\n const normalizeIntervalValue = useCallback(\n (nextValue: number) => {\n let newValue = Number(nextValue);\n\n if (newValue > maxValue || newValue > maxValue - (maxValue % step)) {\n newValue = maxValue;\n } else if (newValue < minValue) {\n newValue = minValue;\n } else {\n newValue = Math.round(newValue / step) * step;\n }\n\n return newValue;\n },\n [maxValue, minValue, step],\n );\n\n const applyIntervalThumbChange = useCallback(\n (thumb: 'from' | 'to', rawValue: number) => {\n if (!fromSliderRef.current || !toSliderRef.current) {\n return;\n }\n\n const newValue = normalizeIntervalValue(rawValue);\n const isFromThumb = thumb === 'from';\n const previousValue = isFromThumb\n ? previousFromValueRef.current\n : previousToValueRef.current;\n const hasChanged = newValue !== previousValue;\n\n if (isFromThumb) {\n updateFromValue(newValue);\n } else {\n updateToValue(newValue);\n }\n\n const from = Number(fromSliderRef.current.value);\n const to = Number(toSliderRef.current.value);\n\n if (hasChanged && typeof onChange === 'function') {\n onChange(undefined, {\n minValue: isFromThumb ? newValue : from,\n maxValue: isFromThumb ? to : newValue,\n });\n }\n\n fillSlider({\n toSlider: toSliderRef.current,\n fromSlider: fromSliderRef.current,\n ...(isFromThumb ? { fromValue: newValue } : { toValue: newValue }),\n theme,\n });\n\n if (isFromThumb) {\n fromSliderRef.current.value = String(newValue > to ? to : newValue);\n } else {\n toSliderRef.current.value = String(from <= newValue ? newValue : from);\n }\n },\n [normalizeIntervalValue, onChange, theme, updateFromValue, updateToValue],\n );\n\n useEffect(() => {\n if (shouldShowThumbLabel) {\n setThumbWidth(getThumbMaxWidth({ maxNumber: maxValue, thumbLabelFormatter }));\n }\n }, [maxValue, shouldShowThumbLabel, thumbLabelFormatter]);\n\n /**\n * This function sets the value\n */\n useEffect(() => {\n if (\n typeof value === 'number' &&\n value >= minValue &&\n value <= maxValue &&\n (typeof minEnabledValue !== 'number' || value >= minEnabledValue) &&\n (typeof maxEnabledValue !== 'number' || value <= maxEnabledValue)\n ) {\n updateFromValue(value);\n }\n }, [maxEnabledValue, maxValue, minEnabledValue, minValue, updateFromValue, value]);\n\n useEffect(() => {\n if (fromValue > toValue) {\n updateFromValue(toValue);\n }\n\n if (toValue < fromValue) {\n updateToValue(fromValue);\n }\n }, [fromValue, toValue, updateFromValue, updateToValue]);\n\n const handleMouseUp = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n const from = Number(fromSliderRef.current?.value);\n const to = Number(toSliderRef.current?.value);\n\n if (typeof onSelect === 'function') {\n onSelect(\n interval ? undefined : from,\n interval ? { maxValue: to, minValue: from } : undefined,\n );\n }\n }, [interval, isDisabled, onSelect]);\n\n const handleControlFromSlider = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n applyIntervalThumbChange('from', Number(event.target.value));\n },\n [applyIntervalThumbChange],\n );\n\n const handleControlToSlider = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (isDisabled) {\n return;\n }\n\n applyIntervalThumbChange('to', Number(event.target.value));\n },\n [applyIntervalThumbChange, isDisabled],\n );\n\n useEffect(() => {\n if (!fromSliderRef.current || !toSliderRef.current || !interval) {\n return;\n }\n\n updateFromValue(interval.minValue);\n updateToValue(interval.maxValue);\n\n fromSliderRef.current.value = String(interval.minValue);\n toSliderRef.current.value = String(interval.maxValue);\n\n fillSlider({\n fromSlider: fromSliderRef.current,\n toSlider: toSliderRef.current,\n theme,\n });\n // Note: An interval can't be in the deps because of rerender\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [theme]);\n\n /**\n * This function updates the value\n */\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (isDisabled) {\n return;\n }\n\n // If interval mode is active, delegate to the \"from\" handler and return early\n if (interval) {\n handleControlFromSlider(event);\n\n return;\n }\n\n // Respect optionally enabled bounds in addition to absolute min/max\n const effectiveMin =\n typeof minEnabledValue === 'number'\n ? Math.max(minValue, minEnabledValue)\n : minValue;\n\n const effectiveMax =\n typeof maxEnabledValue === 'number'\n ? Math.min(maxValue, maxEnabledValue)\n : maxValue;\n\n let newValue = Number(event.target.value);\n\n // Clamp to effective range first\n if (Number.isNaN(newValue)) {\n newValue = effectiveMin;\n }\n\n if (newValue < effectiveMin) newValue = effectiveMin;\n else if (newValue > effectiveMax - (effectiveMax % step)) newValue = effectiveMax;\n else newValue = Math.round(newValue / step) * step;\n\n if (typeof onChange === 'function' && newValue !== previousFromValueRef.current) {\n onChange(newValue);\n }\n\n updateFromValue(newValue);\n },\n [\n handleControlFromSlider,\n interval,\n isDisabled,\n maxEnabledValue,\n maxValue,\n minEnabledValue,\n minValue,\n onChange,\n step,\n updateFromValue,\n ],\n );\n\n const fromSliderThumbPosition = useMemo(() => {\n if (\n typeof fromSliderRef.current?.offsetWidth === 'number' &&\n typeof sliderWrapperSize?.width === 'number'\n ) {\n return calculateGradientOffset({\n maxValue,\n minValue,\n sliderWidth: fromSliderRef.current.offsetWidth,\n thumbWidth: 20,\n value: fromValue,\n wrapperWidth: sliderWrapperSize.width,\n });\n }\n\n return 0;\n }, [fromValue, maxValue, minValue, sliderWrapperSize?.width]);\n\n const toSliderThumbPosition = useMemo(() => {\n if (\n typeof toSliderRef.current?.offsetWidth === 'number' &&\n typeof sliderWrapperSize?.width === 'number'\n ) {\n return calculateGradientOffset({\n maxValue,\n minValue,\n sliderWidth: toSliderRef.current.offsetWidth,\n thumbWidth: 20,\n value: toValue,\n wrapperWidth: sliderWrapperSize.width,\n });\n }\n\n return 0;\n }, [maxValue, minValue, sliderWrapperSize?.width, toValue]);\n\n const toSliderThumbContentPosition = useMemo(\n () =>\n calculatePopupPosition({\n min: minValue,\n max: maxValue,\n sliderValue: toValue,\n popupWidth: thumbWidth,\n }),\n [maxValue, minValue, thumbWidth, toValue],\n );\n\n const fromSliderThumbContentPosition = useMemo(\n () =>\n calculatePopupPosition({\n min: minValue,\n max: maxValue,\n sliderValue: fromValue,\n popupWidth: thumbWidth,\n }),\n [fromValue, maxValue, minValue, thumbWidth],\n );\n\n const handleTouchStart = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n void setRefreshScrollEnabled(false);\n\n if (shouldShowThumbLabel) {\n setIsBigSlider(true);\n }\n }, [isDisabled, shouldShowThumbLabel]);\n\n const handleTouchEnd = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n void setRefreshScrollEnabled(true);\n\n const from = Number(fromSliderRef.current?.value);\n const to = Number(toSliderRef.current?.value);\n\n if (typeof onSelect === 'function') {\n onSelect(\n interval ? undefined : from,\n interval ? { maxValue: to, minValue: from } : undefined,\n );\n }\n\n if (shouldShowThumbLabel) {\n setIsBigSlider(false);\n }\n }, [interval, isDisabled, onSelect, shouldShowThumbLabel]);\n\n const highlightedStepElements = useMemo(() => {\n const sliderWidth = fromSliderRef.current?.offsetWidth ?? 0;\n const wrapperWidth = sliderWrapperSize?.width ?? 0;\n\n if (!shouldHighlightSteps || interval || sliderWidth === 0 || wrapperWidth === 0) {\n return null;\n }\n\n const elements: ReactNode[] = [];\n\n for (let i = minValue; i <= maxValue; i += step) {\n const isStepDisabled =\n (typeof minEnabledValue === 'number' && i < minEnabledValue) ||\n (typeof maxEnabledValue === 'number' && i > maxEnabledValue);\n\n const offset = (wrapperWidth - sliderWidth) / 2;\n const stepWidth = (sliderWidth / (maxValue - minValue)) * step;\n\n elements.push(\n <StyledHighlightedStep\n key={`step--${i}`}\n $isDisabled={isStepDisabled}\n $isFilled={i < fromValue}\n $leftPosition={offset + stepWidth * i}\n />,\n );\n }\n\n return elements;\n }, [\n fromValue,\n interval,\n maxEnabledValue,\n maxValue,\n minEnabledValue,\n minValue,\n shouldHighlightSteps,\n sliderWrapperSize?.width,\n step,\n ]);\n\n const fromInputBackground = useMemo(() => {\n if (interval) return undefined;\n\n const gradientPoints: string[] = [];\n\n const getPercentage = (x: number) => ((x - minValue) / (maxValue - minValue)) * 100;\n\n if (typeof minEnabledValue === 'number') {\n gradientPoints.push('rgb(215, 215, 215) 0%');\n gradientPoints.push(`rgb(215, 215, 215) ${getPercentage(minEnabledValue)}%`);\n gradientPoints.push(`${theme['409'] ?? ''} ${getPercentage(minEnabledValue)}%`);\n } else {\n gradientPoints.push(`${theme['409'] ?? ''} 0%`);\n }\n\n gradientPoints.push(`${theme['409'] ?? ''} ${getPercentage(fromValue)}%`);\n gradientPoints.push(`${theme['403'] ?? ''} ${getPercentage(fromValue)}%`);\n\n if (typeof maxEnabledValue === 'number') {\n gradientPoints.push(`${theme['403'] ?? ''} ${getPercentage(maxEnabledValue)}%`);\n gradientPoints.push(`rgb(215, 215, 215) ${getPercentage(maxEnabledValue)}%`);\n gradientPoints.push('rgb(215, 215, 215) 100%');\n } else {\n gradientPoints.push(`${theme['403'] ?? ''} 100%`);\n }\n\n return `linear-gradient(to right, ${gradientPoints.join(', ')})`;\n }, [fromValue, interval, maxEnabledValue, maxValue, minEnabledValue, minValue, theme]);\n\n return useMemo(\n () => (\n <StyledSlider ref={sliderWrapperRef} $isDisabled={isDisabled}>\n {highlightedStepElements}\n <StyledSliderInput\n animate={{ height: isBigSlider ? 30 : 10 }}\n initial={{ height: 10 }}\n exit={{ height: 10 }}\n $thumbWidth={40}\n ref={fromSliderRef}\n $isInterval={!!interval}\n type=\"range\"\n value={fromValue}\n step={0.01}\n max={maxValue}\n min={minValue}\n onTouchStart={handleTouchStart}\n onTouchEnd={handleTouchEnd}\n onChange={handleInputChange}\n onMouseUp={handleMouseUp}\n $background={fromInputBackground}\n />\n <StyledSliderThumb\n ref={fromSliderThumbRef}\n $position={fromSliderThumbPosition}\n $isBigSlider={isBigSlider}\n >\n {shouldShowThumbLabel && (\n <StyledSliderThumbLabel\n $width={thumbWidth}\n $isBigSlider={isBigSlider}\n $position={fromSliderThumbContentPosition}\n ref={fromSliderThumbContentRef}\n >\n {typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(fromValue)\n : fromValue}\n </StyledSliderThumbLabel>\n )}\n </StyledSliderThumb>\n {interval && (\n <StyledSliderThumb\n ref={toSliderThumbRef}\n $position={toSliderThumbPosition}\n $isBigSlider={isBigSlider}\n >\n {shouldShowThumbLabel && (\n <StyledSliderThumbLabel\n $width={thumbWidth}\n $isBigSlider={isBigSlider}\n $position={toSliderThumbContentPosition}\n ref={toSliderThumbContentRef}\n >\n {typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(toValue)\n : toValue}\n </StyledSliderThumbLabel>\n )}\n </StyledSliderThumb>\n )}\n {interval && (\n <StyledSliderInput\n animate={{ height: isBigSlider ? 30 : 10 }}\n initial={{ height: 10 }}\n exit={{ height: 10 }}\n $thumbWidth={40}\n ref={toSliderRef}\n $isInterval={!!interval}\n type=\"range\"\n value={toValue}\n step={0.01}\n max={maxValue}\n min={minValue}\n onTouchStart={handleTouchStart}\n onTouchEnd={handleTouchEnd}\n onChange={handleControlToSlider}\n onMouseUp={handleMouseUp}\n />\n )}\n </StyledSlider>\n ),\n [\n fromInputBackground,\n fromSliderThumbContentPosition,\n fromSliderThumbPosition,\n fromValue,\n handleControlToSlider,\n handleInputChange,\n handleMouseUp,\n handleTouchEnd,\n handleTouchStart,\n highlightedStepElements,\n interval,\n isBigSlider,\n isDisabled,\n maxValue,\n minValue,\n shouldShowThumbLabel,\n thumbLabelFormatter,\n thumbWidth,\n toSliderThumbContentPosition,\n toSliderThumbPosition,\n toValue,\n ],\n );\n};\n\nSlider.displayName = 'Slider';\n\nexport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AAQ,EACRE,QAAQ,EACRI,oBAAoB,EACpBE,mBAAmB,EACnBO,UAAU,EACVmE,4BAA4B,EAC5BF,qBAAqB,EACrBnE,OAAO,CAEf,CAAC;AACL,CAAC;AAEDjB,MAAM,CAACqI,WAAW,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhJ,OAAA,GAEfS,MAAM","ignoreList":[]}
@@ -72,7 +72,7 @@ const getThumbMaxWidth = ({
72
72
  element.style.minWidth = '20px';
73
73
  element.style.opacity = '0';
74
74
  element.style.position = 'absolute';
75
- element.textContent = typeof thumbLabelFormatter === 'function' ? thumbLabelFormatter(maxNumber) : String(maxNumber);
75
+ element.textContent = typeof thumbLabelFormatter === 'function' ? thumbLabelFormatter(maxNumber, true) : String(maxNumber);
76
76
  document.body.appendChild(element);
77
77
  const width = element.offsetWidth;
78
78
  document.body.removeChild(element);
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","names":["fillSlider","fromSlider","toSlider","theme","fromValue","toValue","rangeDistance","Number","max","min","fromPosition","value","toPosition","backgroundColor","trackColor","gradient","style","background","exports","calculateGradientOffset","maxValue","minValue","sliderWidth","thumbWidth","wrapperWidth","offset","percentage","calculatePopupPosition","sliderValue","popupWidth","leftAtMin","leftAtMax","getThumbMaxWidth","maxNumber","thumbLabelFormatter","element","document","createElement","height","display","padding","whiteSpace","minWidth","opacity","position","textContent","String","body","appendChild","width","offsetWidth","removeChild"],"sources":["../../../src/utils/slider.ts"],"sourcesContent":["import type { Theme } from '../components/color-scheme-provider/ColorSchemeProvider';\n\nexport interface FillSlider {\n fromSlider: HTMLInputElement;\n toSlider: HTMLInputElement;\n fromValue?: number;\n toValue?: number;\n theme: Theme;\n}\n\nexport const fillSlider = ({ fromSlider, toSlider, theme, fromValue, toValue }: FillSlider) => {\n const rangeDistance = Number(toSlider.max) - Number(toSlider.min);\n const fromPosition = Number(fromValue ?? fromSlider.value) - Number(toSlider.min);\n const toPosition = Number(toValue ?? toSlider.value) - Number(toSlider.min);\n\n const backgroundColor = theme['403'];\n const trackColor = theme['409'];\n\n if (!backgroundColor || !trackColor) {\n return;\n }\n\n const gradient = `linear-gradient(\n to right,\n ${backgroundColor} 0%,\n ${backgroundColor} ${(fromPosition / rangeDistance) * 100}%,\n ${trackColor} ${(fromPosition / rangeDistance) * 100}%,\n ${trackColor} ${(toPosition / rangeDistance) * 100}%,\n ${backgroundColor} ${(toPosition / rangeDistance) * 100}%,\n ${backgroundColor} 100%)`;\n\n // Apply the gradient to the appropriate slider\n // eslint-disable-next-line no-param-reassign\n toSlider.style.background = gradient;\n // eslint-disable-next-line no-param-reassign\n fromSlider.style.background = gradient;\n};\n\ninterface CalculateGradientOffset {\n maxValue: number;\n minValue: number;\n sliderWidth: number;\n thumbWidth: number;\n value: number;\n wrapperWidth: number;\n}\n\nexport const calculateGradientOffset = ({\n maxValue,\n minValue,\n sliderWidth,\n thumbWidth,\n value,\n wrapperWidth,\n}: CalculateGradientOffset): number => {\n const offset = (wrapperWidth - sliderWidth) / 2;\n const percentage = (value - minValue) / (maxValue - minValue);\n\n return offset - thumbWidth / 2 + percentage * sliderWidth;\n};\n\ninterface GetThumbMaxWidthOptions {\n maxNumber: number;\n thumbLabelFormatter?: (value: number) => string;\n}\n\ninterface CalculatePopupPositionOptions {\n sliderValue: number;\n min: number;\n max: number;\n popupWidth: number;\n}\n\nexport const calculatePopupPosition = ({\n sliderValue,\n min,\n max,\n popupWidth,\n}: CalculatePopupPositionOptions) => {\n const percentage = (sliderValue - min) / (max - min);\n\n const leftAtMin = -10;\n const leftAtMax = -popupWidth + 25;\n\n return leftAtMin + percentage * (leftAtMax - leftAtMin);\n};\n\nexport const getThumbMaxWidth = ({ maxNumber, thumbLabelFormatter }: GetThumbMaxWidthOptions) => {\n const element = document.createElement('span');\n\n element.style.height = '20px';\n element.style.display = 'flex';\n element.style.padding = '16px';\n element.style.whiteSpace = 'nowrap';\n element.style.minWidth = '20px';\n element.style.opacity = '0';\n element.style.position = 'absolute';\n\n element.textContent =\n typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(maxNumber)\n : String(maxNumber);\n\n document.body.appendChild(element);\n\n const width = element.offsetWidth;\n\n document.body.removeChild(element);\n\n return width;\n};\n"],"mappings":";;;;;;AAUO,MAAMA,UAAU,GAAGA,CAAC;EAAEC,UAAU;EAAEC,QAAQ;EAAEC,KAAK;EAAEC,SAAS;EAAEC;AAAoB,CAAC,KAAK;EAC3F,MAAMC,aAAa,GAAGC,MAAM,CAACL,QAAQ,CAACM,GAAG,CAAC,GAAGD,MAAM,CAACL,QAAQ,CAACO,GAAG,CAAC;EACjE,MAAMC,YAAY,GAAGH,MAAM,CAACH,SAAS,IAAIH,UAAU,CAACU,KAAK,CAAC,GAAGJ,MAAM,CAACL,QAAQ,CAACO,GAAG,CAAC;EACjF,MAAMG,UAAU,GAAGL,MAAM,CAACF,OAAO,IAAIH,QAAQ,CAACS,KAAK,CAAC,GAAGJ,MAAM,CAACL,QAAQ,CAACO,GAAG,CAAC;EAE3E,MAAMI,eAAe,GAAGV,KAAK,CAAC,KAAK,CAAC;EACpC,MAAMW,UAAU,GAAGX,KAAK,CAAC,KAAK,CAAC;EAE/B,IAAI,CAACU,eAAe,IAAI,CAACC,UAAU,EAAE;IACjC;EACJ;EAEA,MAAMC,QAAQ,GAAG;AACrB;AACA,QAAQF,eAAe;AACvB,QAAQA,eAAe,IAAKH,YAAY,GAAGJ,aAAa,GAAI,GAAG;AAC/D,QAAQQ,UAAU,IAAKJ,YAAY,GAAGJ,aAAa,GAAI,GAAG;AAC1D,QAAQQ,UAAU,IAAKF,UAAU,GAAGN,aAAa,GAAI,GAAG;AACxD,QAAQO,eAAe,IAAKD,UAAU,GAAGN,aAAa,GAAI,GAAG;AAC7D,QAAQO,eAAe,QAAQ;;EAE3B;EACA;EACAX,QAAQ,CAACc,KAAK,CAACC,UAAU,GAAGF,QAAQ;EACpC;EACAd,UAAU,CAACe,KAAK,CAACC,UAAU,GAAGF,QAAQ;A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CAAC0B,QAAQ,GAAG,MAAM;EAC/BP,OAAO,CAACnB,KAAK,CAAC2B,OAAO,GAAG,GAAG;EAC3BR,OAAO,CAACnB,KAAK,CAAC4B,QAAQ,GAAG,UAAU;EAEnCT,OAAO,CAACU,WAAW,GACf,OAAOX,mBAAmB,KAAK,UAAU,GACnCA,mBAAmB,CAACD,SAAS,CAAC,GAC9Ba,MAAM,CAACb,SAAS,CAAC;EAE3BG,QAAQ,CAACW,IAAI,CAACC,WAAW,CAACb,OAAO,CAAC;EAElC,MAAMc,KAAK,GAAGd,OAAO,CAACe,WAAW;EAEjCd,QAAQ,CAACW,IAAI,CAACI,WAAW,CAAChB,OAAO,CAAC;EAElC,OAAOc,KAAK;AAChB,CAAC;AAAC/B,OAAA,CAAAc,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"slider.js","names":["fillSlider","fromSlider","toSlider","theme","fromValue","toValue","rangeDistance","Number","max","min","fromPosition","value","toPosition","backgroundColor","trackColor","gradient","style","background","exports","calculateGradientOffset","maxValue","minValue","sliderWidth","thumbWidth","wrapperWidth","offset","percentage","calculatePopupPosition","sliderValue","popupWidth","leftAtMin","leftAtMax","getThumbMaxWidth","maxNumber","thumbLabelFormatter","element","document","createElement","height","display","padding","whiteSpace","minWidth","opacity","position","textContent","String","body","appendChild","width","offsetWidth","removeChild"],"sources":["../../../src/utils/slider.ts"],"sourcesContent":["import type { Theme } from '../components/color-scheme-provider/ColorSchemeProvider';\n\nexport interface FillSlider {\n fromSlider: HTMLInputElement;\n toSlider: HTMLInputElement;\n fromValue?: number;\n toValue?: number;\n theme: Theme;\n}\n\nexport const fillSlider = ({ fromSlider, toSlider, theme, fromValue, toValue }: FillSlider) => {\n const rangeDistance = Number(toSlider.max) - Number(toSlider.min);\n const fromPosition = Number(fromValue ?? fromSlider.value) - Number(toSlider.min);\n const toPosition = Number(toValue ?? toSlider.value) - Number(toSlider.min);\n\n const backgroundColor = theme['403'];\n const trackColor = theme['409'];\n\n if (!backgroundColor || !trackColor) {\n return;\n }\n\n const gradient = `linear-gradient(\n to right,\n ${backgroundColor} 0%,\n ${backgroundColor} ${(fromPosition / rangeDistance) * 100}%,\n ${trackColor} ${(fromPosition / rangeDistance) * 100}%,\n ${trackColor} ${(toPosition / rangeDistance) * 100}%,\n ${backgroundColor} ${(toPosition / rangeDistance) * 100}%,\n ${backgroundColor} 100%)`;\n\n // Apply the gradient to the appropriate slider\n // eslint-disable-next-line no-param-reassign\n toSlider.style.background = gradient;\n // eslint-disable-next-line no-param-reassign\n fromSlider.style.background = gradient;\n};\n\ninterface CalculateGradientOffset {\n maxValue: number;\n minValue: number;\n sliderWidth: number;\n thumbWidth: number;\n value: number;\n wrapperWidth: number;\n}\n\nexport const calculateGradientOffset = ({\n maxValue,\n minValue,\n sliderWidth,\n thumbWidth,\n value,\n wrapperWidth,\n}: CalculateGradientOffset): number => {\n const offset = (wrapperWidth - sliderWidth) / 2;\n const percentage = (value - minValue) / (maxValue - minValue);\n\n return offset - thumbWidth / 2 + percentage * sliderWidth;\n};\n\ninterface GetThumbMaxWidthOptions {\n maxNumber: number;\n thumbLabelFormatter?: (value: number, isMeasuring?: boolean) => string;\n}\n\ninterface CalculatePopupPositionOptions {\n sliderValue: number;\n min: number;\n max: number;\n popupWidth: number;\n}\n\nexport const calculatePopupPosition = ({\n sliderValue,\n min,\n max,\n popupWidth,\n}: CalculatePopupPositionOptions) => {\n const percentage = (sliderValue - min) / (max - min);\n\n const leftAtMin = -10;\n const leftAtMax = -popupWidth + 25;\n\n return leftAtMin + percentage * (leftAtMax - leftAtMin);\n};\n\nexport const getThumbMaxWidth = ({ maxNumber, thumbLabelFormatter }: GetThumbMaxWidthOptions) => {\n const element = document.createElement('span');\n\n element.style.height = '20px';\n element.style.display = 'flex';\n element.style.padding = '16px';\n element.style.whiteSpace = 'nowrap';\n element.style.minWidth = '20px';\n element.style.opacity = '0';\n element.style.position = 'absolute';\n\n element.textContent =\n typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(maxNumber, true)\n : String(maxNumber);\n\n document.body.appendChild(element);\n\n const width = element.offsetWidth;\n\n document.body.removeChild(element);\n\n return width;\n};\n"],"mappings":";;;;;;AAUO,MAAMA,UAAU,GAAGA,CAAC;EAAEC,UAAU;EAAEC,QAAQ;EAAEC,KAAK;EAAEC,SAAS;EAAEC;AAAoB,CAAC,KAAK;EAC3F,MAAMC,aAAa,GAAGC,MAAM,CAACL,QAAQ,CAACM,GAAG,CAAC,GAAGD,MAAM,CAACL,QAAQ,CAACO,GAAG,CAAC;EACjE,MAAMC,YAAY,GAAGH,MAAM,CAACH,SAAS,IAAIH,UAAU,CAACU,KAAK,CAAC,GAAGJ,MAAM,CAACL,QAAQ,CAACO,GAAG,CAAC;EACjF,MAAMG,UAAU,GAAGL,MAAM,CAACF,OAAO,IAAIH,QAAQ,CAACS,KAAK,CAAC,GAAGJ,MAAM,CAACL,QAAQ,CAACO,GAAG,CAAC;EAE3E,MAAMI,eAAe,GAAGV,KAAK,CAAC,KAAK,CAAC;EACpC,MAAMW,UAAU,GAAGX,KAAK,CAAC,KAAK,CAAC;EAE/B,IAAI,CAACU,eAAe,IAAI,CAACC,UAAU,EAAE;IACjC;EACJ;EAEA,MAAMC,QAAQ,GAAG;AACrB;AACA,QAAQF,eAAe;AACvB,QAAQA,eAAe,IAAKH,YAAY,GAAGJ,aAAa,GAAI,GAAG;AAC/D,QAAQQ,UAAU,IAAKJ,YAAY,GAAGJ,aAAa,GAAI,GAAG;AAC1D,QAAQQ,UAAU,IAAKF,UAAU,GAAGN,aAAa,GAAI,GAAG;AACxD,QAAQO,eAAe,IAAKD,UAAU,GAAGN,aAAa,GAAI,GAAG;AAC7D,QAAQO,eAAe,QAAQ;;EAE3B;EACA;EACAX,QAAQ,CAACc,KAAK,CAACC,UAAU,GAAGF,QAAQ;EACpC;EACAd,UAAU,CAACe,KAAK,CAACC,UAAU,GAAGF,QAAQ;AAC1C,CAAC;AAACG,OAAA,CAAAlB,UA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,OAAO,CAACnB,KAAK,CAAC2B,OAAO,GAAG,GAAG;EAC3BR,OAAO,CAACnB,KAAK,CAAC4B,QAAQ,GAAG,UAAU;EAEnCT,OAAO,CAACU,WAAW,GACf,OAAOX,mBAAmB,KAAK,UAAU,GACnCA,mBAAmB,CAACD,SAAS,EAAE,IAAI,CAAC,GACpCa,MAAM,CAACb,SAAS,CAAC;EAE3BG,QAAQ,CAACW,IAAI,CAACC,WAAW,CAACb,OAAO,CAAC;EAElC,MAAMc,KAAK,GAAGd,OAAO,CAACe,WAAW;EAEjCd,QAAQ,CAACW,IAAI,CAACI,WAAW,CAAChB,OAAO,CAAC;EAElC,OAAOc,KAAK;AAChB,CAAC;AAAC/B,OAAA,CAAAc,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.js","names":["setRefreshScrollEnabled","React","useCallback","useEffect","useMemo","useRef","useState","useTheme","useElementSize","calculateGradientOffset","calculatePopupPosition","fillSlider","getThumbMaxWidth","StyledHighlightedStep","StyledSlider","StyledSliderInput","StyledSliderThumb","StyledSliderThumbLabel","Slider","interval","isDisabled","maxEnabledValue","maxValue","minEnabledValue","minValue","onChange","onSelect","shouldHighlightSteps","shouldShowThumbLabel","step","thumbLabelFormatter","value","fromValue","setFromValue","toValue","setToValue","thumbWidth","setThumbWidth","isBigSlider","setIsBigSlider","previousFromValueRef","previousToValueRef","fromSliderRef","toSliderRef","fromSliderThumbRef","toSliderThumbRef","fromSliderThumbContentRef","toSliderThumbContentRef","sliderWrapperRef","sliderWrapperSize","theme","updateFromValue","nextValue","current","updateToValue","normalizeIntervalValue","newValue","Number","Math","round","applyIntervalThumbChange","thumb","rawValue","isFromThumb","previousValue","hasChanged","from","to","undefined","toSlider","fromSlider","String","maxNumber","handleMouseUp","handleControlFromSlider","event","target","handleControlToSlider","handleInputChange","effectiveMin","max","effectiveMax","min","isNaN","fromSliderThumbPosition","offsetWidth","width","sliderWidth","wrapperWidth","toSliderThumbPosition","toSliderThumbContentPosition","sliderValue","popupWidth","fromSliderThumbContentPosition","handleTouchStart","handleTouchEnd","highlightedStepElements","elements","i","isStepDisabled","offset","stepWidth","push","createElement","key","$isDisabled","$isFilled","$leftPosition","fromInputBackground","gradientPoints","getPercentage","x","join","ref","animate","height","initial","exit","$thumbWidth","$isInterval","type","onTouchStart","onTouchEnd","onMouseUp","$background","$position","$isBigSlider","$width","displayName"],"sources":["../../../../src/components/slider/Slider.tsx"],"sourcesContent":["import { setRefreshScrollEnabled } from 'chayns-api';\nimport React, {\n ChangeEvent,\n FC,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTheme } from 'styled-components';\nimport { useElementSize } from '../../hooks/element';\nimport {\n calculateGradientOffset,\n calculatePopupPosition,\n fillSlider,\n getThumbMaxWidth,\n} from '../../utils/slider';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport {\n StyledHighlightedStep,\n StyledSlider,\n StyledSliderInput,\n StyledSliderThumb,\n StyledSliderThumbLabel,\n} from './Slider.styles';\n\nexport interface SliderInterval {\n maxValue: number;\n minValue: number;\n}\n\nexport type SliderProps = {\n /**\n * The current interval of the slider.\n * @description\n * The `interval` prop is used to define a range for the slider, allowing users to select a minimum and maximum value.\n * This is particularly useful for scenarios where you want to allow users to select a range of values, such as price ranges or date ranges.\n * When provided, the slider will display two thumbs, one for the minimum value and one for the maximum value.\n * @example\n * <Slider interval={{ minValue: 10, maxValue: 50 }} />\n * @optional\n */\n interval?: SliderInterval;\n /**\n * Disables the slider, preventing user interaction.\n * @description\n * The `isDisabled` prop is used to disable the slider, making it unresponsive to user input.\n * When set to `true`, the slider cannot be moved, and its appearance may change to indicate that it is disabled.\n * This is useful for scenarios where the slider should not be interacted with, such as when the data it controls is not available or when the user does not have permission to change the value.\n * @default false\n * @example\n * <Slider isDisabled={true} />\n * @optional\n */\n isDisabled?: boolean;\n /**\n * The maximum enabled value of the slider.\n * @description\n * The `maxEnabledValue` prop is used to define the maximum value that can be selected on the slider.\n * It is particularly useful when you want to set an upper limit for the slider's range, ensuring that users cannot select values above this threshold.\n * This prop is optional and can be used in conjunction with the `maxValue` prop to create a more flexible slider.\n * @example\n * <Slider maxEnabledValue={75} />\n * @optional\n */\n maxEnabledValue?: number;\n /**\n * The maximum value of the slider.\n * @description\n * The `maxValue` prop defines the upper limit of the slider's range. It is used to set the maximum value that can be selected by the user.\n * This value should be greater than or equal to `minValue`.\n * @example\n * <Slider maxValue={200} />\n */\n maxValue: number;\n /**\n * The minimum enabled value of the slider.\n * @description\n * The `minEnabledValue` prop is used to define the minimum value that can be selected on the slider.\n * It is particularly useful when you want to set a lower limit for the slider's range, ensuring that users cannot select values below this threshold.\n * This prop is optional and can be used in conjunction with the `minValue` prop to create a more flexible slider.\n * @example\n * <Slider minEnabledValue={25} />\n * @optional\n */\n minEnabledValue?: number;\n /**\n * The minimum value of the slider.\n * @description\n * The `minValue` prop defines the lower limit of the slider's range. It is used to set the minimum value that can be selected by the user.\n * This value should be less than or equal to `maxValue`.\n * @example\n * <Slider minValue={0} />\n */\n minValue: number;\n /**\n * Callback function that is called when the slider value changes.\n * @description\n * The `onChange` prop is a callback function that is triggered whenever the slider value changes.\n * It receives the new value or interval of the slider as an argument, allowing you to update your application state or perform other actions based on the new value.\n * If the slider is configured as an interval, it will receive an object with `minValue` and `maxValue`.\n * @example\n * <Slider onChange={(value, interval) => console.log('Slider changed', { value, interval })} />\n */\n onChange?: (value?: number, interval?: SliderInterval) => void;\n /**\n * Callback function that is called when the slider selection is finalized.\n * @description\n * The `onSelect` prop is a callback function that is triggered when the user finishes interacting with the slider, such as releasing the mouse or touch after dragging the thumb.\n * It receives the selected value or interval as arguments, allowing you to perform actions based on the final selection.\n * If the slider is configured as an interval, it will receive an object with `minValue` and `maxValue`.\n * @example\n * <Slider onSelect={(value, interval) => console.log('Slider selected', { value, interval })} />\n */\n onSelect?: (value?: number, interval?: SliderInterval) => void;\n /**\n * Indicates whether the slider should highlight steps.\n * @description\n * The `shouldHighlightSteps` prop determines whether the slider should visually indicate the steps between values.\n * When set to `true`, the slider will show visual markers for each step, making it easier for users to see the increments.\n * @default false\n * @example\n * <Slider shouldHighlightSteps={true} />\n * @optional\n */\n shouldHighlightSteps?: boolean;\n /**\n * Indicates whether the slider should show a label on the thumb.\n * @description\n * The `shouldShowThumbLabel` prop determines whether the slider should display a label on the thumb that shows the current value.\n * When set to `true`, a label will be shown above the thumb, providing users with immediate feedback on the selected value.\n * @default false\n * @example\n * <Slider shouldShowThumbLabel={true} />\n * @optional\n */\n shouldShowThumbLabel?: boolean;\n /**\n * The step size for the slider.\n * @description\n * The `step` prop defines the increment by which the slider value changes when the user interacts with it.\n * It is used to control the granularity of the slider's movement. For example, if `step` is set to 1, the slider will move in increments of 1.\n * @default 1\n * @example\n * <Slider step={5} />\n * @optional\n */\n step?: number;\n /**\n * A function to format the thumb label.\n * @description\n * The `thumbLabelFormatter` prop is a function that formats the value displayed on the thumb label.\n * It receives the current value as an argument and should return a string that will be displayed on the thumb label.\n * This is useful for customizing the appearance of the label, such as adding currency symbols or units.\n * @example\n * <Slider thumbLabelFormatter={(value) => `${value} €`} />\n * @optional\n */\n thumbLabelFormatter?: (value: number) => string;\n /**\n * The current value of the slider.\n * @description\n * The `value` prop is used to set the current value of the slider when it is not configured as an interval.\n * It should be a number between `minValue` and `maxValue`. If the slider is configured as an interval, this prop will be ignored.\n * @example\n * <Slider value={50} />\n * @optional\n */\n value?: number;\n};\n\nconst Slider: FC<SliderProps> = ({\n interval,\n isDisabled,\n maxEnabledValue,\n maxValue,\n minEnabledValue,\n minValue,\n onChange,\n onSelect,\n shouldHighlightSteps = false,\n shouldShowThumbLabel = false,\n step = 1,\n thumbLabelFormatter,\n value,\n}) => {\n const [fromValue, setFromValue] = useState(minEnabledValue ?? minValue);\n const [toValue, setToValue] = useState(maxEnabledValue ?? maxValue);\n const [thumbWidth, setThumbWidth] = useState(20);\n const [isBigSlider, setIsBigSlider] = useState(false);\n\n const previousFromValueRef = useRef(fromValue);\n const previousToValueRef = useRef(toValue);\n const fromSliderRef = useRef<HTMLInputElement>(null);\n const toSliderRef = useRef<HTMLInputElement>(null);\n const fromSliderThumbRef = useRef<HTMLDivElement>(null);\n const toSliderThumbRef = useRef<HTMLDivElement>(null);\n const fromSliderThumbContentRef = useRef<HTMLDivElement>(null);\n const toSliderThumbContentRef = useRef<HTMLDivElement>(null);\n const sliderWrapperRef = useRef<HTMLDivElement>(null);\n\n const sliderWrapperSize = useElementSize(sliderWrapperRef);\n\n const theme = useTheme() as Theme;\n\n const updateFromValue = useCallback((nextValue: number) => {\n previousFromValueRef.current = nextValue;\n setFromValue(nextValue);\n }, []);\n\n const updateToValue = useCallback((nextValue: number) => {\n previousToValueRef.current = nextValue;\n setToValue(nextValue);\n }, []);\n\n const normalizeIntervalValue = useCallback(\n (nextValue: number) => {\n let newValue = Number(nextValue);\n\n if (newValue > maxValue || newValue > maxValue - (maxValue % step)) {\n newValue = maxValue;\n } else if (newValue < minValue) {\n newValue = minValue;\n } else {\n newValue = Math.round(newValue / step) * step;\n }\n\n return newValue;\n },\n [maxValue, minValue, step],\n );\n\n const applyIntervalThumbChange = useCallback(\n (thumb: 'from' | 'to', rawValue: number) => {\n if (!fromSliderRef.current || !toSliderRef.current) {\n return;\n }\n\n const newValue = normalizeIntervalValue(rawValue);\n const isFromThumb = thumb === 'from';\n const previousValue = isFromThumb\n ? previousFromValueRef.current\n : previousToValueRef.current;\n const hasChanged = newValue !== previousValue;\n\n if (isFromThumb) {\n updateFromValue(newValue);\n } else {\n updateToValue(newValue);\n }\n\n const from = Number(fromSliderRef.current.value);\n const to = Number(toSliderRef.current.value);\n\n if (hasChanged && typeof onChange === 'function') {\n onChange(undefined, {\n minValue: isFromThumb ? newValue : from,\n maxValue: isFromThumb ? to : newValue,\n });\n }\n\n fillSlider({\n toSlider: toSliderRef.current,\n fromSlider: fromSliderRef.current,\n ...(isFromThumb ? { fromValue: newValue } : { toValue: newValue }),\n theme,\n });\n\n if (isFromThumb) {\n fromSliderRef.current.value = String(newValue > to ? to : newValue);\n } else {\n toSliderRef.current.value = String(from <= newValue ? newValue : from);\n }\n },\n [normalizeIntervalValue, onChange, theme, updateFromValue, updateToValue],\n );\n\n useEffect(() => {\n if (shouldShowThumbLabel) {\n setThumbWidth(getThumbMaxWidth({ maxNumber: maxValue, thumbLabelFormatter }));\n }\n }, [maxValue, shouldShowThumbLabel, thumbLabelFormatter]);\n\n /**\n * This function sets the value\n */\n useEffect(() => {\n if (\n typeof value === 'number' &&\n value >= minValue &&\n value <= maxValue &&\n (typeof minEnabledValue !== 'number' || value >= minEnabledValue) &&\n (typeof maxEnabledValue !== 'number' || value <= maxEnabledValue)\n ) {\n updateFromValue(value);\n }\n }, [maxEnabledValue, maxValue, minEnabledValue, minValue, updateFromValue, value]);\n\n useEffect(() => {\n if (fromValue > toValue) {\n updateFromValue(toValue);\n }\n\n if (toValue < fromValue) {\n updateToValue(fromValue);\n }\n }, [fromValue, toValue, updateFromValue, updateToValue]);\n\n const handleMouseUp = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n const from = Number(fromSliderRef.current?.value);\n const to = Number(toSliderRef.current?.value);\n\n if (typeof onSelect === 'function') {\n onSelect(\n interval ? undefined : from,\n interval ? { maxValue: to, minValue: from } : undefined,\n );\n }\n }, [interval, isDisabled, onSelect]);\n\n const handleControlFromSlider = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n applyIntervalThumbChange('from', Number(event.target.value));\n },\n [applyIntervalThumbChange],\n );\n\n const handleControlToSlider = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (isDisabled) {\n return;\n }\n\n applyIntervalThumbChange('to', Number(event.target.value));\n },\n [applyIntervalThumbChange, isDisabled],\n );\n\n useEffect(() => {\n if (!fromSliderRef.current || !toSliderRef.current || !interval) {\n return;\n }\n\n updateFromValue(interval.minValue);\n updateToValue(interval.maxValue);\n\n fromSliderRef.current.value = String(interval.minValue);\n toSliderRef.current.value = String(interval.maxValue);\n\n fillSlider({\n fromSlider: fromSliderRef.current,\n toSlider: toSliderRef.current,\n theme,\n });\n // Note: An interval can't be in the deps because of rerender\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [theme]);\n\n /**\n * This function updates the value\n */\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (isDisabled) {\n return;\n }\n\n // If interval mode is active, delegate to the \"from\" handler and return early\n if (interval) {\n handleControlFromSlider(event);\n\n return;\n }\n\n // Respect optionally enabled bounds in addition to absolute min/max\n const effectiveMin =\n typeof minEnabledValue === 'number'\n ? Math.max(minValue, minEnabledValue)\n : minValue;\n\n const effectiveMax =\n typeof maxEnabledValue === 'number'\n ? Math.min(maxValue, maxEnabledValue)\n : maxValue;\n\n let newValue = Number(event.target.value);\n\n // Clamp to effective range first\n if (Number.isNaN(newValue)) {\n newValue = effectiveMin;\n }\n\n if (newValue < effectiveMin) newValue = effectiveMin;\n else if (newValue > effectiveMax - (effectiveMax % step)) newValue = effectiveMax;\n else newValue = Math.round(newValue / step) * step;\n\n if (typeof onChange === 'function' && newValue !== previousFromValueRef.current) {\n onChange(newValue);\n }\n\n updateFromValue(newValue);\n },\n [\n handleControlFromSlider,\n interval,\n isDisabled,\n maxEnabledValue,\n maxValue,\n minEnabledValue,\n minValue,\n onChange,\n step,\n updateFromValue,\n ],\n );\n\n const fromSliderThumbPosition = useMemo(() => {\n if (\n typeof fromSliderRef.current?.offsetWidth === 'number' &&\n typeof sliderWrapperSize?.width === 'number'\n ) {\n return calculateGradientOffset({\n maxValue,\n minValue,\n sliderWidth: fromSliderRef.current.offsetWidth,\n thumbWidth: 20,\n value: fromValue,\n wrapperWidth: sliderWrapperSize.width,\n });\n }\n\n return 0;\n }, [fromValue, maxValue, minValue, sliderWrapperSize?.width]);\n\n const toSliderThumbPosition = useMemo(() => {\n if (\n typeof toSliderRef.current?.offsetWidth === 'number' &&\n typeof sliderWrapperSize?.width === 'number'\n ) {\n return calculateGradientOffset({\n maxValue,\n minValue,\n sliderWidth: toSliderRef.current.offsetWidth,\n thumbWidth: 20,\n value: toValue,\n wrapperWidth: sliderWrapperSize.width,\n });\n }\n\n return 0;\n }, [maxValue, minValue, sliderWrapperSize?.width, toValue]);\n\n const toSliderThumbContentPosition = useMemo(\n () =>\n calculatePopupPosition({\n min: minValue,\n max: maxValue,\n sliderValue: toValue,\n popupWidth: thumbWidth,\n }),\n [maxValue, minValue, thumbWidth, toValue],\n );\n\n const fromSliderThumbContentPosition = useMemo(\n () =>\n calculatePopupPosition({\n min: minValue,\n max: maxValue,\n sliderValue: fromValue,\n popupWidth: thumbWidth,\n }),\n [fromValue, maxValue, minValue, thumbWidth],\n );\n\n const handleTouchStart = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n void setRefreshScrollEnabled(false);\n\n if (shouldShowThumbLabel) {\n setIsBigSlider(true);\n }\n }, [isDisabled, shouldShowThumbLabel]);\n\n const handleTouchEnd = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n void setRefreshScrollEnabled(true);\n\n const from = Number(fromSliderRef.current?.value);\n const to = Number(toSliderRef.current?.value);\n\n if (typeof onSelect === 'function') {\n onSelect(\n interval ? undefined : from,\n interval ? { maxValue: to, minValue: from } : undefined,\n );\n }\n\n if (shouldShowThumbLabel) {\n setIsBigSlider(false);\n }\n }, [interval, isDisabled, onSelect, shouldShowThumbLabel]);\n\n const highlightedStepElements = useMemo(() => {\n const sliderWidth = fromSliderRef.current?.offsetWidth ?? 0;\n const wrapperWidth = sliderWrapperSize?.width ?? 0;\n\n if (!shouldHighlightSteps || interval || sliderWidth === 0 || wrapperWidth === 0) {\n return null;\n }\n\n const elements: ReactNode[] = [];\n\n for (let i = minValue; i <= maxValue; i += step) {\n const isStepDisabled =\n (typeof minEnabledValue === 'number' && i < minEnabledValue) ||\n (typeof maxEnabledValue === 'number' && i > maxEnabledValue);\n\n const offset = (wrapperWidth - sliderWidth) / 2;\n const stepWidth = (sliderWidth / (maxValue - minValue)) * step;\n\n elements.push(\n <StyledHighlightedStep\n key={`step--${i}`}\n $isDisabled={isStepDisabled}\n $isFilled={i < fromValue}\n $leftPosition={offset + stepWidth * i}\n />,\n );\n }\n\n return elements;\n }, [\n fromValue,\n interval,\n maxEnabledValue,\n maxValue,\n minEnabledValue,\n minValue,\n shouldHighlightSteps,\n sliderWrapperSize?.width,\n step,\n ]);\n\n const fromInputBackground = useMemo(() => {\n if (interval) return undefined;\n\n const gradientPoints: string[] = [];\n\n const getPercentage = (x: number) => ((x - minValue) / (maxValue - minValue)) * 100;\n\n if (typeof minEnabledValue === 'number') {\n gradientPoints.push('rgb(215, 215, 215) 0%');\n gradientPoints.push(`rgb(215, 215, 215) ${getPercentage(minEnabledValue)}%`);\n gradientPoints.push(`${theme['409'] ?? ''} ${getPercentage(minEnabledValue)}%`);\n } else {\n gradientPoints.push(`${theme['409'] ?? ''} 0%`);\n }\n\n gradientPoints.push(`${theme['409'] ?? ''} ${getPercentage(fromValue)}%`);\n gradientPoints.push(`${theme['403'] ?? ''} ${getPercentage(fromValue)}%`);\n\n if (typeof maxEnabledValue === 'number') {\n gradientPoints.push(`${theme['403'] ?? ''} ${getPercentage(maxEnabledValue)}%`);\n gradientPoints.push(`rgb(215, 215, 215) ${getPercentage(maxEnabledValue)}%`);\n gradientPoints.push('rgb(215, 215, 215) 100%');\n } else {\n gradientPoints.push(`${theme['403'] ?? ''} 100%`);\n }\n\n return `linear-gradient(to right, ${gradientPoints.join(', ')})`;\n }, [fromValue, interval, maxEnabledValue, maxValue, minEnabledValue, minValue, theme]);\n\n return useMemo(\n () => (\n <StyledSlider ref={sliderWrapperRef} $isDisabled={isDisabled}>\n {highlightedStepElements}\n <StyledSliderInput\n animate={{ height: isBigSlider ? 30 : 10 }}\n initial={{ height: 10 }}\n exit={{ height: 10 }}\n $thumbWidth={40}\n ref={fromSliderRef}\n $isInterval={!!interval}\n type=\"range\"\n value={fromValue}\n step={0.01}\n max={maxValue}\n min={minValue}\n onTouchStart={handleTouchStart}\n onTouchEnd={handleTouchEnd}\n onChange={handleInputChange}\n onMouseUp={handleMouseUp}\n $background={fromInputBackground}\n />\n <StyledSliderThumb\n ref={fromSliderThumbRef}\n $position={fromSliderThumbPosition}\n $isBigSlider={isBigSlider}\n >\n {shouldShowThumbLabel && (\n <StyledSliderThumbLabel\n $width={thumbWidth}\n $isBigSlider={isBigSlider}\n $position={fromSliderThumbContentPosition}\n ref={fromSliderThumbContentRef}\n >\n {typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(fromValue)\n : fromValue}\n </StyledSliderThumbLabel>\n )}\n </StyledSliderThumb>\n {interval && (\n <StyledSliderThumb\n ref={toSliderThumbRef}\n $position={toSliderThumbPosition}\n $isBigSlider={isBigSlider}\n >\n {shouldShowThumbLabel && (\n <StyledSliderThumbLabel\n $width={thumbWidth}\n $isBigSlider={isBigSlider}\n $position={toSliderThumbContentPosition}\n ref={toSliderThumbContentRef}\n >\n {typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(toValue)\n : toValue}\n </StyledSliderThumbLabel>\n )}\n </StyledSliderThumb>\n )}\n {interval && (\n <StyledSliderInput\n animate={{ height: isBigSlider ? 30 : 10 }}\n initial={{ height: 10 }}\n exit={{ height: 10 }}\n $thumbWidth={40}\n ref={toSliderRef}\n $isInterval={!!interval}\n type=\"range\"\n value={toValue}\n step={0.01}\n max={maxValue}\n min={minValue}\n onTouchStart={handleTouchStart}\n onTouchEnd={handleTouchEnd}\n onChange={handleControlToSlider}\n onMouseUp={handleMouseUp}\n />\n )}\n </StyledSlider>\n ),\n [\n fromInputBackground,\n fromSliderThumbContentPosition,\n fromSliderThumbPosition,\n fromValue,\n handleControlToSlider,\n handleInputChange,\n handleMouseUp,\n handleTouchEnd,\n handleTouchStart,\n highlightedStepElements,\n interval,\n isBigSlider,\n isDisabled,\n maxValue,\n minValue,\n shouldShowThumbLabel,\n thumbLabelFormatter,\n thumbWidth,\n toSliderThumbContentPos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AG,EAAEtE,WAAY;IACjB4E,WAAW,EAAE,CAAC,CAACpG,QAAS;IACxBqG,IAAI,EAAC,OAAO;IACZzF,KAAK,EAAEG,OAAQ;IACfL,IAAI,EAAE,IAAK;IACXmD,GAAG,EAAE1D,QAAS;IACd4D,GAAG,EAAE1D,QAAS;IACdiG,YAAY,EAAE3B,gBAAiB;IAC/B4B,UAAU,EAAE3B,cAAe;IAC3BtE,QAAQ,EAAEoD,qBAAsB;IAChC8C,SAAS,EAAElD;EAAc,CAC5B,CAEK,CACjB,EACD,CACImC,mBAAmB,EACnBf,8BAA8B,EAC9BT,uBAAuB,EACvBpD,SAAS,EACT6C,qBAAqB,EACrBC,iBAAiB,EACjBL,aAAa,EACbsB,cAAc,EACdD,gBAAgB,EAChBE,uBAAuB,EACvB7E,QAAQ,EACRmB,WAAW,EACXlB,UAAU,EACVE,QAAQ,EACRE,QAAQ,EACRI,oBAAoB,EACpBE,mBAAmB,EACnBM,UAAU,EACVsD,4BAA4B,EAC5BD,qBAAqB,EACrBvD,OAAO,CAEf,CAAC;AACL,CAAC;AAEDhB,MAAM,CAAC8G,WAAW,GAAG,QAAQ;AAE7B,eAAe9G,MAAM","ignoreList":[]}
1
+ {"version":3,"file":"Slider.js","names":["setRefreshScrollEnabled","React","useCallback","useEffect","useMemo","useRef","useState","useTheme","useElementSize","calculateGradientOffset","calculatePopupPosition","fillSlider","getThumbMaxWidth","StyledHighlightedStep","StyledSlider","StyledSliderInput","StyledSliderThumb","StyledSliderThumbLabel","Slider","interval","isDisabled","maxEnabledValue","maxValue","minEnabledValue","minValue","onChange","onSelect","shouldHighlightSteps","shouldShowThumbLabel","step","thumbLabelFormatter","value","fromValue","setFromValue","toValue","setToValue","thumbWidth","setThumbWidth","isBigSlider","setIsBigSlider","previousFromValueRef","previousToValueRef","fromSliderRef","toSliderRef","fromSliderThumbRef","toSliderThumbRef","fromSliderThumbContentRef","toSliderThumbContentRef","sliderWrapperRef","sliderWrapperSize","theme","updateFromValue","nextValue","current","updateToValue","normalizeIntervalValue","newValue","Number","Math","round","applyIntervalThumbChange","thumb","rawValue","isFromThumb","previousValue","hasChanged","from","to","undefined","toSlider","fromSlider","String","maxNumber","handleMouseUp","handleControlFromSlider","event","target","handleControlToSlider","handleInputChange","effectiveMin","max","effectiveMax","min","isNaN","fromSliderThumbPosition","offsetWidth","width","sliderWidth","wrapperWidth","toSliderThumbPosition","toSliderThumbContentPosition","sliderValue","popupWidth","fromSliderThumbContentPosition","handleTouchStart","handleTouchEnd","highlightedStepElements","elements","i","isStepDisabled","offset","stepWidth","push","createElement","key","$isDisabled","$isFilled","$leftPosition","fromInputBackground","gradientPoints","getPercentage","x","join","ref","animate","height","initial","exit","$thumbWidth","$isInterval","type","onTouchStart","onTouchEnd","onMouseUp","$background","$position","$isBigSlider","$width","displayName"],"sources":["../../../../src/components/slider/Slider.tsx"],"sourcesContent":["import { setRefreshScrollEnabled } from 'chayns-api';\nimport React, {\n ChangeEvent,\n FC,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTheme } from 'styled-components';\nimport { useElementSize } from '../../hooks/element';\nimport {\n calculateGradientOffset,\n calculatePopupPosition,\n fillSlider,\n getThumbMaxWidth,\n} from '../../utils/slider';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport {\n StyledHighlightedStep,\n StyledSlider,\n StyledSliderInput,\n StyledSliderThumb,\n StyledSliderThumbLabel,\n} from './Slider.styles';\n\nexport interface SliderInterval {\n maxValue: number;\n minValue: number;\n}\n\nexport type SliderProps = {\n /**\n * The current interval of the slider.\n * @description\n * The `interval` prop is used to define a range for the slider, allowing users to select a minimum and maximum value.\n * This is particularly useful for scenarios where you want to allow users to select a range of values, such as price ranges or date ranges.\n * When provided, the slider will display two thumbs, one for the minimum value and one for the maximum value.\n * @example\n * <Slider interval={{ minValue: 10, maxValue: 50 }} />\n * @optional\n */\n interval?: SliderInterval;\n /**\n * Disables the slider, preventing user interaction.\n * @description\n * The `isDisabled` prop is used to disable the slider, making it unresponsive to user input.\n * When set to `true`, the slider cannot be moved, and its appearance may change to indicate that it is disabled.\n * This is useful for scenarios where the slider should not be interacted with, such as when the data it controls is not available or when the user does not have permission to change the value.\n * @default false\n * @example\n * <Slider isDisabled={true} />\n * @optional\n */\n isDisabled?: boolean;\n /**\n * The maximum enabled value of the slider.\n * @description\n * The `maxEnabledValue` prop is used to define the maximum value that can be selected on the slider.\n * It is particularly useful when you want to set an upper limit for the slider's range, ensuring that users cannot select values above this threshold.\n * This prop is optional and can be used in conjunction with the `maxValue` prop to create a more flexible slider.\n * @example\n * <Slider maxEnabledValue={75} />\n * @optional\n */\n maxEnabledValue?: number;\n /**\n * The maximum value of the slider.\n * @description\n * The `maxValue` prop defines the upper limit of the slider's range. It is used to set the maximum value that can be selected by the user.\n * This value should be greater than or equal to `minValue`.\n * @example\n * <Slider maxValue={200} />\n */\n maxValue: number;\n /**\n * The minimum enabled value of the slider.\n * @description\n * The `minEnabledValue` prop is used to define the minimum value that can be selected on the slider.\n * It is particularly useful when you want to set a lower limit for the slider's range, ensuring that users cannot select values below this threshold.\n * This prop is optional and can be used in conjunction with the `minValue` prop to create a more flexible slider.\n * @example\n * <Slider minEnabledValue={25} />\n * @optional\n */\n minEnabledValue?: number;\n /**\n * The minimum value of the slider.\n * @description\n * The `minValue` prop defines the lower limit of the slider's range. It is used to set the minimum value that can be selected by the user.\n * This value should be less than or equal to `maxValue`.\n * @example\n * <Slider minValue={0} />\n */\n minValue: number;\n /**\n * Callback function that is called when the slider value changes.\n * @description\n * The `onChange` prop is a callback function that is triggered whenever the slider value changes.\n * It receives the new value or interval of the slider as an argument, allowing you to update your application state or perform other actions based on the new value.\n * If the slider is configured as an interval, it will receive an object with `minValue` and `maxValue`.\n * @example\n * <Slider onChange={(value, interval) => console.log('Slider changed', { value, interval })} />\n */\n onChange?: (value?: number, interval?: SliderInterval) => void;\n /**\n * Callback function that is called when the slider selection is finalized.\n * @description\n * The `onSelect` prop is a callback function that is triggered when the user finishes interacting with the slider, such as releasing the mouse or touch after dragging the thumb.\n * It receives the selected value or interval as arguments, allowing you to perform actions based on the final selection.\n * If the slider is configured as an interval, it will receive an object with `minValue` and `maxValue`.\n * @example\n * <Slider onSelect={(value, interval) => console.log('Slider selected', { value, interval })} />\n */\n onSelect?: (value?: number, interval?: SliderInterval) => void;\n /**\n * Indicates whether the slider should highlight steps.\n * @description\n * The `shouldHighlightSteps` prop determines whether the slider should visually indicate the steps between values.\n * When set to `true`, the slider will show visual markers for each step, making it easier for users to see the increments.\n * @default false\n * @example\n * <Slider shouldHighlightSteps={true} />\n * @optional\n */\n shouldHighlightSteps?: boolean;\n /**\n * Indicates whether the slider should show a label on the thumb.\n * @description\n * The `shouldShowThumbLabel` prop determines whether the slider should display a label on the thumb that shows the current value.\n * When set to `true`, a label will be shown above the thumb, providing users with immediate feedback on the selected value.\n * @default false\n * @example\n * <Slider shouldShowThumbLabel={true} />\n * @optional\n */\n shouldShowThumbLabel?: boolean;\n /**\n * The step size for the slider.\n * @description\n * The `step` prop defines the increment by which the slider value changes when the user interacts with it.\n * It is used to control the granularity of the slider's movement. For example, if `step` is set to 1, the slider will move in increments of 1.\n * @default 1\n * @example\n * <Slider step={5} />\n * @optional\n */\n step?: number;\n /**\n * A function to format the thumb label.\n * @description\n * The `thumbLabelFormatter` prop is a function that formats the value displayed on the thumb label.\n * It receives the current value as an argument and should return a string that will be displayed on the thumb label.\n * This is useful for customizing the appearance of the label, such as adding currency symbols or units.\n * @example\n * <Slider thumbLabelFormatter={(value) => `${value} €`} />\n * @optional\n */\n thumbLabelFormatter?: (value: number, isMeasuring?: boolean) => string;\n /**\n * The current value of the slider.\n * @description\n * The `value` prop is used to set the current value of the slider when it is not configured as an interval.\n * It should be a number between `minValue` and `maxValue`. If the slider is configured as an interval, this prop will be ignored.\n * @example\n * <Slider value={50} />\n * @optional\n */\n value?: number;\n};\n\nconst Slider: FC<SliderProps> = ({\n interval,\n isDisabled,\n maxEnabledValue,\n maxValue,\n minEnabledValue,\n minValue,\n onChange,\n onSelect,\n shouldHighlightSteps = false,\n shouldShowThumbLabel = false,\n step = 1,\n thumbLabelFormatter,\n value,\n}) => {\n const [fromValue, setFromValue] = useState(minEnabledValue ?? minValue);\n const [toValue, setToValue] = useState(maxEnabledValue ?? maxValue);\n const [thumbWidth, setThumbWidth] = useState(20);\n const [isBigSlider, setIsBigSlider] = useState(false);\n\n const previousFromValueRef = useRef(fromValue);\n const previousToValueRef = useRef(toValue);\n const fromSliderRef = useRef<HTMLInputElement>(null);\n const toSliderRef = useRef<HTMLInputElement>(null);\n const fromSliderThumbRef = useRef<HTMLDivElement>(null);\n const toSliderThumbRef = useRef<HTMLDivElement>(null);\n const fromSliderThumbContentRef = useRef<HTMLDivElement>(null);\n const toSliderThumbContentRef = useRef<HTMLDivElement>(null);\n const sliderWrapperRef = useRef<HTMLDivElement>(null);\n\n const sliderWrapperSize = useElementSize(sliderWrapperRef);\n\n const theme = useTheme() as Theme;\n\n const updateFromValue = useCallback((nextValue: number) => {\n previousFromValueRef.current = nextValue;\n setFromValue(nextValue);\n }, []);\n\n const updateToValue = useCallback((nextValue: number) => {\n previousToValueRef.current = nextValue;\n setToValue(nextValue);\n }, []);\n\n const normalizeIntervalValue = useCallback(\n (nextValue: number) => {\n let newValue = Number(nextValue);\n\n if (newValue > maxValue || newValue > maxValue - (maxValue % step)) {\n newValue = maxValue;\n } else if (newValue < minValue) {\n newValue = minValue;\n } else {\n newValue = Math.round(newValue / step) * step;\n }\n\n return newValue;\n },\n [maxValue, minValue, step],\n );\n\n const applyIntervalThumbChange = useCallback(\n (thumb: 'from' | 'to', rawValue: number) => {\n if (!fromSliderRef.current || !toSliderRef.current) {\n return;\n }\n\n const newValue = normalizeIntervalValue(rawValue);\n const isFromThumb = thumb === 'from';\n const previousValue = isFromThumb\n ? previousFromValueRef.current\n : previousToValueRef.current;\n const hasChanged = newValue !== previousValue;\n\n if (isFromThumb) {\n updateFromValue(newValue);\n } else {\n updateToValue(newValue);\n }\n\n const from = Number(fromSliderRef.current.value);\n const to = Number(toSliderRef.current.value);\n\n if (hasChanged && typeof onChange === 'function') {\n onChange(undefined, {\n minValue: isFromThumb ? newValue : from,\n maxValue: isFromThumb ? to : newValue,\n });\n }\n\n fillSlider({\n toSlider: toSliderRef.current,\n fromSlider: fromSliderRef.current,\n ...(isFromThumb ? { fromValue: newValue } : { toValue: newValue }),\n theme,\n });\n\n if (isFromThumb) {\n fromSliderRef.current.value = String(newValue > to ? to : newValue);\n } else {\n toSliderRef.current.value = String(from <= newValue ? newValue : from);\n }\n },\n [normalizeIntervalValue, onChange, theme, updateFromValue, updateToValue],\n );\n\n useEffect(() => {\n if (shouldShowThumbLabel) {\n setThumbWidth(getThumbMaxWidth({ maxNumber: maxValue, thumbLabelFormatter }));\n }\n }, [maxValue, shouldShowThumbLabel, thumbLabelFormatter]);\n\n /**\n * This function sets the value\n */\n useEffect(() => {\n if (\n typeof value === 'number' &&\n value >= minValue &&\n value <= maxValue &&\n (typeof minEnabledValue !== 'number' || value >= minEnabledValue) &&\n (typeof maxEnabledValue !== 'number' || value <= maxEnabledValue)\n ) {\n updateFromValue(value);\n }\n }, [maxEnabledValue, maxValue, minEnabledValue, minValue, updateFromValue, value]);\n\n useEffect(() => {\n if (fromValue > toValue) {\n updateFromValue(toValue);\n }\n\n if (toValue < fromValue) {\n updateToValue(fromValue);\n }\n }, [fromValue, toValue, updateFromValue, updateToValue]);\n\n const handleMouseUp = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n const from = Number(fromSliderRef.current?.value);\n const to = Number(toSliderRef.current?.value);\n\n if (typeof onSelect === 'function') {\n onSelect(\n interval ? undefined : from,\n interval ? { maxValue: to, minValue: from } : undefined,\n );\n }\n }, [interval, isDisabled, onSelect]);\n\n const handleControlFromSlider = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n applyIntervalThumbChange('from', Number(event.target.value));\n },\n [applyIntervalThumbChange],\n );\n\n const handleControlToSlider = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (isDisabled) {\n return;\n }\n\n applyIntervalThumbChange('to', Number(event.target.value));\n },\n [applyIntervalThumbChange, isDisabled],\n );\n\n useEffect(() => {\n if (!fromSliderRef.current || !toSliderRef.current || !interval) {\n return;\n }\n\n updateFromValue(interval.minValue);\n updateToValue(interval.maxValue);\n\n fromSliderRef.current.value = String(interval.minValue);\n toSliderRef.current.value = String(interval.maxValue);\n\n fillSlider({\n fromSlider: fromSliderRef.current,\n toSlider: toSliderRef.current,\n theme,\n });\n // Note: An interval can't be in the deps because of rerender\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [theme]);\n\n /**\n * This function updates the value\n */\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (isDisabled) {\n return;\n }\n\n // If interval mode is active, delegate to the \"from\" handler and return early\n if (interval) {\n handleControlFromSlider(event);\n\n return;\n }\n\n // Respect optionally enabled bounds in addition to absolute min/max\n const effectiveMin =\n typeof minEnabledValue === 'number'\n ? Math.max(minValue, minEnabledValue)\n : minValue;\n\n const effectiveMax =\n typeof maxEnabledValue === 'number'\n ? Math.min(maxValue, maxEnabledValue)\n : maxValue;\n\n let newValue = Number(event.target.value);\n\n // Clamp to effective range first\n if (Number.isNaN(newValue)) {\n newValue = effectiveMin;\n }\n\n if (newValue < effectiveMin) newValue = effectiveMin;\n else if (newValue > effectiveMax - (effectiveMax % step)) newValue = effectiveMax;\n else newValue = Math.round(newValue / step) * step;\n\n if (typeof onChange === 'function' && newValue !== previousFromValueRef.current) {\n onChange(newValue);\n }\n\n updateFromValue(newValue);\n },\n [\n handleControlFromSlider,\n interval,\n isDisabled,\n maxEnabledValue,\n maxValue,\n minEnabledValue,\n minValue,\n onChange,\n step,\n updateFromValue,\n ],\n );\n\n const fromSliderThumbPosition = useMemo(() => {\n if (\n typeof fromSliderRef.current?.offsetWidth === 'number' &&\n typeof sliderWrapperSize?.width === 'number'\n ) {\n return calculateGradientOffset({\n maxValue,\n minValue,\n sliderWidth: fromSliderRef.current.offsetWidth,\n thumbWidth: 20,\n value: fromValue,\n wrapperWidth: sliderWrapperSize.width,\n });\n }\n\n return 0;\n }, [fromValue, maxValue, minValue, sliderWrapperSize?.width]);\n\n const toSliderThumbPosition = useMemo(() => {\n if (\n typeof toSliderRef.current?.offsetWidth === 'number' &&\n typeof sliderWrapperSize?.width === 'number'\n ) {\n return calculateGradientOffset({\n maxValue,\n minValue,\n sliderWidth: toSliderRef.current.offsetWidth,\n thumbWidth: 20,\n value: toValue,\n wrapperWidth: sliderWrapperSize.width,\n });\n }\n\n return 0;\n }, [maxValue, minValue, sliderWrapperSize?.width, toValue]);\n\n const toSliderThumbContentPosition = useMemo(\n () =>\n calculatePopupPosition({\n min: minValue,\n max: maxValue,\n sliderValue: toValue,\n popupWidth: thumbWidth,\n }),\n [maxValue, minValue, thumbWidth, toValue],\n );\n\n const fromSliderThumbContentPosition = useMemo(\n () =>\n calculatePopupPosition({\n min: minValue,\n max: maxValue,\n sliderValue: fromValue,\n popupWidth: thumbWidth,\n }),\n [fromValue, maxValue, minValue, thumbWidth],\n );\n\n const handleTouchStart = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n void setRefreshScrollEnabled(false);\n\n if (shouldShowThumbLabel) {\n setIsBigSlider(true);\n }\n }, [isDisabled, shouldShowThumbLabel]);\n\n const handleTouchEnd = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n void setRefreshScrollEnabled(true);\n\n const from = Number(fromSliderRef.current?.value);\n const to = Number(toSliderRef.current?.value);\n\n if (typeof onSelect === 'function') {\n onSelect(\n interval ? undefined : from,\n interval ? { maxValue: to, minValue: from } : undefined,\n );\n }\n\n if (shouldShowThumbLabel) {\n setIsBigSlider(false);\n }\n }, [interval, isDisabled, onSelect, shouldShowThumbLabel]);\n\n const highlightedStepElements = useMemo(() => {\n const sliderWidth = fromSliderRef.current?.offsetWidth ?? 0;\n const wrapperWidth = sliderWrapperSize?.width ?? 0;\n\n if (!shouldHighlightSteps || interval || sliderWidth === 0 || wrapperWidth === 0) {\n return null;\n }\n\n const elements: ReactNode[] = [];\n\n for (let i = minValue; i <= maxValue; i += step) {\n const isStepDisabled =\n (typeof minEnabledValue === 'number' && i < minEnabledValue) ||\n (typeof maxEnabledValue === 'number' && i > maxEnabledValue);\n\n const offset = (wrapperWidth - sliderWidth) / 2;\n const stepWidth = (sliderWidth / (maxValue - minValue)) * step;\n\n elements.push(\n <StyledHighlightedStep\n key={`step--${i}`}\n $isDisabled={isStepDisabled}\n $isFilled={i < fromValue}\n $leftPosition={offset + stepWidth * i}\n />,\n );\n }\n\n return elements;\n }, [\n fromValue,\n interval,\n maxEnabledValue,\n maxValue,\n minEnabledValue,\n minValue,\n shouldHighlightSteps,\n sliderWrapperSize?.width,\n step,\n ]);\n\n const fromInputBackground = useMemo(() => {\n if (interval) return undefined;\n\n const gradientPoints: string[] = [];\n\n const getPercentage = (x: number) => ((x - minValue) / (maxValue - minValue)) * 100;\n\n if (typeof minEnabledValue === 'number') {\n gradientPoints.push('rgb(215, 215, 215) 0%');\n gradientPoints.push(`rgb(215, 215, 215) ${getPercentage(minEnabledValue)}%`);\n gradientPoints.push(`${theme['409'] ?? ''} ${getPercentage(minEnabledValue)}%`);\n } else {\n gradientPoints.push(`${theme['409'] ?? ''} 0%`);\n }\n\n gradientPoints.push(`${theme['409'] ?? ''} ${getPercentage(fromValue)}%`);\n gradientPoints.push(`${theme['403'] ?? ''} ${getPercentage(fromValue)}%`);\n\n if (typeof maxEnabledValue === 'number') {\n gradientPoints.push(`${theme['403'] ?? ''} ${getPercentage(maxEnabledValue)}%`);\n gradientPoints.push(`rgb(215, 215, 215) ${getPercentage(maxEnabledValue)}%`);\n gradientPoints.push('rgb(215, 215, 215) 100%');\n } else {\n gradientPoints.push(`${theme['403'] ?? ''} 100%`);\n }\n\n return `linear-gradient(to right, ${gradientPoints.join(', ')})`;\n }, [fromValue, interval, maxEnabledValue, maxValue, minEnabledValue, minValue, theme]);\n\n return useMemo(\n () => (\n <StyledSlider ref={sliderWrapperRef} $isDisabled={isDisabled}>\n {highlightedStepElements}\n <StyledSliderInput\n animate={{ height: isBigSlider ? 30 : 10 }}\n initial={{ height: 10 }}\n exit={{ height: 10 }}\n $thumbWidth={40}\n ref={fromSliderRef}\n $isInterval={!!interval}\n type=\"range\"\n value={fromValue}\n step={0.01}\n max={maxValue}\n min={minValue}\n onTouchStart={handleTouchStart}\n onTouchEnd={handleTouchEnd}\n onChange={handleInputChange}\n onMouseUp={handleMouseUp}\n $background={fromInputBackground}\n />\n <StyledSliderThumb\n ref={fromSliderThumbRef}\n $position={fromSliderThumbPosition}\n $isBigSlider={isBigSlider}\n >\n {shouldShowThumbLabel && (\n <StyledSliderThumbLabel\n $width={thumbWidth}\n $isBigSlider={isBigSlider}\n $position={fromSliderThumbContentPosition}\n ref={fromSliderThumbContentRef}\n >\n {typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(fromValue)\n : fromValue}\n </StyledSliderThumbLabel>\n )}\n </StyledSliderThumb>\n {interval && (\n <StyledSliderThumb\n ref={toSliderThumbRef}\n $position={toSliderThumbPosition}\n $isBigSlider={isBigSlider}\n >\n {shouldShowThumbLabel && (\n <StyledSliderThumbLabel\n $width={thumbWidth}\n $isBigSlider={isBigSlider}\n $position={toSliderThumbContentPosition}\n ref={toSliderThumbContentRef}\n >\n {typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(toValue)\n : toValue}\n </StyledSliderThumbLabel>\n )}\n </StyledSliderThumb>\n )}\n {interval && (\n <StyledSliderInput\n animate={{ height: isBigSlider ? 30 : 10 }}\n initial={{ height: 10 }}\n exit={{ height: 10 }}\n $thumbWidth={40}\n ref={toSliderRef}\n $isInterval={!!interval}\n type=\"range\"\n value={toValue}\n step={0.01}\n max={maxValue}\n min={minValue}\n onTouchStart={handleTouchStart}\n onTouchEnd={handleTouchEnd}\n onChange={handleControlToSlider}\n onMouseUp={handleMouseUp}\n />\n )}\n </StyledSlider>\n ),\n [\n fromInputBackground,\n fromSliderThumbContentPosition,\n fromSliderThumbPosition,\n fromValue,\n handleControlToSlider,\n handleInputChange,\n handleMouseUp,\n handleTouchEnd,\n handleTouchStart,\n highlightedStepElements,\n interval,\n isBigSlider,\n isDisabled,\n maxValue,\n minValue,\n shouldShowThumbLabel,\n thumbLabelFormatter,\n thumbWidth,\n toSliderThumbContentPosition,\n toSliderThumbPosition,\n toValue,\n ],\n );\n};\n\nSlider.displayName = 'Slider';\n\nexport default Slider;\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,YAAY;AACpD,OAAOC,KAAK,IAIRC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SACIC,uBAAuB,EACvBC,sBAAsB,EACtBC,UAAU,EACVC,gBAAgB,QACb,oBAAoB;AAE3B,SACIC,qBAAqB,EACrBC,YAAY,EACZC,iBAAiB,EACjBC,iBAAiB,EACjBC,sBAAsB,QACnB,iBAAiB;AAmJxB,MAAMC,MAAuB,GAAGA,CAAC;EAC7BC,QAAQ;EACRC,UAAU;EACVC,eAAe;EACfC,QAAQ;EACRC,eAAe;EACfC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,oBAAoB,GAAG,KAAK;EAC5BC,oBAAoB,GAAG,KAAK;EAC5BC,IAAI,GAAG,CAAC;EACRC,mBAAmB;EACnBC;AACJ,CAAC,KAAK;EACF,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAG3B,QAAQ,CAACiB,eAAe,IAAIC,QAAQ,CAAC;EACvE,MAAM,CAACU,OAAO,EAAEC,UAAU,CAAC,GAAG7B,QAAQ,CAACe,eAAe,IAAIC,QAAQ,CAAC;EACnE,MAAM,CAACc,UAAU,EAAEC,aAAa,CAAC,GAAG/B,QAAQ,CAAC,EAAE,CAAC;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iBACLlB,KAAA,CAAAsG,aAAA,CAACxF,iBAAiB;IACdmG,OAAO,EAAE;MAAEC,MAAM,EAAE7E,WAAW,GAAG,EAAE,GAAG;IAAG,CAAE;IAC3C8E,OAAO,EAAE;MAAED,MAAM,EAAE;IAAG,CAAE;IACxBE,IAAI,EAAE;MAAEF,MAAM,EAAE;IAAG,CAAE;IACrBG,WAAW,EAAE,EAAG;IAChBL,GAAG,EAAEtE,WAAY;IACjB4E,WAAW,EAAE,CAAC,CAACpG,QAAS;IACxBqG,IAAI,EAAC,OAAO;IACZzF,KAAK,EAAEG,OAAQ;IACfL,IAAI,EAAE,IAAK;IACXmD,GAAG,EAAE1D,QAAS;IACd4D,GAAG,EAAE1D,QAAS;IACdiG,YAAY,EAAE3B,gBAAiB;IAC/B4B,UAAU,EAAE3B,cAAe;IAC3BtE,QAAQ,EAAEoD,qBAAsB;IAChC8C,SAAS,EAAElD;EAAc,CAC5B,CAEK,CACjB,EACD,CACImC,mBAAmB,EACnBf,8BAA8B,EAC9BT,uBAAuB,EACvBpD,SAAS,EACT6C,qBAAqB,EACrBC,iBAAiB,EACjBL,aAAa,EACbsB,cAAc,EACdD,gBAAgB,EAChBE,uBAAuB,EACvB7E,QAAQ,EACRmB,WAAW,EACXlB,UAAU,EACVE,QAAQ,EACRE,QAAQ,EACRI,oBAAoB,EACpBE,mBAAmB,EACnBM,UAAU,EACVsD,4BAA4B,EAC5BD,qBAAqB,EACrBvD,OAAO,CAEf,CAAC;AACL,CAAC;AAEDhB,MAAM,CAAC8G,WAAW,GAAG,QAAQ;AAE7B,eAAe9G,MAAM","ignoreList":[]}
@@ -63,7 +63,7 @@ export const getThumbMaxWidth = ({
63
63
  element.style.minWidth = '20px';
64
64
  element.style.opacity = '0';
65
65
  element.style.position = 'absolute';
66
- element.textContent = typeof thumbLabelFormatter === 'function' ? thumbLabelFormatter(maxNumber) : String(maxNumber);
66
+ element.textContent = typeof thumbLabelFormatter === 'function' ? thumbLabelFormatter(maxNumber, true) : String(maxNumber);
67
67
  document.body.appendChild(element);
68
68
  const width = element.offsetWidth;
69
69
  document.body.removeChild(element);
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","names":["fillSlider","fromSlider","toSlider","theme","fromValue","toValue","rangeDistance","Number","max","min","fromPosition","value","toPosition","backgroundColor","trackColor","gradient","style","background","calculateGradientOffset","maxValue","minValue","sliderWidth","thumbWidth","wrapperWidth","offset","percentage","calculatePopupPosition","sliderValue","popupWidth","leftAtMin","leftAtMax","getThumbMaxWidth","maxNumber","thumbLabelFormatter","element","document","createElement","height","display","padding","whiteSpace","minWidth","opacity","position","textContent","String","body","appendChild","width","offsetWidth","removeChild"],"sources":["../../../src/utils/slider.ts"],"sourcesContent":["import type { Theme } from '../components/color-scheme-provider/ColorSchemeProvider';\n\nexport interface FillSlider {\n fromSlider: HTMLInputElement;\n toSlider: HTMLInputElement;\n fromValue?: number;\n toValue?: number;\n theme: Theme;\n}\n\nexport const fillSlider = ({ fromSlider, toSlider, theme, fromValue, toValue }: FillSlider) => {\n const rangeDistance = Number(toSlider.max) - Number(toSlider.min);\n const fromPosition = Number(fromValue ?? fromSlider.value) - Number(toSlider.min);\n const toPosition = Number(toValue ?? toSlider.value) - Number(toSlider.min);\n\n const backgroundColor = theme['403'];\n const trackColor = theme['409'];\n\n if (!backgroundColor || !trackColor) {\n return;\n }\n\n const gradient = `linear-gradient(\n to right,\n ${backgroundColor} 0%,\n ${backgroundColor} ${(fromPosition / rangeDistance) * 100}%,\n ${trackColor} ${(fromPosition / rangeDistance) * 100}%,\n ${trackColor} ${(toPosition / rangeDistance) * 100}%,\n ${backgroundColor} ${(toPosition / rangeDistance) * 100}%,\n ${backgroundColor} 100%)`;\n\n // Apply the gradient to the appropriate slider\n // eslint-disable-next-line no-param-reassign\n toSlider.style.background = gradient;\n // eslint-disable-next-line no-param-reassign\n fromSlider.style.background = gradient;\n};\n\ninterface CalculateGradientOffset {\n maxValue: number;\n minValue: number;\n sliderWidth: number;\n thumbWidth: number;\n value: number;\n wrapperWidth: number;\n}\n\nexport const calculateGradientOffset = ({\n maxValue,\n minValue,\n sliderWidth,\n thumbWidth,\n value,\n wrapperWidth,\n}: CalculateGradientOffset): number => {\n const offset = (wrapperWidth - sliderWidth) / 2;\n const percentage = (value - minValue) / (maxValue - minValue);\n\n return offset - thumbWidth / 2 + percentage * sliderWidth;\n};\n\ninterface GetThumbMaxWidthOptions {\n maxNumber: number;\n thumbLabelFormatter?: (value: number) => string;\n}\n\ninterface CalculatePopupPositionOptions {\n sliderValue: number;\n min: number;\n max: number;\n popupWidth: number;\n}\n\nexport const calculatePopupPosition = ({\n sliderValue,\n min,\n max,\n popupWidth,\n}: CalculatePopupPositionOptions) => {\n const percentage = (sliderValue - min) / (max - min);\n\n const leftAtMin = -10;\n const leftAtMax = -popupWidth + 25;\n\n return leftAtMin + percentage * (leftAtMax - leftAtMin);\n};\n\nexport const getThumbMaxWidth = ({ maxNumber, thumbLabelFormatter }: GetThumbMaxWidthOptions) => {\n const element = document.createElement('span');\n\n element.style.height = '20px';\n element.style.display = 'flex';\n element.style.padding = '16px';\n element.style.whiteSpace = 'nowrap';\n element.style.minWidth = '20px';\n element.style.opacity = '0';\n element.style.position = 'absolute';\n\n element.textContent =\n typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(maxNumber)\n : String(maxNumber);\n\n document.body.appendChild(element);\n\n const width = element.offsetWidth;\n\n document.body.removeChild(element);\n\n return width;\n};\n"],"mappings":"AAUA,OAAO,MAAMA,UAAU,GAAGA,CAAC;EAAEC,UAAU;EAAEC,QAAQ;EAAEC,KAAK;EAAEC,SAAS;EAAEC;AAAoB,CAAC,KAAK;EAC3F,MAAMC,aAAa,GAAGC,MAAM,CAACL,QAAQ,CAACM,GAAG,CAAC,GAAGD,MAAM,CAACL,QAAQ,CAACO,GAAG,CAAC;EACjE,MAAMC,YAAY,GAAGH,MAAM,CAACH,SAAS,IAAIH,UAAU,CAACU,KAAK,CAAC,GAAGJ,MAAM,CAACL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AAK;EACjC,MAAMH,UAAU,GAAG,CAACE,WAAW,GAAGlB,GAAG,KAAKD,GAAG,GAAGC,GAAG,CAAC;EAEpD,MAAMoB,SAAS,GAAG,CAAC,EAAE;EACrB,MAAMC,SAAS,GAAG,CAACF,UAAU,GAAG,EAAE;EAElC,OAAOC,SAAS,GAAGJ,UAAU,IAAIK,SAAS,GAAGD,SAAS,CAAC;AAC3D,CAAC;AAED,OAAO,MAAME,gBAAgB,GAAGA,CAAC;EAAEC,SAAS;EAAEC;AAA6C,CAAC,KAAK;EAC7F,MAAMC,OAAO,GAAGC,QAAQ,CAACC,aAAa,CAAC,MAAM,CAAC;EAE9CF,OAAO,CAAClB,KAAK,CAACqB,MAAM,GAAG,MAAM;EAC7BH,OAAO,CAAClB,KAAK,CAACsB,OAAO,GAAG,MAAM;EAC9BJ,OAAO,CAAClB,KAAK,CAACuB,OAAO,GAAG,MAAM;EAC9BL,OAAO,CAAClB,KAAK,CAACwB,UAAU,GAAG,QAAQ;EACnCN,OAAO,CAAClB,KAAK,CAACyB,QAAQ,GAAG,MAAM;EAC/BP,OAAO,CAAClB,KAAK,CAAC0B,OAAO,GAAG,GAAG;EAC3BR,OAAO,CAAClB,KAAK,CAAC2B,QAAQ,GAAG,UAAU;EAEnCT,OAAO,CAACU,WAAW,GACf,OAAOX,mBAAmB,KAAK,UAAU,GACnCA,mBAAmB,CAACD,SAAS,CAAC,GAC9Ba,MAAM,CAACb,SAAS,CAAC;EAE3BG,QAAQ,CAACW,IAAI,CAACC,WAAW,CAACb,OAAO,CAAC;EAElC,MAAMc,KAAK,GAAGd,OAAO,CAACe,WAAW;EAEjCd,QAAQ,CAACW,IAAI,CAACI,WAAW,CAAChB,OAAO,CAAC;EAElC,OAAOc,KAAK;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"slider.js","names":["fillSlider","fromSlider","toSlider","theme","fromValue","toValue","rangeDistance","Number","max","min","fromPosition","value","toPosition","backgroundColor","trackColor","gradient","style","background","calculateGradientOffset","maxValue","minValue","sliderWidth","thumbWidth","wrapperWidth","offset","percentage","calculatePopupPosition","sliderValue","popupWidth","leftAtMin","leftAtMax","getThumbMaxWidth","maxNumber","thumbLabelFormatter","element","document","createElement","height","display","padding","whiteSpace","minWidth","opacity","position","textContent","String","body","appendChild","width","offsetWidth","removeChild"],"sources":["../../../src/utils/slider.ts"],"sourcesContent":["import type { Theme } from '../components/color-scheme-provider/ColorSchemeProvider';\n\nexport interface FillSlider {\n fromSlider: HTMLInputElement;\n toSlider: HTMLInputElement;\n fromValue?: number;\n toValue?: number;\n theme: Theme;\n}\n\nexport const fillSlider = ({ fromSlider, toSlider, theme, fromValue, toValue }: FillSlider) => {\n const rangeDistance = Number(toSlider.max) - Number(toSlider.min);\n const fromPosition = Number(fromValue ?? fromSlider.value) - Number(toSlider.min);\n const toPosition = Number(toValue ?? toSlider.value) - Number(toSlider.min);\n\n const backgroundColor = theme['403'];\n const trackColor = theme['409'];\n\n if (!backgroundColor || !trackColor) {\n return;\n }\n\n const gradient = `linear-gradient(\n to right,\n ${backgroundColor} 0%,\n ${backgroundColor} ${(fromPosition / rangeDistance) * 100}%,\n ${trackColor} ${(fromPosition / rangeDistance) * 100}%,\n ${trackColor} ${(toPosition / rangeDistance) * 100}%,\n ${backgroundColor} ${(toPosition / rangeDistance) * 100}%,\n ${backgroundColor} 100%)`;\n\n // Apply the gradient to the appropriate slider\n // eslint-disable-next-line no-param-reassign\n toSlider.style.background = gradient;\n // eslint-disable-next-line no-param-reassign\n fromSlider.style.background = gradient;\n};\n\ninterface CalculateGradientOffset {\n maxValue: number;\n minValue: number;\n sliderWidth: number;\n thumbWidth: number;\n value: number;\n wrapperWidth: number;\n}\n\nexport const calculateGradientOffset = ({\n maxValue,\n minValue,\n sliderWidth,\n thumbWidth,\n value,\n wrapperWidth,\n}: CalculateGradientOffset): number => {\n const offset = (wrapperWidth - sliderWidth) / 2;\n const percentage = (value - minValue) / (maxValue - minValue);\n\n return offset - thumbWidth / 2 + percentage * sliderWidth;\n};\n\ninterface GetThumbMaxWidthOptions {\n maxNumber: number;\n thumbLabelFormatter?: (value: number, isMeasuring?: boolean) => string;\n}\n\ninterface CalculatePopupPositionOptions {\n sliderValue: number;\n min: number;\n max: number;\n popupWidth: number;\n}\n\nexport const calculatePopupPosition = ({\n sliderValue,\n min,\n max,\n popupWidth,\n}: CalculatePopupPositionOptions) => {\n const percentage = (sliderValue - min) / (max - min);\n\n const leftAtMin = -10;\n const leftAtMax = -popupWidth + 25;\n\n return leftAtMin + percentage * (leftAtMax - leftAtMin);\n};\n\nexport const getThumbMaxWidth = ({ maxNumber, thumbLabelFormatter }: GetThumbMaxWidthOptions) => {\n const element = document.createElement('span');\n\n element.style.height = '20px';\n element.style.display = 'flex';\n element.style.padding = '16px';\n element.style.whiteSpace = 'nowrap';\n element.style.minWidth = '20px';\n element.style.opacity = '0';\n element.style.position = 'absolute';\n\n element.textContent =\n typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(maxNumber, true)\n : String(maxNumber);\n\n document.body.appendChild(element);\n\n const width = element.offsetWidth;\n\n document.body.removeChild(element);\n\n return width;\n};\n"],"mappings":"AAUA,OAAO,MAAMA,UAAU,GAAGA,CAAC;EAAEC,UAAU;EAAEC,QAAQ;EAAEC,KAAK;EAAEC,SAAS;EAAEC;AAAoB,CAAC,KAAK;EAC3F,MAAMC,aAAa,GAAGC,MAAM,CAACL,QAAQ,CAACM,GAAG,CAAC,GAAGD,MAAM,CAACL,QAAQ,CAACO,GAAG,CAAC;EACjE,MAAMC,YAAY,GAAGH,MAAM,CAACH,SAAS,IAAIH,UAAU,CAACU,KAAK,CAAC,GAAGJ,MAAM,CAACL,QAAQ,CAACO,GAAG,CAAC;EACjF,MAAMG,UAAU,GAAGL,MAAM,CAACF,OAAO,IAAIH,QAAQ,CAACS,KAAK,CAAC,GAAGJ,MAAM,CAACL,QAAQ,CAACO,GAAG,CAAC;EAE3E,MAAMI,eAAe,GAAGV,KAAK,CAAC,KAAK,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S,GAAGJ,UAAU,IAAIK,SAAS,GAAGD,SAAS,CAAC;AAC3D,CAAC;AAED,OAAO,MAAME,gBAAgB,GAAGA,CAAC;EAAEC,SAAS;EAAEC;AAA6C,CAAC,KAAK;EAC7F,MAAMC,OAAO,GAAGC,QAAQ,CAACC,aAAa,CAAC,MAAM,CAAC;EAE9CF,OAAO,CAAClB,KAAK,CAACqB,MAAM,GAAG,MAAM;EAC7BH,OAAO,CAAClB,KAAK,CAACsB,OAAO,GAAG,MAAM;EAC9BJ,OAAO,CAAClB,KAAK,CAACuB,OAAO,GAAG,MAAM;EAC9BL,OAAO,CAAClB,KAAK,CAACwB,UAAU,GAAG,QAAQ;EACnCN,OAAO,CAAClB,KAAK,CAACyB,QAAQ,GAAG,MAAM;EAC/BP,OAAO,CAAClB,KAAK,CAAC0B,OAAO,GAAG,GAAG;EAC3BR,OAAO,CAAClB,KAAK,CAAC2B,QAAQ,GAAG,UAAU;EAEnCT,OAAO,CAACU,WAAW,GACf,OAAOX,mBAAmB,KAAK,UAAU,GACnCA,mBAAmB,CAACD,SAAS,EAAE,IAAI,CAAC,GACpCa,MAAM,CAACb,SAAS,CAAC;EAE3BG,QAAQ,CAACW,IAAI,CAACC,WAAW,CAACb,OAAO,CAAC;EAElC,MAAMc,KAAK,GAAGd,OAAO,CAACe,WAAW;EAEjCd,QAAQ,CAACW,IAAI,CAACI,WAAW,CAAChB,OAAO,CAAC;EAElC,OAAOc,KAAK;AAChB,CAAC","ignoreList":[]}
@@ -130,7 +130,7 @@ export type SliderProps = {
130
130
  * <Slider thumbLabelFormatter={(value) => `${value} €`} />
131
131
  * @optional
132
132
  */
133
- thumbLabelFormatter?: (value: number) => string;
133
+ thumbLabelFormatter?: (value: number, isMeasuring?: boolean) => string;
134
134
  /**
135
135
  * The current value of the slider.
136
136
  * @description
@@ -18,7 +18,7 @@ interface CalculateGradientOffset {
18
18
  export declare const calculateGradientOffset: ({ maxValue, minValue, sliderWidth, thumbWidth, value, wrapperWidth, }: CalculateGradientOffset) => number;
19
19
  interface GetThumbMaxWidthOptions {
20
20
  maxNumber: number;
21
- thumbLabelFormatter?: (value: number) => string;
21
+ thumbLabelFormatter?: (value: number, isMeasuring?: boolean) => string;
22
22
  }
23
23
  interface CalculatePopupPositionOptions {
24
24
  sliderValue: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/core",
3
- "version": "5.0.53",
3
+ "version": "5.0.55",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "sideEffects": false,
6
6
  "browserslist": [
@@ -87,5 +87,5 @@
87
87
  "publishConfig": {
88
88
  "access": "public"
89
89
  },
90
- "gitHead": "8ece3beb8424358b883a16a87419ef35303be612"
90
+ "gitHead": "05d5f7508703e3fb5757bd36d984d6e1224d5e2b"
91
91
  }