@x-plat/design-system 0.8.3 → 0.9.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 +3 -0
- package/dist/components/AutoResizeTextArea/index.d.ts +3 -0
- package/dist/components/AutoResizeTextArea/index.js +140 -4
- package/dist/components/ChatInput/index.cjs +150 -9
- package/dist/components/ChatInput/index.css +38 -0
- package/dist/components/ChatInput/index.d.cts +3 -0
- package/dist/components/ChatInput/index.d.ts +3 -0
- package/dist/components/ChatInput/index.js +151 -10
- package/dist/components/CheckBox/index.cjs +132 -5
- package/dist/components/CheckBox/index.css +38 -0
- package/dist/components/CheckBox/index.d.cts +3 -0
- package/dist/components/CheckBox/index.d.ts +3 -0
- package/dist/components/CheckBox/index.js +132 -5
- package/dist/components/DatePicker/index.cjs +72 -59
- package/dist/components/DatePicker/index.css +38 -31
- package/dist/components/DatePicker/index.js +38 -25
- 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 +3 -0
- package/dist/components/FileUpload/index.d.ts +3 -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 +3 -0
- package/dist/components/ImageSelector/index.d.ts +3 -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 +3 -8
- package/dist/components/Input/index.d.ts +3 -8
- package/dist/components/Input/index.js +36 -23
- package/dist/components/Radio/index.cjs +152 -8
- package/dist/components/Radio/index.css +38 -0
- package/dist/components/Radio/index.d.cts +3 -0
- package/dist/components/Radio/index.d.ts +3 -0
- package/dist/components/Radio/index.js +152 -8
- package/dist/components/Select/index.cjs +139 -13
- package/dist/components/Select/index.css +38 -0
- package/dist/components/Select/index.d.cts +3 -0
- package/dist/components/Select/index.d.ts +3 -0
- package/dist/components/Select/index.js +139 -13
- package/dist/components/Switch/index.cjs +140 -4
- package/dist/components/Switch/index.css +38 -0
- package/dist/components/Switch/index.d.cts +3 -0
- package/dist/components/Switch/index.d.ts +3 -0
- package/dist/components/Switch/index.js +140 -4
- package/dist/components/TextArea/index.cjs +138 -2
- package/dist/components/TextArea/index.css +38 -0
- package/dist/components/TextArea/index.d.cts +3 -0
- package/dist/components/TextArea/index.d.ts +3 -0
- package/dist/components/TextArea/index.js +138 -2
- package/dist/components/index.cjs +439 -385
- package/dist/components/index.css +38 -31
- package/dist/components/index.d.cts +2 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +222 -171
- package/dist/index.cjs +444 -390
- package/dist/index.css +38 -31
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +224 -173
- package/dist/validation-Dqo1zqhT.d.cts +13 -0
- package/dist/validation-Dqo1zqhT.d.ts +13 -0
- package/guidelines/components/form.md +26 -0
- package/package.json +1 -1
|
@@ -141,22 +141,41 @@ var SuccessIcon = () => /* @__PURE__ */ jsx4(
|
|
|
141
141
|
);
|
|
142
142
|
var SuccessIcon_default = SuccessIcon;
|
|
143
143
|
|
|
144
|
-
// src/components/
|
|
145
|
-
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
146
|
-
var
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
144
|
+
// src/components/FieldMessage/FieldMessage.tsx
|
|
145
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
146
|
+
var ICON = {
|
|
147
|
+
default: /* @__PURE__ */ jsx5(InfoIcon_default, {}),
|
|
148
|
+
success: /* @__PURE__ */ jsx5(SuccessIcon_default, {}),
|
|
149
|
+
warning: /* @__PURE__ */ jsx5(InfoIcon_default, {}),
|
|
150
|
+
error: /* @__PURE__ */ jsx5(ErrorIcon_default, {})
|
|
151
|
+
};
|
|
152
|
+
var FieldMessage = (props) => {
|
|
153
|
+
const { validations } = props;
|
|
154
|
+
if (!validations || validations.length === 0) return null;
|
|
155
|
+
return /* @__PURE__ */ jsx5("div", { className: "lib-xplat-field-message-wrap", children: validations.map((v, idx) => /* @__PURE__ */ jsxs3(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
className: clsx_default("lib-xplat-field-message", v.status),
|
|
159
|
+
children: [
|
|
160
|
+
/* @__PURE__ */ jsx5("div", { className: "icon", children: ICON[v.status] }),
|
|
161
|
+
/* @__PURE__ */ jsx5("span", { children: v.message })
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
`${v.message}_${idx}`
|
|
165
|
+
)) });
|
|
166
|
+
};
|
|
167
|
+
FieldMessage.displayName = "FieldMessage";
|
|
168
|
+
var FieldMessage_default = FieldMessage;
|
|
169
|
+
var Field = (props) => {
|
|
170
|
+
const { validations, children } = props;
|
|
171
|
+
if (!validations || validations.length === 0) return /* @__PURE__ */ jsx5(Fragment, { children });
|
|
172
|
+
return /* @__PURE__ */ jsxs3("div", { className: "lib-xplat-field", children: [
|
|
173
|
+
children,
|
|
174
|
+
/* @__PURE__ */ jsx5(FieldMessage, { validations })
|
|
156
175
|
] });
|
|
157
176
|
};
|
|
158
|
-
|
|
159
|
-
var
|
|
177
|
+
Field.displayName = "Field";
|
|
178
|
+
var hasError = (validations) => !!validations?.some((v) => v.status === "error");
|
|
160
179
|
|
|
161
180
|
// src/components/Input/reg.ts
|
|
162
181
|
var numberAndCommaReg = /^[0-9,]+$/;
|
|
@@ -194,7 +213,6 @@ var handleTelBackspace = (prevValue, currValue) => {
|
|
|
194
213
|
|
|
195
214
|
// src/components/Input/Input.tsx
|
|
196
215
|
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
197
|
-
import { createElement } from "react";
|
|
198
216
|
var formatValue = (type, value) => {
|
|
199
217
|
if (value === null || value === void 0) return "";
|
|
200
218
|
const strValue = Array.isArray(value) ? String(value[0] ?? "") : String(value);
|
|
@@ -283,20 +301,15 @@ var Input = React.forwardRef((props, ref) => {
|
|
|
283
301
|
disabled,
|
|
284
302
|
type: type === "number" ? "text" : type,
|
|
285
303
|
value: localValue,
|
|
286
|
-
onChange: handleChange
|
|
304
|
+
onChange: handleChange,
|
|
305
|
+
"aria-invalid": hasError(validations) || void 0
|
|
287
306
|
}
|
|
288
307
|
),
|
|
289
308
|
suffix && /* @__PURE__ */ jsx6("div", { className: "suffix", children: suffix })
|
|
290
309
|
]
|
|
291
310
|
}
|
|
292
311
|
),
|
|
293
|
-
|
|
294
|
-
InputValidations_default,
|
|
295
|
-
{
|
|
296
|
-
...validation,
|
|
297
|
-
key: `${validation.message}_${idx}`
|
|
298
|
-
}
|
|
299
|
-
)) })
|
|
312
|
+
/* @__PURE__ */ jsx6(FieldMessage_default, { validations })
|
|
300
313
|
] });
|
|
301
314
|
});
|
|
302
315
|
Input.displayName = "Input";
|
|
@@ -1460,7 +1473,7 @@ var MONTH_LABELS = {
|
|
|
1460
1473
|
};
|
|
1461
1474
|
|
|
1462
1475
|
// src/components/DatePicker/SingleDatePicker/index.tsx
|
|
1463
|
-
import { Fragment, jsx as jsx300, jsxs as jsxs191 } from "react/jsx-runtime";
|
|
1476
|
+
import { Fragment as Fragment2, jsx as jsx300, jsxs as jsxs191 } from "react/jsx-runtime";
|
|
1464
1477
|
var DayCell = React5.memo(
|
|
1465
1478
|
({
|
|
1466
1479
|
day,
|
|
@@ -1603,7 +1616,7 @@ var SingleDatePicker = (props) => {
|
|
|
1603
1616
|
},
|
|
1604
1617
|
i
|
|
1605
1618
|
)) }),
|
|
1606
|
-
pickerMode === "days" && /* @__PURE__ */ jsxs191(
|
|
1619
|
+
pickerMode === "days" && /* @__PURE__ */ jsxs191(Fragment2, { children: [
|
|
1607
1620
|
/* @__PURE__ */ jsx300("div", { className: "datepicker-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ jsx300(
|
|
1608
1621
|
"div",
|
|
1609
1622
|
{
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/FieldMessage/index.ts
|
|
21
|
+
var FieldMessage_exports = {};
|
|
22
|
+
__export(FieldMessage_exports, {
|
|
23
|
+
Field: () => Field,
|
|
24
|
+
FieldMessage: () => FieldMessage_default,
|
|
25
|
+
hasError: () => hasError
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(FieldMessage_exports);
|
|
28
|
+
|
|
29
|
+
// src/tokens/svg/status/ErrorIcon.tsx
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var ErrorIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
32
|
+
"svg",
|
|
33
|
+
{
|
|
34
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
35
|
+
width: "1em",
|
|
36
|
+
height: "1em",
|
|
37
|
+
viewBox: "0 0 16 16",
|
|
38
|
+
fill: "none",
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { clipPath: "url(#clip0_1196_9603)", children: [
|
|
41
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
42
|
+
"path",
|
|
43
|
+
{
|
|
44
|
+
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",
|
|
45
|
+
fill: "currentColor"
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
49
|
+
"path",
|
|
50
|
+
{
|
|
51
|
+
fillRule: "evenodd",
|
|
52
|
+
clipRule: "evenodd",
|
|
53
|
+
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",
|
|
54
|
+
fill: "currentColor"
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] }),
|
|
58
|
+
/* @__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" }) }) })
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
var ErrorIcon_default = ErrorIcon;
|
|
63
|
+
|
|
64
|
+
// src/tokens/svg/status/InfoIcon.tsx
|
|
65
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
66
|
+
var InfoIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
67
|
+
"svg",
|
|
68
|
+
{
|
|
69
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
70
|
+
width: "1em",
|
|
71
|
+
height: "1em",
|
|
72
|
+
viewBox: "0 0 16 16",
|
|
73
|
+
fill: "none",
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { clipPath: "url(#clip0_1188_11261)", children: [
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
77
|
+
"path",
|
|
78
|
+
{
|
|
79
|
+
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",
|
|
80
|
+
fill: "currentColor"
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
84
|
+
"path",
|
|
85
|
+
{
|
|
86
|
+
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",
|
|
87
|
+
fill: "currentColor"
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
91
|
+
"path",
|
|
92
|
+
{
|
|
93
|
+
fillRule: "evenodd",
|
|
94
|
+
clipRule: "evenodd",
|
|
95
|
+
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",
|
|
96
|
+
fill: "currentColor"
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] }),
|
|
100
|
+
/* @__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" }) }) })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
var InfoIcon_default = InfoIcon;
|
|
105
|
+
|
|
106
|
+
// src/tokens/svg/status/SuccessIcon.tsx
|
|
107
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
108
|
+
var SuccessIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
109
|
+
"svg",
|
|
110
|
+
{
|
|
111
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
112
|
+
width: "1em",
|
|
113
|
+
height: "1em",
|
|
114
|
+
viewBox: "0 0 16 16",
|
|
115
|
+
fill: "none",
|
|
116
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
117
|
+
"path",
|
|
118
|
+
{
|
|
119
|
+
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",
|
|
120
|
+
fill: "currentColor"
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
var SuccessIcon_default = SuccessIcon;
|
|
126
|
+
|
|
127
|
+
// ../../node_modules/clsx/dist/clsx.mjs
|
|
128
|
+
function r(e) {
|
|
129
|
+
var t, f, n = "";
|
|
130
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
131
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
132
|
+
var o = e.length;
|
|
133
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
134
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
135
|
+
return n;
|
|
136
|
+
}
|
|
137
|
+
function clsx() {
|
|
138
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
139
|
+
return n;
|
|
140
|
+
}
|
|
141
|
+
var clsx_default = clsx;
|
|
142
|
+
|
|
143
|
+
// src/components/FieldMessage/FieldMessage.tsx
|
|
144
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
145
|
+
var ICON = {
|
|
146
|
+
default: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon_default, {}),
|
|
147
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SuccessIcon_default, {}),
|
|
148
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon_default, {}),
|
|
149
|
+
error: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorIcon_default, {})
|
|
150
|
+
};
|
|
151
|
+
var FieldMessage = (props) => {
|
|
152
|
+
const { validations } = props;
|
|
153
|
+
if (!validations || validations.length === 0) return null;
|
|
154
|
+
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)(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
className: clsx_default("lib-xplat-field-message", v.status),
|
|
158
|
+
children: [
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "icon", children: ICON[v.status] }),
|
|
160
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: v.message })
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
`${v.message}_${idx}`
|
|
164
|
+
)) });
|
|
165
|
+
};
|
|
166
|
+
FieldMessage.displayName = "FieldMessage";
|
|
167
|
+
var FieldMessage_default = FieldMessage;
|
|
168
|
+
var Field = (props) => {
|
|
169
|
+
const { validations, children } = props;
|
|
170
|
+
if (!validations || validations.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
|
|
171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "lib-xplat-field", children: [
|
|
172
|
+
children,
|
|
173
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldMessage, { validations })
|
|
174
|
+
] });
|
|
175
|
+
};
|
|
176
|
+
Field.displayName = "Field";
|
|
177
|
+
var hasError = (validations) => !!validations?.some((v) => v.status === "error");
|
|
178
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
179
|
+
0 && (module.exports = {
|
|
180
|
+
Field,
|
|
181
|
+
FieldMessage,
|
|
182
|
+
hasError
|
|
183
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { V as Validation } from '../../validation-Dqo1zqhT.cjs';
|
|
4
|
+
|
|
5
|
+
interface FieldMessageProps {
|
|
6
|
+
/** 표시할 검증 메시지 목록. 비어 있거나 없으면 아무것도 그리지 않는다 */
|
|
7
|
+
validations?: Validation[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 폼 컨트롤 아래에 붙는 검증 메시지.
|
|
11
|
+
*
|
|
12
|
+
* 폼 컴포넌트들이 각자 렌더하지 않고 이걸 공유한다. 아이콘·색·간격이
|
|
13
|
+
* 한 곳에 모여 있어야 DS 전체에서 같은 모양이 나온다.
|
|
14
|
+
*/
|
|
15
|
+
declare const FieldMessage: {
|
|
16
|
+
(props: FieldMessageProps): react_jsx_runtime.JSX.Element | null;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 컨트롤과 검증 메시지를 묶는 래퍼.
|
|
22
|
+
*
|
|
23
|
+
* **validations 가 없으면 래퍼를 만들지 않고 children 을 그대로 통과시킨다.**
|
|
24
|
+
* 기존 사용처의 DOM 구조와 레이아웃이 바뀌지 않도록 하기 위해서다.
|
|
25
|
+
* (폼 컨트롤들의 루트가 label·div·textarea 로 제각각이라 무조건 감싸면 깨진다.)
|
|
26
|
+
*/
|
|
27
|
+
declare const Field: {
|
|
28
|
+
(props: {
|
|
29
|
+
validations?: Validation[];
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
}): react_jsx_runtime.JSX.Element;
|
|
32
|
+
displayName: string;
|
|
33
|
+
};
|
|
34
|
+
/** validations 중 하나라도 error 면 true. aria-invalid 판정에 쓴다 */
|
|
35
|
+
declare const hasError: (validations?: Validation[]) => boolean;
|
|
36
|
+
|
|
37
|
+
export { Field, FieldMessage, hasError };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { V as Validation } from '../../validation-Dqo1zqhT.js';
|
|
4
|
+
|
|
5
|
+
interface FieldMessageProps {
|
|
6
|
+
/** 표시할 검증 메시지 목록. 비어 있거나 없으면 아무것도 그리지 않는다 */
|
|
7
|
+
validations?: Validation[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 폼 컨트롤 아래에 붙는 검증 메시지.
|
|
11
|
+
*
|
|
12
|
+
* 폼 컴포넌트들이 각자 렌더하지 않고 이걸 공유한다. 아이콘·색·간격이
|
|
13
|
+
* 한 곳에 모여 있어야 DS 전체에서 같은 모양이 나온다.
|
|
14
|
+
*/
|
|
15
|
+
declare const FieldMessage: {
|
|
16
|
+
(props: FieldMessageProps): react_jsx_runtime.JSX.Element | null;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 컨트롤과 검증 메시지를 묶는 래퍼.
|
|
22
|
+
*
|
|
23
|
+
* **validations 가 없으면 래퍼를 만들지 않고 children 을 그대로 통과시킨다.**
|
|
24
|
+
* 기존 사용처의 DOM 구조와 레이아웃이 바뀌지 않도록 하기 위해서다.
|
|
25
|
+
* (폼 컨트롤들의 루트가 label·div·textarea 로 제각각이라 무조건 감싸면 깨진다.)
|
|
26
|
+
*/
|
|
27
|
+
declare const Field: {
|
|
28
|
+
(props: {
|
|
29
|
+
validations?: Validation[];
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
}): react_jsx_runtime.JSX.Element;
|
|
32
|
+
displayName: string;
|
|
33
|
+
};
|
|
34
|
+
/** validations 중 하나라도 error 면 true. aria-invalid 판정에 쓴다 */
|
|
35
|
+
declare const hasError: (validations?: Validation[]) => boolean;
|
|
36
|
+
|
|
37
|
+
export { Field, FieldMessage, hasError };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// src/tokens/svg/status/ErrorIcon.tsx
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
var ErrorIcon = () => /* @__PURE__ */ jsxs(
|
|
4
|
+
"svg",
|
|
5
|
+
{
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
width: "1em",
|
|
8
|
+
height: "1em",
|
|
9
|
+
viewBox: "0 0 16 16",
|
|
10
|
+
fill: "none",
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ jsxs("g", { clipPath: "url(#clip0_1196_9603)", children: [
|
|
13
|
+
/* @__PURE__ */ jsx(
|
|
14
|
+
"path",
|
|
15
|
+
{
|
|
16
|
+
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",
|
|
17
|
+
fill: "currentColor"
|
|
18
|
+
}
|
|
19
|
+
),
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
"path",
|
|
22
|
+
{
|
|
23
|
+
fillRule: "evenodd",
|
|
24
|
+
clipRule: "evenodd",
|
|
25
|
+
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",
|
|
26
|
+
fill: "currentColor"
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
] }),
|
|
30
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_1196_9603", children: /* @__PURE__ */ jsx("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
var ErrorIcon_default = ErrorIcon;
|
|
35
|
+
|
|
36
|
+
// src/tokens/svg/status/InfoIcon.tsx
|
|
37
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
38
|
+
var InfoIcon = () => /* @__PURE__ */ jsxs2(
|
|
39
|
+
"svg",
|
|
40
|
+
{
|
|
41
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
42
|
+
width: "1em",
|
|
43
|
+
height: "1em",
|
|
44
|
+
viewBox: "0 0 16 16",
|
|
45
|
+
fill: "none",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsxs2("g", { clipPath: "url(#clip0_1188_11261)", children: [
|
|
48
|
+
/* @__PURE__ */ jsx2(
|
|
49
|
+
"path",
|
|
50
|
+
{
|
|
51
|
+
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",
|
|
52
|
+
fill: "currentColor"
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsx2(
|
|
56
|
+
"path",
|
|
57
|
+
{
|
|
58
|
+
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",
|
|
59
|
+
fill: "currentColor"
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ jsx2(
|
|
63
|
+
"path",
|
|
64
|
+
{
|
|
65
|
+
fillRule: "evenodd",
|
|
66
|
+
clipRule: "evenodd",
|
|
67
|
+
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",
|
|
68
|
+
fill: "currentColor"
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ jsx2("defs", { children: /* @__PURE__ */ jsx2("clipPath", { id: "clip0_1188_11261", children: /* @__PURE__ */ jsx2("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
var InfoIcon_default = InfoIcon;
|
|
77
|
+
|
|
78
|
+
// src/tokens/svg/status/SuccessIcon.tsx
|
|
79
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
80
|
+
var SuccessIcon = () => /* @__PURE__ */ jsx3(
|
|
81
|
+
"svg",
|
|
82
|
+
{
|
|
83
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
84
|
+
width: "1em",
|
|
85
|
+
height: "1em",
|
|
86
|
+
viewBox: "0 0 16 16",
|
|
87
|
+
fill: "none",
|
|
88
|
+
children: /* @__PURE__ */ jsx3(
|
|
89
|
+
"path",
|
|
90
|
+
{
|
|
91
|
+
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",
|
|
92
|
+
fill: "currentColor"
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
var SuccessIcon_default = SuccessIcon;
|
|
98
|
+
|
|
99
|
+
// ../../node_modules/clsx/dist/clsx.mjs
|
|
100
|
+
function r(e) {
|
|
101
|
+
var t, f, n = "";
|
|
102
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
103
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
104
|
+
var o = e.length;
|
|
105
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
106
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
107
|
+
return n;
|
|
108
|
+
}
|
|
109
|
+
function clsx() {
|
|
110
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
111
|
+
return n;
|
|
112
|
+
}
|
|
113
|
+
var clsx_default = clsx;
|
|
114
|
+
|
|
115
|
+
// src/components/FieldMessage/FieldMessage.tsx
|
|
116
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
117
|
+
var ICON = {
|
|
118
|
+
default: /* @__PURE__ */ jsx4(InfoIcon_default, {}),
|
|
119
|
+
success: /* @__PURE__ */ jsx4(SuccessIcon_default, {}),
|
|
120
|
+
warning: /* @__PURE__ */ jsx4(InfoIcon_default, {}),
|
|
121
|
+
error: /* @__PURE__ */ jsx4(ErrorIcon_default, {})
|
|
122
|
+
};
|
|
123
|
+
var FieldMessage = (props) => {
|
|
124
|
+
const { validations } = props;
|
|
125
|
+
if (!validations || validations.length === 0) return null;
|
|
126
|
+
return /* @__PURE__ */ jsx4("div", { className: "lib-xplat-field-message-wrap", children: validations.map((v, idx) => /* @__PURE__ */ jsxs3(
|
|
127
|
+
"div",
|
|
128
|
+
{
|
|
129
|
+
className: clsx_default("lib-xplat-field-message", v.status),
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ jsx4("div", { className: "icon", children: ICON[v.status] }),
|
|
132
|
+
/* @__PURE__ */ jsx4("span", { children: v.message })
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
`${v.message}_${idx}`
|
|
136
|
+
)) });
|
|
137
|
+
};
|
|
138
|
+
FieldMessage.displayName = "FieldMessage";
|
|
139
|
+
var FieldMessage_default = FieldMessage;
|
|
140
|
+
var Field = (props) => {
|
|
141
|
+
const { validations, children } = props;
|
|
142
|
+
if (!validations || validations.length === 0) return /* @__PURE__ */ jsx4(Fragment, { children });
|
|
143
|
+
return /* @__PURE__ */ jsxs3("div", { className: "lib-xplat-field", children: [
|
|
144
|
+
children,
|
|
145
|
+
/* @__PURE__ */ jsx4(FieldMessage, { validations })
|
|
146
|
+
] });
|
|
147
|
+
};
|
|
148
|
+
Field.displayName = "Field";
|
|
149
|
+
var hasError = (validations) => !!validations?.some((v) => v.status === "error");
|
|
150
|
+
export {
|
|
151
|
+
Field,
|
|
152
|
+
FieldMessage_default as FieldMessage,
|
|
153
|
+
hasError
|
|
154
|
+
};
|