@team-monolith/cds 1.120.0 → 1.120.2
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/components/Slider.d.ts +5 -6
- package/dist/components/Slider.js +24 -25
- package/package.json +1 -1
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { SliderProps as MuiSliderProps } from "@mui/material";
|
|
2
2
|
import React from "react";
|
|
3
|
-
export interface SliderProps extends Omit<MuiSliderProps, "onChangeCommitted"> {
|
|
4
|
-
className?: string;
|
|
5
|
-
/** 슬라이더의 최소값 (기본값: 0) */
|
|
6
|
-
min?: number;
|
|
7
|
-
/** 슬라이더의 최대값 (기본값: 100) */
|
|
8
|
-
max?: number;
|
|
3
|
+
export interface SliderProps extends Omit<MuiSliderProps, "defaultValue" | "marks" | "onChangeCommitted"> {
|
|
9
4
|
/** 슬라이더의 기본값 (없는 경우 최소값을 사용) */
|
|
10
5
|
defaultValue?: number;
|
|
11
6
|
/** 슬라이더 하단의 마크 배열 */
|
|
@@ -18,4 +13,8 @@ export interface SliderProps extends Omit<MuiSliderProps, "onChangeCommitted"> {
|
|
|
18
13
|
/** 값 레이블에 단위를 렌더링하는 함수 */
|
|
19
14
|
renderUnit?: (count: number) => string;
|
|
20
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Mui Slider를 기반으로 하는 단일 슬라이더 컴포넌트
|
|
18
|
+
* /images/2025-10-20-14-53-48.png
|
|
19
|
+
*/
|
|
21
20
|
export declare const Slider: React.ForwardRefExoticComponent<Omit<SliderProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -15,27 +15,28 @@ import { css } from "@emotion/react";
|
|
|
15
15
|
import { Slider as MuiSlider, } from "@mui/material";
|
|
16
16
|
import React from "react";
|
|
17
17
|
import { shadows } from "../foundation/shadows";
|
|
18
|
+
const SLIDER_THUMB_SIZE = 42;
|
|
19
|
+
/**
|
|
20
|
+
* Mui Slider를 기반으로 하는 단일 슬라이더 컴포넌트
|
|
21
|
+
* /images/2025-10-20-14-53-48.png
|
|
22
|
+
*/
|
|
18
23
|
export const Slider = React.forwardRef(function Slider(props, ref) {
|
|
19
|
-
var _a, _b;
|
|
20
24
|
const { onChangeCommitted, renderUnit } = props, others = __rest(props, ["onChangeCommitted", "renderUnit"]);
|
|
21
|
-
return (_jsx(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
return (_jsx(StyledSlider, Object.assign({ ref: ref }, others, { valueLabelDisplay: "on", valueLabelFormat: (value) => { var _a; return (_a = renderUnit === null || renderUnit === void 0 ? void 0 : renderUnit(value)) !== null && _a !== void 0 ? _a : value; }, onChangeCommitted: (_e, value) => {
|
|
26
|
+
// AIDEV-NOTE:
|
|
27
|
+
// MUI Slider onChangeCommitted 콜백의 value는 number | number[] 타입이지만
|
|
28
|
+
// 해당 컴포넌트는 항상 단일 슬라이더이므로 number 타입만 처리함
|
|
29
|
+
if (Array.isArray(value))
|
|
30
|
+
return;
|
|
31
|
+
onChangeCommitted === null || onChangeCommitted === void 0 ? void 0 : onChangeCommitted(value);
|
|
32
|
+
} })));
|
|
29
33
|
});
|
|
30
|
-
const
|
|
31
|
-
padding: 0 21px; // thumb 크기(42px)의 절반만큼 좌우 여백 추가
|
|
32
|
-
`;
|
|
33
|
-
const StyledSlider = styled(MuiSlider, {
|
|
34
|
-
shouldForwardProp: (prop) => prop !== "marksLength",
|
|
35
|
-
})(({ theme, marksLength }) => css `
|
|
34
|
+
const StyledSlider = styled(MuiSlider)(({ theme }) => css `
|
|
36
35
|
// figma 디자인과 간격 맞추기 위해 조정
|
|
37
36
|
padding: 7px 0;
|
|
38
|
-
|
|
37
|
+
// thumb 크기(SLIDER_THUMB_SIZE)의 절반만큼 좌우 여백 제외한 너비
|
|
38
|
+
width: calc(100% - ${SLIDER_THUMB_SIZE}px);
|
|
39
|
+
margin: 24px ${SLIDER_THUMB_SIZE / 2}px 0;
|
|
39
40
|
&.MuiSlider-marked {
|
|
40
41
|
margin-bottom: 20px;
|
|
41
42
|
}
|
|
@@ -43,20 +44,25 @@ const StyledSlider = styled(MuiSlider, {
|
|
|
43
44
|
.MuiSlider-rail {
|
|
44
45
|
border-radius: 100px;
|
|
45
46
|
background: ${theme.color.foreground.neutralBaseDisabled};
|
|
47
|
+
opacity: 1;
|
|
46
48
|
}
|
|
47
49
|
.MuiSlider-track {
|
|
48
50
|
border-radius: 100px;
|
|
49
51
|
background: ${theme.color.foreground.primary};
|
|
50
52
|
}
|
|
51
53
|
.MuiSlider-thumb {
|
|
52
|
-
width:
|
|
54
|
+
width: ${SLIDER_THUMB_SIZE}px;
|
|
53
55
|
height: 18px;
|
|
54
56
|
border-radius: 23px;
|
|
55
57
|
border: 2px solid ${theme.color.foreground.neutralBaseDisabled};
|
|
56
|
-
background:
|
|
58
|
+
background: ${theme.color.background.neutralBase};
|
|
57
59
|
/* Shadow-4 */
|
|
58
60
|
box-shadow: ${shadows.shadow04};
|
|
59
61
|
|
|
62
|
+
&:before {
|
|
63
|
+
box-shadow: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
60
66
|
.MuiSlider-valueLabel {
|
|
61
67
|
background: transparent;
|
|
62
68
|
padding: 0;
|
|
@@ -82,12 +88,5 @@ const StyledSlider = styled(MuiSlider, {
|
|
|
82
88
|
font-weight: 500;
|
|
83
89
|
line-height: 16px; /* 133.333% */
|
|
84
90
|
top: 22px; // figma 디자인과 간격 맞추기 위해 조정
|
|
85
|
-
|
|
86
|
-
&[data-index="0"] {
|
|
87
|
-
transform: translateX(0%);
|
|
88
|
-
}
|
|
89
|
-
&[data-index="${marksLength - 1}"] {
|
|
90
|
-
transform: translateX(-100%);
|
|
91
|
-
}
|
|
92
91
|
}
|
|
93
92
|
`);
|