pds-dev-kit-web-test 0.2.54 → 0.2.55
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/src/common/assets/icons/fill/BellOff.d.ts +4 -0
- package/dist/src/common/assets/icons/fill/BellOff.js +30 -0
- package/dist/src/common/assets/icons/fill/index.d.ts +1 -0
- package/dist/src/common/assets/icons/fill/index.js +2 -0
- package/dist/src/common/assets/icons/line/BellOff.d.ts +4 -0
- package/dist/src/common/assets/icons/line/BellOff.js +30 -0
- package/dist/src/common/assets/icons/line/ChatRoom11.d.ts +4 -0
- package/dist/src/common/assets/icons/line/ChatRoom11.js +30 -0
- package/dist/src/common/assets/icons/line/ChatRoomFree.d.ts +4 -0
- package/dist/src/common/assets/icons/line/ChatRoomFree.js +30 -0
- package/dist/src/common/assets/icons/line/ChatRoomGroup.d.ts +4 -0
- package/dist/src/common/assets/icons/line/ChatRoomGroup.js +30 -0
- package/dist/src/common/assets/icons/line/ChatRoomPaid.d.ts +4 -0
- package/dist/src/common/assets/icons/line/ChatRoomPaid.js +30 -0
- package/dist/src/common/assets/icons/line/TypefaceDisplay20.d.ts +4 -0
- package/dist/src/common/assets/icons/line/TypefaceDisplay20.js +30 -0
- package/dist/src/common/assets/icons/line/TypefaceHand20.d.ts +4 -0
- package/dist/src/common/assets/icons/line/TypefaceHand20.js +30 -0
- package/dist/src/common/assets/icons/line/TypefaceMonospace20.d.ts +4 -0
- package/dist/src/common/assets/icons/line/TypefaceMonospace20.js +30 -0
- package/dist/src/common/assets/icons/line/TypefaceSansSerif20.d.ts +4 -0
- package/dist/src/common/assets/icons/line/TypefaceSansSerif20.js +30 -0
- package/dist/src/common/assets/icons/line/TypefaceSerif20.d.ts +4 -0
- package/dist/src/common/assets/icons/line/TypefaceSerif20.js +30 -0
- package/dist/src/common/assets/icons/line/index.d.ts +10 -0
- package/dist/src/common/assets/icons/line/index.js +20 -0
- package/dist/src/common/hooks/index.d.ts +1 -0
- package/dist/src/common/hooks/index.js +3 -1
- package/dist/src/common/hooks/useAbsolutePositioner.d.ts +13 -0
- package/dist/src/common/hooks/useAbsolutePositioner.js +54 -0
- package/dist/src/common/hooks/useTooltip.d.ts +17 -0
- package/dist/src/common/hooks/useTooltip.js +76 -0
- package/dist/src/common/styles/colorSet/PaletteColor_Dark.json +2 -1
- package/dist/src/common/styles/colorSet/PaletteColor_light.json +2 -1
- package/dist/src/common/styles/colorSet/UIColor.json +2 -1
- package/dist/src/common/styles/colorSet/index.d.ts +963 -960
- package/dist/src/common/styles/colorSet/index.js +5 -5
- package/dist/src/common/styles/colorSet/ui-type.d.ts +1 -0
- package/dist/src/common/styles/systemUI/index.d.ts +1 -0
- package/dist/src/common/styles/systemUI/index.js +5 -0
- package/dist/src/common/styles/systemUI/tooltipStyle.d.ts +1 -0
- package/dist/src/common/styles/systemUI/tooltipStyle.js +28 -0
- package/dist/src/common/types/components.d.ts +3 -2
- package/dist/src/common/types/systemUI.d.ts +13 -0
- package/dist/src/common/types/systemUI.js +2 -0
- package/dist/src/common/utils/SystemUIPositionGenerator/clickTypeSystemUICssGenerator.d.ts +13 -0
- package/dist/src/common/utils/SystemUIPositionGenerator/clickTypeSystemUICssGenerator.js +20 -0
- package/dist/src/common/utils/SystemUIPositionGenerator/hoverTypeSystemUICssGenerator.d.ts +17 -0
- package/dist/src/common/utils/SystemUIPositionGenerator/hoverTypeSystemUICssGenerator.js +71 -0
- package/dist/src/common/utils/SystemUIPositionGenerator/index.d.ts +1 -0
- package/dist/src/common/utils/SystemUIPositionGenerator/index.js +8 -0
- package/dist/src/desktop/components/BasicButtonGroup/BasicButtonGroup.js +54 -42
- package/dist/src/desktop/components/BasicButtonGroup/constants.d.ts +0 -6
- package/dist/src/desktop/components/BasicButtonGroup/constants.js +1 -8
- package/dist/src/desktop/components/ContextMenu/ContextMenu.js +1 -1
- package/dist/src/desktop/components/Dropdown/Dropdown.js +48 -9
- package/dist/src/desktop/components/IconButton/IconButton.d.ts +3 -1
- package/dist/src/desktop/components/IconButton/IconButton.js +48 -44
- package/dist/src/desktop/components/SegmentedButtonGroup/SegmentedButtonGroup.js +54 -42
- package/dist/src/desktop/components/SegmentedButtonGroup/constants.d.ts +0 -6
- package/dist/src/desktop/components/SegmentedButtonGroup/constants.js +1 -8
- package/dist/src/desktop/components/TextLabel/TextLabel.d.ts +3 -1
- package/dist/src/desktop/components/TextLabel/TextLabel.js +33 -63
- package/dist/src/desktop/components/UploadIconButton/UploadIconButton.d.ts +3 -1
- package/dist/src/desktop/components/UploadIconButton/UploadIconButton.js +49 -45
- package/dist/src/desktop/components/UploadIconButton/constants.d.ts +7 -0
- package/dist/src/desktop/components/UploadIconButton/constants.js +10 -0
- package/dist/src/desktop/layout/LayoutWT/Containers/ContentsContainer/ContentsContainer.d.ts +1 -1
- package/dist/src/desktop/layout/LayoutWT/Containers/ContentsContainer/ContentsContainer.js +2 -1
- package/dist/src/desktop/layout/LayoutWT/Containers/ContentsContainer/variation/WTW.d.ts +18 -0
- package/dist/src/desktop/layout/LayoutWT/Containers/ContentsContainer/variation/WTW.js +112 -0
- package/dist/src/desktop/layout/LayoutWT/Containers/ContentsContainer/variation/index.d.ts +1 -0
- package/dist/src/desktop/layout/LayoutWT/Containers/ContentsContainer/variation/index.js +3 -1
- package/dist/src/desktop/layout/LayoutWT/ContainersBox/ContainersBox.d.ts +1 -1
- package/dist/src/desktop/layout/LayoutWT/ContainersBox/ContainersBox.js +8 -4
- package/dist/src/hybrid/components/Icon/Icon.js +2 -1
- package/dist/src/mobile/components/ContextMenu/ContextMenu.js +1 -1
- package/dist/src/mobile/components/Dropdown/Dropdown.js +48 -9
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +1 -1
- package/dist/src/sub/DynamicLayout/sectionActionTypes.d.ts +4 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +18 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.js +2 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parsePlacement.js +2 -2
- package/dist/src/sub/GoogleFontkit/headless/GoogleFontItem.js +0 -6
- package/dist/src/sub/GoogleFontkit/headless/GoogleFontsList.js +17 -37
- package/dist/src/sub/GoogleFontkit/types.d.ts +1 -1
- package/dist/src/sub/GoogleFontkit/utils/applyActiveFont.d.ts +0 -3
- package/dist/src/sub/GoogleFontkit/utils/applyActiveFont.js +0 -3
- package/dist/src/sub/GoogleFontkit/utils/createStyleSheet.d.ts +0 -3
- package/dist/src/sub/GoogleFontkit/utils/createStyleSheet.js +0 -3
- package/dist/src/sub/GoogleFontkit/utils/extractFontStyles.js +0 -4
- package/dist/src/sub/GoogleFontkit/utils/fillStyleSheet.d.ts +0 -3
- package/dist/src/sub/GoogleFontkit/utils/fillStyleSheet.js +0 -4
- package/dist/src/sub/GoogleFontkit/utils/getActiveFontStylesheet.d.ts +0 -3
- package/dist/src/sub/GoogleFontkit/utils/getActiveFontStylesheet.js +0 -3
- package/dist/src/sub/GoogleFontkit/utils/getFontId.d.ts +0 -3
- package/dist/src/sub/GoogleFontkit/utils/getFontId.js +0 -3
- package/dist/src/sub/GoogleFontkit/utils/isStyleSheetExists.d.ts +0 -3
- package/dist/src/sub/GoogleFontkit/utils/isStyleSheetExists.js +0 -3
- package/dist/src/sub/GoogleFontkit/utils/setStyleSheetType.d.ts +0 -3
- package/dist/src/sub/GoogleFontkit/utils/setStyleSheetType.js +0 -3
- package/package.json +1 -1
- package/release-note.md +4 -3
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
/* eslint-disable import/order */
|
|
7
|
-
var SemanticColor_json_1 = __importDefault(require("./SemanticColor.json"));
|
|
8
7
|
var PaletteColor_light_json_1 = __importDefault(require("./PaletteColor_light.json"));
|
|
9
|
-
var UIColor_json_1 = __importDefault(require("./UIColor.json"));
|
|
10
8
|
var PaletteColor_Dark_json_1 = __importDefault(require("./PaletteColor_Dark.json"));
|
|
9
|
+
var SemanticColor_json_1 = __importDefault(require("./SemanticColor.json"));
|
|
10
|
+
var UIColor_json_1 = __importDefault(require("./UIColor.json"));
|
|
11
11
|
var colorSet = {
|
|
12
|
-
SemanticColor: SemanticColor_json_1.default,
|
|
13
12
|
PaletteColor_light: PaletteColor_light_json_1.default,
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
PaletteColor_Dark: PaletteColor_Dark_json_1.default,
|
|
14
|
+
SemanticColor: SemanticColor_json_1.default,
|
|
15
|
+
UIColor: UIColor_json_1.default
|
|
16
16
|
};
|
|
17
17
|
exports.default = colorSet;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TooltipWrapperStyle } from './tooltipStyle';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TooltipWrapperStyle = void 0;
|
|
4
|
+
var tooltipStyle_1 = require("./tooltipStyle");
|
|
5
|
+
Object.defineProperty(exports, "TooltipWrapperStyle", { enumerable: true, get: function () { return tooltipStyle_1.TooltipWrapperStyle; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TooltipWrapperStyle: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.TooltipWrapperStyle = void 0;
|
|
8
|
+
var styled_components_1 = require("styled-components");
|
|
9
|
+
exports.TooltipWrapperStyle = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: border-box;\n color: ", ";\n display: flex;\n font-size: ", ";\n font-weight: ", ";\n justify-content: center;\n line-height: 1.2;\n max-width: 240px;\n overflow-wrap: break-word;\n padding: ", ";\n position: absolute;\n text-align: left;\n white-space: pre-wrap;\n width: max-content;\n word-break: keep-all;\n z-index: 400;\n"], ["\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: border-box;\n color: ", ";\n display: flex;\n font-size: ", ";\n font-weight: ", ";\n justify-content: center;\n line-height: 1.2;\n max-width: 240px;\n overflow-wrap: break-word;\n padding: ", ";\n position: absolute;\n text-align: left;\n white-space: pre-wrap;\n width: max-content;\n word-break: keep-all;\n z-index: 400;\n"])), function (_a) {
|
|
10
|
+
var theme = _a.theme;
|
|
11
|
+
return theme.ui_cpnt_button_tooltip_base;
|
|
12
|
+
}, function (_a) {
|
|
13
|
+
var theme = _a.theme;
|
|
14
|
+
return theme.spacing.spacingA;
|
|
15
|
+
}, function (_a) {
|
|
16
|
+
var theme = _a.theme;
|
|
17
|
+
return theme.ui_cpnt_textlabel_button_tooltip;
|
|
18
|
+
}, function (_a) {
|
|
19
|
+
var theme = _a.theme;
|
|
20
|
+
return theme.desktopFontSize.caption2;
|
|
21
|
+
}, function (_a) {
|
|
22
|
+
var theme = _a.theme;
|
|
23
|
+
return theme.fontWeight.normal;
|
|
24
|
+
}, function (_a) {
|
|
25
|
+
var theme = _a.theme;
|
|
26
|
+
return "".concat(theme.spacing.spacingA, " ").concat(theme.spacing.spacingB);
|
|
27
|
+
});
|
|
28
|
+
var templateObject_1;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FillIconNameKeys, LineIconNameKeys } from './icon';
|
|
2
|
+
import type { IconCaseTooltipPositionType } from './systemUI';
|
|
2
3
|
import type { PDSTextType } from './text';
|
|
3
4
|
import type { ForwardedRef } from 'react';
|
|
4
5
|
export type PDSValueOption = {
|
|
@@ -29,7 +30,7 @@ export type BasicButtonGroupValueOption = {
|
|
|
29
30
|
iconFillType?: 'fill' | 'line';
|
|
30
31
|
state?: 'normal' | 'disabled';
|
|
31
32
|
tooltipText?: PDSTextType;
|
|
32
|
-
tooltipPosition?:
|
|
33
|
+
tooltipPosition?: IconCaseTooltipPositionType;
|
|
33
34
|
iconColorTheme?: 'none' | 'red';
|
|
34
35
|
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
35
36
|
onMouseDown?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -40,6 +41,6 @@ export type SegmentedButtonGroupValueOption = Pick<PDSValueOption, 'value'> & {
|
|
|
40
41
|
state?: 'normal' | 'disabled';
|
|
41
42
|
iconColorTheme?: 'none' | 'red';
|
|
42
43
|
tooltipText?: PDSTextType;
|
|
43
|
-
tooltipPosition?:
|
|
44
|
+
tooltipPosition?: IconCaseTooltipPositionType;
|
|
44
45
|
};
|
|
45
46
|
export type ForwardedRefType<T> = ForwardedRef<T | null>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SystemUIPositionType = 'top' | 'bottom' | 'start_top' | 'start_bottom' | 'end_top' | 'end_bottom' | 'left_top' | 'left_bottom' | 'center_top' | 'center_bottom' | 'right_top' | 'right_bottom';
|
|
2
|
+
export type IconCaseTooltipPositionType = Exclude<SystemUIPositionType, 'start_top' | 'start_bottom' | 'end_top' | 'end_bottom'>;
|
|
3
|
+
export type TextCaseTooltipPositionType = Exclude<IconCaseTooltipPositionType, 'center_top' | 'center_bottom'>;
|
|
4
|
+
export type SystemUIPositionOffsetType = {
|
|
5
|
+
top: number;
|
|
6
|
+
right: number;
|
|
7
|
+
bottom: number;
|
|
8
|
+
left: number;
|
|
9
|
+
} | null;
|
|
10
|
+
export type SystemUISizeOffsetType = {
|
|
11
|
+
height: number;
|
|
12
|
+
width: number;
|
|
13
|
+
} | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SystemUIPositionOffsetType, SystemUISizeOffsetType } from '../../types/systemUI';
|
|
2
|
+
type Props = {
|
|
3
|
+
sizeOffset: SystemUISizeOffsetType;
|
|
4
|
+
positionOffset: SystemUIPositionOffsetType;
|
|
5
|
+
distance?: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* @property {sizeOffset} systemUI의 sizeOffset입니다.
|
|
9
|
+
* @property {positionOffset} 타겟의 positionOffset입니다.
|
|
10
|
+
* @property {distance} systemUI와 타겟간의 거리입니다. 기본값은 8이며 단위는 px입니다.
|
|
11
|
+
*/
|
|
12
|
+
export default function clickTypeSystemUICssGenerator({ sizeOffset, positionOffset, distance }: Props): string;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* @property {sizeOffset} systemUI의 sizeOffset입니다.
|
|
5
|
+
* @property {positionOffset} 타겟의 positionOffset입니다.
|
|
6
|
+
* @property {distance} systemUI와 타겟간의 거리입니다. 기본값은 8이며 단위는 px입니다.
|
|
7
|
+
*/
|
|
8
|
+
function clickTypeSystemUICssGenerator(_a) {
|
|
9
|
+
var sizeOffset = _a.sizeOffset, positionOffset = _a.positionOffset, _b = _a.distance, distance = _b === void 0 ? 8 : _b;
|
|
10
|
+
if (!sizeOffset || !positionOffset) {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
var height = sizeOffset.height;
|
|
14
|
+
var left = positionOffset.left, bottom = positionOffset.bottom, top = positionOffset.top;
|
|
15
|
+
var bottomDirectionCssValueByPx = bottom + distance;
|
|
16
|
+
var topDirectionCssValueByPx = top - distance - height;
|
|
17
|
+
var isOverBottom = window.innerHeight < bottomDirectionCssValueByPx + height;
|
|
18
|
+
return "left: ".concat(left, "px; top: ").concat(isOverBottom ? topDirectionCssValueByPx : bottomDirectionCssValueByPx, "px;");
|
|
19
|
+
}
|
|
20
|
+
exports.default = clickTypeSystemUICssGenerator;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SystemUIPositionOffsetType, SystemUISizeOffsetType, SystemUIPositionType } from '../../types/systemUI';
|
|
2
|
+
type Props = {
|
|
3
|
+
baseSize: number;
|
|
4
|
+
sizeOffset: SystemUISizeOffsetType;
|
|
5
|
+
positionOffset: SystemUIPositionOffsetType;
|
|
6
|
+
systemUIPosition: SystemUIPositionType;
|
|
7
|
+
distance?: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @property {baseSize} 타겟의 사이즈입니다.
|
|
11
|
+
* @property {sizeOffset} systemUI의 sizeOffset입니다.
|
|
12
|
+
* @property {positionOffset} 타겟의 positionOffset입니다.
|
|
13
|
+
* @property {systemUIPosition} systemUI의 위치를 결정합니다.
|
|
14
|
+
* @property {distance} systemUI가 화면의 벗어날 경우에 조정되는 position이 가질 화면 limit과의 간격값입니다. 기본값은 8이며 단위는 px입니다.
|
|
15
|
+
*/
|
|
16
|
+
export default function hoverTypeSystemUICssGenerator({ baseSize, sizeOffset, positionOffset, systemUIPosition, distance }: Props): string;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* @property {baseSize} 타겟의 사이즈입니다.
|
|
5
|
+
* @property {sizeOffset} systemUI의 sizeOffset입니다.
|
|
6
|
+
* @property {positionOffset} 타겟의 positionOffset입니다.
|
|
7
|
+
* @property {systemUIPosition} systemUI의 위치를 결정합니다.
|
|
8
|
+
* @property {distance} systemUI가 화면의 벗어날 경우에 조정되는 position이 가질 화면 limit과의 간격값입니다. 기본값은 8이며 단위는 px입니다.
|
|
9
|
+
*/
|
|
10
|
+
function hoverTypeSystemUICssGenerator(_a) {
|
|
11
|
+
var baseSize = _a.baseSize, sizeOffset = _a.sizeOffset, positionOffset = _a.positionOffset, systemUIPosition = _a.systemUIPosition, _b = _a.distance, distance = _b === void 0 ? 8 : _b;
|
|
12
|
+
if (!sizeOffset || !positionOffset) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
var end = positionOffset.left, bottom = positionOffset.bottom, top = positionOffset.top;
|
|
16
|
+
var width = sizeOffset.width, height = sizeOffset.height;
|
|
17
|
+
var centerSpotCssValueByPx = end - (width - baseSize) / 2; // 'center'의 위치 값 -> 자신의 left 위치 - (아이콘 버튼과의 길이차 / 2)
|
|
18
|
+
var overEndLimitCssValueByPx = end - width + baseSize; // 자신의 'left'에서 자기 자신의 'width'만큼 돌아온 뒤 버튼의 크기만큼 더해주어 끝선을 맞춥니다.
|
|
19
|
+
var overBottomLimitCssValueByPx = bottom + distance;
|
|
20
|
+
var overTopLimitCssValueByPx = top - height - distance;
|
|
21
|
+
var isOverEndLimit = overEndLimitCssValueByPx < 0;
|
|
22
|
+
var isOverEndLimitWhenCenterPosition = centerSpotCssValueByPx < 0;
|
|
23
|
+
var isOverStartLimit = window.innerWidth < end + width;
|
|
24
|
+
var isOverBottomLimit = window.innerHeight < overBottomLimitCssValueByPx + height;
|
|
25
|
+
var isOverTopLimit = overTopLimitCssValueByPx < 0;
|
|
26
|
+
var endDirectionCssProp = "left: ".concat(isOverEndLimit ? distance : overEndLimitCssValueByPx, "px;");
|
|
27
|
+
var startDirectionCssProp = isOverStartLimit
|
|
28
|
+
? "right: ".concat(distance, "px;")
|
|
29
|
+
: "left: ".concat(isOverStartLimit ? distance : end, "px;");
|
|
30
|
+
var bottomDirectionCssProp = isOverBottomLimit
|
|
31
|
+
? "bottom: ".concat(distance, "px;")
|
|
32
|
+
: "top: ".concat(overBottomLimitCssValueByPx, "px;");
|
|
33
|
+
var topDirectionCssProp = "top: ".concat(isOverTopLimit ? distance : overTopLimitCssValueByPx, "px;");
|
|
34
|
+
var centerCssPropGenerator = function () {
|
|
35
|
+
if (!isOverEndLimitWhenCenterPosition && !isOverStartLimit) {
|
|
36
|
+
return "left: ".concat(centerSpotCssValueByPx, "px;");
|
|
37
|
+
}
|
|
38
|
+
if (isOverEndLimitWhenCenterPosition) {
|
|
39
|
+
return "left: ".concat(distance, "px;");
|
|
40
|
+
}
|
|
41
|
+
if (isOverStartLimit) {
|
|
42
|
+
return "right: ".concat(distance, "px;");
|
|
43
|
+
}
|
|
44
|
+
return '';
|
|
45
|
+
};
|
|
46
|
+
switch (systemUIPosition) {
|
|
47
|
+
case 'top':
|
|
48
|
+
return "".concat(topDirectionCssProp);
|
|
49
|
+
case 'bottom':
|
|
50
|
+
return "".concat(bottomDirectionCssProp);
|
|
51
|
+
case 'end_top':
|
|
52
|
+
case 'left_top':
|
|
53
|
+
return "".concat(endDirectionCssProp, " ").concat(topDirectionCssProp);
|
|
54
|
+
case 'end_bottom':
|
|
55
|
+
case 'left_bottom':
|
|
56
|
+
return "".concat(endDirectionCssProp, " ").concat(bottomDirectionCssProp);
|
|
57
|
+
case 'center_top':
|
|
58
|
+
return "".concat(centerCssPropGenerator(), " ").concat(topDirectionCssProp);
|
|
59
|
+
case 'center_bottom':
|
|
60
|
+
return "".concat(centerCssPropGenerator(), " ").concat(bottomDirectionCssProp);
|
|
61
|
+
case 'start_top':
|
|
62
|
+
case 'right_top':
|
|
63
|
+
return "".concat(startDirectionCssProp, " ").concat(topDirectionCssProp);
|
|
64
|
+
case 'start_bottom':
|
|
65
|
+
case 'right_bottom':
|
|
66
|
+
return "".concat(startDirectionCssProp, " ").concat(bottomDirectionCssProp);
|
|
67
|
+
default:
|
|
68
|
+
return '';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.default = hoverTypeSystemUICssGenerator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as hoverTypeSystemUICssGenerator } from './hoverTypeSystemUICssGenerator';
|
|
@@ -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.hoverTypeSystemUICssGenerator = void 0;
|
|
7
|
+
var hoverTypeSystemUICssGenerator_1 = require("./hoverTypeSystemUICssGenerator");
|
|
8
|
+
Object.defineProperty(exports, "hoverTypeSystemUICssGenerator", { enumerable: true, get: function () { return __importDefault(hoverTypeSystemUICssGenerator_1).default; } });
|
|
@@ -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 BasicButtonGroup(_a) {
|
|
48
51
|
var _b = _a.size, size = _b === void 0 ? 'medium' : _b, valueArray = _a.valueArray, _c = _a.state, state = _c === void 0 ? 'normal' : _c;
|
|
49
52
|
var _d = (0, react_1.useState)(null), hoveredButtonIndex = _d[0], setHoveredButtonIndex = _d[1];
|
|
53
|
+
var _e = (0, react_1.useState)(null), tooltipSizeOffset = _e[0], setTooltipSizeOffset = _e[1];
|
|
54
|
+
var _f = (0, react_1.useState)(null), tooltipPositionOffset = _f[0], setTooltipPositionOffset = _f[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 (hoveredButtonIndex === 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 = hoveredButtonIndex;
|
|
70
|
+
var countFromRight = valueArray.length - (hoveredButtonIndex + 1);
|
|
71
|
+
var itemSizeWithGap = constants_1.ICON_BUTTON_SIZE[size] + 4;
|
|
72
|
+
setTooltipPositionOffset({
|
|
73
|
+
top: top_1 + window.scrollY,
|
|
74
|
+
right: right + window.scrollX - itemSizeWithGap * countFromRight,
|
|
75
|
+
bottom: bottom + window.scrollY,
|
|
76
|
+
left: left + window.scrollX + itemSizeWithGap * countFromLeft
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (tooltipRef.current) {
|
|
80
|
+
setTooltipSizeOffset({
|
|
81
|
+
height: tooltipRef.current.offsetHeight,
|
|
82
|
+
width: tooltipRef.current.offsetWidth
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}, [hoveredButtonIndex]);
|
|
50
86
|
var getColorKey = function (buttonState, iconColorTheme) {
|
|
51
87
|
if (state === 'disabled' || buttonState === 'disabled') {
|
|
52
88
|
return 'ui_cpnt_button_icon_disabled';
|
|
@@ -56,9 +92,20 @@ function BasicButtonGroup(_a) {
|
|
|
56
92
|
}
|
|
57
93
|
return 'ui_cpnt_button_icon_enabled';
|
|
58
94
|
};
|
|
59
|
-
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) {
|
|
60
|
-
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, tooltipText = _a.tooltipText, _d = _a.tooltipPosition, tooltipPosition = _d === void 0 ? '
|
|
61
|
-
|
|
95
|
+
return ((0, jsx_runtime_1.jsx)(S_BasicButtonGroup, __assign({ "x-pds-name": "BasicButtonGroup", "x-pds-element-type": "component", "x-pds-device-type": "desktop", ref: tooltipPositionTargetRef }, { children: valueArray.map(function (_a, index) {
|
|
96
|
+
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, tooltipText = _a.tooltipText, _d = _a.tooltipPosition, tooltipPosition = _d === void 0 ? 'bottom' : _d, _e = _a.iconColorTheme, iconColorTheme = _e === void 0 ? 'none' : _e;
|
|
97
|
+
var tooltipPositionCss = (0, SystemUIPositionGenerator_1.hoverTypeSystemUICssGenerator)({
|
|
98
|
+
baseSize: constants_1.ICON_BUTTON_SIZE[size],
|
|
99
|
+
sizeOffset: tooltipSizeOffset,
|
|
100
|
+
positionOffset: tooltipPositionOffset,
|
|
101
|
+
systemUIPosition: tooltipPosition.includes('_')
|
|
102
|
+
? tooltipPosition
|
|
103
|
+
: "center_".concat(tooltipPosition)
|
|
104
|
+
});
|
|
105
|
+
var isHoveredButton = index === hoveredButtonIndex;
|
|
106
|
+
return ((0, jsx_runtime_1.jsxs)(S_BasicButton, __assign({ size: size, onClick: function (e) { return onClick && onClick(e); }, onMouseDown: function (e) { return onMouseDown && onMouseDown(e); }, onPointerEnter: function () { return setHoveredButtonIndex(index); }, onPointerLeave: function () { return setHoveredButtonIndex(null); }, disabled: state === 'disabled' || buttonState === 'disabled' }, { children: [(0, jsx_runtime_1.jsx)(components_1.Icon, { iconName: iconName, size: size === 'small' ? 20 : 24, fillType: iconFillType, colorKey: getColorKey(buttonState, iconColorTheme) }), tooltipText &&
|
|
107
|
+
isHoveredButton &&
|
|
108
|
+
(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)] }), iconName + index));
|
|
62
109
|
}) })));
|
|
63
110
|
}
|
|
64
111
|
var S_BasicButtonGroup = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n display: flex;\n width: max-content;\n\n & > button:not(:last-child) {\n margin-right: ", ";\n }\n"], ["\n align-items: center;\n display: flex;\n width: max-content;\n\n & > button:not(:last-child) {\n margin-right: ", ";\n }\n"])), function (_a) {
|
|
@@ -84,44 +131,9 @@ var S_BasicButton = styled_components_1.default.button(templateObject_5 || (temp
|
|
|
84
131
|
var theme = _a.theme;
|
|
85
132
|
return theme.ui_cpnt_basicbuttongroup_base_disabled;
|
|
86
133
|
});
|
|
87
|
-
var
|
|
88
|
-
var
|
|
89
|
-
return
|
|
90
|
-
{
|
|
91
|
-
large: constants_1.TOOLTIP_POSITION_SPACING.large,
|
|
92
|
-
medium: constants_1.TOOLTIP_POSITION_SPACING.medium,
|
|
93
|
-
small: constants_1.TOOLTIP_POSITION_SPACING.small
|
|
94
|
-
}[size];
|
|
95
|
-
});
|
|
96
|
-
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);
|
|
97
|
-
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);
|
|
98
|
-
var tooltipCenterTop = (0, styled_components_1.css)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n bottom: ", ";\n"], ["\n bottom: ", ";\n"])), tooltipPositionSpacing);
|
|
99
|
-
var tooltipCenterBottom = (0, styled_components_1.css)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n top: ", ";\n"], ["\n top: ", ";\n"])), tooltipPositionSpacing);
|
|
100
|
-
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);
|
|
101
|
-
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);
|
|
102
|
-
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) {
|
|
103
|
-
var theme = _a.theme;
|
|
104
|
-
return theme.ui_cpnt_button_tooltip_base;
|
|
105
|
-
}, function (_a) {
|
|
106
|
-
var theme = _a.theme;
|
|
107
|
-
return theme.spacing.spacingA;
|
|
108
|
-
}, function (_a) {
|
|
109
|
-
var theme = _a.theme;
|
|
110
|
-
return "".concat(theme.spacing.spacingA, " ").concat(theme.spacing.spacingB);
|
|
111
|
-
}, function (_a) {
|
|
112
|
-
var isTooltipOpen = _a.isTooltipOpen;
|
|
113
|
-
return !isTooltipOpen && 'display: none';
|
|
114
|
-
}, function (_a) {
|
|
115
|
-
var tooltipPosition = _a.tooltipPosition;
|
|
116
|
-
return tooltipPosition &&
|
|
117
|
-
{
|
|
118
|
-
left_top: tooltipLeftTop,
|
|
119
|
-
left_bottom: tooltipLeftBottom,
|
|
120
|
-
center_top: tooltipCenterTop,
|
|
121
|
-
center_bottom: tooltipCenterBottom,
|
|
122
|
-
right_top: tooltipRightTop,
|
|
123
|
-
right_bottom: tooltipRightBottom
|
|
124
|
-
}[tooltipPosition];
|
|
134
|
+
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) {
|
|
135
|
+
var tooltipPositionCss = _a.tooltipPositionCss;
|
|
136
|
+
return tooltipPositionCss;
|
|
125
137
|
});
|
|
126
138
|
exports.default = BasicButtonGroup;
|
|
127
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6
|
|
139
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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
|
-
};
|
|
@@ -24,7 +24,7 @@ function ContextMenu(_a) {
|
|
|
24
24
|
var children = _a.children, _b = _a.autoWidthMode, autoWidthMode = _b === void 0 ? 'none' : _b, maxHeight = _a.maxHeight, customWidth = _a.customWidth;
|
|
25
25
|
return ((0, jsx_runtime_1.jsx)(S_ContextMenu, __assign({ "x-pds-name": "ContextMenu", "x-pds-element-type": "component", "x-pds-device-type": "desktop", autoWidth: autoWidthMode === 'use', maxHeight: maxHeight, customWidth: customWidth }, { children: children })));
|
|
26
26
|
}
|
|
27
|
-
var S_ContextMenu = styled_components_1.default.ul(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 14px;\n box-shadow: ", ";\n box-sizing: border-box;\n list-style: none;\n margin: 0;\n max-height: ", ";\n min-width: 128px;\n overflow-y: auto;\n padding: ", " 0;\n position: relative;\n vertical-align: baseline;\n width: ", ";\n\n z-index:
|
|
27
|
+
var S_ContextMenu = styled_components_1.default.ul(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 14px;\n box-shadow: ", ";\n box-sizing: border-box;\n list-style: none;\n margin: 0;\n max-height: ", ";\n min-width: 128px;\n overflow-y: auto;\n padding: ", " 0;\n position: relative;\n vertical-align: baseline;\n width: ", ";\n\n z-index: 400;\n\n ", "\n"], ["\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 14px;\n box-shadow: ", ";\n box-sizing: border-box;\n list-style: none;\n margin: 0;\n max-height: ", ";\n min-width: 128px;\n overflow-y: auto;\n padding: ", " 0;\n position: relative;\n vertical-align: baseline;\n width: ", ";\n\n z-index: 400;\n\n ", "\n"])), function (_a) {
|
|
28
28
|
var theme = _a.theme;
|
|
29
29
|
return theme.ui_cpnt_contextmenu_base;
|
|
30
30
|
}, function (_a) {
|
|
@@ -37,9 +37,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
37
37
|
__setModuleDefault(result, mod);
|
|
38
38
|
return result;
|
|
39
39
|
};
|
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
+
};
|
|
40
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
44
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
42
45
|
var react_1 = require("react");
|
|
46
|
+
var react_dom_1 = require("react-dom");
|
|
47
|
+
var clickTypeSystemUICssGenerator_1 = __importDefault(require("../../../common/utils/SystemUIPositionGenerator/clickTypeSystemUICssGenerator"));
|
|
43
48
|
var styled_components_1 = __importStar(require("styled-components"));
|
|
44
49
|
var transitionStyle_1 = require("../../../common/styles/movement/transitionStyle");
|
|
45
50
|
var hybrid_1 = require("../../../hybrid");
|
|
@@ -55,6 +60,10 @@ function Dropdown(_a) {
|
|
|
55
60
|
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, _h = _a.fontWeight, fontWeight = _h === void 0 ? 'regular' : _h, onChange = _a.onChange;
|
|
56
61
|
var _j = (0, react_1.useState)(false), isFocused = _j[0], setIsFocused = _j[1];
|
|
57
62
|
var _k = (0, react_1.useState)(null), selectedValue = _k[0], setSelectedValue = _k[1];
|
|
63
|
+
var _l = (0, react_1.useState)(null), contextMenuSizeOffset = _l[0], setContextMenuSizeOffset = _l[1];
|
|
64
|
+
var _m = (0, react_1.useState)(null), dropdownPositionOffset = _m[0], setDropdownPositionOffset = _m[1];
|
|
65
|
+
var contextMenuRef = (0, react_1.useRef)(null);
|
|
66
|
+
var dropdownRef = (0, react_1.useRef)(null);
|
|
58
67
|
/**
|
|
59
68
|
* @when value 프롭의 값에 따라
|
|
60
69
|
* @expected 값이 null일 때 드롭다운을 초기화하고, 값이 있다면 해당 값으로 설정해줍니다.
|
|
@@ -80,6 +89,36 @@ function Dropdown(_a) {
|
|
|
80
89
|
}
|
|
81
90
|
setSelectedValue(defaultValue);
|
|
82
91
|
}, [defaultValue]);
|
|
92
|
+
/**
|
|
93
|
+
* @when : isFocused 변경되었을 때
|
|
94
|
+
* @expected : dropdownRef, contextMenuRef 의 위치를 업데이트합니다.
|
|
95
|
+
* @clear :
|
|
96
|
+
*/
|
|
97
|
+
(0, react_1.useEffect)(function () {
|
|
98
|
+
if (!isFocused && contextMenuRef.current) {
|
|
99
|
+
setContextMenuSizeOffset(null);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (dropdownRef.current) {
|
|
103
|
+
var _a = dropdownRef.current.getBoundingClientRect(), top_1 = _a.top, right = _a.right, left = _a.left, bottom = _a.bottom;
|
|
104
|
+
setDropdownPositionOffset({
|
|
105
|
+
top: top_1 + window.scrollY,
|
|
106
|
+
right: right + window.scrollX,
|
|
107
|
+
bottom: bottom + window.scrollY,
|
|
108
|
+
left: left + window.scrollX
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
if (contextMenuRef.current) {
|
|
112
|
+
setContextMenuSizeOffset({
|
|
113
|
+
height: contextMenuRef.current.offsetHeight,
|
|
114
|
+
width: contextMenuRef.current.offsetWidth
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}, [isFocused]);
|
|
118
|
+
var contextMenuPositionCss = (0, clickTypeSystemUICssGenerator_1.default)({
|
|
119
|
+
sizeOffset: contextMenuSizeOffset,
|
|
120
|
+
positionOffset: dropdownPositionOffset
|
|
121
|
+
});
|
|
83
122
|
var handleClick = function () {
|
|
84
123
|
if (state === 'disabled' || state === 'read_only') {
|
|
85
124
|
return;
|
|
@@ -101,12 +140,14 @@ function Dropdown(_a) {
|
|
|
101
140
|
}
|
|
102
141
|
};
|
|
103
142
|
var getCustomWidth = function () {
|
|
143
|
+
var _a;
|
|
104
144
|
if (customWidth) {
|
|
105
145
|
return customWidth;
|
|
106
146
|
}
|
|
107
|
-
if (
|
|
108
|
-
return
|
|
147
|
+
if ((_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) {
|
|
148
|
+
return "".concat(dropdownRef.current.offsetWidth, "px");
|
|
109
149
|
}
|
|
150
|
+
return '';
|
|
110
151
|
};
|
|
111
152
|
var getIconColorKey = function () {
|
|
112
153
|
if (state === 'disabled' || state === 'read_only') {
|
|
@@ -194,7 +235,8 @@ function Dropdown(_a) {
|
|
|
194
235
|
var LARGE_HEIGHT = 48;
|
|
195
236
|
return LARGE_HEIGHT * maxHeightItemNumber;
|
|
196
237
|
}, [size, maxHeightItemNumber]);
|
|
197
|
-
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.jsxs)(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() }), displayType === 'icon_text' && (0, jsx_runtime_1.jsx)(hybrid_1.Spacing, { size: "spacing_b", spacingType: "width" })] })), (displayType === 'text_only' || displayType === 'icon_text') && ((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: fontWeight === 'bold' ? 'form2Bold' : 'form2Regular', singleLineMode: "use", colorTheme: getTextColorTheme(), colorOverride: getTextColorOverride(), ellipsisMode: "use", lineLimit: 1, wordBreak: "break_all" }))] })), (0, jsx_runtime_1.jsx)(hybrid_1.Icon, { size: 16, fillType: "line", iconName: isFocused ? 'ic_arrow_up' : 'ic_arrow_down', colorKey: getArrowIconColorKey() })] })), isFocused &&
|
|
238
|
+
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", ref: dropdownRef, 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.jsxs)(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() }), displayType === 'icon_text' && (0, jsx_runtime_1.jsx)(hybrid_1.Spacing, { size: "spacing_b", spacingType: "width" })] })), (displayType === 'text_only' || displayType === 'icon_text') && ((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: fontWeight === 'bold' ? 'form2Bold' : 'form2Regular', singleLineMode: "use", colorTheme: getTextColorTheme(), colorOverride: getTextColorOverride(), ellipsisMode: "use", lineLimit: 1, wordBreak: "break_all" }))] })), (0, jsx_runtime_1.jsx)(hybrid_1.Icon, { size: 16, fillType: "line", iconName: isFocused ? 'ic_arrow_up' : 'ic_arrow_down', colorKey: getArrowIconColorKey() })] })), isFocused &&
|
|
239
|
+
(0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(S_ContextMenuWrapper, __assign({ ref: contextMenuRef, contextMenuPositionCss: contextMenuPositionCss }, { 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)("div", __assign({ onMouseDown: function () { return handleClickOption(el); } }, { 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, state: el.state, displayType: displayType }) }), el.value)); }) })) })), document.body)] })));
|
|
198
240
|
}
|
|
199
241
|
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) {
|
|
200
242
|
var theme = _a.theme;
|
|
@@ -392,12 +434,9 @@ var S_Select = styled_components_1.default.div(templateObject_15 || (templateObj
|
|
|
392
434
|
var state = _a.state;
|
|
393
435
|
return state === 'normal' && normalActionColor;
|
|
394
436
|
});
|
|
395
|
-
var S_ContextMenuWrapper = styled_components_1.default.div(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n display: block;\n
|
|
396
|
-
var
|
|
397
|
-
return
|
|
398
|
-
}, function (_a) {
|
|
399
|
-
var displayType = _a.displayType;
|
|
400
|
-
return (displayType === 'icon_only' ? '100%' : 'inherit');
|
|
437
|
+
var S_ContextMenuWrapper = styled_components_1.default.div(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n display: block;\n position: absolute;\n\n ", ";\n"], ["\n display: block;\n position: absolute;\n\n ", ";\n"])), function (_a) {
|
|
438
|
+
var contextMenuPositionCss = _a.contextMenuPositionCss;
|
|
439
|
+
return contextMenuPositionCss;
|
|
401
440
|
});
|
|
402
441
|
exports.default = Dropdown;
|
|
403
442
|
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,8 +1,10 @@
|
|
|
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 IconButtonProps = {
|
|
4
5
|
tooltipText?: PDSTextType;
|
|
5
|
-
|
|
6
|
+
/** @deprecated 'left_top', 'left_bottom', 'right_top', 'right_bottom' will replace 'top' or 'bottom' */
|
|
7
|
+
tooltipPosition?: IconCaseTooltipPositionType;
|
|
6
8
|
fillType?: 'fill' | 'line';
|
|
7
9
|
shapeType?: 'circular' | 'rectangle' | 'round';
|
|
8
10
|
baseSize?: 'xxlarge' | 'large' | 'medium' | 'small' | 'xsmall';
|