pds-dev-kit-web 2.1.8 → 2.1.10

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 (41) hide show
  1. package/dist/src/common/assets/icons/fill/Accordion.d.ts +4 -0
  2. package/dist/src/common/assets/icons/fill/Accordion.js +30 -0
  3. package/dist/src/common/assets/icons/fill/Download.d.ts +4 -0
  4. package/dist/src/common/assets/icons/fill/Download.js +30 -0
  5. package/dist/src/common/assets/icons/fill/Information.d.ts +4 -0
  6. package/dist/src/common/assets/icons/fill/Information.js +30 -0
  7. package/dist/src/common/assets/icons/fill/LightBulb.d.ts +4 -0
  8. package/dist/src/common/assets/icons/fill/LightBulb.js +30 -0
  9. package/dist/src/common/assets/icons/fill/MenuDesign.d.ts +4 -0
  10. package/dist/src/common/assets/icons/fill/MenuDesign.js +30 -0
  11. package/dist/src/common/assets/icons/fill/index.d.ts +5 -0
  12. package/dist/src/common/assets/icons/fill/index.js +10 -0
  13. package/dist/src/common/assets/icons/line/Accordion.d.ts +4 -0
  14. package/dist/src/common/assets/icons/line/Accordion.js +30 -0
  15. package/dist/src/common/assets/icons/line/Download.js +1 -1
  16. package/dist/src/common/assets/icons/line/LightBulb.d.ts +4 -0
  17. package/dist/src/common/assets/icons/line/LightBulb.js +30 -0
  18. package/dist/src/common/assets/icons/line/MenuDesign.d.ts +4 -0
  19. package/dist/src/common/assets/icons/line/MenuDesign.js +30 -0
  20. package/dist/src/common/assets/icons/line/PostStorage.d.ts +4 -0
  21. package/dist/src/common/assets/icons/line/PostStorage.js +30 -0
  22. package/dist/src/common/assets/icons/line/SectionCustom32.d.ts +4 -0
  23. package/dist/src/common/assets/icons/line/SectionCustom32.js +30 -0
  24. package/dist/src/common/assets/icons/line/SectionCustom40.d.ts +4 -0
  25. package/dist/src/common/assets/icons/line/SectionCustom40.js +30 -0
  26. package/dist/src/common/assets/icons/line/Target.d.ts +4 -0
  27. package/dist/src/common/assets/icons/line/Target.js +30 -0
  28. package/dist/src/common/assets/icons/line/index.d.ts +7 -0
  29. package/dist/src/common/assets/icons/line/index.js +14 -0
  30. package/dist/src/common/styles/colorSet/PaletteColor_Dark.json +1 -1
  31. package/dist/src/common/styles/colorSet/PaletteColor_light.json +1 -1
  32. package/dist/src/common/styles/colorSet/UIColor.json +3 -1
  33. package/dist/src/common/styles/colorSet/index.d.ts +811 -809
  34. package/dist/src/common/styles/colorSet/index.js +3 -3
  35. package/dist/src/common/styles/colorSet/ui-type.d.ts +2 -0
  36. package/dist/src/desktop/components/Slider/Slider.d.ts +1 -1
  37. package/dist/src/desktop/components/Slider/Slider.js +21 -39
  38. package/dist/src/mobile/components/Slider/Slider.d.ts +1 -1
  39. package/dist/src/mobile/components/Slider/Slider.js +21 -39
  40. package/package.json +1 -1
  41. package/release-note.md +12 -28
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  /* eslint-disable import/order */
7
7
  var SemanticColor_json_1 = __importDefault(require("./SemanticColor.json"));
8
- var UIColor_json_1 = __importDefault(require("./UIColor.json"));
9
8
  var PaletteColor_Dark_json_1 = __importDefault(require("./PaletteColor_Dark.json"));
10
9
  var PaletteColor_light_json_1 = __importDefault(require("./PaletteColor_light.json"));
10
+ var UIColor_json_1 = __importDefault(require("./UIColor.json"));
11
11
  var colorSet = {
12
12
  SemanticColor: SemanticColor_json_1.default,
13
- UIColor: UIColor_json_1.default,
14
13
  PaletteColor_Dark: PaletteColor_Dark_json_1.default,
15
- PaletteColor_light: PaletteColor_light_json_1.default
14
+ PaletteColor_light: PaletteColor_light_json_1.default,
15
+ UIColor: UIColor_json_1.default
16
16
  };
17
17
  exports.default = colorSet;
@@ -806,4 +806,6 @@ export interface UITheme {
806
806
  ui_editor_layout_control_panel: string;
807
807
  ui_editor_layout_property_panel: string;
808
808
  ui_editor_layout_navigation_panel_section_item_area_normal: string;
809
+ ui_editor_scroll_bar: string;
810
+ ui_editor_scroll_track: string;
809
811
  }
@@ -5,7 +5,7 @@ export declare type Props = {
5
5
  max: number;
6
6
  step?: number;
7
7
  name?: string;
8
- defaultValue?: string | number;
8
+ value: number;
9
9
  tooltipText?: PDSTextType;
10
10
  state?: 'normal' | 'disabled';
11
11
  prefixText?: PDSTextType;
@@ -24,13 +24,20 @@ var components_1 = require("../../../hybrid/components");
24
24
  var styled_components_1 = __importDefault(require("styled-components"));
25
25
  var TextLabel_1 = require("../TextLabel");
26
26
  function Slider(_a, ref) {
27
- var min = _a.min, max = _a.max, _b = _a.step, step = _b === void 0 ? 1 : _b, name = _a.name, defaultValue = _a.defaultValue, tooltipText = _a.tooltipText, _c = _a.state, state = _c === void 0 ? 'normal' : _c, prefixText = _a.prefixText, suffixText = _a.suffixText, customWidth = _a.customWidth, _d = _a.responsiveMode, responsiveMode = _d === void 0 ? 'none' : _d, onChange = _a.onChange, onClick = _a.onClick;
27
+ var min = _a.min, max = _a.max, _b = _a.step, step = _b === void 0 ? 1 : _b, name = _a.name, value = _a.value, tooltipText = _a.tooltipText, _c = _a.state, state = _c === void 0 ? 'normal' : _c, prefixText = _a.prefixText, suffixText = _a.suffixText, customWidth = _a.customWidth, _d = _a.responsiveMode, responsiveMode = _d === void 0 ? 'none' : _d, onChange = _a.onChange, onClick = _a.onClick;
28
28
  var _e = (0, react_1.useState)(false), isTooltipVisible = _e[0], setIsTooltipVisible = _e[1];
29
29
  var _f = (0, react_1.useState)(false), isDragging = _f[0], setIsDragActive = _f[1];
30
30
  var trackRef = (0, react_1.useRef)(null);
31
31
  var thumbRef = (0, react_1.useRef)(null);
32
32
  var inputRef = (0, react_1.useRef)(null);
33
- var defaultThumbPercentage = ((Number(defaultValue || (max - min) / 2 + min) - min) / (max - min)) * 100;
33
+ (0, react_1.useEffect)(function () {
34
+ if (!trackRef.current || !thumbRef.current) {
35
+ return;
36
+ }
37
+ var width = trackRef.current.getBoundingClientRect().width;
38
+ var thumbPosition = getThumbPositionOnTrack((value - min) / (max - min), value, width);
39
+ updateFillTrackAndThumb(trackRef.current, thumbRef.current, thumbPosition);
40
+ }, [value]);
34
41
  function getPercent(pointValue, width) {
35
42
  if (pointValue <= 0) {
36
43
  return 0;
@@ -43,47 +50,34 @@ function Slider(_a, ref) {
43
50
  function percentToValue(percent, min, max) {
44
51
  return (max - min) * percent + min;
45
52
  }
46
- function getInputValue(inputRef, trackValue) {
47
- var result = { prevInputValue: '', newInputValue: '' };
48
- if (inputRef.current === null) {
49
- return result;
50
- }
51
- result.prevInputValue = inputRef.current.value;
52
- inputRef.current.value = String(trackValue);
53
- result.newInputValue = inputRef.current.value;
54
- return result;
55
- }
56
53
  function getThumbOffset(percent, width) {
57
54
  return ((width * percent - width / 2) / (width / 2)) * -10;
58
55
  }
59
- var getNewInputValue = function (clientX, left, width) {
56
+ var getNewValue = function (clientX, left, width) {
60
57
  var percent = getPercent(clientX - (left + 10), width - 20);
61
58
  var newValue = percentToValue(percent, min, max);
62
- var _a = getInputValue(inputRef, newValue), prevInputValue = _a.prevInputValue, newInputValue = _a.newInputValue;
63
- if (prevInputValue === newInputValue) {
64
- return null;
65
- }
66
- return newInputValue;
59
+ return String(newValue);
67
60
  };
68
61
  var getThumbPositionOnTrack = function (percent, value, width) {
69
62
  var thumbOffset = getThumbOffset(percent, width);
70
- return "calc(" + (Number(value) / (max - min)) * 100 + "% + " + thumbOffset + "px)";
63
+ return "calc(" + ((Number(value) - min) / (max - min)) * 100 + "% + " + thumbOffset + "px)";
71
64
  };
72
65
  var updateFillTrackAndThumb = function (trackElement, thumbElement, thumbPosition) {
73
66
  trackElement.style.backgroundSize = thumbPosition + " 100%";
74
67
  thumbElement.style.left = thumbPosition;
75
68
  };
76
69
  var changeSliderValue = function (clientX) {
77
- if (inputRef.current === null || thumbRef.current === null || trackRef.current === null) {
70
+ if (inputRef.current === null || trackRef.current === null) {
78
71
  return;
79
72
  }
80
73
  var _a = trackRef.current.getBoundingClientRect(), left = _a.left, width = _a.width;
81
- var newInputValue = getNewInputValue(clientX, left, width);
82
- if (newInputValue === null) {
74
+ var newValue = getNewValue(clientX, left, width);
75
+ var prevInputValue = inputRef.current.value;
76
+ inputRef.current.value = String(newValue);
77
+ var newInputValue = inputRef.current.value;
78
+ if (prevInputValue === newInputValue) {
83
79
  return;
84
80
  }
85
- var thumbPosition = getThumbPositionOnTrack(Number(newInputValue) / (max - min), newInputValue, width);
86
- updateFillTrackAndThumb(trackRef.current, thumbRef.current, thumbPosition);
87
81
  inputRef.current.dispatchEvent(new Event('input', { bubbles: true }));
88
82
  };
89
83
  var handleMouseMove = function (e) {
@@ -113,12 +107,6 @@ function Slider(_a, ref) {
113
107
  document.addEventListener('mouseup', handleMouseUp, { once: true });
114
108
  };
115
109
  var handleChange = function (e) {
116
- if (trackRef.current === null || thumbRef.current === null) {
117
- return;
118
- }
119
- var width = trackRef.current.getBoundingClientRect().width;
120
- var thumbPosition = getThumbPositionOnTrack(Number(e.currentTarget.value) / (max - min), e.currentTarget.value, width);
121
- updateFillTrackAndThumb(trackRef.current, thumbRef.current, thumbPosition);
122
110
  if (onChange) {
123
111
  onChange(e);
124
112
  }
@@ -137,7 +125,7 @@ function Slider(_a, ref) {
137
125
  }
138
126
  inputRef.current = node;
139
127
  };
140
- return ((0, jsx_runtime_1.jsxs)(S_SliderBox, __assign({ "x-pds-name": "Slider", "x-pds-element-type": "component", "x-pds-device-type": "desktop" }, { children: [prefixText && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: prefixText, styleTheme: "caption2Bold", colorTheme: state === 'normal' ? 'sysTextSecondary' : 'sysTextTertiary', singleLineMode: "use", textAlign: "right" }, void 0), (0, jsx_runtime_1.jsx)(components_1.Spacing, { spacingType: "width", size: "spacing_b" }, void 0)] }, void 0)), (0, jsx_runtime_1.jsx)(S_SliderWrapper, __assign({ customWidth: customWidth, responsiveMode: responsiveMode }, { children: (0, jsx_runtime_1.jsxs)(S_Slider, __assign({ customWidth: customWidth, isDisabled: state === 'disabled', responsiveMode: responsiveMode, thumbPercentage: defaultThumbPercentage, onMouseDown: handleMouseDown }, { children: [(0, jsx_runtime_1.jsx)(S_Track, { ref: trackRef, thumbPercentage: defaultThumbPercentage, isDisabled: state === 'disabled' }, void 0), (0, jsx_runtime_1.jsxs)(S_Thumb, __assign({ ref: thumbRef, thumbPercentage: defaultThumbPercentage, isDragging: isDragging, isDisabled: state === 'disabled' }, { children: [(0, jsx_runtime_1.jsx)(S_Range, { ref: handleRangeRef, type: "range", name: name, min: min, max: max, step: step, defaultValue: defaultValue, onInput: handleChange, onClick: handleClick }, void 0), tooltipText && isTooltipVisible && ((0, jsx_runtime_1.jsx)(S_Tooltip, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: tooltipText, styleTheme: "caption2Regular", colorOverride: "ui_cpnt_textlabel_button_tooltip", singleLineMode: "use" }, void 0) }, void 0))] }), void 0)] }), void 0) }), void 0), suffixText && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Spacing, { spacingType: "width", size: "spacing_b" }, void 0), (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: suffixText, styleTheme: "caption2Bold", colorTheme: state === 'normal' ? 'sysTextSecondary' : 'sysTextTertiary', singleLineMode: "use" }, void 0)] }, void 0))] }), void 0));
128
+ return ((0, jsx_runtime_1.jsxs)(S_SliderBox, __assign({ "x-pds-name": "Slider", "x-pds-element-type": "component", "x-pds-device-type": "desktop" }, { children: [prefixText && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: prefixText, styleTheme: "caption2Bold", colorTheme: state === 'normal' ? 'sysTextSecondary' : 'sysTextTertiary', singleLineMode: "use", textAlign: "right" }, void 0), (0, jsx_runtime_1.jsx)(components_1.Spacing, { spacingType: "width", size: "spacing_b" }, void 0)] }, void 0)), (0, jsx_runtime_1.jsx)(S_SliderWrapper, __assign({ customWidth: customWidth, responsiveMode: responsiveMode }, { children: (0, jsx_runtime_1.jsxs)(S_Slider, __assign({ customWidth: customWidth, isDisabled: state === 'disabled', responsiveMode: responsiveMode, onMouseDown: handleMouseDown }, { children: [(0, jsx_runtime_1.jsx)(S_Track, { ref: trackRef, isDisabled: state === 'disabled' }, void 0), (0, jsx_runtime_1.jsxs)(S_Thumb, __assign({ ref: thumbRef, isDragging: isDragging, isDisabled: state === 'disabled' }, { children: [(0, jsx_runtime_1.jsx)(S_Range, { ref: handleRangeRef, type: "range", name: name, min: min, max: max, step: step, value: value, onInput: handleChange, onClick: handleClick }, void 0), !!tooltipText && isTooltipVisible && ((0, jsx_runtime_1.jsx)(S_Tooltip, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: tooltipText, styleTheme: "caption2Regular", colorOverride: "ui_cpnt_textlabel_button_tooltip", singleLineMode: "use" }, void 0) }, void 0))] }), void 0)] }), void 0) }), void 0), suffixText && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Spacing, { spacingType: "width", size: "spacing_b" }, void 0), (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: suffixText, styleTheme: "caption2Bold", colorTheme: state === 'normal' ? 'sysTextSecondary' : 'sysTextTertiary', singleLineMode: "use" }, void 0)] }, void 0))] }), void 0));
141
129
  }
142
130
  var S_SliderBox = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n display: flex;\n flex-direction: row;\n"], ["\n align-items: center;\n display: flex;\n flex-direction: row;\n"])));
143
131
  var S_SliderWrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n position: relative;\n width: ", ";\n"], ["\n display: flex;\n position: relative;\n width: ", ";\n"])), function (_a) {
@@ -170,7 +158,7 @@ var S_Slider = styled_components_1.default.div(templateObject_4 || (templateObje
170
158
  }
171
159
  return '324px';
172
160
  });
173
- var S_Track = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n background-size: ", ";\n border-radius: 2px;\n height: 4px;\n position: absolute;\n width: inherit;\n"], ["\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n background-size: ", ";\n border-radius: 2px;\n height: 4px;\n position: absolute;\n width: inherit;\n"])), function (_a) {
161
+ var S_Track = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n border-radius: 2px;\n height: 4px;\n position: absolute;\n width: inherit;\n"], ["\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n border-radius: 2px;\n height: 4px;\n position: absolute;\n width: inherit;\n"])), function (_a) {
174
162
  var theme = _a.theme;
175
163
  return theme.ui_cpnt_slider_track;
176
164
  }, function (_a) {
@@ -178,19 +166,13 @@ var S_Track = styled_components_1.default.div(templateObject_5 || (templateObjec
178
166
  return isDisabled
179
167
  ? "linear-gradient(" + theme.ui_cpnt_slider_track_disabled + ", " + theme.ui_cpnt_slider_track_disabled + ")"
180
168
  : "linear-gradient(" + theme.ui_cpnt_slider_track_active + ", " + theme.ui_cpnt_slider_track_active + ")";
181
- }, function (_a) {
182
- var thumbPercentage = _a.thumbPercentage;
183
- return thumbPercentage + "% 100%";
184
169
  });
185
- var S_Thumb = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 100%;\n box-shadow: ", ";\n display: flex;\n height: 20px;\n justify-content: center;\n left: ", "%;\n position: absolute;\n transform: translateX(-10px);\n width: 20px;\n\n &:hover {\n box-shadow: ", ";\n }\n"], ["\n background-color: ", ";\n border-radius: 100%;\n box-shadow: ", ";\n display: flex;\n height: 20px;\n justify-content: center;\n left: ", "%;\n position: absolute;\n transform: translateX(-10px);\n width: 20px;\n\n &:hover {\n box-shadow: ", ";\n }\n"])), function (_a) {
170
+ var S_Thumb = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 100%;\n box-shadow: ", ";\n display: flex;\n height: 20px;\n justify-content: center;\n position: absolute;\n transform: translateX(-10px);\n width: 20px;\n\n &:hover {\n box-shadow: ", ";\n }\n"], ["\n background-color: ", ";\n border-radius: 100%;\n box-shadow: ", ";\n display: flex;\n height: 20px;\n justify-content: center;\n position: absolute;\n transform: translateX(-10px);\n width: 20px;\n\n &:hover {\n box-shadow: ", ";\n }\n"])), function (_a) {
186
171
  var theme = _a.theme, isDisabled = _a.isDisabled;
187
172
  return isDisabled ? theme.ui_cpnt_slider_thumb_disabled : theme.ui_cpnt_slider_thumb_normal;
188
173
  }, function (_a) {
189
174
  var theme = _a.theme, isDragging = _a.isDragging, isDisabled = _a.isDisabled;
190
175
  return isDragging && !isDisabled ? "0 0 0 8px " + theme.ui_cpnt_slider_thumb_pressed_circle : 'none';
191
- }, function (_a) {
192
- var thumbPercentage = _a.thumbPercentage;
193
- return thumbPercentage;
194
176
  }, function (_a) {
195
177
  var theme = _a.theme, isDragging = _a.isDragging, isDisabled = _a.isDisabled;
196
178
  return !isDragging && !isDisabled && "0 0 0 8px " + theme.ui_cpnt_slider_thumb_hover_circle;
@@ -5,7 +5,7 @@ export declare type Props = {
5
5
  max: number;
6
6
  step?: number;
7
7
  name?: string;
8
- defaultValue?: string | number;
8
+ value: number;
9
9
  tooltipText?: PDSTextType;
10
10
  state?: 'normal' | 'disabled';
11
11
  prefixText?: PDSTextType;
@@ -24,13 +24,20 @@ var components_1 = require("../../../hybrid/components");
24
24
  var styled_components_1 = __importDefault(require("styled-components"));
25
25
  var TextLabel_1 = require("../TextLabel");
26
26
  function Slider(_a, ref) {
27
- var min = _a.min, max = _a.max, _b = _a.step, step = _b === void 0 ? 1 : _b, name = _a.name, defaultValue = _a.defaultValue, tooltipText = _a.tooltipText, _c = _a.state, state = _c === void 0 ? 'normal' : _c, prefixText = _a.prefixText, suffixText = _a.suffixText, customWidth = _a.customWidth, _d = _a.responsiveMode, responsiveMode = _d === void 0 ? 'none' : _d, onChange = _a.onChange, onClick = _a.onClick;
27
+ var min = _a.min, max = _a.max, _b = _a.step, step = _b === void 0 ? 1 : _b, name = _a.name, value = _a.value, tooltipText = _a.tooltipText, _c = _a.state, state = _c === void 0 ? 'normal' : _c, prefixText = _a.prefixText, suffixText = _a.suffixText, customWidth = _a.customWidth, _d = _a.responsiveMode, responsiveMode = _d === void 0 ? 'none' : _d, onChange = _a.onChange, onClick = _a.onClick;
28
28
  var _e = (0, react_1.useState)(false), isTooltipVisible = _e[0], setIsTooltipVisible = _e[1];
29
29
  var _f = (0, react_1.useState)(false), isTouching = _f[0], setIsTouching = _f[1];
30
30
  var trackRef = (0, react_1.useRef)(null);
31
31
  var thumbRef = (0, react_1.useRef)(null);
32
32
  var inputRef = (0, react_1.useRef)(null);
33
- var defaultThumbPercentage = ((Number(defaultValue || (max - min) / 2 + min) - min) / (max - min)) * 100;
33
+ (0, react_1.useEffect)(function () {
34
+ if (!trackRef.current || !thumbRef.current) {
35
+ return;
36
+ }
37
+ var width = trackRef.current.getBoundingClientRect().width;
38
+ var thumbPosition = getThumbPositionOnTrack((value - min) / (max - min), value, width);
39
+ updateFillTrackAndThumb(trackRef.current, thumbRef.current, thumbPosition);
40
+ }, [value]);
34
41
  function getPercent(pointValue, width) {
35
42
  if (pointValue <= 0) {
36
43
  return 0;
@@ -43,47 +50,34 @@ function Slider(_a, ref) {
43
50
  function percentToValue(percent, min, max) {
44
51
  return (max - min) * percent + min;
45
52
  }
46
- function getInputValue(inputRef, trackValue) {
47
- var result = { prevInputValue: '', newInputValue: '' };
48
- if (inputRef.current === null) {
49
- return result;
50
- }
51
- result.prevInputValue = inputRef.current.value;
52
- inputRef.current.value = String(trackValue);
53
- result.newInputValue = inputRef.current.value;
54
- return result;
55
- }
56
53
  function getThumbOffset(percent, width) {
57
54
  return ((width * percent - width / 2) / (width / 2)) * -10;
58
55
  }
59
- var getNewInputValue = function (clientX, left, width) {
56
+ var getNewValue = function (clientX, left, width) {
60
57
  var percent = getPercent(clientX - (left + 10), width - 20);
61
58
  var newValue = percentToValue(percent, min, max);
62
- var _a = getInputValue(inputRef, newValue), prevInputValue = _a.prevInputValue, newInputValue = _a.newInputValue;
63
- if (prevInputValue === newInputValue) {
64
- return null;
65
- }
66
- return newInputValue;
59
+ return String(newValue);
67
60
  };
68
61
  var getThumbPositionOnTrack = function (percent, value, width) {
69
62
  var thumbOffset = getThumbOffset(percent, width);
70
- return "calc(" + (Number(value) / (max - min)) * 100 + "% + " + thumbOffset + "px)";
63
+ return "calc(" + ((Number(value) - min) / (max - min)) * 100 + "% + " + thumbOffset + "px)";
71
64
  };
72
65
  var updateFillTrackAndThumb = function (trackElement, thumbElement, thumbPosition) {
73
66
  trackElement.style.backgroundSize = thumbPosition + " 100%";
74
67
  thumbElement.style.left = thumbPosition;
75
68
  };
76
69
  var changeSliderValue = function (clientX) {
77
- if (inputRef.current === null || thumbRef.current === null || trackRef.current === null) {
70
+ if (inputRef.current === null || trackRef.current === null) {
78
71
  return;
79
72
  }
80
73
  var _a = trackRef.current.getBoundingClientRect(), left = _a.left, width = _a.width;
81
- var newInputValue = getNewInputValue(clientX, left, width);
82
- if (newInputValue === null) {
74
+ var newValue = getNewValue(clientX, left, width);
75
+ var prevInputValue = inputRef.current.value;
76
+ inputRef.current.value = String(newValue);
77
+ var newInputValue = inputRef.current.value;
78
+ if (prevInputValue === newInputValue) {
83
79
  return;
84
80
  }
85
- var thumbPosition = getThumbPositionOnTrack(Number(newInputValue) / (max - min), newInputValue, width);
86
- updateFillTrackAndThumb(trackRef.current, thumbRef.current, thumbPosition);
87
81
  inputRef.current.dispatchEvent(new Event('input', { bubbles: true }));
88
82
  };
89
83
  var handleTouchMove = function (e) {
@@ -113,12 +107,6 @@ function Slider(_a, ref) {
113
107
  document.addEventListener('touchend', handleTouchEnd, { once: true });
114
108
  };
115
109
  var handleChange = function (e) {
116
- if (trackRef.current === null || thumbRef.current === null) {
117
- return;
118
- }
119
- var width = trackRef.current.getBoundingClientRect().width;
120
- var thumbPosition = getThumbPositionOnTrack(Number(e.currentTarget.value) / (max - min), e.currentTarget.value, width);
121
- updateFillTrackAndThumb(trackRef.current, thumbRef.current, thumbPosition);
122
110
  if (onChange) {
123
111
  onChange(e);
124
112
  }
@@ -137,7 +125,7 @@ function Slider(_a, ref) {
137
125
  }
138
126
  inputRef.current = node;
139
127
  };
140
- return ((0, jsx_runtime_1.jsxs)(S_SliderBox, __assign({ "x-pds-name": "Slider", "x-pds-element-type": "component", "x-pds-device-type": "mobile" }, { children: [prefixText && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: prefixText, styleTheme: "caption2Bold", colorTheme: state === 'normal' ? 'sysTextSecondary' : 'sysTextTertiary', singleLineMode: "use", textAlign: "right" }, void 0), (0, jsx_runtime_1.jsx)(components_1.Spacing, { spacingType: "width", size: "spacing_b" }, void 0)] }, void 0)), (0, jsx_runtime_1.jsx)(S_SliderWrapper, __assign({ customWidth: customWidth, responsiveMode: responsiveMode }, { children: (0, jsx_runtime_1.jsxs)(S_Slider, __assign({ customWidth: customWidth, isDisabled: state === 'disabled', responsiveMode: responsiveMode, thumbPercentage: defaultThumbPercentage, onTouchStart: handleTouchStart }, { children: [(0, jsx_runtime_1.jsx)(S_Track, { ref: trackRef, thumbPercentage: defaultThumbPercentage, isDisabled: state === 'disabled' }, void 0), (0, jsx_runtime_1.jsxs)(S_Thumb, __assign({ ref: thumbRef, thumbPercentage: defaultThumbPercentage, isTouching: isTouching, isDisabled: state === 'disabled' }, { children: [(0, jsx_runtime_1.jsx)(S_Range, { ref: handleRangeRef, type: "range", name: name, min: min, max: max, step: step, defaultValue: defaultValue, onInput: handleChange, onClick: handleClick }, void 0), tooltipText && isTooltipVisible && ((0, jsx_runtime_1.jsx)(S_Tooltip, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: tooltipText, styleTheme: "caption2Regular", colorOverride: "ui_cpnt_textlabel_button_tooltip", singleLineMode: "use" }, void 0) }, void 0))] }), void 0)] }), void 0) }), void 0), suffixText && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Spacing, { spacingType: "width", size: "spacing_b" }, void 0), (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: suffixText, styleTheme: "caption2Bold", colorTheme: state === 'normal' ? 'sysTextSecondary' : 'sysTextTertiary', singleLineMode: "use" }, void 0)] }, void 0))] }), void 0));
128
+ return ((0, jsx_runtime_1.jsxs)(S_SliderBox, __assign({ "x-pds-name": "Slider", "x-pds-element-type": "component", "x-pds-device-type": "mobile" }, { children: [prefixText && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: prefixText, styleTheme: "caption2Bold", colorTheme: state === 'normal' ? 'sysTextSecondary' : 'sysTextTertiary', singleLineMode: "use", textAlign: "right" }, void 0), (0, jsx_runtime_1.jsx)(components_1.Spacing, { spacingType: "width", size: "spacing_b" }, void 0)] }, void 0)), (0, jsx_runtime_1.jsx)(S_SliderWrapper, __assign({ customWidth: customWidth, responsiveMode: responsiveMode }, { children: (0, jsx_runtime_1.jsxs)(S_Slider, __assign({ customWidth: customWidth, isDisabled: state === 'disabled', responsiveMode: responsiveMode, onTouchStart: handleTouchStart }, { children: [(0, jsx_runtime_1.jsx)(S_Track, { ref: trackRef, isDisabled: state === 'disabled' }, void 0), (0, jsx_runtime_1.jsxs)(S_Thumb, __assign({ ref: thumbRef, isTouching: isTouching, isDisabled: state === 'disabled' }, { children: [(0, jsx_runtime_1.jsx)(S_Range, { ref: handleRangeRef, type: "range", name: name, min: min, max: max, step: step, value: value, onInput: handleChange, onClick: handleClick }, void 0), !!tooltipText && isTooltipVisible && ((0, jsx_runtime_1.jsx)(S_Tooltip, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: tooltipText, styleTheme: "caption2Regular", colorOverride: "ui_cpnt_textlabel_button_tooltip", singleLineMode: "use" }, void 0) }, void 0))] }), void 0)] }), void 0) }), void 0), suffixText && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Spacing, { spacingType: "width", size: "spacing_b" }, void 0), (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: suffixText, styleTheme: "caption2Bold", colorTheme: state === 'normal' ? 'sysTextSecondary' : 'sysTextTertiary', singleLineMode: "use" }, void 0)] }, void 0))] }), void 0));
141
129
  }
142
130
  var S_SliderBox = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n display: flex;\n flex-direction: row;\n"], ["\n align-items: center;\n display: flex;\n flex-direction: row;\n"])));
143
131
  var S_SliderWrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n position: relative;\n width: ", ";\n"], ["\n display: flex;\n position: relative;\n width: ", ";\n"])), function (_a) {
@@ -170,7 +158,7 @@ var S_Slider = styled_components_1.default.div(templateObject_4 || (templateObje
170
158
  }
171
159
  return '324px';
172
160
  });
173
- var S_Track = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n background-size: ", ";\n border-radius: 2px;\n height: 4px;\n position: absolute;\n width: inherit;\n"], ["\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n background-size: ", ";\n border-radius: 2px;\n height: 4px;\n position: absolute;\n width: inherit;\n"])), function (_a) {
161
+ var S_Track = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n border-radius: 2px;\n height: 4px;\n position: absolute;\n width: inherit;\n"], ["\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n border-radius: 2px;\n height: 4px;\n position: absolute;\n width: inherit;\n"])), function (_a) {
174
162
  var theme = _a.theme;
175
163
  return theme.ui_cpnt_slider_track;
176
164
  }, function (_a) {
@@ -178,19 +166,13 @@ var S_Track = styled_components_1.default.div(templateObject_5 || (templateObjec
178
166
  return isDisabled
179
167
  ? "linear-gradient(" + theme.ui_cpnt_slider_track_disabled + ", " + theme.ui_cpnt_slider_track_disabled + ")"
180
168
  : "linear-gradient(" + theme.ui_cpnt_slider_track_active + ", " + theme.ui_cpnt_slider_track_active + ")";
181
- }, function (_a) {
182
- var thumbPercentage = _a.thumbPercentage;
183
- return thumbPercentage + "% 100%";
184
169
  });
185
- var S_Thumb = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 100%;\n box-shadow: ", ";\n display: flex;\n height: 20px;\n justify-content: center;\n left: ", "%;\n position: absolute;\n transform: translateX(-10px);\n width: 20px;\n"], ["\n background-color: ", ";\n border-radius: 100%;\n box-shadow: ", ";\n display: flex;\n height: 20px;\n justify-content: center;\n left: ", "%;\n position: absolute;\n transform: translateX(-10px);\n width: 20px;\n"])), function (_a) {
170
+ var S_Thumb = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 100%;\n box-shadow: ", ";\n display: flex;\n height: 20px;\n justify-content: center;\n position: absolute;\n transform: translateX(-10px);\n width: 20px;\n"], ["\n background-color: ", ";\n border-radius: 100%;\n box-shadow: ", ";\n display: flex;\n height: 20px;\n justify-content: center;\n position: absolute;\n transform: translateX(-10px);\n width: 20px;\n"])), function (_a) {
186
171
  var theme = _a.theme, isDisabled = _a.isDisabled;
187
172
  return isDisabled ? theme.ui_cpnt_slider_thumb_disabled : theme.ui_cpnt_slider_thumb_normal;
188
173
  }, function (_a) {
189
174
  var theme = _a.theme, isTouching = _a.isTouching, isDisabled = _a.isDisabled;
190
175
  return isTouching && !isDisabled ? "0 0 0 8px " + theme.ui_cpnt_slider_thumb_pressed_circle : 'none';
191
- }, function (_a) {
192
- var thumbPercentage = _a.thumbPercentage;
193
- return thumbPercentage;
194
176
  });
195
177
  var S_Range = styled_components_1.default.input(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n clip: rect(0 0 0 0);\n height: 100%;\n margin: 0;\n outline: none;\n position: absolute;\n width: 100%;\n"], ["\n clip: rect(0 0 0 0);\n height: 100%;\n margin: 0;\n outline: none;\n position: absolute;\n width: 100%;\n"])));
196
178
  exports.default = (0, react_1.forwardRef)(Slider);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web",
3
- "version": "2.1.8",
3
+ "version": "2.1.10",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
package/release-note.md CHANGED
@@ -1,32 +1,16 @@
1
1
  # PDS-DEV-KIT-WEB Release Notes
2
- ## [v2.1.8]
2
+ ## [v2.1.10]
3
3
  ## daily|https://design.storybook.publ.biz/
4
4
 
5
- ### Package
6
- * type
7
- * SegmentedButtonGroupValueOption export 처리
8
5
  ### Components
9
- * BasicButtonGroup
10
- * tooltipText prop 추가
11
- * tooltipPosition prop 추가
12
- * ContextMenuItem
13
- * option에 fontWeight 추가
14
- * displayType 조건에 따른 내부 간격 수정
15
- * Dropdown
16
- * fontWeight prop 추가
17
- * displayType 조건에 따른 내부 간격 수정
18
- * Icon
19
- * 기존 아이콘 개선 추가
20
- * IconButton
21
- * 툴팁 텍스트가 있는 경우, disabled여도 툴팁 텍스트가 뜨도록 변경
22
- * SegmentedButtonGroup
23
- * selectedType prop명 selectionType으로 변경
24
- * selectionType의 형태가 반대로 구현되었던 부분 수정
25
- * tooltipText prop 추가
26
- * tooltipPosition prop 추가
27
- * UploadIconButton
28
- * 툴팁 텍스트가 있는 경우, disabled여도 툴팁 텍스트가 뜨도록 변경
29
- * TextField
30
- * fontWeight prop 추가
31
- * TextLabel
32
- * styleTheme prop에 form1Bold, form2Bold 추가
6
+ * Icon 수정 및 추가
7
+ * ic_information 추가
8
+ * ic_light_bulb 추가
9
+ * ic_menu_design 추가
10
+ * Slider
11
+ * min이 0이 아닌경우에 thumb가 track을 벗어나는 이슈 수정
12
+ * Slider의 Thumb위치가 prop으로 전달되는 value에 의해 계산되어 렌더링 되도록 수정
13
+ * defaultValue prop 삭제
14
+ * value prop 추가
15
+ ### Color
16
+ * 컬러 23.07.21 21시 02분 기준 싱크