@teja-app/ui 0.0.3 → 0.0.5
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 +15 -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 +16 -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/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/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/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/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.types.d.ts +3 -0
- package/dist/components/Select/Select.types.d.ts.map +1 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Select/index.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 +586 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +586 -72
- 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",
|
|
@@ -158,7 +158,7 @@ const Spinner = forwardRef(
|
|
|
158
158
|
ref,
|
|
159
159
|
className: cn(
|
|
160
160
|
"animate-spin",
|
|
161
|
-
sizeStyles$
|
|
161
|
+
sizeStyles$c[size2],
|
|
162
162
|
colorStyles[color],
|
|
163
163
|
className
|
|
164
164
|
),
|
|
@@ -7222,7 +7222,8 @@ function Select({
|
|
|
7222
7222
|
fullWidth = false,
|
|
7223
7223
|
className,
|
|
7224
7224
|
isLoading = false,
|
|
7225
|
-
loadingText = "Loading..."
|
|
7225
|
+
loadingText = "Loading...",
|
|
7226
|
+
placement = "bottom"
|
|
7226
7227
|
}) {
|
|
7227
7228
|
const selectedOption = options.find((opt) => opt.value === value);
|
|
7228
7229
|
const hasError = !!error2;
|
|
@@ -7296,43 +7297,52 @@ function Select({
|
|
|
7296
7297
|
leave: "transition ease-in duration-100",
|
|
7297
7298
|
leaveFrom: "opacity-100",
|
|
7298
7299
|
leaveTo: "opacity-0",
|
|
7299
|
-
children: /* @__PURE__ */ jsx(
|
|
7300
|
-
|
|
7300
|
+
children: /* @__PURE__ */ jsx(
|
|
7301
|
+
Bt,
|
|
7301
7302
|
{
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
"relative cursor-pointer select-none py-2.5 pl-10 pr-4",
|
|
7306
|
-
// Light mode
|
|
7307
|
-
active ? "bg-gold-50 text-primary-900" : "text-primary-900",
|
|
7308
|
-
// Dark mode
|
|
7309
|
-
active ? "dark:bg-primary-700 dark:text-primary-100" : "dark:text-primary-200",
|
|
7310
|
-
option.disabled && "cursor-not-allowed opacity-50",
|
|
7311
|
-
selected && "font-medium"
|
|
7303
|
+
className: cn(
|
|
7304
|
+
"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
|
+
placement === "top" ? "bottom-full mb-1" : "top-full mt-1"
|
|
7312
7306
|
),
|
|
7313
|
-
children: (
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
"
|
|
7322
|
-
|
|
7323
|
-
|
|
7307
|
+
children: options.map((option) => /* @__PURE__ */ jsx(
|
|
7308
|
+
It,
|
|
7309
|
+
{
|
|
7310
|
+
disabled: option.disabled,
|
|
7311
|
+
value: option.value,
|
|
7312
|
+
className: ({ active, selected }) => cn(
|
|
7313
|
+
"relative cursor-pointer select-none py-2.5 pl-10 pr-4",
|
|
7314
|
+
// Light mode
|
|
7315
|
+
active ? "bg-gold-50 text-primary-900" : "text-primary-900",
|
|
7316
|
+
// Dark mode
|
|
7317
|
+
active ? "dark:bg-primary-700 dark:text-primary-100" : "dark:text-primary-200",
|
|
7318
|
+
option.disabled && "cursor-not-allowed opacity-50",
|
|
7319
|
+
selected && "font-medium"
|
|
7320
|
+
),
|
|
7321
|
+
children: ({ selected }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7322
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate", children: option.label }),
|
|
7323
|
+
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(
|
|
7324
|
+
"svg",
|
|
7324
7325
|
{
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7326
|
+
className: "h-5 w-5",
|
|
7327
|
+
fill: "currentColor",
|
|
7328
|
+
viewBox: "0 0 20 20",
|
|
7329
|
+
"aria-hidden": "true",
|
|
7330
|
+
children: /* @__PURE__ */ jsx(
|
|
7331
|
+
"path",
|
|
7332
|
+
{
|
|
7333
|
+
clipRule: "evenodd",
|
|
7334
|
+
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",
|
|
7335
|
+
fillRule: "evenodd"
|
|
7336
|
+
}
|
|
7337
|
+
)
|
|
7328
7338
|
}
|
|
7329
|
-
)
|
|
7330
|
-
}
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
)
|
|
7339
|
+
) })
|
|
7340
|
+
] })
|
|
7341
|
+
},
|
|
7342
|
+
option.value
|
|
7343
|
+
))
|
|
7344
|
+
}
|
|
7345
|
+
)
|
|
7336
7346
|
}
|
|
7337
7347
|
)
|
|
7338
7348
|
] }) }),
|
|
@@ -7369,7 +7379,7 @@ const CloseIcon$2 = () => /* @__PURE__ */ jsx(
|
|
|
7369
7379
|
)
|
|
7370
7380
|
}
|
|
7371
7381
|
);
|
|
7372
|
-
const sizeStyles$
|
|
7382
|
+
const sizeStyles$b = {
|
|
7373
7383
|
sm: "max-w-[400px]",
|
|
7374
7384
|
md: "max-w-[560px]",
|
|
7375
7385
|
lg: "max-w-[720px]"
|
|
@@ -7422,7 +7432,7 @@ function Modal({
|
|
|
7422
7432
|
"bg-white border border-primary-200",
|
|
7423
7433
|
// Dark mode
|
|
7424
7434
|
"dark:bg-primary-800 dark:border-primary-700",
|
|
7425
|
-
sizeStyles$
|
|
7435
|
+
sizeStyles$b[size2],
|
|
7426
7436
|
className
|
|
7427
7437
|
),
|
|
7428
7438
|
children: [
|
|
@@ -7500,7 +7510,7 @@ const CloseIcon$1 = () => /* @__PURE__ */ jsx(
|
|
|
7500
7510
|
)
|
|
7501
7511
|
}
|
|
7502
7512
|
);
|
|
7503
|
-
const sizeStyles$
|
|
7513
|
+
const sizeStyles$a = {
|
|
7504
7514
|
sm: "max-w-[400px]",
|
|
7505
7515
|
md: "max-w-[560px]",
|
|
7506
7516
|
lg: "max-w-[720px]"
|
|
@@ -7549,7 +7559,7 @@ function Drawer({
|
|
|
7549
7559
|
"bg-white border-l border-primary-200",
|
|
7550
7560
|
// Dark mode
|
|
7551
7561
|
"dark:bg-primary-800 dark:border-primary-700",
|
|
7552
|
-
sizeStyles$
|
|
7562
|
+
sizeStyles$a[size2],
|
|
7553
7563
|
className
|
|
7554
7564
|
),
|
|
7555
7565
|
children: [
|
|
@@ -7665,7 +7675,7 @@ const paddingStyles = {
|
|
|
7665
7675
|
md: "p-6",
|
|
7666
7676
|
lg: "p-8"
|
|
7667
7677
|
};
|
|
7668
|
-
const variantStyles$
|
|
7678
|
+
const variantStyles$4 = {
|
|
7669
7679
|
default: [
|
|
7670
7680
|
"shadow-sm border border-primary-200",
|
|
7671
7681
|
"dark:border-primary-700"
|
|
@@ -7706,7 +7716,7 @@ const Card = forwardRef(
|
|
|
7706
7716
|
// Padding
|
|
7707
7717
|
paddingStyles[padding],
|
|
7708
7718
|
// Variant
|
|
7709
|
-
variantStyles$
|
|
7719
|
+
variantStyles$4[variant],
|
|
7710
7720
|
// Hover effect
|
|
7711
7721
|
hoverable && [
|
|
7712
7722
|
"cursor-pointer",
|
|
@@ -7722,7 +7732,7 @@ const Card = forwardRef(
|
|
|
7722
7732
|
}
|
|
7723
7733
|
);
|
|
7724
7734
|
Card.displayName = "Card";
|
|
7725
|
-
const sizeStyles$
|
|
7735
|
+
const sizeStyles$9 = {
|
|
7726
7736
|
sm: "h-4 w-4",
|
|
7727
7737
|
md: "h-5 w-5",
|
|
7728
7738
|
lg: "h-6 w-6"
|
|
@@ -7792,7 +7802,7 @@ const Checkbox = forwardRef(
|
|
|
7792
7802
|
"aria-describedby": errorId,
|
|
7793
7803
|
onChange: handleChange,
|
|
7794
7804
|
className: cn(
|
|
7795
|
-
sizeStyles$
|
|
7805
|
+
sizeStyles$9[size2],
|
|
7796
7806
|
"rounded border transition-colors",
|
|
7797
7807
|
"focus:ring-2 focus:ring-offset-0",
|
|
7798
7808
|
"disabled:cursor-not-allowed",
|
|
@@ -7846,7 +7856,7 @@ const Checkbox = forwardRef(
|
|
|
7846
7856
|
}
|
|
7847
7857
|
);
|
|
7848
7858
|
Checkbox.displayName = "Checkbox";
|
|
7849
|
-
const sizeStyles$
|
|
7859
|
+
const sizeStyles$8 = {
|
|
7850
7860
|
sm: "h-4 w-4",
|
|
7851
7861
|
md: "h-5 w-5",
|
|
7852
7862
|
lg: "h-6 w-6"
|
|
@@ -7885,7 +7895,7 @@ const Radio = forwardRef(
|
|
|
7885
7895
|
id: radioId,
|
|
7886
7896
|
disabled,
|
|
7887
7897
|
className: cn(
|
|
7888
|
-
sizeStyles$
|
|
7898
|
+
sizeStyles$8[size2],
|
|
7889
7899
|
"border transition-colors",
|
|
7890
7900
|
"focus:ring-2 focus:ring-offset-0",
|
|
7891
7901
|
"disabled:cursor-not-allowed",
|
|
@@ -7992,7 +8002,7 @@ function RadioGroup({
|
|
|
7992
8002
|
] });
|
|
7993
8003
|
}
|
|
7994
8004
|
RadioGroup.displayName = "RadioGroup";
|
|
7995
|
-
const sizeStyles$
|
|
8005
|
+
const sizeStyles$7 = {
|
|
7996
8006
|
sm: {
|
|
7997
8007
|
switch: "h-5 w-9",
|
|
7998
8008
|
dot: "h-3 w-3",
|
|
@@ -8019,7 +8029,7 @@ function Toggle({
|
|
|
8019
8029
|
className,
|
|
8020
8030
|
isLoading = false
|
|
8021
8031
|
}) {
|
|
8022
|
-
const currentSize = sizeStyles$
|
|
8032
|
+
const currentSize = sizeStyles$7[size2];
|
|
8023
8033
|
const isDisabled = disabled || isLoading;
|
|
8024
8034
|
return /* @__PURE__ */ jsx(W, { className, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8025
8035
|
(label || description) && /* @__PURE__ */ jsxs("div", { className: "flex-1 mr-4", children: [
|
|
@@ -8256,7 +8266,7 @@ function Combobox({
|
|
|
8256
8266
|
] });
|
|
8257
8267
|
}
|
|
8258
8268
|
Combobox.displayName = "Combobox";
|
|
8259
|
-
const variantStyles$
|
|
8269
|
+
const variantStyles$3 = {
|
|
8260
8270
|
default: cn(
|
|
8261
8271
|
"bg-primary-100 text-primary-700 border-primary-200",
|
|
8262
8272
|
"dark:bg-primary-800 dark:text-primary-200 dark:border-primary-700"
|
|
@@ -8282,7 +8292,7 @@ const variantStyles$2 = {
|
|
|
8282
8292
|
"dark:bg-gold-900/50 dark:text-gold-300 dark:border-gold-700"
|
|
8283
8293
|
)
|
|
8284
8294
|
};
|
|
8285
|
-
const sizeStyles$
|
|
8295
|
+
const sizeStyles$6 = {
|
|
8286
8296
|
sm: "px-2 py-0.5 text-xs",
|
|
8287
8297
|
md: "px-2.5 py-1 text-sm",
|
|
8288
8298
|
lg: "px-3 py-1.5 text-base"
|
|
@@ -8295,8 +8305,8 @@ const Badge = forwardRef(
|
|
|
8295
8305
|
ref,
|
|
8296
8306
|
className: cn(
|
|
8297
8307
|
"inline-flex items-center justify-center font-medium rounded-full border",
|
|
8298
|
-
variantStyles$
|
|
8299
|
-
sizeStyles$
|
|
8308
|
+
variantStyles$3[variant],
|
|
8309
|
+
sizeStyles$6[size2],
|
|
8300
8310
|
className
|
|
8301
8311
|
),
|
|
8302
8312
|
...props,
|
|
@@ -8454,7 +8464,7 @@ const TableCell = forwardRef(
|
|
|
8454
8464
|
}
|
|
8455
8465
|
);
|
|
8456
8466
|
TableCell.displayName = "TableCell";
|
|
8457
|
-
const sizeStyles$
|
|
8467
|
+
const sizeStyles$5 = {
|
|
8458
8468
|
sm: "px-3 py-1.5 text-sm",
|
|
8459
8469
|
md: "px-4 py-2 text-sm",
|
|
8460
8470
|
lg: "px-5 py-2.5 text-base"
|
|
@@ -8503,7 +8513,7 @@ function Tabs({
|
|
|
8503
8513
|
className: ({ selected }) => cn(
|
|
8504
8514
|
"relative outline-none transition-colors duration-normal",
|
|
8505
8515
|
"focus-visible:ring-2 focus-visible:ring-gold-500/50",
|
|
8506
|
-
sizeStyles$
|
|
8516
|
+
sizeStyles$5[size2],
|
|
8507
8517
|
fullWidth && "flex-1",
|
|
8508
8518
|
// Default variant styles
|
|
8509
8519
|
variant === "default" && [
|
|
@@ -8687,7 +8697,7 @@ const Breadcrumbs = forwardRef(
|
|
|
8687
8697
|
}
|
|
8688
8698
|
);
|
|
8689
8699
|
Breadcrumbs.displayName = "Breadcrumbs";
|
|
8690
|
-
const variantStyles$
|
|
8700
|
+
const variantStyles$2 = {
|
|
8691
8701
|
text: "rounded",
|
|
8692
8702
|
circular: "rounded-full",
|
|
8693
8703
|
rectangular: "rounded-md"
|
|
@@ -8723,7 +8733,7 @@ const Skeleton = forwardRef(
|
|
|
8723
8733
|
{
|
|
8724
8734
|
className: cn(
|
|
8725
8735
|
"bg-primary-200 dark:bg-primary-700",
|
|
8726
|
-
variantStyles$
|
|
8736
|
+
variantStyles$2[variant],
|
|
8727
8737
|
animate && "animate-pulse"
|
|
8728
8738
|
),
|
|
8729
8739
|
style: {
|
|
@@ -8745,7 +8755,7 @@ const Skeleton = forwardRef(
|
|
|
8745
8755
|
ref,
|
|
8746
8756
|
className: cn(
|
|
8747
8757
|
"bg-primary-200 dark:bg-primary-700",
|
|
8748
|
-
variantStyles$
|
|
8758
|
+
variantStyles$2[variant],
|
|
8749
8759
|
animate && "animate-pulse",
|
|
8750
8760
|
className
|
|
8751
8761
|
),
|
|
@@ -8764,7 +8774,7 @@ const Skeleton = forwardRef(
|
|
|
8764
8774
|
}
|
|
8765
8775
|
);
|
|
8766
8776
|
Skeleton.displayName = "Skeleton";
|
|
8767
|
-
const defaultIcons = {
|
|
8777
|
+
const defaultIcons$1 = {
|
|
8768
8778
|
"no-data": /* @__PURE__ */ jsx(
|
|
8769
8779
|
"svg",
|
|
8770
8780
|
{
|
|
@@ -8823,7 +8833,7 @@ const defaultIcons = {
|
|
|
8823
8833
|
}
|
|
8824
8834
|
)
|
|
8825
8835
|
};
|
|
8826
|
-
const sizeStyles$
|
|
8836
|
+
const sizeStyles$4 = {
|
|
8827
8837
|
sm: {
|
|
8828
8838
|
container: "py-6 px-4",
|
|
8829
8839
|
icon: "w-10 h-10",
|
|
@@ -8859,7 +8869,7 @@ const EmptyState = forwardRef(
|
|
|
8859
8869
|
className,
|
|
8860
8870
|
...props
|
|
8861
8871
|
}, ref) => {
|
|
8862
|
-
const styles = sizeStyles$
|
|
8872
|
+
const styles = sizeStyles$4[size2];
|
|
8863
8873
|
return /* @__PURE__ */ jsxs(
|
|
8864
8874
|
"div",
|
|
8865
8875
|
{
|
|
@@ -8871,7 +8881,7 @@ const EmptyState = forwardRef(
|
|
|
8871
8881
|
),
|
|
8872
8882
|
...props,
|
|
8873
8883
|
children: [
|
|
8874
|
-
/* @__PURE__ */ jsx("div", { className: cn(styles.icon, typeColors[type], "mb-4"), children: icon || defaultIcons[type] }),
|
|
8884
|
+
/* @__PURE__ */ jsx("div", { className: cn(styles.icon, typeColors[type], "mb-4"), children: icon || defaultIcons$1[type] }),
|
|
8875
8885
|
/* @__PURE__ */ jsx(
|
|
8876
8886
|
"h3",
|
|
8877
8887
|
{
|
|
@@ -8903,7 +8913,7 @@ const EmptyState = forwardRef(
|
|
|
8903
8913
|
EmptyState.displayName = "EmptyState";
|
|
8904
8914
|
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" }) });
|
|
8905
8915
|
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" }) });
|
|
8906
|
-
const sizeStyles$
|
|
8916
|
+
const sizeStyles$3 = {
|
|
8907
8917
|
sm: { button: "h-8 min-w-8 px-2 text-sm", text: "text-sm" },
|
|
8908
8918
|
md: { button: "h-10 min-w-10 px-3 text-sm", text: "text-sm" }
|
|
8909
8919
|
};
|
|
@@ -8953,7 +8963,7 @@ function Pagination({
|
|
|
8953
8963
|
className
|
|
8954
8964
|
}) {
|
|
8955
8965
|
const pageSizeId = useId$1();
|
|
8956
|
-
const currentSize = sizeStyles$
|
|
8966
|
+
const currentSize = sizeStyles$3[size2];
|
|
8957
8967
|
const canGoPrevious = currentPage > 1;
|
|
8958
8968
|
const canGoNext = currentPage < totalPages;
|
|
8959
8969
|
const pageNumbers = useMemo(
|
|
@@ -9500,7 +9510,7 @@ function isItemActive(currentPath, href, matcher = "exact") {
|
|
|
9500
9510
|
return false;
|
|
9501
9511
|
}
|
|
9502
9512
|
}
|
|
9503
|
-
const sizeStyles = {
|
|
9513
|
+
const sizeStyles$2 = {
|
|
9504
9514
|
sm: "px-2 py-1.5 text-xs gap-2",
|
|
9505
9515
|
md: "px-3 py-2.5 text-sm gap-3",
|
|
9506
9516
|
lg: "px-4 py-3 text-base gap-3"
|
|
@@ -9591,7 +9601,7 @@ function SidebarItem({
|
|
|
9591
9601
|
"focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:ring-offset-2",
|
|
9592
9602
|
"dark:focus:ring-offset-primary-900",
|
|
9593
9603
|
// Size styles
|
|
9594
|
-
sizeStyles[size2],
|
|
9604
|
+
sizeStyles$2[size2],
|
|
9595
9605
|
// State styles
|
|
9596
9606
|
item.disabled && "opacity-50 cursor-not-allowed",
|
|
9597
9607
|
!item.disabled && !isActive && [
|
|
@@ -9623,7 +9633,7 @@ function SidebarItem({
|
|
|
9623
9633
|
"focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:ring-offset-2",
|
|
9624
9634
|
"dark:focus:ring-offset-primary-900",
|
|
9625
9635
|
// Size styles
|
|
9626
|
-
sizeStyles[size2],
|
|
9636
|
+
sizeStyles$2[size2],
|
|
9627
9637
|
// State styles
|
|
9628
9638
|
item.disabled && "opacity-50 cursor-not-allowed pointer-events-none",
|
|
9629
9639
|
!item.disabled && !isActive && [
|
|
@@ -9724,7 +9734,7 @@ const SidebarDivider = forwardRef(
|
|
|
9724
9734
|
}
|
|
9725
9735
|
);
|
|
9726
9736
|
SidebarDivider.displayName = "SidebarDivider";
|
|
9727
|
-
const variantStyles = {
|
|
9737
|
+
const variantStyles$1 = {
|
|
9728
9738
|
default: [
|
|
9729
9739
|
"bg-white border-r border-gold-500/40",
|
|
9730
9740
|
"dark:bg-primary-900 dark:border-gold-500/20"
|
|
@@ -9907,7 +9917,7 @@ const Sidebar = forwardRef(
|
|
|
9907
9917
|
// Mobile styles
|
|
9908
9918
|
isOpen ? "translate-x-0" : "-translate-x-full",
|
|
9909
9919
|
// Variant styles
|
|
9910
|
-
variantStyles[variant],
|
|
9920
|
+
variantStyles$1[variant],
|
|
9911
9921
|
className
|
|
9912
9922
|
),
|
|
9913
9923
|
style: { width: sidebarWidth },
|
|
@@ -9920,7 +9930,508 @@ const Sidebar = forwardRef(
|
|
|
9920
9930
|
}
|
|
9921
9931
|
);
|
|
9922
9932
|
Sidebar.displayName = "Sidebar";
|
|
9933
|
+
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" }) });
|
|
9934
|
+
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" }) });
|
|
9935
|
+
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" }) });
|
|
9936
|
+
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" }) });
|
|
9937
|
+
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" }) });
|
|
9938
|
+
const defaultIcons = {
|
|
9939
|
+
success: /* @__PURE__ */ jsx(CheckCircleIcon, {}),
|
|
9940
|
+
error: /* @__PURE__ */ jsx(XCircleIcon, {}),
|
|
9941
|
+
warning: /* @__PURE__ */ jsx(ExclamationCircleIcon, {}),
|
|
9942
|
+
info: /* @__PURE__ */ jsx(InformationCircleIcon, {})
|
|
9943
|
+
};
|
|
9944
|
+
const variantStyles = {
|
|
9945
|
+
success: {
|
|
9946
|
+
container: cn(
|
|
9947
|
+
"bg-success-light border-success/20 text-[#166534]",
|
|
9948
|
+
"dark:bg-success/10 dark:border-success/30 dark:text-[#86efac]"
|
|
9949
|
+
),
|
|
9950
|
+
icon: "text-success dark:text-[#4ade80]",
|
|
9951
|
+
title: "text-[#14532d] dark:text-[#bbf7d0]"
|
|
9952
|
+
},
|
|
9953
|
+
error: {
|
|
9954
|
+
container: cn(
|
|
9955
|
+
"bg-error-light border-error/20 text-[#991b1b]",
|
|
9956
|
+
"dark:bg-error/10 dark:border-error/30 dark:text-[#fca5a5]"
|
|
9957
|
+
),
|
|
9958
|
+
icon: "text-error dark:text-[#f87171]",
|
|
9959
|
+
title: "text-[#7f1d1d] dark:text-[#fecaca]"
|
|
9960
|
+
},
|
|
9961
|
+
warning: {
|
|
9962
|
+
container: cn(
|
|
9963
|
+
"bg-warning-light border-warning/20 text-[#854d0e]",
|
|
9964
|
+
"dark:bg-warning/10 dark:border-warning/30 dark:text-[#fde047]"
|
|
9965
|
+
),
|
|
9966
|
+
icon: "text-warning dark:text-[#facc15]",
|
|
9967
|
+
title: "text-[#713f12] dark:text-[#fef08a]"
|
|
9968
|
+
},
|
|
9969
|
+
info: {
|
|
9970
|
+
container: cn(
|
|
9971
|
+
"bg-info-light border-info/20 text-[#1e40af]",
|
|
9972
|
+
"dark:bg-info/10 dark:border-info/30 dark:text-[#93c5fd]"
|
|
9973
|
+
),
|
|
9974
|
+
icon: "text-info dark:text-[#60a5fa]",
|
|
9975
|
+
title: "text-[#1e3a8a] dark:text-[#bfdbfe]"
|
|
9976
|
+
}
|
|
9977
|
+
};
|
|
9978
|
+
const Alert = forwardRef(
|
|
9979
|
+
({ variant = "info", title, message, icon, onClose, className, ...props }, ref) => {
|
|
9980
|
+
const styles = variantStyles[variant];
|
|
9981
|
+
const displayIcon = icon === null ? null : icon ?? defaultIcons[variant];
|
|
9982
|
+
return /* @__PURE__ */ jsx(
|
|
9983
|
+
"div",
|
|
9984
|
+
{
|
|
9985
|
+
ref,
|
|
9986
|
+
role: "alert",
|
|
9987
|
+
className: cn(
|
|
9988
|
+
"rounded-lg border p-4",
|
|
9989
|
+
styles.container,
|
|
9990
|
+
className
|
|
9991
|
+
),
|
|
9992
|
+
...props,
|
|
9993
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-start", children: [
|
|
9994
|
+
displayIcon !== null && /* @__PURE__ */ jsx("div", { className: cn("flex-shrink-0", styles.icon), "aria-hidden": "true", children: displayIcon }),
|
|
9995
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex-1", displayIcon !== null && "ml-3"), children: [
|
|
9996
|
+
title && /* @__PURE__ */ jsx("h3", { className: cn("text-sm font-medium", styles.title), children: title }),
|
|
9997
|
+
/* @__PURE__ */ jsx("div", { className: cn("text-sm", title && "mt-1"), children: message })
|
|
9998
|
+
] }),
|
|
9999
|
+
onClose && /* @__PURE__ */ jsx("div", { className: "ml-3 flex-shrink-0", children: /* @__PURE__ */ jsxs(
|
|
10000
|
+
"button",
|
|
10001
|
+
{
|
|
10002
|
+
type: "button",
|
|
10003
|
+
onClick: onClose,
|
|
10004
|
+
className: cn(
|
|
10005
|
+
"inline-flex rounded-md p-1.5",
|
|
10006
|
+
"hover:opacity-75 focus:outline-none focus:ring-2 focus:ring-offset-2",
|
|
10007
|
+
"focus:ring-current/20",
|
|
10008
|
+
"dark:focus:ring-offset-primary-900"
|
|
10009
|
+
),
|
|
10010
|
+
children: [
|
|
10011
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Dismiss" }),
|
|
10012
|
+
/* @__PURE__ */ jsx(XMarkIcon, {})
|
|
10013
|
+
]
|
|
10014
|
+
}
|
|
10015
|
+
) })
|
|
10016
|
+
] })
|
|
10017
|
+
}
|
|
10018
|
+
);
|
|
10019
|
+
}
|
|
10020
|
+
);
|
|
10021
|
+
Alert.displayName = "Alert";
|
|
10022
|
+
const sizeStyles$1 = {
|
|
10023
|
+
xs: { container: "w-6 h-6", text: "text-xs", status: "w-2 h-2 border" },
|
|
10024
|
+
sm: { container: "w-8 h-8", text: "text-sm", status: "w-2.5 h-2.5 border" },
|
|
10025
|
+
md: { container: "w-10 h-10", text: "text-base", status: "w-3 h-3 border-2" },
|
|
10026
|
+
lg: { container: "w-12 h-12", text: "text-lg", status: "w-3.5 h-3.5 border-2" },
|
|
10027
|
+
xl: { container: "w-16 h-16", text: "text-2xl", status: "w-4 h-4 border-2" }
|
|
10028
|
+
};
|
|
10029
|
+
const statusStyles = {
|
|
10030
|
+
online: "bg-success",
|
|
10031
|
+
offline: "bg-primary-400 dark:bg-primary-500",
|
|
10032
|
+
away: "bg-warning",
|
|
10033
|
+
busy: "bg-error"
|
|
10034
|
+
};
|
|
10035
|
+
const Avatar = forwardRef(
|
|
10036
|
+
({ name, src, size: size2 = "md", alt, status, className, ...props }, ref) => {
|
|
10037
|
+
const getInitials = (fullName) => {
|
|
10038
|
+
const names = fullName.trim().split(" ");
|
|
10039
|
+
if (names.length === 1) {
|
|
10040
|
+
return names[0]?.charAt(0).toUpperCase() || "";
|
|
10041
|
+
}
|
|
10042
|
+
const firstName = names[0];
|
|
10043
|
+
const lastName = names[names.length - 1];
|
|
10044
|
+
return ((firstName?.charAt(0) || "") + (lastName?.charAt(0) || "")).toUpperCase();
|
|
10045
|
+
};
|
|
10046
|
+
const initials = getInitials(name);
|
|
10047
|
+
const styles = sizeStyles$1[size2];
|
|
10048
|
+
return /* @__PURE__ */ jsxs(
|
|
10049
|
+
"div",
|
|
10050
|
+
{
|
|
10051
|
+
ref,
|
|
10052
|
+
className: cn(
|
|
10053
|
+
"relative inline-flex items-center justify-center",
|
|
10054
|
+
"rounded-full font-medium",
|
|
10055
|
+
// Light mode
|
|
10056
|
+
"bg-gold-500 text-white",
|
|
10057
|
+
// Dark mode
|
|
10058
|
+
"dark:bg-gold-600 dark:text-white",
|
|
10059
|
+
styles.container,
|
|
10060
|
+
className
|
|
10061
|
+
),
|
|
10062
|
+
...props,
|
|
10063
|
+
children: [
|
|
10064
|
+
src ? /* @__PURE__ */ jsx(
|
|
10065
|
+
"img",
|
|
10066
|
+
{
|
|
10067
|
+
src,
|
|
10068
|
+
alt: alt || `${name}'s avatar`,
|
|
10069
|
+
className: "w-full h-full rounded-full object-cover"
|
|
10070
|
+
}
|
|
10071
|
+
) : /* @__PURE__ */ jsx("span", { className: styles.text, children: initials }),
|
|
10072
|
+
status && /* @__PURE__ */ jsx(
|
|
10073
|
+
"span",
|
|
10074
|
+
{
|
|
10075
|
+
role: "status",
|
|
10076
|
+
className: cn(
|
|
10077
|
+
"absolute bottom-0 right-0 rounded-full",
|
|
10078
|
+
"border-white dark:border-primary-900",
|
|
10079
|
+
styles.status,
|
|
10080
|
+
statusStyles[status]
|
|
10081
|
+
),
|
|
10082
|
+
"aria-label": `Status: ${status}`
|
|
10083
|
+
}
|
|
10084
|
+
)
|
|
10085
|
+
]
|
|
10086
|
+
}
|
|
10087
|
+
);
|
|
10088
|
+
}
|
|
10089
|
+
);
|
|
10090
|
+
Avatar.displayName = "Avatar";
|
|
10091
|
+
const OTPInput = ({
|
|
10092
|
+
length = 6,
|
|
10093
|
+
value,
|
|
10094
|
+
onChange,
|
|
10095
|
+
error: error2,
|
|
10096
|
+
disabled = false,
|
|
10097
|
+
autoFocus = false,
|
|
10098
|
+
label = "One-time password",
|
|
10099
|
+
className
|
|
10100
|
+
}) => {
|
|
10101
|
+
const inputRefs = useRef([]);
|
|
10102
|
+
const digits = value.split("").slice(0, length);
|
|
10103
|
+
while (digits.length < length) {
|
|
10104
|
+
digits.push("");
|
|
10105
|
+
}
|
|
10106
|
+
const focusInput = useCallback((index2) => {
|
|
10107
|
+
const input = inputRefs.current[index2];
|
|
10108
|
+
if (input) {
|
|
10109
|
+
input.focus();
|
|
10110
|
+
input.select();
|
|
10111
|
+
}
|
|
10112
|
+
}, []);
|
|
10113
|
+
const handleChange = useCallback(
|
|
10114
|
+
(index2, event_) => {
|
|
10115
|
+
const newValue = event_.target.value;
|
|
10116
|
+
if (!/^\d*$/.test(newValue)) return;
|
|
10117
|
+
const digit = newValue.slice(-1);
|
|
10118
|
+
const newDigits = [...digits];
|
|
10119
|
+
newDigits[index2] = digit;
|
|
10120
|
+
const newOtp = newDigits.join("");
|
|
10121
|
+
onChange(newOtp);
|
|
10122
|
+
if (digit && index2 < length - 1) {
|
|
10123
|
+
focusInput(index2 + 1);
|
|
10124
|
+
}
|
|
10125
|
+
},
|
|
10126
|
+
[digits, length, onChange, focusInput]
|
|
10127
|
+
);
|
|
10128
|
+
const handleKeyDown = useCallback(
|
|
10129
|
+
(index2, event_) => {
|
|
10130
|
+
switch (event_.key) {
|
|
10131
|
+
case "Backspace":
|
|
10132
|
+
if (!digits[index2] && index2 > 0) {
|
|
10133
|
+
event_.preventDefault();
|
|
10134
|
+
const newDigits = [...digits];
|
|
10135
|
+
newDigits[index2 - 1] = "";
|
|
10136
|
+
onChange(newDigits.join(""));
|
|
10137
|
+
focusInput(index2 - 1);
|
|
10138
|
+
} else if (digits[index2]) {
|
|
10139
|
+
const newDigits = [...digits];
|
|
10140
|
+
newDigits[index2] = "";
|
|
10141
|
+
onChange(newDigits.join(""));
|
|
10142
|
+
}
|
|
10143
|
+
break;
|
|
10144
|
+
case "ArrowLeft":
|
|
10145
|
+
event_.preventDefault();
|
|
10146
|
+
if (index2 > 0) {
|
|
10147
|
+
focusInput(index2 - 1);
|
|
10148
|
+
}
|
|
10149
|
+
break;
|
|
10150
|
+
case "ArrowRight":
|
|
10151
|
+
event_.preventDefault();
|
|
10152
|
+
if (index2 < length - 1) {
|
|
10153
|
+
focusInput(index2 + 1);
|
|
10154
|
+
}
|
|
10155
|
+
break;
|
|
10156
|
+
case "Delete": {
|
|
10157
|
+
event_.preventDefault();
|
|
10158
|
+
const newDigits = [...digits];
|
|
10159
|
+
newDigits[index2] = "";
|
|
10160
|
+
onChange(newDigits.join(""));
|
|
10161
|
+
break;
|
|
10162
|
+
}
|
|
10163
|
+
}
|
|
10164
|
+
},
|
|
10165
|
+
[digits, length, onChange, focusInput]
|
|
10166
|
+
);
|
|
10167
|
+
const handlePaste = useCallback(
|
|
10168
|
+
(event_) => {
|
|
10169
|
+
event_.preventDefault();
|
|
10170
|
+
const pastedData = event_.clipboardData.getData("text");
|
|
10171
|
+
const pastedDigits = pastedData.replace(/\D/g, "").slice(0, length);
|
|
10172
|
+
if (pastedDigits) {
|
|
10173
|
+
onChange(pastedDigits);
|
|
10174
|
+
const focusIndex = Math.min(pastedDigits.length, length - 1);
|
|
10175
|
+
focusInput(focusIndex);
|
|
10176
|
+
}
|
|
10177
|
+
},
|
|
10178
|
+
[length, onChange, focusInput]
|
|
10179
|
+
);
|
|
10180
|
+
const errorId = error2 ? "otp-input-error" : void 0;
|
|
10181
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), "data-testid": "otp-input", children: [
|
|
10182
|
+
/* @__PURE__ */ jsx(
|
|
10183
|
+
"div",
|
|
10184
|
+
{
|
|
10185
|
+
role: "group",
|
|
10186
|
+
"aria-label": label,
|
|
10187
|
+
"aria-describedby": errorId,
|
|
10188
|
+
className: "flex justify-center gap-2 sm:gap-3",
|
|
10189
|
+
children: digits.map((digit, index2) => /* @__PURE__ */ jsx(
|
|
10190
|
+
"input",
|
|
10191
|
+
{
|
|
10192
|
+
ref: (element) => {
|
|
10193
|
+
inputRefs.current[index2] = element;
|
|
10194
|
+
},
|
|
10195
|
+
type: "text",
|
|
10196
|
+
inputMode: "numeric",
|
|
10197
|
+
pattern: "\\d*",
|
|
10198
|
+
maxLength: 1,
|
|
10199
|
+
value: digit,
|
|
10200
|
+
disabled,
|
|
10201
|
+
autoFocus: autoFocus && index2 === 0,
|
|
10202
|
+
"aria-label": `Digit ${index2 + 1} of ${length}`,
|
|
10203
|
+
"aria-invalid": !!error2,
|
|
10204
|
+
"data-testid": `otp-input-digit-${index2}`,
|
|
10205
|
+
className: cn(
|
|
10206
|
+
"w-10 h-12 sm:w-12 sm:h-14",
|
|
10207
|
+
"text-center text-xl sm:text-2xl font-semibold",
|
|
10208
|
+
"border-2 rounded-lg",
|
|
10209
|
+
"focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500",
|
|
10210
|
+
"transition-colors duration-200",
|
|
10211
|
+
// Light mode
|
|
10212
|
+
error2 ? "border-error bg-error-light" : "border-primary-300 bg-white",
|
|
10213
|
+
// Dark mode
|
|
10214
|
+
error2 ? "dark:border-error dark:bg-error/10" : "dark:border-primary-600 dark:bg-primary-900 dark:text-white",
|
|
10215
|
+
"dark:focus:ring-primary-400 dark:focus:border-primary-400",
|
|
10216
|
+
disabled && "bg-primary-100 cursor-not-allowed opacity-50 dark:bg-primary-800"
|
|
10217
|
+
),
|
|
10218
|
+
onChange: (event_) => handleChange(index2, event_),
|
|
10219
|
+
onKeyDown: (event_) => handleKeyDown(index2, event_),
|
|
10220
|
+
onPaste: handlePaste,
|
|
10221
|
+
onFocus: (event_) => event_.target.select()
|
|
10222
|
+
},
|
|
10223
|
+
index2
|
|
10224
|
+
))
|
|
10225
|
+
}
|
|
10226
|
+
),
|
|
10227
|
+
error2 && /* @__PURE__ */ jsx(
|
|
10228
|
+
"p",
|
|
10229
|
+
{
|
|
10230
|
+
id: errorId,
|
|
10231
|
+
role: "alert",
|
|
10232
|
+
"aria-live": "assertive",
|
|
10233
|
+
"data-testid": "otp-input-error",
|
|
10234
|
+
className: cn(
|
|
10235
|
+
"mt-2 text-sm text-center",
|
|
10236
|
+
"text-error dark:text-[#fca5a5]"
|
|
10237
|
+
),
|
|
10238
|
+
children: error2
|
|
10239
|
+
}
|
|
10240
|
+
)
|
|
10241
|
+
] });
|
|
10242
|
+
};
|
|
10243
|
+
const DateInput = forwardRef(
|
|
10244
|
+
({
|
|
10245
|
+
value,
|
|
10246
|
+
onChange,
|
|
10247
|
+
label,
|
|
10248
|
+
error: error2,
|
|
10249
|
+
helperText,
|
|
10250
|
+
fullWidth = false,
|
|
10251
|
+
disabled = false,
|
|
10252
|
+
className,
|
|
10253
|
+
id,
|
|
10254
|
+
required,
|
|
10255
|
+
min: min2,
|
|
10256
|
+
max: max2,
|
|
10257
|
+
...props
|
|
10258
|
+
}, ref) => {
|
|
10259
|
+
const inputId = id || label?.toLowerCase().replace(/\s+/g, "-");
|
|
10260
|
+
const hasError = !!error2;
|
|
10261
|
+
const errorId = hasError ? `${inputId}-error` : void 0;
|
|
10262
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(fullWidth ? "w-full" : "w-auto"), children: [
|
|
10263
|
+
label && /* @__PURE__ */ jsxs(
|
|
10264
|
+
"label",
|
|
10265
|
+
{
|
|
10266
|
+
htmlFor: inputId,
|
|
10267
|
+
className: "mb-2 block text-sm font-medium text-primary-700 dark:text-white",
|
|
10268
|
+
children: [
|
|
10269
|
+
label,
|
|
10270
|
+
required && /* @__PURE__ */ jsx("span", { className: "ml-1 text-error", children: "*" })
|
|
10271
|
+
]
|
|
10272
|
+
}
|
|
10273
|
+
),
|
|
10274
|
+
/* @__PURE__ */ jsx(
|
|
10275
|
+
"input",
|
|
10276
|
+
{
|
|
10277
|
+
ref,
|
|
10278
|
+
type: "date",
|
|
10279
|
+
id: inputId,
|
|
10280
|
+
"data-testid": "date-input",
|
|
10281
|
+
value: value || "",
|
|
10282
|
+
onChange: (event_) => onChange(event_.target.value || null),
|
|
10283
|
+
disabled,
|
|
10284
|
+
required,
|
|
10285
|
+
min: min2,
|
|
10286
|
+
max: max2,
|
|
10287
|
+
"aria-label": label ? void 0 : "Select date",
|
|
10288
|
+
"aria-invalid": hasError ? "true" : void 0,
|
|
10289
|
+
"aria-describedby": errorId,
|
|
10290
|
+
className: cn(
|
|
10291
|
+
// Base styles - Light mode
|
|
10292
|
+
"block w-full rounded-md border bg-white px-4 py-2.5 text-sm text-primary-900",
|
|
10293
|
+
"transition-colors duration-normal",
|
|
10294
|
+
"focus:outline-none focus:ring-2",
|
|
10295
|
+
"disabled:cursor-not-allowed disabled:bg-primary-50 disabled:text-primary-500",
|
|
10296
|
+
// Base styles - Dark mode
|
|
10297
|
+
"dark:bg-primary-800 dark:text-primary-100",
|
|
10298
|
+
"dark:disabled:bg-primary-900 dark:disabled:text-primary-600",
|
|
10299
|
+
// Border and focus styles
|
|
10300
|
+
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",
|
|
10301
|
+
// Custom className
|
|
10302
|
+
className
|
|
10303
|
+
),
|
|
10304
|
+
...props
|
|
10305
|
+
}
|
|
10306
|
+
),
|
|
10307
|
+
(error2 || helperText) && /* @__PURE__ */ jsx(
|
|
10308
|
+
"p",
|
|
10309
|
+
{
|
|
10310
|
+
id: errorId,
|
|
10311
|
+
role: hasError ? "alert" : void 0,
|
|
10312
|
+
className: cn(
|
|
10313
|
+
"mt-1.5 text-sm",
|
|
10314
|
+
hasError ? "text-error" : "text-primary-500 dark:text-primary-400"
|
|
10315
|
+
),
|
|
10316
|
+
children: error2 || helperText
|
|
10317
|
+
}
|
|
10318
|
+
)
|
|
10319
|
+
] });
|
|
10320
|
+
}
|
|
10321
|
+
);
|
|
10322
|
+
DateInput.displayName = "DateInput";
|
|
10323
|
+
const sizeStyles = {
|
|
10324
|
+
sm: "px-2.5 py-1 text-xs gap-1",
|
|
10325
|
+
md: "px-3 py-1.5 text-sm gap-1.5",
|
|
10326
|
+
lg: "px-4 py-2 text-base gap-2"
|
|
10327
|
+
};
|
|
10328
|
+
const checkmarkSize = {
|
|
10329
|
+
sm: "w-3 h-3",
|
|
10330
|
+
md: "w-4 h-4",
|
|
10331
|
+
lg: "w-5 h-5"
|
|
10332
|
+
};
|
|
10333
|
+
const PillSelector = forwardRef(
|
|
10334
|
+
({
|
|
10335
|
+
options,
|
|
10336
|
+
selected,
|
|
10337
|
+
onChange,
|
|
10338
|
+
multiple = true,
|
|
10339
|
+
size: size2 = "md",
|
|
10340
|
+
label,
|
|
10341
|
+
fullWidth = false,
|
|
10342
|
+
disabled = false,
|
|
10343
|
+
className,
|
|
10344
|
+
...props
|
|
10345
|
+
}, ref) => {
|
|
10346
|
+
const handleClick = (value) => {
|
|
10347
|
+
if (disabled) return;
|
|
10348
|
+
if (multiple) {
|
|
10349
|
+
if (selected.includes(value)) {
|
|
10350
|
+
onChange(selected.filter((v2) => v2 !== value));
|
|
10351
|
+
} else {
|
|
10352
|
+
onChange([...selected, value]);
|
|
10353
|
+
}
|
|
10354
|
+
} else {
|
|
10355
|
+
onChange([value]);
|
|
10356
|
+
}
|
|
10357
|
+
};
|
|
10358
|
+
return /* @__PURE__ */ jsxs(
|
|
10359
|
+
"div",
|
|
10360
|
+
{
|
|
10361
|
+
ref,
|
|
10362
|
+
className: cn(fullWidth ? "w-full" : "w-auto", className),
|
|
10363
|
+
...props,
|
|
10364
|
+
children: [
|
|
10365
|
+
label && /* @__PURE__ */ jsx("label", { className: "mb-2 block text-sm font-medium text-primary-700 dark:text-white", children: label }),
|
|
10366
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", role: "group", "aria-label": label, children: options.map((option) => {
|
|
10367
|
+
const isSelected = selected.includes(option.value);
|
|
10368
|
+
return /* @__PURE__ */ jsxs(
|
|
10369
|
+
"button",
|
|
10370
|
+
{
|
|
10371
|
+
type: "button",
|
|
10372
|
+
disabled,
|
|
10373
|
+
"aria-pressed": isSelected,
|
|
10374
|
+
onClick: () => handleClick(option.value),
|
|
10375
|
+
className: cn(
|
|
10376
|
+
"inline-flex items-center justify-center rounded-full border font-medium",
|
|
10377
|
+
"transition-colors duration-normal",
|
|
10378
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-1",
|
|
10379
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
10380
|
+
sizeStyles[size2],
|
|
10381
|
+
isSelected ? cn(
|
|
10382
|
+
// Light mode - selected
|
|
10383
|
+
"border-primary-700 bg-primary-700 text-white",
|
|
10384
|
+
"hover:bg-primary-800 hover:border-primary-800",
|
|
10385
|
+
"focus:ring-primary-500/30",
|
|
10386
|
+
// Dark mode - selected
|
|
10387
|
+
"dark:border-gold-500 dark:bg-gold-500 dark:text-primary-900",
|
|
10388
|
+
"dark:hover:bg-gold-400 dark:hover:border-gold-400",
|
|
10389
|
+
"dark:focus:ring-gold-400/30"
|
|
10390
|
+
) : cn(
|
|
10391
|
+
// Light mode - unselected
|
|
10392
|
+
"border-primary-300 bg-white text-primary-700",
|
|
10393
|
+
"hover:border-primary-400 hover:bg-primary-50",
|
|
10394
|
+
"focus:ring-primary-500/20",
|
|
10395
|
+
// Dark mode - unselected
|
|
10396
|
+
"dark:border-primary-600 dark:bg-primary-800 dark:text-primary-200",
|
|
10397
|
+
"dark:hover:border-primary-500 dark:hover:bg-primary-700",
|
|
10398
|
+
"dark:focus:ring-primary-400/20"
|
|
10399
|
+
)
|
|
10400
|
+
),
|
|
10401
|
+
children: [
|
|
10402
|
+
isSelected && /* @__PURE__ */ jsx(
|
|
10403
|
+
"svg",
|
|
10404
|
+
{
|
|
10405
|
+
className: checkmarkSize[size2],
|
|
10406
|
+
fill: "currentColor",
|
|
10407
|
+
viewBox: "0 0 20 20",
|
|
10408
|
+
"aria-hidden": "true",
|
|
10409
|
+
children: /* @__PURE__ */ jsx(
|
|
10410
|
+
"path",
|
|
10411
|
+
{
|
|
10412
|
+
fillRule: "evenodd",
|
|
10413
|
+
clipRule: "evenodd",
|
|
10414
|
+
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"
|
|
10415
|
+
}
|
|
10416
|
+
)
|
|
10417
|
+
}
|
|
10418
|
+
),
|
|
10419
|
+
option.icon,
|
|
10420
|
+
/* @__PURE__ */ jsx("span", { children: option.label })
|
|
10421
|
+
]
|
|
10422
|
+
},
|
|
10423
|
+
option.value
|
|
10424
|
+
);
|
|
10425
|
+
}) })
|
|
10426
|
+
]
|
|
10427
|
+
}
|
|
10428
|
+
);
|
|
10429
|
+
}
|
|
10430
|
+
);
|
|
10431
|
+
PillSelector.displayName = "PillSelector";
|
|
9923
10432
|
export {
|
|
10433
|
+
Alert,
|
|
10434
|
+
Avatar,
|
|
9924
10435
|
Badge,
|
|
9925
10436
|
Breadcrumbs,
|
|
9926
10437
|
Button,
|
|
@@ -9928,13 +10439,16 @@ export {
|
|
|
9928
10439
|
Checkbox,
|
|
9929
10440
|
Combobox,
|
|
9930
10441
|
ConfirmDialog,
|
|
10442
|
+
DateInput,
|
|
9931
10443
|
Drawer,
|
|
9932
10444
|
EmptyState,
|
|
9933
10445
|
Input,
|
|
9934
10446
|
Modal,
|
|
9935
10447
|
MultiSelect,
|
|
10448
|
+
OTPInput,
|
|
9936
10449
|
Pagination,
|
|
9937
10450
|
PasswordInput,
|
|
10451
|
+
PillSelector,
|
|
9938
10452
|
Radio,
|
|
9939
10453
|
RadioGroup,
|
|
9940
10454
|
Select,
|