@teja-app/ui 0.0.4 → 0.0.6
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 +13 -0
- package/dist/components/Alert/Alert.d.ts.map +1 -0
- package/dist/components/Alert/Alert.types.d.ts +17 -0
- package/dist/components/Alert/Alert.types.d.ts.map +1 -0
- package/dist/components/Alert/index.d.ts +3 -0
- package/dist/components/Alert/index.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.d.ts +13 -0
- package/dist/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.types.d.ts +18 -0
- package/dist/components/Avatar/Avatar.types.d.ts.map +1 -0
- package/dist/components/Avatar/index.d.ts +3 -0
- package/dist/components/Avatar/index.d.ts.map +1 -0
- 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/DateInput/DateInput.d.ts +13 -0
- package/dist/components/DateInput/DateInput.d.ts.map +1 -0
- package/dist/components/DateInput/DateInput.types.d.ts +16 -0
- package/dist/components/DateInput/DateInput.types.d.ts.map +1 -0
- package/dist/components/DateInput/index.d.ts +3 -0
- package/dist/components/DateInput/index.d.ts.map +1 -0
- 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/OTPInput/OTPInput.d.ts +22 -0
- package/dist/components/OTPInput/OTPInput.d.ts.map +1 -0
- package/dist/components/OTPInput/OTPInput.types.d.ts +19 -0
- package/dist/components/OTPInput/OTPInput.types.d.ts.map +1 -0
- package/dist/components/OTPInput/index.d.ts +3 -0
- package/dist/components/OTPInput/index.d.ts.map +1 -0
- 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/PillSelector/PillSelector.d.ts +16 -0
- package/dist/components/PillSelector/PillSelector.d.ts.map +1 -0
- package/dist/components/PillSelector/PillSelector.types.d.ts +29 -0
- package/dist/components/PillSelector/PillSelector.types.d.ts.map +1 -0
- package/dist/components/PillSelector/index.d.ts +3 -0
- package/dist/components/PillSelector/index.d.ts.map +1 -0
- 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/components/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.cjs +738 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +738 -98
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as React from "react";
|
|
|
5
5
|
import React__default, { forwardRef, useState, useRef, useCallback, useEffect, useMemo, useLayoutEffect, useContext, createContext, Fragment as Fragment$1, isValidElement, cloneElement, createElement, useId as useId$1, useSyncExternalStore, useReducer, createRef } from "react";
|
|
6
6
|
import * as ReactDOM from "react-dom";
|
|
7
7
|
import { flushSync, createPortal } from "react-dom";
|
|
8
|
-
const variantStyles$
|
|
8
|
+
const variantStyles$5 = {
|
|
9
9
|
primary: [
|
|
10
10
|
// Light mode
|
|
11
11
|
"bg-primary-800 text-white border border-gold-500/40",
|
|
@@ -45,7 +45,7 @@ const variantStyles$4 = {
|
|
|
45
45
|
"dark:focus:ring-error/30"
|
|
46
46
|
].join(" ")
|
|
47
47
|
};
|
|
48
|
-
const sizeStyles$
|
|
48
|
+
const sizeStyles$d = {
|
|
49
49
|
sm: "px-3 py-1.5 text-sm h-8",
|
|
50
50
|
md: "px-4 py-2 text-base h-10",
|
|
51
51
|
lg: "px-6 py-3 text-lg h-12"
|
|
@@ -75,9 +75,9 @@ const Button = forwardRef(
|
|
|
75
75
|
"dark:focus:ring-offset-primary-900",
|
|
76
76
|
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
77
77
|
// Variant styles
|
|
78
|
-
variantStyles$
|
|
78
|
+
variantStyles$5[variant],
|
|
79
79
|
// Size styles
|
|
80
|
-
sizeStyles$
|
|
80
|
+
sizeStyles$d[size2],
|
|
81
81
|
// Width styles
|
|
82
82
|
fullWidth && "w-full",
|
|
83
83
|
// Custom className (allows override)
|
|
@@ -128,7 +128,7 @@ const Button = forwardRef(
|
|
|
128
128
|
}
|
|
129
129
|
);
|
|
130
130
|
Button.displayName = "Button";
|
|
131
|
-
const sizeStyles$
|
|
131
|
+
const sizeStyles$c = {
|
|
132
132
|
xs: "h-3 w-3",
|
|
133
133
|
// 12px
|
|
134
134
|
sm: "h-4 w-4",
|
|
@@ -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(
|
|
@@ -158,7 +159,7 @@ const Spinner = forwardRef(
|
|
|
158
159
|
ref,
|
|
159
160
|
className: cn(
|
|
160
161
|
"animate-spin",
|
|
161
|
-
sizeStyles$
|
|
162
|
+
sizeStyles$c[size2],
|
|
162
163
|
colorStyles[color],
|
|
163
164
|
className
|
|
164
165
|
),
|
|
@@ -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",
|
|
@@ -7304,11 +7333,13 @@ function Select({
|
|
|
7304
7333
|
"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
7334
|
placement === "top" ? "bottom-full mb-1" : "top-full mt-1"
|
|
7306
7335
|
),
|
|
7307
|
-
|
|
7336
|
+
"data-testid": testId ? `${testId}-options` : void 0,
|
|
7337
|
+
children: options.map((option, index2) => /* @__PURE__ */ jsx(
|
|
7308
7338
|
It,
|
|
7309
7339
|
{
|
|
7310
7340
|
disabled: option.disabled,
|
|
7311
7341
|
value: option.value,
|
|
7342
|
+
"data-testid": testId ? `${testId}-option-${index2}` : void 0,
|
|
7312
7343
|
className: ({ active, selected }) => cn(
|
|
7313
7344
|
"relative cursor-pointer select-none py-2.5 pl-10 pr-4",
|
|
7314
7345
|
// Light mode
|
|
@@ -7350,6 +7381,7 @@ function Select({
|
|
|
7350
7381
|
"p",
|
|
7351
7382
|
{
|
|
7352
7383
|
role: hasError ? "alert" : void 0,
|
|
7384
|
+
"data-testid": testId ? hasError ? `${testId}-error` : `${testId}-helper-text` : void 0,
|
|
7353
7385
|
className: cn(
|
|
7354
7386
|
"mt-1.5 text-sm",
|
|
7355
7387
|
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
@@ -7379,7 +7411,7 @@ const CloseIcon$2 = () => /* @__PURE__ */ jsx(
|
|
|
7379
7411
|
)
|
|
7380
7412
|
}
|
|
7381
7413
|
);
|
|
7382
|
-
const sizeStyles$
|
|
7414
|
+
const sizeStyles$b = {
|
|
7383
7415
|
sm: "max-w-[400px]",
|
|
7384
7416
|
md: "max-w-[560px]",
|
|
7385
7417
|
lg: "max-w-[720px]"
|
|
@@ -7395,7 +7427,8 @@ function Modal({
|
|
|
7395
7427
|
footer,
|
|
7396
7428
|
closeOnOverlay = true,
|
|
7397
7429
|
className,
|
|
7398
|
-
isLoading = false
|
|
7430
|
+
isLoading = false,
|
|
7431
|
+
testId
|
|
7399
7432
|
}) {
|
|
7400
7433
|
const handleClose = closeOnOverlay ? onClose : () => {
|
|
7401
7434
|
};
|
|
@@ -7410,7 +7443,7 @@ function Modal({
|
|
|
7410
7443
|
leave: "ease-in duration-100",
|
|
7411
7444
|
leaveFrom: "opacity-100",
|
|
7412
7445
|
leaveTo: "opacity-0",
|
|
7413
|
-
children: /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black/40 backdrop-blur-sm" })
|
|
7446
|
+
children: /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black/40 backdrop-blur-sm", "data-testid": testId ? `${testId}-overlay` : void 0 })
|
|
7414
7447
|
}
|
|
7415
7448
|
),
|
|
7416
7449
|
/* @__PURE__ */ jsx("div", { className: "fixed inset-0 flex items-center justify-center p-4", children: /* @__PURE__ */ jsx(
|
|
@@ -7432,9 +7465,10 @@ function Modal({
|
|
|
7432
7465
|
"bg-white border border-primary-200",
|
|
7433
7466
|
// Dark mode
|
|
7434
7467
|
"dark:bg-primary-800 dark:border-primary-700",
|
|
7435
|
-
sizeStyles$
|
|
7468
|
+
sizeStyles$b[size2],
|
|
7436
7469
|
className
|
|
7437
7470
|
),
|
|
7471
|
+
"data-testid": testId,
|
|
7438
7472
|
children: [
|
|
7439
7473
|
(title || showCloseButton) && /* @__PURE__ */ jsxs(
|
|
7440
7474
|
"div",
|
|
@@ -7443,6 +7477,7 @@ function Modal({
|
|
|
7443
7477
|
"flex items-start justify-between px-6 py-4",
|
|
7444
7478
|
(children || footer) && "border-b border-primary-200 dark:border-primary-700"
|
|
7445
7479
|
),
|
|
7480
|
+
"data-testid": testId ? `${testId}-header` : void 0,
|
|
7446
7481
|
children: [
|
|
7447
7482
|
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
7448
7483
|
title && /* @__PURE__ */ jsx(Qe, { className: "text-lg font-semibold text-primary-900 dark:text-white", children: title }),
|
|
@@ -7461,13 +7496,14 @@ function Modal({
|
|
|
7461
7496
|
"focus:outline-none focus:ring-2 focus:ring-gold-500/20",
|
|
7462
7497
|
"transition-colors"
|
|
7463
7498
|
),
|
|
7499
|
+
"data-testid": testId ? `${testId}-close-button` : void 0,
|
|
7464
7500
|
children: /* @__PURE__ */ jsx(CloseIcon$2, {})
|
|
7465
7501
|
}
|
|
7466
7502
|
)
|
|
7467
7503
|
]
|
|
7468
7504
|
}
|
|
7469
7505
|
),
|
|
7470
|
-
children && /* @__PURE__ */ jsxs("div", { className: "relative px-6 py-4 text-primary-700 dark:text-primary-300", children: [
|
|
7506
|
+
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
7507
|
children,
|
|
7472
7508
|
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
7509
|
] }),
|
|
@@ -7480,6 +7516,7 @@ function Modal({
|
|
|
7480
7516
|
"bg-primary-50 dark:bg-primary-900/50",
|
|
7481
7517
|
"rounded-b-lg"
|
|
7482
7518
|
),
|
|
7519
|
+
"data-testid": testId ? `${testId}-footer` : void 0,
|
|
7483
7520
|
children: footer
|
|
7484
7521
|
}
|
|
7485
7522
|
)
|
|
@@ -7510,7 +7547,7 @@ const CloseIcon$1 = () => /* @__PURE__ */ jsx(
|
|
|
7510
7547
|
)
|
|
7511
7548
|
}
|
|
7512
7549
|
);
|
|
7513
|
-
const sizeStyles$
|
|
7550
|
+
const sizeStyles$a = {
|
|
7514
7551
|
sm: "max-w-[400px]",
|
|
7515
7552
|
md: "max-w-[560px]",
|
|
7516
7553
|
lg: "max-w-[720px]"
|
|
@@ -7524,7 +7561,8 @@ function Drawer({
|
|
|
7524
7561
|
showCloseButton = true,
|
|
7525
7562
|
footer,
|
|
7526
7563
|
className,
|
|
7527
|
-
isLoading = false
|
|
7564
|
+
isLoading = false,
|
|
7565
|
+
testId
|
|
7528
7566
|
}) {
|
|
7529
7567
|
return /* @__PURE__ */ jsx(Ke$2, { show: isOpen, as: Fragment$1, children: /* @__PURE__ */ jsxs(ht$1, { className: "relative z-50", onClose, children: [
|
|
7530
7568
|
/* @__PURE__ */ jsx(
|
|
@@ -7537,7 +7575,7 @@ function Drawer({
|
|
|
7537
7575
|
leave: "ease-in duration-200",
|
|
7538
7576
|
leaveFrom: "opacity-100",
|
|
7539
7577
|
leaveTo: "opacity-0",
|
|
7540
|
-
children: /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black/40 backdrop-blur-sm" })
|
|
7578
|
+
children: /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black/40 backdrop-blur-sm", "data-testid": testId ? `${testId}-overlay` : void 0 })
|
|
7541
7579
|
}
|
|
7542
7580
|
),
|
|
7543
7581
|
/* @__PURE__ */ jsx("div", { className: "fixed inset-0 flex justify-end", children: /* @__PURE__ */ jsx(
|
|
@@ -7559,9 +7597,10 @@ function Drawer({
|
|
|
7559
7597
|
"bg-white border-l border-primary-200",
|
|
7560
7598
|
// Dark mode
|
|
7561
7599
|
"dark:bg-primary-800 dark:border-primary-700",
|
|
7562
|
-
sizeStyles$
|
|
7600
|
+
sizeStyles$a[size2],
|
|
7563
7601
|
className
|
|
7564
7602
|
),
|
|
7603
|
+
"data-testid": testId,
|
|
7565
7604
|
children: [
|
|
7566
7605
|
(title || showCloseButton) && /* @__PURE__ */ jsxs(
|
|
7567
7606
|
"div",
|
|
@@ -7585,13 +7624,14 @@ function Drawer({
|
|
|
7585
7624
|
"focus:outline-none focus:ring-2 focus:ring-gold-500/20",
|
|
7586
7625
|
"transition-colors"
|
|
7587
7626
|
),
|
|
7627
|
+
"data-testid": testId ? `${testId}-close-button` : void 0,
|
|
7588
7628
|
children: /* @__PURE__ */ jsx(CloseIcon$1, {})
|
|
7589
7629
|
}
|
|
7590
7630
|
)
|
|
7591
7631
|
]
|
|
7592
7632
|
}
|
|
7593
7633
|
),
|
|
7594
|
-
/* @__PURE__ */ jsxs("div", { className: "relative flex-1 overflow-y-auto px-6 py-4 text-primary-700 dark:text-primary-300", children: [
|
|
7634
|
+
/* @__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
7635
|
children,
|
|
7596
7636
|
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
7637
|
] }),
|
|
@@ -7629,7 +7669,8 @@ function ConfirmDialog({
|
|
|
7629
7669
|
variant = "neutral",
|
|
7630
7670
|
cancelText = "Cancel",
|
|
7631
7671
|
confirmText = "Confirm",
|
|
7632
|
-
loading = false
|
|
7672
|
+
loading = false,
|
|
7673
|
+
testId
|
|
7633
7674
|
}) {
|
|
7634
7675
|
const buttonVariant = variantToButton[variant];
|
|
7635
7676
|
const handleConfirm = () => {
|
|
@@ -7645,6 +7686,7 @@ function ConfirmDialog({
|
|
|
7645
7686
|
size: "sm",
|
|
7646
7687
|
showCloseButton: false,
|
|
7647
7688
|
closeOnOverlay: !loading,
|
|
7689
|
+
testId,
|
|
7648
7690
|
footer: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-3", children: [
|
|
7649
7691
|
/* @__PURE__ */ jsx(
|
|
7650
7692
|
Button,
|
|
@@ -7652,6 +7694,7 @@ function ConfirmDialog({
|
|
|
7652
7694
|
variant: "secondary",
|
|
7653
7695
|
onClick: onClose,
|
|
7654
7696
|
disabled: loading,
|
|
7697
|
+
"data-testid": testId ? `${testId}-cancel-button` : void 0,
|
|
7655
7698
|
children: cancelText
|
|
7656
7699
|
}
|
|
7657
7700
|
),
|
|
@@ -7661,6 +7704,7 @@ function ConfirmDialog({
|
|
|
7661
7704
|
variant: buttonVariant,
|
|
7662
7705
|
onClick: handleConfirm,
|
|
7663
7706
|
disabled: loading,
|
|
7707
|
+
"data-testid": testId ? `${testId}-confirm-button` : void 0,
|
|
7664
7708
|
children: loading ? "Loading..." : confirmText
|
|
7665
7709
|
}
|
|
7666
7710
|
)
|
|
@@ -7675,7 +7719,7 @@ const paddingStyles = {
|
|
|
7675
7719
|
md: "p-6",
|
|
7676
7720
|
lg: "p-8"
|
|
7677
7721
|
};
|
|
7678
|
-
const variantStyles$
|
|
7722
|
+
const variantStyles$4 = {
|
|
7679
7723
|
default: [
|
|
7680
7724
|
"shadow-sm border border-primary-200",
|
|
7681
7725
|
"dark:border-primary-700"
|
|
@@ -7700,6 +7744,7 @@ const Card = forwardRef(
|
|
|
7700
7744
|
hoverable = false,
|
|
7701
7745
|
children,
|
|
7702
7746
|
className,
|
|
7747
|
+
testId,
|
|
7703
7748
|
...props
|
|
7704
7749
|
}, ref) => {
|
|
7705
7750
|
return /* @__PURE__ */ jsx(
|
|
@@ -7716,7 +7761,7 @@ const Card = forwardRef(
|
|
|
7716
7761
|
// Padding
|
|
7717
7762
|
paddingStyles[padding],
|
|
7718
7763
|
// Variant
|
|
7719
|
-
variantStyles$
|
|
7764
|
+
variantStyles$4[variant],
|
|
7720
7765
|
// Hover effect
|
|
7721
7766
|
hoverable && [
|
|
7722
7767
|
"cursor-pointer",
|
|
@@ -7725,6 +7770,7 @@ const Card = forwardRef(
|
|
|
7725
7770
|
],
|
|
7726
7771
|
className
|
|
7727
7772
|
),
|
|
7773
|
+
"data-testid": testId,
|
|
7728
7774
|
...props,
|
|
7729
7775
|
children
|
|
7730
7776
|
}
|
|
@@ -7732,7 +7778,7 @@ const Card = forwardRef(
|
|
|
7732
7778
|
}
|
|
7733
7779
|
);
|
|
7734
7780
|
Card.displayName = "Card";
|
|
7735
|
-
const sizeStyles$
|
|
7781
|
+
const sizeStyles$9 = {
|
|
7736
7782
|
sm: "h-4 w-4",
|
|
7737
7783
|
md: "h-5 w-5",
|
|
7738
7784
|
lg: "h-6 w-6"
|
|
@@ -7754,6 +7800,7 @@ const Checkbox = forwardRef(
|
|
|
7754
7800
|
indeterminate = false,
|
|
7755
7801
|
className,
|
|
7756
7802
|
id,
|
|
7803
|
+
testId,
|
|
7757
7804
|
...props
|
|
7758
7805
|
}, forwardedRef) => {
|
|
7759
7806
|
const checkboxId = id || label?.toLowerCase().replace(/\s+/g, "-");
|
|
@@ -7780,7 +7827,7 @@ const Checkbox = forwardRef(
|
|
|
7780
7827
|
const handleChange = (e3) => {
|
|
7781
7828
|
onChange?.(e3.target.checked);
|
|
7782
7829
|
};
|
|
7783
|
-
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
7830
|
+
return /* @__PURE__ */ jsxs("div", { className, "data-testid": testId, children: [
|
|
7784
7831
|
/* @__PURE__ */ jsxs(
|
|
7785
7832
|
"label",
|
|
7786
7833
|
{
|
|
@@ -7789,6 +7836,7 @@ const Checkbox = forwardRef(
|
|
|
7789
7836
|
"inline-flex items-center gap-2",
|
|
7790
7837
|
disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
7791
7838
|
),
|
|
7839
|
+
"data-testid": testId ? `${testId}-label` : void 0,
|
|
7792
7840
|
children: [
|
|
7793
7841
|
/* @__PURE__ */ jsx(
|
|
7794
7842
|
"input",
|
|
@@ -7801,8 +7849,9 @@ const Checkbox = forwardRef(
|
|
|
7801
7849
|
"aria-invalid": hasError ? "true" : void 0,
|
|
7802
7850
|
"aria-describedby": errorId,
|
|
7803
7851
|
onChange: handleChange,
|
|
7852
|
+
"data-testid": testId ? `${testId}-checkbox` : void 0,
|
|
7804
7853
|
className: cn(
|
|
7805
|
-
sizeStyles$
|
|
7854
|
+
sizeStyles$9[size2],
|
|
7806
7855
|
"rounded border transition-colors",
|
|
7807
7856
|
"focus:ring-2 focus:ring-offset-0",
|
|
7808
7857
|
"disabled:cursor-not-allowed",
|
|
@@ -7845,6 +7894,7 @@ const Checkbox = forwardRef(
|
|
|
7845
7894
|
{
|
|
7846
7895
|
id: errorId,
|
|
7847
7896
|
role: hasError ? "alert" : void 0,
|
|
7897
|
+
"data-testid": testId ? hasError ? `${testId}-error` : `${testId}-helper-text` : void 0,
|
|
7848
7898
|
className: cn(
|
|
7849
7899
|
"mt-1 text-sm",
|
|
7850
7900
|
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
@@ -7856,7 +7906,7 @@ const Checkbox = forwardRef(
|
|
|
7856
7906
|
}
|
|
7857
7907
|
);
|
|
7858
7908
|
Checkbox.displayName = "Checkbox";
|
|
7859
|
-
const sizeStyles$
|
|
7909
|
+
const sizeStyles$8 = {
|
|
7860
7910
|
sm: "h-4 w-4",
|
|
7861
7911
|
md: "h-5 w-5",
|
|
7862
7912
|
lg: "h-6 w-6"
|
|
@@ -7874,6 +7924,7 @@ const Radio = forwardRef(
|
|
|
7874
7924
|
error: error2 = false,
|
|
7875
7925
|
className,
|
|
7876
7926
|
id,
|
|
7927
|
+
testId,
|
|
7877
7928
|
...props
|
|
7878
7929
|
}, ref) => {
|
|
7879
7930
|
const radioId = id || (label ? `${props.name}-${label.toLowerCase().replace(/\s+/g, "-")}` : void 0);
|
|
@@ -7886,6 +7937,7 @@ const Radio = forwardRef(
|
|
|
7886
7937
|
disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
7887
7938
|
className
|
|
7888
7939
|
),
|
|
7940
|
+
"data-testid": testId,
|
|
7889
7941
|
children: [
|
|
7890
7942
|
/* @__PURE__ */ jsx(
|
|
7891
7943
|
"input",
|
|
@@ -7894,8 +7946,9 @@ const Radio = forwardRef(
|
|
|
7894
7946
|
type: "radio",
|
|
7895
7947
|
id: radioId,
|
|
7896
7948
|
disabled,
|
|
7949
|
+
"data-testid": testId ? `${testId}-radio` : void 0,
|
|
7897
7950
|
className: cn(
|
|
7898
|
-
sizeStyles$
|
|
7951
|
+
sizeStyles$8[size2],
|
|
7899
7952
|
"border transition-colors",
|
|
7900
7953
|
"focus:ring-2 focus:ring-offset-0",
|
|
7901
7954
|
"disabled:cursor-not-allowed",
|
|
@@ -7925,6 +7978,7 @@ const Radio = forwardRef(
|
|
|
7925
7978
|
"text-primary-700 dark:text-primary-200",
|
|
7926
7979
|
error2 && "text-error"
|
|
7927
7980
|
),
|
|
7981
|
+
"data-testid": testId ? `${testId}-label` : void 0,
|
|
7928
7982
|
children: label
|
|
7929
7983
|
}
|
|
7930
7984
|
)
|
|
@@ -7946,7 +8000,8 @@ function RadioGroup({
|
|
|
7946
8000
|
disabled = false,
|
|
7947
8001
|
orientation = "vertical",
|
|
7948
8002
|
className,
|
|
7949
|
-
isLoading = false
|
|
8003
|
+
isLoading = false,
|
|
8004
|
+
testId
|
|
7950
8005
|
}) {
|
|
7951
8006
|
const hasError = !!error2;
|
|
7952
8007
|
const groupId = `${name}-group`;
|
|
@@ -7954,7 +8009,7 @@ function RadioGroup({
|
|
|
7954
8009
|
const handleChange = (e3) => {
|
|
7955
8010
|
onChange?.(e3.target.value);
|
|
7956
8011
|
};
|
|
7957
|
-
return /* @__PURE__ */ jsxs("fieldset", { className, role: "radiogroup", "aria-labelledby": label ? groupId : void 0, children: [
|
|
8012
|
+
return /* @__PURE__ */ jsxs("fieldset", { className, role: "radiogroup", "aria-labelledby": label ? groupId : void 0, "data-testid": testId, children: [
|
|
7958
8013
|
label && /* @__PURE__ */ jsxs(
|
|
7959
8014
|
"legend",
|
|
7960
8015
|
{
|
|
@@ -7972,7 +8027,7 @@ function RadioGroup({
|
|
|
7972
8027
|
className: cn(
|
|
7973
8028
|
orientation === "vertical" ? "space-y-2" : "flex flex-wrap gap-4"
|
|
7974
8029
|
),
|
|
7975
|
-
children: options.map((option) => /* @__PURE__ */ jsx(
|
|
8030
|
+
children: options.map((option, index2) => /* @__PURE__ */ jsx(
|
|
7976
8031
|
Radio,
|
|
7977
8032
|
{
|
|
7978
8033
|
name,
|
|
@@ -7982,7 +8037,8 @@ function RadioGroup({
|
|
|
7982
8037
|
disabled: isDisabled || option.disabled,
|
|
7983
8038
|
error: hasError,
|
|
7984
8039
|
checked: value === option.value,
|
|
7985
|
-
onChange: handleChange
|
|
8040
|
+
onChange: handleChange,
|
|
8041
|
+
testId: testId ? `${testId}-option-${index2}` : void 0
|
|
7986
8042
|
},
|
|
7987
8043
|
option.value
|
|
7988
8044
|
))
|
|
@@ -7992,6 +8048,7 @@ function RadioGroup({
|
|
|
7992
8048
|
"p",
|
|
7993
8049
|
{
|
|
7994
8050
|
role: hasError ? "alert" : void 0,
|
|
8051
|
+
"data-testid": testId ? hasError ? `${testId}-error` : `${testId}-helper-text` : void 0,
|
|
7995
8052
|
className: cn(
|
|
7996
8053
|
"mt-2 text-sm",
|
|
7997
8054
|
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
@@ -8002,7 +8059,7 @@ function RadioGroup({
|
|
|
8002
8059
|
] });
|
|
8003
8060
|
}
|
|
8004
8061
|
RadioGroup.displayName = "RadioGroup";
|
|
8005
|
-
const sizeStyles$
|
|
8062
|
+
const sizeStyles$7 = {
|
|
8006
8063
|
sm: {
|
|
8007
8064
|
switch: "h-5 w-9",
|
|
8008
8065
|
dot: "h-3 w-3",
|
|
@@ -8027,11 +8084,12 @@ function Toggle({
|
|
|
8027
8084
|
disabled = false,
|
|
8028
8085
|
size: size2 = "md",
|
|
8029
8086
|
className,
|
|
8030
|
-
isLoading = false
|
|
8087
|
+
isLoading = false,
|
|
8088
|
+
testId
|
|
8031
8089
|
}) {
|
|
8032
|
-
const currentSize = sizeStyles$
|
|
8090
|
+
const currentSize = sizeStyles$7[size2];
|
|
8033
8091
|
const isDisabled = disabled || isLoading;
|
|
8034
|
-
return /* @__PURE__ */ jsx(W, { className, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8092
|
+
return /* @__PURE__ */ jsx(W, { className, "data-testid": testId, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8035
8093
|
(label || description) && /* @__PURE__ */ jsxs("div", { className: "flex-1 mr-4", children: [
|
|
8036
8094
|
label && /* @__PURE__ */ jsx(
|
|
8037
8095
|
Z,
|
|
@@ -8053,6 +8111,7 @@ function Toggle({
|
|
|
8053
8111
|
disabled: isDisabled,
|
|
8054
8112
|
onChange,
|
|
8055
8113
|
"aria-label": !label ? "Toggle" : void 0,
|
|
8114
|
+
"data-testid": testId ? `${testId}-toggle` : void 0,
|
|
8056
8115
|
className: cn(
|
|
8057
8116
|
currentSize.switch,
|
|
8058
8117
|
"relative inline-flex shrink-0 cursor-pointer rounded-full",
|
|
@@ -8138,7 +8197,8 @@ function Combobox({
|
|
|
8138
8197
|
isLoading = false,
|
|
8139
8198
|
loadingText = "Loading...",
|
|
8140
8199
|
emptyText = "No results found",
|
|
8141
|
-
onSearch
|
|
8200
|
+
onSearch,
|
|
8201
|
+
testId
|
|
8142
8202
|
}) {
|
|
8143
8203
|
const [query, setQuery] = useState("");
|
|
8144
8204
|
const hasError = !!error2;
|
|
@@ -8158,12 +8218,13 @@ function Combobox({
|
|
|
8158
8218
|
onChange?.(newValue);
|
|
8159
8219
|
setQuery("");
|
|
8160
8220
|
};
|
|
8161
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto", className), children: [
|
|
8221
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto", className), "data-testid": testId, children: [
|
|
8162
8222
|
label && /* @__PURE__ */ jsxs(
|
|
8163
8223
|
"label",
|
|
8164
8224
|
{
|
|
8165
8225
|
id: labelId,
|
|
8166
8226
|
className: "mb-2 block text-sm font-medium text-primary-700 dark:text-white",
|
|
8227
|
+
"data-testid": testId ? `${testId}-label` : void 0,
|
|
8167
8228
|
children: [
|
|
8168
8229
|
label,
|
|
8169
8230
|
required && /* @__PURE__ */ jsx("span", { className: "ml-1 text-error", children: "*" })
|
|
@@ -8190,6 +8251,7 @@ function Combobox({
|
|
|
8190
8251
|
onSearch?.(newQuery);
|
|
8191
8252
|
},
|
|
8192
8253
|
placeholder,
|
|
8254
|
+
"data-testid": testId ? `${testId}-input` : void 0,
|
|
8193
8255
|
className: cn(
|
|
8194
8256
|
// Base styles - Light mode
|
|
8195
8257
|
"w-full rounded-md border bg-white px-4 py-2.5 pr-10 text-sm text-primary-900",
|
|
@@ -8223,30 +8285,38 @@ function Combobox({
|
|
|
8223
8285
|
leaveFrom: "opacity-100",
|
|
8224
8286
|
leaveTo: "opacity-0",
|
|
8225
8287
|
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,
|
|
8288
|
+
children: /* @__PURE__ */ jsx(
|
|
8289
|
+
Uo,
|
|
8231
8290
|
{
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8291
|
+
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",
|
|
8292
|
+
"data-testid": testId ? `${testId}-options` : void 0,
|
|
8293
|
+
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: [
|
|
8294
|
+
/* @__PURE__ */ jsx(Spinner, { size: "sm", color: "primary" }),
|
|
8295
|
+
/* @__PURE__ */ jsx("span", { children: loadingText })
|
|
8296
|
+
] }) : 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(
|
|
8297
|
+
Ho,
|
|
8298
|
+
{
|
|
8299
|
+
value: option.value,
|
|
8300
|
+
disabled: option.disabled,
|
|
8301
|
+
"data-testid": testId ? `${testId}-option-${index2}` : void 0,
|
|
8302
|
+
className: ({ active, selected }) => cn(
|
|
8303
|
+
"relative cursor-pointer select-none py-2.5 pl-10 pr-4",
|
|
8304
|
+
// Light mode
|
|
8305
|
+
active ? "bg-gold-50 text-primary-900" : "text-primary-900",
|
|
8306
|
+
// Dark mode
|
|
8307
|
+
active ? "dark:bg-primary-700 dark:text-primary-100" : "dark:text-primary-200",
|
|
8308
|
+
option.disabled && "cursor-not-allowed opacity-50",
|
|
8309
|
+
selected && "font-medium"
|
|
8310
|
+
),
|
|
8311
|
+
children: ({ selected }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8312
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate", children: option.label }),
|
|
8313
|
+
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, {}) })
|
|
8314
|
+
] })
|
|
8315
|
+
},
|
|
8316
|
+
option.value
|
|
8317
|
+
))
|
|
8318
|
+
}
|
|
8319
|
+
)
|
|
8250
8320
|
}
|
|
8251
8321
|
)
|
|
8252
8322
|
] })
|
|
@@ -8256,6 +8326,7 @@ function Combobox({
|
|
|
8256
8326
|
"p",
|
|
8257
8327
|
{
|
|
8258
8328
|
role: hasError ? "alert" : void 0,
|
|
8329
|
+
"data-testid": testId ? hasError ? `${testId}-error` : `${testId}-helper-text` : void 0,
|
|
8259
8330
|
className: cn(
|
|
8260
8331
|
"mt-1.5 text-sm",
|
|
8261
8332
|
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
@@ -8266,7 +8337,7 @@ function Combobox({
|
|
|
8266
8337
|
] });
|
|
8267
8338
|
}
|
|
8268
8339
|
Combobox.displayName = "Combobox";
|
|
8269
|
-
const variantStyles$
|
|
8340
|
+
const variantStyles$3 = {
|
|
8270
8341
|
default: cn(
|
|
8271
8342
|
"bg-primary-100 text-primary-700 border-primary-200",
|
|
8272
8343
|
"dark:bg-primary-800 dark:text-primary-200 dark:border-primary-700"
|
|
@@ -8292,23 +8363,24 @@ const variantStyles$2 = {
|
|
|
8292
8363
|
"dark:bg-gold-900/50 dark:text-gold-300 dark:border-gold-700"
|
|
8293
8364
|
)
|
|
8294
8365
|
};
|
|
8295
|
-
const sizeStyles$
|
|
8366
|
+
const sizeStyles$6 = {
|
|
8296
8367
|
sm: "px-2 py-0.5 text-xs",
|
|
8297
8368
|
md: "px-2.5 py-1 text-sm",
|
|
8298
8369
|
lg: "px-3 py-1.5 text-base"
|
|
8299
8370
|
};
|
|
8300
8371
|
const Badge = forwardRef(
|
|
8301
|
-
({ variant = "default", size: size2 = "md", children, className, ...props }, ref) => {
|
|
8372
|
+
({ variant = "default", size: size2 = "md", children, className, testId, ...props }, ref) => {
|
|
8302
8373
|
return /* @__PURE__ */ jsx(
|
|
8303
8374
|
"span",
|
|
8304
8375
|
{
|
|
8305
8376
|
ref,
|
|
8306
8377
|
className: cn(
|
|
8307
8378
|
"inline-flex items-center justify-center font-medium rounded-full border",
|
|
8308
|
-
variantStyles$
|
|
8309
|
-
sizeStyles$
|
|
8379
|
+
variantStyles$3[variant],
|
|
8380
|
+
sizeStyles$6[size2],
|
|
8310
8381
|
className
|
|
8311
8382
|
),
|
|
8383
|
+
"data-testid": testId,
|
|
8312
8384
|
...props,
|
|
8313
8385
|
children
|
|
8314
8386
|
}
|
|
@@ -8464,7 +8536,7 @@ const TableCell = forwardRef(
|
|
|
8464
8536
|
}
|
|
8465
8537
|
);
|
|
8466
8538
|
TableCell.displayName = "TableCell";
|
|
8467
|
-
const sizeStyles$
|
|
8539
|
+
const sizeStyles$5 = {
|
|
8468
8540
|
sm: "px-3 py-1.5 text-sm",
|
|
8469
8541
|
md: "px-4 py-2 text-sm",
|
|
8470
8542
|
lg: "px-5 py-2.5 text-base"
|
|
@@ -8478,6 +8550,7 @@ function Tabs({
|
|
|
8478
8550
|
size: size2 = "md",
|
|
8479
8551
|
className,
|
|
8480
8552
|
"aria-label": ariaLabel = "Navigation tabs",
|
|
8553
|
+
testId,
|
|
8481
8554
|
...props
|
|
8482
8555
|
}) {
|
|
8483
8556
|
const selectedIndex = useMemo(
|
|
@@ -8505,15 +8578,17 @@ function Tabs({
|
|
|
8505
8578
|
fullWidth && "w-full",
|
|
8506
8579
|
className
|
|
8507
8580
|
),
|
|
8581
|
+
"data-testid": testId,
|
|
8508
8582
|
...props,
|
|
8509
|
-
children: tabs.map((tab) => /* @__PURE__ */ jsx(
|
|
8583
|
+
children: tabs.map((tab, index2) => /* @__PURE__ */ jsx(
|
|
8510
8584
|
dt,
|
|
8511
8585
|
{
|
|
8512
8586
|
disabled: tab.disabled,
|
|
8587
|
+
"data-testid": testId ? `${testId}-tab-${index2}` : void 0,
|
|
8513
8588
|
className: ({ selected }) => cn(
|
|
8514
8589
|
"relative outline-none transition-colors duration-normal",
|
|
8515
8590
|
"focus-visible:ring-2 focus-visible:ring-gold-500/50",
|
|
8516
|
-
sizeStyles$
|
|
8591
|
+
sizeStyles$5[size2],
|
|
8517
8592
|
fullWidth && "flex-1",
|
|
8518
8593
|
// Default variant styles
|
|
8519
8594
|
variant === "default" && [
|
|
@@ -8556,6 +8631,7 @@ function TabContentPanels({
|
|
|
8556
8631
|
children,
|
|
8557
8632
|
className,
|
|
8558
8633
|
isLoading = false,
|
|
8634
|
+
testId,
|
|
8559
8635
|
...props
|
|
8560
8636
|
}) {
|
|
8561
8637
|
const activeContent = activeTab && children[activeTab];
|
|
@@ -8564,6 +8640,7 @@ function TabContentPanels({
|
|
|
8564
8640
|
{
|
|
8565
8641
|
role: "tabpanel",
|
|
8566
8642
|
className: cn("relative mt-4", className),
|
|
8643
|
+
"data-testid": testId,
|
|
8567
8644
|
...props,
|
|
8568
8645
|
children: [
|
|
8569
8646
|
activeContent,
|
|
@@ -8628,6 +8705,7 @@ const Breadcrumbs = forwardRef(
|
|
|
8628
8705
|
maxItems = 0,
|
|
8629
8706
|
renderLink,
|
|
8630
8707
|
className,
|
|
8708
|
+
testId,
|
|
8631
8709
|
...props
|
|
8632
8710
|
}, ref) => {
|
|
8633
8711
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
@@ -8679,12 +8757,20 @@ const Breadcrumbs = forwardRef(
|
|
|
8679
8757
|
ref,
|
|
8680
8758
|
"aria-label": "Breadcrumb",
|
|
8681
8759
|
className: cn("text-sm", className),
|
|
8760
|
+
"data-testid": testId,
|
|
8682
8761
|
...props,
|
|
8683
8762
|
children: /* @__PURE__ */ jsx("ol", { className: "flex items-center flex-wrap gap-1", children: displayItems.map((item, index2) => {
|
|
8684
8763
|
const isLast = index2 === displayItems.length - 1;
|
|
8685
8764
|
const showEllipsis = shouldCollapse && index2 === 0;
|
|
8686
8765
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
8687
|
-
/* @__PURE__ */ jsx(
|
|
8766
|
+
/* @__PURE__ */ jsx(
|
|
8767
|
+
"li",
|
|
8768
|
+
{
|
|
8769
|
+
className: "inline-flex items-center",
|
|
8770
|
+
"data-testid": testId ? `${testId}-item-${index2}` : void 0,
|
|
8771
|
+
children: renderItem(item, index2, isLast)
|
|
8772
|
+
}
|
|
8773
|
+
),
|
|
8688
8774
|
showEllipsis && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8689
8775
|
/* @__PURE__ */ jsx("li", { className: "inline-flex items-center", "aria-hidden": "true", children: separatorElement }),
|
|
8690
8776
|
/* @__PURE__ */ jsx("li", { className: "inline-flex items-center", children: /* @__PURE__ */ jsx(EllipsisButton, { onClick: () => setIsExpanded(true) }) })
|
|
@@ -8697,7 +8783,7 @@ const Breadcrumbs = forwardRef(
|
|
|
8697
8783
|
}
|
|
8698
8784
|
);
|
|
8699
8785
|
Breadcrumbs.displayName = "Breadcrumbs";
|
|
8700
|
-
const variantStyles$
|
|
8786
|
+
const variantStyles$2 = {
|
|
8701
8787
|
text: "rounded",
|
|
8702
8788
|
circular: "rounded-full",
|
|
8703
8789
|
rectangular: "rounded-md"
|
|
@@ -8712,6 +8798,7 @@ const Skeleton = forwardRef(
|
|
|
8712
8798
|
label = "Loading...",
|
|
8713
8799
|
className,
|
|
8714
8800
|
style,
|
|
8801
|
+
testId,
|
|
8715
8802
|
...props
|
|
8716
8803
|
}, ref) => {
|
|
8717
8804
|
const widthValue = typeof width === "number" ? `${width}px` : width;
|
|
@@ -8726,6 +8813,7 @@ const Skeleton = forwardRef(
|
|
|
8726
8813
|
role: "status",
|
|
8727
8814
|
"aria-label": label,
|
|
8728
8815
|
"aria-busy": "true",
|
|
8816
|
+
"data-testid": testId,
|
|
8729
8817
|
...props,
|
|
8730
8818
|
children: [
|
|
8731
8819
|
Array.from({ length: lines }).map((_2, index2) => /* @__PURE__ */ jsx(
|
|
@@ -8733,7 +8821,7 @@ const Skeleton = forwardRef(
|
|
|
8733
8821
|
{
|
|
8734
8822
|
className: cn(
|
|
8735
8823
|
"bg-primary-200 dark:bg-primary-700",
|
|
8736
|
-
variantStyles$
|
|
8824
|
+
variantStyles$2[variant],
|
|
8737
8825
|
animate && "animate-pulse"
|
|
8738
8826
|
),
|
|
8739
8827
|
style: {
|
|
@@ -8755,7 +8843,7 @@ const Skeleton = forwardRef(
|
|
|
8755
8843
|
ref,
|
|
8756
8844
|
className: cn(
|
|
8757
8845
|
"bg-primary-200 dark:bg-primary-700",
|
|
8758
|
-
variantStyles$
|
|
8846
|
+
variantStyles$2[variant],
|
|
8759
8847
|
animate && "animate-pulse",
|
|
8760
8848
|
className
|
|
8761
8849
|
),
|
|
@@ -8767,6 +8855,7 @@ const Skeleton = forwardRef(
|
|
|
8767
8855
|
role: "status",
|
|
8768
8856
|
"aria-label": label,
|
|
8769
8857
|
"aria-busy": "true",
|
|
8858
|
+
"data-testid": testId,
|
|
8770
8859
|
...props,
|
|
8771
8860
|
children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: label })
|
|
8772
8861
|
}
|
|
@@ -8774,7 +8863,7 @@ const Skeleton = forwardRef(
|
|
|
8774
8863
|
}
|
|
8775
8864
|
);
|
|
8776
8865
|
Skeleton.displayName = "Skeleton";
|
|
8777
|
-
const defaultIcons = {
|
|
8866
|
+
const defaultIcons$1 = {
|
|
8778
8867
|
"no-data": /* @__PURE__ */ jsx(
|
|
8779
8868
|
"svg",
|
|
8780
8869
|
{
|
|
@@ -8833,7 +8922,7 @@ const defaultIcons = {
|
|
|
8833
8922
|
}
|
|
8834
8923
|
)
|
|
8835
8924
|
};
|
|
8836
|
-
const sizeStyles$
|
|
8925
|
+
const sizeStyles$4 = {
|
|
8837
8926
|
sm: {
|
|
8838
8927
|
container: "py-6 px-4",
|
|
8839
8928
|
icon: "w-10 h-10",
|
|
@@ -8867,9 +8956,10 @@ const EmptyState = forwardRef(
|
|
|
8867
8956
|
action,
|
|
8868
8957
|
size: size2 = "md",
|
|
8869
8958
|
className,
|
|
8959
|
+
testId,
|
|
8870
8960
|
...props
|
|
8871
8961
|
}, ref) => {
|
|
8872
|
-
const styles = sizeStyles$
|
|
8962
|
+
const styles = sizeStyles$4[size2];
|
|
8873
8963
|
return /* @__PURE__ */ jsxs(
|
|
8874
8964
|
"div",
|
|
8875
8965
|
{
|
|
@@ -8879,9 +8969,17 @@ const EmptyState = forwardRef(
|
|
|
8879
8969
|
styles.container,
|
|
8880
8970
|
className
|
|
8881
8971
|
),
|
|
8972
|
+
"data-testid": testId,
|
|
8882
8973
|
...props,
|
|
8883
8974
|
children: [
|
|
8884
|
-
/* @__PURE__ */ jsx(
|
|
8975
|
+
/* @__PURE__ */ jsx(
|
|
8976
|
+
"div",
|
|
8977
|
+
{
|
|
8978
|
+
className: cn(styles.icon, typeColors[type], "mb-4"),
|
|
8979
|
+
"data-testid": testId ? `${testId}-icon` : void 0,
|
|
8980
|
+
children: icon || defaultIcons$1[type]
|
|
8981
|
+
}
|
|
8982
|
+
),
|
|
8885
8983
|
/* @__PURE__ */ jsx(
|
|
8886
8984
|
"h3",
|
|
8887
8985
|
{
|
|
@@ -8890,6 +8988,7 @@ const EmptyState = forwardRef(
|
|
|
8890
8988
|
"text-primary-900 dark:text-primary-100",
|
|
8891
8989
|
"mb-1"
|
|
8892
8990
|
),
|
|
8991
|
+
"data-testid": testId ? `${testId}-title` : void 0,
|
|
8893
8992
|
children: title
|
|
8894
8993
|
}
|
|
8895
8994
|
),
|
|
@@ -8901,10 +9000,11 @@ const EmptyState = forwardRef(
|
|
|
8901
9000
|
"text-primary-500 dark:text-primary-400",
|
|
8902
9001
|
"max-w-sm mb-4"
|
|
8903
9002
|
),
|
|
9003
|
+
"data-testid": testId ? `${testId}-description` : void 0,
|
|
8904
9004
|
children: description
|
|
8905
9005
|
}
|
|
8906
9006
|
),
|
|
8907
|
-
action && /* @__PURE__ */ jsx("div", { className: "mt-2", children: action })
|
|
9007
|
+
action && /* @__PURE__ */ jsx("div", { className: "mt-2", "data-testid": testId ? `${testId}-action` : void 0, children: action })
|
|
8908
9008
|
]
|
|
8909
9009
|
}
|
|
8910
9010
|
);
|
|
@@ -8913,7 +9013,7 @@ const EmptyState = forwardRef(
|
|
|
8913
9013
|
EmptyState.displayName = "EmptyState";
|
|
8914
9014
|
const ChevronLeftIcon = () => /* @__PURE__ */ jsx("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) });
|
|
8915
9015
|
const ChevronRightIcon = () => /* @__PURE__ */ jsx("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) });
|
|
8916
|
-
const sizeStyles$
|
|
9016
|
+
const sizeStyles$3 = {
|
|
8917
9017
|
sm: { button: "h-8 min-w-8 px-2 text-sm", text: "text-sm" },
|
|
8918
9018
|
md: { button: "h-10 min-w-10 px-3 text-sm", text: "text-sm" }
|
|
8919
9019
|
};
|
|
@@ -8960,10 +9060,11 @@ function Pagination({
|
|
|
8960
9060
|
totalItems,
|
|
8961
9061
|
disabled = false,
|
|
8962
9062
|
size: size2 = "md",
|
|
8963
|
-
className
|
|
9063
|
+
className,
|
|
9064
|
+
testId
|
|
8964
9065
|
}) {
|
|
8965
9066
|
const pageSizeId = useId$1();
|
|
8966
|
-
const currentSize = sizeStyles$
|
|
9067
|
+
const currentSize = sizeStyles$3[size2];
|
|
8967
9068
|
const canGoPrevious = currentPage > 1;
|
|
8968
9069
|
const canGoNext = currentPage < totalPages;
|
|
8969
9070
|
const pageNumbers = useMemo(
|
|
@@ -8993,13 +9094,14 @@ function Pagination({
|
|
|
8993
9094
|
};
|
|
8994
9095
|
if (variant === "load-more") {
|
|
8995
9096
|
if (!canGoNext) return null;
|
|
8996
|
-
return /* @__PURE__ */ jsx("div", { className: cn("flex justify-center", className), children: /* @__PURE__ */ jsx(
|
|
9097
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex justify-center", className), "data-testid": testId, children: /* @__PURE__ */ jsx(
|
|
8997
9098
|
Button,
|
|
8998
9099
|
{
|
|
8999
9100
|
variant: "secondary",
|
|
9000
9101
|
size: size2 === "sm" ? "sm" : "md",
|
|
9001
9102
|
onClick: handleNext,
|
|
9002
9103
|
disabled,
|
|
9104
|
+
"data-testid": testId ? `${testId}-load-more` : void 0,
|
|
9003
9105
|
children: "Load more"
|
|
9004
9106
|
}
|
|
9005
9107
|
) });
|
|
@@ -9010,6 +9112,7 @@ function Pagination({
|
|
|
9010
9112
|
{
|
|
9011
9113
|
"aria-label": "Pagination",
|
|
9012
9114
|
className: cn("flex items-center justify-between gap-4", className),
|
|
9115
|
+
"data-testid": testId,
|
|
9013
9116
|
children: [
|
|
9014
9117
|
/* @__PURE__ */ jsxs(
|
|
9015
9118
|
Button,
|
|
@@ -9019,6 +9122,7 @@ function Pagination({
|
|
|
9019
9122
|
onClick: handlePrevious,
|
|
9020
9123
|
disabled: disabled || !canGoPrevious,
|
|
9021
9124
|
"aria-label": "Previous page",
|
|
9125
|
+
"data-testid": testId ? `${testId}-prev` : void 0,
|
|
9022
9126
|
children: [
|
|
9023
9127
|
/* @__PURE__ */ jsx(ChevronLeftIcon, {}),
|
|
9024
9128
|
/* @__PURE__ */ jsx("span", { className: "ml-1", children: "Previous" })
|
|
@@ -9039,6 +9143,7 @@ function Pagination({
|
|
|
9039
9143
|
onClick: handleNext,
|
|
9040
9144
|
disabled: disabled || !canGoNext,
|
|
9041
9145
|
"aria-label": "Next page",
|
|
9146
|
+
"data-testid": testId ? `${testId}-next` : void 0,
|
|
9042
9147
|
children: [
|
|
9043
9148
|
/* @__PURE__ */ jsx("span", { className: "mr-1", children: "Next" }),
|
|
9044
9149
|
/* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
@@ -9054,6 +9159,7 @@ function Pagination({
|
|
|
9054
9159
|
{
|
|
9055
9160
|
"aria-label": "Pagination",
|
|
9056
9161
|
className: cn("flex items-center justify-between gap-4", className),
|
|
9162
|
+
"data-testid": testId,
|
|
9057
9163
|
children: [
|
|
9058
9164
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
9059
9165
|
itemsRange && /* @__PURE__ */ jsxs("span", { className: cn("text-primary-600 dark:text-primary-400", currentSize.text), children: [
|
|
@@ -9100,6 +9206,7 @@ function Pagination({
|
|
|
9100
9206
|
onClick: handlePrevious,
|
|
9101
9207
|
disabled: disabled || !canGoPrevious,
|
|
9102
9208
|
"aria-label": "Previous page",
|
|
9209
|
+
"data-testid": testId ? `${testId}-prev` : void 0,
|
|
9103
9210
|
className: cn(
|
|
9104
9211
|
"inline-flex items-center justify-center rounded-md",
|
|
9105
9212
|
"border border-primary-300 dark:border-primary-600",
|
|
@@ -9134,6 +9241,7 @@ function Pagination({
|
|
|
9134
9241
|
disabled,
|
|
9135
9242
|
"aria-label": `Page ${page}`,
|
|
9136
9243
|
"aria-current": page === currentPage ? "page" : void 0,
|
|
9244
|
+
"data-testid": testId ? `${testId}-page-${page}` : void 0,
|
|
9137
9245
|
className: cn(
|
|
9138
9246
|
"inline-flex items-center justify-center rounded-md",
|
|
9139
9247
|
"border transition-colors",
|
|
@@ -9162,6 +9270,7 @@ function Pagination({
|
|
|
9162
9270
|
onClick: handleNext,
|
|
9163
9271
|
disabled: disabled || !canGoNext,
|
|
9164
9272
|
"aria-label": "Next page",
|
|
9273
|
+
"data-testid": testId ? `${testId}-next` : void 0,
|
|
9165
9274
|
className: cn(
|
|
9166
9275
|
"inline-flex items-center justify-center rounded-md",
|
|
9167
9276
|
"border border-primary-300 dark:border-primary-600",
|
|
@@ -9229,7 +9338,8 @@ function MultiSelect({
|
|
|
9229
9338
|
required = false,
|
|
9230
9339
|
disabled = false,
|
|
9231
9340
|
fullWidth = false,
|
|
9232
|
-
className
|
|
9341
|
+
className,
|
|
9342
|
+
testId
|
|
9233
9343
|
}) {
|
|
9234
9344
|
const [query, setQuery] = useState("");
|
|
9235
9345
|
const searchInputRef = useRef(null);
|
|
@@ -9285,12 +9395,13 @@ function MultiSelect({
|
|
|
9285
9395
|
};
|
|
9286
9396
|
const displayedChips = selectedOptions.slice(0, maxDisplayedItems);
|
|
9287
9397
|
const hiddenCount = selectedOptions.length - maxDisplayedItems;
|
|
9288
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto", className), children: [
|
|
9398
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto", className), "data-testid": testId, children: [
|
|
9289
9399
|
label && /* @__PURE__ */ jsxs(
|
|
9290
9400
|
"label",
|
|
9291
9401
|
{
|
|
9292
9402
|
id: labelId,
|
|
9293
9403
|
className: "mb-2 block text-sm font-medium text-primary-700 dark:text-white",
|
|
9404
|
+
"data-testid": testId ? `${testId}-label` : void 0,
|
|
9294
9405
|
children: [
|
|
9295
9406
|
label,
|
|
9296
9407
|
required && /* @__PURE__ */ jsx("span", { className: "ml-1 text-error", children: "*" })
|
|
@@ -9318,7 +9429,7 @@ function MultiSelect({
|
|
|
9318
9429
|
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
9430
|
),
|
|
9320
9431
|
children: [
|
|
9321
|
-
displayedChips.map((option) => /* @__PURE__ */ jsxs(
|
|
9432
|
+
displayedChips.map((option, index2) => /* @__PURE__ */ jsxs(
|
|
9322
9433
|
"span",
|
|
9323
9434
|
{
|
|
9324
9435
|
className: cn(
|
|
@@ -9326,6 +9437,7 @@ function MultiSelect({
|
|
|
9326
9437
|
"bg-primary-100 dark:bg-primary-700",
|
|
9327
9438
|
"text-sm text-primary-700 dark:text-primary-200"
|
|
9328
9439
|
),
|
|
9440
|
+
"data-testid": testId ? `${testId}-chip-${index2}` : void 0,
|
|
9329
9441
|
children: [
|
|
9330
9442
|
option.label,
|
|
9331
9443
|
/* @__PURE__ */ jsx(
|
|
@@ -9386,6 +9498,7 @@ function MultiSelect({
|
|
|
9386
9498
|
{
|
|
9387
9499
|
static: true,
|
|
9388
9500
|
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",
|
|
9501
|
+
"data-testid": testId ? `${testId}-options` : void 0,
|
|
9389
9502
|
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
9503
|
/* @__PURE__ */ jsx(Spinner, { size: "sm", color: "primary" }),
|
|
9391
9504
|
/* @__PURE__ */ jsx("span", { children: loadingText })
|
|
@@ -9401,6 +9514,7 @@ function MultiSelect({
|
|
|
9401
9514
|
value: query,
|
|
9402
9515
|
onChange: handleSearchChange,
|
|
9403
9516
|
placeholder: "Search...",
|
|
9517
|
+
"data-testid": testId ? `${testId}-input` : void 0,
|
|
9404
9518
|
className: cn(
|
|
9405
9519
|
"w-full rounded border border-primary-300 px-2 py-1 text-sm",
|
|
9406
9520
|
"bg-white dark:bg-primary-900",
|
|
@@ -9442,11 +9556,12 @@ function MultiSelect({
|
|
|
9442
9556
|
]
|
|
9443
9557
|
}
|
|
9444
9558
|
),
|
|
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(
|
|
9559
|
+
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
9560
|
It,
|
|
9447
9561
|
{
|
|
9448
9562
|
value: option.value,
|
|
9449
9563
|
disabled: option.disabled,
|
|
9564
|
+
"data-testid": testId ? `${testId}-option-${index2}` : void 0,
|
|
9450
9565
|
className: ({ active }) => cn(
|
|
9451
9566
|
"flex cursor-pointer items-center gap-2 px-4 py-2.5",
|
|
9452
9567
|
active && "bg-primary-50 dark:bg-primary-700",
|
|
@@ -9480,6 +9595,7 @@ function MultiSelect({
|
|
|
9480
9595
|
"p",
|
|
9481
9596
|
{
|
|
9482
9597
|
role: hasError ? "alert" : void 0,
|
|
9598
|
+
"data-testid": testId ? hasError ? `${testId}-error` : `${testId}-helper-text` : void 0,
|
|
9483
9599
|
className: cn(
|
|
9484
9600
|
"mt-1.5 text-sm",
|
|
9485
9601
|
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
@@ -9510,7 +9626,7 @@ function isItemActive(currentPath, href, matcher = "exact") {
|
|
|
9510
9626
|
return false;
|
|
9511
9627
|
}
|
|
9512
9628
|
}
|
|
9513
|
-
const sizeStyles = {
|
|
9629
|
+
const sizeStyles$2 = {
|
|
9514
9630
|
sm: "px-2 py-1.5 text-xs gap-2",
|
|
9515
9631
|
md: "px-3 py-2.5 text-sm gap-3",
|
|
9516
9632
|
lg: "px-4 py-3 text-base gap-3"
|
|
@@ -9548,6 +9664,7 @@ function SidebarItem({
|
|
|
9548
9664
|
onNavigate,
|
|
9549
9665
|
LinkComponent,
|
|
9550
9666
|
className,
|
|
9667
|
+
testId,
|
|
9551
9668
|
...props
|
|
9552
9669
|
}) {
|
|
9553
9670
|
if (!shouldShowItem(item)) {
|
|
@@ -9594,6 +9711,7 @@ function SidebarItem({
|
|
|
9594
9711
|
disabled: item.disabled,
|
|
9595
9712
|
"aria-label": item["aria-label"] || item.label,
|
|
9596
9713
|
title: collapsed ? item.label : void 0,
|
|
9714
|
+
"data-testid": testId,
|
|
9597
9715
|
className: cn(
|
|
9598
9716
|
// Base styles
|
|
9599
9717
|
"flex w-full items-center rounded-lg font-medium",
|
|
@@ -9601,7 +9719,7 @@ function SidebarItem({
|
|
|
9601
9719
|
"focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:ring-offset-2",
|
|
9602
9720
|
"dark:focus:ring-offset-primary-900",
|
|
9603
9721
|
// Size styles
|
|
9604
|
-
sizeStyles[size2],
|
|
9722
|
+
sizeStyles$2[size2],
|
|
9605
9723
|
// State styles
|
|
9606
9724
|
item.disabled && "opacity-50 cursor-not-allowed",
|
|
9607
9725
|
!item.disabled && !isActive && [
|
|
@@ -9626,6 +9744,7 @@ function SidebarItem({
|
|
|
9626
9744
|
{
|
|
9627
9745
|
to: item.href,
|
|
9628
9746
|
onClick: handleClick,
|
|
9747
|
+
"data-testid": testId,
|
|
9629
9748
|
className: cn(
|
|
9630
9749
|
// Base styles
|
|
9631
9750
|
"flex items-center rounded-lg font-medium",
|
|
@@ -9633,7 +9752,7 @@ function SidebarItem({
|
|
|
9633
9752
|
"focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:ring-offset-2",
|
|
9634
9753
|
"dark:focus:ring-offset-primary-900",
|
|
9635
9754
|
// Size styles
|
|
9636
|
-
sizeStyles[size2],
|
|
9755
|
+
sizeStyles$2[size2],
|
|
9637
9756
|
// State styles
|
|
9638
9757
|
item.disabled && "opacity-50 cursor-not-allowed pointer-events-none",
|
|
9639
9758
|
!item.disabled && !isActive && [
|
|
@@ -9734,7 +9853,7 @@ const SidebarDivider = forwardRef(
|
|
|
9734
9853
|
}
|
|
9735
9854
|
);
|
|
9736
9855
|
SidebarDivider.displayName = "SidebarDivider";
|
|
9737
|
-
const variantStyles = {
|
|
9856
|
+
const variantStyles$1 = {
|
|
9738
9857
|
default: [
|
|
9739
9858
|
"bg-white border-r border-gold-500/40",
|
|
9740
9859
|
"dark:bg-primary-900 dark:border-gold-500/20"
|
|
@@ -9763,6 +9882,7 @@ const Sidebar = forwardRef(
|
|
|
9763
9882
|
collapsedWidth = "4rem",
|
|
9764
9883
|
className,
|
|
9765
9884
|
"aria-label": ariaLabel = "Main navigation",
|
|
9885
|
+
testId,
|
|
9766
9886
|
...props
|
|
9767
9887
|
}, ref) => {
|
|
9768
9888
|
useEffect(() => {
|
|
@@ -9870,6 +9990,7 @@ const Sidebar = forwardRef(
|
|
|
9870
9990
|
"focus:outline-none focus:ring-2 focus:ring-primary-500/20"
|
|
9871
9991
|
),
|
|
9872
9992
|
"aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
9993
|
+
"data-testid": testId ? `${testId}-toggle` : void 0,
|
|
9873
9994
|
children: /* @__PURE__ */ jsx(
|
|
9874
9995
|
"svg",
|
|
9875
9996
|
{
|
|
@@ -9901,7 +10022,8 @@ const Sidebar = forwardRef(
|
|
|
9901
10022
|
{
|
|
9902
10023
|
className: "fixed inset-0 z-40 bg-black/20 lg:hidden",
|
|
9903
10024
|
onClick: handleOverlayClick,
|
|
9904
|
-
"aria-hidden": "true"
|
|
10025
|
+
"aria-hidden": "true",
|
|
10026
|
+
"data-testid": testId ? `${testId}-overlay` : void 0
|
|
9905
10027
|
}
|
|
9906
10028
|
),
|
|
9907
10029
|
/* @__PURE__ */ jsx(
|
|
@@ -9917,11 +10039,12 @@ const Sidebar = forwardRef(
|
|
|
9917
10039
|
// Mobile styles
|
|
9918
10040
|
isOpen ? "translate-x-0" : "-translate-x-full",
|
|
9919
10041
|
// Variant styles
|
|
9920
|
-
variantStyles[variant],
|
|
10042
|
+
variantStyles$1[variant],
|
|
9921
10043
|
className
|
|
9922
10044
|
),
|
|
9923
10045
|
style: { width: sidebarWidth },
|
|
9924
10046
|
"aria-label": ariaLabel,
|
|
10047
|
+
"data-testid": testId,
|
|
9925
10048
|
...props,
|
|
9926
10049
|
children: sidebarContent
|
|
9927
10050
|
}
|
|
@@ -9930,7 +10053,521 @@ const Sidebar = forwardRef(
|
|
|
9930
10053
|
}
|
|
9931
10054
|
);
|
|
9932
10055
|
Sidebar.displayName = "Sidebar";
|
|
10056
|
+
const CheckCircleIcon = () => /* @__PURE__ */ jsx("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) });
|
|
10057
|
+
const XCircleIcon = () => /* @__PURE__ */ jsx("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9.75 9.75l4.5 4.5m0-4.5l-4.5 4.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) });
|
|
10058
|
+
const ExclamationCircleIcon = () => /* @__PURE__ */ jsx("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z" }) });
|
|
10059
|
+
const InformationCircleIcon = () => /* @__PURE__ */ jsx("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" }) });
|
|
10060
|
+
const XMarkIcon = () => /* @__PURE__ */ jsx("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) });
|
|
10061
|
+
const defaultIcons = {
|
|
10062
|
+
success: /* @__PURE__ */ jsx(CheckCircleIcon, {}),
|
|
10063
|
+
error: /* @__PURE__ */ jsx(XCircleIcon, {}),
|
|
10064
|
+
warning: /* @__PURE__ */ jsx(ExclamationCircleIcon, {}),
|
|
10065
|
+
info: /* @__PURE__ */ jsx(InformationCircleIcon, {})
|
|
10066
|
+
};
|
|
10067
|
+
const variantStyles = {
|
|
10068
|
+
success: {
|
|
10069
|
+
container: cn(
|
|
10070
|
+
"bg-success-light border-success/20 text-[#166534]",
|
|
10071
|
+
"dark:bg-success/10 dark:border-success/30 dark:text-[#86efac]"
|
|
10072
|
+
),
|
|
10073
|
+
icon: "text-success dark:text-[#4ade80]",
|
|
10074
|
+
title: "text-[#14532d] dark:text-[#bbf7d0]"
|
|
10075
|
+
},
|
|
10076
|
+
error: {
|
|
10077
|
+
container: cn(
|
|
10078
|
+
"bg-error-light border-error/20 text-[#991b1b]",
|
|
10079
|
+
"dark:bg-error/10 dark:border-error/30 dark:text-[#fca5a5]"
|
|
10080
|
+
),
|
|
10081
|
+
icon: "text-error dark:text-[#f87171]",
|
|
10082
|
+
title: "text-[#7f1d1d] dark:text-[#fecaca]"
|
|
10083
|
+
},
|
|
10084
|
+
warning: {
|
|
10085
|
+
container: cn(
|
|
10086
|
+
"bg-warning-light border-warning/20 text-[#854d0e]",
|
|
10087
|
+
"dark:bg-warning/10 dark:border-warning/30 dark:text-[#fde047]"
|
|
10088
|
+
),
|
|
10089
|
+
icon: "text-warning dark:text-[#facc15]",
|
|
10090
|
+
title: "text-[#713f12] dark:text-[#fef08a]"
|
|
10091
|
+
},
|
|
10092
|
+
info: {
|
|
10093
|
+
container: cn(
|
|
10094
|
+
"bg-info-light border-info/20 text-[#1e40af]",
|
|
10095
|
+
"dark:bg-info/10 dark:border-info/30 dark:text-[#93c5fd]"
|
|
10096
|
+
),
|
|
10097
|
+
icon: "text-info dark:text-[#60a5fa]",
|
|
10098
|
+
title: "text-[#1e3a8a] dark:text-[#bfdbfe]"
|
|
10099
|
+
}
|
|
10100
|
+
};
|
|
10101
|
+
const Alert = forwardRef(
|
|
10102
|
+
({ variant = "info", title, message, icon, onClose, className, testId, ...props }, ref) => {
|
|
10103
|
+
const styles = variantStyles[variant];
|
|
10104
|
+
const displayIcon = icon === null ? null : icon ?? defaultIcons[variant];
|
|
10105
|
+
return /* @__PURE__ */ jsx(
|
|
10106
|
+
"div",
|
|
10107
|
+
{
|
|
10108
|
+
ref,
|
|
10109
|
+
role: "alert",
|
|
10110
|
+
className: cn(
|
|
10111
|
+
"rounded-lg border p-4",
|
|
10112
|
+
styles.container,
|
|
10113
|
+
className
|
|
10114
|
+
),
|
|
10115
|
+
"data-testid": testId,
|
|
10116
|
+
...props,
|
|
10117
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-start", children: [
|
|
10118
|
+
displayIcon !== null && /* @__PURE__ */ jsx(
|
|
10119
|
+
"div",
|
|
10120
|
+
{
|
|
10121
|
+
className: cn("flex-shrink-0", styles.icon),
|
|
10122
|
+
"aria-hidden": "true",
|
|
10123
|
+
"data-testid": testId ? `${testId}-icon` : void 0,
|
|
10124
|
+
children: displayIcon
|
|
10125
|
+
}
|
|
10126
|
+
),
|
|
10127
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex-1", displayIcon !== null && "ml-3"), children: [
|
|
10128
|
+
title && /* @__PURE__ */ jsx("h3", { className: cn("text-sm font-medium", styles.title), children: title }),
|
|
10129
|
+
/* @__PURE__ */ jsx("div", { className: cn("text-sm", title && "mt-1"), children: message })
|
|
10130
|
+
] }),
|
|
10131
|
+
onClose && /* @__PURE__ */ jsx("div", { className: "ml-3 flex-shrink-0", children: /* @__PURE__ */ jsxs(
|
|
10132
|
+
"button",
|
|
10133
|
+
{
|
|
10134
|
+
type: "button",
|
|
10135
|
+
onClick: onClose,
|
|
10136
|
+
className: cn(
|
|
10137
|
+
"inline-flex rounded-md p-1.5",
|
|
10138
|
+
"hover:opacity-75 focus:outline-none focus:ring-2 focus:ring-offset-2",
|
|
10139
|
+
"focus:ring-current/20",
|
|
10140
|
+
"dark:focus:ring-offset-primary-900"
|
|
10141
|
+
),
|
|
10142
|
+
"data-testid": testId ? `${testId}-close-button` : void 0,
|
|
10143
|
+
children: [
|
|
10144
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Dismiss" }),
|
|
10145
|
+
/* @__PURE__ */ jsx(XMarkIcon, {})
|
|
10146
|
+
]
|
|
10147
|
+
}
|
|
10148
|
+
) })
|
|
10149
|
+
] })
|
|
10150
|
+
}
|
|
10151
|
+
);
|
|
10152
|
+
}
|
|
10153
|
+
);
|
|
10154
|
+
Alert.displayName = "Alert";
|
|
10155
|
+
const sizeStyles$1 = {
|
|
10156
|
+
xs: { container: "w-6 h-6", text: "text-xs", status: "w-2 h-2 border" },
|
|
10157
|
+
sm: { container: "w-8 h-8", text: "text-sm", status: "w-2.5 h-2.5 border" },
|
|
10158
|
+
md: { container: "w-10 h-10", text: "text-base", status: "w-3 h-3 border-2" },
|
|
10159
|
+
lg: { container: "w-12 h-12", text: "text-lg", status: "w-3.5 h-3.5 border-2" },
|
|
10160
|
+
xl: { container: "w-16 h-16", text: "text-2xl", status: "w-4 h-4 border-2" }
|
|
10161
|
+
};
|
|
10162
|
+
const statusStyles = {
|
|
10163
|
+
online: "bg-success",
|
|
10164
|
+
offline: "bg-primary-400 dark:bg-primary-500",
|
|
10165
|
+
away: "bg-warning",
|
|
10166
|
+
busy: "bg-error"
|
|
10167
|
+
};
|
|
10168
|
+
const Avatar = forwardRef(
|
|
10169
|
+
({ name, src, size: size2 = "md", alt, status, className, testId, ...props }, ref) => {
|
|
10170
|
+
const getInitials = (fullName) => {
|
|
10171
|
+
const names = fullName.trim().split(" ");
|
|
10172
|
+
if (names.length === 1) {
|
|
10173
|
+
return names[0]?.charAt(0).toUpperCase() || "";
|
|
10174
|
+
}
|
|
10175
|
+
const firstName = names[0];
|
|
10176
|
+
const lastName = names[names.length - 1];
|
|
10177
|
+
return ((firstName?.charAt(0) || "") + (lastName?.charAt(0) || "")).toUpperCase();
|
|
10178
|
+
};
|
|
10179
|
+
const initials = getInitials(name);
|
|
10180
|
+
const styles = sizeStyles$1[size2];
|
|
10181
|
+
return /* @__PURE__ */ jsxs(
|
|
10182
|
+
"div",
|
|
10183
|
+
{
|
|
10184
|
+
ref,
|
|
10185
|
+
className: cn(
|
|
10186
|
+
"relative inline-flex items-center justify-center",
|
|
10187
|
+
"rounded-full font-medium",
|
|
10188
|
+
// Light mode
|
|
10189
|
+
"bg-gold-500 text-white",
|
|
10190
|
+
// Dark mode
|
|
10191
|
+
"dark:bg-gold-600 dark:text-white",
|
|
10192
|
+
styles.container,
|
|
10193
|
+
className
|
|
10194
|
+
),
|
|
10195
|
+
"data-testid": testId,
|
|
10196
|
+
...props,
|
|
10197
|
+
children: [
|
|
10198
|
+
src ? /* @__PURE__ */ jsx(
|
|
10199
|
+
"img",
|
|
10200
|
+
{
|
|
10201
|
+
src,
|
|
10202
|
+
alt: alt || `${name}'s avatar`,
|
|
10203
|
+
className: "w-full h-full rounded-full object-cover",
|
|
10204
|
+
"data-testid": testId ? `${testId}-image` : void 0
|
|
10205
|
+
}
|
|
10206
|
+
) : /* @__PURE__ */ jsx("span", { className: styles.text, children: initials }),
|
|
10207
|
+
status && /* @__PURE__ */ jsx(
|
|
10208
|
+
"span",
|
|
10209
|
+
{
|
|
10210
|
+
role: "status",
|
|
10211
|
+
className: cn(
|
|
10212
|
+
"absolute bottom-0 right-0 rounded-full",
|
|
10213
|
+
"border-white dark:border-primary-900",
|
|
10214
|
+
styles.status,
|
|
10215
|
+
statusStyles[status]
|
|
10216
|
+
),
|
|
10217
|
+
"aria-label": `Status: ${status}`,
|
|
10218
|
+
"data-testid": testId ? `${testId}-status` : void 0
|
|
10219
|
+
}
|
|
10220
|
+
)
|
|
10221
|
+
]
|
|
10222
|
+
}
|
|
10223
|
+
);
|
|
10224
|
+
}
|
|
10225
|
+
);
|
|
10226
|
+
Avatar.displayName = "Avatar";
|
|
10227
|
+
const OTPInput = ({
|
|
10228
|
+
length = 6,
|
|
10229
|
+
value,
|
|
10230
|
+
onChange,
|
|
10231
|
+
error: error2,
|
|
10232
|
+
disabled = false,
|
|
10233
|
+
autoFocus = false,
|
|
10234
|
+
label = "One-time password",
|
|
10235
|
+
className
|
|
10236
|
+
}) => {
|
|
10237
|
+
const inputRefs = useRef([]);
|
|
10238
|
+
const digits = value.split("").slice(0, length);
|
|
10239
|
+
while (digits.length < length) {
|
|
10240
|
+
digits.push("");
|
|
10241
|
+
}
|
|
10242
|
+
const focusInput = useCallback((index2) => {
|
|
10243
|
+
const input = inputRefs.current[index2];
|
|
10244
|
+
if (input) {
|
|
10245
|
+
input.focus();
|
|
10246
|
+
input.select();
|
|
10247
|
+
}
|
|
10248
|
+
}, []);
|
|
10249
|
+
const handleChange = useCallback(
|
|
10250
|
+
(index2, event_) => {
|
|
10251
|
+
const newValue = event_.target.value;
|
|
10252
|
+
if (!/^\d*$/.test(newValue)) return;
|
|
10253
|
+
const digit = newValue.slice(-1);
|
|
10254
|
+
const newDigits = [...digits];
|
|
10255
|
+
newDigits[index2] = digit;
|
|
10256
|
+
const newOtp = newDigits.join("");
|
|
10257
|
+
onChange(newOtp);
|
|
10258
|
+
if (digit && index2 < length - 1) {
|
|
10259
|
+
focusInput(index2 + 1);
|
|
10260
|
+
}
|
|
10261
|
+
},
|
|
10262
|
+
[digits, length, onChange, focusInput]
|
|
10263
|
+
);
|
|
10264
|
+
const handleKeyDown = useCallback(
|
|
10265
|
+
(index2, event_) => {
|
|
10266
|
+
switch (event_.key) {
|
|
10267
|
+
case "Backspace":
|
|
10268
|
+
if (!digits[index2] && index2 > 0) {
|
|
10269
|
+
event_.preventDefault();
|
|
10270
|
+
const newDigits = [...digits];
|
|
10271
|
+
newDigits[index2 - 1] = "";
|
|
10272
|
+
onChange(newDigits.join(""));
|
|
10273
|
+
focusInput(index2 - 1);
|
|
10274
|
+
} else if (digits[index2]) {
|
|
10275
|
+
const newDigits = [...digits];
|
|
10276
|
+
newDigits[index2] = "";
|
|
10277
|
+
onChange(newDigits.join(""));
|
|
10278
|
+
}
|
|
10279
|
+
break;
|
|
10280
|
+
case "ArrowLeft":
|
|
10281
|
+
event_.preventDefault();
|
|
10282
|
+
if (index2 > 0) {
|
|
10283
|
+
focusInput(index2 - 1);
|
|
10284
|
+
}
|
|
10285
|
+
break;
|
|
10286
|
+
case "ArrowRight":
|
|
10287
|
+
event_.preventDefault();
|
|
10288
|
+
if (index2 < length - 1) {
|
|
10289
|
+
focusInput(index2 + 1);
|
|
10290
|
+
}
|
|
10291
|
+
break;
|
|
10292
|
+
case "Delete": {
|
|
10293
|
+
event_.preventDefault();
|
|
10294
|
+
const newDigits = [...digits];
|
|
10295
|
+
newDigits[index2] = "";
|
|
10296
|
+
onChange(newDigits.join(""));
|
|
10297
|
+
break;
|
|
10298
|
+
}
|
|
10299
|
+
}
|
|
10300
|
+
},
|
|
10301
|
+
[digits, length, onChange, focusInput]
|
|
10302
|
+
);
|
|
10303
|
+
const handlePaste = useCallback(
|
|
10304
|
+
(event_) => {
|
|
10305
|
+
event_.preventDefault();
|
|
10306
|
+
const pastedData = event_.clipboardData.getData("text");
|
|
10307
|
+
const pastedDigits = pastedData.replace(/\D/g, "").slice(0, length);
|
|
10308
|
+
if (pastedDigits) {
|
|
10309
|
+
onChange(pastedDigits);
|
|
10310
|
+
const focusIndex = Math.min(pastedDigits.length, length - 1);
|
|
10311
|
+
focusInput(focusIndex);
|
|
10312
|
+
}
|
|
10313
|
+
},
|
|
10314
|
+
[length, onChange, focusInput]
|
|
10315
|
+
);
|
|
10316
|
+
const errorId = error2 ? "otp-input-error" : void 0;
|
|
10317
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), "data-testid": "otp-input", children: [
|
|
10318
|
+
/* @__PURE__ */ jsx(
|
|
10319
|
+
"div",
|
|
10320
|
+
{
|
|
10321
|
+
role: "group",
|
|
10322
|
+
"aria-label": label,
|
|
10323
|
+
"aria-describedby": errorId,
|
|
10324
|
+
className: "flex justify-center gap-2 sm:gap-3",
|
|
10325
|
+
children: digits.map((digit, index2) => /* @__PURE__ */ jsx(
|
|
10326
|
+
"input",
|
|
10327
|
+
{
|
|
10328
|
+
ref: (element) => {
|
|
10329
|
+
inputRefs.current[index2] = element;
|
|
10330
|
+
},
|
|
10331
|
+
type: "text",
|
|
10332
|
+
inputMode: "numeric",
|
|
10333
|
+
pattern: "\\d*",
|
|
10334
|
+
maxLength: 1,
|
|
10335
|
+
value: digit,
|
|
10336
|
+
disabled,
|
|
10337
|
+
autoFocus: autoFocus && index2 === 0,
|
|
10338
|
+
"aria-label": `Digit ${index2 + 1} of ${length}`,
|
|
10339
|
+
"aria-invalid": !!error2,
|
|
10340
|
+
"data-testid": `otp-input-digit-${index2}`,
|
|
10341
|
+
className: cn(
|
|
10342
|
+
"w-10 h-12 sm:w-12 sm:h-14",
|
|
10343
|
+
"text-center text-xl sm:text-2xl font-semibold",
|
|
10344
|
+
"border-2 rounded-lg",
|
|
10345
|
+
"focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500",
|
|
10346
|
+
"transition-colors duration-200",
|
|
10347
|
+
// Light mode
|
|
10348
|
+
error2 ? "border-error bg-error-light" : "border-primary-300 bg-white",
|
|
10349
|
+
// Dark mode
|
|
10350
|
+
error2 ? "dark:border-error dark:bg-error/10" : "dark:border-primary-600 dark:bg-primary-900 dark:text-white",
|
|
10351
|
+
"dark:focus:ring-primary-400 dark:focus:border-primary-400",
|
|
10352
|
+
disabled && "bg-primary-100 cursor-not-allowed opacity-50 dark:bg-primary-800"
|
|
10353
|
+
),
|
|
10354
|
+
onChange: (event_) => handleChange(index2, event_),
|
|
10355
|
+
onKeyDown: (event_) => handleKeyDown(index2, event_),
|
|
10356
|
+
onPaste: handlePaste,
|
|
10357
|
+
onFocus: (event_) => event_.target.select()
|
|
10358
|
+
},
|
|
10359
|
+
index2
|
|
10360
|
+
))
|
|
10361
|
+
}
|
|
10362
|
+
),
|
|
10363
|
+
error2 && /* @__PURE__ */ jsx(
|
|
10364
|
+
"p",
|
|
10365
|
+
{
|
|
10366
|
+
id: errorId,
|
|
10367
|
+
role: "alert",
|
|
10368
|
+
"aria-live": "assertive",
|
|
10369
|
+
"data-testid": "otp-input-error",
|
|
10370
|
+
className: cn(
|
|
10371
|
+
"mt-2 text-sm text-center",
|
|
10372
|
+
"text-error dark:text-[#fca5a5]"
|
|
10373
|
+
),
|
|
10374
|
+
children: error2
|
|
10375
|
+
}
|
|
10376
|
+
)
|
|
10377
|
+
] });
|
|
10378
|
+
};
|
|
10379
|
+
const DateInput = forwardRef(
|
|
10380
|
+
({
|
|
10381
|
+
value,
|
|
10382
|
+
onChange,
|
|
10383
|
+
label,
|
|
10384
|
+
error: error2,
|
|
10385
|
+
helperText,
|
|
10386
|
+
fullWidth = false,
|
|
10387
|
+
disabled = false,
|
|
10388
|
+
className,
|
|
10389
|
+
id,
|
|
10390
|
+
required,
|
|
10391
|
+
min: min2,
|
|
10392
|
+
max: max2,
|
|
10393
|
+
...props
|
|
10394
|
+
}, ref) => {
|
|
10395
|
+
const inputId = id || label?.toLowerCase().replace(/\s+/g, "-");
|
|
10396
|
+
const hasError = !!error2;
|
|
10397
|
+
const errorId = hasError ? `${inputId}-error` : void 0;
|
|
10398
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto"), children: [
|
|
10399
|
+
label && /* @__PURE__ */ jsxs(
|
|
10400
|
+
"label",
|
|
10401
|
+
{
|
|
10402
|
+
htmlFor: inputId,
|
|
10403
|
+
className: "mb-2 block text-sm font-medium text-primary-700 dark:text-white",
|
|
10404
|
+
children: [
|
|
10405
|
+
label,
|
|
10406
|
+
required && /* @__PURE__ */ jsx("span", { className: "ml-1 text-error", children: "*" })
|
|
10407
|
+
]
|
|
10408
|
+
}
|
|
10409
|
+
),
|
|
10410
|
+
/* @__PURE__ */ jsx(
|
|
10411
|
+
"input",
|
|
10412
|
+
{
|
|
10413
|
+
ref,
|
|
10414
|
+
type: "date",
|
|
10415
|
+
id: inputId,
|
|
10416
|
+
"data-testid": "date-input",
|
|
10417
|
+
value: value || "",
|
|
10418
|
+
onChange: (event_) => onChange(event_.target.value || null),
|
|
10419
|
+
disabled,
|
|
10420
|
+
required,
|
|
10421
|
+
min: min2,
|
|
10422
|
+
max: max2,
|
|
10423
|
+
"aria-label": label ? void 0 : "Select date",
|
|
10424
|
+
"aria-invalid": hasError ? "true" : void 0,
|
|
10425
|
+
"aria-describedby": errorId,
|
|
10426
|
+
className: cn(
|
|
10427
|
+
// Base styles - Light mode
|
|
10428
|
+
"block w-full rounded-md border bg-white px-4 py-2.5 text-sm text-primary-900",
|
|
10429
|
+
"transition-colors duration-normal",
|
|
10430
|
+
"focus:outline-none focus:ring-2",
|
|
10431
|
+
"disabled:cursor-not-allowed disabled:bg-primary-50 disabled:text-primary-500",
|
|
10432
|
+
// Base styles - Dark mode
|
|
10433
|
+
"dark:bg-primary-800 dark:text-primary-100",
|
|
10434
|
+
"dark:disabled:bg-primary-900 dark:disabled:text-primary-600",
|
|
10435
|
+
// Border and focus styles
|
|
10436
|
+
hasError ? "border-error focus:border-error focus:ring-error/20 dark:border-error/70 dark:focus:ring-error/30" : "border-primary-300 focus:border-gold-500 focus:ring-gold-500/20 dark:border-primary-600 dark:focus:border-gold-400 dark:focus:ring-gold-400/30",
|
|
10437
|
+
// Custom className
|
|
10438
|
+
className
|
|
10439
|
+
),
|
|
10440
|
+
...props
|
|
10441
|
+
}
|
|
10442
|
+
),
|
|
10443
|
+
(error2 || helperText) && /* @__PURE__ */ jsx(
|
|
10444
|
+
"p",
|
|
10445
|
+
{
|
|
10446
|
+
id: errorId,
|
|
10447
|
+
role: hasError ? "alert" : void 0,
|
|
10448
|
+
className: cn(
|
|
10449
|
+
"mt-1.5 text-sm",
|
|
10450
|
+
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
10451
|
+
),
|
|
10452
|
+
children: error2 || helperText
|
|
10453
|
+
}
|
|
10454
|
+
)
|
|
10455
|
+
] });
|
|
10456
|
+
}
|
|
10457
|
+
);
|
|
10458
|
+
DateInput.displayName = "DateInput";
|
|
10459
|
+
const sizeStyles = {
|
|
10460
|
+
sm: "px-2.5 py-1 text-xs gap-1",
|
|
10461
|
+
md: "px-3 py-1.5 text-sm gap-1.5",
|
|
10462
|
+
lg: "px-4 py-2 text-base gap-2"
|
|
10463
|
+
};
|
|
10464
|
+
const checkmarkSize = {
|
|
10465
|
+
sm: "w-3 h-3",
|
|
10466
|
+
md: "w-4 h-4",
|
|
10467
|
+
lg: "w-5 h-5"
|
|
10468
|
+
};
|
|
10469
|
+
const PillSelector = forwardRef(
|
|
10470
|
+
({
|
|
10471
|
+
options,
|
|
10472
|
+
selected,
|
|
10473
|
+
onChange,
|
|
10474
|
+
multiple = true,
|
|
10475
|
+
size: size2 = "md",
|
|
10476
|
+
label,
|
|
10477
|
+
fullWidth = false,
|
|
10478
|
+
disabled = false,
|
|
10479
|
+
className,
|
|
10480
|
+
...props
|
|
10481
|
+
}, ref) => {
|
|
10482
|
+
const handleClick = (value) => {
|
|
10483
|
+
if (disabled) return;
|
|
10484
|
+
if (multiple) {
|
|
10485
|
+
if (selected.includes(value)) {
|
|
10486
|
+
onChange(selected.filter((v2) => v2 !== value));
|
|
10487
|
+
} else {
|
|
10488
|
+
onChange([...selected, value]);
|
|
10489
|
+
}
|
|
10490
|
+
} else {
|
|
10491
|
+
onChange([value]);
|
|
10492
|
+
}
|
|
10493
|
+
};
|
|
10494
|
+
return /* @__PURE__ */ jsxs(
|
|
10495
|
+
"div",
|
|
10496
|
+
{
|
|
10497
|
+
ref,
|
|
10498
|
+
className: cn(fullWidth ? "w-full" : "w-auto", className),
|
|
10499
|
+
...props,
|
|
10500
|
+
children: [
|
|
10501
|
+
label && /* @__PURE__ */ jsx("label", { className: "mb-2 block text-sm font-medium text-primary-700 dark:text-white", children: label }),
|
|
10502
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", role: "group", "aria-label": label, children: options.map((option) => {
|
|
10503
|
+
const isSelected = selected.includes(option.value);
|
|
10504
|
+
return /* @__PURE__ */ jsxs(
|
|
10505
|
+
"button",
|
|
10506
|
+
{
|
|
10507
|
+
type: "button",
|
|
10508
|
+
disabled,
|
|
10509
|
+
"aria-pressed": isSelected,
|
|
10510
|
+
onClick: () => handleClick(option.value),
|
|
10511
|
+
className: cn(
|
|
10512
|
+
"inline-flex items-center justify-center rounded-full border font-medium",
|
|
10513
|
+
"transition-colors duration-normal",
|
|
10514
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-1",
|
|
10515
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
10516
|
+
sizeStyles[size2],
|
|
10517
|
+
isSelected ? cn(
|
|
10518
|
+
// Light mode - selected
|
|
10519
|
+
"border-primary-700 bg-primary-700 text-white",
|
|
10520
|
+
"hover:bg-primary-800 hover:border-primary-800",
|
|
10521
|
+
"focus:ring-primary-500/30",
|
|
10522
|
+
// Dark mode - selected
|
|
10523
|
+
"dark:border-gold-500 dark:bg-gold-500 dark:text-primary-900",
|
|
10524
|
+
"dark:hover:bg-gold-400 dark:hover:border-gold-400",
|
|
10525
|
+
"dark:focus:ring-gold-400/30"
|
|
10526
|
+
) : cn(
|
|
10527
|
+
// Light mode - unselected
|
|
10528
|
+
"border-primary-300 bg-white text-primary-700",
|
|
10529
|
+
"hover:border-primary-400 hover:bg-primary-50",
|
|
10530
|
+
"focus:ring-primary-500/20",
|
|
10531
|
+
// Dark mode - unselected
|
|
10532
|
+
"dark:border-primary-600 dark:bg-primary-800 dark:text-primary-200",
|
|
10533
|
+
"dark:hover:border-primary-500 dark:hover:bg-primary-700",
|
|
10534
|
+
"dark:focus:ring-primary-400/20"
|
|
10535
|
+
)
|
|
10536
|
+
),
|
|
10537
|
+
children: [
|
|
10538
|
+
isSelected && /* @__PURE__ */ jsx(
|
|
10539
|
+
"svg",
|
|
10540
|
+
{
|
|
10541
|
+
className: checkmarkSize[size2],
|
|
10542
|
+
fill: "currentColor",
|
|
10543
|
+
viewBox: "0 0 20 20",
|
|
10544
|
+
"aria-hidden": "true",
|
|
10545
|
+
children: /* @__PURE__ */ jsx(
|
|
10546
|
+
"path",
|
|
10547
|
+
{
|
|
10548
|
+
fillRule: "evenodd",
|
|
10549
|
+
clipRule: "evenodd",
|
|
10550
|
+
d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z"
|
|
10551
|
+
}
|
|
10552
|
+
)
|
|
10553
|
+
}
|
|
10554
|
+
),
|
|
10555
|
+
option.icon,
|
|
10556
|
+
/* @__PURE__ */ jsx("span", { children: option.label })
|
|
10557
|
+
]
|
|
10558
|
+
},
|
|
10559
|
+
option.value
|
|
10560
|
+
);
|
|
10561
|
+
}) })
|
|
10562
|
+
]
|
|
10563
|
+
}
|
|
10564
|
+
);
|
|
10565
|
+
}
|
|
10566
|
+
);
|
|
10567
|
+
PillSelector.displayName = "PillSelector";
|
|
9933
10568
|
export {
|
|
10569
|
+
Alert,
|
|
10570
|
+
Avatar,
|
|
9934
10571
|
Badge,
|
|
9935
10572
|
Breadcrumbs,
|
|
9936
10573
|
Button,
|
|
@@ -9938,13 +10575,16 @@ export {
|
|
|
9938
10575
|
Checkbox,
|
|
9939
10576
|
Combobox,
|
|
9940
10577
|
ConfirmDialog,
|
|
10578
|
+
DateInput,
|
|
9941
10579
|
Drawer,
|
|
9942
10580
|
EmptyState,
|
|
9943
10581
|
Input,
|
|
9944
10582
|
Modal,
|
|
9945
10583
|
MultiSelect,
|
|
10584
|
+
OTPInput,
|
|
9946
10585
|
Pagination,
|
|
9947
10586
|
PasswordInput,
|
|
10587
|
+
PillSelector,
|
|
9948
10588
|
Radio,
|
|
9949
10589
|
RadioGroup,
|
|
9950
10590
|
Select,
|