@toptal/picasso-slider 4.0.6-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.10 → 4.0.6-alpha-1757603192867.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 (55) hide show
  1. package/package.json +13 -13
  2. package/src/Slider/Slider.tsx +12 -1
  3. package/LICENSE +0 -20
  4. package/dist-package/src/Slider/Slider.d.ts +0 -47
  5. package/dist-package/src/Slider/Slider.d.ts.map +0 -1
  6. package/dist-package/src/Slider/Slider.js +0 -70
  7. package/dist-package/src/Slider/Slider.js.map +0 -1
  8. package/dist-package/src/Slider/hooks/index.d.ts +0 -2
  9. package/dist-package/src/Slider/hooks/index.d.ts.map +0 -1
  10. package/dist-package/src/Slider/hooks/index.js +0 -2
  11. package/dist-package/src/Slider/hooks/index.js.map +0 -1
  12. package/dist-package/src/Slider/hooks/use-label-overlap.d.ts +0 -9
  13. package/dist-package/src/Slider/hooks/use-label-overlap.d.ts.map +0 -1
  14. package/dist-package/src/Slider/hooks/use-label-overlap.js +0 -41
  15. package/dist-package/src/Slider/hooks/use-label-overlap.js.map +0 -1
  16. package/dist-package/src/Slider/index.d.ts +0 -5
  17. package/dist-package/src/Slider/index.d.ts.map +0 -1
  18. package/dist-package/src/Slider/index.js +0 -2
  19. package/dist-package/src/Slider/index.js.map +0 -1
  20. package/dist-package/src/SliderMark/SliderMark.d.ts +0 -13
  21. package/dist-package/src/SliderMark/SliderMark.d.ts.map +0 -1
  22. package/dist-package/src/SliderMark/SliderMark.js +0 -10
  23. package/dist-package/src/SliderMark/SliderMark.js.map +0 -1
  24. package/dist-package/src/SliderMark/index.d.ts +0 -2
  25. package/dist-package/src/SliderMark/index.d.ts.map +0 -1
  26. package/dist-package/src/SliderMark/index.js +0 -2
  27. package/dist-package/src/SliderMark/index.js.map +0 -1
  28. package/dist-package/src/SliderValueLabel/SliderValueLabel.d.ts +0 -12
  29. package/dist-package/src/SliderValueLabel/SliderValueLabel.d.ts.map +0 -1
  30. package/dist-package/src/SliderValueLabel/SliderValueLabel.js +0 -44
  31. package/dist-package/src/SliderValueLabel/SliderValueLabel.js.map +0 -1
  32. package/dist-package/src/SliderValueLabel/index.d.ts +0 -2
  33. package/dist-package/src/SliderValueLabel/index.d.ts.map +0 -1
  34. package/dist-package/src/SliderValueLabel/index.js +0 -2
  35. package/dist-package/src/SliderValueLabel/index.js.map +0 -1
  36. package/dist-package/src/index.d.ts +0 -2
  37. package/dist-package/src/index.d.ts.map +0 -1
  38. package/dist-package/src/index.js +0 -2
  39. package/dist-package/src/index.js.map +0 -1
  40. package/dist-package/src/utils/check-bg-color.d.ts +0 -7
  41. package/dist-package/src/utils/check-bg-color.d.ts.map +0 -1
  42. package/dist-package/src/utils/check-bg-color.js +0 -15
  43. package/dist-package/src/utils/check-bg-color.js.map +0 -1
  44. package/dist-package/src/utils/check-overlap.d.ts +0 -26
  45. package/dist-package/src/utils/check-overlap.d.ts.map +0 -1
  46. package/dist-package/src/utils/check-overlap.js +0 -32
  47. package/dist-package/src/utils/check-overlap.js.map +0 -1
  48. package/dist-package/src/utils/get-x-placement.d.ts +0 -8
  49. package/dist-package/src/utils/get-x-placement.d.ts.map +0 -1
  50. package/dist-package/src/utils/get-x-placement.js +0 -17
  51. package/dist-package/src/utils/get-x-placement.js.map +0 -1
  52. package/dist-package/src/utils/index.d.ts +0 -4
  53. package/dist-package/src/utils/index.d.ts.map +0 -1
  54. package/dist-package/src/utils/index.js +0 -4
  55. package/dist-package/src/utils/index.js.map +0 -1
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@toptal/picasso-slider",
3
- "version": "4.0.6-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.10+7db07b500",
3
+ "version": "4.0.6-alpha-1757603192867.0",
4
4
  "description": "Toptal UI components library - Slider",
5
5
  "publishConfig": {
6
- "access": "public"
6
+ "access": "public",
7
+ "provenance": true
7
8
  },
8
9
  "main": "./dist-package/src/index.js",
9
10
  "module": "./dist-package/src/index.js",
10
11
  "scripts": {
11
12
  "build:package": "tsc -b tsconfig.json",
12
- "prepublishOnly": "yarn build:package"
13
+ "prepublishOnly": "echo 0"
13
14
  },
14
15
  "repository": {
15
16
  "type": "git",
@@ -23,28 +24,27 @@
23
24
  "homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
24
25
  "dependencies": {
25
26
  "@mui/base": "5.0.0-beta.58",
26
- "@toptal/picasso-shared": "15.0.1-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.377+7db07b500",
27
- "@toptal/picasso-tooltip": "2.0.4-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.10+7db07b500",
28
- "@toptal/picasso-utils": "3.1.1-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.31+7db07b500"
27
+ "@toptal/picasso-shared": "15.0.1-alpha-1757603192867.0",
28
+ "@toptal/picasso-tooltip": "2.0.4-alpha-1757603192867.0",
29
+ "@toptal/picasso-utils": "3.1.1-alpha-1757603192867.0"
29
30
  },
30
31
  "sideEffects": false,
31
32
  "peerDependencies": {
32
- "@toptal/picasso-provider": "*",
33
- "@toptal/picasso-tailwind": ">2.1.0",
34
- "@toptal/picasso-tailwind-merge": "^2.0.0",
33
+ "@toptal/picasso-tailwind-merge": "2.0.4-alpha-1757603192867.0",
34
+ "@toptal/picasso-provider": "5.0.2-alpha-1757603192867.0",
35
+ "@toptal/picasso-tailwind": "3.0.1-alpha-1757603192867.0",
35
36
  "react": ">=16.12.0 < 19.0.0"
36
37
  },
37
38
  "exports": {
38
39
  ".": "./dist-package/src/index.js"
39
40
  },
40
41
  "devDependencies": {
41
- "@toptal/picasso-provider": "5.0.2-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.10+7db07b500",
42
- "@toptal/picasso-tailwind-merge": "2.0.4-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.31+7db07b500"
42
+ "@toptal/picasso-tailwind-merge": "2.0.4-alpha-1757603192867.0",
43
+ "@toptal/picasso-provider": "5.0.2-alpha-1757603192867.0"
43
44
  },
44
45
  "files": [
45
46
  "dist-package/**",
46
47
  "!dist-package/tsconfig.tsbuildinfo",
47
48
  "src"
48
- ],
49
- "gitHead": "7db07b500402a91f0c09da3be294305a194fd1e4"
49
+ ]
50
50
  }
@@ -57,12 +57,16 @@ export interface Props extends BaseProps {
57
57
  }
58
58
 
59
59
  export const Slider = forwardRef<HTMLElement, Props>(function Slider(
60
- { defaultValue = 0, min = 0, max = 100, tooltip = 'off', ...props },
60
+ props,
61
61
  ref
62
62
  ) {
63
63
  const {
64
+ min,
65
+ max,
64
66
  marks,
65
67
  value,
68
+ defaultValue = 0,
69
+ tooltip = 'off',
66
70
  tooltipFormat,
67
71
  step,
68
72
  disabled,
@@ -167,4 +171,11 @@ export const Slider = forwardRef<HTMLElement, Props>(function Slider(
167
171
 
168
172
  Slider.displayName = 'Slider'
169
173
 
174
+ Slider.defaultProps = {
175
+ defaultValue: 0,
176
+ min: 0,
177
+ max: 100,
178
+ tooltip: 'off',
179
+ }
180
+
170
181
  export default Slider
package/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021-2022 Toptal, LLC
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the “Software”), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,47 +0,0 @@
1
- import React from 'react';
2
- import type { BaseProps } from '@toptal/picasso-shared';
3
- export interface Props extends BaseProps {
4
- /** Minimum slider value */
5
- min?: number;
6
- /** Maximum slider value */
7
- max?: number;
8
- /** Controlled value of the component */
9
- value?: number | number[];
10
- /** The default value. Use when the component is not controlled */
11
- defaultValue?: number | number[];
12
- /** Step for the thumb movement */
13
- step?: number;
14
- /** Whether marks are shown or not */
15
- marks?: boolean;
16
- /** Whether component is disabled or not */
17
- disabled?: boolean;
18
- /** Controls when tooltip is displayed:
19
- - **auto** the value tooltip will display when the thumb is hovered or focused.
20
- - **on** will display persistently.
21
- - **off** will never display
22
- */
23
- tooltip?: 'on' | 'auto' | 'off';
24
- /** The format function the value tooltip's value. */
25
- tooltipFormat?: string | ((value: number, index: number) => React.ReactNode);
26
- /** Callback invoked when slider changes its state. */
27
- onChange?: (event: Event, value: number | number[], activeThumb: number) => void;
28
- /** Callback invoked on focus */
29
- onFocus?: (event: React.FocusEvent<HTMLElement>) => void;
30
- /** Callback invoked on blur */
31
- onBlur?: (event: React.FocusEvent<HTMLElement>) => void;
32
- /** Hide thumb when value is undefined or null. Works only when the component is controlled. */
33
- hideThumbOnEmpty?: boolean;
34
- /** Disable track highlight. */
35
- disableTrackHighlight?: boolean;
36
- /**
37
- * Name attribute of the `input` element.
38
- */
39
- name?: string;
40
- /**
41
- * Id attribute of the `input` element.
42
- */
43
- id?: string;
44
- }
45
- export declare const Slider: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLElement>>;
46
- export default Slider;
47
- //# sourceMappingURL=Slider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../../src/Slider/Slider.tsx"],"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IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,eAAO,MAAM,MAAM,2EA2GjB,CAAA;AAIF,eAAe,MAAM,CAAA"}
@@ -1,70 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- // import type { ComponentProps } from 'react'
13
- import React, { forwardRef, useRef } from 'react';
14
- import { Slider as MUIBaseSlider } from '@mui/base/Slider';
15
- import { useCombinedRefs, useOnScreen } from '@toptal/picasso-utils';
16
- import { twJoin, twMerge } from '@toptal/picasso-tailwind-merge';
17
- import SliderMark from '../SliderMark';
18
- import SliderValueLabel from '../SliderValueLabel';
19
- import { useLabelOverlap } from './hooks';
20
- export const Slider = forwardRef(function Slider(_a, ref) {
21
- var { defaultValue = 0, min = 0, max = 100, tooltip = 'off' } = _a, props = __rest(_a, ["defaultValue", "min", "max", "tooltip"]);
22
- const { marks, value, tooltipFormat, step, disabled, onChange, onBlur, onFocus, hideThumbOnEmpty, disableTrackHighlight, className, style, name, id, 'data-private': dataPrivate, 'data-testid': dataTestid, } = props;
23
- const containerRef = useRef(null);
24
- const sliderRef = useCombinedRefs(ref, useRef(null));
25
- // The rootMargin is not working correctly in the storybooks iframe
26
- // To test properly we can open the iframe in new window
27
- const { isOnScreen, isObserved } = useOnScreen({
28
- ref: containerRef,
29
- rootMargin: '-24px 0px 0px 0px',
30
- threshold: 1,
31
- });
32
- const { isPartiallyOverlapped, handleValueLabelOnRender } = useLabelOverlap({
33
- value,
34
- // until IntersectionObserver starts observing the element, we don't render the tooltip
35
- isTooltipRendered: isObserved,
36
- });
37
- const isThumbHidden = hideThumbOnEmpty && (typeof value === 'undefined' || value === null);
38
- return (React.createElement("div", { ref: containerRef, className: twMerge('my-[6px] mx-0', className), style: style },
39
- React.createElement(MUIBaseSlider, { ref: sliderRef, defaultValue: defaultValue, value: value, min: min, max: max, step: step, marks: marks, disabled: disabled, "data-testid": dataTestid, "data-private": dataPrivate, onFocus: onFocus, onBlur: onBlur, name: name, id: id, slots: {
40
- mark: SliderMark,
41
- valueLabel: SliderValueLabel,
42
- }, slotProps: {
43
- mark: {
44
- // @ts-expect-error we have custom Mark component, where we extend props and MUI does not understand it
45
- forceInactive: disableTrackHighlight,
46
- },
47
- root: {
48
- className: 'block cursor-pointer width-full relative py-[6px] -my-[6px]',
49
- },
50
- rail: {
51
- className: 'block absolute w-full h-[1px] opacity-[0.24] rounded-none bg-gray-500',
52
- },
53
- thumb: {
54
- className: twJoin('group/thumb flex justify-center items-center w-[15px] h-[15px]', 'rounded-[50%] bg-blue-500 border-[2px] border-solid border-white', '-mt-[7px] -ml-[6px] outline-0 absolute transition-shadow cursor-pointer', isThumbHidden && 'hidden'),
55
- role: 'slider',
56
- },
57
- track: {
58
- className: twJoin('block absolute h-[1px]', disableTrackHighlight ? 'bg-gray-200' : 'bg-blue-500'),
59
- },
60
- valueLabel: {
61
- tooltip: isObserved ? tooltip : 'off',
62
- onRender: handleValueLabelOnRender,
63
- yPlacement: isOnScreen ? 'top' : 'bottom',
64
- isOverlaped: isPartiallyOverlapped,
65
- },
66
- }, valueLabelFormat: tooltipFormat, onChange: onChange })));
67
- });
68
- Slider.displayName = 'Slider';
69
- export default Slider;
70
- //# sourceMappingURL=Slider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../src/Slider/Slider.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,8CAA8C;AAC9C,OAAO,KAAK,EA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AAC,OAAO,CAAC,CAAC,CAAC,KAAK;oBACrC,QAAQ,EAAE,wBAAwB;oBAClC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ;oBACzC,WAAW,EAAE,qBAAqB;iBACnC;aACF,EACD,gBAAgB,EAAE,aAAa,EAC/B,QAAQ,EAAE,QAAQ,GAClB,CACE,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA;AAE7B,eAAe,MAAM,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './use-label-overlap';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Slider/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './use-label-overlap';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Slider/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA"}
@@ -1,9 +0,0 @@
1
- import type { RefObject } from 'react';
2
- export declare const useLabelOverlap: ({ value, isTooltipRendered, }: {
3
- value?: number | number[] | undefined;
4
- isTooltipRendered: boolean;
5
- }) => {
6
- isPartiallyOverlapped: boolean;
7
- handleValueLabelOnRender: (index: number, labelRef: RefObject<HTMLSpanElement>) => void;
8
- };
9
- //# sourceMappingURL=use-label-overlap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-label-overlap.d.ts","sourceRoot":"","sources":["../../../../src/Slider/hooks/use-label-overlap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,eAAO,MAAM,eAAe;;uBAKP,OAAO;;;sCAsChB,MAAM,YAAY,UAAU,eAAe,CAAC;CAWvD,CAAA"}
@@ -1,41 +0,0 @@
1
- import { useCallback, useEffect, useState } from 'react';
2
- import { checkOverlap } from '../../utils';
3
- export const useLabelOverlap = ({ value, isTooltipRendered, }) => {
4
- const [isPartiallyOverlapped, setIsPartiallyOverlapped] = useState(false);
5
- const [valueLabels, setValueLabels] = useState([]);
6
- const isRangeSlider = Array.isArray(value);
7
- useEffect(() => {
8
- var _a, _b;
9
- if (!isRangeSlider || !isTooltipRendered) {
10
- return;
11
- }
12
- const isFullyOverlaped = value[0] === value[1];
13
- if (isFullyOverlaped) {
14
- setIsPartiallyOverlapped(false);
15
- }
16
- else {
17
- if (!(((_a = valueLabels[0]) === null || _a === void 0 ? void 0 : _a.current) && ((_b = valueLabels[1]) === null || _b === void 0 ? void 0 : _b.current))) {
18
- return;
19
- }
20
- setIsPartiallyOverlapped(checkOverlap({
21
- firstLabelRect: valueLabels[0].current.getBoundingClientRect(),
22
- secondLabelRect: valueLabels[1].current.getBoundingClientRect(),
23
- previousResult: isPartiallyOverlapped,
24
- }));
25
- }
26
- }, [
27
- value,
28
- isRangeSlider,
29
- isPartiallyOverlapped,
30
- valueLabels,
31
- isTooltipRendered,
32
- ]);
33
- const handleValueLabelOnRender = useCallback((index, labelRef) => {
34
- setValueLabels(valLabels => {
35
- valLabels[index] = labelRef;
36
- return valLabels;
37
- });
38
- }, [setValueLabels]);
39
- return { isPartiallyOverlapped, handleValueLabelOnRender };
40
- };
41
- //# sourceMappingURL=use-label-overlap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-label-overlap.js","sourceRoot":"","sources":["../../../../src/Slider/hooks/use-label-overlap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,KAAK,EACL,iBAAiB,GAIlB,EAAE,EAAE;IACH,MAAM,CAAC,q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,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,CAAA;AAC5D,CAAC,CAAA"}
@@ -1,5 +0,0 @@
1
- import type { OmitInternalProps } from '@toptal/picasso-shared';
2
- import type { Props } from './Slider';
3
- export { default as Slider } from './Slider';
4
- export declare type SliderProps = OmitInternalProps<Props>;
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Slider/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAErC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAC5C,oBAAY,WAAW,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default as Slider } from './Slider';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Slider/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA"}
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- export declare type SliderMarkProps = {
3
- markActive: boolean;
4
- ownerState: {
5
- value: number;
6
- };
7
- style: React.CSSProperties;
8
- 'data-index': number;
9
- forceInactive: boolean;
10
- };
11
- declare const SliderMark: ({ markActive, ownerState, "data-index": dataIndex, style, forceInactive, }: SliderMarkProps) => JSX.Element;
12
- export default SliderMark;
13
- //# sourceMappingURL=SliderMark.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SliderMark.d.ts","sourceRoot":"","sources":["../../../src/SliderMark/SliderMark.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,oBAAY,eAAe,GAAG;IAC5B,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7B,KAAK,EAAE,KAAK,CAAC,aAAa,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,OAAO,CAAA;CACvB,CAAA;AAID,QAAA,MAAM,UAAU,+EAMb,eAAe,gBAWjB,CAAA;AAED,eAAe,UAAU,CAAA"}
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { twJoin } from '@toptal/picasso-tailwind-merge';
3
- import { getBgColor } from '../utils';
4
- // We need custom Mark component because we have
5
- // different bg color based on value of the Slider
6
- const SliderMark = ({ markActive, ownerState, 'data-index': dataIndex, style, forceInactive, }) => {
7
- return (React.createElement("span", { "data-index": dataIndex, style: style, className: twJoin('absolute w-[6px] h-[6px] rounded-[50%] border-[2px] top-[1.5px] border-solid border-white opacity-100 -translate-x-2/4 box-content', getBgColor({ markActive, forceInactive, value: ownerState.value })) }));
8
- };
9
- export default SliderMark;
10
- //# sourceMappingURL=SliderMark.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SliderMark.js","sourceRoot":"","sources":["../../../src/SliderMark/SliderMark.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAA;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAUrC,gDAAgD;AAChD,kDAAkD;AAClD,MAAM,UAAU,GAAG,CAAC,EAClB,UAAU,EACV,UAAU,EACV,YAAY,EAAE,SAAS,EACvB,KAAK,EACL,aAAa,GACG,EAAE,EAAE;IACpB,OAAO,CACL,4CACc,SAAS,EACrB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,MAAM,CACf,oIAAoI,EACpI,UAAU,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,CAAC,CACnE,GACD,CACH,CAAA;AACH,CAAC,CAAA;AAED,eAAe,UAAU,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default } from './SliderMark';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/SliderMark/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default } from './SliderMark';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/SliderMark/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
@@ -1,12 +0,0 @@
1
- import type { SliderValueLabelSlotProps } from '@mui/base/Slider';
2
- import type { RefObject } from 'react';
3
- declare type ValueLabelDisplay = 'on' | 'auto' | 'off';
4
- declare const SliderValueLabel: ({ children, index, tooltip, onRender, yPlacement, isOverlaped, ownerState: { value }, }: SliderValueLabelSlotProps & {
5
- tooltip: ValueLabelDisplay;
6
- yPlacement: 'top' | 'bottom';
7
- /** indicates if there are two SliderValueLabels that overlap each other */
8
- isOverlaped: boolean;
9
- onRender: (index: number, ref: RefObject<HTMLSpanElement>) => void;
10
- }) => JSX.Element;
11
- export default SliderValueLabel;
12
- //# sourceMappingURL=SliderValueLabel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SliderValueLabel.d.ts","sourceRoot":"","sources":["../../../src/SliderValueLabel/SliderValueLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMtC,aAAK,iBAAiB,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAA;AAqB9C,QAAA,MAAM,gBAAgB;aASX,iBAAiB;gBACd,KAAK,GAAG,QAAQ;IAC5B,2EAA2E;iBAC9D,OAAO;sBACF,MAAM,OAAO,UAAU,eAAe,CAAC,KAAK,IAAI;iBAkDnE,CAAA;AAED,eAAe,gBAAgB,CAAA"}
@@ -1,44 +0,0 @@
1
- import React, { useEffect, useRef, useState } from 'react';
2
- import { twJoin } from '@toptal/picasso-tailwind-merge';
3
- import { getXPlacement } from '../utils';
4
- const classesByTooltip = {
5
- off: 'hidden',
6
- // We need to use visibility: hidden instead of display: none to keep the
7
- // label visible for javascript calculations.
8
- auto: 'invisible group-hover/thumb:visible flex justify-center items-center',
9
- on: 'flex justify-center items-center',
10
- };
11
- const xPlacementClasses = {
12
- left: 'right-[calc(100%-13px)]',
13
- right: 'left-[calc(100%-13px)]',
14
- center: '',
15
- };
16
- const yPlacementClasses = {
17
- bottom: 'top-[calc(100%+2px)]',
18
- top: 'bottom-[calc(100%+2px)]',
19
- };
20
- const SliderValueLabel = ({ children, index = -1, tooltip = 'off', onRender, yPlacement, isOverlaped, ownerState: { value }, }) => {
21
- const ref = useRef(null);
22
- // we need to change the placement of the label if it is overlaped
23
- // or if it is out of the viewport
24
- const [xPlacement, setXPlacement] = useState('center');
25
- useEffect(() => {
26
- onRender(index, ref);
27
- }, [index, onRender]);
28
- useEffect(() => {
29
- if (!ref.current) {
30
- return;
31
- }
32
- setXPlacement(getXPlacement({
33
- rect: ref.current.getBoundingClientRect(),
34
- isOverlaped: isOverlaped,
35
- isFirstLabel: index === 0,
36
- currentPlacement: xPlacement,
37
- }));
38
- // we need to recalculate on value change to get new rect
39
- }, [isOverlaped, index, xPlacement, value, tooltip]);
40
- return (React.createElement("span", { ref: ref, className: twJoin('absolute will-change-transform transition-transform', classesByTooltip[tooltip], yPlacementClasses[yPlacement], xPlacementClasses[xPlacement]) },
41
- React.createElement("span", { className: twJoin('shadow-4 text-sm text-white bg-graphite-800', 'm-1 rounded-sm py-[2px] px-2 max-w-[300px] break-words') }, children)));
42
- };
43
- export default SliderValueLabel;
44
- //# sourceMappingURL=SliderValueLabel.js.map
@@ -1 +0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ACX,aAAa,CAAC;YACZ,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE;YACzC,WAAW,EAAE,WAAW;YACxB,YAAY,EAAE,KAAK,KAAK,CAAC;YACzB,gBAAgB,EAAE,UAAU;SAC7B,CAAC,CACH,CAAA;QACD,yDAAyD;IAC3D,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;IAEpD,OAAO,CACL,8BACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,MAAM,CACf,qDAAqD,EACrD,gBAAgB,CAAC,OAAO,CAAC,EACzB,iBAAiB,CAAC,UAAU,CAAC,EAC7B,iBAAiB,CAAC,UAAU,CAAC,CAC9B;QAED,8BACE,SAAS,EAAE,MAAM,CACf,6CAA6C,EAC7C,wDAAwD,CACzD,IAEA,QAAQ,CACJ,CACF,CACR,CAAA;AACH,CAAC,CAAA;AAED,eAAe,gBAAgB,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default } from './SliderValueLabel';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/SliderValueLabel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default } from './SliderValueLabel';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/SliderValueLabel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './Slider';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './Slider';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
@@ -1,7 +0,0 @@
1
- export declare type GetBgColorProps = {
2
- markActive?: boolean;
3
- forceInactive?: boolean;
4
- value?: number | readonly number[];
5
- };
6
- export declare const getBgColor: ({ markActive, forceInactive, value, }: GetBgColorProps) => "bg-gray-500" | "bg-blue-500";
7
- //# sourceMappingURL=check-bg-color.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check-bg-color.d.ts","sourceRoot":"","sources":["../../../src/utils/check-bg-color.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;CACnC,CAAA;AAED,eAAO,MAAM,UAAU,0CAIpB,eAAe,kCAiBjB,CAAA"}
@@ -1,15 +0,0 @@
1
- export const getBgColor = ({ markActive, forceInactive, value, }) => {
2
- const inactive = 'bg-gray-500';
3
- const active = 'bg-blue-500';
4
- if (forceInactive) {
5
- return inactive;
6
- }
7
- if (markActive) {
8
- if (value === undefined) {
9
- return inactive;
10
- }
11
- return active;
12
- }
13
- return inactive;
14
- };
15
- //# sourceMappingURL=check-bg-color.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check-bg-color.js","sourceRoot":"","sources":["../../../src/utils/check-bg-color.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,UAAU,EACV,aAAa,EACb,KAAK,GACW,EAAE,EAAE;IACpB,MAAM,QAAQ,GAAG,aAAa,CAAA;IAC9B,MAAM,MAAM,GAAG,aAAa,CAAA;IAE5B,IAAI,aAAa,EAAE;QACjB,OAAO,QAAQ,CAAA;KAChB;IAED,IAAI,UAAU,EAAE;QACd,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,OAAO,QAAQ,CAAA;SAChB;QAED,OAAO,MAAM,CAAA;KACd;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA"}
@@ -1,26 +0,0 @@
1
- export declare type CheckOverlapProps = {
2
- firstLabelRect: DOMRect;
3
- secondLabelRect: DOMRect;
4
- previousResult: boolean;
5
- };
6
- /**
7
- * if we have range slider, there is a chance
8
- * when we select values next to each other
9
- * that the lables might overlap each other. Like this example:
10
- * [ [ ] ]
11
- * A B
12
- *
13
- * In that case we need to reposition the labels to the edges of the thumb.
14
- * [ ] [ ]
15
- * A B
16
- *
17
- * In next rerender when we recalculate the position of the labels the
18
- * above example would end with result as not overlapping as the position was already changed.
19
- * So we need to work with the previous result of this function `previousResult`. When
20
- * true we need to add half of the width of the label to simulate the center position.
21
- *
22
- * This function checks and returns if the labels overlap.
23
- * It is called on each render of the component and everytime the Slider changes value.
24
- **/
25
- export declare const checkOverlap: ({ firstLabelRect, secondLabelRect, previousResult, }: CheckOverlapProps) => boolean;
26
- //# sourceMappingURL=check-overlap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check-overlap.d.ts","sourceRoot":"","sources":["../../../src/utils/check-overlap.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB,GAAG;IAC9B,cAAc,EAAE,OAAO,CAAA;IACvB,eAAe,EAAE,OAAO,CAAA;IACxB,cAAc,EAAE,OAAO,CAAA;CACxB,CAAA;AAED;;;;;;;;;;;;;;;;;;IAkBI;AACJ,eAAO,MAAM,YAAY,yDAItB,iBAAiB,KAAG,OAatB,CAAA"}
@@ -1,32 +0,0 @@
1
- /**
2
- * if we have range slider, there is a chance
3
- * when we select values next to each other
4
- * that the lables might overlap each other. Like this example:
5
- * [ [ ] ]
6
- * A B
7
- *
8
- * In that case we need to reposition the labels to the edges of the thumb.
9
- * [ ] [ ]
10
- * A B
11
- *
12
- * In next rerender when we recalculate the position of the labels the
13
- * above example would end with result as not overlapping as the position was already changed.
14
- * So we need to work with the previous result of this function `previousResult`. When
15
- * true we need to add half of the width of the label to simulate the center position.
16
- *
17
- * This function checks and returns if the labels overlap.
18
- * It is called on each render of the component and everytime the Slider changes value.
19
- **/
20
- export const checkOverlap = ({ firstLabelRect, secondLabelRect, previousResult, }) => {
21
- const gap = 16;
22
- const halfWidth1 = firstLabelRect.width / 2;
23
- const halfWidth2 = secondLabelRect.width / 2;
24
- const rightBoundaryOfFirstLabel = previousResult
25
- ? firstLabelRect.right + halfWidth1
26
- : firstLabelRect.right;
27
- const leftBoundaryOfSecondLabel = previousResult
28
- ? secondLabelRect.left - halfWidth2
29
- : secondLabelRect.left;
30
- return rightBoundaryOfFirstLabel + gap > leftBoundaryOfSecondLabel;
31
- };
32
- //# sourceMappingURL=check-overlap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check-overlap.js","sourceRoot":"","sources":["../../../src/utils/check-overlap.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;IAkBI;AACJ,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,cAAc,EACd,eAAe,EACf,cAAc,GACI,EAAW,EAAE;IAC/B,MAAM,GAAG,GAAG,EAAE,CAAA;IACd,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,GAAG,CAAC,CAAA;IAC3C,MAAM,UAAU,GAAG,eAAe,CAAC,KAAK,GAAG,CAAC,CAAA;IAE5C,MAAM,yBAAyB,GAAG,cAAc;QAC9C,CAAC,CAAC,cAAc,CAAC,KAAK,GAAG,UAAU;QACnC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAA;IACxB,MAAM,yBAAyB,GAAG,cAAc;QAC9C,CAAC,CAAC,eAAe,CAAC,IAAI,GAAG,UAAU;QACnC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAA;IAExB,OAAO,yBAAyB,GAAG,GAAG,GAAG,yBAAyB,CAAA;AACpE,CAAC,CAAA"}
@@ -1,8 +0,0 @@
1
- export declare type GetPositionProps = {
2
- rect: DOMRect;
3
- isOverlaped: boolean;
4
- isFirstLabel: boolean;
5
- currentPlacement: 'left' | 'right' | 'center';
6
- };
7
- export declare const getXPlacement: ({ rect: { width, left, right }, isOverlaped, isFirstLabel, currentPlacement, }: GetPositionProps) => 'left' | 'right' | 'center';
8
- //# sourceMappingURL=get-x-placement.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-x-placement.d.ts","sourceRoot":"","sources":["../../../src/utils/get-x-placement.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,YAAY,EAAE,OAAO,CAAA;IACrB,gBAAgB,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;CAC9C,CAAA;AAED,eAAO,MAAM,aAAa,mFAKvB,gBAAgB,KAAG,MAAM,GAAG,OAAO,GAAG,QAexC,CAAA"}
@@ -1,17 +0,0 @@
1
- export const getXPlacement = ({ rect: { width, left, right }, isOverlaped, isFirstLabel, currentPlacement, }) => {
2
- const gap = 16;
3
- const halfWidth = width / 2;
4
- const leftBoundary = currentPlacement === 'right' ? left - halfWidth : left;
5
- const rightBoundary = currentPlacement === 'left' ? right + halfWidth : right;
6
- if (leftBoundary < gap) {
7
- return 'right';
8
- }
9
- else if (rightBoundary > window.innerWidth - gap) {
10
- return 'left';
11
- }
12
- else if (isOverlaped) {
13
- return isFirstLabel ? 'left' : 'right';
14
- }
15
- return 'center';
16
- };
17
- //# sourceMappingURL=get-x-placement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-x-placement.js","sourceRoot":"","sources":["../../../src/utils/get-x-placement.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC5B,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAC5B,WAAW,EACX,YAAY,EACZ,gBAAgB,GACC,EAA+B,EAAE;IAClD,MAAM,GAAG,GAAG,EAAE,CAAA;IACd,MAAM,SAAS,GAAG,KAAK,GAAG,CAAC,CAAA;IAC3B,MAAM,YAAY,GAAG,gBAAgB,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA;IAC3E,MAAM,aAAa,GAAG,gBAAgB,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAA;IAE7E,IAAI,YAAY,GAAG,GAAG,EAAE;QACtB,OAAO,OAAO,CAAA;KACf;SAAM,IAAI,aAAa,GAAG,MAAM,CAAC,UAAU,GAAG,GAAG,EAAE;QAClD,OAAO,MAAM,CAAA;KACd;SAAM,IAAI,WAAW,EAAE;QACtB,OAAO,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;KACvC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA"}
@@ -1,4 +0,0 @@
1
- export * from './check-bg-color';
2
- export * from './check-overlap';
3
- export * from './get-x-placement';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA"}
@@ -1,4 +0,0 @@
1
- export * from './check-bg-color';
2
- export * from './check-overlap';
3
- export * from './get-x-placement';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA"}