@chayns-components/core 5.0.53 → 5.0.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/AGENTS.md +42 -0
  2. package/lib/cjs/components/context-menu/ContextMenu.js +10 -4
  3. package/lib/cjs/components/context-menu/ContextMenu.js.map +1 -1
  4. package/lib/cjs/components/context-menu/ContextMenu.styles.js +19 -7
  5. package/lib/cjs/components/context-menu/ContextMenu.styles.js.map +1 -1
  6. package/lib/cjs/components/context-menu/ContextMenu.types.js.map +1 -1
  7. package/lib/cjs/components/multi-action-button/MultiActionButton.js +69 -21
  8. package/lib/cjs/components/multi-action-button/MultiActionButton.js.map +1 -1
  9. package/lib/cjs/components/multi-action-button/MultiActionButton.types.js.map +1 -1
  10. package/lib/cjs/components/multi-action-button/MultiActionButton.utils.js +44 -0
  11. package/lib/cjs/components/multi-action-button/MultiActionButton.utils.js.map +1 -0
  12. package/lib/cjs/components/popup/Popup.js +1 -1
  13. package/lib/cjs/components/popup/Popup.js.map +1 -1
  14. package/lib/cjs/components/progress-bar/ProgressBar.js.map +1 -1
  15. package/lib/cjs/components/slider/Slider.js.map +1 -1
  16. package/lib/cjs/index.js.map +1 -1
  17. package/lib/cjs/utils/slider.js +1 -1
  18. package/lib/cjs/utils/slider.js.map +1 -1
  19. package/lib/esm/components/context-menu/ContextMenu.js +10 -4
  20. package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
  21. package/lib/esm/components/context-menu/ContextMenu.styles.js +19 -7
  22. package/lib/esm/components/context-menu/ContextMenu.styles.js.map +1 -1
  23. package/lib/esm/components/context-menu/ContextMenu.types.js.map +1 -1
  24. package/lib/esm/components/multi-action-button/MultiActionButton.js +65 -18
  25. package/lib/esm/components/multi-action-button/MultiActionButton.js.map +1 -1
  26. package/lib/esm/components/multi-action-button/MultiActionButton.types.js.map +1 -1
  27. package/lib/esm/components/multi-action-button/MultiActionButton.utils.js +37 -0
  28. package/lib/esm/components/multi-action-button/MultiActionButton.utils.js.map +1 -0
  29. package/lib/esm/components/popup/Popup.js +1 -1
  30. package/lib/esm/components/popup/Popup.js.map +1 -1
  31. package/lib/esm/components/progress-bar/ProgressBar.js.map +1 -1
  32. package/lib/esm/components/slider/Slider.js.map +1 -1
  33. package/lib/esm/index.js.map +1 -1
  34. package/lib/esm/utils/slider.js +1 -1
  35. package/lib/esm/utils/slider.js.map +1 -1
  36. package/lib/types/components/context-menu/ContextMenu.styles.d.ts +1 -0
  37. package/lib/types/components/context-menu/ContextMenu.types.d.ts +27 -1
  38. package/lib/types/components/multi-action-button/MultiActionButton.types.d.ts +10 -0
  39. package/lib/types/components/multi-action-button/MultiActionButton.utils.d.ts +8 -0
  40. package/lib/types/components/slider/Slider.d.ts +1 -1
  41. package/lib/types/index.d.ts +1 -1
  42. package/lib/types/utils/slider.d.ts +1 -1
  43. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"MultiActionButton.types.js","names":["MultiActionButtonStatusType","MultiActionButtonHeight"],"sources":["../../../../src/components/multi-action-button/MultiActionButton.types.ts"],"sourcesContent":["import type { MouseEvent, ReactElement, ReactNode } from 'react';\nimport type { MotionValue } from 'motion/react';\n\n/**\n * Supported status types for the multi action button.\n */\nexport enum MultiActionButtonStatusType {\n /**\n * Pulsing background effect.\n * @description Applies a subtle animated overlay on the action background to draw attention.\n * This is intended for temporary states like recording or live activity indicators.\n */\n Pulse = 'pulse',\n}\n\n/**\n * Supported heights for the multi action button.\n */\nexport enum MultiActionButtonHeight {\n /**\n * Medium height (42px).\n */\n Medium = 42,\n /**\n * Large height (48px).\n */\n Large = 48,\n}\n\n/**\n * Minimal status configuration for an action.\n */\nexport type MultiActionButtonActionStatus = {\n /**\n * Optional pulse colors for the animation.\n * @description Defines the two colors for the pulsing background animation. If not provided, defaults to ['#A50000', '#630000'].\n * @optional\n */\n pulseColors?: [string, string];\n /**\n * Status type to apply.\n * @description Selects the visual emphasis type applied to the action. The component currently\n * supports a pulsing overlay, and additional types may be added later.\n * @optional\n */\n type?: MultiActionButtonStatusType;\n};\n\n/**\n * Event payload emitted on action click.\n */\nexport type MultiActionButtonActionEvent = {\n /**\n * Which action was clicked.\n * @description Indicates whether the primary or secondary action fired. This is helpful when\n * sharing a handler between both actions.\n */\n action: 'primary' | 'secondary';\n /**\n * Original click event.\n * @description Useful to access modifier keys, prevent default, or stop propagation.\n */\n event: MouseEvent<HTMLButtonElement>;\n /**\n * Whether the secondary action is currently extended.\n * @description Useful for flows that need to distinguish between a collapsed and expanded\n * secondary action, especially on touch devices.\n */\n isExtended: boolean;\n /**\n * Whether the device is considered touch.\n * @description Derived from pointer capabilities and used to decide between hover and click behavior.\n */\n isTouch: boolean;\n};\n\n/**\n * Configuration for a single action.\n */\nexport type MultiActionButtonAction = {\n /**\n * Optional background color for this action.\n * @description Overrides the component-level background color for this specific action.\n * If omitted, `MultiActionButton.backgroundColor` is used as fallback.\n * @optional\n */\n backgroundColor?: string;\n /**\n * Optional color for the icon and label.\n * @description Overrides the default text/icon color. If omitted, the current theme text color is used.\n * @optional\n */\n color?: string;\n /**\n * The icon for the action.\n * @description Can be a FontAwesome class string (e.g., 'fa fa-microphone') or a custom React element.\n * The icon is always rendered inside a fixed-size slot to keep alignment stable.\n */\n icon: string | ReactElement;\n /**\n * Whether the action is disabled.\n * @description Disabled actions do not respond to hover or click and are visually dimmed.\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Optional reason shown in a tooltip when the action is disabled.\n * @description Use this to explain why the action is currently unavailable.\n * @optional\n */\n disabledReason?: string;\n /**\n * The optional label for the action.\n * @description The label is shown next to the icon and will be truncated with ellipsis when\n * there is not enough horizontal space.\n * @optional\n */\n label: ReactNode;\n /**\n * Click handler for the action.\n * @description Receives a payload that includes the action type, extension state, and device info.\n * This allows external logic to decide whether the click should trigger an action immediately.\n * @optional\n */\n onClick?: (info: MultiActionButtonActionEvent) => void;\n /**\n * Status effect configuration for the action.\n * @description Controls optional visual emphasis like pulsing, without changing layout or sizing.\n * @optional\n */\n status?: MultiActionButtonActionStatus;\n};\n\n/**\n * Props for the MultiActionButton component.\n */\nexport type MultiActionButtonProps = {\n /**\n * Optional background color for both actions.\n * @description Overrides the default background color for the action buttons. This is useful\n * when the button is used on different backgrounds or when a specific brand color is needed.\n * If omitted, the primary color from the theme is used.\n * @default theme.primary\n * @optional\n */\n backgroundColor?: string;\n /**\n * Additional class name for the wrapper element.\n * @description Useful for custom styling or testing hooks.\n * @optional\n */\n className?: string;\n /**\n * Timeout in ms before the secondary action collapses after a click.\n * @description Set to 0 to keep the secondary action extended until the user collapses it.\n * @example\n * <MultiActionButton\n * primaryAction={primaryAction}\n * secondaryAction={secondaryAction}\n * extendedTimeoutMs={0}\n * />\n * @default 3000\n * @optional\n */\n extendedTimeoutMs?: number;\n /**\n * Height of the button.\n * @description Controls the height of the button. Use values from MultiActionButtonHeight enum or custom number.\n * @default MultiActionButtonHeight.Medium\n * @optional\n */\n height?: number;\n /**\n * Optional color for the 1px separator line between actions.\n * @description Defaults to theme.cw-body-background and falls back to #fff if not available.\n * @optional\n */\n gapColor?: string;\n /**\n * Whether the button is collapsed to a single icon.\n * @description When collapsed, only the primary icon is shown and the overall width shrinks to a circle.\n * Use this to provide compact states or toolbar modes.\n * @default false\n * @optional\n */\n isCollapsed?: boolean;\n /**\n * Whether the whole control is disabled.\n * @description Disables interactions for both actions, including hover expansion and clicks.\n * @default false\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Primary action configuration.\n * @description Required action shown on the left side (or as the only action when no secondary is provided).\n */\n primaryAction: MultiActionButtonAction;\n /**\n * Secondary action configuration.\n * @description Optional action shown on the right side. When present, it can expand on hover or click.\n * @optional\n */\n secondaryAction?: MultiActionButtonAction;\n /**\n * Whether the button should take the full width of its parent.\n * @description When true, the control stretches to 100% width unless `width` is provided.\n * @optional\n */\n shouldUseFullWidth?: boolean;\n /**\n * Optional width override for the whole button.\n * @description Can be a fixed number or a MotionValue for external animations. When omitted,\n * the width is driven by the content unless `shouldUseFullWidth` is true.\n * @optional\n */\n width?: number | MotionValue<number>;\n};\n"],"mappings":"AAGA;AACA;AACA;AACA,WAAYA,2BAA2B,0BAA3BA,2BAA2B;EACnC;AACJ;AACA;AACA;AACA;EALYA,2BAA2B;EAAA,OAA3BA,2BAA2B;AAAA;;AASvC;AACA;AACA;AACA,WAAYC,uBAAuB,0BAAvBA,uBAAuB;EAC/B;AACJ;AACA;EAHYA,uBAAuB,CAAvBA,uBAAuB;EAK/B;AACJ;AACA;EAPYA,uBAAuB,CAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;;AAWnC;AACA;AACA;;AAiBA;AACA;AACA;;AA0BA;AACA;AACA;;AAuDA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"MultiActionButton.types.js","names":["MultiActionButtonStatusType","MultiActionButtonHeight"],"sources":["../../../../src/components/multi-action-button/MultiActionButton.types.ts"],"sourcesContent":["import type { MouseEvent, ReactElement, ReactNode } from 'react';\nimport type { MotionValue } from 'motion/react';\nimport type { ContextMenuItem } from '../context-menu/ContextMenu.types';\n\n/**\n * Supported status types for the multi action button.\n */\nexport enum MultiActionButtonStatusType {\n /**\n * Pulsing background effect.\n * @description Applies a subtle animated overlay on the action background to draw attention.\n * This is intended for temporary states like recording or live activity indicators.\n */\n Pulse = 'pulse',\n}\n\n/**\n * Supported heights for the multi action button.\n */\nexport enum MultiActionButtonHeight {\n /**\n * Medium height (42px).\n */\n Medium = 42,\n /**\n * Large height (48px).\n */\n Large = 48,\n}\n\n/**\n * Minimal status configuration for an action.\n */\nexport type MultiActionButtonActionStatus = {\n /**\n * Optional pulse colors for the animation.\n * @description Defines the two colors for the pulsing background animation. If not provided, defaults to ['#A50000', '#630000'].\n * @optional\n */\n pulseColors?: [string, string];\n /**\n * Status type to apply.\n * @description Selects the visual emphasis type applied to the action. The component currently\n * supports a pulsing overlay, and additional types may be added later.\n * @optional\n */\n type?: MultiActionButtonStatusType;\n};\n\n/**\n * Event payload emitted on action click.\n */\nexport type MultiActionButtonActionEvent = {\n /**\n * Which action was clicked.\n * @description Indicates whether the primary or secondary action fired. This is helpful when\n * sharing a handler between both actions.\n */\n action: 'primary' | 'secondary';\n /**\n * Original click event.\n * @description Useful to access modifier keys, prevent default, or stop propagation.\n */\n event: MouseEvent<HTMLButtonElement>;\n /**\n * Whether the secondary action is currently extended.\n * @description Useful for flows that need to distinguish between a collapsed and expanded\n * secondary action, especially on touch devices.\n */\n isExtended: boolean;\n /**\n * Whether the device is considered touch.\n * @description Derived from pointer capabilities and used to decide between hover and click behavior.\n */\n isTouch: boolean;\n};\n\n/**\n * Configuration for a single action.\n */\nexport type MultiActionButtonAction = {\n /**\n * Optional background color for this action.\n * @description Overrides the component-level background color for this specific action.\n * If omitted, `MultiActionButton.backgroundColor` is used as fallback.\n * @optional\n */\n backgroundColor?: string;\n /**\n * Optional color for the icon and label.\n * @description Overrides the default text/icon color. If omitted, the current theme text color is used.\n * @optional\n */\n color?: string;\n /**\n * The icon for the action.\n * @description Can be a FontAwesome class string (e.g., 'fa fa-microphone') or a custom React element.\n * The icon is always rendered inside a fixed-size slot to keep alignment stable.\n */\n icon: string | ReactElement;\n /**\n * Whether the action is disabled.\n * @description Disabled actions do not respond to hover or click and are visually dimmed.\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Optional reason shown in a tooltip when the action is disabled.\n * @description Use this to explain why the action is currently unavailable.\n * @optional\n */\n disabledReason?: string;\n /**\n * The optional label for the action.\n * @description The label is shown next to the icon and will be truncated with ellipsis when\n * there is not enough horizontal space.\n * @optional\n */\n label: ReactNode;\n /**\n * Click handler for the action.\n * @description Receives a payload that includes the action type, extension state, and device info.\n * This allows external logic to decide whether the click should trigger an action immediately.\n * @optional\n */\n onClick?: (info: MultiActionButtonActionEvent) => void;\n /**\n * Status effect configuration for the action.\n * @description Controls optional visual emphasis like pulsing, without changing layout or sizing.\n * @optional\n */\n status?: MultiActionButtonActionStatus;\n};\n\nexport type MultiActionButtonSecondaryContextMenu = ContextMenuItem[];\n\n/**\n * Props for the MultiActionButton component.\n */\nexport type MultiActionButtonProps = {\n /**\n * Optional background color for both actions.\n * @description Overrides the default background color for the action buttons. This is useful\n * when the button is used on different backgrounds or when a specific brand color is needed.\n * If omitted, the primary color from the theme is used.\n * @default theme.primary\n * @optional\n */\n backgroundColor?: string;\n /**\n * Additional class name for the wrapper element.\n * @description Useful for custom styling or testing hooks.\n * @optional\n */\n className?: string;\n /**\n * Timeout in ms before the secondary action collapses after a click.\n * @description Set to 0 to keep the secondary action extended until the user collapses it.\n * @example\n * <MultiActionButton\n * primaryAction={primaryAction}\n * secondaryAction={secondaryAction}\n * extendedTimeoutMs={0}\n * />\n * @default 3000\n * @optional\n */\n extendedTimeoutMs?: number;\n /**\n * Height of the button.\n * @description Controls the height of the button. Use values from MultiActionButtonHeight enum or custom number.\n * @default MultiActionButtonHeight.Medium\n * @optional\n */\n height?: number;\n /**\n * Optional color for the 1px separator line between actions.\n * @description Defaults to theme.cw-body-background and falls back to #fff if not available.\n * @optional\n */\n gapColor?: string;\n /**\n * Whether the button is collapsed to a single icon.\n * @description When collapsed, only the primary icon is shown and the overall width shrinks to a circle.\n * Use this to provide compact states or toolbar modes.\n * @default false\n * @optional\n */\n isCollapsed?: boolean;\n /**\n * Whether the whole control is disabled.\n * @description Disables interactions for both actions, including hover expansion and clicks.\n * @default false\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Primary action configuration.\n * @description Required action shown on the left side (or as the only action when no secondary is provided).\n */\n primaryAction: MultiActionButtonAction;\n /**\n * Secondary action configuration.\n * @description Optional action shown on the right side. When present, it can expand on hover or click.\n * @optional\n */\n secondaryAction?: MultiActionButtonAction;\n /**\n * Context menu rendered as the secondary action.\n * @description When the list contains entries, the secondary slot renders a fixed down-arrow\n * trigger that opens a ContextMenu. If the list is empty or undefined, no context menu trigger\n * is shown and `secondaryAction` can be used as usual.\n * @optional\n */\n secondaryContextMenu?: MultiActionButtonSecondaryContextMenu;\n /**\n * Whether the button should take the full width of its parent.\n * @description When true, the control stretches to 100% width unless `width` is provided.\n * @optional\n */\n shouldUseFullWidth?: boolean;\n /**\n * Optional width override for the whole button.\n * @description Can be a fixed number or a MotionValue for external animations. When omitted,\n * the width is driven by the content unless `shouldUseFullWidth` is true.\n * @optional\n */\n width?: number | MotionValue<number>;\n};\n"],"mappings":"AAIA;AACA;AACA;AACA,WAAYA,2BAA2B,0BAA3BA,2BAA2B;EACnC;AACJ;AACA;AACA;AACA;EALYA,2BAA2B;EAAA,OAA3BA,2BAA2B;AAAA;;AASvC;AACA;AACA;AACA,WAAYC,uBAAuB,0BAAvBA,uBAAuB;EAC/B;AACJ;AACA;EAHYA,uBAAuB,CAAvBA,uBAAuB;EAK/B;AACJ;AACA;EAPYA,uBAAuB,CAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;;AAWnC;AACA;AACA;;AAiBA;AACA;AACA;;AA0BA;AACA;AACA;;AAyDA;AACA;AACA","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ export const getSecondaryContextMenuTriggerStyle = ({
2
+ height,
3
+ isCollapsed,
4
+ isExpanded,
5
+ shouldUseContentWidth
6
+ }) => {
7
+ if (isCollapsed) {
8
+ return {
9
+ display: 'inline-flex',
10
+ minWidth: 0,
11
+ opacity: 0,
12
+ pointerEvents: 'none',
13
+ width: 0
14
+ };
15
+ }
16
+ if (shouldUseContentWidth) {
17
+ return {
18
+ display: 'inline-flex',
19
+ flex: '0 1 auto',
20
+ minWidth: 0
21
+ };
22
+ }
23
+ if (isExpanded) {
24
+ return {
25
+ display: 'inline-flex',
26
+ flex: '1 1 auto',
27
+ minWidth: 0
28
+ };
29
+ }
30
+ return {
31
+ display: 'inline-flex',
32
+ flex: '0 0 auto',
33
+ minWidth: 0,
34
+ width: height
35
+ };
36
+ };
37
+ //# sourceMappingURL=MultiActionButton.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiActionButton.utils.js","names":["getSecondaryContextMenuTriggerStyle","height","isCollapsed","isExpanded","shouldUseContentWidth","display","minWidth","opacity","pointerEvents","width","flex"],"sources":["../../../../src/components/multi-action-button/MultiActionButton.utils.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nexport interface GetSecondaryContextMenuTriggerStyleOptions {\n height: number;\n isCollapsed: boolean;\n isExpanded: boolean;\n shouldUseContentWidth: boolean;\n}\n\nexport const getSecondaryContextMenuTriggerStyle = ({\n height,\n isCollapsed,\n isExpanded,\n shouldUseContentWidth,\n}: GetSecondaryContextMenuTriggerStyleOptions): CSSProperties => {\n if (isCollapsed) {\n return {\n display: 'inline-flex',\n minWidth: 0,\n opacity: 0,\n pointerEvents: 'none',\n width: 0,\n };\n }\n\n if (shouldUseContentWidth) {\n return {\n display: 'inline-flex',\n flex: '0 1 auto',\n minWidth: 0,\n };\n }\n\n if (isExpanded) {\n return {\n display: 'inline-flex',\n flex: '1 1 auto',\n minWidth: 0,\n };\n }\n\n return {\n display: 'inline-flex',\n flex: '0 0 auto',\n minWidth: 0,\n width: height,\n };\n};\n"],"mappings":"AASA,OAAO,MAAMA,mCAAmC,GAAGA,CAAC;EAChDC,MAAM;EACNC,WAAW;EACXC,UAAU;EACVC;AACwC,CAAC,KAAoB;EAC7D,IAAIF,WAAW,EAAE;IACb,OAAO;MACHG,OAAO,EAAE,aAAa;MACtBC,QAAQ,EAAE,CAAC;MACXC,OAAO,EAAE,CAAC;MACVC,aAAa,EAAE,MAAM;MACrBC,KAAK,EAAE;IACX,CAAC;EACL;EAEA,IAAIL,qBAAqB,EAAE;IACvB,OAAO;MACHC,OAAO,EAAE,aAAa;MACtBK,IAAI,EAAE,UAAU;MAChBJ,QAAQ,EAAE;IACd,CAAC;EACL;EAEA,IAAIH,UAAU,EAAE;IACZ,OAAO;MACHE,OAAO,EAAE,aAAa;MACtBK,IAAI,EAAE,UAAU;MAChBJ,QAAQ,EAAE;IACd,CAAC;EACL;EAEA,OAAO;IACHD,OAAO,EAAE,aAAa;IACtBK,IAAI,EAAE,UAAU;IAChBJ,QAAQ,EAAE,CAAC;IACXG,KAAK,EAAER;EACX,CAAC;AACL,CAAC","ignoreList":[]}
@@ -160,7 +160,7 @@ const Popup = /*#__PURE__*/forwardRef(({
160
160
  }, [isPopupOpen, updatePopupPosition]);
161
161
  useEffect(() => {
162
162
  if (!isPopupOpen) {
163
- return;
163
+ return undefined;
164
164
  }
165
165
  window.addEventListener('resize', handleReposition);
166
166
  window.addEventListener('scroll', handleReposition, true);
@@ -1 +1 @@
1
- {"version":3,"file":"Popup.js","names":["AnimatePresence","React","forwardRef","useCallback","useEffect","useImperativeHandle","useRef","useState","createPortal","useUuid","PopupAlignment","AreaContextProvider","PopupContentWrapper","StyledPopup","useMeasuredClone","Popup","alignment","content","onShow","container","onHide","children","isOpen","shouldHideOnChildrenLeave","shouldShowOnHover","shouldUseChildrenWidth","shouldScrollWithContent","shouldUseFullWidth","yOffset","shouldBeOpen","ref","coordinates","setCoordinates","x","y","internalAlignment","setInternalAlignment","TopLeft","offset","setOffset","isInternallyOpen","setIsInternallyOpen","portal","setPortal","pseudoSize","setPseudoSize","newContainer","setNewContainer","contentMaxHeight","setContentMaxHeight","undefined","timeout","previousIsVisibleRef","uuid","isControlled","isPopupOpen","height","width","measuredElement","shouldPreventTextWrapping","popupContentRef","popupRef","current","el","element","closest","Element","updatePopupPosition","HORIZONTAL_PADDING","pseudoHeight","pseudoWidth","childrenHeight","left","childrenLeft","top","childrenTop","childrenWidth","getBoundingClientRect","document","body","containerHeight","containerWidth","zoomX","offsetWidth","zoomY","offsetHeight","childrenCenterX","scrollLeft","scrollTop","boundaryLeft","boundaryWidth","relativeX","shouldShowBottom","BottomLeft","BottomRight","BottomCenter","shouldForceRight","TopRight","shouldUseCenterAlignment","TopCenter","hasEnoughSpaceForCenter","isRight","newOffset","right","newX","handleShow","handleReposition","window","addEventListener","removeEventListener","viewHeight","clientHeight","includes","handleChildrenClick","handleHide","handleMouseEnter","clearTimeout","handleMouseLeave","setTimeout","handleDocumentClick","event","contains","target","hide","show","createElement","initial","key","maxHeight","onMouseLeave","onMouseEnter","shouldChangeColor","Fragment","className","onClick","$shouldUseChildrenWidth","$shouldUseFullWidth","displayName"],"sources":["../../../../src/components/popup/Popup.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n forwardRef,\n ReactPortal,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { useUuid } from '../../hooks/uuid';\nimport { PopupAlignment, PopupCoordinates, PopupRef } from '../../types/popup';\nimport AreaContextProvider from '../area-provider/AreaContextProvider';\nimport PopupContentWrapper from './popup-content-wrapper/PopupContentWrapper';\nimport { StyledPopup } from './Popup.styles';\nimport { useMeasuredClone } from '../../hooks/element';\nimport type { PopupProps } from './Popup.types';\n\nexport type { PopupProps } from './Popup.types';\n\nconst Popup = forwardRef<PopupRef, PopupProps>(\n (\n {\n alignment,\n content,\n onShow,\n container,\n onHide,\n children,\n isOpen,\n shouldHideOnChildrenLeave,\n shouldShowOnHover = false,\n shouldUseChildrenWidth = true,\n shouldScrollWithContent = true,\n shouldUseFullWidth = false,\n yOffset = 0,\n shouldBeOpen = false,\n },\n ref,\n ) => {\n const [coordinates, setCoordinates] = useState<PopupCoordinates>({\n x: 0,\n y: 0,\n });\n\n const [internalAlignment, setInternalAlignment] = useState<PopupAlignment>(\n PopupAlignment.TopLeft,\n );\n const [offset, setOffset] = useState<number>(0);\n const [isInternallyOpen, setIsInternallyOpen] = useState(shouldBeOpen);\n const [portal, setPortal] = useState<ReactPortal>();\n const [pseudoSize, setPseudoSize] = useState<{ height: number; width: number }>();\n const [newContainer, setNewContainer] = useState<Element | null>(container ?? null);\n const [contentMaxHeight, setContentMaxHeight] = useState<number | undefined>(undefined);\n\n const timeout = useRef<number>();\n const previousIsVisibleRef = useRef(false);\n\n const uuid = useUuid();\n const isControlled = typeof isOpen === 'boolean';\n const isPopupOpen = isControlled ? isOpen : isInternallyOpen;\n\n const { height, width, measuredElement } = useMeasuredClone({\n content,\n shouldPreventTextWrapping: !shouldUseChildrenWidth,\n });\n\n const popupContentRef = useRef<HTMLDivElement>(null);\n const popupRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (popupRef.current && !container) {\n const el = popupRef.current as HTMLElement;\n\n const element = el.closest('.dialog-inner, .page-provider, .tapp, body');\n\n setNewContainer(element);\n }\n }, [container]);\n\n useEffect(() => {\n if (container instanceof Element) {\n setNewContainer(container);\n }\n }, [container]);\n\n useEffect(() => {\n setPseudoSize({ height, width });\n }, [height, width]);\n\n const updatePopupPosition = useCallback(() => {\n if (popupRef.current && pseudoSize) {\n if (!newContainer) {\n return;\n }\n\n const HORIZONTAL_PADDING = 23;\n\n const { height: pseudoHeight, width: pseudoWidth } = pseudoSize;\n\n const {\n height: childrenHeight,\n left: childrenLeft,\n top: childrenTop,\n width: childrenWidth,\n } = popupRef.current.getBoundingClientRect();\n\n const element = shouldScrollWithContent ? newContainer : document.body;\n\n const {\n height: containerHeight,\n width: containerWidth,\n top,\n left,\n } = element.getBoundingClientRect();\n\n const zoomX = containerWidth / (element as HTMLElement).offsetWidth;\n const zoomY = containerHeight / (element as HTMLElement).offsetHeight;\n\n const childrenCenterX = childrenLeft + childrenWidth / 2;\n const x = (childrenCenterX - left) / zoomX + element.scrollLeft;\n const y =\n (childrenTop + childrenHeight / 2 - top) / zoomY + element.scrollTop - yOffset;\n\n // Use one coordinate space for all horizontal bounds checks.\n const boundaryLeft = element.scrollLeft;\n const boundaryWidth = containerWidth / zoomX;\n const relativeX = x - boundaryLeft;\n\n const shouldShowBottom =\n pseudoHeight > childrenTop - 25 ||\n alignment === PopupAlignment.BottomLeft ||\n alignment === PopupAlignment.BottomRight ||\n alignment === PopupAlignment.BottomCenter;\n\n const shouldForceRight = shouldShowBottom\n ? alignment === PopupAlignment.BottomRight\n : alignment === PopupAlignment.TopRight;\n\n const shouldUseCenterAlignment = shouldShowBottom\n ? alignment === PopupAlignment.BottomCenter\n : alignment === PopupAlignment.TopCenter;\n\n const hasEnoughSpaceForCenter =\n pseudoWidth / 2 <= relativeX - HORIZONTAL_PADDING &&\n pseudoWidth / 2 <= boundaryWidth - relativeX - HORIZONTAL_PADDING;\n\n if (shouldUseCenterAlignment && hasEnoughSpaceForCenter) {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomCenter : PopupAlignment.TopCenter,\n );\n setOffset(0);\n setCoordinates({\n x,\n y,\n });\n } else {\n let isRight = false;\n\n if (pseudoWidth > relativeX - HORIZONTAL_PADDING || shouldForceRight) {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomRight : PopupAlignment.TopRight,\n );\n isRight = true;\n } else {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomLeft : PopupAlignment.TopLeft,\n );\n }\n\n let newOffset;\n\n if (isRight) {\n newOffset =\n relativeX + pseudoWidth >= boundaryWidth - HORIZONTAL_PADDING\n ? relativeX + pseudoWidth - (boundaryWidth - HORIZONTAL_PADDING)\n : 0;\n } else {\n const right = boundaryWidth - relativeX;\n\n newOffset =\n right + pseudoWidth >= boundaryWidth + HORIZONTAL_PADDING\n ? right + pseudoWidth - (boundaryWidth + HORIZONTAL_PADDING)\n : 0;\n }\n\n setOffset(newOffset);\n\n const newX = x - newOffset;\n\n setCoordinates({\n x: newX,\n y,\n });\n }\n }\n }, [alignment, newContainer, pseudoSize, shouldScrollWithContent, yOffset]);\n\n const handleShow = useCallback(() => {\n updatePopupPosition();\n\n if (isControlled) {\n return;\n }\n\n setIsInternallyOpen(true);\n }, [isControlled, updatePopupPosition]);\n\n useEffect(() => {\n if (isControlled) {\n if (isOpen) {\n updatePopupPosition();\n }\n\n return;\n }\n\n if (shouldBeOpen) {\n handleShow();\n }\n }, [handleShow, isControlled, isOpen, shouldBeOpen, updatePopupPosition]);\n\n const handleReposition = useCallback(() => {\n if (isPopupOpen) {\n updatePopupPosition();\n }\n }, [isPopupOpen, updatePopupPosition]);\n\n useEffect(() => {\n if (!isPopupOpen) {\n return;\n }\n\n window.addEventListener('resize', handleReposition);\n window.addEventListener('scroll', handleReposition, true);\n\n return () => {\n window.removeEventListener('resize', handleReposition);\n window.removeEventListener('scroll', handleReposition, true);\n };\n }, [handleReposition, isPopupOpen]);\n\n useEffect(() => {\n if (!newContainer || !popupRef.current) return;\n\n const viewHeight = newContainer.clientHeight;\n const childrenHeight = popupRef.current.getBoundingClientRect().height;\n\n if (\n [\n PopupAlignment.TopLeft,\n PopupAlignment.TopRight,\n PopupAlignment.TopCenter,\n ].includes(internalAlignment)\n ) {\n setContentMaxHeight(coordinates.y - 20);\n } else {\n setContentMaxHeight(viewHeight - childrenHeight - coordinates.y - 20);\n }\n }, [coordinates.y, internalAlignment, newContainer]);\n\n const handleChildrenClick = () => {\n if (isControlled) {\n return;\n }\n\n handleShow();\n };\n\n const handleHide = useCallback(() => {\n if (isControlled) {\n return;\n }\n\n setIsInternallyOpen(false);\n }, [isControlled]);\n\n const handleMouseEnter = useCallback(() => {\n if (isControlled) {\n return;\n }\n\n if (shouldShowOnHover) {\n window.clearTimeout(timeout.current);\n handleShow();\n }\n }, [handleShow, isControlled, shouldShowOnHover]);\n\n const handleMouseLeave = useCallback(() => {\n if (isControlled) {\n return;\n }\n\n if (!shouldShowOnHover) {\n return;\n }\n\n if (shouldHideOnChildrenLeave) {\n handleHide();\n\n return;\n }\n\n timeout.current = window.setTimeout(() => {\n handleHide();\n }, 500);\n }, [handleHide, isControlled, shouldHideOnChildrenLeave, shouldShowOnHover]);\n\n const handleDocumentClick = useCallback<EventListener>(\n (event) => {\n if (!popupContentRef.current?.contains(event.target as Node)) {\n handleHide();\n }\n },\n [handleHide],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow],\n );\n\n useEffect(() => {\n if (!isPopupOpen) {\n return undefined;\n }\n\n if (!isControlled && !shouldBeOpen) {\n document.addEventListener('click', handleDocumentClick, true);\n window.addEventListener('blur', handleHide);\n }\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n window.removeEventListener('blur', handleHide);\n };\n }, [handleDocumentClick, handleHide, isControlled, isPopupOpen, shouldBeOpen]);\n\n useEffect(() => {\n if (previousIsVisibleRef.current === isPopupOpen) {\n return;\n }\n\n previousIsVisibleRef.current = isPopupOpen;\n\n if (isPopupOpen) {\n onShow?.();\n\n return;\n }\n\n onHide?.();\n }, [isPopupOpen, onHide, onShow]);\n\n useEffect(() => {\n if (!newContainer) {\n return;\n }\n\n setPortal(() =>\n createPortal(\n <AnimatePresence initial={false}>\n {isPopupOpen && (\n <PopupContentWrapper\n width={pseudoSize?.width ?? 0}\n offset={offset}\n shouldScrollWithContent={shouldScrollWithContent}\n coordinates={coordinates}\n key={`tooltip_${uuid}`}\n maxHeight={contentMaxHeight}\n alignment={internalAlignment}\n ref={popupContentRef}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n >\n <AreaContextProvider shouldChangeColor>\n {content}\n </AreaContextProvider>\n </PopupContentWrapper>\n )}\n </AnimatePresence>,\n newContainer,\n ),\n );\n }, [\n contentMaxHeight,\n internalAlignment,\n newContainer,\n content,\n coordinates,\n handleMouseEnter,\n handleMouseLeave,\n isPopupOpen,\n offset,\n pseudoSize?.width,\n uuid,\n shouldScrollWithContent,\n ]);\n\n return (\n <>\n {measuredElement}\n <StyledPopup\n className=\"beta-chayns-popup\"\n ref={popupRef}\n onClick={handleChildrenClick}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledPopup>\n {portal}\n </>\n );\n },\n);\n\nPopup.displayName = 'Popup';\n\nexport default Popup;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IACRC,UAAU,EAEVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC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L,GAAG,EAAE8B,eAAgB;MACrBqE,YAAY,EAAEZ,gBAAiB;MAC/Ba,YAAY,EAAEf;IAAiB,gBAE/BlH,KAAA,CAAA4H,aAAA,CAAClH,mBAAmB;MAACwH,iBAAiB;IAAA,GACjClH,OACgB,CACJ,CAEZ,CAAC,EAClB6B,YACJ,CACJ,CAAC;EACL,CAAC,EAAE,CACCE,gBAAgB,EAChBb,iBAAiB,EACjBW,YAAY,EACZ7B,OAAO,EACPc,WAAW,EACXoF,gBAAgB,EAChBE,gBAAgB,EAChB9D,WAAW,EACXjB,MAAM,EACNM,UAAU,EAAEa,KAAK,EACjBJ,IAAI,EACJ3B,uBAAuB,CAC1B,CAAC;EAEF,oBACIzB,KAAA,CAAA4H,aAAA,CAAA5H,KAAA,CAAAmI,QAAA,QACK1E,eAAe,eAChBzD,KAAA,CAAA4H,aAAA,CAAChH,WAAW;IACRwH,SAAS,EAAC,mBAAmB;IAC7BvG,GAAG,EAAE+B,QAAS;IACdyE,OAAO,EAAErB,mBAAoB;IAC7BgB,YAAY,EAAEZ,gBAAiB;IAC/Ba,YAAY,EAAEf,gBAAiB;IAC/BoB,uBAAuB,EAAE9G,sBAAuB;IAChD+G,mBAAmB,EAAE7G;EAAmB,GAEvCN,QACQ,CAAC,EACbqB,MACH,CAAC;AAEX,CACJ,CAAC;AAED3B,KAAK,CAAC0H,WAAW,GAAG,OAAO;AAE3B,eAAe1H,KAAK","ignoreList":[]}
1
+ {"version":3,"file":"Popup.js","names":["AnimatePresence","React","forwardRef","useCallback","useEffect","useImperativeHandle","useRef","useState","createPortal","useUuid","PopupAlignment","AreaContextProvider","PopupContentWrapper","StyledPopup","useMeasuredClone","Popup","alignment","content","onShow","container","onHide","children","isOpen","shouldHideOnChildrenLeave","shouldShowOnHover","shouldUseChildrenWidth","shouldScrollWithContent","shouldUseFullWidth","yOffset","shouldBeOpen","ref","coordinates","setCoordinates","x","y","internalAlignment","setInternalAlignment","TopLeft","offset","setOffset","isInternallyOpen","setIsInternallyOpen","portal","setPortal","pseudoSize","setPseudoSize","newContainer","setNewContainer","contentMaxHeight","setContentMaxHeight","undefined","timeout","previousIsVisibleRef","uuid","isControlled","isPopupOpen","height","width","measuredElement","shouldPreventTextWrapping","popupContentRef","popupRef","current","el","element","closest","Element","updatePopupPosition","HORIZONTAL_PADDING","pseudoHeight","pseudoWidth","childrenHeight","left","childrenLeft","top","childrenTop","childrenWidth","getBoundingClientRect","document","body","containerHeight","containerWidth","zoomX","offsetWidth","zoomY","offsetHeight","childrenCenterX","scrollLeft","scrollTop","boundaryLeft","boundaryWidth","relativeX","shouldShowBottom","BottomLeft","BottomRight","BottomCenter","shouldForceRight","TopRight","shouldUseCenterAlignment","TopCenter","hasEnoughSpaceForCenter","isRight","newOffset","right","newX","handleShow","handleReposition","window","addEventListener","removeEventListener","viewHeight","clientHeight","includes","handleChildrenClick","handleHide","handleMouseEnter","clearTimeout","handleMouseLeave","setTimeout","handleDocumentClick","event","contains","target","hide","show","createElement","initial","key","maxHeight","onMouseLeave","onMouseEnter","shouldChangeColor","Fragment","className","onClick","$shouldUseChildrenWidth","$shouldUseFullWidth","displayName"],"sources":["../../../../src/components/popup/Popup.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n forwardRef,\n ReactPortal,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { useUuid } from '../../hooks/uuid';\nimport { PopupAlignment, PopupCoordinates, PopupRef } from '../../types/popup';\nimport AreaContextProvider from '../area-provider/AreaContextProvider';\nimport PopupContentWrapper from './popup-content-wrapper/PopupContentWrapper';\nimport { StyledPopup } from './Popup.styles';\nimport { useMeasuredClone } from '../../hooks/element';\nimport type { PopupProps } from './Popup.types';\n\nexport type { PopupProps } from './Popup.types';\n\nconst Popup = forwardRef<PopupRef, PopupProps>(\n (\n {\n alignment,\n content,\n onShow,\n container,\n onHide,\n children,\n isOpen,\n shouldHideOnChildrenLeave,\n shouldShowOnHover = false,\n shouldUseChildrenWidth = true,\n shouldScrollWithContent = true,\n shouldUseFullWidth = false,\n yOffset = 0,\n shouldBeOpen = false,\n },\n ref,\n ) => {\n const [coordinates, setCoordinates] = useState<PopupCoordinates>({\n x: 0,\n y: 0,\n });\n\n const [internalAlignment, setInternalAlignment] = useState<PopupAlignment>(\n PopupAlignment.TopLeft,\n );\n const [offset, setOffset] = useState<number>(0);\n const [isInternallyOpen, setIsInternallyOpen] = useState(shouldBeOpen);\n const [portal, setPortal] = useState<ReactPortal>();\n const [pseudoSize, setPseudoSize] = useState<{ height: number; width: number }>();\n const [newContainer, setNewContainer] = useState<Element | null>(container ?? null);\n const [contentMaxHeight, setContentMaxHeight] = useState<number | undefined>(undefined);\n\n const timeout = useRef<number>();\n const previousIsVisibleRef = useRef(false);\n\n const uuid = useUuid();\n const isControlled = typeof isOpen === 'boolean';\n const isPopupOpen = isControlled ? isOpen : isInternallyOpen;\n\n const { height, width, measuredElement } = useMeasuredClone({\n content,\n shouldPreventTextWrapping: !shouldUseChildrenWidth,\n });\n\n const popupContentRef = useRef<HTMLDivElement>(null);\n const popupRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (popupRef.current && !container) {\n const el = popupRef.current as HTMLElement;\n\n const element = el.closest('.dialog-inner, .page-provider, .tapp, body');\n\n setNewContainer(element);\n }\n }, [container]);\n\n useEffect(() => {\n if (container instanceof Element) {\n setNewContainer(container);\n }\n }, [container]);\n\n useEffect(() => {\n setPseudoSize({ height, width });\n }, [height, width]);\n\n const updatePopupPosition = useCallback(() => {\n if (popupRef.current && pseudoSize) {\n if (!newContainer) {\n return;\n }\n\n const HORIZONTAL_PADDING = 23;\n\n const { height: pseudoHeight, width: pseudoWidth } = pseudoSize;\n\n const {\n height: childrenHeight,\n left: childrenLeft,\n top: childrenTop,\n width: childrenWidth,\n } = popupRef.current.getBoundingClientRect();\n\n const element = shouldScrollWithContent ? newContainer : document.body;\n\n const {\n height: containerHeight,\n width: containerWidth,\n top,\n left,\n } = element.getBoundingClientRect();\n\n const zoomX = containerWidth / (element as HTMLElement).offsetWidth;\n const zoomY = containerHeight / (element as HTMLElement).offsetHeight;\n\n const childrenCenterX = childrenLeft + childrenWidth / 2;\n const x = (childrenCenterX - left) / zoomX + element.scrollLeft;\n const y =\n (childrenTop + childrenHeight / 2 - top) / zoomY + element.scrollTop - yOffset;\n\n // Use one coordinate space for all horizontal bounds checks.\n const boundaryLeft = element.scrollLeft;\n const boundaryWidth = containerWidth / zoomX;\n const relativeX = x - boundaryLeft;\n\n const shouldShowBottom =\n pseudoHeight > childrenTop - 25 ||\n alignment === PopupAlignment.BottomLeft ||\n alignment === PopupAlignment.BottomRight ||\n alignment === PopupAlignment.BottomCenter;\n\n const shouldForceRight = shouldShowBottom\n ? alignment === PopupAlignment.BottomRight\n : alignment === PopupAlignment.TopRight;\n\n const shouldUseCenterAlignment = shouldShowBottom\n ? alignment === PopupAlignment.BottomCenter\n : alignment === PopupAlignment.TopCenter;\n\n const hasEnoughSpaceForCenter =\n pseudoWidth / 2 <= relativeX - HORIZONTAL_PADDING &&\n pseudoWidth / 2 <= boundaryWidth - relativeX - HORIZONTAL_PADDING;\n\n if (shouldUseCenterAlignment && hasEnoughSpaceForCenter) {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomCenter : PopupAlignment.TopCenter,\n );\n setOffset(0);\n setCoordinates({\n x,\n y,\n });\n } else {\n let isRight = false;\n\n if (pseudoWidth > relativeX - HORIZONTAL_PADDING || shouldForceRight) {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomRight : PopupAlignment.TopRight,\n );\n isRight = true;\n } else {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomLeft : PopupAlignment.TopLeft,\n );\n }\n\n let newOffset;\n\n if (isRight) {\n newOffset =\n relativeX + pseudoWidth >= boundaryWidth - HORIZONTAL_PADDING\n ? relativeX + pseudoWidth - (boundaryWidth - HORIZONTAL_PADDING)\n : 0;\n } else {\n const right = boundaryWidth - relativeX;\n\n newOffset =\n right + pseudoWidth >= boundaryWidth + HORIZONTAL_PADDING\n ? right + pseudoWidth - (boundaryWidth + HORIZONTAL_PADDING)\n : 0;\n }\n\n setOffset(newOffset);\n\n const newX = x - newOffset;\n\n setCoordinates({\n x: newX,\n y,\n });\n }\n }\n }, [alignment, newContainer, pseudoSize, shouldScrollWithContent, yOffset]);\n\n const handleShow = useCallback(() => {\n updatePopupPosition();\n\n if (isControlled) {\n return;\n }\n\n setIsInternallyOpen(true);\n }, [isControlled, updatePopupPosition]);\n\n useEffect(() => {\n if (isControlled) {\n if (isOpen) {\n updatePopupPosition();\n }\n\n return;\n }\n\n if (shouldBeOpen) {\n handleShow();\n }\n }, [handleShow, isControlled, isOpen, shouldBeOpen, updatePopupPosition]);\n\n const handleReposition = useCallback(() => {\n if (isPopupOpen) {\n updatePopupPosition();\n }\n }, [isPopupOpen, updatePopupPosition]);\n\n useEffect(() => {\n if (!isPopupOpen) {\n return undefined;\n }\n\n window.addEventListener('resize', handleReposition);\n window.addEventListener('scroll', handleReposition, true);\n\n return () => {\n window.removeEventListener('resize', handleReposition);\n window.removeEventListener('scroll', handleReposition, true);\n };\n }, [handleReposition, isPopupOpen]);\n\n useEffect(() => {\n if (!newContainer || !popupRef.current) return;\n\n const viewHeight = newContainer.clientHeight;\n const childrenHeight = popupRef.current.getBoundingClientRect().height;\n\n if (\n [\n PopupAlignment.TopLeft,\n PopupAlignment.TopRight,\n PopupAlignment.TopCenter,\n ].includes(internalAlignment)\n ) {\n setContentMaxHeight(coordinates.y - 20);\n } else {\n setContentMaxHeight(viewHeight - childrenHeight - coordinates.y - 20);\n }\n }, [coordinates.y, internalAlignment, newContainer]);\n\n const handleChildrenClick = () => {\n if (isControlled) {\n return;\n }\n\n handleShow();\n };\n\n const handleHide = useCallback(() => {\n if (isControlled) {\n return;\n }\n\n setIsInternallyOpen(false);\n }, [isControlled]);\n\n const handleMouseEnter = useCallback(() => {\n if (isControlled) {\n return;\n }\n\n if (shouldShowOnHover) {\n window.clearTimeout(timeout.current);\n handleShow();\n }\n }, [handleShow, isControlled, shouldShowOnHover]);\n\n const handleMouseLeave = useCallback(() => {\n if (isControlled) {\n return;\n }\n\n if (!shouldShowOnHover) {\n return;\n }\n\n if (shouldHideOnChildrenLeave) {\n handleHide();\n\n return;\n }\n\n timeout.current = window.setTimeout(() => {\n handleHide();\n }, 500);\n }, [handleHide, isControlled, shouldHideOnChildrenLeave, shouldShowOnHover]);\n\n const handleDocumentClick = useCallback<EventListener>(\n (event) => {\n if (!popupContentRef.current?.contains(event.target as Node)) {\n handleHide();\n }\n },\n [handleHide],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow],\n );\n\n useEffect(() => {\n if (!isPopupOpen) {\n return undefined;\n }\n\n if (!isControlled && !shouldBeOpen) {\n document.addEventListener('click', handleDocumentClick, true);\n window.addEventListener('blur', handleHide);\n }\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n window.removeEventListener('blur', handleHide);\n };\n }, [handleDocumentClick, handleHide, isControlled, isPopupOpen, shouldBeOpen]);\n\n useEffect(() => {\n if (previousIsVisibleRef.current === isPopupOpen) {\n return;\n }\n\n previousIsVisibleRef.current = isPopupOpen;\n\n if (isPopupOpen) {\n onShow?.();\n\n return;\n }\n\n onHide?.();\n }, [isPopupOpen, onHide, onShow]);\n\n useEffect(() => {\n if (!newContainer) {\n return;\n }\n\n setPortal(() =>\n createPortal(\n <AnimatePresence initial={false}>\n {isPopupOpen && (\n <PopupContentWrapper\n width={pseudoSize?.width ?? 0}\n offset={offset}\n shouldScrollWithContent={shouldScrollWithContent}\n coordinates={coordinates}\n key={`tooltip_${uuid}`}\n maxHeight={contentMaxHeight}\n alignment={internalAlignment}\n ref={popupContentRef}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n >\n <AreaContextProvider shouldChangeColor>\n {content}\n </AreaContextProvider>\n </PopupContentWrapper>\n )}\n </AnimatePresence>,\n newContainer,\n ),\n );\n }, [\n contentMaxHeight,\n internalAlignment,\n newContainer,\n content,\n coordinates,\n handleMouseEnter,\n handleMouseLeave,\n isPopupOpen,\n offset,\n pseudoSize?.width,\n uuid,\n shouldScrollWithContent,\n ]);\n\n return (\n <>\n {measuredElement}\n <StyledPopup\n className=\"beta-chayns-popup\"\n ref={popupRef}\n onClick={handleChildrenClick}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledPopup>\n {portal}\n </>\n );\n },\n);\n\nPopup.displayName = 'Popup';\n\nexport default Popup;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IACRC,UAAU,EAEVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SAASC,cAAc,QAAoC,mBAAmB;AAC9E,OAAOC,mBAAmB,MAAM,sCAAsC;AACtE,OAAOC,mBAAmB,MAAM,6CAA6C;AAC7E,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,gBAAgB,QAAQ,qBAAqB;AAKtD,MAAMC,KAAK,gBAAGb,UAAU,CACpB,CACI;EACIc,SAAS;EACTC,OAAO;EACPC,MAAM;EACNC,SAAS;EACTC,MAAM;EACNC,QAAQ;EACRC,MAAM;EACNC,yBAAyB;EACzBC,iBAAiB,GAAG,KAAK;EACzBC,sBAAsB,GAAG,IAAI;EAC7BC,uBAAuB,GAAG,IAAI;EAC9BC,kBAAkB,GAAG,KAAK;EAC1BC,OAAO,GAAG,CAAC;EACXC,YAAY,GAAG;AACnB,CAAC,EACDC,GAAG,KACF;EACD,MAAM,CAACC,WAAW,EAAEC,cAAc,CAA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IAC7BgB,YAAY,EAAEZ,gBAAiB;IAC/Ba,YAAY,EAAEf,gBAAiB;IAC/BoB,uBAAuB,EAAE9G,sBAAuB;IAChD+G,mBAAmB,EAAE7G;EAAmB,GAEvCN,QACQ,CAAC,EACbqB,MACH,CAAC;AAEX,CACJ,CAAC;AAED3B,KAAK,CAAC0H,WAAW,GAAG,OAAO;AAE3B,eAAe1H,KAAK","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBar.js","names":["React","useContext","useEffect","useLayoutEffect","useMemo","useRef","useState","useUuid","StyledMotionProgressBarProgress","StyledProgressBar","StyledProgressBarBackground","StyledProgressBarLabel","StyledProgressBarProgressWrapper","StyledProgressBarShine","StyledProgressBarStep","StyledProgressBarStepWrapper","StyledProgressBarThumbLabel","PopupAlignment","ThemeContext","ThemeProvider","Popup","ProgressBar","t0","$","_c","percentage","label","shouldHideProgress","t1","shouldShowLabelInline","t2","steps","colors","thumbLabel","showShine","t3","height","undefined","uuid","coordinates","setCoordinates","popupRef","hostContainer","setHostContainer","theme","t4","bb0","t","shineCount","Math","ceil","speed","t5","Array","from","length","t6","map","_","index","createElement","key","$delay","shineEffect","getBoundingClientRect","t7","t8","current","show","t9","backgroundColor","primaryTextColor","progressColor","secondaryTextColor","stepColor","thumbLabelColor","$color","initial","width","left","animate","exit","transition","type","repeat","Infinity","repeatDelay","duration","ref","instance","style","border","position","step","onUpdate","onAnimationComplete","onClick","_temp","text","alignment","TopCenter","onHide","container","shouldBeOpen","shouldScrollWithContent","yOffset","$primaryColor","$secondaryColor","progressBar","t10","t11","displayName","event","stopPropagation"],"sources":["../../../../src/components/progress-bar/ProgressBar.tsx"],"sourcesContent":["import React, {\n FC,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useUuid } from '../../hooks/uuid';\nimport {\n StyledMotionProgressBarProgress,\n StyledProgressBar,\n StyledProgressBarBackground,\n StyledProgressBarLabel,\n StyledProgressBarProgressWrapper,\n StyledProgressBarShine,\n StyledProgressBarStep,\n StyledProgressBarStepWrapper,\n StyledProgressBarThumbLabel,\n} from './ProgressBar.styles';\nimport { PopupAlignment, PopupRef } from '../../types/popup';\nimport { ThemeContext, ThemeProvider } from 'styled-components';\nimport { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Popup from '../popup/Popup';\n\ntype Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N\n ? Acc[number]\n : Enumerate<N, [...Acc, Acc['length']]>;\n\ntype Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;\n\ninterface Colors {\n backgroundColor?: string;\n progressColor?: string;\n stepColor?: string;\n primaryTextColor?: string;\n secondaryTextColor?: string;\n thumbLabelColor?: string;\n}\n\nexport type ProgressBarProps = {\n /**\n * The colors of the ProgressBar.\n */\n colors?: Colors;\n /**\n * The label that should be displayed under the progressbar.\n */\n label?: string;\n /**\n * The percentage of the progress. Number between 0 and 100.\n */\n percentage?: Range<0, 101>;\n /**\n * Whether the progress should be hide and just display the label.\n */\n shouldHideProgress?: boolean;\n /**\n * Whether the label should be displayed inside the ProgressBar.\n */\n shouldShowLabelInline?: boolean;\n /**\n * Visual marked steps.\n */\n steps?: Range<0, 101>[];\n /**\n * The label that should be displayed on the thumb of the progress bar.\n */\n thumbLabel?: React.ReactNode;\n /**\n * Whether a shine animation should be shown on the progress bar. The amount of shine is based on the percentage value.\n */\n showShine?: boolean;\n /**\n * The height of the progress bar in pixels. If not provided, it will be 10px if shouldShowLabelInline is false and 20px if shouldShowLabelInline is true.\n */\n height?: number;\n};\n\nconst ProgressBar: FC<ProgressBarProps> = ({\n percentage,\n label,\n shouldHideProgress = false,\n shouldShowLabelInline = false,\n steps,\n colors,\n thumbLabel,\n showShine = false,\n height,\n}) => {\n 'use memo';\n\n const uuid = useUuid();\n const [coordinates, setCoordinates] = useState<{ x: number; y: number }>();\n const popupRef = useRef<PopupRef | null>(null);\n const [hostContainer, setHostContainer] = useState<HTMLDivElement | null>(null);\n\n const theme = useContext(ThemeContext) as Theme | undefined;\n\n const shineEffect = useMemo(() => {\n if (!showShine || percentage === undefined) return null;\n const MIN_ANIMATION_LENGTH = 1;\n const MAX_ANIMATION_LENGTH = 5;\n const MAX_SHINE_COUNT = 6;\n const t = percentage / 100;\n\n const shineCount = Math.ceil(MAX_SHINE_COUNT * t);\n\n const speed = MIN_ANIMATION_LENGTH + (MAX_ANIMATION_LENGTH - MIN_ANIMATION_LENGTH) * t;\n\n return Array.from({ length: shineCount }).map((_, index) => (\n <StyledProgressBarShine\n /* eslint-disable-next-line react/no-array-index-key */\n key={`progress-bar-shine__${shineCount}__${index}`}\n $speed={speed}\n $delay={-(speed / shineCount) * index}\n />\n ));\n }, [percentage, showShine]);\n\n useLayoutEffect(() => {\n if (thumbLabel) setCoordinates(hostContainer?.getBoundingClientRect());\n }, [hostContainer, thumbLabel]);\n\n useEffect(() => {\n if (coordinates) popupRef.current?.show();\n }, [coordinates]);\n\n const progressBar = useMemo(() => {\n if (shouldHideProgress) {\n return null;\n }\n\n if (percentage === undefined) {\n return (\n <StyledProgressBarProgressWrapper>\n <StyledMotionProgressBarProgress\n key={`progress-bar-loop__${uuid}`}\n $color={colors?.progressColor}\n initial={{ width: '200px', left: '-200px' }}\n animate={{ width: '200px', left: '100%' }}\n exit={{ width: '200px', left: '100%' }}\n transition={{\n type: 'tween',\n repeat: Infinity,\n repeatDelay: 0,\n duration: 1,\n }}\n />\n <StyledProgressBarBackground $color={colors?.backgroundColor} />\n </StyledProgressBarProgressWrapper>\n );\n }\n\n return (\n <div\n ref={(instance) => setHostContainer(instance)}\n style={{ border: 0, position: 'relative' }}\n >\n <StyledProgressBarProgressWrapper $isBig={shouldShowLabelInline} $height={height}>\n {!!steps?.length && (\n <StyledProgressBarStepWrapper>\n {steps.map((step) => (\n <StyledProgressBarStep\n $position={step}\n key={`progress-step-${step}`}\n $color={colors?.stepColor}\n />\n ))}\n </StyledProgressBarStepWrapper>\n )}\n <StyledMotionProgressBarProgress\n $height={height}\n $color={colors?.progressColor}\n key={`progress-bar__${uuid}`}\n initial={{ width: '0%' }}\n animate={{ width: `${percentage}%` }}\n exit={{ width: '0%' }}\n transition={{ type: 'tween' }}\n onUpdate={() => popupRef.current?.show()}\n onAnimationComplete={() => popupRef.current?.show()}\n >\n {showShine && shineEffect}\n {thumbLabel && (\n <StyledProgressBarThumbLabel\n $height={height}\n onClick={(event) => event.stopPropagation()}\n >\n <ThemeProvider\n theme={{\n '000': colors?.thumbLabelColor ?? theme?.['104'],\n text: colors?.secondaryTextColor ?? theme?.['300'],\n }}\n >\n <Popup\n ref={popupRef}\n content={thumbLabel}\n alignment={PopupAlignment.TopCenter}\n onHide={() => popupRef.current?.show()}\n container={hostContainer ?? undefined}\n shouldBeOpen\n shouldScrollWithContent\n yOffset={-12}\n >\n {}\n </Popup>\n </ThemeProvider>\n </StyledProgressBarThumbLabel>\n )}\n </StyledMotionProgressBarProgress>\n\n {shouldShowLabelInline && label && (\n <StyledProgressBarLabel\n $shouldShowLabelInline={shouldShowLabelInline}\n $primaryColor={colors?.primaryTextColor}\n $secondaryColor={colors?.secondaryTextColor}\n $colorSplitPosition={percentage}\n >\n {label}\n </StyledProgressBarLabel>\n )}\n\n <StyledProgressBarBackground $color={colors?.backgroundColor} />\n </StyledProgressBarProgressWrapper>\n </div>\n );\n }, [\n colors?.backgroundColor,\n colors?.primaryTextColor,\n colors?.progressColor,\n colors?.secondaryTextColor,\n colors?.stepColor,\n colors?.thumbLabelColor,\n height,\n hostContainer,\n label,\n percentage,\n shineEffect,\n shouldHideProgress,\n shouldShowLabelInline,\n showShine,\n steps,\n theme,\n thumbLabel,\n uuid,\n ]);\n\n return useMemo(\n () => (\n <StyledProgressBar>\n {progressBar}\n {label && !shouldShowLabelInline && (\n <StyledProgressBarLabel $primaryColor={colors?.primaryTextColor}>\n {label}\n </StyledProgressBarLabel>\n )}\n </StyledProgressBar>\n ),\n [colors?.primaryTextColor, label, progressBar, shouldShowLab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AAC;IAAAtF,CAAA,OAAAqF,WAAA;IAAArF,CAAA,OAAAsF,GAAA;IAAAtF,CAAA,OAAAuF,GAAA;EAAA;IAAAA,GAAA,GAAAvF,CAAA;EAAA;EAAA,OAPpBuF,GAOoB;AAAA,CAI/B;AAEDzF,WAAW,CAAC0F,WAAW,GAAG,aAAa;AAEvC,eAAe1F,WAAW;AAzLgB,SAAA4E,MAAAe,KAAA;EAAA,OA2GUA,KAAK,CAAAC,eAAgB,CAAC,CAAC;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"ProgressBar.js","names":["React","useContext","useEffect","useLayoutEffect","useMemo","useRef","useState","useUuid","StyledMotionProgressBarProgress","StyledProgressBar","StyledProgressBarBackground","StyledProgressBarLabel","StyledProgressBarProgressWrapper","StyledProgressBarShine","StyledProgressBarStep","StyledProgressBarStepWrapper","StyledProgressBarThumbLabel","PopupAlignment","ThemeContext","ThemeProvider","Popup","ProgressBar","t0","$","_c","percentage","label","shouldHideProgress","t1","shouldShowLabelInline","t2","steps","colors","thumbLabel","showShine","t3","height","undefined","uuid","coordinates","setCoordinates","popupRef","hostContainer","setHostContainer","theme","t4","bb0","t","shineCount","Math","ceil","speed","t5","Array","from","length","t6","map","_","index","createElement","key","$delay","shineEffect","getBoundingClientRect","t7","t8","current","show","t9","backgroundColor","primaryTextColor","progressColor","secondaryTextColor","stepColor","thumbLabelColor","$color","initial","width","left","animate","exit","transition","type","repeat","Infinity","repeatDelay","duration","ref","instance","style","border","position","step","onUpdate","onAnimationComplete","onClick","_temp","text","alignment","TopCenter","onHide","container","shouldBeOpen","shouldScrollWithContent","yOffset","$primaryColor","$secondaryColor","progressBar","t10","t11","displayName","event","stopPropagation"],"sources":["../../../../src/components/progress-bar/ProgressBar.tsx"],"sourcesContent":["import React, {\n FC,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useUuid } from '../../hooks/uuid';\nimport {\n StyledMotionProgressBarProgress,\n StyledProgressBar,\n StyledProgressBarBackground,\n StyledProgressBarLabel,\n StyledProgressBarProgressWrapper,\n StyledProgressBarShine,\n StyledProgressBarStep,\n StyledProgressBarStepWrapper,\n StyledProgressBarThumbLabel,\n} from './ProgressBar.styles';\nimport { PopupAlignment, PopupRef } from '../../types/popup';\nimport { ThemeContext, ThemeProvider } from 'styled-components';\nimport { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Popup from '../popup/Popup';\n\ntype Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N\n ? Acc[number]\n : Enumerate<N, [...Acc, Acc['length']]>;\n\ntype Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;\n\ninterface Colors {\n backgroundColor?: string;\n progressColor?: string;\n stepColor?: string;\n primaryTextColor?: string;\n secondaryTextColor?: string;\n thumbLabelColor?: string;\n}\n\nexport type ProgressBarProps = {\n /**\n * The colors of the ProgressBar.\n */\n colors?: Colors;\n /**\n * The label that should be displayed under the progressbar.\n */\n label?: string;\n /**\n * The percentage of the progress. Number between 0 and 100.\n */\n percentage?: Range<0, 101>;\n /**\n * Whether the progress should be hide and just display the label.\n */\n shouldHideProgress?: boolean;\n /**\n * Whether the label should be displayed inside the ProgressBar.\n */\n shouldShowLabelInline?: boolean;\n /**\n * Visual marked steps.\n */\n steps?: Range<0, 101>[];\n /**\n * The label that should be displayed on the thumb of the progress bar.\n */\n thumbLabel?: React.ReactNode;\n /**\n * Whether a shine animation should be shown on the progress bar. The amount of shine is based on the percentage value.\n */\n showShine?: boolean;\n /**\n * The height of the progress bar in pixels. If not provided, it will be 10px if shouldShowLabelInline is false and 20px if shouldShowLabelInline is true.\n */\n height?: number;\n};\n\nconst ProgressBar: FC<ProgressBarProps> = ({\n percentage,\n label,\n shouldHideProgress = false,\n shouldShowLabelInline = false,\n steps,\n colors,\n thumbLabel,\n showShine = false,\n height,\n}) => {\n 'use memo';\n\n const uuid = useUuid();\n const [coordinates, setCoordinates] = useState<{ x: number; y: number }>();\n const popupRef = useRef<PopupRef | null>(null);\n const [hostContainer, setHostContainer] = useState<HTMLDivElement | null>(null);\n\n const theme = useContext(ThemeContext) as Theme | undefined;\n\n const shineEffect = useMemo(() => {\n if (!showShine || percentage === undefined) return null;\n const MIN_ANIMATION_LENGTH = 1;\n const MAX_ANIMATION_LENGTH = 5;\n const MAX_SHINE_COUNT = 6;\n const t = percentage / 100;\n\n const shineCount = Math.ceil(MAX_SHINE_COUNT * t);\n\n const speed = MIN_ANIMATION_LENGTH + (MAX_ANIMATION_LENGTH - MIN_ANIMATION_LENGTH) * t;\n\n return Array.from({ length: shineCount }).map((_, index) => (\n <StyledProgressBarShine\n /* eslint-disable-next-line react/no-array-index-key */\n key={`progress-bar-shine__${shineCount}__${index}`}\n $speed={speed}\n $delay={-(speed / shineCount) * index}\n />\n ));\n }, [percentage, showShine]);\n\n useLayoutEffect(() => {\n if (thumbLabel) setCoordinates(hostContainer?.getBoundingClientRect());\n }, [hostContainer, thumbLabel]);\n\n useEffect(() => {\n if (coordinates) popupRef.current?.show();\n }, [coordinates]);\n\n const progressBar = useMemo(() => {\n if (shouldHideProgress) {\n return null;\n }\n\n if (percentage === undefined) {\n return (\n <StyledProgressBarProgressWrapper>\n <StyledMotionProgressBarProgress\n key={`progress-bar-loop__${uuid}`}\n $color={colors?.progressColor}\n initial={{ width: '200px', left: '-200px' }}\n animate={{ width: '200px', left: '100%' }}\n exit={{ width: '200px', left: '100%' }}\n transition={{\n type: 'tween',\n repeat: Infinity,\n repeatDelay: 0,\n duration: 1,\n }}\n />\n <StyledProgressBarBackground $color={colors?.backgroundColor} />\n </StyledProgressBarProgressWrapper>\n );\n }\n\n return (\n <div\n ref={(instance) => setHostContainer(instance)}\n style={{ border: 0, position: 'relative' }}\n >\n <StyledProgressBarProgressWrapper $isBig={shouldShowLabelInline} $height={height}>\n {!!steps?.length && (\n <StyledProgressBarStepWrapper>\n {steps.map((step) => (\n <StyledProgressBarStep\n $position={step}\n key={`progress-step-${step}`}\n $color={colors?.stepColor}\n />\n ))}\n </StyledProgressBarStepWrapper>\n )}\n <StyledMotionProgressBarProgress\n $height={height}\n $color={colors?.progressColor}\n key={`progress-bar__${uuid}`}\n initial={{ width: '0%' }}\n animate={{ width: `${percentage}%` }}\n exit={{ width: '0%' }}\n transition={{ type: 'tween' }}\n onUpdate={() => popupRef.current?.show()}\n onAnimationComplete={() => popupRef.current?.show()}\n >\n {showShine && shineEffect}\n {thumbLabel && (\n <StyledProgressBarThumbLabel\n $height={height}\n onClick={(event) => event.stopPropagation()}\n >\n <ThemeProvider\n theme={{\n '000': colors?.thumbLabelColor ?? theme?.['104'],\n text: colors?.secondaryTextColor ?? theme?.['300'],\n }}\n >\n <Popup\n ref={popupRef}\n content={thumbLabel}\n alignment={PopupAlignment.TopCenter}\n onHide={() => popupRef.current?.show()}\n container={hostContainer ?? undefined}\n shouldBeOpen\n shouldScrollWithContent\n yOffset={-12}\n />\n </ThemeProvider>\n </StyledProgressBarThumbLabel>\n )}\n </StyledMotionProgressBarProgress>\n\n {shouldShowLabelInline && label && (\n <StyledProgressBarLabel\n $shouldShowLabelInline={shouldShowLabelInline}\n $primaryColor={colors?.primaryTextColor}\n $secondaryColor={colors?.secondaryTextColor}\n $colorSplitPosition={percentage}\n >\n {label}\n </StyledProgressBarLabel>\n )}\n\n <StyledProgressBarBackground $color={colors?.backgroundColor} />\n </StyledProgressBarProgressWrapper>\n </div>\n );\n }, [\n colors?.backgroundColor,\n colors?.primaryTextColor,\n colors?.progressColor,\n colors?.secondaryTextColor,\n colors?.stepColor,\n colors?.thumbLabelColor,\n height,\n hostContainer,\n label,\n percentage,\n shineEffect,\n shouldHideProgress,\n shouldShowLabelInline,\n showShine,\n steps,\n theme,\n thumbLabel,\n uuid,\n ]);\n\n return useMemo(\n () => (\n <StyledProgressBar>\n {progressBar}\n {label && !shouldShowLabelInline && (\n <StyledProgressBarLabel $primaryColor={colors?.primaryTextColor}>\n {label}\n </StyledProgressBarLabel>\n )}\n </StyledProgressBar>\n ),\n [colors?.primaryTextColor, label, progressBar, shouldShowLabelInline],\n );\n};\n\nProgressBar.displayName = 'ProgressBar';\n\nexport default ProgressBar;\n"],"mappings":";AAAA,OAAOA,KAAK,IAERC,UAAU,EACVC,SAAS,EACTC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SACIC,+BAA+B,EAC/BC,iBAAiB,EACjBC,2BAA2B,EAC3BC,sBAAsB,EACtBC,gCAAgC,EAChCC,sBAAsB,EACtBC,qBAAqB,EACrBC,4BAA4B,EAC5BC,2BAA2B,QACxB,sBAAsB;AAC7B,SAASC,cAAc,QAAkB,mBAAmB;AAC5D,SAASC,YAAY,EAAEC,aAAa,QAAQ,mBAAmB;AAE/D,OAAOC,KAAK,MAAM,gBAAgB;AAwDlC,MAAMC,WAAiC,GAAGC,EAAA;EAAA;;EAAA,MAAAC,CAAA,GAAAC,EAAA;EAAC;IAAAC,UAAA;IAAAC,KAAA;IAAAC,kBAAA,EAAAC,EAAA;IAAAC,qBAAA,EAAAC,EAAA;IAAAC,KAAA;IAAAC,MAAA;IAAAC,UAAA;IAAAC,SAAA,EAAAC,EAAA;IAAAC;EAAA,IAAAd,EAU1C;EAPG,MAAAK,kBAAA,GAAAC,EAA0B,KAA1BS,SAA0B,GAA1B,KAA0B,GAA1BT,EAA0B;EAC1B,MAAAC,qBAAA,GAAAC,EAA6B,KAA7BO,SAA6B,GAA7B,KAA6B,GAA7BP,EAA6B;EAI7B,MAAAI,SAAA,GAAAC,EAAiB,KAAjBE,SAAiB,GAAjB,KAAiB,GAAjBF,EAAiB;EAKjB,MAAAG,IAAA,GAAa/B,OAAO,CAAC,CAAC;EACtB,OAAAgC,WAAA,EAAAC,cAAA,IAAsClC,QAAQ,CAA2B,CAAC;EAC1E,MAAAmC,QAAA,GAAiBpC,MAAM,CAAkB,IAAI,CAAC;EAC9C,OAAAqC,aAAA,EAAAC,gBAAA,IAA0C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,iBAAiB,QACbmG,WAAW,EACXC,GAKc,CAAC;IAAAtF,CAAA,OAAAqF,WAAA;IAAArF,CAAA,OAAAsF,GAAA;IAAAtF,CAAA,OAAAuF,GAAA;EAAA;IAAAA,GAAA,GAAAvF,CAAA;EAAA;EAAA,OAPpBuF,GAOoB;AAAA,CAI/B;AAEDzF,WAAW,CAAC0F,WAAW,GAAG,aAAa;AAEvC,eAAe1F,WAAW;AAvLgB,SAAA4E,MAAAe,KAAA;EAAA,OA2GUA,KAAK,CAAAC,eAAgB,CAAC,CAAC;AAAA","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 toSliderThumbContentPosition,\n toSliderThumbPosition,\n toValue,\n ],\n );\n};\n\nSlider.displayName = 'Slider';\n\nexport default Slider;\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,YAAY;AACpD,OA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AE,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;EAChD,MAAM,CAACgC,WAAW,EAAEC,cAAc,CAAC,GAAGjC,QAAQ,CAAC,KAAK,CAAC;EAErD,MAAMkC,oBAAoB,GAAGnC,MAAM,CAAC2B,SA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