@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.
Files changed (72) hide show
  1. package/dist/components/AutoResizeTextArea/index.cjs +140 -4
  2. package/dist/components/AutoResizeTextArea/index.css +38 -0
  3. package/dist/components/AutoResizeTextArea/index.d.cts +3 -0
  4. package/dist/components/AutoResizeTextArea/index.d.ts +3 -0
  5. package/dist/components/AutoResizeTextArea/index.js +140 -4
  6. package/dist/components/ChatInput/index.cjs +150 -9
  7. package/dist/components/ChatInput/index.css +38 -0
  8. package/dist/components/ChatInput/index.d.cts +3 -0
  9. package/dist/components/ChatInput/index.d.ts +3 -0
  10. package/dist/components/ChatInput/index.js +151 -10
  11. package/dist/components/CheckBox/index.cjs +132 -5
  12. package/dist/components/CheckBox/index.css +38 -0
  13. package/dist/components/CheckBox/index.d.cts +3 -0
  14. package/dist/components/CheckBox/index.d.ts +3 -0
  15. package/dist/components/CheckBox/index.js +132 -5
  16. package/dist/components/DatePicker/index.cjs +72 -59
  17. package/dist/components/DatePicker/index.css +38 -31
  18. package/dist/components/DatePicker/index.js +38 -25
  19. package/dist/components/FieldMessage/index.cjs +183 -0
  20. package/dist/components/FieldMessage/index.css +37 -0
  21. package/dist/components/FieldMessage/index.d.cts +37 -0
  22. package/dist/components/FieldMessage/index.d.ts +37 -0
  23. package/dist/components/FieldMessage/index.js +154 -0
  24. package/dist/components/FileUpload/index.cjs +135 -8
  25. package/dist/components/FileUpload/index.css +38 -0
  26. package/dist/components/FileUpload/index.d.cts +3 -0
  27. package/dist/components/FileUpload/index.d.ts +3 -0
  28. package/dist/components/FileUpload/index.js +135 -8
  29. package/dist/components/ImageSelector/index.cjs +153 -11
  30. package/dist/components/ImageSelector/index.css +38 -0
  31. package/dist/components/ImageSelector/index.d.cts +3 -0
  32. package/dist/components/ImageSelector/index.d.ts +3 -0
  33. package/dist/components/ImageSelector/index.js +153 -11
  34. package/dist/components/Input/index.cjs +38 -25
  35. package/dist/components/Input/index.css +38 -31
  36. package/dist/components/Input/index.d.cts +3 -8
  37. package/dist/components/Input/index.d.ts +3 -8
  38. package/dist/components/Input/index.js +36 -23
  39. package/dist/components/Radio/index.cjs +152 -8
  40. package/dist/components/Radio/index.css +38 -0
  41. package/dist/components/Radio/index.d.cts +3 -0
  42. package/dist/components/Radio/index.d.ts +3 -0
  43. package/dist/components/Radio/index.js +152 -8
  44. package/dist/components/Select/index.cjs +139 -13
  45. package/dist/components/Select/index.css +38 -0
  46. package/dist/components/Select/index.d.cts +3 -0
  47. package/dist/components/Select/index.d.ts +3 -0
  48. package/dist/components/Select/index.js +139 -13
  49. package/dist/components/Switch/index.cjs +140 -4
  50. package/dist/components/Switch/index.css +38 -0
  51. package/dist/components/Switch/index.d.cts +3 -0
  52. package/dist/components/Switch/index.d.ts +3 -0
  53. package/dist/components/Switch/index.js +140 -4
  54. package/dist/components/TextArea/index.cjs +138 -2
  55. package/dist/components/TextArea/index.css +38 -0
  56. package/dist/components/TextArea/index.d.cts +3 -0
  57. package/dist/components/TextArea/index.d.ts +3 -0
  58. package/dist/components/TextArea/index.js +138 -2
  59. package/dist/components/index.cjs +439 -385
  60. package/dist/components/index.css +38 -31
  61. package/dist/components/index.d.cts +2 -0
  62. package/dist/components/index.d.ts +2 -0
  63. package/dist/components/index.js +222 -171
  64. package/dist/index.cjs +444 -390
  65. package/dist/index.css +38 -31
  66. package/dist/index.d.cts +2 -0
  67. package/dist/index.d.ts +2 -0
  68. package/dist/index.js +224 -173
  69. package/dist/validation-Dqo1zqhT.d.cts +13 -0
  70. package/dist/validation-Dqo1zqhT.d.ts +13 -0
  71. package/guidelines/components/form.md +26 -0
  72. package/package.json +1 -1
@@ -1,3 +1,41 @@
1
+ /* src/components/FieldMessage/fieldMessage.scss */
2
+ .lib-xplat-field {
3
+ display: flex;
4
+ flex-direction: column;
5
+ gap: var(--spacing-space-2);
6
+ }
7
+ .lib-xplat-field-message-wrap {
8
+ display: flex;
9
+ gap: var(--spacing-space-2);
10
+ margin-left: var(--spacing-space-1);
11
+ }
12
+ .lib-xplat-field-message-wrap > .lib-xplat-field-message {
13
+ display: flex;
14
+ gap: var(--spacing-space-1);
15
+ font-family: var(--semantic-typo-caption-2-r-font);
16
+ font-size: var(--semantic-typo-caption-2-r-size);
17
+ line-height: var(--semantic-typo-caption-2-r-lh);
18
+ font-weight: var(--semantic-typo-caption-2-r-weight);
19
+ letter-spacing: var(--semantic-typo-caption-2-r-ls);
20
+ align-items: center;
21
+ user-select: none;
22
+ }
23
+ .lib-xplat-field-message-wrap > .lib-xplat-field-message.default {
24
+ color: var(--semantic-icon-secondary);
25
+ }
26
+ .lib-xplat-field-message-wrap > .lib-xplat-field-message.success {
27
+ color: var(--semantic-text-success);
28
+ }
29
+ .lib-xplat-field-message-wrap > .lib-xplat-field-message.warning {
30
+ color: var(--semantic-text-warning);
31
+ }
32
+ .lib-xplat-field-message-wrap > .lib-xplat-field-message.error {
33
+ color: var(--semantic-text-error);
34
+ }
35
+ .lib-xplat-field-message-wrap > .lib-xplat-field-message > .icon {
36
+ font-size: var(--semantic-typo-label-2-m-size);
37
+ }
38
+
1
39
  /* src/components/Input/input.scss */
2
40
  .lib-xplat-input-wrap {
3
41
  display: flex;
@@ -80,34 +118,3 @@
80
118
  .lib-xplat-input-wrap .lib-xplat-input > .suffix > .wrapper.pointer {
81
119
  cursor: pointer;
82
120
  }
83
- .lib-xplat-input-wrap .lib-xplat-input-validation-wrap {
84
- display: flex;
85
- gap: var(--spacing-space-2);
86
- margin-left: var(--spacing-space-1);
87
- }
88
- .lib-xplat-input-wrap .lib-xplat-input-validation-wrap > .lib-xplat-input-validation {
89
- display: flex;
90
- gap: var(--spacing-space-1);
91
- font-family: var(--semantic-typo-caption-2-r-font);
92
- font-size: var(--semantic-typo-caption-2-r-size);
93
- line-height: var(--semantic-typo-caption-2-r-lh);
94
- font-weight: var(--semantic-typo-caption-2-r-weight);
95
- letter-spacing: var(--semantic-typo-caption-2-r-ls);
96
- align-items: center;
97
- user-select: none;
98
- }
99
- .lib-xplat-input-wrap .lib-xplat-input-validation-wrap > .lib-xplat-input-validation.default {
100
- color: var(--semantic-icon-secondary);
101
- }
102
- .lib-xplat-input-wrap .lib-xplat-input-validation-wrap > .lib-xplat-input-validation.success {
103
- color: var(--semantic-text-success);
104
- }
105
- .lib-xplat-input-wrap .lib-xplat-input-validation-wrap > .lib-xplat-input-validation.warning {
106
- color: var(--semantic-text-warning);
107
- }
108
- .lib-xplat-input-wrap .lib-xplat-input-validation-wrap > .lib-xplat-input-validation.error {
109
- color: var(--semantic-text-error);
110
- }
111
- .lib-xplat-input-wrap .lib-xplat-input-validation-wrap > .lib-xplat-input-validation > .icon {
112
- font-size: var(--semantic-typo-label-2-m-size);
113
- }
@@ -1,24 +1,19 @@
1
1
  import React from 'react';
2
2
  import { I as InputAttributes } from '../../attributes-DJIWir_0.cjs';
3
+ import { V as Validation } from '../../validation-Dqo1zqhT.cjs';
3
4
 
4
5
  type InputSize$1 = "sm" | "md" | "lg";
5
6
  interface InputProps extends Omit<InputAttributes, "size"> {
6
7
  type?: "text" | "number" | "email" | "password" | "tel";
7
8
  size?: InputSize$1;
8
- validations?: {
9
- status: "error" | "warning" | "success" | "default";
10
- message: string;
11
- }[];
9
+ validations?: Validation[];
12
10
  suffix?: React.ReactNode;
13
11
  }
14
12
  declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
15
13
 
16
14
  type InputSize = "sm" | "md" | "lg";
17
15
  interface PasswordInputProps extends Omit<InputAttributes, "size"> {
18
- validations?: {
19
- status: "error" | "warning" | "success" | "default";
20
- message: string;
21
- }[];
16
+ validations?: Validation[];
22
17
  size?: InputSize;
23
18
  reg?: RegExp;
24
19
  }
@@ -1,24 +1,19 @@
1
1
  import React from 'react';
2
2
  import { I as InputAttributes } from '../../attributes-DJIWir_0.js';
3
+ import { V as Validation } from '../../validation-Dqo1zqhT.js';
3
4
 
4
5
  type InputSize$1 = "sm" | "md" | "lg";
5
6
  interface InputProps extends Omit<InputAttributes, "size"> {
6
7
  type?: "text" | "number" | "email" | "password" | "tel";
7
8
  size?: InputSize$1;
8
- validations?: {
9
- status: "error" | "warning" | "success" | "default";
10
- message: string;
11
- }[];
9
+ validations?: Validation[];
12
10
  suffix?: React.ReactNode;
13
11
  }
14
12
  declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
15
13
 
16
14
  type InputSize = "sm" | "md" | "lg";
17
15
  interface PasswordInputProps extends Omit<InputAttributes, "size"> {
18
- validations?: {
19
- status: "error" | "warning" | "success" | "default";
20
- message: string;
21
- }[];
16
+ validations?: Validation[];
22
17
  size?: InputSize;
23
18
  reg?: RegExp;
24
19
  }
@@ -115,22 +115,41 @@ var SuccessIcon = () => /* @__PURE__ */ jsx3(
115
115
  );
116
116
  var SuccessIcon_default = SuccessIcon;
117
117
 
118
- // src/components/Input/InputValidations.tsx
119
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
120
- var InputValidations = (props) => {
121
- const { message, status = "default" } = props;
122
- return /* @__PURE__ */ jsxs3("div", { className: clsx_default("lib-xplat-input-validation", status), children: [
123
- /* @__PURE__ */ jsxs3("div", { className: "icon", children: [
124
- status === "default" && /* @__PURE__ */ jsx4(InfoIcon_default, {}),
125
- status === "success" && /* @__PURE__ */ jsx4(SuccessIcon_default, {}),
126
- status === "warning" && /* @__PURE__ */ jsx4(InfoIcon_default, {}),
127
- status === "error" && /* @__PURE__ */ jsx4(ErrorIcon_default, {})
128
- ] }),
129
- /* @__PURE__ */ jsx4("div", { className: "message", children: message })
118
+ // src/components/FieldMessage/FieldMessage.tsx
119
+ import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
120
+ var ICON = {
121
+ default: /* @__PURE__ */ jsx4(InfoIcon_default, {}),
122
+ success: /* @__PURE__ */ jsx4(SuccessIcon_default, {}),
123
+ warning: /* @__PURE__ */ jsx4(InfoIcon_default, {}),
124
+ error: /* @__PURE__ */ jsx4(ErrorIcon_default, {})
125
+ };
126
+ var FieldMessage = (props) => {
127
+ const { validations } = props;
128
+ if (!validations || validations.length === 0) return null;
129
+ return /* @__PURE__ */ jsx4("div", { className: "lib-xplat-field-message-wrap", children: validations.map((v, idx) => /* @__PURE__ */ jsxs3(
130
+ "div",
131
+ {
132
+ className: clsx_default("lib-xplat-field-message", v.status),
133
+ children: [
134
+ /* @__PURE__ */ jsx4("div", { className: "icon", children: ICON[v.status] }),
135
+ /* @__PURE__ */ jsx4("span", { children: v.message })
136
+ ]
137
+ },
138
+ `${v.message}_${idx}`
139
+ )) });
140
+ };
141
+ FieldMessage.displayName = "FieldMessage";
142
+ var FieldMessage_default = FieldMessage;
143
+ var Field = (props) => {
144
+ const { validations, children } = props;
145
+ if (!validations || validations.length === 0) return /* @__PURE__ */ jsx4(Fragment, { children });
146
+ return /* @__PURE__ */ jsxs3("div", { className: "lib-xplat-field", children: [
147
+ children,
148
+ /* @__PURE__ */ jsx4(FieldMessage, { validations })
130
149
  ] });
131
150
  };
132
- InputValidations.displayName = "InputValidations";
133
- var InputValidations_default = InputValidations;
151
+ Field.displayName = "Field";
152
+ var hasError = (validations) => !!validations?.some((v) => v.status === "error");
134
153
 
135
154
  // src/components/Input/reg.ts
136
155
  var numberAndCommaReg = /^[0-9,]+$/;
@@ -168,7 +187,6 @@ var handleTelBackspace = (prevValue, currValue) => {
168
187
 
169
188
  // src/components/Input/Input.tsx
170
189
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
171
- import { createElement } from "react";
172
190
  var formatValue = (type, value) => {
173
191
  if (value === null || value === void 0) return "";
174
192
  const strValue = Array.isArray(value) ? String(value[0] ?? "") : String(value);
@@ -257,20 +275,15 @@ var Input = React.forwardRef((props, ref) => {
257
275
  disabled,
258
276
  type: type === "number" ? "text" : type,
259
277
  value: localValue,
260
- onChange: handleChange
278
+ onChange: handleChange,
279
+ "aria-invalid": hasError(validations) || void 0
261
280
  }
262
281
  ),
263
282
  suffix && /* @__PURE__ */ jsx5("div", { className: "suffix", children: suffix })
264
283
  ]
265
284
  }
266
285
  ),
267
- validations && /* @__PURE__ */ jsx5("div", { className: "lib-xplat-input-validation-wrap", children: validations?.map((validation, idx) => /* @__PURE__ */ createElement(
268
- InputValidations_default,
269
- {
270
- ...validation,
271
- key: `${validation.message}_${idx}`
272
- }
273
- )) })
286
+ /* @__PURE__ */ jsx5(FieldMessage_default, { validations })
274
287
  ] });
275
288
  });
276
289
  Input.displayName = "Input";
@@ -51,6 +51,139 @@ function clsx() {
51
51
  }
52
52
  var clsx_default = clsx;
53
53
 
54
+ // src/tokens/svg/status/ErrorIcon.tsx
55
+ var import_jsx_runtime = require("react/jsx-runtime");
56
+ var ErrorIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
57
+ "svg",
58
+ {
59
+ xmlns: "http://www.w3.org/2000/svg",
60
+ width: "1em",
61
+ height: "1em",
62
+ viewBox: "0 0 16 16",
63
+ fill: "none",
64
+ children: [
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { clipPath: "url(#clip0_1196_9603)", children: [
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
+ "path",
68
+ {
69
+ 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",
70
+ fill: "currentColor"
71
+ }
72
+ ),
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ "path",
75
+ {
76
+ fillRule: "evenodd",
77
+ clipRule: "evenodd",
78
+ 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",
79
+ fill: "currentColor"
80
+ }
81
+ )
82
+ ] }),
83
+ /* @__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" }) }) })
84
+ ]
85
+ }
86
+ );
87
+ var ErrorIcon_default = ErrorIcon;
88
+
89
+ // src/tokens/svg/status/InfoIcon.tsx
90
+ var import_jsx_runtime2 = require("react/jsx-runtime");
91
+ var InfoIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
92
+ "svg",
93
+ {
94
+ xmlns: "http://www.w3.org/2000/svg",
95
+ width: "1em",
96
+ height: "1em",
97
+ viewBox: "0 0 16 16",
98
+ fill: "none",
99
+ children: [
100
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { clipPath: "url(#clip0_1188_11261)", children: [
101
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
102
+ "path",
103
+ {
104
+ 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",
105
+ fill: "currentColor"
106
+ }
107
+ ),
108
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
109
+ "path",
110
+ {
111
+ 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",
112
+ fill: "currentColor"
113
+ }
114
+ ),
115
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
116
+ "path",
117
+ {
118
+ fillRule: "evenodd",
119
+ clipRule: "evenodd",
120
+ 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",
121
+ fill: "currentColor"
122
+ }
123
+ )
124
+ ] }),
125
+ /* @__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" }) }) })
126
+ ]
127
+ }
128
+ );
129
+ var InfoIcon_default = InfoIcon;
130
+
131
+ // src/tokens/svg/status/SuccessIcon.tsx
132
+ var import_jsx_runtime3 = require("react/jsx-runtime");
133
+ var SuccessIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
134
+ "svg",
135
+ {
136
+ xmlns: "http://www.w3.org/2000/svg",
137
+ width: "1em",
138
+ height: "1em",
139
+ viewBox: "0 0 16 16",
140
+ fill: "none",
141
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
142
+ "path",
143
+ {
144
+ 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",
145
+ fill: "currentColor"
146
+ }
147
+ )
148
+ }
149
+ );
150
+ var SuccessIcon_default = SuccessIcon;
151
+
152
+ // src/components/FieldMessage/FieldMessage.tsx
153
+ var import_jsx_runtime4 = require("react/jsx-runtime");
154
+ var ICON = {
155
+ default: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon_default, {}),
156
+ success: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SuccessIcon_default, {}),
157
+ warning: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon_default, {}),
158
+ error: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorIcon_default, {})
159
+ };
160
+ var FieldMessage = (props) => {
161
+ const { validations } = props;
162
+ if (!validations || validations.length === 0) return null;
163
+ 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)(
164
+ "div",
165
+ {
166
+ className: clsx_default("lib-xplat-field-message", v.status),
167
+ children: [
168
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "icon", children: ICON[v.status] }),
169
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: v.message })
170
+ ]
171
+ },
172
+ `${v.message}_${idx}`
173
+ )) });
174
+ };
175
+ FieldMessage.displayName = "FieldMessage";
176
+ var Field = (props) => {
177
+ const { validations, children } = props;
178
+ if (!validations || validations.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
179
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "lib-xplat-field", children: [
180
+ children,
181
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldMessage, { validations })
182
+ ] });
183
+ };
184
+ Field.displayName = "Field";
185
+ var hasError = (validations) => !!validations?.some((v) => v.status === "error");
186
+
54
187
  // src/components/Radio/RadioGroupContext.tsx
55
188
  var import_react = __toESM(require("react"), 1);
56
189
  var RadioGroupContext = import_react.default.createContext(
@@ -62,7 +195,7 @@ var useRadioGroupContext = () => {
62
195
  var RadioGroupContext_default = RadioGroupContext;
63
196
 
64
197
  // src/components/Radio/Radio.tsx
65
- var import_jsx_runtime = require("react/jsx-runtime");
198
+ var import_jsx_runtime5 = require("react/jsx-runtime");
66
199
  var Radio = (props) => {
67
200
  const {
68
201
  label,
@@ -70,6 +203,7 @@ var Radio = (props) => {
70
203
  value,
71
204
  size: sizeProp,
72
205
  type = "brand",
206
+ validations,
73
207
  ...rest
74
208
  } = props;
75
209
  const context = useRadioGroupContext();
@@ -81,7 +215,7 @@ var Radio = (props) => {
81
215
  value,
82
216
  onChange: rest.onChange
83
217
  };
84
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
218
+ const control = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
85
219
  "label",
86
220
  {
87
221
  className: clsx_default(
@@ -92,30 +226,40 @@ var Radio = (props) => {
92
226
  className
93
227
  ),
94
228
  children: [
95
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { ...rest, ...inputProps, checked: localChecked, type: "radio" }),
96
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
229
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
230
+ "input",
231
+ {
232
+ ...rest,
233
+ ...inputProps,
234
+ checked: localChecked,
235
+ type: "radio",
236
+ "aria-invalid": hasError(validations) || void 0
237
+ }
238
+ ),
239
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
97
240
  "div",
98
241
  {
99
242
  className: clsx_default(
100
243
  "circle",
101
244
  localChecked ? "checked" : void 0
102
245
  ),
103
- children: localChecked && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "inner-circle" })
246
+ children: localChecked && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "inner-circle" })
104
247
  }
105
248
  ),
106
- label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: label })
249
+ label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: label })
107
250
  ]
108
251
  }
109
252
  );
253
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Field, { validations, children: control });
110
254
  };
111
255
  Radio.displayName = "Radio";
112
256
  var Radio_default = Radio;
113
257
 
114
258
  // src/components/Radio/RadioGroup.tsx
115
- var import_jsx_runtime2 = require("react/jsx-runtime");
259
+ var import_jsx_runtime6 = require("react/jsx-runtime");
116
260
  var RadioGroup = (props) => {
117
261
  const { children, ...rest } = props;
118
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RadioGroupContext_default.Provider, { value: rest, children }) });
262
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RadioGroupContext_default.Provider, { value: rest, children }) });
119
263
  };
120
264
  RadioGroup.displayName = "RadioGroup";
121
265
  var RadioGroup_default = RadioGroup;
@@ -1,3 +1,41 @@
1
+ /* src/components/FieldMessage/fieldMessage.scss */
2
+ .lib-xplat-field {
3
+ display: flex;
4
+ flex-direction: column;
5
+ gap: var(--spacing-space-2);
6
+ }
7
+ .lib-xplat-field-message-wrap {
8
+ display: flex;
9
+ gap: var(--spacing-space-2);
10
+ margin-left: var(--spacing-space-1);
11
+ }
12
+ .lib-xplat-field-message-wrap > .lib-xplat-field-message {
13
+ display: flex;
14
+ gap: var(--spacing-space-1);
15
+ font-family: var(--semantic-typo-caption-2-r-font);
16
+ font-size: var(--semantic-typo-caption-2-r-size);
17
+ line-height: var(--semantic-typo-caption-2-r-lh);
18
+ font-weight: var(--semantic-typo-caption-2-r-weight);
19
+ letter-spacing: var(--semantic-typo-caption-2-r-ls);
20
+ align-items: center;
21
+ user-select: none;
22
+ }
23
+ .lib-xplat-field-message-wrap > .lib-xplat-field-message.default {
24
+ color: var(--semantic-icon-secondary);
25
+ }
26
+ .lib-xplat-field-message-wrap > .lib-xplat-field-message.success {
27
+ color: var(--semantic-text-success);
28
+ }
29
+ .lib-xplat-field-message-wrap > .lib-xplat-field-message.warning {
30
+ color: var(--semantic-text-warning);
31
+ }
32
+ .lib-xplat-field-message-wrap > .lib-xplat-field-message.error {
33
+ color: var(--semantic-text-error);
34
+ }
35
+ .lib-xplat-field-message-wrap > .lib-xplat-field-message > .icon {
36
+ font-size: var(--semantic-typo-label-2-m-size);
37
+ }
38
+
1
39
  /* src/components/Radio/radio.scss */
2
40
  .lib-xplat-radio {
3
41
  display: flex;
@@ -1,5 +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 { V as Validation } from '../../validation-Dqo1zqhT.cjs';
3
4
  import React from 'react';
4
5
 
5
6
  type RadioSize = "sm" | "md" | "lg";
@@ -11,6 +12,8 @@ interface RadioProps extends Omit<InputAttributes, "size"> {
11
12
  */
12
13
  name?: string;
13
14
  value: string | number;
15
+ /** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
16
+ validations?: Validation[];
14
17
  size?: RadioSize;
15
18
  type?: RadioType;
16
19
  }
@@ -1,5 +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 { V as Validation } from '../../validation-Dqo1zqhT.js';
3
4
  import React from 'react';
4
5
 
5
6
  type RadioSize = "sm" | "md" | "lg";
@@ -11,6 +12,8 @@ interface RadioProps extends Omit<InputAttributes, "size"> {
11
12
  */
12
13
  name?: string;
13
14
  value: string | number;
15
+ /** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
16
+ validations?: Validation[];
14
17
  size?: RadioSize;
15
18
  type?: RadioType;
16
19
  }