@x-plat/design-system 0.10.0 → 0.12.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 +4 -0
- package/dist/components/AutoResizeTextArea/index.d.ts +4 -0
- package/dist/components/AutoResizeTextArea/index.js +14 -5
- package/dist/components/Badge/index.d.cts +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/ChatInput/index.cjs +20 -7
- package/dist/components/ChatInput/index.css +15 -0
- package/dist/components/ChatInput/index.d.cts +4 -0
- package/dist/components/ChatInput/index.d.ts +4 -0
- package/dist/components/ChatInput/index.js +20 -7
- package/dist/components/CheckBox/index.cjs +8 -3
- package/dist/components/CheckBox/index.css +15 -0
- package/dist/components/CheckBox/index.d.cts +1 -1
- package/dist/components/CheckBox/index.d.ts +1 -1
- package/dist/components/CheckBox/index.js +8 -3
- package/dist/components/DatePicker/index.cjs +179 -64
- package/dist/components/DatePicker/index.css +19 -0
- package/dist/components/DatePicker/index.js +179 -64
- package/dist/components/Drawer/index.cjs +83 -4
- package/dist/components/Drawer/index.js +83 -4
- package/dist/components/Dropdown/index.cjs +57 -16
- package/dist/components/Dropdown/index.css +3 -0
- package/dist/components/Dropdown/index.js +57 -16
- package/dist/components/Editor/index.cjs +779 -50
- package/dist/components/Editor/index.css +100 -0
- package/dist/components/Editor/index.d.cts +1 -1
- package/dist/components/Editor/index.d.ts +1 -1
- package/dist/components/Editor/index.js +779 -50
- 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.js +8 -3
- package/dist/components/ImageSelector/index.cjs +8 -3
- package/dist/components/ImageSelector/index.css +15 -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 +4 -0
- package/dist/components/Input/index.d.ts +4 -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.d.cts +1 -1
- package/dist/components/NotificationBadge/index.d.ts +1 -1
- package/dist/components/Pagination/index.d.cts +1 -1
- package/dist/components/Pagination/index.d.ts +1 -1
- package/dist/components/PopOver/index.cjs +55 -13
- package/dist/components/PopOver/index.css +3 -0
- package/dist/components/PopOver/index.js +55 -13
- package/dist/components/Progress/index.d.cts +1 -1
- package/dist/components/Progress/index.d.ts +1 -1
- package/dist/components/Radio/index.cjs +8 -3
- package/dist/components/Radio/index.css +15 -0
- package/dist/components/Radio/index.d.cts +1 -1
- package/dist/components/Radio/index.d.ts +1 -1
- package/dist/components/Radio/index.js +8 -3
- package/dist/components/Select/index.cjs +120 -39
- package/dist/components/Select/index.css +57 -0
- package/dist/components/Select/index.d.cts +11 -0
- package/dist/components/Select/index.d.ts +11 -0
- package/dist/components/Select/index.js +120 -39
- package/dist/components/Spinner/index.d.cts +1 -1
- package/dist/components/Spinner/index.d.ts +1 -1
- 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.d.cts +1 -1
- package/dist/components/Steps/index.d.ts +1 -1
- package/dist/components/Switch/index.cjs +14 -5
- package/dist/components/Switch/index.css +15 -0
- package/dist/components/Switch/index.d.cts +6 -1
- package/dist/components/Switch/index.d.ts +6 -1
- package/dist/components/Switch/index.js +14 -5
- package/dist/components/Tab/index.cjs +49 -25
- package/dist/components/Tab/index.css +4 -0
- package/dist/components/Tab/index.js +49 -25
- package/dist/components/TextArea/index.cjs +14 -4
- package/dist/components/TextArea/index.css +15 -0
- package/dist/components/TextArea/index.d.cts +4 -0
- package/dist/components/TextArea/index.d.ts +4 -0
- package/dist/components/TextArea/index.js +14 -4
- package/dist/components/TimePicker/index.cjs +461 -0
- package/dist/components/TimePicker/index.css +175 -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 +424 -0
- package/dist/components/index.cjs +1500 -398
- package/dist/components/index.css +385 -0
- package/dist/components/index.d.cts +3 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +1498 -398
- package/dist/index.cjs +1524 -422
- package/dist/index.css +385 -0
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1522 -422
- package/dist/status-njWqQWFV.d.cts +20 -0
- package/dist/status-njWqQWFV.d.ts +20 -0
- package/guidelines/AGENT_PROMPT.md +3 -3
- package/guidelines/Guidelines.md +3 -0
- package/guidelines/components/editor.md +141 -0
- package/guidelines/components/form.md +19 -0
- package/guidelines/components/stat.md +31 -0
- package/guidelines/components/time-picker.md +49 -0
- package/package.json +1 -1
- package/dist/status-g_KP3qT6.d.cts +0 -8
- package/dist/status-g_KP3qT6.d.ts +0 -8
|
@@ -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);
|
|
@@ -7,6 +7,10 @@ interface AutoResizeTextAreaProps extends TextareaAttributes {
|
|
|
7
7
|
/** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
|
|
8
8
|
validations?: Validation[];
|
|
9
9
|
/** 테두리와 배경을 없앤다. ChatInput 처럼 감싸는 쪽이 껍데기를 그릴 때 */
|
|
10
|
+
/** 컨트롤 위에 붙는 라벨. 클릭하면 컨트롤에 포커스가 간다 */
|
|
11
|
+
label?: React.ReactNode;
|
|
12
|
+
/** 라벨 뒤에 필수 표시(*)를 붙인다 */
|
|
13
|
+
required?: boolean;
|
|
10
14
|
bare?: boolean;
|
|
11
15
|
}
|
|
12
16
|
declare const AutoResizeTextArea: React.ForwardRefExoticComponent<AutoResizeTextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -7,6 +7,10 @@ interface AutoResizeTextAreaProps extends TextareaAttributes {
|
|
|
7
7
|
/** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
|
|
8
8
|
validations?: Validation[];
|
|
9
9
|
/** 테두리와 배경을 없앤다. ChatInput 처럼 감싸는 쪽이 껍데기를 그릴 때 */
|
|
10
|
+
/** 컨트롤 위에 붙는 라벨. 클릭하면 컨트롤에 포커스가 간다 */
|
|
11
|
+
label?: React.ReactNode;
|
|
12
|
+
/** 라벨 뒤에 필수 표시(*)를 붙인다 */
|
|
13
|
+
required?: boolean;
|
|
10
14
|
bare?: boolean;
|
|
11
15
|
}
|
|
12
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";
|
|
@@ -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);
|
|
@@ -12,6 +12,10 @@ interface ChatInputProps {
|
|
|
12
12
|
/** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
|
|
13
13
|
validations?: Validation[];
|
|
14
14
|
/** 전송 버튼 색 */
|
|
15
|
+
/** 컨트롤 위에 붙는 라벨. 클릭하면 컨트롤에 포커스가 간다 */
|
|
16
|
+
label?: React.ReactNode;
|
|
17
|
+
/** 라벨 뒤에 필수 표시(*)를 붙인다 */
|
|
18
|
+
required?: boolean;
|
|
15
19
|
buttonType?: ButtonType;
|
|
16
20
|
/** Enter 또는 전송 버튼을 누르면 현재 값을 준다 */
|
|
17
21
|
onSubmit?: (value: string) => void;
|
|
@@ -12,6 +12,10 @@ interface ChatInputProps {
|
|
|
12
12
|
/** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
|
|
13
13
|
validations?: Validation[];
|
|
14
14
|
/** 전송 버튼 색 */
|
|
15
|
+
/** 컨트롤 위에 붙는 라벨. 클릭하면 컨트롤에 포커스가 간다 */
|
|
16
|
+
label?: React.ReactNode;
|
|
17
|
+
/** 라벨 뒤에 필수 표시(*)를 붙인다 */
|
|
18
|
+
required?: boolean;
|
|
15
19
|
buttonType?: ButtonType;
|
|
16
20
|
/** Enter 또는 전송 버튼을 누르면 현재 값을 준다 */
|
|
17
21
|
onSubmit?: (value: string) => void;
|
|
@@ -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";
|
|
@@ -1063,11 +1063,16 @@ var FieldMessage = (props) => {
|
|
|
1063
1063
|
};
|
|
1064
1064
|
FieldMessage.displayName = "FieldMessage";
|
|
1065
1065
|
var Field = (props) => {
|
|
1066
|
-
const { validations, children } = props;
|
|
1067
|
-
|
|
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 });
|
|
1068
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
|
+
] }),
|
|
1069
1074
|
children,
|
|
1070
|
-
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)(FieldMessage, { validations })
|
|
1075
|
+
hasMessages && /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(FieldMessage, { validations })
|
|
1071
1076
|
] });
|
|
1072
1077
|
};
|
|
1073
1078
|
Field.displayName = "Field";
|
|
@@ -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);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { I as InputAttributes } from '../../attributes-DJIWir_0.cjs';
|
|
3
|
-
import { L as LegacyStatusType } from '../../status-
|
|
3
|
+
import { L as LegacyStatusType } from '../../status-njWqQWFV.cjs';
|
|
4
4
|
import { V as Validation } from '../../validation-Dqo1zqhT.cjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { I as InputAttributes } from '../../attributes-DJIWir_0.js';
|
|
3
|
-
import { L as LegacyStatusType } from '../../status-
|
|
3
|
+
import { L as LegacyStatusType } from '../../status-njWqQWFV.js';
|
|
4
4
|
import { V as Validation } from '../../validation-Dqo1zqhT.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
|
|
@@ -1037,11 +1037,16 @@ var FieldMessage = (props) => {
|
|
|
1037
1037
|
};
|
|
1038
1038
|
FieldMessage.displayName = "FieldMessage";
|
|
1039
1039
|
var Field = (props) => {
|
|
1040
|
-
const { validations, children } = props;
|
|
1041
|
-
|
|
1040
|
+
const { label, required = false, htmlFor, validations, children } = props;
|
|
1041
|
+
const hasMessages = !!validations && validations.length > 0;
|
|
1042
|
+
if (!label && !hasMessages) return /* @__PURE__ */ jsx295(Fragment, { children });
|
|
1042
1043
|
return /* @__PURE__ */ jsxs189("div", { className: "lib-xplat-field", children: [
|
|
1044
|
+
label && /* @__PURE__ */ jsxs189("label", { className: "lib-xplat-field-label", htmlFor, children: [
|
|
1045
|
+
label,
|
|
1046
|
+
required && /* @__PURE__ */ jsx295("span", { className: "required", "aria-hidden": "true", children: "*" })
|
|
1047
|
+
] }),
|
|
1043
1048
|
children,
|
|
1044
|
-
/* @__PURE__ */ jsx295(FieldMessage, { validations })
|
|
1049
|
+
hasMessages && /* @__PURE__ */ jsx295(FieldMessage, { validations })
|
|
1045
1050
|
] });
|
|
1046
1051
|
};
|
|
1047
1052
|
Field.displayName = "Field";
|