@x-plat/design-system 0.8.3 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AutoResizeTextArea/index.cjs +140 -4
- package/dist/components/AutoResizeTextArea/index.css +38 -0
- package/dist/components/AutoResizeTextArea/index.d.cts +4 -0
- package/dist/components/AutoResizeTextArea/index.d.ts +4 -0
- package/dist/components/AutoResizeTextArea/index.js +140 -4
- package/dist/components/Badge/index.cjs +5 -1
- package/dist/components/Badge/index.css +1 -0
- package/dist/components/Badge/index.d.cts +1 -0
- package/dist/components/Badge/index.d.ts +1 -0
- package/dist/components/Badge/index.js +5 -1
- package/dist/components/Box/index.d.cts +3 -0
- package/dist/components/Box/index.d.ts +3 -0
- package/dist/components/Chart/index.cjs +7 -6
- package/dist/components/Chart/index.d.cts +12 -1
- package/dist/components/Chart/index.d.ts +12 -1
- package/dist/components/Chart/index.js +7 -6
- package/dist/components/ChatInput/index.cjs +150 -9
- package/dist/components/ChatInput/index.css +38 -0
- package/dist/components/ChatInput/index.d.cts +9 -0
- package/dist/components/ChatInput/index.d.ts +9 -0
- package/dist/components/ChatInput/index.js +151 -10
- package/dist/components/CheckBox/index.cjs +137 -6
- package/dist/components/CheckBox/index.css +40 -0
- package/dist/components/CheckBox/index.d.cts +13 -2
- package/dist/components/CheckBox/index.d.ts +13 -2
- package/dist/components/CheckBox/index.js +137 -6
- package/dist/components/Chip/index.d.cts +2 -0
- package/dist/components/Chip/index.d.ts +2 -0
- package/dist/components/DatePicker/index.cjs +76 -62
- package/dist/components/DatePicker/index.css +38 -31
- package/dist/components/DatePicker/index.js +42 -28
- package/dist/components/Drawer/index.d.cts +1 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/FieldMessage/index.cjs +183 -0
- package/dist/components/FieldMessage/index.css +37 -0
- package/dist/components/FieldMessage/index.d.cts +37 -0
- package/dist/components/FieldMessage/index.d.ts +37 -0
- package/dist/components/FieldMessage/index.js +154 -0
- package/dist/components/FileUpload/index.cjs +135 -8
- package/dist/components/FileUpload/index.css +38 -0
- package/dist/components/FileUpload/index.d.cts +9 -0
- package/dist/components/FileUpload/index.d.ts +9 -0
- package/dist/components/FileUpload/index.js +135 -8
- package/dist/components/ImageSelector/index.cjs +153 -11
- package/dist/components/ImageSelector/index.css +38 -0
- package/dist/components/ImageSelector/index.d.cts +6 -0
- package/dist/components/ImageSelector/index.d.ts +6 -0
- package/dist/components/ImageSelector/index.js +153 -11
- package/dist/components/Input/index.cjs +38 -25
- package/dist/components/Input/index.css +38 -31
- package/dist/components/Input/index.d.cts +7 -8
- package/dist/components/Input/index.d.ts +7 -8
- package/dist/components/Input/index.js +36 -23
- package/dist/components/NotificationBadge/index.cjs +5 -1
- package/dist/components/NotificationBadge/index.css +1 -0
- package/dist/components/NotificationBadge/index.d.cts +6 -2
- package/dist/components/NotificationBadge/index.d.ts +6 -2
- package/dist/components/NotificationBadge/index.js +5 -1
- package/dist/components/Pagination/index.cjs +6 -2
- package/dist/components/Pagination/index.css +1 -0
- package/dist/components/Pagination/index.d.cts +13 -2
- package/dist/components/Pagination/index.d.ts +13 -2
- package/dist/components/Pagination/index.js +6 -2
- package/dist/components/Progress/index.cjs +6 -2
- package/dist/components/Progress/index.css +1 -0
- package/dist/components/Progress/index.d.cts +11 -2
- package/dist/components/Progress/index.d.ts +11 -2
- package/dist/components/Progress/index.js +6 -2
- package/dist/components/Radio/index.cjs +158 -10
- package/dist/components/Radio/index.css +40 -0
- package/dist/components/Radio/index.d.cts +14 -2
- package/dist/components/Radio/index.d.ts +14 -2
- package/dist/components/Radio/index.js +158 -10
- package/dist/components/Select/index.cjs +139 -13
- package/dist/components/Select/index.css +38 -0
- package/dist/components/Select/index.d.cts +8 -1
- package/dist/components/Select/index.d.ts +8 -1
- package/dist/components/Select/index.js +139 -13
- package/dist/components/Skeleton/index.d.cts +3 -0
- package/dist/components/Skeleton/index.d.ts +3 -0
- package/dist/components/Spinner/index.cjs +6 -2
- package/dist/components/Spinner/index.css +1 -0
- package/dist/components/Spinner/index.d.cts +8 -2
- package/dist/components/Spinner/index.d.ts +8 -2
- package/dist/components/Spinner/index.js +6 -2
- package/dist/components/Steps/index.cjs +6 -2
- package/dist/components/Steps/index.css +11 -0
- package/dist/components/Steps/index.d.cts +9 -2
- package/dist/components/Steps/index.d.ts +9 -2
- package/dist/components/Steps/index.js +6 -2
- package/dist/components/Switch/index.cjs +146 -6
- package/dist/components/Switch/index.css +40 -0
- package/dist/components/Switch/index.d.cts +13 -2
- package/dist/components/Switch/index.d.ts +13 -2
- package/dist/components/Switch/index.js +146 -6
- package/dist/components/Tab/index.cjs +4 -3
- package/dist/components/Tab/index.d.cts +12 -1
- package/dist/components/Tab/index.d.ts +12 -1
- package/dist/components/Tab/index.js +4 -3
- package/dist/components/Tag/index.cjs +5 -3
- package/dist/components/Tag/index.d.cts +12 -2
- package/dist/components/Tag/index.d.ts +12 -2
- package/dist/components/Tag/index.js +5 -3
- package/dist/components/TextArea/index.cjs +138 -2
- package/dist/components/TextArea/index.css +38 -0
- package/dist/components/TextArea/index.d.cts +6 -0
- package/dist/components/TextArea/index.d.ts +6 -0
- package/dist/components/TextArea/index.js +138 -2
- package/dist/components/Tooltip/index.cjs +4 -2
- package/dist/components/Tooltip/index.d.cts +11 -1
- package/dist/components/Tooltip/index.d.ts +11 -1
- package/dist/components/Tooltip/index.js +4 -2
- package/dist/components/index.cjs +479 -408
- package/dist/components/index.css +59 -31
- package/dist/components/index.d.cts +3 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +262 -194
- package/dist/index.cjs +484 -413
- package/dist/index.css +59 -31
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +264 -196
- package/dist/status-g_KP3qT6.d.cts +8 -0
- package/dist/status-g_KP3qT6.d.ts +8 -0
- package/dist/validation-Dqo1zqhT.d.cts +13 -0
- package/dist/validation-Dqo1zqhT.d.ts +13 -0
- package/guidelines/AGENT_PROMPT.md +15 -0
- package/guidelines/components/card.md +3 -3
- package/guidelines/components/feedback.md +1 -1
- package/guidelines/components/form.md +26 -0
- package/guidelines/components/navigation.md +16 -15
- package/guidelines/components/overlay.md +43 -4
- package/package.json +1 -1
|
@@ -53,12 +53,145 @@ function clsx() {
|
|
|
53
53
|
}
|
|
54
54
|
var clsx_default = clsx;
|
|
55
55
|
|
|
56
|
-
// src/
|
|
56
|
+
// src/tokens/svg/status/ErrorIcon.tsx
|
|
57
57
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
58
|
+
var ErrorIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
59
|
+
"svg",
|
|
60
|
+
{
|
|
61
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
62
|
+
width: "1em",
|
|
63
|
+
height: "1em",
|
|
64
|
+
viewBox: "0 0 16 16",
|
|
65
|
+
fill: "none",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { clipPath: "url(#clip0_1196_9603)", children: [
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
+
"path",
|
|
70
|
+
{
|
|
71
|
+
d: "M9.57588 5.57559C9.81019 5.34127 10.19 5.34127 10.4243 5.57559C10.6586 5.8099 10.6586 6.18971 10.4243 6.42402L8.84854 7.9998L10.4243 9.57559C10.6586 9.8099 10.6586 10.1897 10.4243 10.424C10.19 10.6583 9.81019 10.6583 9.57588 10.424L8.0001 8.84824L6.42432 10.424C6.19 10.6583 5.81019 10.6583 5.57588 10.424C5.34156 10.1897 5.34156 9.8099 5.57588 9.57559L7.15166 7.9998L5.57588 6.42402C5.34156 6.18971 5.34156 5.8099 5.57588 5.57559C5.81019 5.34127 6.19 5.34127 6.42432 5.57559L8.0001 7.15137L9.57588 5.57559Z",
|
|
72
|
+
fill: "currentColor"
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
76
|
+
"path",
|
|
77
|
+
{
|
|
78
|
+
fillRule: "evenodd",
|
|
79
|
+
clipRule: "evenodd",
|
|
80
|
+
d: "M8.0001 0.733398C12.0131 0.73361 15.2671 3.98679 15.2673 7.9998C15.2672 12.0129 12.0131 15.2668 8.0001 15.267C3.98701 15.2669 0.733016 12.0129 0.73291 7.9998C0.733051 3.98674 3.98704 0.733539 8.0001 0.733398ZM8.0001 1.9334C4.64978 1.93354 1.93383 4.64948 1.93369 7.9998C1.9338 11.3502 4.64975 14.0669 8.0001 14.067C11.3504 14.0668 14.0672 11.3501 14.0673 7.9998C14.0671 4.64953 11.3504 1.93361 8.0001 1.9334Z",
|
|
81
|
+
fill: "currentColor"
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
] }),
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("clipPath", { id: "clip0_1196_9603", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
var ErrorIcon_default = ErrorIcon;
|
|
90
|
+
|
|
91
|
+
// src/tokens/svg/status/InfoIcon.tsx
|
|
92
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
93
|
+
var InfoIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
94
|
+
"svg",
|
|
95
|
+
{
|
|
96
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
97
|
+
width: "1em",
|
|
98
|
+
height: "1em",
|
|
99
|
+
viewBox: "0 0 16 16",
|
|
100
|
+
fill: "none",
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { clipPath: "url(#clip0_1188_11261)", children: [
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
104
|
+
"path",
|
|
105
|
+
{
|
|
106
|
+
d: "M8.00156 7.39999C8.33293 7.39999 8.60156 7.66862 8.60156 7.99999V10.6664C8.60156 10.9978 8.33293 11.2664 8.00156 11.2664C7.67019 11.2664 7.40156 10.9978 7.40156 10.6664V7.99999C7.40156 7.66862 7.67019 7.39999 8.00156 7.39999Z",
|
|
107
|
+
fill: "currentColor"
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
111
|
+
"path",
|
|
112
|
+
{
|
|
113
|
+
d: "M8.00859 4.73358C8.3398 4.73378 8.60859 5.00233 8.60859 5.33358C8.60849 5.66474 8.33973 5.93338 8.00859 5.93358H8.00156C7.67026 5.93358 7.40167 5.66486 7.40156 5.33358C7.40156 5.00221 7.67019 4.73358 8.00156 4.73358H8.00859Z",
|
|
114
|
+
fill: "currentColor"
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
118
|
+
"path",
|
|
119
|
+
{
|
|
120
|
+
fillRule: "evenodd",
|
|
121
|
+
clipRule: "evenodd",
|
|
122
|
+
d: "M8.00156 0.733582C12.0146 0.733793 15.2686 3.98697 15.2688 7.99999C15.2686 12.013 12.0146 15.267 8.00156 15.2672C3.98848 15.267 0.734481 12.0131 0.734375 7.99999C0.734516 3.98693 3.9885 0.733722 8.00156 0.733582ZM8.00156 1.93358C4.65124 1.93372 1.9353 4.64967 1.93516 7.99999C1.93526 11.3503 4.65122 14.067 8.00156 14.0672C11.3518 14.067 14.0686 11.3503 14.0688 7.99999C14.0686 4.64971 11.3518 1.93379 8.00156 1.93358Z",
|
|
123
|
+
fill: "currentColor"
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] }),
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("clipPath", { id: "clip0_1188_11261", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
var InfoIcon_default = InfoIcon;
|
|
132
|
+
|
|
133
|
+
// src/tokens/svg/status/SuccessIcon.tsx
|
|
134
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
135
|
+
var SuccessIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
136
|
+
"svg",
|
|
137
|
+
{
|
|
138
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
139
|
+
width: "1em",
|
|
140
|
+
height: "1em",
|
|
141
|
+
viewBox: "0 0 16 16",
|
|
142
|
+
fill: "none",
|
|
143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
144
|
+
"path",
|
|
145
|
+
{
|
|
146
|
+
d: "M12.9084 3.57597C13.1426 3.34172 13.5225 3.34185 13.7568 3.57597C13.9911 3.81028 13.9911 4.19009 13.7568 4.4244L6.424 11.758C6.31157 11.8703 6.15869 11.9337 5.99978 11.9338C5.8409 11.9337 5.68798 11.8703 5.57556 11.758L2.24197 8.4244C2.00782 8.19018 2.00795 7.81028 2.24197 7.57597C2.47626 7.34167 2.85609 7.34172 3.09041 7.57597L5.999 10.4846L12.9084 3.57597Z",
|
|
147
|
+
fill: "currentColor"
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
var SuccessIcon_default = SuccessIcon;
|
|
153
|
+
|
|
154
|
+
// src/components/FieldMessage/FieldMessage.tsx
|
|
155
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
156
|
+
var ICON = {
|
|
157
|
+
default: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon_default, {}),
|
|
158
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SuccessIcon_default, {}),
|
|
159
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon_default, {}),
|
|
160
|
+
error: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorIcon_default, {})
|
|
161
|
+
};
|
|
162
|
+
var FieldMessage = (props) => {
|
|
163
|
+
const { validations } = props;
|
|
164
|
+
if (!validations || validations.length === 0) return null;
|
|
165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "lib-xplat-field-message-wrap", children: validations.map((v, idx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
166
|
+
"div",
|
|
167
|
+
{
|
|
168
|
+
className: clsx_default("lib-xplat-field-message", v.status),
|
|
169
|
+
children: [
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "icon", children: ICON[v.status] }),
|
|
171
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: v.message })
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
`${v.message}_${idx}`
|
|
175
|
+
)) });
|
|
176
|
+
};
|
|
177
|
+
FieldMessage.displayName = "FieldMessage";
|
|
178
|
+
var Field = (props) => {
|
|
179
|
+
const { validations, children } = props;
|
|
180
|
+
if (!validations || validations.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
|
|
181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "lib-xplat-field", children: [
|
|
182
|
+
children,
|
|
183
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldMessage, { validations })
|
|
184
|
+
] });
|
|
185
|
+
};
|
|
186
|
+
Field.displayName = "Field";
|
|
187
|
+
var hasError = (validations) => !!validations?.some((v) => v.status === "error");
|
|
188
|
+
|
|
189
|
+
// src/components/AutoResizeTextArea/AutoResizeTextArea.tsx
|
|
190
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
58
191
|
var MAX_HEIGHT = 400;
|
|
59
192
|
var AutoResizeTextArea = import_react.default.forwardRef(
|
|
60
193
|
(props, ref) => {
|
|
61
|
-
const { value, className, onChange, disabled, bare = false, ...textareaProps } = props;
|
|
194
|
+
const { value, className, onChange, disabled, bare = false, validations, ...textareaProps } = props;
|
|
62
195
|
const localRef = import_react.default.useRef(null);
|
|
63
196
|
const setRefs = (el) => {
|
|
64
197
|
localRef.current = el;
|
|
@@ -86,9 +219,10 @@ var AutoResizeTextArea = import_react.default.forwardRef(
|
|
|
86
219
|
updateHeight();
|
|
87
220
|
}, [value]);
|
|
88
221
|
if (bare) {
|
|
89
|
-
return /* @__PURE__ */ (0,
|
|
222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
90
223
|
"textarea",
|
|
91
224
|
{
|
|
225
|
+
"aria-invalid": hasError(validations) || void 0,
|
|
92
226
|
...textareaProps,
|
|
93
227
|
ref: setRefs,
|
|
94
228
|
className,
|
|
@@ -98,9 +232,10 @@ var AutoResizeTextArea = import_react.default.forwardRef(
|
|
|
98
232
|
}
|
|
99
233
|
);
|
|
100
234
|
}
|
|
101
|
-
|
|
235
|
+
const control = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: clsx_default("lib-xplat-auto-resize-textarea-wrapper", className), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: clsx_default("lib-xplat-auto-resize-textarea", disabled && "disabled"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
102
236
|
"textarea",
|
|
103
237
|
{
|
|
238
|
+
"aria-invalid": hasError(validations) || void 0,
|
|
104
239
|
...textareaProps,
|
|
105
240
|
ref: setRefs,
|
|
106
241
|
disabled,
|
|
@@ -108,6 +243,7 @@ var AutoResizeTextArea = import_react.default.forwardRef(
|
|
|
108
243
|
onChange: handleChange
|
|
109
244
|
}
|
|
110
245
|
) }) });
|
|
246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Field, { validations, children: control });
|
|
111
247
|
}
|
|
112
248
|
);
|
|
113
249
|
AutoResizeTextArea.displayName = "AutoResizeTextArea";
|
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
/* src/components/FieldMessage/fieldMessage.scss */
|
|
2
|
+
.lib-xplat-field {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--spacing-space-2);
|
|
6
|
+
}
|
|
7
|
+
.lib-xplat-field-message-wrap {
|
|
8
|
+
display: flex;
|
|
9
|
+
gap: var(--spacing-space-2);
|
|
10
|
+
margin-left: var(--spacing-space-1);
|
|
11
|
+
}
|
|
12
|
+
.lib-xplat-field-message-wrap > .lib-xplat-field-message {
|
|
13
|
+
display: flex;
|
|
14
|
+
gap: var(--spacing-space-1);
|
|
15
|
+
font-family: var(--semantic-typo-caption-2-r-font);
|
|
16
|
+
font-size: var(--semantic-typo-caption-2-r-size);
|
|
17
|
+
line-height: var(--semantic-typo-caption-2-r-lh);
|
|
18
|
+
font-weight: var(--semantic-typo-caption-2-r-weight);
|
|
19
|
+
letter-spacing: var(--semantic-typo-caption-2-r-ls);
|
|
20
|
+
align-items: center;
|
|
21
|
+
user-select: none;
|
|
22
|
+
}
|
|
23
|
+
.lib-xplat-field-message-wrap > .lib-xplat-field-message.default {
|
|
24
|
+
color: var(--semantic-icon-secondary);
|
|
25
|
+
}
|
|
26
|
+
.lib-xplat-field-message-wrap > .lib-xplat-field-message.success {
|
|
27
|
+
color: var(--semantic-text-success);
|
|
28
|
+
}
|
|
29
|
+
.lib-xplat-field-message-wrap > .lib-xplat-field-message.warning {
|
|
30
|
+
color: var(--semantic-text-warning);
|
|
31
|
+
}
|
|
32
|
+
.lib-xplat-field-message-wrap > .lib-xplat-field-message.error {
|
|
33
|
+
color: var(--semantic-text-error);
|
|
34
|
+
}
|
|
35
|
+
.lib-xplat-field-message-wrap > .lib-xplat-field-message > .icon {
|
|
36
|
+
font-size: var(--semantic-typo-label-2-m-size);
|
|
37
|
+
}
|
|
38
|
+
|
|
1
39
|
/* src/components/AutoResizeTextArea/autoResizeTextArea.scss */
|
|
2
40
|
.lib-xplat-auto-resize-textarea-wrapper {
|
|
3
41
|
display: flex;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { T as TextareaAttributes } from '../../attributes-DJIWir_0.cjs';
|
|
3
|
+
import { V as Validation } from '../../validation-Dqo1zqhT.cjs';
|
|
3
4
|
|
|
4
5
|
interface AutoResizeTextAreaProps extends TextareaAttributes {
|
|
5
6
|
/** ChatInput 등 내부 임베딩 시 wrapper 없이 textarea만 렌더 */
|
|
7
|
+
/** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
|
|
8
|
+
validations?: Validation[];
|
|
9
|
+
/** 테두리와 배경을 없앤다. ChatInput 처럼 감싸는 쪽이 껍데기를 그릴 때 */
|
|
6
10
|
bare?: boolean;
|
|
7
11
|
}
|
|
8
12
|
declare const AutoResizeTextArea: React.ForwardRefExoticComponent<AutoResizeTextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { T as TextareaAttributes } from '../../attributes-DJIWir_0.js';
|
|
3
|
+
import { V as Validation } from '../../validation-Dqo1zqhT.js';
|
|
3
4
|
|
|
4
5
|
interface AutoResizeTextAreaProps extends TextareaAttributes {
|
|
5
6
|
/** ChatInput 등 내부 임베딩 시 wrapper 없이 textarea만 렌더 */
|
|
7
|
+
/** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
|
|
8
|
+
validations?: Validation[];
|
|
9
|
+
/** 테두리와 배경을 없앤다. ChatInput 처럼 감싸는 쪽이 껍데기를 그릴 때 */
|
|
6
10
|
bare?: boolean;
|
|
7
11
|
}
|
|
8
12
|
declare const AutoResizeTextArea: React.ForwardRefExoticComponent<AutoResizeTextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -17,12 +17,145 @@ function clsx() {
|
|
|
17
17
|
}
|
|
18
18
|
var clsx_default = clsx;
|
|
19
19
|
|
|
20
|
+
// src/tokens/svg/status/ErrorIcon.tsx
|
|
21
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
var ErrorIcon = () => /* @__PURE__ */ jsxs(
|
|
23
|
+
"svg",
|
|
24
|
+
{
|
|
25
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
26
|
+
width: "1em",
|
|
27
|
+
height: "1em",
|
|
28
|
+
viewBox: "0 0 16 16",
|
|
29
|
+
fill: "none",
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("g", { clipPath: "url(#clip0_1196_9603)", children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
"path",
|
|
34
|
+
{
|
|
35
|
+
d: "M9.57588 5.57559C9.81019 5.34127 10.19 5.34127 10.4243 5.57559C10.6586 5.8099 10.6586 6.18971 10.4243 6.42402L8.84854 7.9998L10.4243 9.57559C10.6586 9.8099 10.6586 10.1897 10.4243 10.424C10.19 10.6583 9.81019 10.6583 9.57588 10.424L8.0001 8.84824L6.42432 10.424C6.19 10.6583 5.81019 10.6583 5.57588 10.424C5.34156 10.1897 5.34156 9.8099 5.57588 9.57559L7.15166 7.9998L5.57588 6.42402C5.34156 6.18971 5.34156 5.8099 5.57588 5.57559C5.81019 5.34127 6.19 5.34127 6.42432 5.57559L8.0001 7.15137L9.57588 5.57559Z",
|
|
36
|
+
fill: "currentColor"
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
"path",
|
|
41
|
+
{
|
|
42
|
+
fillRule: "evenodd",
|
|
43
|
+
clipRule: "evenodd",
|
|
44
|
+
d: "M8.0001 0.733398C12.0131 0.73361 15.2671 3.98679 15.2673 7.9998C15.2672 12.0129 12.0131 15.2668 8.0001 15.267C3.98701 15.2669 0.733016 12.0129 0.73291 7.9998C0.733051 3.98674 3.98704 0.733539 8.0001 0.733398ZM8.0001 1.9334C4.64978 1.93354 1.93383 4.64948 1.93369 7.9998C1.9338 11.3502 4.64975 14.0669 8.0001 14.067C11.3504 14.0668 14.0672 11.3501 14.0673 7.9998C14.0671 4.64953 11.3504 1.93361 8.0001 1.9334Z",
|
|
45
|
+
fill: "currentColor"
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_1196_9603", children: /* @__PURE__ */ jsx("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
var ErrorIcon_default = ErrorIcon;
|
|
54
|
+
|
|
55
|
+
// src/tokens/svg/status/InfoIcon.tsx
|
|
56
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
57
|
+
var InfoIcon = () => /* @__PURE__ */ jsxs2(
|
|
58
|
+
"svg",
|
|
59
|
+
{
|
|
60
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
61
|
+
width: "1em",
|
|
62
|
+
height: "1em",
|
|
63
|
+
viewBox: "0 0 16 16",
|
|
64
|
+
fill: "none",
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ jsxs2("g", { clipPath: "url(#clip0_1188_11261)", children: [
|
|
67
|
+
/* @__PURE__ */ jsx2(
|
|
68
|
+
"path",
|
|
69
|
+
{
|
|
70
|
+
d: "M8.00156 7.39999C8.33293 7.39999 8.60156 7.66862 8.60156 7.99999V10.6664C8.60156 10.9978 8.33293 11.2664 8.00156 11.2664C7.67019 11.2664 7.40156 10.9978 7.40156 10.6664V7.99999C7.40156 7.66862 7.67019 7.39999 8.00156 7.39999Z",
|
|
71
|
+
fill: "currentColor"
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ jsx2(
|
|
75
|
+
"path",
|
|
76
|
+
{
|
|
77
|
+
d: "M8.00859 4.73358C8.3398 4.73378 8.60859 5.00233 8.60859 5.33358C8.60849 5.66474 8.33973 5.93338 8.00859 5.93358H8.00156C7.67026 5.93358 7.40167 5.66486 7.40156 5.33358C7.40156 5.00221 7.67019 4.73358 8.00156 4.73358H8.00859Z",
|
|
78
|
+
fill: "currentColor"
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ jsx2(
|
|
82
|
+
"path",
|
|
83
|
+
{
|
|
84
|
+
fillRule: "evenodd",
|
|
85
|
+
clipRule: "evenodd",
|
|
86
|
+
d: "M8.00156 0.733582C12.0146 0.733793 15.2686 3.98697 15.2688 7.99999C15.2686 12.013 12.0146 15.267 8.00156 15.2672C3.98848 15.267 0.734481 12.0131 0.734375 7.99999C0.734516 3.98693 3.9885 0.733722 8.00156 0.733582ZM8.00156 1.93358C4.65124 1.93372 1.9353 4.64967 1.93516 7.99999C1.93526 11.3503 4.65122 14.067 8.00156 14.0672C11.3518 14.067 14.0686 11.3503 14.0688 7.99999C14.0686 4.64971 11.3518 1.93379 8.00156 1.93358Z",
|
|
87
|
+
fill: "currentColor"
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
] }),
|
|
91
|
+
/* @__PURE__ */ jsx2("defs", { children: /* @__PURE__ */ jsx2("clipPath", { id: "clip0_1188_11261", children: /* @__PURE__ */ jsx2("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
var InfoIcon_default = InfoIcon;
|
|
96
|
+
|
|
97
|
+
// src/tokens/svg/status/SuccessIcon.tsx
|
|
98
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
99
|
+
var SuccessIcon = () => /* @__PURE__ */ jsx3(
|
|
100
|
+
"svg",
|
|
101
|
+
{
|
|
102
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
103
|
+
width: "1em",
|
|
104
|
+
height: "1em",
|
|
105
|
+
viewBox: "0 0 16 16",
|
|
106
|
+
fill: "none",
|
|
107
|
+
children: /* @__PURE__ */ jsx3(
|
|
108
|
+
"path",
|
|
109
|
+
{
|
|
110
|
+
d: "M12.9084 3.57597C13.1426 3.34172 13.5225 3.34185 13.7568 3.57597C13.9911 3.81028 13.9911 4.19009 13.7568 4.4244L6.424 11.758C6.31157 11.8703 6.15869 11.9337 5.99978 11.9338C5.8409 11.9337 5.68798 11.8703 5.57556 11.758L2.24197 8.4244C2.00782 8.19018 2.00795 7.81028 2.24197 7.57597C2.47626 7.34167 2.85609 7.34172 3.09041 7.57597L5.999 10.4846L12.9084 3.57597Z",
|
|
111
|
+
fill: "currentColor"
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
var SuccessIcon_default = SuccessIcon;
|
|
117
|
+
|
|
118
|
+
// src/components/FieldMessage/FieldMessage.tsx
|
|
119
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
120
|
+
var ICON = {
|
|
121
|
+
default: /* @__PURE__ */ jsx4(InfoIcon_default, {}),
|
|
122
|
+
success: /* @__PURE__ */ jsx4(SuccessIcon_default, {}),
|
|
123
|
+
warning: /* @__PURE__ */ jsx4(InfoIcon_default, {}),
|
|
124
|
+
error: /* @__PURE__ */ jsx4(ErrorIcon_default, {})
|
|
125
|
+
};
|
|
126
|
+
var FieldMessage = (props) => {
|
|
127
|
+
const { validations } = props;
|
|
128
|
+
if (!validations || validations.length === 0) return null;
|
|
129
|
+
return /* @__PURE__ */ jsx4("div", { className: "lib-xplat-field-message-wrap", children: validations.map((v, idx) => /* @__PURE__ */ jsxs3(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
className: clsx_default("lib-xplat-field-message", v.status),
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ jsx4("div", { className: "icon", children: ICON[v.status] }),
|
|
135
|
+
/* @__PURE__ */ jsx4("span", { children: v.message })
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
`${v.message}_${idx}`
|
|
139
|
+
)) });
|
|
140
|
+
};
|
|
141
|
+
FieldMessage.displayName = "FieldMessage";
|
|
142
|
+
var Field = (props) => {
|
|
143
|
+
const { validations, children } = props;
|
|
144
|
+
if (!validations || validations.length === 0) return /* @__PURE__ */ jsx4(Fragment, { children });
|
|
145
|
+
return /* @__PURE__ */ jsxs3("div", { className: "lib-xplat-field", children: [
|
|
146
|
+
children,
|
|
147
|
+
/* @__PURE__ */ jsx4(FieldMessage, { validations })
|
|
148
|
+
] });
|
|
149
|
+
};
|
|
150
|
+
Field.displayName = "Field";
|
|
151
|
+
var hasError = (validations) => !!validations?.some((v) => v.status === "error");
|
|
152
|
+
|
|
20
153
|
// src/components/AutoResizeTextArea/AutoResizeTextArea.tsx
|
|
21
|
-
import { jsx } from "react/jsx-runtime";
|
|
154
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
22
155
|
var MAX_HEIGHT = 400;
|
|
23
156
|
var AutoResizeTextArea = React.forwardRef(
|
|
24
157
|
(props, ref) => {
|
|
25
|
-
const { value, className, onChange, disabled, bare = false, ...textareaProps } = props;
|
|
158
|
+
const { value, className, onChange, disabled, bare = false, validations, ...textareaProps } = props;
|
|
26
159
|
const localRef = React.useRef(null);
|
|
27
160
|
const setRefs = (el) => {
|
|
28
161
|
localRef.current = el;
|
|
@@ -50,9 +183,10 @@ var AutoResizeTextArea = React.forwardRef(
|
|
|
50
183
|
updateHeight();
|
|
51
184
|
}, [value]);
|
|
52
185
|
if (bare) {
|
|
53
|
-
return /* @__PURE__ */
|
|
186
|
+
return /* @__PURE__ */ jsx5(
|
|
54
187
|
"textarea",
|
|
55
188
|
{
|
|
189
|
+
"aria-invalid": hasError(validations) || void 0,
|
|
56
190
|
...textareaProps,
|
|
57
191
|
ref: setRefs,
|
|
58
192
|
className,
|
|
@@ -62,9 +196,10 @@ var AutoResizeTextArea = React.forwardRef(
|
|
|
62
196
|
}
|
|
63
197
|
);
|
|
64
198
|
}
|
|
65
|
-
|
|
199
|
+
const control = /* @__PURE__ */ jsx5("div", { className: clsx_default("lib-xplat-auto-resize-textarea-wrapper", className), children: /* @__PURE__ */ jsx5("div", { className: clsx_default("lib-xplat-auto-resize-textarea", disabled && "disabled"), children: /* @__PURE__ */ jsx5(
|
|
66
200
|
"textarea",
|
|
67
201
|
{
|
|
202
|
+
"aria-invalid": hasError(validations) || void 0,
|
|
68
203
|
...textareaProps,
|
|
69
204
|
ref: setRefs,
|
|
70
205
|
disabled,
|
|
@@ -72,6 +207,7 @@ var AutoResizeTextArea = React.forwardRef(
|
|
|
72
207
|
onChange: handleChange
|
|
73
208
|
}
|
|
74
209
|
) }) });
|
|
210
|
+
return /* @__PURE__ */ jsx5(Field, { validations, children: control });
|
|
75
211
|
}
|
|
76
212
|
);
|
|
77
213
|
AutoResizeTextArea.displayName = "AutoResizeTextArea";
|
|
@@ -26,6 +26,9 @@ __export(Badge_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(Badge_exports);
|
|
28
28
|
|
|
29
|
+
// src/tokens/interface/status.ts
|
|
30
|
+
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
31
|
+
|
|
29
32
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
30
33
|
function r(e) {
|
|
31
34
|
var t, f, n = "";
|
|
@@ -53,11 +56,12 @@ var NotificationBadge = (props) => {
|
|
|
53
56
|
dot = false,
|
|
54
57
|
size = "md"
|
|
55
58
|
} = props;
|
|
59
|
+
const statusType = normalizeStatus(type);
|
|
56
60
|
const showBadge = dot || count !== void 0 && count > 0;
|
|
57
61
|
const displayCount = count !== void 0 && count > maxCount ? `${maxCount}+` : count;
|
|
58
62
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: clsx_default("lib-xplat-notification-badge", size), children: [
|
|
59
63
|
children,
|
|
60
|
-
showBadge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: clsx_default("badge-indicator",
|
|
64
|
+
showBadge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: clsx_default("badge-indicator", statusType, { dot }), children: !dot && displayCount })
|
|
61
65
|
] });
|
|
62
66
|
};
|
|
63
67
|
NotificationBadge.displayName = "NotificationBadge";
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
.lib-xplat-notification-badge .badge-indicator.info {
|
|
71
71
|
background-color: var(--semantic-surface-info-default);
|
|
72
72
|
}
|
|
73
|
+
.lib-xplat-notification-badge .badge-indicator.primary,
|
|
73
74
|
.lib-xplat-notification-badge .badge-indicator.brand {
|
|
74
75
|
background-color: var(--semantic-surface-brand-default);
|
|
75
76
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/tokens/interface/status.ts
|
|
2
|
+
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
3
|
+
|
|
1
4
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
2
5
|
function r(e) {
|
|
3
6
|
var t, f, n = "";
|
|
@@ -25,11 +28,12 @@ var NotificationBadge = (props) => {
|
|
|
25
28
|
dot = false,
|
|
26
29
|
size = "md"
|
|
27
30
|
} = props;
|
|
31
|
+
const statusType = normalizeStatus(type);
|
|
28
32
|
const showBadge = dot || count !== void 0 && count > 0;
|
|
29
33
|
const displayCount = count !== void 0 && count > maxCount ? `${maxCount}+` : count;
|
|
30
34
|
return /* @__PURE__ */ jsxs("div", { className: clsx_default("lib-xplat-notification-badge", size), children: [
|
|
31
35
|
children,
|
|
32
|
-
showBadge && /* @__PURE__ */ jsx("span", { className: clsx_default("badge-indicator",
|
|
36
|
+
showBadge && /* @__PURE__ */ jsx("span", { className: clsx_default("badge-indicator", statusType, { dot }), children: !dot && displayCount })
|
|
33
37
|
] });
|
|
34
38
|
};
|
|
35
39
|
NotificationBadge.displayName = "NotificationBadge";
|
|
@@ -4,8 +4,11 @@ type BoxVariant = "outlined" | "elevated" | "flat";
|
|
|
4
4
|
type BoxPadding = "none" | "sm" | "md" | "lg";
|
|
5
5
|
interface BoxProps {
|
|
6
6
|
children: React.ReactNode;
|
|
7
|
+
/** 상자 위쪽 제목 */
|
|
7
8
|
title?: React.ReactNode;
|
|
9
|
+
/** 테두리·그림자 방식 */
|
|
8
10
|
variant?: BoxVariant;
|
|
11
|
+
/** 안쪽 여백 */
|
|
9
12
|
padding?: BoxPadding;
|
|
10
13
|
}
|
|
11
14
|
declare const Box: React.FC<BoxProps>;
|
|
@@ -4,8 +4,11 @@ type BoxVariant = "outlined" | "elevated" | "flat";
|
|
|
4
4
|
type BoxPadding = "none" | "sm" | "md" | "lg";
|
|
5
5
|
interface BoxProps {
|
|
6
6
|
children: React.ReactNode;
|
|
7
|
+
/** 상자 위쪽 제목 */
|
|
7
8
|
title?: React.ReactNode;
|
|
9
|
+
/** 테두리·그림자 방식 */
|
|
8
10
|
variant?: BoxVariant;
|
|
11
|
+
/** 안쪽 여백 */
|
|
9
12
|
padding?: BoxPadding;
|
|
10
13
|
}
|
|
11
14
|
declare const Box: React.FC<BoxProps>;
|
|
@@ -682,7 +682,8 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
682
682
|
}) });
|
|
683
683
|
};
|
|
684
684
|
var Chart = import_react.default.memo((props) => {
|
|
685
|
-
const { type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
685
|
+
const { variant, type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
686
|
+
const shape = variant ?? type ?? "line";
|
|
686
687
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
687
688
|
const { width, height } = useChartSize(containerRef);
|
|
688
689
|
const stableData = import_react.default.useMemo(() => data, [JSON.stringify(data)]);
|
|
@@ -691,11 +692,11 @@ var Chart = import_react.default.memo((props) => {
|
|
|
691
692
|
const animate = useChartAnimation(containerRef, dataKey);
|
|
692
693
|
const ready = width > 0 && height > 0;
|
|
693
694
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "lib-xplat-chart", ref: containerRef, children: [
|
|
694
|
-
ready &&
|
|
695
|
-
ready &&
|
|
696
|
-
ready &&
|
|
697
|
-
ready &&
|
|
698
|
-
ready &&
|
|
695
|
+
ready && shape === "line" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LineChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
696
|
+
ready && shape === "curve" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CurveChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
697
|
+
ready && shape === "bar" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
698
|
+
ready && shape === "pie" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
699
|
+
ready && shape === "doughnut" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
699
700
|
ready && (type === "pie" || type === "doughnut") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartLegend, { data: stableData, labels: stableLabels, type }),
|
|
700
701
|
tooltip.visible && tooltip.content && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
|
|
701
702
|
] });
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
type ChartVariant = "line" | "curve" | "bar" | "pie" | "doughnut";
|
|
3
4
|
interface ChartProps {
|
|
4
|
-
|
|
5
|
+
/** 차트 종류 */
|
|
6
|
+
variant?: ChartVariant;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated 모양 변형은 `variant` 로 받는다. `type` 은 상태 색 전용이다.
|
|
9
|
+
* 기존 사용처가 깨지지 않도록 계속 받는다 — 둘 다 주면 `variant` 가 이긴다.
|
|
10
|
+
*/
|
|
11
|
+
type?: ChartVariant;
|
|
12
|
+
/** 계열 이름 → 값 배열. 키 하나가 선/막대 하나가 된다 */
|
|
5
13
|
data: Record<string, number[]>;
|
|
14
|
+
/** x축 라벨. data 의 값 배열과 길이가 같아야 한다 */
|
|
6
15
|
labels: string[];
|
|
16
|
+
/** 마우스를 올렸을 때 값 말풍선을 띄운다 */
|
|
7
17
|
tooltip?: boolean;
|
|
18
|
+
/** 말풍선 배색 */
|
|
8
19
|
tooltipType?: "dark" | "light";
|
|
9
20
|
}
|
|
10
21
|
declare const Chart: React.NamedExoticComponent<ChartProps>;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
type ChartVariant = "line" | "curve" | "bar" | "pie" | "doughnut";
|
|
3
4
|
interface ChartProps {
|
|
4
|
-
|
|
5
|
+
/** 차트 종류 */
|
|
6
|
+
variant?: ChartVariant;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated 모양 변형은 `variant` 로 받는다. `type` 은 상태 색 전용이다.
|
|
9
|
+
* 기존 사용처가 깨지지 않도록 계속 받는다 — 둘 다 주면 `variant` 가 이긴다.
|
|
10
|
+
*/
|
|
11
|
+
type?: ChartVariant;
|
|
12
|
+
/** 계열 이름 → 값 배열. 키 하나가 선/막대 하나가 된다 */
|
|
5
13
|
data: Record<string, number[]>;
|
|
14
|
+
/** x축 라벨. data 의 값 배열과 길이가 같아야 한다 */
|
|
6
15
|
labels: string[];
|
|
16
|
+
/** 마우스를 올렸을 때 값 말풍선을 띄운다 */
|
|
7
17
|
tooltip?: boolean;
|
|
18
|
+
/** 말풍선 배색 */
|
|
8
19
|
tooltipType?: "dark" | "light";
|
|
9
20
|
}
|
|
10
21
|
declare const Chart: React.NamedExoticComponent<ChartProps>;
|
|
@@ -646,7 +646,8 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
646
646
|
}) });
|
|
647
647
|
};
|
|
648
648
|
var Chart = React.memo((props) => {
|
|
649
|
-
const { type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
649
|
+
const { variant, type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
650
|
+
const shape = variant ?? type ?? "line";
|
|
650
651
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
651
652
|
const { width, height } = useChartSize(containerRef);
|
|
652
653
|
const stableData = React.useMemo(() => data, [JSON.stringify(data)]);
|
|
@@ -655,11 +656,11 @@ var Chart = React.memo((props) => {
|
|
|
655
656
|
const animate = useChartAnimation(containerRef, dataKey);
|
|
656
657
|
const ready = width > 0 && height > 0;
|
|
657
658
|
return /* @__PURE__ */ jsxs("div", { className: "lib-xplat-chart", ref: containerRef, children: [
|
|
658
|
-
ready &&
|
|
659
|
-
ready &&
|
|
660
|
-
ready &&
|
|
661
|
-
ready &&
|
|
662
|
-
ready &&
|
|
659
|
+
ready && shape === "line" && /* @__PURE__ */ jsx(LineChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
660
|
+
ready && shape === "curve" && /* @__PURE__ */ jsx(CurveChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
661
|
+
ready && shape === "bar" && /* @__PURE__ */ jsx(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
662
|
+
ready && shape === "pie" && /* @__PURE__ */ jsx(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
663
|
+
ready && shape === "doughnut" && /* @__PURE__ */ jsx(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
663
664
|
ready && (type === "pie" || type === "doughnut") && /* @__PURE__ */ jsx(ChartLegend, { data: stableData, labels: stableLabels, type }),
|
|
664
665
|
tooltip.visible && tooltip.content && /* @__PURE__ */ jsx(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
|
|
665
666
|
] });
|