@teja-app/ui 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Alert/Alert.d.ts.map +1 -1
- package/dist/components/Alert/Alert.types.d.ts +2 -0
- package/dist/components/Alert/Alert.types.d.ts.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/components/Avatar/Avatar.types.d.ts +2 -0
- package/dist/components/Avatar/Avatar.types.d.ts.map +1 -1
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.types.d.ts +2 -0
- package/dist/components/Badge/Badge.types.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts.map +1 -1
- package/dist/components/Card/Card.d.ts.map +1 -1
- package/dist/components/Card/Card.types.d.ts +2 -0
- package/dist/components/Card/Card.types.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.types.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.d.ts +1 -1
- package/dist/components/Combobox/Combobox.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.types.d.ts +2 -0
- package/dist/components/Combobox/Combobox.types.d.ts.map +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.types.d.ts +2 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.types.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +1 -1
- package/dist/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.types.d.ts +2 -0
- package/dist/components/Drawer/Drawer.types.d.ts.map +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/components/EmptyState/EmptyState.types.d.ts +2 -0
- package/dist/components/EmptyState/EmptyState.types.d.ts.map +1 -1
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/Input.types.d.ts +2 -0
- package/dist/components/Input/Input.types.d.ts.map +1 -1
- package/dist/components/Modal/Modal.d.ts +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.types.d.ts +2 -0
- package/dist/components/Modal/Modal.types.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.types.d.ts +2 -0
- package/dist/components/MultiSelect/MultiSelect.types.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.d.ts +1 -1
- package/dist/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.types.d.ts +2 -0
- package/dist/components/Pagination/Pagination.types.d.ts.map +1 -1
- package/dist/components/PasswordInput/PasswordInput.d.ts.map +1 -1
- package/dist/components/PasswordInput/PasswordInput.types.d.ts +2 -0
- package/dist/components/PasswordInput/PasswordInput.types.d.ts.map +1 -1
- package/dist/components/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Radio/Radio.types.d.ts +4 -0
- package/dist/components/Radio/Radio.types.d.ts.map +1 -1
- package/dist/components/Radio/RadioGroup.d.ts +1 -1
- package/dist/components/Radio/RadioGroup.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.types.d.ts +2 -0
- package/dist/components/Select/Select.types.d.ts.map +1 -1
- package/dist/components/Sidebar/Sidebar.d.ts.map +1 -1
- package/dist/components/Sidebar/Sidebar.types.d.ts +4 -0
- package/dist/components/Sidebar/Sidebar.types.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarItem.d.ts +1 -1
- package/dist/components/Sidebar/SidebarItem.d.ts.map +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/components/Skeleton/Skeleton.types.d.ts +2 -0
- package/dist/components/Skeleton/Skeleton.types.d.ts.map +1 -1
- package/dist/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/components/Spinner/Spinner.types.d.ts +2 -0
- package/dist/components/Spinner/Spinner.types.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +2 -2
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.types.d.ts +4 -0
- package/dist/components/Tabs/Tabs.types.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.types.d.ts +2 -0
- package/dist/components/Textarea/Textarea.types.d.ts.map +1 -1
- package/dist/components/Toggle/Toggle.d.ts +1 -1
- package/dist/components/Toggle/Toggle.d.ts.map +1 -1
- package/dist/components/Toggle/Toggle.types.d.ts +2 -0
- package/dist/components/Toggle/Toggle.types.d.ts.map +1 -1
- package/dist/index.cjs +205 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +205 -66
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -150,6 +150,7 @@ const Spinner = forwardRef(
|
|
|
150
150
|
color = "current",
|
|
151
151
|
label = "Loading",
|
|
152
152
|
className,
|
|
153
|
+
testId,
|
|
153
154
|
...props
|
|
154
155
|
}, ref) => {
|
|
155
156
|
return /* @__PURE__ */ jsxs(
|
|
@@ -167,6 +168,7 @@ const Spinner = forwardRef(
|
|
|
167
168
|
xmlns: "http://www.w3.org/2000/svg",
|
|
168
169
|
role: "status",
|
|
169
170
|
"aria-label": label,
|
|
171
|
+
"data-testid": testId,
|
|
170
172
|
...props,
|
|
171
173
|
children: [
|
|
172
174
|
/* @__PURE__ */ jsx(
|
|
@@ -207,18 +209,20 @@ const Input = forwardRef(
|
|
|
207
209
|
required,
|
|
208
210
|
disabled,
|
|
209
211
|
isLoading = false,
|
|
212
|
+
testId,
|
|
210
213
|
...props
|
|
211
214
|
}, ref) => {
|
|
212
215
|
const inputId = id || label?.toLowerCase().replace(/\s+/g, "-");
|
|
213
216
|
const hasError = !!error2;
|
|
214
217
|
const errorId = hasError ? `${inputId}-error` : void 0;
|
|
215
218
|
const showRightIcon = rightIcon || isLoading;
|
|
216
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto"), children: [
|
|
219
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto"), "data-testid": testId, children: [
|
|
217
220
|
label && /* @__PURE__ */ jsxs(
|
|
218
221
|
"label",
|
|
219
222
|
{
|
|
220
223
|
htmlFor: inputId,
|
|
221
224
|
className: "mb-2 block text-sm font-medium text-primary-700 dark:text-white",
|
|
225
|
+
"data-testid": testId ? `${testId}-label` : void 0,
|
|
222
226
|
children: [
|
|
223
227
|
label,
|
|
224
228
|
required && /* @__PURE__ */ jsx("span", { className: "ml-1 text-error", children: "*" })
|
|
@@ -226,7 +230,14 @@ const Input = forwardRef(
|
|
|
226
230
|
}
|
|
227
231
|
),
|
|
228
232
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
229
|
-
leftIcon && /* @__PURE__ */ jsx(
|
|
233
|
+
leftIcon && /* @__PURE__ */ jsx(
|
|
234
|
+
"div",
|
|
235
|
+
{
|
|
236
|
+
className: "pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 text-primary-400 dark:text-primary-500",
|
|
237
|
+
"data-testid": testId ? `${testId}-left-icon` : void 0,
|
|
238
|
+
children: leftIcon
|
|
239
|
+
}
|
|
240
|
+
),
|
|
230
241
|
/* @__PURE__ */ jsx(
|
|
231
242
|
"input",
|
|
232
243
|
{
|
|
@@ -237,6 +248,7 @@ const Input = forwardRef(
|
|
|
237
248
|
"aria-label": !label ? props.placeholder || "Input" : void 0,
|
|
238
249
|
"aria-invalid": hasError ? "true" : void 0,
|
|
239
250
|
"aria-describedby": errorId,
|
|
251
|
+
"data-testid": testId ? `${testId}-input` : void 0,
|
|
240
252
|
className: cn(
|
|
241
253
|
// Base styles - Light mode
|
|
242
254
|
"block w-full rounded-md border bg-white px-4 py-2.5 text-sm text-primary-900",
|
|
@@ -259,13 +271,21 @@ const Input = forwardRef(
|
|
|
259
271
|
...props
|
|
260
272
|
}
|
|
261
273
|
),
|
|
262
|
-
showRightIcon && /* @__PURE__ */ jsx(
|
|
274
|
+
showRightIcon && /* @__PURE__ */ jsx(
|
|
275
|
+
"div",
|
|
276
|
+
{
|
|
277
|
+
className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3 text-primary-400 dark:text-primary-500",
|
|
278
|
+
"data-testid": testId ? `${testId}-right-icon` : void 0,
|
|
279
|
+
children: isLoading ? /* @__PURE__ */ jsx(Spinner, { size: "sm", color: "primary" }) : rightIcon
|
|
280
|
+
}
|
|
281
|
+
)
|
|
263
282
|
] }),
|
|
264
283
|
(error2 || helperText) && /* @__PURE__ */ jsx(
|
|
265
284
|
"p",
|
|
266
285
|
{
|
|
267
286
|
id: errorId,
|
|
268
287
|
role: hasError ? "alert" : void 0,
|
|
288
|
+
"data-testid": testId ? hasError ? `${testId}-error` : `${testId}-helper-text` : void 0,
|
|
269
289
|
className: cn(
|
|
270
290
|
"mt-1.5 text-sm",
|
|
271
291
|
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
@@ -345,7 +365,7 @@ function getPasswordStrength(password) {
|
|
|
345
365
|
}
|
|
346
366
|
}
|
|
347
367
|
const PasswordInput = forwardRef(
|
|
348
|
-
({ showStrengthIndicator = false, value, className, ...props }, ref) => {
|
|
368
|
+
({ showStrengthIndicator = false, value, className, testId, ...props }, ref) => {
|
|
349
369
|
const [showPassword, setShowPassword] = useState(false);
|
|
350
370
|
const togglePasswordVisibility = () => {
|
|
351
371
|
setShowPassword((prev) => !prev);
|
|
@@ -364,10 +384,11 @@ const PasswordInput = forwardRef(
|
|
|
364
384
|
"dark:text-primary-500 dark:hover:text-primary-300"
|
|
365
385
|
),
|
|
366
386
|
"aria-label": showPassword ? "Hide password" : "Show password",
|
|
387
|
+
"data-testid": testId ? `${testId}-toggle-button` : void 0,
|
|
367
388
|
children: showPassword ? /* @__PURE__ */ jsx(EyeSlashIcon, {}) : /* @__PURE__ */ jsx(EyeIcon, {})
|
|
368
389
|
}
|
|
369
390
|
);
|
|
370
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), children: [
|
|
391
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), "data-testid": testId, children: [
|
|
371
392
|
/* @__PURE__ */ jsx(
|
|
372
393
|
Input,
|
|
373
394
|
{
|
|
@@ -375,7 +396,8 @@ const PasswordInput = forwardRef(
|
|
|
375
396
|
ref,
|
|
376
397
|
type: showPassword ? "text" : "password",
|
|
377
398
|
value,
|
|
378
|
-
rightIcon: toggleButton
|
|
399
|
+
rightIcon: toggleButton,
|
|
400
|
+
testId: testId ? `${testId}-input` : void 0
|
|
379
401
|
}
|
|
380
402
|
),
|
|
381
403
|
showStrengthIndicator && passwordValue && strength && strength.label && /* @__PURE__ */ jsxs("div", { className: "mt-2", children: [
|
|
@@ -424,6 +446,7 @@ const Textarea = forwardRef(
|
|
|
424
446
|
defaultValue,
|
|
425
447
|
onChange,
|
|
426
448
|
isLoading = false,
|
|
449
|
+
testId,
|
|
427
450
|
...props
|
|
428
451
|
}, ref) => {
|
|
429
452
|
const textareaId = id || label?.toLowerCase().replace(/\s+/g, "-");
|
|
@@ -464,12 +487,13 @@ const Textarea = forwardRef(
|
|
|
464
487
|
adjustHeight();
|
|
465
488
|
}
|
|
466
489
|
}, [autoResize, adjustHeight, value, defaultValue]);
|
|
467
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto"), children: [
|
|
490
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto"), "data-testid": testId, children: [
|
|
468
491
|
label && /* @__PURE__ */ jsxs(
|
|
469
492
|
"label",
|
|
470
493
|
{
|
|
471
494
|
htmlFor: textareaId,
|
|
472
495
|
className: "mb-2 block text-sm font-medium text-primary-700 dark:text-white",
|
|
496
|
+
"data-testid": testId ? `${testId}-label` : void 0,
|
|
473
497
|
children: [
|
|
474
498
|
label,
|
|
475
499
|
required && /* @__PURE__ */ jsx("span", { className: "ml-1 text-error", children: "*" })
|
|
@@ -492,6 +516,7 @@ const Textarea = forwardRef(
|
|
|
492
516
|
"aria-invalid": hasError ? "true" : void 0,
|
|
493
517
|
"aria-describedby": errorId,
|
|
494
518
|
onChange: handleChange,
|
|
519
|
+
"data-testid": testId ? `${testId}-textarea` : void 0,
|
|
495
520
|
className: cn(
|
|
496
521
|
// Base styles - Light mode
|
|
497
522
|
"block w-full rounded-md border bg-white px-4 py-2.5 text-sm text-primary-900",
|
|
@@ -522,6 +547,7 @@ const Textarea = forwardRef(
|
|
|
522
547
|
{
|
|
523
548
|
id: errorId,
|
|
524
549
|
role: hasError ? "alert" : void 0,
|
|
550
|
+
"data-testid": testId ? hasError ? `${testId}-error` : `${testId}-helper-text` : void 0,
|
|
525
551
|
className: cn(
|
|
526
552
|
"text-sm",
|
|
527
553
|
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
@@ -7223,18 +7249,20 @@ function Select({
|
|
|
7223
7249
|
className,
|
|
7224
7250
|
isLoading = false,
|
|
7225
7251
|
loadingText = "Loading...",
|
|
7226
|
-
placement = "bottom"
|
|
7252
|
+
placement = "bottom",
|
|
7253
|
+
testId
|
|
7227
7254
|
}) {
|
|
7228
7255
|
const selectedOption = options.find((opt) => opt.value === value);
|
|
7229
7256
|
const hasError = !!error2;
|
|
7230
7257
|
const isDisabled = disabled || isLoading;
|
|
7231
7258
|
const labelId = useId$1();
|
|
7232
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto", className), children: [
|
|
7259
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto", className), "data-testid": testId, children: [
|
|
7233
7260
|
label && /* @__PURE__ */ jsxs(
|
|
7234
7261
|
"label",
|
|
7235
7262
|
{
|
|
7236
7263
|
id: labelId,
|
|
7237
7264
|
className: "mb-2 block text-sm font-medium text-primary-700 dark:text-white",
|
|
7265
|
+
"data-testid": testId ? `${testId}-label` : void 0,
|
|
7238
7266
|
children: [
|
|
7239
7267
|
label,
|
|
7240
7268
|
required && /* @__PURE__ */ jsx("span", { className: "ml-1 text-error", children: "*" })
|
|
@@ -7247,6 +7275,7 @@ function Select({
|
|
|
7247
7275
|
{
|
|
7248
7276
|
"aria-label": !label ? placeholder : void 0,
|
|
7249
7277
|
"aria-labelledby": label ? labelId : void 0,
|
|
7278
|
+
"data-testid": testId ? `${testId}-button` : void 0,
|
|
7250
7279
|
className: cn(
|
|
7251
7280
|
// Base styles - Light mode
|
|
7252
7281
|
"relative w-full rounded-md border bg-white px-4 py-2.5 text-left text-sm",
|
|
@@ -7300,15 +7329,18 @@ function Select({
|
|
|
7300
7329
|
children: /* @__PURE__ */ jsx(
|
|
7301
7330
|
Bt,
|
|
7302
7331
|
{
|
|
7332
|
+
portal: true,
|
|
7303
7333
|
className: cn(
|
|
7304
7334
|
"absolute z-dropdown max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-sm shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-primary-800 dark:ring-primary-700",
|
|
7305
7335
|
placement === "top" ? "bottom-full mb-1" : "top-full mt-1"
|
|
7306
7336
|
),
|
|
7307
|
-
|
|
7337
|
+
"data-testid": testId ? `${testId}-options` : void 0,
|
|
7338
|
+
children: options.map((option, index2) => /* @__PURE__ */ jsx(
|
|
7308
7339
|
It,
|
|
7309
7340
|
{
|
|
7310
7341
|
disabled: option.disabled,
|
|
7311
7342
|
value: option.value,
|
|
7343
|
+
"data-testid": testId ? `${testId}-option-${index2}` : void 0,
|
|
7312
7344
|
className: ({ active, selected }) => cn(
|
|
7313
7345
|
"relative cursor-pointer select-none py-2.5 pl-10 pr-4",
|
|
7314
7346
|
// Light mode
|
|
@@ -7350,6 +7382,7 @@ function Select({
|
|
|
7350
7382
|
"p",
|
|
7351
7383
|
{
|
|
7352
7384
|
role: hasError ? "alert" : void 0,
|
|
7385
|
+
"data-testid": testId ? hasError ? `${testId}-error` : `${testId}-helper-text` : void 0,
|
|
7353
7386
|
className: cn(
|
|
7354
7387
|
"mt-1.5 text-sm",
|
|
7355
7388
|
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
@@ -7395,7 +7428,8 @@ function Modal({
|
|
|
7395
7428
|
footer,
|
|
7396
7429
|
closeOnOverlay = true,
|
|
7397
7430
|
className,
|
|
7398
|
-
isLoading = false
|
|
7431
|
+
isLoading = false,
|
|
7432
|
+
testId
|
|
7399
7433
|
}) {
|
|
7400
7434
|
const handleClose = closeOnOverlay ? onClose : () => {
|
|
7401
7435
|
};
|
|
@@ -7410,7 +7444,7 @@ function Modal({
|
|
|
7410
7444
|
leave: "ease-in duration-100",
|
|
7411
7445
|
leaveFrom: "opacity-100",
|
|
7412
7446
|
leaveTo: "opacity-0",
|
|
7413
|
-
children: /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black/40 backdrop-blur-sm" })
|
|
7447
|
+
children: /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black/40 backdrop-blur-sm", "data-testid": testId ? `${testId}-overlay` : void 0 })
|
|
7414
7448
|
}
|
|
7415
7449
|
),
|
|
7416
7450
|
/* @__PURE__ */ jsx("div", { className: "fixed inset-0 flex items-center justify-center p-4", children: /* @__PURE__ */ jsx(
|
|
@@ -7435,6 +7469,7 @@ function Modal({
|
|
|
7435
7469
|
sizeStyles$b[size2],
|
|
7436
7470
|
className
|
|
7437
7471
|
),
|
|
7472
|
+
"data-testid": testId,
|
|
7438
7473
|
children: [
|
|
7439
7474
|
(title || showCloseButton) && /* @__PURE__ */ jsxs(
|
|
7440
7475
|
"div",
|
|
@@ -7443,6 +7478,7 @@ function Modal({
|
|
|
7443
7478
|
"flex items-start justify-between px-6 py-4",
|
|
7444
7479
|
(children || footer) && "border-b border-primary-200 dark:border-primary-700"
|
|
7445
7480
|
),
|
|
7481
|
+
"data-testid": testId ? `${testId}-header` : void 0,
|
|
7446
7482
|
children: [
|
|
7447
7483
|
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
7448
7484
|
title && /* @__PURE__ */ jsx(Qe, { className: "text-lg font-semibold text-primary-900 dark:text-white", children: title }),
|
|
@@ -7461,13 +7497,14 @@ function Modal({
|
|
|
7461
7497
|
"focus:outline-none focus:ring-2 focus:ring-gold-500/20",
|
|
7462
7498
|
"transition-colors"
|
|
7463
7499
|
),
|
|
7500
|
+
"data-testid": testId ? `${testId}-close-button` : void 0,
|
|
7464
7501
|
children: /* @__PURE__ */ jsx(CloseIcon$2, {})
|
|
7465
7502
|
}
|
|
7466
7503
|
)
|
|
7467
7504
|
]
|
|
7468
7505
|
}
|
|
7469
7506
|
),
|
|
7470
|
-
children && /* @__PURE__ */ jsxs("div", { className: "relative px-6 py-4 text-primary-700 dark:text-primary-300", children: [
|
|
7507
|
+
children && /* @__PURE__ */ jsxs("div", { className: "relative px-6 py-4 text-primary-700 dark:text-primary-300", "data-testid": testId ? `${testId}-body` : void 0, children: [
|
|
7471
7508
|
children,
|
|
7472
7509
|
isLoading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-white/60 dark:bg-primary-800/60", children: /* @__PURE__ */ jsx(Spinner, { size: "md", color: "primary" }) })
|
|
7473
7510
|
] }),
|
|
@@ -7480,6 +7517,7 @@ function Modal({
|
|
|
7480
7517
|
"bg-primary-50 dark:bg-primary-900/50",
|
|
7481
7518
|
"rounded-b-lg"
|
|
7482
7519
|
),
|
|
7520
|
+
"data-testid": testId ? `${testId}-footer` : void 0,
|
|
7483
7521
|
children: footer
|
|
7484
7522
|
}
|
|
7485
7523
|
)
|
|
@@ -7524,7 +7562,8 @@ function Drawer({
|
|
|
7524
7562
|
showCloseButton = true,
|
|
7525
7563
|
footer,
|
|
7526
7564
|
className,
|
|
7527
|
-
isLoading = false
|
|
7565
|
+
isLoading = false,
|
|
7566
|
+
testId
|
|
7528
7567
|
}) {
|
|
7529
7568
|
return /* @__PURE__ */ jsx(Ke$2, { show: isOpen, as: Fragment$1, children: /* @__PURE__ */ jsxs(ht$1, { className: "relative z-50", onClose, children: [
|
|
7530
7569
|
/* @__PURE__ */ jsx(
|
|
@@ -7537,7 +7576,7 @@ function Drawer({
|
|
|
7537
7576
|
leave: "ease-in duration-200",
|
|
7538
7577
|
leaveFrom: "opacity-100",
|
|
7539
7578
|
leaveTo: "opacity-0",
|
|
7540
|
-
children: /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black/40 backdrop-blur-sm" })
|
|
7579
|
+
children: /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black/40 backdrop-blur-sm", "data-testid": testId ? `${testId}-overlay` : void 0 })
|
|
7541
7580
|
}
|
|
7542
7581
|
),
|
|
7543
7582
|
/* @__PURE__ */ jsx("div", { className: "fixed inset-0 flex justify-end", children: /* @__PURE__ */ jsx(
|
|
@@ -7562,6 +7601,7 @@ function Drawer({
|
|
|
7562
7601
|
sizeStyles$a[size2],
|
|
7563
7602
|
className
|
|
7564
7603
|
),
|
|
7604
|
+
"data-testid": testId,
|
|
7565
7605
|
children: [
|
|
7566
7606
|
(title || showCloseButton) && /* @__PURE__ */ jsxs(
|
|
7567
7607
|
"div",
|
|
@@ -7585,13 +7625,14 @@ function Drawer({
|
|
|
7585
7625
|
"focus:outline-none focus:ring-2 focus:ring-gold-500/20",
|
|
7586
7626
|
"transition-colors"
|
|
7587
7627
|
),
|
|
7628
|
+
"data-testid": testId ? `${testId}-close-button` : void 0,
|
|
7588
7629
|
children: /* @__PURE__ */ jsx(CloseIcon$1, {})
|
|
7589
7630
|
}
|
|
7590
7631
|
)
|
|
7591
7632
|
]
|
|
7592
7633
|
}
|
|
7593
7634
|
),
|
|
7594
|
-
/* @__PURE__ */ jsxs("div", { className: "relative flex-1 overflow-y-auto px-6 py-4 text-primary-700 dark:text-primary-300", children: [
|
|
7635
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex-1 overflow-y-auto px-6 py-4 text-primary-700 dark:text-primary-300", "data-testid": testId ? `${testId}-content` : void 0, children: [
|
|
7595
7636
|
children,
|
|
7596
7637
|
isLoading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-white/60 dark:bg-primary-800/60", children: /* @__PURE__ */ jsx(Spinner, { size: "md", color: "primary" }) })
|
|
7597
7638
|
] }),
|
|
@@ -7629,7 +7670,8 @@ function ConfirmDialog({
|
|
|
7629
7670
|
variant = "neutral",
|
|
7630
7671
|
cancelText = "Cancel",
|
|
7631
7672
|
confirmText = "Confirm",
|
|
7632
|
-
loading = false
|
|
7673
|
+
loading = false,
|
|
7674
|
+
testId
|
|
7633
7675
|
}) {
|
|
7634
7676
|
const buttonVariant = variantToButton[variant];
|
|
7635
7677
|
const handleConfirm = () => {
|
|
@@ -7645,6 +7687,7 @@ function ConfirmDialog({
|
|
|
7645
7687
|
size: "sm",
|
|
7646
7688
|
showCloseButton: false,
|
|
7647
7689
|
closeOnOverlay: !loading,
|
|
7690
|
+
testId,
|
|
7648
7691
|
footer: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-3", children: [
|
|
7649
7692
|
/* @__PURE__ */ jsx(
|
|
7650
7693
|
Button,
|
|
@@ -7652,6 +7695,7 @@ function ConfirmDialog({
|
|
|
7652
7695
|
variant: "secondary",
|
|
7653
7696
|
onClick: onClose,
|
|
7654
7697
|
disabled: loading,
|
|
7698
|
+
"data-testid": testId ? `${testId}-cancel-button` : void 0,
|
|
7655
7699
|
children: cancelText
|
|
7656
7700
|
}
|
|
7657
7701
|
),
|
|
@@ -7661,6 +7705,7 @@ function ConfirmDialog({
|
|
|
7661
7705
|
variant: buttonVariant,
|
|
7662
7706
|
onClick: handleConfirm,
|
|
7663
7707
|
disabled: loading,
|
|
7708
|
+
"data-testid": testId ? `${testId}-confirm-button` : void 0,
|
|
7664
7709
|
children: loading ? "Loading..." : confirmText
|
|
7665
7710
|
}
|
|
7666
7711
|
)
|
|
@@ -7700,6 +7745,7 @@ const Card = forwardRef(
|
|
|
7700
7745
|
hoverable = false,
|
|
7701
7746
|
children,
|
|
7702
7747
|
className,
|
|
7748
|
+
testId,
|
|
7703
7749
|
...props
|
|
7704
7750
|
}, ref) => {
|
|
7705
7751
|
return /* @__PURE__ */ jsx(
|
|
@@ -7725,6 +7771,7 @@ const Card = forwardRef(
|
|
|
7725
7771
|
],
|
|
7726
7772
|
className
|
|
7727
7773
|
),
|
|
7774
|
+
"data-testid": testId,
|
|
7728
7775
|
...props,
|
|
7729
7776
|
children
|
|
7730
7777
|
}
|
|
@@ -7754,6 +7801,7 @@ const Checkbox = forwardRef(
|
|
|
7754
7801
|
indeterminate = false,
|
|
7755
7802
|
className,
|
|
7756
7803
|
id,
|
|
7804
|
+
testId,
|
|
7757
7805
|
...props
|
|
7758
7806
|
}, forwardedRef) => {
|
|
7759
7807
|
const checkboxId = id || label?.toLowerCase().replace(/\s+/g, "-");
|
|
@@ -7780,7 +7828,7 @@ const Checkbox = forwardRef(
|
|
|
7780
7828
|
const handleChange = (e3) => {
|
|
7781
7829
|
onChange?.(e3.target.checked);
|
|
7782
7830
|
};
|
|
7783
|
-
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
7831
|
+
return /* @__PURE__ */ jsxs("div", { className, "data-testid": testId, children: [
|
|
7784
7832
|
/* @__PURE__ */ jsxs(
|
|
7785
7833
|
"label",
|
|
7786
7834
|
{
|
|
@@ -7789,6 +7837,7 @@ const Checkbox = forwardRef(
|
|
|
7789
7837
|
"inline-flex items-center gap-2",
|
|
7790
7838
|
disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
7791
7839
|
),
|
|
7840
|
+
"data-testid": testId ? `${testId}-label` : void 0,
|
|
7792
7841
|
children: [
|
|
7793
7842
|
/* @__PURE__ */ jsx(
|
|
7794
7843
|
"input",
|
|
@@ -7801,6 +7850,7 @@ const Checkbox = forwardRef(
|
|
|
7801
7850
|
"aria-invalid": hasError ? "true" : void 0,
|
|
7802
7851
|
"aria-describedby": errorId,
|
|
7803
7852
|
onChange: handleChange,
|
|
7853
|
+
"data-testid": testId ? `${testId}-checkbox` : void 0,
|
|
7804
7854
|
className: cn(
|
|
7805
7855
|
sizeStyles$9[size2],
|
|
7806
7856
|
"rounded border transition-colors",
|
|
@@ -7845,6 +7895,7 @@ const Checkbox = forwardRef(
|
|
|
7845
7895
|
{
|
|
7846
7896
|
id: errorId,
|
|
7847
7897
|
role: hasError ? "alert" : void 0,
|
|
7898
|
+
"data-testid": testId ? hasError ? `${testId}-error` : `${testId}-helper-text` : void 0,
|
|
7848
7899
|
className: cn(
|
|
7849
7900
|
"mt-1 text-sm",
|
|
7850
7901
|
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
@@ -7874,6 +7925,7 @@ const Radio = forwardRef(
|
|
|
7874
7925
|
error: error2 = false,
|
|
7875
7926
|
className,
|
|
7876
7927
|
id,
|
|
7928
|
+
testId,
|
|
7877
7929
|
...props
|
|
7878
7930
|
}, ref) => {
|
|
7879
7931
|
const radioId = id || (label ? `${props.name}-${label.toLowerCase().replace(/\s+/g, "-")}` : void 0);
|
|
@@ -7886,6 +7938,7 @@ const Radio = forwardRef(
|
|
|
7886
7938
|
disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
7887
7939
|
className
|
|
7888
7940
|
),
|
|
7941
|
+
"data-testid": testId,
|
|
7889
7942
|
children: [
|
|
7890
7943
|
/* @__PURE__ */ jsx(
|
|
7891
7944
|
"input",
|
|
@@ -7894,6 +7947,7 @@ const Radio = forwardRef(
|
|
|
7894
7947
|
type: "radio",
|
|
7895
7948
|
id: radioId,
|
|
7896
7949
|
disabled,
|
|
7950
|
+
"data-testid": testId ? `${testId}-radio` : void 0,
|
|
7897
7951
|
className: cn(
|
|
7898
7952
|
sizeStyles$8[size2],
|
|
7899
7953
|
"border transition-colors",
|
|
@@ -7925,6 +7979,7 @@ const Radio = forwardRef(
|
|
|
7925
7979
|
"text-primary-700 dark:text-primary-200",
|
|
7926
7980
|
error2 && "text-error"
|
|
7927
7981
|
),
|
|
7982
|
+
"data-testid": testId ? `${testId}-label` : void 0,
|
|
7928
7983
|
children: label
|
|
7929
7984
|
}
|
|
7930
7985
|
)
|
|
@@ -7946,7 +8001,8 @@ function RadioGroup({
|
|
|
7946
8001
|
disabled = false,
|
|
7947
8002
|
orientation = "vertical",
|
|
7948
8003
|
className,
|
|
7949
|
-
isLoading = false
|
|
8004
|
+
isLoading = false,
|
|
8005
|
+
testId
|
|
7950
8006
|
}) {
|
|
7951
8007
|
const hasError = !!error2;
|
|
7952
8008
|
const groupId = `${name}-group`;
|
|
@@ -7954,7 +8010,7 @@ function RadioGroup({
|
|
|
7954
8010
|
const handleChange = (e3) => {
|
|
7955
8011
|
onChange?.(e3.target.value);
|
|
7956
8012
|
};
|
|
7957
|
-
return /* @__PURE__ */ jsxs("fieldset", { className, role: "radiogroup", "aria-labelledby": label ? groupId : void 0, children: [
|
|
8013
|
+
return /* @__PURE__ */ jsxs("fieldset", { className, role: "radiogroup", "aria-labelledby": label ? groupId : void 0, "data-testid": testId, children: [
|
|
7958
8014
|
label && /* @__PURE__ */ jsxs(
|
|
7959
8015
|
"legend",
|
|
7960
8016
|
{
|
|
@@ -7972,7 +8028,7 @@ function RadioGroup({
|
|
|
7972
8028
|
className: cn(
|
|
7973
8029
|
orientation === "vertical" ? "space-y-2" : "flex flex-wrap gap-4"
|
|
7974
8030
|
),
|
|
7975
|
-
children: options.map((option) => /* @__PURE__ */ jsx(
|
|
8031
|
+
children: options.map((option, index2) => /* @__PURE__ */ jsx(
|
|
7976
8032
|
Radio,
|
|
7977
8033
|
{
|
|
7978
8034
|
name,
|
|
@@ -7982,7 +8038,8 @@ function RadioGroup({
|
|
|
7982
8038
|
disabled: isDisabled || option.disabled,
|
|
7983
8039
|
error: hasError,
|
|
7984
8040
|
checked: value === option.value,
|
|
7985
|
-
onChange: handleChange
|
|
8041
|
+
onChange: handleChange,
|
|
8042
|
+
testId: testId ? `${testId}-option-${index2}` : void 0
|
|
7986
8043
|
},
|
|
7987
8044
|
option.value
|
|
7988
8045
|
))
|
|
@@ -7992,6 +8049,7 @@ function RadioGroup({
|
|
|
7992
8049
|
"p",
|
|
7993
8050
|
{
|
|
7994
8051
|
role: hasError ? "alert" : void 0,
|
|
8052
|
+
"data-testid": testId ? hasError ? `${testId}-error` : `${testId}-helper-text` : void 0,
|
|
7995
8053
|
className: cn(
|
|
7996
8054
|
"mt-2 text-sm",
|
|
7997
8055
|
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
@@ -8027,11 +8085,12 @@ function Toggle({
|
|
|
8027
8085
|
disabled = false,
|
|
8028
8086
|
size: size2 = "md",
|
|
8029
8087
|
className,
|
|
8030
|
-
isLoading = false
|
|
8088
|
+
isLoading = false,
|
|
8089
|
+
testId
|
|
8031
8090
|
}) {
|
|
8032
8091
|
const currentSize = sizeStyles$7[size2];
|
|
8033
8092
|
const isDisabled = disabled || isLoading;
|
|
8034
|
-
return /* @__PURE__ */ jsx(W, { className, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8093
|
+
return /* @__PURE__ */ jsx(W, { className, "data-testid": testId, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8035
8094
|
(label || description) && /* @__PURE__ */ jsxs("div", { className: "flex-1 mr-4", children: [
|
|
8036
8095
|
label && /* @__PURE__ */ jsx(
|
|
8037
8096
|
Z,
|
|
@@ -8053,6 +8112,7 @@ function Toggle({
|
|
|
8053
8112
|
disabled: isDisabled,
|
|
8054
8113
|
onChange,
|
|
8055
8114
|
"aria-label": !label ? "Toggle" : void 0,
|
|
8115
|
+
"data-testid": testId ? `${testId}-toggle` : void 0,
|
|
8056
8116
|
className: cn(
|
|
8057
8117
|
currentSize.switch,
|
|
8058
8118
|
"relative inline-flex shrink-0 cursor-pointer rounded-full",
|
|
@@ -8138,7 +8198,8 @@ function Combobox({
|
|
|
8138
8198
|
isLoading = false,
|
|
8139
8199
|
loadingText = "Loading...",
|
|
8140
8200
|
emptyText = "No results found",
|
|
8141
|
-
onSearch
|
|
8201
|
+
onSearch,
|
|
8202
|
+
testId
|
|
8142
8203
|
}) {
|
|
8143
8204
|
const [query, setQuery] = useState("");
|
|
8144
8205
|
const hasError = !!error2;
|
|
@@ -8158,12 +8219,13 @@ function Combobox({
|
|
|
8158
8219
|
onChange?.(newValue);
|
|
8159
8220
|
setQuery("");
|
|
8160
8221
|
};
|
|
8161
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto", className), children: [
|
|
8222
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto", className), "data-testid": testId, children: [
|
|
8162
8223
|
label && /* @__PURE__ */ jsxs(
|
|
8163
8224
|
"label",
|
|
8164
8225
|
{
|
|
8165
8226
|
id: labelId,
|
|
8166
8227
|
className: "mb-2 block text-sm font-medium text-primary-700 dark:text-white",
|
|
8228
|
+
"data-testid": testId ? `${testId}-label` : void 0,
|
|
8167
8229
|
children: [
|
|
8168
8230
|
label,
|
|
8169
8231
|
required && /* @__PURE__ */ jsx("span", { className: "ml-1 text-error", children: "*" })
|
|
@@ -8190,6 +8252,7 @@ function Combobox({
|
|
|
8190
8252
|
onSearch?.(newQuery);
|
|
8191
8253
|
},
|
|
8192
8254
|
placeholder,
|
|
8255
|
+
"data-testid": testId ? `${testId}-input` : void 0,
|
|
8193
8256
|
className: cn(
|
|
8194
8257
|
// Base styles - Light mode
|
|
8195
8258
|
"w-full rounded-md border bg-white px-4 py-2.5 pr-10 text-sm text-primary-900",
|
|
@@ -8223,30 +8286,39 @@ function Combobox({
|
|
|
8223
8286
|
leaveFrom: "opacity-100",
|
|
8224
8287
|
leaveTo: "opacity-0",
|
|
8225
8288
|
afterLeave: () => setQuery(""),
|
|
8226
|
-
children: /* @__PURE__ */ jsx(
|
|
8227
|
-
|
|
8228
|
-
/* @__PURE__ */ jsx("span", { children: loadingText })
|
|
8229
|
-
] }) : filteredOptions.length === 0 && query !== "" ? /* @__PURE__ */ jsx("div", { className: "relative cursor-default select-none px-4 py-2.5 text-primary-500 dark:text-primary-400", children: emptyText }) : filteredOptions.map((option) => /* @__PURE__ */ jsx(
|
|
8230
|
-
Ho,
|
|
8289
|
+
children: /* @__PURE__ */ jsx(
|
|
8290
|
+
Uo,
|
|
8231
8291
|
{
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8292
|
+
portal: true,
|
|
8293
|
+
className: "absolute z-dropdown mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-sm shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-primary-800 dark:ring-primary-700",
|
|
8294
|
+
"data-testid": testId ? `${testId}-options` : void 0,
|
|
8295
|
+
children: isLoading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 px-4 py-2.5 text-primary-500 dark:text-primary-400", children: [
|
|
8296
|
+
/* @__PURE__ */ jsx(Spinner, { size: "sm", color: "primary" }),
|
|
8297
|
+
/* @__PURE__ */ jsx("span", { children: loadingText })
|
|
8298
|
+
] }) : filteredOptions.length === 0 && query !== "" ? /* @__PURE__ */ jsx("div", { className: "relative cursor-default select-none px-4 py-2.5 text-primary-500 dark:text-primary-400", children: emptyText }) : filteredOptions.map((option, index2) => /* @__PURE__ */ jsx(
|
|
8299
|
+
Ho,
|
|
8300
|
+
{
|
|
8301
|
+
value: option.value,
|
|
8302
|
+
disabled: option.disabled,
|
|
8303
|
+
"data-testid": testId ? `${testId}-option-${index2}` : void 0,
|
|
8304
|
+
className: ({ active, selected }) => cn(
|
|
8305
|
+
"relative cursor-pointer select-none py-2.5 pl-10 pr-4",
|
|
8306
|
+
// Light mode
|
|
8307
|
+
active ? "bg-gold-50 text-primary-900" : "text-primary-900",
|
|
8308
|
+
// Dark mode
|
|
8309
|
+
active ? "dark:bg-primary-700 dark:text-primary-100" : "dark:text-primary-200",
|
|
8310
|
+
option.disabled && "cursor-not-allowed opacity-50",
|
|
8311
|
+
selected && "font-medium"
|
|
8312
|
+
),
|
|
8313
|
+
children: ({ selected }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8314
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate", children: option.label }),
|
|
8315
|
+
selected && /* @__PURE__ */ jsx("span", { className: "absolute inset-y-0 left-0 flex items-center pl-3 text-gold-600 dark:text-gold-400", children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
8316
|
+
] })
|
|
8317
|
+
},
|
|
8318
|
+
option.value
|
|
8319
|
+
))
|
|
8320
|
+
}
|
|
8321
|
+
)
|
|
8250
8322
|
}
|
|
8251
8323
|
)
|
|
8252
8324
|
] })
|
|
@@ -8256,6 +8328,7 @@ function Combobox({
|
|
|
8256
8328
|
"p",
|
|
8257
8329
|
{
|
|
8258
8330
|
role: hasError ? "alert" : void 0,
|
|
8331
|
+
"data-testid": testId ? hasError ? `${testId}-error` : `${testId}-helper-text` : void 0,
|
|
8259
8332
|
className: cn(
|
|
8260
8333
|
"mt-1.5 text-sm",
|
|
8261
8334
|
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
@@ -8298,7 +8371,7 @@ const sizeStyles$6 = {
|
|
|
8298
8371
|
lg: "px-3 py-1.5 text-base"
|
|
8299
8372
|
};
|
|
8300
8373
|
const Badge = forwardRef(
|
|
8301
|
-
({ variant = "default", size: size2 = "md", children, className, ...props }, ref) => {
|
|
8374
|
+
({ variant = "default", size: size2 = "md", children, className, testId, ...props }, ref) => {
|
|
8302
8375
|
return /* @__PURE__ */ jsx(
|
|
8303
8376
|
"span",
|
|
8304
8377
|
{
|
|
@@ -8309,6 +8382,7 @@ const Badge = forwardRef(
|
|
|
8309
8382
|
sizeStyles$6[size2],
|
|
8310
8383
|
className
|
|
8311
8384
|
),
|
|
8385
|
+
"data-testid": testId,
|
|
8312
8386
|
...props,
|
|
8313
8387
|
children
|
|
8314
8388
|
}
|
|
@@ -8478,6 +8552,7 @@ function Tabs({
|
|
|
8478
8552
|
size: size2 = "md",
|
|
8479
8553
|
className,
|
|
8480
8554
|
"aria-label": ariaLabel = "Navigation tabs",
|
|
8555
|
+
testId,
|
|
8481
8556
|
...props
|
|
8482
8557
|
}) {
|
|
8483
8558
|
const selectedIndex = useMemo(
|
|
@@ -8505,11 +8580,13 @@ function Tabs({
|
|
|
8505
8580
|
fullWidth && "w-full",
|
|
8506
8581
|
className
|
|
8507
8582
|
),
|
|
8583
|
+
"data-testid": testId,
|
|
8508
8584
|
...props,
|
|
8509
|
-
children: tabs.map((tab) => /* @__PURE__ */ jsx(
|
|
8585
|
+
children: tabs.map((tab, index2) => /* @__PURE__ */ jsx(
|
|
8510
8586
|
dt,
|
|
8511
8587
|
{
|
|
8512
8588
|
disabled: tab.disabled,
|
|
8589
|
+
"data-testid": testId ? `${testId}-tab-${index2}` : void 0,
|
|
8513
8590
|
className: ({ selected }) => cn(
|
|
8514
8591
|
"relative outline-none transition-colors duration-normal",
|
|
8515
8592
|
"focus-visible:ring-2 focus-visible:ring-gold-500/50",
|
|
@@ -8556,6 +8633,7 @@ function TabContentPanels({
|
|
|
8556
8633
|
children,
|
|
8557
8634
|
className,
|
|
8558
8635
|
isLoading = false,
|
|
8636
|
+
testId,
|
|
8559
8637
|
...props
|
|
8560
8638
|
}) {
|
|
8561
8639
|
const activeContent = activeTab && children[activeTab];
|
|
@@ -8564,6 +8642,7 @@ function TabContentPanels({
|
|
|
8564
8642
|
{
|
|
8565
8643
|
role: "tabpanel",
|
|
8566
8644
|
className: cn("relative mt-4", className),
|
|
8645
|
+
"data-testid": testId,
|
|
8567
8646
|
...props,
|
|
8568
8647
|
children: [
|
|
8569
8648
|
activeContent,
|
|
@@ -8628,6 +8707,7 @@ const Breadcrumbs = forwardRef(
|
|
|
8628
8707
|
maxItems = 0,
|
|
8629
8708
|
renderLink,
|
|
8630
8709
|
className,
|
|
8710
|
+
testId,
|
|
8631
8711
|
...props
|
|
8632
8712
|
}, ref) => {
|
|
8633
8713
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
@@ -8679,12 +8759,20 @@ const Breadcrumbs = forwardRef(
|
|
|
8679
8759
|
ref,
|
|
8680
8760
|
"aria-label": "Breadcrumb",
|
|
8681
8761
|
className: cn("text-sm", className),
|
|
8762
|
+
"data-testid": testId,
|
|
8682
8763
|
...props,
|
|
8683
8764
|
children: /* @__PURE__ */ jsx("ol", { className: "flex items-center flex-wrap gap-1", children: displayItems.map((item, index2) => {
|
|
8684
8765
|
const isLast = index2 === displayItems.length - 1;
|
|
8685
8766
|
const showEllipsis = shouldCollapse && index2 === 0;
|
|
8686
8767
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
8687
|
-
/* @__PURE__ */ jsx(
|
|
8768
|
+
/* @__PURE__ */ jsx(
|
|
8769
|
+
"li",
|
|
8770
|
+
{
|
|
8771
|
+
className: "inline-flex items-center",
|
|
8772
|
+
"data-testid": testId ? `${testId}-item-${index2}` : void 0,
|
|
8773
|
+
children: renderItem(item, index2, isLast)
|
|
8774
|
+
}
|
|
8775
|
+
),
|
|
8688
8776
|
showEllipsis && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8689
8777
|
/* @__PURE__ */ jsx("li", { className: "inline-flex items-center", "aria-hidden": "true", children: separatorElement }),
|
|
8690
8778
|
/* @__PURE__ */ jsx("li", { className: "inline-flex items-center", children: /* @__PURE__ */ jsx(EllipsisButton, { onClick: () => setIsExpanded(true) }) })
|
|
@@ -8712,6 +8800,7 @@ const Skeleton = forwardRef(
|
|
|
8712
8800
|
label = "Loading...",
|
|
8713
8801
|
className,
|
|
8714
8802
|
style,
|
|
8803
|
+
testId,
|
|
8715
8804
|
...props
|
|
8716
8805
|
}, ref) => {
|
|
8717
8806
|
const widthValue = typeof width === "number" ? `${width}px` : width;
|
|
@@ -8726,6 +8815,7 @@ const Skeleton = forwardRef(
|
|
|
8726
8815
|
role: "status",
|
|
8727
8816
|
"aria-label": label,
|
|
8728
8817
|
"aria-busy": "true",
|
|
8818
|
+
"data-testid": testId,
|
|
8729
8819
|
...props,
|
|
8730
8820
|
children: [
|
|
8731
8821
|
Array.from({ length: lines }).map((_2, index2) => /* @__PURE__ */ jsx(
|
|
@@ -8767,6 +8857,7 @@ const Skeleton = forwardRef(
|
|
|
8767
8857
|
role: "status",
|
|
8768
8858
|
"aria-label": label,
|
|
8769
8859
|
"aria-busy": "true",
|
|
8860
|
+
"data-testid": testId,
|
|
8770
8861
|
...props,
|
|
8771
8862
|
children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: label })
|
|
8772
8863
|
}
|
|
@@ -8867,6 +8958,7 @@ const EmptyState = forwardRef(
|
|
|
8867
8958
|
action,
|
|
8868
8959
|
size: size2 = "md",
|
|
8869
8960
|
className,
|
|
8961
|
+
testId,
|
|
8870
8962
|
...props
|
|
8871
8963
|
}, ref) => {
|
|
8872
8964
|
const styles = sizeStyles$4[size2];
|
|
@@ -8879,9 +8971,17 @@ const EmptyState = forwardRef(
|
|
|
8879
8971
|
styles.container,
|
|
8880
8972
|
className
|
|
8881
8973
|
),
|
|
8974
|
+
"data-testid": testId,
|
|
8882
8975
|
...props,
|
|
8883
8976
|
children: [
|
|
8884
|
-
/* @__PURE__ */ jsx(
|
|
8977
|
+
/* @__PURE__ */ jsx(
|
|
8978
|
+
"div",
|
|
8979
|
+
{
|
|
8980
|
+
className: cn(styles.icon, typeColors[type], "mb-4"),
|
|
8981
|
+
"data-testid": testId ? `${testId}-icon` : void 0,
|
|
8982
|
+
children: icon || defaultIcons$1[type]
|
|
8983
|
+
}
|
|
8984
|
+
),
|
|
8885
8985
|
/* @__PURE__ */ jsx(
|
|
8886
8986
|
"h3",
|
|
8887
8987
|
{
|
|
@@ -8890,6 +8990,7 @@ const EmptyState = forwardRef(
|
|
|
8890
8990
|
"text-primary-900 dark:text-primary-100",
|
|
8891
8991
|
"mb-1"
|
|
8892
8992
|
),
|
|
8993
|
+
"data-testid": testId ? `${testId}-title` : void 0,
|
|
8893
8994
|
children: title
|
|
8894
8995
|
}
|
|
8895
8996
|
),
|
|
@@ -8901,10 +9002,11 @@ const EmptyState = forwardRef(
|
|
|
8901
9002
|
"text-primary-500 dark:text-primary-400",
|
|
8902
9003
|
"max-w-sm mb-4"
|
|
8903
9004
|
),
|
|
9005
|
+
"data-testid": testId ? `${testId}-description` : void 0,
|
|
8904
9006
|
children: description
|
|
8905
9007
|
}
|
|
8906
9008
|
),
|
|
8907
|
-
action && /* @__PURE__ */ jsx("div", { className: "mt-2", children: action })
|
|
9009
|
+
action && /* @__PURE__ */ jsx("div", { className: "mt-2", "data-testid": testId ? `${testId}-action` : void 0, children: action })
|
|
8908
9010
|
]
|
|
8909
9011
|
}
|
|
8910
9012
|
);
|
|
@@ -8960,7 +9062,8 @@ function Pagination({
|
|
|
8960
9062
|
totalItems,
|
|
8961
9063
|
disabled = false,
|
|
8962
9064
|
size: size2 = "md",
|
|
8963
|
-
className
|
|
9065
|
+
className,
|
|
9066
|
+
testId
|
|
8964
9067
|
}) {
|
|
8965
9068
|
const pageSizeId = useId$1();
|
|
8966
9069
|
const currentSize = sizeStyles$3[size2];
|
|
@@ -8993,13 +9096,14 @@ function Pagination({
|
|
|
8993
9096
|
};
|
|
8994
9097
|
if (variant === "load-more") {
|
|
8995
9098
|
if (!canGoNext) return null;
|
|
8996
|
-
return /* @__PURE__ */ jsx("div", { className: cn("flex justify-center", className), children: /* @__PURE__ */ jsx(
|
|
9099
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex justify-center", className), "data-testid": testId, children: /* @__PURE__ */ jsx(
|
|
8997
9100
|
Button,
|
|
8998
9101
|
{
|
|
8999
9102
|
variant: "secondary",
|
|
9000
9103
|
size: size2 === "sm" ? "sm" : "md",
|
|
9001
9104
|
onClick: handleNext,
|
|
9002
9105
|
disabled,
|
|
9106
|
+
"data-testid": testId ? `${testId}-load-more` : void 0,
|
|
9003
9107
|
children: "Load more"
|
|
9004
9108
|
}
|
|
9005
9109
|
) });
|
|
@@ -9010,6 +9114,7 @@ function Pagination({
|
|
|
9010
9114
|
{
|
|
9011
9115
|
"aria-label": "Pagination",
|
|
9012
9116
|
className: cn("flex items-center justify-between gap-4", className),
|
|
9117
|
+
"data-testid": testId,
|
|
9013
9118
|
children: [
|
|
9014
9119
|
/* @__PURE__ */ jsxs(
|
|
9015
9120
|
Button,
|
|
@@ -9019,6 +9124,7 @@ function Pagination({
|
|
|
9019
9124
|
onClick: handlePrevious,
|
|
9020
9125
|
disabled: disabled || !canGoPrevious,
|
|
9021
9126
|
"aria-label": "Previous page",
|
|
9127
|
+
"data-testid": testId ? `${testId}-prev` : void 0,
|
|
9022
9128
|
children: [
|
|
9023
9129
|
/* @__PURE__ */ jsx(ChevronLeftIcon, {}),
|
|
9024
9130
|
/* @__PURE__ */ jsx("span", { className: "ml-1", children: "Previous" })
|
|
@@ -9039,6 +9145,7 @@ function Pagination({
|
|
|
9039
9145
|
onClick: handleNext,
|
|
9040
9146
|
disabled: disabled || !canGoNext,
|
|
9041
9147
|
"aria-label": "Next page",
|
|
9148
|
+
"data-testid": testId ? `${testId}-next` : void 0,
|
|
9042
9149
|
children: [
|
|
9043
9150
|
/* @__PURE__ */ jsx("span", { className: "mr-1", children: "Next" }),
|
|
9044
9151
|
/* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
@@ -9054,6 +9161,7 @@ function Pagination({
|
|
|
9054
9161
|
{
|
|
9055
9162
|
"aria-label": "Pagination",
|
|
9056
9163
|
className: cn("flex items-center justify-between gap-4", className),
|
|
9164
|
+
"data-testid": testId,
|
|
9057
9165
|
children: [
|
|
9058
9166
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
9059
9167
|
itemsRange && /* @__PURE__ */ jsxs("span", { className: cn("text-primary-600 dark:text-primary-400", currentSize.text), children: [
|
|
@@ -9100,6 +9208,7 @@ function Pagination({
|
|
|
9100
9208
|
onClick: handlePrevious,
|
|
9101
9209
|
disabled: disabled || !canGoPrevious,
|
|
9102
9210
|
"aria-label": "Previous page",
|
|
9211
|
+
"data-testid": testId ? `${testId}-prev` : void 0,
|
|
9103
9212
|
className: cn(
|
|
9104
9213
|
"inline-flex items-center justify-center rounded-md",
|
|
9105
9214
|
"border border-primary-300 dark:border-primary-600",
|
|
@@ -9134,6 +9243,7 @@ function Pagination({
|
|
|
9134
9243
|
disabled,
|
|
9135
9244
|
"aria-label": `Page ${page}`,
|
|
9136
9245
|
"aria-current": page === currentPage ? "page" : void 0,
|
|
9246
|
+
"data-testid": testId ? `${testId}-page-${page}` : void 0,
|
|
9137
9247
|
className: cn(
|
|
9138
9248
|
"inline-flex items-center justify-center rounded-md",
|
|
9139
9249
|
"border transition-colors",
|
|
@@ -9162,6 +9272,7 @@ function Pagination({
|
|
|
9162
9272
|
onClick: handleNext,
|
|
9163
9273
|
disabled: disabled || !canGoNext,
|
|
9164
9274
|
"aria-label": "Next page",
|
|
9275
|
+
"data-testid": testId ? `${testId}-next` : void 0,
|
|
9165
9276
|
className: cn(
|
|
9166
9277
|
"inline-flex items-center justify-center rounded-md",
|
|
9167
9278
|
"border border-primary-300 dark:border-primary-600",
|
|
@@ -9229,7 +9340,8 @@ function MultiSelect({
|
|
|
9229
9340
|
required = false,
|
|
9230
9341
|
disabled = false,
|
|
9231
9342
|
fullWidth = false,
|
|
9232
|
-
className
|
|
9343
|
+
className,
|
|
9344
|
+
testId
|
|
9233
9345
|
}) {
|
|
9234
9346
|
const [query, setQuery] = useState("");
|
|
9235
9347
|
const searchInputRef = useRef(null);
|
|
@@ -9285,12 +9397,13 @@ function MultiSelect({
|
|
|
9285
9397
|
};
|
|
9286
9398
|
const displayedChips = selectedOptions.slice(0, maxDisplayedItems);
|
|
9287
9399
|
const hiddenCount = selectedOptions.length - maxDisplayedItems;
|
|
9288
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto", className), children: [
|
|
9400
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto", className), "data-testid": testId, children: [
|
|
9289
9401
|
label && /* @__PURE__ */ jsxs(
|
|
9290
9402
|
"label",
|
|
9291
9403
|
{
|
|
9292
9404
|
id: labelId,
|
|
9293
9405
|
className: "mb-2 block text-sm font-medium text-primary-700 dark:text-white",
|
|
9406
|
+
"data-testid": testId ? `${testId}-label` : void 0,
|
|
9294
9407
|
children: [
|
|
9295
9408
|
label,
|
|
9296
9409
|
required && /* @__PURE__ */ jsx("span", { className: "ml-1 text-error", children: "*" })
|
|
@@ -9318,7 +9431,7 @@ function MultiSelect({
|
|
|
9318
9431
|
hasError ? "border-error focus-within:border-error focus-within:ring-2 focus-within:ring-error/20" : "border-primary-300 dark:border-primary-600 focus-within:border-gold-500 focus-within:ring-2 focus-within:ring-gold-500/20"
|
|
9319
9432
|
),
|
|
9320
9433
|
children: [
|
|
9321
|
-
displayedChips.map((option) => /* @__PURE__ */ jsxs(
|
|
9434
|
+
displayedChips.map((option, index2) => /* @__PURE__ */ jsxs(
|
|
9322
9435
|
"span",
|
|
9323
9436
|
{
|
|
9324
9437
|
className: cn(
|
|
@@ -9326,6 +9439,7 @@ function MultiSelect({
|
|
|
9326
9439
|
"bg-primary-100 dark:bg-primary-700",
|
|
9327
9440
|
"text-sm text-primary-700 dark:text-primary-200"
|
|
9328
9441
|
),
|
|
9442
|
+
"data-testid": testId ? `${testId}-chip-${index2}` : void 0,
|
|
9329
9443
|
children: [
|
|
9330
9444
|
option.label,
|
|
9331
9445
|
/* @__PURE__ */ jsx(
|
|
@@ -9384,8 +9498,10 @@ function MultiSelect({
|
|
|
9384
9498
|
children: /* @__PURE__ */ jsx(
|
|
9385
9499
|
Bt,
|
|
9386
9500
|
{
|
|
9501
|
+
portal: true,
|
|
9387
9502
|
static: true,
|
|
9388
9503
|
className: "absolute z-dropdown mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-sm shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-primary-800 dark:ring-primary-700",
|
|
9504
|
+
"data-testid": testId ? `${testId}-options` : void 0,
|
|
9389
9505
|
children: isLoading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 px-4 py-2.5 text-primary-500 dark:text-primary-400", children: [
|
|
9390
9506
|
/* @__PURE__ */ jsx(Spinner, { size: "sm", color: "primary" }),
|
|
9391
9507
|
/* @__PURE__ */ jsx("span", { children: loadingText })
|
|
@@ -9401,6 +9517,7 @@ function MultiSelect({
|
|
|
9401
9517
|
value: query,
|
|
9402
9518
|
onChange: handleSearchChange,
|
|
9403
9519
|
placeholder: "Search...",
|
|
9520
|
+
"data-testid": testId ? `${testId}-input` : void 0,
|
|
9404
9521
|
className: cn(
|
|
9405
9522
|
"w-full rounded border border-primary-300 px-2 py-1 text-sm",
|
|
9406
9523
|
"bg-white dark:bg-primary-900",
|
|
@@ -9442,11 +9559,12 @@ function MultiSelect({
|
|
|
9442
9559
|
]
|
|
9443
9560
|
}
|
|
9444
9561
|
),
|
|
9445
|
-
filteredOptions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-4 py-2.5 text-primary-500 dark:text-primary-400", children: emptyText }) : filteredOptions.map((option) => /* @__PURE__ */ jsxs(
|
|
9562
|
+
filteredOptions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-4 py-2.5 text-primary-500 dark:text-primary-400", children: emptyText }) : filteredOptions.map((option, index2) => /* @__PURE__ */ jsxs(
|
|
9446
9563
|
It,
|
|
9447
9564
|
{
|
|
9448
9565
|
value: option.value,
|
|
9449
9566
|
disabled: option.disabled,
|
|
9567
|
+
"data-testid": testId ? `${testId}-option-${index2}` : void 0,
|
|
9450
9568
|
className: ({ active }) => cn(
|
|
9451
9569
|
"flex cursor-pointer items-center gap-2 px-4 py-2.5",
|
|
9452
9570
|
active && "bg-primary-50 dark:bg-primary-700",
|
|
@@ -9480,6 +9598,7 @@ function MultiSelect({
|
|
|
9480
9598
|
"p",
|
|
9481
9599
|
{
|
|
9482
9600
|
role: hasError ? "alert" : void 0,
|
|
9601
|
+
"data-testid": testId ? hasError ? `${testId}-error` : `${testId}-helper-text` : void 0,
|
|
9483
9602
|
className: cn(
|
|
9484
9603
|
"mt-1.5 text-sm",
|
|
9485
9604
|
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
@@ -9548,6 +9667,7 @@ function SidebarItem({
|
|
|
9548
9667
|
onNavigate,
|
|
9549
9668
|
LinkComponent,
|
|
9550
9669
|
className,
|
|
9670
|
+
testId,
|
|
9551
9671
|
...props
|
|
9552
9672
|
}) {
|
|
9553
9673
|
if (!shouldShowItem(item)) {
|
|
@@ -9594,6 +9714,7 @@ function SidebarItem({
|
|
|
9594
9714
|
disabled: item.disabled,
|
|
9595
9715
|
"aria-label": item["aria-label"] || item.label,
|
|
9596
9716
|
title: collapsed ? item.label : void 0,
|
|
9717
|
+
"data-testid": testId,
|
|
9597
9718
|
className: cn(
|
|
9598
9719
|
// Base styles
|
|
9599
9720
|
"flex w-full items-center rounded-lg font-medium",
|
|
@@ -9626,6 +9747,7 @@ function SidebarItem({
|
|
|
9626
9747
|
{
|
|
9627
9748
|
to: item.href,
|
|
9628
9749
|
onClick: handleClick,
|
|
9750
|
+
"data-testid": testId,
|
|
9629
9751
|
className: cn(
|
|
9630
9752
|
// Base styles
|
|
9631
9753
|
"flex items-center rounded-lg font-medium",
|
|
@@ -9763,6 +9885,7 @@ const Sidebar = forwardRef(
|
|
|
9763
9885
|
collapsedWidth = "4rem",
|
|
9764
9886
|
className,
|
|
9765
9887
|
"aria-label": ariaLabel = "Main navigation",
|
|
9888
|
+
testId,
|
|
9766
9889
|
...props
|
|
9767
9890
|
}, ref) => {
|
|
9768
9891
|
useEffect(() => {
|
|
@@ -9870,6 +9993,7 @@ const Sidebar = forwardRef(
|
|
|
9870
9993
|
"focus:outline-none focus:ring-2 focus:ring-primary-500/20"
|
|
9871
9994
|
),
|
|
9872
9995
|
"aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
9996
|
+
"data-testid": testId ? `${testId}-toggle` : void 0,
|
|
9873
9997
|
children: /* @__PURE__ */ jsx(
|
|
9874
9998
|
"svg",
|
|
9875
9999
|
{
|
|
@@ -9901,7 +10025,8 @@ const Sidebar = forwardRef(
|
|
|
9901
10025
|
{
|
|
9902
10026
|
className: "fixed inset-0 z-40 bg-black/20 lg:hidden",
|
|
9903
10027
|
onClick: handleOverlayClick,
|
|
9904
|
-
"aria-hidden": "true"
|
|
10028
|
+
"aria-hidden": "true",
|
|
10029
|
+
"data-testid": testId ? `${testId}-overlay` : void 0
|
|
9905
10030
|
}
|
|
9906
10031
|
),
|
|
9907
10032
|
/* @__PURE__ */ jsx(
|
|
@@ -9922,6 +10047,7 @@ const Sidebar = forwardRef(
|
|
|
9922
10047
|
),
|
|
9923
10048
|
style: { width: sidebarWidth },
|
|
9924
10049
|
"aria-label": ariaLabel,
|
|
10050
|
+
"data-testid": testId,
|
|
9925
10051
|
...props,
|
|
9926
10052
|
children: sidebarContent
|
|
9927
10053
|
}
|
|
@@ -9976,7 +10102,7 @@ const variantStyles = {
|
|
|
9976
10102
|
}
|
|
9977
10103
|
};
|
|
9978
10104
|
const Alert = forwardRef(
|
|
9979
|
-
({ variant = "info", title, message, icon, onClose, className, ...props }, ref) => {
|
|
10105
|
+
({ variant = "info", title, message, icon, onClose, className, testId, ...props }, ref) => {
|
|
9980
10106
|
const styles = variantStyles[variant];
|
|
9981
10107
|
const displayIcon = icon === null ? null : icon ?? defaultIcons[variant];
|
|
9982
10108
|
return /* @__PURE__ */ jsx(
|
|
@@ -9989,9 +10115,18 @@ const Alert = forwardRef(
|
|
|
9989
10115
|
styles.container,
|
|
9990
10116
|
className
|
|
9991
10117
|
),
|
|
10118
|
+
"data-testid": testId,
|
|
9992
10119
|
...props,
|
|
9993
10120
|
children: /* @__PURE__ */ jsxs("div", { className: "flex items-start", children: [
|
|
9994
|
-
displayIcon !== null && /* @__PURE__ */ jsx(
|
|
10121
|
+
displayIcon !== null && /* @__PURE__ */ jsx(
|
|
10122
|
+
"div",
|
|
10123
|
+
{
|
|
10124
|
+
className: cn("flex-shrink-0", styles.icon),
|
|
10125
|
+
"aria-hidden": "true",
|
|
10126
|
+
"data-testid": testId ? `${testId}-icon` : void 0,
|
|
10127
|
+
children: displayIcon
|
|
10128
|
+
}
|
|
10129
|
+
),
|
|
9995
10130
|
/* @__PURE__ */ jsxs("div", { className: cn("flex-1", displayIcon !== null && "ml-3"), children: [
|
|
9996
10131
|
title && /* @__PURE__ */ jsx("h3", { className: cn("text-sm font-medium", styles.title), children: title }),
|
|
9997
10132
|
/* @__PURE__ */ jsx("div", { className: cn("text-sm", title && "mt-1"), children: message })
|
|
@@ -10007,6 +10142,7 @@ const Alert = forwardRef(
|
|
|
10007
10142
|
"focus:ring-current/20",
|
|
10008
10143
|
"dark:focus:ring-offset-primary-900"
|
|
10009
10144
|
),
|
|
10145
|
+
"data-testid": testId ? `${testId}-close-button` : void 0,
|
|
10010
10146
|
children: [
|
|
10011
10147
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Dismiss" }),
|
|
10012
10148
|
/* @__PURE__ */ jsx(XMarkIcon, {})
|
|
@@ -10033,7 +10169,7 @@ const statusStyles = {
|
|
|
10033
10169
|
busy: "bg-error"
|
|
10034
10170
|
};
|
|
10035
10171
|
const Avatar = forwardRef(
|
|
10036
|
-
({ name, src, size: size2 = "md", alt, status, className, ...props }, ref) => {
|
|
10172
|
+
({ name, src, size: size2 = "md", alt, status, className, testId, ...props }, ref) => {
|
|
10037
10173
|
const getInitials = (fullName) => {
|
|
10038
10174
|
const names = fullName.trim().split(" ");
|
|
10039
10175
|
if (names.length === 1) {
|
|
@@ -10059,6 +10195,7 @@ const Avatar = forwardRef(
|
|
|
10059
10195
|
styles.container,
|
|
10060
10196
|
className
|
|
10061
10197
|
),
|
|
10198
|
+
"data-testid": testId,
|
|
10062
10199
|
...props,
|
|
10063
10200
|
children: [
|
|
10064
10201
|
src ? /* @__PURE__ */ jsx(
|
|
@@ -10066,7 +10203,8 @@ const Avatar = forwardRef(
|
|
|
10066
10203
|
{
|
|
10067
10204
|
src,
|
|
10068
10205
|
alt: alt || `${name}'s avatar`,
|
|
10069
|
-
className: "w-full h-full rounded-full object-cover"
|
|
10206
|
+
className: "w-full h-full rounded-full object-cover",
|
|
10207
|
+
"data-testid": testId ? `${testId}-image` : void 0
|
|
10070
10208
|
}
|
|
10071
10209
|
) : /* @__PURE__ */ jsx("span", { className: styles.text, children: initials }),
|
|
10072
10210
|
status && /* @__PURE__ */ jsx(
|
|
@@ -10079,7 +10217,8 @@ const Avatar = forwardRef(
|
|
|
10079
10217
|
styles.status,
|
|
10080
10218
|
statusStyles[status]
|
|
10081
10219
|
),
|
|
10082
|
-
"aria-label": `Status: ${status}
|
|
10220
|
+
"aria-label": `Status: ${status}`,
|
|
10221
|
+
"data-testid": testId ? `${testId}-status` : void 0
|
|
10083
10222
|
}
|
|
10084
10223
|
)
|
|
10085
10224
|
]
|