pds-dev-kit-web 2.0.14-alpha.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -4
- package/dist/index.js +9 -3
- package/dist/src/common/assets/icons/line/DottedCircle.d.ts +4 -0
- package/dist/src/common/assets/icons/line/DottedCircle.js +30 -0
- package/dist/src/common/assets/icons/line/index.d.ts +1 -0
- package/dist/src/common/assets/icons/line/index.js +2 -0
- package/dist/src/common/styles/colorSet/PaletteColor_Dark.json +14 -2
- package/dist/src/common/styles/colorSet/PaletteColor_light.json +13 -1
- package/dist/src/common/styles/colorSet/UIColor.json +26 -1
- package/dist/src/common/styles/colorSet/index.d.ts +51 -2
- package/dist/src/common/styles/colorSet/index.js +2 -2
- package/dist/src/common/styles/colorSet/ui-type.d.ts +25 -0
- package/dist/src/common/types/components.d.ts +15 -0
- package/dist/src/desktop/common/components/TextFieldBase/TextFieldBase.d.ts +4 -1
- package/dist/src/desktop/common/components/TextFieldBase/TextFieldBase.js +36 -11
- package/dist/src/desktop/common/components/TextFieldBase/constants.d.ts +1 -0
- package/dist/src/desktop/common/components/TextFieldBase/constants.js +4 -0
- package/dist/src/desktop/components/BasicButtonGroup/BasicButtonGroup.d.ts +9 -0
- package/dist/src/desktop/components/BasicButtonGroup/BasicButtonGroup.js +73 -0
- package/dist/src/desktop/components/BasicButtonGroup/index.d.ts +1 -0
- package/dist/src/desktop/components/BasicButtonGroup/index.js +8 -0
- package/dist/src/desktop/components/ContextMenuItem/ContextMenuItem.d.ts +5 -3
- package/dist/src/desktop/components/ContextMenuItem/ContextMenuItem.js +15 -3
- package/dist/src/desktop/components/Dropdown/Dropdown.d.ts +9 -10
- package/dist/src/desktop/components/Dropdown/Dropdown.js +71 -26
- package/dist/src/desktop/components/IconButton/IconButton.d.ts +4 -2
- package/dist/src/desktop/components/IconButton/IconButton.js +52 -4
- package/dist/src/desktop/components/IconButton/constants.d.ts +15 -0
- package/dist/src/desktop/components/IconButton/constants.js +19 -0
- package/dist/src/desktop/components/SegmentedButtonGroup/SegmentedButtonGroup.d.ts +18 -0
- package/dist/src/desktop/components/SegmentedButtonGroup/SegmentedButtonGroup.js +143 -0
- package/dist/src/desktop/components/SegmentedButtonGroup/index.d.ts +1 -0
- package/dist/src/desktop/components/SegmentedButtonGroup/index.js +8 -0
- package/dist/src/desktop/components/Slider/Slider.d.ts +19 -0
- package/dist/src/desktop/components/Slider/Slider.js +200 -0
- package/dist/src/desktop/components/Slider/index.d.ts +1 -0
- package/dist/src/desktop/components/Slider/index.js +8 -0
- package/dist/src/desktop/components/TextField/TextField.d.ts +3 -1
- package/dist/src/desktop/components/TextField/TextField.js +5 -5
- package/dist/src/desktop/components/index.d.ts +4 -1
- package/dist/src/desktop/components/index.js +7 -1
- package/dist/src/desktop/index.d.ts +1 -1
- package/dist/src/desktop/index.js +5 -2
- package/dist/src/desktop/layout/LayoutWS/Containers/ContentsContainer/ContentsContainer.d.ts +1 -1
- package/dist/src/desktop/layout/LayoutWS/Containers/ContentsContainer/ContentsContainer.js +2 -1
- package/dist/src/desktop/layout/LayoutWS/Containers/ContentsContainer/variation/WSG.js +57 -32
- package/dist/src/desktop/layout/LayoutWS/Containers/ContentsContainer/variation/WSI.d.ts +15 -0
- package/dist/src/desktop/layout/LayoutWS/Containers/ContentsContainer/variation/WSI.js +117 -0
- package/dist/src/desktop/layout/LayoutWS/Containers/ContentsContainer/variation/index.d.ts +1 -0
- package/dist/src/desktop/layout/LayoutWS/Containers/ContentsContainer/variation/index.js +3 -1
- package/dist/src/desktop/layout/LayoutWS/ContainersBox/ContainersBox.d.ts +1 -1
- package/dist/src/mobile/common/components/TextFieldBase/TextFieldBase.d.ts +4 -1
- package/dist/src/mobile/common/components/TextFieldBase/TextFieldBase.js +35 -10
- package/dist/src/mobile/common/components/TextFieldBase/constants.d.ts +1 -0
- package/dist/src/mobile/common/components/TextFieldBase/constants.js +4 -0
- package/dist/src/mobile/components/BasicButtonGroup/BasicButtonGroup.d.ts +9 -0
- package/dist/src/mobile/components/BasicButtonGroup/BasicButtonGroup.js +73 -0
- package/dist/src/mobile/components/BasicButtonGroup/index.d.ts +1 -0
- package/dist/src/mobile/components/BasicButtonGroup/index.js +8 -0
- package/dist/src/mobile/components/ContextMenu/ContextMenu.js +1 -1
- package/dist/src/mobile/components/ContextMenuItem/ContextMenuItem.d.ts +5 -3
- package/dist/src/mobile/components/ContextMenuItem/ContextMenuItem.js +15 -3
- package/dist/src/mobile/components/Dropdown/Dropdown.d.ts +9 -10
- package/dist/src/mobile/components/Dropdown/Dropdown.js +70 -25
- package/dist/src/mobile/components/SegmentedButtonGroup/SegmentedButtonGroup.d.ts +18 -0
- package/dist/src/mobile/components/SegmentedButtonGroup/SegmentedButtonGroup.js +143 -0
- package/dist/src/mobile/components/SegmentedButtonGroup/index.d.ts +1 -0
- package/dist/src/mobile/components/SegmentedButtonGroup/index.js +8 -0
- package/dist/src/mobile/components/Slider/Slider.d.ts +19 -0
- package/dist/src/mobile/components/Slider/Slider.js +197 -0
- package/dist/src/mobile/components/Slider/index.d.ts +1 -0
- package/dist/src/mobile/components/Slider/index.js +8 -0
- package/dist/src/mobile/components/TextField/TextField.d.ts +3 -1
- package/dist/src/mobile/components/TextField/TextField.js +5 -5
- package/dist/src/mobile/components/index.d.ts +4 -1
- package/dist/src/mobile/components/index.js +7 -1
- package/dist/src/mobile/index.d.ts +1 -1
- package/dist/src/mobile/index.js +5 -1
- package/dist/src/sub/DynamicLayout/mock_storybook.js +20 -112
- package/dist/src/sub/DynamicLayout/sections/MembershipSection/NormalType/templates/TemplateA/mobile/components/SectionContents.js +1 -1
- package/dist/src/sub/DynamicLayout/sections/MembershipSection/NormalType/templates/TemplateB/mobile/components/SectionContents.js +1 -1
- package/package.json +1 -1
- package/release-note.md +8 -7
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __assign = (this && this.__assign) || function () {
|
|
7
|
+
__assign = Object.assign || function(t) {
|
|
8
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
+
s = arguments[i];
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
return __assign.apply(this, arguments);
|
|
16
|
+
};
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
var components_1 = require("../../../hybrid/components");
|
|
39
|
+
var styled_components_1 = __importStar(require("styled-components"));
|
|
40
|
+
function BasicButtonGroup(_a) {
|
|
41
|
+
var _b = _a.size, size = _b === void 0 ? 'medium' : _b, valueArray = _a.valueArray, _c = _a.state, state = _c === void 0 ? 'normal' : _c;
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(S_BasicButtonGroup, __assign({ "x-pds-name": "BasicButtonGroup", "x-pds-element-type": "component", "x-pds-device-type": "desktop" }, { children: valueArray.map(function (_a, index) {
|
|
43
|
+
var iconName = _a.iconName, _b = _a.iconFillType, iconFillType = _b === void 0 ? 'line' : _b, _c = _a.state, buttonState = _c === void 0 ? 'normal' : _c, onClick = _a.onClick, onMouseDown = _a.onMouseDown;
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(S_BasicButton, __assign({ size: size, onClick: function (e) { return onClick && onClick(e); }, onMouseDown: function (e) { return onMouseDown && onMouseDown(e); }, disabled: state === 'disabled' || buttonState === 'disabled' }, { children: (0, jsx_runtime_1.jsx)(components_1.Icon, { iconName: iconName, size: size === 'small' ? 20 : 24, iconFillType: iconFillType, colorKey: state === 'disabled' || buttonState === 'disabled'
|
|
45
|
+
? 'ui_cpnt_button_icon_disabled'
|
|
46
|
+
: 'ui_cpnt_button_icon_enabled' }, void 0) }), iconName + index));
|
|
47
|
+
}) }), void 0));
|
|
48
|
+
}
|
|
49
|
+
var S_BasicButtonGroup = 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) {
|
|
50
|
+
var theme = _a.theme;
|
|
51
|
+
return theme.spacing.spacingA;
|
|
52
|
+
});
|
|
53
|
+
var large = (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: 14px;\n height: 48px;\n width: 48px;\n"], ["\n border-radius: 14px;\n height: 48px;\n width: 48px;\n"])));
|
|
54
|
+
var medium = (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border-radius: 12px;\n height: 40px;\n width: 40px;\n"], ["\n border-radius: 12px;\n height: 40px;\n width: 40px;\n"])));
|
|
55
|
+
var small = (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border-radius: 10px;\n height: 32px;\n width: 32px;\n"], ["\n border-radius: 10px;\n height: 32px;\n width: 32px;\n"])));
|
|
56
|
+
var S_BasicButton = styled_components_1.default.button(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n border: none;\n display: inline-flex;\n justify-content: center;\n position: relative;\n\n ", ";\n\n &::before {\n background-color: transparent;\n border-radius: inherit;\n content: '';\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n }\n\n &:hover:enabled:before {\n background-color: ", ";\n }\n\n &:active:enabled:before {\n background-color: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n cursor: default;\n }\n"], ["\n align-items: center;\n background-color: ", ";\n border: none;\n display: inline-flex;\n justify-content: center;\n position: relative;\n\n ", ";\n\n &::before {\n background-color: transparent;\n border-radius: inherit;\n content: '';\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n }\n\n &:hover:enabled:before {\n background-color: ", ";\n }\n\n &:active:enabled:before {\n background-color: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n cursor: default;\n }\n"])), function (_a) {
|
|
57
|
+
var theme = _a.theme;
|
|
58
|
+
return theme.ui_cpnt_basicbuttongroup_base_default;
|
|
59
|
+
}, function (_a) {
|
|
60
|
+
var size = _a.size;
|
|
61
|
+
return size && { large: large, medium: medium, small: small }[size];
|
|
62
|
+
}, function (_a) {
|
|
63
|
+
var theme = _a.theme;
|
|
64
|
+
return theme.ui_cpnt_button_fill_on_base_hover;
|
|
65
|
+
}, function (_a) {
|
|
66
|
+
var theme = _a.theme;
|
|
67
|
+
return theme.ui_cpnt_button_fill_on_base_pressed;
|
|
68
|
+
}, function (_a) {
|
|
69
|
+
var theme = _a.theme;
|
|
70
|
+
return theme.ui_cpnt_basicbuttongroup_base_disabled;
|
|
71
|
+
});
|
|
72
|
+
exports.default = BasicButtonGroup;
|
|
73
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BasicButtonGroup } from './BasicButtonGroup';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BasicButtonGroup = void 0;
|
|
7
|
+
var BasicButtonGroup_1 = require("./BasicButtonGroup");
|
|
8
|
+
Object.defineProperty(exports, "BasicButtonGroup", { enumerable: true, get: function () { return __importDefault(BasicButtonGroup_1).default; } });
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { PDSTextType, PDSValueOption } from '../../../common';
|
|
3
|
+
import type { DropdownValueOption } from '../../../common/types';
|
|
3
4
|
export declare type ContextMenuItemProps = {
|
|
4
|
-
option?: PDSValueOption;
|
|
5
|
+
option?: PDSValueOption | DropdownValueOption;
|
|
5
6
|
size?: 'large' | 'medium' | 'small';
|
|
6
7
|
isSelected?: boolean;
|
|
7
8
|
state?: 'normal' | 'disabled';
|
|
8
|
-
|
|
9
|
+
displayType?: 'text_only' | 'icon_only' | 'icon_text';
|
|
10
|
+
onClick?: (value: PDSValueOption | DropdownValueOption | string | number | boolean) => void;
|
|
9
11
|
/** @deprecated option 필드를 대신 사용하세요. */
|
|
10
12
|
text?: PDSTextType;
|
|
11
13
|
/** @deprecated option 필드를 대신 사용하세요. */
|
|
12
14
|
value?: string | number | boolean;
|
|
13
15
|
};
|
|
14
|
-
declare function ContextMenuItem({ option, size, isSelected, state, onClick, text, value }: ContextMenuItemProps): JSX.Element;
|
|
16
|
+
declare function ContextMenuItem({ option, size, isSelected, state, displayType, onClick, text, value }: ContextMenuItemProps): JSX.Element;
|
|
15
17
|
export default ContextMenuItem;
|
|
@@ -35,10 +35,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
var components_1 = require("../../../hybrid/components");
|
|
38
39
|
var styled_components_1 = __importStar(require("styled-components"));
|
|
39
40
|
var TextLabel_1 = require("../TextLabel");
|
|
40
41
|
function ContextMenuItem(_a) {
|
|
41
|
-
var option = _a.option, _b = _a.size, size = _b === void 0 ? 'small' : _b, _c = _a.isSelected, isSelected = _c === void 0 ? false : _c, _d = _a.state, state = _d === void 0 ? 'normal' : _d, onClick = _a.onClick, text = _a.text, value = _a.value;
|
|
42
|
+
var option = _a.option, _b = _a.size, size = _b === void 0 ? 'small' : _b, _c = _a.isSelected, isSelected = _c === void 0 ? false : _c, _d = _a.state, state = _d === void 0 ? 'normal' : _d, displayType = _a.displayType, onClick = _a.onClick, text = _a.text, value = _a.value;
|
|
42
43
|
var handleClick = function () {
|
|
43
44
|
if (state === 'disabled') {
|
|
44
45
|
return;
|
|
@@ -60,7 +61,15 @@ function ContextMenuItem(_a) {
|
|
|
60
61
|
if (state === 'disabled') {
|
|
61
62
|
textColorTheme = 'sysTextTertiary';
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
+
var getIconColorKey = function () {
|
|
65
|
+
if (state === 'disabled') {
|
|
66
|
+
return 'ui_cpnt_dropdown_display_icon_disabled';
|
|
67
|
+
}
|
|
68
|
+
return 'ui_cpnt_dropdown_display_icon_normal';
|
|
69
|
+
};
|
|
70
|
+
return ((0, jsx_runtime_1.jsxs)(S_ContextMenuItem, __assign({ "x-pds-name": "ContextMenuItem", "x-pds-element-type": "component", "x-pds-device-type": "desktop", size: size, onClick: handleClick, selected: isSelected, disabled: state === 'disabled', displayType: displayType }, { children: [(displayType === 'icon_only' || displayType === 'icon_text') &&
|
|
71
|
+
option &&
|
|
72
|
+
'iconName' in option && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(components_1.Icon, { size: size === 'small' ? 20 : 24, iconName: option.iconName, fillType: option.iconFillType, colorKey: getIconColorKey() }, void 0) }, void 0)), (displayType === 'text_only' || displayType === 'icon_text') && (option === null || option === void 0 ? void 0 : option.text) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Spacing, { size: "spacing_b", spacingType: "width" }, void 0), (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: option.text || text, styleTheme: "form2Regular", singleLineMode: "use", colorTheme: textColorTheme, ellipsisMode: "use", lineLimit: 1, wordBreak: "break_all" }, void 0)] }, void 0))] }), void 0));
|
|
64
73
|
}
|
|
65
74
|
var large = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 48px;\n padding: 0 ", ";\n\n & > div {\n height: 48px;\n line-height: 48px;\n }\n"], ["\n height: 48px;\n padding: 0 ", ";\n\n & > div {\n height: 48px;\n line-height: 48px;\n }\n"])), function (_a) {
|
|
66
75
|
var theme = _a.theme;
|
|
@@ -74,11 +83,14 @@ var small = (0, styled_components_1.css)(templateObject_3 || (templateObject_3 =
|
|
|
74
83
|
var theme = _a.theme;
|
|
75
84
|
return theme.spacing.spacingD;
|
|
76
85
|
});
|
|
77
|
-
var S_ContextMenuItem = styled_components_1.default.li(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n box-sizing: border-box;\n cursor: pointer;\n display: flex;\n\n ", ";\n\n &:hover {\n background-color: ", ";\n }\n\n ", ";\n"], ["\n align-items: center;\n background-color: ", ";\n box-sizing: border-box;\n cursor: pointer;\n display: flex;\n\n ", ";\n\n &:hover {\n background-color: ", ";\n }\n\n ", ";\n"])), function (_a) {
|
|
86
|
+
var S_ContextMenuItem = styled_components_1.default.li(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n box-sizing: border-box;\n cursor: pointer;\n display: flex;\n\n ", ";\n ", ";\n\n &:hover {\n background-color: ", ";\n }\n\n ", ";\n"], ["\n align-items: center;\n background-color: ", ";\n box-sizing: border-box;\n cursor: pointer;\n display: flex;\n\n ", ";\n ", ";\n\n &:hover {\n background-color: ", ";\n }\n\n ", ";\n"])), function (_a) {
|
|
78
87
|
var theme = _a.theme, selected = _a.selected;
|
|
79
88
|
return selected
|
|
80
89
|
? theme.ui_cpnt_contextmenu_menu_base_selected
|
|
81
90
|
: theme.ui_cpnt_contextmenu_menu_base_normal;
|
|
91
|
+
}, function (_a) {
|
|
92
|
+
var displayType = _a.displayType;
|
|
93
|
+
return displayType === 'icon_only' && 'justify-content: center';
|
|
82
94
|
}, function (_a) {
|
|
83
95
|
var size = _a.size;
|
|
84
96
|
return size && { large: large, medium: medium, small: small }[size];
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { PDSTextType
|
|
3
|
-
|
|
4
|
-
state?: 'normal' | 'disabled';
|
|
5
|
-
};
|
|
2
|
+
import type { PDSTextType } from '../../../common';
|
|
3
|
+
import type { DropdownValueOption } from '../../../common/types';
|
|
6
4
|
declare type Props = {
|
|
7
5
|
colorTheme?: 'none' | 'dark' | 'white';
|
|
8
6
|
hintText?: PDSTextType;
|
|
9
7
|
maxHeightItemNumber?: number;
|
|
10
|
-
defaultValue?:
|
|
11
|
-
value?:
|
|
8
|
+
defaultValue?: DropdownValueOption;
|
|
9
|
+
value?: DropdownValueOption | null;
|
|
12
10
|
responsiveMode?: 'none' | 'use';
|
|
13
|
-
size?: 'large' | 'small';
|
|
11
|
+
size?: 'large' | 'medium' | 'small';
|
|
14
12
|
state?: 'normal' | 'read_only' | 'disabled';
|
|
15
|
-
valueArray:
|
|
13
|
+
valueArray: DropdownValueOption[];
|
|
16
14
|
customWidth?: string;
|
|
17
|
-
|
|
15
|
+
displayType?: 'text_only' | 'icon_only' | 'icon_text';
|
|
16
|
+
onChange?: (option: DropdownValueOption) => void;
|
|
18
17
|
};
|
|
19
|
-
declare function Dropdown({ colorTheme, value, defaultValue, hintText, maxHeightItemNumber, responsiveMode, size, state, valueArray, customWidth, onChange }: Props): JSX.Element;
|
|
18
|
+
declare function Dropdown({ colorTheme, value, defaultValue, hintText, maxHeightItemNumber, responsiveMode, size, state, valueArray, customWidth, displayType, onChange }: Props): JSX.Element;
|
|
20
19
|
export default Dropdown;
|
|
@@ -48,9 +48,9 @@ function Dropdown(_a) {
|
|
|
48
48
|
// selectionMode = 'single',
|
|
49
49
|
_e = _a.size,
|
|
50
50
|
// selectionMode = 'single',
|
|
51
|
-
size = _e === void 0 ? 'large' : _e, _f = _a.state, state = _f === void 0 ? 'normal' : _f, valueArray = _a.valueArray, customWidth = _a.customWidth, onChange = _a.onChange;
|
|
52
|
-
var
|
|
53
|
-
var
|
|
51
|
+
size = _e === void 0 ? 'large' : _e, _f = _a.state, state = _f === void 0 ? 'normal' : _f, valueArray = _a.valueArray, customWidth = _a.customWidth, _g = _a.displayType, displayType = _g === void 0 ? 'text_only' : _g, onChange = _a.onChange;
|
|
52
|
+
var _h = (0, react_1.useState)(false), isFocused = _h[0], setIsFocused = _h[1];
|
|
53
|
+
var _j = (0, react_1.useState)(null), selectedValue = _j[0], setSelectedValue = _j[1];
|
|
54
54
|
/**
|
|
55
55
|
* @when value 프롭의 값에 따라
|
|
56
56
|
* @expected 값이 null일 때 드롭다운을 초기화하고, 값이 있다면 해당 값으로 설정해줍니다.
|
|
@@ -96,7 +96,21 @@ function Dropdown(_a) {
|
|
|
96
96
|
onChange(option);
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
+
var getCustomWidth = function () {
|
|
100
|
+
if (customWidth) {
|
|
101
|
+
return customWidth;
|
|
102
|
+
}
|
|
103
|
+
if (displayType === 'icon_only') {
|
|
104
|
+
return 'auto';
|
|
105
|
+
}
|
|
106
|
+
};
|
|
99
107
|
var getIconColorKey = function () {
|
|
108
|
+
if (state === 'disabled' || state === 'read_only') {
|
|
109
|
+
return 'ui_cpnt_dropdown_display_icon_disabled';
|
|
110
|
+
}
|
|
111
|
+
return 'ui_cpnt_dropdown_display_icon_normal';
|
|
112
|
+
};
|
|
113
|
+
var getArrowIconColorKey = function () {
|
|
100
114
|
if (colorTheme === 'dark') {
|
|
101
115
|
if (state === 'disabled' || state === 'read_only') {
|
|
102
116
|
return 'ui_cpnt_dropdown_text_darktheme_disabled';
|
|
@@ -176,12 +190,9 @@ function Dropdown(_a) {
|
|
|
176
190
|
var LARGE_HEIGHT = 48;
|
|
177
191
|
return LARGE_HEIGHT * maxHeightItemNumber;
|
|
178
192
|
}, [size, maxHeightItemNumber]);
|
|
179
|
-
return ((0, jsx_runtime_1.jsxs)(S_Dropdown, __assign({ "x-pds-name": "Dropdown", "x-pds-element-type": "component", "x-pds-device-type": "desktop", className: "container", size: size, tabIndex: 0, onBlur: handleBlur, responsiveMode: responsiveMode, customWidth: customWidth }, { children: [(0, jsx_runtime_1.jsxs)(S_Select, __assign({ size: size, onClick: handleClick, isFocused: isFocused, state: state, colorTheme: colorTheme, responsiveMode: responsiveMode, customWidth: customWidth }, { children: [(0, jsx_runtime_1.
|
|
193
|
+
return ((0, jsx_runtime_1.jsxs)(S_Dropdown, __assign({ "x-pds-name": "Dropdown", "x-pds-element-type": "component", "x-pds-device-type": "desktop", className: "container", size: size, tabIndex: 0, onBlur: handleBlur, responsiveMode: responsiveMode, customWidth: customWidth, displayType: displayType }, { children: [(0, jsx_runtime_1.jsxs)(S_Select, __assign({ size: size, onClick: handleClick, isFocused: isFocused, state: state, colorTheme: colorTheme, responsiveMode: responsiveMode, customWidth: customWidth, displayType: displayType }, { children: [(0, jsx_runtime_1.jsxs)(S_TextLabel, __assign({ size: size, responsiveMode: responsiveMode, displayType: displayType }, { children: [(displayType === 'icon_only' || displayType === 'icon_text') && (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.iconName) && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(hybrid_1.Icon, { size: size === 'small' ? 20 : 24, iconName: selectedValue.iconName, fillType: selectedValue.iconFillType, colorKey: getIconColorKey() }, void 0) }, void 0)), (displayType === 'text_only' || displayType === 'icon_text') && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(hybrid_1.Spacing, { size: "spacing_b", spacingType: "width" }, void 0), (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.text) || (value === null || value === void 0 ? void 0 : value.text) || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.text) || hintText, styleTheme: "form2Regular", singleLineMode: "use", colorTheme: getTextColorTheme(), colorOverride: getTextColorOverride(), ellipsisMode: "use", lineLimit: 1, wordBreak: "break_all" }, void 0)] }, void 0))] }), void 0), (0, jsx_runtime_1.jsx)(hybrid_1.Icon, { size: 16, fillType: "line", iconName: isFocused ? 'ic_arrow_up' : 'ic_arrow_down', colorKey: getArrowIconColorKey() }, void 0)] }), void 0), isFocused && ((0, jsx_runtime_1.jsx)(S_ContextMenuWrapper, __assign({ displayType: displayType }, { children: (0, jsx_runtime_1.jsx)(ContextMenu_1.ContextMenu, __assign({ autoWidthMode: "use", maxHeight: maxHeight, customWidth: getCustomWidth() }, { children: valueArray.map(function (el) { return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(ContextMenuItem_1.ContextMenuItem, { option: el, size: size, isSelected: (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.value) === el.value, onClick: handleClickOption, state: el.state, displayType: displayType }, void 0) }, el.value)); }) }), void 0) }), void 0))] }), void 0));
|
|
180
194
|
}
|
|
181
|
-
var S_TextLabel = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n
|
|
182
|
-
var theme = _a.theme;
|
|
183
|
-
return theme.spacing.spacingD;
|
|
184
|
-
}, function (_a) {
|
|
195
|
+
var S_TextLabel = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n display: flex;\n padding-right: ", ";\n\n ", ";\n"], ["\n align-items: center;\n display: flex;\n padding-right: ", ";\n\n ", ";\n"])), function (_a) {
|
|
185
196
|
var theme = _a.theme;
|
|
186
197
|
return theme.spacing.spacingB;
|
|
187
198
|
}, function (_a) {
|
|
@@ -189,29 +200,53 @@ var S_TextLabel = styled_components_1.default.div(templateObject_1 || (templateO
|
|
|
189
200
|
return size &&
|
|
190
201
|
{
|
|
191
202
|
large: large,
|
|
203
|
+
medium: medium,
|
|
192
204
|
small: small
|
|
193
205
|
}[size];
|
|
194
206
|
});
|
|
195
207
|
var large = (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 48px;\n width: ", ";\n\n & > div {\n height: 48px;\n line-height: 48px;\n }\n"], ["\n height: 48px;\n width: ", ";\n\n & > div {\n height: 48px;\n line-height: 48px;\n }\n"])), function (_a) {
|
|
196
|
-
var responsiveMode = _a.responsiveMode;
|
|
197
|
-
|
|
208
|
+
var displayType = _a.displayType, responsiveMode = _a.responsiveMode;
|
|
209
|
+
if (responsiveMode === 'use') {
|
|
210
|
+
return '100%';
|
|
211
|
+
}
|
|
212
|
+
if (displayType === 'icon_only') {
|
|
213
|
+
return 'fit-content';
|
|
214
|
+
}
|
|
215
|
+
return '432px';
|
|
198
216
|
});
|
|
199
|
-
var
|
|
200
|
-
var responsiveMode = _a.responsiveMode;
|
|
201
|
-
|
|
217
|
+
var medium = (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border-radius: 12px;\n height: 40px;\n width: ", ";\n\n & > div {\n height: 40px;\n line-height: 40px;\n }\n"], ["\n border-radius: 12px;\n height: 40px;\n width: ", ";\n\n & > div {\n height: 40px;\n line-height: 40px;\n }\n"])), function (_a) {
|
|
218
|
+
var displayType = _a.displayType, responsiveMode = _a.responsiveMode;
|
|
219
|
+
if (responsiveMode === 'use') {
|
|
220
|
+
return '100%';
|
|
221
|
+
}
|
|
222
|
+
if (displayType === 'icon_only') {
|
|
223
|
+
return 'fit-content';
|
|
224
|
+
}
|
|
225
|
+
return '188px';
|
|
202
226
|
});
|
|
203
|
-
var
|
|
227
|
+
var small = (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border-radius: 10px;\n height: 32px;\n width: ", ";\n\n & > div {\n height: 32px;\n line-height: 32px;\n }\n"], ["\n border-radius: 10px;\n height: 32px;\n width: ", ";\n\n & > div {\n height: 32px;\n line-height: 32px;\n }\n"])), function (_a) {
|
|
228
|
+
var displayType = _a.displayType, responsiveMode = _a.responsiveMode;
|
|
229
|
+
if (responsiveMode === 'use') {
|
|
230
|
+
return '100%';
|
|
231
|
+
}
|
|
232
|
+
if (displayType === 'icon_only') {
|
|
233
|
+
return 'fit-content';
|
|
234
|
+
}
|
|
235
|
+
return '188px';
|
|
236
|
+
});
|
|
237
|
+
var S_Dropdown = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: inline-block;\n outline: none;\n position: relative;\n\n ", ";\n\n ", "\n"], ["\n display: inline-block;\n outline: none;\n position: relative;\n\n ", ";\n\n ", "\n"])), function (_a) {
|
|
204
238
|
var size = _a.size;
|
|
205
239
|
return size &&
|
|
206
240
|
{
|
|
207
241
|
large: large,
|
|
242
|
+
medium: medium,
|
|
208
243
|
small: small
|
|
209
244
|
}[size];
|
|
210
245
|
}, function (_a) {
|
|
211
246
|
var customWidth = _a.customWidth;
|
|
212
247
|
return customWidth && "width: " + customWidth + ";";
|
|
213
248
|
});
|
|
214
|
-
var colorThemeBackgroundReadOnly = (0, styled_components_1.css)(
|
|
249
|
+
var colorThemeBackgroundReadOnly = (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) {
|
|
215
250
|
var colorTheme = _a.colorTheme, theme = _a.theme;
|
|
216
251
|
switch (colorTheme) {
|
|
217
252
|
case 'dark':
|
|
@@ -222,7 +257,7 @@ var colorThemeBackgroundReadOnly = (0, styled_components_1.css)(templateObject_5
|
|
|
222
257
|
return theme.ui_cpnt_dropdown_base_disabled;
|
|
223
258
|
}
|
|
224
259
|
});
|
|
225
|
-
var colorThemeBackgroundDisabled = (0, styled_components_1.css)(
|
|
260
|
+
var colorThemeBackgroundDisabled = (0, styled_components_1.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) {
|
|
226
261
|
var colorTheme = _a.colorTheme, theme = _a.theme;
|
|
227
262
|
switch (colorTheme) {
|
|
228
263
|
case 'dark':
|
|
@@ -233,7 +268,7 @@ var colorThemeBackgroundDisabled = (0, styled_components_1.css)(templateObject_6
|
|
|
233
268
|
return theme.ui_cpnt_dropdown_base_disabled;
|
|
234
269
|
}
|
|
235
270
|
});
|
|
236
|
-
var colorThemeBackgroundNormal = (0, styled_components_1.css)(
|
|
271
|
+
var colorThemeBackgroundNormal = (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) {
|
|
237
272
|
var colorTheme = _a.colorTheme, theme = _a.theme;
|
|
238
273
|
switch (colorTheme) {
|
|
239
274
|
case 'dark':
|
|
@@ -244,7 +279,7 @@ var colorThemeBackgroundNormal = (0, styled_components_1.css)(templateObject_7 |
|
|
|
244
279
|
return theme.ui_cpnt_dropdown_base_normal;
|
|
245
280
|
}
|
|
246
281
|
});
|
|
247
|
-
var colorThemeBorderWhite = (0, styled_components_1.css)(
|
|
282
|
+
var colorThemeBorderWhite = (0, styled_components_1.css)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) {
|
|
248
283
|
var state = _a.state, theme = _a.theme;
|
|
249
284
|
switch (state) {
|
|
250
285
|
case 'disabled':
|
|
@@ -254,7 +289,7 @@ var colorThemeBorderWhite = (0, styled_components_1.css)(templateObject_8 || (te
|
|
|
254
289
|
return theme.ui_cpnt_dropdown_border_white_normal;
|
|
255
290
|
}
|
|
256
291
|
});
|
|
257
|
-
var colorThemeBorderDark = (0, styled_components_1.css)(
|
|
292
|
+
var colorThemeBorderDark = (0, styled_components_1.css)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) {
|
|
258
293
|
var state = _a.state, theme = _a.theme;
|
|
259
294
|
switch (state) {
|
|
260
295
|
case 'disabled':
|
|
@@ -264,7 +299,7 @@ var colorThemeBorderDark = (0, styled_components_1.css)(templateObject_9 || (tem
|
|
|
264
299
|
return theme.ui_cpnt_dropdown_border_darktheme_normal;
|
|
265
300
|
}
|
|
266
301
|
});
|
|
267
|
-
var borderColor = (0, styled_components_1.css)(
|
|
302
|
+
var borderColor = (0, styled_components_1.css)(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) {
|
|
268
303
|
var state = _a.state, theme = _a.theme;
|
|
269
304
|
switch (state) {
|
|
270
305
|
case 'disabled':
|
|
@@ -275,7 +310,7 @@ var borderColor = (0, styled_components_1.css)(templateObject_10 || (templateObj
|
|
|
275
310
|
return theme.ui_cpnt_dropdown_border_normal;
|
|
276
311
|
}
|
|
277
312
|
});
|
|
278
|
-
var backgroundHoverColor = (0, styled_components_1.css)(
|
|
313
|
+
var backgroundHoverColor = (0, styled_components_1.css)(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) {
|
|
279
314
|
var colorTheme = _a.colorTheme, theme = _a.theme;
|
|
280
315
|
switch (colorTheme) {
|
|
281
316
|
case 'none':
|
|
@@ -288,7 +323,7 @@ var backgroundHoverColor = (0, styled_components_1.css)(templateObject_11 || (te
|
|
|
288
323
|
return theme.ui_cpnt_textfield_base_hover;
|
|
289
324
|
}
|
|
290
325
|
});
|
|
291
|
-
var backgroundActiveColor = (0, styled_components_1.css)(
|
|
326
|
+
var backgroundActiveColor = (0, styled_components_1.css)(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) {
|
|
292
327
|
var colorTheme = _a.colorTheme, theme = _a.theme;
|
|
293
328
|
switch (colorTheme) {
|
|
294
329
|
case 'none':
|
|
@@ -301,8 +336,8 @@ var backgroundActiveColor = (0, styled_components_1.css)(templateObject_12 || (t
|
|
|
301
336
|
return theme.ui_cpnt_textfield_base_pressed;
|
|
302
337
|
}
|
|
303
338
|
});
|
|
304
|
-
var normalActionColor = (0, styled_components_1.css)(
|
|
305
|
-
var S_Select = styled_components_1.default.div(
|
|
339
|
+
var normalActionColor = (0, styled_components_1.css)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n"], ["\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n"])), backgroundHoverColor, backgroundActiveColor);
|
|
340
|
+
var S_Select = styled_components_1.default.div(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n border: 2px solid\n ", ";\n border-radius: 14px;\n box-sizing: border-box;\n cursor: ", ";\n display: flex;\n justify-content: space-between;\n padding-left: ", ";\n padding-right: ", ";\n\n ", ";\n\n ", "\n\n ", "\n\n ", "\n"], ["\n align-items: center;\n background-color: ", ";\n border: 2px solid\n ", ";\n border-radius: 14px;\n box-sizing: border-box;\n cursor: ", ";\n display: flex;\n justify-content: space-between;\n padding-left: ", ";\n padding-right: ", ";\n\n ", ";\n\n ", "\n\n ", "\n\n ", "\n"])), function (_a) {
|
|
306
341
|
var state = _a.state;
|
|
307
342
|
switch (state) {
|
|
308
343
|
case 'disabled':
|
|
@@ -332,11 +367,18 @@ var S_Select = styled_components_1.default.div(templateObject_14 || (templateObj
|
|
|
332
367
|
case 'normal':
|
|
333
368
|
return 'pointer';
|
|
334
369
|
}
|
|
370
|
+
}, function (_a) {
|
|
371
|
+
var size = _a.size, theme = _a.theme;
|
|
372
|
+
return size === 'large' ? theme.spacing.spacingD : theme.spacing.spacingC;
|
|
373
|
+
}, function (_a) {
|
|
374
|
+
var size = _a.size, theme = _a.theme;
|
|
375
|
+
return size === 'large' ? theme.spacing.spacingD : theme.spacing.spacingC;
|
|
335
376
|
}, function (_a) {
|
|
336
377
|
var size = _a.size;
|
|
337
378
|
return size &&
|
|
338
379
|
{
|
|
339
380
|
large: large,
|
|
381
|
+
medium: medium,
|
|
340
382
|
small: small
|
|
341
383
|
}[size];
|
|
342
384
|
}, function (_a) {
|
|
@@ -346,9 +388,12 @@ var S_Select = styled_components_1.default.div(templateObject_14 || (templateObj
|
|
|
346
388
|
var state = _a.state;
|
|
347
389
|
return state === 'normal' && normalActionColor;
|
|
348
390
|
});
|
|
349
|
-
var S_ContextMenuWrapper = styled_components_1.default.div(
|
|
391
|
+
var S_ContextMenuWrapper = styled_components_1.default.div(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n display: block;\n margin-top: ", ";\n position: absolute;\n width: ", ";\n"], ["\n display: block;\n margin-top: ", ";\n position: absolute;\n width: ", ";\n"])), function (_a) {
|
|
350
392
|
var theme = _a.theme;
|
|
351
393
|
return theme.spacing.spacingB;
|
|
394
|
+
}, function (_a) {
|
|
395
|
+
var displayType = _a.displayType;
|
|
396
|
+
return (displayType === 'icon_only' ? '100%' : 'inherit');
|
|
352
397
|
});
|
|
353
398
|
exports.default = Dropdown;
|
|
354
|
-
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;
|
|
399
|
+
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;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { FillIconNameKeys, LineIconNameKeys, UiColors } from '../../../common';
|
|
2
|
+
import type { FillIconNameKeys, LineIconNameKeys, PDSTextType, UiColors } from '../../../common';
|
|
3
3
|
export declare type IconButtonProps = {
|
|
4
|
+
tooltipText?: PDSTextType;
|
|
5
|
+
tooltipPosition?: 'left_top' | 'left_bottom' | 'center_top' | 'center_bottom' | 'right_top' | 'right_bottom';
|
|
4
6
|
fillType?: 'fill' | 'line';
|
|
5
7
|
shapeType?: 'circular' | 'rectangle';
|
|
6
8
|
baseSize?: 'xxlarge' | 'large' | 'medium' | 'small' | 'xsmall';
|
|
@@ -18,5 +20,5 @@ export declare type IconButtonProps = {
|
|
|
18
20
|
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
19
21
|
onMouseDown?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
20
22
|
};
|
|
21
|
-
declare function IconButton({ fillType, shapeType, baseSize, baseColorKey, borderColorKey, iconSize, iconFillType, iconName, iconColorKey, shadow, colorTheme, type, state, tabIndex, onClick, onMouseDown }: IconButtonProps): JSX.Element;
|
|
23
|
+
declare function IconButton({ tooltipText, tooltipPosition, fillType, shapeType, baseSize, baseColorKey, borderColorKey, iconSize, iconFillType, iconName, iconColorKey, shadow, colorTheme, type, state, tabIndex, onClick, onMouseDown }: IconButtonProps): JSX.Element;
|
|
22
24
|
export default IconButton;
|
|
@@ -35,11 +35,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
var react_1 = require("react");
|
|
38
39
|
var styled_components_1 = __importStar(require("styled-components"));
|
|
39
40
|
var transitionStyle_1 = require("../../../common/styles/movement/transitionStyle");
|
|
40
41
|
var hybrid_1 = require("../../../hybrid");
|
|
42
|
+
var TextLabel_1 = require("../TextLabel");
|
|
43
|
+
var constants_1 = require("./constants");
|
|
41
44
|
function IconButton(_a) {
|
|
42
|
-
var _b = _a.
|
|
45
|
+
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;
|
|
46
|
+
var _m = (0, react_1.useState)(false), isTooltipOpen = _m[0], setIsTooltipOpen = _m[1];
|
|
47
|
+
var handleTooltipToggle = function (value) {
|
|
48
|
+
setIsTooltipOpen(value);
|
|
49
|
+
};
|
|
43
50
|
var handleClick = function (e) {
|
|
44
51
|
if (onClick) {
|
|
45
52
|
onClick(e);
|
|
@@ -73,7 +80,7 @@ function IconButton(_a) {
|
|
|
73
80
|
}
|
|
74
81
|
return iconStateColorObj[fillType];
|
|
75
82
|
};
|
|
76
|
-
return ((0, jsx_runtime_1.
|
|
83
|
+
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, onMouseEnter: function () { return tooltipText && handleTooltipToggle(true); }, onMouseLeave: function () { return tooltipText && handleTooltipToggle(false); } }, { children: [(0, jsx_runtime_1.jsx)(hybrid_1.Icon, { iconName: iconName, size: iconSize, colorKey: IconColorSelect(), fillType: iconFillType }, void 0), 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" }, void 0) }), void 0))] }), void 0));
|
|
77
84
|
}
|
|
78
85
|
var fillDisabled = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n"], ["\n background-color: ", ";\n"])), function (_a) {
|
|
79
86
|
var theme = _a.theme, baseColorKey = _a.baseColorKey;
|
|
@@ -81,7 +88,7 @@ var fillDisabled = (0, styled_components_1.css)(templateObject_1 || (templateObj
|
|
|
81
88
|
? ''
|
|
82
89
|
: theme.ui_cpnt_button_fill_base_disabled;
|
|
83
90
|
});
|
|
84
|
-
var fill = (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n border: none;\n position: relative;\n\n &::before {\n
|
|
91
|
+
var fill = (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n border: none;\n position: relative;\n\n &::before {\n background-color: transparent;\n border-radius: inherit;\n content: '';\n height: 100%;\n position: absolute;\n width: 100%;\n ", "\n }\n\n &:hover:enabled::before {\n background-color: ", ";\n }\n\n &:active:enabled::before {\n background-color: ", ";\n }\n\n ", ";\n"], ["\n background-color: ", ";\n border: none;\n position: relative;\n\n &::before {\n background-color: transparent;\n border-radius: inherit;\n content: '';\n height: 100%;\n position: absolute;\n width: 100%;\n ", "\n }\n\n &:hover:enabled::before {\n background-color: ", ";\n }\n\n &:active:enabled::before {\n background-color: ", ";\n }\n\n ", ";\n"])), function (_a) {
|
|
85
92
|
var theme = _a.theme, baseColorKey = _a.baseColorKey;
|
|
86
93
|
return baseColorKey ? theme[baseColorKey] : theme.ui_cpnt_button_fill_base_primary;
|
|
87
94
|
}, transitionStyle_1.ButtonTransition, function (_a) {
|
|
@@ -172,5 +179,46 @@ var iconButtonStyle = (0, styled_components_1.css)(templateObject_12 || (templat
|
|
|
172
179
|
}[baseSize];
|
|
173
180
|
});
|
|
174
181
|
var S_IconButton = styled_components_1.default.button(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), iconButtonStyle);
|
|
182
|
+
var tooltipPositionSpacing = (0, styled_components_1.css)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) {
|
|
183
|
+
var baseSize = _a.baseSize;
|
|
184
|
+
return baseSize &&
|
|
185
|
+
{
|
|
186
|
+
xxlarge: constants_1.TOOLTIP_POSITION_SPACING.xxlarge,
|
|
187
|
+
large: constants_1.TOOLTIP_POSITION_SPACING.large,
|
|
188
|
+
medium: constants_1.TOOLTIP_POSITION_SPACING.medium,
|
|
189
|
+
small: constants_1.TOOLTIP_POSITION_SPACING.small,
|
|
190
|
+
xsmall: constants_1.TOOLTIP_POSITION_SPACING.xsmall
|
|
191
|
+
}[baseSize];
|
|
192
|
+
});
|
|
193
|
+
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);
|
|
194
|
+
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);
|
|
195
|
+
var tooltipCenterTop = (0, styled_components_1.css)(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n bottom: ", ";\n"], ["\n bottom: ", ";\n"])), tooltipPositionSpacing);
|
|
196
|
+
var tooltipCenterBottom = (0, styled_components_1.css)(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n top: ", ";\n"], ["\n top: ", ";\n"])), tooltipPositionSpacing);
|
|
197
|
+
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);
|
|
198
|
+
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);
|
|
199
|
+
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) {
|
|
200
|
+
var theme = _a.theme;
|
|
201
|
+
return theme.ui_cpnt_button_tooltip_base;
|
|
202
|
+
}, function (_a) {
|
|
203
|
+
var theme = _a.theme;
|
|
204
|
+
return theme.spacing.spacingA;
|
|
205
|
+
}, function (_a) {
|
|
206
|
+
var theme = _a.theme;
|
|
207
|
+
return theme.spacing.spacingA + " " + theme.spacing.spacingB;
|
|
208
|
+
}, function (_a) {
|
|
209
|
+
var isTooltipOpen = _a.isTooltipOpen;
|
|
210
|
+
return !isTooltipOpen && 'display: none';
|
|
211
|
+
}, function (_a) {
|
|
212
|
+
var tooltipPosition = _a.tooltipPosition;
|
|
213
|
+
return tooltipPosition &&
|
|
214
|
+
{
|
|
215
|
+
left_top: tooltipLeftTop,
|
|
216
|
+
left_bottom: tooltipLeftBottom,
|
|
217
|
+
center_top: tooltipCenterTop,
|
|
218
|
+
center_bottom: tooltipCenterBottom,
|
|
219
|
+
right_top: tooltipRightTop,
|
|
220
|
+
right_bottom: tooltipRightBottom
|
|
221
|
+
}[tooltipPosition];
|
|
222
|
+
});
|
|
175
223
|
exports.default = IconButton;
|
|
176
|
-
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;
|
|
224
|
+
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;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const ICON_BUTTON_SIZE: {
|
|
2
|
+
xxlarge: number;
|
|
3
|
+
large: number;
|
|
4
|
+
medium: number;
|
|
5
|
+
small: number;
|
|
6
|
+
xsmall: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const ICON_BUTTON_TOOLTIP_SPACING = 8;
|
|
9
|
+
export declare const TOOLTIP_POSITION_SPACING: {
|
|
10
|
+
xxlarge: string;
|
|
11
|
+
large: string;
|
|
12
|
+
medium: string;
|
|
13
|
+
small: string;
|
|
14
|
+
xsmall: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOOLTIP_POSITION_SPACING = exports.ICON_BUTTON_TOOLTIP_SPACING = 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
|
+
};
|
|
11
|
+
exports.ICON_BUTTON_TOOLTIP_SPACING = 8;
|
|
12
|
+
// NOTE - iconSize 크기에 따라 위치를 이동시켜주고, iconButtonSize에 간격까지 8px을 추가해준 값입니다.(IconButton과 tooltip의 간격)
|
|
13
|
+
exports.TOOLTIP_POSITION_SPACING = {
|
|
14
|
+
xxlarge: "calc(" + exports.ICON_BUTTON_SIZE.xxlarge + "px + " + exports.ICON_BUTTON_TOOLTIP_SPACING + "px)",
|
|
15
|
+
large: "calc(" + exports.ICON_BUTTON_SIZE.large + "px + " + exports.ICON_BUTTON_TOOLTIP_SPACING + "px)",
|
|
16
|
+
medium: "calc(" + exports.ICON_BUTTON_SIZE.medium + "px + " + exports.ICON_BUTTON_TOOLTIP_SPACING + "px)",
|
|
17
|
+
small: "calc(" + exports.ICON_BUTTON_SIZE.small + "px + " + exports.ICON_BUTTON_TOOLTIP_SPACING + "px)",
|
|
18
|
+
xsmall: "calc(" + exports.ICON_BUTTON_SIZE.xsmall + "px + " + exports.ICON_BUTTON_TOOLTIP_SPACING + "px)"
|
|
19
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FillIconNameKeys, LineIconNameKeys, PDSValueOption } from '../../../common/types';
|
|
3
|
+
declare type SegmentedButtonGroupValueOption = Pick<PDSValueOption, 'value'> & {
|
|
4
|
+
iconName: FillIconNameKeys | LineIconNameKeys;
|
|
5
|
+
iconFillType?: 'fill' | 'line';
|
|
6
|
+
state?: 'normal' | 'disabled';
|
|
7
|
+
};
|
|
8
|
+
export declare type SegmentedButtonGroupProps = {
|
|
9
|
+
size?: 'large' | 'medium' | 'small';
|
|
10
|
+
value: PDSValueOption['value'] | PDSValueOption['value'][];
|
|
11
|
+
valueArray: SegmentedButtonGroupValueOption[];
|
|
12
|
+
selectedType?: 'single' | 'multi';
|
|
13
|
+
state?: 'normal' | 'disabled';
|
|
14
|
+
onClick?: (value: PDSValueOption['value']) => void;
|
|
15
|
+
onMouseDown?: (value: PDSValueOption['value']) => void;
|
|
16
|
+
};
|
|
17
|
+
declare function SegmentedButtonGroup({ size, value, valueArray, selectedType, state, onClick, onMouseDown }: SegmentedButtonGroupProps): JSX.Element;
|
|
18
|
+
export default SegmentedButtonGroup;
|