@x-plat/design-system 0.9.0 → 0.11.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 +14 -5
- package/dist/components/AutoResizeTextArea/index.css +15 -0
- package/dist/components/AutoResizeTextArea/index.d.cts +5 -0
- package/dist/components/AutoResizeTextArea/index.d.ts +5 -0
- package/dist/components/AutoResizeTextArea/index.js +14 -5
- 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 +20 -7
- package/dist/components/ChatInput/index.css +15 -0
- package/dist/components/ChatInput/index.d.cts +10 -0
- package/dist/components/ChatInput/index.d.ts +10 -0
- package/dist/components/ChatInput/index.js +20 -7
- package/dist/components/CheckBox/index.cjs +14 -5
- package/dist/components/CheckBox/index.css +17 -0
- package/dist/components/CheckBox/index.d.cts +10 -2
- package/dist/components/CheckBox/index.d.ts +10 -2
- package/dist/components/CheckBox/index.js +14 -5
- package/dist/components/Chip/index.d.cts +2 -0
- package/dist/components/Chip/index.d.ts +2 -0
- package/dist/components/DatePicker/index.cjs +181 -65
- package/dist/components/DatePicker/index.css +19 -0
- package/dist/components/DatePicker/index.js +181 -65
- package/dist/components/Drawer/index.cjs +83 -4
- package/dist/components/Drawer/index.d.cts +1 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Drawer/index.js +83 -4
- package/dist/components/Dropdown/index.cjs +35 -7
- package/dist/components/Dropdown/index.js +35 -7
- package/dist/components/Editor/index.cjs +178 -21
- package/dist/components/Editor/index.js +178 -21
- package/dist/components/FieldMessage/index.cjs +8 -3
- package/dist/components/FieldMessage/index.css +15 -0
- package/dist/components/FieldMessage/index.d.cts +11 -4
- package/dist/components/FieldMessage/index.d.ts +11 -4
- package/dist/components/FieldMessage/index.js +8 -3
- package/dist/components/FileUpload/index.cjs +8 -3
- package/dist/components/FileUpload/index.css +15 -0
- package/dist/components/FileUpload/index.d.cts +6 -0
- package/dist/components/FileUpload/index.d.ts +6 -0
- package/dist/components/FileUpload/index.js +8 -3
- package/dist/components/ImageSelector/index.cjs +8 -3
- package/dist/components/ImageSelector/index.css +15 -0
- package/dist/components/ImageSelector/index.d.cts +3 -0
- package/dist/components/ImageSelector/index.d.ts +3 -0
- package/dist/components/ImageSelector/index.js +8 -3
- package/dist/components/Input/index.cjs +15 -5
- package/dist/components/Input/index.css +15 -0
- package/dist/components/Input/index.d.cts +8 -0
- package/dist/components/Input/index.d.ts +8 -0
- package/dist/components/Input/index.js +15 -5
- package/dist/components/Modal/index.cjs +84 -5
- package/dist/components/Modal/index.js +84 -5
- 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/PopOver/index.cjs +34 -6
- package/dist/components/PopOver/index.js +34 -6
- 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 +14 -5
- package/dist/components/Radio/index.css +17 -0
- package/dist/components/Radio/index.d.cts +11 -2
- package/dist/components/Radio/index.d.ts +11 -2
- package/dist/components/Radio/index.js +14 -5
- package/dist/components/Select/index.cjs +99 -31
- package/dist/components/Select/index.css +54 -0
- package/dist/components/Select/index.d.cts +16 -1
- package/dist/components/Select/index.d.ts +16 -1
- package/dist/components/Select/index.js +99 -31
- 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/Stat/index.cjs +84 -0
- package/dist/components/Stat/index.css +96 -0
- package/dist/components/Stat/index.d.cts +37 -0
- package/dist/components/Stat/index.d.ts +37 -0
- package/dist/components/Stat/index.js +57 -0
- 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 +20 -7
- package/dist/components/Switch/index.css +17 -0
- package/dist/components/Switch/index.d.cts +15 -2
- package/dist/components/Switch/index.d.ts +15 -2
- package/dist/components/Switch/index.js +20 -7
- package/dist/components/Tab/index.cjs +51 -26
- package/dist/components/Tab/index.css +4 -0
- package/dist/components/Tab/index.d.cts +12 -1
- package/dist/components/Tab/index.d.ts +12 -1
- package/dist/components/Tab/index.js +51 -26
- 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 +14 -4
- package/dist/components/TextArea/index.css +15 -0
- package/dist/components/TextArea/index.d.cts +7 -0
- package/dist/components/TextArea/index.d.ts +7 -0
- package/dist/components/TextArea/index.js +14 -4
- package/dist/components/TimePicker/index.cjs +448 -0
- package/dist/components/TimePicker/index.css +172 -0
- package/dist/components/TimePicker/index.d.cts +42 -0
- package/dist/components/TimePicker/index.d.ts +42 -0
- package/dist/components/TimePicker/index.js +411 -0
- 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 +916 -385
- package/dist/components/index.css +296 -0
- package/dist/components/index.d.cts +3 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +914 -385
- package/dist/index.cjs +940 -409
- package/dist/index.css +296 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +938 -409
- package/dist/status-njWqQWFV.d.cts +20 -0
- package/dist/status-njWqQWFV.d.ts +20 -0
- package/guidelines/AGENT_PROMPT.md +18 -3
- package/guidelines/Guidelines.md +3 -0
- package/guidelines/components/card.md +3 -3
- package/guidelines/components/editor.md +86 -0
- package/guidelines/components/feedback.md +1 -1
- package/guidelines/components/form.md +19 -0
- package/guidelines/components/navigation.md +16 -15
- package/guidelines/components/overlay.md +43 -4
- package/guidelines/components/stat.md +31 -0
- package/guidelines/components/time-picker.md +49 -0
- package/package.json +1 -1
|
@@ -176,11 +176,16 @@ var FieldMessage = (props) => {
|
|
|
176
176
|
};
|
|
177
177
|
FieldMessage.displayName = "FieldMessage";
|
|
178
178
|
var Field = (props) => {
|
|
179
|
-
const { validations, children } = props;
|
|
180
|
-
|
|
179
|
+
const { label, required = false, htmlFor, validations, children } = props;
|
|
180
|
+
const hasMessages = !!validations && validations.length > 0;
|
|
181
|
+
if (!label && !hasMessages) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
|
|
181
182
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "lib-xplat-field", children: [
|
|
183
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "lib-xplat-field-label", htmlFor, children: [
|
|
184
|
+
label,
|
|
185
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "required", "aria-hidden": "true", children: "*" })
|
|
186
|
+
] }),
|
|
182
187
|
children,
|
|
183
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldMessage, { validations })
|
|
188
|
+
hasMessages && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldMessage, { validations })
|
|
184
189
|
] });
|
|
185
190
|
};
|
|
186
191
|
Field.displayName = "Field";
|
|
@@ -191,7 +196,9 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
|
191
196
|
var MAX_HEIGHT = 400;
|
|
192
197
|
var AutoResizeTextArea = import_react.default.forwardRef(
|
|
193
198
|
(props, ref) => {
|
|
194
|
-
const { value, className, onChange, disabled, bare = false, validations, ...textareaProps } = props;
|
|
199
|
+
const { value, className, onChange, disabled, bare = false, validations, label, required, ...textareaProps } = props;
|
|
200
|
+
const autoId = import_react.default.useId();
|
|
201
|
+
const fieldId = props.id ?? autoId;
|
|
195
202
|
const localRef = import_react.default.useRef(null);
|
|
196
203
|
const setRefs = (el) => {
|
|
197
204
|
localRef.current = el;
|
|
@@ -225,6 +232,7 @@ var AutoResizeTextArea = import_react.default.forwardRef(
|
|
|
225
232
|
"aria-invalid": hasError(validations) || void 0,
|
|
226
233
|
...textareaProps,
|
|
227
234
|
ref: setRefs,
|
|
235
|
+
id: fieldId,
|
|
228
236
|
className,
|
|
229
237
|
disabled,
|
|
230
238
|
value,
|
|
@@ -238,12 +246,13 @@ var AutoResizeTextArea = import_react.default.forwardRef(
|
|
|
238
246
|
"aria-invalid": hasError(validations) || void 0,
|
|
239
247
|
...textareaProps,
|
|
240
248
|
ref: setRefs,
|
|
249
|
+
id: fieldId,
|
|
241
250
|
disabled,
|
|
242
251
|
value,
|
|
243
252
|
onChange: handleChange
|
|
244
253
|
}
|
|
245
254
|
) }) });
|
|
246
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Field, { validations, children: control });
|
|
255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
247
256
|
}
|
|
248
257
|
);
|
|
249
258
|
AutoResizeTextArea.displayName = "AutoResizeTextArea";
|
|
@@ -4,6 +4,21 @@
|
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
gap: var(--spacing-space-2);
|
|
6
6
|
}
|
|
7
|
+
.lib-xplat-field-label {
|
|
8
|
+
font-family: var(--semantic-typo-label-2-m-font);
|
|
9
|
+
font-size: var(--semantic-typo-label-2-m-size);
|
|
10
|
+
line-height: var(--semantic-typo-label-2-m-lh);
|
|
11
|
+
font-weight: var(--semantic-typo-label-2-m-weight);
|
|
12
|
+
letter-spacing: var(--semantic-typo-label-2-m-ls);
|
|
13
|
+
color: var(--semantic-text-secondary);
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: var(--spacing-space-1);
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
.lib-xplat-field-label > .required {
|
|
20
|
+
color: var(--semantic-text-error);
|
|
21
|
+
}
|
|
7
22
|
.lib-xplat-field-message-wrap {
|
|
8
23
|
display: flex;
|
|
9
24
|
gap: var(--spacing-space-2);
|
|
@@ -6,6 +6,11 @@ interface AutoResizeTextAreaProps extends TextareaAttributes {
|
|
|
6
6
|
/** ChatInput 등 내부 임베딩 시 wrapper 없이 textarea만 렌더 */
|
|
7
7
|
/** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
|
|
8
8
|
validations?: Validation[];
|
|
9
|
+
/** 테두리와 배경을 없앤다. ChatInput 처럼 감싸는 쪽이 껍데기를 그릴 때 */
|
|
10
|
+
/** 컨트롤 위에 붙는 라벨. 클릭하면 컨트롤에 포커스가 간다 */
|
|
11
|
+
label?: React.ReactNode;
|
|
12
|
+
/** 라벨 뒤에 필수 표시(*)를 붙인다 */
|
|
13
|
+
required?: boolean;
|
|
9
14
|
bare?: boolean;
|
|
10
15
|
}
|
|
11
16
|
declare const AutoResizeTextArea: React.ForwardRefExoticComponent<AutoResizeTextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -6,6 +6,11 @@ interface AutoResizeTextAreaProps extends TextareaAttributes {
|
|
|
6
6
|
/** ChatInput 등 내부 임베딩 시 wrapper 없이 textarea만 렌더 */
|
|
7
7
|
/** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
|
|
8
8
|
validations?: Validation[];
|
|
9
|
+
/** 테두리와 배경을 없앤다. ChatInput 처럼 감싸는 쪽이 껍데기를 그릴 때 */
|
|
10
|
+
/** 컨트롤 위에 붙는 라벨. 클릭하면 컨트롤에 포커스가 간다 */
|
|
11
|
+
label?: React.ReactNode;
|
|
12
|
+
/** 라벨 뒤에 필수 표시(*)를 붙인다 */
|
|
13
|
+
required?: boolean;
|
|
9
14
|
bare?: boolean;
|
|
10
15
|
}
|
|
11
16
|
declare const AutoResizeTextArea: React.ForwardRefExoticComponent<AutoResizeTextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -140,11 +140,16 @@ var FieldMessage = (props) => {
|
|
|
140
140
|
};
|
|
141
141
|
FieldMessage.displayName = "FieldMessage";
|
|
142
142
|
var Field = (props) => {
|
|
143
|
-
const { validations, children } = props;
|
|
144
|
-
|
|
143
|
+
const { label, required = false, htmlFor, validations, children } = props;
|
|
144
|
+
const hasMessages = !!validations && validations.length > 0;
|
|
145
|
+
if (!label && !hasMessages) return /* @__PURE__ */ jsx4(Fragment, { children });
|
|
145
146
|
return /* @__PURE__ */ jsxs3("div", { className: "lib-xplat-field", children: [
|
|
147
|
+
label && /* @__PURE__ */ jsxs3("label", { className: "lib-xplat-field-label", htmlFor, children: [
|
|
148
|
+
label,
|
|
149
|
+
required && /* @__PURE__ */ jsx4("span", { className: "required", "aria-hidden": "true", children: "*" })
|
|
150
|
+
] }),
|
|
146
151
|
children,
|
|
147
|
-
/* @__PURE__ */ jsx4(FieldMessage, { validations })
|
|
152
|
+
hasMessages && /* @__PURE__ */ jsx4(FieldMessage, { validations })
|
|
148
153
|
] });
|
|
149
154
|
};
|
|
150
155
|
Field.displayName = "Field";
|
|
@@ -155,7 +160,9 @@ import { jsx as jsx5 } from "react/jsx-runtime";
|
|
|
155
160
|
var MAX_HEIGHT = 400;
|
|
156
161
|
var AutoResizeTextArea = React.forwardRef(
|
|
157
162
|
(props, ref) => {
|
|
158
|
-
const { value, className, onChange, disabled, bare = false, validations, ...textareaProps } = props;
|
|
163
|
+
const { value, className, onChange, disabled, bare = false, validations, label, required, ...textareaProps } = props;
|
|
164
|
+
const autoId = React.useId();
|
|
165
|
+
const fieldId = props.id ?? autoId;
|
|
159
166
|
const localRef = React.useRef(null);
|
|
160
167
|
const setRefs = (el) => {
|
|
161
168
|
localRef.current = el;
|
|
@@ -189,6 +196,7 @@ var AutoResizeTextArea = React.forwardRef(
|
|
|
189
196
|
"aria-invalid": hasError(validations) || void 0,
|
|
190
197
|
...textareaProps,
|
|
191
198
|
ref: setRefs,
|
|
199
|
+
id: fieldId,
|
|
192
200
|
className,
|
|
193
201
|
disabled,
|
|
194
202
|
value,
|
|
@@ -202,12 +210,13 @@ var AutoResizeTextArea = React.forwardRef(
|
|
|
202
210
|
"aria-invalid": hasError(validations) || void 0,
|
|
203
211
|
...textareaProps,
|
|
204
212
|
ref: setRefs,
|
|
213
|
+
id: fieldId,
|
|
205
214
|
disabled,
|
|
206
215
|
value,
|
|
207
216
|
onChange: handleChange
|
|
208
217
|
}
|
|
209
218
|
) }) });
|
|
210
|
-
return /* @__PURE__ */ jsx5(Field, { validations, children: control });
|
|
219
|
+
return /* @__PURE__ */ jsx5(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
211
220
|
}
|
|
212
221
|
);
|
|
213
222
|
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
|
] });
|
|
@@ -235,11 +235,16 @@ var FieldMessage = (props) => {
|
|
|
235
235
|
};
|
|
236
236
|
FieldMessage.displayName = "FieldMessage";
|
|
237
237
|
var Field = (props) => {
|
|
238
|
-
const { validations, children } = props;
|
|
239
|
-
|
|
238
|
+
const { label, required = false, htmlFor, validations, children } = props;
|
|
239
|
+
const hasMessages = !!validations && validations.length > 0;
|
|
240
|
+
if (!label && !hasMessages) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children });
|
|
240
241
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "lib-xplat-field", children: [
|
|
242
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "lib-xplat-field-label", htmlFor, children: [
|
|
243
|
+
label,
|
|
244
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "required", "aria-hidden": "true", children: "*" })
|
|
245
|
+
] }),
|
|
241
246
|
children,
|
|
242
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FieldMessage, { validations })
|
|
247
|
+
hasMessages && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FieldMessage, { validations })
|
|
243
248
|
] });
|
|
244
249
|
};
|
|
245
250
|
Field.displayName = "Field";
|
|
@@ -250,7 +255,9 @@ var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
|
250
255
|
var MAX_HEIGHT = 400;
|
|
251
256
|
var AutoResizeTextArea = import_react.default.forwardRef(
|
|
252
257
|
(props, ref) => {
|
|
253
|
-
const { value, className, onChange, disabled, bare = false, validations, ...textareaProps } = props;
|
|
258
|
+
const { value, className, onChange, disabled, bare = false, validations, label, required, ...textareaProps } = props;
|
|
259
|
+
const autoId = import_react.default.useId();
|
|
260
|
+
const fieldId = props.id ?? autoId;
|
|
254
261
|
const localRef = import_react.default.useRef(null);
|
|
255
262
|
const setRefs = (el) => {
|
|
256
263
|
localRef.current = el;
|
|
@@ -284,6 +291,7 @@ var AutoResizeTextArea = import_react.default.forwardRef(
|
|
|
284
291
|
"aria-invalid": hasError(validations) || void 0,
|
|
285
292
|
...textareaProps,
|
|
286
293
|
ref: setRefs,
|
|
294
|
+
id: fieldId,
|
|
287
295
|
className,
|
|
288
296
|
disabled,
|
|
289
297
|
value,
|
|
@@ -297,12 +305,13 @@ var AutoResizeTextArea = import_react.default.forwardRef(
|
|
|
297
305
|
"aria-invalid": hasError(validations) || void 0,
|
|
298
306
|
...textareaProps,
|
|
299
307
|
ref: setRefs,
|
|
308
|
+
id: fieldId,
|
|
300
309
|
disabled,
|
|
301
310
|
value,
|
|
302
311
|
onChange: handleChange
|
|
303
312
|
}
|
|
304
313
|
) }) });
|
|
305
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Field, { validations, children: control });
|
|
314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
306
315
|
}
|
|
307
316
|
);
|
|
308
317
|
AutoResizeTextArea.displayName = "AutoResizeTextArea";
|
|
@@ -319,8 +328,11 @@ var ChatInput = import_react2.default.forwardRef(
|
|
|
319
328
|
buttonType = "primary",
|
|
320
329
|
onSubmit,
|
|
321
330
|
onChange,
|
|
322
|
-
validations
|
|
331
|
+
validations,
|
|
332
|
+
label,
|
|
333
|
+
required
|
|
323
334
|
} = props;
|
|
335
|
+
const fieldId = import_react2.default.useId();
|
|
324
336
|
const isControlled = valueProp !== void 0;
|
|
325
337
|
const [internalValue, setInternalValue] = import_react2.default.useState("");
|
|
326
338
|
const value = isControlled ? valueProp : internalValue;
|
|
@@ -345,6 +357,7 @@ var ChatInput = import_react2.default.forwardRef(
|
|
|
345
357
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
346
358
|
AutoResizeTextArea_default,
|
|
347
359
|
{
|
|
360
|
+
id: fieldId,
|
|
348
361
|
ref,
|
|
349
362
|
bare: true,
|
|
350
363
|
className: "chat-input-textarea",
|
|
@@ -369,7 +382,7 @@ var ChatInput = import_react2.default.forwardRef(
|
|
|
369
382
|
}
|
|
370
383
|
)
|
|
371
384
|
] });
|
|
372
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Field, { validations, children: control });
|
|
385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
373
386
|
}
|
|
374
387
|
);
|
|
375
388
|
ChatInput.displayName = "ChatInput";
|
|
@@ -82,6 +82,21 @@
|
|
|
82
82
|
flex-direction: column;
|
|
83
83
|
gap: var(--spacing-space-2);
|
|
84
84
|
}
|
|
85
|
+
.lib-xplat-field-label {
|
|
86
|
+
font-family: var(--semantic-typo-label-2-m-font);
|
|
87
|
+
font-size: var(--semantic-typo-label-2-m-size);
|
|
88
|
+
line-height: var(--semantic-typo-label-2-m-lh);
|
|
89
|
+
font-weight: var(--semantic-typo-label-2-m-weight);
|
|
90
|
+
letter-spacing: var(--semantic-typo-label-2-m-ls);
|
|
91
|
+
color: var(--semantic-text-secondary);
|
|
92
|
+
display: inline-flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
gap: var(--spacing-space-1);
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
}
|
|
97
|
+
.lib-xplat-field-label > .required {
|
|
98
|
+
color: var(--semantic-text-error);
|
|
99
|
+
}
|
|
85
100
|
.lib-xplat-field-message-wrap {
|
|
86
101
|
display: flex;
|
|
87
102
|
gap: var(--spacing-space-2);
|
|
@@ -3,13 +3,23 @@ import { V as Validation } from '../../validation-Dqo1zqhT.cjs';
|
|
|
3
3
|
|
|
4
4
|
type ButtonType = "primary" | "secondary" | "ghost";
|
|
5
5
|
interface ChatInputProps {
|
|
6
|
+
/** 비어 있을 때 표시할 안내 글자 */
|
|
6
7
|
placeholder?: string;
|
|
8
|
+
/** 입력값. 주면 controlled 가 된다 */
|
|
7
9
|
value?: string;
|
|
10
|
+
/** 입력과 전송을 막는다 */
|
|
8
11
|
disabled?: boolean;
|
|
9
12
|
/** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
|
|
10
13
|
validations?: Validation[];
|
|
14
|
+
/** 전송 버튼 색 */
|
|
15
|
+
/** 컨트롤 위에 붙는 라벨. 클릭하면 컨트롤에 포커스가 간다 */
|
|
16
|
+
label?: React.ReactNode;
|
|
17
|
+
/** 라벨 뒤에 필수 표시(*)를 붙인다 */
|
|
18
|
+
required?: boolean;
|
|
11
19
|
buttonType?: ButtonType;
|
|
20
|
+
/** Enter 또는 전송 버튼을 누르면 현재 값을 준다 */
|
|
12
21
|
onSubmit?: (value: string) => void;
|
|
22
|
+
/** 입력할 때마다 값을 준다 */
|
|
13
23
|
onChange?: (value: string) => void;
|
|
14
24
|
}
|
|
15
25
|
declare const ChatInput: React.ForwardRefExoticComponent<ChatInputProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -3,13 +3,23 @@ import { V as Validation } from '../../validation-Dqo1zqhT.js';
|
|
|
3
3
|
|
|
4
4
|
type ButtonType = "primary" | "secondary" | "ghost";
|
|
5
5
|
interface ChatInputProps {
|
|
6
|
+
/** 비어 있을 때 표시할 안내 글자 */
|
|
6
7
|
placeholder?: string;
|
|
8
|
+
/** 입력값. 주면 controlled 가 된다 */
|
|
7
9
|
value?: string;
|
|
10
|
+
/** 입력과 전송을 막는다 */
|
|
8
11
|
disabled?: boolean;
|
|
9
12
|
/** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
|
|
10
13
|
validations?: Validation[];
|
|
14
|
+
/** 전송 버튼 색 */
|
|
15
|
+
/** 컨트롤 위에 붙는 라벨. 클릭하면 컨트롤에 포커스가 간다 */
|
|
16
|
+
label?: React.ReactNode;
|
|
17
|
+
/** 라벨 뒤에 필수 표시(*)를 붙인다 */
|
|
18
|
+
required?: boolean;
|
|
11
19
|
buttonType?: ButtonType;
|
|
20
|
+
/** Enter 또는 전송 버튼을 누르면 현재 값을 준다 */
|
|
12
21
|
onSubmit?: (value: string) => void;
|
|
22
|
+
/** 입력할 때마다 값을 준다 */
|
|
13
23
|
onChange?: (value: string) => void;
|
|
14
24
|
}
|
|
15
25
|
declare const ChatInput: React.ForwardRefExoticComponent<ChatInputProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -199,11 +199,16 @@ var FieldMessage = (props) => {
|
|
|
199
199
|
};
|
|
200
200
|
FieldMessage.displayName = "FieldMessage";
|
|
201
201
|
var Field = (props) => {
|
|
202
|
-
const { validations, children } = props;
|
|
203
|
-
|
|
202
|
+
const { label, required = false, htmlFor, validations, children } = props;
|
|
203
|
+
const hasMessages = !!validations && validations.length > 0;
|
|
204
|
+
if (!label && !hasMessages) return /* @__PURE__ */ jsx12(Fragment, { children });
|
|
204
205
|
return /* @__PURE__ */ jsxs6("div", { className: "lib-xplat-field", children: [
|
|
206
|
+
label && /* @__PURE__ */ jsxs6("label", { className: "lib-xplat-field-label", htmlFor, children: [
|
|
207
|
+
label,
|
|
208
|
+
required && /* @__PURE__ */ jsx12("span", { className: "required", "aria-hidden": "true", children: "*" })
|
|
209
|
+
] }),
|
|
205
210
|
children,
|
|
206
|
-
/* @__PURE__ */ jsx12(FieldMessage, { validations })
|
|
211
|
+
hasMessages && /* @__PURE__ */ jsx12(FieldMessage, { validations })
|
|
207
212
|
] });
|
|
208
213
|
};
|
|
209
214
|
Field.displayName = "Field";
|
|
@@ -214,7 +219,9 @@ import { jsx as jsx13 } from "react/jsx-runtime";
|
|
|
214
219
|
var MAX_HEIGHT = 400;
|
|
215
220
|
var AutoResizeTextArea = React.forwardRef(
|
|
216
221
|
(props, ref) => {
|
|
217
|
-
const { value, className, onChange, disabled, bare = false, validations, ...textareaProps } = props;
|
|
222
|
+
const { value, className, onChange, disabled, bare = false, validations, label, required, ...textareaProps } = props;
|
|
223
|
+
const autoId = React.useId();
|
|
224
|
+
const fieldId = props.id ?? autoId;
|
|
218
225
|
const localRef = React.useRef(null);
|
|
219
226
|
const setRefs = (el) => {
|
|
220
227
|
localRef.current = el;
|
|
@@ -248,6 +255,7 @@ var AutoResizeTextArea = React.forwardRef(
|
|
|
248
255
|
"aria-invalid": hasError(validations) || void 0,
|
|
249
256
|
...textareaProps,
|
|
250
257
|
ref: setRefs,
|
|
258
|
+
id: fieldId,
|
|
251
259
|
className,
|
|
252
260
|
disabled,
|
|
253
261
|
value,
|
|
@@ -261,12 +269,13 @@ var AutoResizeTextArea = React.forwardRef(
|
|
|
261
269
|
"aria-invalid": hasError(validations) || void 0,
|
|
262
270
|
...textareaProps,
|
|
263
271
|
ref: setRefs,
|
|
272
|
+
id: fieldId,
|
|
264
273
|
disabled,
|
|
265
274
|
value,
|
|
266
275
|
onChange: handleChange
|
|
267
276
|
}
|
|
268
277
|
) }) });
|
|
269
|
-
return /* @__PURE__ */ jsx13(Field, { validations, children: control });
|
|
278
|
+
return /* @__PURE__ */ jsx13(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
270
279
|
}
|
|
271
280
|
);
|
|
272
281
|
AutoResizeTextArea.displayName = "AutoResizeTextArea";
|
|
@@ -283,8 +292,11 @@ var ChatInput = React2.forwardRef(
|
|
|
283
292
|
buttonType = "primary",
|
|
284
293
|
onSubmit,
|
|
285
294
|
onChange,
|
|
286
|
-
validations
|
|
295
|
+
validations,
|
|
296
|
+
label,
|
|
297
|
+
required
|
|
287
298
|
} = props;
|
|
299
|
+
const fieldId = React2.useId();
|
|
288
300
|
const isControlled = valueProp !== void 0;
|
|
289
301
|
const [internalValue, setInternalValue] = React2.useState("");
|
|
290
302
|
const value = isControlled ? valueProp : internalValue;
|
|
@@ -309,6 +321,7 @@ var ChatInput = React2.forwardRef(
|
|
|
309
321
|
/* @__PURE__ */ jsx14(
|
|
310
322
|
AutoResizeTextArea_default,
|
|
311
323
|
{
|
|
324
|
+
id: fieldId,
|
|
312
325
|
ref,
|
|
313
326
|
bare: true,
|
|
314
327
|
className: "chat-input-textarea",
|
|
@@ -333,7 +346,7 @@ var ChatInput = React2.forwardRef(
|
|
|
333
346
|
}
|
|
334
347
|
)
|
|
335
348
|
] });
|
|
336
|
-
return /* @__PURE__ */ jsx14(Field, { validations, children: control });
|
|
349
|
+
return /* @__PURE__ */ jsx14(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
337
350
|
}
|
|
338
351
|
);
|
|
339
352
|
ChatInput.displayName = "ChatInput";
|
|
@@ -1019,6 +1019,9 @@ var import_jsx_runtime294 = require("react/jsx-runtime");
|
|
|
1019
1019
|
// src/tokens/index.ts
|
|
1020
1020
|
var import_tokens_core2 = require("@x-plat/tokens-core");
|
|
1021
1021
|
|
|
1022
|
+
// src/tokens/interface/status.ts
|
|
1023
|
+
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
1024
|
+
|
|
1022
1025
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
1023
1026
|
function r(e) {
|
|
1024
1027
|
var t, f, n = "";
|
|
@@ -1060,11 +1063,16 @@ var FieldMessage = (props) => {
|
|
|
1060
1063
|
};
|
|
1061
1064
|
FieldMessage.displayName = "FieldMessage";
|
|
1062
1065
|
var Field = (props) => {
|
|
1063
|
-
const { validations, children } = props;
|
|
1064
|
-
|
|
1066
|
+
const { label, required = false, htmlFor, validations, children } = props;
|
|
1067
|
+
const hasMessages = !!validations && validations.length > 0;
|
|
1068
|
+
if (!label && !hasMessages) return /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(import_jsx_runtime295.Fragment, { children });
|
|
1065
1069
|
return /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)("div", { className: "lib-xplat-field", children: [
|
|
1070
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)("label", { className: "lib-xplat-field-label", htmlFor, children: [
|
|
1071
|
+
label,
|
|
1072
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime295.jsx)("span", { className: "required", "aria-hidden": "true", children: "*" })
|
|
1073
|
+
] }),
|
|
1066
1074
|
children,
|
|
1067
|
-
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)(FieldMessage, { validations })
|
|
1075
|
+
hasMessages && /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(FieldMessage, { validations })
|
|
1068
1076
|
] });
|
|
1069
1077
|
};
|
|
1070
1078
|
Field.displayName = "Field";
|
|
@@ -1080,10 +1088,11 @@ var CheckBox = (props) => {
|
|
|
1080
1088
|
onChange,
|
|
1081
1089
|
disabled,
|
|
1082
1090
|
size = "md",
|
|
1083
|
-
type = "
|
|
1091
|
+
type = "primary",
|
|
1084
1092
|
validations,
|
|
1085
1093
|
...rest
|
|
1086
1094
|
} = props;
|
|
1095
|
+
const statusType = normalizeStatus(type);
|
|
1087
1096
|
const handleChange = (e) => {
|
|
1088
1097
|
if (onChange) onChange(e);
|
|
1089
1098
|
};
|
|
@@ -1091,7 +1100,7 @@ var CheckBox = (props) => {
|
|
|
1091
1100
|
const checkedClasses = `checked`;
|
|
1092
1101
|
const disabledClasses = "disabled";
|
|
1093
1102
|
const boxClasses = disabled ? disabledClasses : checked ? checkedClasses : uncheckedClasses;
|
|
1094
|
-
const control = /* @__PURE__ */ (0, import_jsx_runtime296.jsxs)("label", { className: clsx_default("lib-xplat-checkbox", size,
|
|
1103
|
+
const control = /* @__PURE__ */ (0, import_jsx_runtime296.jsxs)("label", { className: clsx_default("lib-xplat-checkbox", size, statusType, className), children: [
|
|
1095
1104
|
/* @__PURE__ */ (0, import_jsx_runtime296.jsx)(
|
|
1096
1105
|
"input",
|
|
1097
1106
|
{
|