infinity-ui-elements 1.3.1 → 1.4.1-beta.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/README.md +62 -1
- package/dist/components/Badge/Badge.d.ts +28 -0
- package/dist/components/Badge/Badge.d.ts.map +1 -0
- package/dist/components/Badge/Badge.stories.d.ts +16 -0
- package/dist/components/Badge/Badge.stories.d.ts.map +1 -0
- package/dist/components/Badge/index.d.ts +3 -0
- package/dist/components/Badge/index.d.ts.map +1 -0
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +49 -0
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +23 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts.map +1 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -0
- package/dist/components/Counter/Counter.d.ts +24 -0
- package/dist/components/Counter/Counter.d.ts.map +1 -0
- package/dist/components/Counter/Counter.stories.d.ts +14 -0
- package/dist/components/Counter/Counter.stories.d.ts.map +1 -0
- package/dist/components/Counter/index.d.ts +3 -0
- package/dist/components/Counter/index.d.ts.map +1 -0
- package/dist/components/Divider/Divider.d.ts +37 -0
- package/dist/components/Divider/Divider.d.ts.map +1 -0
- package/dist/components/Divider/Divider.stories.d.ts +12 -0
- package/dist/components/Divider/Divider.stories.d.ts.map +1 -0
- package/dist/components/Divider/index.d.ts +2 -0
- package/dist/components/Divider/index.d.ts.map +1 -0
- package/dist/components/FormFooter/FormFooter.d.ts +38 -0
- package/dist/components/FormFooter/FormFooter.d.ts.map +1 -0
- package/dist/components/FormFooter/FormFooter.stories.d.ts +50 -0
- package/dist/components/FormFooter/FormFooter.stories.d.ts.map +1 -0
- package/dist/components/FormFooter/index.d.ts +3 -0
- package/dist/components/FormFooter/index.d.ts.map +1 -0
- package/dist/components/FormHeader/FormHeader.d.ts +58 -0
- package/dist/components/FormHeader/FormHeader.d.ts.map +1 -0
- package/dist/components/FormHeader/FormHeader.stories.d.ts +65 -0
- package/dist/components/FormHeader/FormHeader.stories.d.ts.map +1 -0
- package/dist/components/FormHeader/index.d.ts +3 -0
- package/dist/components/FormHeader/index.d.ts.map +1 -0
- package/dist/components/ListItem/ListItem.d.ts +63 -0
- package/dist/components/ListItem/ListItem.d.ts.map +1 -0
- package/dist/components/ListItem/ListItem.stories.d.ts +66 -0
- package/dist/components/ListItem/ListItem.stories.d.ts.map +1 -0
- package/dist/components/ListItem/index.d.ts +3 -0
- package/dist/components/ListItem/index.d.ts.map +1 -0
- package/dist/components/Radio/Radio.d.ts +45 -0
- package/dist/components/Radio/Radio.d.ts.map +1 -0
- package/dist/components/Radio/Radio.stories.d.ts +23 -0
- package/dist/components/Radio/Radio.stories.d.ts.map +1 -0
- package/dist/components/Radio/index.d.ts +3 -0
- package/dist/components/Radio/index.d.ts.map +1 -0
- package/dist/components/Switch/Switch.d.ts +39 -0
- package/dist/components/Switch/Switch.d.ts.map +1 -0
- package/dist/components/Switch/Switch.stories.d.ts +37 -0
- package/dist/components/Switch/Switch.stories.d.ts.map +1 -0
- package/dist/components/Switch/index.d.ts +3 -0
- package/dist/components/Switch/index.d.ts.map +1 -0
- package/dist/components/Text/Text.d.ts +2 -9
- package/dist/components/Text/Text.d.ts.map +1 -1
- package/dist/components/Text/index.d.ts +1 -1
- package/dist/components/Text/index.d.ts.map +1 -1
- package/dist/components/TextArea/TextArea.d.ts +31 -0
- package/dist/components/TextArea/TextArea.d.ts.map +1 -0
- package/dist/components/TextArea/TextArea.stories.d.ts +27 -0
- package/dist/components/TextArea/TextArea.stories.d.ts.map +1 -0
- package/dist/components/TextArea/index.d.ts +3 -0
- package/dist/components/TextArea/index.d.ts.map +1 -0
- package/dist/components/TextField/TextField.d.ts +4 -0
- package/dist/components/TextField/TextField.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1208 -145
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1227 -144
- package/dist/index.js.map +1 -1
- package/dist/lib/icons.d.ts +96 -0
- package/dist/lib/icons.d.ts.map +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var React = require('react');
|
|
5
|
-
var reactSlot = require('@radix-ui/react-slot');
|
|
6
5
|
var classVarianceAuthority = require('class-variance-authority');
|
|
7
|
-
var reactSpinners = require('react-spinners');
|
|
8
6
|
var clsx = require('clsx');
|
|
9
7
|
var tailwindMerge = require('tailwind-merge');
|
|
8
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
9
|
+
var reactSpinners = require('react-spinners');
|
|
10
10
|
|
|
11
11
|
function _interopNamespaceDefault(e) {
|
|
12
12
|
var n = Object.create(null);
|
|
@@ -32,6 +32,18 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
32
32
|
const CUSTOM_CLASS_PATTERNS = [
|
|
33
33
|
// Custom font classes
|
|
34
34
|
/^font-(functional|display)$/,
|
|
35
|
+
// Custom font-size classes
|
|
36
|
+
/^font-size-/,
|
|
37
|
+
// Custom leading (line-height) classes
|
|
38
|
+
/^leading-(00|25|50|75|100|200|300|400|500|600|700|800|900|1000|1100)$/,
|
|
39
|
+
// Custom text utility classes (text-display, text-heading, text-body, text-caption variants)
|
|
40
|
+
/^text-(display|heading|body|caption)(-\w+)?(-\w+)?$/,
|
|
41
|
+
// Text weight classes
|
|
42
|
+
/^text-weight-/,
|
|
43
|
+
// Text color classes
|
|
44
|
+
/^text-color-/,
|
|
45
|
+
/^outline-width-/,
|
|
46
|
+
/^border-width-/,
|
|
35
47
|
// Custom spacing classes (example)
|
|
36
48
|
// /^spacing-(xs|sm|md|lg|xl)$/,
|
|
37
49
|
// Custom color classes (example)
|
|
@@ -54,7 +66,133 @@ function cn(...inputs) {
|
|
|
54
66
|
return clsx.clsx(mergedStandard, customClasses);
|
|
55
67
|
}
|
|
56
68
|
|
|
57
|
-
const
|
|
69
|
+
const badgeVariants = classVarianceAuthority.cva("inline-flex items-center whitespace-nowrap transition-colors", {
|
|
70
|
+
variants: {
|
|
71
|
+
variant: {
|
|
72
|
+
light: "",
|
|
73
|
+
filled: "",
|
|
74
|
+
},
|
|
75
|
+
color: {
|
|
76
|
+
primary: "",
|
|
77
|
+
positive: "",
|
|
78
|
+
negative: "",
|
|
79
|
+
notice: "",
|
|
80
|
+
info: "",
|
|
81
|
+
neutral: "",
|
|
82
|
+
},
|
|
83
|
+
size: {
|
|
84
|
+
small: "px-2 h-[var(--size-20)] gap-2 rounded-large text-body-small-medium",
|
|
85
|
+
medium: "px-3 h-[var(--size-24)] gap-3 rounded-large text-body-medium-medium",
|
|
86
|
+
large: "px-4 h-[var(--size-28)] gap-3 rounded-xlarge text-body-large-medium",
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
compoundVariants: [
|
|
90
|
+
// Light variant colors
|
|
91
|
+
{
|
|
92
|
+
variant: "light",
|
|
93
|
+
color: "primary",
|
|
94
|
+
class: "bg-action-fill-primary-faded text-action-ink-primary-normal",
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
variant: "light",
|
|
98
|
+
color: "positive",
|
|
99
|
+
class: "bg-action-fill-positive-faded text-action-ink-positive-normal",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
variant: "light",
|
|
103
|
+
color: "negative",
|
|
104
|
+
class: "bg-action-fill-negative-faded text-action-ink-negative-normal",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
variant: "light",
|
|
108
|
+
color: "notice",
|
|
109
|
+
class: "bg-action-fill-notice-faded text-action-ink-notice-normal",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
variant: "light",
|
|
113
|
+
color: "info",
|
|
114
|
+
class: "bg-action-fill-info-faded text-action-ink-info-normal",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
variant: "light",
|
|
118
|
+
color: "neutral",
|
|
119
|
+
class: "bg-action-fill-neutral-faded text-action-ink-neutral-normal",
|
|
120
|
+
},
|
|
121
|
+
// Filled variant colors
|
|
122
|
+
{
|
|
123
|
+
variant: "filled",
|
|
124
|
+
color: "primary",
|
|
125
|
+
class: "bg-action-fill-primary-default text-action-ink-on-primary-normal",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
variant: "filled",
|
|
129
|
+
color: "positive",
|
|
130
|
+
class: "bg-action-fill-positive-default text-action-ink-on-primary-normal",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
variant: "filled",
|
|
134
|
+
color: "negative",
|
|
135
|
+
class: "bg-action-fill-negative-default text-action-ink-on-primary-normal",
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
variant: "filled",
|
|
139
|
+
color: "notice",
|
|
140
|
+
class: "bg-action-fill-notice-default text-action-ink-on-primary-normal",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
variant: "filled",
|
|
144
|
+
color: "info",
|
|
145
|
+
class: "bg-action-fill-info-default text-action-ink-on-primary-normal",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
variant: "filled",
|
|
149
|
+
color: "neutral",
|
|
150
|
+
class: "bg-action-fill-neutral-default text-action-ink-on-primary-normal",
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
defaultVariants: {
|
|
154
|
+
variant: "light",
|
|
155
|
+
color: "info",
|
|
156
|
+
size: "medium",
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
const Badge = React__namespace.forwardRef(({ className, variant, size, color, showDot = false, children, ...props }, ref) => {
|
|
160
|
+
const getDotColor = () => {
|
|
161
|
+
if (variant === "filled") {
|
|
162
|
+
return "bg-action-ink-on-primary-normal";
|
|
163
|
+
}
|
|
164
|
+
// Light variant - use the corresponding action color
|
|
165
|
+
switch (color) {
|
|
166
|
+
case "primary":
|
|
167
|
+
return "bg-action-fill-primary-default";
|
|
168
|
+
case "positive":
|
|
169
|
+
return "bg-action-fill-positive-default";
|
|
170
|
+
case "negative":
|
|
171
|
+
return "bg-action-fill-negative-default";
|
|
172
|
+
case "notice":
|
|
173
|
+
return "bg-action-fill-notice-default";
|
|
174
|
+
case "info":
|
|
175
|
+
return "bg-action-fill-info-default";
|
|
176
|
+
case "neutral":
|
|
177
|
+
return "bg-action-fill-neutral-default";
|
|
178
|
+
default:
|
|
179
|
+
return "bg-action-fill-info-default";
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
const getDotSize = () => {
|
|
183
|
+
if (size === "small") {
|
|
184
|
+
return "h-2 w-2";
|
|
185
|
+
}
|
|
186
|
+
if (size === "medium") {
|
|
187
|
+
return "h-[6px] w-[6px]";
|
|
188
|
+
}
|
|
189
|
+
return "h-3 w-3";
|
|
190
|
+
};
|
|
191
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: cn(badgeVariants({ variant, size, color }), className), ...props, children: [showDot && (jsxRuntime.jsx("span", { className: cn("rounded-full", getDotColor(), getDotSize()), "aria-hidden": "true" })), children] }));
|
|
192
|
+
});
|
|
193
|
+
Badge.displayName = "Badge";
|
|
194
|
+
|
|
195
|
+
const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-center whitespace-nowrap ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none", {
|
|
58
196
|
variants: {
|
|
59
197
|
variant: {
|
|
60
198
|
primary: "bg-action-fill-primary-default text-action-ink-on-primary-normal hover:bg-action-fill-primary-hover",
|
|
@@ -70,10 +208,10 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
70
208
|
neutral: "",
|
|
71
209
|
},
|
|
72
210
|
size: {
|
|
73
|
-
xsmall: "md:h-[28px] px-3
|
|
74
|
-
small: "md:h-[32px] px-4
|
|
75
|
-
medium: "md:h-[36px] px-6 py-2 rounded-medium",
|
|
76
|
-
large: "md:h-[44px] px-6
|
|
211
|
+
xsmall: "md:h-[28px] px-3 rounded-medium text-body-small-medium",
|
|
212
|
+
small: "md:h-[32px] px-4 rounded-medium text-body-small-medium",
|
|
213
|
+
medium: "md:h-[36px] px-6 py-2 rounded-medium text-body-medium-medium",
|
|
214
|
+
large: "md:h-[44px] px-6 rounded-xlarge text-body-large-medium",
|
|
77
215
|
},
|
|
78
216
|
isIconOnly: {
|
|
79
217
|
true: "aspect-square p-0",
|
|
@@ -100,7 +238,8 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
100
238
|
class: `bg-action-fill-primary-default text-action-ink-on-primary-normal
|
|
101
239
|
hover:bg-action-fill-primary-hover
|
|
102
240
|
disabled:bg-action-fill-primary-disabled
|
|
103
|
-
disabled:text-action-ink-primary-disabled
|
|
241
|
+
disabled:text-action-ink-primary-disabled,
|
|
242
|
+
active:bg-action-fill-primary-activated
|
|
104
243
|
`,
|
|
105
244
|
},
|
|
106
245
|
{
|
|
@@ -110,6 +249,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
110
249
|
hover:bg-action-fill-positive-hover
|
|
111
250
|
disabled:bg-action-fill-primary-disabled
|
|
112
251
|
disabled:text-action-ink-primary-disabled
|
|
252
|
+
active:bg-action-fill-positive-activated
|
|
113
253
|
`,
|
|
114
254
|
},
|
|
115
255
|
{
|
|
@@ -119,6 +259,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
119
259
|
hover:bg-action-fill-negative-hover
|
|
120
260
|
disabled:bg-action-fill-negative-disabled
|
|
121
261
|
disabled:text-action-ink-negative-disabled
|
|
262
|
+
active:bg-action-fill-negative-activated
|
|
122
263
|
`,
|
|
123
264
|
},
|
|
124
265
|
{
|
|
@@ -128,6 +269,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
128
269
|
hover:bg-action-fill-notice-hover
|
|
129
270
|
disabled:bg-action-fill-notice-disabled
|
|
130
271
|
disabled:text-action-ink-notice-disabled
|
|
272
|
+
active:bg-action-fill-notice-activated
|
|
131
273
|
`,
|
|
132
274
|
},
|
|
133
275
|
{
|
|
@@ -137,6 +279,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
137
279
|
hover:bg-action-fill-info-hover
|
|
138
280
|
disabled:bg-action-fill-info-disabled
|
|
139
281
|
disabled:text-action-ink-info-disabled
|
|
282
|
+
active:bg-action-fill-info-activated
|
|
140
283
|
`,
|
|
141
284
|
},
|
|
142
285
|
{
|
|
@@ -146,42 +289,96 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
146
289
|
hover:bg-action-fill-neutral-hover
|
|
147
290
|
disabled:bg-action-fill-neutral-disabled
|
|
148
291
|
disabled:text-action-ink-neutral-disabled
|
|
292
|
+
active:bg-action-fill-neutral-activated
|
|
149
293
|
`,
|
|
150
294
|
},
|
|
151
295
|
// Secondary variant colors
|
|
152
296
|
{
|
|
153
297
|
variant: "secondary",
|
|
154
298
|
color: "primary",
|
|
155
|
-
class: `
|
|
299
|
+
class: `
|
|
300
|
+
border-action-outline-info-faded
|
|
301
|
+
text-action-ink-primary-normal
|
|
302
|
+
hover:border-action-outline-primary-faded-hover
|
|
303
|
+
hover:bg-action-fill-primary-faded-hover
|
|
156
304
|
disabled:bg-action-outline-info-disabled
|
|
157
305
|
disabled:text-action-ink-primary-disabled
|
|
158
306
|
disabled:border-action-outline-primary-disabled
|
|
307
|
+
active:border-action-outline-primary-faded-activated
|
|
308
|
+
active:bg-action-fill-primary-faded-activated
|
|
159
309
|
`,
|
|
160
310
|
},
|
|
161
311
|
{
|
|
162
312
|
variant: "secondary",
|
|
163
313
|
color: "positive",
|
|
164
|
-
class:
|
|
314
|
+
class: `
|
|
315
|
+
border-action-outline-positive-faded
|
|
316
|
+
text-action-ink-positive-normal
|
|
317
|
+
hover:border-action-outline-positive-faded-hover
|
|
318
|
+
hover:bg-action-fill-positive-faded-hover
|
|
319
|
+
disabled:bg-action-outline-positive-disabled
|
|
320
|
+
disabled:text-action-ink-positive-disabled
|
|
321
|
+
disabled:border-action-outline-positive-disabled
|
|
322
|
+
active:border-action-outline-positive-faded-activated
|
|
323
|
+
active:bg-action-fill-positive-faded-activated
|
|
324
|
+
`,
|
|
165
325
|
},
|
|
166
326
|
{
|
|
167
327
|
variant: "secondary",
|
|
168
328
|
color: "negative",
|
|
169
|
-
class:
|
|
329
|
+
class: `
|
|
330
|
+
border-action-outline-negative-faded
|
|
331
|
+
text-action-ink-negative-normal
|
|
332
|
+
hover:border-action-outline-negative-faded-hover
|
|
333
|
+
hover:bg-action-fill-negative-faded-hover
|
|
334
|
+
disabled:bg-action-outline-negative-disabled
|
|
335
|
+
disabled:text-action-ink-negative-disabled
|
|
336
|
+
disabled:border-action-outline-negative-disabled
|
|
337
|
+
active:border-action-outline-negative-faded-activated
|
|
338
|
+
active:bg-action-fill-negative-faded-activated
|
|
339
|
+
`,
|
|
170
340
|
},
|
|
171
341
|
{
|
|
172
342
|
variant: "secondary",
|
|
173
343
|
color: "notice",
|
|
174
|
-
class:
|
|
344
|
+
class: `
|
|
345
|
+
border-action-outline-notice-faded
|
|
346
|
+
text-action-ink-notice-normal
|
|
347
|
+
hover:border-action-outline-notice-faded-hover
|
|
348
|
+
hover:bg-action-fill-notice-faded-hover
|
|
349
|
+
disabled:bg-action-outline-notice-disabled
|
|
350
|
+
disabled:text-action-ink-notice-disabled
|
|
351
|
+
disabled:border-action-outline-notice-disabled
|
|
352
|
+
active:border-action-outline-notice-faded-activated
|
|
353
|
+
active:bg-action-fill-notice-faded-activated
|
|
354
|
+
`,
|
|
175
355
|
},
|
|
176
356
|
{
|
|
177
357
|
variant: "secondary",
|
|
178
358
|
color: "info",
|
|
179
|
-
class:
|
|
359
|
+
class: `border-action-outline-info-faded
|
|
360
|
+
text-action-ink-info-normal
|
|
361
|
+
hover:border-action-outline-info-faded-hover
|
|
362
|
+
hover:bg-action-fill-info-faded-hover
|
|
363
|
+
disabled:bg-action-outline-info-disabled
|
|
364
|
+
disabled:text-action-ink-info-disabled
|
|
365
|
+
disabled:border-action-outline-info-disabled
|
|
366
|
+
active:border-action-outline-info-faded-activated
|
|
367
|
+
active:bg-action-fill-info-faded-activated
|
|
368
|
+
`,
|
|
180
369
|
},
|
|
181
370
|
{
|
|
182
371
|
variant: "secondary",
|
|
183
372
|
color: "neutral",
|
|
184
|
-
class:
|
|
373
|
+
class: `border-action-outline-neutral-faded
|
|
374
|
+
text-action-ink-neutral-normal
|
|
375
|
+
hover:bg-action-outline-neutral-faded-hover
|
|
376
|
+
hover:bg-action-fill-neutral-faded-hover
|
|
377
|
+
disabled:text-action-ink-neutral-disabled
|
|
378
|
+
disabled:border-action-outline-neutral-disabled
|
|
379
|
+
active:border-action-outline-neutral-faded-activated
|
|
380
|
+
active:bg-action-fill-neutral-faded-activated
|
|
381
|
+
`,
|
|
185
382
|
},
|
|
186
383
|
// Tertiary variant colors
|
|
187
384
|
{
|
|
@@ -190,6 +387,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
190
387
|
class: `text-action-ink-primary-normal
|
|
191
388
|
hover:bg-action-fill-primary-faded
|
|
192
389
|
disabled:text-action-ink-on-primary-muted
|
|
390
|
+
active:bg-action-fill-primary-faded-activated
|
|
193
391
|
`,
|
|
194
392
|
},
|
|
195
393
|
{
|
|
@@ -198,6 +396,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
198
396
|
class: `text-action-ink-positive-normal
|
|
199
397
|
hover:bg-action-fill-positive-faded
|
|
200
398
|
disabled:text-action-ink-on-positive-muted
|
|
399
|
+
active:bg-action-fill-positive-faded-activated
|
|
201
400
|
`,
|
|
202
401
|
},
|
|
203
402
|
{
|
|
@@ -206,6 +405,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
206
405
|
class: `text-action-ink-negative-normal
|
|
207
406
|
hover:bg-action-fill-negative-faded
|
|
208
407
|
disabled:text-action-ink-on-negative-muted
|
|
408
|
+
active:bg-action-fill-negative-faded-activated
|
|
209
409
|
`,
|
|
210
410
|
},
|
|
211
411
|
{
|
|
@@ -214,6 +414,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
214
414
|
class: `text-action-ink-notice-normal
|
|
215
415
|
hover:bg-action-fill-notice-faded
|
|
216
416
|
disabled:text-action-ink-on-notice-muted
|
|
417
|
+
active:bg-action-fill-notice-faded-activated
|
|
217
418
|
`,
|
|
218
419
|
},
|
|
219
420
|
{
|
|
@@ -222,6 +423,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
222
423
|
class: `text-action-ink-info-normal
|
|
223
424
|
hover:bg-action-fill-info-faded
|
|
224
425
|
disabled:text-action-ink-on-notice-muted
|
|
426
|
+
active:bg-action-fill-info-faded-activated
|
|
225
427
|
`,
|
|
226
428
|
},
|
|
227
429
|
{
|
|
@@ -230,6 +432,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
230
432
|
class: `text-action-ink-neutral-normal
|
|
231
433
|
hover:bg-action-fill-neutral-faded
|
|
232
434
|
disabled:text-action-ink-on-notice-muted
|
|
435
|
+
active:bg-action-fill-neutral-faded-activated
|
|
233
436
|
`,
|
|
234
437
|
},
|
|
235
438
|
// Icon only sizing
|
|
@@ -279,174 +482,533 @@ const Button = React__namespace.forwardRef(({ className, variant = "primary", co
|
|
|
279
482
|
});
|
|
280
483
|
Button.displayName = "Button";
|
|
281
484
|
|
|
282
|
-
|
|
485
|
+
// Helper function to get the text utility class name
|
|
486
|
+
function getTextClassName(variant = "body", size = "medium", weight = "regular", color = "default") {
|
|
487
|
+
// Build the base class name
|
|
488
|
+
let baseClass = `text-${variant}`;
|
|
489
|
+
// Add size
|
|
490
|
+
if (size) {
|
|
491
|
+
baseClass += `-${size}`;
|
|
492
|
+
}
|
|
493
|
+
// Add weight
|
|
494
|
+
if (weight) {
|
|
495
|
+
baseClass += `-${weight}`;
|
|
496
|
+
}
|
|
497
|
+
// Add color class separately
|
|
498
|
+
const colorClass = `text-color-${color}`;
|
|
499
|
+
return `${baseClass} ${colorClass}`;
|
|
500
|
+
}
|
|
501
|
+
const Text = React__namespace.forwardRef(({ className, variant = "body", size = "medium", weight = "regular", color = "default", as = "p", children, ...props }, ref) => {
|
|
502
|
+
const Component = as;
|
|
503
|
+
const textClass = getTextClassName(variant, size, weight, color);
|
|
504
|
+
return React__namespace.createElement(Component, {
|
|
505
|
+
className: cn(textClass, className),
|
|
506
|
+
ref,
|
|
507
|
+
...props,
|
|
508
|
+
}, children);
|
|
509
|
+
});
|
|
510
|
+
Text.displayName = "Text";
|
|
511
|
+
|
|
512
|
+
const FormFooter = React__namespace.forwardRef(({ helperText, trailingText, validationState = "default", size = "medium", isDisabled = false, className, helperTextClassName, trailingTextClassName, }, ref) => {
|
|
513
|
+
// Size-based configurations
|
|
514
|
+
const sizeConfig = {
|
|
515
|
+
small: {
|
|
516
|
+
textSize: "xsmall",
|
|
517
|
+
iconSize: 12,
|
|
518
|
+
gap: "gap-1",
|
|
519
|
+
},
|
|
520
|
+
medium: {
|
|
521
|
+
textSize: "small",
|
|
522
|
+
iconSize: 14,
|
|
523
|
+
gap: "gap-1",
|
|
524
|
+
},
|
|
525
|
+
large: {
|
|
526
|
+
textSize: "medium",
|
|
527
|
+
iconSize: 16,
|
|
528
|
+
gap: "gap-1.5",
|
|
529
|
+
},
|
|
530
|
+
};
|
|
531
|
+
const config = sizeConfig[size];
|
|
532
|
+
// Determine text color based on validation state and disabled state
|
|
533
|
+
const getTextColor = () => {
|
|
534
|
+
if (isDisabled)
|
|
535
|
+
return "disabled";
|
|
536
|
+
if (validationState === "positive")
|
|
537
|
+
return "positive";
|
|
538
|
+
if (validationState === "negative")
|
|
539
|
+
return "negative";
|
|
540
|
+
if (validationState === "default")
|
|
541
|
+
return "default";
|
|
542
|
+
return "default";
|
|
543
|
+
};
|
|
544
|
+
// Don't render anything if there's no content
|
|
545
|
+
if (!helperText && !trailingText) {
|
|
546
|
+
return null;
|
|
547
|
+
}
|
|
548
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: cn("flex items-center justify-between px-1", config.gap, className), children: [helperText && (jsxRuntime.jsxs("div", { className: cn("flex items-center", config.gap), children: [validationState === "positive" && (jsxRuntime.jsx("svg", { width: config.iconSize, height: config.iconSize, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-feedback-ink-positive-intense shrink-0", children: jsxRuntime.jsx("path", { d: "M3 7L6 10L11 4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })), validationState === "negative" && (jsxRuntime.jsxs("svg", { width: config.iconSize, height: config.iconSize, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-feedback-ink-negative-subtle shrink-0", children: [jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "6", stroke: "currentColor", strokeWidth: "1" }), jsxRuntime.jsx("path", { d: "M7 4V7.5M7 10V9.5", stroke: "currentColor", strokeWidth: "1", strokeLinecap: "round" })] })), jsxRuntime.jsx(Text, { as: "span", variant: "body", size: config.textSize, weight: "regular", color: getTextColor(), className: cn("italic font-size-100 leading-100", helperTextClassName), children: helperText })] })), trailingText && (jsxRuntime.jsx(Text, { as: "span", variant: "body", size: config.textSize, weight: "regular", color: isDisabled ? "disabled" : "muted", className: cn("font-size-100 leading-100 shrink-0", trailingTextClassName), children: trailingText }))] }));
|
|
549
|
+
});
|
|
550
|
+
FormFooter.displayName = "FormFooter";
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* ==============================================
|
|
554
|
+
* HOW TO ADD A NEW ICON:
|
|
555
|
+
* ==============================================
|
|
556
|
+
*
|
|
557
|
+
* 1. Add your SVG file to: src/assets/icons/{iconName}.svg
|
|
558
|
+
*
|
|
559
|
+
* 2. Copy the SVG content from the file
|
|
560
|
+
*
|
|
561
|
+
* 3. Add it to the iconRegistry below:
|
|
562
|
+
* iconName: `<svg>...</svg>`,
|
|
563
|
+
*
|
|
564
|
+
* 4. Use it anywhere in your app:
|
|
565
|
+
* <Icon name="iconName" size={24} />
|
|
566
|
+
*
|
|
567
|
+
* The Icon component will automatically:
|
|
568
|
+
* - Replace hardcoded colors with currentColor
|
|
569
|
+
* - Allow you to control color via className or style
|
|
570
|
+
* - Resize based on the size prop
|
|
571
|
+
* ==============================================
|
|
572
|
+
*/
|
|
573
|
+
/**
|
|
574
|
+
* Icon registry - maps icon names to their SVG content
|
|
575
|
+
* Add your icons here by copying the SVG content from your icon files
|
|
576
|
+
*/
|
|
577
|
+
const iconRegistry = {
|
|
578
|
+
// Tick/Check icon
|
|
579
|
+
tick: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
580
|
+
<path d="M10.364 15.1924L19.5564 6L20.9706 7.41421L10.364 18.0208L4 11.6569L5.41422 10.2427L10.364 15.1924Z" fill="#081416"/>
|
|
581
|
+
</svg>`,
|
|
582
|
+
// Alias: check points to the same icon as tick
|
|
583
|
+
check: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
584
|
+
<path d="M10.364 15.1924L19.5564 6L20.9706 7.41421L10.364 18.0208L4 11.6569L5.41422 10.2427L10.364 15.1924Z" fill="#081416"/>
|
|
585
|
+
</svg>`,
|
|
586
|
+
};
|
|
587
|
+
const Icon = ({ name, size = 24, className = "", style = {}, ...props }) => {
|
|
588
|
+
const svgContent = iconRegistry[name];
|
|
589
|
+
if (!svgContent) {
|
|
590
|
+
console.warn(`Icon "${String(name)}" not found in registry.\n` +
|
|
591
|
+
`Available icons: ${Object.keys(iconRegistry).join(", ")}`);
|
|
592
|
+
return null;
|
|
593
|
+
}
|
|
594
|
+
// Parse the SVG content
|
|
595
|
+
const parser = new DOMParser();
|
|
596
|
+
const svgDoc = parser.parseFromString(svgContent, "image/svg+xml");
|
|
597
|
+
const svgElement = svgDoc.querySelector("svg");
|
|
598
|
+
if (!svgElement) {
|
|
599
|
+
console.error(`Invalid SVG content for icon "${String(name)}"`);
|
|
600
|
+
return null;
|
|
601
|
+
}
|
|
602
|
+
// Extract viewBox attribute
|
|
603
|
+
const viewBox = svgElement.getAttribute("viewBox") || "0 0 24 24";
|
|
604
|
+
let innerHTML = svgElement.innerHTML;
|
|
605
|
+
// Replace hardcoded fill and stroke colors with currentColor
|
|
606
|
+
// This allows the icon color to be controlled via CSS color property
|
|
607
|
+
innerHTML = innerHTML
|
|
608
|
+
.replace(/fill="[^"]*"/g, 'fill="currentColor"')
|
|
609
|
+
.replace(/stroke="[^"]*"/g, 'stroke="currentColor"');
|
|
610
|
+
return (jsxRuntime.jsx("svg", { width: size, height: size, viewBox: viewBox, fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, style: style, ...props, dangerouslySetInnerHTML: { __html: innerHTML } }));
|
|
611
|
+
};
|
|
612
|
+
Icon.displayName = "Icon";
|
|
613
|
+
/**
|
|
614
|
+
* Get all available icon names from the registry
|
|
615
|
+
* @returns Array of registered icon names
|
|
616
|
+
*
|
|
617
|
+
* @example
|
|
618
|
+
* ```tsx
|
|
619
|
+
* const icons = getAvailableIcons();
|
|
620
|
+
* console.log(icons); // ['tick', 'check', ...]
|
|
621
|
+
* ```
|
|
622
|
+
*/
|
|
623
|
+
function getAvailableIcons() {
|
|
624
|
+
return Object.keys(iconRegistry);
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Check if an icon exists in the registry
|
|
628
|
+
* @param name - Icon name to check
|
|
629
|
+
* @returns true if the icon exists
|
|
630
|
+
*
|
|
631
|
+
* @example
|
|
632
|
+
* ```tsx
|
|
633
|
+
* if (hasIcon('tick')) {
|
|
634
|
+
* // Icon exists
|
|
635
|
+
* }
|
|
636
|
+
* ```
|
|
637
|
+
*/
|
|
638
|
+
function hasIcon(name) {
|
|
639
|
+
return name in iconRegistry;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
const checkboxVariants = classVarianceAuthority.cva("relative inline-flex items-center justify-center shrink-0 transition-all cursor-pointer", {
|
|
283
643
|
variants: {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
644
|
+
size: {
|
|
645
|
+
small: "w-[14px] h-[14px] rounded-small border-[1.5px]",
|
|
646
|
+
medium: "w-[16px] h-[16px] rounded-small border-[1.5px]",
|
|
647
|
+
large: "w-[20px] h-[20px] rounded-medium border-[2px]",
|
|
648
|
+
},
|
|
649
|
+
validationState: {
|
|
650
|
+
none: "",
|
|
651
|
+
error: "border-action-outline-negative-default hover:border-action-outline-negative-hover focus:ring-2 ring-action-outline-negative-faded-hover",
|
|
652
|
+
},
|
|
653
|
+
isChecked: {
|
|
654
|
+
true: "",
|
|
655
|
+
false: "",
|
|
656
|
+
},
|
|
657
|
+
isIndeterminate: {
|
|
658
|
+
true: "",
|
|
659
|
+
false: "",
|
|
289
660
|
},
|
|
661
|
+
isDisabled: {
|
|
662
|
+
true: "cursor-not-allowed opacity-60 border-action-outline-neutral-disabled bg-surface-fill-neutral-subtle",
|
|
663
|
+
false: "",
|
|
664
|
+
},
|
|
665
|
+
},
|
|
666
|
+
compoundVariants: [
|
|
667
|
+
// Unchecked state - none validation
|
|
668
|
+
{
|
|
669
|
+
isChecked: false,
|
|
670
|
+
validationState: "none",
|
|
671
|
+
isDisabled: false,
|
|
672
|
+
class: "border-action-outline-neutral-faded hover:bg-action-fill-neutral-faded hover:border-action-outline-neutral-faded",
|
|
673
|
+
},
|
|
674
|
+
// Checked state - none validation
|
|
675
|
+
{
|
|
676
|
+
isChecked: true,
|
|
677
|
+
validationState: "none",
|
|
678
|
+
isDisabled: false,
|
|
679
|
+
class: "bg-action-fill-primary-default hover:bg-action-fill-primary-hover hover:border-action-fill-primary-hover border-action-fill-primary-default",
|
|
680
|
+
},
|
|
681
|
+
// Checked or Indeterminate state - error validation
|
|
682
|
+
{
|
|
683
|
+
isChecked: true,
|
|
684
|
+
validationState: "error",
|
|
685
|
+
isDisabled: false,
|
|
686
|
+
class: "bg-action-fill-negative-default border-action-fill-negative-default hover:bg-action-fill-negative-hover hover:border-action-fill-negative-hover",
|
|
687
|
+
},
|
|
688
|
+
// Indeterminate state - none validation
|
|
689
|
+
{
|
|
690
|
+
isIndeterminate: true,
|
|
691
|
+
validationState: "none",
|
|
692
|
+
isDisabled: false,
|
|
693
|
+
class: "bg-action-fill-primary-default border-action-fill-primary-default hover:bg-action-fill-primary-hover hover:border-action-fill-primary-hover",
|
|
694
|
+
},
|
|
695
|
+
// Indeterminate state - error validation (same as checked error)
|
|
696
|
+
{
|
|
697
|
+
isIndeterminate: true,
|
|
698
|
+
validationState: "error",
|
|
699
|
+
isDisabled: false,
|
|
700
|
+
class: "bg-action-fill-negative-default border-action-fill-negative-default hover:bg-action-fill-negative-hover hover:border-action-fill-negative-hover",
|
|
701
|
+
},
|
|
702
|
+
],
|
|
703
|
+
defaultVariants: {
|
|
704
|
+
size: "medium",
|
|
705
|
+
validationState: "none",
|
|
706
|
+
isChecked: false,
|
|
707
|
+
isIndeterminate: false,
|
|
708
|
+
isDisabled: false,
|
|
709
|
+
},
|
|
710
|
+
});
|
|
711
|
+
const Checkbox = React__namespace.forwardRef(({ label, errorText, size = "medium", validationState = "none", isDisabled = false, isIndeterminate = false, showErrorText = true, containerClassName, labelClassName, className, checked, onChange, ...props }, ref) => {
|
|
712
|
+
const [internalChecked, setInternalChecked] = React__namespace.useState(false);
|
|
713
|
+
const [showRipple, setShowRipple] = React__namespace.useState(false);
|
|
714
|
+
const inputRef = React__namespace.useRef(null);
|
|
715
|
+
const rippleTimeoutRef = React__namespace.useRef(null);
|
|
716
|
+
// Use forwarded ref or internal ref
|
|
717
|
+
React__namespace.useImperativeHandle(ref, () => inputRef.current);
|
|
718
|
+
const isChecked = checked !== undefined ? checked : internalChecked;
|
|
719
|
+
// Set indeterminate property on the input element
|
|
720
|
+
React__namespace.useEffect(() => {
|
|
721
|
+
if (inputRef.current) {
|
|
722
|
+
inputRef.current.indeterminate = isIndeterminate;
|
|
723
|
+
}
|
|
724
|
+
}, [isIndeterminate]);
|
|
725
|
+
// Cleanup timeout on unmount
|
|
726
|
+
React__namespace.useEffect(() => {
|
|
727
|
+
return () => {
|
|
728
|
+
if (rippleTimeoutRef.current) {
|
|
729
|
+
clearTimeout(rippleTimeoutRef.current);
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
}, []);
|
|
733
|
+
const handleChange = (e) => {
|
|
734
|
+
if (onChange) {
|
|
735
|
+
onChange(e);
|
|
736
|
+
}
|
|
737
|
+
else {
|
|
738
|
+
setInternalChecked(e.target.checked);
|
|
739
|
+
}
|
|
740
|
+
};
|
|
741
|
+
const triggerRipple = () => {
|
|
742
|
+
if (!isDisabled && !showRipple) {
|
|
743
|
+
// Clear any existing timeout
|
|
744
|
+
if (rippleTimeoutRef.current) {
|
|
745
|
+
clearTimeout(rippleTimeoutRef.current);
|
|
746
|
+
}
|
|
747
|
+
setShowRipple(true);
|
|
748
|
+
rippleTimeoutRef.current = setTimeout(() => {
|
|
749
|
+
setShowRipple(false);
|
|
750
|
+
rippleTimeoutRef.current = null;
|
|
751
|
+
}, 400); // Match animation duration (0.4s)
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
const handleContainerClick = () => {
|
|
755
|
+
if (!isDisabled && inputRef.current) {
|
|
756
|
+
triggerRipple();
|
|
757
|
+
inputRef.current.click();
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
const handleKeyDown = (e) => {
|
|
761
|
+
if ((e.key === " " || e.key === "Enter") && !isDisabled) {
|
|
762
|
+
e.preventDefault();
|
|
763
|
+
triggerRipple();
|
|
764
|
+
inputRef.current?.click();
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
// Size-based configurations
|
|
768
|
+
const sizeConfig = {
|
|
769
|
+
small: {
|
|
770
|
+
gap: "gap-2",
|
|
771
|
+
labelSize: "text-body-small-regular",
|
|
772
|
+
iconSize: 10,
|
|
773
|
+
},
|
|
774
|
+
medium: {
|
|
775
|
+
gap: "gap-2.5",
|
|
776
|
+
labelSize: "text-body-medium-regular",
|
|
777
|
+
iconSize: 12,
|
|
778
|
+
},
|
|
779
|
+
large: {
|
|
780
|
+
gap: "gap-3",
|
|
781
|
+
labelSize: "text-body-large-regular",
|
|
782
|
+
iconSize: 14,
|
|
783
|
+
},
|
|
784
|
+
};
|
|
785
|
+
const config = sizeConfig[size];
|
|
786
|
+
// Determine if we should show the error text
|
|
787
|
+
const shouldShowError = errorText && showErrorText;
|
|
788
|
+
return (jsxRuntime.jsxs("div", { className: cn("inline-flex flex-col", containerClassName), children: [jsxRuntime.jsxs("div", { className: cn("inline-flex items-center", config.gap, isDisabled ? "cursor-not-allowed" : "cursor-pointer"), onClick: handleContainerClick, onKeyDown: handleKeyDown, role: "checkbox", "aria-checked": isIndeterminate ? "mixed" : isChecked, "aria-disabled": isDisabled, tabIndex: isDisabled ? -1 : 0, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "checkbox", className: "sr-only", checked: isChecked, onChange: handleChange, disabled: isDisabled, ...props }), jsxRuntime.jsxs("div", { className: "relative inline-flex shrink-0", children: [showRipple && (jsxRuntime.jsx("div", { className: cn("absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full pointer-events-none w-full h-full", validationState === "error"
|
|
789
|
+
? "bg-action-outline-negative-faded"
|
|
790
|
+
: "bg-action-outline-primary-faded"), style: {
|
|
791
|
+
animation: "var(--animate-checkbox-ripple)",
|
|
792
|
+
} })), jsxRuntime.jsxs("div", { className: cn(checkboxVariants({
|
|
793
|
+
size,
|
|
794
|
+
validationState,
|
|
795
|
+
isChecked: isChecked && !isIndeterminate,
|
|
796
|
+
isIndeterminate,
|
|
797
|
+
isDisabled,
|
|
798
|
+
}), className), children: [isChecked && !isIndeterminate && (jsxRuntime.jsx(Icon, { name: "tick", size: config.iconSize, className: "text-action-ink-on-primary-normal" })), isIndeterminate && (jsxRuntime.jsx("svg", { width: config.iconSize, height: config.iconSize, viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-action-ink-on-primary-normal", children: jsxRuntime.jsx("path", { d: "M3 6H9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) }))] })] }), label && (jsxRuntime.jsx("label", { className: cn(config.labelSize, "select-none inline-flex items-center", isDisabled
|
|
799
|
+
? "text-surface-ink-neutral-disabled"
|
|
800
|
+
: "text-surface-ink-neutral-normal", labelClassName), children: label }))] }), shouldShowError && (jsxRuntime.jsx(FormFooter, { helperText: errorText, validationState: "negative", size: size, isDisabled: isDisabled }))] }));
|
|
801
|
+
});
|
|
802
|
+
Checkbox.displayName = "Checkbox";
|
|
803
|
+
|
|
804
|
+
const counterVariants = classVarianceAuthority.cva("inline-flex items-center justify-center transition-colors", {
|
|
805
|
+
variants: {
|
|
290
806
|
size: {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
large: "
|
|
294
|
-
medium: "font-size-900 leading-900 tracking-[0%] mb-0",
|
|
295
|
-
small: "font-size-800 leading-800 tracking-[0%] mb-0",
|
|
296
|
-
xsmall: "font-size-25 leading-25 tracking-[0%] mb-[var(--paragraph-spacing-100)]",
|
|
297
|
-
},
|
|
298
|
-
weight: {
|
|
299
|
-
regular: "font-normal",
|
|
300
|
-
medium: "font-medium",
|
|
301
|
-
semibold: "font-semibold",
|
|
807
|
+
small: "text-body-xsmall-medium rounded-small px-1 py-0.5 min-w-[20px] h-[16px]",
|
|
808
|
+
medium: "text-body-small-medium rounded-medium px-2 py-1 min-w-[24px] h-[20px]",
|
|
809
|
+
large: "text-body-medium-medium rounded-medium px-2 py-1 min-w-[28px] h-[24px]",
|
|
302
810
|
},
|
|
303
811
|
color: {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
},
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
h3: "",
|
|
315
|
-
h4: "",
|
|
316
|
-
h5: "",
|
|
317
|
-
h6: "",
|
|
318
|
-
p: "",
|
|
319
|
-
span: "",
|
|
320
|
-
div: "",
|
|
321
|
-
label: "",
|
|
812
|
+
positive: "",
|
|
813
|
+
negative: "",
|
|
814
|
+
notice: "",
|
|
815
|
+
information: "",
|
|
816
|
+
neutral: "",
|
|
817
|
+
primary: "",
|
|
818
|
+
},
|
|
819
|
+
emphasis: {
|
|
820
|
+
subtle: "",
|
|
821
|
+
intense: "",
|
|
322
822
|
},
|
|
323
823
|
},
|
|
324
824
|
compoundVariants: [
|
|
325
|
-
//
|
|
825
|
+
// Positive - Subtle
|
|
326
826
|
{
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
class: "
|
|
827
|
+
color: "positive",
|
|
828
|
+
emphasis: "subtle",
|
|
829
|
+
class: "bg-feedback-fill-positive-subtle text-feedback-ink-positive-intense",
|
|
330
830
|
},
|
|
831
|
+
// Positive - Intense
|
|
331
832
|
{
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
class: "
|
|
833
|
+
color: "positive",
|
|
834
|
+
emphasis: "intense",
|
|
835
|
+
class: "bg-feedback-fill-positive-intense text-action-ink-on-primary-normal",
|
|
335
836
|
},
|
|
837
|
+
// Negative - Subtle
|
|
336
838
|
{
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
class: "
|
|
839
|
+
color: "negative",
|
|
840
|
+
emphasis: "subtle",
|
|
841
|
+
class: "bg-feedback-fill-negative-subtle text-feedback-ink-negative-subtle",
|
|
340
842
|
},
|
|
341
|
-
//
|
|
843
|
+
// Negative - Intense
|
|
342
844
|
{
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
class: "
|
|
845
|
+
color: "negative",
|
|
846
|
+
emphasis: "intense",
|
|
847
|
+
class: "bg-feedback-fill-negative-intense text-action-ink-on-primary-normal",
|
|
346
848
|
},
|
|
849
|
+
// Notice - Subtle
|
|
347
850
|
{
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
class: "
|
|
851
|
+
color: "notice",
|
|
852
|
+
emphasis: "subtle",
|
|
853
|
+
class: "bg-feedback-fill-notice-subtle text-feedback-ink-notice-subtle",
|
|
351
854
|
},
|
|
855
|
+
// Notice - Intense
|
|
352
856
|
{
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
class: "
|
|
857
|
+
color: "notice",
|
|
858
|
+
emphasis: "intense",
|
|
859
|
+
class: "bg-feedback-fill-notice-intense text-action-ink-on-primary-normal",
|
|
356
860
|
},
|
|
357
|
-
//
|
|
358
|
-
// Display sizes
|
|
861
|
+
// Information - Subtle
|
|
359
862
|
{
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
class: "
|
|
863
|
+
color: "information",
|
|
864
|
+
emphasis: "subtle",
|
|
865
|
+
class: "bg-feedback-fill-info-subtle text-feedback-ink-info-subtle",
|
|
363
866
|
},
|
|
867
|
+
// Information - Intense
|
|
364
868
|
{
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
class: "
|
|
869
|
+
color: "information",
|
|
870
|
+
emphasis: "intense",
|
|
871
|
+
class: "bg-feedback-fill-info-intense text-action-ink-on-primary-normal",
|
|
368
872
|
},
|
|
873
|
+
// Neutral - Subtle
|
|
369
874
|
{
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
class: "
|
|
875
|
+
color: "neutral",
|
|
876
|
+
emphasis: "subtle",
|
|
877
|
+
class: "bg-surface-fill-neutral-subtle text-surface-ink-neutral-normal",
|
|
373
878
|
},
|
|
879
|
+
// Neutral - Intense
|
|
374
880
|
{
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
class: "
|
|
881
|
+
color: "neutral",
|
|
882
|
+
emphasis: "intense",
|
|
883
|
+
class: "bg-feedback-fill-neutral-intense text-action-ink-on-primary-normal",
|
|
378
884
|
},
|
|
379
|
-
//
|
|
885
|
+
// Primary - Subtle
|
|
380
886
|
{
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
class: "
|
|
887
|
+
color: "primary",
|
|
888
|
+
emphasis: "subtle",
|
|
889
|
+
class: "bg-surface-fill-primary-moderate text-surface-ink-primary-normal",
|
|
384
890
|
},
|
|
891
|
+
// Primary - Intense
|
|
385
892
|
{
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
class: "
|
|
893
|
+
color: "primary",
|
|
894
|
+
emphasis: "intense",
|
|
895
|
+
class: "bg-surface-fill-primary-intense text-action-ink-on-primary-normal",
|
|
896
|
+
},
|
|
897
|
+
],
|
|
898
|
+
defaultVariants: {
|
|
899
|
+
size: "medium",
|
|
900
|
+
color: "neutral",
|
|
901
|
+
emphasis: "subtle",
|
|
902
|
+
},
|
|
903
|
+
});
|
|
904
|
+
const Counter = React__namespace.forwardRef(({ value, max, size = "medium", color = "neutral", emphasis = "subtle", className, ...props }, ref) => {
|
|
905
|
+
// Handle max value logic
|
|
906
|
+
const displayValue = React__namespace.useMemo(() => {
|
|
907
|
+
if (max !== undefined && typeof value === "number" && value > max) {
|
|
908
|
+
return `${max}+`;
|
|
909
|
+
}
|
|
910
|
+
return value;
|
|
911
|
+
}, [value, max]);
|
|
912
|
+
return (jsxRuntime.jsx("span", { ref: ref, className: cn(counterVariants({
|
|
913
|
+
size,
|
|
914
|
+
color,
|
|
915
|
+
emphasis,
|
|
916
|
+
}), className), ...props, children: displayValue }));
|
|
917
|
+
});
|
|
918
|
+
Counter.displayName = "Counter";
|
|
919
|
+
|
|
920
|
+
const dividerVariants = classVarianceAuthority.cva("", {
|
|
921
|
+
variants: {
|
|
922
|
+
orientation: {
|
|
923
|
+
horizontal: "w-full",
|
|
924
|
+
vertical: "h-full",
|
|
925
|
+
},
|
|
926
|
+
thickness: {
|
|
927
|
+
thinner: "",
|
|
928
|
+
thin: "",
|
|
929
|
+
thick: "",
|
|
930
|
+
thicker: "",
|
|
389
931
|
},
|
|
932
|
+
lineStyle: {
|
|
933
|
+
solid: "border-solid",
|
|
934
|
+
dashed: "border-dashed",
|
|
935
|
+
},
|
|
936
|
+
variant: {
|
|
937
|
+
normal: "",
|
|
938
|
+
subtle: "",
|
|
939
|
+
muted: "",
|
|
940
|
+
},
|
|
941
|
+
},
|
|
942
|
+
compoundVariants: [
|
|
943
|
+
// Horizontal orientation with thickness
|
|
390
944
|
{
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
class: "
|
|
945
|
+
orientation: "horizontal",
|
|
946
|
+
thickness: "thinner",
|
|
947
|
+
class: "border-t-[0.5px]",
|
|
394
948
|
},
|
|
395
949
|
{
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
class: "
|
|
950
|
+
orientation: "horizontal",
|
|
951
|
+
thickness: "thin",
|
|
952
|
+
class: "border-t-[1px]",
|
|
399
953
|
},
|
|
400
954
|
{
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
class: "
|
|
955
|
+
orientation: "horizontal",
|
|
956
|
+
thickness: "thick",
|
|
957
|
+
class: "border-t-[2px]",
|
|
404
958
|
},
|
|
405
|
-
// Body sizes
|
|
406
959
|
{
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
class: "
|
|
960
|
+
orientation: "horizontal",
|
|
961
|
+
thickness: "thicker",
|
|
962
|
+
class: "border-t-[3px]",
|
|
410
963
|
},
|
|
964
|
+
// Vertical orientation with thickness
|
|
411
965
|
{
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
class: "
|
|
966
|
+
orientation: "vertical",
|
|
967
|
+
thickness: "thinner",
|
|
968
|
+
class: "border-l-[0.5px]",
|
|
415
969
|
},
|
|
416
970
|
{
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
class: "
|
|
971
|
+
orientation: "vertical",
|
|
972
|
+
thickness: "thin",
|
|
973
|
+
class: "border-l-[1px]",
|
|
420
974
|
},
|
|
421
975
|
{
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
class: "
|
|
976
|
+
orientation: "vertical",
|
|
977
|
+
thickness: "thick",
|
|
978
|
+
class: "border-l-[2px]",
|
|
425
979
|
},
|
|
426
|
-
// Caption sizes
|
|
427
980
|
{
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
class: "
|
|
981
|
+
orientation: "vertical",
|
|
982
|
+
thickness: "thicker",
|
|
983
|
+
class: "border-l-[3px]",
|
|
984
|
+
},
|
|
985
|
+
// Normal variant colors
|
|
986
|
+
{
|
|
987
|
+
variant: "normal",
|
|
988
|
+
class: "border-surface-outline-neutral-normal",
|
|
989
|
+
},
|
|
990
|
+
// Subtle variant colors
|
|
991
|
+
{
|
|
992
|
+
variant: "subtle",
|
|
993
|
+
class: "border-surface-outline-neutral-subtle",
|
|
994
|
+
},
|
|
995
|
+
// Muted variant colors
|
|
996
|
+
{
|
|
997
|
+
variant: "muted",
|
|
998
|
+
class: "border-surface-outline-neutral-muted",
|
|
431
999
|
},
|
|
432
1000
|
],
|
|
433
1001
|
defaultVariants: {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
as: "p",
|
|
1002
|
+
orientation: "horizontal",
|
|
1003
|
+
thickness: "thin",
|
|
1004
|
+
lineStyle: "solid",
|
|
1005
|
+
variant: "normal",
|
|
439
1006
|
},
|
|
440
1007
|
});
|
|
441
|
-
const
|
|
442
|
-
|
|
443
|
-
return React__namespace.createElement(Component, {
|
|
444
|
-
className: cn(textVariants({ variant, size, weight, color, as, className })),
|
|
445
|
-
ref,
|
|
446
|
-
...props,
|
|
447
|
-
}, children);
|
|
1008
|
+
const Divider = React__namespace.forwardRef(({ className, orientation = "horizontal", thickness = "thin", lineStyle = "solid", variant = "normal", ...props }, ref) => {
|
|
1009
|
+
return (jsxRuntime.jsx("div", { ref: ref, role: "separator", "aria-orientation": orientation, className: cn(dividerVariants({ orientation, thickness, lineStyle, variant }), className), ...props }));
|
|
448
1010
|
});
|
|
449
|
-
|
|
1011
|
+
Divider.displayName = "Divider";
|
|
450
1012
|
|
|
451
1013
|
const tooltipVariants = classVarianceAuthority.cva("fixed z-50 bg-popup-fill-intense text-action-ink-on-primary-normal rounded-medium border border-popup-outline-subtle flex flex-col p-4 rounded-xlarge min-w-[200px] max-w-[300px] transition-opacity duration-200", {
|
|
452
1014
|
variants: {
|
|
@@ -678,6 +1240,504 @@ const Tooltip = React__namespace.forwardRef(({ children, heading, description, p
|
|
|
678
1240
|
});
|
|
679
1241
|
Tooltip.displayName = "Tooltip";
|
|
680
1242
|
|
|
1243
|
+
const FormHeader = React__namespace.forwardRef(({ label, size = "medium", isOptional = false, isRequired = false, infoHeading, infoDescription, linkText, linkHref, onLinkClick, htmlFor, className, labelClassName, linkClassName, }, ref) => {
|
|
1244
|
+
// Size-based configurations
|
|
1245
|
+
const sizeConfig = {
|
|
1246
|
+
small: {
|
|
1247
|
+
textSize: "xsmall",
|
|
1248
|
+
iconSize: 12,
|
|
1249
|
+
gap: "gap-1.5",
|
|
1250
|
+
},
|
|
1251
|
+
medium: {
|
|
1252
|
+
textSize: "small",
|
|
1253
|
+
iconSize: 14,
|
|
1254
|
+
gap: "gap-2",
|
|
1255
|
+
},
|
|
1256
|
+
large: {
|
|
1257
|
+
textSize: "medium",
|
|
1258
|
+
iconSize: 16,
|
|
1259
|
+
gap: "gap-2.5",
|
|
1260
|
+
},
|
|
1261
|
+
};
|
|
1262
|
+
const config = sizeConfig[size];
|
|
1263
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: cn("flex items-center justify-between px-1", config.gap, className), children: [jsxRuntime.jsxs("div", { className: cn("flex items-center", config.gap), children: [jsxRuntime.jsxs("label", { htmlFor: htmlFor, className: cn("flex items-center", labelClassName), children: [jsxRuntime.jsx(Text, { as: "span", variant: "body", size: config.textSize, weight: "semibold", color: "subtle", children: label }), isRequired && (jsxRuntime.jsx(Text, { as: "span", variant: "body", size: config.textSize, weight: "semibold", className: "text-feedback-ink-negative-subtle ml-0.5", children: "*" })), isOptional && (jsxRuntime.jsx(Text, { as: "span", variant: "body", size: config.textSize, weight: "regular", className: "text-surface-ink-neutral-muted ml-1", children: "(optional)" }))] }), infoDescription && (jsxRuntime.jsx(Tooltip, { description: infoDescription, heading: infoHeading, children: jsxRuntime.jsxs("svg", { width: config.iconSize, height: config.iconSize, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-surface-ink-neutral-muted cursor-help", children: [jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "6", stroke: "currentColor", strokeWidth: "1" }), jsxRuntime.jsx("path", { d: "M7 6V10M7 4.5V4", stroke: "currentColor", strokeWidth: "1", strokeLinecap: "round" })] }) }))] }), linkText && (jsxRuntime.jsx("a", { href: linkHref, onClick: onLinkClick, className: cn("text-surface-ink-primary-normal hover:text-surface-ink-primary-hover transition-colors cursor-pointer font-display font-semibold leading-tight shrink-0", size === "small" && "text-xs", size === "medium" && "text-xs", size === "large" && "text-sm", linkClassName), children: linkText }))] }));
|
|
1264
|
+
});
|
|
1265
|
+
FormHeader.displayName = "FormHeader";
|
|
1266
|
+
|
|
1267
|
+
const listItemVariants = classVarianceAuthority.cva("flex items-start gap-3 p-3 rounded-medium transition-colors cursor-pointer", {
|
|
1268
|
+
variants: {
|
|
1269
|
+
variant: {
|
|
1270
|
+
default: `hover:bg-action-fill-neutral-faded
|
|
1271
|
+
focus:bg-action-fill-neutral-faded
|
|
1272
|
+
focus:ring-2
|
|
1273
|
+
ring-action-outline-primary-faded-hover
|
|
1274
|
+
border border-transparent
|
|
1275
|
+
`,
|
|
1276
|
+
bordered: "border border-action-outline-primary-faded hover:bg-surface-fill-primary-subtle",
|
|
1277
|
+
primary: `hover:bg-action-fill-neutral-faded
|
|
1278
|
+
focus:bg-action-fill-neutral-faded
|
|
1279
|
+
focus:ring-2
|
|
1280
|
+
ring-action-outline-primary-faded-hover
|
|
1281
|
+
border border-transparent
|
|
1282
|
+
`,
|
|
1283
|
+
negative: `hover:bg-action-fill-negative-faded
|
|
1284
|
+
focus:bg-action-fill-negative-faded
|
|
1285
|
+
focus:ring-2 ring-action-outline-negative-faded-hover
|
|
1286
|
+
border border-transparent
|
|
1287
|
+
`,
|
|
1288
|
+
},
|
|
1289
|
+
isDisabled: {
|
|
1290
|
+
true: "cursor-not-allowed opacity-60",
|
|
1291
|
+
false: "",
|
|
1292
|
+
},
|
|
1293
|
+
isSelected: {
|
|
1294
|
+
true: "bg-action-fill-primary-faded border-action-outline-primary-faded",
|
|
1295
|
+
false: "",
|
|
1296
|
+
},
|
|
1297
|
+
},
|
|
1298
|
+
defaultVariants: {
|
|
1299
|
+
variant: "default",
|
|
1300
|
+
isDisabled: false,
|
|
1301
|
+
isSelected: false,
|
|
1302
|
+
},
|
|
1303
|
+
});
|
|
1304
|
+
const ChevronRightIcon = ({ className }) => (jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: jsxRuntime.jsx("path", { d: "M7.5 15L12.5 10L7.5 5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
1305
|
+
const ListItem = React__namespace.forwardRef(({ className, type = "single", leadingIcon, title, description, trailingIcon, showChevron = true, variant = "default", isDisabled = false, isSelected = false, onSelectionChange, checkboxSize = "small", containerClassName, contentClassName, onClick, ...props }, ref) => {
|
|
1306
|
+
const [internalSelected, setInternalSelected] = React__namespace.useState(isSelected);
|
|
1307
|
+
// Sync internal state with prop
|
|
1308
|
+
React__namespace.useEffect(() => {
|
|
1309
|
+
setInternalSelected(isSelected);
|
|
1310
|
+
}, [isSelected]);
|
|
1311
|
+
const handleClick = (e) => {
|
|
1312
|
+
if (isDisabled)
|
|
1313
|
+
return;
|
|
1314
|
+
if (type === "multiple") {
|
|
1315
|
+
const newSelected = !internalSelected;
|
|
1316
|
+
setInternalSelected(newSelected);
|
|
1317
|
+
onSelectionChange?.(newSelected);
|
|
1318
|
+
}
|
|
1319
|
+
onClick?.(e);
|
|
1320
|
+
};
|
|
1321
|
+
const handleCheckboxChange = (e) => {
|
|
1322
|
+
e.stopPropagation();
|
|
1323
|
+
if (isDisabled)
|
|
1324
|
+
return;
|
|
1325
|
+
const newSelected = e.target.checked;
|
|
1326
|
+
setInternalSelected(newSelected);
|
|
1327
|
+
onSelectionChange?.(newSelected);
|
|
1328
|
+
};
|
|
1329
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: cn(listItemVariants({
|
|
1330
|
+
variant,
|
|
1331
|
+
isDisabled,
|
|
1332
|
+
isSelected: type === "multiple" ? internalSelected : false,
|
|
1333
|
+
}), containerClassName), onClick: handleClick, role: type === "multiple" ? "checkbox" : "button", "aria-checked": type === "multiple" ? internalSelected : undefined, "aria-disabled": isDisabled, tabIndex: isDisabled ? -1 : 0, ...props, children: [type === "multiple" && (jsxRuntime.jsx(Checkbox, { checked: internalSelected, onChange: handleCheckboxChange, isDisabled: isDisabled, size: checkboxSize, className: "shrink-0 mt-0.5" })), leadingIcon && (jsxRuntime.jsx("div", { className: cn(`shrink-0 flex items-center justify-center mt-0.5`, variant === "primary"
|
|
1334
|
+
? "text-action-ink-primary-normal"
|
|
1335
|
+
: variant === "negative"
|
|
1336
|
+
? "text-action-ink-negative-normal"
|
|
1337
|
+
: "text-action-ink-neutral-subtle", isDisabled && "text-surface-ink-neutral-disabled"), children: leadingIcon })), jsxRuntime.jsxs("div", { className: cn("flex-1 min-w-0 flex flex-col justify-center", contentClassName), children: [jsxRuntime.jsx("div", { className: cn("text-body-medium-regular truncate", variant === "primary"
|
|
1338
|
+
? "text-action-ink-primary-normal"
|
|
1339
|
+
: variant === "negative"
|
|
1340
|
+
? "text-action-ink-negative-normal"
|
|
1341
|
+
: "text-action-ink-neutral-normal", isDisabled && "text-surface-ink-neutral-disabled"), children: title }), description && (jsxRuntime.jsx("div", { className: cn("text-body-small-regular text-surface-ink-neutral-muted mt-0.5 line-clamp-2", isDisabled && "text-surface-ink-neutral-disabled"), children: description }))] }), (trailingIcon || showChevron) && (jsxRuntime.jsx("div", { className: "shrink-0 self-center text-action-ink-neutral-subtle", children: trailingIcon || jsxRuntime.jsx(ChevronRightIcon, {}) }))] }));
|
|
1342
|
+
});
|
|
1343
|
+
ListItem.displayName = "ListItem";
|
|
1344
|
+
|
|
1345
|
+
const radioVariants = classVarianceAuthority.cva("relative inline-flex items-center justify-center shrink-0 border transition-all cursor-pointer rounded-full", {
|
|
1346
|
+
variants: {
|
|
1347
|
+
size: {
|
|
1348
|
+
small: "w-[14px] h-[14px] border-[1.5px]",
|
|
1349
|
+
medium: "w-[16px] h-[16px] border-[1.5px]",
|
|
1350
|
+
large: "w-[20px] h-[20px] border-[2px]",
|
|
1351
|
+
},
|
|
1352
|
+
validationState: {
|
|
1353
|
+
none: "",
|
|
1354
|
+
error: "border-action-outline-negative-default hover:border-action-outline-negative-hover",
|
|
1355
|
+
},
|
|
1356
|
+
isChecked: {
|
|
1357
|
+
true: "",
|
|
1358
|
+
false: "",
|
|
1359
|
+
},
|
|
1360
|
+
isDisabled: {
|
|
1361
|
+
true: "cursor-not-allowed opacity-60 border-action-outline-neutral-disabled bg-surface-fill-neutral-subtle",
|
|
1362
|
+
false: "",
|
|
1363
|
+
},
|
|
1364
|
+
isFocused: {
|
|
1365
|
+
true: "",
|
|
1366
|
+
false: "",
|
|
1367
|
+
},
|
|
1368
|
+
},
|
|
1369
|
+
compoundVariants: [
|
|
1370
|
+
// Unchecked state - none validation
|
|
1371
|
+
{
|
|
1372
|
+
isChecked: false,
|
|
1373
|
+
validationState: "none",
|
|
1374
|
+
isDisabled: false,
|
|
1375
|
+
class: `border-action-outline-neutral-faded
|
|
1376
|
+
hover:bg-action-fill-neutral-faded
|
|
1377
|
+
hover:border-action-outline-neutral-faded
|
|
1378
|
+
`,
|
|
1379
|
+
},
|
|
1380
|
+
// Checked state - none validation
|
|
1381
|
+
{
|
|
1382
|
+
isChecked: true,
|
|
1383
|
+
validationState: "none",
|
|
1384
|
+
isDisabled: false,
|
|
1385
|
+
class: "bg-action-fill-primary-default hover:bg-action-fill-primary-hover border-action-fill-primary-default hover:border-action-fill-primary-hover",
|
|
1386
|
+
},
|
|
1387
|
+
// Checked state - error validation
|
|
1388
|
+
{
|
|
1389
|
+
isChecked: true,
|
|
1390
|
+
validationState: "error",
|
|
1391
|
+
isDisabled: false,
|
|
1392
|
+
class: "bg-action-fill-negative-default hover:bg-action-fill-negative-hover border-action-fill-negative-default hover:border-action-fill-negative-hover",
|
|
1393
|
+
},
|
|
1394
|
+
// Focused state - none validation
|
|
1395
|
+
{
|
|
1396
|
+
isFocused: true,
|
|
1397
|
+
validationState: "none",
|
|
1398
|
+
isDisabled: false,
|
|
1399
|
+
class: "ring-2 ring-action-outline-primary-faded",
|
|
1400
|
+
},
|
|
1401
|
+
// Focused state - error validation
|
|
1402
|
+
{
|
|
1403
|
+
isFocused: true,
|
|
1404
|
+
validationState: "error",
|
|
1405
|
+
isDisabled: false,
|
|
1406
|
+
class: "ring-2 ring-action-outline-negative-faded",
|
|
1407
|
+
},
|
|
1408
|
+
],
|
|
1409
|
+
defaultVariants: {
|
|
1410
|
+
size: "medium",
|
|
1411
|
+
validationState: "none",
|
|
1412
|
+
isChecked: false,
|
|
1413
|
+
isDisabled: false,
|
|
1414
|
+
isFocused: false,
|
|
1415
|
+
},
|
|
1416
|
+
});
|
|
1417
|
+
const Radio = React__namespace.forwardRef(({ label, errorText, size = "medium", validationState = "none", isDisabled = false, showErrorText = true, containerClassName, labelClassName, className, checked, onChange, ...props }, ref) => {
|
|
1418
|
+
const [internalChecked, setInternalChecked] = React__namespace.useState(false);
|
|
1419
|
+
const [showRipple, setShowRipple] = React__namespace.useState(false);
|
|
1420
|
+
const [isFocused, setIsFocused] = React__namespace.useState(false);
|
|
1421
|
+
const inputRef = React__namespace.useRef(null);
|
|
1422
|
+
// Use forwarded ref or internal ref
|
|
1423
|
+
React__namespace.useImperativeHandle(ref, () => inputRef.current);
|
|
1424
|
+
const isChecked = checked !== undefined ? checked : internalChecked;
|
|
1425
|
+
const handleChange = (e) => {
|
|
1426
|
+
if (onChange) {
|
|
1427
|
+
onChange(e);
|
|
1428
|
+
}
|
|
1429
|
+
else {
|
|
1430
|
+
setInternalChecked(e.target.checked);
|
|
1431
|
+
}
|
|
1432
|
+
};
|
|
1433
|
+
const triggerRipple = () => {
|
|
1434
|
+
if (!isDisabled) {
|
|
1435
|
+
setShowRipple(true);
|
|
1436
|
+
setTimeout(() => {
|
|
1437
|
+
setShowRipple(false);
|
|
1438
|
+
}, 360); // Match animation duration (0.36s)
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
const handleContainerClick = () => {
|
|
1442
|
+
if (!isDisabled && inputRef.current) {
|
|
1443
|
+
// Only show ripple when checking (not unchecking)
|
|
1444
|
+
const willBeChecked = !isChecked;
|
|
1445
|
+
if (willBeChecked) {
|
|
1446
|
+
triggerRipple();
|
|
1447
|
+
}
|
|
1448
|
+
inputRef.current.click();
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
const handleKeyDown = (e) => {
|
|
1452
|
+
if ((e.key === " " || e.key === "Enter") && !isDisabled) {
|
|
1453
|
+
e.preventDefault();
|
|
1454
|
+
// Only show ripple when checking (not unchecking)
|
|
1455
|
+
const willBeChecked = !isChecked;
|
|
1456
|
+
if (willBeChecked) {
|
|
1457
|
+
triggerRipple();
|
|
1458
|
+
}
|
|
1459
|
+
inputRef.current?.click();
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
const handleFocus = () => {
|
|
1463
|
+
if (!isDisabled) {
|
|
1464
|
+
setIsFocused(true);
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
const handleBlur = () => {
|
|
1468
|
+
setIsFocused(false);
|
|
1469
|
+
};
|
|
1470
|
+
// Size-based configurations
|
|
1471
|
+
const sizeConfig = {
|
|
1472
|
+
small: {
|
|
1473
|
+
gap: "gap-2",
|
|
1474
|
+
labelSize: "text-body-small-regular",
|
|
1475
|
+
innerCircleSize: 6,
|
|
1476
|
+
},
|
|
1477
|
+
medium: {
|
|
1478
|
+
gap: "gap-2.5",
|
|
1479
|
+
labelSize: "text-body-medium-regular",
|
|
1480
|
+
innerCircleSize: 7,
|
|
1481
|
+
},
|
|
1482
|
+
large: {
|
|
1483
|
+
gap: "gap-3",
|
|
1484
|
+
labelSize: "text-body-large-regular",
|
|
1485
|
+
innerCircleSize: 8,
|
|
1486
|
+
},
|
|
1487
|
+
};
|
|
1488
|
+
const config = sizeConfig[size];
|
|
1489
|
+
// Determine if we should show the error text
|
|
1490
|
+
const shouldShowError = errorText && showErrorText;
|
|
1491
|
+
return (jsxRuntime.jsxs("div", { className: cn("inline-flex flex-col", containerClassName), children: [jsxRuntime.jsxs("div", { className: cn("inline-flex items-center", config.gap, isDisabled ? "cursor-not-allowed" : "cursor-pointer"), onClick: handleContainerClick, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, role: "radio", "aria-checked": isChecked, "aria-disabled": isDisabled, tabIndex: isDisabled ? -1 : 0, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "radio", className: "sr-only", checked: isChecked, onChange: handleChange, disabled: isDisabled, ...props }), jsxRuntime.jsxs("div", { className: "relative inline-flex shrink-0", children: [showRipple && (jsxRuntime.jsx("div", { className: cn("absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full pointer-events-none w-full h-full", validationState === "error"
|
|
1492
|
+
? "bg-action-outline-negative-faded"
|
|
1493
|
+
: "bg-action-outline-primary-faded"), style: {
|
|
1494
|
+
animation: "var(--animate-checkbox-ripple)",
|
|
1495
|
+
} })), jsxRuntime.jsx("div", { className: cn(radioVariants({
|
|
1496
|
+
size,
|
|
1497
|
+
validationState,
|
|
1498
|
+
isChecked,
|
|
1499
|
+
isDisabled,
|
|
1500
|
+
isFocused,
|
|
1501
|
+
}), className), children: isChecked && (jsxRuntime.jsx("div", { className: "rounded-full bg-white transition-all", style: {
|
|
1502
|
+
width: `${config.innerCircleSize}px`,
|
|
1503
|
+
height: `${config.innerCircleSize}px`,
|
|
1504
|
+
} })) })] }), label && (jsxRuntime.jsx("label", { className: cn(config.labelSize, "select-none inline-flex items-center", isDisabled
|
|
1505
|
+
? "text-surface-ink-neutral-disabled"
|
|
1506
|
+
: "text-surface-ink-neutral-normal", labelClassName), children: label }))] }), shouldShowError && (jsxRuntime.jsx(FormFooter, { helperText: errorText, validationState: "negative", size: size, isDisabled: isDisabled }))] }));
|
|
1507
|
+
});
|
|
1508
|
+
Radio.displayName = "Radio";
|
|
1509
|
+
|
|
1510
|
+
const switchVariants = classVarianceAuthority.cva("relative inline-flex items-center shrink-0 cursor-pointer rounded-full transition-all duration-200", {
|
|
1511
|
+
variants: {
|
|
1512
|
+
size: {
|
|
1513
|
+
small: "w-[20px] h-[12px]",
|
|
1514
|
+
medium: "w-[28px] h-[16px]",
|
|
1515
|
+
large: "w-[36px] h-[20px]",
|
|
1516
|
+
},
|
|
1517
|
+
isChecked: {
|
|
1518
|
+
true: "bg-action-fill-primary-default ",
|
|
1519
|
+
false: "bg-surface-fill-neutral-subtle",
|
|
1520
|
+
},
|
|
1521
|
+
isDisabled: {
|
|
1522
|
+
true: "cursor-not-allowed opacity-60",
|
|
1523
|
+
false: "",
|
|
1524
|
+
},
|
|
1525
|
+
},
|
|
1526
|
+
compoundVariants: [
|
|
1527
|
+
{
|
|
1528
|
+
isChecked: true,
|
|
1529
|
+
isDisabled: false,
|
|
1530
|
+
class: "hover:bg-action-fill-primary-hover ",
|
|
1531
|
+
},
|
|
1532
|
+
{
|
|
1533
|
+
isChecked: false,
|
|
1534
|
+
isDisabled: false,
|
|
1535
|
+
class: "hover:bg-action-fill-neutral-faded",
|
|
1536
|
+
},
|
|
1537
|
+
],
|
|
1538
|
+
defaultVariants: {
|
|
1539
|
+
size: "medium",
|
|
1540
|
+
isChecked: false,
|
|
1541
|
+
isDisabled: false,
|
|
1542
|
+
},
|
|
1543
|
+
});
|
|
1544
|
+
const switchThumbVariants = classVarianceAuthority.cva("inline-block rounded-full bg-neutral-00 shadow-sm transition-transform duration-200", {
|
|
1545
|
+
variants: {
|
|
1546
|
+
size: {
|
|
1547
|
+
small: "h-[8px] w-[8px]",
|
|
1548
|
+
medium: "h-[12px] w-[12px]",
|
|
1549
|
+
large: "h-[16px] w-[16px]",
|
|
1550
|
+
},
|
|
1551
|
+
isChecked: {
|
|
1552
|
+
true: "",
|
|
1553
|
+
false: "",
|
|
1554
|
+
},
|
|
1555
|
+
},
|
|
1556
|
+
compoundVariants: [
|
|
1557
|
+
// Small size translations
|
|
1558
|
+
{
|
|
1559
|
+
size: "small",
|
|
1560
|
+
isChecked: false,
|
|
1561
|
+
class: "translate-x-[2px]",
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
size: "small",
|
|
1565
|
+
isChecked: true,
|
|
1566
|
+
class: "translate-x-[10px]",
|
|
1567
|
+
},
|
|
1568
|
+
// Medium size translations
|
|
1569
|
+
{
|
|
1570
|
+
size: "medium",
|
|
1571
|
+
isChecked: false,
|
|
1572
|
+
class: "translate-x-[2px]",
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
size: "medium",
|
|
1576
|
+
isChecked: true,
|
|
1577
|
+
class: "translate-x-[14px]",
|
|
1578
|
+
},
|
|
1579
|
+
// Large size translations
|
|
1580
|
+
{
|
|
1581
|
+
size: "large",
|
|
1582
|
+
isChecked: false,
|
|
1583
|
+
class: "translate-x-[2px]",
|
|
1584
|
+
},
|
|
1585
|
+
{
|
|
1586
|
+
size: "large",
|
|
1587
|
+
isChecked: true,
|
|
1588
|
+
class: "translate-x-[18px]",
|
|
1589
|
+
},
|
|
1590
|
+
],
|
|
1591
|
+
defaultVariants: {
|
|
1592
|
+
size: "medium",
|
|
1593
|
+
isChecked: false,
|
|
1594
|
+
},
|
|
1595
|
+
});
|
|
1596
|
+
const Switch = React__namespace.forwardRef(({ label, size = "medium", isDisabled = false, containerClassName, labelClassName, trackClassName, thumbClassName, className, checked, onChange, ...props }, ref) => {
|
|
1597
|
+
const [internalChecked, setInternalChecked] = React__namespace.useState(false);
|
|
1598
|
+
const inputRef = React__namespace.useRef(null);
|
|
1599
|
+
// Use forwarded ref or internal ref
|
|
1600
|
+
React__namespace.useImperativeHandle(ref, () => inputRef.current);
|
|
1601
|
+
const isChecked = checked !== undefined ? checked : internalChecked;
|
|
1602
|
+
const handleChange = (e) => {
|
|
1603
|
+
if (onChange) {
|
|
1604
|
+
onChange(e);
|
|
1605
|
+
}
|
|
1606
|
+
else {
|
|
1607
|
+
setInternalChecked(e.target.checked);
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1610
|
+
const handleContainerClick = () => {
|
|
1611
|
+
if (!isDisabled && inputRef.current) {
|
|
1612
|
+
inputRef.current.click();
|
|
1613
|
+
}
|
|
1614
|
+
};
|
|
1615
|
+
const handleKeyDown = (e) => {
|
|
1616
|
+
if ((e.key === " " || e.key === "Enter") && !isDisabled) {
|
|
1617
|
+
e.preventDefault();
|
|
1618
|
+
inputRef.current?.click();
|
|
1619
|
+
}
|
|
1620
|
+
};
|
|
1621
|
+
// Size-based configurations
|
|
1622
|
+
const sizeConfig = {
|
|
1623
|
+
small: {
|
|
1624
|
+
gap: "gap-2",
|
|
1625
|
+
labelSize: "text-body-small-regular",
|
|
1626
|
+
},
|
|
1627
|
+
medium: {
|
|
1628
|
+
gap: "gap-2.5",
|
|
1629
|
+
labelSize: "text-body-medium-regular",
|
|
1630
|
+
},
|
|
1631
|
+
large: {
|
|
1632
|
+
gap: "gap-3",
|
|
1633
|
+
labelSize: "text-body-large-regular",
|
|
1634
|
+
},
|
|
1635
|
+
};
|
|
1636
|
+
const config = sizeConfig[size];
|
|
1637
|
+
return (jsxRuntime.jsx("div", { className: cn("inline-flex flex-col", containerClassName), children: jsxRuntime.jsxs("div", { className: cn("inline-flex items-center", config.gap, isDisabled ? "cursor-not-allowed" : "cursor-pointer"), onClick: handleContainerClick, onKeyDown: handleKeyDown, role: "switch", "aria-checked": isChecked, "aria-disabled": isDisabled, tabIndex: isDisabled ? -1 : 0, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "checkbox", role: "switch", className: "sr-only", checked: isChecked, onChange: handleChange, disabled: isDisabled, ...props }), jsxRuntime.jsx("div", { className: "relative inline-flex shrink-0", children: jsxRuntime.jsx("div", { className: cn(switchVariants({
|
|
1638
|
+
size,
|
|
1639
|
+
isChecked,
|
|
1640
|
+
isDisabled,
|
|
1641
|
+
}), trackClassName, className, "focus-visible:ring-2 focus-visible:ring-action-outline-primary-faded focus-visible:ring-offset-2"), children: jsxRuntime.jsx("span", { className: cn(switchThumbVariants({
|
|
1642
|
+
size,
|
|
1643
|
+
isChecked,
|
|
1644
|
+
}), thumbClassName) }) }) }), label && (jsxRuntime.jsx("label", { className: cn(config.labelSize, "select-none inline-flex items-center", isDisabled
|
|
1645
|
+
? "text-surface-ink-neutral-disabled"
|
|
1646
|
+
: "text-surface-ink-neutral-normal", labelClassName), children: label }))] }) }));
|
|
1647
|
+
});
|
|
1648
|
+
Switch.displayName = "Switch";
|
|
1649
|
+
|
|
1650
|
+
const textAreaVariants = classVarianceAuthority.cva("relative flex flex-col border rounded-medium transition-all font-display font-size-100 leading-100", {
|
|
1651
|
+
variants: {
|
|
1652
|
+
size: {
|
|
1653
|
+
small: "p-3 min-h-[56px] text-xs gap-2",
|
|
1654
|
+
medium: "p-4 min-h-[56px] text-sm gap-2",
|
|
1655
|
+
large: "p-5 min-h-[64px]text-base gap-3",
|
|
1656
|
+
},
|
|
1657
|
+
validationState: {
|
|
1658
|
+
none: `
|
|
1659
|
+
border-action-outline-neutral-faded
|
|
1660
|
+
hover:border-action-outline-primary-hover
|
|
1661
|
+
focus-within:border-action-outline-primary-hover
|
|
1662
|
+
focus-within:ring-2
|
|
1663
|
+
ring-action-outline-primary-faded-hover`,
|
|
1664
|
+
positive: `
|
|
1665
|
+
border-action-outline-positive-default
|
|
1666
|
+
focus-within:border-action-outline-positive-hover
|
|
1667
|
+
focus-within:ring-2
|
|
1668
|
+
ring-action-outline-positive-faded-hover`,
|
|
1669
|
+
negative: `border-action-outline-negative-default
|
|
1670
|
+
focus-within:border-action-outline-negative-hover
|
|
1671
|
+
focus-within:ring-2
|
|
1672
|
+
ring-action-outline-negative-faded-hover`,
|
|
1673
|
+
},
|
|
1674
|
+
isDisabled: {
|
|
1675
|
+
true: `
|
|
1676
|
+
border-[var(--border-width-thinner)]
|
|
1677
|
+
hover:border-action-outline-neutral-disabled
|
|
1678
|
+
border-action-outline-neutral-disabled
|
|
1679
|
+
bg-surface-fill-neutral-intense cursor-not-allowed opacity-60`,
|
|
1680
|
+
false: "bg-surface-fill-neutral-intense",
|
|
1681
|
+
},
|
|
1682
|
+
},
|
|
1683
|
+
defaultVariants: {
|
|
1684
|
+
size: "medium",
|
|
1685
|
+
validationState: "none",
|
|
1686
|
+
isDisabled: false,
|
|
1687
|
+
},
|
|
1688
|
+
});
|
|
1689
|
+
const TextArea = React__namespace.forwardRef(({ label, helperText, errorText, successText, size = "medium", validationState = "none", isDisabled = false, isRequired = false, isOptional = false, maxChar, showCharCount = true, infoDescription, infoHeading, linkText, linkHref, onLinkClick, containerClassName, labelClassName, textAreaClassName, className, value, onChange, rows = 4, ...props }, ref) => {
|
|
1690
|
+
const [internalValue, setInternalValue] = React__namespace.useState("");
|
|
1691
|
+
const textAreaValue = value !== undefined ? value : internalValue;
|
|
1692
|
+
const currentLength = String(textAreaValue).length;
|
|
1693
|
+
const handleChange = (e) => {
|
|
1694
|
+
const newValue = e.target.value;
|
|
1695
|
+
// Prevent exceeding maxChar if specified
|
|
1696
|
+
if (maxChar && newValue.length > maxChar) {
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
if (onChange) {
|
|
1700
|
+
onChange(e);
|
|
1701
|
+
}
|
|
1702
|
+
else {
|
|
1703
|
+
setInternalValue(newValue);
|
|
1704
|
+
}
|
|
1705
|
+
};
|
|
1706
|
+
// Determine which helper text to show
|
|
1707
|
+
const displayHelperText = errorText || successText || helperText;
|
|
1708
|
+
const currentValidationState = errorText
|
|
1709
|
+
? "negative"
|
|
1710
|
+
: successText
|
|
1711
|
+
? "positive"
|
|
1712
|
+
: validationState;
|
|
1713
|
+
// Check if we're approaching or at the limit
|
|
1714
|
+
const isNearLimit = maxChar && currentLength >= maxChar * 0.9;
|
|
1715
|
+
const isAtLimit = maxChar && currentLength >= maxChar;
|
|
1716
|
+
const sizeConfig = {
|
|
1717
|
+
small: {
|
|
1718
|
+
gap: "gap-2",
|
|
1719
|
+
},
|
|
1720
|
+
medium: {
|
|
1721
|
+
gap: "gap-2",
|
|
1722
|
+
},
|
|
1723
|
+
large: {
|
|
1724
|
+
gap: "gap-3",
|
|
1725
|
+
},
|
|
1726
|
+
};
|
|
1727
|
+
return (jsxRuntime.jsxs("div", { className: cn("w-full flex flex-col", sizeConfig[size].gap, containerClassName), children: [label && (jsxRuntime.jsx(FormHeader, { label: label, size: size, isRequired: isRequired, isOptional: isOptional, infoHeading: infoHeading, infoDescription: infoDescription, linkText: linkText, linkHref: linkHref, onLinkClick: onLinkClick, htmlFor: props.id, className: "mb-2", labelClassName: labelClassName })), jsxRuntime.jsx("div", { className: cn(textAreaVariants({
|
|
1728
|
+
size,
|
|
1729
|
+
validationState: currentValidationState,
|
|
1730
|
+
isDisabled,
|
|
1731
|
+
}), className), children: jsxRuntime.jsx("textarea", { ref: ref, value: textAreaValue, onChange: handleChange, disabled: isDisabled, required: isRequired, rows: rows, className: cn("flex-1 bg-transparent border-none outline-none text-surface-ink-neutral-normal placeholder:text-surface-ink-neutral-muted disabled:cursor-not-allowed disabled:text-surface-ink-neutral-disabled font-display resize-none", size === "small" && "text-xs", size === "medium" && "text-sm", size === "large" && "text-base", textAreaClassName), ...props }) }), jsxRuntime.jsx(FormFooter, { helperText: displayHelperText, trailingText: maxChar && showCharCount ? `${currentLength}/${maxChar}` : undefined, validationState: currentValidationState === "none"
|
|
1732
|
+
? "default"
|
|
1733
|
+
: currentValidationState, size: size, isDisabled: isDisabled, className: "mt-1", trailingTextClassName: cn("transition-colors", isAtLimit
|
|
1734
|
+
? "text-feedback-ink-negative-subtle"
|
|
1735
|
+
: isNearLimit
|
|
1736
|
+
? "text-feedback-ink-warning-subtle"
|
|
1737
|
+
: "") })] }));
|
|
1738
|
+
});
|
|
1739
|
+
TextArea.displayName = "TextArea";
|
|
1740
|
+
|
|
681
1741
|
const textFieldVariants = classVarianceAuthority.cva("relative flex items-center gap-2 border rounded-medium transition-all font-display font-size-100 leading-100", {
|
|
682
1742
|
variants: {
|
|
683
1743
|
size: {
|
|
@@ -687,19 +1747,17 @@ const textFieldVariants = classVarianceAuthority.cva("relative flex items-center
|
|
|
687
1747
|
},
|
|
688
1748
|
validationState: {
|
|
689
1749
|
none: `
|
|
690
|
-
border-action-outline-neutral-
|
|
1750
|
+
border-action-outline-neutral-faded
|
|
691
1751
|
hover:border-action-outline-primary-hover
|
|
692
1752
|
focus-within:border-action-outline-primary-hover
|
|
693
1753
|
focus-within:ring-2
|
|
694
1754
|
ring-action-outline-primary-faded-hover`,
|
|
695
1755
|
positive: `
|
|
696
1756
|
border-action-outline-positive-default
|
|
697
|
-
hover:border-action-outline-positive-hover
|
|
698
1757
|
focus-within:border-action-outline-positive-hover
|
|
699
1758
|
focus-within:ring-2
|
|
700
1759
|
ring-action-outline-positive-faded-hover`,
|
|
701
1760
|
negative: `border-action-outline-negative-default
|
|
702
|
-
hover:border-action-outline-negative-hover
|
|
703
1761
|
focus-within:border-action-outline-negative-hover
|
|
704
1762
|
focus-within:ring-2
|
|
705
1763
|
ring-action-outline-negative-faded-hover`,
|
|
@@ -719,7 +1777,7 @@ const textFieldVariants = classVarianceAuthority.cva("relative flex items-center
|
|
|
719
1777
|
isDisabled: false,
|
|
720
1778
|
},
|
|
721
1779
|
});
|
|
722
|
-
const TextField = React__namespace.forwardRef(({ label, helperText, errorText, successText, size = "medium", validationState = "none", isDisabled = false, isRequired = false, prefix, suffix, showClearButton = false, infoDescription, infoHeading, onClear, containerClassName, labelClassName, inputClassName, className, value, onChange, ...props }, ref) => {
|
|
1780
|
+
const TextField = React__namespace.forwardRef(({ label, helperText, errorText, successText, size = "medium", validationState = "none", isDisabled = false, isRequired = false, isOptional = false, prefix, suffix, showClearButton = false, infoDescription, infoHeading, linkText, linkHref, onLinkClick, onClear, containerClassName, labelClassName, inputClassName, className, value, onChange, ...props }, ref) => {
|
|
723
1781
|
const [internalValue, setInternalValue] = React__namespace.useState("");
|
|
724
1782
|
const inputValue = value !== undefined ? value : internalValue;
|
|
725
1783
|
const hasValue = inputValue && String(inputValue).length > 0;
|
|
@@ -751,7 +1809,18 @@ const TextField = React__namespace.forwardRef(({ label, helperText, errorText, s
|
|
|
751
1809
|
: successText
|
|
752
1810
|
? "positive"
|
|
753
1811
|
: validationState;
|
|
754
|
-
|
|
1812
|
+
const sizeConfig = {
|
|
1813
|
+
small: {
|
|
1814
|
+
gap: "gap-2",
|
|
1815
|
+
},
|
|
1816
|
+
medium: {
|
|
1817
|
+
gap: "gap-2",
|
|
1818
|
+
},
|
|
1819
|
+
large: {
|
|
1820
|
+
gap: "gap-3",
|
|
1821
|
+
},
|
|
1822
|
+
};
|
|
1823
|
+
return (jsxRuntime.jsxs("div", { className: cn("w-full flex flex-col", sizeConfig[size].gap, containerClassName), children: [label && (jsxRuntime.jsx(FormHeader, { label: label, size: size, isRequired: isRequired, isOptional: isOptional, infoHeading: infoHeading, infoDescription: infoDescription, linkText: linkText, linkHref: linkHref, onLinkClick: onLinkClick, htmlFor: props.id, className: "mb-2", labelClassName: labelClassName })), jsxRuntime.jsxs("div", { className: cn(textFieldVariants({
|
|
755
1824
|
size,
|
|
756
1825
|
validationState: currentValidationState,
|
|
757
1826
|
isDisabled,
|
|
@@ -767,25 +1836,39 @@ const TextField = React__namespace.forwardRef(({ label, helperText, errorText, s
|
|
|
767
1836
|
? "text-feedback-ink-positive-intense"
|
|
768
1837
|
: currentValidationState === "negative"
|
|
769
1838
|
? "text-feedback-ink-negative-subtle"
|
|
770
|
-
: "text-surface-ink-neutral-muted"), children: suffix }))] }),
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
? "default"
|
|
774
|
-
: isDisabled
|
|
775
|
-
? "disabled"
|
|
776
|
-
: "subtle", className: cn("italic font-size-100 leading-100", currentValidationState === "positive" &&
|
|
777
|
-
"text-feedback-ink-positive-intense", currentValidationState === "negative" &&
|
|
778
|
-
"text-feedback-ink-negative-subtle"), children: displayHelperText })] }))] }));
|
|
1839
|
+
: "text-surface-ink-neutral-muted"), children: suffix }))] }), jsxRuntime.jsx(FormFooter, { helperText: displayHelperText, validationState: currentValidationState === "none"
|
|
1840
|
+
? "default"
|
|
1841
|
+
: currentValidationState, size: size, isDisabled: isDisabled, className: "mt-1" })] }));
|
|
779
1842
|
});
|
|
780
1843
|
TextField.displayName = "TextField";
|
|
781
1844
|
|
|
1845
|
+
exports.Badge = Badge;
|
|
782
1846
|
exports.Button = Button;
|
|
1847
|
+
exports.Checkbox = Checkbox;
|
|
1848
|
+
exports.Counter = Counter;
|
|
1849
|
+
exports.Divider = Divider;
|
|
1850
|
+
exports.FormFooter = FormFooter;
|
|
1851
|
+
exports.FormHeader = FormHeader;
|
|
1852
|
+
exports.Icon = Icon;
|
|
1853
|
+
exports.ListItem = ListItem;
|
|
1854
|
+
exports.Radio = Radio;
|
|
1855
|
+
exports.Switch = Switch;
|
|
783
1856
|
exports.Text = Text;
|
|
1857
|
+
exports.TextArea = TextArea;
|
|
784
1858
|
exports.TextField = TextField;
|
|
785
1859
|
exports.Tooltip = Tooltip;
|
|
1860
|
+
exports.badgeVariants = badgeVariants;
|
|
786
1861
|
exports.buttonVariants = buttonVariants;
|
|
1862
|
+
exports.checkboxVariants = checkboxVariants;
|
|
787
1863
|
exports.cn = cn;
|
|
1864
|
+
exports.counterVariants = counterVariants;
|
|
1865
|
+
exports.getAvailableIcons = getAvailableIcons;
|
|
1866
|
+
exports.hasIcon = hasIcon;
|
|
1867
|
+
exports.iconRegistry = iconRegistry;
|
|
1868
|
+
exports.listItemVariants = listItemVariants;
|
|
1869
|
+
exports.radioVariants = radioVariants;
|
|
1870
|
+
exports.switchVariants = switchVariants;
|
|
1871
|
+
exports.textAreaVariants = textAreaVariants;
|
|
788
1872
|
exports.textFieldVariants = textFieldVariants;
|
|
789
|
-
exports.textVariants = textVariants;
|
|
790
1873
|
exports.tooltipVariants = tooltipVariants;
|
|
791
1874
|
//# sourceMappingURL=index.js.map
|