@team-monolith/cds 0.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/README.md +46 -0
- package/dist/CodleDesignSystemProvider.d.ts +5 -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 +26 -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 +72 -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.d.ts +16 -0
- package/dist/icons/arrows.js +17 -0
- package/dist/icons/brand.d.ts +4 -0
- package/dist/icons/brand.js +13 -0
- package/dist/icons/map.d.ts +4 -0
- package/dist/icons/map.js +13 -0
- package/dist/icons/system.d.ts +25 -0
- package/dist/icons/system.js +20 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -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/index.d.ts +2 -0
- package/dist/patterns/EmptyState/index.js +2 -0
- package/dist/patterns/Grid/EnhancedTableCell.d.ts +9 -0
- package/dist/patterns/Grid/EnhancedTableCell.js +122 -0
- package/dist/patterns/Grid/Grid.d.ts +51 -0
- package/dist/patterns/Grid/Grid.js +140 -0
- package/dist/patterns/Grid/index.d.ts +3 -0
- package/dist/patterns/Grid/index.js +2 -0
- package/dist/patterns/SegmentedControl/SegmentedControlButton.d.ts +8 -0
- package/dist/patterns/SegmentedControl/SegmentedControlButton.js +41 -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 +16 -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/TableRow.d.ts +12 -0
- package/dist/patterns/Table/TableRow.js +29 -0
- package/dist/patterns/Table/TableSizeContext.d.ts +7 -0
- package/dist/patterns/Table/TableSizeContext.js +3 -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 +52 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/src/App.tsx +7 -0
- package/src/cds/CodleDesignSystemProvider.tsx +93 -0
- package/src/cds/README.md +23 -0
- package/src/cds/components/AlertDialog/AlertDialog.tsx +101 -0
- package/src/cds/components/AlertDialog/AlertDialogActions.tsx +34 -0
- package/src/cds/components/AlertDialog/AlertDialogContent.tsx +38 -0
- package/src/cds/components/AlertDialog/AlertDialogTitle.tsx +63 -0
- package/src/cds/components/AlertDialog/index.tsx +4 -0
- package/src/cds/components/Banner.tsx +176 -0
- package/src/cds/components/Button.tsx +239 -0
- package/src/cds/components/CheckboxInput.tsx +270 -0
- package/src/cds/components/Input.tsx +166 -0
- package/src/cds/components/InputBase.tsx +226 -0
- package/src/cds/components/Pagination.tsx +99 -0
- package/src/cds/components/PinInput.tsx +322 -0
- package/src/cds/components/RadioInput.tsx +226 -0
- package/src/cds/components/SquareButton.tsx +229 -0
- package/src/cds/components/Switch.tsx +129 -0
- package/src/cds/components/Tag.tsx +155 -0
- package/src/cds/components/Tooltip.tsx +104 -0
- package/src/cds/emotion.d.ts +70 -0
- package/src/cds/foundation/color.ts +83 -0
- package/src/cds/foundation/shadows.ts +17 -0
- package/src/cds/icons/arrows.tsx +61 -0
- package/src/cds/icons/brand.tsx +13 -0
- package/src/cds/icons/map.tsx +14 -0
- package/src/cds/icons/system.tsx +113 -0
- package/src/cds/index.ts +3 -0
- package/src/cds/patterns/Dropdown/Dropdown.tsx +111 -0
- package/src/cds/patterns/Dropdown/DropdownItem.tsx +203 -0
- package/src/cds/patterns/Dropdown/DropdownMenu.tsx +176 -0
- package/src/cds/patterns/Dropdown/index.tsx +2 -0
- package/src/cds/patterns/EmptyState/EmptyState.tsx +91 -0
- package/src/cds/patterns/EmptyState/empty-state-icon.svg +36 -0
- package/src/cds/patterns/EmptyState/index.tsx +2 -0
- package/src/cds/patterns/Grid/EnhancedTableCell.tsx +180 -0
- package/src/cds/patterns/Grid/Grid.tsx +360 -0
- package/src/cds/patterns/Grid/index.tsx +4 -0
- package/src/cds/patterns/SegmentedControl/SegmentedControlButton.tsx +41 -0
- package/src/cds/patterns/SegmentedControl/SegmentedControlGroup.tsx +81 -0
- package/src/cds/patterns/SegmentedControl/SegmentedControlGroupPropsContext.tsx +9 -0
- package/src/cds/patterns/SegmentedControl/SegmentedControlSquareButton.tsx +51 -0
- package/src/cds/patterns/SegmentedControl/index.ts +3 -0
- package/src/cds/patterns/Table/Table.tsx +56 -0
- package/src/cds/patterns/Table/TableBody.tsx +30 -0
- package/src/cds/patterns/Table/TableCell.tsx +242 -0
- package/src/cds/patterns/Table/TableHead.tsx +30 -0
- package/src/cds/patterns/Table/TableRow.tsx +54 -0
- package/src/cds/patterns/Table/TableSizeContext.tsx +10 -0
- package/src/cds/patterns/Table/TableVariantContext.tsx +9 -0
- package/src/cds/patterns/Table/index.tsx +15 -0
- package/src/cds/utils/hover.tsx +24 -0
- package/src/cds/utils/reset.tsx +19 -0
- package/src/cds/utils/zIndex.tsx +3 -0
- package/src/index.tsx +10 -0
- package/src/react-app-env.d.ts +1 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,77 @@
|
|
|
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, useTheme } from "@emotion/react";
|
|
30
|
+
import * as React from "react";
|
|
31
|
+
import styled from "@emotion/styled";
|
|
32
|
+
import { ZINDEX } from "../utils/zIndex";
|
|
33
|
+
var CHECKBOX_ICON_STYLE = function (theme, type, disabled) {
|
|
34
|
+
return {
|
|
35
|
+
default: css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n rect {\n fill: ", ";\n stroke: ", ";\n }\n ", "\n "], ["\n rect {\n fill: ", ";\n stroke: ", ";\n }\n ", "\n "])), theme.color.background.neutralBase, theme.color.background.neutralAltActive, disabled
|
|
36
|
+
? css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n rect {\n fill: ", ";\n stroke: ", ";\n }\n "], ["\n rect {\n fill: ", ";\n stroke: ", ";\n }\n "])), theme.color.background.neutralAlt, theme.color.background.neutralAltActive) : css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n input[type=\"checkbox\"]:hover + & {\n rect {\n stroke: ", ";\n }\n }\n "], ["\n input[type=\"checkbox\"]:hover + & {\n rect {\n stroke: ", ";\n }\n }\n "])), theme.color.background.primary)),
|
|
37
|
+
checked: css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n rect {\n fill: ", ";\n stroke: ", ";\n }\n path {\n fill: ", ";\n }\n ", "\n "], ["\n rect {\n fill: ", ";\n stroke: ", ";\n }\n path {\n fill: ", ";\n }\n ", "\n "])), theme.color.background.primary, theme.color.background.primary, theme.color.background.neutralBase, disabled
|
|
38
|
+
? css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n rect {\n fill: ", ";\n stroke: ", ";\n }\n path {\n fill: ", ";\n }\n "], ["\n rect {\n fill: ", ";\n stroke: ", ";\n }\n path {\n fill: ", ";\n }\n "])), theme.color.background.neutralAlt, theme.color.background.primaryDisabled, theme.color.background.primaryDisabled) : css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n input[type=\"checkbox\"]:hover + & {\n rect {\n fill: ", ";\n stroke: ", ";\n }\n }\n "], ["\n input[type=\"checkbox\"]:hover + & {\n rect {\n fill: ", ";\n stroke: ", ";\n }\n }\n "])), theme.color.background.primaryActive, theme.color.background.primaryActive)),
|
|
39
|
+
partial: css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n rect {\n fill: ", ";\n stroke: ", ";\n }\n rect + rect {\n fill: ", ";\n stroke: none;\n }\n ", "\n "], ["\n rect {\n fill: ", ";\n stroke: ", ";\n }\n rect + rect {\n fill: ", ";\n stroke: none;\n }\n ", "\n "])), theme.color.background.neutralBase, theme.color.background.primary, theme.color.background.primary, disabled
|
|
40
|
+
? css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n rect {\n fill: ", ";\n stroke: ", ";\n }\n rect + rect {\n fill: ", ";\n stroke: none;\n }\n "], ["\n rect {\n fill: ", ";\n stroke: ", ";\n }\n rect + rect {\n fill: ", ";\n stroke: none;\n }\n "])), theme.color.background.neutralAlt, theme.color.background.primaryDisabled, theme.color.background.primaryDisabled) : css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n input[type=\"checkbox\"]:hover + & {\n rect {\n stroke: ", ";\n }\n rect + rect {\n fill: ", ";\n stroke: none;\n }\n }\n "], ["\n input[type=\"checkbox\"]:hover + & {\n rect {\n stroke: ", ";\n }\n rect + rect {\n fill: ", ";\n stroke: none;\n }\n }\n "])), theme.color.background.primaryActive, theme.color.background.primaryActive)),
|
|
41
|
+
}[type];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=36-907&t=G4t39O7uXZvsGQ9u-0)
|
|
45
|
+
*/
|
|
46
|
+
var CheckboxInput = React.forwardRef(function (props, ref) {
|
|
47
|
+
var className = props.className, checked = props.checked, label = props.label, spacer = props.spacer, disabled = props.disabled, partial = props.partial, onChange = props.onChange, onClick = props.onClick, other = __rest(props, ["className", "checked", "label", "spacer", "disabled", "partial", "onChange", "onClick"]);
|
|
48
|
+
if (!label) {
|
|
49
|
+
return _jsx(Checkbox, __assign({}, props, { ref: ref }));
|
|
50
|
+
}
|
|
51
|
+
var checkboxProps = { checked: checked, spacer: spacer, disabled: disabled, partial: partial, onChange: onChange };
|
|
52
|
+
return (_jsxs(Label, __assign({ className: className, ref: ref }, other, { children: [_jsx(Checkbox, __assign({}, checkboxProps)), _jsx("span", __assign({ css: css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n margin-left: 8px;\n "], ["\n margin-left: 8px;\n "]))) }, { children: label }))] })));
|
|
53
|
+
});
|
|
54
|
+
var Checkbox = React.forwardRef(function (props, ref) {
|
|
55
|
+
var className = props.className, checked = props.checked, partial = props.partial, _a = props.disabled, disabled = _a === void 0 ? false : _a, _b = props.spacer, spacer = _b === void 0 ? false : _b, onChange = props.onChange, onClick = props.onClick, inputProps = props.inputProps, other = __rest(props, ["className", "checked", "partial", "disabled", "spacer", "onChange", "onClick", "inputProps"]);
|
|
56
|
+
var type = checked
|
|
57
|
+
? "checked"
|
|
58
|
+
: partial
|
|
59
|
+
? "partial"
|
|
60
|
+
: "default";
|
|
61
|
+
return (_jsxs(CheckboxContainer, __assign({ className: className, spacer: spacer, disabled: disabled, ref: ref }, other, { children: [_jsx(StyledInput, __assign({ type: "checkbox" }, inputProps, { checked: checked, disabled: disabled, onClick: onClick, onChange: onChange })), _jsx(CheckboxIcon, { type: type, disabled: disabled })] })));
|
|
62
|
+
});
|
|
63
|
+
var CheckboxContainer = styled.span(function (_a) {
|
|
64
|
+
var spacer = _a.spacer, disabled = _a.disabled;
|
|
65
|
+
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n display: inline-block;\n position: relative;\n width: 16px;\n height: 16px;\n cursor: ", ";\n margin-bottom: ", ";\n "], ["\n display: inline-block;\n position: relative;\n width: 16px;\n height: 16px;\n cursor: ", ";\n margin-bottom: ", ";\n "])), disabled ? "default" : "pointer", spacer ? "8px" : "0");
|
|
66
|
+
});
|
|
67
|
+
var StyledInput = styled.input(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n cursor: inherit;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n width: 16px;\n height: 16px;\n margin: 0;\n padding: 0;\n // input \uCEF4\uD3EC\uB10C\uD2B8\uB294 \uBCF4\uC774\uC9C0 \uC54A\uC9C0\uB9CC, \uD074\uB9AD\uC774 \uAC00\uB2A5\uD558\uAC8C z-index\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n z-index: ", ";\n"], ["\n cursor: inherit;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n width: 16px;\n height: 16px;\n margin: 0;\n padding: 0;\n // input \uCEF4\uD3EC\uB10C\uD2B8\uB294 \uBCF4\uC774\uC9C0 \uC54A\uC9C0\uB9CC, \uD074\uB9AD\uC774 \uAC00\uB2A5\uD558\uAC8C z-index\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n z-index: ", ";\n"])), ZINDEX.inputBase);
|
|
68
|
+
var Label = styled.label(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n display: flex;\n position: relative;\n width: fit-content;\n font-size: 14px;\n font-weight: 500;\n line-height: 16px;\n color: ", ";\n align-self: center;\n"], ["\n display: flex;\n position: relative;\n width: fit-content;\n font-size: 14px;\n font-weight: 500;\n line-height: 16px;\n color: ", ";\n align-self: center;\n"])), function (_a) {
|
|
69
|
+
var theme = _a.theme;
|
|
70
|
+
return theme.color.foreground.neutralBase;
|
|
71
|
+
});
|
|
72
|
+
var CheckboxIcon = function (props) {
|
|
73
|
+
var theme = useTheme();
|
|
74
|
+
return (_jsxs("svg", __assign({ width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", css: CHECKBOX_ICON_STYLE(theme, props.type, props.disabled) }, { children: [_jsx("rect", { x: "0.5", y: "0.5", width: "15", height: "15", rx: "1.5", fill: "currentColor", stroke: "currentColor" }), props.type === "checked" && (_jsx("path", { d: "M7.10545 12.6041L7.08783 12.6217L2.68799 8.22185L4.12067 6.78917L7.10551 9.77402L11.8795 5L13.3122 6.43268L7.12313 12.6218L7.10545 12.6041Z", fill: "currentColor" })), props.type === "partial" && (_jsx("rect", { x: "4", y: "4", width: "8", height: "8", fill: "currentColor" }))] })));
|
|
75
|
+
};
|
|
76
|
+
export default CheckboxInput;
|
|
77
|
+
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;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { InputBaseColor, InputBaseProps, InputBaseSize } from "./InputBase";
|
|
3
|
+
export type InputColor = InputBaseColor;
|
|
4
|
+
export type InputSize = InputBaseSize;
|
|
5
|
+
export interface InputProps extends InputBaseProps {
|
|
6
|
+
/** Input 컴포넌트 상단에 노출될 문자열 */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Input 컴포넌트 하단에 노출될 문자열 */
|
|
9
|
+
hintText?: string;
|
|
10
|
+
/** hint 영역 좌측에 노출될 아이콘 */
|
|
11
|
+
hintIcon?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=26-10284&t=HnIfxpf8uR6WmzMW-0)
|
|
15
|
+
*/
|
|
16
|
+
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<any>>;
|
|
17
|
+
export default Input;
|
|
@@ -0,0 +1,72 @@
|
|
|
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 styled from "@emotion/styled";
|
|
31
|
+
import React from "react";
|
|
32
|
+
import { InputBase, } from "./InputBase";
|
|
33
|
+
var COLOR_TO_HINT_STYLES = function (theme, color, disabled) {
|
|
34
|
+
return disabled
|
|
35
|
+
? css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.neutralBaseDisabled) : {
|
|
36
|
+
default: css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.neutralBaseDisabled),
|
|
37
|
+
activePrimary: css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.neutralBaseDisabled),
|
|
38
|
+
activeDanger: css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.danger),
|
|
39
|
+
activeSuccess: css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.success),
|
|
40
|
+
}[color];
|
|
41
|
+
};
|
|
42
|
+
var SIZE_TO_FONT_STYLES = function (size) {
|
|
43
|
+
return ({
|
|
44
|
+
small: css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-size: 14px;\n line-height: 20px;\n svg {\n width: 16px;\n height: 16px;\n }\n "], ["\n font-size: 14px;\n line-height: 20px;\n svg {\n width: 16px;\n height: 16px;\n }\n "]))),
|
|
45
|
+
medium: css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-size: 16px;\n line-height: 24px;\n svg {\n width: 16px;\n height: 16px;\n }\n "], ["\n font-size: 16px;\n line-height: 24px;\n svg {\n width: 16px;\n height: 16px;\n }\n "]))),
|
|
46
|
+
large: css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n font-size: 18px;\n line-height: 28px;\n svg {\n width: 18px;\n height: 18px;\n }\n "], ["\n font-size: 18px;\n line-height: 28px;\n svg {\n width: 18px;\n height: 18px;\n }\n "]))),
|
|
47
|
+
}[size]);
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=26-10284&t=HnIfxpf8uR6WmzMW-0)
|
|
51
|
+
*/
|
|
52
|
+
var Input = React.forwardRef(function (props, ref) {
|
|
53
|
+
var label = props.label, hintText = props.hintText, hintIcon = props.hintIcon, className = props.className, color = props.color, size = props.size, placeholder = props.placeholder, disabled = props.disabled, startIcon = props.startIcon, startLabel = props.startLabel, endLabel = props.endLabel, endIcon = props.endIcon, inputProps = props.inputProps, inputRef = props.inputRef, fullWidth = props.fullWidth, onChange = props.onChange, onClear = props.onClear, defaultValue = props.defaultValue, value = props.value, other = __rest(props, ["label", "hintText", "hintIcon", "className", "color", "size", "placeholder", "disabled", "startIcon", "startLabel", "endLabel", "endIcon", "inputProps", "inputRef", "fullWidth", "onChange", "onClear", "defaultValue", "value"]);
|
|
54
|
+
return (_jsxs(InputWrapper, __assign({ className: props.className, size: props.size, fullWidth: props.fullWidth, ref: ref }, other, { children: [label ? (_jsxs(Label, __assign({ disabled: props.disabled }, { children: [label, " ", _jsx(InputBase, __assign({}, props))] }))) : (_jsx(InputBase, __assign({}, props))), hintText && (_jsxs(Hint, __assign({ color: props.color, disabled: props.disabled }, { children: [hintIcon, hintText] })))] })));
|
|
55
|
+
});
|
|
56
|
+
var InputWrapper = styled.span(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n display: inline-flex;\n flex-direction: column;\n gap: 8px;\n ", "\n ", "\n\n position: relative;\n"], ["\n display: inline-flex;\n flex-direction: column;\n gap: 8px;\n ", "\n ", "\n\n position: relative;\n"])), function (_a) {
|
|
57
|
+
var size = _a.size;
|
|
58
|
+
return SIZE_TO_FONT_STYLES(size);
|
|
59
|
+
}, function (_a) {
|
|
60
|
+
var fullWidth = _a.fullWidth;
|
|
61
|
+
return fullWidth && "width: 100%;";
|
|
62
|
+
});
|
|
63
|
+
var Label = styled.label(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 8px;\n ", "\n"], ["\n display: flex;\n flex-direction: column;\n gap: 8px;\n ", "\n"])), function (_a) {
|
|
64
|
+
var theme = _a.theme, disabled = _a.disabled;
|
|
65
|
+
return disabled && css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.neutralBaseDisabled);
|
|
66
|
+
});
|
|
67
|
+
var Hint = styled.div(function (_a) {
|
|
68
|
+
var theme = _a.theme, color = _a.color, disabled = _a.disabled;
|
|
69
|
+
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: 4px;\n ", ";\n "], ["\n display: flex;\n align-items: center;\n gap: 4px;\n ", ";\n "])), COLOR_TO_HINT_STYLES(theme, color, disabled));
|
|
70
|
+
});
|
|
71
|
+
export default Input;
|
|
72
|
+
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,42 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from "react";
|
|
2
|
+
export type InputBaseColor = "default" | "activePrimary" | "activeDanger" | "activeSuccess";
|
|
3
|
+
export type InputBaseSize = "large" | "medium" | "small";
|
|
4
|
+
export interface InputBaseProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
/** 컴포넌트 색상 */
|
|
7
|
+
color: InputBaseColor;
|
|
8
|
+
/** 컴포넌트 크기 */
|
|
9
|
+
size: InputBaseSize;
|
|
10
|
+
/** 입력되기 전 Input 컴포넌트에 노출될 문자열 */
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
/** 비활성화 여부 */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Input 컴포넌트 내의 좌측 영역에 노출될 아이콘 */
|
|
15
|
+
startIcon?: React.ReactNode;
|
|
16
|
+
/** Input 컴포넌트 내의 좌측 영역에 노출될 텍스트.
|
|
17
|
+
* `startIcon` 보다 우측에 노출됩니다. */
|
|
18
|
+
startLabel?: string;
|
|
19
|
+
/** Input 컴포넌트 내의 우측 영역에 노출될 텍스트.
|
|
20
|
+
* `endIcon` 보다 좌측에 노출됩니다. */
|
|
21
|
+
endLabel?: string;
|
|
22
|
+
/** Input 컴포넌트 내의 우측 영역에 노출될 아이콘 */
|
|
23
|
+
endIcon?: React.ReactNode;
|
|
24
|
+
/** HTML input 태그에 전달될 ref */
|
|
25
|
+
inputRef?: React.LegacyRef<HTMLInputElement>;
|
|
26
|
+
/** HTML input 태그에 전달될 props */
|
|
27
|
+
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
28
|
+
/** true일 경우, Input이 상위 요소의 전체 길이를 차지하게 됩니다. */
|
|
29
|
+
fullWidth?: boolean;
|
|
30
|
+
/** 값이 변경될때 호출될 콜백 함수 */
|
|
31
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
32
|
+
/**
|
|
33
|
+
* Clear Button을 클릭했을 때의 콜백 함수.
|
|
34
|
+
* 설정하면, Input 컴포넌트 내의 우측 영역에 Clear Button이 노출됩니다.
|
|
35
|
+
*/
|
|
36
|
+
onClear?: () => void;
|
|
37
|
+
/** input의 value의 초기값 (UnControlled Component) */
|
|
38
|
+
defaultValue?: any;
|
|
39
|
+
/** input의 value (Controlled Component) */
|
|
40
|
+
value?: any;
|
|
41
|
+
}
|
|
42
|
+
export declare function InputBase(props: InputBaseProps): React.ReactElement;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 "react/jsx-runtime";
|
|
17
|
+
import { css } from "@emotion/react";
|
|
18
|
+
import styled from "@emotion/styled";
|
|
19
|
+
import { CloseCircleFillIcon } from "../icons/system";
|
|
20
|
+
import { RESET_BUTTON } from "../utils/reset";
|
|
21
|
+
var COLOR_TO_INPUT_STYLES = function (theme, color, disabled) {
|
|
22
|
+
if (disabled) {
|
|
23
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border: none;\n background: ", ";\n color: ", ";\n "], ["\n border: none;\n background: ", ";\n color: ", ";\n "])), theme.color.foreground.neutralBaseDisabled, theme.color.background.neutralAlt);
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
default: css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: none;\n background: ", ";\n color: ", ";\n "], ["\n border: none;\n background: ", ";\n color: ", ";\n "])), theme.color.background.neutralAlt, theme.color.foreground.neutralBase),
|
|
27
|
+
activePrimary: css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border: 2px solid ", ";\n background: ", ";\n color: ", ";\n "], ["\n border: 2px solid ", ";\n background: ", ";\n color: ", ";\n "])), theme.color.foreground.primary, theme.color.background.neutralBase, theme.color.foreground.neutralBase),
|
|
28
|
+
activeDanger: css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border: 2px solid ", ";\n background: ", ";\n color: ", ";\n "], ["\n border: 2px solid ", ";\n background: ", ";\n color: ", ";\n "])), theme.color.foreground.danger, theme.color.background.neutralBase, theme.color.foreground.neutralBase),
|
|
29
|
+
activeSuccess: css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n border: 2px solid ", ";\n background: ", ";\n color: ", ";\n "], ["\n border: 2px solid ", ";\n background: ", ";\n color: ", ";\n "])), theme.color.foreground.success, theme.color.background.neutralBase, theme.color.foreground.neutralBase),
|
|
30
|
+
}[color];
|
|
31
|
+
};
|
|
32
|
+
var SIZE_TO_STYLES = function (size) {
|
|
33
|
+
return ({
|
|
34
|
+
small: css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding-top: 8px;\n padding-bottom: 8px;\n width: 300px;\n height: 36px;\n "], ["\n padding-top: 8px;\n padding-bottom: 8px;\n width: 300px;\n height: 36px;\n "]))),
|
|
35
|
+
medium: css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-top: 12px;\n padding-bottom: 12px;\n width: 375px;\n height: 48px;\n "], ["\n padding-top: 12px;\n padding-bottom: 12px;\n width: 375px;\n height: 48px;\n "]))),
|
|
36
|
+
large: css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n padding-top: 14px;\n padding-bottom: 14px;\n width: 375px;\n height: 56px;\n "], ["\n padding-top: 14px;\n padding-bottom: 14px;\n width: 375px;\n height: 56px;\n "]))),
|
|
37
|
+
}[size]);
|
|
38
|
+
};
|
|
39
|
+
export function InputBase(props) {
|
|
40
|
+
var className = props.className, color = props.color, size = props.size, placeholder = props.placeholder, _a = props.disabled, disabled = _a === void 0 ? false : _a, startIcon = props.startIcon, startLabel = props.startLabel, endLabel = props.endLabel, endIcon = props.endIcon, inputProps = props.inputProps, inputRef = props.inputRef, _b = props.fullWidth, fullWidth = _b === void 0 ? false : _b, onChange = props.onChange, onClear = props.onClear, defaultValue = props.defaultValue, value = props.value;
|
|
41
|
+
return (_jsxs(InputContainer, __assign({ className: className, disabled: disabled, color: color, inputSize: size, fullWidth: fullWidth }, { children: [startIcon, startLabel && _jsx("span", { children: startLabel }), _jsx(StyledInput, __assign({}, inputProps, { ref: inputRef, onChange: onChange, placeholder: placeholder, disabled: disabled, defaultValue: defaultValue, value: value })), endLabel && _jsx("span", { children: endLabel }), endIcon, onClear && (_jsx(ClearButton, __assign({ onClick: onClear, disabled: disabled }, { children: _jsx(CloseCircleFillIcon, {}) })))] })));
|
|
42
|
+
}
|
|
43
|
+
var InputContainer = styled.div(function (_a) {
|
|
44
|
+
var theme = _a.theme, color = _a.color, inputSize = _a.inputSize, disabled = _a.disabled, fullWidth = _a.fullWidth;
|
|
45
|
+
return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: 16px;\n\n box-sizing: border-box;\n padding: 14px 16px;\n border-radius: 8px;\n ", "\n ", "\n ", " // InputWrapper\uC758 width\uB97C \uB530\uB985\uB2C8\uB2E4.\n "], ["\n display: flex;\n align-items: center;\n gap: 16px;\n\n box-sizing: border-box;\n padding: 14px 16px;\n border-radius: 8px;\n ", "\n ", "\n ", " // InputWrapper\uC758 width\uB97C \uB530\uB985\uB2C8\uB2E4.\n "])), COLOR_TO_INPUT_STYLES(theme, color, disabled), SIZE_TO_STYLES(inputSize), fullWidth && "width: inherit;");
|
|
46
|
+
});
|
|
47
|
+
var StyledInput = styled.input(function (_a) {
|
|
48
|
+
var theme = _a.theme;
|
|
49
|
+
return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n appearance: none;\n flex: 1;\n min-width: 0;\n border: none;\n padding: 0;\n background-color: transparent;\n font: inherit;\n color: currentColor;\n\n &:focus-visible {\n outline: none;\n }\n &::placeholder {\n color: ", ";\n }\n "], ["\n appearance: none;\n flex: 1;\n min-width: 0;\n border: none;\n padding: 0;\n background-color: transparent;\n font: inherit;\n color: currentColor;\n\n &:focus-visible {\n outline: none;\n }\n &::placeholder {\n color: ", ";\n }\n "])), theme.color.foreground.neutralBaseDisabled);
|
|
50
|
+
});
|
|
51
|
+
var ClearButton = styled.button(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n ", "\n color: currentColor;\n &:not(:disabled) {\n cursor: pointer;\n }\n display: flex;\n align-items: center;\n"], ["\n ", "\n color: currentColor;\n &:not(:disabled) {\n cursor: pointer;\n }\n display: flex;\n align-items: center;\n"])), RESET_BUTTON);
|
|
52
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface PaginationProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
/** 시작과 끝에 오는 페이지의 수 */
|
|
5
|
+
boundaryCount?: number;
|
|
6
|
+
/** 전체 페이지의 수 */
|
|
7
|
+
count?: number;
|
|
8
|
+
/** 기본 페이지 (UnControlled) */
|
|
9
|
+
defaultPage?: number;
|
|
10
|
+
/** 비활성화 여부 */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** 다음 페이지로 이동하는 버튼 숨김여부 */
|
|
13
|
+
hideNextButton?: boolean;
|
|
14
|
+
/** 이전 페이지로 이동하는 버튼 숨김여부 */
|
|
15
|
+
hidePrevButton?: boolean;
|
|
16
|
+
/** 페이지가 변경되었을 때 콜백함수 */
|
|
17
|
+
onChange?: (event: React.ChangeEvent<unknown>, page: number) => void;
|
|
18
|
+
/** 현재 페이지 전후로 나타나는 페이지의 수 */
|
|
19
|
+
siblingCount?: number;
|
|
20
|
+
/** 현재 페이지 */
|
|
21
|
+
page: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=35-798&t=6OdVgm0hiYaq5PFw-0)
|
|
25
|
+
*/
|
|
26
|
+
declare const Pagination: React.ForwardRefExoticComponent<PaginationProps & React.RefAttributes<any>>;
|
|
27
|
+
export default Pagination;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 "@emotion/react/jsx-runtime";
|
|
17
|
+
/** @jsxImportSource @emotion/react */
|
|
18
|
+
import { css } from "@emotion/react";
|
|
19
|
+
import * as React from "react";
|
|
20
|
+
import styled from "@emotion/styled";
|
|
21
|
+
import { Pagination as MuiPagination } from "@mui/material";
|
|
22
|
+
import { HOVER } from "../utils/hover";
|
|
23
|
+
/**
|
|
24
|
+
* [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=35-798&t=6OdVgm0hiYaq5PFw-0)
|
|
25
|
+
*/
|
|
26
|
+
var Pagination = React.forwardRef(function (props, ref) { return (_jsx(StyledPagination, __assign({ siblingCount: 2, shape: "rounded" }, props, { ref: ref }))); });
|
|
27
|
+
var StyledPagination = styled(MuiPagination)(function (_a) {
|
|
28
|
+
var theme = _a.theme;
|
|
29
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n &.MuiPagination-root {\n & .MuiPagination-ul {\n li {\n width: 32px;\n height: 32px;\n margin-left: 4px;\n margin-right: 4px;\n button {\n padding: 0;\n margin: 0;\n }\n }\n }\n & .MuiPaginationItem-root {\n ", "\n }\n & .MuiPaginationItem-text {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n border-radius: 8px;\n color: ", ";\n font-weight: 400;\n font-size: 14px;\n line-height: 24px;\n padding: 1px 7px;\n margin: 0;\n }\n & .Mui-selected {\n border: 2px solid ", ";\n background-color: transparent;\n color: ", ";\n font-weight: 700;\n ", "\n }\n & .Mui-disabled {\n background-color: transparent;\n color: ", ";\n }\n & .Mui-disabled.Mui-selected {\n border: 2px solid ", ";\n background-color: transparent;\n color: ", ";\n }\n & .MuiPaginationItem-ellipsis {\n ", "\n }\n }\n "], ["\n &.MuiPagination-root {\n & .MuiPagination-ul {\n li {\n width: 32px;\n height: 32px;\n margin-left: 4px;\n margin-right: 4px;\n button {\n padding: 0;\n margin: 0;\n }\n }\n }\n & .MuiPaginationItem-root {\n ", "\n }\n & .MuiPaginationItem-text {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n border-radius: 8px;\n color: ", ";\n font-weight: 400;\n font-size: 14px;\n line-height: 24px;\n padding: 1px 7px;\n margin: 0;\n }\n & .Mui-selected {\n border: 2px solid ", ";\n background-color: transparent;\n color: ", ";\n font-weight: 700;\n ", "\n }\n & .Mui-disabled {\n background-color: transparent;\n color: ", ";\n }\n & .Mui-disabled.Mui-selected {\n border: 2px solid ", ";\n background-color: transparent;\n color: ", ";\n }\n & .MuiPaginationItem-ellipsis {\n ", "\n }\n }\n "])), HOVER(css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n "], ["\n background-color: ", ";\n "])), theme.color.background.neutralAlt)), theme.color.foreground.neutralBase, theme.color.background.primary, theme.color.background.primary, HOVER(css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: transparent;\n "], ["\n background-color: transparent;\n "])))), theme.color.foreground.neutralBaseDisabled, theme.color.background.primaryDisabled, theme.color.background.primaryDisabled, HOVER(css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color: transparent;\n "], ["\n background-color: transparent;\n "])))));
|
|
30
|
+
});
|
|
31
|
+
export default Pagination;
|
|
32
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type PinInputColor = "default" | "activePrimary" | "activeDanger" | "activeSuccess";
|
|
3
|
+
export type PinInputSize = "large" | "medium" | "small";
|
|
4
|
+
export interface PinInputProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
/** `true` 값일 때 첫번째 Input에 자동으로 포커싱합니다. */
|
|
7
|
+
autoFocus?: boolean;
|
|
8
|
+
/** 컴포넌트 크기 */
|
|
9
|
+
size: PinInputSize;
|
|
10
|
+
/** 입력되기 전 PinInput 컴포넌트에 노출될 문자열 */
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
/** Input 컴포넌트 상단에 노출될 문자열 */
|
|
13
|
+
label?: string;
|
|
14
|
+
/** Input 컴포넌트 하단에 노출될 문자열 */
|
|
15
|
+
hintText?: string;
|
|
16
|
+
/** hint 영역 좌측에 노출될 아이콘 */
|
|
17
|
+
hintIcon?: React.ReactNode;
|
|
18
|
+
/** 비활성화 여부 */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** 에러 상태 여부 */
|
|
21
|
+
error?: boolean;
|
|
22
|
+
/** 성공 상태 여부 */
|
|
23
|
+
positive?: boolean;
|
|
24
|
+
/** 값이 변경될때 호출될 콜백 함수 */
|
|
25
|
+
onChange: (e: {
|
|
26
|
+
values: string[];
|
|
27
|
+
event: React.ChangeEvent<HTMLInputElement>;
|
|
28
|
+
}) => void;
|
|
29
|
+
/** PinInput의 value (Controlled Component) */
|
|
30
|
+
values: string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=26-11031&t=n7a8XP4k8R2TGmiO-0)
|
|
34
|
+
*/
|
|
35
|
+
declare const PinInput: React.ForwardRefExoticComponent<PinInputProps & React.RefAttributes<any>>;
|
|
36
|
+
export default PinInput;
|
|
@@ -0,0 +1,154 @@
|
|
|
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 styled from "@emotion/styled";
|
|
31
|
+
import React, { useRef, useState } from "react";
|
|
32
|
+
import { InputBase } from "./InputBase";
|
|
33
|
+
var SIZE_TO_STYLES = function (size) {
|
|
34
|
+
return ({
|
|
35
|
+
small: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 36px;\n "], ["\n width: 36px;\n "]))),
|
|
36
|
+
medium: css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 48px;\n "], ["\n width: 48px;\n "]))),
|
|
37
|
+
large: css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 56px;\n "], ["\n width: 56px;\n "]))),
|
|
38
|
+
}[size]);
|
|
39
|
+
};
|
|
40
|
+
var COLOR_TO_HINT_STYLES = function (theme, color, disabled) {
|
|
41
|
+
return disabled
|
|
42
|
+
? css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.neutralBaseDisabled) : {
|
|
43
|
+
default: css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.neutralBaseDisabled),
|
|
44
|
+
activePrimary: css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.neutralBaseDisabled),
|
|
45
|
+
activeDanger: css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.danger),
|
|
46
|
+
activeSuccess: css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.success),
|
|
47
|
+
}[color];
|
|
48
|
+
};
|
|
49
|
+
var SIZE_TO_FONT_STYLES = function (size) {
|
|
50
|
+
return ({
|
|
51
|
+
small: css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n font-size: 14px;\n line-height: 20px;\n svg {\n width: 16px;\n height: 16px;\n }\n "], ["\n font-size: 14px;\n line-height: 20px;\n svg {\n width: 16px;\n height: 16px;\n }\n "]))),
|
|
52
|
+
medium: css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n font-size: 16px;\n line-height: 24px;\n svg {\n width: 16px;\n height: 16px;\n }\n "], ["\n font-size: 16px;\n line-height: 24px;\n svg {\n width: 16px;\n height: 16px;\n }\n "]))),
|
|
53
|
+
large: css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n font-size: 18px;\n line-height: 28px;\n svg {\n width: 18px;\n height: 18px;\n }\n "], ["\n font-size: 18px;\n line-height: 28px;\n svg {\n width: 18px;\n height: 18px;\n }\n "]))),
|
|
54
|
+
}[size]);
|
|
55
|
+
};
|
|
56
|
+
/** i번째 값을 value로 바꾸는 setState Wrapper 함수 */
|
|
57
|
+
function updateFocus(value, i, setFocus) {
|
|
58
|
+
setFocus(function (prevFocus) {
|
|
59
|
+
var newFocus = prevFocus.slice();
|
|
60
|
+
newFocus[i] = value;
|
|
61
|
+
return newFocus;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=26-11031&t=n7a8XP4k8R2TGmiO-0)
|
|
66
|
+
*/
|
|
67
|
+
var PinInput = React.forwardRef(function (props, ref) {
|
|
68
|
+
var className = props.className, autoFocus = props.autoFocus, size = props.size, placeholder = props.placeholder, label = props.label, hintText = props.hintText, hintIcon = props.hintIcon, _a = props.disabled, disabled = _a === void 0 ? false : _a, error = props.error, positive = props.positive, onChange = props.onChange, values = props.values, other = __rest(props, ["className", "autoFocus", "size", "placeholder", "label", "hintText", "hintIcon", "disabled", "error", "positive", "onChange", "values"]);
|
|
69
|
+
return (_jsxs(PinInputWrapper, __assign({ className: className, size: size, ref: ref }, other, { children: [label ? (_jsxs(Label, __assign({ disabled: disabled }, { children: [label, " ", _jsx(PinInputComponent, __assign({}, props))] }))) : (_jsx(PinInputComponent, __assign({}, props))), hintText && (_jsxs(Hint, __assign({ color: error ? "activeDanger" : positive ? "activeSuccess" : "default", disabled: disabled }, { children: [hintIcon, hintText] })))] })));
|
|
70
|
+
});
|
|
71
|
+
function PinInputComponent(props) {
|
|
72
|
+
var autoFocus = props.autoFocus, size = props.size, placeholder = props.placeholder, _a = props.disabled, disabled = _a === void 0 ? false : _a, error = props.error, positive = props.positive, onChange = props.onChange, values = props.values;
|
|
73
|
+
var _b = useState([]), focus = _b[0], setFocus = _b[1];
|
|
74
|
+
var refs = useRef([]);
|
|
75
|
+
return (_jsx(PinInputContainer, { children: values.map(function (value, i) { return (_jsx(SqaureInput, { color: error
|
|
76
|
+
? "activeDanger"
|
|
77
|
+
: positive
|
|
78
|
+
? "activeSuccess"
|
|
79
|
+
: focus[i]
|
|
80
|
+
? "activePrimary"
|
|
81
|
+
: "default", inputRef: function (element) {
|
|
82
|
+
refs.current[i] = element;
|
|
83
|
+
}, onChange: function (event) {
|
|
84
|
+
var _a;
|
|
85
|
+
var eventValue = event.target.value;
|
|
86
|
+
if (eventValue.length > 2) {
|
|
87
|
+
// 복붙으로 입력을 입력한 경우
|
|
88
|
+
if (eventValue.length === values.length &&
|
|
89
|
+
eventValue.match(/^[0-9]+$/)) {
|
|
90
|
+
onChange({ values: eventValue.split(""), event: event });
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
// 값을 지웠을 때
|
|
95
|
+
if (eventValue === "") {
|
|
96
|
+
var newValues = values.slice();
|
|
97
|
+
newValues[i] = "";
|
|
98
|
+
onChange({ values: newValues, event: event });
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
// 원래 값이 있었고, 새 값을 입력했을 때
|
|
102
|
+
// 입력 완료된 값(2자리)으로부터 새로 입력한 숫자를 추출한다.
|
|
103
|
+
var currentValue = values[i];
|
|
104
|
+
var newValue = eventValue;
|
|
105
|
+
if (currentValue[0] === eventValue[0]) {
|
|
106
|
+
// 예) 이전 값: '2', 입력된 상태: '23' 인 경우
|
|
107
|
+
newValue = eventValue[1]; // 뒷 자리가 새로 입력된 숫자
|
|
108
|
+
}
|
|
109
|
+
else if (currentValue[0] === eventValue[1]) {
|
|
110
|
+
// 예) 이전 값: '2', 입력된 상태: '32' 인 경우
|
|
111
|
+
newValue = eventValue[0]; // 앞 자리가 새로 입력된 숫자
|
|
112
|
+
}
|
|
113
|
+
// 새로 입력된 값이 숫자일때만 onChange를 실행
|
|
114
|
+
if (newValue.match(/^[0-9]$/)) {
|
|
115
|
+
var newValues = values.slice();
|
|
116
|
+
newValues[i] = newValue;
|
|
117
|
+
onChange({ values: newValues, event: event });
|
|
118
|
+
// 자동으로 다음 input으로 포커스 이동시킴.
|
|
119
|
+
if (i < values.length - 1) {
|
|
120
|
+
(_a = refs.current[i + 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}, placeholder: focus[i] ? "" : placeholder, disabled: disabled, size: size, inputProps: {
|
|
124
|
+
autoFocus: autoFocus ? i === 0 : false,
|
|
125
|
+
onBlur: function () { return updateFocus(false, i, setFocus); },
|
|
126
|
+
onFocus: function () { return updateFocus(true, i, setFocus); },
|
|
127
|
+
onKeyDown: function (e) {
|
|
128
|
+
var _a;
|
|
129
|
+
// Backspace 키로 이전 input으로의 포커스 이동
|
|
130
|
+
if (e.key === "Backspace" && values[i] === "" && i > 0) {
|
|
131
|
+
(_a = refs.current[i - 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
}, fullWidth: true, value: value }, i)); }) }));
|
|
135
|
+
}
|
|
136
|
+
var PinInputWrapper = styled.span(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n display: inline-flex;\n flex-direction: column;\n gap: 8px;\n ", "\n"], ["\n display: inline-flex;\n flex-direction: column;\n gap: 8px;\n ", "\n"])), function (_a) {
|
|
137
|
+
var size = _a.size;
|
|
138
|
+
return SIZE_TO_FONT_STYLES(size);
|
|
139
|
+
});
|
|
140
|
+
var PinInputContainer = styled.span(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n display: inline-flex;\n gap: 8px;\n"], ["\n display: inline-flex;\n gap: 8px;\n"])));
|
|
141
|
+
var SqaureInput = styled(InputBase)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n ", "\n padding: 0;\n input {\n text-align: center;\n }\n"], ["\n ", "\n padding: 0;\n input {\n text-align: center;\n }\n"])), function (_a) {
|
|
142
|
+
var size = _a.size;
|
|
143
|
+
return SIZE_TO_STYLES(size);
|
|
144
|
+
});
|
|
145
|
+
var Hint = styled.div(function (_a) {
|
|
146
|
+
var theme = _a.theme, color = _a.color, disabled = _a.disabled;
|
|
147
|
+
return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: 4px;\n ", ";\n "], ["\n display: flex;\n align-items: center;\n gap: 4px;\n ", ";\n "])), COLOR_TO_HINT_STYLES(theme, color, disabled));
|
|
148
|
+
});
|
|
149
|
+
var Label = styled.label(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 8px;\n ", "\n"], ["\n display: flex;\n flex-direction: column;\n gap: 8px;\n ", "\n"])), function (_a) {
|
|
150
|
+
var theme = _a.theme, disabled = _a.disabled;
|
|
151
|
+
return disabled && css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.neutralBaseDisabled);
|
|
152
|
+
});
|
|
153
|
+
export default PinInput;
|
|
154
|
+
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;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { InputHTMLAttributes } from "react";
|
|
3
|
+
export type RadioInputType = "default" | "selected";
|
|
4
|
+
export interface RadioInputProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
/** 라디오 버튼의 선택 여부(Controlled) */
|
|
7
|
+
checked: boolean;
|
|
8
|
+
/** 라디오 버튼의 라벨 */
|
|
9
|
+
label?: string;
|
|
10
|
+
/** 라디오 버튼의 하단 마진(8px) 여부 */
|
|
11
|
+
spacer?: boolean;
|
|
12
|
+
/** 라디오 버튼의 비활성화 여부 */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** 라디오 버튼 선택값 변경시 호출되는 함수 */
|
|
15
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
16
|
+
/** HTML input 태그에 전달될 props */
|
|
17
|
+
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=420-3704&t=lvpbJKdtz7Lb8wIQ-0)
|
|
21
|
+
*/
|
|
22
|
+
declare const RadioInput: React.ForwardRefExoticComponent<RadioInputProps & React.RefAttributes<any>>;
|
|
23
|
+
export default RadioInput;
|