@gamecp/ui 0.1.0 → 0.1.14
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.d.mts +489 -68
- package/dist/index.d.ts +489 -68
- package/dist/index.js +3215 -923
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3167 -915
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -4
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,71 @@
|
|
|
1
|
-
import React4, { forwardRef, useState, useRef, useEffect } from 'react';
|
|
2
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import React4, { forwardRef, useState, useRef, useEffect, useCallback } from 'react';
|
|
3
|
+
import { RiCloseLine, RiCheckLine, RiLoader4Line, RiFileCopyLine, RiEyeOffLine, RiEyeLine, RiRefreshLine, RiSearchLine, RiFilterLine, RiGridFill, RiListUnordered, RiFileCopyFill, RiPauseFill, RiPauseLine, RiRestartFill, RiRestartLine, RiStopFill, RiStopLine, RiPlayFill, RiPlayLine, RiBarChartFill, RiBarChartLine, RiEyeFill, RiPlayCircleFill, RiPlayCircleLine, RiStopCircleFill, RiStopCircleLine, RiDeleteBinFill, RiDeleteBinLine, RiEditFill, RiEditLine, RiArrowDownSLine } from 'react-icons/ri';
|
|
5
4
|
import { createPortal } from 'react-dom';
|
|
6
5
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
6
|
+
import NextLink from 'next/link';
|
|
7
|
+
import { Tooltip } from 'react-tooltip';
|
|
8
|
+
import { useIntlayer } from 'next-intlayer';
|
|
7
9
|
|
|
8
|
-
// src/
|
|
10
|
+
// src/Badge.tsx
|
|
11
|
+
var badgeVariants = {
|
|
12
|
+
default: "bg-gray-100 text-foreground border-border",
|
|
13
|
+
primary: "bg-primary-100 text-primary-800 border-primary-200",
|
|
14
|
+
secondary: "bg-gray-100 text-foreground border-border",
|
|
15
|
+
success: "bg-success text-success-dark border-success-light",
|
|
16
|
+
warning: "bg-yellow-100 text-yellow-800 border-yellow-200",
|
|
17
|
+
error: "bg-red-100 text-red-800 border-red-200",
|
|
18
|
+
info: "bg-muted text-muted-foreground border-ring",
|
|
19
|
+
gray: "bg-gray-100 text-foreground border-border",
|
|
20
|
+
purple: "bg-purple-100 text-purple-800 border-purple-200",
|
|
21
|
+
pink: "bg-pink-100 text-pink-800 border-pink-200",
|
|
22
|
+
indigo: "bg-indigo-100 text-indigo-800 border-indigo-200",
|
|
23
|
+
yellow: "bg-yellow-100 text-yellow-800 border-yellow-200",
|
|
24
|
+
orange: "bg-orange-100 text-orange-800 border-orange-200",
|
|
25
|
+
teal: "bg-teal-100 text-teal-800 border-teal-200",
|
|
26
|
+
cyan: "bg-cyan-100 text-cyan-800 border-cyan-200",
|
|
27
|
+
lime: "bg-lime-100 text-lime-800 border-lime-200",
|
|
28
|
+
emerald: "bg-emerald-100 text-emerald-800 border-emerald-200",
|
|
29
|
+
rose: "bg-rose-100 text-rose-800 border-rose-200",
|
|
30
|
+
sky: "bg-sky-100 text-sky-800 border-sky-200",
|
|
31
|
+
violet: "bg-violet-100 text-violet-800 border-violet-200",
|
|
32
|
+
fuchsia: "bg-fuchsia-100 text-fuchsia-800 border-fuchsia-200",
|
|
33
|
+
amber: "bg-amber-100 text-amber-800 border-amber-200"
|
|
34
|
+
};
|
|
35
|
+
var badgeSizes = {
|
|
36
|
+
sm: "px-2 py-0.5 text-xs",
|
|
37
|
+
md: "px-2.5 py-0.5 text-xs",
|
|
38
|
+
lg: "px-3 py-1 text-sm"
|
|
39
|
+
};
|
|
40
|
+
function Badge({
|
|
41
|
+
children,
|
|
42
|
+
variant = "default",
|
|
43
|
+
size = "md",
|
|
44
|
+
className = "",
|
|
45
|
+
customColors
|
|
46
|
+
}) {
|
|
47
|
+
const baseClasses = "inline-flex items-center font-medium rounded-full border";
|
|
48
|
+
const variantClasses5 = variant === "custom" ? "" : badgeVariants[variant];
|
|
49
|
+
const sizeClasses5 = badgeSizes[size];
|
|
50
|
+
const customStyles = variant === "custom" && customColors ? {
|
|
51
|
+
backgroundColor: customColors.background,
|
|
52
|
+
color: customColors.text,
|
|
53
|
+
borderColor: customColors.border || customColors.background
|
|
54
|
+
} : {};
|
|
55
|
+
return /* @__PURE__ */ jsx(
|
|
56
|
+
"span",
|
|
57
|
+
{
|
|
58
|
+
className: `${baseClasses} ${variantClasses5} ${sizeClasses5} ${className}`,
|
|
59
|
+
style: customStyles,
|
|
60
|
+
children
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
9
64
|
var variantClasses = {
|
|
10
65
|
primary: "bg-primary text-primary-foreground hover:bg-primary/90 border-transparent",
|
|
11
66
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent",
|
|
12
67
|
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 border-transparent",
|
|
68
|
+
danger: "bg-red-600 text-white hover:bg-red-700 border-transparent",
|
|
13
69
|
ghost: "bg-transparent hover:bg-muted hover:text-foreground border-transparent",
|
|
14
70
|
link: "bg-transparent text-primary underline-offset-4 hover:underline border-transparent p-0",
|
|
15
71
|
outline: "bg-transparent border-border hover:bg-muted hover:text-foreground"
|
|
@@ -88,73 +144,6 @@ var Button = forwardRef(
|
|
|
88
144
|
);
|
|
89
145
|
Button.displayName = "Button";
|
|
90
146
|
var Button_default = Button;
|
|
91
|
-
var badgeVariants = {
|
|
92
|
-
default: "bg-gray-100 text-foreground border-border",
|
|
93
|
-
primary: "bg-primary-100 text-primary-800 border-primary-200",
|
|
94
|
-
secondary: "bg-gray-100 text-foreground border-border",
|
|
95
|
-
success: "bg-success text-success-dark border-success-light",
|
|
96
|
-
warning: "bg-yellow-100 text-yellow-800 border-yellow-200",
|
|
97
|
-
error: "bg-red-100 text-red-800 border-red-200",
|
|
98
|
-
info: "bg-muted text-muted-foreground border-ring",
|
|
99
|
-
gray: "bg-gray-100 text-foreground border-border",
|
|
100
|
-
purple: "bg-purple-100 text-purple-800 border-purple-200",
|
|
101
|
-
pink: "bg-pink-100 text-pink-800 border-pink-200",
|
|
102
|
-
indigo: "bg-indigo-100 text-indigo-800 border-indigo-200",
|
|
103
|
-
yellow: "bg-yellow-100 text-yellow-800 border-yellow-200",
|
|
104
|
-
orange: "bg-orange-100 text-orange-800 border-orange-200",
|
|
105
|
-
teal: "bg-teal-100 text-teal-800 border-teal-200",
|
|
106
|
-
cyan: "bg-cyan-100 text-cyan-800 border-cyan-200",
|
|
107
|
-
lime: "bg-lime-100 text-lime-800 border-lime-200",
|
|
108
|
-
emerald: "bg-emerald-100 text-emerald-800 border-emerald-200",
|
|
109
|
-
rose: "bg-rose-100 text-rose-800 border-rose-200",
|
|
110
|
-
sky: "bg-sky-100 text-sky-800 border-sky-200",
|
|
111
|
-
violet: "bg-violet-100 text-violet-800 border-violet-200",
|
|
112
|
-
fuchsia: "bg-fuchsia-100 text-fuchsia-800 border-fuchsia-200",
|
|
113
|
-
amber: "bg-amber-100 text-amber-800 border-amber-200"
|
|
114
|
-
};
|
|
115
|
-
var badgeSizes = {
|
|
116
|
-
sm: "px-2 py-0.5 text-xs",
|
|
117
|
-
md: "px-2.5 py-0.5 text-xs",
|
|
118
|
-
lg: "px-3 py-1 text-sm"
|
|
119
|
-
};
|
|
120
|
-
function Badge({
|
|
121
|
-
children,
|
|
122
|
-
variant = "default",
|
|
123
|
-
size = "md",
|
|
124
|
-
className = "",
|
|
125
|
-
customColors
|
|
126
|
-
}) {
|
|
127
|
-
const baseClasses = "inline-flex items-center font-medium rounded-full border";
|
|
128
|
-
const variantClasses4 = variant === "custom" ? "" : badgeVariants[variant];
|
|
129
|
-
const sizeClasses4 = badgeSizes[size];
|
|
130
|
-
const customStyles = variant === "custom" && customColors ? {
|
|
131
|
-
backgroundColor: customColors.background,
|
|
132
|
-
color: customColors.text,
|
|
133
|
-
borderColor: customColors.border || customColors.background
|
|
134
|
-
} : {};
|
|
135
|
-
return /* @__PURE__ */ jsx(
|
|
136
|
-
"span",
|
|
137
|
-
{
|
|
138
|
-
className: `${baseClasses} ${variantClasses4} ${sizeClasses4} ${className}`,
|
|
139
|
-
style: customStyles,
|
|
140
|
-
children
|
|
141
|
-
}
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
var SuccessBadge = (props) => /* @__PURE__ */ jsx(Badge, { ...props, variant: "success" });
|
|
145
|
-
var WarningBadge = (props) => /* @__PURE__ */ jsx(Badge, { ...props, variant: "warning" });
|
|
146
|
-
var ErrorBadge = (props) => /* @__PURE__ */ jsx(Badge, { ...props, variant: "error" });
|
|
147
|
-
var InfoBadge = (props) => /* @__PURE__ */ jsx(Badge, { ...props, variant: "info" });
|
|
148
|
-
var PrimaryBadge = (props) => /* @__PURE__ */ jsx(Badge, { ...props, variant: "primary" });
|
|
149
|
-
var GrayBadge = (props) => /* @__PURE__ */ jsx(Badge, { ...props, variant: "gray" });
|
|
150
|
-
function StatusBadge({
|
|
151
|
-
isActive,
|
|
152
|
-
activeText = "Active",
|
|
153
|
-
inactiveText = "Inactive",
|
|
154
|
-
...props
|
|
155
|
-
}) {
|
|
156
|
-
return /* @__PURE__ */ jsx(Badge, { ...props, variant: isActive ? "success" : "error", children: isActive ? activeText : inactiveText });
|
|
157
|
-
}
|
|
158
147
|
var sizeClasses2 = {
|
|
159
148
|
xs: "w-3 h-3",
|
|
160
149
|
sm: "w-4 h-4",
|
|
@@ -260,7 +249,8 @@ function Card({
|
|
|
260
249
|
contentClassName = "",
|
|
261
250
|
status,
|
|
262
251
|
statusIcon,
|
|
263
|
-
statusText
|
|
252
|
+
statusText,
|
|
253
|
+
id
|
|
264
254
|
}) {
|
|
265
255
|
const [isExpanded, setIsExpanded] = useState(defaultExpanded);
|
|
266
256
|
const baseClasses = [
|
|
@@ -290,6 +280,7 @@ function Card({
|
|
|
290
280
|
return /* @__PURE__ */ jsxs(
|
|
291
281
|
"div",
|
|
292
282
|
{
|
|
283
|
+
id,
|
|
293
284
|
className: `${baseClasses} ${className}`,
|
|
294
285
|
style,
|
|
295
286
|
onClick: clickable || onClick ? handleClick : void 0,
|
|
@@ -343,934 +334,3195 @@ function Card({
|
|
|
343
334
|
}
|
|
344
335
|
);
|
|
345
336
|
}
|
|
346
|
-
|
|
337
|
+
var sizeClasses3 = {
|
|
338
|
+
sm: "max-w-md",
|
|
339
|
+
md: "max-w-2xl",
|
|
340
|
+
lg: "max-w-4xl",
|
|
341
|
+
xl: "max-w-6xl",
|
|
342
|
+
full: "max-w-full mx-4"
|
|
343
|
+
};
|
|
344
|
+
function Modal({
|
|
345
|
+
isOpen,
|
|
346
|
+
onClose,
|
|
347
347
|
children,
|
|
348
|
-
className = "",
|
|
349
|
-
...props
|
|
350
|
-
}) {
|
|
351
|
-
return /* @__PURE__ */ jsx(Card, { className, ...props, children });
|
|
352
|
-
}
|
|
353
|
-
function HeaderCard({
|
|
354
348
|
title,
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
iconColor,
|
|
359
|
-
iconSize,
|
|
360
|
-
actionButton,
|
|
361
|
-
children,
|
|
349
|
+
header,
|
|
350
|
+
blocking = false,
|
|
351
|
+
size = "md",
|
|
362
352
|
className = "",
|
|
363
|
-
|
|
353
|
+
footer,
|
|
354
|
+
fullScreen = false,
|
|
355
|
+
noPadding = false,
|
|
356
|
+
footerBg = "gray",
|
|
357
|
+
variant = "default",
|
|
358
|
+
scrollable = true,
|
|
359
|
+
"aria-describedby": ariaDescribedBy,
|
|
360
|
+
customStyles = {}
|
|
364
361
|
}) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
362
|
+
const modalContentRef = useRef(null);
|
|
363
|
+
const previousActiveElementRef = useRef(null);
|
|
364
|
+
const hasPerformedInitialFocusRef = useRef(false);
|
|
365
|
+
const getFocusableElements = () => {
|
|
366
|
+
if (!modalContentRef.current) return [];
|
|
367
|
+
const focusableSelectors = [
|
|
368
|
+
"button:not([disabled])",
|
|
369
|
+
"a[href]",
|
|
370
|
+
"input:not([disabled])",
|
|
371
|
+
"select:not([disabled])",
|
|
372
|
+
"textarea:not([disabled])",
|
|
373
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
374
|
+
].join(", ");
|
|
375
|
+
return Array.from(
|
|
376
|
+
modalContentRef.current.querySelectorAll(focusableSelectors)
|
|
377
|
+
);
|
|
378
|
+
};
|
|
379
|
+
useEffect(() => {
|
|
380
|
+
if (!isOpen) {
|
|
381
|
+
hasPerformedInitialFocusRef.current = false;
|
|
382
|
+
return;
|
|
378
383
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
function StatusCard({
|
|
382
|
-
status,
|
|
383
|
-
statusIcon,
|
|
384
|
-
statusText,
|
|
385
|
-
children,
|
|
386
|
-
className = "",
|
|
387
|
-
...props
|
|
388
|
-
}) {
|
|
389
|
-
return /* @__PURE__ */ jsx(
|
|
390
|
-
Card,
|
|
391
|
-
{
|
|
392
|
-
status,
|
|
393
|
-
statusIcon,
|
|
394
|
-
statusText,
|
|
395
|
-
className,
|
|
396
|
-
...props,
|
|
397
|
-
children
|
|
384
|
+
if (!hasPerformedInitialFocusRef.current) {
|
|
385
|
+
previousActiveElementRef.current = document.activeElement;
|
|
398
386
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
default: "text-foreground hover:text-primary",
|
|
419
|
-
primary: "text-primary hover:text-primary/80",
|
|
420
|
-
muted: "text-muted-foreground hover:text-foreground"
|
|
421
|
-
};
|
|
422
|
-
var Link = forwardRef(
|
|
423
|
-
({
|
|
424
|
-
href,
|
|
425
|
-
variant = "default",
|
|
426
|
-
underline = false,
|
|
427
|
-
external = false,
|
|
428
|
-
className = "",
|
|
429
|
-
children,
|
|
430
|
-
...props
|
|
431
|
-
}, ref) => {
|
|
432
|
-
const classes = [
|
|
433
|
-
"transition-colors",
|
|
434
|
-
variantClasses3[variant],
|
|
435
|
-
underline ? "underline underline-offset-4" : "hover:underline hover:underline-offset-4",
|
|
436
|
-
className
|
|
437
|
-
].filter(Boolean).join(" ");
|
|
438
|
-
if (external || href.startsWith("http")) {
|
|
439
|
-
return /* @__PURE__ */ jsx(
|
|
440
|
-
"a",
|
|
441
|
-
{
|
|
442
|
-
ref,
|
|
443
|
-
href,
|
|
444
|
-
className: classes,
|
|
445
|
-
target: "_blank",
|
|
446
|
-
rel: "noopener noreferrer",
|
|
447
|
-
...props,
|
|
448
|
-
children
|
|
387
|
+
let timeoutId = null;
|
|
388
|
+
if (!hasPerformedInitialFocusRef.current) {
|
|
389
|
+
const focusableElements = getFocusableElements();
|
|
390
|
+
const firstFocusable = focusableElements[0];
|
|
391
|
+
timeoutId = setTimeout(() => {
|
|
392
|
+
const activeElement = document.activeElement;
|
|
393
|
+
const isHTMLElement = activeElement instanceof HTMLElement;
|
|
394
|
+
const isUserTyping = activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA" || isHTMLElement && activeElement.isContentEditable);
|
|
395
|
+
const isFocusInModal = modalContentRef.current?.contains(activeElement);
|
|
396
|
+
if (!isUserTyping && !isFocusInModal) {
|
|
397
|
+
if (firstFocusable) {
|
|
398
|
+
firstFocusable.focus();
|
|
399
|
+
hasPerformedInitialFocusRef.current = true;
|
|
400
|
+
} else if (modalContentRef.current) {
|
|
401
|
+
modalContentRef.current.focus();
|
|
402
|
+
hasPerformedInitialFocusRef.current = true;
|
|
403
|
+
}
|
|
404
|
+
} else if (isFocusInModal) {
|
|
405
|
+
hasPerformedInitialFocusRef.current = true;
|
|
449
406
|
}
|
|
450
|
-
);
|
|
407
|
+
}, 100);
|
|
451
408
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
);
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
min,
|
|
470
|
-
max,
|
|
471
|
-
step,
|
|
472
|
-
maxLength,
|
|
473
|
-
autoComplete,
|
|
474
|
-
description,
|
|
475
|
-
footerDescription,
|
|
476
|
-
autoFocus = false,
|
|
477
|
-
onKeyDown,
|
|
478
|
-
onBlur,
|
|
479
|
-
icon,
|
|
480
|
-
rows = 3,
|
|
481
|
-
showHidePassword = false,
|
|
482
|
-
onGeneratePassword,
|
|
483
|
-
copyable = false,
|
|
484
|
-
readOnly = false,
|
|
485
|
-
clearable = true
|
|
486
|
-
}) {
|
|
487
|
-
const [showPassword, setShowPassword] = useState(false);
|
|
488
|
-
const [copied, setCopied] = useState(false);
|
|
489
|
-
const handleCopy = async () => {
|
|
490
|
-
try {
|
|
491
|
-
await navigator.clipboard.writeText(String(value));
|
|
492
|
-
setCopied(true);
|
|
493
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
494
|
-
} catch (err) {
|
|
495
|
-
console.error("Failed to copy:", err);
|
|
496
|
-
}
|
|
497
|
-
};
|
|
498
|
-
const shouldShowIcons = (inputType) => {
|
|
499
|
-
return inputType !== "checkbox" && inputType !== "textarea";
|
|
500
|
-
};
|
|
501
|
-
const getIconConfig = (iconProp) => {
|
|
502
|
-
if (!iconProp) return { left: null, right: null };
|
|
503
|
-
if (React4.isValidElement(iconProp)) {
|
|
504
|
-
return { left: iconProp, right: null };
|
|
505
|
-
}
|
|
506
|
-
if (typeof iconProp === "object" && iconProp !== null && ("left" in iconProp || "right" in iconProp)) {
|
|
507
|
-
return { left: iconProp.left || null, right: iconProp.right || null };
|
|
508
|
-
}
|
|
509
|
-
return {
|
|
510
|
-
left: React4.isValidElement(iconProp) ? iconProp : null,
|
|
511
|
-
right: null
|
|
409
|
+
const handleTab = (event) => {
|
|
410
|
+
if (event.key !== "Tab") return;
|
|
411
|
+
const focusableElements = getFocusableElements();
|
|
412
|
+
if (focusableElements.length === 0) return;
|
|
413
|
+
const firstElement = focusableElements[0];
|
|
414
|
+
const lastElement = focusableElements[focusableElements.length - 1];
|
|
415
|
+
if (event.shiftKey) {
|
|
416
|
+
if (document.activeElement === firstElement) {
|
|
417
|
+
event.preventDefault();
|
|
418
|
+
lastElement.focus();
|
|
419
|
+
}
|
|
420
|
+
} else {
|
|
421
|
+
if (document.activeElement === lastElement) {
|
|
422
|
+
event.preventDefault();
|
|
423
|
+
firstElement.focus();
|
|
424
|
+
}
|
|
425
|
+
}
|
|
512
426
|
};
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
const rightPositionClass = position === "right" && type === "number" ? "right-4 pr-3" : position === "right" ? "right-0 pr-3" : "left-0 pl-3";
|
|
517
|
-
return /* @__PURE__ */ jsx(
|
|
518
|
-
"div",
|
|
519
|
-
{
|
|
520
|
-
className: `absolute inset-y-0 ${rightPositionClass} flex items-center pointer-events-none`,
|
|
521
|
-
children: /* @__PURE__ */ jsx("div", { className: "text-muted-foreground", children: iconNode })
|
|
427
|
+
const handleEsc = (event) => {
|
|
428
|
+
if (event.key === "Escape" && !blocking) {
|
|
429
|
+
onClose();
|
|
522
430
|
}
|
|
523
|
-
|
|
431
|
+
};
|
|
432
|
+
document.addEventListener("keydown", handleTab);
|
|
433
|
+
document.addEventListener("keydown", handleEsc);
|
|
434
|
+
document.body.style.overflow = "hidden";
|
|
435
|
+
return () => {
|
|
436
|
+
if (timeoutId) {
|
|
437
|
+
clearTimeout(timeoutId);
|
|
438
|
+
}
|
|
439
|
+
document.removeEventListener("keydown", handleTab);
|
|
440
|
+
document.removeEventListener("keydown", handleEsc);
|
|
441
|
+
document.body.style.overflow = "unset";
|
|
442
|
+
if (!isOpen && previousActiveElementRef.current) {
|
|
443
|
+
previousActiveElementRef.current.focus();
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
}, [isOpen, onClose, blocking]);
|
|
447
|
+
const modalRoot = (() => {
|
|
448
|
+
if (typeof document === "undefined") return null;
|
|
449
|
+
let root = document.getElementById("modal-root");
|
|
450
|
+
if (!root) {
|
|
451
|
+
root = document.createElement("div");
|
|
452
|
+
root.id = "modal-root";
|
|
453
|
+
document.body.appendChild(root);
|
|
454
|
+
}
|
|
455
|
+
return root;
|
|
456
|
+
})();
|
|
457
|
+
if (!modalRoot) {
|
|
458
|
+
return null;
|
|
459
|
+
}
|
|
460
|
+
const backdropVariants = {
|
|
461
|
+
hidden: { opacity: 0 },
|
|
462
|
+
visible: { opacity: 1 }
|
|
524
463
|
};
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
464
|
+
const modalVariants = {
|
|
465
|
+
hidden: {
|
|
466
|
+
opacity: 0,
|
|
467
|
+
scale: 0.95,
|
|
468
|
+
y: 20
|
|
469
|
+
},
|
|
470
|
+
visible: {
|
|
471
|
+
opacity: 1,
|
|
472
|
+
scale: 1,
|
|
473
|
+
y: 0,
|
|
474
|
+
transition: {
|
|
475
|
+
duration: 0.2,
|
|
476
|
+
ease: "easeOut"
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
exit: {
|
|
480
|
+
opacity: 0,
|
|
481
|
+
scale: 0.9,
|
|
482
|
+
y: 100,
|
|
483
|
+
// Slide down much further for reverse effect
|
|
484
|
+
transition: {
|
|
485
|
+
duration: 0.3,
|
|
486
|
+
ease: "easeIn"
|
|
487
|
+
}
|
|
531
488
|
}
|
|
532
|
-
return paddingClasses2.join(" ");
|
|
533
489
|
};
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
{
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
490
|
+
if (!isOpen) return null;
|
|
491
|
+
if (variant === "plain") {
|
|
492
|
+
return createPortal(
|
|
493
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsx(
|
|
494
|
+
motion.div,
|
|
495
|
+
{
|
|
496
|
+
className: `modal-backdrop fixed inset-0 w-screen h-screen flex items-center ${customStyles.backdrop?.includes("justify-") ? customStyles.backdrop : customStyles.backdrop ? `${customStyles.backdrop} justify-center` : "justify-center bg-black/10"} z-[999999] m-0 ${fullScreen ? "p-0" : "p-4"}`,
|
|
497
|
+
variants: backdropVariants,
|
|
498
|
+
initial: "hidden",
|
|
499
|
+
animate: isOpen ? "visible" : "hidden",
|
|
500
|
+
exit: "hidden",
|
|
501
|
+
onClick: blocking ? void 0 : onClose,
|
|
502
|
+
children: /* @__PURE__ */ jsx(
|
|
503
|
+
motion.div,
|
|
504
|
+
{
|
|
505
|
+
ref: modalContentRef,
|
|
506
|
+
role: "dialog",
|
|
507
|
+
"aria-modal": "true",
|
|
508
|
+
"aria-labelledby": title ? "modal-title-plain" : void 0,
|
|
509
|
+
"aria-describedby": ariaDescribedBy || "modal-content-plain",
|
|
510
|
+
tabIndex: -1,
|
|
511
|
+
className: `w-full flex flex-col overflow-hidden relative z-[1000000] ${customStyles.container || "bg-card shadow-xl"} ${fullScreen ? "h-full rounded-none" : `rounded-lg ${className} ${sizeClasses3[size]} max-h-[90vh]`}`,
|
|
512
|
+
variants: modalVariants,
|
|
513
|
+
initial: "hidden",
|
|
514
|
+
animate: isOpen ? "visible" : "exit",
|
|
515
|
+
exit: "exit",
|
|
516
|
+
onClick: (e) => e.stopPropagation(),
|
|
517
|
+
children: /* @__PURE__ */ jsx(
|
|
518
|
+
"div",
|
|
519
|
+
{
|
|
520
|
+
id: "modal-content-plain",
|
|
521
|
+
className: `flex-1 ${customStyles.content || ""}`,
|
|
522
|
+
children
|
|
523
|
+
}
|
|
524
|
+
)
|
|
549
525
|
},
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
value: newValue,
|
|
553
|
-
checked: newValue
|
|
554
|
-
}
|
|
555
|
-
};
|
|
556
|
-
onChange(syntheticEvent);
|
|
526
|
+
"modal-content"
|
|
527
|
+
)
|
|
557
528
|
},
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
),
|
|
567
|
-
/* @__PURE__ */ jsx(
|
|
568
|
-
"button",
|
|
529
|
+
"modal-backdrop"
|
|
530
|
+
) }),
|
|
531
|
+
modalRoot
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
return createPortal(
|
|
535
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsx(
|
|
536
|
+
motion.div,
|
|
569
537
|
{
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
},
|
|
581
|
-
disabled,
|
|
582
|
-
className: `
|
|
583
|
-
relative inline-flex h-6 w-11 items-center rounded-full transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
|
|
584
|
-
${Boolean(value) ? "bg-primary" : "bg-muted"}
|
|
585
|
-
${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
586
|
-
${error ? "ring-2 ring-destructive" : ""}
|
|
587
|
-
`,
|
|
588
|
-
"aria-label": `${label}${required ? " (required)" : ""}`,
|
|
589
|
-
"aria-describedby": name,
|
|
590
|
-
children: /* @__PURE__ */ jsx(
|
|
591
|
-
"span",
|
|
538
|
+
className: `modal-backdrop fixed inset-0 w-screen h-screen bg-black/10 flex items-center ${customStyles.backdrop || "justify-center"} z-[999999] m-0 ${fullScreen ? "p-0" : "p-4"}`,
|
|
539
|
+
variants: backdropVariants,
|
|
540
|
+
initial: "hidden",
|
|
541
|
+
animate: isOpen ? "visible" : "hidden",
|
|
542
|
+
exit: "hidden",
|
|
543
|
+
onClick: blocking ? void 0 : onClose,
|
|
544
|
+
children: /* @__PURE__ */ jsxs(
|
|
545
|
+
motion.div,
|
|
592
546
|
{
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
547
|
+
ref: modalContentRef,
|
|
548
|
+
role: "dialog",
|
|
549
|
+
"aria-modal": "true",
|
|
550
|
+
"aria-labelledby": title ? "modal-title" : void 0,
|
|
551
|
+
"aria-describedby": ariaDescribedBy || "modal-content",
|
|
552
|
+
tabIndex: -1,
|
|
553
|
+
className: `bg-card border border-border shadow-xl w-full flex flex-col overflow-hidden relative z-[1000000] ${fullScreen ? "h-full rounded-none" : `rounded-lg ${customStyles.container || className || sizeClasses3[size]} max-h-[90vh]`}`,
|
|
554
|
+
variants: modalVariants,
|
|
555
|
+
initial: "hidden",
|
|
556
|
+
animate: isOpen ? "visible" : "exit",
|
|
557
|
+
exit: "exit",
|
|
558
|
+
onClick: (e) => e.stopPropagation(),
|
|
559
|
+
children: [
|
|
560
|
+
header ? /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: header }) : title ? /* @__PURE__ */ jsxs(
|
|
561
|
+
"div",
|
|
562
|
+
{
|
|
563
|
+
className: `px-6 py-4 border-b border-border flex justify-between items-center flex-shrink-0 ${customStyles.header || ""}`,
|
|
564
|
+
children: [
|
|
565
|
+
/* @__PURE__ */ jsx(
|
|
566
|
+
"h2",
|
|
567
|
+
{
|
|
568
|
+
id: "modal-title",
|
|
569
|
+
className: "text-xl font-semibold text-foreground",
|
|
570
|
+
children: title
|
|
571
|
+
}
|
|
572
|
+
),
|
|
573
|
+
/* @__PURE__ */ jsx(
|
|
574
|
+
"button",
|
|
575
|
+
{
|
|
576
|
+
onClick: onClose,
|
|
577
|
+
className: "p-2 text-muted-foreground hover:text-foreground hover:bg-muted rounded-full transition-colors",
|
|
578
|
+
title: "Close",
|
|
579
|
+
"aria-label": "Close modal",
|
|
580
|
+
disabled: blocking,
|
|
581
|
+
children: /* @__PURE__ */ jsx(RiCloseLine, { className: "w-5 h-5", "aria-hidden": "true" })
|
|
582
|
+
}
|
|
583
|
+
)
|
|
584
|
+
]
|
|
585
|
+
}
|
|
586
|
+
) : null,
|
|
587
|
+
/* @__PURE__ */ jsx(
|
|
588
|
+
"div",
|
|
589
|
+
{
|
|
590
|
+
id: "modal-content",
|
|
591
|
+
className: `bg-background text-foreground flex-1 ${scrollable ? "overflow-y-auto" : ""} ${fullScreen || noPadding ? "p-0" : "px-6 py-4"}`,
|
|
592
|
+
children
|
|
593
|
+
}
|
|
594
|
+
),
|
|
595
|
+
footer && /* @__PURE__ */ jsx(
|
|
596
|
+
"div",
|
|
597
|
+
{
|
|
598
|
+
className: `flex-shrink-0 px-6 py-4 border-t border-border ${footerBg === "white" ? "bg-card" : "bg-muted"} ${customStyles.footer || ""}`,
|
|
599
|
+
children: footer
|
|
600
|
+
}
|
|
601
|
+
)
|
|
602
|
+
]
|
|
616
603
|
},
|
|
617
|
-
|
|
618
|
-
label,
|
|
619
|
-
required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", "aria-label": "required", children: "*" })
|
|
620
|
-
]
|
|
621
|
-
}
|
|
622
|
-
),
|
|
623
|
-
description && /* @__PURE__ */ jsx(
|
|
624
|
-
"span",
|
|
625
|
-
{
|
|
626
|
-
id: `${name}-description`,
|
|
627
|
-
className: "text-xs text-muted-foreground",
|
|
628
|
-
children: description
|
|
629
|
-
}
|
|
630
|
-
)
|
|
631
|
-
] }),
|
|
632
|
-
error && /* @__PURE__ */ jsx("div", { id: `${name}-error`, className: "form-error", role: "alert", children: typeof error === "string" ? /* @__PURE__ */ jsx("p", { children: error }) : error })
|
|
633
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
634
|
-
label && /* @__PURE__ */ jsxs("label", { htmlFor: name, className: "form-label", children: [
|
|
635
|
-
label,
|
|
636
|
-
required && /* @__PURE__ */ jsx("span", { className: "form-label-required", children: "*" })
|
|
637
|
-
] }),
|
|
638
|
-
description && /* @__PURE__ */ jsx("p", { id: `${name}-description`, className: "form-description", children: description }),
|
|
639
|
-
type === "textarea" ? /* @__PURE__ */ jsx(
|
|
640
|
-
"textarea",
|
|
641
|
-
{
|
|
642
|
-
id: name,
|
|
643
|
-
name,
|
|
644
|
-
value,
|
|
645
|
-
onChange,
|
|
646
|
-
placeholder,
|
|
647
|
-
required,
|
|
648
|
-
disabled,
|
|
649
|
-
autoFocus,
|
|
650
|
-
onKeyDown,
|
|
651
|
-
onBlur,
|
|
652
|
-
rows,
|
|
653
|
-
maxLength,
|
|
654
|
-
"aria-invalid": error ? "true" : "false",
|
|
655
|
-
"aria-describedby": error ? `${name}-error` : description ? `${name}-description` : void 0,
|
|
656
|
-
className: `form-input ${error ? "form-input-error" : ""} ${inputClassName}`
|
|
657
|
-
}
|
|
658
|
-
) : type === "color" ? /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3", children: [
|
|
659
|
-
/* @__PURE__ */ jsxs("div", { className: "relative w-10 h-10 border border-input rounded-md overflow-hidden bg-card", children: [
|
|
660
|
-
/* @__PURE__ */ jsx(
|
|
661
|
-
"input",
|
|
662
|
-
{
|
|
663
|
-
id: name,
|
|
664
|
-
name,
|
|
665
|
-
type: "color",
|
|
666
|
-
value,
|
|
667
|
-
onChange,
|
|
668
|
-
required,
|
|
669
|
-
disabled,
|
|
670
|
-
className: "absolute inset-0 w-full h-full cursor-pointer opacity-0"
|
|
671
|
-
}
|
|
672
|
-
),
|
|
673
|
-
/* @__PURE__ */ jsx(
|
|
674
|
-
"div",
|
|
675
|
-
{
|
|
676
|
-
className: "w-full h-full rounded-md",
|
|
677
|
-
style: { backgroundColor: value }
|
|
678
|
-
}
|
|
604
|
+
"modal-content"
|
|
679
605
|
)
|
|
680
|
-
|
|
681
|
-
|
|
606
|
+
},
|
|
607
|
+
"modal-backdrop"
|
|
608
|
+
) }),
|
|
609
|
+
modalRoot
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
function ConfirmDialog({ isOpen, options, onConfirm, onCancel }) {
|
|
613
|
+
const { title, message, confirmText, cancelText = "Cancel", confirmButtonColor = "blue" } = options;
|
|
614
|
+
const getConfirmVariant = () => {
|
|
615
|
+
switch (confirmButtonColor) {
|
|
616
|
+
case "red":
|
|
617
|
+
return "danger";
|
|
618
|
+
case "green":
|
|
619
|
+
return "primary";
|
|
620
|
+
case "blue":
|
|
621
|
+
default:
|
|
622
|
+
return "primary";
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
return /* @__PURE__ */ jsx(Modal, { isOpen, onClose: onCancel, title, children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
626
|
+
/* @__PURE__ */ jsx("p", { className: "text-foreground", children: message }),
|
|
627
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-3 justify-end", children: [
|
|
628
|
+
/* @__PURE__ */ jsx(Button_default, { variant: "secondary", onClick: onCancel, children: cancelText }),
|
|
629
|
+
/* @__PURE__ */ jsx(Button_default, { variant: getConfirmVariant(), onClick: onConfirm, children: confirmText })
|
|
630
|
+
] })
|
|
631
|
+
] }) });
|
|
632
|
+
}
|
|
633
|
+
function useConfirmDialog() {
|
|
634
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
635
|
+
const [options, setOptions] = useState({
|
|
636
|
+
title: "",
|
|
637
|
+
message: "",
|
|
638
|
+
confirmText: "Confirm"
|
|
639
|
+
});
|
|
640
|
+
const [resolver, setResolver] = useState(null);
|
|
641
|
+
const confirm = (opts) => {
|
|
642
|
+
setOptions(opts);
|
|
643
|
+
setIsOpen(true);
|
|
644
|
+
return new Promise((resolve) => {
|
|
645
|
+
setResolver(() => resolve);
|
|
646
|
+
});
|
|
647
|
+
};
|
|
648
|
+
const handleConfirm = () => {
|
|
649
|
+
setIsOpen(false);
|
|
650
|
+
if (resolver) {
|
|
651
|
+
resolver(true);
|
|
652
|
+
setResolver(null);
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
const handleCancel = () => {
|
|
656
|
+
setIsOpen(false);
|
|
657
|
+
if (resolver) {
|
|
658
|
+
resolver(false);
|
|
659
|
+
setResolver(null);
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
const dialog = /* @__PURE__ */ jsx(
|
|
663
|
+
ConfirmDialog,
|
|
664
|
+
{
|
|
665
|
+
isOpen,
|
|
666
|
+
options,
|
|
667
|
+
onConfirm: handleConfirm,
|
|
668
|
+
onCancel: handleCancel
|
|
669
|
+
}
|
|
670
|
+
);
|
|
671
|
+
return { confirm, dialog };
|
|
672
|
+
}
|
|
673
|
+
var ConfirmDialog_default = ConfirmDialog;
|
|
674
|
+
var paddingClasses2 = {
|
|
675
|
+
none: "",
|
|
676
|
+
sm: "p-4",
|
|
677
|
+
md: "p-6",
|
|
678
|
+
lg: "p-8"
|
|
679
|
+
};
|
|
680
|
+
function Container({
|
|
681
|
+
children,
|
|
682
|
+
className = "",
|
|
683
|
+
padding = "md",
|
|
684
|
+
id
|
|
685
|
+
}) {
|
|
686
|
+
return /* @__PURE__ */ jsx("div", { id, className: `${paddingClasses2[padding]} ${className}`, children });
|
|
687
|
+
}
|
|
688
|
+
var EmptyState = ({
|
|
689
|
+
icon: Icon,
|
|
690
|
+
title,
|
|
691
|
+
subtitle,
|
|
692
|
+
action,
|
|
693
|
+
className = ""
|
|
694
|
+
}) => {
|
|
695
|
+
return /* @__PURE__ */ jsxs(
|
|
696
|
+
"div",
|
|
697
|
+
{
|
|
698
|
+
className: `text-center py-12 text-secondary-foreground p-6 lg:p-12 ${className}`,
|
|
699
|
+
role: "status",
|
|
700
|
+
"aria-live": "polite",
|
|
701
|
+
children: [
|
|
682
702
|
/* @__PURE__ */ jsx(
|
|
683
|
-
|
|
703
|
+
Icon,
|
|
684
704
|
{
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
type: "text",
|
|
688
|
-
value,
|
|
689
|
-
onChange,
|
|
690
|
-
placeholder,
|
|
691
|
-
required,
|
|
692
|
-
disabled,
|
|
693
|
-
maxLength,
|
|
694
|
-
autoComplete,
|
|
695
|
-
autoFocus,
|
|
696
|
-
onKeyDown,
|
|
697
|
-
onBlur,
|
|
698
|
-
className: `form-input max-w-24 ${error ? "form-input-error" : ""} ${getInputPaddingClasses(type, getIconConfig(icon))} ${inputClassName}`,
|
|
699
|
-
"aria-label": `${label} text input`
|
|
705
|
+
className: "w-12 h-12 mx-auto mb-3 text-muted-foreground",
|
|
706
|
+
"aria-hidden": "true"
|
|
700
707
|
}
|
|
701
708
|
),
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
709
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium mb-1", children: title }),
|
|
710
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mb-4", children: subtitle }),
|
|
711
|
+
action && /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: action })
|
|
712
|
+
]
|
|
713
|
+
}
|
|
714
|
+
);
|
|
715
|
+
};
|
|
716
|
+
var EmptyState_default = EmptyState;
|
|
717
|
+
function useKeyboardNavigation({
|
|
718
|
+
isOpen,
|
|
719
|
+
optionsLength,
|
|
720
|
+
onSelect,
|
|
721
|
+
onClose,
|
|
722
|
+
onOpen
|
|
723
|
+
}) {
|
|
724
|
+
const [focusedIndex, setFocusedIndex] = useState(-1);
|
|
725
|
+
const resetFocus = useCallback(() => {
|
|
726
|
+
setFocusedIndex(-1);
|
|
727
|
+
}, []);
|
|
728
|
+
const handleKeyDown = useCallback(
|
|
729
|
+
(e) => {
|
|
730
|
+
if (!isOpen) {
|
|
731
|
+
if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
|
|
732
|
+
e.preventDefault();
|
|
733
|
+
onOpen?.();
|
|
734
|
+
}
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
switch (e.key) {
|
|
738
|
+
case "ArrowDown":
|
|
739
|
+
e.preventDefault();
|
|
740
|
+
setFocusedIndex((prev) => prev < optionsLength - 1 ? prev + 1 : 0);
|
|
741
|
+
break;
|
|
742
|
+
case "ArrowUp":
|
|
743
|
+
e.preventDefault();
|
|
744
|
+
setFocusedIndex((prev) => prev > 0 ? prev - 1 : optionsLength - 1);
|
|
745
|
+
break;
|
|
746
|
+
case "Enter":
|
|
747
|
+
e.preventDefault();
|
|
748
|
+
if (focusedIndex >= 0 && focusedIndex < optionsLength) {
|
|
749
|
+
onSelect(focusedIndex);
|
|
750
|
+
}
|
|
751
|
+
break;
|
|
752
|
+
case "Escape":
|
|
753
|
+
e.preventDefault();
|
|
754
|
+
onClose();
|
|
755
|
+
resetFocus();
|
|
756
|
+
break;
|
|
757
|
+
case "Tab":
|
|
758
|
+
onClose();
|
|
759
|
+
resetFocus();
|
|
760
|
+
break;
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
[isOpen, optionsLength, focusedIndex, onSelect, onClose, onOpen, resetFocus]
|
|
764
|
+
);
|
|
765
|
+
return {
|
|
766
|
+
focusedIndex,
|
|
767
|
+
handleKeyDown,
|
|
768
|
+
resetFocus,
|
|
769
|
+
setFocusedIndex
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
function SmartDropdown({
|
|
773
|
+
isOpen,
|
|
774
|
+
onClose,
|
|
775
|
+
trigger,
|
|
776
|
+
children,
|
|
777
|
+
className = "",
|
|
778
|
+
width = 384,
|
|
779
|
+
maxHeight = 450,
|
|
780
|
+
offset = 8,
|
|
781
|
+
margin = 16,
|
|
782
|
+
id = "dropdown-listbox",
|
|
783
|
+
position = "auto"
|
|
784
|
+
}) {
|
|
785
|
+
const [dropdownPosition, setDropdownPosition] = useState({
|
|
786
|
+
top: 0,
|
|
787
|
+
left: 0,
|
|
788
|
+
right: void 0,
|
|
789
|
+
width: 0,
|
|
790
|
+
maxHeight: 0,
|
|
791
|
+
isAbove: false
|
|
792
|
+
});
|
|
793
|
+
const dropdownRef = useRef(null);
|
|
794
|
+
const triggerRef = useRef(null);
|
|
795
|
+
const calculateDropdownPosition = useCallback(() => {
|
|
796
|
+
if (!triggerRef.current) return;
|
|
797
|
+
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
798
|
+
const viewportWidth = window.innerWidth;
|
|
799
|
+
const viewportHeight = window.innerHeight;
|
|
800
|
+
const spaceAbove = triggerRect.top - margin;
|
|
801
|
+
const spaceBelow = viewportHeight - triggerRect.bottom - margin;
|
|
802
|
+
let calculatedWidth;
|
|
803
|
+
if (width === "fit-content") {
|
|
804
|
+
calculatedWidth = triggerRect.width;
|
|
805
|
+
} else if (width === "auto") {
|
|
806
|
+
calculatedWidth = triggerRect.width;
|
|
807
|
+
} else if (typeof width === "number") {
|
|
808
|
+
calculatedWidth = Math.min(width, viewportWidth - margin * 2);
|
|
809
|
+
} else {
|
|
810
|
+
calculatedWidth = triggerRect.width;
|
|
811
|
+
}
|
|
812
|
+
const calculatedMaxHeight = Math.min(
|
|
813
|
+
maxHeight,
|
|
814
|
+
Math.max(spaceAbove, spaceBelow)
|
|
815
|
+
);
|
|
816
|
+
let left = triggerRect.left;
|
|
817
|
+
let right = void 0;
|
|
818
|
+
if (position === "top-right" || position === "bottom-right") {
|
|
819
|
+
left = triggerRect.right - calculatedWidth;
|
|
820
|
+
} else if (position === "top-left" || position === "bottom-left") {
|
|
821
|
+
left = triggerRect.left;
|
|
822
|
+
} else if (position === "top-left-aligned" || position === "bottom-left-aligned") {
|
|
823
|
+
const availableLeftSpace = triggerRect.left - margin;
|
|
824
|
+
const dynamicOffset = Math.max(20, availableLeftSpace * 0.2);
|
|
825
|
+
right = viewportWidth - triggerRect.left + dynamicOffset;
|
|
826
|
+
left = 0;
|
|
827
|
+
calculatedWidth = Math.min(
|
|
828
|
+
calculatedWidth,
|
|
829
|
+
triggerRect.left - dynamicOffset - margin
|
|
830
|
+
);
|
|
831
|
+
} else {
|
|
832
|
+
if (left + calculatedWidth > viewportWidth - margin) {
|
|
833
|
+
left = triggerRect.right - calculatedWidth;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
if (left !== void 0 && left < margin) {
|
|
837
|
+
left = margin;
|
|
838
|
+
}
|
|
839
|
+
let top = triggerRect.bottom + offset;
|
|
840
|
+
let finalMaxHeight = calculatedMaxHeight;
|
|
841
|
+
let isAbove = false;
|
|
842
|
+
if (spaceAbove > spaceBelow && top + calculatedMaxHeight > viewportHeight - margin) {
|
|
843
|
+
isAbove = true;
|
|
844
|
+
top = triggerRect.top - calculatedMaxHeight - offset;
|
|
845
|
+
finalMaxHeight = Math.min(calculatedMaxHeight, spaceAbove);
|
|
846
|
+
if (top < margin) {
|
|
847
|
+
top = margin;
|
|
848
|
+
finalMaxHeight = triggerRect.top - margin - offset;
|
|
849
|
+
}
|
|
850
|
+
} else {
|
|
851
|
+
finalMaxHeight = Math.min(calculatedMaxHeight, spaceBelow);
|
|
852
|
+
if (top + finalMaxHeight > viewportHeight - margin) {
|
|
853
|
+
top = viewportHeight - margin - finalMaxHeight;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
if (position === "top-right") {
|
|
857
|
+
left = triggerRect.right - calculatedWidth;
|
|
858
|
+
top = triggerRect.top - offset;
|
|
859
|
+
isAbove = true;
|
|
860
|
+
finalMaxHeight = Math.min(maxHeight, spaceAbove);
|
|
861
|
+
} else if (position === "top-left") {
|
|
862
|
+
left = triggerRect.left;
|
|
863
|
+
top = triggerRect.top - offset;
|
|
864
|
+
isAbove = true;
|
|
865
|
+
finalMaxHeight = Math.min(maxHeight, spaceAbove);
|
|
866
|
+
} else if (position === "bottom-right") {
|
|
867
|
+
left = triggerRect.right - calculatedWidth;
|
|
868
|
+
top = triggerRect.bottom + offset;
|
|
869
|
+
isAbove = false;
|
|
870
|
+
finalMaxHeight = Math.min(maxHeight, spaceBelow);
|
|
871
|
+
} else if (position === "bottom-left") {
|
|
872
|
+
left = triggerRect.left;
|
|
873
|
+
top = triggerRect.bottom + offset;
|
|
874
|
+
isAbove = false;
|
|
875
|
+
finalMaxHeight = Math.min(maxHeight, spaceBelow);
|
|
876
|
+
} else if (position === "top-left-aligned") {
|
|
877
|
+
right = viewportWidth - triggerRect.right;
|
|
878
|
+
left = 0;
|
|
879
|
+
top = triggerRect.top - offset;
|
|
880
|
+
isAbove = true;
|
|
881
|
+
finalMaxHeight = Math.min(maxHeight, spaceAbove);
|
|
882
|
+
} else if (position === "bottom-left-aligned") {
|
|
883
|
+
right = viewportWidth - triggerRect.right;
|
|
884
|
+
left = 0;
|
|
885
|
+
top = triggerRect.bottom + offset;
|
|
886
|
+
isAbove = false;
|
|
887
|
+
finalMaxHeight = Math.min(maxHeight, spaceBelow);
|
|
888
|
+
}
|
|
889
|
+
setDropdownPosition({
|
|
890
|
+
top,
|
|
891
|
+
left,
|
|
892
|
+
right,
|
|
893
|
+
width: calculatedWidth,
|
|
894
|
+
maxHeight: finalMaxHeight,
|
|
895
|
+
isAbove
|
|
896
|
+
});
|
|
897
|
+
}, [width, maxHeight, margin, offset, position]);
|
|
898
|
+
useEffect(() => {
|
|
899
|
+
const handleClickOutside = (event) => {
|
|
900
|
+
const target = event.target;
|
|
901
|
+
const isInsideDropdown = dropdownRef.current?.contains(target);
|
|
902
|
+
const isInsideTrigger = triggerRef.current?.contains(target);
|
|
903
|
+
if (!isInsideDropdown && !isInsideTrigger) {
|
|
904
|
+
onClose();
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
908
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
909
|
+
}, [onClose]);
|
|
910
|
+
useEffect(() => {
|
|
911
|
+
if (isOpen) {
|
|
912
|
+
calculateDropdownPosition();
|
|
913
|
+
}
|
|
914
|
+
}, [isOpen, calculateDropdownPosition]);
|
|
915
|
+
useEffect(() => {
|
|
916
|
+
if (!isOpen) return;
|
|
917
|
+
const handleResize = () => {
|
|
918
|
+
calculateDropdownPosition();
|
|
919
|
+
};
|
|
920
|
+
const handleScroll = () => {
|
|
921
|
+
calculateDropdownPosition();
|
|
922
|
+
};
|
|
923
|
+
window.addEventListener("resize", handleResize);
|
|
924
|
+
window.addEventListener("scroll", handleScroll, true);
|
|
925
|
+
return () => {
|
|
926
|
+
window.removeEventListener("resize", handleResize);
|
|
927
|
+
window.removeEventListener("scroll", handleScroll, true);
|
|
928
|
+
};
|
|
929
|
+
}, [isOpen, calculateDropdownPosition]);
|
|
930
|
+
useEffect(() => {
|
|
931
|
+
if (!isOpen || !dropdownRef.current || !triggerRef.current) return;
|
|
932
|
+
if (dropdownPosition.isAbove) {
|
|
933
|
+
const adjustPosition = () => {
|
|
934
|
+
const dropdownRect = dropdownRef.current?.getBoundingClientRect();
|
|
935
|
+
const triggerRect = triggerRef.current?.getBoundingClientRect();
|
|
936
|
+
if (!dropdownRect || !triggerRect) return;
|
|
937
|
+
const actualHeight = dropdownRect.height;
|
|
938
|
+
const newTop = triggerRect.top - actualHeight - offset;
|
|
939
|
+
if (newTop !== dropdownPosition.top && newTop >= margin) {
|
|
940
|
+
setDropdownPosition((prev) => ({
|
|
941
|
+
...prev,
|
|
942
|
+
top: newTop
|
|
943
|
+
}));
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
947
|
+
setTimeout(adjustPosition, 0);
|
|
948
|
+
});
|
|
949
|
+
resizeObserver.observe(dropdownRef.current);
|
|
950
|
+
adjustPosition();
|
|
951
|
+
return () => {
|
|
952
|
+
resizeObserver.disconnect();
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
}, [isOpen, dropdownPosition.isAbove, dropdownPosition.top, offset, margin]);
|
|
956
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
957
|
+
/* @__PURE__ */ jsx(
|
|
958
|
+
"div",
|
|
959
|
+
{
|
|
960
|
+
ref: triggerRef,
|
|
961
|
+
className: "w-full",
|
|
962
|
+
role: "combobox",
|
|
963
|
+
"aria-expanded": isOpen,
|
|
964
|
+
"aria-haspopup": "listbox",
|
|
965
|
+
"aria-controls": "dropdown-listbox",
|
|
966
|
+
children: trigger
|
|
967
|
+
}
|
|
968
|
+
),
|
|
969
|
+
isOpen && typeof window !== "undefined" && createPortal(
|
|
711
970
|
/* @__PURE__ */ jsx(
|
|
712
|
-
"
|
|
971
|
+
"div",
|
|
713
972
|
{
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
onKeyDown,
|
|
727
|
-
onBlur,
|
|
728
|
-
"aria-invalid": error ? "true" : "false",
|
|
729
|
-
"aria-describedby": error ? `${name}-error` : description ? `${name}-description` : void 0,
|
|
730
|
-
className: `form-input ${error ? "form-input-error" : ""} ${readOnly ? "bg-muted cursor-default" : ""} ${copyable ? "pr-20" : "pr-10"} ${getInputPaddingClasses(type, getIconConfig(icon))} ${inputClassName}`
|
|
731
|
-
}
|
|
732
|
-
),
|
|
733
|
-
shouldShowIcons(type) && (() => {
|
|
734
|
-
const iconConfig = getIconConfig(icon);
|
|
735
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
736
|
-
renderIcon(iconConfig.left, "left"),
|
|
737
|
-
renderIcon(iconConfig.right, "right")
|
|
738
|
-
] });
|
|
739
|
-
})(),
|
|
740
|
-
copyable && /* @__PURE__ */ jsx(
|
|
741
|
-
"button",
|
|
742
|
-
{
|
|
743
|
-
type: "button",
|
|
744
|
-
onClick: handleCopy,
|
|
745
|
-
className: "absolute inset-y-0 right-8 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors duration-200 z-10",
|
|
746
|
-
"aria-label": `Copy ${label}`,
|
|
747
|
-
title: copied ? "Copied!" : `Copy ${label}`,
|
|
748
|
-
children: copied ? /* @__PURE__ */ jsx(RiCheckLine, { className: "w-4 h-4 text-green-500", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(RiFileCopyLine, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
749
|
-
}
|
|
750
|
-
),
|
|
751
|
-
/* @__PURE__ */ jsx(
|
|
752
|
-
"button",
|
|
753
|
-
{
|
|
754
|
-
type: "button",
|
|
755
|
-
onClick: () => setShowPassword(!showPassword),
|
|
756
|
-
className: "absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors duration-200 z-10",
|
|
757
|
-
"aria-label": showPassword ? "Hide password" : "Show password",
|
|
758
|
-
title: showPassword ? "Hide password" : "Show password",
|
|
759
|
-
children: showPassword ? /* @__PURE__ */ jsx(RiEyeOffLine, { className: "w-4 h-4", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(RiEyeLine, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
760
|
-
}
|
|
761
|
-
),
|
|
762
|
-
onGeneratePassword && !readOnly && /* @__PURE__ */ jsx(
|
|
763
|
-
"button",
|
|
764
|
-
{
|
|
765
|
-
type: "button",
|
|
766
|
-
onClick: onGeneratePassword,
|
|
767
|
-
className: `absolute inset-y-0 ${copyable ? "right-16" : "right-8"} flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors duration-200 z-10`,
|
|
768
|
-
"aria-label": "Generate new password",
|
|
769
|
-
title: "Generate new password",
|
|
770
|
-
children: /* @__PURE__ */ jsx(RiRefreshLine, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
771
|
-
}
|
|
772
|
-
)
|
|
773
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "relative group", children: [
|
|
774
|
-
/* @__PURE__ */ jsx(
|
|
775
|
-
"input",
|
|
776
|
-
{
|
|
777
|
-
id: name,
|
|
778
|
-
name,
|
|
779
|
-
type,
|
|
780
|
-
value,
|
|
781
|
-
onChange,
|
|
782
|
-
placeholder,
|
|
783
|
-
required,
|
|
784
|
-
disabled: disabled || readOnly,
|
|
785
|
-
readOnly,
|
|
786
|
-
min,
|
|
787
|
-
max,
|
|
788
|
-
step,
|
|
789
|
-
maxLength,
|
|
790
|
-
autoComplete,
|
|
791
|
-
autoFocus,
|
|
792
|
-
onKeyDown,
|
|
793
|
-
onBlur,
|
|
794
|
-
"aria-invalid": error ? "true" : "false",
|
|
795
|
-
"aria-describedby": error ? `${name}-error` : description ? `${name}-description` : void 0,
|
|
796
|
-
className: `form-input ${error ? "form-input-error" : ""} ${readOnly ? "bg-muted cursor-default" : ""} ${copyable ? "pr-10" : ""} ${getInputPaddingClasses(type, getIconConfig(icon))} ${inputClassName}`
|
|
797
|
-
}
|
|
798
|
-
),
|
|
799
|
-
shouldShowIcons(type) && (() => {
|
|
800
|
-
const iconConfig = getIconConfig(icon);
|
|
801
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
802
|
-
renderIcon(iconConfig.left, "left"),
|
|
803
|
-
renderIcon(iconConfig.right, "right")
|
|
804
|
-
] });
|
|
805
|
-
})(),
|
|
806
|
-
copyable && /* @__PURE__ */ jsx(
|
|
807
|
-
"button",
|
|
808
|
-
{
|
|
809
|
-
type: "button",
|
|
810
|
-
onClick: handleCopy,
|
|
811
|
-
className: `absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-all duration-200 z-10`,
|
|
812
|
-
"aria-label": `Copy ${label}`,
|
|
813
|
-
title: copied ? "Copied!" : `Copy ${label}`,
|
|
814
|
-
children: copied ? /* @__PURE__ */ jsx(RiCheckLine, { className: "w-4 h-4 text-green-500", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(RiFileCopyLine, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
815
|
-
}
|
|
816
|
-
),
|
|
817
|
-
clearable && !copyable && value !== "" && value !== null && value !== void 0 && !disabled && !readOnly && /* @__PURE__ */ jsx(
|
|
818
|
-
"button",
|
|
819
|
-
{
|
|
820
|
-
type: "button",
|
|
821
|
-
onClick: () => {
|
|
822
|
-
const syntheticEvent = {
|
|
823
|
-
target: { name, value: "" }
|
|
824
|
-
};
|
|
825
|
-
onChange(syntheticEvent);
|
|
973
|
+
ref: dropdownRef,
|
|
974
|
+
id,
|
|
975
|
+
"data-smart-dropdown": true,
|
|
976
|
+
role: "listbox",
|
|
977
|
+
"aria-label": "Dropdown options",
|
|
978
|
+
className: `fixed z-[1000001] card overflow-hidden`,
|
|
979
|
+
style: {
|
|
980
|
+
top: dropdownPosition.top,
|
|
981
|
+
...dropdownPosition.left !== void 0 ? { left: dropdownPosition.left } : {},
|
|
982
|
+
...dropdownPosition.right !== void 0 ? { right: dropdownPosition.right } : {},
|
|
983
|
+
width: width === "fit-content" ? "auto" : dropdownPosition.width,
|
|
984
|
+
maxHeight: dropdownPosition.maxHeight
|
|
826
985
|
},
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
children: /* @__PURE__ */ jsx(
|
|
986
|
+
onClick: (e) => {
|
|
987
|
+
e.stopPropagation();
|
|
988
|
+
},
|
|
989
|
+
children: /* @__PURE__ */ jsx(
|
|
990
|
+
"div",
|
|
991
|
+
{
|
|
992
|
+
className: className ? className : "overflow-y-auto",
|
|
993
|
+
style: { maxHeight: dropdownPosition.maxHeight },
|
|
994
|
+
children: typeof children === "function" ? children({ isAbove: dropdownPosition.isAbove }) : children
|
|
995
|
+
}
|
|
996
|
+
)
|
|
831
997
|
}
|
|
832
|
-
)
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
] }) });
|
|
998
|
+
),
|
|
999
|
+
document.body
|
|
1000
|
+
)
|
|
1001
|
+
] });
|
|
837
1002
|
}
|
|
838
|
-
function
|
|
839
|
-
|
|
1003
|
+
function SmartSelect({
|
|
1004
|
+
options,
|
|
1005
|
+
value,
|
|
840
1006
|
onChange,
|
|
841
|
-
|
|
842
|
-
label,
|
|
843
|
-
description,
|
|
1007
|
+
placeholder = "Select option...",
|
|
844
1008
|
className = "",
|
|
845
|
-
|
|
1009
|
+
description,
|
|
1010
|
+
disabled = false,
|
|
1011
|
+
multiple = false,
|
|
1012
|
+
width,
|
|
1013
|
+
searchable = false,
|
|
1014
|
+
keepOpen = false,
|
|
1015
|
+
clearable = true,
|
|
1016
|
+
// API integration props
|
|
1017
|
+
onOpen,
|
|
1018
|
+
onClose,
|
|
1019
|
+
onSearch,
|
|
1020
|
+
isLoading = false
|
|
846
1021
|
}) {
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
|
|
1022
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
1023
|
+
const [triggerWidth, setTriggerWidth] = useState(
|
|
1024
|
+
void 0
|
|
1025
|
+
);
|
|
1026
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
1027
|
+
const [displayValue, setDisplayValue] = useState("");
|
|
1028
|
+
const inputRef = useRef(null);
|
|
1029
|
+
const buttonRef = useRef(null);
|
|
1030
|
+
const selectedValues = multiple ? value || [] : [value];
|
|
1031
|
+
const selectedOptions = options.filter(
|
|
1032
|
+
(opt) => selectedValues.includes(opt.value)
|
|
1033
|
+
);
|
|
1034
|
+
const hasSelection = multiple ? selectedValues.length > 0 : value && value !== "";
|
|
1035
|
+
const filteredOptions = searchable && searchTerm.trim() ? options.filter(
|
|
1036
|
+
(option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()) || option.value.toLowerCase().includes(searchTerm.toLowerCase()) || option.description?.toLowerCase().includes(searchTerm.toLowerCase())
|
|
1037
|
+
) : options;
|
|
1038
|
+
const { focusedIndex, handleKeyDown, resetFocus } = useKeyboardNavigation({
|
|
1039
|
+
isOpen,
|
|
1040
|
+
optionsLength: filteredOptions.length,
|
|
1041
|
+
onSelect: (index) => handleSelect(filteredOptions[index].value),
|
|
1042
|
+
onClose: () => setIsOpen(false),
|
|
1043
|
+
onOpen: () => setIsOpen(true)
|
|
1044
|
+
});
|
|
1045
|
+
useEffect(() => {
|
|
1046
|
+
if (selectedOptions.length > 0) {
|
|
1047
|
+
if (multiple) {
|
|
1048
|
+
setDisplayValue(selectedOptions.map((opt) => opt.label).join(", "));
|
|
1049
|
+
} else {
|
|
1050
|
+
setDisplayValue(selectedOptions[0].label);
|
|
1051
|
+
}
|
|
1052
|
+
} else {
|
|
1053
|
+
setDisplayValue("");
|
|
1054
|
+
}
|
|
1055
|
+
}, [selectedOptions, multiple]);
|
|
1056
|
+
const handleSelect = (optionValue) => {
|
|
1057
|
+
if (multiple) {
|
|
1058
|
+
const currentValues = value || [];
|
|
1059
|
+
const newValues = currentValues.includes(optionValue) ? currentValues.filter((v) => v !== optionValue) : [...currentValues, optionValue];
|
|
1060
|
+
onChange(newValues);
|
|
1061
|
+
} else {
|
|
1062
|
+
onChange(optionValue);
|
|
1063
|
+
setSearchTerm("");
|
|
1064
|
+
setIsOpen(false);
|
|
850
1065
|
}
|
|
851
1066
|
};
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
1067
|
+
const currentTriggerRef = searchable ? inputRef : buttonRef;
|
|
1068
|
+
useEffect(() => {
|
|
1069
|
+
if (currentTriggerRef.current) {
|
|
1070
|
+
const rect = currentTriggerRef.current.getBoundingClientRect();
|
|
1071
|
+
setTriggerWidth(rect.width);
|
|
1072
|
+
}
|
|
1073
|
+
}, [isOpen, currentTriggerRef]);
|
|
1074
|
+
useEffect(() => {
|
|
1075
|
+
if (!currentTriggerRef.current) return;
|
|
1076
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
1077
|
+
if (currentTriggerRef.current) {
|
|
1078
|
+
const rect = currentTriggerRef.current.getBoundingClientRect();
|
|
1079
|
+
setTriggerWidth(rect.width);
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
resizeObserver.observe(currentTriggerRef.current);
|
|
1083
|
+
return () => {
|
|
1084
|
+
resizeObserver.disconnect();
|
|
1085
|
+
};
|
|
1086
|
+
}, [currentTriggerRef]);
|
|
1087
|
+
useEffect(() => {
|
|
1088
|
+
if (isOpen && searchable && inputRef.current) {
|
|
1089
|
+
setTimeout(() => {
|
|
1090
|
+
inputRef.current?.focus();
|
|
1091
|
+
}, 0);
|
|
1092
|
+
} else if (!isOpen) {
|
|
1093
|
+
setSearchTerm("");
|
|
1094
|
+
resetFocus();
|
|
1095
|
+
}
|
|
1096
|
+
}, [isOpen, searchable, resetFocus]);
|
|
1097
|
+
const handleOpen = () => {
|
|
1098
|
+
setIsOpen(true);
|
|
1099
|
+
onOpen?.();
|
|
856
1100
|
};
|
|
857
|
-
const
|
|
858
|
-
|
|
1101
|
+
const handleClose = () => {
|
|
1102
|
+
setIsOpen(false);
|
|
1103
|
+
onClose?.();
|
|
1104
|
+
};
|
|
1105
|
+
const handleSearchChange = (search) => {
|
|
1106
|
+
setSearchTerm(search);
|
|
1107
|
+
onSearch?.(search);
|
|
1108
|
+
};
|
|
1109
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full", "data-smart-select": true, children: [
|
|
1110
|
+
description && /* @__PURE__ */ jsx("p", { className: "form-description", children: description }),
|
|
859
1111
|
/* @__PURE__ */ jsx(
|
|
860
|
-
|
|
1112
|
+
SmartDropdown,
|
|
861
1113
|
{
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
1114
|
+
isOpen,
|
|
1115
|
+
onClose: handleClose,
|
|
1116
|
+
width: width !== void 0 ? width : triggerWidth,
|
|
1117
|
+
maxHeight: 200,
|
|
1118
|
+
trigger: searchable ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
1119
|
+
/* @__PURE__ */ jsx(
|
|
1120
|
+
"input",
|
|
1121
|
+
{
|
|
1122
|
+
ref: inputRef,
|
|
1123
|
+
type: "text",
|
|
1124
|
+
value: isOpen ? searchTerm : displayValue,
|
|
1125
|
+
onChange: (e) => {
|
|
1126
|
+
if (isOpen) {
|
|
1127
|
+
handleSearchChange(e.target.value);
|
|
1128
|
+
resetFocus();
|
|
1129
|
+
}
|
|
1130
|
+
},
|
|
1131
|
+
onFocus: () => !disabled && handleOpen(),
|
|
1132
|
+
onClick: (e) => {
|
|
1133
|
+
e.stopPropagation();
|
|
1134
|
+
!disabled && handleOpen();
|
|
1135
|
+
},
|
|
1136
|
+
onKeyDown: handleKeyDown,
|
|
1137
|
+
placeholder,
|
|
1138
|
+
disabled,
|
|
1139
|
+
role: "combobox",
|
|
1140
|
+
"aria-expanded": isOpen,
|
|
1141
|
+
"aria-haspopup": "listbox",
|
|
1142
|
+
"aria-controls": "dropdown-listbox",
|
|
1143
|
+
"aria-autocomplete": "list",
|
|
1144
|
+
"aria-activedescendant": focusedIndex >= 0 ? `option-${focusedIndex}` : void 0,
|
|
1145
|
+
className: `form-input truncate ${hasSelection ? "pr-12" : "pr-8"} ${disabled ? "opacity-50 cursor-not-allowed" : ""} ${className}`
|
|
1146
|
+
}
|
|
1147
|
+
),
|
|
1148
|
+
hasSelection && clearable && /* @__PURE__ */ jsx(
|
|
1149
|
+
"button",
|
|
1150
|
+
{
|
|
1151
|
+
type: "button",
|
|
1152
|
+
onClick: (e) => {
|
|
1153
|
+
e.stopPropagation();
|
|
1154
|
+
onChange(multiple ? [] : "");
|
|
1155
|
+
},
|
|
1156
|
+
className: "absolute right-6 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground hover:text-muted-foreground transition-colors",
|
|
1157
|
+
"aria-label": "Clear selection",
|
|
1158
|
+
title: "Clear selection",
|
|
1159
|
+
children: /* @__PURE__ */ jsx(RiCloseLine, { className: "w-4 h-4", "aria-hidden": true })
|
|
1160
|
+
}
|
|
1161
|
+
),
|
|
1162
|
+
/* @__PURE__ */ jsx(
|
|
1163
|
+
"button",
|
|
1164
|
+
{
|
|
1165
|
+
type: "button",
|
|
1166
|
+
onClick: (e) => {
|
|
1167
|
+
e.stopPropagation();
|
|
1168
|
+
!disabled && setIsOpen(!isOpen);
|
|
1169
|
+
},
|
|
1170
|
+
className: `absolute right-2 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground hover:text-muted-foreground transition-colors ${disabled ? "opacity-50 cursor-not-allowed" : ""}`,
|
|
1171
|
+
disabled,
|
|
1172
|
+
"aria-label": isOpen ? "Close dropdown" : "Open dropdown",
|
|
1173
|
+
"aria-expanded": isOpen,
|
|
1174
|
+
children: /* @__PURE__ */ jsx(
|
|
1175
|
+
DropDownArrow,
|
|
1176
|
+
{
|
|
1177
|
+
isOpen,
|
|
1178
|
+
disabled,
|
|
1179
|
+
size: "sm",
|
|
1180
|
+
color: "gray",
|
|
1181
|
+
"aria-hidden": true
|
|
1182
|
+
}
|
|
1183
|
+
)
|
|
1184
|
+
}
|
|
1185
|
+
)
|
|
1186
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "relative group", children: [
|
|
1187
|
+
/* @__PURE__ */ jsx(
|
|
1188
|
+
"button",
|
|
1189
|
+
{
|
|
1190
|
+
ref: buttonRef,
|
|
1191
|
+
type: "button",
|
|
1192
|
+
onClick: (e) => {
|
|
1193
|
+
e.stopPropagation();
|
|
1194
|
+
!disabled && (isOpen ? handleClose() : handleOpen());
|
|
1195
|
+
},
|
|
1196
|
+
onKeyDown: handleKeyDown,
|
|
1197
|
+
disabled,
|
|
1198
|
+
role: "combobox",
|
|
1199
|
+
"aria-expanded": isOpen,
|
|
1200
|
+
"aria-haspopup": "listbox",
|
|
1201
|
+
"aria-controls": "dropdown-listbox",
|
|
1202
|
+
"aria-label": placeholder,
|
|
1203
|
+
"aria-activedescendant": focusedIndex >= 0 ? `option-${focusedIndex}` : void 0,
|
|
1204
|
+
className: `form-input flex items-center justify-between text-left ${hasSelection ? "pr-12" : "pr-8"} ${disabled ? "opacity-60 cursor-not-allowed" : ""} ${className}`,
|
|
1205
|
+
children: /* @__PURE__ */ jsx(
|
|
1206
|
+
"span",
|
|
1207
|
+
{
|
|
1208
|
+
className: `flex items-center gap-2 min-w-0 flex-1 ${selectedOptions.length > 0 ? "" : "text-muted-foreground opacity-60"}`,
|
|
1209
|
+
children: multiple ? selectedOptions.length > 0 ? (() => {
|
|
1210
|
+
const displayText = selectedOptions.map((opt) => opt.label).join(", ");
|
|
1211
|
+
return /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 min-w-0 flex-1", children: [
|
|
1212
|
+
selectedOptions[0].icon && /* @__PURE__ */ jsx("span", { className: "flex-shrink-0", children: selectedOptions[0].icon }),
|
|
1213
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: displayText })
|
|
1214
|
+
] });
|
|
1215
|
+
})() : /* @__PURE__ */ jsx("span", { className: "truncate", children: placeholder }) : selectedOptions[0] ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 min-w-0 flex-1", children: [
|
|
1216
|
+
selectedOptions[0].icon && /* @__PURE__ */ jsx("span", { className: "flex-shrink-0", children: selectedOptions[0].icon }),
|
|
1217
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: selectedOptions[0].label })
|
|
1218
|
+
] }) : /* @__PURE__ */ jsx("span", { className: "truncate", children: placeholder })
|
|
1219
|
+
}
|
|
1220
|
+
)
|
|
1221
|
+
}
|
|
1222
|
+
),
|
|
1223
|
+
hasSelection && clearable && /* @__PURE__ */ jsx(
|
|
1224
|
+
"button",
|
|
1225
|
+
{
|
|
1226
|
+
type: "button",
|
|
1227
|
+
onClick: (e) => {
|
|
1228
|
+
e.stopPropagation();
|
|
1229
|
+
onChange(multiple ? [] : "");
|
|
1230
|
+
},
|
|
1231
|
+
className: "absolute right-6 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground hover:text-muted-foreground transition-all duration-200 opacity-0 group-hover:opacity-100",
|
|
1232
|
+
"aria-label": "Clear selection",
|
|
1233
|
+
title: "Clear selection",
|
|
1234
|
+
children: /* @__PURE__ */ jsx(RiCloseLine, { className: "w-4 h-4", "aria-hidden": true })
|
|
1235
|
+
}
|
|
1236
|
+
),
|
|
1237
|
+
/* @__PURE__ */ jsx(
|
|
1238
|
+
"button",
|
|
1239
|
+
{
|
|
1240
|
+
type: "button",
|
|
1241
|
+
onClick: (e) => {
|
|
1242
|
+
e.stopPropagation();
|
|
1243
|
+
!disabled && setIsOpen(!isOpen);
|
|
1244
|
+
},
|
|
1245
|
+
className: `absolute right-2 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground hover:text-muted-foreground transition-colors ${disabled ? "opacity-50 cursor-not-allowed" : ""}`,
|
|
1246
|
+
disabled,
|
|
1247
|
+
"aria-label": isOpen ? "Close dropdown" : "Open dropdown",
|
|
1248
|
+
"aria-expanded": isOpen,
|
|
1249
|
+
children: /* @__PURE__ */ jsx(
|
|
1250
|
+
DropDownArrow,
|
|
1251
|
+
{
|
|
1252
|
+
isOpen,
|
|
1253
|
+
disabled,
|
|
1254
|
+
size: "sm",
|
|
1255
|
+
color: "gray",
|
|
1256
|
+
"aria-hidden": true
|
|
1257
|
+
}
|
|
1258
|
+
)
|
|
1259
|
+
}
|
|
1260
|
+
)
|
|
1261
|
+
] }),
|
|
1262
|
+
children: /* @__PURE__ */ jsx("div", { className: "py-2", children: filteredOptions.length > 0 ? filteredOptions.map((option, index) => /* @__PURE__ */ jsxs(
|
|
1263
|
+
"button",
|
|
876
1264
|
{
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
1265
|
+
id: `option-${index}`,
|
|
1266
|
+
type: "button",
|
|
1267
|
+
role: "option",
|
|
1268
|
+
"aria-selected": selectedValues.includes(option.value),
|
|
1269
|
+
onMouseDown: (e) => {
|
|
1270
|
+
e.preventDefault();
|
|
1271
|
+
e.stopPropagation();
|
|
1272
|
+
handleSelect(option.value);
|
|
1273
|
+
},
|
|
1274
|
+
className: `w-full px-3 py-2 text-left text-sm hover:bg-accent flex items-center justify-between min-h-[40px] transition-colors ${selectedValues.includes(option.value) ? "bg-accent border-l-2 border-l-ring" : index === focusedIndex ? "bg-muted ring-2 ring-ring" : ""}`,
|
|
1275
|
+
children: [
|
|
1276
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 min-w-0 flex-1", children: [
|
|
1277
|
+
option.icon && /* @__PURE__ */ jsx("span", { className: "flex-shrink-0", children: option.icon }),
|
|
1278
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1279
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1280
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium text-foreground truncate", children: option.label }),
|
|
1281
|
+
option.metadata?.isDefault && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium success-badge flex-shrink-0", children: "Default" })
|
|
1282
|
+
] }),
|
|
1283
|
+
option.description && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground truncate", children: option.description }),
|
|
1284
|
+
option.metadata?.args && option.metadata.args.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-1", children: [
|
|
1285
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-secondary-foreground mb-1", children: "Arguments:" }),
|
|
1286
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
|
|
1287
|
+
option.metadata.args.slice(0, 3).map((arg, argIndex) => /* @__PURE__ */ jsx(
|
|
1288
|
+
"span",
|
|
1289
|
+
{
|
|
1290
|
+
className: "inline-flex items-center px-1.5 py-0.5 rounded text-xs font-mono bg-muted text-muted-foreground",
|
|
1291
|
+
children: arg
|
|
1292
|
+
},
|
|
1293
|
+
argIndex
|
|
1294
|
+
)),
|
|
1295
|
+
option.metadata.args.length > 3 && /* @__PURE__ */ jsxs("span", { className: "text-xs text-secondary-foreground", children: [
|
|
1296
|
+
"+",
|
|
1297
|
+
option.metadata.args.length - 3,
|
|
1298
|
+
" more"
|
|
1299
|
+
] })
|
|
1300
|
+
] })
|
|
1301
|
+
] })
|
|
1302
|
+
] })
|
|
1303
|
+
] }),
|
|
1304
|
+
multiple ? /* @__PURE__ */ jsx(
|
|
1305
|
+
"input",
|
|
1306
|
+
{
|
|
1307
|
+
type: "checkbox",
|
|
1308
|
+
checked: selectedValues.includes(option.value),
|
|
1309
|
+
onChange: () => {
|
|
1310
|
+
},
|
|
1311
|
+
className: "w-4 h-4 text-primary bg-muted border-border rounded focus:ring-primary focus:ring-2"
|
|
1312
|
+
}
|
|
1313
|
+
) : selectedValues.includes(option.value) && /* @__PURE__ */ jsx(RiCheckLine, { className: "w-4 h-4 text-primary flex-shrink-0" })
|
|
1314
|
+
]
|
|
1315
|
+
},
|
|
1316
|
+
option.value
|
|
1317
|
+
)) : /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-sm text-secondary-foreground flex items-center gap-2", children: isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1318
|
+
/* @__PURE__ */ jsx(RiLoader4Line, { className: "w-4 h-4 animate-spin" }),
|
|
1319
|
+
/* @__PURE__ */ jsx("span", { children: "Loading..." })
|
|
1320
|
+
] }) : searchTerm.trim() ? /* @__PURE__ */ jsx("span", { children: "No results found" }) : /* @__PURE__ */ jsx("span", { children: "No options available" }) }) })
|
|
886
1321
|
}
|
|
887
|
-
)
|
|
888
|
-
(label || description) && /* @__PURE__ */ jsxs("div", { className: "ml-3 text-sm leading-6", children: [
|
|
889
|
-
label && /* @__PURE__ */ jsx("label", { className: "font-medium text-foreground cursor-pointer", onClick: toggle, children: label }),
|
|
890
|
-
description && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: description })
|
|
891
|
-
] })
|
|
1322
|
+
)
|
|
892
1323
|
] });
|
|
893
1324
|
}
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
xl: "max-w-6xl",
|
|
899
|
-
full: "max-w-full mx-4"
|
|
900
|
-
};
|
|
901
|
-
function Modal({
|
|
902
|
-
isOpen,
|
|
903
|
-
onClose,
|
|
904
|
-
children,
|
|
905
|
-
title,
|
|
906
|
-
header,
|
|
907
|
-
blocking = false,
|
|
908
|
-
size = "md",
|
|
1325
|
+
function Skeleton({ className = "", children }) {
|
|
1326
|
+
return /* @__PURE__ */ jsx("div", { className: `animate-pulse ${className}`, children });
|
|
1327
|
+
}
|
|
1328
|
+
function SkeletonItem({
|
|
909
1329
|
className = "",
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
variant = "default",
|
|
915
|
-
scrollable = true,
|
|
916
|
-
"aria-describedby": ariaDescribedBy,
|
|
917
|
-
customStyles = {}
|
|
1330
|
+
width = "w-full",
|
|
1331
|
+
height = "h-4",
|
|
1332
|
+
rounded = true,
|
|
1333
|
+
animate = true
|
|
918
1334
|
}) {
|
|
919
|
-
const
|
|
920
|
-
const
|
|
921
|
-
const
|
|
922
|
-
const
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
"textarea:not([disabled])",
|
|
930
|
-
'[tabindex]:not([tabindex="-1"])'
|
|
931
|
-
].join(", ");
|
|
932
|
-
return Array.from(
|
|
933
|
-
modalContentRef.current.querySelectorAll(focusableSelectors)
|
|
934
|
-
);
|
|
935
|
-
};
|
|
936
|
-
useEffect(() => {
|
|
937
|
-
if (!isOpen) {
|
|
938
|
-
hasPerformedInitialFocusRef.current = false;
|
|
939
|
-
return;
|
|
1335
|
+
const isArbitraryHeight = height.includes("[") && height.includes("]");
|
|
1336
|
+
const baseClasses = isArbitraryHeight ? `bg-muted ${width}` : `${height} bg-muted ${width}`;
|
|
1337
|
+
const roundedClasses = rounded ? "rounded" : "";
|
|
1338
|
+
const animateClasses = animate ? "animate-pulse" : "";
|
|
1339
|
+
const style = isArbitraryHeight ? { height: height.replace("h-[", "").replace("]", "") } : {};
|
|
1340
|
+
return /* @__PURE__ */ jsx(
|
|
1341
|
+
"div",
|
|
1342
|
+
{
|
|
1343
|
+
className: `${baseClasses} ${roundedClasses} ${animateClasses} ${className}`,
|
|
1344
|
+
style
|
|
940
1345
|
}
|
|
941
|
-
|
|
942
|
-
|
|
1346
|
+
);
|
|
1347
|
+
}
|
|
1348
|
+
function SkeletonCard({ className = "", children }) {
|
|
1349
|
+
return /* @__PURE__ */ jsx("div", { className: `card card-padding ${className}`, children });
|
|
1350
|
+
}
|
|
1351
|
+
function SkeletonTable({
|
|
1352
|
+
rows = 5,
|
|
1353
|
+
columns = 4,
|
|
1354
|
+
className = "",
|
|
1355
|
+
showHeader = true
|
|
1356
|
+
}) {
|
|
1357
|
+
return /* @__PURE__ */ jsx("div", { className: `card overflow-hidden ${className}`, children: /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "w-full divide-y divide-border", children: [
|
|
1358
|
+
showHeader && /* @__PURE__ */ jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ jsx("tr", { children: Array.from({ length: columns }).map((_, i) => /* @__PURE__ */ jsx("th", { className: "px-6 py-3 text-left", children: /* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-4" }) }, i)) }) }),
|
|
1359
|
+
/* @__PURE__ */ jsx("tbody", { className: "table-body-card", children: Array.from({ length: rows }).map((_, rowIndex) => /* @__PURE__ */ jsx("tr", { children: Array.from({ length: columns }).map((_2, colIndex) => /* @__PURE__ */ jsx("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1360
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-full", height: "h-4" }),
|
|
1361
|
+
colIndex === 0 && /* @__PURE__ */ jsx(SkeletonItem, { width: "w-3/4", height: "h-3" })
|
|
1362
|
+
] }) }, colIndex)) }, rowIndex)) })
|
|
1363
|
+
] }) }) });
|
|
1364
|
+
}
|
|
1365
|
+
function SkeletonList({
|
|
1366
|
+
items = 5,
|
|
1367
|
+
className = "",
|
|
1368
|
+
itemHeight = "h-20"
|
|
1369
|
+
}) {
|
|
1370
|
+
return /* @__PURE__ */ jsx("div", { className: `space-y-4 ${className}`, children: Array.from({ length: items }).map((_, i) => /* @__PURE__ */ jsx("div", { className: "card card-padding-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
1371
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-12", height: "h-12", rounded: true }),
|
|
1372
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
|
|
1373
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-1/3", height: "h-4" }),
|
|
1374
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-1/2", height: "h-3" })
|
|
1375
|
+
] }),
|
|
1376
|
+
/* @__PURE__ */ jsxs("div", { className: "flex space-x-2", children: [
|
|
1377
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-8" }),
|
|
1378
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-8" })
|
|
1379
|
+
] })
|
|
1380
|
+
] }) }, i)) });
|
|
1381
|
+
}
|
|
1382
|
+
function SkeletonSearchCard({ className = "" }) {
|
|
1383
|
+
return /* @__PURE__ */ jsx(SkeletonCard, { className, children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
1384
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row md:items-center md:justify-between gap-4", children: [
|
|
1385
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1386
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-48", height: "h-6" }),
|
|
1387
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-32", height: "h-4" })
|
|
1388
|
+
] }),
|
|
1389
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsx(SkeletonItem, { width: "w-32", height: "h-10" }) })
|
|
1390
|
+
] }),
|
|
1391
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row gap-3", children: [
|
|
1392
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-full", height: "h-10" }),
|
|
1393
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-32", height: "h-10" }),
|
|
1394
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-32", height: "h-10" }),
|
|
1395
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-10", height: "h-10" })
|
|
1396
|
+
] })
|
|
1397
|
+
] }) });
|
|
1398
|
+
}
|
|
1399
|
+
function SkeletonGameServerCard({
|
|
1400
|
+
className = ""
|
|
1401
|
+
}) {
|
|
1402
|
+
return /* @__PURE__ */ jsxs(
|
|
1403
|
+
"div",
|
|
1404
|
+
{
|
|
1405
|
+
className: `card overflow-hidden h-[380px] flex flex-col ${className}`,
|
|
1406
|
+
children: [
|
|
1407
|
+
/* @__PURE__ */ jsx("div", { className: "relative px-5 py-4 border-b border-border bg-muted overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex items-center space-x-3 relative z-10", children: /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1408
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-32", height: "h-6", className: "mb-2" }),
|
|
1409
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-1", children: [
|
|
1410
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-4", height: "h-4", rounded: true }),
|
|
1411
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-4" })
|
|
1412
|
+
] })
|
|
1413
|
+
] }) }) }),
|
|
1414
|
+
/* @__PURE__ */ jsxs("div", { className: "relative px-4 py-3 pt-0 flex-grow", children: [
|
|
1415
|
+
/* @__PURE__ */ jsx("div", { className: "relative p-2", children: /* @__PURE__ */ jsxs("div", { className: "grid gap-3 grid-cols-3", children: [
|
|
1416
|
+
/* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
1417
|
+
/* @__PURE__ */ jsx("div", { className: "mx-auto mb-1 w-16 h-16 rounded-full border-4 border-border animate-pulse" }),
|
|
1418
|
+
/* @__PURE__ */ jsx(
|
|
1419
|
+
SkeletonItem,
|
|
1420
|
+
{
|
|
1421
|
+
width: "w-12",
|
|
1422
|
+
height: "h-3",
|
|
1423
|
+
className: "mx-auto mb-1"
|
|
1424
|
+
}
|
|
1425
|
+
),
|
|
1426
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3", className: "mx-auto" })
|
|
1427
|
+
] }),
|
|
1428
|
+
/* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
1429
|
+
/* @__PURE__ */ jsx("div", { className: "mx-auto mb-1 w-16 h-16 rounded-full border-4 border-border animate-pulse" }),
|
|
1430
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3", className: "mx-auto mb-1" }),
|
|
1431
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-6", height: "h-3", className: "mx-auto" })
|
|
1432
|
+
] }),
|
|
1433
|
+
/* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
1434
|
+
/* @__PURE__ */ jsx("div", { className: "mx-auto mb-1 w-16 h-16 rounded-full border-4 border-border animate-pulse" }),
|
|
1435
|
+
/* @__PURE__ */ jsx(
|
|
1436
|
+
SkeletonItem,
|
|
1437
|
+
{
|
|
1438
|
+
width: "w-12",
|
|
1439
|
+
height: "h-3",
|
|
1440
|
+
className: "mx-auto mb-1"
|
|
1441
|
+
}
|
|
1442
|
+
),
|
|
1443
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3", className: "mx-auto" })
|
|
1444
|
+
] })
|
|
1445
|
+
] }) }),
|
|
1446
|
+
/* @__PURE__ */ jsxs("div", { className: "border-t border-border pt-4 space-y-1", children: [
|
|
1447
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1448
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-3" }),
|
|
1449
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-3" })
|
|
1450
|
+
] }),
|
|
1451
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1452
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-12", height: "h-3" }),
|
|
1453
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-3" })
|
|
1454
|
+
] }),
|
|
1455
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1456
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3" }),
|
|
1457
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-3" })
|
|
1458
|
+
] }),
|
|
1459
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1460
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3" }),
|
|
1461
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-3" })
|
|
1462
|
+
] }),
|
|
1463
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1464
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3" }),
|
|
1465
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-3" })
|
|
1466
|
+
] })
|
|
1467
|
+
] })
|
|
1468
|
+
] }),
|
|
1469
|
+
/* @__PURE__ */ jsx("div", { className: "px-4 py-3 bg-card border-t border-border", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1470
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
1471
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1472
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1473
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true })
|
|
1474
|
+
] }) }),
|
|
1475
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
1476
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1477
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1478
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true })
|
|
1479
|
+
] })
|
|
1480
|
+
] }) })
|
|
1481
|
+
]
|
|
943
1482
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1483
|
+
);
|
|
1484
|
+
}
|
|
1485
|
+
function SkeletonGameCard({ className = "" }) {
|
|
1486
|
+
return /* @__PURE__ */ jsx("div", { className: `card card-padding-sm ${className}`, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
1487
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-12", height: "h-12", rounded: true }),
|
|
1488
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
|
|
1489
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-40", height: "h-4" }),
|
|
1490
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-64", height: "h-3" })
|
|
1491
|
+
] }),
|
|
1492
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
1493
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-6", rounded: true }),
|
|
1494
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-6", rounded: true })
|
|
1495
|
+
] })
|
|
1496
|
+
] }) });
|
|
1497
|
+
}
|
|
1498
|
+
function SkeletonUserCard({ className = "" }) {
|
|
1499
|
+
return /* @__PURE__ */ jsx("div", { className: `card card-padding-sm ${className}`, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
1500
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-12", height: "h-12", rounded: true }),
|
|
1501
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
|
|
1502
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-32", height: "h-4" }),
|
|
1503
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-40", height: "h-3" })
|
|
1504
|
+
] }),
|
|
1505
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
1506
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-6", rounded: true }),
|
|
1507
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-6", rounded: true })
|
|
1508
|
+
] })
|
|
1509
|
+
] }) });
|
|
1510
|
+
}
|
|
1511
|
+
function SkeletonNodeCard({ className = "" }) {
|
|
1512
|
+
return /* @__PURE__ */ jsxs("div", { className: `card overflow-hidden min-h-[320px] ${className}`, children: [
|
|
1513
|
+
/* @__PURE__ */ jsx("div", { className: "px-4 py-3 border-b border-border bg-muted", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1514
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3", children: [
|
|
1515
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8" }),
|
|
1516
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1517
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-32", height: "h-5", className: "mb-1" }),
|
|
1518
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-4", className: "mb-1" }),
|
|
1519
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-3" })
|
|
1520
|
+
] })
|
|
1521
|
+
] }),
|
|
1522
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-6", rounded: true })
|
|
1523
|
+
] }) }),
|
|
1524
|
+
/* @__PURE__ */ jsxs("div", { className: "px-4 py-3", children: [
|
|
1525
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-4 mb-4", children: [
|
|
1526
|
+
/* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
1527
|
+
/* @__PURE__ */ jsx(
|
|
1528
|
+
SkeletonItem,
|
|
1529
|
+
{
|
|
1530
|
+
width: "w-16",
|
|
1531
|
+
height: "h-16",
|
|
1532
|
+
rounded: true,
|
|
1533
|
+
className: "mx-auto mb-1"
|
|
1534
|
+
}
|
|
1535
|
+
),
|
|
1536
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3", className: "mx-auto mb-1" }),
|
|
1537
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-6", height: "h-3", className: "mx-auto" })
|
|
1538
|
+
] }),
|
|
1539
|
+
/* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
1540
|
+
/* @__PURE__ */ jsx(
|
|
1541
|
+
SkeletonItem,
|
|
1542
|
+
{
|
|
1543
|
+
width: "w-16",
|
|
1544
|
+
height: "h-16",
|
|
1545
|
+
rounded: true,
|
|
1546
|
+
className: "mx-auto mb-1"
|
|
1547
|
+
}
|
|
1548
|
+
),
|
|
1549
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3", className: "mx-auto mb-1" }),
|
|
1550
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-6", height: "h-3", className: "mx-auto" })
|
|
1551
|
+
] }),
|
|
1552
|
+
/* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
1553
|
+
/* @__PURE__ */ jsx(
|
|
1554
|
+
SkeletonItem,
|
|
1555
|
+
{
|
|
1556
|
+
width: "w-16",
|
|
1557
|
+
height: "h-16",
|
|
1558
|
+
rounded: true,
|
|
1559
|
+
className: "mx-auto mb-1"
|
|
1560
|
+
}
|
|
1561
|
+
),
|
|
1562
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-12", height: "h-3", className: "mx-auto mb-1" }),
|
|
1563
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3", className: "mx-auto" })
|
|
1564
|
+
] })
|
|
1565
|
+
] }),
|
|
1566
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-muted rounded-lg p-3 mb-4", children: [
|
|
1567
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-2", children: [
|
|
1568
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-4" }),
|
|
1569
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-4" })
|
|
1570
|
+
] }),
|
|
1571
|
+
/* @__PURE__ */ jsx(
|
|
1572
|
+
SkeletonItem,
|
|
1573
|
+
{
|
|
1574
|
+
width: "w-full",
|
|
1575
|
+
height: "h-2",
|
|
1576
|
+
rounded: true,
|
|
1577
|
+
className: "mb-1"
|
|
960
1578
|
}
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1579
|
+
),
|
|
1580
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-32", height: "h-3" })
|
|
1581
|
+
] }),
|
|
1582
|
+
/* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground mb-3", children: [
|
|
1583
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between mb-1", children: [
|
|
1584
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-12", height: "h-3" }),
|
|
1585
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-3" })
|
|
1586
|
+
] }),
|
|
1587
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1588
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-3" }),
|
|
1589
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-3" })
|
|
1590
|
+
] })
|
|
1591
|
+
] }),
|
|
1592
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-end items-center pt-3 border-t border-border", children: /* @__PURE__ */ jsxs("div", { className: "flex space-x-2", children: [
|
|
1593
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-8", rounded: true }),
|
|
1594
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1595
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true })
|
|
1596
|
+
] }) })
|
|
1597
|
+
] })
|
|
1598
|
+
] });
|
|
1599
|
+
}
|
|
1600
|
+
function SkeletonTenantCard({ className = "" }) {
|
|
1601
|
+
return /* @__PURE__ */ jsx("div", { className: `card card-padding-sm ${className}`, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
1602
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-12", height: "h-12", rounded: true }),
|
|
1603
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
|
|
1604
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-40", height: "h-4" }),
|
|
1605
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-56", height: "h-3" })
|
|
1606
|
+
] }),
|
|
1607
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
1608
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-28", height: "h-6", rounded: true }),
|
|
1609
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-6", rounded: true })
|
|
1610
|
+
] })
|
|
1611
|
+
] }) });
|
|
1612
|
+
}
|
|
1613
|
+
function SkeletonStats({ className = "" }) {
|
|
1614
|
+
return /* @__PURE__ */ jsx(
|
|
1615
|
+
"div",
|
|
1616
|
+
{
|
|
1617
|
+
className: `grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 ${className}`,
|
|
1618
|
+
children: Array.from({ length: 4 }).map((_, i) => /* @__PURE__ */ jsx("div", { className: "card card-padding", children: /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1619
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-4" }),
|
|
1620
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-8" }),
|
|
1621
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-32", height: "h-3" })
|
|
1622
|
+
] }) }, i))
|
|
965
1623
|
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
if (typeof document === "undefined") return null;
|
|
1006
|
-
let root = document.getElementById("modal-root");
|
|
1007
|
-
if (!root) {
|
|
1008
|
-
root = document.createElement("div");
|
|
1009
|
-
root.id = "modal-root";
|
|
1010
|
-
document.body.appendChild(root);
|
|
1624
|
+
);
|
|
1625
|
+
}
|
|
1626
|
+
function SkeletonRecentActivity({
|
|
1627
|
+
items = 5,
|
|
1628
|
+
className = ""
|
|
1629
|
+
}) {
|
|
1630
|
+
return /* @__PURE__ */ jsx("div", { className: `space-y-4 ${className}`, children: Array.from({ length: items }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3", children: [
|
|
1631
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1632
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
|
|
1633
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-full", height: "h-4" }),
|
|
1634
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-1/2", height: "h-3" })
|
|
1635
|
+
] }),
|
|
1636
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-4" })
|
|
1637
|
+
] }, i)) });
|
|
1638
|
+
}
|
|
1639
|
+
function SkeletonForm({
|
|
1640
|
+
fields = 4,
|
|
1641
|
+
className = ""
|
|
1642
|
+
}) {
|
|
1643
|
+
return /* @__PURE__ */ jsx(SkeletonCard, { className, children: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
1644
|
+
Array.from({ length: fields }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1645
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-4" }),
|
|
1646
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-full", height: "h-10" })
|
|
1647
|
+
] }, i)),
|
|
1648
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-end space-x-3 pt-4", children: [
|
|
1649
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-10" }),
|
|
1650
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-10" })
|
|
1651
|
+
] })
|
|
1652
|
+
] }) });
|
|
1653
|
+
}
|
|
1654
|
+
function SkeletonGameServerCards({
|
|
1655
|
+
items = 4,
|
|
1656
|
+
className = ""
|
|
1657
|
+
}) {
|
|
1658
|
+
return /* @__PURE__ */ jsx(
|
|
1659
|
+
"div",
|
|
1660
|
+
{
|
|
1661
|
+
className: `grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-6 ${className}`,
|
|
1662
|
+
children: Array.from({ length: items }).map((_, i) => /* @__PURE__ */ jsx(SkeletonGameServerCard, {}, i))
|
|
1011
1663
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
opacity: 0,
|
|
1024
|
-
scale: 0.95,
|
|
1025
|
-
y: 20
|
|
1026
|
-
},
|
|
1027
|
-
visible: {
|
|
1028
|
-
opacity: 1,
|
|
1029
|
-
scale: 1,
|
|
1030
|
-
y: 0,
|
|
1031
|
-
transition: {
|
|
1032
|
-
duration: 0.2,
|
|
1033
|
-
ease: "easeOut"
|
|
1034
|
-
}
|
|
1035
|
-
},
|
|
1036
|
-
exit: {
|
|
1037
|
-
opacity: 0,
|
|
1038
|
-
scale: 0.9,
|
|
1039
|
-
y: 100,
|
|
1040
|
-
// Slide down much further for reverse effect
|
|
1041
|
-
transition: {
|
|
1042
|
-
duration: 0.3,
|
|
1043
|
-
ease: "easeIn"
|
|
1044
|
-
}
|
|
1664
|
+
);
|
|
1665
|
+
}
|
|
1666
|
+
function SkeletonNodeCards({
|
|
1667
|
+
items = 3,
|
|
1668
|
+
className = ""
|
|
1669
|
+
}) {
|
|
1670
|
+
return /* @__PURE__ */ jsx(
|
|
1671
|
+
"div",
|
|
1672
|
+
{
|
|
1673
|
+
className: `grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-6 ${className}`,
|
|
1674
|
+
children: Array.from({ length: items }).map((_, i) => /* @__PURE__ */ jsx(SkeletonNodeCard, {}, i))
|
|
1045
1675
|
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
{
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
"
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
children: [
|
|
1117
|
-
|
|
1118
|
-
|
|
1676
|
+
);
|
|
1677
|
+
}
|
|
1678
|
+
function SkeletonNodeTable({
|
|
1679
|
+
items = 3,
|
|
1680
|
+
className = ""
|
|
1681
|
+
}) {
|
|
1682
|
+
return /* @__PURE__ */ jsx("div", { className: `space-y-4 ${className}`, children: Array.from({ length: items }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "card overflow-hidden", children: [
|
|
1683
|
+
/* @__PURE__ */ jsx("div", { className: "px-6 py-4 border-b border-border bg-muted", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1684
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
1685
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8" }),
|
|
1686
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1687
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-32", height: "h-5", className: "mb-1" }),
|
|
1688
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-28", height: "h-4", className: "mb-1" }),
|
|
1689
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-3" })
|
|
1690
|
+
] })
|
|
1691
|
+
] }),
|
|
1692
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
1693
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
1694
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-6", height: "h-6", className: "mr-2" }),
|
|
1695
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-4" })
|
|
1696
|
+
] }),
|
|
1697
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-6", rounded: true })
|
|
1698
|
+
] })
|
|
1699
|
+
] }) }),
|
|
1700
|
+
/* @__PURE__ */ jsxs("div", { className: "px-6 py-4", children: [
|
|
1701
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-4 gap-6", children: [
|
|
1702
|
+
/* @__PURE__ */ jsxs("div", { className: "lg:col-span-2", children: [
|
|
1703
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-4", className: "mb-3" }),
|
|
1704
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-start space-x-6", children: Array.from({ length: 3 }).map((_2, chartIndex) => /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
1705
|
+
/* @__PURE__ */ jsx(
|
|
1706
|
+
SkeletonItem,
|
|
1707
|
+
{
|
|
1708
|
+
width: "w-14",
|
|
1709
|
+
height: "h-14",
|
|
1710
|
+
rounded: true,
|
|
1711
|
+
className: "mx-auto mb-1"
|
|
1712
|
+
}
|
|
1713
|
+
),
|
|
1714
|
+
/* @__PURE__ */ jsx(
|
|
1715
|
+
SkeletonItem,
|
|
1716
|
+
{
|
|
1717
|
+
width: "w-8",
|
|
1718
|
+
height: "h-3",
|
|
1719
|
+
className: "mx-auto mb-1"
|
|
1720
|
+
}
|
|
1721
|
+
),
|
|
1722
|
+
/* @__PURE__ */ jsx(
|
|
1723
|
+
SkeletonItem,
|
|
1724
|
+
{
|
|
1725
|
+
width: "w-10",
|
|
1726
|
+
height: "h-3",
|
|
1727
|
+
className: "mx-auto"
|
|
1728
|
+
}
|
|
1729
|
+
)
|
|
1730
|
+
] }, chartIndex)) })
|
|
1731
|
+
] }),
|
|
1732
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1733
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-4", className: "mb-3" }),
|
|
1734
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1735
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-12", height: "h-5" }),
|
|
1736
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-3" })
|
|
1737
|
+
] })
|
|
1738
|
+
] }),
|
|
1739
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1740
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-4", className: "mb-3" }),
|
|
1741
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1742
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1743
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-12", height: "h-3" }),
|
|
1744
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-3" })
|
|
1745
|
+
] }),
|
|
1746
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1747
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-3" }),
|
|
1748
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-3" })
|
|
1749
|
+
] })
|
|
1750
|
+
] })
|
|
1751
|
+
] })
|
|
1752
|
+
] }),
|
|
1753
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-end items-center pt-4 border-t border-border mt-4", children: /* @__PURE__ */ jsxs("div", { className: "flex space-x-2", children: [
|
|
1754
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-8", rounded: true }),
|
|
1755
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1756
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true })
|
|
1757
|
+
] }) })
|
|
1758
|
+
] })
|
|
1759
|
+
] }, i)) });
|
|
1760
|
+
}
|
|
1761
|
+
function SkeletonGameServerTable({
|
|
1762
|
+
items = 3,
|
|
1763
|
+
className = ""
|
|
1764
|
+
}) {
|
|
1765
|
+
return /* @__PURE__ */ jsx("div", { className: `space-y-4 ${className}`, children: Array.from({ length: items }).map((_, i) => /* @__PURE__ */ jsxs(
|
|
1766
|
+
"div",
|
|
1767
|
+
{
|
|
1768
|
+
className: "card overflow-hidden min-h-[200px] flex flex-col",
|
|
1769
|
+
children: [
|
|
1770
|
+
/* @__PURE__ */ jsx("div", { className: "relative px-5 py-4 border-b border-border bg-muted overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex items-center space-x-3 relative z-10", children: /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1771
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-32", height: "h-6", className: "mb-2" }),
|
|
1772
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-1", children: [
|
|
1773
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-4", height: "h-4", rounded: true }),
|
|
1774
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-4" })
|
|
1775
|
+
] })
|
|
1776
|
+
] }) }) }),
|
|
1777
|
+
/* @__PURE__ */ jsx("div", { className: "relative px-4 py-3 pt-0 flex-grow", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row items-start md:items-center gap-4 md:gap-8", children: [
|
|
1778
|
+
/* @__PURE__ */ jsx("div", { className: "flex-shrink-0 w-full md:w-auto", children: /* @__PURE__ */ jsxs("div", { className: "grid gap-2 grid-cols-3", children: [
|
|
1779
|
+
/* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
1780
|
+
/* @__PURE__ */ jsx("div", { className: "mx-auto mb-1 w-16 h-16 rounded-full border-4 border-border animate-pulse" }),
|
|
1781
|
+
/* @__PURE__ */ jsx(
|
|
1782
|
+
SkeletonItem,
|
|
1119
1783
|
{
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
"h2",
|
|
1124
|
-
{
|
|
1125
|
-
id: "modal-title",
|
|
1126
|
-
className: "text-xl font-semibold text-foreground",
|
|
1127
|
-
children: title
|
|
1128
|
-
}
|
|
1129
|
-
),
|
|
1130
|
-
/* @__PURE__ */ jsx(
|
|
1131
|
-
"button",
|
|
1132
|
-
{
|
|
1133
|
-
onClick: onClose,
|
|
1134
|
-
className: "p-2 text-muted-foreground hover:text-foreground hover:bg-muted rounded-full transition-colors",
|
|
1135
|
-
title: "Close",
|
|
1136
|
-
"aria-label": "Close modal",
|
|
1137
|
-
disabled: blocking,
|
|
1138
|
-
children: /* @__PURE__ */ jsx(RiCloseLine, { className: "w-5 h-5", "aria-hidden": "true" })
|
|
1139
|
-
}
|
|
1140
|
-
)
|
|
1141
|
-
]
|
|
1784
|
+
width: "w-12",
|
|
1785
|
+
height: "h-3",
|
|
1786
|
+
className: "mx-auto mb-1"
|
|
1142
1787
|
}
|
|
1143
|
-
)
|
|
1788
|
+
),
|
|
1144
1789
|
/* @__PURE__ */ jsx(
|
|
1145
|
-
|
|
1790
|
+
SkeletonItem,
|
|
1146
1791
|
{
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1792
|
+
width: "w-8",
|
|
1793
|
+
height: "h-3",
|
|
1794
|
+
className: "mx-auto"
|
|
1795
|
+
}
|
|
1796
|
+
)
|
|
1797
|
+
] }),
|
|
1798
|
+
/* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
1799
|
+
/* @__PURE__ */ jsx("div", { className: "mx-auto mb-1 w-16 h-16 rounded-full border-4 border-border animate-pulse" }),
|
|
1800
|
+
/* @__PURE__ */ jsx(
|
|
1801
|
+
SkeletonItem,
|
|
1802
|
+
{
|
|
1803
|
+
width: "w-8",
|
|
1804
|
+
height: "h-3",
|
|
1805
|
+
className: "mx-auto mb-1"
|
|
1150
1806
|
}
|
|
1151
1807
|
),
|
|
1152
|
-
|
|
1153
|
-
|
|
1808
|
+
/* @__PURE__ */ jsx(
|
|
1809
|
+
SkeletonItem,
|
|
1154
1810
|
{
|
|
1155
|
-
|
|
1156
|
-
|
|
1811
|
+
width: "w-6",
|
|
1812
|
+
height: "h-3",
|
|
1813
|
+
className: "mx-auto"
|
|
1157
1814
|
}
|
|
1158
1815
|
)
|
|
1159
|
-
]
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1816
|
+
] }),
|
|
1817
|
+
/* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
1818
|
+
/* @__PURE__ */ jsx("div", { className: "mx-auto mb-1 w-16 h-16 rounded-full border-4 border-border animate-pulse" }),
|
|
1819
|
+
/* @__PURE__ */ jsx(
|
|
1820
|
+
SkeletonItem,
|
|
1821
|
+
{
|
|
1822
|
+
width: "w-12",
|
|
1823
|
+
height: "h-3",
|
|
1824
|
+
className: "mx-auto mb-1"
|
|
1825
|
+
}
|
|
1826
|
+
),
|
|
1827
|
+
/* @__PURE__ */ jsx(
|
|
1828
|
+
SkeletonItem,
|
|
1829
|
+
{
|
|
1830
|
+
width: "w-8",
|
|
1831
|
+
height: "h-3",
|
|
1832
|
+
className: "mx-auto"
|
|
1833
|
+
}
|
|
1834
|
+
)
|
|
1835
|
+
] })
|
|
1836
|
+
] }) }),
|
|
1837
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm text-muted-foreground flex-1 w-full grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-1", children: [
|
|
1838
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1839
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-3" }),
|
|
1840
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-3" })
|
|
1841
|
+
] }),
|
|
1842
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1843
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-12", height: "h-3" }),
|
|
1844
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-3" })
|
|
1845
|
+
] }),
|
|
1846
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1847
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3" }),
|
|
1848
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-3" })
|
|
1849
|
+
] }),
|
|
1850
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1851
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3" }),
|
|
1852
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-3" })
|
|
1853
|
+
] }),
|
|
1854
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1855
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3" }),
|
|
1856
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-3" })
|
|
1857
|
+
] }),
|
|
1858
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
1859
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3" }),
|
|
1860
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-3" })
|
|
1861
|
+
] })
|
|
1862
|
+
] })
|
|
1863
|
+
] }) }),
|
|
1864
|
+
/* @__PURE__ */ jsx("div", { className: "px-4 py-3 bg-card border-t border-border", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1865
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
1866
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1867
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1868
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true })
|
|
1869
|
+
] }) }),
|
|
1870
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
1871
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1872
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1873
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true })
|
|
1874
|
+
] })
|
|
1875
|
+
] }) })
|
|
1876
|
+
]
|
|
1877
|
+
},
|
|
1878
|
+
i
|
|
1879
|
+
)) });
|
|
1880
|
+
}
|
|
1881
|
+
function SkeletonGamesTable({
|
|
1882
|
+
items = 3,
|
|
1883
|
+
className = ""
|
|
1884
|
+
}) {
|
|
1885
|
+
return /* @__PURE__ */ jsx(
|
|
1886
|
+
"div",
|
|
1887
|
+
{
|
|
1888
|
+
className: `overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg ${className}`,
|
|
1889
|
+
children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-gray-300", children: [
|
|
1890
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
1891
|
+
/* @__PURE__ */ jsx("th", { className: "px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider", children: "Game" }),
|
|
1892
|
+
/* @__PURE__ */ jsx("th", { className: "px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider", children: "Type" }),
|
|
1893
|
+
/* @__PURE__ */ jsx("th", { className: "px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider", children: "Port" }),
|
|
1894
|
+
/* @__PURE__ */ jsx("th", { className: "px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider", children: "Mode" }),
|
|
1895
|
+
/* @__PURE__ */ jsx("th", { className: "px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider", children: "Status" }),
|
|
1896
|
+
/* @__PURE__ */ jsx("th", { className: "px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider", children: "Created" }),
|
|
1897
|
+
/* @__PURE__ */ jsx("th", { className: "px-2 py-1 rounded-md bg-muted backdrop-blur-sm text-center text-xs font-medium text-muted-foreground uppercase tracking-wider sticky right-0", children: "Actions" })
|
|
1898
|
+
] }) }),
|
|
1899
|
+
/* @__PURE__ */ jsx("tbody", { className: "table-body-card", children: Array.from({ length: items }).map((_, i) => /* @__PURE__ */ jsxs("tr", { className: "hover:bg-muted", children: [
|
|
1900
|
+
/* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
1901
|
+
/* @__PURE__ */ jsx("div", { className: "flex-shrink-0 h-10 w-10", children: /* @__PURE__ */ jsx(SkeletonItem, { width: "w-10", height: "h-10", rounded: true }) }),
|
|
1902
|
+
/* @__PURE__ */ jsxs("div", { className: "ml-4 min-w-0 flex-1", children: [
|
|
1903
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-32", height: "h-4", className: "mb-1" }),
|
|
1904
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-48", height: "h-3" })
|
|
1905
|
+
] })
|
|
1906
|
+
] }) }),
|
|
1907
|
+
/* @__PURE__ */ jsxs("td", { className: "px-6 py-4 whitespace-nowrap", children: [
|
|
1908
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-4", className: "mb-1" }),
|
|
1909
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-3" })
|
|
1910
|
+
] }),
|
|
1911
|
+
/* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
1912
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-6", rounded: true }),
|
|
1913
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-3" })
|
|
1914
|
+
] }) }),
|
|
1915
|
+
/* @__PURE__ */ jsxs("td", { className: "px-6 py-4 whitespace-nowrap", children: [
|
|
1916
|
+
/* @__PURE__ */ jsx(
|
|
1917
|
+
SkeletonItem,
|
|
1918
|
+
{
|
|
1919
|
+
width: "w-16",
|
|
1920
|
+
height: "h-6",
|
|
1921
|
+
rounded: true,
|
|
1922
|
+
className: "mb-1"
|
|
1923
|
+
}
|
|
1924
|
+
),
|
|
1925
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-3" })
|
|
1926
|
+
] }),
|
|
1927
|
+
/* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-6", rounded: true }) }),
|
|
1928
|
+
/* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-muted-foreground", children: /* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-4" }) }),
|
|
1929
|
+
/* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap text-right text-sm font-medium sticky right-0 bg-card", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end space-x-1", children: [
|
|
1930
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1931
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1932
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1933
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true })
|
|
1934
|
+
] }) })
|
|
1935
|
+
] }, i)) })
|
|
1936
|
+
] })
|
|
1937
|
+
}
|
|
1167
1938
|
);
|
|
1168
1939
|
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
className
|
|
1172
|
-
|
|
1173
|
-
}) => {
|
|
1174
|
-
|
|
1940
|
+
function SkeletonEnvironmentsList({
|
|
1941
|
+
items = 3,
|
|
1942
|
+
className = ""
|
|
1943
|
+
}) {
|
|
1944
|
+
return /* @__PURE__ */ jsx("div", { className: `space-y-4 ${className}`, children: Array.from({ length: items }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "card p-3", children: [
|
|
1945
|
+
/* @__PURE__ */ jsx("div", { className: "p-4 border-b border-border", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1946
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3 w-full", children: [
|
|
1947
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-5", height: "h-5" }),
|
|
1948
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between w-full pr-6 md:pr-12", children: [
|
|
1949
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
1950
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
1951
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-5" }),
|
|
1952
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-16", height: "h-5", rounded: true })
|
|
1953
|
+
] }),
|
|
1954
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-48", height: "h-3" })
|
|
1955
|
+
] }),
|
|
1956
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx(SkeletonItem, { width: "w-20", height: "h-3" }) })
|
|
1957
|
+
] })
|
|
1958
|
+
] }),
|
|
1959
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }) })
|
|
1960
|
+
] }) }),
|
|
1961
|
+
/* @__PURE__ */ jsx("div", { className: "p-6", children: Array.from({ length: 2 + i % 3 }).map((_2, varIndex) => /* @__PURE__ */ jsx("div", { className: "mb-4 last:mb-0", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4 items-center", children: [
|
|
1962
|
+
/* @__PURE__ */ jsxs("div", { className: "col-span-5", children: [
|
|
1963
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-32", height: "h-4", className: "mb-1" }),
|
|
1964
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-48", height: "h-3" })
|
|
1965
|
+
] }),
|
|
1966
|
+
/* @__PURE__ */ jsxs("div", { className: "col-span-5 flex items-center space-x-2", children: [
|
|
1967
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }),
|
|
1968
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-4" })
|
|
1969
|
+
] }),
|
|
1970
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-2 flex justify-end", children: /* @__PURE__ */ jsx(SkeletonItem, { width: "w-8", height: "h-8", rounded: true }) })
|
|
1971
|
+
] }) }, varIndex)) })
|
|
1972
|
+
] }, i)) });
|
|
1973
|
+
}
|
|
1974
|
+
function FormInput({
|
|
1975
|
+
label,
|
|
1976
|
+
name,
|
|
1977
|
+
type = "text",
|
|
1978
|
+
value,
|
|
1979
|
+
onChange,
|
|
1980
|
+
placeholder,
|
|
1981
|
+
required = false,
|
|
1982
|
+
disabled = false,
|
|
1983
|
+
error,
|
|
1984
|
+
className = "",
|
|
1985
|
+
inputClassName = "",
|
|
1986
|
+
min,
|
|
1987
|
+
max,
|
|
1988
|
+
step,
|
|
1989
|
+
maxLength,
|
|
1990
|
+
autoComplete,
|
|
1991
|
+
description,
|
|
1992
|
+
footerDescription,
|
|
1993
|
+
autoFocus = false,
|
|
1994
|
+
onKeyDown,
|
|
1995
|
+
onBlur,
|
|
1996
|
+
icon,
|
|
1997
|
+
options = [],
|
|
1998
|
+
multiSelect = false,
|
|
1999
|
+
selectWidth,
|
|
2000
|
+
searchable = false,
|
|
2001
|
+
clearable = true,
|
|
2002
|
+
rows = 3,
|
|
2003
|
+
showHidePassword = false,
|
|
2004
|
+
onGeneratePassword,
|
|
2005
|
+
isLoading = false,
|
|
2006
|
+
copyable = false,
|
|
2007
|
+
readOnly = false
|
|
2008
|
+
}) {
|
|
2009
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
2010
|
+
const [copied, setCopied] = useState(false);
|
|
2011
|
+
const handleCopy = async () => {
|
|
2012
|
+
try {
|
|
2013
|
+
await navigator.clipboard.writeText(String(value));
|
|
2014
|
+
setCopied(true);
|
|
2015
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
2016
|
+
} catch (err) {
|
|
2017
|
+
console.error("Failed to copy:", err);
|
|
2018
|
+
}
|
|
2019
|
+
};
|
|
2020
|
+
const shouldShowIcons = (inputType) => {
|
|
2021
|
+
return inputType !== "checkbox" && inputType !== "textarea";
|
|
2022
|
+
};
|
|
2023
|
+
const getIconConfig = (iconProp) => {
|
|
2024
|
+
if (!iconProp) return { left: null, right: null };
|
|
2025
|
+
if (React4.isValidElement(iconProp)) {
|
|
2026
|
+
return { left: iconProp, right: null };
|
|
2027
|
+
}
|
|
2028
|
+
if (typeof iconProp === "object" && iconProp !== null && ("left" in iconProp || "right" in iconProp)) {
|
|
2029
|
+
return { left: iconProp.left || null, right: iconProp.right || null };
|
|
2030
|
+
}
|
|
2031
|
+
return {
|
|
2032
|
+
left: React4.isValidElement(iconProp) ? iconProp : null,
|
|
2033
|
+
right: null
|
|
2034
|
+
};
|
|
2035
|
+
};
|
|
2036
|
+
const renderIcon = (iconNode, position) => {
|
|
2037
|
+
if (!iconNode) return null;
|
|
2038
|
+
const rightPositionClass = position === "right" && type === "number" ? "right-4 pr-3" : position === "right" ? "right-0 pr-3" : "left-0 pl-3";
|
|
2039
|
+
return /* @__PURE__ */ jsx(
|
|
2040
|
+
"div",
|
|
2041
|
+
{
|
|
2042
|
+
className: `absolute inset-y-0 ${rightPositionClass} flex items-center pointer-events-none`,
|
|
2043
|
+
children: /* @__PURE__ */ jsx("div", { className: "text-muted-foreground", children: iconNode })
|
|
2044
|
+
}
|
|
2045
|
+
);
|
|
2046
|
+
};
|
|
2047
|
+
const getInputPaddingClasses = (inputType, iconConfig) => {
|
|
2048
|
+
if (!shouldShowIcons(inputType)) return "";
|
|
2049
|
+
const paddingClasses3 = [];
|
|
2050
|
+
if (iconConfig.left) paddingClasses3.push("pl-10");
|
|
2051
|
+
if (iconConfig.right) {
|
|
2052
|
+
paddingClasses3.push(inputType === "number" ? "pr-12" : "pr-10");
|
|
2053
|
+
}
|
|
2054
|
+
return paddingClasses3.join(" ");
|
|
2055
|
+
};
|
|
2056
|
+
const SkeletonInput = () => {
|
|
2057
|
+
const iconConfig = getIconConfig(icon);
|
|
2058
|
+
const hasLeftIcon = iconConfig.left;
|
|
2059
|
+
const hasRightIcon = iconConfig.right;
|
|
2060
|
+
if (type === "checkbox") {
|
|
2061
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center p-2 space-x-3 h-full", children: [
|
|
2062
|
+
/* @__PURE__ */ jsx("div", { className: "relative inline-flex h-6 w-11 items-center rounded-full bg-muted", children: /* @__PURE__ */ jsx("span", { className: "inline-block h-4 w-4 transform rounded-full bg-white border border-border translate-x-1" }) }),
|
|
2063
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
2064
|
+
/* @__PURE__ */ jsxs("label", { className: "form-label", children: [
|
|
2065
|
+
label,
|
|
2066
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
2067
|
+
] }),
|
|
2068
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description })
|
|
2069
|
+
] })
|
|
2070
|
+
] });
|
|
2071
|
+
}
|
|
2072
|
+
if (type === "textarea") {
|
|
2073
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2074
|
+
/* @__PURE__ */ jsxs("label", { className: "form-label", children: [
|
|
2075
|
+
label,
|
|
2076
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-1", children: "*" })
|
|
2077
|
+
] }),
|
|
2078
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-sm text-secondary-foreground", children: description }),
|
|
2079
|
+
/* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(
|
|
2080
|
+
SkeletonItem,
|
|
2081
|
+
{
|
|
2082
|
+
width: "w-full",
|
|
2083
|
+
height: "h-24",
|
|
2084
|
+
className: `rounded-md`
|
|
2085
|
+
}
|
|
2086
|
+
) }),
|
|
2087
|
+
footerDescription && /* @__PURE__ */ jsx("p", { className: "text-sm text-secondary-foreground", children: footerDescription })
|
|
2088
|
+
] });
|
|
2089
|
+
}
|
|
2090
|
+
if (type === "color") {
|
|
2091
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2092
|
+
/* @__PURE__ */ jsxs("label", { className: "form-label", children: [
|
|
2093
|
+
label,
|
|
2094
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-1", children: "*" })
|
|
2095
|
+
] }),
|
|
2096
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-sm text-secondary-foreground", children: description }),
|
|
2097
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3", children: [
|
|
2098
|
+
/* @__PURE__ */ jsx(SkeletonItem, { width: "w-10", height: "h-10", className: "rounded-md" }),
|
|
2099
|
+
/* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(SkeletonItem, { width: "w-24", height: "h-10", className: "rounded-md" }) })
|
|
2100
|
+
] })
|
|
2101
|
+
] });
|
|
2102
|
+
}
|
|
2103
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
2104
|
+
/* @__PURE__ */ jsxs("label", { className: "form-label", children: [
|
|
2105
|
+
label,
|
|
2106
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-1", children: "*" })
|
|
2107
|
+
] }),
|
|
2108
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-sm text-secondary-foreground", children: description }),
|
|
2109
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2110
|
+
/* @__PURE__ */ jsx(
|
|
2111
|
+
SkeletonItem,
|
|
2112
|
+
{
|
|
2113
|
+
width: "w-full",
|
|
2114
|
+
height: "h-10",
|
|
2115
|
+
className: `rounded-md ${hasLeftIcon ? "pl-10" : ""} ${hasRightIcon ? "pr-10" : ""}`
|
|
2116
|
+
}
|
|
2117
|
+
),
|
|
2118
|
+
hasLeftIcon && /* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center", children: /* @__PURE__ */ jsx(SkeletonItem, { width: "w-5", height: "h-5", className: "rounded-full" }) }),
|
|
2119
|
+
hasRightIcon && /* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center", children: /* @__PURE__ */ jsx(SkeletonItem, { width: "w-5", height: "h-5", className: "rounded-full" }) })
|
|
2120
|
+
] }),
|
|
2121
|
+
footerDescription && /* @__PURE__ */ jsx("p", { className: "text-sm text-secondary-foreground", children: footerDescription })
|
|
2122
|
+
] });
|
|
2123
|
+
};
|
|
2124
|
+
return /* @__PURE__ */ jsx("div", { className: `form-group ${className}`, children: isLoading ? /* @__PURE__ */ jsx(SkeletonInput, {}) : type === "checkbox" ? /* @__PURE__ */ jsxs("div", { className: "flex items-center p-2 space-x-3 h-full", children: [
|
|
2125
|
+
/* @__PURE__ */ jsx(
|
|
2126
|
+
"input",
|
|
2127
|
+
{
|
|
2128
|
+
id: name,
|
|
2129
|
+
name,
|
|
2130
|
+
type: "checkbox",
|
|
2131
|
+
checked: Boolean(value),
|
|
2132
|
+
onChange: (e) => {
|
|
2133
|
+
const newValue = e.target.checked;
|
|
2134
|
+
const syntheticEvent = {
|
|
2135
|
+
target: {
|
|
2136
|
+
name: e.target.name,
|
|
2137
|
+
value: newValue,
|
|
2138
|
+
checked: newValue
|
|
2139
|
+
},
|
|
2140
|
+
currentTarget: {
|
|
2141
|
+
name: e.target.name,
|
|
2142
|
+
value: newValue,
|
|
2143
|
+
checked: newValue
|
|
2144
|
+
}
|
|
2145
|
+
};
|
|
2146
|
+
onChange(syntheticEvent);
|
|
2147
|
+
},
|
|
2148
|
+
required,
|
|
2149
|
+
disabled,
|
|
2150
|
+
onKeyDown,
|
|
2151
|
+
className: "sr-only",
|
|
2152
|
+
"aria-label": label,
|
|
2153
|
+
"aria-describedby": error ? `${name}-error` : description ? `${name}-description` : void 0,
|
|
2154
|
+
"aria-invalid": error ? "true" : "false"
|
|
2155
|
+
}
|
|
2156
|
+
),
|
|
2157
|
+
/* @__PURE__ */ jsx(
|
|
2158
|
+
"button",
|
|
2159
|
+
{
|
|
2160
|
+
type: "button",
|
|
2161
|
+
onClick: () => {
|
|
2162
|
+
if (!disabled) {
|
|
2163
|
+
const checkbox = document.getElementById(
|
|
2164
|
+
name
|
|
2165
|
+
);
|
|
2166
|
+
if (checkbox) {
|
|
2167
|
+
checkbox.click();
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
},
|
|
2171
|
+
disabled,
|
|
2172
|
+
className: `
|
|
2173
|
+
relative inline-flex h-6 w-11 items-center rounded-full transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
|
|
2174
|
+
${Boolean(value) ? "bg-primary" : "bg-muted"}
|
|
2175
|
+
${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
2176
|
+
${error ? "ring-2 ring-destructive" : ""}
|
|
2177
|
+
`,
|
|
2178
|
+
"aria-label": `${label}${required ? " (required)" : ""}`,
|
|
2179
|
+
"aria-describedby": name,
|
|
2180
|
+
children: /* @__PURE__ */ jsx(
|
|
2181
|
+
"span",
|
|
2182
|
+
{
|
|
2183
|
+
className: `
|
|
2184
|
+
inline-block h-4 w-4 transform rounded-full bg-background border border-border transition duration-200 ease-in-out
|
|
2185
|
+
${Boolean(value) ? "translate-x-6" : "translate-x-1"}
|
|
2186
|
+
`
|
|
2187
|
+
}
|
|
2188
|
+
)
|
|
2189
|
+
}
|
|
2190
|
+
),
|
|
2191
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
2192
|
+
/* @__PURE__ */ jsxs(
|
|
2193
|
+
"label",
|
|
2194
|
+
{
|
|
2195
|
+
htmlFor: name,
|
|
2196
|
+
className: "text-sm font-medium text-foreground cursor-pointer",
|
|
2197
|
+
onClick: () => {
|
|
2198
|
+
if (!disabled) {
|
|
2199
|
+
const checkbox = document.getElementById(
|
|
2200
|
+
name
|
|
2201
|
+
);
|
|
2202
|
+
if (checkbox) {
|
|
2203
|
+
checkbox.click();
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
},
|
|
2207
|
+
children: [
|
|
2208
|
+
label,
|
|
2209
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", "aria-label": "required", children: "*" })
|
|
2210
|
+
]
|
|
2211
|
+
}
|
|
2212
|
+
),
|
|
2213
|
+
description && /* @__PURE__ */ jsx(
|
|
2214
|
+
"span",
|
|
2215
|
+
{
|
|
2216
|
+
id: `${name}-description`,
|
|
2217
|
+
className: "text-xs text-muted-foreground",
|
|
2218
|
+
children: description
|
|
2219
|
+
}
|
|
2220
|
+
)
|
|
2221
|
+
] }),
|
|
2222
|
+
error && /* @__PURE__ */ jsx("div", { id: `${name}-error`, className: "form-error", role: "alert", children: typeof error === "string" ? /* @__PURE__ */ jsx("p", { children: error }) : error })
|
|
2223
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2224
|
+
label && /* @__PURE__ */ jsxs("label", { htmlFor: name, className: "form-label", children: [
|
|
2225
|
+
label,
|
|
2226
|
+
required && /* @__PURE__ */ jsx("span", { className: "form-label-required", children: "*" })
|
|
2227
|
+
] }),
|
|
2228
|
+
description && /* @__PURE__ */ jsx("p", { id: `${name}-description`, className: "form-description", children: description }),
|
|
2229
|
+
type === "select" ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2230
|
+
/* @__PURE__ */ jsx(
|
|
2231
|
+
SmartSelect,
|
|
2232
|
+
{
|
|
2233
|
+
value: multiSelect ? Array.isArray(value) ? value : value ? String(value).split(",") : [] : String(value),
|
|
2234
|
+
onChange: multiSelect ? (selectedValue) => {
|
|
2235
|
+
const syntheticEvent = {
|
|
2236
|
+
target: {
|
|
2237
|
+
name,
|
|
2238
|
+
value: Array.isArray(selectedValue) ? selectedValue.join(",") : selectedValue
|
|
2239
|
+
}
|
|
2240
|
+
};
|
|
2241
|
+
onChange(syntheticEvent);
|
|
2242
|
+
} : (selectedValue) => {
|
|
2243
|
+
const syntheticEvent = {
|
|
2244
|
+
target: {
|
|
2245
|
+
name,
|
|
2246
|
+
value: selectedValue
|
|
2247
|
+
}
|
|
2248
|
+
};
|
|
2249
|
+
onChange(syntheticEvent);
|
|
2250
|
+
},
|
|
2251
|
+
options,
|
|
2252
|
+
placeholder: placeholder || "Select an option...",
|
|
2253
|
+
className: `form-input ${error ? "form-input-error" : ""} ${disabled ? "opacity-50 cursor-not-allowed" : ""} ${getInputPaddingClasses(type, getIconConfig(icon))} ${inputClassName}`,
|
|
2254
|
+
multiple: multiSelect,
|
|
2255
|
+
width: selectWidth,
|
|
2256
|
+
searchable,
|
|
2257
|
+
clearable
|
|
2258
|
+
}
|
|
2259
|
+
),
|
|
2260
|
+
shouldShowIcons(type) && (() => {
|
|
2261
|
+
const iconConfig = getIconConfig(icon);
|
|
2262
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2263
|
+
renderIcon(iconConfig.left, "left"),
|
|
2264
|
+
renderIcon(iconConfig.right, "right")
|
|
2265
|
+
] });
|
|
2266
|
+
})()
|
|
2267
|
+
] }) : type === "textarea" ? /* @__PURE__ */ jsx(
|
|
2268
|
+
"textarea",
|
|
2269
|
+
{
|
|
2270
|
+
id: name,
|
|
2271
|
+
name,
|
|
2272
|
+
value,
|
|
2273
|
+
onChange,
|
|
2274
|
+
placeholder,
|
|
2275
|
+
required,
|
|
2276
|
+
disabled,
|
|
2277
|
+
autoFocus,
|
|
2278
|
+
onKeyDown,
|
|
2279
|
+
onBlur,
|
|
2280
|
+
rows,
|
|
2281
|
+
maxLength,
|
|
2282
|
+
"aria-invalid": error ? "true" : "false",
|
|
2283
|
+
"aria-describedby": error ? `${name}-error` : description ? `${name}-description` : void 0,
|
|
2284
|
+
className: `form-input ${error ? "form-input-error" : ""} ${inputClassName}`
|
|
2285
|
+
}
|
|
2286
|
+
) : type === "color" ? /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3", children: [
|
|
2287
|
+
/* @__PURE__ */ jsxs("div", { className: "relative w-10 h-10 border border-input rounded-md overflow-hidden bg-card", children: [
|
|
2288
|
+
/* @__PURE__ */ jsx(
|
|
2289
|
+
"input",
|
|
2290
|
+
{
|
|
2291
|
+
id: name,
|
|
2292
|
+
name,
|
|
2293
|
+
type: "color",
|
|
2294
|
+
value,
|
|
2295
|
+
onChange,
|
|
2296
|
+
required,
|
|
2297
|
+
disabled,
|
|
2298
|
+
className: "absolute inset-0 w-full h-full cursor-pointer opacity-0"
|
|
2299
|
+
}
|
|
2300
|
+
),
|
|
2301
|
+
/* @__PURE__ */ jsx(
|
|
2302
|
+
"div",
|
|
2303
|
+
{
|
|
2304
|
+
className: "w-full h-full rounded-md",
|
|
2305
|
+
style: { backgroundColor: value }
|
|
2306
|
+
}
|
|
2307
|
+
)
|
|
2308
|
+
] }),
|
|
2309
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2310
|
+
/* @__PURE__ */ jsx(
|
|
2311
|
+
"input",
|
|
2312
|
+
{
|
|
2313
|
+
id: `${name}-text`,
|
|
2314
|
+
name: `${name}-text`,
|
|
2315
|
+
type: "text",
|
|
2316
|
+
value,
|
|
2317
|
+
onChange,
|
|
2318
|
+
placeholder,
|
|
2319
|
+
required,
|
|
2320
|
+
disabled,
|
|
2321
|
+
maxLength,
|
|
2322
|
+
autoComplete,
|
|
2323
|
+
autoFocus,
|
|
2324
|
+
onKeyDown,
|
|
2325
|
+
onBlur,
|
|
2326
|
+
className: `form-input max-w-24 ${error ? "form-input-error" : ""} ${getInputPaddingClasses(type, getIconConfig(icon))} ${inputClassName}`,
|
|
2327
|
+
"aria-label": `${label} text input`
|
|
2328
|
+
}
|
|
2329
|
+
),
|
|
2330
|
+
shouldShowIcons(type) && (() => {
|
|
2331
|
+
const iconConfig = getIconConfig(icon);
|
|
2332
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2333
|
+
renderIcon(iconConfig.left, "left"),
|
|
2334
|
+
renderIcon(iconConfig.right, "right")
|
|
2335
|
+
] });
|
|
2336
|
+
})()
|
|
2337
|
+
] })
|
|
2338
|
+
] }) : showHidePassword && type === "password" ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2339
|
+
/* @__PURE__ */ jsx(
|
|
2340
|
+
"input",
|
|
2341
|
+
{
|
|
2342
|
+
id: name,
|
|
2343
|
+
name,
|
|
2344
|
+
type: showPassword ? "text" : "password",
|
|
2345
|
+
value,
|
|
2346
|
+
onChange,
|
|
2347
|
+
placeholder,
|
|
2348
|
+
required,
|
|
2349
|
+
disabled: disabled || readOnly,
|
|
2350
|
+
readOnly,
|
|
2351
|
+
maxLength,
|
|
2352
|
+
autoComplete,
|
|
2353
|
+
autoFocus,
|
|
2354
|
+
onKeyDown,
|
|
2355
|
+
onBlur,
|
|
2356
|
+
"aria-invalid": error ? "true" : "false",
|
|
2357
|
+
"aria-describedby": error ? `${name}-error` : description ? `${name}-description` : void 0,
|
|
2358
|
+
className: `form-input ${error ? "form-input-error" : ""} ${readOnly ? "bg-muted cursor-default" : ""} ${copyable ? "pr-20" : "pr-10"} ${getInputPaddingClasses(type, getIconConfig(icon))} ${inputClassName}`
|
|
2359
|
+
}
|
|
2360
|
+
),
|
|
2361
|
+
shouldShowIcons(type) && (() => {
|
|
2362
|
+
const iconConfig = getIconConfig(icon);
|
|
2363
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2364
|
+
renderIcon(iconConfig.left, "left"),
|
|
2365
|
+
renderIcon(iconConfig.right, "right")
|
|
2366
|
+
] });
|
|
2367
|
+
})(),
|
|
2368
|
+
copyable && /* @__PURE__ */ jsx(
|
|
2369
|
+
"button",
|
|
2370
|
+
{
|
|
2371
|
+
type: "button",
|
|
2372
|
+
onClick: handleCopy,
|
|
2373
|
+
className: "absolute inset-y-0 right-8 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors duration-200 z-10",
|
|
2374
|
+
"aria-label": `Copy ${label}`,
|
|
2375
|
+
title: copied ? "Copied!" : `Copy ${label}`,
|
|
2376
|
+
children: copied ? /* @__PURE__ */ jsx(RiCheckLine, { className: "w-4 h-4 text-green-500", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(RiFileCopyLine, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
2377
|
+
}
|
|
2378
|
+
),
|
|
2379
|
+
/* @__PURE__ */ jsx(
|
|
2380
|
+
"button",
|
|
2381
|
+
{
|
|
2382
|
+
type: "button",
|
|
2383
|
+
onClick: () => setShowPassword(!showPassword),
|
|
2384
|
+
className: "absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors duration-200 z-10",
|
|
2385
|
+
"aria-label": showPassword ? "Hide password" : "Show password",
|
|
2386
|
+
title: showPassword ? "Hide password" : "Show password",
|
|
2387
|
+
children: showPassword ? /* @__PURE__ */ jsx(RiEyeOffLine, { className: "w-4 h-4", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(RiEyeLine, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
2388
|
+
}
|
|
2389
|
+
),
|
|
2390
|
+
onGeneratePassword && !readOnly && /* @__PURE__ */ jsx(
|
|
2391
|
+
"button",
|
|
2392
|
+
{
|
|
2393
|
+
type: "button",
|
|
2394
|
+
onClick: onGeneratePassword,
|
|
2395
|
+
className: `absolute inset-y-0 ${copyable ? "right-16" : "right-8"} flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors duration-200 z-10`,
|
|
2396
|
+
"aria-label": "Generate new password",
|
|
2397
|
+
title: "Generate new password",
|
|
2398
|
+
children: /* @__PURE__ */ jsx(RiRefreshLine, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
2399
|
+
}
|
|
2400
|
+
)
|
|
2401
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "relative group", children: [
|
|
2402
|
+
/* @__PURE__ */ jsx(
|
|
2403
|
+
"input",
|
|
2404
|
+
{
|
|
2405
|
+
id: name,
|
|
2406
|
+
name,
|
|
2407
|
+
type,
|
|
2408
|
+
value,
|
|
2409
|
+
onChange,
|
|
2410
|
+
placeholder,
|
|
2411
|
+
required,
|
|
2412
|
+
disabled: disabled || readOnly,
|
|
2413
|
+
readOnly,
|
|
2414
|
+
min,
|
|
2415
|
+
max,
|
|
2416
|
+
step,
|
|
2417
|
+
maxLength,
|
|
2418
|
+
autoComplete,
|
|
2419
|
+
autoFocus,
|
|
2420
|
+
onKeyDown,
|
|
2421
|
+
onBlur,
|
|
2422
|
+
"aria-invalid": error ? "true" : "false",
|
|
2423
|
+
"aria-describedby": error ? `${name}-error` : description ? `${name}-description` : void 0,
|
|
2424
|
+
className: `form-input ${error ? "form-input-error" : ""} ${readOnly ? "bg-muted cursor-default" : ""} ${copyable ? "pr-10" : ""} ${getInputPaddingClasses(type, getIconConfig(icon))} ${inputClassName}`
|
|
2425
|
+
}
|
|
2426
|
+
),
|
|
2427
|
+
shouldShowIcons(type) && (() => {
|
|
2428
|
+
const iconConfig = getIconConfig(icon);
|
|
2429
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2430
|
+
renderIcon(iconConfig.left, "left"),
|
|
2431
|
+
renderIcon(iconConfig.right, "right")
|
|
2432
|
+
] });
|
|
2433
|
+
})(),
|
|
2434
|
+
copyable && /* @__PURE__ */ jsx(
|
|
2435
|
+
"button",
|
|
2436
|
+
{
|
|
2437
|
+
type: "button",
|
|
2438
|
+
onClick: handleCopy,
|
|
2439
|
+
className: `absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-all duration-200 z-10`,
|
|
2440
|
+
"aria-label": `Copy ${label}`,
|
|
2441
|
+
title: copied ? "Copied!" : `Copy ${label}`,
|
|
2442
|
+
children: copied ? /* @__PURE__ */ jsx(RiCheckLine, { className: "w-4 h-4 text-green-500", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(RiFileCopyLine, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
2443
|
+
}
|
|
2444
|
+
),
|
|
2445
|
+
clearable && !copyable && value !== "" && value !== null && value !== void 0 && !disabled && !readOnly && /* @__PURE__ */ jsx(
|
|
2446
|
+
"button",
|
|
2447
|
+
{
|
|
2448
|
+
type: "button",
|
|
2449
|
+
onClick: () => {
|
|
2450
|
+
const syntheticEvent = {
|
|
2451
|
+
target: { name, value: "" }
|
|
2452
|
+
};
|
|
2453
|
+
onChange(syntheticEvent);
|
|
2454
|
+
},
|
|
2455
|
+
className: `absolute inset-y-0 ${type === "number" ? "right-4" : "right-0"} flex items-center pr-3 text-muted-foreground hover:text-muted-foreground transition-all duration-200 z-10 opacity-0 group-hover:opacity-100`,
|
|
2456
|
+
"aria-label": `Clear ${label}`,
|
|
2457
|
+
title: `Clear ${label}`,
|
|
2458
|
+
children: /* @__PURE__ */ jsx(RiCloseLine, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
2459
|
+
}
|
|
2460
|
+
)
|
|
2461
|
+
] }),
|
|
2462
|
+
footerDescription && /* @__PURE__ */ jsx("p", { className: "text-xs mt-1", children: footerDescription }),
|
|
2463
|
+
error && /* @__PURE__ */ jsx("div", { id: `${name}-error`, className: "form-error", role: "alert", children: typeof error === "string" ? /* @__PURE__ */ jsx("p", { children: error }) : error })
|
|
2464
|
+
] }) });
|
|
2465
|
+
}
|
|
2466
|
+
function FormSection({
|
|
2467
|
+
title,
|
|
2468
|
+
description,
|
|
2469
|
+
children,
|
|
2470
|
+
className = ""
|
|
2471
|
+
}) {
|
|
2472
|
+
return /* @__PURE__ */ jsxs("div", { className: `space-y-4 ${className}`, children: [
|
|
2473
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2474
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-medium ", children: title }),
|
|
2475
|
+
description && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: description })
|
|
2476
|
+
] }),
|
|
2477
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-4", children })
|
|
2478
|
+
] });
|
|
2479
|
+
}
|
|
2480
|
+
function Grid({
|
|
2481
|
+
children,
|
|
2482
|
+
cols = 1,
|
|
2483
|
+
gap = 4,
|
|
2484
|
+
className = ""
|
|
2485
|
+
}) {
|
|
2486
|
+
const colClasses = {
|
|
2487
|
+
1: "grid-cols-1",
|
|
2488
|
+
2: "grid-cols-1 md:grid-cols-2",
|
|
2489
|
+
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
|
|
2490
|
+
4: "grid-cols-1 md:grid-cols-2 lg:grid-cols-4",
|
|
2491
|
+
5: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5",
|
|
2492
|
+
6: "grid-cols-2 md:grid-cols-3 lg:grid-cols-6",
|
|
2493
|
+
12: "grid-cols-12"
|
|
2494
|
+
};
|
|
2495
|
+
const gapClasses = {
|
|
2496
|
+
1: "gap-1",
|
|
2497
|
+
2: "gap-2",
|
|
2498
|
+
3: "gap-3",
|
|
2499
|
+
4: "gap-4",
|
|
2500
|
+
6: "gap-6",
|
|
2501
|
+
8: "gap-8"
|
|
2502
|
+
};
|
|
2503
|
+
return /* @__PURE__ */ jsx("div", { className: `grid ${colClasses[cols]} ${gapClasses[gap]} ${className}`, children });
|
|
2504
|
+
}
|
|
2505
|
+
var variantStyles = {
|
|
2506
|
+
default: "bg-accent border-border text-muted-foreground",
|
|
2507
|
+
warning: "bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800 text-yellow-700 dark:text-yellow-300",
|
|
2508
|
+
info: "bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800 text-blue-700 dark:text-blue-300",
|
|
2509
|
+
success: "bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800 text-green-700 dark:text-green-300"
|
|
2510
|
+
};
|
|
2511
|
+
var titleStyles = {
|
|
2512
|
+
default: "text-foreground",
|
|
2513
|
+
warning: "text-yellow-800 dark:text-yellow-200",
|
|
2514
|
+
info: "text-blue-800 dark:text-blue-200",
|
|
2515
|
+
success: "text-green-800 dark:text-green-200"
|
|
2516
|
+
};
|
|
2517
|
+
function InfoBox({
|
|
2518
|
+
title,
|
|
2519
|
+
children,
|
|
2520
|
+
variant = "default",
|
|
2521
|
+
className = ""
|
|
2522
|
+
}) {
|
|
2523
|
+
return /* @__PURE__ */ jsxs("div", { className: `border rounded-md p-4 ${variantStyles[variant]} ${className}`, children: [
|
|
2524
|
+
/* @__PURE__ */ jsx("h4", { className: `font-medium mb-2 ${titleStyles[variant]}`, children: title }),
|
|
2525
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm space-y-1 [&>ul]:list-disc [&>ul]:list-outside [&>ul]:pl-3 [&>ol]:list-decimal [&>ol]:list-outside [&>ol]:pl-4", children })
|
|
2526
|
+
] });
|
|
2527
|
+
}
|
|
2528
|
+
var variantClasses3 = {
|
|
2529
|
+
default: "text-foreground hover:text-primary",
|
|
2530
|
+
primary: "text-primary hover:text-primary/80",
|
|
2531
|
+
muted: "text-muted-foreground hover:text-foreground"
|
|
2532
|
+
};
|
|
2533
|
+
var Link = forwardRef(
|
|
2534
|
+
({
|
|
2535
|
+
href,
|
|
2536
|
+
variant = "default",
|
|
2537
|
+
underline = false,
|
|
2538
|
+
external = false,
|
|
2539
|
+
className = "",
|
|
2540
|
+
children,
|
|
2541
|
+
...props
|
|
2542
|
+
}, ref) => {
|
|
2543
|
+
const classes = [
|
|
2544
|
+
"transition-colors",
|
|
2545
|
+
variantClasses3[variant],
|
|
2546
|
+
underline ? "underline underline-offset-4" : "hover:underline hover:underline-offset-4",
|
|
2547
|
+
className
|
|
2548
|
+
].filter(Boolean).join(" ");
|
|
2549
|
+
if (external || href.startsWith("http")) {
|
|
2550
|
+
return /* @__PURE__ */ jsx(
|
|
2551
|
+
"a",
|
|
2552
|
+
{
|
|
2553
|
+
ref,
|
|
2554
|
+
href,
|
|
2555
|
+
className: classes,
|
|
2556
|
+
target: "_blank",
|
|
2557
|
+
rel: "noopener noreferrer",
|
|
2558
|
+
...props,
|
|
2559
|
+
children
|
|
2560
|
+
}
|
|
2561
|
+
);
|
|
2562
|
+
}
|
|
2563
|
+
return /* @__PURE__ */ jsx(NextLink, { ref, href, className: classes, ...props, children });
|
|
2564
|
+
}
|
|
2565
|
+
);
|
|
2566
|
+
Link.displayName = "Link";
|
|
2567
|
+
var Link_default = Link;
|
|
2568
|
+
var LoadingSpinner = ({
|
|
2569
|
+
message = "Initializing...",
|
|
2570
|
+
className,
|
|
2571
|
+
showMessage = false
|
|
2572
|
+
}) => {
|
|
2573
|
+
const containerClasses = className !== void 0 ? className : "flex items-center justify-center h-screen min-h-screen";
|
|
2574
|
+
return /* @__PURE__ */ jsx(
|
|
2575
|
+
"div",
|
|
2576
|
+
{
|
|
2577
|
+
className: containerClasses,
|
|
2578
|
+
role: "status",
|
|
2579
|
+
"aria-live": "polite",
|
|
2580
|
+
"aria-label": message,
|
|
2581
|
+
children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
2582
|
+
/* @__PURE__ */ jsxs(
|
|
2583
|
+
"div",
|
|
2584
|
+
{
|
|
2585
|
+
className: "flex items-center justify-center space-x-2 mb-6",
|
|
2586
|
+
"aria-hidden": "true",
|
|
2587
|
+
children: [
|
|
2588
|
+
/* @__PURE__ */ jsx("div", { className: "w-1.5 h-12 bg-gradient-to-t from-primary-600 to-primary-400 rounded-full shadow-sm [animation:wave_1.2s_ease-in-out_infinite] [animation-delay:0s]" }),
|
|
2589
|
+
/* @__PURE__ */ jsx("div", { className: "w-1.5 h-8 bg-gradient-to-t from-primary-600 to-primary-400 rounded-full shadow-sm [animation:wave_1.2s_ease-in-out_infinite] [animation-delay:0.2s]" }),
|
|
2590
|
+
/* @__PURE__ */ jsx("div", { className: "w-1.5 h-8 bg-gradient-to-t from-primary-600 to-primary-400 rounded-full shadow-sm [animation:wave_1.2s_ease-in-out_infinite] [animation-delay:0.4s]" }),
|
|
2591
|
+
/* @__PURE__ */ jsx("div", { className: "w-1.5 h-12 bg-gradient-to-t from-primary-600 to-primary-400 rounded-full shadow-sm [animation:wave_1.2s_ease-in-out_infinite] [animation-delay:0.6s]" })
|
|
2592
|
+
]
|
|
2593
|
+
}
|
|
2594
|
+
),
|
|
2595
|
+
showMessage && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: /* @__PURE__ */ jsx(
|
|
2596
|
+
"p",
|
|
2597
|
+
{
|
|
2598
|
+
className: "text-sm text-secondary-foreground animate-pulse",
|
|
2599
|
+
"aria-live": "polite",
|
|
2600
|
+
children: message
|
|
2601
|
+
}
|
|
2602
|
+
) })
|
|
2603
|
+
] })
|
|
2604
|
+
}
|
|
2605
|
+
);
|
|
2606
|
+
};
|
|
2607
|
+
var LoadingSpinner_default = LoadingSpinner;
|
|
2608
|
+
function PageHeader({
|
|
2609
|
+
icon: Icon,
|
|
2610
|
+
title,
|
|
2611
|
+
subtitle,
|
|
2612
|
+
rightContent,
|
|
2613
|
+
className = ""
|
|
2614
|
+
}) {
|
|
2615
|
+
return /* @__PURE__ */ jsx("div", { className: `mb-6 lg:mb-8 ${className}`, children: /* @__PURE__ */ jsxs("div", { className: "header-layout", children: [
|
|
2616
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3", children: [
|
|
2617
|
+
Icon && /* @__PURE__ */ jsx(Icon, { className: "w-6 h-6 lg:w-8 lg:h-8 flex-shrink-0" }),
|
|
2618
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
2619
|
+
/* @__PURE__ */ jsx("h1", { className: "text-xl lg:text-3xl font-bold text-foreground truncate", children: title }),
|
|
2620
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: "text-sm lg:text-base text-muted-foreground", children: subtitle })
|
|
2621
|
+
] })
|
|
2622
|
+
] }),
|
|
2623
|
+
rightContent && /* @__PURE__ */ jsx("div", { className: "flex items-center space-x-2 lg:space-x-3 flex-shrink-0", children: rightContent })
|
|
2624
|
+
] }) });
|
|
2625
|
+
}
|
|
2626
|
+
function Switch({
|
|
2627
|
+
checked,
|
|
2628
|
+
onChange,
|
|
2629
|
+
disabled = false,
|
|
2630
|
+
label,
|
|
2631
|
+
description,
|
|
2632
|
+
className = "",
|
|
2633
|
+
size = "md"
|
|
2634
|
+
}) {
|
|
2635
|
+
const toggle = () => {
|
|
2636
|
+
if (!disabled) {
|
|
2637
|
+
onChange(!checked);
|
|
2638
|
+
}
|
|
2639
|
+
};
|
|
2640
|
+
const sizes = {
|
|
2641
|
+
sm: { track: "w-8 h-4", thumb: "w-3 h-3", translate: "translate-x-4" },
|
|
2642
|
+
md: { track: "w-11 h-6", thumb: "w-5 h-5", translate: "translate-x-5" },
|
|
2643
|
+
lg: { track: "w-14 h-8", thumb: "w-7 h-7", translate: "translate-x-6" }
|
|
2644
|
+
};
|
|
2645
|
+
const currentSize = sizes[size];
|
|
2646
|
+
return /* @__PURE__ */ jsxs("div", { className: `flex items-start ${className}`, children: [
|
|
2647
|
+
/* @__PURE__ */ jsx(
|
|
2648
|
+
"button",
|
|
2649
|
+
{
|
|
2650
|
+
type: "button",
|
|
2651
|
+
role: "switch",
|
|
2652
|
+
"aria-checked": checked,
|
|
2653
|
+
disabled,
|
|
2654
|
+
onClick: toggle,
|
|
2655
|
+
className: `
|
|
2656
|
+
relative inline-flex flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent
|
|
2657
|
+
transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
|
|
2658
|
+
${checked ? "bg-primary" : "bg-muted"}
|
|
2659
|
+
${disabled ? "opacity-50 cursor-not-allowed" : ""}
|
|
2660
|
+
${currentSize.track}
|
|
2661
|
+
`,
|
|
2662
|
+
children: /* @__PURE__ */ jsx(
|
|
2663
|
+
"span",
|
|
2664
|
+
{
|
|
2665
|
+
"aria-hidden": "true",
|
|
2666
|
+
className: `
|
|
2667
|
+
pointer-events-none inline-block transform rounded-full bg-white shadow ring-0
|
|
2668
|
+
transition duration-200 ease-in-out
|
|
2669
|
+
${checked ? currentSize.translate : "translate-x-0"}
|
|
2670
|
+
${currentSize.thumb}
|
|
2671
|
+
`
|
|
2672
|
+
}
|
|
2673
|
+
)
|
|
2674
|
+
}
|
|
2675
|
+
),
|
|
2676
|
+
(label || description) && /* @__PURE__ */ jsxs("div", { className: "ml-3 text-sm leading-6", children: [
|
|
2677
|
+
label && /* @__PURE__ */ jsx("label", { className: "font-medium text-foreground cursor-pointer", onClick: toggle, children: label }),
|
|
2678
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: description })
|
|
2679
|
+
] })
|
|
2680
|
+
] });
|
|
2681
|
+
}
|
|
2682
|
+
var variantClasses4 = {
|
|
2683
|
+
default: "text-foreground",
|
|
2684
|
+
muted: "text-muted-foreground",
|
|
2685
|
+
bold: "font-semibold"
|
|
2686
|
+
};
|
|
2687
|
+
var sizeClasses4 = {
|
|
2688
|
+
xs: "text-xs",
|
|
2689
|
+
sm: "text-sm",
|
|
2690
|
+
base: "text-base",
|
|
2691
|
+
lg: "text-lg",
|
|
2692
|
+
xl: "text-xl",
|
|
2693
|
+
"2xl": "text-2xl",
|
|
2694
|
+
"3xl": "text-3xl"
|
|
2695
|
+
};
|
|
2696
|
+
function Typography({
|
|
2697
|
+
as: Element = "p",
|
|
2698
|
+
variant = "default",
|
|
2699
|
+
size = "base",
|
|
2700
|
+
children,
|
|
2701
|
+
className = ""
|
|
2702
|
+
}) {
|
|
2703
|
+
const classes = `${variantClasses4[variant]} ${sizeClasses4[size]} ${className}`;
|
|
2704
|
+
return /* @__PURE__ */ jsx(Element, { className: classes, children });
|
|
2705
|
+
}
|
|
2706
|
+
var Spinner = ({
|
|
2707
|
+
size = "md",
|
|
2708
|
+
color = "primary",
|
|
2709
|
+
className = ""
|
|
2710
|
+
}) => {
|
|
2711
|
+
const sizeClasses5 = {
|
|
2712
|
+
sm: "h-4 w-4",
|
|
2713
|
+
md: "h-8 w-8",
|
|
2714
|
+
lg: "h-12 w-12",
|
|
2715
|
+
xl: "h-16 w-16"
|
|
2716
|
+
};
|
|
2717
|
+
const colorClasses2 = {
|
|
2718
|
+
primary: "border-primary-600",
|
|
2719
|
+
blue: "border-ring",
|
|
2720
|
+
white: "border-white",
|
|
2721
|
+
current: "border-current"
|
|
2722
|
+
};
|
|
2723
|
+
const baseClasses = "animate-spin rounded-full border-2 border-t-transparent";
|
|
2724
|
+
const sizeClass = sizeClasses5[size];
|
|
2725
|
+
const colorClass = colorClasses2[color];
|
|
2726
|
+
const finalClasses = `${baseClasses} ${sizeClass} ${colorClass} ${className}`.trim();
|
|
2727
|
+
return /* @__PURE__ */ jsx("div", { className: finalClasses });
|
|
2728
|
+
};
|
|
2729
|
+
var Spinner_default = Spinner;
|
|
2730
|
+
function DataTable({
|
|
2731
|
+
children,
|
|
2732
|
+
className = "",
|
|
2733
|
+
containerClassName = "",
|
|
2734
|
+
stickyActions = false
|
|
2735
|
+
}) {
|
|
2736
|
+
return /* @__PURE__ */ jsx("div", { className: `card overflow-hidden ${containerClassName}`, children: /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsx(
|
|
2737
|
+
"table",
|
|
2738
|
+
{
|
|
2739
|
+
role: "table",
|
|
2740
|
+
"aria-label": "Data table",
|
|
2741
|
+
className: `w-full divide-y divide-border ${className} ${stickyActions ? "relative" : ""}`,
|
|
2742
|
+
children
|
|
2743
|
+
}
|
|
2744
|
+
) }) });
|
|
2745
|
+
}
|
|
2746
|
+
function DataTableHeader({
|
|
2747
|
+
children,
|
|
2748
|
+
className = ""
|
|
2749
|
+
}) {
|
|
2750
|
+
return /* @__PURE__ */ jsx("thead", { className: `bg-muted ${className}`, children });
|
|
2751
|
+
}
|
|
2752
|
+
function DataTableBody({
|
|
2753
|
+
children,
|
|
2754
|
+
className = ""
|
|
2755
|
+
}) {
|
|
2756
|
+
return /* @__PURE__ */ jsx("tbody", { className: `table-body-card ${className}`, children });
|
|
2757
|
+
}
|
|
2758
|
+
function DataTableRow({
|
|
2759
|
+
children,
|
|
2760
|
+
className = "",
|
|
2761
|
+
onClick,
|
|
2762
|
+
hover = true
|
|
2763
|
+
}) {
|
|
2764
|
+
const baseClasses = "hover:bg-muted transition-colors duration-150";
|
|
2765
|
+
const clickableClasses = onClick ? "cursor-pointer" : "";
|
|
2766
|
+
const hoverClasses = hover ? baseClasses : "";
|
|
2767
|
+
return /* @__PURE__ */ jsx(
|
|
2768
|
+
"tr",
|
|
2769
|
+
{
|
|
2770
|
+
className: `${hoverClasses} ${clickableClasses} ${className}`,
|
|
2771
|
+
onClick,
|
|
2772
|
+
children
|
|
2773
|
+
}
|
|
2774
|
+
);
|
|
2775
|
+
}
|
|
2776
|
+
function DataTableHeaderCell({
|
|
2777
|
+
children,
|
|
2778
|
+
className = "",
|
|
2779
|
+
align = "left",
|
|
2780
|
+
padding = "md",
|
|
2781
|
+
sticky,
|
|
2782
|
+
stickyOffset = 0
|
|
2783
|
+
}) {
|
|
2784
|
+
const alignClasses = {
|
|
2785
|
+
left: "text-left",
|
|
2786
|
+
center: "text-center",
|
|
2787
|
+
right: "text-right"
|
|
2788
|
+
};
|
|
2789
|
+
const paddingClasses3 = {
|
|
2790
|
+
sm: "px-3 py-2",
|
|
2791
|
+
md: "px-6 py-3",
|
|
2792
|
+
lg: "px-8 py-4"
|
|
2793
|
+
};
|
|
2794
|
+
const stickyClasses = sticky ? `sticky ${sticky === "left" ? "left-0" : "right-0"} z-10` : "";
|
|
2795
|
+
const stickyOffsetClasses = sticky && stickyOffset > 0 ? sticky === "left" ? `left-${stickyOffset}` : `right-${stickyOffset}` : "";
|
|
2796
|
+
const stickyStyling = "";
|
|
2797
|
+
return /* @__PURE__ */ jsx(
|
|
2798
|
+
"th",
|
|
2799
|
+
{
|
|
2800
|
+
scope: "col",
|
|
2801
|
+
className: `${paddingClasses3[padding]} ${alignClasses[align]} text-xs font-medium text-muted-foreground uppercase tracking-wider ${stickyClasses} ${stickyOffsetClasses} ${stickyStyling} ${className}`,
|
|
2802
|
+
children
|
|
2803
|
+
}
|
|
2804
|
+
);
|
|
2805
|
+
}
|
|
2806
|
+
function DataTableCell({
|
|
2807
|
+
children,
|
|
2808
|
+
className = "",
|
|
2809
|
+
align = "left",
|
|
2810
|
+
padding = "md",
|
|
2811
|
+
sticky,
|
|
2812
|
+
stickyOffset = 0
|
|
2813
|
+
}) {
|
|
2814
|
+
const alignClasses = {
|
|
2815
|
+
left: "text-left",
|
|
2816
|
+
center: "text-center",
|
|
2817
|
+
right: "text-right"
|
|
2818
|
+
};
|
|
2819
|
+
const paddingClasses3 = {
|
|
2820
|
+
sm: "px-3 py-2",
|
|
2821
|
+
md: "px-6 py-4",
|
|
2822
|
+
lg: "px-8 py-6"
|
|
2823
|
+
};
|
|
2824
|
+
const stickyClasses = sticky ? `sticky ${sticky === "left" ? "left-0" : "right-0"} z-10` : "";
|
|
2825
|
+
const stickyOffsetClasses = sticky && stickyOffset > 0 ? sticky === "left" ? `left-${stickyOffset}` : `right-${stickyOffset}` : "";
|
|
2826
|
+
const stickyStyling = "";
|
|
2827
|
+
return /* @__PURE__ */ jsx(
|
|
2828
|
+
"td",
|
|
2829
|
+
{
|
|
2830
|
+
className: `${paddingClasses3[padding]} whitespace-nowrap ${alignClasses[align]} text-sm ${stickyClasses} ${stickyOffsetClasses} ${stickyStyling} ${className}`,
|
|
2831
|
+
children
|
|
2832
|
+
}
|
|
2833
|
+
);
|
|
2834
|
+
}
|
|
2835
|
+
function DataTableEmptyState({
|
|
2836
|
+
icon: Icon,
|
|
2837
|
+
title,
|
|
2838
|
+
description,
|
|
2839
|
+
action,
|
|
2840
|
+
variant = "table"
|
|
2841
|
+
}) {
|
|
2842
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2843
|
+
/* @__PURE__ */ jsx(Icon, { className: "w-20 h-20 text-primary-500 mx-auto mb-4" }),
|
|
2844
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-medium text-foreground mb-2", children: title }),
|
|
2845
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground mb-6", children: description }),
|
|
2846
|
+
action && /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: action })
|
|
2847
|
+
] });
|
|
2848
|
+
if (variant === "div") {
|
|
2849
|
+
return /* @__PURE__ */ jsx("div", { className: "card card-padding text-center lg:p-24", children: content });
|
|
2850
|
+
}
|
|
2851
|
+
return /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 100, className: "px-6 py-12 text-center", children: content }) });
|
|
2852
|
+
}
|
|
2853
|
+
function DataTableLoadingState({
|
|
2854
|
+
message = "Loading...",
|
|
2855
|
+
rows = 5,
|
|
2856
|
+
columns = 4
|
|
2857
|
+
}) {
|
|
2858
|
+
return /* @__PURE__ */ jsxs("div", { className: "card card-padding", children: [
|
|
2859
|
+
/* @__PURE__ */ jsxs("div", { className: "text-center mb-4", children: [
|
|
2860
|
+
/* @__PURE__ */ jsx(Spinner_default, { size: "md", color: "primary", className: "mx-auto mb-2" }),
|
|
2861
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: message })
|
|
2862
|
+
] }),
|
|
2863
|
+
/* @__PURE__ */ jsx(SkeletonTable, { rows, columns, showHeader: false })
|
|
2864
|
+
] });
|
|
2865
|
+
}
|
|
2866
|
+
function StatusBadge({
|
|
2867
|
+
status,
|
|
2868
|
+
variant = "default"
|
|
2869
|
+
}) {
|
|
2870
|
+
const variantClasses5 = {
|
|
2871
|
+
default: "bg-muted text-muted-foreground",
|
|
2872
|
+
success: "bg-success text-success-dark",
|
|
2873
|
+
warning: "bg-yellow-100 text-yellow-800",
|
|
2874
|
+
error: "bg-red-100 text-red-800",
|
|
2875
|
+
info: "bg-primary-100 text-primary-800"
|
|
2876
|
+
};
|
|
2877
|
+
return /* @__PURE__ */ jsx("span", { className: `badge ${variantClasses5[variant]}`, children: status });
|
|
2878
|
+
}
|
|
2879
|
+
function DataTableActions({
|
|
2880
|
+
children,
|
|
2881
|
+
className = "",
|
|
2882
|
+
enhanced = false
|
|
2883
|
+
}) {
|
|
2884
|
+
const baseClasses = "flex items-center justify-end space-x-2 dt-actions";
|
|
2885
|
+
const enhancedClasses = enhanced ? "px-2 py-1 rounded-md bg-card backdrop-blur-sm" : "";
|
|
2886
|
+
return /* @__PURE__ */ jsx("div", { className: `${baseClasses} ${enhancedClasses} ${className}`, children });
|
|
2887
|
+
}
|
|
2888
|
+
function StickyActionsColumn({
|
|
2889
|
+
children,
|
|
2890
|
+
className = ""
|
|
2891
|
+
}) {
|
|
1175
2892
|
return /* @__PURE__ */ jsx(
|
|
1176
2893
|
"div",
|
|
1177
2894
|
{
|
|
1178
|
-
className:
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
2895
|
+
className: `border-l border-border shadow-[-1px_0_3px_-1px_rgba(0,0,0,0.02)] ${className}`,
|
|
2896
|
+
children
|
|
2897
|
+
}
|
|
2898
|
+
);
|
|
2899
|
+
}
|
|
2900
|
+
function SharedTooltip({
|
|
2901
|
+
id,
|
|
2902
|
+
place = "top",
|
|
2903
|
+
offset = 8,
|
|
2904
|
+
delayShow = 200,
|
|
2905
|
+
delayHide = 100,
|
|
2906
|
+
className = "",
|
|
2907
|
+
style = {},
|
|
2908
|
+
children
|
|
2909
|
+
}) {
|
|
2910
|
+
return /* @__PURE__ */ jsx(
|
|
2911
|
+
Tooltip,
|
|
2912
|
+
{
|
|
2913
|
+
id,
|
|
2914
|
+
place,
|
|
2915
|
+
offset,
|
|
2916
|
+
delayShow,
|
|
2917
|
+
delayHide,
|
|
2918
|
+
className: `!bg-popover !text-popover-foreground !border !border-border !shadow-md !text-xs !px-2 !py-1 !rounded-md z-50 ${className}`,
|
|
2919
|
+
style,
|
|
2920
|
+
positionStrategy: "fixed",
|
|
2921
|
+
render: children ? () => /* @__PURE__ */ jsx(Fragment, { children }) : void 0
|
|
2922
|
+
}
|
|
2923
|
+
);
|
|
2924
|
+
}
|
|
2925
|
+
function CountBadge({
|
|
2926
|
+
count,
|
|
2927
|
+
className = "",
|
|
2928
|
+
size = "sm",
|
|
2929
|
+
variant = "primary"
|
|
2930
|
+
}) {
|
|
2931
|
+
const sizeClasses5 = {
|
|
2932
|
+
sm: "text-xs px-1.5 py-0.5 min-w-[18px]",
|
|
2933
|
+
md: "text-sm px-2 py-1 min-w-[20px]",
|
|
2934
|
+
lg: "text-base px-2.5 py-1.5 min-w-[24px]"
|
|
2935
|
+
};
|
|
2936
|
+
const variantClasses5 = {
|
|
2937
|
+
primary: "bg-ring ",
|
|
2938
|
+
secondary: "bg-muted0 ",
|
|
2939
|
+
success: "bg-green-500 ",
|
|
2940
|
+
warning: "bg-yellow-500 ",
|
|
2941
|
+
error: "bg-red-500 "
|
|
2942
|
+
};
|
|
2943
|
+
if (count <= 0) return null;
|
|
2944
|
+
return /* @__PURE__ */ jsx(
|
|
2945
|
+
"span",
|
|
2946
|
+
{
|
|
2947
|
+
"aria-label": `Count: ${count}`,
|
|
2948
|
+
className: `${sizeClasses5[size]} ${variantClasses5[variant]} rounded-full text-center font-medium ${className}`,
|
|
2949
|
+
children: count
|
|
2950
|
+
}
|
|
2951
|
+
);
|
|
2952
|
+
}
|
|
2953
|
+
function ClearButton({
|
|
2954
|
+
onClick,
|
|
2955
|
+
className = "",
|
|
2956
|
+
size = "sm",
|
|
2957
|
+
variant = "overlay",
|
|
2958
|
+
tooltipId,
|
|
2959
|
+
tooltipContent = "Clear"
|
|
2960
|
+
}) {
|
|
2961
|
+
const sizeClasses5 = {
|
|
2962
|
+
sm: "w-4 h-4",
|
|
2963
|
+
md: "w-5 h-5",
|
|
2964
|
+
lg: "w-6 h-6"
|
|
2965
|
+
};
|
|
2966
|
+
const iconSizeClasses2 = {
|
|
2967
|
+
sm: "w-3 h-3",
|
|
2968
|
+
md: "w-4 h-4",
|
|
2969
|
+
lg: "w-5 h-5"
|
|
2970
|
+
};
|
|
2971
|
+
const variantClasses5 = {
|
|
2972
|
+
overlay: "absolute -top-1 -right-1 bg-red-500 rounded-full flex items-center justify-center hover:bg-red-600 transition-colors cursor-pointer",
|
|
2973
|
+
inline: "bg-red-500 rounded-full flex items-center justify-center hover:bg-red-600 transition-colors",
|
|
2974
|
+
ghost: "text-muted-foreground hover:text-muted-foreground transition-colors"
|
|
2975
|
+
};
|
|
2976
|
+
const baseProps = {
|
|
2977
|
+
onClick: (e) => {
|
|
2978
|
+
e.stopPropagation();
|
|
2979
|
+
onClick(e);
|
|
2980
|
+
},
|
|
2981
|
+
className: `${sizeClasses5[size]} ${variantClasses5[variant]} ${className}`,
|
|
2982
|
+
title: tooltipContent
|
|
2983
|
+
};
|
|
2984
|
+
const tooltipProps = tooltipId ? {
|
|
2985
|
+
"data-tooltip-id": tooltipId,
|
|
2986
|
+
"data-tooltip-content": tooltipContent
|
|
2987
|
+
} : {};
|
|
2988
|
+
const Element = variant === "overlay" ? "span" : "button";
|
|
2989
|
+
return /* @__PURE__ */ jsx(Element, { ...baseProps, ...tooltipProps, children: /* @__PURE__ */ jsx(RiCloseLine, { className: iconSizeClasses2[size] }) });
|
|
2990
|
+
}
|
|
2991
|
+
function IconButtonWithCount({
|
|
2992
|
+
icon,
|
|
2993
|
+
label,
|
|
2994
|
+
count = 0,
|
|
2995
|
+
onClick,
|
|
2996
|
+
onClear,
|
|
2997
|
+
showLabel = true,
|
|
2998
|
+
className = "",
|
|
2999
|
+
buttonClassName = "",
|
|
3000
|
+
countVariant = "primary",
|
|
3001
|
+
clearVariant = "overlay",
|
|
3002
|
+
tooltipId,
|
|
3003
|
+
tooltipContent,
|
|
3004
|
+
clearTooltipId,
|
|
3005
|
+
clearTooltipContent = "Clear"
|
|
3006
|
+
}) {
|
|
3007
|
+
const hasActiveCount = count > 0;
|
|
3008
|
+
const shouldShowLabel = showLabel && !hasActiveCount;
|
|
3009
|
+
return /* @__PURE__ */ jsxs(
|
|
3010
|
+
"button",
|
|
3011
|
+
{
|
|
3012
|
+
onClick,
|
|
3013
|
+
className: `btn-alt btn-md flex items-center space-x-1 relative ${buttonClassName} ${className}`,
|
|
3014
|
+
"data-tooltip-id": tooltipId,
|
|
3015
|
+
"data-tooltip-content": tooltipContent,
|
|
3016
|
+
children: [
|
|
3017
|
+
icon,
|
|
3018
|
+
shouldShowLabel && label && /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: label }),
|
|
3019
|
+
hasActiveCount && /* @__PURE__ */ jsx(CountBadge, { count, variant: countVariant }),
|
|
3020
|
+
hasActiveCount && onClear && /* @__PURE__ */ jsx(
|
|
3021
|
+
ClearButton,
|
|
3022
|
+
{
|
|
3023
|
+
onClick: onClear,
|
|
3024
|
+
variant: clearVariant,
|
|
3025
|
+
tooltipId: clearTooltipId,
|
|
3026
|
+
tooltipContent: clearTooltipContent
|
|
3027
|
+
}
|
|
3028
|
+
)
|
|
3029
|
+
]
|
|
3030
|
+
}
|
|
3031
|
+
);
|
|
3032
|
+
}
|
|
3033
|
+
function ActionButton({
|
|
3034
|
+
icon: IconComponent,
|
|
3035
|
+
label,
|
|
3036
|
+
onClick,
|
|
3037
|
+
href,
|
|
3038
|
+
disabled = false,
|
|
3039
|
+
size = "md",
|
|
3040
|
+
iconOnly = false,
|
|
3041
|
+
className = "",
|
|
3042
|
+
title,
|
|
3043
|
+
tooltipId,
|
|
3044
|
+
tooltipPlace = "bottom",
|
|
3045
|
+
tooltipOffset = 12,
|
|
3046
|
+
tooltipDelayShow = 200,
|
|
3047
|
+
tooltipDelayHide = 100,
|
|
3048
|
+
type = "button",
|
|
3049
|
+
variant,
|
|
3050
|
+
terminalMode = false,
|
|
3051
|
+
fill = false,
|
|
3052
|
+
loading: externalLoading,
|
|
3053
|
+
// Extract loading prop to prevent it from being passed to DOM
|
|
3054
|
+
loadingIcon: LoadingIconComponent,
|
|
3055
|
+
// Custom loading icon
|
|
3056
|
+
disableLoadingSpin = false,
|
|
3057
|
+
// Disable spin animation for custom loading icons
|
|
3058
|
+
...restProps
|
|
3059
|
+
}) {
|
|
3060
|
+
const [loading, setLoading] = useState(false);
|
|
3061
|
+
const handleClick = useCallback(async () => {
|
|
3062
|
+
if (onClick && !disabled && !loading) {
|
|
3063
|
+
setLoading(true);
|
|
3064
|
+
try {
|
|
3065
|
+
await onClick();
|
|
3066
|
+
} catch (error) {
|
|
3067
|
+
console.error("ActionButton onClick error:", error);
|
|
3068
|
+
} finally {
|
|
3069
|
+
setLoading(false);
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
}, [onClick, disabled, loading]);
|
|
3073
|
+
const iconSizes = {
|
|
3074
|
+
sm: terminalMode ? "w-4 h-4" : "w-4 h-4",
|
|
3075
|
+
md: terminalMode ? "w-4 h-4" : "w-4 h-4",
|
|
3076
|
+
lg: terminalMode ? "w-5 h-5" : "w-5 h-5"
|
|
3077
|
+
};
|
|
3078
|
+
const heightClasses = {
|
|
3079
|
+
sm: terminalMode ? "" : "btn-sm",
|
|
3080
|
+
md: terminalMode ? "" : "btn-md",
|
|
3081
|
+
lg: terminalMode ? "" : "btn-lg"
|
|
3082
|
+
};
|
|
3083
|
+
const paddingClasses3 = iconOnly ? terminalMode ? "" : "p-2" : "px-3 py-1.5";
|
|
3084
|
+
const t = useIntlayer("action-button");
|
|
3085
|
+
const getVariantConfig = () => {
|
|
3086
|
+
switch (variant) {
|
|
3087
|
+
case "edit":
|
|
3088
|
+
return {
|
|
3089
|
+
icon: fill ? RiEditFill : RiEditLine,
|
|
3090
|
+
label: t.edit,
|
|
3091
|
+
className: "btn-secondary"
|
|
3092
|
+
};
|
|
3093
|
+
case "delete":
|
|
3094
|
+
return {
|
|
3095
|
+
icon: fill ? RiDeleteBinFill : RiDeleteBinLine,
|
|
3096
|
+
label: t.delete,
|
|
3097
|
+
className: "btn-danger"
|
|
3098
|
+
};
|
|
3099
|
+
case "deactivate":
|
|
3100
|
+
return {
|
|
3101
|
+
icon: fill ? RiStopCircleFill : RiStopCircleLine,
|
|
3102
|
+
label: t.deactivate,
|
|
3103
|
+
className: "bg-slate-50 text-slate-600 hover:bg-slate-100 hover:text-slate-700 border border-slate-200 transition-all duration-300 ease-in-out"
|
|
3104
|
+
};
|
|
3105
|
+
case "activate":
|
|
3106
|
+
return {
|
|
3107
|
+
icon: fill ? RiPlayCircleFill : RiPlayCircleLine,
|
|
3108
|
+
label: t.activate,
|
|
3109
|
+
className: "bg-emerald-50 text-emerald-600 hover:bg-emerald-100 hover:text-emerald-700 border border-emerald-200 transition-all duration-300 ease-in-out"
|
|
3110
|
+
};
|
|
3111
|
+
case "view":
|
|
3112
|
+
return {
|
|
3113
|
+
icon: fill ? RiEyeFill : RiEyeLine,
|
|
3114
|
+
label: t.view,
|
|
3115
|
+
className: "bg-muted text-muted-foreground hover:bg-gray-100 hover:text-foreground border border-border transition-all duration-300 ease-in-out"
|
|
3116
|
+
};
|
|
3117
|
+
case "metrics":
|
|
3118
|
+
return {
|
|
3119
|
+
icon: fill ? RiBarChartFill : RiBarChartLine,
|
|
3120
|
+
label: t.metrics,
|
|
3121
|
+
className: "bg-purple-50 text-purple-600 hover:bg-purple-100 hover:text-purple-700 border border-purple-200 transition-all duration-300 ease-in-out"
|
|
3122
|
+
};
|
|
3123
|
+
case "start":
|
|
3124
|
+
return {
|
|
3125
|
+
icon: fill ? RiPlayFill : RiPlayLine,
|
|
3126
|
+
label: t.start,
|
|
3127
|
+
className: "bg-green-50 text-green-600 hover:bg-green-100 hover:text-green-700 border border-green-200 transition-all duration-300 ease-in-out"
|
|
3128
|
+
};
|
|
3129
|
+
case "stop":
|
|
3130
|
+
return {
|
|
3131
|
+
icon: fill ? RiStopFill : RiStopLine,
|
|
3132
|
+
label: t.stop,
|
|
3133
|
+
className: "bg-red-50 text-red-600 hover:bg-red-100 hover:text-red-700 border border-red-200 transition-all duration-300 ease-in-out"
|
|
3134
|
+
};
|
|
3135
|
+
case "restart":
|
|
3136
|
+
return {
|
|
3137
|
+
icon: fill ? RiRestartFill : RiRestartLine,
|
|
3138
|
+
label: t.restart,
|
|
3139
|
+
className: "bg-orange-50 text-orange-600 hover:bg-orange-100 hover:text-orange-700 border border-orange-200 transition-all duration-300 ease-in-out"
|
|
3140
|
+
};
|
|
3141
|
+
case "pause":
|
|
3142
|
+
return {
|
|
3143
|
+
icon: fill ? RiPauseFill : RiPauseLine,
|
|
3144
|
+
label: t.pause,
|
|
3145
|
+
className: "bg-yellow-50 text-yellow-600 hover:bg-yellow-100 hover:text-yellow-700 border border-yellow-200 transition-all duration-300 ease-in-out"
|
|
3146
|
+
};
|
|
3147
|
+
case "clone":
|
|
3148
|
+
return {
|
|
3149
|
+
icon: fill ? RiFileCopyFill : RiFileCopyLine,
|
|
3150
|
+
label: t.clone,
|
|
3151
|
+
className: "bg-indigo-50 text-indigo-600 hover:bg-indigo-100 hover:text-indigo-700 border border-indigo-200 transition-all duration-300 ease-in-out"
|
|
3152
|
+
};
|
|
3153
|
+
default:
|
|
3154
|
+
return null;
|
|
3155
|
+
}
|
|
3156
|
+
};
|
|
3157
|
+
const variantConfig = getVariantConfig();
|
|
3158
|
+
const variantClasses5 = {
|
|
3159
|
+
primary: "btn-primary",
|
|
3160
|
+
secondary: "btn-secondary",
|
|
3161
|
+
danger: "btn-danger",
|
|
3162
|
+
success: "bg-green-50 text-green-600 hover:bg-green-100 hover:text-green-700 border border-green-200 transition-all duration-300 ease-in-out",
|
|
3163
|
+
warning: "bg-yellow-50 text-yellow-600 hover:bg-yellow-100 hover:text-yellow-700 border border-yellow-200 transition-all duration-300 ease-in-out",
|
|
3164
|
+
info: "bg-muted text-muted-foreground hover:bg-primary hover:text-primary-foreground border border-ring transition-all duration-300 ease-in-out",
|
|
3165
|
+
metrics: "bg-purple-50 text-purple-600 hover:bg-purple-100 hover:text-purple-700 border border-purple-200 transition-all duration-300 ease-in-out"
|
|
3166
|
+
};
|
|
3167
|
+
let variantClass = variantConfig ? variantConfig.className : variant ? variantClasses5[variant] : "";
|
|
3168
|
+
if (terminalMode && variantClass) {
|
|
3169
|
+
const hoverMatch = variantClass.match(/hover:text-(\w+)-(\d+)/);
|
|
3170
|
+
const hoverColor = hoverMatch ? `hover:text-${hoverMatch[1]}-${hoverMatch[2]}` : "hover:text-muted-foreground";
|
|
3171
|
+
variantClass = `text-muted-foreground ${hoverColor} transition-colors duration-200`;
|
|
3172
|
+
}
|
|
3173
|
+
const isDisabled = disabled || loading || externalLoading;
|
|
3174
|
+
const buttonContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3175
|
+
loading || externalLoading ? /* @__PURE__ */ jsx(
|
|
3176
|
+
"div",
|
|
3177
|
+
{
|
|
3178
|
+
className: `${iconSizes[size]} flex items-center justify-center flex-shrink-0 ${terminalMode ? "text-muted-foreground p-0.5" : ""}`,
|
|
3179
|
+
"aria-hidden": "true",
|
|
3180
|
+
children: LoadingIconComponent ? /* @__PURE__ */ jsx(
|
|
3181
|
+
LoadingIconComponent,
|
|
3182
|
+
{
|
|
3183
|
+
className: `w-full h-full ${disableLoadingSpin ? "" : "animate-spin-slow"}`,
|
|
3184
|
+
"aria-hidden": "true"
|
|
3185
|
+
}
|
|
3186
|
+
) : /* @__PURE__ */ jsx(
|
|
1184
3187
|
"div",
|
|
1185
3188
|
{
|
|
1186
|
-
className: "
|
|
1187
|
-
"aria-hidden": "true"
|
|
1188
|
-
children: [
|
|
1189
|
-
/* @__PURE__ */ jsx("div", { className: "w-1.5 h-12 bg-gradient-to-t from-primary-600 to-primary-400 rounded-full shadow-sm [animation:wave_1.2s_ease-in-out_infinite] [animation-delay:0s]" }),
|
|
1190
|
-
/* @__PURE__ */ jsx("div", { className: "w-1.5 h-8 bg-gradient-to-t from-primary-600 to-primary-400 rounded-full shadow-sm [animation:wave_1.2s_ease-in-out_infinite] [animation-delay:0.2s]" }),
|
|
1191
|
-
/* @__PURE__ */ jsx("div", { className: "w-1.5 h-8 bg-gradient-to-t from-primary-600 to-primary-400 rounded-full shadow-sm [animation:wave_1.2s_ease-in-out_infinite] [animation-delay:0.4s]" }),
|
|
1192
|
-
/* @__PURE__ */ jsx("div", { className: "w-1.5 h-12 bg-gradient-to-t from-primary-600 to-primary-400 rounded-full shadow-sm [animation:wave_1.2s_ease-in-out_infinite] [animation-delay:0.6s]" })
|
|
1193
|
-
]
|
|
3189
|
+
className: "w-full h-full border-2 border-current border-t-transparent rounded-full animate-spin",
|
|
3190
|
+
"aria-hidden": "true"
|
|
1194
3191
|
}
|
|
1195
|
-
)
|
|
1196
|
-
|
|
1197
|
-
|
|
3192
|
+
)
|
|
3193
|
+
}
|
|
3194
|
+
) : (variantConfig?.icon || IconComponent) && /* @__PURE__ */ jsx(
|
|
3195
|
+
"div",
|
|
3196
|
+
{
|
|
3197
|
+
className: `${iconSizes[size]} flex items-center justify-center flex-shrink-0`,
|
|
3198
|
+
"aria-hidden": "true",
|
|
3199
|
+
children: variantConfig?.icon ? /* @__PURE__ */ jsx(
|
|
3200
|
+
variantConfig.icon,
|
|
1198
3201
|
{
|
|
1199
|
-
className: "
|
|
1200
|
-
"aria-
|
|
1201
|
-
children: message
|
|
3202
|
+
className: "w-full h-full",
|
|
3203
|
+
"aria-hidden": "true"
|
|
1202
3204
|
}
|
|
1203
|
-
) })
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
};
|
|
1208
|
-
|
|
1209
|
-
|
|
3205
|
+
) : IconComponent ? /* @__PURE__ */ jsx(IconComponent, { className: "w-full h-full", "aria-hidden": "true" }) : null
|
|
3206
|
+
}
|
|
3207
|
+
),
|
|
3208
|
+
!iconOnly && (restProps.children ? restProps.children : (variantConfig?.label || label) && /* @__PURE__ */ jsx("span", { className: "flex items-center", children: variantConfig?.label || label }))
|
|
3209
|
+
] });
|
|
3210
|
+
const accessibleLabel = title || (iconOnly ? variantConfig?.label || label : void 0);
|
|
3211
|
+
const buttonAriaLabel = iconOnly && !accessibleLabel ? variantConfig?.label || label || "Action button" : accessibleLabel;
|
|
3212
|
+
const tooltipContent = title || (iconOnly ? variantConfig?.label || label : void 0);
|
|
3213
|
+
const buttonClassName = `
|
|
3214
|
+
|
|
3215
|
+
${terminalMode ? "btn-terminal" : `btn ${variantClass} ${paddingClasses3} ${heightClasses[size]} ${className} ${isDisabled ? "opacity-50 cursor-not-allowed" : ""}`}`;
|
|
3216
|
+
if (href) {
|
|
3217
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3218
|
+
/* @__PURE__ */ jsx(
|
|
3219
|
+
NextLink,
|
|
3220
|
+
{
|
|
3221
|
+
href,
|
|
3222
|
+
title: typeof title === "string" ? title : void 0,
|
|
3223
|
+
"aria-label": iconOnly ? typeof buttonAriaLabel === "string" ? buttonAriaLabel : void 0 : void 0,
|
|
3224
|
+
onClick: handleClick,
|
|
3225
|
+
className: buttonClassName,
|
|
3226
|
+
"data-tooltip-id": tooltipId,
|
|
3227
|
+
"aria-busy": loading || externalLoading ? "true" : void 0,
|
|
3228
|
+
...restProps,
|
|
3229
|
+
children: buttonContent
|
|
3230
|
+
}
|
|
3231
|
+
),
|
|
3232
|
+
tooltipId && /* @__PURE__ */ jsx(
|
|
3233
|
+
SharedTooltip,
|
|
3234
|
+
{
|
|
3235
|
+
id: tooltipId,
|
|
3236
|
+
place: tooltipPlace,
|
|
3237
|
+
offset: tooltipOffset,
|
|
3238
|
+
delayShow: tooltipDelayShow,
|
|
3239
|
+
delayHide: tooltipDelayHide,
|
|
3240
|
+
children: tooltipContent
|
|
3241
|
+
}
|
|
3242
|
+
)
|
|
3243
|
+
] });
|
|
3244
|
+
}
|
|
3245
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3246
|
+
/* @__PURE__ */ jsx(
|
|
3247
|
+
"button",
|
|
3248
|
+
{
|
|
3249
|
+
type,
|
|
3250
|
+
onClick: handleClick,
|
|
3251
|
+
title: typeof title === "string" ? title : void 0,
|
|
3252
|
+
"aria-label": iconOnly ? typeof buttonAriaLabel === "string" ? buttonAriaLabel : void 0 : void 0,
|
|
3253
|
+
className: buttonClassName,
|
|
3254
|
+
"data-tooltip-id": tooltipId,
|
|
3255
|
+
"aria-busy": loading || externalLoading ? "true" : void 0,
|
|
3256
|
+
...restProps,
|
|
3257
|
+
disabled: isDisabled,
|
|
3258
|
+
children: buttonContent
|
|
3259
|
+
}
|
|
3260
|
+
),
|
|
3261
|
+
tooltipId && /* @__PURE__ */ jsx(
|
|
3262
|
+
SharedTooltip,
|
|
3263
|
+
{
|
|
3264
|
+
id: tooltipId,
|
|
3265
|
+
place: tooltipPlace,
|
|
3266
|
+
offset: tooltipOffset,
|
|
3267
|
+
delayShow: tooltipDelayShow,
|
|
3268
|
+
delayHide: tooltipDelayHide,
|
|
3269
|
+
children: tooltipContent
|
|
3270
|
+
}
|
|
3271
|
+
)
|
|
3272
|
+
] });
|
|
3273
|
+
}
|
|
3274
|
+
function SearchCard({
|
|
3275
|
+
title,
|
|
3276
|
+
count,
|
|
3277
|
+
total,
|
|
3278
|
+
actionButton,
|
|
3279
|
+
children,
|
|
3280
|
+
className = "",
|
|
1210
3281
|
icon: Icon,
|
|
3282
|
+
description
|
|
3283
|
+
}) {
|
|
3284
|
+
return /* @__PURE__ */ jsxs("div", { className: `card p-4 lg:p-6 ${className}`, children: [
|
|
3285
|
+
/* @__PURE__ */ jsx(
|
|
3286
|
+
SearchCardHeader,
|
|
3287
|
+
{
|
|
3288
|
+
title,
|
|
3289
|
+
count,
|
|
3290
|
+
total,
|
|
3291
|
+
actionButton,
|
|
3292
|
+
icon: Icon,
|
|
3293
|
+
description
|
|
3294
|
+
}
|
|
3295
|
+
),
|
|
3296
|
+
/* @__PURE__ */ jsx(SearchCardContent, { children })
|
|
3297
|
+
] });
|
|
3298
|
+
}
|
|
3299
|
+
function SearchCardHeader({
|
|
1211
3300
|
title,
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
3301
|
+
count,
|
|
3302
|
+
total,
|
|
3303
|
+
actionButton,
|
|
3304
|
+
icon: Icon,
|
|
3305
|
+
description
|
|
1215
3306
|
}) {
|
|
1216
|
-
return /* @__PURE__ */
|
|
1217
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3", children: [
|
|
1218
|
-
Icon && /* @__PURE__ */ jsx(Icon, { className: "w-6 h-6 lg:w-8 lg:h-8 flex-shrink-0" }),
|
|
3307
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4 mb-6", children: [
|
|
3308
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3 min-w-0 flex-1", children: [
|
|
3309
|
+
Icon && /* @__PURE__ */ jsx(Icon, { className: "w-6 h-6 lg:w-8 lg:h-8 text-foreground flex-shrink-0" }),
|
|
1219
3310
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
1220
|
-
/* @__PURE__ */ jsx("
|
|
1221
|
-
|
|
3311
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg lg:text-2xl font-bold truncate", children: title }),
|
|
3312
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground hidden md:block", children: description }),
|
|
3313
|
+
/* @__PURE__ */ jsxs("p", { className: "mt-1 lg:mt-2 text-xs text-secondary-foreground", children: [
|
|
3314
|
+
count,
|
|
3315
|
+
" of ",
|
|
3316
|
+
total,
|
|
3317
|
+
" ",
|
|
3318
|
+
title.toLowerCase()
|
|
3319
|
+
] })
|
|
1222
3320
|
] })
|
|
1223
3321
|
] }),
|
|
1224
|
-
|
|
1225
|
-
] })
|
|
3322
|
+
actionButton && /* @__PURE__ */ jsx("div", { className: "flex flex-row gap-2 lg:gap-3 flex-shrink-0", children: actionButton })
|
|
3323
|
+
] });
|
|
1226
3324
|
}
|
|
1227
|
-
function
|
|
1228
|
-
title,
|
|
1229
|
-
description,
|
|
3325
|
+
function SearchCardContent({
|
|
1230
3326
|
children,
|
|
1231
3327
|
className = ""
|
|
1232
3328
|
}) {
|
|
3329
|
+
return /* @__PURE__ */ jsx("div", { className, children });
|
|
3330
|
+
}
|
|
3331
|
+
function SearchInput({
|
|
3332
|
+
placeholder,
|
|
3333
|
+
value,
|
|
3334
|
+
onChange,
|
|
3335
|
+
className = ""
|
|
3336
|
+
}) {
|
|
3337
|
+
return /* @__PURE__ */ jsx("div", { className: `flex-1 ${className}`, children: /* @__PURE__ */ jsx(
|
|
3338
|
+
FormInput,
|
|
3339
|
+
{
|
|
3340
|
+
label: "",
|
|
3341
|
+
name: "search",
|
|
3342
|
+
type: "text",
|
|
3343
|
+
value,
|
|
3344
|
+
onChange: (e) => onChange(e.target.value),
|
|
3345
|
+
placeholder,
|
|
3346
|
+
icon: {
|
|
3347
|
+
left: /* @__PURE__ */ jsx(RiSearchLine, { className: "w-4 h-4 text-muted-foreground" })
|
|
3348
|
+
},
|
|
3349
|
+
className: "mb-0"
|
|
3350
|
+
}
|
|
3351
|
+
) });
|
|
3352
|
+
}
|
|
3353
|
+
function FilterSelect({
|
|
3354
|
+
value,
|
|
3355
|
+
onChange,
|
|
3356
|
+
options,
|
|
3357
|
+
placeholder,
|
|
3358
|
+
className = "",
|
|
3359
|
+
multiple = false,
|
|
3360
|
+
searchable = true
|
|
3361
|
+
}) {
|
|
3362
|
+
return /* @__PURE__ */ jsx(
|
|
3363
|
+
SmartSelect,
|
|
3364
|
+
{
|
|
3365
|
+
value,
|
|
3366
|
+
onChange,
|
|
3367
|
+
options,
|
|
3368
|
+
placeholder,
|
|
3369
|
+
className: `form-input form-input-md ${className}`,
|
|
3370
|
+
keepOpen: multiple,
|
|
3371
|
+
multiple,
|
|
3372
|
+
searchable
|
|
3373
|
+
}
|
|
3374
|
+
);
|
|
3375
|
+
}
|
|
3376
|
+
function RefreshButton({
|
|
3377
|
+
onClick,
|
|
3378
|
+
isLoading = false,
|
|
3379
|
+
className = ""
|
|
3380
|
+
}) {
|
|
3381
|
+
return /* @__PURE__ */ jsx(
|
|
3382
|
+
ActionButton,
|
|
3383
|
+
{
|
|
3384
|
+
icon: RiRefreshLine,
|
|
3385
|
+
onClick,
|
|
3386
|
+
disabled: isLoading,
|
|
3387
|
+
loading: isLoading,
|
|
3388
|
+
iconOnly: true,
|
|
3389
|
+
size: "md",
|
|
3390
|
+
variant: "secondary",
|
|
3391
|
+
tooltipId: "refresh-button-tooltip",
|
|
3392
|
+
title: "Refresh",
|
|
3393
|
+
tooltipPlace: "top",
|
|
3394
|
+
className: `btn-alt ${className}`
|
|
3395
|
+
}
|
|
3396
|
+
);
|
|
3397
|
+
}
|
|
3398
|
+
function FilterToggleButton({
|
|
3399
|
+
isOpen,
|
|
3400
|
+
onClick,
|
|
3401
|
+
onClear,
|
|
3402
|
+
activeCount = 0,
|
|
3403
|
+
className = ""
|
|
3404
|
+
}) {
|
|
3405
|
+
const tooltipText = activeCount > 0 ? `${activeCount} filter${activeCount === 1 ? "" : "s"} active` : "Filters";
|
|
3406
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3407
|
+
/* @__PURE__ */ jsx(
|
|
3408
|
+
IconButtonWithCount,
|
|
3409
|
+
{
|
|
3410
|
+
icon: /* @__PURE__ */ jsx(RiFilterLine, { className: "w-4 h-4" }),
|
|
3411
|
+
label: "Filters",
|
|
3412
|
+
count: activeCount,
|
|
3413
|
+
onClick,
|
|
3414
|
+
onClear,
|
|
3415
|
+
className,
|
|
3416
|
+
tooltipId: "filter-button-tooltip",
|
|
3417
|
+
tooltipContent: tooltipText,
|
|
3418
|
+
clearTooltipId: "clear-filters-tooltip",
|
|
3419
|
+
clearTooltipContent: "Clear all filters"
|
|
3420
|
+
}
|
|
3421
|
+
),
|
|
3422
|
+
/* @__PURE__ */ jsx(SharedTooltip, { id: "filter-button-tooltip" })
|
|
3423
|
+
] });
|
|
3424
|
+
}
|
|
3425
|
+
function MobileSearchLayout({
|
|
3426
|
+
searchInput,
|
|
3427
|
+
filters,
|
|
3428
|
+
viewControls,
|
|
3429
|
+
activeFilterCount = 0,
|
|
3430
|
+
onClearFilters,
|
|
3431
|
+
className = "",
|
|
3432
|
+
filterInline = false,
|
|
3433
|
+
searchButton
|
|
3434
|
+
}) {
|
|
3435
|
+
const [showFilters, setShowFilters] = useState(false);
|
|
3436
|
+
if (filterInline) {
|
|
3437
|
+
return /* @__PURE__ */ jsxs("div", { className: `space-y-4 ${className}`, children: [
|
|
3438
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
3439
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: searchInput }),
|
|
3440
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
3441
|
+
/* @__PURE__ */ jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ jsx(
|
|
3442
|
+
SmartDropdown,
|
|
3443
|
+
{
|
|
3444
|
+
isOpen: showFilters,
|
|
3445
|
+
onClose: () => setShowFilters(false),
|
|
3446
|
+
width: 600,
|
|
3447
|
+
maxHeight: 320,
|
|
3448
|
+
trigger: /* @__PURE__ */ jsx(
|
|
3449
|
+
FilterToggleButton,
|
|
3450
|
+
{
|
|
3451
|
+
isOpen: showFilters,
|
|
3452
|
+
onClick: () => setShowFilters(!showFilters),
|
|
3453
|
+
activeCount: activeFilterCount,
|
|
3454
|
+
onClear: onClearFilters
|
|
3455
|
+
}
|
|
3456
|
+
),
|
|
3457
|
+
children: /* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: filters }) }) })
|
|
3458
|
+
}
|
|
3459
|
+
) }),
|
|
3460
|
+
viewControls && viewControls
|
|
3461
|
+
] })
|
|
3462
|
+
] }),
|
|
3463
|
+
/* @__PURE__ */ jsxs("div", { className: "hidden lg:flex lg:flex-col lg:gap-3", children: [
|
|
3464
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col lg:flex-row gap-3", children: filters }),
|
|
3465
|
+
searchButton && /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: searchButton })
|
|
3466
|
+
] }),
|
|
3467
|
+
/* @__PURE__ */ jsx(SharedTooltip, { id: "clear-filters-tooltip" })
|
|
3468
|
+
] });
|
|
3469
|
+
}
|
|
1233
3470
|
return /* @__PURE__ */ jsxs("div", { className: `space-y-4 ${className}`, children: [
|
|
1234
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1235
|
-
/* @__PURE__ */ jsx("
|
|
1236
|
-
|
|
3471
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
3472
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: searchInput }),
|
|
3473
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
3474
|
+
/* @__PURE__ */ jsx(
|
|
3475
|
+
SmartDropdown,
|
|
3476
|
+
{
|
|
3477
|
+
isOpen: showFilters,
|
|
3478
|
+
onClose: () => setShowFilters(false),
|
|
3479
|
+
width: 600,
|
|
3480
|
+
maxHeight: 320,
|
|
3481
|
+
trigger: /* @__PURE__ */ jsx(
|
|
3482
|
+
FilterToggleButton,
|
|
3483
|
+
{
|
|
3484
|
+
isOpen: showFilters,
|
|
3485
|
+
onClick: () => setShowFilters(!showFilters),
|
|
3486
|
+
activeCount: activeFilterCount,
|
|
3487
|
+
onClear: onClearFilters
|
|
3488
|
+
}
|
|
3489
|
+
),
|
|
3490
|
+
children: /* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: filters }) }) })
|
|
3491
|
+
}
|
|
3492
|
+
),
|
|
3493
|
+
viewControls && viewControls
|
|
3494
|
+
] })
|
|
1237
3495
|
] }),
|
|
1238
|
-
/* @__PURE__ */ jsx(
|
|
3496
|
+
/* @__PURE__ */ jsx(SharedTooltip, { id: "clear-filters-tooltip" })
|
|
1239
3497
|
] });
|
|
1240
3498
|
}
|
|
1241
|
-
function
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
gap = 4,
|
|
3499
|
+
function ViewToggle({
|
|
3500
|
+
currentView,
|
|
3501
|
+
onViewChange,
|
|
1245
3502
|
className = ""
|
|
1246
3503
|
}) {
|
|
1247
|
-
const
|
|
1248
|
-
|
|
1249
|
-
2: "grid-cols-1 md:grid-cols-2",
|
|
1250
|
-
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
|
|
1251
|
-
4: "grid-cols-1 md:grid-cols-2 lg:grid-cols-4",
|
|
1252
|
-
5: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5",
|
|
1253
|
-
6: "grid-cols-2 md:grid-cols-3 lg:grid-cols-6",
|
|
1254
|
-
12: "grid-cols-12"
|
|
1255
|
-
};
|
|
1256
|
-
const gapClasses = {
|
|
1257
|
-
1: "gap-1",
|
|
1258
|
-
2: "gap-2",
|
|
1259
|
-
3: "gap-3",
|
|
1260
|
-
4: "gap-4",
|
|
1261
|
-
6: "gap-6",
|
|
1262
|
-
8: "gap-8"
|
|
3504
|
+
const toggleView = () => {
|
|
3505
|
+
onViewChange(currentView === "cards" ? "list" : "cards");
|
|
1263
3506
|
};
|
|
1264
|
-
return /* @__PURE__ */ jsx(
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
3507
|
+
return /* @__PURE__ */ jsx(
|
|
3508
|
+
ActionButton,
|
|
3509
|
+
{
|
|
3510
|
+
icon: currentView === "cards" ? RiGridFill : RiListUnordered,
|
|
3511
|
+
onClick: toggleView,
|
|
3512
|
+
iconOnly: true,
|
|
3513
|
+
size: "md",
|
|
3514
|
+
variant: "secondary",
|
|
3515
|
+
tooltipId: "view-toggle-tooltip",
|
|
3516
|
+
title: currentView === "cards" ? "Switch to List View" : "Switch to Card View",
|
|
3517
|
+
tooltipPlace: "top",
|
|
3518
|
+
className: `btn-alt ${className}`
|
|
3519
|
+
}
|
|
3520
|
+
);
|
|
1272
3521
|
}
|
|
1273
3522
|
|
|
1274
|
-
|
|
3523
|
+
// src/index.ts
|
|
3524
|
+
var VERSION = "0.1.3";
|
|
3525
|
+
|
|
3526
|
+
export { ActionButton, Badge, Button_default as Button, Card, ConfirmDialog_default as ConfirmDialog, Container, DataTable, DataTableActions, DataTableBody, DataTableCell, DataTableEmptyState, DataTableHeader, DataTableHeaderCell, DataTableLoadingState, DataTableRow, EmptyState_default as EmptyState, FilterSelect, FilterToggleButton, FormInput, FormSection, Grid, IconButtonWithCount, InfoBox, Link_default as Link, LoadingSpinner_default as LoadingSpinner, MobileSearchLayout, Modal, PageHeader, RefreshButton, SearchCard, SearchCardContent, SearchCardHeader, SearchInput, SharedTooltip, Skeleton, SkeletonCard, SkeletonEnvironmentsList, SkeletonForm, SkeletonGameCard, SkeletonGameServerCard, SkeletonGameServerCards, SkeletonGameServerTable, SkeletonGamesTable, SkeletonItem, SkeletonList, SkeletonNodeCard, SkeletonNodeCards, SkeletonNodeTable, SkeletonRecentActivity, SkeletonSearchCard, SkeletonStats, SkeletonTable, SkeletonTenantCard, SkeletonUserCard, SmartDropdown, SmartSelect, Spinner_default as Spinner, StatusBadge, StickyActionsColumn, Switch, Typography, VERSION, ViewToggle, useConfirmDialog };
|
|
1275
3527
|
//# sourceMappingURL=index.mjs.map
|
|
1276
3528
|
//# sourceMappingURL=index.mjs.map
|