etudes 2.4.0 → 2.6.0

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 (89) hide show
  1. package/lib/Accordion.d.ts +2 -2
  2. package/lib/Accordion.js.map +1 -1
  3. package/lib/BurgerButton.d.ts +2 -2
  4. package/lib/BurgerButton.js +1 -1
  5. package/lib/BurgerButton.js.map +1 -1
  6. package/lib/Conditional.d.ts +1 -1
  7. package/lib/Conditional.js.map +1 -1
  8. package/lib/DebugConsole.d.ts +1 -1
  9. package/lib/DebugConsole.js.map +1 -1
  10. package/lib/Dial.d.ts +1 -1
  11. package/lib/Dial.js.map +1 -1
  12. package/lib/Dropdown.d.ts +2 -2
  13. package/lib/Dropdown.js +1 -1
  14. package/lib/Dropdown.js.map +1 -1
  15. package/lib/Each.d.ts +1 -1
  16. package/lib/Each.js.map +1 -1
  17. package/lib/ExtractChild.d.ts +1 -1
  18. package/lib/ExtractChild.js.map +1 -1
  19. package/lib/ExtractChildren.d.ts +1 -1
  20. package/lib/ExtractChildren.js.map +1 -1
  21. package/lib/FlatSVG.d.ts +1 -1
  22. package/lib/FlatSVG.js +51 -72
  23. package/lib/FlatSVG.js.map +1 -1
  24. package/lib/List.d.ts +1 -1
  25. package/lib/List.js.map +1 -1
  26. package/lib/MasonryGrid.d.ts +1 -1
  27. package/lib/MasonryGrid.js +10 -10
  28. package/lib/MasonryGrid.js.map +1 -1
  29. package/lib/Panorama.d.ts +15 -15
  30. package/lib/Panorama.js.map +1 -1
  31. package/lib/PanoramaSlider.d.ts +8 -8
  32. package/lib/PanoramaSlider.js +6 -6
  33. package/lib/PanoramaSlider.js.map +1 -1
  34. package/lib/RangeSlider.d.ts +1 -1
  35. package/lib/RangeSlider.js.map +1 -1
  36. package/lib/Repeat.d.ts +1 -1
  37. package/lib/Repeat.js.map +1 -1
  38. package/lib/RotatingGallery.d.ts +5 -5
  39. package/lib/RotatingGallery.js +2 -2
  40. package/lib/RotatingGallery.js.map +1 -1
  41. package/lib/SelectableButton.d.ts +1 -1
  42. package/lib/SelectableButton.js.map +1 -1
  43. package/lib/Slider.d.ts +11 -11
  44. package/lib/Slider.js +4 -4
  45. package/lib/Slider.js.map +1 -1
  46. package/lib/StepwiseSlider.d.ts +18 -18
  47. package/lib/StepwiseSlider.js +9 -9
  48. package/lib/StepwiseSlider.js.map +1 -1
  49. package/lib/SwipeContainer.d.ts +1 -1
  50. package/lib/SwipeContainer.js.map +1 -1
  51. package/lib/TextField.d.ts +1 -1
  52. package/lib/TextField.js.map +1 -1
  53. package/lib/Video.d.ts +1 -1
  54. package/lib/Video.js.map +1 -1
  55. package/lib/WithTooltip.d.ts +1 -1
  56. package/lib/WithTooltip.js +2 -1
  57. package/lib/WithTooltip.js.map +1 -1
  58. package/lib/hooks/useDragEffect.d.ts +15 -15
  59. package/lib/hooks/useDragEffect.js +6 -6
  60. package/lib/hooks/useDragEffect.js.map +1 -1
  61. package/lib/hooks/useElementRect.d.ts +2 -2
  62. package/lib/hooks/useElementRect.js +1 -1
  63. package/lib/hooks/useElementRect.js.map +1 -1
  64. package/lib/hooks/useInterval.d.ts +5 -5
  65. package/lib/hooks/useInterval.js +4 -4
  66. package/lib/hooks/useInterval.js.map +1 -1
  67. package/lib/hooks/useLoadImageEffect.d.ts +6 -6
  68. package/lib/hooks/useLoadImageEffect.js +3 -3
  69. package/lib/hooks/useLoadImageEffect.js.map +1 -1
  70. package/lib/hooks/usePrevious.d.ts +1 -1
  71. package/lib/hooks/usePrevious.js +1 -1
  72. package/lib/hooks/usePrevious.js.map +1 -1
  73. package/lib/hooks/useResizeEffect.d.ts +5 -5
  74. package/lib/hooks/useResizeEffect.js +3 -3
  75. package/lib/hooks/useResizeEffect.js.map +1 -1
  76. package/lib/hooks/useSearchParamState.d.ts +7 -7
  77. package/lib/hooks/useSearchParamState.js +3 -3
  78. package/lib/hooks/useSearchParamState.js.map +1 -1
  79. package/lib/providers/ScrollPositionProvider.d.ts +1 -1
  80. package/lib/providers/ScrollPositionProvider.js.map +1 -1
  81. package/lib/utils/asComponentDict.d.ts +1 -1
  82. package/lib/utils/asComponentDict.js.map +1 -1
  83. package/lib/utils/asStyleDict.d.ts +1 -1
  84. package/lib/utils/asStyleDict.js.map +1 -1
  85. package/lib/utils/cloneStyledElement.d.ts +6 -6
  86. package/lib/utils/cloneStyledElement.js.map +1 -1
  87. package/lib/utils/styles.d.ts +1 -1
  88. package/lib/utils/styles.js.map +1 -1
  89. package/package.json +12 -10
@@ -1 +1 @@
1
- {"version":3,"file":"PanoramaSlider.js","sourceRoot":"/","sources":["PanoramaSlider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,6CAA8F;AAE9F,4EAAqD;AACrD,wDAAoD;AACpD,4EAAqD;AACrD,4EAAqD;AACrD,oEAA6C;AAC7C,kFAA2D;AAC3D,0DAAmC;AA4BnC;;;;;;;;GAQG;AACH,kBAAe,IAAA,kBAAU,EAAsC,UAAC,EAqB/D,EAAE,GAAG;;IApBJ,IAAA,SAAS,eAAA,EACT,KAAK,WAAA,EACL,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAA,EACT,qBAAuB,EAAvB,aAAa,mBAAG,OAAO,KAAA,EACvB,QAAQ,cAAA,EACR,GAAG,SAAA,EACH,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAA,EACT,GAAG,SAAA,EACH,YAAY,kBAAA,EACZ,kBAAc,EAAd,UAAU,mBAAG,CAAC,KAAA,EACd,aAAa,mBAAA,EACb,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,mBAAmB,yBAAA,EACnB,gBAAgB,sBAAA,EAChB,gBAAgB,sBAAA,EAChB,iBAAiB,uBAAA,EACjB,gBAAgB,sBAAA,EAChB,QAAQ,cAAA,EACL,KAAK,cApBsD,kRAqB/D,CADS;IAER,IAAM,cAAc,GAAG;QACrB,IAAI,CA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AU,EAAC,eAAe,CAAC,OAAO,CAAC;oBAC9C,KAAK,EAAE,IAAA,gBAAM,EAAC,WAAW,CAAC,OAAO,CAAC;iBACnC,CAAC;gBACD,IAAA,4BAAkB,EAAC,MAAA,UAAU,CAAC,KAAK,mCAAI,8BAAC,2BAAmB,IAAC,KAAK,EAAE,aAAa,CAAC,KAAK,GAAG,EAAE;oBAC1F,SAAS,EAAE,IAAA,oBAAU,EAAC,eAAe,CAAC,KAAK,CAAC;oBAC5C,KAAK,EAAE,IAAA,gBAAM,EAAC,WAAW,CAAC,KAAK,CAAC;iBACjC,CAAC,CACE,CACF;QACL,IAAA,4BAAkB,EAAC,MAAA,UAAU,CAAC,SAAS,mCAAI,8BAAC,+BAAuB,IAAC,KAAK,EAAE,aAAa,CAAC,SAAS,GAAG,EAAE;YACtG,SAAS,EAAE,IAAA,oBAAU,EAAC,eAAe,CAAC,SAAS,CAAC;YAChD,KAAK,EAAE,IAAA,gBAAM,EAAC,WAAW,CAAC,SAAS,CAAC;SACrC,CAAC,CACE,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEK,IAAM,mBAAmB,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAAzF,QAAA,mBAAmB,uBAAsE;AAE/F,IAAM,qBAAqB,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAA3F,QAAA,qBAAqB,yBAAsE;AAEjG,IAAM,uBAAuB,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAA7F,QAAA,uBAAuB,2BAAsE","sourcesContent":["import classNames from 'classnames'\nimport React, { forwardRef, HTMLAttributes, PropsWithChildren, useRef, useState } from 'react'\nimport { Size } from 'spase'\nimport useResizeEffect from './hooks/useResizeEffect'\nimport Panorama, { PanoramaProps } from './Panorama'\nimport asClassNameDict from './utils/asClassNameDict'\nimport asComponentDict from './utils/asComponentDict'\nimport asStyleDict from './utils/asStyleDict'\nimport cloneStyledElement from './utils/cloneStyledElement'\nimport styles from './utils/styles'\n\nexport type PanoramaSliderProps = HTMLAttributes<HTMLDivElement> & PanoramaProps & PropsWithChildren<{\n /**\n * Field-of-view (0.0 - 360.0 degrees, inclusive) that represents the size of\n * the reticle. 360 indicates the reticle covers the entire image. If this is\n * unspecified, the component will attempt to automatically calculate the FOV\n * using the `viewportSize` prop.\n */\n fov?: number\n\n /**\n * Specifies which length (width or height) should be automatically\n * calculated. The counterpart must be known (if `width` is specified here,\n * the component's height must be known, i.e. it is specified in the CSS).\n * Defaults to `width`.\n */\n autoDimension?: 'width' | 'height'\n\n /**\n * Size of the viewport that this component is controlling. A viewport can be\n * thought of as a DOM element containing an aspect-filled image. This is used\n * to automatically calculate the FOV if `fov` prop is not specified. If it\n * is, this prop is ignored.\n */\n viewportSize?: Size\n}>\n\n/**\n * A slider for a {@link Panorama} component.\n *\n * @exports PanoramaSliderIndicator - The indicator that appears when the slider\n * is being dragged.\n * @exports PanoramaSliderReticle - The reticle that indicates the FOV of the\n * backing {@link Panorama}.\n * @exports PanoramaSliderTrack - The slide track.\n */\nexport default forwardRef<HTMLDivElement, PanoramaSliderProps>(({\n className,\n style,\n angle = 0,\n autoDimension = 'width',\n children,\n fov,\n speed = 1,\n src,\n viewportSize,\n zeroAnchor = 0,\n onAngleChange,\n onDragEnd,\n onDragStart,\n onImageLoadComplete,\n onImageLoadError,\n onImageLoadStart,\n onImageSizeChange,\n onPositionChange,\n onResize,\n ...props\n}, ref) => {\n const getAspectRatio = () => {\n if (!imageSize) return 0\n const { width, height } = imageSize\n if (height === 0) return 0\n\n return width / height\n }\n\n const getReticleWidth = () => {\n const deg = Math.min(360, Math.max(0, fov ?? (viewportSize ? viewportSize.width / (viewportSize.height * aspectRatio) * 360 : 0)))\n\n return size.width * (deg / 360)\n }\n\n const getAdjustedZeroAnchor = () => {\n if (size.width <= 0) return zeroAnchor\n\n return ((size.width - reticleWidth) * 0.5 + zeroAnchor * reticleWidth) / size.width\n }\n\n const dragStartHandler = () => {\n setIsDragging(true)\n onDragStart?.()\n }\n\n const dragEndHandler = () => {\n setIsDragging(false)\n onDragEnd?.()\n }\n\n const panoramaRef = useRef<HTMLDivElement>(null)\n\n const [imageSize, setImageSize] = useState<Size | undefined>(undefined)\n const [isDragging, setIsDragging] = useState(false)\n\n const [size] = useResizeEffect(panoramaRef, { onResize })\n\n const aspectRatio = getAspectRatio()\n const reticleWidth = getReticleWidth()\n const adjustedZeroAnchor = getAdjustedZeroAnchor()\n\n const components = asComponentDict(children, {\n track: PanoramaSliderTrack,\n reticle: PanoramaSliderReticle,\n indicator: PanoramaSliderIndicator,\n })\n\n const fixedClassNames = asClassNameDict({\n root: classNames({\n dragging: isDragging,\n }),\n track: classNames({\n dragging: isDragging,\n }),\n reticle: classNames({\n dragging: isDragging,\n }),\n indicator: classNames({\n dragging: isDragging,\n }),\n })\n\n const fixedStyles = asStyleDict({\n root: {\n ...autoDimension === 'width' ? {\n width: `${size.height * aspectRatio}px`,\n } : {\n height: `${size.width / aspectRatio}px`,\n },\n },\n body: {\n height: '100%',\n left: '0',\n overflow: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n top: '0',\n width: '100%',\n },\n panorama: {\n height: '100%',\n width: '100%',\n },\n controls: {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'flex-start',\n left: '0',\n overflow: 'visible',\n position: 'absolute',\n top: '0',\n width: '100%',\n },\n track: {\n flex: '1 0 auto',\n },\n reticle: {\n width: `${reticleWidth}px`,\n },\n indicator: {\n width: `${reticleWidth}px`,\n },\n })\n\n const defaultStyles = asStyleDict({\n track: {\n background: 'rgba(0, 0, 0, .7)',\n height: '100%',\n },\n reticle: {\n background: `rgba(0, 0, 0, ${isDragging ? 0 : 0.3})`,\n flex: '0 0 auto',\n height: '100%',\n transitionDuration: '100ms',\n transitionProperty: 'background',\n transitionTimingFunction: 'ease-out',\n },\n indicator: {\n background: '#fff',\n borderRadius: '2px',\n bottom: '-10px',\n boxSizing: 'border-box',\n display: 'block',\n height: '2px',\n left: '0',\n margin: '0 auto',\n opacity: isDragging ? 1 : 0,\n position: 'absolute',\n right: '0',\n transition: 'opacity .3s ease-out',\n },\n })\n\n return (\n <div\n {...props}\n ref={ref}\n className={classNames(className, fixedClassNames.root)}\n style={styles(style, fixedStyles.root)}\n >\n <Panorama\n angle={angle}\n ref={panoramaRef}\n speed={speed}\n src={src}\n style={fixedStyles.panorama}\n zeroAnchor={adjustedZeroAnchor}\n onAngleChange={onAngleChange}\n onDragEnd={dragEndHandler}\n onDragStart={dragStartHandler}\n onImageLoadComplete={onImageLoadComplete}\n onImageLoadError={onImageLoadError}\n onImageLoadStart={onImageLoadStart}\n onImageSizeChange={setImageSize}\n onPositionChange={onPositionChange}\n />\n <div style={fixedStyles.body}>\n <div style={fixedStyles.controls}>\n {cloneStyledElement(components.track ?? <PanoramaSliderTrack style={defaultStyles.track}/>, {\n className: classNames(fixedClassNames.track),\n style: styles(fixedStyles.track),\n })}\n {cloneStyledElement(components.reticle ?? <PanoramaSliderReticle style={defaultStyles.reticle}/>, {\n className: classNames(fixedClassNames.reticle),\n style: styles(fixedStyles.reticle),\n })}\n {cloneStyledElement(components.track ?? <PanoramaSliderTrack style={defaultStyles.track}/>, {\n className: classNames(fixedClassNames.track),\n style: styles(fixedStyles.track),\n })}\n </div>\n </div>\n {cloneStyledElement(components.indicator ?? <PanoramaSliderIndicator style={defaultStyles.indicator}/>, {\n className: classNames(fixedClassNames.indicator),\n style: styles(fixedStyles.indicator),\n })}\n </div>\n )\n})\n\nexport const PanoramaSliderTrack = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const PanoramaSliderReticle = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const PanoramaSliderIndicator = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n"]}
1
+ {"version":3,"file":"PanoramaSlider.js","sourceRoot":"/","sources":["PanoramaSlider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,6CAAwG;AAExG,wDAAyD;AACzD,4EAAqD;AACrD,4EAAqD;AACrD,4EAAqD;AACrD,oEAA6C;AAC7C,kFAA2D;AAC3D,0DAAmC;AA4BnC;;;;;;;;GAQG;AACH,kBAAe,IAAA,kBAAU,EAAsC,UAAC,EAqB/D,EAAE,GAAG;;IApBJ,IAAA,SAAS,eAAA,EACT,KAAK,WAAA,EACL,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAA,EACT,qBAAuB,EAAvB,aAAa,mBAAG,OAAO,KAAA,EACvB,QAAQ,cAAA,EACR,GAAG,SAAA,EACH,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAA,EACT,GAAG,SAAA,EACH,YAAY,kBAAA,EACZ,kBAAc,EAAd,UAAU,mBAAG,CAAC,KAAA,EACd,aAAa,mBAAA,EACb,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,mBAAmB,yBAAA,EACnB,gBAAgB,sBAAA,EAChB,gBAAgB,sBAAA,EAChB,iBAAiB,uBAAA,EACjB,gBAAgB,sBAAA,EAChB,QAAQ,cAAA,EACL,KAAK,cApBsD,kRAqB/D,CADS;IAER,IAAM,cAAc,GAAG;QACrB,IAAI,CAAC,SAAS;YAAE,OAAO,CAAC,CAAA;QAChB,IAAA,KAAK,GAAa,SAAS,MAAtB,EAAE,MAAM,GAAK,SAAS,OAAd,CAAc;QACnC,IAAI,MAAM,KAAK,CAAC;YAAE,OAAO,CAAC,CAAA;QAE1B,OAAO,KAAK,GAAG,MAAM,CAAA;IACvB,CAAC,CAAA;IAED,IAAM,eAAe,GAAG;QACtB,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,EAAE,IAAA,oBAAU,EAAC,eAAe,CAAC,KAAK,CAAC;oBAC5C,KAAK,EAAE,IAAA,gBAAM,EAAC,WAAW,CAAC,KAAK,CAAC;iBACjC,CAAC,CACE,CACF;QACL,IAAA,4BAAkB,EAAC,MAAA,UAAU,CAAC,SAAS,mCAAI,8BAAC,+BAAuB,IAAC,KAAK,EAAE,aAAa,CAAC,SAAS,GAAG,EAAE;YACtG,SAAS,EAAE,IAAA,oBAAU,EAAC,eAAe,CAAC,SAAS,CAAC;YAChD,KAAK,EAAE,IAAA,gBAAM,EAAC,WAAW,CAAC,SAAS,CAAC;SACrC,CAAC,CACE,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEK,IAAM,mBAAmB,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAAzF,QAAA,mBAAmB,uBAAsE;AAE/F,IAAM,qBAAqB,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAA3F,QAAA,qBAAqB,yBAAsE;AAEjG,IAAM,uBAAuB,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAA7F,QAAA,uBAAuB,2BAAsE","sourcesContent":["import classNames from 'classnames'\nimport React, { forwardRef, useRef, useState, type HTMLAttributes, type PropsWithChildren } from 'react'\nimport { type Size } from 'spase'\nimport Panorama, { type PanoramaProps } from './Panorama'\nimport useResizeEffect from './hooks/useResizeEffect'\nimport asClassNameDict from './utils/asClassNameDict'\nimport asComponentDict from './utils/asComponentDict'\nimport asStyleDict from './utils/asStyleDict'\nimport cloneStyledElement from './utils/cloneStyledElement'\nimport styles from './utils/styles'\n\nexport type PanoramaSliderProps = HTMLAttributes<HTMLDivElement> & PanoramaProps & PropsWithChildren<{\n /**\n * Field-of-view (0.0 - 360.0 degrees, inclusive) that represents the size of\n * the reticle. 360 indicates the reticle covers the entire image. If this is\n * unspecified, the component will attempt to automatically calculate the FOV\n * using the `viewportSize` prop.\n */\n fov?: number\n\n /**\n * Specifies which length (width or height) should be automatically\n * calculated. The counterpart must be known (if `width` is specified here,\n * the component's height must be known, i.e. it is specified in the CSS).\n * Defaults to `width`.\n */\n autoDimension?: 'width' | 'height'\n\n /**\n * Size of the viewport that this component is controlling. A viewport can be\n * thought of as a DOM element containing an aspect-filled image. This is used\n * to automatically calculate the FOV if `fov` prop is not specified. If it\n * is, this prop is ignored.\n */\n viewportSize?: Size\n}>\n\n/**\n * A slider for a {@link Panorama} component.\n *\n * @exports PanoramaSliderIndicator The indicator that appears when the slider\n * is being dragged.\n * @exports PanoramaSliderReticle The reticle that indicates the FOV of the\n * backing {@link Panorama}.\n * @exports PanoramaSliderTrack The slide track.\n */\nexport default forwardRef<HTMLDivElement, PanoramaSliderProps>(({\n className,\n style,\n angle = 0,\n autoDimension = 'width',\n children,\n fov,\n speed = 1,\n src,\n viewportSize,\n zeroAnchor = 0,\n onAngleChange,\n onDragEnd,\n onDragStart,\n onImageLoadComplete,\n onImageLoadError,\n onImageLoadStart,\n onImageSizeChange,\n onPositionChange,\n onResize,\n ...props\n}, ref) => {\n const getAspectRatio = () => {\n if (!imageSize) return 0\n const { width, height } = imageSize\n if (height === 0) return 0\n\n return width / height\n }\n\n const getReticleWidth = () => {\n const deg = Math.min(360, Math.max(0, fov ?? (viewportSize ? viewportSize.width / (viewportSize.height * aspectRatio) * 360 : 0)))\n\n return size.width * (deg / 360)\n }\n\n const getAdjustedZeroAnchor = () => {\n if (size.width <= 0) return zeroAnchor\n\n return ((size.width - reticleWidth) * 0.5 + zeroAnchor * reticleWidth) / size.width\n }\n\n const dragStartHandler = () => {\n setIsDragging(true)\n onDragStart?.()\n }\n\n const dragEndHandler = () => {\n setIsDragging(false)\n onDragEnd?.()\n }\n\n const panoramaRef = useRef<HTMLDivElement>(null)\n\n const [imageSize, setImageSize] = useState<Size | undefined>(undefined)\n const [isDragging, setIsDragging] = useState(false)\n\n const [size] = useResizeEffect(panoramaRef, { onResize })\n\n const aspectRatio = getAspectRatio()\n const reticleWidth = getReticleWidth()\n const adjustedZeroAnchor = getAdjustedZeroAnchor()\n\n const components = asComponentDict(children, {\n track: PanoramaSliderTrack,\n reticle: PanoramaSliderReticle,\n indicator: PanoramaSliderIndicator,\n })\n\n const fixedClassNames = asClassNameDict({\n root: classNames({\n dragging: isDragging,\n }),\n track: classNames({\n dragging: isDragging,\n }),\n reticle: classNames({\n dragging: isDragging,\n }),\n indicator: classNames({\n dragging: isDragging,\n }),\n })\n\n const fixedStyles = asStyleDict({\n root: {\n ...autoDimension === 'width' ? {\n width: `${size.height * aspectRatio}px`,\n } : {\n height: `${size.width / aspectRatio}px`,\n },\n },\n body: {\n height: '100%',\n left: '0',\n overflow: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n top: '0',\n width: '100%',\n },\n panorama: {\n height: '100%',\n width: '100%',\n },\n controls: {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'flex-start',\n left: '0',\n overflow: 'visible',\n position: 'absolute',\n top: '0',\n width: '100%',\n },\n track: {\n flex: '1 0 auto',\n },\n reticle: {\n width: `${reticleWidth}px`,\n },\n indicator: {\n width: `${reticleWidth}px`,\n },\n })\n\n const defaultStyles = asStyleDict({\n track: {\n background: 'rgba(0, 0, 0, .7)',\n height: '100%',\n },\n reticle: {\n background: `rgba(0, 0, 0, ${isDragging ? 0 : 0.3})`,\n flex: '0 0 auto',\n height: '100%',\n transitionDuration: '100ms',\n transitionProperty: 'background',\n transitionTimingFunction: 'ease-out',\n },\n indicator: {\n background: '#fff',\n borderRadius: '2px',\n bottom: '-10px',\n boxSizing: 'border-box',\n display: 'block',\n height: '2px',\n left: '0',\n margin: '0 auto',\n opacity: isDragging ? 1 : 0,\n position: 'absolute',\n right: '0',\n transition: 'opacity .3s ease-out',\n },\n })\n\n return (\n <div\n {...props}\n ref={ref}\n className={classNames(className, fixedClassNames.root)}\n style={styles(style, fixedStyles.root)}\n >\n <Panorama\n angle={angle}\n ref={panoramaRef}\n speed={speed}\n src={src}\n style={fixedStyles.panorama}\n zeroAnchor={adjustedZeroAnchor}\n onAngleChange={onAngleChange}\n onDragEnd={dragEndHandler}\n onDragStart={dragStartHandler}\n onImageLoadComplete={onImageLoadComplete}\n onImageLoadError={onImageLoadError}\n onImageLoadStart={onImageLoadStart}\n onImageSizeChange={setImageSize}\n onPositionChange={onPositionChange}\n />\n <div style={fixedStyles.body}>\n <div style={fixedStyles.controls}>\n {cloneStyledElement(components.track ?? <PanoramaSliderTrack style={defaultStyles.track}/>, {\n className: classNames(fixedClassNames.track),\n style: styles(fixedStyles.track),\n })}\n {cloneStyledElement(components.reticle ?? <PanoramaSliderReticle style={defaultStyles.reticle}/>, {\n className: classNames(fixedClassNames.reticle),\n style: styles(fixedStyles.reticle),\n })}\n {cloneStyledElement(components.track ?? <PanoramaSliderTrack style={defaultStyles.track}/>, {\n className: classNames(fixedClassNames.track),\n style: styles(fixedStyles.track),\n })}\n </div>\n </div>\n {cloneStyledElement(components.indicator ?? <PanoramaSliderIndicator style={defaultStyles.indicator}/>, {\n className: classNames(fixedClassNames.indicator),\n style: styles(fixedStyles.indicator),\n })}\n </div>\n )\n})\n\nexport const PanoramaSliderTrack = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const PanoramaSliderReticle = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const PanoramaSliderIndicator = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n"]}
@@ -1,4 +1,4 @@
1
- import React, { HTMLAttributes, PropsWithChildren } from 'react';
1
+ import React, { type HTMLAttributes, type PropsWithChildren } from 'react';
2
2
  type Orientation = 'horizontal' | 'vertical';
3
3
  type Range = [number, number];
4
4
  export type RangeSliderProps =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C,WAAW,CAAC,KAAK,CAAC;iBACjC,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAC7D,CACG,CACF,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEK,IAAM,iBAAiB,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAAvF,QAAA,iBAAiB,qBAAsE;AAE7F,IAAM,gBAAgB,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAAtF,QAAA,gBAAgB,oBAAsE;AAE5F,IAAM,oBAAoB,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAA1F,QAAA,oBAAoB,wBAAsE;AAE1F,QAAA,eAAe,GAAG,IAAA,kBAAU,EAAiD,UAAC,EAAY,EAAE,GAAG;QAAZ,KAAK,cAAV,EAAY,CAAF;IAAY,OAAA,kDAAS,KAAK,IAAE,GAAG,EAAE,GAAG,IAAG,CAAA;CAAA,CAAC,CAAA","sourcesContent":["import classNames from 'classnames'\nimport isEqual from 'fast-deep-equal'\nimport React, { forwardRef, HTMLAttributes, PropsWithChildren, useEffect, useRef, useState } from 'react'\nimport useDragEffect from './hooks/useDragEffect'\nimport useResizeEffect from './hooks/useResizeEffect'\nimport asClassNameDict from './utils/asClassNameDict'\nimport asComponentDict from './utils/asComponentDict'\nimport asStyleDict from './utils/asStyleDict'\nimport cloneStyledElement from './utils/cloneStyledElement'\nimport styles from './utils/styles'\n\ntype Orientation = 'horizontal' | 'vertical'\n\ntype Range = [number, number]\n\nexport type RangeSliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{\n areLabelsVisible?: boolean\n decimalPlaces?: number\n knobPadding?: number\n max: number\n min: number\n orientation?: Orientation\n range?: Range\n steps?: number\n onRangeChange?: (range: Range) => void\n}>\n\nexport default forwardRef<HTMLDivElement, RangeSliderProps>(({\n children,\n className,\n areLabelsVisible = true,\n decimalPlaces = 2,\n knobPadding = 20,\n max: maxValue,\n min: minValue,\n orientation = 'vertical',\n range: externalRange,\n steps = -1,\n onRangeChange,\n ...props\n}, ref) => {\n const getPositionByValue = (value: number) => (value - minValue) / (maxValue - minValue)\n const getPositionByDisplacement = (displacement: number) => displacement / (orientation === 'horizontal' ? size.width : size.height)\n const getValueByPosition = (position: number) => position * (maxValue - minValue) + minValue\n const getValueByDisplacement = (displacement: number) => getValueByPosition(getPositionByDisplacement(displacement))\n const getDisplacementByPosition = (position: number) => position * (orientation === 'horizontal' ? size.width : size.height)\n const getDisplacementByValue = (value: number) => getDisplacementByPosition(getPositionByValue(value))\n\n const getClosestSteppedValue = (value: number) => {\n const n = breakpoints.length\n let idx = 0\n let diff = Infinity\n\n for (let i = 0; i < n; i++) {\n const t = breakpoints[i]\n const d = Math.abs(value - t)\n\n if (d < diff) {\n diff = d\n idx = i\n }\n }\n\n return breakpoints[idx]\n }\n\n const bodyRef = useRef<HTMLDivElement>(null)\n const startKnobRef = useRef<HTMLDivElement>(null)\n const endKnobRef = useRef<HTMLDivElement>(null)\n\n const [size] = useResizeEffect(bodyRef)\n\n const [range, setRange] = useState<Range>(externalRange ?? [minValue, maxValue])\n\n const { isDragging: [isDraggingStartKnob], isReleasing: [isReleasingStartKnob], value: [startValue, setStartValue] } = useDragEffect(startKnobRef, {\n initialValue: externalRange?.[0] ?? minValue,\n transform: (value: number, dx: number, dy: number) => {\n const delta = orientation === 'horizontal' ? dx : dy\n const dMin = getDisplacementByValue(minValue)\n const dMax = getDisplacementByValue(range[1])\n const dCurr = getDisplacementByValue(value) + delta\n\n return getValueByDisplacement(Math.max(dMin, Math.min(dMax, dCurr)))\n },\n }, [minValue, orientation, size, range[1]])\n\n const { isDragging: [isDraggingEndKnob], isReleasing: [isReleasingEndKnob], value: [endValue, setEndValue] } = useDragEffect(endKnobRef, {\n initialValue: externalRange?.[1] ?? maxValue,\n transform: (value: number, dx: number, dy: number) => {\n const delta = orientation === 'horizontal' ? dx : dy\n const dMin = getDisplacementByValue(range[0])\n const dMax = getDisplacementByValue(maxValue)\n const dCurr = getDisplacementByValue(value) + delta\n\n return getValueByDisplacement(Math.max(dMin, Math.min(dMax, dCurr)))\n },\n }, [maxValue, orientation, size, range[0]])\n\n const breakpoints = [minValue, ...[...Array(steps)].map((v, i) => minValue + (i + 1) * (maxValue - minValue) / (1 + steps)), maxValue]\n const [start, end] = range.map(getDisplacementByValue)\n const highlightLength = end - start\n\n useEffect(() => {\n if (range[0] === startValue) return\n setRange([startValue, range[1]])\n onRangeChange?.(range)\n }, [startValue])\n\n useEffect(() => {\n if (range[1] === endValue) return\n setRange([range[0], endValue])\n onRangeChange?.(range)\n }, [endValue])\n\n useEffect(() => {\n if (isDraggingStartKnob || isDraggingEndKnob || isEqual(externalRange, range)) return\n setRange(externalRange ?? [minValue, maxValue])\n }, [externalRange])\n\n useEffect(() => {\n if (steps < 0) return\n setStartValue(getClosestSteppedValue(startValue))\n }, [isReleasingStartKnob])\n\n useEffect(() => {\n if (steps < 0 || !isReleasingEndKnob) return\n setEndValue(getClosestSteppedValue(endValue))\n }, [isReleasingEndKnob])\n\n const components = asComponentDict(children, {\n gutter: RangeSliderGutter,\n highlight: RangeSliderHighlight,\n knob: RangeSliderKnob,\n label: RangeSliderLabel,\n })\n\n const fixedClassNames = asClassNameDict({\n root: classNames(orientation),\n gutter: classNames(orientation),\n highlight: classNames(orientation),\n knob: classNames(orientation),\n label: classNames(orientation),\n })\n\n const fixedStyles = asStyleDict({\n body: {\n height: '100%',\n width: '100%',\n },\n gutter: {\n display: 'block',\n top: '0',\n left: '0',\n position: 'absolute',\n width: '100%',\n height: '100%',\n },\n highlight: {\n height: '100%',\n left: '0',\n position: 'absolute',\n top: '0',\n ...orientation === 'horizontal' ? {\n width: `${highlightLength}px`,\n transform: `translate3d(${start}px, 0, 0)`,\n } : {\n height: `${highlightLength}px`,\n transform: `translate3d(0, ${start}px, 0)`,\n },\n },\n knob: {\n bottom: '0',\n left: '0',\n margin: 'auto',\n position: 'absolute',\n right: '0',\n top: '0',\n touchAction: 'none',\n zIndex: '1',\n },\n knobHitbox: {\n background: 'transparent',\n height: `calc(100% + ${knobPadding * 2}px)`,\n left: `-${knobPadding}px`,\n padding: `${knobPadding}px`,\n position: 'absolute',\n top: `-${knobPadding}px`,\n width: `calc(100% + ${knobPadding * 2}px)`,\n },\n label: {\n pointerEvents: 'none',\n position: 'relative',\n userSelect: 'none',\n },\n })\n\n const defaultStyles = asStyleDict({\n gutter: {\n background: 'rgba(255, 255, 255, .2)',\n },\n highlight: {\n background: '#fff',\n transitionDuration: '100ms',\n transitionProperty: (isReleasingStartKnob ? !isReleasingEndKnob : isReleasingEndKnob) ? 'opacity, width, transform' : 'opacity',\n transitionTimingFunction: 'ease-out',\n },\n knob: {\n alignItems: 'center',\n background: '#fff',\n borderRadius: '10px',\n boxSizing: 'border-box',\n display: 'flex',\n height: '20px',\n justifyContent: 'center',\n transitionDuration: '100ms',\n transitionTimingFunction: 'ease-out',\n width: '20px',\n },\n label: {\n background: 'transparent',\n color: '#fff',\n textAlign: 'center',\n transitionDuration: '100ms',\n transitionTimingFunction: 'ease-out',\n ...orientation === 'horizontal' ? {\n top: 'calc(100% + 10px)',\n } : {\n left: 'calc(100% + 10px)',\n },\n },\n })\n\n return (\n <div {...props} ref={ref} className={classNames(className, fixedClassNames.root)}>\n <div ref={bodyRef} style={fixedStyles.body}>\n {cloneStyledElement(components.gutter ?? <RangeSliderGutter style={defaultStyles.gutter}/>, {\n className: classNames(fixedClassNames.gutter),\n style: styles(fixedStyles.gutter),\n })}\n {cloneStyledElement(components.highlight ?? <RangeSliderHighlight style={defaultStyles.highlight}/>, {\n className: classNames(fixedClassNames.highlight),\n style: styles(fixedStyles.highlight),\n })}\n {cloneStyledElement(components.knob ?? <RangeSliderKnob style={styles(defaultStyles.knob, {\n transitionProperty: isReleasingStartKnob ? 'opacity, transform' : 'opacity',\n })}/>, {\n ref: startKnobRef,\n disabled: isEqual([startValue, endValue], [maxValue, maxValue]),\n className: classNames(fixedClassNames.knob, {\n dragging: isDraggingStartKnob,\n releasing: isReleasingStartKnob,\n }),\n style: styles(fixedStyles.knob, {\n pointerEvents: isEqual([startValue, endValue], [minValue, minValue]) ? 'none' : 'auto',\n }, orientation === 'horizontal' ? {\n marginLeft: `${start}px`,\n } : {\n marginTop: `${start}px`,\n }),\n }, <div style={fixedStyles.knobHitbox}/>, areLabelsVisible &&\n cloneStyledElement(components.label ?? <RangeSliderLabel style={styles(defaultStyles.label, {\n transitionProperty: isReleasingStartKnob ? 'opacity, transform' : 'opacity',\n })}/>, {\n className: classNames(fixedClassNames.label, {\n dragging: isDraggingStartKnob || isDraggingEndKnob,\n releasing: isReleasingStartKnob || isReleasingEndKnob,\n }),\n style: styles(fixedStyles.label),\n }, Number(startValue.toFixed(decimalPlaces)).toLocaleString())\n )}\n {cloneStyledElement(components.knob ?? <RangeSliderKnob style={styles(defaultStyles.knob, {\n transitionProperty: isReleasingEndKnob ? 'opacity, transform' : 'opacity',\n })}/>, {\n ref: endKnobRef,\n disabled: isEqual([startValue, endValue], [maxValue, maxValue]),\n className: classNames(fixedClassNames.knob, {\n dragging: isDraggingEndKnob,\n releasing: isDraggingEndKnob,\n }),\n style: styles(fixedStyles.knob, {\n pointerEvents: isEqual([startValue, endValue], [maxValue, maxValue]) ? 'none' : 'auto',\n }, orientation === 'horizontal' ? {\n marginLeft: `${end}px`,\n } : {\n marginTop: `${end}px`,\n }),\n }, <div style={fixedStyles.knobHitbox}/>, areLabelsVisible &&\n cloneStyledElement(components.label ?? <RangeSliderLabel style={styles(defaultStyles.label, {\n transitionProperty: isReleasingEndKnob ? 'opacity, transform' : 'opacity',\n })}/>, {\n className: classNames(fixedClassNames.label, {\n dragging: isDraggingEndKnob,\n releasing: isReleasingEndKnob,\n }),\n style: styles(fixedStyles.label),\n }, Number(endValue.toFixed(decimalPlaces)).toLocaleString())\n )}\n </div>\n </div>\n )\n})\n\nexport const RangeSliderGutter = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const RangeSliderLabel = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const RangeSliderHighlight = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const RangeSliderKnob = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ ...props }, ref) => <div {...props} ref={ref}/>)\n"]}
1
+ {"version":3,"file":"RangeSlider.js","sourceRoot":"/","sources":["RangeSlider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,oEAAqC;AACrC,6CAAmH;AACnH,wEAAiD;AACjD,4EAAqD;AACrD,4EAAqD;AACrD,4EAAqD;AACrD,oEAA6C;AAC7C,kFAA2D;AAC3D,0DAAmC;AAkBnC,kBAAe,IAAA,kBAAU,EAAmC,UAAC,EAa5D,EAAE,GAAG;;IAZJ,IAAA,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,wBAAuB,EAAvB,gBAAgB,mBAAG,IAAI,KAAA,EACvB,qBAAiB,EAAjB,aAAa,mBAAG,CAAC,KAAA,EACjB,mBAAgB,EAAhB,WAAW,mBAAG,EAAE,KAAA,EACX,QAAQ,SAAA,EACR,QAAQ,SAAA,EACb,mBAAwB,EAAxB,WAAW,mBAAG,UAAU,KAAA,EACjB,aAAa,WAAA,EACpB,aAAU,EAAV,KAAK,mBAAG,CAAC,CAAC,KAAA,EACV,aAAa,mBAAA,EACV,KAAK,cAZmD,6IAa5D,CADS;IAER,IAAM,kBAAkB,GAAG,UAAC,KAAa,IAAK,OAAA,CAAC,KA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forwardRef, useEffect, useRef, useState, type HTMLAttributes, type PropsWithChildren } from 'react'\nimport useDragEffect from './hooks/useDragEffect'\nimport useResizeEffect from './hooks/useResizeEffect'\nimport asClassNameDict from './utils/asClassNameDict'\nimport asComponentDict from './utils/asComponentDict'\nimport asStyleDict from './utils/asStyleDict'\nimport cloneStyledElement from './utils/cloneStyledElement'\nimport styles from './utils/styles'\n\ntype Orientation = 'horizontal' | 'vertical'\n\ntype Range = [number, number]\n\nexport type RangeSliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{\n areLabelsVisible?: boolean\n decimalPlaces?: number\n knobPadding?: number\n max: number\n min: number\n orientation?: Orientation\n range?: Range\n steps?: number\n onRangeChange?: (range: Range) => void\n}>\n\nexport default forwardRef<HTMLDivElement, RangeSliderProps>(({\n children,\n className,\n areLabelsVisible = true,\n decimalPlaces = 2,\n knobPadding = 20,\n max: maxValue,\n min: minValue,\n orientation = 'vertical',\n range: externalRange,\n steps = -1,\n onRangeChange,\n ...props\n}, ref) => {\n const getPositionByValue = (value: number) => (value - minValue) / (maxValue - minValue)\n const getPositionByDisplacement = (displacement: number) => displacement / (orientation === 'horizontal' ? size.width : size.height)\n const getValueByPosition = (position: number) => position * (maxValue - minValue) + minValue\n const getValueByDisplacement = (displacement: number) => getValueByPosition(getPositionByDisplacement(displacement))\n const getDisplacementByPosition = (position: number) => position * (orientation === 'horizontal' ? size.width : size.height)\n const getDisplacementByValue = (value: number) => getDisplacementByPosition(getPositionByValue(value))\n\n const getClosestSteppedValue = (value: number) => {\n const n = breakpoints.length\n let idx = 0\n let diff = Infinity\n\n for (let i = 0; i < n; i++) {\n const t = breakpoints[i]\n const d = Math.abs(value - t)\n\n if (d < diff) {\n diff = d\n idx = i\n }\n }\n\n return breakpoints[idx]\n }\n\n const bodyRef = useRef<HTMLDivElement>(null)\n const startKnobRef = useRef<HTMLDivElement>(null)\n const endKnobRef = useRef<HTMLDivElement>(null)\n\n const [size] = useResizeEffect(bodyRef)\n\n const [range, setRange] = useState<Range>(externalRange ?? [minValue, maxValue])\n\n const { isDragging: [isDraggingStartKnob], isReleasing: [isReleasingStartKnob], value: [startValue, setStartValue] } = useDragEffect(startKnobRef, {\n initialValue: externalRange?.[0] ?? minValue,\n transform: (value: number, dx: number, dy: number) => {\n const delta = orientation === 'horizontal' ? dx : dy\n const dMin = getDisplacementByValue(minValue)\n const dMax = getDisplacementByValue(range[1])\n const dCurr = getDisplacementByValue(value) + delta\n\n return getValueByDisplacement(Math.max(dMin, Math.min(dMax, dCurr)))\n },\n }, [minValue, orientation, size, range[1]])\n\n const { isDragging: [isDraggingEndKnob], isReleasing: [isReleasingEndKnob], value: [endValue, setEndValue] } = useDragEffect(endKnobRef, {\n initialValue: externalRange?.[1] ?? maxValue,\n transform: (value: number, dx: number, dy: number) => {\n const delta = orientation === 'horizontal' ? dx : dy\n const dMin = getDisplacementByValue(range[0])\n const dMax = getDisplacementByValue(maxValue)\n const dCurr = getDisplacementByValue(value) + delta\n\n return getValueByDisplacement(Math.max(dMin, Math.min(dMax, dCurr)))\n },\n }, [maxValue, orientation, size, range[0]])\n\n const breakpoints = [minValue, ...[...Array(steps)].map((v, i) => minValue + (i + 1) * (maxValue - minValue) / (1 + steps)), maxValue]\n const [start, end] = range.map(getDisplacementByValue)\n const highlightLength = end - start\n\n useEffect(() => {\n if (range[0] === startValue) return\n setRange([startValue, range[1]])\n onRangeChange?.(range)\n }, [startValue])\n\n useEffect(() => {\n if (range[1] === endValue) return\n setRange([range[0], endValue])\n onRangeChange?.(range)\n }, [endValue])\n\n useEffect(() => {\n if (isDraggingStartKnob || isDraggingEndKnob || isEqual(externalRange, range)) return\n setRange(externalRange ?? [minValue, maxValue])\n }, [externalRange])\n\n useEffect(() => {\n if (steps < 0) return\n setStartValue(getClosestSteppedValue(startValue))\n }, [isReleasingStartKnob])\n\n useEffect(() => {\n if (steps < 0 || !isReleasingEndKnob) return\n setEndValue(getClosestSteppedValue(endValue))\n }, [isReleasingEndKnob])\n\n const components = asComponentDict(children, {\n gutter: RangeSliderGutter,\n highlight: RangeSliderHighlight,\n knob: RangeSliderKnob,\n label: RangeSliderLabel,\n })\n\n const fixedClassNames = asClassNameDict({\n root: classNames(orientation),\n gutter: classNames(orientation),\n highlight: classNames(orientation),\n knob: classNames(orientation),\n label: classNames(orientation),\n })\n\n const fixedStyles = asStyleDict({\n body: {\n height: '100%',\n width: '100%',\n },\n gutter: {\n display: 'block',\n top: '0',\n left: '0',\n position: 'absolute',\n width: '100%',\n height: '100%',\n },\n highlight: {\n height: '100%',\n left: '0',\n position: 'absolute',\n top: '0',\n ...orientation === 'horizontal' ? {\n width: `${highlightLength}px`,\n transform: `translate3d(${start}px, 0, 0)`,\n } : {\n height: `${highlightLength}px`,\n transform: `translate3d(0, ${start}px, 0)`,\n },\n },\n knob: {\n bottom: '0',\n left: '0',\n margin: 'auto',\n position: 'absolute',\n right: '0',\n top: '0',\n touchAction: 'none',\n zIndex: '1',\n },\n knobHitbox: {\n background: 'transparent',\n height: `calc(100% + ${knobPadding * 2}px)`,\n left: `-${knobPadding}px`,\n padding: `${knobPadding}px`,\n position: 'absolute',\n top: `-${knobPadding}px`,\n width: `calc(100% + ${knobPadding * 2}px)`,\n },\n label: {\n pointerEvents: 'none',\n position: 'relative',\n userSelect: 'none',\n },\n })\n\n const defaultStyles = asStyleDict({\n gutter: {\n background: 'rgba(255, 255, 255, .2)',\n },\n highlight: {\n background: '#fff',\n transitionDuration: '100ms',\n transitionProperty: (isReleasingStartKnob ? !isReleasingEndKnob : isReleasingEndKnob) ? 'opacity, width, transform' : 'opacity',\n transitionTimingFunction: 'ease-out',\n },\n knob: {\n alignItems: 'center',\n background: '#fff',\n borderRadius: '10px',\n boxSizing: 'border-box',\n display: 'flex',\n height: '20px',\n justifyContent: 'center',\n transitionDuration: '100ms',\n transitionTimingFunction: 'ease-out',\n width: '20px',\n },\n label: {\n background: 'transparent',\n color: '#fff',\n textAlign: 'center',\n transitionDuration: '100ms',\n transitionTimingFunction: 'ease-out',\n ...orientation === 'horizontal' ? {\n top: 'calc(100% + 10px)',\n } : {\n left: 'calc(100% + 10px)',\n },\n },\n })\n\n return (\n <div {...props} ref={ref} className={classNames(className, fixedClassNames.root)}>\n <div ref={bodyRef} style={fixedStyles.body}>\n {cloneStyledElement(components.gutter ?? <RangeSliderGutter style={defaultStyles.gutter}/>, {\n className: classNames(fixedClassNames.gutter),\n style: styles(fixedStyles.gutter),\n })}\n {cloneStyledElement(components.highlight ?? <RangeSliderHighlight style={defaultStyles.highlight}/>, {\n className: classNames(fixedClassNames.highlight),\n style: styles(fixedStyles.highlight),\n })}\n {cloneStyledElement(components.knob ?? <RangeSliderKnob style={styles(defaultStyles.knob, {\n transitionProperty: isReleasingStartKnob ? 'opacity, transform' : 'opacity',\n })}/>, {\n ref: startKnobRef,\n disabled: isEqual([startValue, endValue], [maxValue, maxValue]),\n className: classNames(fixedClassNames.knob, {\n dragging: isDraggingStartKnob,\n releasing: isReleasingStartKnob,\n }),\n style: styles(fixedStyles.knob, {\n pointerEvents: isEqual([startValue, endValue], [minValue, minValue]) ? 'none' : 'auto',\n }, orientation === 'horizontal' ? {\n marginLeft: `${start}px`,\n } : {\n marginTop: `${start}px`,\n }),\n }, <div style={fixedStyles.knobHitbox}/>, areLabelsVisible &&\n cloneStyledElement(components.label ?? <RangeSliderLabel style={styles(defaultStyles.label, {\n transitionProperty: isReleasingStartKnob ? 'opacity, transform' : 'opacity',\n })}/>, {\n className: classNames(fixedClassNames.label, {\n dragging: isDraggingStartKnob || isDraggingEndKnob,\n releasing: isReleasingStartKnob || isReleasingEndKnob,\n }),\n style: styles(fixedStyles.label),\n }, Number(startValue.toFixed(decimalPlaces)).toLocaleString())\n )}\n {cloneStyledElement(components.knob ?? <RangeSliderKnob style={styles(defaultStyles.knob, {\n transitionProperty: isReleasingEndKnob ? 'opacity, transform' : 'opacity',\n })}/>, {\n ref: endKnobRef,\n disabled: isEqual([startValue, endValue], [maxValue, maxValue]),\n className: classNames(fixedClassNames.knob, {\n dragging: isDraggingEndKnob,\n releasing: isDraggingEndKnob,\n }),\n style: styles(fixedStyles.knob, {\n pointerEvents: isEqual([startValue, endValue], [maxValue, maxValue]) ? 'none' : 'auto',\n }, orientation === 'horizontal' ? {\n marginLeft: `${end}px`,\n } : {\n marginTop: `${end}px`,\n }),\n }, <div style={fixedStyles.knobHitbox}/>, areLabelsVisible &&\n cloneStyledElement(components.label ?? <RangeSliderLabel style={styles(defaultStyles.label, {\n transitionProperty: isReleasingEndKnob ? 'opacity, transform' : 'opacity',\n })}/>, {\n className: classNames(fixedClassNames.label, {\n dragging: isDraggingEndKnob,\n releasing: isReleasingEndKnob,\n }),\n style: styles(fixedStyles.label),\n }, Number(endValue.toFixed(decimalPlaces)).toLocaleString())\n )}\n </div>\n </div>\n )\n})\n\nexport const RangeSliderGutter = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const RangeSliderLabel = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const RangeSliderHighlight = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const RangeSliderKnob = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ ...props }, ref) => <div {...props} ref={ref}/>)\n"]}
package/lib/Repeat.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import React, { type ReactNode } from 'react';
2
2
  export type RepeatProps = {
3
3
  children?: ReactNode | ((index: number) => ReactNode);
4
4
  count?: number;
package/lib/Repeat.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Repeat.js","sourceRoot":"/","sources":["Repeat.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAkD;AAQlD;;;GAGG;AACH,SAAwB,MAAM,CAAC,EAIjB;QAHZ,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAA,EACT,QAAQ,cAAA,EACR,MAAM,YAAA;IAEN,OAAO,CACL,8DACG,yBAAI,KAAK,CAAC,KAAK,CAAC,UAAE,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAC/B,8BAAC,gBAAQ,IAAC,GAAG,EAAE,kBAAW,CAAC,CAAE,IAC1B,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CACpE,CACZ,EAJgC,CAIhC,CAAC,CACD,CACJ,CAAA;AACH,CAAC;AAdD,yBAcC","sourcesContent":["import React, { Fragment, ReactNode } from 'react'\n\nexport type RepeatProps = {\n children?: ReactNode | ((index: number) => ReactNode)\n count?: number\n render?: (index: number) => ReactNode\n}\n\n/**\n * A tag-less component that repeats its children, automatically assigning each\n * a unique key.\n */\nexport default function Repeat({\n count = 1,\n children,\n render,\n}: RepeatProps) {\n return (\n <>\n {[...Array(count)].map((v, i) => (\n <Fragment key={`element-${i}`}>\n {render ? render(i) : typeof children === 'function' ? children(i) : children}\n </Fragment>\n ))}\n </>\n )\n}\n"]}
1
+ {"version":3,"file":"Repeat.js","sourceRoot":"/","sources":["Repeat.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAuD;AAQvD;;;GAGG;AACH,SAAwB,MAAM,CAAC,EAIjB;QAHZ,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAA,EACT,QAAQ,cAAA,EACR,MAAM,YAAA;IAEN,OAAO,CACL,8DACG,yBAAI,KAAK,CAAC,KAAK,CAAC,UAAE,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAC/B,8BAAC,gBAAQ,IAAC,GAAG,EAAE,kBAAW,CAAC,CAAE,IAC1B,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CACpE,CACZ,EAJgC,CAIhC,CAAC,CACD,CACJ,CAAA;AACH,CAAC;AAdD,yBAcC","sourcesContent":["import React, { Fragment, type ReactNode } from 'react'\n\nexport type RepeatProps = {\n children?: ReactNode | ((index: number) => ReactNode)\n count?: number\n render?: (index: number) => ReactNode\n}\n\n/**\n * A tag-less component that repeats its children, automatically assigning each\n * a unique key.\n */\nexport default function Repeat({\n count = 1,\n children,\n render,\n}: RepeatProps) {\n return (\n <>\n {[...Array(count)].map((v, i) => (\n <Fragment key={`element-${i}`}>\n {render ? render(i) : typeof children === 'function' ? children(i) : children}\n </Fragment>\n ))}\n </>\n )\n}\n"]}
@@ -1,4 +1,4 @@
1
- import React, { HTMLAttributes, PropsWithChildren } from 'react';
1
+ import React, { type HTMLAttributes, type PropsWithChildren } from 'react';
2
2
  export type RotatingGalleryProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{
3
3
  /**
4
4
  * Current image index. An error is thrown if the index is invalid (must be
@@ -23,15 +23,15 @@ export type RotatingGalleryProps = HTMLAttributes<HTMLDivElement> & PropsWithChi
23
23
  /**
24
24
  * Handler invoked when the image index changes.
25
25
  *
26
- * @param index - The current image index.
26
+ * @param index The current image index.
27
27
  */
28
28
  onIndexChange?: (index: number) => void;
29
29
  }>;
30
30
  /**
31
31
  * A component displaying rotating images.
32
32
  *
33
- * @exports RotatingGalleryImage - Component for each rotating image, classes:
34
- * `entering`, `entered`, `exiting`, `exited`.
33
+ * @exports RotatingGalleryImage Component for each rotating image, classes:
34
+ * `entering`, `entered`, `exiting`, `exited`.
35
35
  */
36
36
  declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
37
37
  /**
@@ -57,7 +57,7 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
57
57
  /**
58
58
  * Handler invoked when the image index changes.
59
59
  *
60
- * @param index - The current image index.
60
+ * @param index The current image index.
61
61
  */
62
62
  onIndexChange?: ((index: number) => void) | undefined;
63
63
  } & {
@@ -77,8 +77,8 @@ var styles_1 = __importDefault(require("./utils/styles"));
77
77
  /**
78
78
  * A component displaying rotating images.
79
79
  *
80
- * @exports RotatingGalleryImage - Component for each rotating image, classes:
81
- * `entering`, `entered`, `exiting`, `exited`.
80
+ * @exports RotatingGalleryImage Component for each rotating image, classes:
81
+ * `entering`, `entered`, `exiting`, `exited`.
82
82
  */
83
83
  exports.default = (0, react_1.forwardRef)(function (_a, ref) {
84
84
  var children = _a.children, _b = _a.index, externalIndex = _b === void 0 ? 0 : _b, rotationDuration = _a.rotationDuration, _c = _a.srcs, srcs = _c === void 0 ? [] : _c, _d = _a.transitionDuration, transitionDuration = _d === void 0 ? 500 : _d, onIndexChange = _a.onIndexChange, props = __rest(_a, ["children", "index", "rotationDuration", "srcs", "transitionDuration", "onIndexChange"]);
@@ -1 +1 @@
1
- {"version":3,"file":"RotatingGallery.js","sourceRoot":"/","sources":["RotatingGallery.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,6CAAiG;AACjG,iEAAmD;AACnD,gDAAyB;AACzB,oEAA6C;AAC7C,4EAAqD;AACrD,oEAA6C;AAC7C,kFAA2D;AAC3D,0DAAmC;AAmCnC;;;;;GAKG;AACH,kBAAe,IAAA,kBAAU,EAAuC,UAAC,EAQhE,EAAE,GAAG;IAPJ,IAAA,QAAQ,cAAA,EACR,aAAwB,EAAjB,aAAa,mBAAG,CAAC,KAAA,EACxB,gBAAgB,sBAAA,EAChB,YAAS,EAAT,IAAI,mBAAG,EAAE,KAAA,EACT,0BAAwB,EAAxB,kBAAkB,mBAAG,GAAG,KAAA,EACxB,aAAa,mBAAA,EACV,KAAK,cAPuD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,UAAC,GAAG,EAAE,GAAG,IAAK,OAAA,CACb,8BAAC,mCAAU,IAAC,EAAE,EAAE,GAAG,KAAK,KAAK,EAAE,OAAO,EAAE,kBAAkB,IACvD,UAAA,KAAK;;YAAI,OAAA,IAAA,4BAAkB,EAAC,MAAA,UAAU,CAAC,KAAK,mCAAI,8BAAC,4BAAoB,IAAC,KAAK,EAAE,IAAA,gBAAM,EAClF,aAAa,CAAC,KAAK,EACnB,KAAK,KAAK,UAAU,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,EACxC,KAAK,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CACxC,GAAG,EAAE;gBACJ,SAAS,EAAE,IAAA,oBAAU,EAAC,KAAK,CAAC;gBAC5B,KAAK,EAAE,IAAA,gBAAM,EAAC,WAAW,CAAC,KAAK,EAAE;oBAC/B,eAAe,EAAE,cAAO,GAAG,MAAG;iBAC/B,CAAC;aACH,CAAC,CAAA;SAAA,CACS,CACd,EAbc,CAad,CACI,CACH,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEK,IAAM,oBAAoB,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAA1F,QAAA,oBAAoB,wBAAsE","sourcesContent":["import classNames from 'classnames'\nimport React, { forwardRef, HTMLAttributes, PropsWithChildren, useEffect, useState } from 'react'\nimport { Transition } from 'react-transition-group'\nimport Each from './Each'\nimport useInterval from './hooks/useInterval'\nimport asComponentDict from './utils/asComponentDict'\nimport asStyleDict from './utils/asStyleDict'\nimport cloneStyledElement from './utils/cloneStyledElement'\nimport styles from './utils/styles'\n\nexport type RotatingGalleryProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{\n /**\n * Current image index. An error is thrown if the index is invalid (must be\n * between 0 and length of `srcs` - 1, inclusive). This prop supports two-way\n * binding.\n */\n index?: number\n\n /**\n * An array of image paths.\n */\n srcs?: string[]\n\n /**\n * The duration of one rotation in milliseconds (how long one image stays\n * before transitioning to the next). Specifying `NaN` or a negative number\n * will prevent the component from automatically rotating.\n */\n rotationDuration?: number\n\n /**\n * The duration of an image transition in milliseconds.\n */\n transitionDuration?: number\n\n /**\n * Handler invoked when the image index changes.\n *\n * @param index - The current image index.\n */\n onIndexChange?: (index: number) => void\n}>\n\n/**\n * A component displaying rotating images.\n *\n * @exports RotatingGalleryImage - Component for each rotating image, classes:\n * `entering`, `entered`, `exiting`, `exited`.\n */\nexport default forwardRef<HTMLDivElement, RotatingGalleryProps>(({\n children,\n index: externalIndex = 0,\n rotationDuration,\n srcs = [],\n transitionDuration = 500,\n onIndexChange,\n ...props\n}, ref) => {\n const [index, setIndex] = useState(externalIndex)\n\n useInterval(() => {\n setIndex((index + 1) % srcs.length)\n }, rotationDuration, undefined, [index])\n\n useEffect(() => {\n if (externalIndex === index) return\n setIndex(externalIndex)\n }, [externalIndex])\n\n useEffect(() => {\n onIndexChange?.(index)\n }, [index])\n\n const components = asComponentDict(children, {\n image: RotatingGalleryImage,\n })\n\n const fixedStyles = asStyleDict({\n image: {\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'cover',\n height: '100%',\n left: '0',\n position: 'absolute',\n top: '0',\n width: '100%',\n transitionDuration: `${transitionDuration}ms`,\n },\n })\n\n const defaultStyles = asStyleDict({\n image: {\n transitionProperty: 'opacity',\n transitionTimingFunction: 'ease-out',\n },\n })\n\n return (\n <div {...props} ref={ref}>\n <Each in={srcs}>\n {(src, idx) => (\n <Transition in={idx === index} timeout={transitionDuration}>\n {state => cloneStyledElement(components.image ?? <RotatingGalleryImage style={styles(\n defaultStyles.image,\n state === 'entering' && { opacity: '1' },\n state === 'exiting' && { opacity: '0' },\n )}/>, {\n className: classNames(state),\n style: styles(fixedStyles.image, {\n backgroundImage: `url(${src})`,\n }),\n })}\n </Transition>\n )}\n </Each>\n </div>\n )\n})\n\nexport const RotatingGalleryImage = ({ ...props }: HTMLAttributes<HTM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ad,CACI,CACH,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEK,IAAM,oBAAoB,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAA1F,QAAA,oBAAoB,wBAAsE","sourcesContent":["import classNames from 'classnames'\nimport React, { forwardRef, useEffect, useState, type HTMLAttributes, type PropsWithChildren } from 'react'\nimport { Transition } from 'react-transition-group'\nimport Each from './Each'\nimport useInterval from './hooks/useInterval'\nimport asComponentDict from './utils/asComponentDict'\nimport asStyleDict from './utils/asStyleDict'\nimport cloneStyledElement from './utils/cloneStyledElement'\nimport styles from './utils/styles'\n\nexport type RotatingGalleryProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{\n /**\n * Current image index. An error is thrown if the index is invalid (must be\n * between 0 and length of `srcs` - 1, inclusive). This prop supports two-way\n * binding.\n */\n index?: number\n\n /**\n * An array of image paths.\n */\n srcs?: string[]\n\n /**\n * The duration of one rotation in milliseconds (how long one image stays\n * before transitioning to the next). Specifying `NaN` or a negative number\n * will prevent the component from automatically rotating.\n */\n rotationDuration?: number\n\n /**\n * The duration of an image transition in milliseconds.\n */\n transitionDuration?: number\n\n /**\n * Handler invoked when the image index changes.\n *\n * @param index The current image index.\n */\n onIndexChange?: (index: number) => void\n}>\n\n/**\n * A component displaying rotating images.\n *\n * @exports RotatingGalleryImage Component for each rotating image, classes:\n * `entering`, `entered`, `exiting`, `exited`.\n */\nexport default forwardRef<HTMLDivElement, RotatingGalleryProps>(({\n children,\n index: externalIndex = 0,\n rotationDuration,\n srcs = [],\n transitionDuration = 500,\n onIndexChange,\n ...props\n}, ref) => {\n const [index, setIndex] = useState(externalIndex)\n\n useInterval(() => {\n setIndex((index + 1) % srcs.length)\n }, rotationDuration, undefined, [index])\n\n useEffect(() => {\n if (externalIndex === index) return\n setIndex(externalIndex)\n }, [externalIndex])\n\n useEffect(() => {\n onIndexChange?.(index)\n }, [index])\n\n const components = asComponentDict(children, {\n image: RotatingGalleryImage,\n })\n\n const fixedStyles = asStyleDict({\n image: {\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'cover',\n height: '100%',\n left: '0',\n position: 'absolute',\n top: '0',\n width: '100%',\n transitionDuration: `${transitionDuration}ms`,\n },\n })\n\n const defaultStyles = asStyleDict({\n image: {\n transitionProperty: 'opacity',\n transitionTimingFunction: 'ease-out',\n },\n })\n\n return (\n <div {...props} ref={ref}>\n <Each in={srcs}>\n {(src, idx) => (\n <Transition in={idx === index} timeout={transitionDuration}>\n {state => cloneStyledElement(components.image ?? <RotatingGalleryImage style={styles(\n defaultStyles.image,\n state === 'entering' && { opacity: '1' },\n state === 'exiting' && { opacity: '0' },\n )}/>, {\n className: classNames(state),\n style: styles(fixedStyles.image, {\n backgroundImage: `url(${src})`,\n }),\n })}\n </Transition>\n )}\n </Each>\n </div>\n )\n})\n\nexport const RotatingGalleryImage = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n"]}
@@ -1,4 +1,4 @@
1
- import React, { HTMLAttributes, ReactNode } from 'react';
1
+ import React, { type HTMLAttributes, type ReactNode } from 'react';
2
2
  export type SelectableButtonProps = Omit<HTMLAttributes<HTMLButtonElement>, 'children'> & {
3
3
  children?: (props: Pick<SelectableButtonProps, 'isDeselectable' | 'isDisabled' | 'isSelected' | 'label'>) => ReactNode;
4
4
  isDeselectable?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"SelectableButton.js","sourceRoot":"/","sources":["SelectableButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAyF;AAYzF,kBAAe,IAAA,kBAAU,EAA2C,UAAC,EASpE,EAAE,GAAG;;IARJ,IAAA,QAAQ,cAAA,EACR,sBAAsB,EAAtB,cAAc,mBAAG,KAAK,KAAA,EACtB,kBAAkB,EAAlB,UAAU,mBAAG,KAAK,KAAA,EAClB,kBAAsC,EAA1B,kBAAkB,mBAAG,KAAK,KAAA,EACtC,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,QAAQ,cAAA,EACL,KAAK,cAR2D,6FASpE,CADS;IAEF,IAAA,KAAA,OAA8B,IAAA,gBAAQ,EAAC,kBAAkB,CAAC,IAAA,EAAzD,UAAU,QAAA,EAAE,aAAa,QAAgC,CAAA;IAEhE,IAAM,eAAe,GAAG;QACtB,IAAI,UAAU;YAAE,OAAM;QAEtB,IAAI,UAAU,EAAE;YACd,IAAI,CAAC,cAAc;gBAAE,OAAM;YAC3B,aAAa,CAAC,KAAK,CAAC,CAAA;YACpB,UAAU,aAAV,UAAU,uBAAV,UAAU,EAAI,CAAA;SACf;aACI;YACH,aAAa,CAAC,IAAI,CAAC,CAAA;YACnB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,EAAI,CAAA;SACb;IACH,CAAC,CAAA;IAED,IAAA,iBAAS,EAAC;QACR,aAAa,CAAC,kBAAkB,CAAC,CAAA;IACnC,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAA;IAExB,OAAO,CACL,qDACM,KAAK,IACT,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,cAAM,OAAA,eAAe,EAAE,EAAjB,CAAiB,EAAE,QAAQ,EAAE,UAAU,IAAI,UAAU,IAAI,CAAC,cAAc,KAEtF,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,EAAE,cAAc,gBAAA,EAAE,UAAU,YAAA,EAAE,UAAU,YAAA,EAAE,KAAK,OAAA,EAAE,CAAC,mCAAI,KAAK,CAChE,CACV,CAAA;AACH,CAAC,CAAC,CAAA","sourcesContent":["import React, { forwardRef, HTMLAttributes, ReactNode, useEffect, useState } from 'react'\n\nexport type SelectableButtonProps = Omit<HTMLAttributes<HTMLButtonElement>, 'children'> & {\n children?: (props: Pick<SelectableButtonProps, 'isDeselectable' | 'isDisabled' | 'isSelected' | 'label'>) => ReactNode\n isDeselectable?: boolean\n isDisabled?: boolean\n isSelected?: boolean\n label?: string\n onDeselect?: () => void\n onSelect?: () => void\n}\n\nexport default forwardRef<HTMLButtonElement, SelectableButtonProps>(({\n children,\n isDeselectable = false,\n isDisabled = false,\n isSelected: externalIsSelected = false,\n label,\n onDeselect,\n onSelect,\n ...props\n}, ref) => {\n const [isSelected, setIsSelected] = useState(externalIsSelected)\n\n const toggleSelection = () => {\n if (isDisabled) return\n\n if (isSelected) {\n if (!isDeselectable) return\n setIsSelected(false)\n onDeselect?.()\n }\n else {\n setIsSelected(true)\n onSelect?.()\n }\n }\n\n useEffect(() => {\n setIsSelected(externalIsSelected)\n }, [externalIsSelected])\n\n return (\n <button\n {...props}\n ref={ref}\n onClick={() => toggleSelection()} disabled={isDisabled || isSelected && !isDeselectable}\n >\n {children?.({ isDeselectable, isDisabled, isSelected, label }) ?? label}\n </button>\n )\n})\n"]}
1
+ {"version":3,"file":"SelectableButton.js","sourceRoot":"/","sources":["SelectableButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAmG;AAYnG,kBAAe,IAAA,kBAAU,EAA2C,UAAC,EASpE,EAAE,GAAG;;IARJ,IAAA,QAAQ,cAAA,EACR,sBAAsB,EAAtB,cAAc,mBAAG,KAAK,KAAA,EACtB,kBAAkB,EAAlB,UAAU,mBAAG,KAAK,KAAA,EAClB,kBAAsC,EAA1B,kBAAkB,mBAAG,KAAK,KAAA,EACtC,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,QAAQ,cAAA,EACL,KAAK,cAR2D,6FASpE,CADS;IAEF,IAAA,KAAA,OAA8B,IAAA,gBAAQ,EAAC,kBAAkB,CAAC,IAAA,EAAzD,UAAU,QAAA,EAAE,aAAa,QAAgC,CAAA;IAEhE,IAAM,eAAe,GAAG;QACtB,IAAI,UAAU;YAAE,OAAM;QAEtB,IAAI,UAAU,EAAE;YACd,IAAI,CAAC,cAAc;gBAAE,OAAM;YAC3B,aAAa,CAAC,KAAK,CAAC,CAAA;YACpB,UAAU,aAAV,UAAU,uBAAV,UAAU,EAAI,CAAA;SACf;aACI;YACH,aAAa,CAAC,IAAI,CAAC,CAAA;YACnB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,EAAI,CAAA;SACb;IACH,CAAC,CAAA;IAED,IAAA,iBAAS,EAAC;QACR,aAAa,CAAC,kBAAkB,CAAC,CAAA;IACnC,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAA;IAExB,OAAO,CACL,qDACM,KAAK,IACT,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,cAAM,OAAA,eAAe,EAAE,EAAjB,CAAiB,EAAE,QAAQ,EAAE,UAAU,IAAI,UAAU,IAAI,CAAC,cAAc,KAEtF,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,EAAE,cAAc,gBAAA,EAAE,UAAU,YAAA,EAAE,UAAU,YAAA,EAAE,KAAK,OAAA,EAAE,CAAC,mCAAI,KAAK,CAChE,CACV,CAAA;AACH,CAAC,CAAC,CAAA","sourcesContent":["import React, { forwardRef, useEffect, useState, type HTMLAttributes, type ReactNode } from 'react'\n\nexport type SelectableButtonProps = Omit<HTMLAttributes<HTMLButtonElement>, 'children'> & {\n children?: (props: Pick<SelectableButtonProps, 'isDeselectable' | 'isDisabled' | 'isSelected' | 'label'>) => ReactNode\n isDeselectable?: boolean\n isDisabled?: boolean\n isSelected?: boolean\n label?: string\n onDeselect?: () => void\n onSelect?: () => void\n}\n\nexport default forwardRef<HTMLButtonElement, SelectableButtonProps>(({\n children,\n isDeselectable = false,\n isDisabled = false,\n isSelected: externalIsSelected = false,\n label,\n onDeselect,\n onSelect,\n ...props\n}, ref) => {\n const [isSelected, setIsSelected] = useState(externalIsSelected)\n\n const toggleSelection = () => {\n if (isDisabled) return\n\n if (isSelected) {\n if (!isDeselectable) return\n setIsSelected(false)\n onDeselect?.()\n }\n else {\n setIsSelected(true)\n onSelect?.()\n }\n }\n\n useEffect(() => {\n setIsSelected(externalIsSelected)\n }, [externalIsSelected])\n\n return (\n <button\n {...props}\n ref={ref}\n onClick={() => toggleSelection()} disabled={isDisabled || isSelected && !isDeselectable}\n >\n {children?.({ isDeselectable, isDisabled, isSelected, label }) ?? label}\n </button>\n )\n})\n"]}
package/lib/Slider.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React, { HTMLAttributes, PropsWithChildren } from 'react';
1
+ import React, { type HTMLAttributes, type PropsWithChildren } from 'react';
2
2
  type Orientation = 'horizontal' | 'vertical';
3
3
  export type SliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{
4
4
  /**
@@ -40,7 +40,7 @@ export type SliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{
40
40
  * A function that returns the label to be displayed at a given slider
41
41
  * position.
42
42
  *
43
- * @param position - The current slider position.
43
+ * @param position The current slider position.
44
44
  *
45
45
  * @returns The label.
46
46
  */
@@ -52,8 +52,8 @@ export type SliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{
52
52
  * `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is
53
53
  * still `true`.
54
54
  *
55
- * @param position - The current slider position.
56
- * @param isDragging - Specifies if the position change is due to dragging.
55
+ * @param position The current slider position.
56
+ * @param isDragging Specifies if the position change is due to dragging.
57
57
  */
58
58
  onPositionChange?: (position: number, isDragging: boolean) => void;
59
59
  /**
@@ -74,10 +74,10 @@ export type SliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{
74
74
  * width and height of the knob are set via props (`knobWidth` and `knobHeight`,
75
75
  * respectively). The size of the knob does not impact the size of the slider.
76
76
  *
77
- * @exports SliderKnob - The component for the knob.
78
- * @exports SliderLabel - The component for the label on the knob.
79
- * @exports SliderTrack - The component for the slide track on either side of
80
- * the knob.
77
+ * @exports SliderKnob The component for the knob.
78
+ * @exports SliderLabel The component for the label on the knob.
79
+ * @exports SliderTrack The component for the slide track on either side of the
80
+ * knob.
81
81
  */
82
82
  declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
83
83
  /**
@@ -119,7 +119,7 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
119
119
  * A function that returns the label to be displayed at a given slider
120
120
  * position.
121
121
  *
122
- * @param position - The current slider position.
122
+ * @param position The current slider position.
123
123
  *
124
124
  * @returns The label.
125
125
  */
@@ -131,8 +131,8 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
131
131
  * `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is
132
132
  * still `true`.
133
133
  *
134
- * @param position - The current slider position.
135
- * @param isDragging - Specifies if the position change is due to dragging.
134
+ * @param position The current slider position.
135
+ * @param isDragging Specifies if the position change is due to dragging.
136
136
  */
137
137
  onPositionChange?: ((position: number, isDragging: boolean) => void) | undefined;
138
138
  /**
package/lib/Slider.js CHANGED
@@ -83,10 +83,10 @@ var styles_1 = __importDefault(require("./utils/styles"));
83
83
  * width and height of the knob are set via props (`knobWidth` and `knobHeight`,
84
84
  * respectively). The size of the knob does not impact the size of the slider.
85
85
  *
86
- * @exports SliderKnob - The component for the knob.
87
- * @exports SliderLabel - The component for the label on the knob.
88
- * @exports SliderTrack - The component for the slide track on either side of
89
- * the knob.
86
+ * @exports SliderKnob The component for the knob.
87
+ * @exports SliderLabel The component for the label on the knob.
88
+ * @exports SliderTrack The component for the slide track on either side of the
89
+ * knob.
90
90
  */
91
91
  exports.default = (0, react_1.forwardRef)(function (_a, ref) {
92
92
  var _b, _c, _d, _e;
package/lib/Slider.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.js","sourceRoot":"/","sources":["Slider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,6CAA2G;AAC3G,+BAA4B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EAAE,IAAA,gBAAM,EAAC,WAAW,CAAC,IAAI,CAAC;aAChC,EAAE,aAAa,IAAI,IAAA,4BAAkB,EAAC,MAAA,UAAU,CAAC,KAAK,mCAAI,8BAAC,mBAAW,IAAC,KAAK,EAAE,aAAa,CAAC,KAAK,GAAG,EAAE;gBACrG,SAAS,EAAE,IAAA,oBAAU,EAAC,eAAe,CAAC,KAAK,CAAC;gBAC5C,KAAK,EAAE,IAAA,gBAAM,EAAC,WAAW,CAAC,KAAK,CAAC;aACjC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CACrB,CACL,CACF,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEK,IAAM,WAAW,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAAjF,QAAA,WAAW,eAAsE;AAEvF,IAAM,UAAU,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAAhF,QAAA,UAAU,cAAsE;AAEtF,IAAM,WAAW,GAAG,UAAC,EAA4C;QAAvC,KAAK,cAAV,EAAY,CAAF;IAAuC,OAAA,kDAAS,KAAK,EAAG,CAAA;CAAA,CAAA;AAAjF,QAAA,WAAW,eAAsE","sourcesContent":["import classNames from 'classnames'\nimport React, { forwardRef, HTMLAttributes, MouseEvent, PropsWithChildren, useEffect, useRef } from 'react'\nimport { Rect } from 'spase'\nimport useDragEffect from './hooks/useDragEffect'\nimport asClassNameDict from './utils/asClassNameDict'\nimport asComponentDict from './utils/asComponentDict'\nimport asStyleDict from './utils/asStyleDict'\nimport cloneStyledElement from './utils/cloneStyledElement'\nimport styles from './utils/styles'\n\ntype Orientation = 'horizontal' | 'vertical'\n\nexport type SliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{\n /**\n * By default the position is a value from 0 - 1, 0 being the start of the\n * slider and 1 being the end. Switching on this flag inverts this behavior,\n * where 0 becomes the end of the slider and 1 being the start.\n */\n isInverted?: boolean\n\n /**\n * Specifies if the track is clickable to set the position of the knob.\n */\n isTrackInteractive?: boolean\n\n /**\n * Indicates if position change events are dispatched only when dragging ends.\n * When disabled, aforementioned events are fired repeatedly while dragging.\n */\n onlyDispatchesOnDragEnd?: boolean\n\n /**\n * Padding between the track and the knob in pixels.\n */\n trackPadding?: number\n\n /**\n * Height of the knob in pixels.\n */\n knobHeight?: number\n\n /**\n * Width of the knob in pixels.\n */\n knobWidth?: number\n\n /**\n * Orientation of the slider.\n */\n orientation?: Orientation\n\n /**\n * The current position.\n */\n position?: number\n\n /**\n * A function that returns the label to be displayed at a given slider\n * position.\n *\n * @param position - The current slider position.\n *\n * @returns The label.\n */\n labelProvider?: (position: number) => string\n\n /**\n * Handler invoked when position changes. This can either be invoked from the\n * `position` prop being changed or from the slider being dragged. Note that\n * if the event is emitted at the end of dragging due to\n * `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is\n * still `true`.\n *\n * @param position - The current slider position.\n * @param isDragging - Specifies if the position change is due to dragging.\n */\n onPositionChange?: (position: number, isDragging: boolean) => void\n\n /**\n * Handler invoked when dragging ends.\n */\n onDragEnd?: () => void\n\n /**\n * Handler invoked when dragging begins.\n */\n onDragStart?: () => void\n}>\n\n/**\n * A slider component supporting both horizontal and vertical orientations whose\n * sliding position (a decimal between 0.0 and 1.0, inclusive) can be two-way\n * binded. The component consists of three customizable elements: a draggable\n * knob, a label on the knob, and a scroll track on either side of the knob.\n * While the width and height of the slider is inferred from its CSS rules, the\n * width and height of the knob are set via props (`knobWidth` and `knobHeight`,\n * respectively). The size of the knob does not impact the size of the slider.\n *\n * @exports SliderKnob - The component for the knob.\n * @exports SliderLabel - The component for the label on the knob.\n * @exports SliderTrack - The component for the slide track on either side of\n * the knob.\n */\nexport default forwardRef<HTMLDivElement, SliderProps>(({\n children,\n className,\n isInverted = false,\n isTrackInteractive = true,\n knobHeight = 30,\n knobWidth = 30,\n labelProvider,\n onlyDispatchesOnDragEnd = false,\n orientation = 'vertical',\n position: externalPosition = 0,\n trackPadding = 0,\n onDragEnd,\n onDragStart,\n onPositionChange,\n ...props\n}, ref) => {\n const mapDragValueToPosition = (value: number, dx: number, dy: number) => {\n const rect = Rect.from(bodyRef.current) ?? new Rect()\n const truePosition = isInverted ? 1 - value : value\n const trueNewPositionX = truePosition * rect.width + dx\n const trueNewPositionY = truePosition * rect.height + dy\n const trueNewPosition = orientation === 'vertical' ? Math.max(0, Math.min(1, trueNewPositionY / rect.height)) : Math.max(0, Math.min(1, trueNewPositionX / rect.width))\n const normalizedPosition = isInverted ? 1 - trueNewPosition : trueNewPosition\n\n return normalizedPosition\n }\n\n const trackClickHandler = (event: MouseEvent) => {\n if (!isTrackInteractive) return\n\n const rect = Rect.from(bodyRef.current) ?? new Rect()\n\n switch (orientation) {\n case 'horizontal': {\n const trackPosition = (event.clientX - rect.left) / rect.width\n const normalizedPosition = isInverted ? 1 - trackPosition : trackPosition\n setPosition(normalizedPosition)\n break\n }\n case 'vertical': {\n const trackPosition = (event.clientY - rect.top) / rect.height\n const normalizedPosition = isInverted ? 1 - trackPosition : trackPosition\n setPosition(normalizedPosition)\n break\n }\n default: break\n }\n }\n\n const bodyRef = useRef<HTMLDivElement>(null)\n const knobContainerRef = useRef<HTMLButtonElement>(null)\n\n const { isDragging: [isDragging], isReleasing: [isReleasing], value: [position, setPosition] } = useDragEffect(knobContainerRef, {\n initialValue: externalPosition,\n transform: mapDragValueToPosition,\n onDragStart,\n onDragEnd,\n })\n\n // Natural position is the position affecting internal components accounting\n // for `isInverted`.\n const naturalPosition = isInverted ? 1 - position : position\n const isAtEnd = isInverted ? position === 0 : position === 1\n const isAtStart = isInverted ? position === 1 : position === 0\n\n useEffect(() => {\n if (isDragging || externalPosition === position) return\n setPosition(externalPosition)\n }, [externalPosition])\n\n useEffect(() => {\n if (isDragging && onlyDispatchesOnDragEnd) return\n onPositionChange?.(position, isDragging)\n }, [position])\n\n useEffect(() => {\n if (isDragging || !onlyDispatchesOnDragEnd) return\n onPositionChange?.(position, true)\n }, [isDragging])\n\n const components = asComponentDict(children, {\n knob: SliderKnob,\n label: SliderLabel,\n track: SliderTrack,\n })\n\n const fixedClassNames = asClassNameDict({\n root: classNames(orientation, {\n 'at-end': isAtEnd,\n 'at-start': isAtStart,\n 'dragging': isDragging,\n 'releasing': isReleasing,\n }),\n track: classNames(orientation, {\n 'at-end': isAtEnd,\n 'at-start': isAtStart,\n 'dragging': isDragging,\n 'releasing': isReleasing,\n }),\n knob: classNames(orientation, {\n 'at-end': isAtEnd,\n 'at-start': isAtStart,\n 'dragging': isDragging,\n 'releasing': isReleasing,\n }),\n label: classNames(orientation, {\n 'at-end': isAtEnd,\n 'at-start': isAtStart,\n 'dragging': isDragging,\n 'releasing': isReleasing,\n }),\n })\n\n const fixedStyles = asStyleDict({\n body: {\n height: '100%',\n width: '100%',\n },\n knobContainer: {\n background: 'none',\n border: 'none',\n outline: 'none',\n position: 'absolute',\n transform: 'translate3d(-50%, -50%, 0)',\n zIndex: '1',\n ...orientation === 'vertical' ? {\n left: '50%',\n top: `${naturalPosition * 100}%`,\n transition: isDragging === false ? 'top 100ms ease-out' : 'none',\n } : {\n left: `${naturalPosition * 100}%`,\n top: '50%',\n transition: isDragging === false ? 'left 100ms ease-out' : 'none',\n },\n },\n knob: {\n height: `${knobHeight}px`,\n touchAction: 'none',\n width: `${knobWidth}px`,\n },\n label: {\n pointerEvents: 'none',\n userSelect: 'none',\n },\n track: {\n cursor: isTrackInteractive ? 'pointer' : 'auto',\n pointerEvents: isTrackInteractive ? 'auto' : 'none',\n position: 'absolute',\n ...orientation === 'vertical' ? {\n left: '0',\n margin: '0 auto',\n right: '0',\n width: '100%',\n } : {\n bottom: '0',\n height: '100%',\n margin: 'auto 0',\n top: '0',\n },\n },\n trackHitbox: {\n height: '100%',\n minHeight: '20px',\n minWidth: '20px',\n position: 'absolute',\n transform: orientation === 'horizontal' ? 'translate3d(0, -50%, 0)' : 'translate3d(-50%, 0, 0)',\n width: '100%',\n },\n })\n\n const defaultStyles = asStyleDict({\n knob: {\n alignItems: 'center',\n background: '#fff',\n boxSizing: 'border-box',\n display: 'flex',\n justifyContent: 'center',\n },\n label: {\n color: '#000',\n fontSize: '12px',\n lineHeight: `${knobHeight}px`,\n },\n track: {\n background: '#fff',\n },\n })\n\n return (\n <div {...props} ref={ref} className={classNames(className, fixedClassNames.root)}>\n <div ref={bodyRef} style={fixedStyles.body}>\n {cloneStyledElement(components.track ?? <SliderTrack style={defaultStyles.track}/>, {\n className: classNames('start', fixedClassNames.track),\n style: styles(fixedStyles.track, orientation === 'vertical' ? {\n height: `calc(${naturalPosition * 100}% - ${trackPadding <= 0 ? 0 : knobHeight * 0.5}px - ${trackPadding}px)`,\n top: '0',\n } : {\n left: '0',\n width: `calc(${naturalPosition * 100}% - ${trackPadding <= 0 ? 0 : knobWidth * 0.5}px - ${trackPadding}px)`,\n }),\n onClick: trackClickHandler,\n }, <div style={fixedStyles.trackHitbox}/>)}\n {cloneStyledElement(components.track ?? <SliderTrack style={defaultStyles.track}/>, {\n className: classNames('end', fixedClassNames.track),\n style: styles(fixedStyles.track, orientation === 'vertical' ? {\n bottom: '0',\n height: `calc(${(1 - naturalPosition) * 100}% - ${trackPadding <= 0 ? 0 : knobHeight * 0.5}px - ${trackPadding}px)`,\n } : {\n right: '0',\n width: `calc(${(1 - naturalPosition) * 100}% - ${trackPadding <= 0 ? 0 : knobWidth * 0.5}px - ${trackPadding}px)`,\n }),\n onClick: trackClickHandler,\n }, <div style={fixedStyles.trackHitbox}/>)}\n <button ref={knobContainerRef} style={fixedStyles.knobContainer}>\n {cloneStyledElement(components.knob ?? <SliderKnob style={defaultStyles.knob}/>, {\n className: classNames(fixedClassNames.knob),\n style: styles(fixedStyles.knob),\n }, labelProvider && cloneStyledElement(components.label ?? <SliderLabel style={defaultStyles.label}/>, {\n className: classNames(fixedClassNames.label),\n style: styles(fixedStyles.label),\n }, labelProvider(position)))}\n </button>\n </div>\n </div>\n )\n})\n\nexport const SliderTrack = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const SliderKnob = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const SliderLabel = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n"]}
1
+ {"version":3,"file":"Slider.js","sourceRoot":"/","sources":["Slider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,6CAA0H;AAC1H,+BAA4B;AAC5B,wEAAiD;AACjD,4EAAqD;AACrD,4EAAqD;AACrD,oEAA6C;AAC7C,kFAA2D;AAC3D,0DAAmC;AAiFnC;;;;;;;;;;;;;GAaG;AACH,kBAAe,IAAA,kBAAU,EAA8B,UAAC,EAgBvD,EAAE,GAAG;;IAfJ,IAAA,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,kBAAkB,EAAlB,UAAU,mBAAG,KAAK,KAAA,EAClB,0BAAyB,EAAzB,kBAAkB,mBAAG,IAAI,KAAA,EACzB,kBAAe,EAAf,UAAU,mBAAG,EAAE,KAAA,EACf,iBAAc,EAAd,SAAS,mBAAG,EAAE,KAAA,EACd,aAAa,mBAAA,EACb,+BAA+B,EAA/B,uBAAuB,mBAAG,KAAK,KAAA,EAC/B,mBAAwB,EAAxB,WAAW,mBAAG,UAAU,KAAA,EACxB,gBAA8B,EAApB,gBAAgB,mBAAG,CAAC,KAAA,EAC9B,oBAAgB,EAAhB,YAAY,mBAAG,CAAC,KAAA,EAChB,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,gBAAgB,sBAAA,EACb,KAAK,cAf8C,+NAgBvD,CADS;IAER,IAAM,sBAAsB,GAAG,UAAC,KAAa,EAAE,EAAU,EAAE,EAAU;;QACnE,IAAM,IAAI,GAAG,MA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KAAK,EAAG,CAAA;CAAA,CAAA;AAAjF,QAAA,WAAW,eAAsE","sourcesContent":["import classNames from 'classnames'\nimport React, { forwardRef, useEffect, useRef, type HTMLAttributes, type MouseEvent, type PropsWithChildren } from 'react'\nimport { Rect } from 'spase'\nimport useDragEffect from './hooks/useDragEffect'\nimport asClassNameDict from './utils/asClassNameDict'\nimport asComponentDict from './utils/asComponentDict'\nimport asStyleDict from './utils/asStyleDict'\nimport cloneStyledElement from './utils/cloneStyledElement'\nimport styles from './utils/styles'\n\ntype Orientation = 'horizontal' | 'vertical'\n\nexport type SliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{\n /**\n * By default the position is a value from 0 - 1, 0 being the start of the\n * slider and 1 being the end. Switching on this flag inverts this behavior,\n * where 0 becomes the end of the slider and 1 being the start.\n */\n isInverted?: boolean\n\n /**\n * Specifies if the track is clickable to set the position of the knob.\n */\n isTrackInteractive?: boolean\n\n /**\n * Indicates if position change events are dispatched only when dragging ends.\n * When disabled, aforementioned events are fired repeatedly while dragging.\n */\n onlyDispatchesOnDragEnd?: boolean\n\n /**\n * Padding between the track and the knob in pixels.\n */\n trackPadding?: number\n\n /**\n * Height of the knob in pixels.\n */\n knobHeight?: number\n\n /**\n * Width of the knob in pixels.\n */\n knobWidth?: number\n\n /**\n * Orientation of the slider.\n */\n orientation?: Orientation\n\n /**\n * The current position.\n */\n position?: number\n\n /**\n * A function that returns the label to be displayed at a given slider\n * position.\n *\n * @param position The current slider position.\n *\n * @returns The label.\n */\n labelProvider?: (position: number) => string\n\n /**\n * Handler invoked when position changes. This can either be invoked from the\n * `position` prop being changed or from the slider being dragged. Note that\n * if the event is emitted at the end of dragging due to\n * `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is\n * still `true`.\n *\n * @param position The current slider position.\n * @param isDragging Specifies if the position change is due to dragging.\n */\n onPositionChange?: (position: number, isDragging: boolean) => void\n\n /**\n * Handler invoked when dragging ends.\n */\n onDragEnd?: () => void\n\n /**\n * Handler invoked when dragging begins.\n */\n onDragStart?: () => void\n}>\n\n/**\n * A slider component supporting both horizontal and vertical orientations whose\n * sliding position (a decimal between 0.0 and 1.0, inclusive) can be two-way\n * binded. The component consists of three customizable elements: a draggable\n * knob, a label on the knob, and a scroll track on either side of the knob.\n * While the width and height of the slider is inferred from its CSS rules, the\n * width and height of the knob are set via props (`knobWidth` and `knobHeight`,\n * respectively). The size of the knob does not impact the size of the slider.\n *\n * @exports SliderKnob The component for the knob.\n * @exports SliderLabel The component for the label on the knob.\n * @exports SliderTrack The component for the slide track on either side of the\n * knob.\n */\nexport default forwardRef<HTMLDivElement, SliderProps>(({\n children,\n className,\n isInverted = false,\n isTrackInteractive = true,\n knobHeight = 30,\n knobWidth = 30,\n labelProvider,\n onlyDispatchesOnDragEnd = false,\n orientation = 'vertical',\n position: externalPosition = 0,\n trackPadding = 0,\n onDragEnd,\n onDragStart,\n onPositionChange,\n ...props\n}, ref) => {\n const mapDragValueToPosition = (value: number, dx: number, dy: number) => {\n const rect = Rect.from(bodyRef.current) ?? new Rect()\n const truePosition = isInverted ? 1 - value : value\n const trueNewPositionX = truePosition * rect.width + dx\n const trueNewPositionY = truePosition * rect.height + dy\n const trueNewPosition = orientation === 'vertical' ? Math.max(0, Math.min(1, trueNewPositionY / rect.height)) : Math.max(0, Math.min(1, trueNewPositionX / rect.width))\n const normalizedPosition = isInverted ? 1 - trueNewPosition : trueNewPosition\n\n return normalizedPosition\n }\n\n const trackClickHandler = (event: MouseEvent) => {\n if (!isTrackInteractive) return\n\n const rect = Rect.from(bodyRef.current) ?? new Rect()\n\n switch (orientation) {\n case 'horizontal': {\n const trackPosition = (event.clientX - rect.left) / rect.width\n const normalizedPosition = isInverted ? 1 - trackPosition : trackPosition\n setPosition(normalizedPosition)\n break\n }\n case 'vertical': {\n const trackPosition = (event.clientY - rect.top) / rect.height\n const normalizedPosition = isInverted ? 1 - trackPosition : trackPosition\n setPosition(normalizedPosition)\n break\n }\n default: break\n }\n }\n\n const bodyRef = useRef<HTMLDivElement>(null)\n const knobContainerRef = useRef<HTMLButtonElement>(null)\n\n const { isDragging: [isDragging], isReleasing: [isReleasing], value: [position, setPosition] } = useDragEffect(knobContainerRef, {\n initialValue: externalPosition,\n transform: mapDragValueToPosition,\n onDragStart,\n onDragEnd,\n })\n\n // Natural position is the position affecting internal components accounting\n // for `isInverted`.\n const naturalPosition = isInverted ? 1 - position : position\n const isAtEnd = isInverted ? position === 0 : position === 1\n const isAtStart = isInverted ? position === 1 : position === 0\n\n useEffect(() => {\n if (isDragging || externalPosition === position) return\n setPosition(externalPosition)\n }, [externalPosition])\n\n useEffect(() => {\n if (isDragging && onlyDispatchesOnDragEnd) return\n onPositionChange?.(position, isDragging)\n }, [position])\n\n useEffect(() => {\n if (isDragging || !onlyDispatchesOnDragEnd) return\n onPositionChange?.(position, true)\n }, [isDragging])\n\n const components = asComponentDict(children, {\n knob: SliderKnob,\n label: SliderLabel,\n track: SliderTrack,\n })\n\n const fixedClassNames = asClassNameDict({\n root: classNames(orientation, {\n 'at-end': isAtEnd,\n 'at-start': isAtStart,\n 'dragging': isDragging,\n 'releasing': isReleasing,\n }),\n track: classNames(orientation, {\n 'at-end': isAtEnd,\n 'at-start': isAtStart,\n 'dragging': isDragging,\n 'releasing': isReleasing,\n }),\n knob: classNames(orientation, {\n 'at-end': isAtEnd,\n 'at-start': isAtStart,\n 'dragging': isDragging,\n 'releasing': isReleasing,\n }),\n label: classNames(orientation, {\n 'at-end': isAtEnd,\n 'at-start': isAtStart,\n 'dragging': isDragging,\n 'releasing': isReleasing,\n }),\n })\n\n const fixedStyles = asStyleDict({\n body: {\n height: '100%',\n width: '100%',\n },\n knobContainer: {\n background: 'none',\n border: 'none',\n outline: 'none',\n position: 'absolute',\n transform: 'translate3d(-50%, -50%, 0)',\n zIndex: '1',\n ...orientation === 'vertical' ? {\n left: '50%',\n top: `${naturalPosition * 100}%`,\n transition: isDragging === false ? 'top 100ms ease-out' : 'none',\n } : {\n left: `${naturalPosition * 100}%`,\n top: '50%',\n transition: isDragging === false ? 'left 100ms ease-out' : 'none',\n },\n },\n knob: {\n height: `${knobHeight}px`,\n touchAction: 'none',\n width: `${knobWidth}px`,\n },\n label: {\n pointerEvents: 'none',\n userSelect: 'none',\n },\n track: {\n cursor: isTrackInteractive ? 'pointer' : 'auto',\n pointerEvents: isTrackInteractive ? 'auto' : 'none',\n position: 'absolute',\n ...orientation === 'vertical' ? {\n left: '0',\n margin: '0 auto',\n right: '0',\n width: '100%',\n } : {\n bottom: '0',\n height: '100%',\n margin: 'auto 0',\n top: '0',\n },\n },\n trackHitbox: {\n height: '100%',\n minHeight: '20px',\n minWidth: '20px',\n position: 'absolute',\n transform: orientation === 'horizontal' ? 'translate3d(0, -50%, 0)' : 'translate3d(-50%, 0, 0)',\n width: '100%',\n },\n })\n\n const defaultStyles = asStyleDict({\n knob: {\n alignItems: 'center',\n background: '#fff',\n boxSizing: 'border-box',\n display: 'flex',\n justifyContent: 'center',\n },\n label: {\n color: '#000',\n fontSize: '12px',\n lineHeight: `${knobHeight}px`,\n },\n track: {\n background: '#fff',\n },\n })\n\n return (\n <div {...props} ref={ref} className={classNames(className, fixedClassNames.root)}>\n <div ref={bodyRef} style={fixedStyles.body}>\n {cloneStyledElement(components.track ?? <SliderTrack style={defaultStyles.track}/>, {\n className: classNames('start', fixedClassNames.track),\n style: styles(fixedStyles.track, orientation === 'vertical' ? {\n height: `calc(${naturalPosition * 100}% - ${trackPadding <= 0 ? 0 : knobHeight * 0.5}px - ${trackPadding}px)`,\n top: '0',\n } : {\n left: '0',\n width: `calc(${naturalPosition * 100}% - ${trackPadding <= 0 ? 0 : knobWidth * 0.5}px - ${trackPadding}px)`,\n }),\n onClick: trackClickHandler,\n }, <div style={fixedStyles.trackHitbox}/>)}\n {cloneStyledElement(components.track ?? <SliderTrack style={defaultStyles.track}/>, {\n className: classNames('end', fixedClassNames.track),\n style: styles(fixedStyles.track, orientation === 'vertical' ? {\n bottom: '0',\n height: `calc(${(1 - naturalPosition) * 100}% - ${trackPadding <= 0 ? 0 : knobHeight * 0.5}px - ${trackPadding}px)`,\n } : {\n right: '0',\n width: `calc(${(1 - naturalPosition) * 100}% - ${trackPadding <= 0 ? 0 : knobWidth * 0.5}px - ${trackPadding}px)`,\n }),\n onClick: trackClickHandler,\n }, <div style={fixedStyles.trackHitbox}/>)}\n <button ref={knobContainerRef} style={fixedStyles.knobContainer}>\n {cloneStyledElement(components.knob ?? <SliderKnob style={defaultStyles.knob}/>, {\n className: classNames(fixedClassNames.knob),\n style: styles(fixedStyles.knob),\n }, labelProvider && cloneStyledElement(components.label ?? <SliderLabel style={defaultStyles.label}/>, {\n className: classNames(fixedClassNames.label),\n style: styles(fixedStyles.label),\n }, labelProvider(position)))}\n </button>\n </div>\n </div>\n )\n})\n\nexport const SliderTrack = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const SliderKnob = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n\nexport const SliderLabel = ({ ...props }: HTMLAttributes<HTMLDivElement>) => <div {...props}/>\n"]}
@@ -1,4 +1,4 @@
1
- import React, { HTMLAttributes, PropsWithChildren } from 'react';
1
+ import React, { type HTMLAttributes, type PropsWithChildren } from 'react';
2
2
  type Orientation = 'horizontal' | 'vertical';
3
3
  export type StepwiseSliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{
4
4
  /**
@@ -48,8 +48,8 @@ export type StepwiseSliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChil
48
48
  * A function that returns the label to be displayed at a given slider
49
49
  * position and closest step index (if steps are provided).
50
50
  *
51
- * @param position - The current slider position.
52
- * @param index - The nearest step index (if steps are provided), or -1 if no
51
+ * @param position The current slider position.
52
+ * @param index The nearest step index (if steps are provided), or -1 if no
53
53
  * steps are provided.
54
54
  *
55
55
  * @returns The label.
@@ -62,8 +62,8 @@ export type StepwiseSliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChil
62
62
  * `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is
63
63
  * still `true`. This event is emitted right after `onPositionChange`.
64
64
  *
65
- * @param index - The current slider index.
66
- * @param isDragging - Specifies if the index change is due to dragging.
65
+ * @param index The current slider index.
66
+ * @param isDragging Specifies if the index change is due to dragging.
67
67
  */
68
68
  onIndexChange?: (index: number, isDragging: boolean) => void;
69
69
  /**
@@ -73,8 +73,8 @@ export type StepwiseSliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChil
73
73
  * `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is
74
74
  * still `true`. This event is emitted right before `onIndexChange`.
75
75
  *
76
- * @param position - The current slider position.
77
- * @param isDragging - Specifies if the position change is due to dragging.
76
+ * @param position The current slider position.
77
+ * @param isDragging Specifies if the position change is due to dragging.
78
78
  */
79
79
  onPositionChange?: (position: number, isDragging: boolean) => void;
80
80
  /**
@@ -99,10 +99,10 @@ export type StepwiseSliderProps = HTMLAttributes<HTMLDivElement> & PropsWithChil
99
99
  * the slider. While dragging, the slider still emits a position change event,
100
100
  * where the position is a decimal ranging between 0.0 and 1.0, inclusive.
101
101
  *
102
- * @exports StepwiseSliderKnob - The component for the knob.
103
- * @exports StepwiseSliderLabel - The component for the label on the knob.
104
- * @exports StepwiseSliderTrack - The component for the slide track on either
105
- * side of the knob.
102
+ * @exports StepwiseSliderKnob The component for the knob.
103
+ * @exports StepwiseSliderLabel The component for the label on the knob.
104
+ * @exports StepwiseSliderTrack The component for the slide track on either side
105
+ * of the knob.
106
106
  */
107
107
  declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
108
108
  /**
@@ -152,8 +152,8 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
152
152
  * A function that returns the label to be displayed at a given slider
153
153
  * position and closest step index (if steps are provided).
154
154
  *
155
- * @param position - The current slider position.
156
- * @param index - The nearest step index (if steps are provided), or -1 if no
155
+ * @param position The current slider position.
156
+ * @param index The nearest step index (if steps are provided), or -1 if no
157
157
  * steps are provided.
158
158
  *
159
159
  * @returns The label.
@@ -166,8 +166,8 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
166
166
  * `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is
167
167
  * still `true`. This event is emitted right after `onPositionChange`.
168
168
  *
169
- * @param index - The current slider index.
170
- * @param isDragging - Specifies if the index change is due to dragging.
169
+ * @param index The current slider index.
170
+ * @param isDragging Specifies if the index change is due to dragging.
171
171
  */
172
172
  onIndexChange?: ((index: number, isDragging: boolean) => void) | undefined;
173
173
  /**
@@ -177,8 +177,8 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
177
177
  * `onlyDispatchesOnDragEnd` set to `true`, the `isDragging` parameter here is
178
178
  * still `true`. This event is emitted right before `onIndexChange`.
179
179
  *
180
- * @param position - The current slider position.
181
- * @param isDragging - Specifies if the position change is due to dragging.
180
+ * @param position The current slider position.
181
+ * @param isDragging Specifies if the position change is due to dragging.
182
182
  */
183
183
  onPositionChange?: ((position: number, isDragging: boolean) => void) | undefined;
184
184
  /**
@@ -199,7 +199,7 @@ export declare const StepwiseSliderLabel: ({ ...props }: HTMLAttributes<HTMLDivE
199
199
  /**
200
200
  * Generates a set of steps compatible with this component.
201
201
  *
202
- * @param length - The number of steps. This must be at least 2 because you must
202
+ * @param length The number of steps. This must be at least 2 because you must
203
203
  * include the starting and ending points.
204
204
  *
205
205
  * @returns An array of steps.