@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.
Files changed (144) hide show
  1. package/dist/CodleDesignSystemProvider.d.ts +69 -0
  2. package/dist/CodleDesignSystemProvider.js +96 -0
  3. package/dist/components/AlertDialog/AlertDialog.d.ts +14 -0
  4. package/dist/components/AlertDialog/AlertDialog.js +45 -0
  5. package/dist/components/AlertDialog/AlertDialogActions.d.ts +8 -0
  6. package/dist/components/AlertDialog/AlertDialogActions.js +35 -0
  7. package/dist/components/AlertDialog/AlertDialogContent.d.ts +8 -0
  8. package/dist/components/AlertDialog/AlertDialogContent.js +36 -0
  9. package/dist/components/AlertDialog/AlertDialogTitle.d.ts +13 -0
  10. package/dist/components/AlertDialog/AlertDialogTitle.js +38 -0
  11. package/dist/components/AlertDialog/index.d.ts +4 -0
  12. package/dist/components/AlertDialog/index.js +4 -0
  13. package/dist/components/Banner.d.ts +29 -0
  14. package/dist/components/Banner.js +65 -0
  15. package/dist/components/Button.d.ts +31 -0
  16. package/dist/components/Button.js +72 -0
  17. package/dist/components/CheckboxInput.d.ts +27 -0
  18. package/dist/components/CheckboxInput.js +77 -0
  19. package/dist/components/Input.d.ts +17 -0
  20. package/dist/components/Input.js +73 -0
  21. package/dist/components/InputBase.d.ts +42 -0
  22. package/dist/components/InputBase.js +52 -0
  23. package/dist/components/Pagination.d.ts +27 -0
  24. package/dist/components/Pagination.js +32 -0
  25. package/dist/components/PinInput.d.ts +36 -0
  26. package/dist/components/PinInput.js +154 -0
  27. package/dist/components/RadioInput.d.ts +23 -0
  28. package/dist/components/RadioInput.js +78 -0
  29. package/dist/components/SquareButton.d.ts +26 -0
  30. package/dist/components/SquareButton.js +80 -0
  31. package/dist/components/Switch.d.ts +19 -0
  32. package/dist/components/Switch.js +59 -0
  33. package/dist/components/Tag.d.ts +21 -0
  34. package/dist/components/Tag.js +61 -0
  35. package/dist/components/Tooltip.d.ts +26 -0
  36. package/dist/components/Tooltip.js +50 -0
  37. package/dist/foundation/color.d.ts +75 -0
  38. package/dist/foundation/color.js +75 -0
  39. package/dist/foundation/shadows.d.ts +9 -0
  40. package/dist/foundation/shadows.js +10 -0
  41. package/dist/icons/Arrows/index.d.ts +2 -0
  42. package/dist/icons/Arrows/index.js +2 -0
  43. package/dist/icons/Media/index.d.ts +2 -0
  44. package/dist/icons/Media/index.js +2 -0
  45. package/dist/icons/System/index.d.ts +2 -0
  46. package/dist/icons/System/index.js +2 -0
  47. package/dist/icons/arrows.d.ts +28 -0
  48. package/dist/icons/arrows.js +21 -0
  49. package/dist/icons/brand.d.ts +4 -0
  50. package/dist/icons/brand.js +13 -0
  51. package/dist/icons/design.d.ts +4 -0
  52. package/dist/icons/design.js +13 -0
  53. package/dist/icons/map.d.ts +4 -0
  54. package/dist/icons/map.js +13 -0
  55. package/dist/icons/system.d.ts +31 -0
  56. package/dist/icons/system.js +22 -0
  57. package/dist/index.d.ts +44 -0
  58. package/dist/index.js +44 -0
  59. package/dist/patterns/Card/Card.d.ts +39 -0
  60. package/dist/patterns/Card/Card.js +68 -0
  61. package/dist/patterns/Card/class-icon.svg +28 -0
  62. package/dist/patterns/Card/index.d.ts +2 -0
  63. package/dist/patterns/Card/index.js +2 -0
  64. package/dist/patterns/Card/material-icon.svg +25 -0
  65. package/dist/patterns/Card/problem-icon.svg +25 -0
  66. package/dist/patterns/Card/thumbnail/sample.png +0 -0
  67. package/dist/patterns/Dialog/Dialog.d.ts +12 -0
  68. package/dist/patterns/Dialog/Dialog.js +26 -0
  69. package/dist/patterns/Dialog/DialogContent.d.ts +8 -0
  70. package/dist/patterns/Dialog/DialogContent.js +23 -0
  71. package/dist/patterns/Dialog/DialogNavigation.d.ts +12 -0
  72. package/dist/patterns/Dialog/DialogNavigation.js +25 -0
  73. package/dist/patterns/Dialog/DialogNavigationContext.d.ts +5 -0
  74. package/dist/patterns/Dialog/DialogNavigationContext.js +5 -0
  75. package/dist/patterns/Dialog/DialogNavigationItem.d.ts +10 -0
  76. package/dist/patterns/Dialog/DialogNavigationItem.js +25 -0
  77. package/dist/patterns/Dialog/DialogPanel.d.ts +10 -0
  78. package/dist/patterns/Dialog/DialogPanel.js +31 -0
  79. package/dist/patterns/Dialog/DialogPanels.d.ts +13 -0
  80. package/dist/patterns/Dialog/DialogPanels.js +17 -0
  81. package/dist/patterns/Dialog/DialogPanelsContext.d.ts +5 -0
  82. package/dist/patterns/Dialog/DialogPanelsContext.js +5 -0
  83. package/dist/patterns/Dialog/DialogTitle.d.ts +13 -0
  84. package/dist/patterns/Dialog/DialogTitle.js +26 -0
  85. package/dist/patterns/Dialog/index.d.ts +7 -0
  86. package/dist/patterns/Dialog/index.js +7 -0
  87. package/dist/patterns/Dropdown/Dropdown.d.ts +27 -0
  88. package/dist/patterns/Dropdown/Dropdown.js +41 -0
  89. package/dist/patterns/Dropdown/DropdownItem.d.ts +42 -0
  90. package/dist/patterns/Dropdown/DropdownItem.js +89 -0
  91. package/dist/patterns/Dropdown/DropdownMenu.d.ts +30 -0
  92. package/dist/patterns/Dropdown/DropdownMenu.js +85 -0
  93. package/dist/patterns/Dropdown/index.d.ts +2 -0
  94. package/dist/patterns/Dropdown/index.js +2 -0
  95. package/dist/patterns/EmptyState/EmptyState.d.ts +16 -0
  96. package/dist/patterns/EmptyState/EmptyState.js +36 -0
  97. package/dist/patterns/EmptyState/empty-state-icon.svg +36 -0
  98. package/dist/patterns/EmptyState/index.d.ts +2 -0
  99. package/dist/patterns/EmptyState/index.js +2 -0
  100. package/dist/patterns/Navigation/NavigationContext.d.ts +5 -0
  101. package/dist/patterns/Navigation/NavigationContext.js +5 -0
  102. package/dist/patterns/Navigation/NavigationHorizontal.d.ts +11 -0
  103. package/dist/patterns/Navigation/NavigationHorizontal.js +27 -0
  104. package/dist/patterns/Navigation/NavigationItem.d.ts +9 -0
  105. package/dist/patterns/Navigation/NavigationItem.js +33 -0
  106. package/dist/patterns/Navigation/NavigationVertical.d.ts +14 -0
  107. package/dist/patterns/Navigation/NavigationVertical.js +27 -0
  108. package/dist/patterns/Navigation/index.d.ts +3 -0
  109. package/dist/patterns/Navigation/index.js +3 -0
  110. package/dist/patterns/SegmentedControl/SegmentedControlButton.d.ts +8 -0
  111. package/dist/patterns/SegmentedControl/SegmentedControlButton.js +57 -0
  112. package/dist/patterns/SegmentedControl/SegmentedControlGroup.d.ts +26 -0
  113. package/dist/patterns/SegmentedControl/SegmentedControlGroup.js +50 -0
  114. package/dist/patterns/SegmentedControl/SegmentedControlGroupPropsContext.d.ts +5 -0
  115. package/dist/patterns/SegmentedControl/SegmentedControlGroupPropsContext.js +5 -0
  116. package/dist/patterns/SegmentedControl/SegmentedControlSquareButton.d.ts +8 -0
  117. package/dist/patterns/SegmentedControl/SegmentedControlSquareButton.js +45 -0
  118. package/dist/patterns/SegmentedControl/index.d.ts +3 -0
  119. package/dist/patterns/SegmentedControl/index.js +3 -0
  120. package/dist/patterns/Table/Table.d.ts +18 -0
  121. package/dist/patterns/Table/Table.js +33 -0
  122. package/dist/patterns/Table/TableBody.d.ts +8 -0
  123. package/dist/patterns/Table/TableBody.js +26 -0
  124. package/dist/patterns/Table/TableCell.d.ts +15 -0
  125. package/dist/patterns/Table/TableCell.js +78 -0
  126. package/dist/patterns/Table/TableHead.d.ts +8 -0
  127. package/dist/patterns/Table/TableHead.js +26 -0
  128. package/dist/patterns/Table/TablePropsContext.d.ts +7 -0
  129. package/dist/patterns/Table/TablePropsContext.js +3 -0
  130. package/dist/patterns/Table/TableRow.d.ts +14 -0
  131. package/dist/patterns/Table/TableRow.js +34 -0
  132. package/dist/patterns/Table/TableVariantContext.d.ts +6 -0
  133. package/dist/patterns/Table/TableVariantContext.js +3 -0
  134. package/dist/patterns/Table/index.d.ts +7 -0
  135. package/dist/patterns/Table/index.js +6 -0
  136. package/dist/utils/hover.d.ts +3 -0
  137. package/dist/utils/hover.js +14 -0
  138. package/dist/utils/reset.d.ts +2 -0
  139. package/dist/utils/reset.js +8 -0
  140. package/dist/utils/zIndex.d.ts +3 -0
  141. package/dist/utils/zIndex.js +3 -0
  142. package/package.json +3 -2
  143. package/src/cds/index.ts +1 -1
  144. package/src/cds/patterns/SegmentedControl/SegmentedControlButton.tsx +22 -8
@@ -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,73 @@
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
+ var _className = props.className, inputBaseProps = __rest(props, ["className"]);
55
+ 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({}, inputBaseProps))] }))) : (_jsx(InputBase, __assign({}, inputBaseProps))), hintText && (_jsxs(Hint, __assign({ color: props.color, disabled: props.disabled }, { children: [hintIcon, hintText] })))] })));
56
+ });
57
+ 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) {
58
+ var size = _a.size;
59
+ return SIZE_TO_FONT_STYLES(size);
60
+ }, function (_a) {
61
+ var fullWidth = _a.fullWidth;
62
+ return fullWidth && "width: 100%;";
63
+ });
64
+ 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) {
65
+ var theme = _a.theme, disabled = _a.disabled;
66
+ return disabled && css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), theme.color.foreground.neutralBaseDisabled);
67
+ });
68
+ var Hint = styled.div(function (_a) {
69
+ var theme = _a.theme, color = _a.color, disabled = _a.disabled;
70
+ 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));
71
+ });
72
+ export default Input;
73
+ 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;