pds-dev-kit-web 2.2.10 → 2.2.11

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 (43) hide show
  1. package/dist/src/common/hooks/index.d.ts +1 -0
  2. package/dist/src/common/hooks/index.js +3 -1
  3. package/dist/src/common/hooks/useAbsolutePositioner.d.ts +13 -0
  4. package/dist/src/common/hooks/useAbsolutePositioner.js +54 -0
  5. package/dist/src/common/hooks/useTooltip.d.ts +17 -0
  6. package/dist/src/common/hooks/useTooltip.js +76 -0
  7. package/dist/src/common/styles/colorSet/PaletteColor_Dark.json +2 -1
  8. package/dist/src/common/styles/colorSet/PaletteColor_light.json +2 -1
  9. package/dist/src/common/styles/colorSet/UIColor.json +2 -1
  10. package/dist/src/common/styles/colorSet/index.d.ts +843 -840
  11. package/dist/src/common/styles/colorSet/index.js +3 -3
  12. package/dist/src/common/styles/colorSet/ui-type.d.ts +1 -0
  13. package/dist/src/common/styles/systemUI/index.d.ts +1 -0
  14. package/dist/src/common/styles/systemUI/index.js +5 -0
  15. package/dist/src/common/styles/systemUI/tooltipStyle.d.ts +1 -0
  16. package/dist/src/common/styles/systemUI/tooltipStyle.js +28 -0
  17. package/dist/src/common/types/components.d.ts +3 -2
  18. package/dist/src/common/types/systemUI.d.ts +13 -0
  19. package/dist/src/common/types/systemUI.js +2 -0
  20. package/dist/src/common/utils/SystemUIPositionGenerator/clickTypeSystemUICssGenerator.d.ts +13 -0
  21. package/dist/src/common/utils/SystemUIPositionGenerator/clickTypeSystemUICssGenerator.js +20 -0
  22. package/dist/src/common/utils/SystemUIPositionGenerator/hoverTypeSystemUICssGenerator.d.ts +17 -0
  23. package/dist/src/common/utils/SystemUIPositionGenerator/hoverTypeSystemUICssGenerator.js +71 -0
  24. package/dist/src/common/utils/SystemUIPositionGenerator/index.d.ts +1 -0
  25. package/dist/src/common/utils/SystemUIPositionGenerator/index.js +8 -0
  26. package/dist/src/desktop/components/BasicButtonGroup/BasicButtonGroup.js +54 -42
  27. package/dist/src/desktop/components/BasicButtonGroup/constants.d.ts +0 -6
  28. package/dist/src/desktop/components/BasicButtonGroup/constants.js +1 -8
  29. package/dist/src/desktop/components/Dropdown/Dropdown.js +48 -9
  30. package/dist/src/desktop/components/IconButton/IconButton.d.ts +3 -1
  31. package/dist/src/desktop/components/IconButton/IconButton.js +48 -44
  32. package/dist/src/desktop/components/SegmentedButtonGroup/SegmentedButtonGroup.js +54 -42
  33. package/dist/src/desktop/components/SegmentedButtonGroup/constants.d.ts +0 -6
  34. package/dist/src/desktop/components/SegmentedButtonGroup/constants.js +1 -8
  35. package/dist/src/desktop/components/TextLabel/TextLabel.d.ts +3 -1
  36. package/dist/src/desktop/components/TextLabel/TextLabel.js +33 -63
  37. package/dist/src/desktop/components/UploadIconButton/UploadIconButton.d.ts +3 -1
  38. package/dist/src/desktop/components/UploadIconButton/UploadIconButton.js +49 -45
  39. package/dist/src/desktop/components/UploadIconButton/constants.d.ts +7 -0
  40. package/dist/src/desktop/components/UploadIconButton/constants.js +10 -0
  41. package/dist/src/mobile/components/Dropdown/Dropdown.js +48 -9
  42. package/package.json +1 -1
  43. package/release-note.md +8 -4
@@ -40,14 +40,55 @@ var __importStar = (this && this.__importStar) || function (mod) {
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  var jsx_runtime_1 = require("react/jsx-runtime");
42
42
  var react_1 = require("react");
43
+ var react_dom_1 = require("react-dom");
44
+ var systemUI_1 = require("../../../common/styles/systemUI");
45
+ var SystemUIPositionGenerator_1 = require("../../../common/utils/SystemUIPositionGenerator");
43
46
  var styled_components_1 = __importStar(require("styled-components"));
44
47
  var transitionStyle_1 = require("../../../common/styles/movement/transitionStyle");
45
48
  var hybrid_1 = require("../../../hybrid");
46
- var TextLabel_1 = require("../TextLabel");
47
49
  var constants_1 = require("./constants");
48
50
  function IconButton(_a) {
49
- var tooltipText = _a.tooltipText, _b = _a.tooltipPosition, tooltipPosition = _b === void 0 ? 'center_bottom' : _b, _c = _a.fillType, fillType = _c === void 0 ? 'fill' : _c, _d = _a.shapeType, shapeType = _d === void 0 ? 'rectangle' : _d, _e = _a.baseSize, baseSize = _e === void 0 ? 'small' : _e, baseColorKey = _a.baseColorKey, borderColorKey = _a.borderColorKey, _f = _a.iconSize, iconSize = _f === void 0 ? 24 : _f, _g = _a.iconFillType, iconFillType = _g === void 0 ? 'line' : _g, iconName = _a.iconName, iconColorKey = _a.iconColorKey, _h = _a.shadow, shadow = _h === void 0 ? 'hidden' : _h, _j = _a.colorTheme, colorTheme = _j === void 0 ? 'none' : _j, _k = _a.type, type = _k === void 0 ? 'button' : _k, _l = _a.state, state = _l === void 0 ? 'normal' : _l, tabIndex = _a.tabIndex, onClick = _a.onClick, onMouseDown = _a.onMouseDown;
51
+ var tooltipText = _a.tooltipText, _b = _a.tooltipPosition, tooltipPosition = _b === void 0 ? 'bottom' : _b, _c = _a.fillType, fillType = _c === void 0 ? 'fill' : _c, _d = _a.shapeType, shapeType = _d === void 0 ? 'rectangle' : _d, _e = _a.baseSize, baseSize = _e === void 0 ? 'small' : _e, baseColorKey = _a.baseColorKey, borderColorKey = _a.borderColorKey, _f = _a.iconSize, iconSize = _f === void 0 ? 24 : _f, _g = _a.iconFillType, iconFillType = _g === void 0 ? 'line' : _g, iconName = _a.iconName, iconColorKey = _a.iconColorKey, _h = _a.shadow, shadow = _h === void 0 ? 'hidden' : _h, _j = _a.colorTheme, colorTheme = _j === void 0 ? 'none' : _j, _k = _a.type, type = _k === void 0 ? 'button' : _k, _l = _a.state, state = _l === void 0 ? 'normal' : _l, tabIndex = _a.tabIndex, onClick = _a.onClick, onMouseDown = _a.onMouseDown;
50
52
  var _m = (0, react_1.useState)(false), isTooltipOpen = _m[0], setIsTooltipOpen = _m[1];
53
+ var tooltipPositionTargetRef = (0, react_1.useRef)(null);
54
+ var tooltipRef = (0, react_1.useRef)(null);
55
+ var _o = (0, react_1.useState)(null), tooltipSizeOffset = _o[0], setTooltipSizeOffset = _o[1];
56
+ var _p = (0, react_1.useState)(null), tooltipPositionOffset = _p[0], setTooltipPositionOffset = _p[1];
57
+ /**
58
+ * @when : 화면진입 시, dependency 변경되었을 때
59
+ * @expected : tooltipPositionTargetRef, tooltipRef 의 위치를 업데이트합니다.
60
+ * @clear :
61
+ */
62
+ (0, react_1.useEffect)(function () {
63
+ if (!tooltipPositionTargetRef.current || !tooltipText) {
64
+ return;
65
+ }
66
+ if (!isTooltipOpen && tooltipRef.current) {
67
+ setTooltipSizeOffset(null);
68
+ return;
69
+ }
70
+ var _a = tooltipPositionTargetRef.current.getBoundingClientRect(), top = _a.top, right = _a.right, left = _a.left, bottom = _a.bottom;
71
+ setTooltipPositionOffset({
72
+ top: top + window.scrollY,
73
+ right: right + window.scrollX,
74
+ bottom: bottom + window.scrollY,
75
+ left: left + window.scrollX
76
+ });
77
+ if (tooltipRef.current) {
78
+ setTooltipSizeOffset({
79
+ height: tooltipRef.current.offsetHeight,
80
+ width: tooltipRef.current.offsetWidth
81
+ });
82
+ }
83
+ }, [isTooltipOpen]);
84
+ var tooltipPositionCss = (0, SystemUIPositionGenerator_1.hoverTypeSystemUICssGenerator)({
85
+ baseSize: constants_1.ICON_BUTTON_SIZE[baseSize],
86
+ sizeOffset: tooltipSizeOffset,
87
+ positionOffset: tooltipPositionOffset,
88
+ systemUIPosition: tooltipPosition.includes('_')
89
+ ? tooltipPosition
90
+ : "center_".concat(tooltipPosition)
91
+ });
51
92
  var handleTooltipToggle = function (value) {
52
93
  setIsTooltipOpen(value);
53
94
  };
@@ -84,7 +125,7 @@ function IconButton(_a) {
84
125
  }
85
126
  return iconStateColorObj[fillType];
86
127
  };
87
- return ((0, jsx_runtime_1.jsxs)(S_IconButton, __assign({ "x-pds-name": "IconButton", "x-pds-element-type": "component", "x-pds-device-type": "desktop", fillType: fillType, shapeType: shapeType, baseSize: baseSize, baseColorKey: baseColorKey, borderColorKey: borderColorKey, shadow: shadow, colorTheme: colorTheme, type: type, state: state, disabled: state === 'disabled', tabIndex: tabIndex, onClick: handleClick, onMouseDown: handleMouseDown, onPointerEnter: function () { return tooltipText && handleTooltipToggle(true); }, onPointerLeave: function () { return tooltipText && handleTooltipToggle(false); } }, { children: [(0, jsx_runtime_1.jsx)(hybrid_1.Icon, { iconName: iconName, size: iconSize, colorKey: IconColorSelect(), fillType: iconFillType }), tooltipText && isTooltipOpen && ((0, jsx_runtime_1.jsx)(S_TooltipWrapper, __assign({ className: "TooltipWrapper", isTooltipOpen: isTooltipOpen, tooltipPosition: tooltipPosition, baseSize: baseSize }, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: tooltipText, colorOverride: "ui_cpnt_textlabel_button_tooltip", styleTheme: "caption2Regular", colorTheme: "sysTextSecondary" }) })))] })));
128
+ return ((0, jsx_runtime_1.jsxs)(S_IconButton, __assign({ "x-pds-name": "IconButton", "x-pds-element-type": "component", "x-pds-device-type": "desktop", ref: tooltipPositionTargetRef, fillType: fillType, shapeType: shapeType, baseSize: baseSize, baseColorKey: baseColorKey, borderColorKey: borderColorKey, shadow: shadow, colorTheme: colorTheme, type: type, state: state, disabled: state === 'disabled', tabIndex: tabIndex, onClick: handleClick, onMouseDown: handleMouseDown, onPointerEnter: function () { return tooltipText && handleTooltipToggle(true); }, onPointerLeave: function () { return tooltipText && handleTooltipToggle(false); } }, { children: [(0, jsx_runtime_1.jsx)(hybrid_1.Icon, { iconName: iconName, size: iconSize, colorKey: IconColorSelect(), fillType: iconFillType }), isTooltipOpen && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(S_TooltipWrapper, __assign({ className: "TooltipWrapper", ref: tooltipRef, tooltipPositionCss: tooltipPositionCss }, { children: tooltipText })), document.body) }))] })));
88
129
  }
89
130
  var fillDisabled = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n"], ["\n background-color: ", ";\n"])), function (_a) {
90
131
  var theme = _a.theme, baseColorKey = _a.baseColorKey;
@@ -188,46 +229,9 @@ var iconButtonStyle = (0, styled_components_1.css)(templateObject_13 || (templat
188
229
  }[baseSize];
189
230
  });
190
231
  var S_IconButton = styled_components_1.default.button(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), iconButtonStyle);
191
- var tooltipPositionSpacing = (0, styled_components_1.css)(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) {
192
- var baseSize = _a.baseSize;
193
- return baseSize &&
194
- {
195
- xxlarge: constants_1.TOOLTIP_POSITION_SPACING.xxlarge,
196
- large: constants_1.TOOLTIP_POSITION_SPACING.large,
197
- medium: constants_1.TOOLTIP_POSITION_SPACING.medium,
198
- small: constants_1.TOOLTIP_POSITION_SPACING.small,
199
- xsmall: constants_1.TOOLTIP_POSITION_SPACING.xsmall
200
- }[baseSize];
201
- });
202
- var tooltipLeftTop = (0, styled_components_1.css)(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n bottom: ", ";\n right: 0;\n"], ["\n bottom: ", ";\n right: 0;\n"])), tooltipPositionSpacing);
203
- var tooltipLeftBottom = (0, styled_components_1.css)(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n right: 0;\n top: ", ";\n"], ["\n right: 0;\n top: ", ";\n"])), tooltipPositionSpacing);
204
- var tooltipCenterTop = (0, styled_components_1.css)(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n bottom: ", ";\n"], ["\n bottom: ", ";\n"])), tooltipPositionSpacing);
205
- var tooltipCenterBottom = (0, styled_components_1.css)(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n top: ", ";\n"], ["\n top: ", ";\n"])), tooltipPositionSpacing);
206
- var tooltipRightTop = (0, styled_components_1.css)(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n bottom: ", ";\n left: 0;\n"], ["\n bottom: ", ";\n left: 0;\n"])), tooltipPositionSpacing);
207
- var tooltipRightBottom = (0, styled_components_1.css)(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n left: 0;\n top: ", ";\n"], ["\n left: 0;\n top: ", ";\n"])), tooltipPositionSpacing);
208
- var S_TooltipWrapper = styled_components_1.default.div(templateObject_22 || (templateObject_22 = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n padding: ", ";\n position: absolute;\n width: max-content;\n z-index: 400;\n\n ", ";\n\n ", "\n"], ["\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n padding: ", ";\n position: absolute;\n width: max-content;\n z-index: 400;\n\n ", ";\n\n ", "\n"])), function (_a) {
209
- var theme = _a.theme;
210
- return theme.ui_cpnt_button_tooltip_base;
211
- }, function (_a) {
212
- var theme = _a.theme;
213
- return theme.spacing.spacingA;
214
- }, function (_a) {
215
- var theme = _a.theme;
216
- return "".concat(theme.spacing.spacingA, " ").concat(theme.spacing.spacingB);
217
- }, function (_a) {
218
- var isTooltipOpen = _a.isTooltipOpen;
219
- return !isTooltipOpen && 'display: none';
220
- }, function (_a) {
221
- var tooltipPosition = _a.tooltipPosition;
222
- return tooltipPosition &&
223
- {
224
- left_top: tooltipLeftTop,
225
- left_bottom: tooltipLeftBottom,
226
- center_top: tooltipCenterTop,
227
- center_bottom: tooltipCenterBottom,
228
- right_top: tooltipRightTop,
229
- right_bottom: tooltipRightBottom
230
- }[tooltipPosition];
232
+ var S_TooltipWrapper = styled_components_1.default.div(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n ", "\n\n ", ";\n"], ["\n ", "\n\n ", ";\n"])), systemUI_1.TooltipWrapperStyle, function (_a) {
233
+ var tooltipPositionCss = _a.tooltipPositionCss;
234
+ return tooltipPositionCss;
231
235
  });
232
236
  exports.default = IconButton;
233
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22;
237
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15;
@@ -40,6 +40,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  var jsx_runtime_1 = require("react/jsx-runtime");
42
42
  var react_1 = require("react");
43
+ var react_dom_1 = require("react-dom");
44
+ var systemUI_1 = require("../../../common/styles/systemUI");
45
+ var SystemUIPositionGenerator_1 = require("../../../common/utils/SystemUIPositionGenerator");
43
46
  var components_1 = require("../../../hybrid/components");
44
47
  var styled_components_1 = __importStar(require("styled-components"));
45
48
  var TextLabel_1 = require("../TextLabel");
@@ -47,6 +50,39 @@ var constants_1 = require("./constants");
47
50
  function SegmentedButtonGroup(_a) {
48
51
  var _b = _a.size, size = _b === void 0 ? 'medium' : _b, value = _a.value, valueArray = _a.valueArray, _c = _a.selectionType, selectionType = _c === void 0 ? 'single' : _c, _d = _a.state, state = _d === void 0 ? 'normal' : _d, onClick = _a.onClick, onMouseDown = _a.onMouseDown;
49
52
  var _e = (0, react_1.useState)(null), currentButtonIndex = _e[0], setCurrentButtonIndex = _e[1];
53
+ var _f = (0, react_1.useState)(null), tooltipSizeOffset = _f[0], setTooltipSizeOffset = _f[1];
54
+ var _g = (0, react_1.useState)(null), tooltipPositionOffset = _g[0], setTooltipPositionOffset = _g[1];
55
+ var tooltipRef = (0, react_1.useRef)(null);
56
+ var tooltipPositionTargetRef = (0, react_1.useRef)(null);
57
+ /**
58
+ * @when : hoveredButtonIndex 변경되었을 때
59
+ * @expected : tooltipPositionTargetRef, tooltipRef 의 위치를 업데이트합니다.
60
+ * @clear :
61
+ */
62
+ (0, react_1.useEffect)(function () {
63
+ if (currentButtonIndex === null) {
64
+ setTooltipSizeOffset(null);
65
+ return;
66
+ }
67
+ if (tooltipPositionTargetRef.current) {
68
+ var _a = tooltipPositionTargetRef.current.getBoundingClientRect(), top_1 = _a.top, right = _a.right, left = _a.left, bottom = _a.bottom;
69
+ var countFromLeft = currentButtonIndex;
70
+ var countFromRight = valueArray.length - (currentButtonIndex + 1);
71
+ var itemSize = constants_1.ICON_BUTTON_SIZE[size];
72
+ setTooltipPositionOffset({
73
+ top: top_1 + window.scrollY,
74
+ right: right + window.scrollX - itemSize * countFromRight,
75
+ bottom: bottom + window.scrollY,
76
+ left: left + window.scrollX + itemSize * countFromLeft
77
+ });
78
+ }
79
+ if (tooltipRef.current) {
80
+ setTooltipSizeOffset({
81
+ height: tooltipRef.current.offsetHeight,
82
+ width: tooltipRef.current.offsetWidth
83
+ });
84
+ }
85
+ }, [currentButtonIndex]);
50
86
  var handleClick = function (value) {
51
87
  if (onClick) {
52
88
  onClick(value);
@@ -75,9 +111,20 @@ function SegmentedButtonGroup(_a) {
75
111
  }
76
112
  return 'ui_cpnt_button_icon_enabled';
77
113
  };
78
- return ((0, jsx_runtime_1.jsx)(S_SegmentedButtonGroupGroups, __assign({ "x-pds-name": "SegmentedButtonGroup", "x-pds-element-type": "component", "x-pds-device-type": "desktop", selectionType: selectionType }, { children: valueArray.map(function (_a, index) {
79
- var currentButtonValue = _a.value, iconName = _a.iconName, _b = _a.iconFillType, iconFillType = _b === void 0 ? 'line' : _b, _c = _a.state, buttonState = _c === void 0 ? 'normal' : _c, tooltipText = _a.tooltipText, _d = _a.tooltipPosition, tooltipPosition = _d === void 0 ? 'center_bottom' : _d, _e = _a.iconColorTheme, iconColorTheme = _e === void 0 ? 'none' : _e;
80
- return ((0, jsx_runtime_1.jsxs)(S_BasicButton, __assign({ size: size, onClick: function () { return handleClick(currentButtonValue); }, onMouseDown: function () { return handleMouseDown(currentButtonValue); }, disabled: state === 'disabled' || buttonState === 'disabled', selectionType: selectionType, isSelected: checkSelection(currentButtonValue), onPointerEnter: function () { return setCurrentButtonIndex(index); }, onPointerLeave: function () { return setCurrentButtonIndex(null); } }, { children: [(0, jsx_runtime_1.jsx)(components_1.Icon, { iconName: iconName, size: size === 'small' ? 20 : 24, fillType: iconFillType, colorKey: getIconColorKey(checkSelection(currentButtonValue), state === 'disabled' || buttonState === 'disabled', iconColorTheme) }), tooltipText && ((0, jsx_runtime_1.jsx)(S_TooltipWrapper, __assign({ className: "TooltipWrapper", isTooltipOpen: index === currentButtonIndex, tooltipPosition: tooltipPosition, size: size }, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: tooltipText, colorOverride: "ui_cpnt_textlabel_button_tooltip", styleTheme: "caption2Regular", colorTheme: "sysTextSecondary" }) })))] }), String(currentButtonValue)));
114
+ return ((0, jsx_runtime_1.jsx)(S_SegmentedButtonGroupGroups, __assign({ "x-pds-name": "SegmentedButtonGroup", "x-pds-element-type": "component", "x-pds-device-type": "desktop", selectionType: selectionType, ref: tooltipPositionTargetRef }, { children: valueArray.map(function (_a, index) {
115
+ var currentButtonValue = _a.value, iconName = _a.iconName, _b = _a.iconFillType, iconFillType = _b === void 0 ? 'line' : _b, _c = _a.state, buttonState = _c === void 0 ? 'normal' : _c, tooltipText = _a.tooltipText, _d = _a.tooltipPosition, tooltipPosition = _d === void 0 ? 'bottom' : _d, _e = _a.iconColorTheme, iconColorTheme = _e === void 0 ? 'none' : _e;
116
+ var tooltipPositionCss = (0, SystemUIPositionGenerator_1.hoverTypeSystemUICssGenerator)({
117
+ baseSize: constants_1.ICON_BUTTON_SIZE[size],
118
+ sizeOffset: tooltipSizeOffset,
119
+ positionOffset: tooltipPositionOffset,
120
+ systemUIPosition: tooltipPosition.includes('_')
121
+ ? tooltipPosition
122
+ : "center_".concat(tooltipPosition)
123
+ });
124
+ var isCurrentButton = index === currentButtonIndex;
125
+ return ((0, jsx_runtime_1.jsxs)(S_BasicButton, __assign({ size: size, onClick: function () { return handleClick(currentButtonValue); }, onMouseDown: function () { return handleMouseDown(currentButtonValue); }, disabled: state === 'disabled' || buttonState === 'disabled', selectionType: selectionType, isSelected: checkSelection(currentButtonValue), onPointerEnter: function () { return setCurrentButtonIndex(index); }, onPointerLeave: function () { return setCurrentButtonIndex(null); } }, { children: [(0, jsx_runtime_1.jsx)(components_1.Icon, { iconName: iconName, size: size === 'small' ? 20 : 24, fillType: iconFillType, colorKey: getIconColorKey(checkSelection(currentButtonValue), state === 'disabled' || buttonState === 'disabled', iconColorTheme) }), tooltipText &&
126
+ isCurrentButton &&
127
+ (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(S_TooltipWrapper, __assign({ className: "TooltipWrapper", ref: tooltipRef, tooltipPositionCss: tooltipPositionCss, size: size }, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: tooltipText, colorOverride: "ui_cpnt_textlabel_button_tooltip", styleTheme: "caption2Regular", colorTheme: "sysTextSecondary" }) })), document.body)] }), String(currentButtonValue)));
81
128
  }) })));
82
129
  }
83
130
  var S_SegmentedButtonGroupGroups = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: max-content;\n\n & > button:not(:last-child) {\n margin-right: ", ";\n }\n"], ["\n width: max-content;\n\n & > button:not(:last-child) {\n margin-right: ", ";\n }\n"])), function (_a) {
@@ -150,44 +197,9 @@ var S_BasicButton = styled_components_1.default.button(templateObject_5 || (temp
150
197
  var theme = _a.theme;
151
198
  return theme.ui_cpnt_segmentedbuttongroup_base_disabled;
152
199
  });
153
- var tooltipPositionSpacing = (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) {
154
- var size = _a.size;
155
- return size &&
156
- {
157
- large: constants_1.TOOLTIP_POSITION_SPACING.large,
158
- medium: constants_1.TOOLTIP_POSITION_SPACING.medium,
159
- small: constants_1.TOOLTIP_POSITION_SPACING.small
160
- }[size];
161
- });
162
- var tooltipLeftTop = (0, styled_components_1.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n bottom: ", ";\n right: 0;\n"], ["\n bottom: ", ";\n right: 0;\n"])), tooltipPositionSpacing);
163
- var tooltipLeftBottom = (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n right: 0;\n top: ", ";\n"], ["\n right: 0;\n top: ", ";\n"])), tooltipPositionSpacing);
164
- var tooltipCenterTop = (0, styled_components_1.css)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n bottom: ", ";\n"], ["\n bottom: ", ";\n"])), tooltipPositionSpacing);
165
- var tooltipCenterBottom = (0, styled_components_1.css)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n top: ", ";\n"], ["\n top: ", ";\n"])), tooltipPositionSpacing);
166
- var tooltipRightTop = (0, styled_components_1.css)(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n bottom: ", ";\n left: 0;\n"], ["\n bottom: ", ";\n left: 0;\n"])), tooltipPositionSpacing);
167
- var tooltipRightBottom = (0, styled_components_1.css)(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n left: 0;\n top: ", ";\n"], ["\n left: 0;\n top: ", ";\n"])), tooltipPositionSpacing);
168
- var S_TooltipWrapper = styled_components_1.default.div(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n padding: ", ";\n position: absolute;\n width: max-content;\n z-index: 400;\n\n ", ";\n\n ", "\n"], ["\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n padding: ", ";\n position: absolute;\n width: max-content;\n z-index: 400;\n\n ", ";\n\n ", "\n"])), function (_a) {
169
- var theme = _a.theme;
170
- return theme.ui_cpnt_button_tooltip_base;
171
- }, function (_a) {
172
- var theme = _a.theme;
173
- return theme.spacing.spacingA;
174
- }, function (_a) {
175
- var theme = _a.theme;
176
- return "".concat(theme.spacing.spacingA, " ").concat(theme.spacing.spacingB);
177
- }, function (_a) {
178
- var isTooltipOpen = _a.isTooltipOpen;
179
- return !isTooltipOpen && 'display: none';
180
- }, function (_a) {
181
- var tooltipPosition = _a.tooltipPosition;
182
- return tooltipPosition &&
183
- {
184
- left_top: tooltipLeftTop,
185
- left_bottom: tooltipLeftBottom,
186
- center_top: tooltipCenterTop,
187
- center_bottom: tooltipCenterBottom,
188
- right_top: tooltipRightTop,
189
- right_bottom: tooltipRightBottom
190
- }[tooltipPosition];
200
+ var S_TooltipWrapper = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n\n ", ";\n"], ["\n ", "\n\n ", ";\n"])), systemUI_1.TooltipWrapperStyle, function (_a) {
201
+ var tooltipPositionCss = _a.tooltipPositionCss;
202
+ return tooltipPositionCss;
191
203
  });
192
204
  exports.default = SegmentedButtonGroup;
193
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13;
205
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -3,9 +3,3 @@ export declare const ICON_BUTTON_SIZE: {
3
3
  medium: number;
4
4
  small: number;
5
5
  };
6
- export declare const ICON_BUTTON_TOOLTIP_SPACING = 8;
7
- export declare const TOOLTIP_POSITION_SPACING: {
8
- large: string;
9
- medium: string;
10
- small: string;
11
- };
@@ -1,15 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TOOLTIP_POSITION_SPACING = exports.ICON_BUTTON_TOOLTIP_SPACING = exports.ICON_BUTTON_SIZE = void 0;
3
+ exports.ICON_BUTTON_SIZE = void 0;
4
4
  exports.ICON_BUTTON_SIZE = {
5
5
  large: 48,
6
6
  medium: 40,
7
7
  small: 32
8
8
  };
9
- exports.ICON_BUTTON_TOOLTIP_SPACING = 8;
10
- // NOTE - iconSize 크기에 따라 위치를 이동시켜주고, iconButtonSize에 간격까지 8px을 추가해준 값입니다.(IconButton과 tooltip의 간격)
11
- exports.TOOLTIP_POSITION_SPACING = {
12
- large: "calc(".concat(exports.ICON_BUTTON_SIZE.large, "px + ").concat(exports.ICON_BUTTON_TOOLTIP_SPACING, "px)"),
13
- medium: "calc(".concat(exports.ICON_BUTTON_SIZE.medium, "px + ").concat(exports.ICON_BUTTON_TOOLTIP_SPACING, "px)"),
14
- small: "calc(".concat(exports.ICON_BUTTON_SIZE.small, "px + ").concat(exports.ICON_BUTTON_TOOLTIP_SPACING, "px)")
15
- };
@@ -1,9 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import type { PDSTextType, UiColors } from '../../../common';
3
+ import type { TextCaseTooltipPositionType } from '../../../common/types/systemUI';
3
4
  export type TextLabelProps = {
4
5
  text: PDSTextType;
5
6
  tooltipText?: PDSTextType;
6
- tooltipPosition?: 'left_top' | 'left_bottom' | 'right_top' | 'right_bottom';
7
+ /** @deprecated 'left_top', 'left_bottom', 'right_top', 'right_bottom' will replace 'top' or 'bottom' */
8
+ tooltipPosition?: TextCaseTooltipPositionType;
7
9
  tooltipIconColorKey?: UiColors;
8
10
  textAlign?: 'left' | 'center' | 'right';
9
11
  styleTheme?: 'displayBold' | 'wizardPageTitleBold' | 'headingBold' | 'leadParaBold' | 'leadParaRegular' | 'subTitleBold' | 'subTitleRegular' | 'body1Bold' | 'body1Regular' | 'body2Bold' | 'body2Regular' | 'caption1Bold' | 'caption1Regular' | 'caption2Bold' | 'caption2Regular' | 'form1Regular' | 'form1Bold' | 'form2Regular' | 'form2Bold' | 'blog1Regular';
@@ -41,40 +41,37 @@ Object.defineProperty(exports, "__esModule", { value: true });
41
41
  var jsx_runtime_1 = require("react/jsx-runtime");
42
42
  var react_1 = require("react");
43
43
  var react_dom_1 = require("react-dom");
44
+ var systemUI_1 = require("../../../common/styles/systemUI");
45
+ var SystemUIPositionGenerator_1 = require("../../../common/utils/SystemUIPositionGenerator");
44
46
  var styled_components_1 = __importStar(require("styled-components"));
45
47
  var hybrid_1 = require("../../../hybrid");
46
48
  function TextLabel(_a) {
47
- var text = _a.text, tooltipText = _a.tooltipText, _b = _a.tooltipPosition, tooltipPosition = _b === void 0 ? 'right_bottom' : _b, _c = _a.tooltipIconColorKey, tooltipIconColorKey = _c === void 0 ? 'ui_cpnt_icon_sys_grey_03' : _c, _d = _a.textAlign, textAlign = _d === void 0 ? 'left' : _d, _e = _a.styleTheme, styleTheme = _e === void 0 ? 'body2Bold' : _e, colorOverride = _a.colorOverride, _f = _a.colorTheme, colorTheme = _f === void 0 ? 'sysTextPrimary' : _f, _g = _a.singleLineMode, singleLineMode = _g === void 0 ? 'none' : _g, _h = _a.ellipsisMode, ellipsisMode = _h === void 0 ? 'none' : _h, lineLimit = _a.lineLimit, _j = _a.userSelectMode, userSelectMode = _j === void 0 ? 'none' : _j, customFontSize = _a.customFontSize, customFontWeight = _a.customFontWeight, _k = _a.textDecorationType, textDecorationType = _k === void 0 ? 'none' : _k, _l = _a.requirementMode, requirementMode = _l === void 0 ? 'none' : _l, _m = _a.bulletPointMode, bulletPointMode = _m === void 0 ? 'none' : _m, wordBreak = _a.wordBreak, letterSpacing = _a.letterSpacing;
49
+ var text = _a.text, tooltipText = _a.tooltipText, _b = _a.tooltipPosition, tooltipPosition = _b === void 0 ? 'bottom' : _b, _c = _a.tooltipIconColorKey, tooltipIconColorKey = _c === void 0 ? 'ui_cpnt_icon_sys_grey_03' : _c, _d = _a.textAlign, textAlign = _d === void 0 ? 'left' : _d, _e = _a.styleTheme, styleTheme = _e === void 0 ? 'body2Bold' : _e, colorOverride = _a.colorOverride, _f = _a.colorTheme, colorTheme = _f === void 0 ? 'sysTextPrimary' : _f, _g = _a.singleLineMode, singleLineMode = _g === void 0 ? 'none' : _g, _h = _a.ellipsisMode, ellipsisMode = _h === void 0 ? 'none' : _h, lineLimit = _a.lineLimit, _j = _a.userSelectMode, userSelectMode = _j === void 0 ? 'none' : _j, customFontSize = _a.customFontSize, customFontWeight = _a.customFontWeight, _k = _a.textDecorationType, textDecorationType = _k === void 0 ? 'none' : _k, _l = _a.requirementMode, requirementMode = _l === void 0 ? 'none' : _l, _m = _a.bulletPointMode, bulletPointMode = _m === void 0 ? 'none' : _m, wordBreak = _a.wordBreak, letterSpacing = _a.letterSpacing;
48
50
  var _o = (0, react_1.useState)(false), isTooltipOpen = _o[0], setIsTooltipOpen = _o[1];
51
+ var tooltipPositionTargetRef = (0, react_1.useRef)(null);
52
+ var tooltipRef = (0, react_1.useRef)(null);
49
53
  var _p = (0, react_1.useState)(null), tooltipSizeOffset = _p[0], setTooltipSizeOffset = _p[1];
50
54
  var _q = (0, react_1.useState)(null), tooltipPositionOffset = _q[0], setTooltipPositionOffset = _q[1];
51
- var tooltipRef = (0, react_1.useRef)(null);
52
- var tooltipPositionTargetRef = (0, react_1.useRef)(null);
53
- var handleTooltipOpen = function () {
54
- setIsTooltipOpen(true);
55
- };
56
- var handleTooltipClose = function () {
57
- setIsTooltipOpen(false);
58
- };
59
55
  /**
60
- * @when : isTooltipOpen이 변경되었을 때
56
+ * @when : 화면진입 시, dependency 변경되었을 때
61
57
  * @expected : tooltipPositionTargetRef, tooltipRef 의 위치를 업데이트합니다.
62
58
  * @clear :
63
59
  */
64
60
  (0, react_1.useEffect)(function () {
65
- if (tooltipPositionTargetRef.current) {
66
- var _a = tooltipPositionTargetRef.current.getBoundingClientRect(), top_1 = _a.top, right = _a.right, left = _a.left, bottom = _a.bottom;
67
- setTooltipPositionOffset({
68
- top: top_1 + window.scrollY,
69
- right: right + window.scrollX,
70
- bottom: bottom + window.scrollY,
71
- left: left + window.scrollX
72
- });
61
+ if (!tooltipPositionTargetRef.current || !tooltipText) {
62
+ return;
73
63
  }
74
64
  if (!isTooltipOpen && tooltipRef.current) {
75
65
  setTooltipSizeOffset(null);
76
66
  return;
77
67
  }
68
+ var _a = tooltipPositionTargetRef.current.getBoundingClientRect(), top = _a.top, right = _a.right, left = _a.left, bottom = _a.bottom;
69
+ setTooltipPositionOffset({
70
+ top: top + window.scrollY,
71
+ right: right + window.scrollX,
72
+ bottom: bottom + window.scrollY,
73
+ left: left + window.scrollX
74
+ });
78
75
  if (tooltipRef.current) {
79
76
  setTooltipSizeOffset({
80
77
  height: tooltipRef.current.offsetHeight,
@@ -82,34 +79,22 @@ function TextLabel(_a) {
82
79
  });
83
80
  }
84
81
  }, [isTooltipOpen]);
85
- var tooltipPositionCss = getTooltipPositionCss(tooltipSizeOffset, tooltipPositionOffset, tooltipPosition);
86
- return ((0, jsx_runtime_1.jsxs)(S_TextLabel, __assign({ "x-pds-name": "TextLabel", "x-pds-element-type": "component", "x-pds-device-type": "desktop", textAlign: textAlign, styleTheme: styleTheme, colorOverride: colorOverride, colorTheme: colorTheme, singleLineMode: singleLineMode, ellipsisMode: ellipsisMode, lineLimit: lineLimit, userSelectMode: userSelectMode, customFontSize: customFontSize, customFontWeight: customFontWeight, textDecorationType: textDecorationType, bulletPointMode: bulletPointMode, wordBreak: wordBreak, "$letterSpacing": letterSpacing }, { children: [text, requirementMode === 'use' && ((0, jsx_runtime_1.jsx)(S_AfterTextBox, __assign({ styleTheme: styleTheme }, { children: (0, jsx_runtime_1.jsx)(S_IconWrapper, { children: (0, jsx_runtime_1.jsx)(hybrid_1.Icon, { iconName: "ic_requirement", size: 16, fillType: "line", colorKey: "ui_cpnt_icon_sys_error_01" }) }) }))), tooltipText && ((0, jsx_runtime_1.jsxs)(S_AfterTextBox, __assign({ styleTheme: styleTheme, ref: tooltipPositionTargetRef }, { children: [(0, jsx_runtime_1.jsx)(S_IconWrapper, __assign({ onMouseEnter: handleTooltipOpen, onMouseLeave: handleTooltipClose }, { children: (0, jsx_runtime_1.jsx)(hybrid_1.Icon, { iconName: "ic_question", size: 16, fillType: "fill", colorKey: tooltipIconColorKey }) })), (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(S_TooltipWrapper, __assign({ className: "TooltipWrapper", ref: tooltipRef, isTooltipOpen: isTooltipOpen, tooltipPosition: tooltipPosition, tooltipPositionCss: tooltipPositionCss, onMouseEnter: handleTooltipOpen, onMouseLeave: handleTooltipClose }, { children: "".concat(tooltipText) })), document.body)] })))] })));
87
- }
88
- function getTooltipPositionCss(size, position, positionType) {
89
- if (!size || !position) {
90
- return '';
91
- }
92
- var left = position.left, bottom = position.bottom, top = position.top;
93
- var width = size.width, height = size.height;
94
- var leftValue = left - width + 16;
95
- var bottomValue = bottom + 4;
96
- var topValue = top - height - 4;
97
- var isOverLeft = leftValue < 0;
98
- var isOverRight = window.innerWidth < left + width;
99
- var isOverBottom = window.innerHeight < bottomValue + height;
100
- var isOverTop = topValue < 0;
101
- switch (positionType) {
102
- case 'left_bottom':
103
- return "\n left: ".concat(isOverLeft ? 5 : leftValue, "px;\n ").concat(isOverBottom ? 'bottom: 5px;' : "top: ".concat(bottomValue, "px;"));
104
- case 'left_top':
105
- return "\n left: ".concat(isOverLeft ? 5 : leftValue, "px;\n top: ").concat(isOverTop ? 5 : topValue, "px;");
106
- case 'right_bottom':
107
- return "\n ".concat(isOverRight ? 'right: 5px;' : "left: ".concat(isOverRight ? 5 : left, "px;"), "\n ").concat(isOverBottom ? 'bottom: 5px;' : "top: ".concat(bottomValue, "px;"));
108
- case 'right_top':
109
- return "\n ".concat(isOverRight ? 'right: 5px;' : "left: ".concat(isOverRight ? 5 : left, "px;"), "\n top: ").concat(isOverTop ? 5 : topValue, "px;");
110
- default:
111
- return '';
112
- }
82
+ var tooltipPositionCss = (0, SystemUIPositionGenerator_1.hoverTypeSystemUICssGenerator)({
83
+ baseSize: 16,
84
+ sizeOffset: tooltipSizeOffset,
85
+ positionOffset: tooltipPositionOffset,
86
+ systemUIPosition: tooltipPosition.includes('_')
87
+ ? tooltipPosition
88
+ : "right_".concat(tooltipPosition),
89
+ distance: 4
90
+ });
91
+ var handleTooltipOpen = function () {
92
+ setIsTooltipOpen(true);
93
+ };
94
+ var handleTooltipClose = function () {
95
+ setIsTooltipOpen(false);
96
+ };
97
+ return ((0, jsx_runtime_1.jsxs)(S_TextLabel, __assign({ "x-pds-name": "TextLabel", "x-pds-element-type": "component", "x-pds-device-type": "desktop", textAlign: textAlign, styleTheme: styleTheme, colorOverride: colorOverride, colorTheme: colorTheme, singleLineMode: singleLineMode, ellipsisMode: ellipsisMode, lineLimit: lineLimit, userSelectMode: userSelectMode, customFontSize: customFontSize, customFontWeight: customFontWeight, textDecorationType: textDecorationType, bulletPointMode: bulletPointMode, wordBreak: wordBreak, "$letterSpacing": letterSpacing }, { children: [text, requirementMode === 'use' && ((0, jsx_runtime_1.jsx)(S_AfterTextBox, __assign({ styleTheme: styleTheme }, { children: (0, jsx_runtime_1.jsx)(S_IconWrapper, { children: (0, jsx_runtime_1.jsx)(hybrid_1.Icon, { iconName: "ic_requirement", size: 16, fillType: "line", colorKey: "ui_cpnt_icon_sys_error_01" }) }) }))), tooltipText && ((0, jsx_runtime_1.jsx)(S_AfterTextBox, __assign({ styleTheme: styleTheme }, { children: (0, jsx_runtime_1.jsxs)(S_IconWrapper, __assign({ ref: tooltipPositionTargetRef, onPointerEnter: handleTooltipOpen, onPointerLeave: handleTooltipClose }, { children: [(0, jsx_runtime_1.jsx)(hybrid_1.Icon, { iconName: "ic_question", size: 16, fillType: "fill", colorKey: tooltipIconColorKey }), isTooltipOpen && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(S_TooltipWrapper, __assign({ className: "TooltipWrapper", ref: tooltipRef, tooltipPositionCss: tooltipPositionCss }, { children: tooltipText })), document.body) }))] })) })))] })));
113
98
  }
114
99
  var displayBold = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"], ["\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (_a) {
115
100
  var theme = _a.theme;
@@ -508,24 +493,9 @@ var S_AfterTextBox = styled_components_1.default.div(templateObject_51 || (templ
508
493
  }[styleTheme];
509
494
  });
510
495
  var S_IconWrapper = styled_components_1.default.div(templateObject_52 || (templateObject_52 = __makeTemplateObject(["\n align-items: center;\n display: flex;\n height: 16px;\n height: 100%;\n justify-content: center;\n width: 16px;\n"], ["\n align-items: center;\n display: flex;\n height: 16px;\n height: 100%;\n justify-content: center;\n width: 16px;\n"])));
511
- var S_TooltipWrapper = styled_components_1.default.div(templateObject_53 || (templateObject_53 = __makeTemplateObject(["\n ", "\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: border-box;\n color: ", ";\n display: flex;\n justify-content: center;\n line-height: 1.2;\n max-width: 240px;\n overflow-wrap: break-word;\n padding: ", ";\n position: fixed;\n text-align: left;\n white-space: pre-wrap;\n width: max-content;\n word-break: keep-all;\n z-index: 400;\n\n ", ";\n ", ";\n"], ["\n ", "\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: border-box;\n color: ", ";\n display: flex;\n justify-content: center;\n line-height: 1.2;\n max-width: 240px;\n overflow-wrap: break-word;\n padding: ", ";\n position: fixed;\n text-align: left;\n white-space: pre-wrap;\n width: max-content;\n word-break: keep-all;\n z-index: 400;\n\n ", ";\n ", ";\n"])), caption2Regular, function (_a) {
512
- var theme = _a.theme;
513
- return theme.ui_cpnt_button_tooltip_base;
514
- }, function (_a) {
515
- var theme = _a.theme;
516
- return theme.spacing.spacingA;
517
- }, function (_a) {
518
- var theme = _a.theme;
519
- return theme.ui_cpnt_textlabel_button_tooltip;
520
- }, function (_a) {
521
- var theme = _a.theme;
522
- return "".concat(theme.spacing.spacingA, " ").concat(theme.spacing.spacingB);
523
- }, function (_a) {
524
- var isTooltipOpen = _a.isTooltipOpen;
525
- return !isTooltipOpen && 'display: none';
526
- }, function (_a) {
496
+ var S_TooltipWrapper = styled_components_1.default.div(templateObject_53 || (templateObject_53 = __makeTemplateObject(["\n ", "\n\n ", ";\n"], ["\n ", "\n\n ", ";\n"])), systemUI_1.TooltipWrapperStyle, function (_a) {
527
497
  var tooltipPositionCss = _a.tooltipPositionCss;
528
- return tooltipPositionCss && tooltipPositionCss;
498
+ return tooltipPositionCss;
529
499
  });
530
500
  exports.default = TextLabel;
531
501
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28, templateObject_29, templateObject_30, templateObject_31, templateObject_32, templateObject_33, templateObject_34, templateObject_35, templateObject_36, templateObject_37, templateObject_38, templateObject_39, templateObject_40, templateObject_41, templateObject_42, templateObject_43, templateObject_44, templateObject_45, templateObject_46, templateObject_47, templateObject_48, templateObject_49, templateObject_50, templateObject_51, templateObject_52, templateObject_53;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { FillIconNameKeys, LineIconNameKeys, PDSTextType, UiColors } from '../../../common';
3
+ import type { IconCaseTooltipPositionType } from '../../../common/types/systemUI';
3
4
  export type UploadIconButtonProps = {
4
5
  fillType?: 'fill' | 'line';
5
6
  shapeType?: 'circular' | 'rectangle' | 'round';
@@ -16,7 +17,8 @@ export type UploadIconButtonProps = {
16
17
  accept?: string;
17
18
  multipleMode?: 'none' | 'use';
18
19
  tooltipText?: PDSTextType;
19
- tooltipPosition?: 'left_top' | 'left_bottom' | 'center_top' | 'center_bottom' | 'right_top' | 'right_bottom';
20
+ /** @deprecated 'left_top', 'left_bottom', 'right_top', 'right_bottom' will replace 'top' or 'bottom' */
21
+ tooltipPosition?: IconCaseTooltipPositionType;
20
22
  onClick?: (e: React.ChangeEvent<HTMLInputElement>) => void;
21
23
  };
22
24
  declare function UploadIconButton({ fillType, shapeType, baseSize, baseColorKey, borderColorKey, iconSize, iconFillType, iconName, iconColorKey, shadow, colorTheme, state, accept, multipleMode, tooltipText, tooltipPosition, onClick }: UploadIconButtonProps): JSX.Element;
@@ -40,15 +40,56 @@ var __importStar = (this && this.__importStar) || function (mod) {
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  var jsx_runtime_1 = require("react/jsx-runtime");
42
42
  var react_1 = require("react");
43
+ var react_dom_1 = require("react-dom");
44
+ var systemUI_1 = require("../../../common/styles/systemUI");
45
+ var SystemUIPositionGenerator_1 = require("../../../common/utils/SystemUIPositionGenerator");
43
46
  var styled_components_1 = __importStar(require("styled-components"));
44
47
  var transitionStyle_1 = require("../../../common/styles/movement/transitionStyle");
45
48
  var hybrid_1 = require("../../../hybrid");
46
- var constants_1 = require("../IconButton/constants");
47
- var TextLabel_1 = require("../TextLabel");
49
+ var constants_1 = require("./constants");
48
50
  var types_1 = require("./types");
49
51
  function UploadIconButton(_a) {
50
- var _b = _a.fillType, fillType = _b === void 0 ? 'fill' : _b, _c = _a.shapeType, shapeType = _c === void 0 ? 'rectangle' : _c, _d = _a.baseSize, baseSize = _d === void 0 ? 'small' : _d, baseColorKey = _a.baseColorKey, borderColorKey = _a.borderColorKey, _e = _a.iconSize, iconSize = _e === void 0 ? 24 : _e, _f = _a.iconFillType, iconFillType = _f === void 0 ? 'line' : _f, _g = _a.iconName, iconName = _g === void 0 ? 'ic_upload' : _g, iconColorKey = _a.iconColorKey, _h = _a.shadow, shadow = _h === void 0 ? 'hidden' : _h, _j = _a.colorTheme, colorTheme = _j === void 0 ? 'none' : _j, _k = _a.state, state = _k === void 0 ? 'normal' : _k, _l = _a.accept, accept = _l === void 0 ? '*' : _l, _m = _a.multipleMode, multipleMode = _m === void 0 ? 'none' : _m, tooltipText = _a.tooltipText, _o = _a.tooltipPosition, tooltipPosition = _o === void 0 ? 'center_bottom' : _o, onClick = _a.onClick;
52
+ var _b = _a.fillType, fillType = _b === void 0 ? 'fill' : _b, _c = _a.shapeType, shapeType = _c === void 0 ? 'rectangle' : _c, _d = _a.baseSize, baseSize = _d === void 0 ? 'small' : _d, baseColorKey = _a.baseColorKey, borderColorKey = _a.borderColorKey, _e = _a.iconSize, iconSize = _e === void 0 ? 24 : _e, _f = _a.iconFillType, iconFillType = _f === void 0 ? 'line' : _f, _g = _a.iconName, iconName = _g === void 0 ? 'ic_upload' : _g, iconColorKey = _a.iconColorKey, _h = _a.shadow, shadow = _h === void 0 ? 'hidden' : _h, _j = _a.colorTheme, colorTheme = _j === void 0 ? 'none' : _j, _k = _a.state, state = _k === void 0 ? 'normal' : _k, _l = _a.accept, accept = _l === void 0 ? '*' : _l, _m = _a.multipleMode, multipleMode = _m === void 0 ? 'none' : _m, tooltipText = _a.tooltipText, _o = _a.tooltipPosition, tooltipPosition = _o === void 0 ? 'bottom' : _o, onClick = _a.onClick;
51
53
  var _p = (0, react_1.useState)(false), isTooltipOpen = _p[0], setIsTooltipOpen = _p[1];
54
+ var tooltipPositionTargetRef = (0, react_1.useRef)(null);
55
+ var tooltipRef = (0, react_1.useRef)(null);
56
+ var _q = (0, react_1.useState)(null), tooltipSizeOffset = _q[0], setTooltipSizeOffset = _q[1];
57
+ var _r = (0, react_1.useState)(null), tooltipPositionOffset = _r[0], setTooltipPositionOffset = _r[1];
58
+ /**
59
+ * @when : 화면진입 시, dependency 변경되었을 때
60
+ * @expected : tooltipPositionTargetRef, tooltipRef 의 위치를 업데이트합니다.
61
+ * @clear :
62
+ */
63
+ (0, react_1.useEffect)(function () {
64
+ if (!tooltipPositionTargetRef.current || !tooltipText) {
65
+ return;
66
+ }
67
+ if (!isTooltipOpen && tooltipRef.current) {
68
+ setTooltipSizeOffset(null);
69
+ return;
70
+ }
71
+ var _a = tooltipPositionTargetRef.current.getBoundingClientRect(), top = _a.top, right = _a.right, left = _a.left, bottom = _a.bottom;
72
+ setTooltipPositionOffset({
73
+ top: top + window.scrollY,
74
+ right: right + window.scrollX,
75
+ bottom: bottom + window.scrollY,
76
+ left: left + window.scrollX
77
+ });
78
+ if (tooltipRef.current) {
79
+ setTooltipSizeOffset({
80
+ height: tooltipRef.current.offsetHeight,
81
+ width: tooltipRef.current.offsetWidth
82
+ });
83
+ }
84
+ }, [isTooltipOpen]);
85
+ var tooltipPositionCss = (0, SystemUIPositionGenerator_1.hoverTypeSystemUICssGenerator)({
86
+ baseSize: constants_1.ICON_BUTTON_SIZE[baseSize],
87
+ sizeOffset: tooltipSizeOffset,
88
+ positionOffset: tooltipPositionOffset,
89
+ systemUIPosition: tooltipPosition.includes('_')
90
+ ? tooltipPosition
91
+ : "center_".concat(tooltipPosition)
92
+ });
52
93
  var handleTooltipToggle = function (value) {
53
94
  setIsTooltipOpen(value);
54
95
  };
@@ -70,7 +111,7 @@ function UploadIconButton(_a) {
70
111
  }
71
112
  return types_1.iconStateColors[fillType];
72
113
  };
73
- return ((0, jsx_runtime_1.jsxs)(S_UploadIconButton, __assign({ "x-pds-name": "UploadIconButton", "x-pds-element-type": "component", "x-pds-device-type": "desktop", fillType: fillType, shapeType: shapeType, baseSize: baseSize, baseColorKey: baseColorKey, borderColorKey: borderColorKey, shadow: shadow, colorTheme: colorTheme, isDisabled: state === 'disabled', onPointerEnter: function () { return tooltipText && handleTooltipToggle(true); }, onPointerLeave: function () { return tooltipText && handleTooltipToggle(false); } }, { children: [(0, jsx_runtime_1.jsx)("input", { type: "file", hidden: true, disabled: state === 'disabled', accept: accept, multiple: multipleMode === 'use', onChange: handleClick }), (0, jsx_runtime_1.jsx)(hybrid_1.Icon, { iconName: iconName, size: iconSize, colorKey: IconColorSelect(), fillType: iconFillType }), tooltipText && isTooltipOpen && ((0, jsx_runtime_1.jsx)(S_TooltipWrapper, __assign({ className: "TooltipWrapper", isTooltipOpen: isTooltipOpen, tooltipPosition: tooltipPosition, baseSize: baseSize }, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: tooltipText, colorOverride: "ui_cpnt_textlabel_button_tooltip", styleTheme: "caption2Regular", colorTheme: "sysTextSecondary" }) })))] })));
114
+ return ((0, jsx_runtime_1.jsxs)(S_UploadIconButton, __assign({ "x-pds-name": "UploadIconButton", "x-pds-element-type": "component", "x-pds-device-type": "desktop", ref: tooltipPositionTargetRef, fillType: fillType, shapeType: shapeType, baseSize: baseSize, baseColorKey: baseColorKey, borderColorKey: borderColorKey, shadow: shadow, colorTheme: colorTheme, isDisabled: state === 'disabled', onPointerEnter: function () { return tooltipText && handleTooltipToggle(true); }, onPointerLeave: function () { return tooltipText && handleTooltipToggle(false); } }, { children: [(0, jsx_runtime_1.jsx)("input", { type: "file", hidden: true, disabled: state === 'disabled', accept: accept, multiple: multipleMode === 'use', onChange: handleClick }), (0, jsx_runtime_1.jsx)(hybrid_1.Icon, { iconName: iconName, size: iconSize, colorKey: IconColorSelect(), fillType: iconFillType }), isTooltipOpen && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(S_TooltipWrapper, __assign({ className: "TooltipWrapper", ref: tooltipRef, tooltipPositionCss: tooltipPositionCss }, { children: tooltipText })), document.body) }))] })));
74
115
  }
75
116
  var fillDisabled = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n\n &:hover:not([disabled])::before {\n background-color: unset;\n }\n\n &:active:not([disabled])::before {\n background-color: unset;\n }\n"], ["\n background-color: ", ";\n\n &:hover:not([disabled])::before {\n background-color: unset;\n }\n\n &:active:not([disabled])::before {\n background-color: unset;\n }\n"])), function (_a) {
76
117
  var theme = _a.theme, baseColorKey = _a.baseColorKey;
@@ -173,46 +214,9 @@ var S_UploadIconButton = styled_components_1.default.label(templateObject_13 ||
173
214
  xsmall: xsmall
174
215
  }[baseSize];
175
216
  });
176
- var tooltipPositionSpacing = (0, styled_components_1.css)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) {
177
- var baseSize = _a.baseSize;
178
- return baseSize &&
179
- {
180
- xxlarge: constants_1.TOOLTIP_POSITION_SPACING.xxlarge,
181
- large: constants_1.TOOLTIP_POSITION_SPACING.large,
182
- medium: constants_1.TOOLTIP_POSITION_SPACING.medium,
183
- small: constants_1.TOOLTIP_POSITION_SPACING.small,
184
- xsmall: constants_1.TOOLTIP_POSITION_SPACING.xsmall
185
- }[baseSize];
186
- });
187
- var tooltipLeftTop = (0, styled_components_1.css)(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n bottom: ", ";\n right: 0;\n"], ["\n bottom: ", ";\n right: 0;\n"])), tooltipPositionSpacing);
188
- var tooltipLeftBottom = (0, styled_components_1.css)(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n right: 0;\n top: ", ";\n"], ["\n right: 0;\n top: ", ";\n"])), tooltipPositionSpacing);
189
- var tooltipCenterTop = (0, styled_components_1.css)(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n bottom: ", ";\n"], ["\n bottom: ", ";\n"])), tooltipPositionSpacing);
190
- var tooltipCenterBottom = (0, styled_components_1.css)(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n top: ", ";\n"], ["\n top: ", ";\n"])), tooltipPositionSpacing);
191
- var tooltipRightTop = (0, styled_components_1.css)(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n bottom: ", ";\n left: 0;\n"], ["\n bottom: ", ";\n left: 0;\n"])), tooltipPositionSpacing);
192
- var tooltipRightBottom = (0, styled_components_1.css)(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n left: 0;\n top: ", ";\n"], ["\n left: 0;\n top: ", ";\n"])), tooltipPositionSpacing);
193
- var S_TooltipWrapper = styled_components_1.default.div(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n padding: ", ";\n position: absolute;\n width: max-content;\n z-index: 400;\n\n ", ";\n\n ", "\n"], ["\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n padding: ", ";\n position: absolute;\n width: max-content;\n z-index: 400;\n\n ", ";\n\n ", "\n"])), function (_a) {
194
- var theme = _a.theme;
195
- return theme.ui_cpnt_button_tooltip_base;
196
- }, function (_a) {
197
- var theme = _a.theme;
198
- return theme.spacing.spacingA;
199
- }, function (_a) {
200
- var theme = _a.theme;
201
- return "".concat(theme.spacing.spacingA, " ").concat(theme.spacing.spacingB);
202
- }, function (_a) {
203
- var isTooltipOpen = _a.isTooltipOpen;
204
- return !isTooltipOpen && 'display: none';
205
- }, function (_a) {
206
- var tooltipPosition = _a.tooltipPosition;
207
- return tooltipPosition &&
208
- {
209
- left_top: tooltipLeftTop,
210
- left_bottom: tooltipLeftBottom,
211
- center_top: tooltipCenterTop,
212
- center_bottom: tooltipCenterBottom,
213
- right_top: tooltipRightTop,
214
- right_bottom: tooltipRightBottom
215
- }[tooltipPosition];
217
+ var S_TooltipWrapper = styled_components_1.default.div(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n ", "\n\n ", ";\n"], ["\n ", "\n\n ", ";\n"])), systemUI_1.TooltipWrapperStyle, function (_a) {
218
+ var tooltipPositionCss = _a.tooltipPositionCss;
219
+ return tooltipPositionCss;
216
220
  });
217
221
  exports.default = UploadIconButton;
218
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21;
222
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14;
@@ -0,0 +1,7 @@
1
+ export declare const ICON_BUTTON_SIZE: {
2
+ xxlarge: number;
3
+ large: number;
4
+ medium: number;
5
+ small: number;
6
+ xsmall: number;
7
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ICON_BUTTON_SIZE = void 0;
4
+ exports.ICON_BUTTON_SIZE = {
5
+ xxlarge: 96,
6
+ large: 48,
7
+ medium: 40,
8
+ small: 32,
9
+ xsmall: 24
10
+ };