@x-plat/design-system 0.8.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) 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 +4 -0
  4. package/dist/components/AutoResizeTextArea/index.d.ts +4 -0
  5. package/dist/components/AutoResizeTextArea/index.js +140 -4
  6. package/dist/components/Badge/index.cjs +5 -1
  7. package/dist/components/Badge/index.css +1 -0
  8. package/dist/components/Badge/index.d.cts +1 -0
  9. package/dist/components/Badge/index.d.ts +1 -0
  10. package/dist/components/Badge/index.js +5 -1
  11. package/dist/components/Box/index.d.cts +3 -0
  12. package/dist/components/Box/index.d.ts +3 -0
  13. package/dist/components/Chart/index.cjs +7 -6
  14. package/dist/components/Chart/index.d.cts +12 -1
  15. package/dist/components/Chart/index.d.ts +12 -1
  16. package/dist/components/Chart/index.js +7 -6
  17. package/dist/components/ChatInput/index.cjs +150 -9
  18. package/dist/components/ChatInput/index.css +38 -0
  19. package/dist/components/ChatInput/index.d.cts +9 -0
  20. package/dist/components/ChatInput/index.d.ts +9 -0
  21. package/dist/components/ChatInput/index.js +151 -10
  22. package/dist/components/CheckBox/index.cjs +137 -6
  23. package/dist/components/CheckBox/index.css +40 -0
  24. package/dist/components/CheckBox/index.d.cts +13 -2
  25. package/dist/components/CheckBox/index.d.ts +13 -2
  26. package/dist/components/CheckBox/index.js +137 -6
  27. package/dist/components/Chip/index.d.cts +2 -0
  28. package/dist/components/Chip/index.d.ts +2 -0
  29. package/dist/components/DatePicker/index.cjs +76 -62
  30. package/dist/components/DatePicker/index.css +38 -31
  31. package/dist/components/DatePicker/index.js +42 -28
  32. package/dist/components/Drawer/index.d.cts +1 -0
  33. package/dist/components/Drawer/index.d.ts +1 -0
  34. package/dist/components/FieldMessage/index.cjs +183 -0
  35. package/dist/components/FieldMessage/index.css +37 -0
  36. package/dist/components/FieldMessage/index.d.cts +37 -0
  37. package/dist/components/FieldMessage/index.d.ts +37 -0
  38. package/dist/components/FieldMessage/index.js +154 -0
  39. package/dist/components/FileUpload/index.cjs +135 -8
  40. package/dist/components/FileUpload/index.css +38 -0
  41. package/dist/components/FileUpload/index.d.cts +9 -0
  42. package/dist/components/FileUpload/index.d.ts +9 -0
  43. package/dist/components/FileUpload/index.js +135 -8
  44. package/dist/components/ImageSelector/index.cjs +153 -11
  45. package/dist/components/ImageSelector/index.css +38 -0
  46. package/dist/components/ImageSelector/index.d.cts +6 -0
  47. package/dist/components/ImageSelector/index.d.ts +6 -0
  48. package/dist/components/ImageSelector/index.js +153 -11
  49. package/dist/components/Input/index.cjs +38 -25
  50. package/dist/components/Input/index.css +38 -31
  51. package/dist/components/Input/index.d.cts +7 -8
  52. package/dist/components/Input/index.d.ts +7 -8
  53. package/dist/components/Input/index.js +36 -23
  54. package/dist/components/NotificationBadge/index.cjs +5 -1
  55. package/dist/components/NotificationBadge/index.css +1 -0
  56. package/dist/components/NotificationBadge/index.d.cts +6 -2
  57. package/dist/components/NotificationBadge/index.d.ts +6 -2
  58. package/dist/components/NotificationBadge/index.js +5 -1
  59. package/dist/components/Pagination/index.cjs +6 -2
  60. package/dist/components/Pagination/index.css +1 -0
  61. package/dist/components/Pagination/index.d.cts +13 -2
  62. package/dist/components/Pagination/index.d.ts +13 -2
  63. package/dist/components/Pagination/index.js +6 -2
  64. package/dist/components/Progress/index.cjs +6 -2
  65. package/dist/components/Progress/index.css +1 -0
  66. package/dist/components/Progress/index.d.cts +11 -2
  67. package/dist/components/Progress/index.d.ts +11 -2
  68. package/dist/components/Progress/index.js +6 -2
  69. package/dist/components/Radio/index.cjs +158 -10
  70. package/dist/components/Radio/index.css +40 -0
  71. package/dist/components/Radio/index.d.cts +14 -2
  72. package/dist/components/Radio/index.d.ts +14 -2
  73. package/dist/components/Radio/index.js +158 -10
  74. package/dist/components/Select/index.cjs +139 -13
  75. package/dist/components/Select/index.css +38 -0
  76. package/dist/components/Select/index.d.cts +8 -1
  77. package/dist/components/Select/index.d.ts +8 -1
  78. package/dist/components/Select/index.js +139 -13
  79. package/dist/components/Skeleton/index.d.cts +3 -0
  80. package/dist/components/Skeleton/index.d.ts +3 -0
  81. package/dist/components/Spinner/index.cjs +6 -2
  82. package/dist/components/Spinner/index.css +1 -0
  83. package/dist/components/Spinner/index.d.cts +8 -2
  84. package/dist/components/Spinner/index.d.ts +8 -2
  85. package/dist/components/Spinner/index.js +6 -2
  86. package/dist/components/Steps/index.cjs +6 -2
  87. package/dist/components/Steps/index.css +11 -0
  88. package/dist/components/Steps/index.d.cts +9 -2
  89. package/dist/components/Steps/index.d.ts +9 -2
  90. package/dist/components/Steps/index.js +6 -2
  91. package/dist/components/Switch/index.cjs +146 -6
  92. package/dist/components/Switch/index.css +40 -0
  93. package/dist/components/Switch/index.d.cts +13 -2
  94. package/dist/components/Switch/index.d.ts +13 -2
  95. package/dist/components/Switch/index.js +146 -6
  96. package/dist/components/Tab/index.cjs +4 -3
  97. package/dist/components/Tab/index.d.cts +12 -1
  98. package/dist/components/Tab/index.d.ts +12 -1
  99. package/dist/components/Tab/index.js +4 -3
  100. package/dist/components/Tag/index.cjs +5 -3
  101. package/dist/components/Tag/index.d.cts +12 -2
  102. package/dist/components/Tag/index.d.ts +12 -2
  103. package/dist/components/Tag/index.js +5 -3
  104. package/dist/components/TextArea/index.cjs +138 -2
  105. package/dist/components/TextArea/index.css +38 -0
  106. package/dist/components/TextArea/index.d.cts +6 -0
  107. package/dist/components/TextArea/index.d.ts +6 -0
  108. package/dist/components/TextArea/index.js +138 -2
  109. package/dist/components/Tooltip/index.cjs +4 -2
  110. package/dist/components/Tooltip/index.d.cts +11 -1
  111. package/dist/components/Tooltip/index.d.ts +11 -1
  112. package/dist/components/Tooltip/index.js +4 -2
  113. package/dist/components/index.cjs +479 -408
  114. package/dist/components/index.css +59 -31
  115. package/dist/components/index.d.cts +3 -0
  116. package/dist/components/index.d.ts +3 -0
  117. package/dist/components/index.js +262 -194
  118. package/dist/index.cjs +484 -413
  119. package/dist/index.css +59 -31
  120. package/dist/index.d.cts +3 -0
  121. package/dist/index.d.ts +3 -0
  122. package/dist/index.js +264 -196
  123. package/dist/status-g_KP3qT6.d.cts +8 -0
  124. package/dist/status-g_KP3qT6.d.ts +8 -0
  125. package/dist/validation-Dqo1zqhT.d.cts +13 -0
  126. package/dist/validation-Dqo1zqhT.d.ts +13 -0
  127. package/guidelines/AGENT_PROMPT.md +15 -0
  128. package/guidelines/components/card.md +3 -3
  129. package/guidelines/components/feedback.md +1 -1
  130. package/guidelines/components/form.md +26 -0
  131. package/guidelines/components/navigation.md +16 -15
  132. package/guidelines/components/overlay.md +43 -4
  133. package/package.json +1 -1
@@ -37,6 +37,9 @@ module.exports = __toCommonJS(Switch_exports);
37
37
  // src/components/Switch/Switch.tsx
38
38
  var import_react = __toESM(require("react"), 1);
39
39
 
40
+ // src/tokens/interface/status.ts
41
+ var normalizeStatus = (value) => value === "brand" ? "primary" : value;
42
+
40
43
  // ../../node_modules/clsx/dist/clsx.mjs
41
44
  function r(e) {
42
45
  var t, f, n = "";
@@ -53,17 +56,152 @@ function clsx() {
53
56
  }
54
57
  var clsx_default = clsx;
55
58
 
56
- // src/components/Switch/Switch.tsx
59
+ // src/tokens/svg/status/ErrorIcon.tsx
57
60
  var import_jsx_runtime = require("react/jsx-runtime");
61
+ var ErrorIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
62
+ "svg",
63
+ {
64
+ xmlns: "http://www.w3.org/2000/svg",
65
+ width: "1em",
66
+ height: "1em",
67
+ viewBox: "0 0 16 16",
68
+ fill: "none",
69
+ children: [
70
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { clipPath: "url(#clip0_1196_9603)", children: [
71
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
72
+ "path",
73
+ {
74
+ 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",
75
+ fill: "currentColor"
76
+ }
77
+ ),
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
79
+ "path",
80
+ {
81
+ fillRule: "evenodd",
82
+ clipRule: "evenodd",
83
+ 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",
84
+ fill: "currentColor"
85
+ }
86
+ )
87
+ ] }),
88
+ /* @__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" }) }) })
89
+ ]
90
+ }
91
+ );
92
+ var ErrorIcon_default = ErrorIcon;
93
+
94
+ // src/tokens/svg/status/InfoIcon.tsx
95
+ var import_jsx_runtime2 = require("react/jsx-runtime");
96
+ var InfoIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
97
+ "svg",
98
+ {
99
+ xmlns: "http://www.w3.org/2000/svg",
100
+ width: "1em",
101
+ height: "1em",
102
+ viewBox: "0 0 16 16",
103
+ fill: "none",
104
+ children: [
105
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { clipPath: "url(#clip0_1188_11261)", children: [
106
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
107
+ "path",
108
+ {
109
+ 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",
110
+ fill: "currentColor"
111
+ }
112
+ ),
113
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
114
+ "path",
115
+ {
116
+ 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",
117
+ fill: "currentColor"
118
+ }
119
+ ),
120
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
121
+ "path",
122
+ {
123
+ fillRule: "evenodd",
124
+ clipRule: "evenodd",
125
+ 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",
126
+ fill: "currentColor"
127
+ }
128
+ )
129
+ ] }),
130
+ /* @__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" }) }) })
131
+ ]
132
+ }
133
+ );
134
+ var InfoIcon_default = InfoIcon;
135
+
136
+ // src/tokens/svg/status/SuccessIcon.tsx
137
+ var import_jsx_runtime3 = require("react/jsx-runtime");
138
+ var SuccessIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
139
+ "svg",
140
+ {
141
+ xmlns: "http://www.w3.org/2000/svg",
142
+ width: "1em",
143
+ height: "1em",
144
+ viewBox: "0 0 16 16",
145
+ fill: "none",
146
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
147
+ "path",
148
+ {
149
+ 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",
150
+ fill: "currentColor"
151
+ }
152
+ )
153
+ }
154
+ );
155
+ var SuccessIcon_default = SuccessIcon;
156
+
157
+ // src/components/FieldMessage/FieldMessage.tsx
158
+ var import_jsx_runtime4 = require("react/jsx-runtime");
159
+ var ICON = {
160
+ default: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon_default, {}),
161
+ success: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SuccessIcon_default, {}),
162
+ warning: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon_default, {}),
163
+ error: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorIcon_default, {})
164
+ };
165
+ var FieldMessage = (props) => {
166
+ const { validations } = props;
167
+ if (!validations || validations.length === 0) return null;
168
+ 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)(
169
+ "div",
170
+ {
171
+ className: clsx_default("lib-xplat-field-message", v.status),
172
+ children: [
173
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "icon", children: ICON[v.status] }),
174
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: v.message })
175
+ ]
176
+ },
177
+ `${v.message}_${idx}`
178
+ )) });
179
+ };
180
+ FieldMessage.displayName = "FieldMessage";
181
+ var Field = (props) => {
182
+ const { validations, children } = props;
183
+ if (!validations || validations.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
184
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "lib-xplat-field", children: [
185
+ children,
186
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldMessage, { validations })
187
+ ] });
188
+ };
189
+ Field.displayName = "Field";
190
+ var hasError = (validations) => !!validations?.some((v) => v.status === "error");
191
+
192
+ // src/components/Switch/Switch.tsx
193
+ var import_jsx_runtime5 = require("react/jsx-runtime");
58
194
  var KNOB_TRANSITION_MS = 250;
59
195
  var Switch = (props) => {
60
196
  const {
61
197
  value,
62
198
  size = "md",
63
- type = "brand",
199
+ type = "primary",
64
200
  disabled,
65
- onChange
201
+ onChange,
202
+ validations
66
203
  } = props;
204
+ const statusType = normalizeStatus(type);
67
205
  const [isAnimating, setIsAnimating] = import_react.default.useState(false);
68
206
  const timeoutRef = import_react.default.useRef(null);
69
207
  import_react.default.useEffect(() => {
@@ -81,22 +219,24 @@ var Switch = (props) => {
81
219
  timeoutRef.current = null;
82
220
  }, KNOB_TRANSITION_MS);
83
221
  };
84
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
222
+ const control = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
85
223
  "div",
86
224
  {
87
225
  className: clsx_default(
88
226
  "lib-xplat-switch",
89
227
  size,
90
- type,
228
+ statusType,
91
229
  value ? "checked" : void 0,
92
230
  disabled && "disabled",
93
231
  isAnimating && "animating"
94
232
  ),
95
233
  onClick: handleClick,
234
+ "aria-invalid": hasError(validations) || void 0,
96
235
  "aria-disabled": disabled || isAnimating,
97
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: clsx_default("knob", value ? "checked" : void 0) })
236
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: clsx_default("knob", value ? "checked" : void 0) })
98
237
  }
99
238
  );
239
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Field, { validations, children: control });
100
240
  };
101
241
  Switch.displayName = "Switch";
102
242
  var Switch_default = Switch;
@@ -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/Switch/switch.scss */
2
40
  .lib-xplat-switch {
3
41
  position: relative;
@@ -51,10 +89,12 @@
51
89
  pointer-events: none;
52
90
  cursor: wait;
53
91
  }
92
+ .lib-xplat-switch.primary.checked,
54
93
  .lib-xplat-switch.brand.checked {
55
94
  background-color: var(--semantic-surface-brand-default);
56
95
  border-color: var(--semantic-surface-brand-default);
57
96
  }
97
+ .lib-xplat-switch.primary.checked:hover:not(.disabled):not(.animating),
58
98
  .lib-xplat-switch.brand.checked:hover:not(.disabled):not(.animating) {
59
99
  background-color: var(--semantic-surface-brand-strong);
60
100
  border-color: var(--semantic-surface-brand-strong);
@@ -1,12 +1,23 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { L as LegacyStatusType } from '../../status-g_KP3qT6.cjs';
3
+ import { V as Validation } from '../../validation-Dqo1zqhT.cjs';
2
4
 
3
5
  type SwitchSize = "sm" | "md" | "lg";
4
- type SwitchType = "brand" | "success" | "error" | "warning" | "info";
6
+ /** Switch 의 상태 색 */
7
+ type SwitchType = "primary" | "success" | "error" | "warning" | "info";
8
+ /** 입력으로는 예전 이름 `brand` 도 받는다 (= `primary`) */
9
+ type SwitchTypeInput = SwitchType | LegacyStatusType;
5
10
  interface SwitchProps {
11
+ /** 켜짐 여부. controlled 전용이라 onChange 와 함께 쓴다 */
6
12
  value: boolean;
13
+ /** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
14
+ validations?: Validation[];
15
+ /** 스위치 크기 */
7
16
  size?: SwitchSize;
8
- type?: SwitchType;
17
+ /** 켜졌을 때의 색 */
18
+ type?: SwitchTypeInput;
9
19
  disabled?: boolean;
20
+ /** 토글될 때 바뀐 값을 준다 */
10
21
  onChange?: (value: boolean) => void;
11
22
  }
12
23
  declare const Switch: {
@@ -1,12 +1,23 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { L as LegacyStatusType } from '../../status-g_KP3qT6.js';
3
+ import { V as Validation } from '../../validation-Dqo1zqhT.js';
2
4
 
3
5
  type SwitchSize = "sm" | "md" | "lg";
4
- type SwitchType = "brand" | "success" | "error" | "warning" | "info";
6
+ /** Switch 의 상태 색 */
7
+ type SwitchType = "primary" | "success" | "error" | "warning" | "info";
8
+ /** 입력으로는 예전 이름 `brand` 도 받는다 (= `primary`) */
9
+ type SwitchTypeInput = SwitchType | LegacyStatusType;
5
10
  interface SwitchProps {
11
+ /** 켜짐 여부. controlled 전용이라 onChange 와 함께 쓴다 */
6
12
  value: boolean;
13
+ /** 컨트롤 아래에 표시할 검증 메시지. DS 폼 컴포넌트 공통 */
14
+ validations?: Validation[];
15
+ /** 스위치 크기 */
7
16
  size?: SwitchSize;
8
- type?: SwitchType;
17
+ /** 켜졌을 때의 색 */
18
+ type?: SwitchTypeInput;
9
19
  disabled?: boolean;
20
+ /** 토글될 때 바뀐 값을 준다 */
10
21
  onChange?: (value: boolean) => void;
11
22
  }
12
23
  declare const Switch: {
@@ -1,6 +1,9 @@
1
1
  // src/components/Switch/Switch.tsx
2
2
  import React from "react";
3
3
 
4
+ // src/tokens/interface/status.ts
5
+ var normalizeStatus = (value) => value === "brand" ? "primary" : value;
6
+
4
7
  // ../../node_modules/clsx/dist/clsx.mjs
5
8
  function r(e) {
6
9
  var t, f, n = "";
@@ -17,17 +20,152 @@ function clsx() {
17
20
  }
18
21
  var clsx_default = clsx;
19
22
 
23
+ // src/tokens/svg/status/ErrorIcon.tsx
24
+ import { jsx, jsxs } from "react/jsx-runtime";
25
+ var ErrorIcon = () => /* @__PURE__ */ jsxs(
26
+ "svg",
27
+ {
28
+ xmlns: "http://www.w3.org/2000/svg",
29
+ width: "1em",
30
+ height: "1em",
31
+ viewBox: "0 0 16 16",
32
+ fill: "none",
33
+ children: [
34
+ /* @__PURE__ */ jsxs("g", { clipPath: "url(#clip0_1196_9603)", children: [
35
+ /* @__PURE__ */ jsx(
36
+ "path",
37
+ {
38
+ 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",
39
+ fill: "currentColor"
40
+ }
41
+ ),
42
+ /* @__PURE__ */ jsx(
43
+ "path",
44
+ {
45
+ fillRule: "evenodd",
46
+ clipRule: "evenodd",
47
+ 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",
48
+ fill: "currentColor"
49
+ }
50
+ )
51
+ ] }),
52
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_1196_9603", children: /* @__PURE__ */ jsx("rect", { width: "16", height: "16", fill: "white" }) }) })
53
+ ]
54
+ }
55
+ );
56
+ var ErrorIcon_default = ErrorIcon;
57
+
58
+ // src/tokens/svg/status/InfoIcon.tsx
59
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
60
+ var InfoIcon = () => /* @__PURE__ */ jsxs2(
61
+ "svg",
62
+ {
63
+ xmlns: "http://www.w3.org/2000/svg",
64
+ width: "1em",
65
+ height: "1em",
66
+ viewBox: "0 0 16 16",
67
+ fill: "none",
68
+ children: [
69
+ /* @__PURE__ */ jsxs2("g", { clipPath: "url(#clip0_1188_11261)", children: [
70
+ /* @__PURE__ */ jsx2(
71
+ "path",
72
+ {
73
+ 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",
74
+ fill: "currentColor"
75
+ }
76
+ ),
77
+ /* @__PURE__ */ jsx2(
78
+ "path",
79
+ {
80
+ 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",
81
+ fill: "currentColor"
82
+ }
83
+ ),
84
+ /* @__PURE__ */ jsx2(
85
+ "path",
86
+ {
87
+ fillRule: "evenodd",
88
+ clipRule: "evenodd",
89
+ 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",
90
+ fill: "currentColor"
91
+ }
92
+ )
93
+ ] }),
94
+ /* @__PURE__ */ jsx2("defs", { children: /* @__PURE__ */ jsx2("clipPath", { id: "clip0_1188_11261", children: /* @__PURE__ */ jsx2("rect", { width: "16", height: "16", fill: "white" }) }) })
95
+ ]
96
+ }
97
+ );
98
+ var InfoIcon_default = InfoIcon;
99
+
100
+ // src/tokens/svg/status/SuccessIcon.tsx
101
+ import { jsx as jsx3 } from "react/jsx-runtime";
102
+ var SuccessIcon = () => /* @__PURE__ */ jsx3(
103
+ "svg",
104
+ {
105
+ xmlns: "http://www.w3.org/2000/svg",
106
+ width: "1em",
107
+ height: "1em",
108
+ viewBox: "0 0 16 16",
109
+ fill: "none",
110
+ children: /* @__PURE__ */ jsx3(
111
+ "path",
112
+ {
113
+ 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",
114
+ fill: "currentColor"
115
+ }
116
+ )
117
+ }
118
+ );
119
+ var SuccessIcon_default = SuccessIcon;
120
+
121
+ // src/components/FieldMessage/FieldMessage.tsx
122
+ import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
123
+ var ICON = {
124
+ default: /* @__PURE__ */ jsx4(InfoIcon_default, {}),
125
+ success: /* @__PURE__ */ jsx4(SuccessIcon_default, {}),
126
+ warning: /* @__PURE__ */ jsx4(InfoIcon_default, {}),
127
+ error: /* @__PURE__ */ jsx4(ErrorIcon_default, {})
128
+ };
129
+ var FieldMessage = (props) => {
130
+ const { validations } = props;
131
+ if (!validations || validations.length === 0) return null;
132
+ return /* @__PURE__ */ jsx4("div", { className: "lib-xplat-field-message-wrap", children: validations.map((v, idx) => /* @__PURE__ */ jsxs3(
133
+ "div",
134
+ {
135
+ className: clsx_default("lib-xplat-field-message", v.status),
136
+ children: [
137
+ /* @__PURE__ */ jsx4("div", { className: "icon", children: ICON[v.status] }),
138
+ /* @__PURE__ */ jsx4("span", { children: v.message })
139
+ ]
140
+ },
141
+ `${v.message}_${idx}`
142
+ )) });
143
+ };
144
+ FieldMessage.displayName = "FieldMessage";
145
+ var Field = (props) => {
146
+ const { validations, children } = props;
147
+ if (!validations || validations.length === 0) return /* @__PURE__ */ jsx4(Fragment, { children });
148
+ return /* @__PURE__ */ jsxs3("div", { className: "lib-xplat-field", children: [
149
+ children,
150
+ /* @__PURE__ */ jsx4(FieldMessage, { validations })
151
+ ] });
152
+ };
153
+ Field.displayName = "Field";
154
+ var hasError = (validations) => !!validations?.some((v) => v.status === "error");
155
+
20
156
  // src/components/Switch/Switch.tsx
21
- import { jsx } from "react/jsx-runtime";
157
+ import { jsx as jsx5 } from "react/jsx-runtime";
22
158
  var KNOB_TRANSITION_MS = 250;
23
159
  var Switch = (props) => {
24
160
  const {
25
161
  value,
26
162
  size = "md",
27
- type = "brand",
163
+ type = "primary",
28
164
  disabled,
29
- onChange
165
+ onChange,
166
+ validations
30
167
  } = props;
168
+ const statusType = normalizeStatus(type);
31
169
  const [isAnimating, setIsAnimating] = React.useState(false);
32
170
  const timeoutRef = React.useRef(null);
33
171
  React.useEffect(() => {
@@ -45,22 +183,24 @@ var Switch = (props) => {
45
183
  timeoutRef.current = null;
46
184
  }, KNOB_TRANSITION_MS);
47
185
  };
48
- return /* @__PURE__ */ jsx(
186
+ const control = /* @__PURE__ */ jsx5(
49
187
  "div",
50
188
  {
51
189
  className: clsx_default(
52
190
  "lib-xplat-switch",
53
191
  size,
54
- type,
192
+ statusType,
55
193
  value ? "checked" : void 0,
56
194
  disabled && "disabled",
57
195
  isAnimating && "animating"
58
196
  ),
59
197
  onClick: handleClick,
198
+ "aria-invalid": hasError(validations) || void 0,
60
199
  "aria-disabled": disabled || isAnimating,
61
- children: /* @__PURE__ */ jsx("div", { className: clsx_default("knob", value ? "checked" : void 0) })
200
+ children: /* @__PURE__ */ jsx5("div", { className: clsx_default("knob", value ? "checked" : void 0) })
62
201
  }
63
202
  );
203
+ return /* @__PURE__ */ jsx5(Field, { validations, children: control });
64
204
  };
65
205
  Switch.displayName = "Switch";
66
206
  var Switch_default = Switch;
@@ -74,7 +74,8 @@ var TabItem_default = TabItem;
74
74
  // src/components/Tab/Tab.tsx
75
75
  var import_jsx_runtime2 = require("react/jsx-runtime");
76
76
  var Tab = (props) => {
77
- const { activeIndex, onChange, tabs, type, size = "md" } = props;
77
+ const { activeIndex, onChange, tabs, variant, type, size = "md" } = props;
78
+ const shape = variant ?? type ?? "default";
78
79
  const [underlineStyle, setUnderlineStyle] = import_react2.default.useState({
79
80
  left: 0,
80
81
  width: 0
@@ -89,7 +90,7 @@ var Tab = (props) => {
89
90
  setUnderlineStyle({ left: el.offsetLeft, width: el.offsetWidth });
90
91
  }
91
92
  }, [activeIndex, tabs.length]);
92
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: clsx_default("lib-xplat-tab", `type-${type}`, size), children: [
93
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: clsx_default("lib-xplat-tab", `type-${shape}`, size), children: [
93
94
  tabs.map((tab, idx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
94
95
  TabItem_default,
95
96
  {
@@ -102,7 +103,7 @@ var Tab = (props) => {
102
103
  },
103
104
  `${tab.value}_${idx}`
104
105
  )),
105
- type === "toggle" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
106
+ shape === "toggle" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
106
107
  "div",
107
108
  {
108
109
  className: "tab-toggle-underline",
@@ -5,11 +5,22 @@ interface TabItemType {
5
5
  title: string;
6
6
  }
7
7
  type TabSize = "sm" | "md" | "lg";
8
+ type TabVariant = "default" | "toggle";
8
9
  interface TabProps {
10
+ /** 활성 탭 인덱스. controlled 전용이라 onChange 와 함께 쓴다 */
9
11
  activeIndex: number;
12
+ /** 탭 목록. children 을 받지 않는다 */
10
13
  tabs: TabItemType[];
14
+ /** 첫 인자가 탭 객체, **두 번째가 인덱스**다. setActiveIndex 를 그대로 넘기면 안 된다 */
11
15
  onChange: (value: TabItemType, index: number) => void;
12
- type: "default" | "toggle";
16
+ /** 탭 모양. `default` 는 채워진 평면 탭, `toggle` 은 밑줄 인디케이터가 슬라이드 */
17
+ variant?: TabVariant;
18
+ /**
19
+ * @deprecated 모양 변형은 `variant` 로 받는다. `type` 은 상태 색 전용이다.
20
+ * 기존 사용처가 깨지지 않도록 계속 받는다 — 둘 다 주면 `variant` 가 이긴다.
21
+ */
22
+ type?: TabVariant;
23
+ /** 탭 높이와 글자 크기 */
13
24
  size?: TabSize;
14
25
  }
15
26
  declare const Tab: {
@@ -5,11 +5,22 @@ interface TabItemType {
5
5
  title: string;
6
6
  }
7
7
  type TabSize = "sm" | "md" | "lg";
8
+ type TabVariant = "default" | "toggle";
8
9
  interface TabProps {
10
+ /** 활성 탭 인덱스. controlled 전용이라 onChange 와 함께 쓴다 */
9
11
  activeIndex: number;
12
+ /** 탭 목록. children 을 받지 않는다 */
10
13
  tabs: TabItemType[];
14
+ /** 첫 인자가 탭 객체, **두 번째가 인덱스**다. setActiveIndex 를 그대로 넘기면 안 된다 */
11
15
  onChange: (value: TabItemType, index: number) => void;
12
- type: "default" | "toggle";
16
+ /** 탭 모양. `default` 는 채워진 평면 탭, `toggle` 은 밑줄 인디케이터가 슬라이드 */
17
+ variant?: TabVariant;
18
+ /**
19
+ * @deprecated 모양 변형은 `variant` 로 받는다. `type` 은 상태 색 전용이다.
20
+ * 기존 사용처가 깨지지 않도록 계속 받는다 — 둘 다 주면 `variant` 가 이긴다.
21
+ */
22
+ type?: TabVariant;
23
+ /** 탭 높이와 글자 크기 */
13
24
  size?: TabSize;
14
25
  }
15
26
  declare const Tab: {
@@ -38,7 +38,8 @@ var TabItem_default = TabItem;
38
38
  // src/components/Tab/Tab.tsx
39
39
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
40
40
  var Tab = (props) => {
41
- const { activeIndex, onChange, tabs, type, size = "md" } = props;
41
+ const { activeIndex, onChange, tabs, variant, type, size = "md" } = props;
42
+ const shape = variant ?? type ?? "default";
42
43
  const [underlineStyle, setUnderlineStyle] = React2.useState({
43
44
  left: 0,
44
45
  width: 0
@@ -53,7 +54,7 @@ var Tab = (props) => {
53
54
  setUnderlineStyle({ left: el.offsetLeft, width: el.offsetWidth });
54
55
  }
55
56
  }, [activeIndex, tabs.length]);
56
- return /* @__PURE__ */ jsxs("div", { className: clsx_default("lib-xplat-tab", `type-${type}`, size), children: [
57
+ return /* @__PURE__ */ jsxs("div", { className: clsx_default("lib-xplat-tab", `type-${shape}`, size), children: [
57
58
  tabs.map((tab, idx) => /* @__PURE__ */ jsx2(
58
59
  TabItem_default,
59
60
  {
@@ -66,7 +67,7 @@ var Tab = (props) => {
66
67
  },
67
68
  `${tab.value}_${idx}`
68
69
  )),
69
- type === "toggle" && /* @__PURE__ */ jsx2(
70
+ shape === "toggle" && /* @__PURE__ */ jsx2(
70
71
  "div",
71
72
  {
72
73
  className: "tab-toggle-underline",
@@ -939,20 +939,22 @@ var import_jsx_runtime295 = require("react/jsx-runtime");
939
939
  var Tag = (props) => {
940
940
  const {
941
941
  children,
942
- type = "neutral",
942
+ variant,
943
+ type,
943
944
  onClose,
944
945
  size = "md",
945
946
  disabled = false,
946
947
  colorIndex
947
948
  } = props;
949
+ const shape = variant ?? type ?? "neutral";
948
950
  return /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)(
949
951
  "span",
950
952
  {
951
953
  className: clsx_default(
952
954
  "lib-xplat-tag",
953
- type,
955
+ shape,
954
956
  size,
955
- type === "categorical" && colorIndex !== void 0 && `cat-${colorIndex}`,
957
+ shape === "categorical" && colorIndex !== void 0 && `cat-${colorIndex}`,
956
958
  disabled && "disabled"
957
959
  ),
958
960
  children: [
@@ -1,14 +1,24 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
 
4
- type TagType = "neutral" | "categorical";
4
+ type TagVariant = "neutral" | "categorical";
5
5
  type TagSize = "sm" | "md" | "lg";
6
6
  interface TagProps {
7
7
  children: React.ReactNode;
8
- type?: TagType;
8
+ /** 태그 배색. `categorical` 은 `colorIndex` 로 계열 색을 고른다 */
9
+ variant?: TagVariant;
10
+ /**
11
+ * @deprecated 모양 변형은 `variant` 로 받는다. `type` 은 상태 색 전용이다.
12
+ * 기존 사용처가 깨지지 않도록 계속 받는다 — 둘 다 주면 `variant` 가 이긴다.
13
+ */
14
+ type?: TagVariant;
15
+ /** 주면 오른쪽에 닫기 버튼이 생긴다. 제거 가능한 태그로 쓸 때 */
9
16
  onClose?: () => void;
17
+ /** 태그 크기 */
10
18
  size?: TagSize;
19
+ /** 흐리게 표시하고 닫기 버튼을 막는다 */
11
20
  disabled?: boolean;
21
+ /** variant 가 categorical 일 때 쓸 계열 색 번호 (1~8) */
12
22
  colorIndex?: number;
13
23
  }
14
24
  declare const Tag: {