atomos_next_genesis 0.0.3-alpha → 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/index.cjs +2744 -726
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1253 -102
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +382 -145
- package/dist/index.d.ts +382 -145
- package/dist/index.js +2740 -730
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -38,30 +38,52 @@ __export(app_exports, {
|
|
|
38
38
|
AvatarGroup: () => AvatarGroup_default,
|
|
39
39
|
BreadCrumb: () => Breadcrumb_default,
|
|
40
40
|
Button: () => Button_default,
|
|
41
|
+
Callout: () => Callout_default,
|
|
42
|
+
Card: () => Card_default,
|
|
43
|
+
CardAction: () => CardAction,
|
|
44
|
+
CardContent: () => CardContent,
|
|
45
|
+
CardDescription: () => CardDescription,
|
|
46
|
+
CardFooter: () => CardFooter,
|
|
47
|
+
CardHeader: () => CardHeader,
|
|
48
|
+
CardTitle: () => CardTitle,
|
|
41
49
|
Checkbox: () => Checkbox_default,
|
|
42
50
|
Chip: () => Chip_default,
|
|
43
51
|
CircularProgress: () => CircularProgress_default,
|
|
44
52
|
Divider: () => Divider_default,
|
|
53
|
+
Drawer: () => Drawer_default,
|
|
45
54
|
Dropdown: () => Dropdown_default,
|
|
55
|
+
DropdownMenu: () => DropdownMenu,
|
|
56
|
+
DropdownMenuContent: () => DropdownMenuContent,
|
|
57
|
+
DropdownMenuItem: () => DropdownMenuItem,
|
|
58
|
+
DropdownMenuLabel: () => DropdownMenuLabel,
|
|
59
|
+
DropdownMenuSeparator: () => DropdownMenuSeparator,
|
|
60
|
+
DropdownMenuSub: () => DropdownMenuSub,
|
|
61
|
+
DropdownMenuSubContent: () => DropdownMenuSubContent,
|
|
62
|
+
DropdownMenuSubTrigger: () => DropdownMenuSubTrigger,
|
|
63
|
+
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
46
64
|
DropdownWithIcon: () => DropdownWithIcon_default,
|
|
65
|
+
FileSelector: () => FileSelector_default,
|
|
47
66
|
FileUpload: () => FileUpload_default,
|
|
67
|
+
FileUploadPreview: () => FileUploadPreview_default,
|
|
48
68
|
GlobalNavigation: () => GlobalNavigation_default,
|
|
49
69
|
HelperText: () => HelperText_default,
|
|
50
70
|
Input: () => Input_default,
|
|
51
71
|
Label: () => Label_default,
|
|
52
72
|
ListItem: () => ListItem_default,
|
|
73
|
+
ListPagination: () => ListPagination_default,
|
|
53
74
|
Loading: () => Loading_default,
|
|
54
|
-
MenuDropdown: () => MenuDropdown,
|
|
55
|
-
MenuItem: () => MenuItem3,
|
|
56
|
-
MenuSubItem: () => MenuSubItem,
|
|
57
75
|
Modal: () => Modal,
|
|
58
76
|
Notice: () => Notice_default,
|
|
77
|
+
OTPInput: () => OTPInput_default,
|
|
59
78
|
Pagination: () => Pagination_default,
|
|
60
79
|
ProgressBar: () => Progress_default,
|
|
61
80
|
Radio: () => Radio_default,
|
|
81
|
+
RazorPayFileUpload: () => ImageUploadControlled,
|
|
62
82
|
Sidebar: () => Sidebar_default,
|
|
63
83
|
Skeleton: () => Skeleton_default,
|
|
64
84
|
Slider: () => Slider_default,
|
|
85
|
+
Spinner: () => Spinner_default,
|
|
86
|
+
SplitButton: () => SplitButton_default,
|
|
65
87
|
Stepper: () => Stepper_default,
|
|
66
88
|
Tab: () => Tab,
|
|
67
89
|
TabList: () => TabList,
|
|
@@ -73,29 +95,60 @@ __export(app_exports, {
|
|
|
73
95
|
TableHeadCell: () => TableHeadCell,
|
|
74
96
|
TableRow: () => TableRow,
|
|
75
97
|
TabsContainer: () => Tabs_default,
|
|
98
|
+
TextInputWithLabel: () => TextInputWithLabel_default,
|
|
76
99
|
Textarea: () => Textarea_default,
|
|
77
100
|
Toggle: () => Toggle_default,
|
|
78
|
-
Tooltip: () => Tooltip_default
|
|
101
|
+
Tooltip: () => Tooltip_default,
|
|
102
|
+
TreeView: () => TreeView_default,
|
|
103
|
+
Typography: () => Typography_default,
|
|
104
|
+
defaultGetFileIcon: () => defaultGetFileIcon
|
|
79
105
|
});
|
|
80
106
|
module.exports = __toCommonJS(app_exports);
|
|
81
107
|
|
|
82
|
-
// app/components/
|
|
108
|
+
// app/components/Accordion.tsx
|
|
83
109
|
var import_react = __toESM(require("react"), 1);
|
|
110
|
+
var import_react2 = require("@remixicon/react");
|
|
84
111
|
|
|
85
112
|
// app/utils/utils.tsx
|
|
86
113
|
var import_clsx = __toESM(require("clsx"), 1);
|
|
87
114
|
var import_tailwind_merge = require("tailwind-merge");
|
|
88
115
|
var cn = (...classes) => (0, import_tailwind_merge.twMerge)((0, import_clsx.default)(...classes));
|
|
89
116
|
|
|
90
|
-
// app/components/
|
|
91
|
-
var import_react2 = require("@remixicon/react");
|
|
117
|
+
// app/components/Accordion.tsx
|
|
92
118
|
function Accordion({
|
|
93
119
|
type = "single",
|
|
94
120
|
collapsible = true,
|
|
95
121
|
className,
|
|
96
|
-
children
|
|
122
|
+
children,
|
|
123
|
+
expanded
|
|
97
124
|
}) {
|
|
98
|
-
const [openItems, setOpenItems] = (0, import_react.useState)(
|
|
125
|
+
const [openItems, setOpenItems] = (0, import_react.useState)(() => {
|
|
126
|
+
const defaultOpen = [];
|
|
127
|
+
import_react.default.Children.forEach(children, (child) => {
|
|
128
|
+
if (import_react.default.isValidElement(child)) {
|
|
129
|
+
const triggerChild = import_react.default.Children.toArray(child.props.children)[0];
|
|
130
|
+
if (import_react.default.isValidElement(triggerChild) && triggerChild.props.defaultOpen) {
|
|
131
|
+
defaultOpen.push(child.props.value);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
return defaultOpen;
|
|
136
|
+
});
|
|
137
|
+
(0, import_react.useEffect)(() => {
|
|
138
|
+
if (expanded !== void 0) {
|
|
139
|
+
if (expanded) {
|
|
140
|
+
const allValues = [];
|
|
141
|
+
import_react.default.Children.forEach(children, (child) => {
|
|
142
|
+
if (import_react.default.isValidElement(child)) {
|
|
143
|
+
allValues.push(child.props.value);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
setOpenItems(allValues);
|
|
147
|
+
} else {
|
|
148
|
+
setOpenItems([]);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}, [expanded, children]);
|
|
99
152
|
const handleToggle = (value) => {
|
|
100
153
|
if (type === "single") {
|
|
101
154
|
setOpenItems(
|
|
@@ -107,7 +160,7 @@ function Accordion({
|
|
|
107
160
|
);
|
|
108
161
|
}
|
|
109
162
|
};
|
|
110
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className }, import_react.default.Children.map(children, (child) => {
|
|
163
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className, role: "region", "aria-label": "Accordion" }, import_react.default.Children.map(children, (child) => {
|
|
111
164
|
if (import_react.default.isValidElement(child)) {
|
|
112
165
|
return import_react.default.cloneElement(
|
|
113
166
|
child,
|
|
@@ -129,6 +182,8 @@ function AccordionItem({
|
|
|
129
182
|
className
|
|
130
183
|
}) {
|
|
131
184
|
const isOpen = openItems == null ? void 0 : openItems.includes(value);
|
|
185
|
+
const headerId = `accordion-header-${value}`;
|
|
186
|
+
const contentId = `accordion-content-${value}`;
|
|
132
187
|
const toggle = () => {
|
|
133
188
|
if (!disabled && handleToggle) {
|
|
134
189
|
handleToggle(value);
|
|
@@ -138,55 +193,79 @@ function AccordionItem({
|
|
|
138
193
|
"div",
|
|
139
194
|
{
|
|
140
195
|
className: cn(
|
|
141
|
-
"bg-white
|
|
142
|
-
disabled
|
|
143
|
-
isOpen
|
|
196
|
+
"bg-white rounded-lg shadow transition-all duration-300 ease-in-out border",
|
|
197
|
+
disabled && "opacity-50 pointer-events-none select-none",
|
|
198
|
+
isOpen && "border-gray-300",
|
|
144
199
|
className
|
|
145
200
|
)
|
|
146
201
|
},
|
|
147
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
202
|
+
children && Array.isArray(children) ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
148
203
|
"div",
|
|
149
204
|
{
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
className: cn(
|
|
157
|
-
"grid transition-all duration-300 ease-in-out",
|
|
158
|
-
isOpen ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"
|
|
159
|
-
)
|
|
205
|
+
onClick: toggle,
|
|
206
|
+
onKeyDown: (e) => {
|
|
207
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
208
|
+
e.preventDefault();
|
|
209
|
+
toggle();
|
|
210
|
+
}
|
|
160
211
|
},
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
212
|
+
role: "button",
|
|
213
|
+
tabIndex: disabled ? -1 : 0,
|
|
214
|
+
"aria-expanded": isOpen,
|
|
215
|
+
"aria-disabled": disabled,
|
|
216
|
+
"aria-controls": contentId,
|
|
217
|
+
id: headerId,
|
|
218
|
+
className: "cursor-pointer"
|
|
219
|
+
},
|
|
220
|
+
import_react.default.cloneElement(children[0], { isOpen })
|
|
221
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
222
|
+
"div",
|
|
223
|
+
{
|
|
224
|
+
id: contentId,
|
|
225
|
+
role: "region",
|
|
226
|
+
"aria-labelledby": headerId,
|
|
227
|
+
className: cn(
|
|
228
|
+
"transition-all duration-300 ease-in-out overflow-hidden",
|
|
229
|
+
isOpen ? "max-h-[1000px] opacity-100" : "max-h-0 opacity-0"
|
|
230
|
+
),
|
|
231
|
+
onClick: (e) => e.stopPropagation()
|
|
232
|
+
},
|
|
233
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "p-3.5" }, children[1])
|
|
234
|
+
)) : children
|
|
164
235
|
);
|
|
165
236
|
}
|
|
166
|
-
function AccordionTrigger({
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
isOpen ? "rotate-180" : "rotate-0"
|
|
173
|
-
)
|
|
174
|
-
},
|
|
175
|
-
/* @__PURE__ */ import_react.default.createElement(import_react2.RiArrowDownSLine, { size: 18 })
|
|
176
|
-
));
|
|
177
|
-
}
|
|
178
|
-
function AccordionContent({ isOpen, children }) {
|
|
237
|
+
function AccordionTrigger({
|
|
238
|
+
isOpen,
|
|
239
|
+
children,
|
|
240
|
+
className,
|
|
241
|
+
triggerIcon = /* @__PURE__ */ import_react.default.createElement(import_react2.RiArrowDownSLine, { size: 18 })
|
|
242
|
+
}) {
|
|
179
243
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
180
244
|
"div",
|
|
181
245
|
{
|
|
182
246
|
className: cn(
|
|
183
|
-
"
|
|
184
|
-
|
|
247
|
+
"flex p-3.5 text-lg rounded-lg bg-white hover:bg-gray-50 justify-between items-center font-semibold transition-all delay-150 ease-in",
|
|
248
|
+
isOpen && "bg-gray-100",
|
|
249
|
+
className
|
|
185
250
|
)
|
|
186
251
|
},
|
|
187
|
-
children
|
|
252
|
+
children,
|
|
253
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
254
|
+
"span",
|
|
255
|
+
{
|
|
256
|
+
className: cn(
|
|
257
|
+
"transition-transform duration-300",
|
|
258
|
+
isOpen ? "rotate-180" : "rotate-0"
|
|
259
|
+
),
|
|
260
|
+
"aria-hidden": "true"
|
|
261
|
+
},
|
|
262
|
+
triggerIcon
|
|
263
|
+
)
|
|
188
264
|
);
|
|
189
265
|
}
|
|
266
|
+
function AccordionContent({ children }) {
|
|
267
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "text-gray-700" }, children);
|
|
268
|
+
}
|
|
190
269
|
|
|
191
270
|
// app/components/Avatar.tsx
|
|
192
271
|
var import_image = __toESM(require("next/image"), 1);
|
|
@@ -377,7 +456,7 @@ var Breadcrumb_default = Breadcrumbs;
|
|
|
377
456
|
var import_react6 = __toESM(require("react"), 1);
|
|
378
457
|
var import_class_variance_authority = require("class-variance-authority");
|
|
379
458
|
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
380
|
-
"rounded-lg disabled:select-none font-semibold cursor-pointer transition-colors duration-300 ease-in-out",
|
|
459
|
+
"rounded-lg disabled:select-none font-semibold cursor-pointer transition-colors duration-300 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2",
|
|
381
460
|
{
|
|
382
461
|
variants: {
|
|
383
462
|
variant: {
|
|
@@ -390,11 +469,29 @@ var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
|
390
469
|
error: "bg-error-700 border-error-700 active:bg-error-900 active:border-error-900 hover:bg-error-800 hover:border-error-800",
|
|
391
470
|
warning: "bg-warning-600 border-warning-600 active:bg-warning-900 active:border-warning-900 hover:bg-warning-700 hover:border-warning-700",
|
|
392
471
|
default: "bg-gray-600 border-gray-600 active:bg-gray-900 active:border-gray-900 hover:bg-gray-700 hover:border-gray-700",
|
|
472
|
+
blue: "bg-blue-600 border-blue-600 active:bg-blue-900 active:border-blue-900 hover:bg-blue-700 hover:border-blue-700",
|
|
473
|
+
bluegray: "bg-bluegray-600 border-bluegray-600 active:bg-bluegray-900 active:border-bluegray-900 hover:bg-bluegray-700 hover:border-bluegray-700",
|
|
474
|
+
bluelight: "bg-bluelight-600 border-bluelight-600 active:bg-bluelight-900 active:border-bluelight-900 hover:bg-bluelight-700 hover:border-bluelight-700",
|
|
475
|
+
indigo: "bg-indigo-600 border-indigo-600 active:bg-indigo-900 active:border-indigo-900 hover:bg-indigo-700 hover:border-indigo-700",
|
|
476
|
+
purple: "bg-purple-600 border-purple-600 active:bg-purple-900 active:border-purple-900 hover:bg-purple-700 hover:border-purple-700",
|
|
477
|
+
violet: "bg-violet-600 border-violet-600 active:bg-violet-900 active:border-violet-900 hover:bg-violet-700 hover:border-violet-700",
|
|
478
|
+
pink: "bg-pink-600 border-pink-600 active:bg-pink-900 active:border-pink-900 hover:bg-pink-700 hover:border-pink-700",
|
|
479
|
+
rose: "bg-rose-600 border-rose-600 active:bg-rose-900 active:border-rose-900 hover:bg-rose-700 hover:border-rose-700",
|
|
480
|
+
orange: "bg-orange-600 border-orange-600 active:bg-orange-900 active:border-orange-900 hover:bg-orange-700 hover:border-orange-700",
|
|
393
481
|
"primary-outlined": "border-primary-600 text-primary-600 hover:bg-primary-100 active:bg-primary-200 active:border-primary-700",
|
|
394
482
|
"success-outlined": "border-success-600 text-success-600 hover:bg-success-50 hover:border-success-700 hover:text-success-700 active:bg-success-100 active:text-success-900 active:border-success-900",
|
|
395
483
|
"error-outlined": "border-error-700 text-error-700 hover:bg-error-100 hover:border-error-700 hover:text-error-700 active:bg-error-200 active:text-error-700 active:border-error-800",
|
|
396
484
|
"warning-outlined": "border-warning-500 text-warning-500 hover:bg-warning-50 hover:border-warning-600 hover:text-warning-600 active:bg-warning-100 active:text-warning-700 active:border-warning-700",
|
|
397
|
-
"default-outlined": "border-gray-700 text-gray-700 hover:bg-gray-100 hover:border-gray-700 hover:text-gray-700 active:bg-gray-300 active:text-gray-800 active:border-gray-800"
|
|
485
|
+
"default-outlined": "border-gray-700 text-gray-700 hover:bg-gray-100 hover:border-gray-700 hover:text-gray-700 active:bg-gray-300 active:text-gray-800 active:border-gray-800",
|
|
486
|
+
"blue-outlined": "border-blue-600 text-blue-600 hover:bg-blue-50 hover:border-blue-700 hover:text-blue-700 active:bg-blue-100 active:text-blue-900 active:border-blue-900",
|
|
487
|
+
"bluegray-outlined": "border-bluegray-600 text-bluegray-600 hover:bg-bluegray-50 hover:border-bluegray-700 hover:text-bluegray-700 active:bg-bluegray-100 active:text-bluegray-900 active:border-bluegray-900",
|
|
488
|
+
"bluelight-outlined": "border-bluelight-600 text-bluelight-600 hover:bg-bluelight-50 hover:border-bluelight-700 hover:text-bluelight-700 active:bg-bluelight-100 active:text-bluelight-900 active:border-bluelight-900",
|
|
489
|
+
"indigo-outlined": "border-indigo-600 text-indigo-600 hover:bg-indigo-50 hover:border-indigo-700 hover:text-indigo-700 active:bg-indigo-100 active:text-indigo-900 active:border-indigo-900",
|
|
490
|
+
"purple-outlined": "border-purple-600 text-purple-600 hover:bg-purple-50 hover:border-purple-700 hover:text-purple-700 active:bg-purple-100 active:text-purple-900 active:border-purple-900",
|
|
491
|
+
"violet-outlined": "border-violet-600 text-violet-600 hover:bg-violet-50 hover:border-violet-700 hover:text-violet-700 active:bg-violet-100 active:text-violet-900 active:border-violet-900",
|
|
492
|
+
"pink-outlined": "border-pink-600 text-pink-600 hover:bg-pink-50 hover:border-pink-700 hover:text-pink-700 active:bg-pink-100 active:text-pink-900 active:border-pink-900",
|
|
493
|
+
"rose-outlined": "border-rose-600 text-rose-600 hover:bg-rose-50 hover:border-rose-700 hover:text-rose-700 active:bg-rose-100 active:text-rose-900 active:border-rose-900",
|
|
494
|
+
"orange-outlined": "border-orange-600 text-orange-600 hover:bg-orange-50 hover:border-orange-700 hover:text-orange-700 active:bg-orange-100 active:text-orange-900 active:border-orange-900"
|
|
398
495
|
},
|
|
399
496
|
size: {
|
|
400
497
|
sm: "text-sm px-3.5 py-2",
|
|
@@ -404,7 +501,7 @@ var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
|
404
501
|
},
|
|
405
502
|
defaultVariants: {
|
|
406
503
|
variant: "filled",
|
|
407
|
-
size: "
|
|
504
|
+
size: "sm"
|
|
408
505
|
}
|
|
409
506
|
}
|
|
410
507
|
);
|
|
@@ -418,36 +515,187 @@ var Button = ({
|
|
|
418
515
|
disabled,
|
|
419
516
|
endIcon,
|
|
420
517
|
size,
|
|
518
|
+
type = "button",
|
|
421
519
|
...props
|
|
422
520
|
}) => {
|
|
423
|
-
return
|
|
424
|
-
|
|
521
|
+
return (
|
|
522
|
+
// <button
|
|
523
|
+
// {...props}
|
|
524
|
+
// disabled={disabled}
|
|
525
|
+
// type={type}
|
|
526
|
+
// aria-disabled={disabled}
|
|
527
|
+
// className={cn(
|
|
528
|
+
// fullWidth && "w-full",
|
|
529
|
+
// buttonVariants({ intent, className, variant, size }),
|
|
530
|
+
// "flex items-center text-center justify-center gap-2"
|
|
531
|
+
// )}
|
|
532
|
+
// >
|
|
533
|
+
// {startIcon}
|
|
534
|
+
// {children}
|
|
535
|
+
// {endIcon}
|
|
536
|
+
// </button>
|
|
537
|
+
/* @__PURE__ */ import_react6.default.createElement(
|
|
538
|
+
"button",
|
|
539
|
+
{
|
|
540
|
+
...props,
|
|
541
|
+
disabled,
|
|
542
|
+
"aria-disabled": disabled,
|
|
543
|
+
type,
|
|
544
|
+
className: cn(
|
|
545
|
+
fullWidth && "w-full",
|
|
546
|
+
buttonVariants({ intent, className, variant, size }),
|
|
547
|
+
"flex items-center text-center justify-center gap-2"
|
|
548
|
+
)
|
|
549
|
+
},
|
|
550
|
+
startIcon && /* @__PURE__ */ import_react6.default.createElement("span", { "aria-hidden": "true" }, startIcon),
|
|
551
|
+
children,
|
|
552
|
+
endIcon && /* @__PURE__ */ import_react6.default.createElement("span", { "aria-hidden": "true" }, endIcon)
|
|
553
|
+
)
|
|
554
|
+
);
|
|
555
|
+
};
|
|
556
|
+
var Button_default = Button;
|
|
557
|
+
|
|
558
|
+
// app/components/Callout.tsx
|
|
559
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
560
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
561
|
+
var calloutVariants = (0, import_class_variance_authority2.cva)("py-3 px-4 font-medium rounded-md", {
|
|
562
|
+
variants: {
|
|
563
|
+
variant: {
|
|
564
|
+
filled: "",
|
|
565
|
+
outlined: "border"
|
|
566
|
+
},
|
|
567
|
+
intent: {
|
|
568
|
+
primary: "",
|
|
569
|
+
warning: "",
|
|
570
|
+
error: "",
|
|
571
|
+
success: "",
|
|
572
|
+
default: ""
|
|
573
|
+
},
|
|
574
|
+
size: {
|
|
575
|
+
xs: "text-xs",
|
|
576
|
+
sm: "text-sm",
|
|
577
|
+
md: "text-base",
|
|
578
|
+
lg: "text-lg"
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
compoundVariants: [
|
|
425
582
|
{
|
|
426
|
-
|
|
427
|
-
|
|
583
|
+
variant: "filled",
|
|
584
|
+
intent: "primary",
|
|
585
|
+
className: "bg-primary-50 text-primary-600"
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
variant: "outlined",
|
|
589
|
+
intent: "primary",
|
|
590
|
+
className: "border-primary-200 text-primary-600 bg-transparent"
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
variant: "filled",
|
|
594
|
+
intent: "warning",
|
|
595
|
+
className: "bg-warning-50 text-warning-600"
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
variant: "outlined",
|
|
599
|
+
intent: "warning",
|
|
600
|
+
className: "border-warning-200 text-warning-600 bg-transparent"
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
variant: "filled",
|
|
604
|
+
intent: "error",
|
|
605
|
+
className: "bg-error-50 text-error-600"
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
variant: "outlined",
|
|
609
|
+
intent: "error",
|
|
610
|
+
className: "border-error-200 text-error-600 bg-transparent"
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
variant: "filled",
|
|
614
|
+
intent: "success",
|
|
615
|
+
className: "bg-success-50 text-success-600"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
variant: "outlined",
|
|
619
|
+
intent: "success",
|
|
620
|
+
className: "border-success-200 text-success-600 bg-transparent"
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
variant: "filled",
|
|
624
|
+
intent: "default",
|
|
625
|
+
className: "bg-gray-50 text-gray-600"
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
variant: "outlined",
|
|
629
|
+
intent: "default",
|
|
630
|
+
className: "border-gray-300 text-gray-600 bg-transparent"
|
|
631
|
+
}
|
|
632
|
+
],
|
|
633
|
+
defaultVariants: {
|
|
634
|
+
variant: "filled",
|
|
635
|
+
intent: "primary",
|
|
636
|
+
size: "sm"
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
var Callout = ({
|
|
640
|
+
children,
|
|
641
|
+
variant,
|
|
642
|
+
intent,
|
|
643
|
+
size,
|
|
644
|
+
startIcon,
|
|
645
|
+
endIcon,
|
|
646
|
+
className
|
|
647
|
+
}) => {
|
|
648
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
649
|
+
"div",
|
|
650
|
+
{
|
|
651
|
+
role: "alert",
|
|
428
652
|
className: cn(
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
653
|
+
calloutVariants({ variant, intent, size }),
|
|
654
|
+
"flex items-center justify-between gap-2",
|
|
655
|
+
className
|
|
432
656
|
)
|
|
433
657
|
},
|
|
434
|
-
startIcon,
|
|
435
|
-
|
|
436
|
-
endIcon
|
|
658
|
+
/* @__PURE__ */ import_react7.default.createElement("div", { className: "flex items-center gap-2" }, startIcon && /* @__PURE__ */ import_react7.default.createElement("span", null, startIcon), children),
|
|
659
|
+
endIcon && /* @__PURE__ */ import_react7.default.createElement("span", null, endIcon)
|
|
437
660
|
);
|
|
438
661
|
};
|
|
439
|
-
var
|
|
662
|
+
var Callout_default = Callout;
|
|
663
|
+
|
|
664
|
+
// app/components/Card.tsx
|
|
665
|
+
var import_react8 = __toESM(require("react"), 1);
|
|
666
|
+
function Card_default({ children, className }) {
|
|
667
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", { className: cn("bg-white rounded-lg border border-gray-200 shadow-sm", className) }, children);
|
|
668
|
+
}
|
|
669
|
+
var CardHeader = ({ children, className }) => {
|
|
670
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", { className: cn("p-4 pb-4", className) }, children);
|
|
671
|
+
};
|
|
672
|
+
var CardTitle = ({ children, className }) => {
|
|
673
|
+
return /* @__PURE__ */ import_react8.default.createElement("h3", { className: cn("text-lg font-semibold text-gray-900 mb-2", className) }, children);
|
|
674
|
+
};
|
|
675
|
+
var CardDescription = ({ children, className }) => {
|
|
676
|
+
return /* @__PURE__ */ import_react8.default.createElement("p", { className: cn("text-sm text-gray-600 mb-4", className) }, children);
|
|
677
|
+
};
|
|
678
|
+
var CardAction = ({ children, className }) => {
|
|
679
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", { className: cn("mt-4", className) }, children);
|
|
680
|
+
};
|
|
681
|
+
var CardContent = ({ children, className }) => {
|
|
682
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", { className: cn("p-6 pt-0", className) }, children);
|
|
683
|
+
};
|
|
684
|
+
var CardFooter = ({ children, className }) => {
|
|
685
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", { className: cn("p-6 pt-0", className) }, children);
|
|
686
|
+
};
|
|
440
687
|
|
|
441
688
|
// app/components/Checkbox.tsx
|
|
442
|
-
var
|
|
443
|
-
var
|
|
444
|
-
var checkboxVariant = (0,
|
|
689
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
690
|
+
var import_class_variance_authority3 = require("class-variance-authority");
|
|
691
|
+
var checkboxVariant = (0, import_class_variance_authority3.cva)(
|
|
445
692
|
"peer relative cursor-pointer appearance-none rounded-[4px] border border-gray-300 transition-all checked:border-primary-600 checked:bg-primary-50 hover:bg-primary-50 disabled:opacity-30 disabled:pointer-events-none",
|
|
446
693
|
{
|
|
447
694
|
variants: {
|
|
448
695
|
size: {
|
|
449
696
|
sm: "h-3 w-3",
|
|
450
|
-
lg: "h-3.5 w-3.5"
|
|
697
|
+
lg: "h-3.5 w-3.5",
|
|
698
|
+
xl: "h-4 w-4"
|
|
451
699
|
}
|
|
452
700
|
},
|
|
453
701
|
defaultVariants: {
|
|
@@ -455,47 +703,59 @@ var checkboxVariant = (0, import_class_variance_authority2.cva)(
|
|
|
455
703
|
}
|
|
456
704
|
}
|
|
457
705
|
);
|
|
458
|
-
var Checkbox = (0,
|
|
459
|
-
({ disabled, checked, size, className, children, ...props }, ref) => {
|
|
460
|
-
return /* @__PURE__ */
|
|
706
|
+
var Checkbox = (0, import_react9.forwardRef)(
|
|
707
|
+
({ disabled, checked, size, className, children, id, ...props }, ref) => {
|
|
708
|
+
return /* @__PURE__ */ import_react9.default.createElement("div", { className: "inline-flex relative items-center" }, /* @__PURE__ */ import_react9.default.createElement(
|
|
461
709
|
"input",
|
|
462
710
|
{
|
|
463
711
|
type: "checkbox",
|
|
464
712
|
ref,
|
|
713
|
+
id,
|
|
465
714
|
...props,
|
|
466
715
|
disabled,
|
|
467
716
|
checked,
|
|
468
|
-
className: cn(
|
|
717
|
+
className: cn(
|
|
718
|
+
"peer",
|
|
719
|
+
checkboxVariant({ className, size }),
|
|
720
|
+
"focus-visible:ring-2 focus-visible:ring-primary-600 focus-visible:ring-offset-2"
|
|
721
|
+
)
|
|
469
722
|
}
|
|
470
|
-
), /* @__PURE__ */
|
|
471
|
-
"
|
|
723
|
+
), /* @__PURE__ */ import_react9.default.createElement(
|
|
724
|
+
"span",
|
|
472
725
|
{
|
|
473
|
-
|
|
474
|
-
className: "
|
|
475
|
-
viewBox: "0 0 20 20",
|
|
476
|
-
fill: "currentColor",
|
|
477
|
-
stroke: "currentColor",
|
|
478
|
-
strokeWidth: "1"
|
|
726
|
+
"aria-hidden": "true",
|
|
727
|
+
className: "absolute text-primary-600 transition-opacity opacity-0 pointer-events-none top-2/4 left-2/4 -translate-y-2/4 -translate-x-2/4 peer-checked:opacity-100"
|
|
479
728
|
},
|
|
480
|
-
/* @__PURE__ */
|
|
481
|
-
"
|
|
729
|
+
/* @__PURE__ */ import_react9.default.createElement(
|
|
730
|
+
"svg",
|
|
482
731
|
{
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
732
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
733
|
+
className: "w-2.5 h-2.5",
|
|
734
|
+
viewBox: "0 0 20 20",
|
|
735
|
+
fill: "currentColor",
|
|
736
|
+
stroke: "currentColor",
|
|
737
|
+
strokeWidth: "1"
|
|
738
|
+
},
|
|
739
|
+
/* @__PURE__ */ import_react9.default.createElement(
|
|
740
|
+
"path",
|
|
741
|
+
{
|
|
742
|
+
fillRule: "evenodd",
|
|
743
|
+
d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
|
|
744
|
+
clipRule: "evenodd"
|
|
745
|
+
}
|
|
746
|
+
)
|
|
487
747
|
)
|
|
488
|
-
))
|
|
748
|
+
));
|
|
489
749
|
}
|
|
490
750
|
);
|
|
491
751
|
Checkbox.displayName = "Checkbox";
|
|
492
752
|
var Checkbox_default = Checkbox;
|
|
493
753
|
|
|
494
754
|
// app/components/Chip.tsx
|
|
495
|
-
var
|
|
496
|
-
var
|
|
497
|
-
var chipVariants = (0,
|
|
498
|
-
"
|
|
755
|
+
var import_react10 = __toESM(require("react"), 1);
|
|
756
|
+
var import_class_variance_authority4 = require("class-variance-authority");
|
|
757
|
+
var chipVariants = (0, import_class_variance_authority4.cva)(
|
|
758
|
+
"inline-flex items-center w-fit gap-2 rounded-full capitalize",
|
|
499
759
|
{
|
|
500
760
|
variants: {
|
|
501
761
|
intent: {
|
|
@@ -503,6 +763,7 @@ var chipVariants = (0, import_class_variance_authority3.cva)(
|
|
|
503
763
|
success: "bg-success-50 text-success-600",
|
|
504
764
|
warning: "bg-warning-50 text-warning-500",
|
|
505
765
|
error: "bg-error-50 text-error-600",
|
|
766
|
+
blue: "bg-blue-100 text-blue-700",
|
|
506
767
|
primary: "bg-primary-100 text-primary-700",
|
|
507
768
|
bluegray: "bg-bluegray-100 text-bluegray-500",
|
|
508
769
|
bluelight: "bg-bluelight-100 text-bluelight-600",
|
|
@@ -516,7 +777,7 @@ var chipVariants = (0, import_class_variance_authority3.cva)(
|
|
|
516
777
|
size: {
|
|
517
778
|
sm: "text-xs px-2 py-0.5",
|
|
518
779
|
md: "text-sm px-2.5 py-0.5",
|
|
519
|
-
lg: "text-
|
|
780
|
+
lg: "text-base px-3 py-1"
|
|
520
781
|
}
|
|
521
782
|
},
|
|
522
783
|
defaultVariants: {
|
|
@@ -530,6 +791,7 @@ var dotColorVariants = {
|
|
|
530
791
|
success: "bg-success-600",
|
|
531
792
|
warning: "bg-warning-600",
|
|
532
793
|
error: "bg-error-600",
|
|
794
|
+
blue: "bg-blue-600",
|
|
533
795
|
primary: "bg-primary-600",
|
|
534
796
|
bluegray: "bg-bluegray-500",
|
|
535
797
|
bluelight: "bg-bluelight-600",
|
|
@@ -546,23 +808,37 @@ var Chip = ({
|
|
|
546
808
|
size,
|
|
547
809
|
intent = "default",
|
|
548
810
|
dot,
|
|
549
|
-
dotColor
|
|
811
|
+
dotColor,
|
|
812
|
+
startIcon,
|
|
813
|
+
endIcon,
|
|
814
|
+
...rest
|
|
550
815
|
}) => {
|
|
551
816
|
const resolvedIntent = intent ?? "default";
|
|
552
|
-
return /* @__PURE__ */
|
|
817
|
+
return /* @__PURE__ */ import_react10.default.createElement(
|
|
553
818
|
"span",
|
|
554
819
|
{
|
|
555
|
-
className: cn(
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
820
|
+
className: cn(chipVariants({ intent: resolvedIntent, size }), className),
|
|
821
|
+
...rest
|
|
822
|
+
},
|
|
823
|
+
startIcon && /* @__PURE__ */ import_react10.default.createElement("span", { "aria-hidden": "true" }, startIcon),
|
|
824
|
+
!startIcon && dot && /* @__PURE__ */ import_react10.default.createElement(
|
|
825
|
+
"span",
|
|
826
|
+
{
|
|
827
|
+
"aria-hidden": "true",
|
|
828
|
+
className: cn(
|
|
829
|
+
"w-1.5 h-1.5 rounded-full",
|
|
830
|
+
dotColor || dotColorVariants[resolvedIntent] || "bg-primary-600"
|
|
831
|
+
)
|
|
832
|
+
}
|
|
833
|
+
),
|
|
834
|
+
children,
|
|
835
|
+
endIcon && /* @__PURE__ */ import_react10.default.createElement("span", { "aria-hidden": "true" }, endIcon)
|
|
836
|
+
);
|
|
562
837
|
};
|
|
563
838
|
var Chip_default = Chip;
|
|
564
839
|
|
|
565
840
|
// app/components/CircularProgress.tsx
|
|
841
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
566
842
|
var CircularProgressBar = ({
|
|
567
843
|
percentage,
|
|
568
844
|
size = 160,
|
|
@@ -574,7 +850,7 @@ var CircularProgressBar = ({
|
|
|
574
850
|
const viewBox = `0 0 ${size} ${size}`;
|
|
575
851
|
const dashArray = radius * Math.PI * 2;
|
|
576
852
|
const dashOffset = dashArray - dashArray * (percentage || 0) / 100;
|
|
577
|
-
return /* @__PURE__ */
|
|
853
|
+
return /* @__PURE__ */ import_react11.default.createElement("svg", { width: size, height: size, viewBox }, /* @__PURE__ */ import_react11.default.createElement(
|
|
578
854
|
"circle",
|
|
579
855
|
{
|
|
580
856
|
className: "fill-none stroke-gray-200",
|
|
@@ -583,7 +859,7 @@ var CircularProgressBar = ({
|
|
|
583
859
|
r: radius,
|
|
584
860
|
strokeWidth: `${strokeWidth}px`
|
|
585
861
|
}
|
|
586
|
-
), /* @__PURE__ */
|
|
862
|
+
), /* @__PURE__ */ import_react11.default.createElement(
|
|
587
863
|
"circle",
|
|
588
864
|
{
|
|
589
865
|
className: "fill-none stroke-primary-600 transition-all delay-200 ease-in",
|
|
@@ -598,7 +874,7 @@ var CircularProgressBar = ({
|
|
|
598
874
|
strokeDashoffset: dashOffset
|
|
599
875
|
}
|
|
600
876
|
}
|
|
601
|
-
), /* @__PURE__ */
|
|
877
|
+
), /* @__PURE__ */ import_react11.default.createElement(
|
|
602
878
|
"text",
|
|
603
879
|
{
|
|
604
880
|
x: "50%",
|
|
@@ -614,14 +890,14 @@ var CircularProgressBar = ({
|
|
|
614
890
|
var CircularProgress_default = CircularProgressBar;
|
|
615
891
|
|
|
616
892
|
// app/components/Divider.tsx
|
|
617
|
-
var
|
|
893
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
618
894
|
var Divider = ({
|
|
619
895
|
width,
|
|
620
896
|
height,
|
|
621
897
|
position = "horizontal",
|
|
622
898
|
className
|
|
623
899
|
}) => {
|
|
624
|
-
return /* @__PURE__ */
|
|
900
|
+
return /* @__PURE__ */ import_react12.default.createElement(
|
|
625
901
|
"div",
|
|
626
902
|
{
|
|
627
903
|
style: {
|
|
@@ -638,52 +914,142 @@ var Divider = ({
|
|
|
638
914
|
};
|
|
639
915
|
var Divider_default = Divider;
|
|
640
916
|
|
|
641
|
-
// app/components/
|
|
642
|
-
var import_react13 =
|
|
917
|
+
// app/components/Drawer.tsx
|
|
918
|
+
var import_react13 = require("react");
|
|
643
919
|
var import_react14 = require("@remixicon/react");
|
|
920
|
+
var Drawer = ({
|
|
921
|
+
isOpen,
|
|
922
|
+
setIsOpen,
|
|
923
|
+
children,
|
|
924
|
+
position = "right",
|
|
925
|
+
width = "w-80",
|
|
926
|
+
height = "h-64",
|
|
927
|
+
className,
|
|
928
|
+
showCloseButton = true,
|
|
929
|
+
closeOnOutsideClick = true
|
|
930
|
+
}) => {
|
|
931
|
+
const handleClose = (0, import_react13.useCallback)(() => {
|
|
932
|
+
setIsOpen(false);
|
|
933
|
+
}, [setIsOpen]);
|
|
934
|
+
(0, import_react13.useEffect)(() => {
|
|
935
|
+
document.body.style.overflow = isOpen ? "hidden" : "";
|
|
936
|
+
}, [isOpen]);
|
|
937
|
+
(0, import_react13.useEffect)(() => {
|
|
938
|
+
const handleKeyDown = (e) => {
|
|
939
|
+
if (e.key === "Escape" && isOpen) {
|
|
940
|
+
handleClose();
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
944
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
945
|
+
}, [isOpen, handleClose]);
|
|
946
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
947
|
+
"div",
|
|
948
|
+
{
|
|
949
|
+
className: cn(
|
|
950
|
+
"fixed inset-0 bg-black/50 transition-opacity duration-300 z-[10000000000000000]",
|
|
951
|
+
isOpen ? "opacity-100" : "opacity-0 pointer-events-none"
|
|
952
|
+
),
|
|
953
|
+
onClick: () => closeOnOutsideClick && handleClose()
|
|
954
|
+
}
|
|
955
|
+
), /* @__PURE__ */ React.createElement(
|
|
956
|
+
"div",
|
|
957
|
+
{
|
|
958
|
+
className: cn(
|
|
959
|
+
"fixed bg-white shadow-xl p-4 transition-transform duration-300 z-[100000000000000000]",
|
|
960
|
+
position === "right" && `top-0 right-0 ${width} h-full`,
|
|
961
|
+
position === "left" && `top-0 left-0 ${width} h-full`,
|
|
962
|
+
position === "top" && `top-0 left-0 w-full ${height}`,
|
|
963
|
+
position === "bottom" && `bottom-0 left-0 w-full ${height}`,
|
|
964
|
+
!isOpen && (position === "right" ? "translate-x-full" : position === "left" ? "-translate-x-full" : position === "top" ? "-translate-y-full" : "translate-y-full"),
|
|
965
|
+
isOpen && "translate-x-0 translate-y-0",
|
|
966
|
+
className
|
|
967
|
+
),
|
|
968
|
+
onClick: (e) => e.stopPropagation()
|
|
969
|
+
},
|
|
970
|
+
showCloseButton && /* @__PURE__ */ React.createElement(
|
|
971
|
+
Button_default,
|
|
972
|
+
{
|
|
973
|
+
size: "sm",
|
|
974
|
+
variant: "outlined",
|
|
975
|
+
intent: "default-outlined",
|
|
976
|
+
onClick: handleClose,
|
|
977
|
+
startIcon: /* @__PURE__ */ React.createElement(import_react14.RiCloseLine, { size: 20 }),
|
|
978
|
+
"aria-label": "Close drawer",
|
|
979
|
+
className: "absolute border-none p-1 transition-colors top-3 right-4"
|
|
980
|
+
}
|
|
981
|
+
),
|
|
982
|
+
/* @__PURE__ */ React.createElement("div", { className: "overflow-y-auto h-full" }, children)
|
|
983
|
+
));
|
|
984
|
+
};
|
|
985
|
+
var Drawer_default = Drawer;
|
|
986
|
+
|
|
987
|
+
// app/components/Dropdown.tsx
|
|
988
|
+
var import_react17 = __toESM(require("react"), 1);
|
|
989
|
+
var import_react18 = require("@remixicon/react");
|
|
644
990
|
|
|
645
991
|
// app/components/Input.tsx
|
|
646
|
-
var
|
|
647
|
-
var Input = (0,
|
|
648
|
-
({
|
|
649
|
-
|
|
992
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
993
|
+
var Input = (0, import_react15.forwardRef)(
|
|
994
|
+
({
|
|
995
|
+
size,
|
|
996
|
+
startIcon,
|
|
997
|
+
endIcon,
|
|
998
|
+
className,
|
|
999
|
+
type,
|
|
1000
|
+
error,
|
|
1001
|
+
disabled,
|
|
1002
|
+
id,
|
|
1003
|
+
"aria-label": ariaLabel,
|
|
1004
|
+
"aria-describedby": ariaDescribedby,
|
|
1005
|
+
...props
|
|
1006
|
+
}, ref) => {
|
|
1007
|
+
return /* @__PURE__ */ import_react15.default.createElement(
|
|
650
1008
|
"div",
|
|
651
1009
|
{
|
|
652
1010
|
className: cn(
|
|
653
|
-
"group flex items-center gap-2 p-3.5 border border-gray-200 rounded-lg bg-white shadow-
|
|
1011
|
+
"group flex items-center gap-2 p-3.5 border border-gray-200 rounded-lg bg-white shadow-[0px_1px_2px_0px_#1018280D] hover:bg-gray-50 hover:border-gray-300 focus-within:border-gray-800 focus-within:bg-gray-25 focus-within:hover:bg-gray-50 focus-within:hover:border-gray-800 has-[:disabled]:opacity-30 has-[:disabled]:bg-gray-300 has-[:disabled]:select-none has-[:disabled]:pointer-events-none",
|
|
654
1012
|
size === "sm" ? "w-[320px] h-10" : size === "lg" ? "w-[313px] h-11" : "w-full h-10",
|
|
1013
|
+
error && "border-error-500 hover:border-error-600 focus-within:border-error-500 focus-within:hover:border-error-500",
|
|
655
1014
|
className
|
|
656
1015
|
)
|
|
657
1016
|
},
|
|
658
|
-
/* @__PURE__ */
|
|
1017
|
+
startIcon && /* @__PURE__ */ import_react15.default.createElement(
|
|
659
1018
|
"span",
|
|
660
1019
|
{
|
|
1020
|
+
"aria-hidden": "true",
|
|
661
1021
|
className: cn(
|
|
662
|
-
|
|
663
|
-
disabled
|
|
1022
|
+
"group-hover:text-gray-600 group-focus-within:text-gray-600",
|
|
1023
|
+
disabled && "text-gray-900",
|
|
1024
|
+
error && "text-error-500"
|
|
664
1025
|
)
|
|
665
1026
|
},
|
|
666
1027
|
startIcon
|
|
667
1028
|
),
|
|
668
|
-
/* @__PURE__ */
|
|
1029
|
+
/* @__PURE__ */ import_react15.default.createElement(
|
|
669
1030
|
"input",
|
|
670
1031
|
{
|
|
671
1032
|
...props,
|
|
672
1033
|
ref,
|
|
1034
|
+
id,
|
|
673
1035
|
disabled,
|
|
674
1036
|
type,
|
|
1037
|
+
"aria-label": ariaLabel,
|
|
1038
|
+
"aria-describedby": ariaDescribedby,
|
|
1039
|
+
"aria-disabled": disabled,
|
|
675
1040
|
className: cn(
|
|
676
|
-
"w-full text-sm focus:outline-none bg-transparent disabled:text-gray-900 placeholder:text-gray-500 group-hover:placeholder:text-gray-500",
|
|
1041
|
+
"w-full text-sm focus:outline-none focus:ring-offset-0 bg-transparent disabled:text-gray-900 placeholder:text-gray-500 group-hover:placeholder:text-gray-500 rounded-md",
|
|
677
1042
|
size
|
|
678
1043
|
)
|
|
679
1044
|
}
|
|
680
1045
|
),
|
|
681
|
-
/* @__PURE__ */
|
|
1046
|
+
endIcon && /* @__PURE__ */ import_react15.default.createElement(
|
|
682
1047
|
"span",
|
|
683
1048
|
{
|
|
1049
|
+
"aria-hidden": "true",
|
|
684
1050
|
className: cn(
|
|
685
|
-
|
|
686
|
-
disabled
|
|
1051
|
+
"group-hover:text-gray-600 group-focus-within:text-gray-600",
|
|
1052
|
+
disabled && "text-gray-900"
|
|
687
1053
|
)
|
|
688
1054
|
},
|
|
689
1055
|
endIcon
|
|
@@ -695,9 +1061,9 @@ Input.displayName = "Input";
|
|
|
695
1061
|
var Input_default = Input;
|
|
696
1062
|
|
|
697
1063
|
// app/components/Label.tsx
|
|
698
|
-
var
|
|
699
|
-
var
|
|
700
|
-
var labelVariants = (0,
|
|
1064
|
+
var import_class_variance_authority5 = require("class-variance-authority");
|
|
1065
|
+
var import_react16 = __toESM(require("react"), 1);
|
|
1066
|
+
var labelVariants = (0, import_class_variance_authority5.cva)("flex item-start", {
|
|
701
1067
|
variants: {
|
|
702
1068
|
size: {
|
|
703
1069
|
sm: "text-xs",
|
|
@@ -718,52 +1084,39 @@ var Label = ({
|
|
|
718
1084
|
className,
|
|
719
1085
|
...props
|
|
720
1086
|
}) => {
|
|
721
|
-
return /* @__PURE__ */
|
|
1087
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
722
1088
|
"label",
|
|
723
1089
|
{
|
|
724
1090
|
htmlFor,
|
|
725
|
-
className: cn(
|
|
1091
|
+
className: cn(
|
|
1092
|
+
"cursor-pointer",
|
|
1093
|
+
labelVariants({ className, size }),
|
|
1094
|
+
disabled === true ? "opacity-30 select-none pointer-events-none" : "opacity-100"
|
|
1095
|
+
),
|
|
1096
|
+
"aria-disabled": disabled,
|
|
726
1097
|
...props
|
|
727
1098
|
},
|
|
728
|
-
children,
|
|
729
|
-
|
|
1099
|
+
/* @__PURE__ */ import_react16.default.createElement("span", { className: "flex items-center gap-1" }, children, required && /* @__PURE__ */ import_react16.default.createElement(
|
|
1100
|
+
"span",
|
|
1101
|
+
{
|
|
1102
|
+
"aria-label": "required field",
|
|
1103
|
+
role: "presentation",
|
|
1104
|
+
className: "text-red-500",
|
|
1105
|
+
"aria-hidden": "true"
|
|
1106
|
+
},
|
|
1107
|
+
"*"
|
|
1108
|
+
))
|
|
730
1109
|
);
|
|
731
1110
|
};
|
|
732
1111
|
var Label_default = Label;
|
|
733
1112
|
|
|
734
|
-
// app/components/Tooltip.tsx
|
|
735
|
-
var import_class_variance_authority5 = require("class-variance-authority");
|
|
736
|
-
var import_react12 = __toESM(require("react"), 1);
|
|
737
|
-
var tooltipVariants = (0, import_class_variance_authority5.cva)(
|
|
738
|
-
"bg-white shadow-lg rounded-lg absolute hidden group-hover:block p-3 z-10 max-w-[328px] w-max whitespace-normal opacity-0 group-hover:opacity-100 transform transition-all duration-1000 ease-in-out group-hover:delay-[2000ms]",
|
|
739
|
-
{
|
|
740
|
-
variants: {
|
|
741
|
-
position: {
|
|
742
|
-
top: "bottom-[calc(100%+0px)] group-hover:translate-y-0 delay-1000 translate-y-[-10px]",
|
|
743
|
-
right: "top-1/2 -translate-y-1/2 left-[calc(100%+0px)] group-hover:translate-x-0 translate-x-[-10px]",
|
|
744
|
-
bottom: "top-[calc(100%+0px)] group-hover:translate-y-0 translate-y-[10px]",
|
|
745
|
-
left: "top-1/2 -translate-y-1/2 right-[calc(100%+0px)] group-hover:translate-x-0 translate-x-[10px]"
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
);
|
|
750
|
-
var Tooltip = ({
|
|
751
|
-
position,
|
|
752
|
-
content,
|
|
753
|
-
children,
|
|
754
|
-
className,
|
|
755
|
-
...props
|
|
756
|
-
}) => {
|
|
757
|
-
return /* @__PURE__ */ import_react12.default.createElement("div", { ...props, className: "relative cursor-pointer text-sm group" }, /* @__PURE__ */ import_react12.default.createElement("div", null, children), /* @__PURE__ */ import_react12.default.createElement("span", { className: cn(tooltipVariants({ position }), className) }, content));
|
|
758
|
-
};
|
|
759
|
-
var Tooltip_default = Tooltip;
|
|
760
|
-
|
|
761
1113
|
// app/components/Dropdown.tsx
|
|
762
1114
|
var defaultRenderItem = (option) => {
|
|
763
|
-
return /* @__PURE__ */
|
|
1115
|
+
return /* @__PURE__ */ import_react17.default.createElement(MenuItem, { label: option.label, value: option.value });
|
|
764
1116
|
};
|
|
765
|
-
var Dropdown = (0,
|
|
1117
|
+
var Dropdown = (0, import_react17.forwardRef)(
|
|
766
1118
|
({
|
|
1119
|
+
id = `dropdown-${Math.random().toString(36).substring(2, 11)}`,
|
|
767
1120
|
options,
|
|
768
1121
|
selected,
|
|
769
1122
|
setSelected,
|
|
@@ -776,39 +1129,42 @@ var Dropdown = (0, import_react13.forwardRef)(
|
|
|
776
1129
|
position = "top",
|
|
777
1130
|
width,
|
|
778
1131
|
info,
|
|
779
|
-
dropDownTooltip = false,
|
|
780
1132
|
dropdownFooter = false,
|
|
781
1133
|
onApply,
|
|
782
1134
|
disabled = false,
|
|
783
|
-
onReset
|
|
1135
|
+
onReset,
|
|
1136
|
+
footerAction
|
|
784
1137
|
}, ref) => {
|
|
785
1138
|
var _a, _b;
|
|
786
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
787
|
-
const [filteredOptions, setFilteredOptions] = (0,
|
|
1139
|
+
const [searchQuery, setSearchQuery] = (0, import_react17.useState)("");
|
|
1140
|
+
const [filteredOptions, setFilteredOptions] = (0, import_react17.useState)(
|
|
788
1141
|
options || []
|
|
789
1142
|
);
|
|
790
|
-
const [dropdownMenu, setDropdownMenu] = (0,
|
|
791
|
-
const dropdownRef = (0,
|
|
792
|
-
(0,
|
|
793
|
-
(0,
|
|
1143
|
+
const [dropdownMenu, setDropdownMenu] = (0, import_react17.useState)(false);
|
|
1144
|
+
const dropdownRef = (0, import_react17.useRef)(null);
|
|
1145
|
+
(0, import_react17.useImperativeHandle)(ref, () => dropdownRef.current);
|
|
1146
|
+
(0, import_react17.useEffect)(() => {
|
|
794
1147
|
if (options) {
|
|
795
1148
|
setFilteredOptions(options);
|
|
796
1149
|
}
|
|
797
1150
|
}, [options]);
|
|
798
|
-
const memoizedFilteredOptions = (0,
|
|
1151
|
+
const memoizedFilteredOptions = (0, import_react17.useMemo)(() => {
|
|
799
1152
|
if (!search)
|
|
800
1153
|
return filteredOptions;
|
|
801
|
-
return filteredOptions.filter(
|
|
802
|
-
(
|
|
803
|
-
|
|
1154
|
+
return filteredOptions.filter((option) => {
|
|
1155
|
+
if (typeof option.label === "string") {
|
|
1156
|
+
return option.label.toLowerCase().includes(searchQuery.toLowerCase());
|
|
1157
|
+
}
|
|
1158
|
+
return option.label.toString().includes(searchQuery.toLowerCase());
|
|
1159
|
+
});
|
|
804
1160
|
}, [search, searchQuery, filteredOptions]);
|
|
805
|
-
const handleSearchChange = (0,
|
|
1161
|
+
const handleSearchChange = (0, import_react17.useCallback)(
|
|
806
1162
|
(e) => {
|
|
807
1163
|
setSearchQuery(e.target.value);
|
|
808
1164
|
},
|
|
809
1165
|
[]
|
|
810
1166
|
);
|
|
811
|
-
const toggleOption = (0,
|
|
1167
|
+
const toggleOption = (0, import_react17.useCallback)(
|
|
812
1168
|
(option) => {
|
|
813
1169
|
if (multiple && setSelected) {
|
|
814
1170
|
setSelected(
|
|
@@ -821,7 +1177,7 @@ var Dropdown = (0, import_react13.forwardRef)(
|
|
|
821
1177
|
},
|
|
822
1178
|
[multiple, setSelected]
|
|
823
1179
|
);
|
|
824
|
-
const handleCheckboxChange = (0,
|
|
1180
|
+
const handleCheckboxChange = (0, import_react17.useCallback)(
|
|
825
1181
|
(option) => {
|
|
826
1182
|
if (multiple && setSelected) {
|
|
827
1183
|
setSelected(
|
|
@@ -847,7 +1203,7 @@ var Dropdown = (0, import_react13.forwardRef)(
|
|
|
847
1203
|
setSelected == null ? void 0 : setSelected([]);
|
|
848
1204
|
setDropdownMenu(false);
|
|
849
1205
|
};
|
|
850
|
-
(0,
|
|
1206
|
+
(0, import_react17.useEffect)(() => {
|
|
851
1207
|
document.addEventListener("mousedown", handleClickOutside);
|
|
852
1208
|
return () => {
|
|
853
1209
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
@@ -858,12 +1214,13 @@ var Dropdown = (0, import_react13.forwardRef)(
|
|
|
858
1214
|
setDropdownMenu(false);
|
|
859
1215
|
}
|
|
860
1216
|
};
|
|
861
|
-
return /* @__PURE__ */
|
|
1217
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
862
1218
|
"div",
|
|
863
1219
|
{
|
|
1220
|
+
id,
|
|
864
1221
|
ref: dropdownRef,
|
|
865
1222
|
className: cn(
|
|
866
|
-
"relative ",
|
|
1223
|
+
"relative bg-gray-25 shadow-[0px_1px_2px_0px_#1018280D] rounded-lg",
|
|
867
1224
|
!width && "w-full",
|
|
868
1225
|
disabled && "cursor-not-allowed opacity-50"
|
|
869
1226
|
),
|
|
@@ -871,110 +1228,143 @@ var Dropdown = (0, import_react13.forwardRef)(
|
|
|
871
1228
|
width
|
|
872
1229
|
}
|
|
873
1230
|
},
|
|
874
|
-
/* @__PURE__ */
|
|
875
|
-
"
|
|
1231
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
1232
|
+
"button",
|
|
876
1233
|
{
|
|
1234
|
+
type: "button",
|
|
1235
|
+
"aria-haspopup": "listbox",
|
|
1236
|
+
"aria-expanded": dropdownMenu,
|
|
1237
|
+
"aria-labelledby": `${id}-label`,
|
|
1238
|
+
disabled,
|
|
877
1239
|
onClick: () => !disabled && setDropdownMenu((prev) => !prev),
|
|
1240
|
+
onKeyDown: (e) => {
|
|
1241
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1242
|
+
e.preventDefault();
|
|
1243
|
+
!disabled && setDropdownMenu((prev) => !prev);
|
|
1244
|
+
}
|
|
1245
|
+
},
|
|
878
1246
|
className: cn(
|
|
879
|
-
"hover:bg-gray-50 py-2 px-[14px] rounded-lg flex justify-between items-center text-gray-900 bg-gray-25 text-text-sm cursor-pointer",
|
|
880
|
-
dropdownMenu ? "border border-
|
|
1247
|
+
"w-full hover:bg-gray-50 py-2 px-[14px] rounded-lg flex justify-between items-center text-gray-900 bg-gray-25 text-text-sm cursor-pointer",
|
|
1248
|
+
dropdownMenu ? "border border-primary-600" : "border border-gray-200",
|
|
881
1249
|
disabled && "bg-gray-300 hover:bg-gray-300 cursor-not-allowed"
|
|
882
1250
|
)
|
|
883
1251
|
},
|
|
884
|
-
/* @__PURE__ */
|
|
885
|
-
|
|
886
|
-
{
|
|
887
|
-
className: cn(
|
|
888
|
-
"flex items-center gap-2 text-ellipsis overflow-hidden"
|
|
889
|
-
)
|
|
890
|
-
},
|
|
891
|
-
icon && /* @__PURE__ */ import_react13.default.createElement("span", null, icon),
|
|
892
|
-
/* @__PURE__ */ import_react13.default.createElement("p", { className: "line-clamp-1 w-full" }, multiple ? ((selected == null ? void 0 : selected.length) ?? 0) > 0 ? `${selected == null ? void 0 : selected.length} Selected` : dropdownText : ((_a = selected == null ? void 0 : selected[0]) == null ? void 0 : _a.label) ? (_b = selected == null ? void 0 : selected[0]) == null ? void 0 : _b.label : dropdownText)
|
|
893
|
-
),
|
|
894
|
-
/* @__PURE__ */ import_react13.default.createElement(import_react14.RiArrowDownSLine, { size: 18 })
|
|
1252
|
+
/* @__PURE__ */ import_react17.default.createElement("section", { className: "flex items-center gap-2 text-ellipsis overflow-hidden" }, icon && /* @__PURE__ */ import_react17.default.createElement("span", { "aria-hidden": "true" }, icon), /* @__PURE__ */ import_react17.default.createElement("span", { id: `${id}-label`, className: "line-clamp-1 w-full" }, multiple ? ((selected == null ? void 0 : selected.length) ?? 0) > 0 ? `${selected == null ? void 0 : selected.length} Selected` : dropdownText : ((_a = selected == null ? void 0 : selected[0]) == null ? void 0 : _a.label) ? (_b = selected == null ? void 0 : selected[0]) == null ? void 0 : _b.label : dropdownText)),
|
|
1253
|
+
/* @__PURE__ */ import_react17.default.createElement(import_react18.RiArrowDownSLine, { "aria-hidden": "true", size: 18 })
|
|
895
1254
|
),
|
|
896
|
-
/* @__PURE__ */
|
|
1255
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
897
1256
|
"ul",
|
|
898
1257
|
{
|
|
1258
|
+
role: "listbox",
|
|
1259
|
+
"aria-multiselectable": multiple,
|
|
1260
|
+
"aria-labelledby": `${id}-label`,
|
|
899
1261
|
className: cn(
|
|
900
1262
|
"max-h-0 opacity-0 overflow-hidden shadow-sm mt-1 rounded absolute text-[16px] bg-white z-[1000] w-full transition-all duration-75 delay-100 ease-in",
|
|
901
1263
|
position === "top" ? "top-10" : "bottom-10",
|
|
902
|
-
dropdownMenu
|
|
1264
|
+
dropdownMenu ? "border border-primary-600" : "border border-gray-200",
|
|
1265
|
+
dropdownMenu && "max-h-[360px] h-fit opacity-[1] transition-all ease-in duration-150"
|
|
903
1266
|
)
|
|
904
1267
|
},
|
|
905
|
-
search && /* @__PURE__ */
|
|
1268
|
+
search && /* @__PURE__ */ import_react17.default.createElement(
|
|
906
1269
|
Input_default,
|
|
907
1270
|
{
|
|
1271
|
+
id: `${id}-search`,
|
|
908
1272
|
type: "text",
|
|
909
1273
|
placeholder: "Search...",
|
|
1274
|
+
"aria-label": "Search options",
|
|
910
1275
|
value: searchQuery,
|
|
911
1276
|
onChange: handleSearchChange,
|
|
912
|
-
className: "rounded rounded-b-none text-gray-800 bg-white w-full h-[35px] pl-3",
|
|
913
|
-
endIcon: /* @__PURE__ */
|
|
1277
|
+
className: "rounded rounded-b-none text-gray-800 bg-white w-full h-[35px] pl-3 border-none",
|
|
1278
|
+
endIcon: /* @__PURE__ */ import_react17.default.createElement(import_react18.RiSearchLine, { size: 18 })
|
|
914
1279
|
}
|
|
915
1280
|
),
|
|
916
|
-
multiple && /* @__PURE__ */
|
|
917
|
-
"
|
|
1281
|
+
multiple && /* @__PURE__ */ import_react17.default.createElement("section", { className: "py-[6px] px-[14px] flex justify-between items-center" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
1282
|
+
"button",
|
|
918
1283
|
{
|
|
1284
|
+
type: "button",
|
|
1285
|
+
"aria-label": "Select all",
|
|
919
1286
|
onClick: handleSelectAll,
|
|
920
1287
|
className: "text-text-sm hover:text-primary-700 text-primary-600 cursor-pointer"
|
|
921
1288
|
},
|
|
922
1289
|
"Select all"
|
|
923
|
-
), /* @__PURE__ */
|
|
1290
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
924
1291
|
"button",
|
|
925
1292
|
{
|
|
1293
|
+
"aria-label": "Reset",
|
|
1294
|
+
type: "button",
|
|
926
1295
|
className: "text-text-sm text-warning-500 hover:text-warning-600",
|
|
927
1296
|
onClick: handleReset
|
|
928
1297
|
},
|
|
929
1298
|
"Reset"
|
|
930
1299
|
)),
|
|
931
|
-
/* @__PURE__ */
|
|
1300
|
+
/* @__PURE__ */ import_react17.default.createElement("section", { className: "max-h-[200px] transition-all duration-75 delay-100 ease-in-out overflow-y-scroll" }, options ? memoizedFilteredOptions == null ? void 0 : memoizedFilteredOptions.map((option, i) => {
|
|
932
1301
|
var _a2;
|
|
933
|
-
return /* @__PURE__ */
|
|
1302
|
+
return /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, { key: i }, multiple ? /* @__PURE__ */ import_react17.default.createElement(
|
|
934
1303
|
Label_default,
|
|
935
1304
|
{
|
|
936
|
-
className:
|
|
937
|
-
|
|
1305
|
+
className: cn(
|
|
1306
|
+
"has-[:checked]:bg-primary-50 has-[:checked]:border-primary-600 hover:bg-gray-50 flex flex-col py-[6px] px-[14px] cursor-pointer border-l-4 border-transparent",
|
|
1307
|
+
(option == null ? void 0 : option.disabledOption) && "opacity-50 cursor-not-allowed hover:bg-white text-gray-300 select-none"
|
|
1308
|
+
),
|
|
1309
|
+
htmlFor: `${id}-checkbox-${option.value}`,
|
|
938
1310
|
key: i
|
|
939
1311
|
},
|
|
940
|
-
/* @__PURE__ */
|
|
1312
|
+
/* @__PURE__ */ import_react17.default.createElement("section", { className: "flex items-center justify-between gap-2 w-full" }, /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
941
1313
|
Checkbox_default,
|
|
942
1314
|
{
|
|
943
|
-
id:
|
|
1315
|
+
id: `${id}-checkbox-${option.value}`,
|
|
944
1316
|
checked: (selected == null ? void 0 : selected.some(
|
|
945
1317
|
(item) => item.value === option.value
|
|
946
1318
|
)) ?? false,
|
|
947
|
-
onChange: () => handleCheckboxChange(option)
|
|
1319
|
+
onChange: () => handleCheckboxChange(option),
|
|
1320
|
+
disabled: option == null ? void 0 : option.disabledOption
|
|
948
1321
|
}
|
|
949
|
-
), /* @__PURE__ */
|
|
950
|
-
|
|
1322
|
+
), /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
1323
|
+
"div",
|
|
951
1324
|
{
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
1325
|
+
style: {
|
|
1326
|
+
color: (option == null ? void 0 : option.disabledOption) ? "#D1D5DB" : option.labelTextColor
|
|
1327
|
+
},
|
|
1328
|
+
className: cn(
|
|
1329
|
+
"break-words",
|
|
1330
|
+
(option == null ? void 0 : option.disabledOption) && "text-gray-300"
|
|
1331
|
+
)
|
|
1332
|
+
},
|
|
1333
|
+
renderItem(option)
|
|
1334
|
+
))), /* @__PURE__ */ import_react17.default.createElement("span", { className: "text-gray-500" }, option == null ? void 0 : option.info)),
|
|
1335
|
+
/* @__PURE__ */ import_react17.default.createElement("span", { className: "pt-[2px] text-text-sm text-gray-500" }, option == null ? void 0 : option.addInfo)
|
|
1336
|
+
) : /* @__PURE__ */ import_react17.default.createElement(
|
|
957
1337
|
Label_default,
|
|
958
1338
|
{
|
|
959
1339
|
key: i,
|
|
1340
|
+
htmlFor: `${id}-checkbox-${option.value}`,
|
|
960
1341
|
className: cn(
|
|
961
1342
|
"flex justify-between py-[6px] px-[14px] hover:bg-gray-50 gap-2 items-center border-l-4 border-transparent cursor-pointer",
|
|
962
1343
|
{
|
|
963
|
-
"bg-primary-50 border-primary-600": selected && ((_a2 = selected[0]) == null ? void 0 : _a2.value) === option.value
|
|
1344
|
+
"bg-primary-50 border-primary-600": selected && ((_a2 = selected[0]) == null ? void 0 : _a2.value) === option.value,
|
|
1345
|
+
"opacity-50 cursor-not-allowed hover:bg-white text-gray-500": option == null ? void 0 : option.disabledOption
|
|
964
1346
|
}
|
|
965
1347
|
),
|
|
966
|
-
onClick: () => toggleOption(option)
|
|
1348
|
+
onClick: () => !(option == null ? void 0 : option.disabledOption) && toggleOption(option)
|
|
967
1349
|
},
|
|
968
|
-
/* @__PURE__ */
|
|
969
|
-
|
|
1350
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
1351
|
+
"div",
|
|
970
1352
|
{
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
1353
|
+
style: {
|
|
1354
|
+
color: (option == null ? void 0 : option.disabledOption) ? "#D1D5DB" : option.labelTextColor
|
|
1355
|
+
},
|
|
1356
|
+
className: cn(
|
|
1357
|
+
"break-words",
|
|
1358
|
+
(option == null ? void 0 : option.disabledOption) && "text-gray-300"
|
|
1359
|
+
)
|
|
1360
|
+
},
|
|
1361
|
+
renderItem(option)
|
|
1362
|
+
),
|
|
1363
|
+
/* @__PURE__ */ import_react17.default.createElement("span", { className: "text-gray-500" }, info)
|
|
975
1364
|
));
|
|
976
1365
|
}) : children),
|
|
977
|
-
|
|
1366
|
+
footerAction && /* @__PURE__ */ import_react17.default.createElement("div", { className: "py-2 mt-1 px-2 border-t" }, footerAction),
|
|
1367
|
+
dropdownFooter && /* @__PURE__ */ import_react17.default.createElement(
|
|
978
1368
|
DropdownFooter,
|
|
979
1369
|
{
|
|
980
1370
|
setDropdownMenu,
|
|
@@ -986,28 +1376,24 @@ var Dropdown = (0, import_react13.forwardRef)(
|
|
|
986
1376
|
}
|
|
987
1377
|
);
|
|
988
1378
|
var MenuItem = ({ label, children }) => {
|
|
989
|
-
return /* @__PURE__ */
|
|
990
|
-
};
|
|
991
|
-
var DropdownTooltip = ({
|
|
992
|
-
tooltipContent
|
|
993
|
-
}) => {
|
|
994
|
-
const content = tooltipContent || "";
|
|
995
|
-
return content ? /* @__PURE__ */ import_react13.default.createElement(Tooltip_default, { position: "right", content }, /* @__PURE__ */ import_react13.default.createElement(import_react14.RiErrorWarningLine, { color: "#98A2B3", size: 14 })) : null;
|
|
1379
|
+
return /* @__PURE__ */ import_react17.default.createElement("p", { className: "break-all" }, label || children);
|
|
996
1380
|
};
|
|
997
1381
|
var DropdownFooter = ({
|
|
998
|
-
// onReset,
|
|
999
1382
|
onApply,
|
|
1000
1383
|
setDropdownMenu
|
|
1001
1384
|
}) => {
|
|
1002
|
-
return /* @__PURE__ */
|
|
1385
|
+
return /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex justify-end border-t border-gray-200 px-[14px] py-[8px] text-text-sm" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
1003
1386
|
"button",
|
|
1004
1387
|
{
|
|
1388
|
+
type: "button",
|
|
1005
1389
|
className: "text-primary-600 hover:text-primary-700",
|
|
1006
1390
|
onClick: () => {
|
|
1007
1391
|
if (onApply) {
|
|
1008
1392
|
onApply();
|
|
1009
1393
|
}
|
|
1010
|
-
setDropdownMenu
|
|
1394
|
+
if (setDropdownMenu) {
|
|
1395
|
+
setDropdownMenu(false);
|
|
1396
|
+
}
|
|
1011
1397
|
}
|
|
1012
1398
|
},
|
|
1013
1399
|
"Apply"
|
|
@@ -1016,38 +1402,324 @@ var DropdownFooter = ({
|
|
|
1016
1402
|
Dropdown.displayName = "Dropdown";
|
|
1017
1403
|
var Dropdown_default = Dropdown;
|
|
1018
1404
|
|
|
1405
|
+
// app/components/DropdownMenu.tsx
|
|
1406
|
+
var import_react19 = require("@remixicon/react");
|
|
1407
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
1408
|
+
var DropdownContext = import_react20.default.createContext(null);
|
|
1409
|
+
function DropdownMenu({ children }) {
|
|
1410
|
+
const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
|
|
1411
|
+
const [focusedIndex, setFocusedIndex] = (0, import_react20.useState)(-1);
|
|
1412
|
+
const triggerRef = (0, import_react20.useRef)(null);
|
|
1413
|
+
const contentRef = (0, import_react20.useRef)(null);
|
|
1414
|
+
const menuItemsRef = (0, import_react20.useRef)([]);
|
|
1415
|
+
const itemsCountRef = (0, import_react20.useRef)(0);
|
|
1416
|
+
const registerItem = (0, import_react20.useCallback)(() => {
|
|
1417
|
+
const idx = itemsCountRef.current;
|
|
1418
|
+
itemsCountRef.current += 1;
|
|
1419
|
+
return idx;
|
|
1420
|
+
}, []);
|
|
1421
|
+
const closeMenu = () => {
|
|
1422
|
+
setIsOpen(false);
|
|
1423
|
+
setFocusedIndex(-1);
|
|
1424
|
+
};
|
|
1425
|
+
(0, import_react20.useEffect)(() => {
|
|
1426
|
+
if (!isOpen)
|
|
1427
|
+
return;
|
|
1428
|
+
const handleClickOutside = (e) => {
|
|
1429
|
+
if (triggerRef.current && contentRef.current && !triggerRef.current.contains(e.target) && !contentRef.current.contains(e.target)) {
|
|
1430
|
+
closeMenu();
|
|
1431
|
+
}
|
|
1432
|
+
};
|
|
1433
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1434
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1435
|
+
}, [isOpen]);
|
|
1436
|
+
(0, import_react20.useEffect)(() => {
|
|
1437
|
+
if (!isOpen)
|
|
1438
|
+
return;
|
|
1439
|
+
const handleKey = (event) => {
|
|
1440
|
+
var _a;
|
|
1441
|
+
switch (event.key) {
|
|
1442
|
+
case "Escape":
|
|
1443
|
+
event.preventDefault();
|
|
1444
|
+
closeMenu();
|
|
1445
|
+
(_a = triggerRef.current) == null ? void 0 : _a.focus();
|
|
1446
|
+
break;
|
|
1447
|
+
case "ArrowDown":
|
|
1448
|
+
event.preventDefault();
|
|
1449
|
+
setFocusedIndex(
|
|
1450
|
+
(prev) => prev < itemsCountRef.current - 1 ? prev + 1 : 0
|
|
1451
|
+
);
|
|
1452
|
+
break;
|
|
1453
|
+
case "ArrowUp":
|
|
1454
|
+
event.preventDefault();
|
|
1455
|
+
setFocusedIndex(
|
|
1456
|
+
(prev) => prev > 0 ? prev - 1 : itemsCountRef.current - 1
|
|
1457
|
+
);
|
|
1458
|
+
break;
|
|
1459
|
+
case "Home":
|
|
1460
|
+
event.preventDefault();
|
|
1461
|
+
setFocusedIndex(0);
|
|
1462
|
+
break;
|
|
1463
|
+
case "End":
|
|
1464
|
+
event.preventDefault();
|
|
1465
|
+
setFocusedIndex(itemsCountRef.current - 1);
|
|
1466
|
+
break;
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
document.addEventListener("keydown", handleKey);
|
|
1470
|
+
setFocusedIndex(0);
|
|
1471
|
+
return () => document.removeEventListener("keydown", handleKey);
|
|
1472
|
+
}, [isOpen]);
|
|
1473
|
+
(0, import_react20.useEffect)(() => {
|
|
1474
|
+
if (!isOpen)
|
|
1475
|
+
return;
|
|
1476
|
+
const el = menuItemsRef.current[focusedIndex];
|
|
1477
|
+
if (el)
|
|
1478
|
+
el.focus();
|
|
1479
|
+
}, [focusedIndex, isOpen]);
|
|
1480
|
+
const contextValue = {
|
|
1481
|
+
isOpen,
|
|
1482
|
+
setIsOpen,
|
|
1483
|
+
triggerRef,
|
|
1484
|
+
contentRef,
|
|
1485
|
+
focusedIndex,
|
|
1486
|
+
setFocusedIndex,
|
|
1487
|
+
itemsCount: itemsCountRef.current,
|
|
1488
|
+
registerItem,
|
|
1489
|
+
menuItemsRef
|
|
1490
|
+
};
|
|
1491
|
+
return /* @__PURE__ */ import_react20.default.createElement(DropdownContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react20.default.createElement("div", { className: "relative inline-block text-left" }, children));
|
|
1492
|
+
}
|
|
1493
|
+
function DropdownMenuTrigger({
|
|
1494
|
+
children,
|
|
1495
|
+
isOpen,
|
|
1496
|
+
setIsOpen
|
|
1497
|
+
}) {
|
|
1498
|
+
const ctx = import_react20.default.useContext(DropdownContext);
|
|
1499
|
+
const actualIsOpen = (ctx == null ? void 0 : ctx.isOpen) ?? isOpen;
|
|
1500
|
+
const actualSetIsOpen = (ctx == null ? void 0 : ctx.setIsOpen) ?? setIsOpen;
|
|
1501
|
+
const handleKey = (e) => {
|
|
1502
|
+
switch (e.key) {
|
|
1503
|
+
case "Enter":
|
|
1504
|
+
case " ":
|
|
1505
|
+
e.preventDefault();
|
|
1506
|
+
actualSetIsOpen == null ? void 0 : actualSetIsOpen(!actualIsOpen);
|
|
1507
|
+
break;
|
|
1508
|
+
case "ArrowDown":
|
|
1509
|
+
e.preventDefault();
|
|
1510
|
+
actualSetIsOpen == null ? void 0 : actualSetIsOpen(true);
|
|
1511
|
+
break;
|
|
1512
|
+
case "ArrowUp":
|
|
1513
|
+
e.preventDefault();
|
|
1514
|
+
actualSetIsOpen == null ? void 0 : actualSetIsOpen(true);
|
|
1515
|
+
break;
|
|
1516
|
+
}
|
|
1517
|
+
};
|
|
1518
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
1519
|
+
"div",
|
|
1520
|
+
{
|
|
1521
|
+
ref: ctx == null ? void 0 : ctx.triggerRef,
|
|
1522
|
+
tabIndex: 0,
|
|
1523
|
+
role: "button",
|
|
1524
|
+
"aria-haspopup": "menu",
|
|
1525
|
+
"aria-expanded": actualIsOpen,
|
|
1526
|
+
onClick: () => actualSetIsOpen == null ? void 0 : actualSetIsOpen(!actualIsOpen),
|
|
1527
|
+
onKeyDown: handleKey,
|
|
1528
|
+
className: "cursor-pointer outline-none focus:ring-2 focus:ring-primary-500 rounded"
|
|
1529
|
+
},
|
|
1530
|
+
children
|
|
1531
|
+
);
|
|
1532
|
+
}
|
|
1533
|
+
function DropdownMenuContent({
|
|
1534
|
+
children,
|
|
1535
|
+
isOpen,
|
|
1536
|
+
align = "right",
|
|
1537
|
+
className = ""
|
|
1538
|
+
}) {
|
|
1539
|
+
const ctx = import_react20.default.useContext(DropdownContext);
|
|
1540
|
+
const actualIsOpen = (ctx == null ? void 0 : ctx.isOpen) ?? isOpen;
|
|
1541
|
+
const [visible, setVisible] = (0, import_react20.useState)(actualIsOpen);
|
|
1542
|
+
(0, import_react20.useEffect)(() => {
|
|
1543
|
+
if (actualIsOpen)
|
|
1544
|
+
setVisible(true);
|
|
1545
|
+
else
|
|
1546
|
+
setTimeout(() => setVisible(false), 150);
|
|
1547
|
+
}, [actualIsOpen]);
|
|
1548
|
+
if (!visible)
|
|
1549
|
+
return null;
|
|
1550
|
+
const pos = align === "left" || align === "start" ? "right-0" : align === "right" || align === "end" ? "left-0" : align === "center" ? "left-1/2 -translate-x-1/2" : "";
|
|
1551
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
1552
|
+
"div",
|
|
1553
|
+
{
|
|
1554
|
+
ref: ctx == null ? void 0 : ctx.contentRef,
|
|
1555
|
+
role: "menu",
|
|
1556
|
+
className: cn(
|
|
1557
|
+
"absolute w-56 mt-2 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 z-50 transition-all",
|
|
1558
|
+
actualIsOpen ? "opacity-100" : "opacity-0 -translate-y-2",
|
|
1559
|
+
pos,
|
|
1560
|
+
className
|
|
1561
|
+
)
|
|
1562
|
+
},
|
|
1563
|
+
children
|
|
1564
|
+
);
|
|
1565
|
+
}
|
|
1566
|
+
function DropdownMenuItemWrapper({
|
|
1567
|
+
children,
|
|
1568
|
+
onClick,
|
|
1569
|
+
onKeyDown,
|
|
1570
|
+
disabled,
|
|
1571
|
+
isSubTrigger,
|
|
1572
|
+
className,
|
|
1573
|
+
"aria-expanded": ariaExpanded
|
|
1574
|
+
}) {
|
|
1575
|
+
const ctx = import_react20.default.useContext(DropdownContext);
|
|
1576
|
+
const [index] = (0, import_react20.useState)(() => (ctx == null ? void 0 : ctx.registerItem()) ?? -1);
|
|
1577
|
+
const ref = (0, import_react20.useRef)(null);
|
|
1578
|
+
(0, import_react20.useEffect)(() => {
|
|
1579
|
+
if (ctx && index >= 0) {
|
|
1580
|
+
ctx.menuItemsRef.current[index] = ref.current;
|
|
1581
|
+
}
|
|
1582
|
+
}, [index, ctx]);
|
|
1583
|
+
const handleKey = (e) => {
|
|
1584
|
+
if (onKeyDown)
|
|
1585
|
+
onKeyDown(e);
|
|
1586
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1587
|
+
e.preventDefault();
|
|
1588
|
+
if (!disabled)
|
|
1589
|
+
onClick == null ? void 0 : onClick();
|
|
1590
|
+
}
|
|
1591
|
+
};
|
|
1592
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
1593
|
+
"div",
|
|
1594
|
+
{
|
|
1595
|
+
ref,
|
|
1596
|
+
role: "menuitem",
|
|
1597
|
+
tabIndex: disabled ? -1 : 0,
|
|
1598
|
+
"aria-disabled": disabled,
|
|
1599
|
+
"aria-expanded": ariaExpanded,
|
|
1600
|
+
onClick: () => !disabled && (onClick == null ? void 0 : onClick()),
|
|
1601
|
+
onKeyDown: handleKey,
|
|
1602
|
+
className: cn(
|
|
1603
|
+
"px-4 py-2 flex items-center justify-between text-sm cursor-pointer rounded",
|
|
1604
|
+
disabled ? "text-gray-400 cursor-not-allowed" : "hover:bg-gray-100",
|
|
1605
|
+
className
|
|
1606
|
+
)
|
|
1607
|
+
},
|
|
1608
|
+
children
|
|
1609
|
+
);
|
|
1610
|
+
}
|
|
1611
|
+
function DropdownMenuItem({
|
|
1612
|
+
children,
|
|
1613
|
+
className = "",
|
|
1614
|
+
onClick,
|
|
1615
|
+
disabled,
|
|
1616
|
+
shortcut
|
|
1617
|
+
}) {
|
|
1618
|
+
const ctx = import_react20.default.useContext(DropdownContext);
|
|
1619
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
1620
|
+
DropdownMenuItemWrapper,
|
|
1621
|
+
{
|
|
1622
|
+
disabled,
|
|
1623
|
+
onClick: () => {
|
|
1624
|
+
if (!disabled) {
|
|
1625
|
+
onClick == null ? void 0 : onClick();
|
|
1626
|
+
ctx == null ? void 0 : ctx.setIsOpen(false);
|
|
1627
|
+
}
|
|
1628
|
+
},
|
|
1629
|
+
className
|
|
1630
|
+
},
|
|
1631
|
+
/* @__PURE__ */ import_react20.default.createElement("span", null, children),
|
|
1632
|
+
shortcut && /* @__PURE__ */ import_react20.default.createElement("kbd", { className: "text-xs text-gray-400" }, shortcut)
|
|
1633
|
+
);
|
|
1634
|
+
}
|
|
1635
|
+
function DropdownMenuLabel({ children }) {
|
|
1636
|
+
return /* @__PURE__ */ import_react20.default.createElement("div", { className: "px-4 py-2 text-sm font-semibold text-gray-700" }, children);
|
|
1637
|
+
}
|
|
1638
|
+
function DropdownMenuSeparator() {
|
|
1639
|
+
return /* @__PURE__ */ import_react20.default.createElement("div", { className: "border-t border-gray-100 my-1" });
|
|
1640
|
+
}
|
|
1641
|
+
var SubmenuContext = import_react20.default.createContext(null);
|
|
1642
|
+
function DropdownMenuSub({ children }) {
|
|
1643
|
+
const [isSubOpen, setIsSubOpen] = (0, import_react20.useState)(false);
|
|
1644
|
+
return /* @__PURE__ */ import_react20.default.createElement(SubmenuContext.Provider, { value: { isSubOpen, setIsSubOpen } }, /* @__PURE__ */ import_react20.default.createElement("div", { className: "relative" }, children));
|
|
1645
|
+
}
|
|
1646
|
+
function DropdownMenuSubTrigger({ children }) {
|
|
1647
|
+
const sub = import_react20.default.useContext(SubmenuContext);
|
|
1648
|
+
const handleKey = (e) => {
|
|
1649
|
+
if (e.key === "ArrowRight") {
|
|
1650
|
+
e.preventDefault();
|
|
1651
|
+
sub.setIsSubOpen(true);
|
|
1652
|
+
} else if (e.key === "ArrowLeft") {
|
|
1653
|
+
e.preventDefault();
|
|
1654
|
+
sub.setIsSubOpen(false);
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1657
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
1658
|
+
DropdownMenuItemWrapper,
|
|
1659
|
+
{
|
|
1660
|
+
isSubTrigger: true,
|
|
1661
|
+
"aria-expanded": sub.isSubOpen,
|
|
1662
|
+
onClick: () => sub.setIsSubOpen(!sub.isSubOpen),
|
|
1663
|
+
onKeyDown: handleKey
|
|
1664
|
+
},
|
|
1665
|
+
/* @__PURE__ */ import_react20.default.createElement("span", { className: "flex-1" }, children),
|
|
1666
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
1667
|
+
import_react19.RiArrowDownSLine,
|
|
1668
|
+
{
|
|
1669
|
+
className: cn(
|
|
1670
|
+
"w-4 h-4 transition-transform",
|
|
1671
|
+
sub.isSubOpen && "rotate-180"
|
|
1672
|
+
)
|
|
1673
|
+
}
|
|
1674
|
+
)
|
|
1675
|
+
);
|
|
1676
|
+
}
|
|
1677
|
+
function DropdownMenuSubContent({ children }) {
|
|
1678
|
+
const sub = import_react20.default.useContext(SubmenuContext);
|
|
1679
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
1680
|
+
"div",
|
|
1681
|
+
{
|
|
1682
|
+
className: cn(
|
|
1683
|
+
"overflow-hidden bg-gray-50 transition-all",
|
|
1684
|
+
sub.isSubOpen ? "max-h-[300px] opacity-100" : "max-h-0 opacity-0"
|
|
1685
|
+
)
|
|
1686
|
+
},
|
|
1687
|
+
children
|
|
1688
|
+
);
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1019
1691
|
// app/components/DropdownWithIcon.tsx
|
|
1020
|
-
var
|
|
1021
|
-
var
|
|
1692
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
1693
|
+
var import_react22 = require("@remixicon/react");
|
|
1022
1694
|
var defaultRenderItem2 = (option) => {
|
|
1023
|
-
return /* @__PURE__ */
|
|
1695
|
+
return /* @__PURE__ */ import_react21.default.createElement(MenuItem2, { label: option.label, value: option.value });
|
|
1024
1696
|
};
|
|
1025
|
-
var DropdownWithIcon = (0,
|
|
1697
|
+
var DropdownWithIcon = (0, import_react21.forwardRef)(
|
|
1026
1698
|
({
|
|
1699
|
+
id = `dropdown-${Math.random().toString(36).substring(2, 11)}`,
|
|
1027
1700
|
options,
|
|
1028
1701
|
selected = [],
|
|
1029
1702
|
setSelected,
|
|
1030
1703
|
search = false,
|
|
1031
1704
|
multiple = false,
|
|
1705
|
+
dropdownText,
|
|
1032
1706
|
renderItem = defaultRenderItem2,
|
|
1033
1707
|
children,
|
|
1034
1708
|
trigger,
|
|
1035
|
-
// dropdownMenu = false,
|
|
1036
1709
|
position = "top",
|
|
1037
|
-
// setDropdownMenu = () => {},
|
|
1038
1710
|
width,
|
|
1039
1711
|
info,
|
|
1040
|
-
dropDownTooltip = false,
|
|
1041
1712
|
dropdownFooter = false,
|
|
1042
1713
|
onApply,
|
|
1043
1714
|
disabled = false,
|
|
1044
|
-
onReset
|
|
1715
|
+
onReset,
|
|
1716
|
+
footerAction
|
|
1045
1717
|
}, ref) => {
|
|
1046
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
1047
|
-
const localDropdownRef = (0,
|
|
1048
|
-
const [dropdownMenu, setDropdownMenu] = (0,
|
|
1049
|
-
(0,
|
|
1050
|
-
const memoizedFilteredOptions = (0,
|
|
1718
|
+
const [searchQuery, setSearchQuery] = (0, import_react21.useState)("");
|
|
1719
|
+
const localDropdownRef = (0, import_react21.useRef)(null);
|
|
1720
|
+
const [dropdownMenu, setDropdownMenu] = (0, import_react21.useState)(false);
|
|
1721
|
+
(0, import_react21.useImperativeHandle)(ref, () => localDropdownRef.current);
|
|
1722
|
+
const memoizedFilteredOptions = (0, import_react21.useMemo)(() => {
|
|
1051
1723
|
if (!search)
|
|
1052
1724
|
return options;
|
|
1053
1725
|
return options == null ? void 0 : options.filter(
|
|
@@ -1057,14 +1729,14 @@ var DropdownWithIcon = (0, import_react15.forwardRef)(
|
|
|
1057
1729
|
}
|
|
1058
1730
|
);
|
|
1059
1731
|
}, [search, searchQuery, options]);
|
|
1060
|
-
const handleSearchChange = (0,
|
|
1732
|
+
const handleSearchChange = (0, import_react21.useCallback)(
|
|
1061
1733
|
(e) => {
|
|
1062
1734
|
var _a;
|
|
1063
1735
|
setSearchQuery((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.value);
|
|
1064
1736
|
},
|
|
1065
1737
|
[]
|
|
1066
1738
|
);
|
|
1067
|
-
const toggleOption = (0,
|
|
1739
|
+
const toggleOption = (0, import_react21.useCallback)(
|
|
1068
1740
|
(option) => {
|
|
1069
1741
|
if (multiple && setSelected) {
|
|
1070
1742
|
setSelected(
|
|
@@ -1077,7 +1749,7 @@ var DropdownWithIcon = (0, import_react15.forwardRef)(
|
|
|
1077
1749
|
},
|
|
1078
1750
|
[multiple, setSelected, setDropdownMenu]
|
|
1079
1751
|
);
|
|
1080
|
-
const handleCheckboxChange = (0,
|
|
1752
|
+
const handleCheckboxChange = (0, import_react21.useCallback)(
|
|
1081
1753
|
(option) => {
|
|
1082
1754
|
if (multiple && setSelected) {
|
|
1083
1755
|
setSelected(
|
|
@@ -1103,7 +1775,7 @@ var DropdownWithIcon = (0, import_react15.forwardRef)(
|
|
|
1103
1775
|
setSelected == null ? void 0 : setSelected([]);
|
|
1104
1776
|
setDropdownMenu(false);
|
|
1105
1777
|
};
|
|
1106
|
-
(0,
|
|
1778
|
+
(0, import_react21.useEffect)(() => {
|
|
1107
1779
|
const handleClickOutside = (event) => {
|
|
1108
1780
|
var _a;
|
|
1109
1781
|
if ((localDropdownRef == null ? void 0 : localDropdownRef.current) && !((_a = localDropdownRef == null ? void 0 : localDropdownRef.current) == null ? void 0 : _a.contains(event == null ? void 0 : event.target))) {
|
|
@@ -1115,9 +1787,10 @@ var DropdownWithIcon = (0, import_react15.forwardRef)(
|
|
|
1115
1787
|
document == null ? void 0 : document.removeEventListener("mousedown", handleClickOutside);
|
|
1116
1788
|
};
|
|
1117
1789
|
}, [setDropdownMenu]);
|
|
1118
|
-
return /* @__PURE__ */
|
|
1790
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
1119
1791
|
"div",
|
|
1120
1792
|
{
|
|
1793
|
+
id,
|
|
1121
1794
|
ref: localDropdownRef,
|
|
1122
1795
|
className: cn(
|
|
1123
1796
|
"relative",
|
|
@@ -1128,14 +1801,42 @@ var DropdownWithIcon = (0, import_react15.forwardRef)(
|
|
|
1128
1801
|
width
|
|
1129
1802
|
}
|
|
1130
1803
|
},
|
|
1131
|
-
/* @__PURE__ */
|
|
1132
|
-
|
|
1804
|
+
/* @__PURE__ */ import_react21.default.createElement(
|
|
1805
|
+
"button",
|
|
1806
|
+
{
|
|
1807
|
+
type: "button",
|
|
1808
|
+
"aria-haspopup": "listbox",
|
|
1809
|
+
"aria-expanded": dropdownMenu,
|
|
1810
|
+
"aria-labelledby": `${id}-label`,
|
|
1811
|
+
disabled,
|
|
1812
|
+
onClick: () => !disabled && setDropdownMenu((prev) => !prev),
|
|
1813
|
+
onKeyDown: (e) => {
|
|
1814
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1815
|
+
e.preventDefault();
|
|
1816
|
+
!disabled && setDropdownMenu((prev) => !prev);
|
|
1817
|
+
}
|
|
1818
|
+
},
|
|
1819
|
+
className: cn(
|
|
1820
|
+
"w-full",
|
|
1821
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
1822
|
+
dropdownText && "flex items-center gap-2"
|
|
1823
|
+
)
|
|
1824
|
+
},
|
|
1825
|
+
trigger,
|
|
1826
|
+
dropdownText && /* @__PURE__ */ import_react21.default.createElement("span", { id: `${id}-label`, className: "text-sm text-gray-800" }, dropdownText)
|
|
1827
|
+
),
|
|
1828
|
+
/* @__PURE__ */ import_react21.default.createElement(
|
|
1133
1829
|
"ul",
|
|
1134
1830
|
{
|
|
1831
|
+
role: "listbox",
|
|
1832
|
+
"aria-multiselectable": multiple,
|
|
1833
|
+
"aria-labelledby": `${id}-label`,
|
|
1834
|
+
tabIndex: -1,
|
|
1135
1835
|
className: cn(
|
|
1136
1836
|
"max-h-0 opacity-0 overflow-hidden shadow-sm mt-1 rounded absolute text-[16px] bg-white z-[1000] w-full transition-all duration-75 delay-100 ease-in",
|
|
1837
|
+
dropdownMenu ? "border border-primary-600" : "border border-gray-200",
|
|
1137
1838
|
position === "top" ? "top-10" : position === "bottom" ? "bottom-10" : position === "left" ? "left-0" : position === "right" ? "right-[90%]" : "top-10",
|
|
1138
|
-
dropdownMenu && "max-h-[
|
|
1839
|
+
dropdownMenu && "max-h-[360px] h-fit opacity-[1] transition-all ease-in duration-150"
|
|
1139
1840
|
),
|
|
1140
1841
|
style: {
|
|
1141
1842
|
width,
|
|
@@ -1143,104 +1844,135 @@ var DropdownWithIcon = (0, import_react15.forwardRef)(
|
|
|
1143
1844
|
top: "calc(100% + 4px)"
|
|
1144
1845
|
}
|
|
1145
1846
|
},
|
|
1146
|
-
search && /* @__PURE__ */
|
|
1847
|
+
search && /* @__PURE__ */ import_react21.default.createElement(
|
|
1147
1848
|
Input_default,
|
|
1148
1849
|
{
|
|
1850
|
+
id: `${id}-search`,
|
|
1149
1851
|
type: "text",
|
|
1150
1852
|
placeholder: "Search...",
|
|
1853
|
+
"aria-label": "Search options",
|
|
1151
1854
|
value: searchQuery,
|
|
1152
1855
|
onChange: handleSearchChange,
|
|
1153
|
-
className: "rounded rounded-b-none text-gray-800 bg-white w-full h-[35px] pl-3",
|
|
1154
|
-
endIcon: /* @__PURE__ */
|
|
1856
|
+
className: "rounded rounded-b-none text-gray-800 bg-white w-full h-[35px] pl-3 border-none",
|
|
1857
|
+
endIcon: /* @__PURE__ */ import_react21.default.createElement(import_react22.RiSearchLine, { size: 18 })
|
|
1155
1858
|
}
|
|
1156
1859
|
),
|
|
1157
|
-
multiple && /* @__PURE__ */
|
|
1158
|
-
"
|
|
1860
|
+
multiple && /* @__PURE__ */ import_react21.default.createElement("section", { className: "py-[6px] px-[14px] flex justify-between items-center" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
1861
|
+
"button",
|
|
1159
1862
|
{
|
|
1863
|
+
type: "button",
|
|
1864
|
+
"aria-label": "Select all",
|
|
1160
1865
|
onClick: handleSelectAll,
|
|
1161
|
-
className: "text-text-sm hover:text-primary-700
|
|
1866
|
+
className: "text-text-sm hover:text-primary-700 text-primary-600 cursor-pointer"
|
|
1162
1867
|
},
|
|
1163
1868
|
"Select all"
|
|
1164
|
-
), /* @__PURE__ */
|
|
1869
|
+
), /* @__PURE__ */ import_react21.default.createElement(
|
|
1165
1870
|
"button",
|
|
1166
1871
|
{
|
|
1872
|
+
"aria-label": "Reset",
|
|
1873
|
+
type: "button",
|
|
1167
1874
|
className: "text-text-sm text-warning-500 hover:text-warning-600",
|
|
1168
1875
|
onClick: handleReset
|
|
1169
1876
|
},
|
|
1170
1877
|
"Reset"
|
|
1171
1878
|
)),
|
|
1172
|
-
/* @__PURE__ */
|
|
1879
|
+
/* @__PURE__ */ import_react21.default.createElement("section", { className: "max-h-[200px] z-[1000] transition-all duration-75 delay-100 ease-in-out overflow-y-scroll" }, options ? memoizedFilteredOptions == null ? void 0 : memoizedFilteredOptions.map((option, i) => {
|
|
1173
1880
|
var _a;
|
|
1174
|
-
return /* @__PURE__ */
|
|
1881
|
+
return /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, { key: i }, multiple ? /* @__PURE__ */ import_react21.default.createElement(
|
|
1175
1882
|
Label_default,
|
|
1176
1883
|
{
|
|
1177
|
-
className:
|
|
1178
|
-
|
|
1884
|
+
className: cn(
|
|
1885
|
+
"has-[:checked]:bg-primary-50 has-[:checked]:border-primary-600 hover:bg-gray-50 flex flex-col py-[6px] px-[14px] break-words cursor-pointer border-l-4 border-transparent",
|
|
1886
|
+
(option == null ? void 0 : option.disabledOption) && "opacity-50 cursor-not-allowed hover:bg-white text-gray-300 select-none"
|
|
1887
|
+
),
|
|
1888
|
+
htmlFor: `${id}-checkbox-${option.value}`,
|
|
1179
1889
|
key: i
|
|
1180
1890
|
},
|
|
1181
|
-
/* @__PURE__ */
|
|
1891
|
+
/* @__PURE__ */ import_react21.default.createElement("section", { className: "flex items-center justify-between gap-2 w-full" }, /* @__PURE__ */ import_react21.default.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
1182
1892
|
Checkbox_default,
|
|
1183
1893
|
{
|
|
1184
|
-
id:
|
|
1894
|
+
id: `${id}-checkbox-${option.value}`,
|
|
1185
1895
|
checked: selected == null ? void 0 : selected.some(
|
|
1186
1896
|
(item) => (item == null ? void 0 : item.value) === (option == null ? void 0 : option.value)
|
|
1187
1897
|
),
|
|
1188
|
-
onChange: () => handleCheckboxChange(option)
|
|
1898
|
+
onChange: () => handleCheckboxChange(option),
|
|
1899
|
+
disabled: option == null ? void 0 : option.disabledOption
|
|
1189
1900
|
}
|
|
1190
|
-
), /* @__PURE__ */
|
|
1191
|
-
|
|
1901
|
+
), /* @__PURE__ */ import_react21.default.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
1902
|
+
"div",
|
|
1192
1903
|
{
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1904
|
+
style: {
|
|
1905
|
+
color: (option == null ? void 0 : option.disabledOption) ? "#D1D5DB" : option.labelTextColor
|
|
1906
|
+
},
|
|
1907
|
+
className: cn(
|
|
1908
|
+
"break-words",
|
|
1909
|
+
(option == null ? void 0 : option.disabledOption) && "text-gray-300"
|
|
1910
|
+
)
|
|
1911
|
+
},
|
|
1912
|
+
renderItem(option)
|
|
1913
|
+
))), /* @__PURE__ */ import_react21.default.createElement("span", { className: "text-gray-500" }, option == null ? void 0 : option.info)),
|
|
1914
|
+
/* @__PURE__ */ import_react21.default.createElement("span", { className: "pt-[2px] text-text-sm text-gray-500" }, option == null ? void 0 : option.addInfo)
|
|
1915
|
+
) : /* @__PURE__ */ import_react21.default.createElement(
|
|
1198
1916
|
Label_default,
|
|
1199
1917
|
{
|
|
1918
|
+
htmlFor: `${id}-checkbox-${option.value}`,
|
|
1200
1919
|
key: i,
|
|
1201
1920
|
className: cn(
|
|
1202
1921
|
"flex justify-between py-[6px] px-[14px] hover:bg-gray-50 gap-2 items-center border-l-4 border-transparent cursor-pointer",
|
|
1203
1922
|
{
|
|
1204
|
-
"bg-primary-50 border-primary-600": selected && ((_a = selected[0]) == null ? void 0 : _a.value) === (option == null ? void 0 : option.value)
|
|
1923
|
+
"bg-primary-50 border-primary-600": selected && ((_a = selected[0]) == null ? void 0 : _a.value) === (option == null ? void 0 : option.value),
|
|
1924
|
+
"opacity-50 cursor-not-allowed hover:bg-white text-gray-500": option == null ? void 0 : option.disabledOption
|
|
1205
1925
|
}
|
|
1206
1926
|
),
|
|
1207
|
-
onClick: () => toggleOption(option)
|
|
1927
|
+
onClick: () => !(option == null ? void 0 : option.disabledOption) && toggleOption(option)
|
|
1208
1928
|
},
|
|
1209
|
-
/* @__PURE__ */
|
|
1210
|
-
|
|
1929
|
+
/* @__PURE__ */ import_react21.default.createElement(
|
|
1930
|
+
"div",
|
|
1211
1931
|
{
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1932
|
+
style: {
|
|
1933
|
+
color: (option == null ? void 0 : option.disabledOption) ? "#D1D5DB" : option.labelTextColor
|
|
1934
|
+
},
|
|
1935
|
+
className: cn(
|
|
1936
|
+
"break-words",
|
|
1937
|
+
(option == null ? void 0 : option.disabledOption) && "text-gray-300"
|
|
1938
|
+
)
|
|
1939
|
+
},
|
|
1940
|
+
renderItem(option)
|
|
1941
|
+
),
|
|
1942
|
+
/* @__PURE__ */ import_react21.default.createElement("span", { className: "text-gray-500" }, info)
|
|
1216
1943
|
));
|
|
1217
1944
|
}) : children),
|
|
1218
|
-
|
|
1945
|
+
footerAction && /* @__PURE__ */ import_react21.default.createElement("div", { className: "py-2 mt-1 px-2 border-t" }, footerAction),
|
|
1946
|
+
dropdownFooter && /* @__PURE__ */ import_react21.default.createElement(
|
|
1947
|
+
DropdownFooter2,
|
|
1948
|
+
{
|
|
1949
|
+
setDropdownMenu,
|
|
1950
|
+
onApply
|
|
1951
|
+
}
|
|
1952
|
+
)
|
|
1219
1953
|
)
|
|
1220
1954
|
);
|
|
1221
1955
|
}
|
|
1222
1956
|
);
|
|
1223
1957
|
var MenuItem2 = ({ label, children }) => {
|
|
1224
|
-
return /* @__PURE__ */
|
|
1225
|
-
};
|
|
1226
|
-
var DropdownTooltip2 = ({
|
|
1227
|
-
tooltipContent
|
|
1228
|
-
}) => {
|
|
1229
|
-
return tooltipContent ? /* @__PURE__ */ import_react15.default.createElement(Tooltip_default, { position: "right", content: tooltipContent }, /* @__PURE__ */ import_react15.default.createElement(import_react16.RiErrorWarningLine, { color: "#98A2B3", size: 14 })) : null;
|
|
1958
|
+
return /* @__PURE__ */ import_react21.default.createElement("p", { className: "break-all" }, label || children);
|
|
1230
1959
|
};
|
|
1231
1960
|
var DropdownFooter2 = ({
|
|
1232
1961
|
onApply,
|
|
1233
1962
|
setDropdownMenu
|
|
1234
1963
|
}) => {
|
|
1235
|
-
return /* @__PURE__ */
|
|
1964
|
+
return /* @__PURE__ */ import_react21.default.createElement("div", { className: "flex justify-end border-t border-gray-200 px-[14px] py-[8px] text-text-sm" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
1236
1965
|
"button",
|
|
1237
1966
|
{
|
|
1967
|
+
type: "button",
|
|
1238
1968
|
className: "text-primary-600 hover:text-primary-700",
|
|
1239
1969
|
onClick: () => {
|
|
1240
1970
|
if (onApply) {
|
|
1241
1971
|
onApply();
|
|
1242
1972
|
}
|
|
1243
|
-
setDropdownMenu
|
|
1973
|
+
if (setDropdownMenu) {
|
|
1974
|
+
setDropdownMenu(false);
|
|
1975
|
+
}
|
|
1244
1976
|
}
|
|
1245
1977
|
},
|
|
1246
1978
|
"Apply"
|
|
@@ -1249,9 +1981,45 @@ var DropdownFooter2 = ({
|
|
|
1249
1981
|
DropdownWithIcon.displayName = "DropdownWithIcon";
|
|
1250
1982
|
var DropdownWithIcon_default = DropdownWithIcon;
|
|
1251
1983
|
|
|
1984
|
+
// app/components/FileSelector.tsx
|
|
1985
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
1986
|
+
var FileSelector = (0, import_react23.forwardRef)(
|
|
1987
|
+
({ component, ...props }, ref) => {
|
|
1988
|
+
const internalRef = (0, import_react23.useRef)(null);
|
|
1989
|
+
const inputRef = ref || internalRef;
|
|
1990
|
+
const handleClick = () => {
|
|
1991
|
+
var _a;
|
|
1992
|
+
(_a = inputRef.current) == null ? void 0 : _a.click();
|
|
1993
|
+
};
|
|
1994
|
+
return /* @__PURE__ */ import_react23.default.createElement(
|
|
1995
|
+
"div",
|
|
1996
|
+
{
|
|
1997
|
+
onClick: handleClick,
|
|
1998
|
+
style: { display: "inline-block", cursor: "pointer" }
|
|
1999
|
+
},
|
|
2000
|
+
/* @__PURE__ */ import_react23.default.createElement(
|
|
2001
|
+
"input",
|
|
2002
|
+
{
|
|
2003
|
+
type: "file",
|
|
2004
|
+
ref: inputRef,
|
|
2005
|
+
...props,
|
|
2006
|
+
style: { display: "none" }
|
|
2007
|
+
}
|
|
2008
|
+
),
|
|
2009
|
+
component
|
|
2010
|
+
);
|
|
2011
|
+
}
|
|
2012
|
+
);
|
|
2013
|
+
FileSelector.displayName = "FileSelector";
|
|
2014
|
+
var FileSelector_default = FileSelector;
|
|
2015
|
+
|
|
1252
2016
|
// app/components/FileUpload.tsx
|
|
1253
|
-
var
|
|
1254
|
-
var
|
|
2017
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
2018
|
+
var import_react27 = require("@remixicon/react");
|
|
2019
|
+
|
|
2020
|
+
// app/components/FileUploadPreview.tsx
|
|
2021
|
+
var import_react24 = require("@remixicon/react");
|
|
2022
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
1255
2023
|
var getIconForMimeType = (file) => {
|
|
1256
2024
|
var _a;
|
|
1257
2025
|
const fileName = typeof file === "string" ? file : file.name;
|
|
@@ -1264,65 +2032,109 @@ var getIconForMimeType = (file) => {
|
|
|
1264
2032
|
case "gif":
|
|
1265
2033
|
case "svg":
|
|
1266
2034
|
case "webp":
|
|
1267
|
-
iconComponent = /* @__PURE__ */
|
|
2035
|
+
iconComponent = /* @__PURE__ */ import_react25.default.createElement(import_react24.RiImageLine, { className: "text-primary-600 bg-primary-100 border-4 border-primary-50 w-8 h-8 p-1 rounded-full" });
|
|
1268
2036
|
break;
|
|
1269
2037
|
case "mp3":
|
|
1270
2038
|
case "wav":
|
|
1271
2039
|
case "ogg":
|
|
1272
|
-
iconComponent = /* @__PURE__ */
|
|
2040
|
+
iconComponent = /* @__PURE__ */ import_react25.default.createElement(import_react24.RiMusic2Line, { className: "text-primary-600 bg-primary-100 border-4 border-primary-50 w-8 h-8 p-1 rounded-full" });
|
|
1273
2041
|
break;
|
|
1274
2042
|
case "mp4":
|
|
1275
2043
|
case "avi":
|
|
1276
2044
|
case "mkv":
|
|
1277
|
-
iconComponent = /* @__PURE__ */
|
|
2045
|
+
iconComponent = /* @__PURE__ */ import_react25.default.createElement(import_react24.RiVideoLine, { className: "text-primary-600 bg-primary-100 border-4 border-primary-50 w-8 h-8 p-1 rounded-full" });
|
|
1278
2046
|
break;
|
|
1279
2047
|
case "xls":
|
|
1280
2048
|
case "xlsx":
|
|
1281
2049
|
case "csv":
|
|
1282
2050
|
case "txt":
|
|
1283
2051
|
case "ods":
|
|
1284
|
-
iconComponent = /* @__PURE__ */
|
|
2052
|
+
iconComponent = /* @__PURE__ */ import_react25.default.createElement(import_react24.RiFileExcel2Line, { className: "text-primary-600 bg-primary-100 border-4 border-primary-50 w-8 h-8 p-1 rounded-full" });
|
|
1285
2053
|
break;
|
|
1286
2054
|
case "doc":
|
|
1287
2055
|
case "docx":
|
|
1288
2056
|
case "odt":
|
|
1289
2057
|
case "xml":
|
|
1290
|
-
iconComponent = /* @__PURE__ */
|
|
2058
|
+
iconComponent = /* @__PURE__ */ import_react25.default.createElement(import_react24.RiFileWord2Line, { className: "text-primary-600 bg-primary-100 border-4 border-primary-50 w-8 h-8 p-1 rounded-full" });
|
|
1291
2059
|
break;
|
|
1292
2060
|
case "pptx":
|
|
1293
2061
|
case "pptm":
|
|
1294
2062
|
case "xps":
|
|
1295
2063
|
case "ppsx":
|
|
1296
|
-
iconComponent = /* @__PURE__ */
|
|
2064
|
+
iconComponent = /* @__PURE__ */ import_react25.default.createElement(import_react24.RiFilePpt2Line, { className: "text-primary-600 bg-primary-100 border-4 border-primary-50 w-8 h-8 p-1 rounded-full" });
|
|
1297
2065
|
break;
|
|
1298
2066
|
case "rar":
|
|
1299
2067
|
case "zip":
|
|
1300
|
-
iconComponent = /* @__PURE__ */
|
|
2068
|
+
iconComponent = /* @__PURE__ */ import_react25.default.createElement(import_react24.RiFileZipLine, { className: "text-primary-600 bg-primary-100 border-4 border-primary-50 w-8 h-8 p-1 rounded-full" });
|
|
1301
2069
|
break;
|
|
1302
2070
|
case "pdf":
|
|
1303
|
-
iconComponent = /* @__PURE__ */
|
|
2071
|
+
iconComponent = /* @__PURE__ */ import_react25.default.createElement(import_react24.RiFilePdf2Line, { className: "text-primary-600 bg-primary-100 border-4 border-primary-50 w-8 h-8 p-1 rounded-full" });
|
|
1304
2072
|
break;
|
|
1305
2073
|
default:
|
|
1306
|
-
iconComponent = /* @__PURE__ */
|
|
2074
|
+
iconComponent = /* @__PURE__ */ import_react25.default.createElement(import_react24.RiFileLine, { className: "text-primary-600 bg-primary-100 border-4 border-primary-50 w-8 h-8 p-1 rounded-full" });
|
|
1307
2075
|
break;
|
|
1308
2076
|
}
|
|
1309
2077
|
return iconComponent;
|
|
1310
2078
|
};
|
|
1311
|
-
var
|
|
2079
|
+
var FileUploadPreview = ({
|
|
2080
|
+
index,
|
|
2081
|
+
file,
|
|
2082
|
+
children,
|
|
2083
|
+
onDelete
|
|
2084
|
+
}) => {
|
|
2085
|
+
return /* @__PURE__ */ import_react25.default.createElement(
|
|
2086
|
+
"div",
|
|
2087
|
+
{
|
|
2088
|
+
key: index,
|
|
2089
|
+
className: "p-4 border border-gray-200 rounded-lg flex items-center justify-between gap-5"
|
|
2090
|
+
},
|
|
2091
|
+
/* @__PURE__ */ import_react25.default.createElement("div", { className: "flex items-center gap-2 w-full" }, getIconForMimeType(file), /* @__PURE__ */ import_react25.default.createElement("div", { className: "flex flex-col gap-1 w-full" }, /* @__PURE__ */ import_react25.default.createElement("p", { className: "text-sm line-clamp-2 break-all" }, typeof file === "string" ? file : file.name, " "), children && /* @__PURE__ */ import_react25.default.createElement("div", { className: "w-full" }, children))),
|
|
2092
|
+
/* @__PURE__ */ import_react25.default.createElement("button", { type: "button", onClick: () => onDelete == null ? void 0 : onDelete(index) }, /* @__PURE__ */ import_react25.default.createElement(import_react24.RiDeleteBinLine, { className: "text-gray-500 w-5 h-5 cursor-pointer" }))
|
|
2093
|
+
);
|
|
2094
|
+
};
|
|
2095
|
+
var FileUploadPreview_default = FileUploadPreview;
|
|
2096
|
+
|
|
2097
|
+
// app/components/FileUpload.tsx
|
|
2098
|
+
var FileUpload = (0, import_react26.forwardRef)(
|
|
1312
2099
|
({
|
|
1313
2100
|
selectedFile,
|
|
2101
|
+
setSelectedFile,
|
|
1314
2102
|
onChange,
|
|
1315
2103
|
multiple,
|
|
1316
2104
|
onDelete,
|
|
1317
2105
|
children,
|
|
1318
2106
|
disabled,
|
|
1319
2107
|
title,
|
|
2108
|
+
filePreviewClassName,
|
|
1320
2109
|
id,
|
|
1321
2110
|
className,
|
|
1322
2111
|
accept,
|
|
1323
2112
|
...props
|
|
1324
2113
|
}, ref) => {
|
|
1325
|
-
|
|
2114
|
+
const [isDragging, setIsDragging] = (0, import_react26.useState)(false);
|
|
2115
|
+
const handleDragOver = (e) => {
|
|
2116
|
+
e.preventDefault();
|
|
2117
|
+
if (!disabled)
|
|
2118
|
+
setIsDragging(true);
|
|
2119
|
+
};
|
|
2120
|
+
const handleDragLeave = () => {
|
|
2121
|
+
setIsDragging(false);
|
|
2122
|
+
};
|
|
2123
|
+
const handleDrop = (e) => {
|
|
2124
|
+
e.preventDefault();
|
|
2125
|
+
setIsDragging(false);
|
|
2126
|
+
if (disabled)
|
|
2127
|
+
return;
|
|
2128
|
+
const files = Array.from(e.dataTransfer.files);
|
|
2129
|
+
if (files.length === 0)
|
|
2130
|
+
return;
|
|
2131
|
+
if (multiple) {
|
|
2132
|
+
setSelectedFile && setSelectedFile([...selectedFile || [], ...files]);
|
|
2133
|
+
} else {
|
|
2134
|
+
setSelectedFile && setSelectedFile([files[0]]);
|
|
2135
|
+
}
|
|
2136
|
+
};
|
|
2137
|
+
return /* @__PURE__ */ import_react26.default.createElement("div", { className: "flex flex-col gap-2" }, /* @__PURE__ */ import_react26.default.createElement(
|
|
1326
2138
|
"input",
|
|
1327
2139
|
{
|
|
1328
2140
|
type: "file",
|
|
@@ -1335,33 +2147,40 @@ var FileUpload = (0, import_react17.forwardRef)(
|
|
|
1335
2147
|
hidden: true,
|
|
1336
2148
|
ref
|
|
1337
2149
|
}
|
|
1338
|
-
), /* @__PURE__ */
|
|
2150
|
+
), /* @__PURE__ */ import_react26.default.createElement(
|
|
1339
2151
|
Label_default,
|
|
1340
2152
|
{
|
|
1341
2153
|
htmlFor: id,
|
|
1342
2154
|
disabled,
|
|
2155
|
+
role: "button",
|
|
2156
|
+
"aria-label": `Upload ${multiple ? "files" : "file"}`,
|
|
2157
|
+
tabIndex: 0,
|
|
2158
|
+
onKeyDown: (e) => {
|
|
2159
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2160
|
+
e.preventDefault();
|
|
2161
|
+
e.currentTarget.click();
|
|
2162
|
+
}
|
|
2163
|
+
},
|
|
2164
|
+
onDragOver: handleDragOver,
|
|
2165
|
+
onDragLeave: handleDragLeave,
|
|
2166
|
+
onDrop: handleDrop,
|
|
1343
2167
|
className: cn(
|
|
1344
|
-
"w-full h-[126px] border-2 border-dashed border-gray-200 hover:bg-gray-200 cursor-pointer rounded-lg px-6 py-4 flex
|
|
2168
|
+
"w-full h-[126px] border-2 border-dashed border-gray-200 hover:bg-gray-200 cursor-pointer rounded-lg px-6 py-4 flex items-center justify-center transition-all",
|
|
2169
|
+
isDragging && "border-primary-500 bg-primary-50",
|
|
1345
2170
|
disabled && "pointer-events-none",
|
|
1346
2171
|
className
|
|
1347
2172
|
)
|
|
1348
2173
|
},
|
|
1349
|
-
/* @__PURE__ */
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
"div",
|
|
2174
|
+
/* @__PURE__ */ import_react26.default.createElement("div", { className: cn("grid grid-cols-1 place-items-center gap-2") }, /* @__PURE__ */ import_react26.default.createElement("div", { className: "w-10 h-10 border-[6px] border-gray-50 bg-gray-200 rounded-full p-1 flex justify-center items-center" }, /* @__PURE__ */ import_react26.default.createElement(import_react27.RiUpload2Line, { className: "w-5 h-5" })), /* @__PURE__ */ import_react26.default.createElement("div", null, /* @__PURE__ */ import_react26.default.createElement("p", { className: "text-center text-sm text-gray-600" }, /* @__PURE__ */ import_react26.default.createElement("span", { className: "text-primary-600 font-semibold" }, "Click to upload or drag and drop"), " ", /* @__PURE__ */ import_react26.default.createElement("br", null), " ", title)))
|
|
2175
|
+
), /* @__PURE__ */ import_react26.default.createElement("section", { className: cn(`grid gap-2`, filePreviewClassName) }, selectedFile == null ? void 0 : selectedFile.map((file, index) => /* @__PURE__ */ import_react26.default.createElement(
|
|
2176
|
+
FileUploadPreview_default,
|
|
1353
2177
|
{
|
|
1354
|
-
key: index,
|
|
1355
|
-
|
|
2178
|
+
key: file.name || index,
|
|
2179
|
+
file,
|
|
2180
|
+
index,
|
|
2181
|
+
onDelete
|
|
1356
2182
|
},
|
|
1357
|
-
|
|
1358
|
-
/* @__PURE__ */ import_react17.default.createElement(
|
|
1359
|
-
import_react18.RiDeleteBinLine,
|
|
1360
|
-
{
|
|
1361
|
-
onClick: onDelete,
|
|
1362
|
-
className: "text-gray-500 w-5 h-5 cursor-pointer"
|
|
1363
|
-
}
|
|
1364
|
-
)
|
|
2183
|
+
children
|
|
1365
2184
|
))));
|
|
1366
2185
|
}
|
|
1367
2186
|
);
|
|
@@ -1369,8 +2188,8 @@ FileUpload.displayName = "FileUpload";
|
|
|
1369
2188
|
var FileUpload_default = FileUpload;
|
|
1370
2189
|
|
|
1371
2190
|
// app/components/GlobalNavigation.tsx
|
|
1372
|
-
var
|
|
1373
|
-
var GlobalNavigation = (0,
|
|
2191
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
2192
|
+
var GlobalNavigation = (0, import_react28.forwardRef)(
|
|
1374
2193
|
({
|
|
1375
2194
|
isOpen,
|
|
1376
2195
|
setIsOpen,
|
|
@@ -1379,27 +2198,30 @@ var GlobalNavigation = (0, import_react19.forwardRef)(
|
|
|
1379
2198
|
className,
|
|
1380
2199
|
postion = "bottom-right"
|
|
1381
2200
|
}, ref) => {
|
|
1382
|
-
const
|
|
1383
|
-
(0,
|
|
2201
|
+
const triggerRef = (0, import_react28.useRef)(null);
|
|
2202
|
+
const contentRef = (0, import_react28.useRef)(null);
|
|
2203
|
+
(0, import_react28.useEffect)(() => {
|
|
1384
2204
|
const handleClickOutside = (event) => {
|
|
1385
|
-
|
|
2205
|
+
var _a, _b;
|
|
2206
|
+
if (!((_a = triggerRef.current) == null ? void 0 : _a.contains(event.target)) && !((_b = contentRef.current) == null ? void 0 : _b.contains(event.target))) {
|
|
1386
2207
|
setIsOpen(false);
|
|
1387
2208
|
}
|
|
1388
2209
|
};
|
|
1389
2210
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1390
2211
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1391
|
-
}, []);
|
|
1392
|
-
return /* @__PURE__ */
|
|
2212
|
+
}, [setIsOpen]);
|
|
2213
|
+
return /* @__PURE__ */ import_react28.default.createElement("div", { className: "relative w-max", ref }, /* @__PURE__ */ import_react28.default.createElement(
|
|
1393
2214
|
"div",
|
|
1394
2215
|
{
|
|
1395
2216
|
className: "cursor-pointer",
|
|
1396
|
-
ref:
|
|
2217
|
+
ref: triggerRef,
|
|
1397
2218
|
onClick: () => setIsOpen(!isOpen)
|
|
1398
2219
|
},
|
|
1399
2220
|
trigger
|
|
1400
|
-
), isOpen && /* @__PURE__ */
|
|
2221
|
+
), isOpen && /* @__PURE__ */ import_react28.default.createElement(
|
|
1401
2222
|
"div",
|
|
1402
2223
|
{
|
|
2224
|
+
ref: contentRef,
|
|
1403
2225
|
className: cn(
|
|
1404
2226
|
"absolute z-10 bg-white rounded-lg shadow-sm border min-w-[200px] p-4 transition-all duration-300 ease-in-out",
|
|
1405
2227
|
postion === "bottom-left" && "left-0 top-4/4",
|
|
@@ -1417,9 +2239,9 @@ GlobalNavigation.displayName = "GlobalNavigation";
|
|
|
1417
2239
|
var GlobalNavigation_default = GlobalNavigation;
|
|
1418
2240
|
|
|
1419
2241
|
// app/components/HelperText.tsx
|
|
1420
|
-
var
|
|
2242
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
1421
2243
|
var HelperText = ({ children, className, size, error }) => {
|
|
1422
|
-
return /* @__PURE__ */
|
|
2244
|
+
return /* @__PURE__ */ import_react29.default.createElement(
|
|
1423
2245
|
"span",
|
|
1424
2246
|
{
|
|
1425
2247
|
className: cn(
|
|
@@ -1436,42 +2258,134 @@ var HelperText_default = HelperText;
|
|
|
1436
2258
|
|
|
1437
2259
|
// app/components/ListItem.tsx
|
|
1438
2260
|
var import_link = __toESM(require("next/link"), 1);
|
|
1439
|
-
var
|
|
1440
|
-
var ListItem =
|
|
2261
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
2262
|
+
var ListItem = import_react30.default.forwardRef(({ className, title, href, onClick, as = "link", icon }, ref) => {
|
|
2263
|
+
const commonClasses = cn(
|
|
2264
|
+
"px-4 py-[8px] w-full flex items-center gap-2 focus:outline-none focus:ring-2 focus:ring-primary-600 focus-visible:ring-2 rounded",
|
|
2265
|
+
className
|
|
2266
|
+
);
|
|
1441
2267
|
if (as === "button") {
|
|
1442
|
-
return /* @__PURE__ */
|
|
2268
|
+
return /* @__PURE__ */ import_react30.default.createElement(
|
|
1443
2269
|
"button",
|
|
1444
2270
|
{
|
|
1445
|
-
className:
|
|
1446
|
-
"px-4 py-[8px] w-full text-left flex items-center gap-2",
|
|
1447
|
-
className
|
|
1448
|
-
),
|
|
2271
|
+
className: commonClasses,
|
|
1449
2272
|
onClick,
|
|
1450
|
-
ref
|
|
2273
|
+
ref,
|
|
2274
|
+
type: "button",
|
|
2275
|
+
role: "menuitem"
|
|
1451
2276
|
},
|
|
1452
|
-
/* @__PURE__ */
|
|
1453
|
-
icon && /* @__PURE__ */
|
|
2277
|
+
/* @__PURE__ */ import_react30.default.createElement("span", { className: "text-base font-normal" }, title),
|
|
2278
|
+
icon && /* @__PURE__ */ import_react30.default.createElement("span", { className: "flex-shrink-0", "aria-hidden": "true" }, icon)
|
|
1454
2279
|
);
|
|
1455
2280
|
}
|
|
1456
|
-
return /* @__PURE__ */
|
|
2281
|
+
return /* @__PURE__ */ import_react30.default.createElement(
|
|
1457
2282
|
import_link.default,
|
|
1458
2283
|
{
|
|
1459
2284
|
href: href ?? "",
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
2285
|
+
className: commonClasses,
|
|
2286
|
+
ref,
|
|
2287
|
+
role: "menuitem",
|
|
2288
|
+
onClick: (e) => {
|
|
2289
|
+
if (!href) {
|
|
2290
|
+
e.preventDefault();
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
1463
2293
|
},
|
|
1464
|
-
/* @__PURE__ */
|
|
1465
|
-
icon && /* @__PURE__ */
|
|
2294
|
+
/* @__PURE__ */ import_react30.default.createElement("span", { className: "text-base font-normal" }, title),
|
|
2295
|
+
icon && /* @__PURE__ */ import_react30.default.createElement("span", { className: "flex-shrink-0", "aria-hidden": "true" }, icon)
|
|
1466
2296
|
);
|
|
1467
2297
|
});
|
|
1468
2298
|
ListItem.displayName = "ListItem";
|
|
1469
2299
|
var ListItem_default = ListItem;
|
|
1470
2300
|
|
|
2301
|
+
// app/components/ListPagination.tsx
|
|
2302
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
2303
|
+
var import_react32 = require("@remixicon/react");
|
|
2304
|
+
var ListPagination = ({
|
|
2305
|
+
count,
|
|
2306
|
+
page,
|
|
2307
|
+
rowsPerPage,
|
|
2308
|
+
onPageChange,
|
|
2309
|
+
className
|
|
2310
|
+
}) => {
|
|
2311
|
+
const totalPages = Math.ceil(count / rowsPerPage);
|
|
2312
|
+
const [expanded, setExpanded] = (0, import_react31.useState)(false);
|
|
2313
|
+
const renderPages = () => {
|
|
2314
|
+
if (totalPages <= 6 || expanded) {
|
|
2315
|
+
return [...Array(totalPages)].map((_, i) => /* @__PURE__ */ import_react31.default.createElement(PageBtn, { key: i, i, page, onPageChange }));
|
|
2316
|
+
}
|
|
2317
|
+
const start = [0, 1];
|
|
2318
|
+
const mid = [page - 1, page, page + 1].filter(
|
|
2319
|
+
(i) => i > 1 && i < totalPages - 2
|
|
2320
|
+
);
|
|
2321
|
+
const end = [totalPages - 2, totalPages - 1];
|
|
2322
|
+
const range = Array.from(/* @__PURE__ */ new Set([...start, ...mid, ...end]));
|
|
2323
|
+
return range.map(
|
|
2324
|
+
(i, idx) => typeof range[idx - 1] === "number" && i - range[idx - 1] > 1 ? /* @__PURE__ */ import_react31.default.createElement(
|
|
2325
|
+
Button_default,
|
|
2326
|
+
{
|
|
2327
|
+
key: `dots-${i}`,
|
|
2328
|
+
size: "sm",
|
|
2329
|
+
variant: "outlined",
|
|
2330
|
+
onClick: () => setExpanded(true)
|
|
2331
|
+
},
|
|
2332
|
+
"..."
|
|
2333
|
+
) : /* @__PURE__ */ import_react31.default.createElement(PageBtn, { key: i, i, page, onPageChange })
|
|
2334
|
+
);
|
|
2335
|
+
};
|
|
2336
|
+
return /* @__PURE__ */ import_react31.default.createElement("section", { className: cn("flex items-center gap-1", className) }, /* @__PURE__ */ import_react31.default.createElement(
|
|
2337
|
+
NavBtn,
|
|
2338
|
+
{
|
|
2339
|
+
icon: /* @__PURE__ */ import_react31.default.createElement(import_react32.RiArrowLeftSLine, { size: 22 }),
|
|
2340
|
+
onClick: () => onPageChange(page - 1),
|
|
2341
|
+
disabled: page === 0
|
|
2342
|
+
}
|
|
2343
|
+
), /* @__PURE__ */ import_react31.default.createElement("div", { className: "max-w-[90vw] w-max overflow-auto flex items-center gap-2 p-2" }, renderPages()), /* @__PURE__ */ import_react31.default.createElement(
|
|
2344
|
+
NavBtn,
|
|
2345
|
+
{
|
|
2346
|
+
icon: /* @__PURE__ */ import_react31.default.createElement(import_react32.RiArrowRightSLine, { size: 22 }),
|
|
2347
|
+
onClick: () => onPageChange(page + 1),
|
|
2348
|
+
disabled: page === totalPages - 1
|
|
2349
|
+
}
|
|
2350
|
+
));
|
|
2351
|
+
};
|
|
2352
|
+
var PageBtn = ({
|
|
2353
|
+
i,
|
|
2354
|
+
page,
|
|
2355
|
+
onPageChange
|
|
2356
|
+
}) => /* @__PURE__ */ import_react31.default.createElement(
|
|
2357
|
+
Button_default,
|
|
2358
|
+
{
|
|
2359
|
+
size: "sm",
|
|
2360
|
+
variant: "outlined",
|
|
2361
|
+
className: cn(
|
|
2362
|
+
i === page && "bg-primary-50 shadow-[0px_0px_0px_2px] shadow-primary-700 hover:shadow-[0px_0px_0px_2px] hover:shadow-primary-700"
|
|
2363
|
+
),
|
|
2364
|
+
onClick: () => onPageChange(i)
|
|
2365
|
+
},
|
|
2366
|
+
i + 1
|
|
2367
|
+
);
|
|
2368
|
+
var NavBtn = ({
|
|
2369
|
+
icon,
|
|
2370
|
+
onClick,
|
|
2371
|
+
disabled
|
|
2372
|
+
}) => /* @__PURE__ */ import_react31.default.createElement(
|
|
2373
|
+
Button_default,
|
|
2374
|
+
{
|
|
2375
|
+
size: "sm",
|
|
2376
|
+
variant: "outlined",
|
|
2377
|
+
startIcon: icon,
|
|
2378
|
+
onClick,
|
|
2379
|
+
disabled,
|
|
2380
|
+
className: "p-2"
|
|
2381
|
+
}
|
|
2382
|
+
);
|
|
2383
|
+
var ListPagination_default = ListPagination;
|
|
2384
|
+
|
|
1471
2385
|
// app/components/Loading.tsx
|
|
1472
|
-
var
|
|
2386
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
1473
2387
|
var Loading = ({ width, height, loaderColor, variant }) => {
|
|
1474
|
-
return /* @__PURE__ */
|
|
2388
|
+
return /* @__PURE__ */ import_react33.default.createElement(
|
|
1475
2389
|
"div",
|
|
1476
2390
|
{
|
|
1477
2391
|
className: cn(
|
|
@@ -1490,17 +2404,18 @@ var Loading = ({ width, height, loaderColor, variant }) => {
|
|
|
1490
2404
|
var Loading_default = Loading;
|
|
1491
2405
|
|
|
1492
2406
|
// app/components/Modal.tsx
|
|
1493
|
-
var
|
|
1494
|
-
var
|
|
2407
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
2408
|
+
var import_react35 = require("@remixicon/react");
|
|
1495
2409
|
function Modal({
|
|
1496
2410
|
children,
|
|
1497
2411
|
showModal,
|
|
1498
2412
|
setShowModal,
|
|
1499
2413
|
closeModal = true,
|
|
1500
2414
|
closeOnOutsideClick = true,
|
|
1501
|
-
className = ""
|
|
2415
|
+
className = "",
|
|
2416
|
+
width = "50%"
|
|
1502
2417
|
}) {
|
|
1503
|
-
(0,
|
|
2418
|
+
(0, import_react34.useEffect)(() => {
|
|
1504
2419
|
if (showModal) {
|
|
1505
2420
|
document.body.style.overflow = "hidden";
|
|
1506
2421
|
} else {
|
|
@@ -1515,130 +2430,50 @@ function Modal({
|
|
|
1515
2430
|
setShowModal(false);
|
|
1516
2431
|
}
|
|
1517
2432
|
};
|
|
1518
|
-
return /* @__PURE__ */
|
|
2433
|
+
return /* @__PURE__ */ import_react34.default.createElement(import_react34.default.Fragment, null, showModal && /* @__PURE__ */ import_react34.default.createElement(
|
|
1519
2434
|
"div",
|
|
1520
2435
|
{
|
|
1521
2436
|
onClick: handleClickOutside,
|
|
1522
2437
|
className: "w-full h-full bg-backdrop bg-blend-overlay fixed top-0 bottom-0 left-0 right-0 flex justify-center items-center z-[1000000] overflow-hidden"
|
|
1523
2438
|
},
|
|
1524
|
-
/* @__PURE__ */
|
|
2439
|
+
/* @__PURE__ */ import_react34.default.createElement(
|
|
1525
2440
|
"div",
|
|
1526
2441
|
{
|
|
1527
|
-
|
|
2442
|
+
style: { width },
|
|
2443
|
+
className: cn(
|
|
2444
|
+
"relative bg-white shadow-boxShadow rounded-xl p-[18px] transition-all duration-150 fade-in-grow mx-4",
|
|
2445
|
+
className
|
|
2446
|
+
)
|
|
1528
2447
|
},
|
|
1529
|
-
/* @__PURE__ */
|
|
1530
|
-
closeModal && /* @__PURE__ */
|
|
2448
|
+
/* @__PURE__ */ import_react34.default.createElement("div", null, children),
|
|
2449
|
+
closeModal && /* @__PURE__ */ import_react34.default.createElement(
|
|
1531
2450
|
"div",
|
|
1532
2451
|
{
|
|
1533
|
-
className: "absolute top-4 ml-5 right-5 z-10 shadow-backdrop rounded-
|
|
2452
|
+
className: "absolute top-4 ml-5 right-5 z-10 shadow-backdrop rounded-md cursor-pointer hover:bg-gray-100",
|
|
1534
2453
|
onClick: () => setShowModal(false)
|
|
1535
2454
|
},
|
|
1536
|
-
/* @__PURE__ */
|
|
2455
|
+
/* @__PURE__ */ import_react34.default.createElement(import_react35.RiCloseLine, { size: 24 })
|
|
1537
2456
|
)
|
|
1538
2457
|
)
|
|
1539
2458
|
));
|
|
1540
2459
|
}
|
|
1541
2460
|
|
|
1542
|
-
// app/components/MenuItem.tsx
|
|
1543
|
-
var import_react25 = __toESM(require("react"), 1);
|
|
1544
|
-
var import_react26 = require("@remixicon/react");
|
|
1545
|
-
function MenuDropdown({
|
|
1546
|
-
trigger,
|
|
1547
|
-
children,
|
|
1548
|
-
width = "250px",
|
|
1549
|
-
className
|
|
1550
|
-
}) {
|
|
1551
|
-
const [isOpen, setIsOpen] = (0, import_react25.useState)(false);
|
|
1552
|
-
const dropdownRef = (0, import_react25.useRef)(null);
|
|
1553
|
-
(0, import_react25.useEffect)(() => {
|
|
1554
|
-
const handleClickOutside = (event) => {
|
|
1555
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1556
|
-
setIsOpen(false);
|
|
1557
|
-
}
|
|
1558
|
-
};
|
|
1559
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
1560
|
-
return () => {
|
|
1561
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
1562
|
-
};
|
|
1563
|
-
}, []);
|
|
1564
|
-
return /* @__PURE__ */ import_react25.default.createElement("div", { className: "relative w-full", ref: dropdownRef }, /* @__PURE__ */ import_react25.default.createElement(
|
|
1565
|
-
"div",
|
|
1566
|
-
{
|
|
1567
|
-
className: "cursor-pointer",
|
|
1568
|
-
onClick: () => setIsOpen(!isOpen),
|
|
1569
|
-
"aria-label": "Open menu"
|
|
1570
|
-
},
|
|
1571
|
-
trigger
|
|
1572
|
-
), isOpen && /* @__PURE__ */ import_react25.default.createElement(
|
|
1573
|
-
"div",
|
|
1574
|
-
{
|
|
1575
|
-
style: { width },
|
|
1576
|
-
className: cn(
|
|
1577
|
-
"border border-gray-200 rounded-lg absolute left-0 mt-1 z-[100000] w-full bg-white shadow-sm",
|
|
1578
|
-
className
|
|
1579
|
-
)
|
|
1580
|
-
},
|
|
1581
|
-
children
|
|
1582
|
-
));
|
|
1583
|
-
}
|
|
1584
|
-
var MenuSubItem = ({
|
|
1585
|
-
label,
|
|
1586
|
-
onClick,
|
|
1587
|
-
disabled,
|
|
1588
|
-
children,
|
|
1589
|
-
className = ""
|
|
1590
|
-
}) => /* @__PURE__ */ import_react25.default.createElement(
|
|
1591
|
-
"button",
|
|
1592
|
-
{
|
|
1593
|
-
className: cn(
|
|
1594
|
-
"w-full text-left p-4 text-sm border-y-[0.5px] last:border-y first:rounded-t hover:bg-primary-50 hover:rounded",
|
|
1595
|
-
disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
1596
|
-
className
|
|
1597
|
-
),
|
|
1598
|
-
onClick,
|
|
1599
|
-
disabled
|
|
1600
|
-
},
|
|
1601
|
-
label,
|
|
1602
|
-
children && /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, children)
|
|
1603
|
-
);
|
|
1604
|
-
var MenuItem3 = ({
|
|
1605
|
-
content,
|
|
1606
|
-
children,
|
|
1607
|
-
className = "",
|
|
1608
|
-
sectionClassName = "",
|
|
1609
|
-
menuClassName = ""
|
|
1610
|
-
}) => {
|
|
1611
|
-
const [isSubOpen, setIsSubOpen] = (0, import_react25.useState)(false);
|
|
1612
|
-
return /* @__PURE__ */ import_react25.default.createElement("div", { className: cn("relative", className) }, /* @__PURE__ */ import_react25.default.createElement(
|
|
1613
|
-
"section",
|
|
1614
|
-
{
|
|
1615
|
-
onClick: () => setIsSubOpen(!isSubOpen),
|
|
1616
|
-
className: cn(
|
|
1617
|
-
"cursor-pointer hover:bg-primary-50 p-4 flex text-sm border-y-[0.5px] justify-between items-center gap-1 w-full text-left",
|
|
1618
|
-
sectionClassName
|
|
1619
|
-
)
|
|
1620
|
-
},
|
|
1621
|
-
content,
|
|
1622
|
-
isSubOpen ? /* @__PURE__ */ import_react25.default.createElement(import_react26.RiArrowUpSLine, { size: 20 }) : /* @__PURE__ */ import_react25.default.createElement(import_react26.RiArrowDownSLine, { size: 20 })
|
|
1623
|
-
), isSubOpen && /* @__PURE__ */ import_react25.default.createElement("div", { className: cn(" border-primary-100 bg-gray-50", menuClassName) }, children));
|
|
1624
|
-
};
|
|
1625
|
-
|
|
1626
2461
|
// app/components/Notice.tsx
|
|
1627
2462
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
1628
|
-
var
|
|
1629
|
-
var
|
|
2463
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
2464
|
+
var import_react37 = require("@remixicon/react");
|
|
1630
2465
|
var VariantIcon = ({ variant }) => {
|
|
1631
2466
|
switch (variant) {
|
|
1632
2467
|
case "success":
|
|
1633
|
-
return /* @__PURE__ */
|
|
2468
|
+
return /* @__PURE__ */ import_react36.default.createElement("span", null, /* @__PURE__ */ import_react36.default.createElement(import_react37.RiThumbUpLine, { size: 20, color: "#039855" }));
|
|
1634
2469
|
case "warning":
|
|
1635
|
-
return /* @__PURE__ */
|
|
2470
|
+
return /* @__PURE__ */ import_react36.default.createElement("span", null, /* @__PURE__ */ import_react36.default.createElement(import_react37.RiQuestionLine, { color: "#F79009", size: 20 }));
|
|
1636
2471
|
case "info":
|
|
1637
|
-
return /* @__PURE__ */
|
|
2472
|
+
return /* @__PURE__ */ import_react36.default.createElement("span", null, /* @__PURE__ */ import_react36.default.createElement(import_react37.RiErrorWarningLine, { color: "#1570EF", size: 20 }));
|
|
1638
2473
|
case "error":
|
|
1639
|
-
return /* @__PURE__ */
|
|
2474
|
+
return /* @__PURE__ */ import_react36.default.createElement("span", null, /* @__PURE__ */ import_react36.default.createElement(import_react37.RiAlertFill, { color: "#F04438", size: 20 }));
|
|
1640
2475
|
default:
|
|
1641
|
-
return /* @__PURE__ */
|
|
2476
|
+
return /* @__PURE__ */ import_react36.default.createElement("span", null, /* @__PURE__ */ import_react36.default.createElement(import_react37.RiShieldCheckLine, { color: "#475467", size: 20 }));
|
|
1642
2477
|
}
|
|
1643
2478
|
};
|
|
1644
2479
|
var noticeVariants = (0, import_class_variance_authority6.cva)("p-4 w-fit rounded-[6px]", {
|
|
@@ -1652,7 +2487,8 @@ var noticeVariants = (0, import_class_variance_authority6.cva)("p-4 w-fit rounde
|
|
|
1652
2487
|
},
|
|
1653
2488
|
position: {
|
|
1654
2489
|
top: "top-4 transition-all duration-700 m-auto left-0 right-0",
|
|
1655
|
-
bottom: "bottom-4 transition-all duration-700 right-4"
|
|
2490
|
+
bottom: "bottom-4 transition-all duration-700 right-4",
|
|
2491
|
+
center: "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 test"
|
|
1656
2492
|
}
|
|
1657
2493
|
}
|
|
1658
2494
|
});
|
|
@@ -1666,38 +2502,106 @@ var Notice = ({
|
|
|
1666
2502
|
showIcon = true
|
|
1667
2503
|
}) => {
|
|
1668
2504
|
const handleClose = () => setOpen(false);
|
|
1669
|
-
return /* @__PURE__ */
|
|
2505
|
+
return /* @__PURE__ */ import_react36.default.createElement(import_react36.default.Fragment, null, open && /* @__PURE__ */ import_react36.default.createElement(
|
|
1670
2506
|
"div",
|
|
1671
2507
|
{
|
|
1672
2508
|
className: cn(
|
|
1673
2509
|
noticeVariants({ variant, position }),
|
|
1674
2510
|
`fixed z-10`,
|
|
1675
2511
|
position === "top" && open && `animate-slide-in-top`,
|
|
1676
|
-
position === "bottom" && open && `animate-slide-in-right
|
|
2512
|
+
position === "bottom" && open && `animate-slide-in-right`,
|
|
2513
|
+
position === "center" && open && `animate-fade-in`
|
|
1677
2514
|
)
|
|
1678
2515
|
},
|
|
1679
|
-
/* @__PURE__ */
|
|
2516
|
+
/* @__PURE__ */ import_react36.default.createElement("div", { className: "relative" }, showIcon ? noticeTitle == "" ? /* @__PURE__ */ import_react36.default.createElement("div", { className: "flex items-start" }, /* @__PURE__ */ import_react36.default.createElement(VariantIcon, { variant }), /* @__PURE__ */ import_react36.default.createElement("span", { className: "ml-2 mr-8 text-text-sm" }, children), /* @__PURE__ */ import_react36.default.createElement("span", { onClick: handleClose }, /* @__PURE__ */ import_react36.default.createElement(import_react37.RiCloseLine, { size: 20 }))) : /* @__PURE__ */ import_react36.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react36.default.createElement("section", { className: "flex items-start" }, /* @__PURE__ */ import_react36.default.createElement(VariantIcon, { variant }), /* @__PURE__ */ import_react36.default.createElement("div", { className: "ml-2 mr-8 -mt-[3px]" }, /* @__PURE__ */ import_react36.default.createElement("span", { className: "font-bold text-gray-800 mb-1" }, noticeTitle), /* @__PURE__ */ import_react36.default.createElement("p", { className: "text-text-sm text-gray-700" }, children))), /* @__PURE__ */ import_react36.default.createElement(
|
|
1680
2517
|
"span",
|
|
1681
2518
|
{
|
|
1682
2519
|
className: cn("absolute top-0 right-0 cursor-pointer"),
|
|
1683
2520
|
onClick: handleClose
|
|
1684
2521
|
},
|
|
1685
|
-
/* @__PURE__ */
|
|
1686
|
-
)) : /* @__PURE__ */
|
|
2522
|
+
/* @__PURE__ */ import_react36.default.createElement(import_react37.RiCloseLine, { size: 20 })
|
|
2523
|
+
)) : /* @__PURE__ */ import_react36.default.createElement("div", { className: "mr-8" }, /* @__PURE__ */ import_react36.default.createElement("section", { className: "flex items-center" }, /* @__PURE__ */ import_react36.default.createElement("p", { className: "font-bold text-gray-800 mb-1" }, noticeTitle)), /* @__PURE__ */ import_react36.default.createElement(
|
|
1687
2524
|
"span",
|
|
1688
2525
|
{
|
|
1689
2526
|
className: cn("absolute top-0 right-0 cursor-pointer"),
|
|
1690
2527
|
onClick: handleClose
|
|
1691
2528
|
},
|
|
1692
|
-
/* @__PURE__ */
|
|
1693
|
-
), /* @__PURE__ */
|
|
2529
|
+
/* @__PURE__ */ import_react36.default.createElement(import_react37.RiCloseLine, { size: 20 })
|
|
2530
|
+
), /* @__PURE__ */ import_react36.default.createElement("p", { className: "text-text-sm" }, children)))
|
|
1694
2531
|
));
|
|
1695
2532
|
};
|
|
1696
2533
|
var Notice_default = Notice;
|
|
1697
2534
|
|
|
2535
|
+
// app/components/OTPInput.tsx
|
|
2536
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
2537
|
+
var OTPInput = ({
|
|
2538
|
+
length,
|
|
2539
|
+
onChange,
|
|
2540
|
+
type = "text"
|
|
2541
|
+
}) => {
|
|
2542
|
+
const [otpValues, setOtpValues] = (0, import_react38.useState)(Array(length).fill(""));
|
|
2543
|
+
const inputsRef = (0, import_react38.useRef)([]);
|
|
2544
|
+
const handleChange = (e, idx) => {
|
|
2545
|
+
var _a;
|
|
2546
|
+
let value = e.target.value;
|
|
2547
|
+
if (type === "number")
|
|
2548
|
+
value = value.replace(/\D/g, "");
|
|
2549
|
+
if (!value)
|
|
2550
|
+
return;
|
|
2551
|
+
const newOtp = [...otpValues];
|
|
2552
|
+
newOtp[idx] = value[0];
|
|
2553
|
+
setOtpValues(newOtp);
|
|
2554
|
+
onChange(newOtp.join(""));
|
|
2555
|
+
if (idx < length - 1)
|
|
2556
|
+
(_a = inputsRef.current[idx + 1]) == null ? void 0 : _a.focus();
|
|
2557
|
+
};
|
|
2558
|
+
const handleKeyDown = (e, idx) => {
|
|
2559
|
+
var _a;
|
|
2560
|
+
if (e.key === "Backspace") {
|
|
2561
|
+
if (otpValues[idx]) {
|
|
2562
|
+
const newOtp = [...otpValues];
|
|
2563
|
+
newOtp[idx] = "";
|
|
2564
|
+
setOtpValues(newOtp);
|
|
2565
|
+
onChange(newOtp.join(""));
|
|
2566
|
+
} else if (idx > 0) {
|
|
2567
|
+
(_a = inputsRef.current[idx - 1]) == null ? void 0 : _a.focus();
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
};
|
|
2571
|
+
const handlePaste = (e) => {
|
|
2572
|
+
var _a;
|
|
2573
|
+
e.preventDefault();
|
|
2574
|
+
let pasteData = e.clipboardData.getData("Text");
|
|
2575
|
+
if (type === "number")
|
|
2576
|
+
pasteData = pasteData.replace(/\D/g, "");
|
|
2577
|
+
const newOtp = pasteData.split("").concat(Array(length).fill("")).slice(0, length);
|
|
2578
|
+
setOtpValues(newOtp);
|
|
2579
|
+
onChange(newOtp.join(""));
|
|
2580
|
+
(_a = inputsRef.current[Math.min(pasteData.length, length - 1)]) == null ? void 0 : _a.focus();
|
|
2581
|
+
};
|
|
2582
|
+
return /* @__PURE__ */ import_react38.default.createElement("div", { className: "flex items-center gap-2" }, Array.from({ length }).map((_, idx) => /* @__PURE__ */ import_react38.default.createElement(
|
|
2583
|
+
Input_default,
|
|
2584
|
+
{
|
|
2585
|
+
key: idx,
|
|
2586
|
+
type,
|
|
2587
|
+
inputMode: type === "number" ? "numeric" : "text",
|
|
2588
|
+
maxLength: 1,
|
|
2589
|
+
value: otpValues[idx],
|
|
2590
|
+
onChange: (e) => handleChange(e, idx),
|
|
2591
|
+
onKeyDown: (e) => handleKeyDown(e, idx),
|
|
2592
|
+
onPaste: handlePaste,
|
|
2593
|
+
ref: (el) => {
|
|
2594
|
+
inputsRef.current[idx] = el ?? null;
|
|
2595
|
+
},
|
|
2596
|
+
className: "w-[40px] p-3.5"
|
|
2597
|
+
}
|
|
2598
|
+
)));
|
|
2599
|
+
};
|
|
2600
|
+
var OTPInput_default = OTPInput;
|
|
2601
|
+
|
|
1698
2602
|
// app/components/Pagination.tsx
|
|
1699
|
-
var
|
|
1700
|
-
var
|
|
2603
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
2604
|
+
var import_react40 = require("@remixicon/react");
|
|
1701
2605
|
var Pagination = ({
|
|
1702
2606
|
count,
|
|
1703
2607
|
page,
|
|
@@ -1705,7 +2609,10 @@ var Pagination = ({
|
|
|
1705
2609
|
rowsPerPageOptions,
|
|
1706
2610
|
onPageChange,
|
|
1707
2611
|
onRowsPerPageChange,
|
|
1708
|
-
className
|
|
2612
|
+
className,
|
|
2613
|
+
variant = "primary",
|
|
2614
|
+
countVariable,
|
|
2615
|
+
itemsPerPage = true
|
|
1709
2616
|
}) => {
|
|
1710
2617
|
const totalPages = Math.ceil(count / rowsPerPage);
|
|
1711
2618
|
const handlePrevPageClick = () => {
|
|
@@ -1714,7 +2621,7 @@ var Pagination = ({
|
|
|
1714
2621
|
const handleNextPageClick = () => {
|
|
1715
2622
|
onPageChange(page + 1);
|
|
1716
2623
|
};
|
|
1717
|
-
const [showOptions, setShowOptions] = (0,
|
|
2624
|
+
const [showOptions, setShowOptions] = (0, import_react39.useState)(false);
|
|
1718
2625
|
const handleOptionClick = (option) => {
|
|
1719
2626
|
if (typeof option === "number") {
|
|
1720
2627
|
onRowsPerPageChange(option);
|
|
@@ -1723,15 +2630,16 @@ var Pagination = ({
|
|
|
1723
2630
|
}
|
|
1724
2631
|
setShowOptions(false);
|
|
1725
2632
|
};
|
|
1726
|
-
return /* @__PURE__ */
|
|
2633
|
+
return /* @__PURE__ */ import_react39.default.createElement(
|
|
1727
2634
|
"div",
|
|
1728
2635
|
{
|
|
1729
2636
|
className: cn(
|
|
1730
|
-
"
|
|
2637
|
+
"px-3 py-4 flex justify-between items-center w-full",
|
|
2638
|
+
variant === "primary" && "border border-gray-200 px-6 py-4",
|
|
1731
2639
|
className
|
|
1732
2640
|
)
|
|
1733
2641
|
},
|
|
1734
|
-
/* @__PURE__ */
|
|
2642
|
+
/* @__PURE__ */ import_react39.default.createElement("section", { className: "flex gap-1.5 items-center" }, countVariable && /* @__PURE__ */ import_react39.default.createElement("p", { className: "text-text-sm text-gray-800 font-medium" }, count, " ", countVariable ?? "Items"), itemsPerPage && /* @__PURE__ */ import_react39.default.createElement("div", { className: "flex gap-1.5 items-center" }, /* @__PURE__ */ import_react39.default.createElement("span", { className: "text-gray-800 text-text-sm font-medium" }, "Items per page"), /* @__PURE__ */ import_react39.default.createElement("div", { className: "relative z-[100]" }, /* @__PURE__ */ import_react39.default.createElement(
|
|
1735
2643
|
"div",
|
|
1736
2644
|
{
|
|
1737
2645
|
className: "border border-gray-600 w-[88px] rounded text-sm px-1.5 py-1 cursor-pointer flex items-center justify-between gap-1 text-gray-600",
|
|
@@ -1739,8 +2647,8 @@ var Pagination = ({
|
|
|
1739
2647
|
},
|
|
1740
2648
|
rowsPerPage,
|
|
1741
2649
|
" ",
|
|
1742
|
-
!showOptions ? /* @__PURE__ */
|
|
1743
|
-
), showOptions && /* @__PURE__ */
|
|
2650
|
+
!showOptions ? /* @__PURE__ */ import_react39.default.createElement(import_react40.RiArrowDownSLine, { size: 14 }) : /* @__PURE__ */ import_react39.default.createElement(import_react40.RiArrowUpSLine, { size: 14 })
|
|
2651
|
+
), showOptions && /* @__PURE__ */ import_react39.default.createElement("div", { className: "absolute top-full left-0 shadow bg-white rounded-md text-sm mt-1 z-50" }, rowsPerPageOptions == null ? void 0 : rowsPerPageOptions.map((option, index) => /* @__PURE__ */ import_react39.default.createElement(
|
|
1744
2652
|
"div",
|
|
1745
2653
|
{
|
|
1746
2654
|
key: index,
|
|
@@ -1748,42 +2656,62 @@ var Pagination = ({
|
|
|
1748
2656
|
onClick: () => handleOptionClick(option)
|
|
1749
2657
|
},
|
|
1750
2658
|
typeof option === "number" ? option : option.label
|
|
1751
|
-
))))),
|
|
1752
|
-
/* @__PURE__ */
|
|
2659
|
+
)))))),
|
|
2660
|
+
/* @__PURE__ */ import_react39.default.createElement("section", { className: "flex items-center gap-2 font-medium" }, variant === "primary" ? /* @__PURE__ */ import_react39.default.createElement("div", { className: "flex items-center gap-2 text-gray-800 text-text-sm" }, /* @__PURE__ */ import_react39.default.createElement("span", null, "page"), /* @__PURE__ */ import_react39.default.createElement(
|
|
1753
2661
|
"select",
|
|
1754
2662
|
{
|
|
1755
2663
|
value: page + 1,
|
|
1756
2664
|
onChange: (e) => onPageChange(parseInt(e.target.value, 10) - 1),
|
|
1757
2665
|
className: "bg-gray-25 text-gray-500 px-3.5 py-1 border border-gray-200 rounded-md text-sm focus:outline-none focus:border-gray-600"
|
|
1758
2666
|
},
|
|
1759
|
-
totalPages > 0 && [...Array(totalPages)].map((_, index) => /* @__PURE__ */
|
|
1760
|
-
), /* @__PURE__ */
|
|
2667
|
+
totalPages > 0 && [...Array(totalPages)].map((_, index) => /* @__PURE__ */ import_react39.default.createElement("option", { key: index + 1, value: index + 1 }, index + 1))
|
|
2668
|
+
), /* @__PURE__ */ import_react39.default.createElement("span", null, "of ", totalPages > 0 ? totalPages : 0)) : /* @__PURE__ */ import_react39.default.createElement("div", { className: "flex items-center gap-2 text-gray-800 text-text-sm mx-3" }, /* @__PURE__ */ import_react39.default.createElement("span", null, page + 1, " of ", totalPages > 0 ? totalPages : 0)), variant === "primary" ? /* @__PURE__ */ import_react39.default.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ import_react39.default.createElement(
|
|
1761
2669
|
Button_default,
|
|
1762
2670
|
{
|
|
1763
2671
|
variant: "outlined",
|
|
1764
2672
|
intent: "default-outlined",
|
|
1765
|
-
startIcon: /* @__PURE__ */
|
|
2673
|
+
startIcon: /* @__PURE__ */ import_react39.default.createElement(import_react40.RiArrowLeftLine, { size: 20 }),
|
|
1766
2674
|
onClick: handlePrevPageClick,
|
|
1767
2675
|
disabled: page === 0,
|
|
1768
2676
|
className: "rounded-none h-8 rounded-l-lg"
|
|
1769
2677
|
}
|
|
1770
|
-
), /* @__PURE__ */
|
|
2678
|
+
), /* @__PURE__ */ import_react39.default.createElement(
|
|
1771
2679
|
Button_default,
|
|
1772
2680
|
{
|
|
1773
2681
|
variant: "outlined",
|
|
1774
2682
|
intent: "default-outlined",
|
|
1775
|
-
startIcon: /* @__PURE__ */
|
|
2683
|
+
startIcon: /* @__PURE__ */ import_react39.default.createElement(import_react40.RiArrowRightLine, { size: 20 }),
|
|
1776
2684
|
onClick: handleNextPageClick,
|
|
1777
2685
|
disabled: page === totalPages - 1,
|
|
1778
2686
|
className: "rounded-none h-8 rounded-r-lg"
|
|
1779
2687
|
}
|
|
2688
|
+
)) : /* @__PURE__ */ import_react39.default.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ import_react39.default.createElement(
|
|
2689
|
+
import_react40.RiArrowLeftSLine,
|
|
2690
|
+
{
|
|
2691
|
+
size: 22,
|
|
2692
|
+
cursor: "pointer",
|
|
2693
|
+
onClick: handlePrevPageClick,
|
|
2694
|
+
className: cn(
|
|
2695
|
+
page === 0 && "pointer-events-none select-none opacity-30"
|
|
2696
|
+
)
|
|
2697
|
+
}
|
|
2698
|
+
), /* @__PURE__ */ import_react39.default.createElement(
|
|
2699
|
+
import_react40.RiArrowRightSLine,
|
|
2700
|
+
{
|
|
2701
|
+
size: 22,
|
|
2702
|
+
cursor: "pointer",
|
|
2703
|
+
onClick: handleNextPageClick,
|
|
2704
|
+
className: cn(
|
|
2705
|
+
page === totalPages - 1 && "pointer-events-none select-none opacity-30"
|
|
2706
|
+
)
|
|
2707
|
+
}
|
|
1780
2708
|
)))
|
|
1781
2709
|
);
|
|
1782
2710
|
};
|
|
1783
2711
|
var Pagination_default = Pagination;
|
|
1784
2712
|
|
|
1785
2713
|
// app/components/Progress.tsx
|
|
1786
|
-
var
|
|
2714
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
1787
2715
|
var ProgressBar = ({
|
|
1788
2716
|
progress,
|
|
1789
2717
|
progressText = "",
|
|
@@ -1791,7 +2719,7 @@ var ProgressBar = ({
|
|
|
1791
2719
|
progressTextPosition
|
|
1792
2720
|
}) => {
|
|
1793
2721
|
const _progress = Math == null ? void 0 : Math.min(Math == null ? void 0 : Math.max(0, progress), 100);
|
|
1794
|
-
return /* @__PURE__ */
|
|
2722
|
+
return /* @__PURE__ */ import_react41.default.createElement(
|
|
1795
2723
|
"div",
|
|
1796
2724
|
{
|
|
1797
2725
|
className: cn(
|
|
@@ -1799,7 +2727,7 @@ var ProgressBar = ({
|
|
|
1799
2727
|
progressTextPosition === "right" ? "flex items-center gap-1" : progressTextPosition === "left" ? "flex items-center gap-1" : ""
|
|
1800
2728
|
)
|
|
1801
2729
|
},
|
|
1802
|
-
/* @__PURE__ */
|
|
2730
|
+
/* @__PURE__ */ import_react41.default.createElement(
|
|
1803
2731
|
"span",
|
|
1804
2732
|
{
|
|
1805
2733
|
className: cn(
|
|
@@ -1809,7 +2737,7 @@ var ProgressBar = ({
|
|
|
1809
2737
|
},
|
|
1810
2738
|
progressText
|
|
1811
2739
|
),
|
|
1812
|
-
/* @__PURE__ */
|
|
2740
|
+
/* @__PURE__ */ import_react41.default.createElement(
|
|
1813
2741
|
"div",
|
|
1814
2742
|
{
|
|
1815
2743
|
className: "w-full h-2 rounded bg-gray-200",
|
|
@@ -1818,15 +2746,15 @@ var ProgressBar = ({
|
|
|
1818
2746
|
"aria-valuemin": 0,
|
|
1819
2747
|
"aria-valuemax": 100
|
|
1820
2748
|
},
|
|
1821
|
-
/* @__PURE__ */
|
|
2749
|
+
/* @__PURE__ */ import_react41.default.createElement(
|
|
1822
2750
|
"div",
|
|
1823
2751
|
{
|
|
1824
|
-
className: `${progressColor} h-full transition-all delay-
|
|
2752
|
+
className: `${progressColor} h-full transition-all delay-100 duration-300 rounded ease-in`,
|
|
1825
2753
|
style: { width: `${_progress}%` }
|
|
1826
2754
|
}
|
|
1827
2755
|
)
|
|
1828
2756
|
),
|
|
1829
|
-
/* @__PURE__ */
|
|
2757
|
+
/* @__PURE__ */ import_react41.default.createElement(
|
|
1830
2758
|
"span",
|
|
1831
2759
|
{
|
|
1832
2760
|
className: cn(
|
|
@@ -1841,7 +2769,7 @@ var ProgressBar = ({
|
|
|
1841
2769
|
var Progress_default = ProgressBar;
|
|
1842
2770
|
|
|
1843
2771
|
// app/components/Radio.tsx
|
|
1844
|
-
var
|
|
2772
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
1845
2773
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
1846
2774
|
var radioVariants = (0, import_class_variance_authority7.cva)("", {
|
|
1847
2775
|
variants: {
|
|
@@ -1854,27 +2782,32 @@ var radioVariants = (0, import_class_variance_authority7.cva)("", {
|
|
|
1854
2782
|
size: "sm"
|
|
1855
2783
|
}
|
|
1856
2784
|
});
|
|
1857
|
-
var Radio = (0,
|
|
1858
|
-
({ size, disabled, checked, className, children, ...props }, ref) => {
|
|
1859
|
-
return /* @__PURE__ */
|
|
2785
|
+
var Radio = (0, import_react42.forwardRef)(
|
|
2786
|
+
({ size, disabled, checked, className, children, id, name, ...props }, ref) => {
|
|
2787
|
+
return /* @__PURE__ */ import_react42.default.createElement("div", { className: "relative inline-flex items-center cursor-pointer" }, /* @__PURE__ */ import_react42.default.createElement(
|
|
1860
2788
|
"input",
|
|
1861
2789
|
{
|
|
1862
2790
|
...props,
|
|
1863
2791
|
ref,
|
|
2792
|
+
id,
|
|
2793
|
+
name,
|
|
1864
2794
|
checked,
|
|
1865
2795
|
disabled,
|
|
2796
|
+
role: "radio",
|
|
2797
|
+
"aria-checked": checked,
|
|
1866
2798
|
type: "radio",
|
|
1867
2799
|
className: cn(
|
|
1868
|
-
"peer relative cursor-pointer appearance-none rounded-full border border-gray-300 hover:border-primary-600 hover:bg-primary-50 transition-all checked:border-primary-600 checked:bg-primary-50 disabled:opacity-30 disabled:pointer-events-none",
|
|
2800
|
+
"peer relative cursor-pointer appearance-none rounded-full border border-gray-300 hover:border-primary-600 hover:bg-primary-50 transition-all checked:border-primary-600 checked:bg-primary-50 disabled:opacity-30 disabled:pointer-events-none focus-visible:ring-2 focus-visible:ring-primary-600 focus-visible:ring-offset-2",
|
|
1869
2801
|
radioVariants({ size, className })
|
|
1870
2802
|
)
|
|
1871
2803
|
}
|
|
1872
|
-
), /* @__PURE__ */
|
|
2804
|
+
), /* @__PURE__ */ import_react42.default.createElement(
|
|
1873
2805
|
"span",
|
|
1874
2806
|
{
|
|
2807
|
+
"aria-hidden": "true",
|
|
1875
2808
|
className: cn(
|
|
1876
2809
|
"absolute transition-opacity opacity-0 ease-in-out pointer-events-none top-2/4 left-2/4 -translate-y-2/4 -translate-x-2/4 peer-checked:opacity-100 h-1.5 w-1.5 bg-primary-600 rounded-full duration-300",
|
|
1877
|
-
size
|
|
2810
|
+
size === "sm" && "h-[4.5px] w-[4.5px]"
|
|
1878
2811
|
)
|
|
1879
2812
|
}
|
|
1880
2813
|
));
|
|
@@ -1883,158 +2816,687 @@ var Radio = (0, import_react32.forwardRef)(
|
|
|
1883
2816
|
Radio.displayName = "Radio";
|
|
1884
2817
|
var Radio_default = Radio;
|
|
1885
2818
|
|
|
2819
|
+
// app/components/RazorPayFileUpload.tsx
|
|
2820
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
2821
|
+
var import_react45 = require("@remixicon/react");
|
|
2822
|
+
|
|
2823
|
+
// app/components/Spinner.tsx
|
|
2824
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
2825
|
+
var colorVars = {
|
|
2826
|
+
primary: {
|
|
2827
|
+
c1: "var(--primary-500)",
|
|
2828
|
+
c2: "var(--primary-200)"
|
|
2829
|
+
},
|
|
2830
|
+
black: {
|
|
2831
|
+
c1: "rgba(0, 0, 0, 1)",
|
|
2832
|
+
c2: "rgba(0, 0, 0, 0.5)"
|
|
2833
|
+
},
|
|
2834
|
+
gray: {
|
|
2835
|
+
c1: "var(--gray-500)",
|
|
2836
|
+
c2: "var(--gray-300)"
|
|
2837
|
+
}
|
|
2838
|
+
};
|
|
2839
|
+
var Spinner = ({ size = "md", color = "primary" }) => {
|
|
2840
|
+
const sizeClass = cn({
|
|
2841
|
+
"w-4 h-4": size === "xs",
|
|
2842
|
+
"w-6 h-6": size === "sm",
|
|
2843
|
+
"w-10 h-10": size === "md",
|
|
2844
|
+
"w-16 h-16": size === "lg"
|
|
2845
|
+
});
|
|
2846
|
+
const getColorValues = (color2) => {
|
|
2847
|
+
if (colorVars[color2]) {
|
|
2848
|
+
return colorVars[color2];
|
|
2849
|
+
}
|
|
2850
|
+
if (color2.startsWith("#")) {
|
|
2851
|
+
return {
|
|
2852
|
+
c1: color2,
|
|
2853
|
+
c2: `${color2}80`
|
|
2854
|
+
};
|
|
2855
|
+
}
|
|
2856
|
+
return colorVars.primary;
|
|
2857
|
+
};
|
|
2858
|
+
const colorValues = getColorValues(color);
|
|
2859
|
+
return /* @__PURE__ */ import_react43.default.createElement("div", { className: cn("relative", sizeClass) }, /* @__PURE__ */ import_react43.default.createElement(
|
|
2860
|
+
"div",
|
|
2861
|
+
{
|
|
2862
|
+
className: "spinner",
|
|
2863
|
+
style: {
|
|
2864
|
+
["--spinner-color-1"]: colorValues.c1,
|
|
2865
|
+
["--spinner-color-2"]: colorValues.c2
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
));
|
|
2869
|
+
};
|
|
2870
|
+
var Spinner_default = Spinner;
|
|
2871
|
+
|
|
2872
|
+
// app/components/RazorPayFileUpload.tsx
|
|
2873
|
+
var import_image2 = __toESM(require("next/image"), 1);
|
|
2874
|
+
var defaultGetFileIcon = (fileName, fileType) => {
|
|
2875
|
+
var _a;
|
|
2876
|
+
const extension = ((_a = fileName.split(".").pop()) == null ? void 0 : _a.toLowerCase()) || "";
|
|
2877
|
+
if (fileType.startsWith("image/") || ["jpg", "jpeg", "png", "gif", "svg", "webp", "bmp"].includes(extension)) {
|
|
2878
|
+
return /* @__PURE__ */ import_react44.default.createElement(import_react45.RiImageLine, { className: "w-6 h-6 text-white" });
|
|
2879
|
+
}
|
|
2880
|
+
if (fileType.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a"].includes(extension)) {
|
|
2881
|
+
return /* @__PURE__ */ import_react44.default.createElement(import_react45.RiMusic2Line, { className: "w-6 h-6 text-white" });
|
|
2882
|
+
}
|
|
2883
|
+
if (fileType.startsWith("video/") || ["mp4", "avi", "mkv", "mov", "wmv"].includes(extension)) {
|
|
2884
|
+
return /* @__PURE__ */ import_react44.default.createElement(import_react45.RiVideoLine, { className: "w-6 h-6 text-white" });
|
|
2885
|
+
}
|
|
2886
|
+
if (fileType.includes("excel") || ["xls", "xlsx", "csv", "txt", "ods"].includes(extension)) {
|
|
2887
|
+
return /* @__PURE__ */ import_react44.default.createElement(import_react45.RiFileExcel2Line, { className: "w-6 h-6 text-white" });
|
|
2888
|
+
}
|
|
2889
|
+
if (fileType.includes("word") || ["doc", "docx", "odt", "xml"].includes(extension)) {
|
|
2890
|
+
return /* @__PURE__ */ import_react44.default.createElement(import_react45.RiFileWord2Line, { className: "w-6 h-6 text-white" });
|
|
2891
|
+
}
|
|
2892
|
+
if (["pptx", "pptm", "xps", "ppsx"].includes(extension)) {
|
|
2893
|
+
return /* @__PURE__ */ import_react44.default.createElement(import_react45.RiFilePpt2Line, { className: "w-6 h-6 text-white" });
|
|
2894
|
+
}
|
|
2895
|
+
if (fileType.includes("zip") || ["zip", "rar", "7z", "tar", "gz"].includes(extension)) {
|
|
2896
|
+
return /* @__PURE__ */ import_react44.default.createElement(import_react45.RiFileZipLine, { className: "w-6 h-6 text-white" });
|
|
2897
|
+
}
|
|
2898
|
+
if (fileType === "application/pdf" || extension === "pdf") {
|
|
2899
|
+
return /* @__PURE__ */ import_react44.default.createElement(import_react45.RiFilePdf2Line, { className: "w-6 h-6 text-white" });
|
|
2900
|
+
}
|
|
2901
|
+
return /* @__PURE__ */ import_react44.default.createElement(import_react45.RiFileLine, { className: "w-6 h-6 text-white" });
|
|
2902
|
+
};
|
|
2903
|
+
function ImageUploadControlled({
|
|
2904
|
+
items,
|
|
2905
|
+
onAddFiles,
|
|
2906
|
+
onUpdateItem,
|
|
2907
|
+
onDelete,
|
|
2908
|
+
onRetry,
|
|
2909
|
+
onPreview,
|
|
2910
|
+
onUpload,
|
|
2911
|
+
multiple = true,
|
|
2912
|
+
accept = "image/*",
|
|
2913
|
+
maxSizeMB = 15,
|
|
2914
|
+
className = "",
|
|
2915
|
+
hintText,
|
|
2916
|
+
showSizeText = true,
|
|
2917
|
+
getFileIcon = defaultGetFileIcon,
|
|
2918
|
+
autoUpload = true,
|
|
2919
|
+
disabled
|
|
2920
|
+
}) {
|
|
2921
|
+
var _a;
|
|
2922
|
+
const inputRef = (0, import_react44.useRef)(null);
|
|
2923
|
+
const [isDragging, setIsDragging] = (0, import_react44.useState)(false);
|
|
2924
|
+
const localPreviews = (0, import_react44.useRef)(/* @__PURE__ */ new Map());
|
|
2925
|
+
const uploadProgress = (0, import_react44.useRef)(/* @__PURE__ */ new Map());
|
|
2926
|
+
const formatSize = (bytes) => {
|
|
2927
|
+
if (!bytes)
|
|
2928
|
+
return "0 KB";
|
|
2929
|
+
return `${Math.round(bytes / 1024)} KB`;
|
|
2930
|
+
};
|
|
2931
|
+
const getPreviewUrl = (item) => {
|
|
2932
|
+
if (item.previewUrl)
|
|
2933
|
+
return item.previewUrl;
|
|
2934
|
+
if (item.file && !localPreviews.current.has(item.id)) {
|
|
2935
|
+
const url = URL.createObjectURL(item.file);
|
|
2936
|
+
localPreviews.current.set(item.id, url);
|
|
2937
|
+
}
|
|
2938
|
+
return localPreviews.current.get(item.id);
|
|
2939
|
+
};
|
|
2940
|
+
const getStatusDisplay = (status) => {
|
|
2941
|
+
switch (status) {
|
|
2942
|
+
case "uploading":
|
|
2943
|
+
return {
|
|
2944
|
+
text: "Uploading",
|
|
2945
|
+
color: "text-blue-600",
|
|
2946
|
+
showSpinner: true,
|
|
2947
|
+
icon: /* @__PURE__ */ import_react44.default.createElement(Spinner_default, { size: "xs", color: "gray" }),
|
|
2948
|
+
canPreview: false
|
|
2949
|
+
};
|
|
2950
|
+
case "success":
|
|
2951
|
+
return {
|
|
2952
|
+
text: "Completed",
|
|
2953
|
+
color: "text-green-600",
|
|
2954
|
+
showSpinner: false,
|
|
2955
|
+
icon: /* @__PURE__ */ import_react44.default.createElement(import_react45.RiCheckLine, { className: "w-3 h-3 text-white" }),
|
|
2956
|
+
canPreview: true
|
|
2957
|
+
};
|
|
2958
|
+
case "error":
|
|
2959
|
+
return {
|
|
2960
|
+
text: "Failed",
|
|
2961
|
+
color: "text-red-600",
|
|
2962
|
+
showSpinner: false,
|
|
2963
|
+
icon: /* @__PURE__ */ import_react44.default.createElement(import_react45.RiCloseLine, { className: "w-3 h-3 text-white" }),
|
|
2964
|
+
canPreview: false
|
|
2965
|
+
};
|
|
2966
|
+
default:
|
|
2967
|
+
return {
|
|
2968
|
+
text: "",
|
|
2969
|
+
color: "",
|
|
2970
|
+
showSpinner: false,
|
|
2971
|
+
icon: null,
|
|
2972
|
+
canPreview: false
|
|
2973
|
+
};
|
|
2974
|
+
}
|
|
2975
|
+
};
|
|
2976
|
+
const getProgressColor = (status) => {
|
|
2977
|
+
switch (status) {
|
|
2978
|
+
case "uploading":
|
|
2979
|
+
return "bg-blue-500";
|
|
2980
|
+
case "success":
|
|
2981
|
+
return "bg-green-600";
|
|
2982
|
+
case "error":
|
|
2983
|
+
return "bg-red-500";
|
|
2984
|
+
default:
|
|
2985
|
+
return "bg-gray-300";
|
|
2986
|
+
}
|
|
2987
|
+
};
|
|
2988
|
+
const getItemFileIcon = (item) => {
|
|
2989
|
+
var _a2, _b;
|
|
2990
|
+
const fileName = item.name || ((_a2 = item.file) == null ? void 0 : _a2.name) || "";
|
|
2991
|
+
const fileType = ((_b = item.file) == null ? void 0 : _b.type) || "";
|
|
2992
|
+
return getFileIcon(fileName, fileType);
|
|
2993
|
+
};
|
|
2994
|
+
const handleUpload = import_react44.default.useCallback(
|
|
2995
|
+
async (item) => {
|
|
2996
|
+
if (!item.file || !onUpload)
|
|
2997
|
+
return;
|
|
2998
|
+
try {
|
|
2999
|
+
if (onUpdateItem) {
|
|
3000
|
+
onUpdateItem(item.id, { status: "uploading", progress: 0 });
|
|
3001
|
+
}
|
|
3002
|
+
const previewUrl = await onUpload(item.file, (progress) => {
|
|
3003
|
+
uploadProgress.current.set(item.id, progress);
|
|
3004
|
+
if (onUpdateItem) {
|
|
3005
|
+
onUpdateItem(item.id, { progress, status: "uploading" });
|
|
3006
|
+
}
|
|
3007
|
+
});
|
|
3008
|
+
if (onUpdateItem) {
|
|
3009
|
+
onUpdateItem(item.id, {
|
|
3010
|
+
progress: 100,
|
|
3011
|
+
status: "success",
|
|
3012
|
+
previewUrl
|
|
3013
|
+
});
|
|
3014
|
+
}
|
|
3015
|
+
} catch (error) {
|
|
3016
|
+
if (onUpdateItem) {
|
|
3017
|
+
onUpdateItem(item.id, { progress: 0, status: "error" });
|
|
3018
|
+
}
|
|
3019
|
+
}
|
|
3020
|
+
},
|
|
3021
|
+
[onUpload, onUpdateItem]
|
|
3022
|
+
);
|
|
3023
|
+
const getCurrentProgress = (item) => {
|
|
3024
|
+
return uploadProgress.current.get(item.id) ?? item.progress ?? 0;
|
|
3025
|
+
};
|
|
3026
|
+
const handleRetry = (id) => {
|
|
3027
|
+
const item = items.find((item2) => item2.id === id);
|
|
3028
|
+
if (item && onUpload) {
|
|
3029
|
+
handleUpload(item);
|
|
3030
|
+
} else if (onRetry) {
|
|
3031
|
+
onRetry(id);
|
|
3032
|
+
}
|
|
3033
|
+
};
|
|
3034
|
+
const handleDelete = (id) => {
|
|
3035
|
+
if (localPreviews.current.has(id)) {
|
|
3036
|
+
const url = localPreviews.current.get(id);
|
|
3037
|
+
if (url)
|
|
3038
|
+
URL.revokeObjectURL(url);
|
|
3039
|
+
localPreviews.current.delete(id);
|
|
3040
|
+
}
|
|
3041
|
+
uploadProgress.current.delete(id);
|
|
3042
|
+
if (onDelete) {
|
|
3043
|
+
onDelete(id);
|
|
3044
|
+
}
|
|
3045
|
+
};
|
|
3046
|
+
const triggerInput = () => {
|
|
3047
|
+
var _a2;
|
|
3048
|
+
return (_a2 = inputRef.current) == null ? void 0 : _a2.click();
|
|
3049
|
+
};
|
|
3050
|
+
const handleInputChange = (e) => {
|
|
3051
|
+
const files = Array.from(e.target.files || []);
|
|
3052
|
+
if (files.length === 0)
|
|
3053
|
+
return;
|
|
3054
|
+
const validFiles = files.filter(
|
|
3055
|
+
(file) => file.size <= maxSizeMB * 1024 * 1024
|
|
3056
|
+
);
|
|
3057
|
+
if (validFiles.length === 0)
|
|
3058
|
+
return;
|
|
3059
|
+
onAddFiles(multiple ? validFiles : [validFiles[0]]);
|
|
3060
|
+
e.target.value = "";
|
|
3061
|
+
};
|
|
3062
|
+
const handleDragOver = (e) => {
|
|
3063
|
+
e.preventDefault();
|
|
3064
|
+
if (!disabled)
|
|
3065
|
+
setIsDragging(true);
|
|
3066
|
+
};
|
|
3067
|
+
const handleDragLeave = () => {
|
|
3068
|
+
setIsDragging(false);
|
|
3069
|
+
};
|
|
3070
|
+
const handleDrop = (e) => {
|
|
3071
|
+
e.preventDefault();
|
|
3072
|
+
setIsDragging(false);
|
|
3073
|
+
if (disabled)
|
|
3074
|
+
return;
|
|
3075
|
+
const files = Array.from(e.dataTransfer.files);
|
|
3076
|
+
if (files.length === 0)
|
|
3077
|
+
return;
|
|
3078
|
+
const validFiles = files.filter(
|
|
3079
|
+
(file) => file.size <= maxSizeMB * 1024 * 1024
|
|
3080
|
+
);
|
|
3081
|
+
if (validFiles.length > 0) {
|
|
3082
|
+
onAddFiles(multiple ? validFiles : [validFiles[0]]);
|
|
3083
|
+
}
|
|
3084
|
+
};
|
|
3085
|
+
const handleKeyDown = (e) => {
|
|
3086
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3087
|
+
e.preventDefault();
|
|
3088
|
+
triggerInput();
|
|
3089
|
+
}
|
|
3090
|
+
};
|
|
3091
|
+
import_react44.default.useEffect(() => {
|
|
3092
|
+
if (autoUpload && onUpload) {
|
|
3093
|
+
items.forEach((item) => {
|
|
3094
|
+
if (item.status === "idle" && item.file) {
|
|
3095
|
+
handleUpload(item);
|
|
3096
|
+
}
|
|
3097
|
+
});
|
|
3098
|
+
}
|
|
3099
|
+
}, [items, autoUpload, onUpload, handleUpload]);
|
|
3100
|
+
import_react44.default.useEffect(() => {
|
|
3101
|
+
const previews = localPreviews == null ? void 0 : localPreviews.current;
|
|
3102
|
+
return () => {
|
|
3103
|
+
previews == null ? void 0 : previews.forEach((url) => URL == null ? void 0 : URL.revokeObjectURL(url));
|
|
3104
|
+
};
|
|
3105
|
+
}, []);
|
|
3106
|
+
return /* @__PURE__ */ import_react44.default.createElement("div", { className: `w-full ${className}` }, /* @__PURE__ */ import_react44.default.createElement(
|
|
3107
|
+
"input",
|
|
3108
|
+
{
|
|
3109
|
+
ref: inputRef,
|
|
3110
|
+
type: "file",
|
|
3111
|
+
accept,
|
|
3112
|
+
multiple,
|
|
3113
|
+
hidden: true,
|
|
3114
|
+
onChange: handleInputChange,
|
|
3115
|
+
disabled
|
|
3116
|
+
}
|
|
3117
|
+
), /* @__PURE__ */ import_react44.default.createElement(
|
|
3118
|
+
Label_default,
|
|
3119
|
+
{
|
|
3120
|
+
htmlFor: (_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.id,
|
|
3121
|
+
onDragOver: handleDragOver,
|
|
3122
|
+
onDragLeave: handleDragLeave,
|
|
3123
|
+
onDrop: handleDrop,
|
|
3124
|
+
onClick: triggerInput,
|
|
3125
|
+
onKeyDown: handleKeyDown,
|
|
3126
|
+
tabIndex: 0,
|
|
3127
|
+
role: "button",
|
|
3128
|
+
disabled,
|
|
3129
|
+
"aria-label": `Upload ${multiple ? "images" : "an image"}`,
|
|
3130
|
+
className: cn(
|
|
3131
|
+
"max-w-[564px] w-full bg-white py-4 flex items-center justify-center rounded-lg border cursor-pointer transition-all",
|
|
3132
|
+
isDragging ? "border-blue-500 bg-blue-50" : "border-gray-300 bg-white hover:bg-gray-50",
|
|
3133
|
+
disabled && "pointer-events-none cursor-not-allowed"
|
|
3134
|
+
)
|
|
3135
|
+
},
|
|
3136
|
+
/* @__PURE__ */ import_react44.default.createElement("div", { className: "flex items-center gap-3 text-center" }, /* @__PURE__ */ import_react44.default.createElement("div", null, /* @__PURE__ */ import_react44.default.createElement("p", { className: "text-sm text-gray-600" }, "Drag files here or", /* @__PURE__ */ import_react44.default.createElement("span", { className: "text-primary-600 font-semibold ml-1" }, "Upload"), " ", /* @__PURE__ */ import_react44.default.createElement("br", null))))
|
|
3137
|
+
), /* @__PURE__ */ import_react44.default.createElement("span", { className: "text-xs" }, hintText ?? `Only PNG, JPG, GIF. Max file size ${maxSizeMB}MB`), /* @__PURE__ */ import_react44.default.createElement("div", { className: "flex flex-col gap-4 mt-4" }, items == null ? void 0 : items.map((item) => {
|
|
3138
|
+
var _a2, _b;
|
|
3139
|
+
const previewUrl = getPreviewUrl(item);
|
|
3140
|
+
const progress = getCurrentProgress(item);
|
|
3141
|
+
const statusInfo = getStatusDisplay(item.status);
|
|
3142
|
+
const progressColor = getProgressColor(item == null ? void 0 : item.status);
|
|
3143
|
+
const fileIcon = getItemFileIcon(item);
|
|
3144
|
+
return /* @__PURE__ */ import_react44.default.createElement(
|
|
3145
|
+
"div",
|
|
3146
|
+
{
|
|
3147
|
+
key: item == null ? void 0 : item.id,
|
|
3148
|
+
className: "flex items-center gap-4 bg-white max-w-[564px] w-full p-4 rounded-lg border border-gray-200"
|
|
3149
|
+
},
|
|
3150
|
+
/* @__PURE__ */ import_react44.default.createElement("div", { className: "w-14 h-14 flex-shrink-0 rounded-md overflow-hidden relative" }, /* @__PURE__ */ import_react44.default.createElement(
|
|
3151
|
+
import_image2.default,
|
|
3152
|
+
{
|
|
3153
|
+
src: "/fileImg.svg",
|
|
3154
|
+
className: "absolute inset-0 w-full h-full object-contain",
|
|
3155
|
+
fill: true,
|
|
3156
|
+
alt: "file"
|
|
3157
|
+
}
|
|
3158
|
+
), /* @__PURE__ */ import_react44.default.createElement("div", { className: "relative z-10 mt-2 -ml-[2px] flex items-center justify-center w-full h-full text-white" }, fileIcon)),
|
|
3159
|
+
/* @__PURE__ */ import_react44.default.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ import_react44.default.createElement("div", { className: "flex items-start justify-between gap-2 mb-3" }, /* @__PURE__ */ import_react44.default.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ import_react44.default.createElement("h4", { className: "text-sm font-medium text-gray-900 truncate" }, (item == null ? void 0 : item.name) || ((_a2 = item.file) == null ? void 0 : _a2.name) || "Unnamed file"), showSizeText && /* @__PURE__ */ import_react44.default.createElement("div", { className: "text-xs text-gray-500 mt-1 flex items-center gap-1" }, formatSize((item == null ? void 0 : item.size) || ((_b = item.file) == null ? void 0 : _b.size)), statusInfo.text && /* @__PURE__ */ import_react44.default.createElement("div", { className: "ml-2 font-medium flex items-center gap-1" }, (statusInfo == null ? void 0 : statusInfo.showSpinner) ? (
|
|
3160
|
+
// For uploading - just show spinner without circle
|
|
3161
|
+
/* @__PURE__ */ import_react44.default.createElement(import_react44.default.Fragment, null, statusInfo.icon, /* @__PURE__ */ import_react44.default.createElement("span", { className: statusInfo.color }, statusInfo.text))
|
|
3162
|
+
) : (
|
|
3163
|
+
// For completed/failed - show circle with icon
|
|
3164
|
+
/* @__PURE__ */ import_react44.default.createElement(import_react44.default.Fragment, null, /* @__PURE__ */ import_react44.default.createElement(
|
|
3165
|
+
"div",
|
|
3166
|
+
{
|
|
3167
|
+
className: `w-4 h-4 rounded-full flex justify-center items-center ${(statusInfo == null ? void 0 : statusInfo.color) === "text-red-600" ? "bg-red-600" : (statusInfo == null ? void 0 : statusInfo.color) === "text-green-600" ? "bg-green-600" : "bg-gray-400"}`
|
|
3168
|
+
},
|
|
3169
|
+
statusInfo == null ? void 0 : statusInfo.icon
|
|
3170
|
+
), /* @__PURE__ */ import_react44.default.createElement("span", { className: statusInfo.color }, statusInfo == null ? void 0 : statusInfo.text))
|
|
3171
|
+
)))), /* @__PURE__ */ import_react44.default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ import_react44.default.createElement("div", { className: "flex items-center gap-2" }, onPreview && (item == null ? void 0 : item.status) === "success" && /* @__PURE__ */ import_react44.default.createElement(
|
|
3172
|
+
"button",
|
|
3173
|
+
{
|
|
3174
|
+
type: "button",
|
|
3175
|
+
onClick: () => onPreview(item.id),
|
|
3176
|
+
className: "p-2 rounded-md hover:bg-gray-100 transition-colors text-gray-600",
|
|
3177
|
+
title: "Preview"
|
|
3178
|
+
},
|
|
3179
|
+
/* @__PURE__ */ import_react44.default.createElement(import_react45.RiEyeLine, { size: 16 })
|
|
3180
|
+
), (item == null ? void 0 : item.status) === "error" && /* @__PURE__ */ import_react44.default.createElement(import_react44.default.Fragment, null, /* @__PURE__ */ import_react44.default.createElement("span", { className: "hidden sm:inline-block" }, /* @__PURE__ */ import_react44.default.createElement(
|
|
3181
|
+
Button_default,
|
|
3182
|
+
{
|
|
3183
|
+
variant: "outlined",
|
|
3184
|
+
intent: "primary-outlined",
|
|
3185
|
+
type: "button",
|
|
3186
|
+
size: "sm",
|
|
3187
|
+
onClick: () => handleRetry(item == null ? void 0 : item.id),
|
|
3188
|
+
className: "whitespace-nowrap h-[30px]"
|
|
3189
|
+
},
|
|
3190
|
+
/* @__PURE__ */ import_react44.default.createElement(import_react45.RiRefreshLine, { size: 16 }),
|
|
3191
|
+
"Try Again"
|
|
3192
|
+
)), /* @__PURE__ */ import_react44.default.createElement("span", { className: "sm:hidden" }, /* @__PURE__ */ import_react44.default.createElement(
|
|
3193
|
+
Button_default,
|
|
3194
|
+
{
|
|
3195
|
+
variant: "outlined",
|
|
3196
|
+
intent: "primary-outlined",
|
|
3197
|
+
type: "button",
|
|
3198
|
+
size: "sm",
|
|
3199
|
+
onClick: () => handleRetry(item == null ? void 0 : item.id),
|
|
3200
|
+
className: "h-[30px] px-1 py-1"
|
|
3201
|
+
},
|
|
3202
|
+
/* @__PURE__ */ import_react44.default.createElement(import_react45.RiRefreshLine, { size: 16 })
|
|
3203
|
+
))), /* @__PURE__ */ import_react44.default.createElement(
|
|
3204
|
+
"button",
|
|
3205
|
+
{
|
|
3206
|
+
type: "button",
|
|
3207
|
+
onClick: () => handleDelete(item.id),
|
|
3208
|
+
className: "p-2 rounded-md hover:bg-gray-100 transition-colors text-gray-600",
|
|
3209
|
+
title: "Delete"
|
|
3210
|
+
},
|
|
3211
|
+
/* @__PURE__ */ import_react44.default.createElement(import_react45.RiDeleteBin6Line, { size: 16 })
|
|
3212
|
+
)))), /* @__PURE__ */ import_react44.default.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ import_react44.default.createElement("div", { className: "flex-1" }, /* @__PURE__ */ import_react44.default.createElement(
|
|
3213
|
+
Progress_default,
|
|
3214
|
+
{
|
|
3215
|
+
progressColor,
|
|
3216
|
+
progress
|
|
3217
|
+
}
|
|
3218
|
+
)), /* @__PURE__ */ import_react44.default.createElement("div", { className: "text-xs text-gray-500 w-12 text-right" }, item.status === "error" ? "--%" : `${Math.round(progress)}%`)))
|
|
3219
|
+
);
|
|
3220
|
+
})));
|
|
3221
|
+
}
|
|
3222
|
+
|
|
1886
3223
|
// app/components/Sidebar.tsx
|
|
1887
|
-
var
|
|
3224
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
1888
3225
|
var import_link2 = __toESM(require("next/link"), 1);
|
|
3226
|
+
var import_react47 = require("@remixicon/react");
|
|
1889
3227
|
var import_navigation = require("next/navigation");
|
|
1890
|
-
var Sidebar = ({ children, collapsed, setCollapsed }) => {
|
|
1891
|
-
return /* @__PURE__ */
|
|
3228
|
+
var Sidebar = ({ children, collapsed, setCollapsed, dense = false }) => {
|
|
3229
|
+
return /* @__PURE__ */ import_react46.default.createElement(
|
|
1892
3230
|
"div",
|
|
1893
3231
|
{
|
|
1894
3232
|
onMouseEnter: () => setCollapsed(true),
|
|
1895
3233
|
onMouseLeave: () => setCollapsed(false),
|
|
1896
3234
|
className: cn(
|
|
1897
3235
|
"border border-gray-200 shadow-sm relative flex flex-col min-h-screen transition-all duration-300 ease-in-out cursor-pointer",
|
|
1898
|
-
!collapsed ? "w-[80px] py-[21px] px-[17px]" : "w-[308px] py-[22px] px-6"
|
|
3236
|
+
!collapsed ? dense ? "w-[76px] py-[19px] px-[15px]" : "w-[80px] py-[21px] px-[17px]" : dense ? "w-[304px] py-[20px] px-5" : "w-[308px] py-[22px] px-6"
|
|
1899
3237
|
)
|
|
1900
3238
|
},
|
|
1901
|
-
/* @__PURE__ */
|
|
3239
|
+
/* @__PURE__ */ import_react46.default.createElement("div", null, children)
|
|
1902
3240
|
);
|
|
1903
3241
|
};
|
|
1904
3242
|
var SidebarHeader = ({
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
children
|
|
3243
|
+
children,
|
|
3244
|
+
dense = false
|
|
1908
3245
|
}) => {
|
|
1909
|
-
return /* @__PURE__ */
|
|
1910
|
-
"div",
|
|
1911
|
-
{
|
|
1912
|
-
className: cn({
|
|
1913
|
-
"z-20": true
|
|
1914
|
-
})
|
|
1915
|
-
},
|
|
1916
|
-
/* @__PURE__ */ import_react33.default.createElement("div", { className: "flex justify-between items-center mb-4" }, /* @__PURE__ */ import_react33.default.createElement("span", { className: "whitespace-nowrap" }, children))
|
|
1917
|
-
);
|
|
3246
|
+
return /* @__PURE__ */ import_react46.default.createElement("div", { className: cn("z-20", dense ? "mb-3" : "mb-4") }, /* @__PURE__ */ import_react46.default.createElement("div", { className: "flex justify-between items-center" }, /* @__PURE__ */ import_react46.default.createElement("span", { className: "whitespace-nowrap" }, children)));
|
|
1918
3247
|
};
|
|
1919
3248
|
var SidebarMenu = ({
|
|
1920
3249
|
collapsed,
|
|
1921
3250
|
navItems,
|
|
1922
|
-
scroll = false
|
|
3251
|
+
scroll = false,
|
|
3252
|
+
dense = false
|
|
1923
3253
|
}) => {
|
|
3254
|
+
const [openMenus, setOpenMenus] = (0, import_react46.useState)({});
|
|
1924
3255
|
const currentPath = (0, import_navigation.usePathname)();
|
|
1925
|
-
|
|
1926
|
-
|
|
3256
|
+
const toggleMenu = (label) => {
|
|
3257
|
+
setOpenMenus((prev) => ({ ...prev, [label]: !prev[label] }));
|
|
3258
|
+
};
|
|
3259
|
+
import_react46.default.useEffect(() => {
|
|
3260
|
+
if (!collapsed) {
|
|
3261
|
+
setOpenMenus({});
|
|
3262
|
+
}
|
|
3263
|
+
}, [collapsed]);
|
|
3264
|
+
const getMenuHeight = () => {
|
|
3265
|
+
const footerItemsLength = (navItems == null ? void 0 : navItems.reduce((acc, item) => acc + item.items.length, 0)) || 0;
|
|
3266
|
+
if (footerItemsLength <= 1) {
|
|
3267
|
+
return "max-h-[80vh]";
|
|
3268
|
+
} else if (footerItemsLength === 2) {
|
|
3269
|
+
return "max-h-[70vh]";
|
|
3270
|
+
} else {
|
|
3271
|
+
return "max-h-[60vh]";
|
|
3272
|
+
}
|
|
3273
|
+
};
|
|
3274
|
+
const renderMenuItems = (items, level = 0) => {
|
|
3275
|
+
return /* @__PURE__ */ import_react46.default.createElement("ul", { className: level > 0 ? "ml-5 border-l border-gray-200" : "" }, items == null ? void 0 : items.map((item, index) => {
|
|
3276
|
+
const hasSubItems = item.subItems && item.subItems.length > 0;
|
|
3277
|
+
const isActive = item.href === currentPath;
|
|
3278
|
+
const isOpen = openMenus[item.label];
|
|
3279
|
+
const paddingLeft = level === 0 ? dense ? "10px" : "12px" : `${level * 5 + (dense ? 10 : 12)}px`;
|
|
3280
|
+
return /* @__PURE__ */ import_react46.default.createElement("li", { key: index }, hasSubItems ? /* @__PURE__ */ import_react46.default.createElement(
|
|
3281
|
+
import_link2.default,
|
|
3282
|
+
{
|
|
3283
|
+
href: item.href || "#",
|
|
3284
|
+
className: cn(
|
|
3285
|
+
"flex items-center justify-between rounded-md cursor-pointer transition-colors duration-300 font-semibold whitespace-nowrap overflow-hidden",
|
|
3286
|
+
dense ? "px-3 py-1.5 mb-1" : "px-3 py-2 mb-[6px]",
|
|
3287
|
+
isActive ? "bg-primary-600 text-white" : "text-gray-700",
|
|
3288
|
+
isOpen ? "bg-gray-100" : "",
|
|
3289
|
+
"hover:bg-gray-100",
|
|
3290
|
+
level > 0 ? "text-sm font-medium" : ""
|
|
3291
|
+
),
|
|
3292
|
+
style: { paddingLeft },
|
|
3293
|
+
onClick: (e) => {
|
|
3294
|
+
if (collapsed) {
|
|
3295
|
+
toggleMenu(item.label);
|
|
3296
|
+
}
|
|
3297
|
+
if (!item.href)
|
|
3298
|
+
e.preventDefault();
|
|
3299
|
+
}
|
|
3300
|
+
},
|
|
3301
|
+
/* @__PURE__ */ import_react46.default.createElement("div", { className: "flex items-center gap-2" }, item.icon && level === 0 && /* @__PURE__ */ import_react46.default.createElement("span", { className: dense ? "text-xs" : "text-text-sm" }, item.icon), /* @__PURE__ */ import_react46.default.createElement("span", { className: cn(!collapsed ? "opacity-0" : "") }, item.label)),
|
|
3302
|
+
collapsed && hasSubItems && /* @__PURE__ */ import_react46.default.createElement("span", null, isOpen ? /* @__PURE__ */ import_react46.default.createElement(
|
|
3303
|
+
import_react47.RiArrowDownSLine,
|
|
3304
|
+
{
|
|
3305
|
+
size: dense ? 16 : 18,
|
|
3306
|
+
color: "#475467"
|
|
3307
|
+
}
|
|
3308
|
+
) : /* @__PURE__ */ import_react46.default.createElement(
|
|
3309
|
+
import_react47.RiArrowRightSLine,
|
|
3310
|
+
{
|
|
3311
|
+
size: dense ? 16 : 18,
|
|
3312
|
+
color: "#475467"
|
|
3313
|
+
}
|
|
3314
|
+
))
|
|
3315
|
+
) : /* @__PURE__ */ import_react46.default.createElement(
|
|
3316
|
+
import_link2.default,
|
|
3317
|
+
{
|
|
3318
|
+
href: item.href || "#",
|
|
3319
|
+
className: cn(
|
|
3320
|
+
"flex items-center gap-2 rounded-md cursor-pointer transition-colors duration-300 whitespace-nowrap overflow-hidden",
|
|
3321
|
+
"hover:bg-gray-100",
|
|
3322
|
+
dense ? "px-3 py-1 mb-1" : "px-3 py-2 mb-[6px]",
|
|
3323
|
+
isActive ? "bg-primary-600 hover:bg-primary-700 text-white" : "text-gray-700",
|
|
3324
|
+
level > 0 ? "text-sm font-medium" : "font-semibold"
|
|
3325
|
+
)
|
|
3326
|
+
},
|
|
3327
|
+
item.icon && level === 0 && /* @__PURE__ */ import_react46.default.createElement("span", { className: dense ? "text-xs" : "text-text-sm" }, item.icon),
|
|
3328
|
+
/* @__PURE__ */ import_react46.default.createElement("span", { className: cn(!collapsed ? "opacity-0" : "") }, item.label)
|
|
3329
|
+
), hasSubItems && isOpen && /* @__PURE__ */ import_react46.default.createElement("div", { className: dense ? "mt-0.5" : "mt-1" }, renderMenuItems(item.subItems, level + 1)));
|
|
3330
|
+
}));
|
|
3331
|
+
};
|
|
3332
|
+
return /* @__PURE__ */ import_react46.default.createElement(
|
|
3333
|
+
"nav",
|
|
1927
3334
|
{
|
|
1928
|
-
|
|
1929
|
-
|
|
3335
|
+
className: cn(
|
|
3336
|
+
getMenuHeight(),
|
|
3337
|
+
"",
|
|
3338
|
+
scroll && collapsed ? "overflow-y-auto customScroll" : "overflow-hidden"
|
|
3339
|
+
)
|
|
1930
3340
|
},
|
|
1931
|
-
/* @__PURE__ */
|
|
1932
|
-
"
|
|
1933
|
-
{
|
|
1934
|
-
className: cn({
|
|
1935
|
-
"text-[14px] text-gray-500": true,
|
|
1936
|
-
"w-[37px] text-ellipsis text-white whitespace-nowrap overflow-hidden": !collapsed
|
|
1937
|
-
})
|
|
1938
|
-
},
|
|
1939
|
-
parentItem.label
|
|
1940
|
-
),
|
|
1941
|
-
/* @__PURE__ */ import_react33.default.createElement("ul", null, parentItem == null ? void 0 : parentItem.items.map((item, index) => /* @__PURE__ */ import_react33.default.createElement("li", { key: index }, /* @__PURE__ */ import_react33.default.createElement(
|
|
1942
|
-
import_link2.default,
|
|
3341
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
|
3342
|
+
"ul",
|
|
1943
3343
|
{
|
|
1944
|
-
className: cn(
|
|
1945
|
-
"
|
|
1946
|
-
"
|
|
1947
|
-
|
|
1948
|
-
"hover:bg-primary-600": currentPath === (item == null ? void 0 : item.href)
|
|
1949
|
-
}),
|
|
1950
|
-
href: item.href,
|
|
1951
|
-
passHref: true
|
|
3344
|
+
className: cn(
|
|
3345
|
+
"flex flex-col gap-2 items-stretch",
|
|
3346
|
+
dense ? "my-1.5" : "my-2"
|
|
3347
|
+
)
|
|
1952
3348
|
},
|
|
1953
|
-
/* @__PURE__ */
|
|
1954
|
-
"
|
|
3349
|
+
navItems == null ? void 0 : navItems.map((parentItem, parentIndex) => /* @__PURE__ */ import_react46.default.createElement(
|
|
3350
|
+
"li",
|
|
1955
3351
|
{
|
|
1956
|
-
|
|
3352
|
+
key: parentIndex,
|
|
3353
|
+
className: "flex flex-col gap-3 mb-1 whitespace-nowrap overflow-hidden"
|
|
1957
3354
|
},
|
|
1958
|
-
/* @__PURE__ */
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
3355
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
|
3356
|
+
"p",
|
|
3357
|
+
{
|
|
3358
|
+
className: cn(
|
|
3359
|
+
"text-gray-500 font-medium",
|
|
3360
|
+
dense ? "text-[12px]" : "text-[14px]",
|
|
3361
|
+
!collapsed ? "opacity-0" : ""
|
|
3362
|
+
)
|
|
3363
|
+
},
|
|
3364
|
+
parentItem.label
|
|
3365
|
+
),
|
|
3366
|
+
renderMenuItems(parentItem.items)
|
|
3367
|
+
))
|
|
3368
|
+
)
|
|
3369
|
+
);
|
|
1963
3370
|
};
|
|
1964
|
-
var
|
|
3371
|
+
var SidebarFooter = ({
|
|
1965
3372
|
children,
|
|
1966
3373
|
setCollapsed,
|
|
1967
3374
|
collapsed,
|
|
1968
|
-
navItems
|
|
3375
|
+
navItems,
|
|
3376
|
+
dense = false
|
|
1969
3377
|
}) => {
|
|
1970
3378
|
const currentPath = (0, import_navigation.usePathname)();
|
|
1971
|
-
return /* @__PURE__ */
|
|
3379
|
+
return /* @__PURE__ */ import_react46.default.createElement(
|
|
1972
3380
|
"div",
|
|
1973
3381
|
{
|
|
1974
3382
|
className: cn({
|
|
1975
|
-
"absolute bottom-0
|
|
1976
|
-
"w-[
|
|
3383
|
+
"absolute bottom-0 overflow-auto bg-white z-10": true,
|
|
3384
|
+
"max-h-[226px] py-2.5 w-[85%]": dense,
|
|
3385
|
+
"max-h-[230px] py-3 w-[85%]": !dense,
|
|
3386
|
+
"w-[53%]": !collapsed && dense,
|
|
3387
|
+
"w-[55%]": !collapsed && !dense
|
|
1977
3388
|
}),
|
|
1978
3389
|
onClick: () => setCollapsed(true)
|
|
1979
3390
|
},
|
|
1980
|
-
collapsed && /* @__PURE__ */
|
|
1981
|
-
navItems && navItems.length > 0 && /* @__PURE__ */
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
"text-[14px] text-gray-500": true,
|
|
1994
|
-
"w-[37px] text-ellipsis text-white whitespace-nowrap overflow-hidden": !collapsed
|
|
1995
|
-
})
|
|
1996
|
-
},
|
|
1997
|
-
parentItem.label
|
|
1998
|
-
),
|
|
1999
|
-
/* @__PURE__ */ import_react33.default.createElement("ul", null, (_a = parentItem == null ? void 0 : parentItem.items) == null ? void 0 : _a.map((item, index) => /* @__PURE__ */ import_react33.default.createElement("li", { key: index }, /* @__PURE__ */ import_react33.default.createElement(
|
|
2000
|
-
import_link2.default,
|
|
3391
|
+
collapsed && /* @__PURE__ */ import_react46.default.createElement("div", { className: "shadow-md" }, /* @__PURE__ */ import_react46.default.createElement(Divider_default, null)),
|
|
3392
|
+
navItems && navItems.length > 0 && /* @__PURE__ */ import_react46.default.createElement("nav", { className: "flex-grow w-full" }, /* @__PURE__ */ import_react46.default.createElement(
|
|
3393
|
+
"ul",
|
|
3394
|
+
{
|
|
3395
|
+
className: cn(
|
|
3396
|
+
"flex flex-col gap-2 items-stretch",
|
|
3397
|
+
dense ? "my-1.5" : "my-2"
|
|
3398
|
+
)
|
|
3399
|
+
},
|
|
3400
|
+
navItems == null ? void 0 : navItems.map((parentItem, parentIndex) => {
|
|
3401
|
+
var _a;
|
|
3402
|
+
return /* @__PURE__ */ import_react46.default.createElement(
|
|
3403
|
+
"li",
|
|
2001
3404
|
{
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
"text-white bg-primary-600": currentPath === (item == null ? void 0 : item.href),
|
|
2005
|
-
"text-gray-700": currentPath !== (item == null ? void 0 : item.href),
|
|
2006
|
-
"hover:bg-primary-600": currentPath === (item == null ? void 0 : item.href)
|
|
2007
|
-
}),
|
|
2008
|
-
href: item.href,
|
|
2009
|
-
passHref: true
|
|
3405
|
+
key: parentIndex,
|
|
3406
|
+
className: "flex flex-col gap-3 mb-1 whitespace-nowrap overflow-hidden"
|
|
2010
3407
|
},
|
|
2011
|
-
/* @__PURE__ */
|
|
2012
|
-
"
|
|
3408
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
|
3409
|
+
"p",
|
|
2013
3410
|
{
|
|
2014
|
-
className:
|
|
3411
|
+
className: cn({
|
|
3412
|
+
"text-gray-500": true,
|
|
3413
|
+
"text-[12px]": dense,
|
|
3414
|
+
"text-[14px]": !dense,
|
|
3415
|
+
"w-[35px] text-ellipsis text-white whitespace-nowrap overflow-hidden": !collapsed && dense,
|
|
3416
|
+
"w-[37px] text-ellipsis text-white whitespace-nowrap overflow-hidden": !collapsed && !dense
|
|
3417
|
+
})
|
|
2015
3418
|
},
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
)
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
3419
|
+
parentItem.label
|
|
3420
|
+
),
|
|
3421
|
+
/* @__PURE__ */ import_react46.default.createElement("ul", null, (_a = parentItem == null ? void 0 : parentItem.items) == null ? void 0 : _a.map((item, index) => /* @__PURE__ */ import_react46.default.createElement("li", { key: index }, /* @__PURE__ */ import_react46.default.createElement(
|
|
3422
|
+
import_link2.default,
|
|
3423
|
+
{
|
|
3424
|
+
className: cn({
|
|
3425
|
+
"hover:bg-gray-100 flex items-center cursor-pointer rounded-md transition-colors duration-300 font-semibold whitespace-nowrap overflow-hidden": true,
|
|
3426
|
+
"px-2 py-1.5 mb-1": dense,
|
|
3427
|
+
"px-3 py-2 mb-[6px]": !dense,
|
|
3428
|
+
"text-white bg-primary-600": currentPath === (item == null ? void 0 : item.href),
|
|
3429
|
+
"text-gray-700": currentPath !== (item == null ? void 0 : item.href),
|
|
3430
|
+
"hover:bg-primary-600": currentPath === (item == null ? void 0 : item.href)
|
|
3431
|
+
}),
|
|
3432
|
+
href: (item == null ? void 0 : item.href) || "#",
|
|
3433
|
+
passHref: true
|
|
3434
|
+
},
|
|
3435
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
|
3436
|
+
"div",
|
|
3437
|
+
{
|
|
3438
|
+
className: `flex items-center gap-2 whitespace-nowrap`
|
|
3439
|
+
},
|
|
3440
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
|
3441
|
+
"span",
|
|
3442
|
+
{
|
|
3443
|
+
className: dense ? "text-xs" : "text-text-sm"
|
|
3444
|
+
},
|
|
3445
|
+
" ",
|
|
3446
|
+
item.icon
|
|
3447
|
+
),
|
|
3448
|
+
/* @__PURE__ */ import_react46.default.createElement("span", { className: cn(!collapsed ? "opacity-0" : "") }, item.label)
|
|
3449
|
+
)
|
|
3450
|
+
))))
|
|
3451
|
+
);
|
|
3452
|
+
})
|
|
3453
|
+
)),
|
|
2022
3454
|
children
|
|
2023
3455
|
);
|
|
2024
3456
|
};
|
|
2025
3457
|
Sidebar.Header = SidebarHeader;
|
|
2026
3458
|
Sidebar.Menu = SidebarMenu;
|
|
2027
|
-
Sidebar.Footer =
|
|
3459
|
+
Sidebar.Footer = SidebarFooter;
|
|
2028
3460
|
var Sidebar_default = Sidebar;
|
|
2029
3461
|
|
|
2030
|
-
// app/components/
|
|
2031
|
-
var
|
|
2032
|
-
var
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
3462
|
+
// app/components/Skeleton.tsx
|
|
3463
|
+
var import_react48 = __toESM(require("react"), 1);
|
|
3464
|
+
var Skeleton = ({
|
|
3465
|
+
width = "100%",
|
|
3466
|
+
height = "100%",
|
|
3467
|
+
circle = false,
|
|
3468
|
+
animation = "shimmer"
|
|
3469
|
+
}) => {
|
|
3470
|
+
const style = {
|
|
3471
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
3472
|
+
height: typeof height === "number" ? `${height}px` : height,
|
|
3473
|
+
borderRadius: circle ? "50%" : void 0,
|
|
3474
|
+
display: "block"
|
|
3475
|
+
};
|
|
3476
|
+
return /* @__PURE__ */ import_react48.default.createElement(
|
|
3477
|
+
"span",
|
|
3478
|
+
{
|
|
3479
|
+
className: cn(
|
|
3480
|
+
"skeleton rounded-lg",
|
|
3481
|
+
circle ? "circle" : "",
|
|
3482
|
+
animation === "shimmer" && "skeleton-shimmer",
|
|
3483
|
+
animation === "wave" && "skeleton-wave",
|
|
3484
|
+
animation === "pulse" && "skeleton-pulse"
|
|
3485
|
+
),
|
|
3486
|
+
style
|
|
3487
|
+
}
|
|
3488
|
+
);
|
|
3489
|
+
};
|
|
3490
|
+
var Skeleton_default = Skeleton;
|
|
3491
|
+
|
|
3492
|
+
// app/components/Slider.tsx
|
|
3493
|
+
var import_react49 = __toESM(require("react"), 1);
|
|
3494
|
+
var Slider = (0, import_react49.forwardRef)(
|
|
3495
|
+
({ value, min = 0, max = 100, size = "sm", ...props }, ref) => {
|
|
3496
|
+
const progress = (value - min) / (max - min) * 100;
|
|
3497
|
+
return /* @__PURE__ */ import_react49.default.createElement(import_react49.default.Fragment, null, /* @__PURE__ */ import_react49.default.createElement(
|
|
3498
|
+
"input",
|
|
3499
|
+
{
|
|
2038
3500
|
ref,
|
|
2039
3501
|
type: "range",
|
|
2040
3502
|
min,
|
|
@@ -2055,25 +3517,27 @@ var Slider = (0, import_react34.forwardRef)(
|
|
|
2055
3517
|
Slider.displayName = "Slider";
|
|
2056
3518
|
var Slider_default = Slider;
|
|
2057
3519
|
|
|
2058
|
-
// app/components/
|
|
2059
|
-
var
|
|
2060
|
-
var
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
}
|
|
2072
|
-
|
|
3520
|
+
// app/components/SplitButton.tsx
|
|
3521
|
+
var import_react50 = __toESM(require("react"), 1);
|
|
3522
|
+
var SplitButton = (0, import_react50.forwardRef)(
|
|
3523
|
+
({ children, className = "", size = "md", appearance = "primary", compact = false, ...props }, ref) => {
|
|
3524
|
+
return /* @__PURE__ */ import_react50.default.createElement(
|
|
3525
|
+
"div",
|
|
3526
|
+
{
|
|
3527
|
+
ref,
|
|
3528
|
+
className: `inline-flex ${compact ? "gap-0" : ""} ${className}`,
|
|
3529
|
+
...props
|
|
3530
|
+
},
|
|
3531
|
+
children
|
|
3532
|
+
);
|
|
3533
|
+
}
|
|
3534
|
+
);
|
|
3535
|
+
SplitButton.displayName = "SplitButton";
|
|
3536
|
+
var SplitButton_default = SplitButton;
|
|
2073
3537
|
|
|
2074
3538
|
// app/components/Stepper.tsx
|
|
2075
|
-
var
|
|
2076
|
-
var
|
|
3539
|
+
var import_react51 = __toESM(require("react"), 1);
|
|
3540
|
+
var import_react52 = require("@remixicon/react");
|
|
2077
3541
|
var Stepper = ({
|
|
2078
3542
|
stepsConfig,
|
|
2079
3543
|
currentStep,
|
|
@@ -2082,82 +3546,126 @@ var Stepper = ({
|
|
|
2082
3546
|
setIsComplete,
|
|
2083
3547
|
position = "horizontal"
|
|
2084
3548
|
}) => {
|
|
2085
|
-
var _a;
|
|
2086
|
-
const stepRef = (0,
|
|
3549
|
+
var _a, _b;
|
|
3550
|
+
const stepRef = (0, import_react51.useRef)([]);
|
|
2087
3551
|
if (!stepsConfig.length) {
|
|
2088
3552
|
return null;
|
|
2089
3553
|
}
|
|
2090
3554
|
const ActiveComponent = (_a = stepsConfig[currentStep - 1]) == null ? void 0 : _a.Component;
|
|
2091
|
-
return /* @__PURE__ */
|
|
3555
|
+
return /* @__PURE__ */ import_react51.default.createElement(
|
|
2092
3556
|
"div",
|
|
2093
3557
|
{
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
)
|
|
3558
|
+
role: "region",
|
|
3559
|
+
"aria-label": "Step Progress",
|
|
3560
|
+
className: cn(position !== "horizontal" && "flex")
|
|
2098
3561
|
},
|
|
2099
|
-
|
|
3562
|
+
/* @__PURE__ */ import_react51.default.createElement(
|
|
2100
3563
|
"div",
|
|
2101
3564
|
{
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
3565
|
+
className: cn(
|
|
3566
|
+
"relative",
|
|
3567
|
+
position === "horizontal" ? "flex justify-center items-start" : "flex flex-col"
|
|
3568
|
+
),
|
|
3569
|
+
role: "list",
|
|
3570
|
+
"aria-label": `Progress: ${currentStep} of ${stepsConfig.length} steps`
|
|
2105
3571
|
},
|
|
2106
|
-
/* @__PURE__ */
|
|
3572
|
+
stepsConfig == null ? void 0 : stepsConfig.map((step, index) => /* @__PURE__ */ import_react51.default.createElement(
|
|
2107
3573
|
"div",
|
|
2108
3574
|
{
|
|
3575
|
+
key: index,
|
|
3576
|
+
ref: (el) => stepRef.current[index] = el,
|
|
2109
3577
|
className: cn(
|
|
2110
|
-
"",
|
|
2111
|
-
|
|
2112
|
-
|
|
3578
|
+
position === "horizontal" ? "flex gap-4 flex-col" : "flex gap-6 justify-start",
|
|
3579
|
+
index === stepsConfig.length - 1 ? "w-auto" : "w-full",
|
|
3580
|
+
currentStep > index + 1 || isComplete ? "complete" : "",
|
|
3581
|
+
currentStep === index + 1 ? "" : ""
|
|
3582
|
+
),
|
|
3583
|
+
role: "listitem",
|
|
3584
|
+
"aria-current": currentStep === index + 1 ? "step" : void 0,
|
|
3585
|
+
"aria-label": `${step.name}${step.helperName ? `, ${step.helperName}` : ""}, ${currentStep > index + 1 || isComplete ? "completed" : currentStep === index + 1 ? "current step" : "pending"}`
|
|
2113
3586
|
},
|
|
2114
|
-
/* @__PURE__ */
|
|
3587
|
+
/* @__PURE__ */ import_react51.default.createElement(
|
|
2115
3588
|
"div",
|
|
2116
3589
|
{
|
|
2117
|
-
className:
|
|
3590
|
+
className: cn(
|
|
3591
|
+
"",
|
|
3592
|
+
position === "horizontal" ? "flex items-center" : "flex flex-col"
|
|
3593
|
+
)
|
|
2118
3594
|
},
|
|
2119
|
-
|
|
2120
|
-
|
|
3595
|
+
/* @__PURE__ */ import_react51.default.createElement(
|
|
3596
|
+
"div",
|
|
3597
|
+
{
|
|
3598
|
+
className: `w-[20px] h-[20px] rounded-full bg-gray-100 flex justify-center items-center ${currentStep === index + 1 ? "border border-primary-600" : "border border-gray-200"} ${currentStep > index + 1 || isComplete ? "bg-primary-600 border-none" : ""}`,
|
|
3599
|
+
role: "status",
|
|
3600
|
+
"aria-label": `Step ${index + 1} ${currentStep > index + 1 || isComplete ? "completed" : currentStep === index + 1 ? "current" : "pending"}`
|
|
3601
|
+
},
|
|
3602
|
+
currentStep === index + 1 && !isComplete && /* @__PURE__ */ import_react51.default.createElement(
|
|
3603
|
+
"span",
|
|
3604
|
+
{
|
|
3605
|
+
"aria-hidden": "true",
|
|
3606
|
+
className: "w-[10px] h-[10px] rounded-full bg-primary-600"
|
|
3607
|
+
}
|
|
3608
|
+
),
|
|
3609
|
+
(currentStep > index + 1 || isComplete) && /* @__PURE__ */ import_react51.default.createElement("span", { "aria-hidden": "true" }, /* @__PURE__ */ import_react51.default.createElement(import_react52.RiCheckLine, { size: 12, color: "#fff" }))
|
|
3610
|
+
),
|
|
3611
|
+
index !== stepsConfig.length - 1 && /* @__PURE__ */ import_react51.default.createElement(
|
|
3612
|
+
"div",
|
|
3613
|
+
{
|
|
3614
|
+
className: cn(
|
|
3615
|
+
"mx-auto rounded-lg bg-gray-200",
|
|
3616
|
+
position === "horizontal" ? "w-[80%] h-1" : "h-[100px] w-1 my-2"
|
|
3617
|
+
),
|
|
3618
|
+
"aria-hidden": "true"
|
|
3619
|
+
},
|
|
3620
|
+
/* @__PURE__ */ import_react51.default.createElement(
|
|
3621
|
+
"p",
|
|
3622
|
+
{
|
|
3623
|
+
className: cn(
|
|
3624
|
+
"h-full rounded-lg",
|
|
3625
|
+
currentStep > index + 1 ? "bg-primary-600" : ""
|
|
3626
|
+
)
|
|
3627
|
+
}
|
|
3628
|
+
)
|
|
3629
|
+
)
|
|
2121
3630
|
),
|
|
2122
|
-
|
|
3631
|
+
/* @__PURE__ */ import_react51.default.createElement(
|
|
2123
3632
|
"div",
|
|
2124
3633
|
{
|
|
3634
|
+
"aria-hidden": currentStep !== index + 1,
|
|
2125
3635
|
className: cn(
|
|
2126
|
-
"
|
|
2127
|
-
position === "
|
|
3636
|
+
"whitespace-nowrap",
|
|
3637
|
+
position === "vertical" || (step == null ? void 0 : step.helperName) ? "-mt-1" : ""
|
|
2128
3638
|
)
|
|
2129
3639
|
},
|
|
2130
|
-
/* @__PURE__ */
|
|
2131
|
-
"
|
|
3640
|
+
/* @__PURE__ */ import_react51.default.createElement(
|
|
3641
|
+
"span",
|
|
2132
3642
|
{
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
)
|
|
3643
|
+
"aria-label": "Helper text",
|
|
3644
|
+
className: "text-gray-400 text-text-xs"
|
|
3645
|
+
},
|
|
3646
|
+
step == null ? void 0 : step.helperName
|
|
3647
|
+
),
|
|
3648
|
+
/* @__PURE__ */ import_react51.default.createElement("p", null, step == null ? void 0 : step.name)
|
|
2139
3649
|
)
|
|
2140
|
-
)
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
))
|
|
2153
|
-
), ActiveComponent && /* @__PURE__ */ import_react36.default.createElement(ActiveComponent, null));
|
|
3650
|
+
))
|
|
3651
|
+
),
|
|
3652
|
+
ActiveComponent && /* @__PURE__ */ import_react51.default.createElement(
|
|
3653
|
+
"div",
|
|
3654
|
+
{
|
|
3655
|
+
role: "tabpanel",
|
|
3656
|
+
"aria-label": `Current step: ${(_b = stepsConfig[currentStep - 1]) == null ? void 0 : _b.name}`,
|
|
3657
|
+
tabIndex: 0
|
|
3658
|
+
},
|
|
3659
|
+
/* @__PURE__ */ import_react51.default.createElement(ActiveComponent, null)
|
|
3660
|
+
)
|
|
3661
|
+
);
|
|
2154
3662
|
};
|
|
2155
3663
|
var Stepper_default = Stepper;
|
|
2156
3664
|
|
|
2157
3665
|
// app/components/TableComponents.tsx
|
|
2158
|
-
var
|
|
3666
|
+
var import_react53 = __toESM(require("react"), 1);
|
|
2159
3667
|
var Table = ({ children, className, dense, ...props }) => {
|
|
2160
|
-
return /* @__PURE__ */
|
|
3668
|
+
return /* @__PURE__ */ import_react53.default.createElement(
|
|
2161
3669
|
"table",
|
|
2162
3670
|
{
|
|
2163
3671
|
...props,
|
|
@@ -2175,7 +3683,7 @@ var TableHead = ({
|
|
|
2175
3683
|
className,
|
|
2176
3684
|
...props
|
|
2177
3685
|
}) => {
|
|
2178
|
-
return /* @__PURE__ */
|
|
3686
|
+
return /* @__PURE__ */ import_react53.default.createElement(
|
|
2179
3687
|
"thead",
|
|
2180
3688
|
{
|
|
2181
3689
|
...props,
|
|
@@ -2189,7 +3697,7 @@ var TableBody = ({
|
|
|
2189
3697
|
className,
|
|
2190
3698
|
...props
|
|
2191
3699
|
}) => {
|
|
2192
|
-
return /* @__PURE__ */
|
|
3700
|
+
return /* @__PURE__ */ import_react53.default.createElement("tbody", { ...props, className: cn(className) }, children);
|
|
2193
3701
|
};
|
|
2194
3702
|
var TableRow = ({
|
|
2195
3703
|
children,
|
|
@@ -2197,7 +3705,7 @@ var TableRow = ({
|
|
|
2197
3705
|
indent,
|
|
2198
3706
|
...props
|
|
2199
3707
|
}) => {
|
|
2200
|
-
return /* @__PURE__ */
|
|
3708
|
+
return /* @__PURE__ */ import_react53.default.createElement(
|
|
2201
3709
|
"tr",
|
|
2202
3710
|
{
|
|
2203
3711
|
...props,
|
|
@@ -2217,9 +3725,11 @@ var TableHeadCell = ({
|
|
|
2217
3725
|
sticky,
|
|
2218
3726
|
shadow,
|
|
2219
3727
|
left,
|
|
3728
|
+
shadowRight,
|
|
3729
|
+
right,
|
|
2220
3730
|
...props
|
|
2221
3731
|
}) => {
|
|
2222
|
-
return /* @__PURE__ */
|
|
3732
|
+
return /* @__PURE__ */ import_react53.default.createElement(
|
|
2223
3733
|
"th",
|
|
2224
3734
|
{
|
|
2225
3735
|
...props,
|
|
@@ -2227,14 +3737,17 @@ var TableHeadCell = ({
|
|
|
2227
3737
|
"px-6 py-3 text-left group-has-[th]/dense:py-2",
|
|
2228
3738
|
sticky && `sticky bg-gray-50`,
|
|
2229
3739
|
sticky && shadow && "shadow-table",
|
|
3740
|
+
sticky && shadowRight && "shadow-tableRight",
|
|
2230
3741
|
left,
|
|
3742
|
+
right,
|
|
2231
3743
|
className
|
|
2232
3744
|
),
|
|
2233
3745
|
style: {
|
|
2234
|
-
left
|
|
3746
|
+
left,
|
|
3747
|
+
right
|
|
2235
3748
|
}
|
|
2236
3749
|
},
|
|
2237
|
-
/* @__PURE__ */
|
|
3750
|
+
/* @__PURE__ */ import_react53.default.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ import_react53.default.createElement("span", { className: "font-medium text-xs" }, children), icon && /* @__PURE__ */ import_react53.default.createElement(
|
|
2238
3751
|
"span",
|
|
2239
3752
|
{
|
|
2240
3753
|
className: "hover:bg-gray-200 w-5 h-5 flex items-center justify-center p-1 rounded focus:bg-gray-300 active:bg-gray-300"
|
|
@@ -2249,10 +3762,12 @@ var TableDataCell = ({
|
|
|
2249
3762
|
icon,
|
|
2250
3763
|
sticky,
|
|
2251
3764
|
shadow,
|
|
3765
|
+
shadowRight,
|
|
2252
3766
|
left,
|
|
3767
|
+
right,
|
|
2253
3768
|
...props
|
|
2254
3769
|
}) => {
|
|
2255
|
-
return /* @__PURE__ */
|
|
3770
|
+
return /* @__PURE__ */ import_react53.default.createElement(
|
|
2256
3771
|
"td",
|
|
2257
3772
|
{
|
|
2258
3773
|
...props,
|
|
@@ -2260,15 +3775,18 @@ var TableDataCell = ({
|
|
|
2260
3775
|
"px-6 py-4 text-sm font-medium group-has-[td]/dense:py-2 first:group-has-[td]/indent:pl-[60px]",
|
|
2261
3776
|
sticky && `sticky bg-white`,
|
|
2262
3777
|
sticky && shadow && "shadow-table",
|
|
3778
|
+
sticky && shadowRight && "shadow-tableRight",
|
|
2263
3779
|
left,
|
|
3780
|
+
right,
|
|
2264
3781
|
className
|
|
2265
3782
|
),
|
|
2266
3783
|
style: {
|
|
2267
|
-
left
|
|
3784
|
+
left,
|
|
3785
|
+
right
|
|
2268
3786
|
}
|
|
2269
3787
|
},
|
|
2270
|
-
/* @__PURE__ */
|
|
2271
|
-
icon && /* @__PURE__ */
|
|
3788
|
+
/* @__PURE__ */ import_react53.default.createElement("span", { className: "font-medium text-sm" }, children),
|
|
3789
|
+
icon && /* @__PURE__ */ import_react53.default.createElement(
|
|
2272
3790
|
"span",
|
|
2273
3791
|
{
|
|
2274
3792
|
className: "hover:bg-gray-200 w-5 h-5 flex items-center justify-center p-1 rounded focus:bg-gray-300 active:bg-gray-300"
|
|
@@ -2280,94 +3798,215 @@ var TableDataCell = ({
|
|
|
2280
3798
|
var TableComponents_default = Table;
|
|
2281
3799
|
|
|
2282
3800
|
// app/components/Tabs.tsx
|
|
2283
|
-
var
|
|
3801
|
+
var import_react54 = __toESM(require("react"), 1);
|
|
2284
3802
|
var TabsContainer = ({
|
|
2285
3803
|
children,
|
|
2286
|
-
className
|
|
3804
|
+
className,
|
|
3805
|
+
position = "horizontal"
|
|
2287
3806
|
}) => {
|
|
2288
|
-
return /* @__PURE__ */
|
|
3807
|
+
return /* @__PURE__ */ import_react54.default.createElement("div", { className: cn(position === "vertical" ? "flex" : "block", className) }, children);
|
|
2289
3808
|
};
|
|
2290
3809
|
var TabList = ({
|
|
2291
3810
|
onChange,
|
|
2292
3811
|
ariaLabel,
|
|
2293
3812
|
children,
|
|
2294
3813
|
box = false,
|
|
2295
|
-
|
|
3814
|
+
pill = false,
|
|
3815
|
+
className,
|
|
3816
|
+
position = "horizontal"
|
|
2296
3817
|
}) => {
|
|
2297
|
-
const
|
|
2298
|
-
|
|
3818
|
+
const [focusIndex, setFocusIndex] = import_react54.default.useState(0);
|
|
3819
|
+
const tabRefs = import_react54.default.useRef([]);
|
|
3820
|
+
const handleKeyDown = (e, index) => {
|
|
3821
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3822
|
+
const tabCount = import_react54.default.Children.count(children);
|
|
3823
|
+
switch (e.key) {
|
|
3824
|
+
case "ArrowRight":
|
|
3825
|
+
if (position === "horizontal") {
|
|
3826
|
+
e.preventDefault();
|
|
3827
|
+
const nextIndex = (index + 1) % tabCount;
|
|
3828
|
+
setFocusIndex(nextIndex);
|
|
3829
|
+
(_a = tabRefs.current[nextIndex]) == null ? void 0 : _a.focus();
|
|
3830
|
+
}
|
|
3831
|
+
break;
|
|
3832
|
+
case "ArrowLeft":
|
|
3833
|
+
if (position === "horizontal") {
|
|
3834
|
+
e.preventDefault();
|
|
3835
|
+
const prevIndex = (index - 1 + tabCount) % tabCount;
|
|
3836
|
+
setFocusIndex(prevIndex);
|
|
3837
|
+
(_b = tabRefs.current[prevIndex]) == null ? void 0 : _b.focus();
|
|
3838
|
+
}
|
|
3839
|
+
break;
|
|
3840
|
+
case "ArrowDown":
|
|
3841
|
+
if (position === "vertical") {
|
|
3842
|
+
e.preventDefault();
|
|
3843
|
+
const nextIndex = (index + 1) % tabCount;
|
|
3844
|
+
setFocusIndex(nextIndex);
|
|
3845
|
+
(_c = tabRefs.current[nextIndex]) == null ? void 0 : _c.focus();
|
|
3846
|
+
}
|
|
3847
|
+
break;
|
|
3848
|
+
case "ArrowUp":
|
|
3849
|
+
if (position === "vertical") {
|
|
3850
|
+
e.preventDefault();
|
|
3851
|
+
const prevIndex = (index - 1 + tabCount) % tabCount;
|
|
3852
|
+
setFocusIndex(prevIndex);
|
|
3853
|
+
(_d = tabRefs.current[prevIndex]) == null ? void 0 : _d.focus();
|
|
3854
|
+
}
|
|
3855
|
+
break;
|
|
3856
|
+
case "Home":
|
|
3857
|
+
e.preventDefault();
|
|
3858
|
+
setFocusIndex(0);
|
|
3859
|
+
(_e = tabRefs.current[0]) == null ? void 0 : _e.focus();
|
|
3860
|
+
break;
|
|
3861
|
+
case "End":
|
|
3862
|
+
e.preventDefault();
|
|
3863
|
+
const lastIndex = tabCount - 1;
|
|
3864
|
+
setFocusIndex(lastIndex);
|
|
3865
|
+
(_f = tabRefs.current[lastIndex]) == null ? void 0 : _f.focus();
|
|
3866
|
+
break;
|
|
3867
|
+
}
|
|
2299
3868
|
};
|
|
2300
|
-
return /* @__PURE__ */
|
|
3869
|
+
return /* @__PURE__ */ import_react54.default.createElement(
|
|
2301
3870
|
"div",
|
|
2302
3871
|
{
|
|
2303
3872
|
className: cn(
|
|
2304
|
-
"flex items-center",
|
|
2305
|
-
box ? "bg-gray-50 rounded-lg border border-gray-200" : "border-b border-gray-200",
|
|
3873
|
+
position === "horizontal" ? "flex items-center" : "flex flex-col items-stretch",
|
|
3874
|
+
box ? "bg-gray-50 rounded-lg border border-gray-200" : pill ? position === "horizontal" ? "bg-transparent rounded-lg" : "bg-gray-100 rounded-full p-1" : position === "horizontal" ? "border-b border-gray-200" : "border-r border-gray-200",
|
|
2306
3875
|
className
|
|
2307
3876
|
),
|
|
2308
3877
|
role: "tablist",
|
|
2309
|
-
"aria-label": ariaLabel
|
|
3878
|
+
"aria-label": ariaLabel,
|
|
3879
|
+
"aria-orientation": position
|
|
2310
3880
|
},
|
|
2311
|
-
|
|
2312
|
-
if (
|
|
2313
|
-
|
|
2314
|
-
onChange
|
|
2315
|
-
box
|
|
3881
|
+
import_react54.default.Children.map(children, (child, index) => {
|
|
3882
|
+
if (import_react54.default.isValidElement(child)) {
|
|
3883
|
+
const childProps = {
|
|
3884
|
+
onChange,
|
|
3885
|
+
box,
|
|
3886
|
+
pill,
|
|
3887
|
+
// Add this line to pass pill prop to Tab
|
|
3888
|
+
position,
|
|
3889
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
3890
|
+
tabIndex: index === focusIndex ? 0 : -1
|
|
3891
|
+
};
|
|
3892
|
+
return import_react54.default.cloneElement(child, {
|
|
3893
|
+
...childProps,
|
|
3894
|
+
ref: (el) => {
|
|
3895
|
+
tabRefs.current[index] = el;
|
|
3896
|
+
const originalRef = child.ref;
|
|
3897
|
+
if (originalRef) {
|
|
3898
|
+
if (typeof originalRef === "function") {
|
|
3899
|
+
originalRef(el);
|
|
3900
|
+
} else {
|
|
3901
|
+
originalRef.current = el;
|
|
3902
|
+
}
|
|
3903
|
+
}
|
|
3904
|
+
}
|
|
2316
3905
|
});
|
|
2317
3906
|
}
|
|
2318
3907
|
return null;
|
|
2319
3908
|
})
|
|
2320
3909
|
);
|
|
2321
3910
|
};
|
|
2322
|
-
var Tab = (
|
|
2323
|
-
|
|
2324
|
-
value,
|
|
2325
|
-
onChange,
|
|
2326
|
-
icon,
|
|
2327
|
-
content,
|
|
2328
|
-
box = false,
|
|
2329
|
-
selectedTabValue,
|
|
2330
|
-
className
|
|
2331
|
-
}) => {
|
|
2332
|
-
const handleClick = () => {
|
|
2333
|
-
onChange(value);
|
|
2334
|
-
};
|
|
2335
|
-
const isSelected = value === selectedTabValue;
|
|
2336
|
-
return /* @__PURE__ */ import_react39.default.createElement(
|
|
2337
|
-
"button",
|
|
2338
|
-
{
|
|
2339
|
-
role: "tab",
|
|
2340
|
-
className: cn(
|
|
2341
|
-
"flex items-center gap-2 px-4 py-3 text-text-sm font-medium cursor-pointer hover:bg-gray-100 hover:rounded-t transition-all ease-linear duration-200 delay-75",
|
|
2342
|
-
isSelected && !box ? "text-primary-600 border-b-2 border-primary-600" : "border-b-2 border-transparent text-gray-700",
|
|
2343
|
-
isSelected && box ? "bg-white hover:bg-white shadow-md" : "",
|
|
2344
|
-
box ? "m-1 rounded-lg hover:rounded-lg" : "m-0",
|
|
2345
|
-
className
|
|
2346
|
-
),
|
|
2347
|
-
onClick: handleClick
|
|
2348
|
-
},
|
|
2349
|
-
icon,
|
|
2350
|
-
" ",
|
|
3911
|
+
var Tab = import_react54.default.forwardRef(
|
|
3912
|
+
({
|
|
2351
3913
|
label,
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
3914
|
+
value,
|
|
3915
|
+
onChange,
|
|
3916
|
+
icon,
|
|
3917
|
+
content,
|
|
3918
|
+
box = false,
|
|
3919
|
+
pill = false,
|
|
3920
|
+
selectedTabValue,
|
|
3921
|
+
className,
|
|
3922
|
+
onKeyDown,
|
|
3923
|
+
tabIndex,
|
|
3924
|
+
position = "horizontal"
|
|
3925
|
+
}, ref) => {
|
|
3926
|
+
const isSelected = value === selectedTabValue;
|
|
3927
|
+
return /* @__PURE__ */ import_react54.default.createElement(
|
|
3928
|
+
"button",
|
|
3929
|
+
{
|
|
3930
|
+
ref,
|
|
3931
|
+
role: "tab",
|
|
3932
|
+
"aria-selected": isSelected,
|
|
3933
|
+
"aria-controls": `panel-${value}`,
|
|
3934
|
+
id: `tab-${value}`,
|
|
3935
|
+
tabIndex,
|
|
3936
|
+
onKeyDown,
|
|
3937
|
+
className: cn(
|
|
3938
|
+
"flex items-center gap-2 px-4 py-3 text-text-sm font-medium cursor-pointer",
|
|
3939
|
+
// Default variant (no box, no pill)
|
|
3940
|
+
!box && !pill && [
|
|
3941
|
+
isSelected && position === "horizontal" ? "text-primary-600 border-b-2 border-primary-600" : isSelected && position === "vertical" ? "text-primary-600 border-r-2 border-primary-600" : "border-transparent text-gray-700"
|
|
3942
|
+
],
|
|
3943
|
+
// Box variant
|
|
3944
|
+
box && [
|
|
3945
|
+
position === "horizontal" ? "m-1 rounded-lg hover:rounded-lg" : "mx-1 my-0.5 rounded-lg hover:rounded-lg",
|
|
3946
|
+
isSelected ? "bg-white hover:bg-white shadow-md" : ""
|
|
3947
|
+
],
|
|
3948
|
+
// Pill variant - Horizontal
|
|
3949
|
+
pill && position === "horizontal" && [
|
|
3950
|
+
"py-1 px-3 text-sm first:rounded-l-2xl last:rounded-r-2xl border transition-all duration-200",
|
|
3951
|
+
isSelected ? "bg-primary-600 border-primary-600 text-white shadow-sm hover:bg-primary-700" : "bg-white border-gray-300 text-gray-700 hover:bg-gray-100"
|
|
3952
|
+
],
|
|
3953
|
+
// Pill variant - Vertical
|
|
3954
|
+
pill && position === "vertical" && [
|
|
3955
|
+
"py-2 px-4 rounded-full border transition-all duration-200 my-1",
|
|
3956
|
+
isSelected ? "bg-primary-600 border-primary-600 text-white shadow-sm hover:bg-primary-700" : "bg-gray-100 border-gray-300 text-gray-700 hover:bg-gray-200 hover:border-gray-400"
|
|
3957
|
+
],
|
|
3958
|
+
// Common hover styles for non-pill variants
|
|
3959
|
+
!pill && [
|
|
3960
|
+
position === "horizontal" ? "hover:bg-gray-100 hover:rounded-t transition-all ease-linear duration-200 delay-75" : "hover:bg-gray-100 hover:rounded-l transition-all ease-linear duration-200 delay-75"
|
|
3961
|
+
],
|
|
3962
|
+
// Border for vertical non-box, non-pill
|
|
3963
|
+
position === "vertical" && !box && !pill && !isSelected ? "border-r-2" : "",
|
|
3964
|
+
className
|
|
3965
|
+
),
|
|
3966
|
+
onClick: () => onChange(value)
|
|
3967
|
+
},
|
|
3968
|
+
icon && /* @__PURE__ */ import_react54.default.createElement("span", { "aria-hidden": "true" }, icon),
|
|
3969
|
+
label,
|
|
3970
|
+
content && /* @__PURE__ */ import_react54.default.createElement("span", { "aria-hidden": "true" }, content)
|
|
3971
|
+
);
|
|
3972
|
+
}
|
|
3973
|
+
);
|
|
2356
3974
|
var TabPanel = ({
|
|
2357
3975
|
value,
|
|
2358
3976
|
currentValue,
|
|
2359
3977
|
children,
|
|
2360
3978
|
className
|
|
2361
3979
|
}) => {
|
|
2362
|
-
return value === currentValue ? /* @__PURE__ */
|
|
3980
|
+
return value === currentValue ? /* @__PURE__ */ import_react54.default.createElement(
|
|
3981
|
+
"div",
|
|
3982
|
+
{
|
|
3983
|
+
role: "tabpanel",
|
|
3984
|
+
id: `panel-${value}`,
|
|
3985
|
+
"aria-labelledby": `tab-${value}`,
|
|
3986
|
+
tabIndex: 0,
|
|
3987
|
+
className
|
|
3988
|
+
},
|
|
3989
|
+
children
|
|
3990
|
+
) : null;
|
|
2363
3991
|
};
|
|
2364
3992
|
var Tabs_default = TabsContainer;
|
|
3993
|
+
Tab.displayName = "Tab";
|
|
2365
3994
|
|
|
2366
3995
|
// app/components/Textarea.tsx
|
|
2367
|
-
var
|
|
2368
|
-
var Textarea = (0,
|
|
2369
|
-
({
|
|
2370
|
-
|
|
3996
|
+
var import_react55 = __toESM(require("react"), 1);
|
|
3997
|
+
var Textarea = (0, import_react55.forwardRef)(
|
|
3998
|
+
({
|
|
3999
|
+
size,
|
|
4000
|
+
className,
|
|
4001
|
+
rows,
|
|
4002
|
+
cols,
|
|
4003
|
+
disabled,
|
|
4004
|
+
error,
|
|
4005
|
+
children,
|
|
4006
|
+
id,
|
|
4007
|
+
...props
|
|
4008
|
+
}, ref) => {
|
|
4009
|
+
return /* @__PURE__ */ import_react55.default.createElement(
|
|
2371
4010
|
"textarea",
|
|
2372
4011
|
{
|
|
2373
4012
|
...props,
|
|
@@ -2376,8 +4015,9 @@ var Textarea = (0, import_react40.forwardRef)(
|
|
|
2376
4015
|
rows,
|
|
2377
4016
|
cols,
|
|
2378
4017
|
className: cn(
|
|
2379
|
-
"group flex items-center gap-2 border border-gray-200 rounded-lg bg-gray-50 shadow-xs hover:bg-gray-50 hover:border-gray-300 text-sm focus-within:border-gray-800 focus-within:bg-gray-25 focus-within:hover:bg-gray-50 focus-within:hover:border-gray-800 outline-none disabled:bg-gray-300 disabled:select-none disabled:pointer-events-none disabled:opacity-30 placeholder:text-gray-500 hover:placeholder:text-gray-500",
|
|
4018
|
+
"group flex items-center gap-2 border border-gray-200 rounded-lg bg-gray-50 shadow-xs hover:bg-gray-50 hover:border-gray-300 text-sm focus-within:border-gray-800 focus-within:bg-gray-25 focus-within:hover:bg-gray-50 focus-within:hover:border-gray-800 outline-none disabled:bg-gray-300 disabled:select-none disabled:pointer-events-none disabled:opacity-30 w-full placeholder:text-gray-500 hover:placeholder:text-gray-500 shadow-[0px_1px_2px_0px_#1018280D]",
|
|
2380
4019
|
size === "sm" ? "py-2.5 px-3.5" : "p-2.5",
|
|
4020
|
+
error && "border-error-500 hover:border-error-600 focus-within:hover:border-error-500 focus-within:border-error-500",
|
|
2381
4021
|
className,
|
|
2382
4022
|
size
|
|
2383
4023
|
)
|
|
@@ -2389,9 +4029,74 @@ var Textarea = (0, import_react40.forwardRef)(
|
|
|
2389
4029
|
Textarea.displayName = "Textarea";
|
|
2390
4030
|
var Textarea_default = Textarea;
|
|
2391
4031
|
|
|
4032
|
+
// app/components/TextInputWithLabel.tsx
|
|
4033
|
+
var import_react56 = require("@remixicon/react");
|
|
4034
|
+
var import_react57 = __toESM(require("react"), 1);
|
|
4035
|
+
var TextInputWithLabel = ({
|
|
4036
|
+
intent = "primary",
|
|
4037
|
+
placeholder = "Enter tags",
|
|
4038
|
+
type = "text",
|
|
4039
|
+
size,
|
|
4040
|
+
tags,
|
|
4041
|
+
setTags,
|
|
4042
|
+
...props
|
|
4043
|
+
}) => {
|
|
4044
|
+
const handleAddTags = (inputValue) => {
|
|
4045
|
+
const values = inputValue.split(",").map((v) => v.trim()).filter((v) => v && !tags.includes(v));
|
|
4046
|
+
if (values.length === 0)
|
|
4047
|
+
return;
|
|
4048
|
+
setTags([...tags, ...values]);
|
|
4049
|
+
};
|
|
4050
|
+
const handleRemoveTag = (tag) => {
|
|
4051
|
+
setTags(tags.filter((t) => t !== tag));
|
|
4052
|
+
};
|
|
4053
|
+
const handleKeyDown = (e) => {
|
|
4054
|
+
if (e.key === "Enter") {
|
|
4055
|
+
e.preventDefault();
|
|
4056
|
+
const target = e.target;
|
|
4057
|
+
handleAddTags(target.value);
|
|
4058
|
+
target.value = "";
|
|
4059
|
+
}
|
|
4060
|
+
};
|
|
4061
|
+
const handlePaste = (e) => {
|
|
4062
|
+
e.preventDefault();
|
|
4063
|
+
const pasteData = e.clipboardData.getData("text");
|
|
4064
|
+
handleAddTags(pasteData);
|
|
4065
|
+
};
|
|
4066
|
+
return /* @__PURE__ */ import_react57.default.createElement("div", null, /* @__PURE__ */ import_react57.default.createElement(
|
|
4067
|
+
Input_default,
|
|
4068
|
+
{
|
|
4069
|
+
type,
|
|
4070
|
+
size,
|
|
4071
|
+
onKeyDown: handleKeyDown,
|
|
4072
|
+
onPaste: handlePaste,
|
|
4073
|
+
placeholder,
|
|
4074
|
+
className: "w-full",
|
|
4075
|
+
...props
|
|
4076
|
+
}
|
|
4077
|
+
), /* @__PURE__ */ import_react57.default.createElement("div", { className: "flex flex-wrap items-center gap-2 mt-2 transition-all duration-300" }, tags == null ? void 0 : tags.map((tag, idx) => /* @__PURE__ */ import_react57.default.createElement(
|
|
4078
|
+
Chip_default,
|
|
4079
|
+
{
|
|
4080
|
+
size: "md",
|
|
4081
|
+
intent,
|
|
4082
|
+
key: `${tag}-${idx}`,
|
|
4083
|
+
endIcon: /* @__PURE__ */ import_react57.default.createElement(
|
|
4084
|
+
import_react56.RiCloseCircleLine,
|
|
4085
|
+
{
|
|
4086
|
+
size: 14,
|
|
4087
|
+
className: "cursor-pointer hover:text-red-500",
|
|
4088
|
+
onClick: () => handleRemoveTag(tag)
|
|
4089
|
+
}
|
|
4090
|
+
)
|
|
4091
|
+
},
|
|
4092
|
+
tag
|
|
4093
|
+
))));
|
|
4094
|
+
};
|
|
4095
|
+
var TextInputWithLabel_default = TextInputWithLabel;
|
|
4096
|
+
|
|
2392
4097
|
// app/components/Toggle.tsx
|
|
2393
4098
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
2394
|
-
var
|
|
4099
|
+
var import_react58 = __toESM(require("react"), 1);
|
|
2395
4100
|
var toggleVariants = (0, import_class_variance_authority8.cva)("", {
|
|
2396
4101
|
variants: {
|
|
2397
4102
|
size: {
|
|
@@ -2409,37 +4114,42 @@ var toggleVariants = (0, import_class_variance_authority8.cva)("", {
|
|
|
2409
4114
|
intent: "primary"
|
|
2410
4115
|
}
|
|
2411
4116
|
});
|
|
2412
|
-
var Toggle = (0,
|
|
2413
|
-
({ size, className, intent, disabled, children, ...props }, ref) => {
|
|
2414
|
-
return /* @__PURE__ */
|
|
4117
|
+
var Toggle = (0, import_react58.forwardRef)(
|
|
4118
|
+
({ size, className, intent, disabled, children, id, ...props }, ref) => {
|
|
4119
|
+
return /* @__PURE__ */ import_react58.default.createElement(
|
|
2415
4120
|
"label",
|
|
2416
4121
|
{
|
|
2417
4122
|
className: cn(
|
|
2418
4123
|
"inline-flex items-center cursor-pointer",
|
|
2419
4124
|
disabled && "opacity-30 pointer-events-none"
|
|
2420
|
-
)
|
|
4125
|
+
),
|
|
4126
|
+
htmlFor: id
|
|
2421
4127
|
},
|
|
2422
|
-
/* @__PURE__ */
|
|
4128
|
+
/* @__PURE__ */ import_react58.default.createElement(
|
|
2423
4129
|
"input",
|
|
2424
4130
|
{
|
|
2425
4131
|
type: "checkbox",
|
|
2426
4132
|
disabled,
|
|
2427
4133
|
ref,
|
|
4134
|
+
id,
|
|
4135
|
+
role: "switch",
|
|
4136
|
+
"aria-checked": props == null ? void 0 : props.checked,
|
|
2428
4137
|
...props,
|
|
2429
|
-
className: "sr-only
|
|
4138
|
+
className: "sr-only peer"
|
|
2430
4139
|
}
|
|
2431
4140
|
),
|
|
2432
|
-
/* @__PURE__ */
|
|
4141
|
+
/* @__PURE__ */ import_react58.default.createElement(
|
|
2433
4142
|
"span",
|
|
2434
4143
|
{
|
|
2435
4144
|
className: cn(
|
|
2436
|
-
"relative w-11 h-7 bg-gray-300 peer-focus:
|
|
4145
|
+
"relative w-11 h-7 bg-gray-300 rounded-full peer peer-focus:ring-2 peer-focus:ring-primary-600 peer-focus:ring-offset-2 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all",
|
|
2437
4146
|
toggleVariants({
|
|
2438
4147
|
intent,
|
|
2439
|
-
className,
|
|
2440
4148
|
size
|
|
2441
|
-
})
|
|
2442
|
-
|
|
4149
|
+
}),
|
|
4150
|
+
className
|
|
4151
|
+
),
|
|
4152
|
+
"aria-hidden": "true"
|
|
2443
4153
|
},
|
|
2444
4154
|
children
|
|
2445
4155
|
)
|
|
@@ -2448,6 +4158,288 @@ var Toggle = (0, import_react41.forwardRef)(
|
|
|
2448
4158
|
);
|
|
2449
4159
|
Toggle.displayName = "Toggle";
|
|
2450
4160
|
var Toggle_default = Toggle;
|
|
4161
|
+
|
|
4162
|
+
// app/components/Tooltip.tsx
|
|
4163
|
+
var import_class_variance_authority9 = require("class-variance-authority");
|
|
4164
|
+
var import_react59 = __toESM(require("react"), 1);
|
|
4165
|
+
var tooltipVariants = (0, import_class_variance_authority9.cva)(
|
|
4166
|
+
"bg-white shadow-lg rounded-lg absolute hidden group-hover:block p-3 z-10 max-w-[328px] w-max whitespace-normal opacity-0 group-hover:opacity-100 transform transition-all duration-1000 ease-in-out group-hover:delay-[2000ms]",
|
|
4167
|
+
{
|
|
4168
|
+
variants: {
|
|
4169
|
+
position: {
|
|
4170
|
+
top: "bottom-[calc(100%+8px)] group-hover:translate-y-0 delay-1000 translate-y-[-10px]",
|
|
4171
|
+
right: "top-1/2 -translate-y-1/2 left-[calc(100%+8px)] group-hover:translate-x-0 translate-x-[-10px]",
|
|
4172
|
+
bottom: "top-[calc(100%+8px)] group-hover:translate-y-0 translate-y-[10px]",
|
|
4173
|
+
left: "top-1/2 -translate-y-1/2 right-[calc(100%+8px)] group-hover:translate-x-0 translate-x-[10px]"
|
|
4174
|
+
}
|
|
4175
|
+
}
|
|
4176
|
+
}
|
|
4177
|
+
);
|
|
4178
|
+
var arrowVariants = (0, import_class_variance_authority9.cva)(
|
|
4179
|
+
"absolute w-0 h-0 border-transparent border-solid",
|
|
4180
|
+
{
|
|
4181
|
+
variants: {
|
|
4182
|
+
position: {
|
|
4183
|
+
top: "top-full left-5 -translate-x-1/2 border-t-white border-t-[6px] border-x-[6px] border-x-transparent border-b-0",
|
|
4184
|
+
right: "right-full top-1/2 -translate-y-1/2 border-r-white border-r-[6px] border-y-[6px] border-y-transparent border-l-0",
|
|
4185
|
+
bottom: "bottom-full left-4 -translate-x-1/2 border-b-white border-b-[6px] border-x-[6px] border-x-transparent border-t-0",
|
|
4186
|
+
left: "left-full top-1/2 -translate-y-1/2 border-l-white border-l-[6px] border-y-[6px] border-y-transparent border-r-0"
|
|
4187
|
+
}
|
|
4188
|
+
}
|
|
4189
|
+
}
|
|
4190
|
+
);
|
|
4191
|
+
var Tooltip = ({
|
|
4192
|
+
position,
|
|
4193
|
+
content,
|
|
4194
|
+
children,
|
|
4195
|
+
className,
|
|
4196
|
+
...props
|
|
4197
|
+
}) => {
|
|
4198
|
+
return /* @__PURE__ */ import_react59.default.createElement("div", { ...props, className: "relative cursor-pointer text-sm group w-fit" }, /* @__PURE__ */ import_react59.default.createElement("div", null, children), /* @__PURE__ */ import_react59.default.createElement("div", { className: cn(tooltipVariants({ position }), className) }, content, /* @__PURE__ */ import_react59.default.createElement("div", { className: cn(arrowVariants({ position })) })));
|
|
4199
|
+
};
|
|
4200
|
+
var Tooltip_default = Tooltip;
|
|
4201
|
+
|
|
4202
|
+
// app/components/TreeView.tsx
|
|
4203
|
+
var import_react60 = __toESM(require("react"), 1);
|
|
4204
|
+
var import_react61 = require("@remixicon/react");
|
|
4205
|
+
var TreeView = ({
|
|
4206
|
+
children,
|
|
4207
|
+
"aria-label": ariaLabel,
|
|
4208
|
+
flat = false,
|
|
4209
|
+
className,
|
|
4210
|
+
defaultExpandedIds = [],
|
|
4211
|
+
expandedIds,
|
|
4212
|
+
onExpandedChange,
|
|
4213
|
+
allowMultiple = true,
|
|
4214
|
+
expandTopLevelByDefault = false
|
|
4215
|
+
}) => {
|
|
4216
|
+
const topLevelIds = import_react60.default.Children.toArray(children).map(
|
|
4217
|
+
(child) => import_react60.default.isValidElement(child) ? child.props.id : null
|
|
4218
|
+
).filter(Boolean);
|
|
4219
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react60.useState)(
|
|
4220
|
+
() => new Set(
|
|
4221
|
+
defaultExpandedIds.length ? defaultExpandedIds : expandTopLevelByDefault ? topLevelIds : []
|
|
4222
|
+
)
|
|
4223
|
+
);
|
|
4224
|
+
const expandedNodes = expandedIds ? new Set(expandedIds) : internalExpanded;
|
|
4225
|
+
const [selectedId, setSelectedId] = (0, import_react60.useState)(null);
|
|
4226
|
+
const toggleNode = (id) => {
|
|
4227
|
+
const updateSet = (set) => {
|
|
4228
|
+
const next = new Set(set);
|
|
4229
|
+
if (allowMultiple) {
|
|
4230
|
+
next.has(id) ? next.delete(id) : next.add(id);
|
|
4231
|
+
} else {
|
|
4232
|
+
next.clear();
|
|
4233
|
+
next.add(id);
|
|
4234
|
+
}
|
|
4235
|
+
return next;
|
|
4236
|
+
};
|
|
4237
|
+
if (expandedIds && onExpandedChange) {
|
|
4238
|
+
const newExpanded = updateSet(expandedNodes);
|
|
4239
|
+
onExpandedChange(Array.from(newExpanded));
|
|
4240
|
+
} else {
|
|
4241
|
+
setInternalExpanded((prev) => updateSet(prev));
|
|
4242
|
+
}
|
|
4243
|
+
};
|
|
4244
|
+
const handleSelect = (id) => setSelectedId(id);
|
|
4245
|
+
const enhanceChildren = (nodes, level = 0) => import_react60.default.Children.map(nodes, (child) => {
|
|
4246
|
+
if (import_react60.default.isValidElement(child)) {
|
|
4247
|
+
return import_react60.default.cloneElement(child, {
|
|
4248
|
+
level,
|
|
4249
|
+
expanded: expandedNodes.has(child.props.id),
|
|
4250
|
+
onToggle: toggleNode,
|
|
4251
|
+
onSelect: handleSelect,
|
|
4252
|
+
selected: selectedId === child.props.id,
|
|
4253
|
+
flat,
|
|
4254
|
+
children: enhanceChildren(child.props.children, level + 1)
|
|
4255
|
+
});
|
|
4256
|
+
}
|
|
4257
|
+
return child;
|
|
4258
|
+
});
|
|
4259
|
+
return /* @__PURE__ */ import_react60.default.createElement(
|
|
4260
|
+
"ul",
|
|
4261
|
+
{
|
|
4262
|
+
role: "tree",
|
|
4263
|
+
"aria-label": ariaLabel,
|
|
4264
|
+
className: cn("list-none p-0 m-0 text-sm", className)
|
|
4265
|
+
},
|
|
4266
|
+
enhanceChildren(children)
|
|
4267
|
+
);
|
|
4268
|
+
};
|
|
4269
|
+
var DefaultExpandIcon = ({ expanded }) => /* @__PURE__ */ import_react60.default.createElement("span", { className: "transition-transform duration-200" }, expanded ? /* @__PURE__ */ import_react60.default.createElement(import_react61.RiArrowDownSFill, { size: 18 }) : /* @__PURE__ */ import_react60.default.createElement(import_react61.RiArrowRightSFill, { size: 18 }));
|
|
4270
|
+
var TreeViewItem = ({
|
|
4271
|
+
id,
|
|
4272
|
+
children,
|
|
4273
|
+
current = false,
|
|
4274
|
+
className,
|
|
4275
|
+
onSelect,
|
|
4276
|
+
expanded = false,
|
|
4277
|
+
onToggle,
|
|
4278
|
+
selected = false,
|
|
4279
|
+
level = 0,
|
|
4280
|
+
flat = false
|
|
4281
|
+
}) => {
|
|
4282
|
+
const leading = [];
|
|
4283
|
+
const trailing = [];
|
|
4284
|
+
const content = [];
|
|
4285
|
+
let subTree = null;
|
|
4286
|
+
import_react60.default.Children.forEach(children, (child) => {
|
|
4287
|
+
if (import_react60.default.isValidElement(child)) {
|
|
4288
|
+
if (child.type === TreeViewLeadingVisual)
|
|
4289
|
+
leading.push(child);
|
|
4290
|
+
else if (child.type === TreeViewTrailingVisual)
|
|
4291
|
+
trailing.push(child);
|
|
4292
|
+
else if (child.type === TreeViewSubTree)
|
|
4293
|
+
subTree = child;
|
|
4294
|
+
else
|
|
4295
|
+
content.push(child);
|
|
4296
|
+
} else
|
|
4297
|
+
content.push(child);
|
|
4298
|
+
});
|
|
4299
|
+
const hasSubTree = !!subTree;
|
|
4300
|
+
const handleClick = (e) => {
|
|
4301
|
+
e.stopPropagation();
|
|
4302
|
+
if (hasSubTree && !flat && onToggle)
|
|
4303
|
+
onToggle(id);
|
|
4304
|
+
if (onSelect)
|
|
4305
|
+
onSelect(id);
|
|
4306
|
+
};
|
|
4307
|
+
const handleKeyDown = (e) => {
|
|
4308
|
+
switch (e.key) {
|
|
4309
|
+
case "Enter":
|
|
4310
|
+
case " ":
|
|
4311
|
+
e.preventDefault();
|
|
4312
|
+
handleClick(e);
|
|
4313
|
+
break;
|
|
4314
|
+
case "ArrowRight":
|
|
4315
|
+
if (hasSubTree && !expanded && !flat && onToggle) {
|
|
4316
|
+
e.preventDefault();
|
|
4317
|
+
onToggle(id);
|
|
4318
|
+
}
|
|
4319
|
+
break;
|
|
4320
|
+
case "ArrowLeft":
|
|
4321
|
+
if (hasSubTree && expanded && !flat && onToggle) {
|
|
4322
|
+
e.preventDefault();
|
|
4323
|
+
onToggle(id);
|
|
4324
|
+
}
|
|
4325
|
+
break;
|
|
4326
|
+
}
|
|
4327
|
+
};
|
|
4328
|
+
const processedSubTree = subTree && import_react60.default.isValidElement(subTree) ? import_react60.default.cloneElement(subTree, { expanded, flat }) : null;
|
|
4329
|
+
return /* @__PURE__ */ import_react60.default.createElement(import_react60.default.Fragment, null, /* @__PURE__ */ import_react60.default.createElement(
|
|
4330
|
+
"li",
|
|
4331
|
+
{
|
|
4332
|
+
role: "treeitem",
|
|
4333
|
+
"aria-expanded": hasSubTree && !flat ? expanded : void 0,
|
|
4334
|
+
"aria-selected": selected,
|
|
4335
|
+
"aria-current": current ? "true" : void 0,
|
|
4336
|
+
className: cn(
|
|
4337
|
+
"flex items-center gap-2 px-2 py-1 cursor-pointer select-none rounded transition-colors duration-150",
|
|
4338
|
+
selected && "bg-blue-50 text-blue-600 font-medium",
|
|
4339
|
+
"hover:bg-gray-100",
|
|
4340
|
+
className
|
|
4341
|
+
),
|
|
4342
|
+
style: { paddingLeft: `${level * 16 + 8}px` },
|
|
4343
|
+
onClick: handleClick,
|
|
4344
|
+
onKeyDown: handleKeyDown,
|
|
4345
|
+
tabIndex: 0
|
|
4346
|
+
},
|
|
4347
|
+
/* @__PURE__ */ import_react60.default.createElement("span", { className: "flex items-center gap-1" }, !leading.length && hasSubTree && !flat && /* @__PURE__ */ import_react60.default.createElement(DefaultExpandIcon, { expanded }), leading),
|
|
4348
|
+
/* @__PURE__ */ import_react60.default.createElement("span", { className: "flex-1" }, content),
|
|
4349
|
+
trailing
|
|
4350
|
+
), processedSubTree);
|
|
4351
|
+
};
|
|
4352
|
+
var TreeViewSubTree = ({
|
|
4353
|
+
children,
|
|
4354
|
+
state,
|
|
4355
|
+
count,
|
|
4356
|
+
className,
|
|
4357
|
+
expanded = false,
|
|
4358
|
+
flat = false
|
|
4359
|
+
}) => {
|
|
4360
|
+
if (flat)
|
|
4361
|
+
return null;
|
|
4362
|
+
if (state === "loading") {
|
|
4363
|
+
return /* @__PURE__ */ import_react60.default.createElement("ul", { role: "group", className: cn("list-none m-0", className) }, /* @__PURE__ */ import_react60.default.createElement("li", { className: "text-gray-500 italic p-1 pl-6" }, "Loading", count ? ` ${count} items...` : "..."));
|
|
4364
|
+
}
|
|
4365
|
+
return /* @__PURE__ */ import_react60.default.createElement(
|
|
4366
|
+
"ul",
|
|
4367
|
+
{
|
|
4368
|
+
role: "group",
|
|
4369
|
+
className: cn(
|
|
4370
|
+
"list-none m-0 pl-0 overflow-hidden transition-all duration-300 ease-in-out",
|
|
4371
|
+
expanded ? "max-h-96 opacity-100" : "max-h-0 opacity-0",
|
|
4372
|
+
className
|
|
4373
|
+
)
|
|
4374
|
+
},
|
|
4375
|
+
children
|
|
4376
|
+
);
|
|
4377
|
+
};
|
|
4378
|
+
var TreeViewLeadingVisual = ({ children, className }) => /* @__PURE__ */ import_react60.default.createElement("span", { className: cn("flex items-center flex-shrink-0", className) }, children);
|
|
4379
|
+
var TreeViewTrailingVisual = ({ children, label, className }) => /* @__PURE__ */ import_react60.default.createElement(
|
|
4380
|
+
"span",
|
|
4381
|
+
{
|
|
4382
|
+
className: cn("flex items-center ml-auto flex-shrink-0", className),
|
|
4383
|
+
"aria-label": label
|
|
4384
|
+
},
|
|
4385
|
+
children
|
|
4386
|
+
);
|
|
4387
|
+
TreeView.Item = TreeViewItem;
|
|
4388
|
+
TreeView.SubTree = TreeViewSubTree;
|
|
4389
|
+
TreeView.LeadingVisual = TreeViewLeadingVisual;
|
|
4390
|
+
TreeView.TrailingVisual = TreeViewTrailingVisual;
|
|
4391
|
+
var TreeView_default = TreeView;
|
|
4392
|
+
|
|
4393
|
+
// app/components/Typography.tsx
|
|
4394
|
+
var import_class_variance_authority10 = require("class-variance-authority");
|
|
4395
|
+
var import_react62 = __toESM(require("react"), 1);
|
|
4396
|
+
var typographyVariant = (0, import_class_variance_authority10.cva)("text-dark", {
|
|
4397
|
+
variants: {
|
|
4398
|
+
variant: {
|
|
4399
|
+
h1: "text-8xl font-bold",
|
|
4400
|
+
h2: "text-7xl font-bold",
|
|
4401
|
+
h3: "text-5xl font-bold",
|
|
4402
|
+
h4: "text-[32px] font-bold",
|
|
4403
|
+
h5: "text-2xl font-bold",
|
|
4404
|
+
h6: "text-xl font-semibold",
|
|
4405
|
+
b1: "text-xl font-normal",
|
|
4406
|
+
b2: "text-lg font-normal",
|
|
4407
|
+
b3: "text-base font-normal",
|
|
4408
|
+
b4: "text-sm font-normal",
|
|
4409
|
+
b5: "text-xs font-normal"
|
|
4410
|
+
},
|
|
4411
|
+
intent: {
|
|
4412
|
+
primary: "text-primary-600",
|
|
4413
|
+
success: "text-success-600",
|
|
4414
|
+
error: "text-error-600",
|
|
4415
|
+
warning: "text-warning-600",
|
|
4416
|
+
default: "text-black"
|
|
4417
|
+
}
|
|
4418
|
+
},
|
|
4419
|
+
defaultVariants: {
|
|
4420
|
+
variant: "h1",
|
|
4421
|
+
intent: "default"
|
|
4422
|
+
}
|
|
4423
|
+
});
|
|
4424
|
+
var Typography = ({
|
|
4425
|
+
as,
|
|
4426
|
+
variant = "h1",
|
|
4427
|
+
intent = "default",
|
|
4428
|
+
children,
|
|
4429
|
+
className,
|
|
4430
|
+
...props
|
|
4431
|
+
}) => {
|
|
4432
|
+
const Component = as || ((variant == null ? void 0 : variant.startsWith("b")) ? "p" : variant);
|
|
4433
|
+
return /* @__PURE__ */ import_react62.default.createElement(
|
|
4434
|
+
Component,
|
|
4435
|
+
{
|
|
4436
|
+
className: cn(typographyVariant({ variant, intent, className })),
|
|
4437
|
+
...props
|
|
4438
|
+
},
|
|
4439
|
+
children
|
|
4440
|
+
);
|
|
4441
|
+
};
|
|
4442
|
+
var Typography_default = Typography;
|
|
2451
4443
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2452
4444
|
0 && (module.exports = {
|
|
2453
4445
|
Accordion,
|
|
@@ -2458,30 +4450,52 @@ var Toggle_default = Toggle;
|
|
|
2458
4450
|
AvatarGroup,
|
|
2459
4451
|
BreadCrumb,
|
|
2460
4452
|
Button,
|
|
4453
|
+
Callout,
|
|
4454
|
+
Card,
|
|
4455
|
+
CardAction,
|
|
4456
|
+
CardContent,
|
|
4457
|
+
CardDescription,
|
|
4458
|
+
CardFooter,
|
|
4459
|
+
CardHeader,
|
|
4460
|
+
CardTitle,
|
|
2461
4461
|
Checkbox,
|
|
2462
4462
|
Chip,
|
|
2463
4463
|
CircularProgress,
|
|
2464
4464
|
Divider,
|
|
4465
|
+
Drawer,
|
|
2465
4466
|
Dropdown,
|
|
4467
|
+
DropdownMenu,
|
|
4468
|
+
DropdownMenuContent,
|
|
4469
|
+
DropdownMenuItem,
|
|
4470
|
+
DropdownMenuLabel,
|
|
4471
|
+
DropdownMenuSeparator,
|
|
4472
|
+
DropdownMenuSub,
|
|
4473
|
+
DropdownMenuSubContent,
|
|
4474
|
+
DropdownMenuSubTrigger,
|
|
4475
|
+
DropdownMenuTrigger,
|
|
2466
4476
|
DropdownWithIcon,
|
|
4477
|
+
FileSelector,
|
|
2467
4478
|
FileUpload,
|
|
4479
|
+
FileUploadPreview,
|
|
2468
4480
|
GlobalNavigation,
|
|
2469
4481
|
HelperText,
|
|
2470
4482
|
Input,
|
|
2471
4483
|
Label,
|
|
2472
4484
|
ListItem,
|
|
4485
|
+
ListPagination,
|
|
2473
4486
|
Loading,
|
|
2474
|
-
MenuDropdown,
|
|
2475
|
-
MenuItem,
|
|
2476
|
-
MenuSubItem,
|
|
2477
4487
|
Modal,
|
|
2478
4488
|
Notice,
|
|
4489
|
+
OTPInput,
|
|
2479
4490
|
Pagination,
|
|
2480
4491
|
ProgressBar,
|
|
2481
4492
|
Radio,
|
|
4493
|
+
RazorPayFileUpload,
|
|
2482
4494
|
Sidebar,
|
|
2483
4495
|
Skeleton,
|
|
2484
4496
|
Slider,
|
|
4497
|
+
Spinner,
|
|
4498
|
+
SplitButton,
|
|
2485
4499
|
Stepper,
|
|
2486
4500
|
Tab,
|
|
2487
4501
|
TabList,
|
|
@@ -2493,8 +4507,12 @@ var Toggle_default = Toggle;
|
|
|
2493
4507
|
TableHeadCell,
|
|
2494
4508
|
TableRow,
|
|
2495
4509
|
TabsContainer,
|
|
4510
|
+
TextInputWithLabel,
|
|
2496
4511
|
Textarea,
|
|
2497
4512
|
Toggle,
|
|
2498
|
-
Tooltip
|
|
4513
|
+
Tooltip,
|
|
4514
|
+
TreeView,
|
|
4515
|
+
Typography,
|
|
4516
|
+
defaultGetFileIcon
|
|
2499
4517
|
});
|
|
2500
4518
|
//# sourceMappingURL=index.cjs.map
|