@shoplflow/base 0.33.4 → 0.35.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.
- package/dist/index.cjs +290 -0
- package/dist/index.d.cts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.js +291 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6581,6 +6581,296 @@ var Skeleton = ({ styleVar = "rectangle", width = "50px", height = "20px" }) =>
|
|
|
6581
6581
|
return /* @__PURE__ */ jsxRuntime.jsx(Container6, { styleVar, width, height, "data-shoplflow": "Skeleton" });
|
|
6582
6582
|
};
|
|
6583
6583
|
exports.Skeleton = Skeleton;
|
|
6584
|
+
|
|
6585
|
+
// src/components/Slider/Slider.types.ts
|
|
6586
|
+
exports.SLIDER_Z_INDEX = {
|
|
6587
|
+
THUMB_BUTTON: 10
|
|
6588
|
+
};
|
|
6589
|
+
|
|
6590
|
+
// src/components/Slider/Slider.styled.ts
|
|
6591
|
+
var SliderContainer = styled6__default.default.div`
|
|
6592
|
+
position: relative;
|
|
6593
|
+
width: 100%;
|
|
6594
|
+
padding: 0 12px;
|
|
6595
|
+
user-select: none;
|
|
6596
|
+
background-color: ${exports.colorTokens.neutral200};
|
|
6597
|
+
border-radius: 16px;
|
|
6598
|
+
|
|
6599
|
+
${({ isDisabled }) => isDisabled && react$1.css`
|
|
6600
|
+
opacity: 0.5;
|
|
6601
|
+
cursor: not-allowed;
|
|
6602
|
+
`}
|
|
6603
|
+
`;
|
|
6604
|
+
var SliderTrack = styled6__default.default.div`
|
|
6605
|
+
width: 100%; // SliderContainer의 padding 영역 내에서 100%
|
|
6606
|
+
height: 24px;
|
|
6607
|
+
position: relative;
|
|
6608
|
+
overflow: visible;
|
|
6609
|
+
margin: 0;
|
|
6610
|
+
`;
|
|
6611
|
+
var SelectedTrack = styled6__default.default.div`
|
|
6612
|
+
position: absolute;
|
|
6613
|
+
height: 100%;
|
|
6614
|
+
border-radius: 16px;
|
|
6615
|
+
background-color: ${({ selectedColor }) => exports.colorTokens[selectedColor]};
|
|
6616
|
+
top: 0;
|
|
6617
|
+
left: ${({ startPosition }) => startPosition};
|
|
6618
|
+
width: ${({ width }) => width};
|
|
6619
|
+
`;
|
|
6620
|
+
var StepsContainer = styled6__default.default.div`
|
|
6621
|
+
position: absolute;
|
|
6622
|
+
top: 0;
|
|
6623
|
+
left: 0;
|
|
6624
|
+
width: 100%;
|
|
6625
|
+
height: 100%;
|
|
6626
|
+
display: flex;
|
|
6627
|
+
align-items: center;
|
|
6628
|
+
pointer-events: none;
|
|
6629
|
+
`;
|
|
6630
|
+
var Steps = styled6__default.default.div`
|
|
6631
|
+
position: absolute;
|
|
6632
|
+
width: 8px;
|
|
6633
|
+
height: 8px;
|
|
6634
|
+
border-radius: 50%;
|
|
6635
|
+
background-color: transparent;
|
|
6636
|
+
|
|
6637
|
+
&[data-edge='true'] {
|
|
6638
|
+
width: 16px;
|
|
6639
|
+
height: 16px;
|
|
6640
|
+
}
|
|
6641
|
+
`;
|
|
6642
|
+
var ThumbButton = styled6__default.default.button`
|
|
6643
|
+
position: absolute;
|
|
6644
|
+
top: 50%;
|
|
6645
|
+
transform: translate(-50%, -50%);
|
|
6646
|
+
border: none;
|
|
6647
|
+
padding: 0;
|
|
6648
|
+
outline: none;
|
|
6649
|
+
z-index: ${exports.SLIDER_Z_INDEX.THUMB_BUTTON}; // thumb를 track보다 위에 위치시킴
|
|
6650
|
+
`;
|
|
6651
|
+
var ThumbCircle = styled6__default.default.div`
|
|
6652
|
+
width: 16px;
|
|
6653
|
+
height: 16px;
|
|
6654
|
+
border-radius: 50%;
|
|
6655
|
+
border: 0.5px solid transparent; // 자연스러운 transition을 위한 초기 border 설정
|
|
6656
|
+
background-color: ${exports.colorTokens.neutral0};
|
|
6657
|
+
transition:
|
|
6658
|
+
transform 0.15s ease,
|
|
6659
|
+
border 0.15s ease;
|
|
6660
|
+
cursor: ${({ isDisabled }) => isDisabled ? "not-allowed" : "grab"};
|
|
6661
|
+
|
|
6662
|
+
${({ isDisabled, selectedColor }) => !isDisabled && react$1.css`
|
|
6663
|
+
&:active {
|
|
6664
|
+
border: 3px solid ${exports.colorTokens[selectedColor]};
|
|
6665
|
+
}
|
|
6666
|
+
|
|
6667
|
+
&:hover {
|
|
6668
|
+
border: 3px solid ${exports.colorTokens[selectedColor]};
|
|
6669
|
+
}
|
|
6670
|
+
`}
|
|
6671
|
+
`;
|
|
6672
|
+
|
|
6673
|
+
// src/components/Slider/sliderUtils.ts
|
|
6674
|
+
var getAdjustedValue = (value, bounds, step) => {
|
|
6675
|
+
const { min, max } = bounds;
|
|
6676
|
+
const snappedValue = Math.round((value - min) / step) * step + min;
|
|
6677
|
+
return Math.max(min, Math.min(max, snappedValue));
|
|
6678
|
+
};
|
|
6679
|
+
var getPositionPercentage = (index, selectedRange, bounds) => {
|
|
6680
|
+
const { min, max } = bounds;
|
|
6681
|
+
return Math.trunc((selectedRange[index] - min) / (max - min) * 100);
|
|
6682
|
+
};
|
|
6683
|
+
var getValueFromPercentage = (percentage, bounds, step) => {
|
|
6684
|
+
const { min, max } = bounds;
|
|
6685
|
+
const rawValue = min + percentage / 100 * (max - min);
|
|
6686
|
+
return getAdjustedValue(rawValue, bounds, step);
|
|
6687
|
+
};
|
|
6688
|
+
var generateSteps = (bounds, step, maxSteps = 21) => {
|
|
6689
|
+
const { min, max } = bounds;
|
|
6690
|
+
const totalSteps = Math.floor((max - min) / step) + 1;
|
|
6691
|
+
const stepInterval = totalSteps > maxSteps ? Math.ceil(totalSteps / maxSteps) : 1;
|
|
6692
|
+
const tickValues = [];
|
|
6693
|
+
for (let i = 0; i < totalSteps; i += stepInterval) {
|
|
6694
|
+
const value = min + i * step;
|
|
6695
|
+
if (value <= max) {
|
|
6696
|
+
tickValues.push(value);
|
|
6697
|
+
}
|
|
6698
|
+
}
|
|
6699
|
+
if (tickValues.length > 0 && tickValues[tickValues.length - 1] !== max) {
|
|
6700
|
+
tickValues.push(max);
|
|
6701
|
+
}
|
|
6702
|
+
return tickValues;
|
|
6703
|
+
};
|
|
6704
|
+
var validateRange = ({
|
|
6705
|
+
min,
|
|
6706
|
+
max,
|
|
6707
|
+
defaultRange
|
|
6708
|
+
}) => {
|
|
6709
|
+
if (defaultRange.min < min || defaultRange.max > max) {
|
|
6710
|
+
throw new Error("defaultRange\uAC00 Slider\uC758 \uC804\uCCB4 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0A9\uB2C8\uB2E4.");
|
|
6711
|
+
}
|
|
6712
|
+
if (defaultRange.min > defaultRange.max) {
|
|
6713
|
+
throw new Error("defaultRange\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uD655\uC778\uD574\uC8FC\uC138\uC694.");
|
|
6714
|
+
}
|
|
6715
|
+
};
|
|
6716
|
+
var validateStep = ({ min, max, step }) => {
|
|
6717
|
+
if (step <= 0) {
|
|
6718
|
+
throw new Error("step\uC740 0\uBCF4\uB2E4 \uCEE4\uC57C \uD569\uB2C8\uB2E4.");
|
|
6719
|
+
}
|
|
6720
|
+
if (step > max || step < min || step > max - min) {
|
|
6721
|
+
throw new Error("step\uC774 Slider\uC758 \uC804\uCCB4 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0A9\uB2C8\uB2E4.");
|
|
6722
|
+
}
|
|
6723
|
+
};
|
|
6724
|
+
var SliderSteps = ({ bounds, step, maxSteps = 21 }) => {
|
|
6725
|
+
const steps = generateSteps(bounds, step, maxSteps);
|
|
6726
|
+
const { min, max } = bounds;
|
|
6727
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StepsContainer, { children: steps.map((stepValue) => {
|
|
6728
|
+
const position = (stepValue - min) / (max - min) * 100;
|
|
6729
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6730
|
+
Steps,
|
|
6731
|
+
{
|
|
6732
|
+
style: {
|
|
6733
|
+
left: `${position}%`
|
|
6734
|
+
}
|
|
6735
|
+
},
|
|
6736
|
+
stepValue
|
|
6737
|
+
);
|
|
6738
|
+
}) });
|
|
6739
|
+
};
|
|
6740
|
+
var SliderThumbs = ({
|
|
6741
|
+
positions,
|
|
6742
|
+
values,
|
|
6743
|
+
isDisabled,
|
|
6744
|
+
selectedColor,
|
|
6745
|
+
onMouseDown
|
|
6746
|
+
}) => {
|
|
6747
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: positions.map((position, index) => /* @__PURE__ */ jsxRuntime.jsx(ThumbButton, { style: { left: `${position}%` }, onMouseDown: onMouseDown(index), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6748
|
+
exports.Tooltip,
|
|
6749
|
+
{
|
|
6750
|
+
trigger: /* @__PURE__ */ jsxRuntime.jsx(ThumbCircle, { isDisabled, selectedColor }),
|
|
6751
|
+
popper: !isDisabled && /* @__PURE__ */ jsxRuntime.jsx(exports.Tooltip.Content, { content: Math.abs(values[index]).toString() })
|
|
6752
|
+
}
|
|
6753
|
+
) }, index)) });
|
|
6754
|
+
};
|
|
6755
|
+
var useSlider = ({ bounds, step, defaultRange, handleRange, isDisabled = false }) => {
|
|
6756
|
+
const { min, max } = bounds;
|
|
6757
|
+
validateRange({ min, max, defaultRange });
|
|
6758
|
+
validateStep({ min, max, step });
|
|
6759
|
+
const [range, setRange] = React3.useState([defaultRange.min, defaultRange.max]);
|
|
6760
|
+
const trackRef = React3.useRef(null);
|
|
6761
|
+
const updateRange = React3.useCallback(
|
|
6762
|
+
(index, newValue) => {
|
|
6763
|
+
setRange((prev) => {
|
|
6764
|
+
const newRange = [...prev];
|
|
6765
|
+
if (index === 0) {
|
|
6766
|
+
newRange[0] = Math.min(newValue, newRange[1]);
|
|
6767
|
+
} else if (index === 1) {
|
|
6768
|
+
newRange[1] = Math.max(newValue, newRange[0]);
|
|
6769
|
+
}
|
|
6770
|
+
return newRange;
|
|
6771
|
+
});
|
|
6772
|
+
handleRange == null ? void 0 : handleRange({ min: range[0], max: range[1] });
|
|
6773
|
+
},
|
|
6774
|
+
[range, handleRange]
|
|
6775
|
+
);
|
|
6776
|
+
const handleMouseDown = React3.useCallback(
|
|
6777
|
+
(index) => (e) => {
|
|
6778
|
+
if (isDisabled) {
|
|
6779
|
+
return;
|
|
6780
|
+
}
|
|
6781
|
+
e.preventDefault();
|
|
6782
|
+
const handleMouseMove = (moveEvent) => {
|
|
6783
|
+
if (!trackRef.current) {
|
|
6784
|
+
return;
|
|
6785
|
+
}
|
|
6786
|
+
const rect = trackRef.current.getBoundingClientRect();
|
|
6787
|
+
const offsetX = moveEvent.clientX - rect.left;
|
|
6788
|
+
const percentage = Math.min(Math.max(offsetX / rect.width * 100, 0), 100);
|
|
6789
|
+
const newValue = getValueFromPercentage(percentage, { min, max }, step);
|
|
6790
|
+
updateRange(index, newValue);
|
|
6791
|
+
};
|
|
6792
|
+
const handleMouseUp = () => {
|
|
6793
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
6794
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
6795
|
+
};
|
|
6796
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
6797
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
6798
|
+
},
|
|
6799
|
+
[isDisabled, min, max, step, updateRange]
|
|
6800
|
+
);
|
|
6801
|
+
const handleClickTrack = React3.useCallback(
|
|
6802
|
+
(e) => {
|
|
6803
|
+
if (isDisabled || !trackRef.current) {
|
|
6804
|
+
return;
|
|
6805
|
+
}
|
|
6806
|
+
const rect = trackRef.current.getBoundingClientRect();
|
|
6807
|
+
const offsetX = e.clientX - rect.left;
|
|
6808
|
+
const percentage = offsetX / rect.width * 100;
|
|
6809
|
+
const newValue = getValueFromPercentage(percentage, { min, max }, step);
|
|
6810
|
+
const distanceToStart = Math.abs(getPositionPercentage(0, range, { min, max }) - percentage);
|
|
6811
|
+
const distanceToEnd = Math.abs(getPositionPercentage(1, range, { min, max }) - percentage);
|
|
6812
|
+
if (distanceToStart <= distanceToEnd) {
|
|
6813
|
+
updateRange(0, newValue);
|
|
6814
|
+
} else {
|
|
6815
|
+
updateRange(1, newValue);
|
|
6816
|
+
}
|
|
6817
|
+
},
|
|
6818
|
+
[isDisabled, min, max, step, range, updateRange]
|
|
6819
|
+
);
|
|
6820
|
+
const startPosition = getPositionPercentage(0, range, { min, max });
|
|
6821
|
+
const endPosition = getPositionPercentage(1, range, { min, max });
|
|
6822
|
+
const width = endPosition - startPosition;
|
|
6823
|
+
return {
|
|
6824
|
+
range,
|
|
6825
|
+
trackRef,
|
|
6826
|
+
handleMouseDown,
|
|
6827
|
+
handleClickTrack,
|
|
6828
|
+
positions: {
|
|
6829
|
+
start: startPosition,
|
|
6830
|
+
end: endPosition,
|
|
6831
|
+
width
|
|
6832
|
+
}
|
|
6833
|
+
};
|
|
6834
|
+
};
|
|
6835
|
+
var Slider = ({
|
|
6836
|
+
min = 0,
|
|
6837
|
+
max,
|
|
6838
|
+
step = 1,
|
|
6839
|
+
defaultRange = { min: 0, max: 0 },
|
|
6840
|
+
handleRange,
|
|
6841
|
+
isDisabled = false,
|
|
6842
|
+
selectedColor = "shopl300"
|
|
6843
|
+
}) => {
|
|
6844
|
+
const { range, trackRef, handleMouseDown, handleClickTrack, positions } = useSlider({
|
|
6845
|
+
bounds: { min, max },
|
|
6846
|
+
step,
|
|
6847
|
+
defaultRange,
|
|
6848
|
+
handleRange,
|
|
6849
|
+
isDisabled
|
|
6850
|
+
});
|
|
6851
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SliderContainer, { isDisabled, children: /* @__PURE__ */ jsxRuntime.jsxs(SliderTrack, { ref: trackRef, onClick: handleClickTrack, children: [
|
|
6852
|
+
/* @__PURE__ */ jsxRuntime.jsx(SliderSteps, { bounds: { min, max }, step, range }),
|
|
6853
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6854
|
+
SelectedTrack,
|
|
6855
|
+
{
|
|
6856
|
+
selectedColor,
|
|
6857
|
+
startPosition: `calc(${positions.start}% - 12px)`,
|
|
6858
|
+
width: `calc(${positions.width}% + 24px)`
|
|
6859
|
+
}
|
|
6860
|
+
),
|
|
6861
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6862
|
+
SliderThumbs,
|
|
6863
|
+
{
|
|
6864
|
+
positions: [positions.start, positions.end],
|
|
6865
|
+
isDisabled,
|
|
6866
|
+
selectedColor,
|
|
6867
|
+
onMouseDown: handleMouseDown,
|
|
6868
|
+
values: range
|
|
6869
|
+
}
|
|
6870
|
+
)
|
|
6871
|
+
] }) });
|
|
6872
|
+
};
|
|
6873
|
+
exports.Slider = Slider;
|
|
6584
6874
|
var SpaceMarginWrapper = styled6__default.default(framerMotion.motion.div)`
|
|
6585
6875
|
position: relative;
|
|
6586
6876
|
display: flex;
|
package/dist/index.d.cts
CHANGED
|
@@ -1540,4 +1540,50 @@ declare type SkeletonProps = {
|
|
|
1540
1540
|
|
|
1541
1541
|
declare const Skeleton: ({ styleVar, width, height }: SkeletonProps) => react_jsx_runtime.JSX.Element;
|
|
1542
1542
|
|
|
1543
|
-
|
|
1543
|
+
interface SliderProps {
|
|
1544
|
+
/**
|
|
1545
|
+
* 선택 가능한 최소값
|
|
1546
|
+
*/
|
|
1547
|
+
min: number;
|
|
1548
|
+
/**
|
|
1549
|
+
* 선택 가능한 최대값
|
|
1550
|
+
*/
|
|
1551
|
+
max: number;
|
|
1552
|
+
/**
|
|
1553
|
+
* 증분 단위
|
|
1554
|
+
*/
|
|
1555
|
+
step?: number;
|
|
1556
|
+
/**
|
|
1557
|
+
* 초기 선택 범위
|
|
1558
|
+
*/
|
|
1559
|
+
defaultRange?: {
|
|
1560
|
+
min: number;
|
|
1561
|
+
max: number;
|
|
1562
|
+
};
|
|
1563
|
+
/**
|
|
1564
|
+
* 선택 범위가 변경될 때 실행할 함수
|
|
1565
|
+
*/
|
|
1566
|
+
handleRange?: (range: {
|
|
1567
|
+
min: number;
|
|
1568
|
+
max: number;
|
|
1569
|
+
}) => void;
|
|
1570
|
+
/**
|
|
1571
|
+
* 비활성화 여부
|
|
1572
|
+
*/
|
|
1573
|
+
isDisabled?: boolean;
|
|
1574
|
+
/**
|
|
1575
|
+
* 선택된 범위에 적용될 색상
|
|
1576
|
+
*/
|
|
1577
|
+
selectedColor?: ColorTokens;
|
|
1578
|
+
}
|
|
1579
|
+
declare type SliderBounds = {
|
|
1580
|
+
min: number;
|
|
1581
|
+
max: number;
|
|
1582
|
+
};
|
|
1583
|
+
declare const SLIDER_Z_INDEX: {
|
|
1584
|
+
readonly THUMB_BUTTON: 10;
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1587
|
+
declare const Slider: React__default.FC<SliderProps>;
|
|
1588
|
+
|
|
1589
|
+
export { AnnualDatepicker, AnnualDatepickerProps, AsProp, Avatar, AvatarOptionProps, AvatarProps, AvatarSizeVariantType, AvatarSizeVariants, BackDropOptionProps, BackDropProps, BorderRadiusTokens, BoxShadowTokens, Button, ButtonComponent, ButtonOptionProps, ButtonProps, ButtonSizeVariantType, ButtonSizeVariants, ButtonStyleVariantType, ButtonStyleVariants, CHECKBOX_SYMBOL_KEY, Callout, CalloutOptionProps, CalloutProps, CalloutType, CalloutTypes, Checkbox, CheckboxOptionProps, CheckboxProps, CheckboxStyleVariantType, CheckboxStyleVariants, ChipButton, ChipButtonOptionProps, ChipButtonProps, ChipButtonSizeVariantType, ChipButtonSizeVariants, ChipButtonStyleVariantType, ChipButtonStyleVariants, ChipToggle, ChipToggleOptionProps, ChipToggleProps, ChipToggleSizeVariantType, ChipToggleSizeVariants, ChipToggleStyleVariantType, ChipToggleStyleVariants, ColorTokens, DangerouslySetInnerHTML, DayCalendarType, DayDatepicker, DayDatepickerHeaderCustomProps, DayDatepickerOptionProps, DayDatepickerProps, DayDatepickerSizeVariantType, DayDatepickerSizeVariants, DomainType, Dropdown, DropdownButton, DropdownButtonContext, DropdownButtonContextType, DropdownButtonOptionProps, DropdownButtonProps, DropdownButtonSizeVariantType, DropdownButtonSizeVariants, DropdownButtonStyleVariantType, DropdownButtonStyleVariants, DropdownContentProps, DropdownOptionProps, DropdownOptionVariantType, DropdownOptionVariants, DropdownProps, DropdownSizeVariantType, DropdownTriggerButtonProps, FontWeightTokens, Icon, IconButton, IconButtonComponent, IconButtonOptionProps, IconButtonProps, IconButtonSizeVariantType, IconButtonSizeVariants, IconButtonStyleVariantType, IconButtonStyleVariants, IconOptionProps, IconProps, IconSizeVariants, IconSizeVariantsType, Input, InputButton, InputButtonOptionProps, InputButtonProps, InputOptionProps, InputProps, InputSizeVariantType, InputSizeVariants, List, ListContent2ColumnsProps, ListOptionProps, ListProps, ListText2RowsProps, MODAL_FOOTER_KEY, MODAL_HEADER_KEY, Menu, MenuOptionProps, MenuProps, MenuSizeVariantType, MenuSizeVariants, MinusBoxOptionProps, MinusBoxProps, MinusButton, Modal, ModalBodyOptionProps, ModalBodyProps, ModalBottomProps, ModalContainerOptionProps, ModalContainerProps, ModalContext, ModalFooterOptionProps, ModalFooterProps, ModalFooterType, ModalHandlerContext, ModalHeaderOptionProps, ModalHeaderProps, ModalHeaderType, ModalPortal as ModalProvider, ModalSize, ModalSizeType, ModalStateType, ModalTopProps, MonthClickDateInfo, MonthDatepicker, MonthDatepickerProps, MonthDatepickerStyleType, MotionStack, MotionStackComponentType, MotionStackContainer, MotionStackContainerComponentType, NumberCombobox, NumberComboboxErrorType, NumberComboboxInputType, NumberComboboxOptionProps, NumberComboboxProps, NumberComboboxSizeVariantType, NumberComboboxSizeVariants, Pagination, PaginationOptionProps, PaginationProps, PaginationSizeSelectorProps, PolymorphicComponentProps, PolymorphicRef, Popper, PopperOptionProps, PopperPortal, PopperPortalProps, PopperProps, PopperTrigger, PopperTriggerProps, RADIO_SYMBOL_KEY, Radio, RadioOptionProps, RadioProps, RemoveModalProps, SLIDER_Z_INDEX, ScrollArea, ScrollAreaOptionProps, ScrollAreaProps, ScrollbarRefType, SelectInputButton, SelectInputButtonOptionProps, SelectInputButtonProps, ShoplflowProvider, ShoplflowProviderProps, Skeleton, SkeletonProps, Slider, SliderBounds, SliderProps, SpacingTokens, SplitButton, SplitButtonContext, SplitButtonContextType, SplitButtonOptionProps, SplitButtonProps, SplitButtonSizeVariantType, SplitButtonSizeVariants, SplitButtonStyleVariantType, SplitButtonStyleVariants, Stack, StackComponentType, StackContainer, StackContainerComponentType, StackContainerGenericProps, StackContainerOptionProps, StackContainerProps, StackGenericProps, StackOptionProps, StackProps, StyledIcon, StyledStack, StyledStackContainer, Switch, SwitchOptionProps, SwitchProps, TREE_SYMBOL_KEY, TabOptionProps, TabProps, TabSizeVariantType, TabSizeVariants, TabStyleVariantType, TabStyleVariants, TabStyledProps, TabTextStyledProps, Tabs, TabsContext, TabsContextType, TabsOptionProps, TabsProps, Tag, TagOptionProps, TagProps, TagSizeVariantType, TagSizeVariants, TagStyleVariantType, TagStyleVariants, Text, Text2Rows, TextArea, TextAreaOptionProps, TextAreaProps, TextOptionProps, TextProps, ToggleButton, ToggleButtonInnerRadioOptionProps, ToggleButtonInnerRadioProps, ToggleButtonOptionProps, ToggleButtonProps, ToggleButtonSizeVariantType, ToggleButtonSizeVariants, Tooltip, TooltipContentProps, TooltipOptionProps, TooltipProps, Tree, TreeItem, TreeItemOptionProps, TreeItemProps, TreeOptionProps, TreeProps, TypographyTokens, WeekClickDateInfo, WeekDatepicker, WeekDatepickerProps, WeekDatepickerStyleType, YearSelectProps, borderRadiusTokens, boxShadowTokens, colorTokens, fontWeightTokens, getDomain, spacingTokens, typographyTokens, useDomain, useDropdownButtonContext, useHandleModal, useModalValue, useSplitButtonContext, useTabs };
|
package/dist/index.d.ts
CHANGED
|
@@ -1540,4 +1540,50 @@ declare type SkeletonProps = {
|
|
|
1540
1540
|
|
|
1541
1541
|
declare const Skeleton: ({ styleVar, width, height }: SkeletonProps) => react_jsx_runtime.JSX.Element;
|
|
1542
1542
|
|
|
1543
|
-
|
|
1543
|
+
interface SliderProps {
|
|
1544
|
+
/**
|
|
1545
|
+
* 선택 가능한 최소값
|
|
1546
|
+
*/
|
|
1547
|
+
min: number;
|
|
1548
|
+
/**
|
|
1549
|
+
* 선택 가능한 최대값
|
|
1550
|
+
*/
|
|
1551
|
+
max: number;
|
|
1552
|
+
/**
|
|
1553
|
+
* 증분 단위
|
|
1554
|
+
*/
|
|
1555
|
+
step?: number;
|
|
1556
|
+
/**
|
|
1557
|
+
* 초기 선택 범위
|
|
1558
|
+
*/
|
|
1559
|
+
defaultRange?: {
|
|
1560
|
+
min: number;
|
|
1561
|
+
max: number;
|
|
1562
|
+
};
|
|
1563
|
+
/**
|
|
1564
|
+
* 선택 범위가 변경될 때 실행할 함수
|
|
1565
|
+
*/
|
|
1566
|
+
handleRange?: (range: {
|
|
1567
|
+
min: number;
|
|
1568
|
+
max: number;
|
|
1569
|
+
}) => void;
|
|
1570
|
+
/**
|
|
1571
|
+
* 비활성화 여부
|
|
1572
|
+
*/
|
|
1573
|
+
isDisabled?: boolean;
|
|
1574
|
+
/**
|
|
1575
|
+
* 선택된 범위에 적용될 색상
|
|
1576
|
+
*/
|
|
1577
|
+
selectedColor?: ColorTokens;
|
|
1578
|
+
}
|
|
1579
|
+
declare type SliderBounds = {
|
|
1580
|
+
min: number;
|
|
1581
|
+
max: number;
|
|
1582
|
+
};
|
|
1583
|
+
declare const SLIDER_Z_INDEX: {
|
|
1584
|
+
readonly THUMB_BUTTON: 10;
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1587
|
+
declare const Slider: React__default.FC<SliderProps>;
|
|
1588
|
+
|
|
1589
|
+
export { AnnualDatepicker, AnnualDatepickerProps, AsProp, Avatar, AvatarOptionProps, AvatarProps, AvatarSizeVariantType, AvatarSizeVariants, BackDropOptionProps, BackDropProps, BorderRadiusTokens, BoxShadowTokens, Button, ButtonComponent, ButtonOptionProps, ButtonProps, ButtonSizeVariantType, ButtonSizeVariants, ButtonStyleVariantType, ButtonStyleVariants, CHECKBOX_SYMBOL_KEY, Callout, CalloutOptionProps, CalloutProps, CalloutType, CalloutTypes, Checkbox, CheckboxOptionProps, CheckboxProps, CheckboxStyleVariantType, CheckboxStyleVariants, ChipButton, ChipButtonOptionProps, ChipButtonProps, ChipButtonSizeVariantType, ChipButtonSizeVariants, ChipButtonStyleVariantType, ChipButtonStyleVariants, ChipToggle, ChipToggleOptionProps, ChipToggleProps, ChipToggleSizeVariantType, ChipToggleSizeVariants, ChipToggleStyleVariantType, ChipToggleStyleVariants, ColorTokens, DangerouslySetInnerHTML, DayCalendarType, DayDatepicker, DayDatepickerHeaderCustomProps, DayDatepickerOptionProps, DayDatepickerProps, DayDatepickerSizeVariantType, DayDatepickerSizeVariants, DomainType, Dropdown, DropdownButton, DropdownButtonContext, DropdownButtonContextType, DropdownButtonOptionProps, DropdownButtonProps, DropdownButtonSizeVariantType, DropdownButtonSizeVariants, DropdownButtonStyleVariantType, DropdownButtonStyleVariants, DropdownContentProps, DropdownOptionProps, DropdownOptionVariantType, DropdownOptionVariants, DropdownProps, DropdownSizeVariantType, DropdownTriggerButtonProps, FontWeightTokens, Icon, IconButton, IconButtonComponent, IconButtonOptionProps, IconButtonProps, IconButtonSizeVariantType, IconButtonSizeVariants, IconButtonStyleVariantType, IconButtonStyleVariants, IconOptionProps, IconProps, IconSizeVariants, IconSizeVariantsType, Input, InputButton, InputButtonOptionProps, InputButtonProps, InputOptionProps, InputProps, InputSizeVariantType, InputSizeVariants, List, ListContent2ColumnsProps, ListOptionProps, ListProps, ListText2RowsProps, MODAL_FOOTER_KEY, MODAL_HEADER_KEY, Menu, MenuOptionProps, MenuProps, MenuSizeVariantType, MenuSizeVariants, MinusBoxOptionProps, MinusBoxProps, MinusButton, Modal, ModalBodyOptionProps, ModalBodyProps, ModalBottomProps, ModalContainerOptionProps, ModalContainerProps, ModalContext, ModalFooterOptionProps, ModalFooterProps, ModalFooterType, ModalHandlerContext, ModalHeaderOptionProps, ModalHeaderProps, ModalHeaderType, ModalPortal as ModalProvider, ModalSize, ModalSizeType, ModalStateType, ModalTopProps, MonthClickDateInfo, MonthDatepicker, MonthDatepickerProps, MonthDatepickerStyleType, MotionStack, MotionStackComponentType, MotionStackContainer, MotionStackContainerComponentType, NumberCombobox, NumberComboboxErrorType, NumberComboboxInputType, NumberComboboxOptionProps, NumberComboboxProps, NumberComboboxSizeVariantType, NumberComboboxSizeVariants, Pagination, PaginationOptionProps, PaginationProps, PaginationSizeSelectorProps, PolymorphicComponentProps, PolymorphicRef, Popper, PopperOptionProps, PopperPortal, PopperPortalProps, PopperProps, PopperTrigger, PopperTriggerProps, RADIO_SYMBOL_KEY, Radio, RadioOptionProps, RadioProps, RemoveModalProps, SLIDER_Z_INDEX, ScrollArea, ScrollAreaOptionProps, ScrollAreaProps, ScrollbarRefType, SelectInputButton, SelectInputButtonOptionProps, SelectInputButtonProps, ShoplflowProvider, ShoplflowProviderProps, Skeleton, SkeletonProps, Slider, SliderBounds, SliderProps, SpacingTokens, SplitButton, SplitButtonContext, SplitButtonContextType, SplitButtonOptionProps, SplitButtonProps, SplitButtonSizeVariantType, SplitButtonSizeVariants, SplitButtonStyleVariantType, SplitButtonStyleVariants, Stack, StackComponentType, StackContainer, StackContainerComponentType, StackContainerGenericProps, StackContainerOptionProps, StackContainerProps, StackGenericProps, StackOptionProps, StackProps, StyledIcon, StyledStack, StyledStackContainer, Switch, SwitchOptionProps, SwitchProps, TREE_SYMBOL_KEY, TabOptionProps, TabProps, TabSizeVariantType, TabSizeVariants, TabStyleVariantType, TabStyleVariants, TabStyledProps, TabTextStyledProps, Tabs, TabsContext, TabsContextType, TabsOptionProps, TabsProps, Tag, TagOptionProps, TagProps, TagSizeVariantType, TagSizeVariants, TagStyleVariantType, TagStyleVariants, Text, Text2Rows, TextArea, TextAreaOptionProps, TextAreaProps, TextOptionProps, TextProps, ToggleButton, ToggleButtonInnerRadioOptionProps, ToggleButtonInnerRadioProps, ToggleButtonOptionProps, ToggleButtonProps, ToggleButtonSizeVariantType, ToggleButtonSizeVariants, Tooltip, TooltipContentProps, TooltipOptionProps, TooltipProps, Tree, TreeItem, TreeItemOptionProps, TreeItemProps, TreeOptionProps, TreeProps, TypographyTokens, WeekClickDateInfo, WeekDatepicker, WeekDatepickerProps, WeekDatepickerStyleType, YearSelectProps, borderRadiusTokens, boxShadowTokens, colorTokens, fontWeightTokens, getDomain, spacingTokens, typographyTokens, useDomain, useDropdownButtonContext, useHandleModal, useModalValue, useSplitButtonContext, useTabs };
|
package/dist/index.js
CHANGED
|
@@ -6554,6 +6554,296 @@ var Skeleton = ({ styleVar = "rectangle", width = "50px", height = "20px" }) =>
|
|
|
6554
6554
|
return /* @__PURE__ */ jsx(Container6, { styleVar, width, height, "data-shoplflow": "Skeleton" });
|
|
6555
6555
|
};
|
|
6556
6556
|
var Skeleton_default = Skeleton;
|
|
6557
|
+
|
|
6558
|
+
// src/components/Slider/Slider.types.ts
|
|
6559
|
+
var SLIDER_Z_INDEX = {
|
|
6560
|
+
THUMB_BUTTON: 10
|
|
6561
|
+
};
|
|
6562
|
+
|
|
6563
|
+
// src/components/Slider/Slider.styled.ts
|
|
6564
|
+
var SliderContainer = styled6.div`
|
|
6565
|
+
position: relative;
|
|
6566
|
+
width: 100%;
|
|
6567
|
+
padding: 0 12px;
|
|
6568
|
+
user-select: none;
|
|
6569
|
+
background-color: ${colorTokens.neutral200};
|
|
6570
|
+
border-radius: 16px;
|
|
6571
|
+
|
|
6572
|
+
${({ isDisabled }) => isDisabled && css`
|
|
6573
|
+
opacity: 0.5;
|
|
6574
|
+
cursor: not-allowed;
|
|
6575
|
+
`}
|
|
6576
|
+
`;
|
|
6577
|
+
var SliderTrack = styled6.div`
|
|
6578
|
+
width: 100%; // SliderContainer의 padding 영역 내에서 100%
|
|
6579
|
+
height: 24px;
|
|
6580
|
+
position: relative;
|
|
6581
|
+
overflow: visible;
|
|
6582
|
+
margin: 0;
|
|
6583
|
+
`;
|
|
6584
|
+
var SelectedTrack = styled6.div`
|
|
6585
|
+
position: absolute;
|
|
6586
|
+
height: 100%;
|
|
6587
|
+
border-radius: 16px;
|
|
6588
|
+
background-color: ${({ selectedColor }) => colorTokens[selectedColor]};
|
|
6589
|
+
top: 0;
|
|
6590
|
+
left: ${({ startPosition }) => startPosition};
|
|
6591
|
+
width: ${({ width }) => width};
|
|
6592
|
+
`;
|
|
6593
|
+
var StepsContainer = styled6.div`
|
|
6594
|
+
position: absolute;
|
|
6595
|
+
top: 0;
|
|
6596
|
+
left: 0;
|
|
6597
|
+
width: 100%;
|
|
6598
|
+
height: 100%;
|
|
6599
|
+
display: flex;
|
|
6600
|
+
align-items: center;
|
|
6601
|
+
pointer-events: none;
|
|
6602
|
+
`;
|
|
6603
|
+
var Steps = styled6.div`
|
|
6604
|
+
position: absolute;
|
|
6605
|
+
width: 8px;
|
|
6606
|
+
height: 8px;
|
|
6607
|
+
border-radius: 50%;
|
|
6608
|
+
background-color: transparent;
|
|
6609
|
+
|
|
6610
|
+
&[data-edge='true'] {
|
|
6611
|
+
width: 16px;
|
|
6612
|
+
height: 16px;
|
|
6613
|
+
}
|
|
6614
|
+
`;
|
|
6615
|
+
var ThumbButton = styled6.button`
|
|
6616
|
+
position: absolute;
|
|
6617
|
+
top: 50%;
|
|
6618
|
+
transform: translate(-50%, -50%);
|
|
6619
|
+
border: none;
|
|
6620
|
+
padding: 0;
|
|
6621
|
+
outline: none;
|
|
6622
|
+
z-index: ${SLIDER_Z_INDEX.THUMB_BUTTON}; // thumb를 track보다 위에 위치시킴
|
|
6623
|
+
`;
|
|
6624
|
+
var ThumbCircle = styled6.div`
|
|
6625
|
+
width: 16px;
|
|
6626
|
+
height: 16px;
|
|
6627
|
+
border-radius: 50%;
|
|
6628
|
+
border: 0.5px solid transparent; // 자연스러운 transition을 위한 초기 border 설정
|
|
6629
|
+
background-color: ${colorTokens.neutral0};
|
|
6630
|
+
transition:
|
|
6631
|
+
transform 0.15s ease,
|
|
6632
|
+
border 0.15s ease;
|
|
6633
|
+
cursor: ${({ isDisabled }) => isDisabled ? "not-allowed" : "grab"};
|
|
6634
|
+
|
|
6635
|
+
${({ isDisabled, selectedColor }) => !isDisabled && css`
|
|
6636
|
+
&:active {
|
|
6637
|
+
border: 3px solid ${colorTokens[selectedColor]};
|
|
6638
|
+
}
|
|
6639
|
+
|
|
6640
|
+
&:hover {
|
|
6641
|
+
border: 3px solid ${colorTokens[selectedColor]};
|
|
6642
|
+
}
|
|
6643
|
+
`}
|
|
6644
|
+
`;
|
|
6645
|
+
|
|
6646
|
+
// src/components/Slider/sliderUtils.ts
|
|
6647
|
+
var getAdjustedValue = (value, bounds, step) => {
|
|
6648
|
+
const { min, max } = bounds;
|
|
6649
|
+
const snappedValue = Math.round((value - min) / step) * step + min;
|
|
6650
|
+
return Math.max(min, Math.min(max, snappedValue));
|
|
6651
|
+
};
|
|
6652
|
+
var getPositionPercentage = (index, selectedRange, bounds) => {
|
|
6653
|
+
const { min, max } = bounds;
|
|
6654
|
+
return Math.trunc((selectedRange[index] - min) / (max - min) * 100);
|
|
6655
|
+
};
|
|
6656
|
+
var getValueFromPercentage = (percentage, bounds, step) => {
|
|
6657
|
+
const { min, max } = bounds;
|
|
6658
|
+
const rawValue = min + percentage / 100 * (max - min);
|
|
6659
|
+
return getAdjustedValue(rawValue, bounds, step);
|
|
6660
|
+
};
|
|
6661
|
+
var generateSteps = (bounds, step, maxSteps = 21) => {
|
|
6662
|
+
const { min, max } = bounds;
|
|
6663
|
+
const totalSteps = Math.floor((max - min) / step) + 1;
|
|
6664
|
+
const stepInterval = totalSteps > maxSteps ? Math.ceil(totalSteps / maxSteps) : 1;
|
|
6665
|
+
const tickValues = [];
|
|
6666
|
+
for (let i = 0; i < totalSteps; i += stepInterval) {
|
|
6667
|
+
const value = min + i * step;
|
|
6668
|
+
if (value <= max) {
|
|
6669
|
+
tickValues.push(value);
|
|
6670
|
+
}
|
|
6671
|
+
}
|
|
6672
|
+
if (tickValues.length > 0 && tickValues[tickValues.length - 1] !== max) {
|
|
6673
|
+
tickValues.push(max);
|
|
6674
|
+
}
|
|
6675
|
+
return tickValues;
|
|
6676
|
+
};
|
|
6677
|
+
var validateRange = ({
|
|
6678
|
+
min,
|
|
6679
|
+
max,
|
|
6680
|
+
defaultRange
|
|
6681
|
+
}) => {
|
|
6682
|
+
if (defaultRange.min < min || defaultRange.max > max) {
|
|
6683
|
+
throw new Error("defaultRange\uAC00 Slider\uC758 \uC804\uCCB4 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0A9\uB2C8\uB2E4.");
|
|
6684
|
+
}
|
|
6685
|
+
if (defaultRange.min > defaultRange.max) {
|
|
6686
|
+
throw new Error("defaultRange\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uD655\uC778\uD574\uC8FC\uC138\uC694.");
|
|
6687
|
+
}
|
|
6688
|
+
};
|
|
6689
|
+
var validateStep = ({ min, max, step }) => {
|
|
6690
|
+
if (step <= 0) {
|
|
6691
|
+
throw new Error("step\uC740 0\uBCF4\uB2E4 \uCEE4\uC57C \uD569\uB2C8\uB2E4.");
|
|
6692
|
+
}
|
|
6693
|
+
if (step > max || step < min || step > max - min) {
|
|
6694
|
+
throw new Error("step\uC774 Slider\uC758 \uC804\uCCB4 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0A9\uB2C8\uB2E4.");
|
|
6695
|
+
}
|
|
6696
|
+
};
|
|
6697
|
+
var SliderSteps = ({ bounds, step, maxSteps = 21 }) => {
|
|
6698
|
+
const steps = generateSteps(bounds, step, maxSteps);
|
|
6699
|
+
const { min, max } = bounds;
|
|
6700
|
+
return /* @__PURE__ */ jsx(StepsContainer, { children: steps.map((stepValue) => {
|
|
6701
|
+
const position = (stepValue - min) / (max - min) * 100;
|
|
6702
|
+
return /* @__PURE__ */ jsx(
|
|
6703
|
+
Steps,
|
|
6704
|
+
{
|
|
6705
|
+
style: {
|
|
6706
|
+
left: `${position}%`
|
|
6707
|
+
}
|
|
6708
|
+
},
|
|
6709
|
+
stepValue
|
|
6710
|
+
);
|
|
6711
|
+
}) });
|
|
6712
|
+
};
|
|
6713
|
+
var SliderThumbs = ({
|
|
6714
|
+
positions,
|
|
6715
|
+
values,
|
|
6716
|
+
isDisabled,
|
|
6717
|
+
selectedColor,
|
|
6718
|
+
onMouseDown
|
|
6719
|
+
}) => {
|
|
6720
|
+
return /* @__PURE__ */ jsx(Fragment, { children: positions.map((position, index) => /* @__PURE__ */ jsx(ThumbButton, { style: { left: `${position}%` }, onMouseDown: onMouseDown(index), children: /* @__PURE__ */ jsx(
|
|
6721
|
+
Tooltip_default,
|
|
6722
|
+
{
|
|
6723
|
+
trigger: /* @__PURE__ */ jsx(ThumbCircle, { isDisabled, selectedColor }),
|
|
6724
|
+
popper: !isDisabled && /* @__PURE__ */ jsx(Tooltip_default.Content, { content: Math.abs(values[index]).toString() })
|
|
6725
|
+
}
|
|
6726
|
+
) }, index)) });
|
|
6727
|
+
};
|
|
6728
|
+
var useSlider = ({ bounds, step, defaultRange, handleRange, isDisabled = false }) => {
|
|
6729
|
+
const { min, max } = bounds;
|
|
6730
|
+
validateRange({ min, max, defaultRange });
|
|
6731
|
+
validateStep({ min, max, step });
|
|
6732
|
+
const [range, setRange] = useState([defaultRange.min, defaultRange.max]);
|
|
6733
|
+
const trackRef = useRef(null);
|
|
6734
|
+
const updateRange = useCallback(
|
|
6735
|
+
(index, newValue) => {
|
|
6736
|
+
setRange((prev) => {
|
|
6737
|
+
const newRange = [...prev];
|
|
6738
|
+
if (index === 0) {
|
|
6739
|
+
newRange[0] = Math.min(newValue, newRange[1]);
|
|
6740
|
+
} else if (index === 1) {
|
|
6741
|
+
newRange[1] = Math.max(newValue, newRange[0]);
|
|
6742
|
+
}
|
|
6743
|
+
return newRange;
|
|
6744
|
+
});
|
|
6745
|
+
handleRange == null ? void 0 : handleRange({ min: range[0], max: range[1] });
|
|
6746
|
+
},
|
|
6747
|
+
[range, handleRange]
|
|
6748
|
+
);
|
|
6749
|
+
const handleMouseDown = useCallback(
|
|
6750
|
+
(index) => (e) => {
|
|
6751
|
+
if (isDisabled) {
|
|
6752
|
+
return;
|
|
6753
|
+
}
|
|
6754
|
+
e.preventDefault();
|
|
6755
|
+
const handleMouseMove = (moveEvent) => {
|
|
6756
|
+
if (!trackRef.current) {
|
|
6757
|
+
return;
|
|
6758
|
+
}
|
|
6759
|
+
const rect = trackRef.current.getBoundingClientRect();
|
|
6760
|
+
const offsetX = moveEvent.clientX - rect.left;
|
|
6761
|
+
const percentage = Math.min(Math.max(offsetX / rect.width * 100, 0), 100);
|
|
6762
|
+
const newValue = getValueFromPercentage(percentage, { min, max }, step);
|
|
6763
|
+
updateRange(index, newValue);
|
|
6764
|
+
};
|
|
6765
|
+
const handleMouseUp = () => {
|
|
6766
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
6767
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
6768
|
+
};
|
|
6769
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
6770
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
6771
|
+
},
|
|
6772
|
+
[isDisabled, min, max, step, updateRange]
|
|
6773
|
+
);
|
|
6774
|
+
const handleClickTrack = useCallback(
|
|
6775
|
+
(e) => {
|
|
6776
|
+
if (isDisabled || !trackRef.current) {
|
|
6777
|
+
return;
|
|
6778
|
+
}
|
|
6779
|
+
const rect = trackRef.current.getBoundingClientRect();
|
|
6780
|
+
const offsetX = e.clientX - rect.left;
|
|
6781
|
+
const percentage = offsetX / rect.width * 100;
|
|
6782
|
+
const newValue = getValueFromPercentage(percentage, { min, max }, step);
|
|
6783
|
+
const distanceToStart = Math.abs(getPositionPercentage(0, range, { min, max }) - percentage);
|
|
6784
|
+
const distanceToEnd = Math.abs(getPositionPercentage(1, range, { min, max }) - percentage);
|
|
6785
|
+
if (distanceToStart <= distanceToEnd) {
|
|
6786
|
+
updateRange(0, newValue);
|
|
6787
|
+
} else {
|
|
6788
|
+
updateRange(1, newValue);
|
|
6789
|
+
}
|
|
6790
|
+
},
|
|
6791
|
+
[isDisabled, min, max, step, range, updateRange]
|
|
6792
|
+
);
|
|
6793
|
+
const startPosition = getPositionPercentage(0, range, { min, max });
|
|
6794
|
+
const endPosition = getPositionPercentage(1, range, { min, max });
|
|
6795
|
+
const width = endPosition - startPosition;
|
|
6796
|
+
return {
|
|
6797
|
+
range,
|
|
6798
|
+
trackRef,
|
|
6799
|
+
handleMouseDown,
|
|
6800
|
+
handleClickTrack,
|
|
6801
|
+
positions: {
|
|
6802
|
+
start: startPosition,
|
|
6803
|
+
end: endPosition,
|
|
6804
|
+
width
|
|
6805
|
+
}
|
|
6806
|
+
};
|
|
6807
|
+
};
|
|
6808
|
+
var Slider = ({
|
|
6809
|
+
min = 0,
|
|
6810
|
+
max,
|
|
6811
|
+
step = 1,
|
|
6812
|
+
defaultRange = { min: 0, max: 0 },
|
|
6813
|
+
handleRange,
|
|
6814
|
+
isDisabled = false,
|
|
6815
|
+
selectedColor = "shopl300"
|
|
6816
|
+
}) => {
|
|
6817
|
+
const { range, trackRef, handleMouseDown, handleClickTrack, positions } = useSlider({
|
|
6818
|
+
bounds: { min, max },
|
|
6819
|
+
step,
|
|
6820
|
+
defaultRange,
|
|
6821
|
+
handleRange,
|
|
6822
|
+
isDisabled
|
|
6823
|
+
});
|
|
6824
|
+
return /* @__PURE__ */ jsx(SliderContainer, { isDisabled, children: /* @__PURE__ */ jsxs(SliderTrack, { ref: trackRef, onClick: handleClickTrack, children: [
|
|
6825
|
+
/* @__PURE__ */ jsx(SliderSteps, { bounds: { min, max }, step, range }),
|
|
6826
|
+
/* @__PURE__ */ jsx(
|
|
6827
|
+
SelectedTrack,
|
|
6828
|
+
{
|
|
6829
|
+
selectedColor,
|
|
6830
|
+
startPosition: `calc(${positions.start}% - 12px)`,
|
|
6831
|
+
width: `calc(${positions.width}% + 24px)`
|
|
6832
|
+
}
|
|
6833
|
+
),
|
|
6834
|
+
/* @__PURE__ */ jsx(
|
|
6835
|
+
SliderThumbs,
|
|
6836
|
+
{
|
|
6837
|
+
positions: [positions.start, positions.end],
|
|
6838
|
+
isDisabled,
|
|
6839
|
+
selectedColor,
|
|
6840
|
+
onMouseDown: handleMouseDown,
|
|
6841
|
+
values: range
|
|
6842
|
+
}
|
|
6843
|
+
)
|
|
6844
|
+
] }) });
|
|
6845
|
+
};
|
|
6846
|
+
var Slider_default = Slider;
|
|
6557
6847
|
var SpaceMarginWrapper = styled6(motion.div)`
|
|
6558
6848
|
position: relative;
|
|
6559
6849
|
display: flex;
|
|
@@ -6608,4 +6898,4 @@ classnames/index.js:
|
|
|
6608
6898
|
*)
|
|
6609
6899
|
*/
|
|
6610
6900
|
|
|
6611
|
-
export { AnnualDatepicker_default as AnnualDatepicker, Avatar_default as Avatar, AvatarSizeVariants, Button_default as Button, ButtonSizeVariants, ButtonStyleVariants, CHECKBOX_SYMBOL_KEY, Callout_default as Callout, CalloutTypes, Checkbox_default as Checkbox, CheckboxStyleVariants, ChipButton_default as ChipButton, ChipButtonSizeVariants, ChipButtonStyleVariants, ChipToggle_default as ChipToggle, ChipToggleSizeVariants, ChipToggleStyleVariants, DayDatepicker_default as DayDatepicker, DayDatepickerSizeVariants, Dropdown_default as Dropdown, DropdownButton_default as DropdownButton, DropdownButtonContext, DropdownButtonSizeVariants, DropdownButtonStyleVariants, DropdownOptionVariants, Icon_default as Icon, IconButton_default as IconButton, IconButtonSizeVariants, IconButtonStyleVariants, IconSizeVariants, Input_default as Input, InputButton_default as InputButton, InputSizeVariants, List_default as List, MODAL_FOOTER_KEY, MODAL_HEADER_KEY, Menu_default as Menu, MenuSizeVariants, MinusButton_default as MinusButton, Modal, ModalContext, ModalHandlerContext, ModalPortal_default as ModalProvider, ModalSize, MonthDatepicker_default as MonthDatepicker, MotionStack, MotionStackContainer, NumberCombobox_default as NumberCombobox, NumberComboboxSizeVariants, Pagination_default as Pagination, Popper_default as Popper, PopperPortal, PopperTrigger, RADIO_SYMBOL_KEY, Radio_default as Radio, ScrollArea_default as ScrollArea, SelectInputButton_default as SelectInputButton, ShoplflowProvider_default as ShoplflowProvider, Skeleton_default as Skeleton, SplitButton_default as SplitButton, SplitButtonContext, SplitButtonSizeVariants, SplitButtonStyleVariants, Stack_default as Stack, StackContainer_default as StackContainer, StyledIcon, StyledStack, StyledStackContainer, Switch_default as Switch, TREE_SYMBOL_KEY, TabSizeVariants, TabStyleVariants, Tabs_default as Tabs, TabsContext, Tag_default as Tag, TagSizeVariants, TagStyleVariants, Text_default as Text, Text2Rows, TextArea_default as TextArea, ToggleButton_default as ToggleButton, ToggleButtonSizeVariants, Tooltip_default as Tooltip, Tree_default as Tree, TreeItem, WeekDatepicker_default as WeekDatepicker, borderRadiusTokens, boxShadowTokens, colorTokens, fontWeightTokens, getDomain, spacingTokens, typographyTokens, useDomain, useDropdownButtonContext, useHandleModal, useModalValue, useSplitButtonContext, useTabs };
|
|
6901
|
+
export { AnnualDatepicker_default as AnnualDatepicker, Avatar_default as Avatar, AvatarSizeVariants, Button_default as Button, ButtonSizeVariants, ButtonStyleVariants, CHECKBOX_SYMBOL_KEY, Callout_default as Callout, CalloutTypes, Checkbox_default as Checkbox, CheckboxStyleVariants, ChipButton_default as ChipButton, ChipButtonSizeVariants, ChipButtonStyleVariants, ChipToggle_default as ChipToggle, ChipToggleSizeVariants, ChipToggleStyleVariants, DayDatepicker_default as DayDatepicker, DayDatepickerSizeVariants, Dropdown_default as Dropdown, DropdownButton_default as DropdownButton, DropdownButtonContext, DropdownButtonSizeVariants, DropdownButtonStyleVariants, DropdownOptionVariants, Icon_default as Icon, IconButton_default as IconButton, IconButtonSizeVariants, IconButtonStyleVariants, IconSizeVariants, Input_default as Input, InputButton_default as InputButton, InputSizeVariants, List_default as List, MODAL_FOOTER_KEY, MODAL_HEADER_KEY, Menu_default as Menu, MenuSizeVariants, MinusButton_default as MinusButton, Modal, ModalContext, ModalHandlerContext, ModalPortal_default as ModalProvider, ModalSize, MonthDatepicker_default as MonthDatepicker, MotionStack, MotionStackContainer, NumberCombobox_default as NumberCombobox, NumberComboboxSizeVariants, Pagination_default as Pagination, Popper_default as Popper, PopperPortal, PopperTrigger, RADIO_SYMBOL_KEY, Radio_default as Radio, SLIDER_Z_INDEX, ScrollArea_default as ScrollArea, SelectInputButton_default as SelectInputButton, ShoplflowProvider_default as ShoplflowProvider, Skeleton_default as Skeleton, Slider_default as Slider, SplitButton_default as SplitButton, SplitButtonContext, SplitButtonSizeVariants, SplitButtonStyleVariants, Stack_default as Stack, StackContainer_default as StackContainer, StyledIcon, StyledStack, StyledStackContainer, Switch_default as Switch, TREE_SYMBOL_KEY, TabSizeVariants, TabStyleVariants, Tabs_default as Tabs, TabsContext, Tag_default as Tag, TagSizeVariants, TagStyleVariants, Text_default as Text, Text2Rows, TextArea_default as TextArea, ToggleButton_default as ToggleButton, ToggleButtonSizeVariants, Tooltip_default as Tooltip, Tree_default as Tree, TreeItem, WeekDatepicker_default as WeekDatepicker, borderRadiusTokens, boxShadowTokens, colorTokens, fontWeightTokens, getDomain, spacingTokens, typographyTokens, useDomain, useDropdownButtonContext, useHandleModal, useModalValue, useSplitButtonContext, useTabs };
|