@team-monolith/cds 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CodleDesignSystemProvider.d.ts +69 -0
- package/dist/CodleDesignSystemProvider.js +96 -0
- package/dist/components/AlertDialog/AlertDialog.d.ts +14 -0
- package/dist/components/AlertDialog/AlertDialog.js +45 -0
- package/dist/components/AlertDialog/AlertDialogActions.d.ts +8 -0
- package/dist/components/AlertDialog/AlertDialogActions.js +35 -0
- package/dist/components/AlertDialog/AlertDialogContent.d.ts +8 -0
- package/dist/components/AlertDialog/AlertDialogContent.js +36 -0
- package/dist/components/AlertDialog/AlertDialogTitle.d.ts +13 -0
- package/dist/components/AlertDialog/AlertDialogTitle.js +38 -0
- package/dist/components/AlertDialog/index.d.ts +4 -0
- package/dist/components/AlertDialog/index.js +4 -0
- package/dist/components/Banner.d.ts +29 -0
- package/dist/components/Banner.js +65 -0
- package/dist/components/Button.d.ts +31 -0
- package/dist/components/Button.js +72 -0
- package/dist/components/CheckboxInput.d.ts +27 -0
- package/dist/components/CheckboxInput.js +77 -0
- package/dist/components/Input.d.ts +17 -0
- package/dist/components/Input.js +73 -0
- package/dist/components/InputBase.d.ts +42 -0
- package/dist/components/InputBase.js +52 -0
- package/dist/components/Pagination.d.ts +27 -0
- package/dist/components/Pagination.js +32 -0
- package/dist/components/PinInput.d.ts +36 -0
- package/dist/components/PinInput.js +154 -0
- package/dist/components/RadioInput.d.ts +23 -0
- package/dist/components/RadioInput.js +78 -0
- package/dist/components/SquareButton.d.ts +26 -0
- package/dist/components/SquareButton.js +80 -0
- package/dist/components/Switch.d.ts +19 -0
- package/dist/components/Switch.js +59 -0
- package/dist/components/Tag.d.ts +21 -0
- package/dist/components/Tag.js +61 -0
- package/dist/components/Tooltip.d.ts +26 -0
- package/dist/components/Tooltip.js +50 -0
- package/dist/foundation/color.d.ts +75 -0
- package/dist/foundation/color.js +75 -0
- package/dist/foundation/shadows.d.ts +9 -0
- package/dist/foundation/shadows.js +10 -0
- package/dist/icons/Arrows/index.d.ts +2 -0
- package/dist/icons/Arrows/index.js +2 -0
- package/dist/icons/Media/index.d.ts +2 -0
- package/dist/icons/Media/index.js +2 -0
- package/dist/icons/System/index.d.ts +2 -0
- package/dist/icons/System/index.js +2 -0
- package/dist/icons/arrows.d.ts +28 -0
- package/dist/icons/arrows.js +21 -0
- package/dist/icons/brand.d.ts +4 -0
- package/dist/icons/brand.js +13 -0
- package/dist/icons/design.d.ts +4 -0
- package/dist/icons/design.js +13 -0
- package/dist/icons/map.d.ts +4 -0
- package/dist/icons/map.js +13 -0
- package/dist/icons/system.d.ts +31 -0
- package/dist/icons/system.js +22 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +44 -0
- package/dist/patterns/Card/Card.d.ts +39 -0
- package/dist/patterns/Card/Card.js +68 -0
- package/dist/patterns/Card/class-icon.svg +28 -0
- package/dist/patterns/Card/index.d.ts +2 -0
- package/dist/patterns/Card/index.js +2 -0
- package/dist/patterns/Card/material-icon.svg +25 -0
- package/dist/patterns/Card/problem-icon.svg +25 -0
- package/dist/patterns/Card/thumbnail/sample.png +0 -0
- package/dist/patterns/Dialog/Dialog.d.ts +12 -0
- package/dist/patterns/Dialog/Dialog.js +26 -0
- package/dist/patterns/Dialog/DialogContent.d.ts +8 -0
- package/dist/patterns/Dialog/DialogContent.js +23 -0
- package/dist/patterns/Dialog/DialogNavigation.d.ts +12 -0
- package/dist/patterns/Dialog/DialogNavigation.js +25 -0
- package/dist/patterns/Dialog/DialogNavigationContext.d.ts +5 -0
- package/dist/patterns/Dialog/DialogNavigationContext.js +5 -0
- package/dist/patterns/Dialog/DialogNavigationItem.d.ts +10 -0
- package/dist/patterns/Dialog/DialogNavigationItem.js +25 -0
- package/dist/patterns/Dialog/DialogPanel.d.ts +10 -0
- package/dist/patterns/Dialog/DialogPanel.js +31 -0
- package/dist/patterns/Dialog/DialogPanels.d.ts +13 -0
- package/dist/patterns/Dialog/DialogPanels.js +17 -0
- package/dist/patterns/Dialog/DialogPanelsContext.d.ts +5 -0
- package/dist/patterns/Dialog/DialogPanelsContext.js +5 -0
- package/dist/patterns/Dialog/DialogTitle.d.ts +13 -0
- package/dist/patterns/Dialog/DialogTitle.js +26 -0
- package/dist/patterns/Dialog/index.d.ts +7 -0
- package/dist/patterns/Dialog/index.js +7 -0
- package/dist/patterns/Dropdown/Dropdown.d.ts +27 -0
- package/dist/patterns/Dropdown/Dropdown.js +41 -0
- package/dist/patterns/Dropdown/DropdownItem.d.ts +42 -0
- package/dist/patterns/Dropdown/DropdownItem.js +89 -0
- package/dist/patterns/Dropdown/DropdownMenu.d.ts +30 -0
- package/dist/patterns/Dropdown/DropdownMenu.js +85 -0
- package/dist/patterns/Dropdown/index.d.ts +2 -0
- package/dist/patterns/Dropdown/index.js +2 -0
- package/dist/patterns/EmptyState/EmptyState.d.ts +16 -0
- package/dist/patterns/EmptyState/EmptyState.js +36 -0
- package/dist/patterns/EmptyState/empty-state-icon.svg +36 -0
- package/dist/patterns/EmptyState/index.d.ts +2 -0
- package/dist/patterns/EmptyState/index.js +2 -0
- package/dist/patterns/Navigation/NavigationContext.d.ts +5 -0
- package/dist/patterns/Navigation/NavigationContext.js +5 -0
- package/dist/patterns/Navigation/NavigationHorizontal.d.ts +11 -0
- package/dist/patterns/Navigation/NavigationHorizontal.js +27 -0
- package/dist/patterns/Navigation/NavigationItem.d.ts +9 -0
- package/dist/patterns/Navigation/NavigationItem.js +33 -0
- package/dist/patterns/Navigation/NavigationVertical.d.ts +14 -0
- package/dist/patterns/Navigation/NavigationVertical.js +27 -0
- package/dist/patterns/Navigation/index.d.ts +3 -0
- package/dist/patterns/Navigation/index.js +3 -0
- package/dist/patterns/SegmentedControl/SegmentedControlButton.d.ts +8 -0
- package/dist/patterns/SegmentedControl/SegmentedControlButton.js +57 -0
- package/dist/patterns/SegmentedControl/SegmentedControlGroup.d.ts +26 -0
- package/dist/patterns/SegmentedControl/SegmentedControlGroup.js +50 -0
- package/dist/patterns/SegmentedControl/SegmentedControlGroupPropsContext.d.ts +5 -0
- package/dist/patterns/SegmentedControl/SegmentedControlGroupPropsContext.js +5 -0
- package/dist/patterns/SegmentedControl/SegmentedControlSquareButton.d.ts +8 -0
- package/dist/patterns/SegmentedControl/SegmentedControlSquareButton.js +45 -0
- package/dist/patterns/SegmentedControl/index.d.ts +3 -0
- package/dist/patterns/SegmentedControl/index.js +3 -0
- package/dist/patterns/Table/Table.d.ts +18 -0
- package/dist/patterns/Table/Table.js +33 -0
- package/dist/patterns/Table/TableBody.d.ts +8 -0
- package/dist/patterns/Table/TableBody.js +26 -0
- package/dist/patterns/Table/TableCell.d.ts +15 -0
- package/dist/patterns/Table/TableCell.js +78 -0
- package/dist/patterns/Table/TableHead.d.ts +8 -0
- package/dist/patterns/Table/TableHead.js +26 -0
- package/dist/patterns/Table/TablePropsContext.d.ts +7 -0
- package/dist/patterns/Table/TablePropsContext.js +3 -0
- package/dist/patterns/Table/TableRow.d.ts +14 -0
- package/dist/patterns/Table/TableRow.js +34 -0
- package/dist/patterns/Table/TableVariantContext.d.ts +6 -0
- package/dist/patterns/Table/TableVariantContext.js +3 -0
- package/dist/patterns/Table/index.d.ts +7 -0
- package/dist/patterns/Table/index.js +6 -0
- package/dist/utils/hover.d.ts +3 -0
- package/dist/utils/hover.js +14 -0
- package/dist/utils/reset.d.ts +2 -0
- package/dist/utils/reset.js +8 -0
- package/dist/utils/zIndex.d.ts +3 -0
- package/dist/utils/zIndex.js +3 -0
- package/package.json +3 -2
- package/src/cds/index.ts +1 -1
- package/src/cds/patterns/SegmentedControl/SegmentedControlButton.tsx +22 -8
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import styled from "@emotion/styled";
|
|
18
|
+
import { NavigationVertical } from "../Navigation";
|
|
19
|
+
import { DialogNavigationContext } from "./DialogNavigationContext";
|
|
20
|
+
export function DialogNavigation(props) {
|
|
21
|
+
var value = props.value, onChange = props.onChange;
|
|
22
|
+
return (_jsx(DialogNavigationContext.Provider, __assign({ value: { value: value, onChange: onChange } }, { children: _jsx(StyledNavigationVertical, __assign({}, props, { size: "small" })) })));
|
|
23
|
+
}
|
|
24
|
+
var StyledNavigationVertical = styled(NavigationVertical)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 160px;\n"], ["\n width: 160px;\n"])));
|
|
25
|
+
var templateObject_1;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface DialogNavigationItemProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
component?: React.ElementType;
|
|
5
|
+
/** 표기될 문구 */
|
|
6
|
+
label: string;
|
|
7
|
+
/** 이 아이템이 대표하는 값 */
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function DialogNavigationItem(props: DialogNavigationItemProps): JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { useContext } from "react";
|
|
14
|
+
import { NavigationItem } from "../Navigation";
|
|
15
|
+
import { DialogNavigationContext } from "./DialogNavigationContext";
|
|
16
|
+
export function DialogNavigationItem(props) {
|
|
17
|
+
return (_jsx(NavigationItem, { component: NavigationItemComponent, to: props.value, label: props.label }));
|
|
18
|
+
}
|
|
19
|
+
function NavigationItemComponent(props) {
|
|
20
|
+
var to = props.to;
|
|
21
|
+
var _a = useContext(DialogNavigationContext), value = _a.value, onChange = _a.onChange;
|
|
22
|
+
return (_jsx("span", __assign({ onClick: function () {
|
|
23
|
+
onChange(to);
|
|
24
|
+
} }, { children: props.children({ isActive: value === to }) })));
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface DialogPanelProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
component?: React.ElementType;
|
|
5
|
+
/** Content 내용으로 표기될 값 */
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/** 이 패널이 활성화 될 값 */
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function DialogPanel(props: DialogPanelProps): React.ReactElement;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
import { jsx as _jsx, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
17
|
+
/** @jsxImportSource @emotion/react */
|
|
18
|
+
import { css } from "@emotion/react";
|
|
19
|
+
import { useContext } from "react";
|
|
20
|
+
import { DialogPanelsContext } from "./DialogPanelsContext";
|
|
21
|
+
export function DialogPanel(props) {
|
|
22
|
+
var className = props.className, _a = props.component, Component = _a === void 0 ? "div" : _a, children = props.children, value = props.value;
|
|
23
|
+
var _b = useContext(DialogPanelsContext), selectedValue = _b.value, renderStrategy = _b.renderStrategy;
|
|
24
|
+
if (renderStrategy === "hidden") {
|
|
25
|
+
return (_jsx(Component, __assign({ className: className, css: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n width: 100%;\n "], ["\n display: ", ";\n width: 100%;\n "])), value === selectedValue ? "block" : "none") }, { children: children })));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return value === selectedValue ? (_jsx(Component, __assign({ className: className }, { children: children }))) : (_jsx(_Fragment, {}));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
var templateObject_1;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface DialogPanelsProps {
|
|
3
|
+
/** Content 내용으로 표기될 값 */
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/** 현재 선택된 값 */
|
|
6
|
+
value: string;
|
|
7
|
+
/** 활성화되지 않은 패널을 처리하는 전략
|
|
8
|
+
* hidden: display: none으로 가립니다.
|
|
9
|
+
* unmount: 컴포넌트를 unmount합니다.
|
|
10
|
+
*/
|
|
11
|
+
renderStrategy: "hidden" | "unmount";
|
|
12
|
+
}
|
|
13
|
+
export declare function DialogPanels(props: DialogPanelsProps): React.ReactElement;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { DialogPanelsContext } from "./DialogPanelsContext";
|
|
14
|
+
export function DialogPanels(props) {
|
|
15
|
+
var children = props.children, value = props.value, renderStrategy = props.renderStrategy;
|
|
16
|
+
return (_jsx(DialogPanelsContext.Provider, __assign({ value: { value: value, renderStrategy: renderStrategy } }, { children: children })));
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface DialogTitleProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
component?: React.ElementType;
|
|
5
|
+
/**
|
|
6
|
+
* 제목의 X 버튼을 누르를 때 호출되는 callback.
|
|
7
|
+
* 이 속성이 전달되면 X 버튼을 Title 영역에 그립니다.
|
|
8
|
+
*/
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
/** Content 내용으로 표기될 값 */
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function DialogTitle(props: DialogTitleProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
17
|
+
/** @jsxImportSource @emotion/react */
|
|
18
|
+
import { css, useTheme } from "@emotion/react";
|
|
19
|
+
import SquareButton from "../../components/SquareButton";
|
|
20
|
+
import { CloseFillIcon } from "../../icons/system";
|
|
21
|
+
export function DialogTitle(props) {
|
|
22
|
+
var className = props.className, _a = props.component, Component = _a === void 0 ? "div" : _a, onClose = props.onClose, children = props.children;
|
|
23
|
+
var theme = useTheme();
|
|
24
|
+
return (_jsx(_Fragment, { children: _jsxs(Component, __assign({ className: className, css: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n padding: 0px 16px 0px 24px;\n justify-content: space-between;\n align-items: center;\n\n text-align: center;\n /* Alt/Paragraph/16px-Eb */\n font-size: 16px;\n font-family: NanumSquareNeo;\n font-weight: 800;\n line-height: 24px;\n color: ", ";\n "], ["\n display: flex;\n padding: 0px 16px 0px 24px;\n justify-content: space-between;\n align-items: center;\n\n text-align: center;\n /* Alt/Paragraph/16px-Eb */\n font-size: 16px;\n font-family: NanumSquareNeo;\n font-weight: 800;\n line-height: 24px;\n color: ", ";\n "])), theme.color.foreground.neutralBase) }, { children: [children, onClose && (_jsx(SquareButton, { color: "icon", size: "small", icon: _jsx(CloseFillIcon, {}), onClick: onClose }))] })) }));
|
|
25
|
+
}
|
|
26
|
+
var templateObject_1;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ButtonColor, ButtonSize } from "../../components/Button";
|
|
3
|
+
import { DropdownMenuProps } from "./DropdownMenu";
|
|
4
|
+
export interface DropdownProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
component?: React.ElementType;
|
|
7
|
+
/** 버튼 비활성화 여부 */
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** 버튼 컴포넌트 색상 */
|
|
10
|
+
color?: ButtonColor;
|
|
11
|
+
/** 버튼 컴포넌트 크기 */
|
|
12
|
+
size?: ButtonSize;
|
|
13
|
+
/** 버튼 컴포넌트 내 좌측에 표기될 아이콘 */
|
|
14
|
+
startIcon?: React.ReactNode;
|
|
15
|
+
/** 버튼 컴포넌트 내 우측에 표기될 아이콘 */
|
|
16
|
+
endIcon?: React.ReactNode;
|
|
17
|
+
/** 버튼 컴포넌트 내 표기될 문자열 */
|
|
18
|
+
label: string;
|
|
19
|
+
/** 버튼 클릭 시 호출될 콜백 함수 */
|
|
20
|
+
onClick?: () => void;
|
|
21
|
+
/** 드롭다운 메뉴의 props */
|
|
22
|
+
menuProps: DropdownMenuProps;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* [피그마](https://www.figma.com/file/PnQp3tPxiCjgsPZfLUaUL1/Codle-PD-Kit---Patterns?type=design&node-id=203-95329&t=FwczLZ1IVvskUVbT-0)
|
|
26
|
+
*/
|
|
27
|
+
export default function Dropdown(props: DropdownProps): JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useRef, useState } from "react";
|
|
14
|
+
import Button from "../../components/Button";
|
|
15
|
+
import DropdownMenu from "./DropdownMenu";
|
|
16
|
+
import { ArrowDropDownFillIcon } from "../../icons/arrows";
|
|
17
|
+
/**
|
|
18
|
+
* [피그마](https://www.figma.com/file/PnQp3tPxiCjgsPZfLUaUL1/Codle-PD-Kit---Patterns?type=design&node-id=203-95329&t=FwczLZ1IVvskUVbT-0)
|
|
19
|
+
*/
|
|
20
|
+
export default function Dropdown(props) {
|
|
21
|
+
var className = props.className, _a = props.component, Component = _a === void 0 ? "div" : _a, disabled = props.disabled, _b = props.color, color = _b === void 0 ? "primary" : _b, _c = props.size, size = _c === void 0 ? "medium" : _c, startIcon = props.startIcon, _d = props.endIcon, endIcon = _d === void 0 ? _jsx(ArrowDropDownFillIcon, {}) : _d, label = props.label, onClick = props.onClick, menuProps = props.menuProps;
|
|
22
|
+
var buttonProps = {
|
|
23
|
+
disabled: disabled,
|
|
24
|
+
color: color,
|
|
25
|
+
size: size,
|
|
26
|
+
startIcon: startIcon,
|
|
27
|
+
endIcon: endIcon,
|
|
28
|
+
};
|
|
29
|
+
var menuRef = useRef(null);
|
|
30
|
+
var _e = useState(false), open = _e[0], setOpen = _e[1];
|
|
31
|
+
var handleClick = function () {
|
|
32
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
33
|
+
setOpen(true);
|
|
34
|
+
};
|
|
35
|
+
var handleClose = function (e) {
|
|
36
|
+
var _a;
|
|
37
|
+
(_a = menuProps.onClose) === null || _a === void 0 ? void 0 : _a.call(menuProps, e);
|
|
38
|
+
setOpen(false);
|
|
39
|
+
};
|
|
40
|
+
return (_jsxs(Component, __assign({ className: className }, { children: [_jsx(Button, __assign({ ref: menuRef }, buttonProps, { label: label, onClick: handleClick })), _jsx(DropdownMenu, __assign({}, menuProps, { open: open, onClose: handleClose, anchorEl: menuRef.current }))] })));
|
|
41
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CheckboxInputProps } from "../../components/CheckboxInput";
|
|
3
|
+
import { DropdownMenuProps } from "./DropdownMenu";
|
|
4
|
+
export type DropdownItemType = "default" | "danger";
|
|
5
|
+
export declare const DROPDOWN_ITEM_WIDTH = 116;
|
|
6
|
+
export interface DropdownItemProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
component?: React.ElementType;
|
|
9
|
+
/** 드롭다운 아이템의 타입 */
|
|
10
|
+
type?: DropdownItemType;
|
|
11
|
+
/** 체크박스 노출여부 */
|
|
12
|
+
checkbox?: boolean;
|
|
13
|
+
/** 체크박스 설정 props. 초기 체크여부 및 체크박스 값 변경시 호출되는 함수 등을 지정합니다. */
|
|
14
|
+
checkboxProps?: CheckboxInputProps;
|
|
15
|
+
/** 시작 아이콘 설정 */
|
|
16
|
+
startIcon?: React.ReactNode;
|
|
17
|
+
/** 드롭다운 아이템의 라벨 */
|
|
18
|
+
label?: string;
|
|
19
|
+
/** 끝 아이콘 설정. subMenuProps가 없으면 노출되지 않습니다. */
|
|
20
|
+
endIcon?: React.ReactNode;
|
|
21
|
+
/** 비활성화 여부 */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** 드롭다운 아이템의 활성화 여부. 서브 메뉴가 노출될 때 true가 됩니다. */
|
|
24
|
+
active?: boolean;
|
|
25
|
+
/** 드롭다운 아이템 마우스 호버 시 호출될 콜백 함수 */
|
|
26
|
+
onMouseEnter?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
27
|
+
/** 드롭다운 아이템 마우스 아웃 시 호출될 콜백 함수 */
|
|
28
|
+
onMouseLeave?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
29
|
+
/** 드롭다운 아이템 클릭 시 호출될 콜백 함수 */
|
|
30
|
+
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
31
|
+
/** 드롭다운 아이템의 서브 메뉴가 열려야 하는지 여부 */
|
|
32
|
+
shouldSubMenuOpen?: boolean;
|
|
33
|
+
/** 아이템이 가지는 드롭다운 메뉴 props. 주어지지 않으면 서브메뉴가 없습니다. */
|
|
34
|
+
subMenuProps?: DropdownMenuProps;
|
|
35
|
+
/** 드롭다운 아이템의 서브 메뉴가 닫힐 때 실행할 콜백함수 */
|
|
36
|
+
onSubMenuClose?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* [피그마](https://www.figma.com/file/PnQp3tPxiCjgsPZfLUaUL1/Codle-PD-Kit---Patterns?type=design&node-id=106-1900&t=FwczLZ1IVvskUVbT-0)
|
|
40
|
+
*/
|
|
41
|
+
declare const DropdownItem: React.ForwardRefExoticComponent<DropdownItemProps & React.RefAttributes<any>>;
|
|
42
|
+
export default DropdownItem;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
+
var t = {};
|
|
18
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
+
t[p] = s[p];
|
|
20
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
+
t[p[i]] = s[p[i]];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
};
|
|
27
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
28
|
+
/** @jsxImportSource @emotion/react */
|
|
29
|
+
import { css } from "@emotion/react";
|
|
30
|
+
import * as React from "react";
|
|
31
|
+
import styled from "@emotion/styled";
|
|
32
|
+
import { MenuItem } from "@mui/material";
|
|
33
|
+
import { HOVER } from "../../utils/hover";
|
|
34
|
+
import CheckboxInput from "../../components/CheckboxInput";
|
|
35
|
+
import { useRef, useState } from "react";
|
|
36
|
+
import DropdownMenu from "./DropdownMenu";
|
|
37
|
+
import { ArrowRightSLineIcon } from "../../icons/arrows";
|
|
38
|
+
export var DROPDOWN_ITEM_WIDTH = 116;
|
|
39
|
+
var TYPE_TO_COLOR = function (theme, type) {
|
|
40
|
+
return {
|
|
41
|
+
default: theme.color.foreground.neutralBase,
|
|
42
|
+
danger: theme.color.foreground.danger,
|
|
43
|
+
}[type];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* [피그마](https://www.figma.com/file/PnQp3tPxiCjgsPZfLUaUL1/Codle-PD-Kit---Patterns?type=design&node-id=106-1900&t=FwczLZ1IVvskUVbT-0)
|
|
47
|
+
*/
|
|
48
|
+
var DropdownItem = React.forwardRef(function (props, ref) {
|
|
49
|
+
var className = props.className, _a = props.component, Component = _a === void 0 ? "div" : _a, _b = props.type, type = _b === void 0 ? "default" : _b, checkbox = props.checkbox, _c = props.checkboxProps, checkboxProps = _c === void 0 ? { checked: false } : _c, startIcon = props.startIcon, label = props.label, _d = props.endIcon, endIcon = _d === void 0 ? _jsx(ArrowRightSLineIcon, {}) : _d, disabled = props.disabled, active = props.active, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, onClick = props.onClick, _e = props.shouldSubMenuOpen, shouldSubMenuOpen = _e === void 0 ? false : _e, _f = props.subMenuProps, subMenuProps = _f === void 0 ? {
|
|
50
|
+
itemsProps: [],
|
|
51
|
+
} : _f, onSubMenuClose = props.onSubMenuClose, other = __rest(props, ["className", "component", "type", "checkbox", "checkboxProps", "startIcon", "label", "endIcon", "disabled", "active", "onMouseEnter", "onMouseLeave", "onClick", "shouldSubMenuOpen", "subMenuProps", "onSubMenuClose"]);
|
|
52
|
+
var itemRef = useRef(null);
|
|
53
|
+
var _g = useState(false), isSubMenuOpen = _g[0], setIsSubMenuOpen = _g[1];
|
|
54
|
+
var handleClick = function (e) {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
setIsSubMenuOpen(true);
|
|
57
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
58
|
+
};
|
|
59
|
+
var handleClose = function (e) {
|
|
60
|
+
setIsSubMenuOpen(false);
|
|
61
|
+
onSubMenuClose === null || onSubMenuClose === void 0 ? void 0 : onSubMenuClose(e);
|
|
62
|
+
};
|
|
63
|
+
var isSubMenuExist = subMenuProps.itemsProps.length > 0;
|
|
64
|
+
var isSubMenuShowed = isSubMenuExist && isSubMenuOpen && shouldSubMenuOpen;
|
|
65
|
+
return (_jsxs(Component, __assign({ className: className, ref: ref, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: handleClick }, other, { children: [_jsxs(StyledMenuItem, __assign({ ref: itemRef, disabled: disabled, selected: isSubMenuShowed || active }, { children: [_jsxs(LeftWrapper, { children: [checkbox && (_jsx(StyledCheckboxInput, __assign({}, checkboxProps, { onClick: function (e) {
|
|
66
|
+
var _a;
|
|
67
|
+
e.stopPropagation();
|
|
68
|
+
(_a = checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
|
69
|
+
} }))), startIcon && _jsx(IconDiv, __assign({ type: type }, { children: startIcon })), _jsx(LabelDiv, __assign({ type: type }, { children: label }))] }), isSubMenuExist && _jsx(IconDiv, __assign({ type: type }, { children: endIcon }))] })), isSubMenuExist && (_jsx(DropdownMenu, __assign({}, subMenuProps, { open: isSubMenuShowed, anchorEl: itemRef.current, isNestedMenu: true, onClose: handleClose, anchorOrigin: {
|
|
70
|
+
vertical: "top",
|
|
71
|
+
horizontal: "right",
|
|
72
|
+
} })))] })));
|
|
73
|
+
});
|
|
74
|
+
var StyledCheckboxInput = styled(CheckboxInput)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin: 4px;\n"], ["\n margin: 4px;\n"])));
|
|
75
|
+
var IconDiv = styled.div(function (_a) {
|
|
76
|
+
var theme = _a.theme, type = _a.type;
|
|
77
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 14px;\n height: 14px;\n svg {\n width: 14px;\n height: 14px;\n path {\n fill: ", ";\n }\n }\n "], ["\n width: 14px;\n height: 14px;\n svg {\n width: 14px;\n height: 14px;\n path {\n fill: ", ";\n }\n }\n "])), TYPE_TO_COLOR(theme, type));
|
|
78
|
+
});
|
|
79
|
+
var LabelDiv = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n"], ["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n"])), function (_a) {
|
|
80
|
+
var theme = _a.theme, type = _a.type;
|
|
81
|
+
return TYPE_TO_COLOR(theme, type);
|
|
82
|
+
});
|
|
83
|
+
var LeftWrapper = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n overflow: hidden;\n white-space: nowrap;\n gap: 4px;\n"], ["\n display: flex;\n align-items: center;\n overflow: hidden;\n white-space: nowrap;\n gap: 4px;\n"])));
|
|
84
|
+
var StyledMenuItem = styled(MenuItem)(function (_a) {
|
|
85
|
+
var theme = _a.theme;
|
|
86
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n &.MuiMenuItem-root {\n background-color: ", ";\n width: ", "px;\n height: 32px;\n border-radius: 6px;\n padding: 4px 8px 4px 8px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n line-height: 14px;\n ", "\n &.Mui-selected {\n background-color: ", ";\n }\n }\n "], ["\n &.MuiMenuItem-root {\n background-color: ", ";\n width: ", "px;\n height: 32px;\n border-radius: 6px;\n padding: 4px 8px 4px 8px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n line-height: 14px;\n ", "\n &.Mui-selected {\n background-color: ", ";\n }\n }\n "])), theme.color.background.neutralBase, DROPDOWN_ITEM_WIDTH, HOVER(css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background-color: ", ";\n "], ["\n background-color: ", ";\n "])), theme.color.background.neutralAlt)), theme.color.background.neutralAlt);
|
|
87
|
+
});
|
|
88
|
+
export default DropdownItem;
|
|
89
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DropdownItemProps } from "./DropdownItem";
|
|
3
|
+
interface OriginProps {
|
|
4
|
+
vertical: "top" | "center" | "bottom";
|
|
5
|
+
horizontal: "left" | "center" | "right";
|
|
6
|
+
}
|
|
7
|
+
export declare const DROPDOWN_MENU_WIDTH = 124;
|
|
8
|
+
export declare const DROPDOWN_MENU_MAX_HEIGHT = 160;
|
|
9
|
+
export interface DropdownMenuProps {
|
|
10
|
+
className?: string;
|
|
11
|
+
/** 드롭다운 메뉴가 열리는지 여부 */
|
|
12
|
+
open?: boolean;
|
|
13
|
+
/** 드롭다운 메뉴의 위치참조 */
|
|
14
|
+
anchorEl?: HTMLElement | null;
|
|
15
|
+
/** 드롭다운 메뉴가 닫힐 때 실행될 콜백함수 */
|
|
16
|
+
onClose?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
17
|
+
/** 현재 드롭다운 메뉴가 중첩 드롭다운인지 여부. 최상위일 경우 false입니다. */
|
|
18
|
+
isNestedMenu?: boolean;
|
|
19
|
+
/** 드롭다운 메뉴 원점이 anchor의 어디에 위치하는지 조정 */
|
|
20
|
+
anchorOrigin?: OriginProps;
|
|
21
|
+
/** 드롭다운 메뉴 원점이 메뉴 자신의 어디에 위치하는지 조정 */
|
|
22
|
+
transformOrigin?: OriginProps;
|
|
23
|
+
/** 드롭다운 메뉴가 가지는 드롭다운 아이템들의 props 배열 */
|
|
24
|
+
itemsProps: DropdownItemProps[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* [피그마](https://www.figma.com/file/PnQp3tPxiCjgsPZfLUaUL1/Codle-PD-Kit---Patterns?type=design&node-id=106-1921&t=FwczLZ1IVvskUVbT-0)
|
|
28
|
+
*/
|
|
29
|
+
declare const DropdownMenu: React.ForwardRefExoticComponent<DropdownMenuProps & React.RefAttributes<any>>;
|
|
30
|
+
export default DropdownMenu;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
+
var t = {};
|
|
18
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
+
t[p] = s[p];
|
|
20
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
+
t[p[i]] = s[p[i]];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
};
|
|
27
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
+
import styled from "@emotion/styled";
|
|
29
|
+
import { css } from "@emotion/react";
|
|
30
|
+
import { Menu } from "@mui/material";
|
|
31
|
+
import React, { useState } from "react";
|
|
32
|
+
import shadows from "../../foundation/shadows";
|
|
33
|
+
import DropdownItem, { DROPDOWN_ITEM_WIDTH, } from "./DropdownItem";
|
|
34
|
+
var ORIGIN_PROPS_TO_MARGIN = function (originProps) {
|
|
35
|
+
var vertical = originProps.vertical, horizontal = originProps.horizontal;
|
|
36
|
+
return {
|
|
37
|
+
top: {
|
|
38
|
+
left: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-right: 12px;\n "], ["\n margin-right: 12px;\n "]))),
|
|
39
|
+
center: css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-bottom: 8px;\n "], ["\n margin-bottom: 8px;\n "]))),
|
|
40
|
+
right: css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin-left: 12px;\n "], ["\n margin-left: 12px;\n "]))),
|
|
41
|
+
},
|
|
42
|
+
center: {
|
|
43
|
+
left: css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin-right: 12px;\n "], ["\n margin-right: 12px;\n "]))),
|
|
44
|
+
center: css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-bottom: 8px;\n "], ["\n margin-bottom: 8px;\n "]))),
|
|
45
|
+
right: css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-left: 12px;\n "], ["\n margin-left: 12px;\n "]))),
|
|
46
|
+
},
|
|
47
|
+
bottom: {
|
|
48
|
+
left: css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-top: 8px;\n "], ["\n margin-top: 8px;\n "]))),
|
|
49
|
+
center: css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n margin-top: 8px;\n "], ["\n margin-top: 8px;\n "]))),
|
|
50
|
+
right: css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n margin-top: 8px;\n "], ["\n margin-top: 8px;\n "]))),
|
|
51
|
+
},
|
|
52
|
+
}[vertical][horizontal];
|
|
53
|
+
};
|
|
54
|
+
export var DROPDOWN_MENU_WIDTH = 124;
|
|
55
|
+
export var DROPDOWN_MENU_MAX_HEIGHT = 160;
|
|
56
|
+
/**
|
|
57
|
+
* [피그마](https://www.figma.com/file/PnQp3tPxiCjgsPZfLUaUL1/Codle-PD-Kit---Patterns?type=design&node-id=106-1921&t=FwczLZ1IVvskUVbT-0)
|
|
58
|
+
*/
|
|
59
|
+
var DropdownMenu = React.forwardRef(function (props, ref) {
|
|
60
|
+
var className = props.className, _a = props.open, open = _a === void 0 ? false : _a, anchorEl = props.anchorEl, onClose = props.onClose, _b = props.isNestedMenu, isNestedMenu = _b === void 0 ? false : _b, _c = props.anchorOrigin, anchorOrigin = _c === void 0 ? {
|
|
61
|
+
vertical: "bottom",
|
|
62
|
+
horizontal: "left",
|
|
63
|
+
} : _c, transformOrigin = props.transformOrigin, itemsProps = props.itemsProps, other = __rest(props, ["className", "open", "anchorEl", "onClose", "isNestedMenu", "anchorOrigin", "transformOrigin", "itemsProps"]);
|
|
64
|
+
var _d = useState(-1), selectedIndex = _d[0], setSelectedIndex = _d[1];
|
|
65
|
+
var handleClick = function (e) {
|
|
66
|
+
setSelectedIndex(-1);
|
|
67
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(e);
|
|
68
|
+
};
|
|
69
|
+
// https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Popover/Popover.js#L104
|
|
70
|
+
// 메뉴를 감싸는 popover의 절대위치를 이동시키기 위해 anchorEl의 위치를 가져옵니다.
|
|
71
|
+
var anchorRect = anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.getBoundingClientRect();
|
|
72
|
+
return (_jsx(StyledMenu, __assign({ ref: ref, open: open, anchorEl: anchorEl, onClick: handleClick, onClose: onClose, className: className, anchorRect: isNestedMenu ? anchorRect : undefined, anchorOrigin: anchorOrigin, transformOrigin: transformOrigin, hideBackdrop: true }, other, { children: itemsProps === null || itemsProps === void 0 ? void 0 : itemsProps.map(function (itemProps, index) { return (_jsx(DropdownItem, __assign({}, itemProps, { onClick: function (e) {
|
|
73
|
+
var _a;
|
|
74
|
+
(_a = itemProps.onClick) === null || _a === void 0 ? void 0 : _a.call(itemProps, e);
|
|
75
|
+
setSelectedIndex(index);
|
|
76
|
+
}, shouldSubMenuOpen: open && selectedIndex === index, onSubMenuClose: onClose }), index)); }) })));
|
|
77
|
+
});
|
|
78
|
+
var StyledMenu = styled(Menu, {
|
|
79
|
+
shouldForwardProp: function (prop) { return prop !== "anchorRect"; },
|
|
80
|
+
})(function (_a) {
|
|
81
|
+
var anchorRect = _a.anchorRect, anchorOrigin = _a.anchorOrigin;
|
|
82
|
+
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n .MuiPaper-root {\n display: block;\n ", "\n width: ", "px;\n max-height: ", "px;\n box-shadow: ", ";\n .MuiList-root {\n display: inline-flex;\n flex-direction: column;\n padding: 4px;\n gap: 2px;\n }\n ", "\n }\n &.MuiModal-root {\n ", "\n }\n "], ["\n .MuiPaper-root {\n display: block;\n ", "\n width: ", "px;\n max-height: ", "px;\n box-shadow: ", ";\n .MuiList-root {\n display: inline-flex;\n flex-direction: column;\n padding: 4px;\n gap: 2px;\n }\n ", "\n }\n &.MuiModal-root {\n ", "\n }\n "])), ORIGIN_PROPS_TO_MARGIN(anchorOrigin), DROPDOWN_MENU_WIDTH, DROPDOWN_MENU_MAX_HEIGHT, shadows.shadow04, anchorRect && css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n position: absolute;\n top: 0px !important;\n left: 0px !important;\n "], ["\n position: absolute;\n top: 0px !important;\n left: 0px !important;\n "]))), anchorRect && css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n position: absolute;\n top: ", "px;\n left: ", "px;\n "], ["\n position: absolute;\n top: ", "px;\n left: ", "px;\n "])), anchorRect.top, anchorRect.left + DROPDOWN_ITEM_WIDTH));
|
|
83
|
+
});
|
|
84
|
+
export default DropdownMenu;
|
|
85
|
+
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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ButtonProps } from "../../components/Button";
|
|
3
|
+
export interface EmptyStateProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
component?: React.ElementType;
|
|
6
|
+
/** 상단에 표시되는 텍스트입니다. */
|
|
7
|
+
title: string;
|
|
8
|
+
/** title 하단에 표시되는 텍스트입니다. */
|
|
9
|
+
subtitle?: string;
|
|
10
|
+
/** 하단의 영역에 렌더링 될 Button 컴포넌트의 속성 배열입니다. */
|
|
11
|
+
buttons?: ButtonProps[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* [피그마](https://www.figma.com/file/PnQp3tPxiCjgsPZfLUaUL1/Codle-PD-Kit---Patterns?type=design&node-id=181-89918&t=J5yAnjojg5Dm1764-0)
|
|
15
|
+
*/
|
|
16
|
+
export default function EmptyState(props: EmptyStateProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
17
|
+
/** @jsxImportSource @emotion/react */
|
|
18
|
+
import { css } from "@emotion/react";
|
|
19
|
+
import styled from "@emotion/styled";
|
|
20
|
+
import Button from "../../components/Button";
|
|
21
|
+
import { ReactComponent as EmptyStateIcon } from "./empty-state-icon.svg";
|
|
22
|
+
/**
|
|
23
|
+
* [피그마](https://www.figma.com/file/PnQp3tPxiCjgsPZfLUaUL1/Codle-PD-Kit---Patterns?type=design&node-id=181-89918&t=J5yAnjojg5Dm1764-0)
|
|
24
|
+
*/
|
|
25
|
+
export default function EmptyState(props) {
|
|
26
|
+
var className = props.className, _a = props.component, Component = _a === void 0 ? "div" : _a, title = props.title, subtitle = props.subtitle, buttons = props.buttons;
|
|
27
|
+
return (_jsxs(Component, __assign({ className: className, css: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 10px;\n\n padding: 120px 10px;\n "], ["\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 10px;\n\n padding: 120px 10px;\n "]))) }, { children: [_jsx(EmptyStateIcon, {}), _jsxs(TextDiv, { children: [_jsx(Title, { children: title }), subtitle && _jsx(Subtitle, { children: subtitle }), (buttons === null || buttons === void 0 ? void 0 : buttons.length) !== 0 && (_jsx(Buttons, { children: buttons === null || buttons === void 0 ? void 0 : buttons.map(function (buttonProps) { return (_jsx(Button, __assign({}, buttonProps))); }) }))] })] })));
|
|
28
|
+
}
|
|
29
|
+
var TextDiv = styled.div(function (_a) {
|
|
30
|
+
var theme = _a.theme;
|
|
31
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 24px 0px;\n gap: 12px;\n\n font-style: normal;\n color: ", ";\n "], ["\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 24px 0px;\n gap: 12px;\n\n font-style: normal;\n color: ", ";\n "])), theme.color.foreground.neutralBase);
|
|
32
|
+
});
|
|
33
|
+
var Title = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-weight: 800;\n font-size: 36px;\n line-height: 44px;\n"], ["\n font-weight: 800;\n font-size: 36px;\n line-height: 44px;\n"])));
|
|
34
|
+
var Subtitle = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-weight: 400;\n font-size: 18px;\n line-height: 28px;\n"], ["\n font-weight: 400;\n font-size: 18px;\n line-height: 28px;\n"])));
|
|
35
|
+
var Buttons = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding: 4px;\n gap: 8px;\n"], ["\n display: flex;\n align-items: center;\n padding: 4px;\n gap: 8px;\n"])));
|
|
36
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|