@underverse-ui/underverse 0.1.31 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1222 -1197
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.js +1133 -1108
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -613,583 +613,557 @@ var import_react3 = __toESM(require("react"), 1);
|
|
|
613
613
|
var import_next_intl = require("next-intl");
|
|
614
614
|
var import_lucide_react3 = require("lucide-react");
|
|
615
615
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
616
|
-
var Input = (0, import_react3.forwardRef)(
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
"text-foreground group-focus-within:text-primary",
|
|
747
|
-
|
|
616
|
+
var Input = (0, import_react3.forwardRef)(
|
|
617
|
+
({
|
|
618
|
+
label,
|
|
619
|
+
error,
|
|
620
|
+
description,
|
|
621
|
+
className,
|
|
622
|
+
required,
|
|
623
|
+
variant = "default",
|
|
624
|
+
size = "md",
|
|
625
|
+
leftIcon: LeftIcon,
|
|
626
|
+
rightIcon: RightIcon,
|
|
627
|
+
clearable = false,
|
|
628
|
+
loading: loading2 = false,
|
|
629
|
+
success = false,
|
|
630
|
+
onClear,
|
|
631
|
+
hint,
|
|
632
|
+
counter = false,
|
|
633
|
+
type = "text",
|
|
634
|
+
value,
|
|
635
|
+
maxLength,
|
|
636
|
+
...rest
|
|
637
|
+
}, ref) => {
|
|
638
|
+
const [localError, setLocalError] = (0, import_react3.useState)(error);
|
|
639
|
+
const [showPassword, setShowPassword] = (0, import_react3.useState)(false);
|
|
640
|
+
const [isFocused, setIsFocused] = (0, import_react3.useState)(false);
|
|
641
|
+
const tv = (0, import_next_intl.useTranslations)("ValidationInput");
|
|
642
|
+
const autoId = (0, import_react3.useId)();
|
|
643
|
+
const needsId = !!(label || description || hint || error);
|
|
644
|
+
const resolvedId = rest.id || (needsId ? `input-${autoId}` : void 0);
|
|
645
|
+
const errMsg = error || localError;
|
|
646
|
+
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
647
|
+
const charCount = typeof value === "string" ? value.length : 0;
|
|
648
|
+
const errorId = errMsg && resolvedId ? `${resolvedId}-error` : void 0;
|
|
649
|
+
const descId = !errMsg && (description || hint) && resolvedId ? `${resolvedId}-desc` : void 0;
|
|
650
|
+
const containerSpacing = size === "sm" ? "space-y-1.5" : "space-y-2";
|
|
651
|
+
const variantStyles6 = {
|
|
652
|
+
default: {
|
|
653
|
+
container: "bg-background border border-input hover:border-accent-foreground/20",
|
|
654
|
+
focus: "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background focus-visible:border-transparent",
|
|
655
|
+
error: "border-destructive focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-destructive focus-visible:ring-offset-1 focus-visible:ring-offset-background focus-visible:border-transparent"
|
|
656
|
+
},
|
|
657
|
+
filled: {
|
|
658
|
+
container: "bg-muted/50 border border-transparent hover:bg-muted/70",
|
|
659
|
+
focus: "focus-visible:outline-none focus-visible:bg-background focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background focus-visible:border-transparent",
|
|
660
|
+
error: "bg-destructive/10 border-destructive focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-destructive focus-visible:ring-offset-1 focus-visible:ring-offset-background focus-visible:border-transparent"
|
|
661
|
+
},
|
|
662
|
+
outlined: {
|
|
663
|
+
container: "bg-transparent border border-border hover:border-accent-foreground/30",
|
|
664
|
+
focus: "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background focus-visible:border-transparent",
|
|
665
|
+
error: "border-destructive focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-destructive focus-visible:ring-offset-1 focus-visible:ring-offset-background focus-visible:border-transparent"
|
|
666
|
+
},
|
|
667
|
+
minimal: {
|
|
668
|
+
container: "bg-transparent border-0 border-b border-border hover:border-accent-foreground/30",
|
|
669
|
+
focus: "focus-visible:outline-none focus-visible:border-ring focus-visible:ring-0 rounded-none",
|
|
670
|
+
error: "border-destructive focus-visible:outline-none focus-visible:border-destructive"
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
const sizeStyles8 = {
|
|
674
|
+
sm: {
|
|
675
|
+
input: "px-3 py-1.5 text-sm h-8 md:h-7 md:py-1 md:text-xs",
|
|
676
|
+
icon: "w-4 h-4",
|
|
677
|
+
button: "h-7 w-7"
|
|
678
|
+
},
|
|
679
|
+
md: {
|
|
680
|
+
input: "px-4 py-2 text-sm h-10",
|
|
681
|
+
icon: "w-5 h-5",
|
|
682
|
+
button: "h-8 w-8"
|
|
683
|
+
},
|
|
684
|
+
lg: {
|
|
685
|
+
input: "px-5 py-4 text-base h-12",
|
|
686
|
+
icon: "w-6 h-6",
|
|
687
|
+
button: "h-10 w-10"
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
const getErrorKey = (v) => {
|
|
691
|
+
if (v.valueMissing) return "required";
|
|
692
|
+
if (v.typeMismatch) return "typeMismatch";
|
|
693
|
+
if (v.patternMismatch) return "pattern";
|
|
694
|
+
if (v.tooShort) return "tooShort";
|
|
695
|
+
if (v.tooLong) return "tooLong";
|
|
696
|
+
if (v.rangeUnderflow) return "rangeUnderflow";
|
|
697
|
+
if (v.rangeOverflow) return "rangeOverflow";
|
|
698
|
+
if (v.stepMismatch) return "stepMismatch";
|
|
699
|
+
if (v.badInput) return "badInput";
|
|
700
|
+
return "invalid";
|
|
701
|
+
};
|
|
702
|
+
const getStatusIcon = () => {
|
|
703
|
+
if (loading2) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.Loader2, { className: cn("animate-spin text-muted-foreground", sizeStyles8[size].icon) });
|
|
704
|
+
if (success) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.CheckCircle, { className: cn("text-success", sizeStyles8[size].icon) });
|
|
705
|
+
if (errMsg) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.AlertCircle, { className: cn("text-destructive", sizeStyles8[size].icon) });
|
|
706
|
+
return null;
|
|
707
|
+
};
|
|
708
|
+
const showPasswordToggle = type === "password";
|
|
709
|
+
const actualType = showPasswordToggle && showPassword ? "text" : type;
|
|
710
|
+
const { onFocus: onFocusProp, onBlur: onBlurProp, disabled } = rest;
|
|
711
|
+
const {
|
|
712
|
+
label: _label,
|
|
713
|
+
error: _error,
|
|
714
|
+
description: _description,
|
|
715
|
+
variant: _variant,
|
|
716
|
+
size: _size,
|
|
717
|
+
leftIcon: _leftIcon,
|
|
718
|
+
rightIcon: _rightIcon,
|
|
719
|
+
clearable: _clearable,
|
|
720
|
+
loading: _loading,
|
|
721
|
+
success: _success,
|
|
722
|
+
onClear: _onClear,
|
|
723
|
+
hint: _hint,
|
|
724
|
+
counter: _counter,
|
|
725
|
+
...restInput
|
|
726
|
+
} = rest;
|
|
727
|
+
const handleFocus = (e) => {
|
|
728
|
+
setIsFocused(true);
|
|
729
|
+
onFocusProp?.(e);
|
|
730
|
+
};
|
|
731
|
+
const handleBlur = (e) => {
|
|
732
|
+
setIsFocused(false);
|
|
733
|
+
onBlurProp?.(e);
|
|
734
|
+
};
|
|
735
|
+
const radiusClass = size === "sm" ? "rounded-md" : "rounded-lg";
|
|
736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cn("w-full group", containerSpacing), children: [
|
|
737
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
738
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
739
|
+
"label",
|
|
740
|
+
{
|
|
741
|
+
className: cn(
|
|
742
|
+
// Label size follows input size
|
|
743
|
+
size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm",
|
|
744
|
+
"font-medium transition-colors duration-200",
|
|
745
|
+
// default color and highlight while any descendant focused
|
|
746
|
+
disabled ? "text-muted-foreground" : cn("text-foreground group-focus-within:text-primary", success && "text-primary"),
|
|
747
|
+
errMsg && "text-destructive"
|
|
748
748
|
),
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
counter && maxLength && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: cn(
|
|
758
|
-
"text-xs transition-colors duration-200",
|
|
759
|
-
charCount > maxLength * 0.9 ? "text-warning" : "text-muted-foreground",
|
|
760
|
-
charCount >= maxLength && "text-destructive"
|
|
761
|
-
), children: [
|
|
762
|
-
charCount,
|
|
763
|
-
"/",
|
|
764
|
-
maxLength
|
|
765
|
-
] })
|
|
766
|
-
] }),
|
|
767
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative group", children: [
|
|
768
|
-
LeftIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: cn(
|
|
769
|
-
"absolute left-3 top-1/2 -translate-y-1/2 z-10",
|
|
770
|
-
"text-muted-foreground transition-colors duration-200",
|
|
771
|
-
// highlight icon when input (or controls) focused
|
|
772
|
-
"group-focus-within:text-primary"
|
|
773
|
-
), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LeftIcon, { className: sizeStyles8[size].icon }) }),
|
|
774
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
775
|
-
"input",
|
|
776
|
-
{
|
|
777
|
-
ref,
|
|
778
|
-
type: actualType,
|
|
779
|
-
...value !== void 0 ? { value } : {},
|
|
780
|
-
maxLength,
|
|
781
|
-
required,
|
|
782
|
-
id: resolvedId,
|
|
783
|
-
autoComplete: type === "password" ? "current-password" : type === "email" ? "email" : rest.autoComplete,
|
|
784
|
-
onFocus: handleFocus,
|
|
785
|
-
onBlur: handleBlur,
|
|
786
|
-
onInvalid: (e) => {
|
|
787
|
-
e.preventDefault();
|
|
788
|
-
const key = getErrorKey(e.currentTarget.validity);
|
|
789
|
-
setLocalError(tv(key));
|
|
790
|
-
},
|
|
791
|
-
onInput: () => setLocalError(void 0),
|
|
792
|
-
"aria-invalid": !!errMsg,
|
|
793
|
-
"aria-describedby": [errorId, descId].filter(Boolean).join(" ") || void 0,
|
|
794
|
-
className: cn(
|
|
795
|
-
"w-full text-foreground transition-all duration-200 ease-out",
|
|
796
|
-
"placeholder:text-muted-foreground focus:outline-none focus-visible:outline-none",
|
|
797
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
798
|
-
// Size styles
|
|
799
|
-
sizeStyles8[size].input,
|
|
800
|
-
radiusClass,
|
|
801
|
-
// Icon padding adjustments
|
|
802
|
-
LeftIcon && "pl-10",
|
|
803
|
-
(RightIcon || showPasswordToggle || clearable || loading2 || success || errMsg) && "pr-10",
|
|
804
|
-
// Variant styles
|
|
805
|
-
variantStyles6[variant].container,
|
|
806
|
-
errMsg ? variantStyles6[variant].error : variantStyles6[variant].focus,
|
|
807
|
-
// Reduce visual weight for sm: no default drop shadows
|
|
808
|
-
size !== "sm" && variant !== "minimal" && "shadow-sm",
|
|
809
|
-
size !== "sm" && isFocused && "shadow-md",
|
|
810
|
-
className
|
|
811
|
-
),
|
|
812
|
-
disabled,
|
|
813
|
-
...restInput
|
|
814
|
-
}
|
|
815
|
-
),
|
|
816
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1", children: [
|
|
817
|
-
getStatusIcon(),
|
|
818
|
-
RightIcon && !loading2 && !success && !errMsg && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RightIcon, { className: cn("text-muted-foreground", sizeStyles8[size].icon) }),
|
|
819
|
-
clearable && hasValue && !loading2 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
820
|
-
"button",
|
|
749
|
+
children: [
|
|
750
|
+
label,
|
|
751
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-destructive ml-1", children: "*" })
|
|
752
|
+
]
|
|
753
|
+
}
|
|
754
|
+
),
|
|
755
|
+
counter && maxLength && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
756
|
+
"span",
|
|
821
757
|
{
|
|
822
|
-
type: "button",
|
|
823
|
-
onClick: () => {
|
|
824
|
-
if (onClear) return onClear();
|
|
825
|
-
rest.onChange?.({ target: { value: "" } });
|
|
826
|
-
},
|
|
827
758
|
className: cn(
|
|
828
|
-
"
|
|
829
|
-
"
|
|
830
|
-
"
|
|
831
|
-
sizeStyles8[size].button
|
|
759
|
+
"text-xs transition-colors duration-200",
|
|
760
|
+
charCount > maxLength * 0.9 ? "text-warning" : "text-muted-foreground",
|
|
761
|
+
charCount >= maxLength && "text-destructive"
|
|
832
762
|
),
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
763
|
+
children: [
|
|
764
|
+
charCount,
|
|
765
|
+
"/",
|
|
766
|
+
maxLength
|
|
767
|
+
]
|
|
768
|
+
}
|
|
769
|
+
)
|
|
770
|
+
] }),
|
|
771
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative group", children: [
|
|
772
|
+
LeftIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
773
|
+
"div",
|
|
774
|
+
{
|
|
775
|
+
className: cn(
|
|
776
|
+
"absolute left-3 top-1/2 -translate-y-1/2 z-10",
|
|
777
|
+
"text-muted-foreground transition-colors duration-200",
|
|
778
|
+
// highlight icon when input (or controls) focused
|
|
779
|
+
"group-focus-within:text-primary"
|
|
780
|
+
),
|
|
781
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LeftIcon, { className: sizeStyles8[size].icon })
|
|
836
782
|
}
|
|
837
783
|
),
|
|
838
|
-
|
|
839
|
-
"
|
|
784
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
785
|
+
"input",
|
|
840
786
|
{
|
|
841
|
-
|
|
842
|
-
|
|
787
|
+
ref,
|
|
788
|
+
type: actualType,
|
|
789
|
+
...value !== void 0 ? { value } : {},
|
|
790
|
+
maxLength,
|
|
791
|
+
required,
|
|
792
|
+
id: resolvedId,
|
|
793
|
+
autoComplete: type === "password" ? "current-password" : type === "email" ? "email" : rest.autoComplete,
|
|
794
|
+
onFocus: handleFocus,
|
|
795
|
+
onBlur: handleBlur,
|
|
796
|
+
onInvalid: (e) => {
|
|
797
|
+
e.preventDefault();
|
|
798
|
+
const key = getErrorKey(e.currentTarget.validity);
|
|
799
|
+
setLocalError(tv(key));
|
|
800
|
+
},
|
|
801
|
+
onInput: () => setLocalError(void 0),
|
|
802
|
+
"aria-invalid": !!errMsg,
|
|
803
|
+
"aria-describedby": [errorId, descId].filter(Boolean).join(" ") || void 0,
|
|
843
804
|
className: cn(
|
|
844
|
-
"
|
|
845
|
-
"
|
|
846
|
-
"
|
|
847
|
-
|
|
805
|
+
"w-full text-foreground transition-all duration-200 ease-out",
|
|
806
|
+
"placeholder:text-muted-foreground focus:outline-none focus-visible:outline-none",
|
|
807
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
808
|
+
// Size styles
|
|
809
|
+
sizeStyles8[size].input,
|
|
810
|
+
radiusClass,
|
|
811
|
+
// Icon padding adjustments
|
|
812
|
+
LeftIcon && "pl-10",
|
|
813
|
+
(RightIcon || showPasswordToggle || clearable || loading2 || success || errMsg) && "pr-10",
|
|
814
|
+
// Variant styles
|
|
815
|
+
variantStyles6[variant].container,
|
|
816
|
+
errMsg ? variantStyles6[variant].error : variantStyles6[variant].focus,
|
|
817
|
+
// Reduce visual weight for sm: no default drop shadows
|
|
818
|
+
size !== "sm" && variant !== "minimal" && "shadow-sm",
|
|
819
|
+
size !== "sm" && isFocused && "shadow-md",
|
|
820
|
+
className
|
|
848
821
|
),
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
822
|
+
disabled,
|
|
823
|
+
...restInput
|
|
824
|
+
}
|
|
825
|
+
),
|
|
826
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1", children: [
|
|
827
|
+
getStatusIcon(),
|
|
828
|
+
RightIcon && !loading2 && !success && !errMsg && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RightIcon, { className: cn("text-muted-foreground", sizeStyles8[size].icon) }),
|
|
829
|
+
clearable && hasValue && !loading2 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
830
|
+
"button",
|
|
831
|
+
{
|
|
832
|
+
type: "button",
|
|
833
|
+
onClick: () => {
|
|
834
|
+
if (onClear) return onClear();
|
|
835
|
+
rest.onChange?.({ target: { value: "" } });
|
|
836
|
+
},
|
|
837
|
+
className: cn(
|
|
838
|
+
"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors rounded-sm",
|
|
839
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
|
|
840
|
+
"active:bg-accent active:text-accent-foreground",
|
|
841
|
+
sizeStyles8[size].button
|
|
842
|
+
),
|
|
843
|
+
tabIndex: 0,
|
|
844
|
+
"aria-label": "Clear input",
|
|
845
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.X, { className: sizeStyles8[size].icon })
|
|
846
|
+
}
|
|
847
|
+
),
|
|
848
|
+
showPasswordToggle && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
849
|
+
"button",
|
|
850
|
+
{
|
|
851
|
+
type: "button",
|
|
852
|
+
onClick: () => setShowPassword(!showPassword),
|
|
853
|
+
className: cn(
|
|
854
|
+
"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors rounded-full",
|
|
855
|
+
"focus:outline-none focus-visible:ring-1 focus-visible:ring-ring/40",
|
|
856
|
+
"active:bg-accent/50 active:text-accent-foreground",
|
|
857
|
+
sizeStyles8[size].button
|
|
858
|
+
),
|
|
859
|
+
tabIndex: 0,
|
|
860
|
+
"aria-label": showPassword ? "Hide password" : "Show password",
|
|
861
|
+
children: showPassword ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.EyeOff, { className: sizeStyles8[size].icon }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.Eye, { className: sizeStyles8[size].icon })
|
|
862
|
+
}
|
|
863
|
+
)
|
|
864
|
+
] }),
|
|
865
|
+
variant === "minimal" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
866
|
+
"div",
|
|
867
|
+
{
|
|
868
|
+
className: cn(
|
|
869
|
+
"absolute bottom-0 left-0 h-0.5 bg-gradient-to-r from-primary to-primary/60 transition-all duration-300",
|
|
870
|
+
// default hidden
|
|
871
|
+
"w-0 opacity-0",
|
|
872
|
+
// expand underline when focused within input container
|
|
873
|
+
"group-focus-within:w-full group-focus-within:opacity-100"
|
|
874
|
+
)
|
|
852
875
|
}
|
|
853
876
|
)
|
|
854
877
|
] }),
|
|
855
|
-
|
|
856
|
-
"
|
|
878
|
+
errMsg && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { id: errorId, className: "flex items-center gap-2 text-sm text-destructive animate-in slide-in-from-top-1 duration-200", children: [
|
|
879
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.AlertCircle, { className: "w-4 h-4 flex-shrink-0" }),
|
|
880
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: errMsg })
|
|
881
|
+
] }),
|
|
882
|
+
(description || hint) && !errMsg && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
883
|
+
"p",
|
|
857
884
|
{
|
|
885
|
+
id: descId,
|
|
858
886
|
className: cn(
|
|
859
|
-
"
|
|
860
|
-
//
|
|
861
|
-
"
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
)
|
|
887
|
+
"text-xs transition-colors duration-200",
|
|
888
|
+
// follow focus state of the whole field area
|
|
889
|
+
"text-muted-foreground group-focus-within:text-primary/70"
|
|
890
|
+
),
|
|
891
|
+
children: hint || description
|
|
865
892
|
}
|
|
866
893
|
)
|
|
867
|
-
] })
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: errMsg })
|
|
871
|
-
] }),
|
|
872
|
-
(description || hint) && !errMsg && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { id: descId, className: cn(
|
|
873
|
-
"text-xs transition-colors duration-200",
|
|
874
|
-
// follow focus state of the whole field area
|
|
875
|
-
"text-muted-foreground group-focus-within:text-primary/70"
|
|
876
|
-
), children: hint || description })
|
|
877
|
-
] });
|
|
878
|
-
});
|
|
894
|
+
] });
|
|
895
|
+
}
|
|
896
|
+
);
|
|
879
897
|
Input.displayName = "Input";
|
|
880
|
-
var SearchInput = (0, import_react3.forwardRef)(
|
|
881
|
-
onSearch,
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
}, searchDelay);
|
|
892
|
-
return () => clearTimeout(timer);
|
|
893
|
-
}, [searchValue, onSearch, searchDelay]);
|
|
894
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
895
|
-
Input,
|
|
896
|
-
{
|
|
897
|
-
ref,
|
|
898
|
-
type: "search",
|
|
899
|
-
leftIcon: import_lucide_react3.Search,
|
|
900
|
-
placeholder,
|
|
901
|
-
clearable: true,
|
|
902
|
-
value: searchValue,
|
|
903
|
-
onChange: (e) => setSearchValue(e.target.value),
|
|
904
|
-
onClear: () => setSearchValue(""),
|
|
905
|
-
...props
|
|
906
|
-
}
|
|
907
|
-
);
|
|
908
|
-
});
|
|
909
|
-
SearchInput.displayName = "SearchInput";
|
|
910
|
-
var PasswordInput = (0, import_react3.forwardRef)(({
|
|
911
|
-
showStrength = false,
|
|
912
|
-
strengthLabels = ["Weak", "Fair", "Good", "Strong"],
|
|
913
|
-
...props
|
|
914
|
-
}, ref) => {
|
|
915
|
-
const getPasswordStrength = (password) => {
|
|
916
|
-
let score = 0;
|
|
917
|
-
if (password.length >= 8) score++;
|
|
918
|
-
if (/[a-z]/.test(password)) score++;
|
|
919
|
-
if (/[A-Z]/.test(password)) score++;
|
|
920
|
-
if (/[0-9]/.test(password)) score++;
|
|
921
|
-
if (/[^A-Za-z0-9]/.test(password)) score++;
|
|
922
|
-
return Math.min(score, 4);
|
|
923
|
-
};
|
|
924
|
-
const strength = showStrength && typeof props.value === "string" ? getPasswordStrength(props.value) : 0;
|
|
925
|
-
const strengthColors = ["bg-destructive", "bg-warning", "bg-warning", "bg-success"];
|
|
926
|
-
const strengthLabel = strengthLabels[strength - 1];
|
|
927
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-2", children: [
|
|
928
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Input, { ref, type: "password", ...props }),
|
|
929
|
-
showStrength && props.value && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1", children: [
|
|
930
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex gap-1", children: [1, 2, 3, 4].map((level) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
931
|
-
"div",
|
|
932
|
-
{
|
|
933
|
-
className: cn(
|
|
934
|
-
"h-1 flex-1 rounded-full transition-colors duration-300",
|
|
935
|
-
level <= strength ? strengthColors[strength - 1] : "bg-muted"
|
|
936
|
-
)
|
|
937
|
-
},
|
|
938
|
-
level
|
|
939
|
-
)) }),
|
|
940
|
-
strengthLabel && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: cn(
|
|
941
|
-
"text-xs font-medium",
|
|
942
|
-
strength <= 1 ? "text-destructive" : strength <= 2 ? "text-warning" : strength <= 3 ? "text-warning" : "text-success"
|
|
943
|
-
), children: strengthLabel })
|
|
944
|
-
] })
|
|
945
|
-
] });
|
|
946
|
-
});
|
|
947
|
-
PasswordInput.displayName = "PasswordInput";
|
|
948
|
-
var NumberInput = (0, import_react3.forwardRef)(({
|
|
949
|
-
min,
|
|
950
|
-
max,
|
|
951
|
-
step = 1,
|
|
952
|
-
showSteppers = true,
|
|
953
|
-
onIncrement,
|
|
954
|
-
onDecrement,
|
|
955
|
-
formatThousands = false,
|
|
956
|
-
locale = "vi-VN",
|
|
957
|
-
value,
|
|
958
|
-
onChange,
|
|
959
|
-
...props
|
|
960
|
-
}, ref) => {
|
|
961
|
-
const toNumber = (v) => {
|
|
962
|
-
if (v === "" || v === void 0 || v === null) return 0;
|
|
963
|
-
const n = Number(v);
|
|
964
|
-
return Number.isFinite(n) ? n : 0;
|
|
965
|
-
};
|
|
966
|
-
const format = import_react3.default.useCallback(
|
|
967
|
-
(n) => new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }).format(n),
|
|
968
|
-
[locale]
|
|
969
|
-
);
|
|
970
|
-
const parse = (s) => {
|
|
971
|
-
const digits = (s || "").replace(/\D+/g, "");
|
|
972
|
-
return digits ? Number(digits) : NaN;
|
|
973
|
-
};
|
|
974
|
-
const [displayValue, setDisplayValue] = import_react3.default.useState(
|
|
975
|
-
formatThousands ? value !== void 0 && value !== null && value !== "" ? format(toNumber(value)) : "" : String(value ?? "")
|
|
976
|
-
);
|
|
977
|
-
const currentValue = toNumber(value);
|
|
978
|
-
import_react3.default.useEffect(() => {
|
|
979
|
-
if (formatThousands) {
|
|
980
|
-
const next = value === "" || value === void 0 || value === null ? "" : format(toNumber(value));
|
|
981
|
-
setDisplayValue((prev) => prev === next ? prev : next);
|
|
982
|
-
} else {
|
|
983
|
-
const next = String(value ?? "");
|
|
984
|
-
setDisplayValue((prev) => prev === next ? prev : next);
|
|
985
|
-
}
|
|
986
|
-
}, [value, formatThousands, locale, format]);
|
|
987
|
-
const handleIncrement = () => {
|
|
988
|
-
if (onIncrement) {
|
|
989
|
-
onIncrement();
|
|
990
|
-
} else if (onChange) {
|
|
991
|
-
const newValue = Math.min(currentValue + step, max ?? Infinity);
|
|
992
|
-
if (formatThousands) setDisplayValue(format(newValue));
|
|
993
|
-
onChange({ target: { value: newValue.toString() } });
|
|
994
|
-
}
|
|
995
|
-
};
|
|
996
|
-
const handleDecrement = () => {
|
|
997
|
-
if (onDecrement) {
|
|
998
|
-
onDecrement();
|
|
999
|
-
} else if (onChange) {
|
|
1000
|
-
const newValue = Math.max(currentValue - step, min ?? -Infinity);
|
|
1001
|
-
if (formatThousands) setDisplayValue(format(newValue));
|
|
1002
|
-
onChange({ target: { value: newValue.toString() } });
|
|
1003
|
-
}
|
|
1004
|
-
};
|
|
1005
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
|
|
1006
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
898
|
+
var SearchInput = (0, import_react3.forwardRef)(
|
|
899
|
+
({ onSearch, searchDelay = 300, placeholder = "Search...", ...props }, ref) => {
|
|
900
|
+
const [searchValue, setSearchValue] = (0, import_react3.useState)(props.value || "");
|
|
901
|
+
import_react3.default.useEffect(() => {
|
|
902
|
+
if (!onSearch) return;
|
|
903
|
+
const timer = setTimeout(() => {
|
|
904
|
+
onSearch(searchValue);
|
|
905
|
+
}, searchDelay);
|
|
906
|
+
return () => clearTimeout(timer);
|
|
907
|
+
}, [searchValue, onSearch, searchDelay]);
|
|
908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1007
909
|
Input,
|
|
1008
910
|
{
|
|
1009
911
|
ref,
|
|
1010
|
-
type:
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
912
|
+
type: "search",
|
|
913
|
+
leftIcon: import_lucide_react3.Search,
|
|
914
|
+
placeholder,
|
|
915
|
+
clearable: true,
|
|
916
|
+
value: searchValue,
|
|
917
|
+
onChange: (e) => setSearchValue(e.target.value),
|
|
918
|
+
onClear: () => setSearchValue(""),
|
|
919
|
+
...props
|
|
920
|
+
}
|
|
921
|
+
);
|
|
922
|
+
}
|
|
923
|
+
);
|
|
924
|
+
SearchInput.displayName = "SearchInput";
|
|
925
|
+
var PasswordInput = (0, import_react3.forwardRef)(
|
|
926
|
+
({ showStrength = false, strengthLabels = ["Weak", "Fair", "Good", "Strong"], ...props }, ref) => {
|
|
927
|
+
const getPasswordStrength = (password) => {
|
|
928
|
+
let score = 0;
|
|
929
|
+
if (password.length >= 8) score++;
|
|
930
|
+
if (/[a-z]/.test(password)) score++;
|
|
931
|
+
if (/[A-Z]/.test(password)) score++;
|
|
932
|
+
if (/[0-9]/.test(password)) score++;
|
|
933
|
+
if (/[^A-Za-z0-9]/.test(password)) score++;
|
|
934
|
+
return Math.min(score, 4);
|
|
935
|
+
};
|
|
936
|
+
const strength = showStrength && typeof props.value === "string" ? getPasswordStrength(props.value) : 0;
|
|
937
|
+
const strengthColors = ["bg-destructive", "bg-warning", "bg-warning", "bg-success"];
|
|
938
|
+
const strengthLabel = strengthLabels[strength - 1];
|
|
939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-2", children: [
|
|
940
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Input, { ref, type: "password", ...props }),
|
|
941
|
+
showStrength && props.value && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1", children: [
|
|
942
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex gap-1", children: [1, 2, 3, 4].map((level) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
943
|
+
"div",
|
|
944
|
+
{
|
|
945
|
+
className: cn(
|
|
946
|
+
"h-1 flex-1 rounded-full transition-colors duration-300",
|
|
947
|
+
level <= strength ? strengthColors[strength - 1] : "bg-muted"
|
|
948
|
+
)
|
|
949
|
+
},
|
|
950
|
+
level
|
|
951
|
+
)) }),
|
|
952
|
+
strengthLabel && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
953
|
+
"p",
|
|
954
|
+
{
|
|
955
|
+
className: cn(
|
|
956
|
+
"text-xs font-medium",
|
|
957
|
+
strength <= 1 ? "text-destructive" : strength <= 2 ? "text-warning" : strength <= 3 ? "text-warning" : "text-success"
|
|
958
|
+
),
|
|
959
|
+
children: strengthLabel
|
|
1028
960
|
}
|
|
1029
|
-
},
|
|
1030
|
-
...props,
|
|
1031
|
-
className: cn(
|
|
1032
|
-
showSteppers && [
|
|
1033
|
-
"pr-12",
|
|
1034
|
-
// Hide native browser steppers
|
|
1035
|
-
"[&::-webkit-outer-spin-button]:appearance-none",
|
|
1036
|
-
"[&::-webkit-inner-spin-button]:appearance-none",
|
|
1037
|
-
"[&::-webkit-inner-spin-button]:m-0",
|
|
1038
|
-
"appearance-none"
|
|
1039
|
-
],
|
|
1040
|
-
props.className
|
|
1041
961
|
)
|
|
962
|
+
] })
|
|
963
|
+
] });
|
|
964
|
+
}
|
|
965
|
+
);
|
|
966
|
+
PasswordInput.displayName = "PasswordInput";
|
|
967
|
+
var NumberInput = (0, import_react3.forwardRef)(
|
|
968
|
+
({ min, max, step = 1, showSteppers = true, onIncrement, onDecrement, formatThousands = false, locale = "vi-VN", value, onChange, ...props }, ref) => {
|
|
969
|
+
const toNumber = (v) => {
|
|
970
|
+
if (v === "" || v === void 0 || v === null) return 0;
|
|
971
|
+
const n = Number(v);
|
|
972
|
+
return Number.isFinite(n) ? n : 0;
|
|
973
|
+
};
|
|
974
|
+
const format = import_react3.default.useCallback((n) => new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }).format(n), [locale]);
|
|
975
|
+
const parse = (s) => {
|
|
976
|
+
const digits = (s || "").replace(/\D+/g, "");
|
|
977
|
+
return digits ? Number(digits) : NaN;
|
|
978
|
+
};
|
|
979
|
+
const [displayValue, setDisplayValue] = import_react3.default.useState(
|
|
980
|
+
formatThousands ? value !== void 0 && value !== null && value !== "" ? format(toNumber(value)) : "" : String(value ?? "")
|
|
981
|
+
);
|
|
982
|
+
const currentValue = toNumber(value);
|
|
983
|
+
import_react3.default.useEffect(() => {
|
|
984
|
+
if (formatThousands) {
|
|
985
|
+
const next = value === "" || value === void 0 || value === null ? "" : format(toNumber(value));
|
|
986
|
+
setDisplayValue((prev) => prev === next ? prev : next);
|
|
987
|
+
} else {
|
|
988
|
+
const next = String(value ?? "");
|
|
989
|
+
setDisplayValue((prev) => prev === next ? prev : next);
|
|
990
|
+
}
|
|
991
|
+
}, [value, formatThousands, locale, format]);
|
|
992
|
+
const handleIncrement = () => {
|
|
993
|
+
if (onIncrement) {
|
|
994
|
+
onIncrement();
|
|
995
|
+
} else if (onChange) {
|
|
996
|
+
const newValue = Math.min(currentValue + step, max ?? Infinity);
|
|
997
|
+
if (formatThousands) setDisplayValue(format(newValue));
|
|
998
|
+
onChange({ target: { value: newValue.toString() } });
|
|
1042
999
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1000
|
+
};
|
|
1001
|
+
const handleDecrement = () => {
|
|
1002
|
+
if (onDecrement) {
|
|
1003
|
+
onDecrement();
|
|
1004
|
+
} else if (onChange) {
|
|
1005
|
+
const newValue = Math.max(currentValue - step, min ?? -Infinity);
|
|
1006
|
+
if (formatThousands) setDisplayValue(format(newValue));
|
|
1007
|
+
onChange({ target: { value: newValue.toString() } });
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
|
|
1045
1011
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1046
|
-
|
|
1012
|
+
Input,
|
|
1047
1013
|
{
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
{
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
"path",
|
|
1068
|
-
{
|
|
1069
|
-
d: "M4 2L6 6H2L4 2Z",
|
|
1070
|
-
fill: "currentColor"
|
|
1071
|
-
}
|
|
1072
|
-
)
|
|
1014
|
+
ref,
|
|
1015
|
+
type: formatThousands ? "text" : "number",
|
|
1016
|
+
min,
|
|
1017
|
+
max,
|
|
1018
|
+
step,
|
|
1019
|
+
rightIcon: showSteppers ? void 0 : props.rightIcon,
|
|
1020
|
+
value: displayValue,
|
|
1021
|
+
onChange: (e) => {
|
|
1022
|
+
if (!onChange) return;
|
|
1023
|
+
if (!formatThousands) return onChange(e);
|
|
1024
|
+
const raw = e.target.value;
|
|
1025
|
+
const parsed = parse(raw);
|
|
1026
|
+
if (Number.isNaN(parsed)) {
|
|
1027
|
+
setDisplayValue("");
|
|
1028
|
+
onChange({ target: { value: "" } });
|
|
1029
|
+
} else {
|
|
1030
|
+
const bounded = Math.min(Math.max(parsed, min ?? -Infinity), max ?? Infinity);
|
|
1031
|
+
setDisplayValue(format(bounded));
|
|
1032
|
+
onChange({ target: { value: bounded.toString() } });
|
|
1073
1033
|
}
|
|
1034
|
+
},
|
|
1035
|
+
...props,
|
|
1036
|
+
className: cn(
|
|
1037
|
+
showSteppers && [
|
|
1038
|
+
"pr-12",
|
|
1039
|
+
// Hide native browser steppers
|
|
1040
|
+
"[&::-webkit-outer-spin-button]:appearance-none",
|
|
1041
|
+
"[&::-webkit-inner-spin-button]:appearance-none",
|
|
1042
|
+
"[&::-webkit-inner-spin-button]:m-0",
|
|
1043
|
+
"appearance-none"
|
|
1044
|
+
],
|
|
1045
|
+
props.className
|
|
1074
1046
|
)
|
|
1075
1047
|
}
|
|
1076
1048
|
),
|
|
1049
|
+
showSteppers && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "absolute right-2 top-1/2 -translate-y-1/2 flex flex-col gap-0.5", children: [
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1051
|
+
"button",
|
|
1052
|
+
{
|
|
1053
|
+
type: "button",
|
|
1054
|
+
onClick: handleIncrement,
|
|
1055
|
+
disabled: max !== void 0 && currentValue >= max,
|
|
1056
|
+
className: cn(
|
|
1057
|
+
"flex items-center justify-center w-4 h-4 rounded-sm transition-colors",
|
|
1058
|
+
"hover:bg-accent focus:outline-none focus:bg-accent",
|
|
1059
|
+
"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",
|
|
1060
|
+
"text-muted-foreground hover:text-foreground"
|
|
1061
|
+
),
|
|
1062
|
+
"aria-label": "Increase value",
|
|
1063
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M4 2L6 6H2L4 2Z", fill: "currentColor" }) })
|
|
1064
|
+
}
|
|
1065
|
+
),
|
|
1066
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1067
|
+
"button",
|
|
1068
|
+
{
|
|
1069
|
+
type: "button",
|
|
1070
|
+
onClick: handleDecrement,
|
|
1071
|
+
disabled: min !== void 0 && currentValue <= min,
|
|
1072
|
+
className: cn(
|
|
1073
|
+
"flex items-center justify-center w-4 h-4 rounded-sm transition-colors",
|
|
1074
|
+
"hover:bg-accent focus:outline-none focus:bg-accent",
|
|
1075
|
+
"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",
|
|
1076
|
+
"text-muted-foreground hover:text-foreground"
|
|
1077
|
+
),
|
|
1078
|
+
"aria-label": "Decrease value",
|
|
1079
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M4 6L2 2H6L4 6Z", fill: "currentColor" }) })
|
|
1080
|
+
}
|
|
1081
|
+
)
|
|
1082
|
+
] })
|
|
1083
|
+
] });
|
|
1084
|
+
}
|
|
1085
|
+
);
|
|
1086
|
+
NumberInput.displayName = "NumberInput";
|
|
1087
|
+
var Textarea = (0, import_react3.forwardRef)(
|
|
1088
|
+
({ label, error, description, variant = "default", resize = "vertical", counter = false, className, required, value, maxLength, ...props }, ref) => {
|
|
1089
|
+
const [isFocused, setIsFocused] = (0, import_react3.useState)(false);
|
|
1090
|
+
const charCount = typeof value === "string" ? value.length : 0;
|
|
1091
|
+
const variantStyles6 = {
|
|
1092
|
+
default: "bg-background border border-input hover:border-accent-foreground/20 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background focus-visible:border-transparent",
|
|
1093
|
+
filled: "bg-muted/50 border border-transparent hover:bg-muted/70 focus-visible:outline-none focus-visible:bg-background focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background focus-visible:border-transparent",
|
|
1094
|
+
outlined: "bg-transparent border border-border hover:border-accent-foreground/30 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background focus-visible:border-transparent",
|
|
1095
|
+
minimal: "bg-transparent border-0 border-b border-border hover:border-accent-foreground/30 focus-visible:outline-none focus-visible:border-ring focus-visible:ring-0 rounded-none"
|
|
1096
|
+
};
|
|
1097
|
+
const resizeClasses = {
|
|
1098
|
+
none: "resize-none",
|
|
1099
|
+
vertical: "resize-y",
|
|
1100
|
+
horizontal: "resize-x",
|
|
1101
|
+
both: "resize"
|
|
1102
|
+
};
|
|
1103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "w-full space-y-2", children: [
|
|
1104
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
1105
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1106
|
+
"label",
|
|
1107
|
+
{
|
|
1108
|
+
className: cn(
|
|
1109
|
+
"text-sm font-medium transition-colors duration-200",
|
|
1110
|
+
isFocused ? "text-primary" : "text-foreground",
|
|
1111
|
+
error && "text-destructive"
|
|
1112
|
+
),
|
|
1113
|
+
children: [
|
|
1114
|
+
label,
|
|
1115
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-destructive ml-1", children: "*" })
|
|
1116
|
+
]
|
|
1117
|
+
}
|
|
1118
|
+
),
|
|
1119
|
+
counter && maxLength && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1120
|
+
"span",
|
|
1121
|
+
{
|
|
1122
|
+
className: cn(
|
|
1123
|
+
"text-xs transition-colors duration-200",
|
|
1124
|
+
charCount > maxLength * 0.9 ? "text-warning" : "text-muted-foreground",
|
|
1125
|
+
charCount >= maxLength && "text-destructive"
|
|
1126
|
+
),
|
|
1127
|
+
children: [
|
|
1128
|
+
charCount,
|
|
1129
|
+
"/",
|
|
1130
|
+
maxLength
|
|
1131
|
+
]
|
|
1132
|
+
}
|
|
1133
|
+
)
|
|
1134
|
+
] }),
|
|
1077
1135
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1078
|
-
"
|
|
1136
|
+
"textarea",
|
|
1079
1137
|
{
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1138
|
+
ref,
|
|
1139
|
+
value,
|
|
1140
|
+
maxLength,
|
|
1141
|
+
required,
|
|
1142
|
+
onFocus: () => setIsFocused(true),
|
|
1143
|
+
onBlur: () => setIsFocused(false),
|
|
1083
1144
|
className: cn(
|
|
1084
|
-
"
|
|
1085
|
-
"
|
|
1086
|
-
"disabled:
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
"
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
d: "M4 6L2 2H6L4 6Z",
|
|
1102
|
-
fill: "currentColor"
|
|
1103
|
-
}
|
|
1104
|
-
)
|
|
1105
|
-
}
|
|
1106
|
-
)
|
|
1107
|
-
}
|
|
1108
|
-
)
|
|
1109
|
-
] })
|
|
1110
|
-
] });
|
|
1111
|
-
});
|
|
1112
|
-
NumberInput.displayName = "NumberInput";
|
|
1113
|
-
var Textarea = (0, import_react3.forwardRef)(({
|
|
1114
|
-
label,
|
|
1115
|
-
error,
|
|
1116
|
-
description,
|
|
1117
|
-
variant = "default",
|
|
1118
|
-
resize = "vertical",
|
|
1119
|
-
counter = false,
|
|
1120
|
-
className,
|
|
1121
|
-
required,
|
|
1122
|
-
value,
|
|
1123
|
-
maxLength,
|
|
1124
|
-
...props
|
|
1125
|
-
}, ref) => {
|
|
1126
|
-
const [isFocused, setIsFocused] = (0, import_react3.useState)(false);
|
|
1127
|
-
const charCount = typeof value === "string" ? value.length : 0;
|
|
1128
|
-
const variantStyles6 = {
|
|
1129
|
-
default: "bg-background border border-input hover:border-accent-foreground/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:border-transparent",
|
|
1130
|
-
filled: "bg-muted/50 border border-transparent hover:bg-muted/70 focus-visible:outline-none focus-visible:bg-background focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:border-transparent",
|
|
1131
|
-
outlined: "bg-transparent border border-border hover:border-accent-foreground/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:border-transparent",
|
|
1132
|
-
minimal: "bg-transparent border-0 border-b border-border hover:border-accent-foreground/30 focus-visible:outline-none focus-visible:border-ring focus-visible:ring-0 rounded-none"
|
|
1133
|
-
};
|
|
1134
|
-
const resizeClasses = {
|
|
1135
|
-
none: "resize-none",
|
|
1136
|
-
vertical: "resize-y",
|
|
1137
|
-
horizontal: "resize-x",
|
|
1138
|
-
both: "resize"
|
|
1139
|
-
};
|
|
1140
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "w-full space-y-2", children: [
|
|
1141
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
1142
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: cn(
|
|
1143
|
-
"text-sm font-medium transition-colors duration-200",
|
|
1144
|
-
isFocused ? "text-primary" : "text-foreground",
|
|
1145
|
-
error && "text-destructive"
|
|
1146
|
-
), children: [
|
|
1147
|
-
label,
|
|
1148
|
-
required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-destructive ml-1", children: "*" })
|
|
1145
|
+
"w-full rounded-lg px-4 py-3 text-sm text-foreground transition-all duration-200",
|
|
1146
|
+
"placeholder:text-muted-foreground focus:outline-none min-h-[80px]",
|
|
1147
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
1148
|
+
variantStyles6[variant],
|
|
1149
|
+
// DÒNG NÀY ĐÃ ĐƯỢC CẬP NHẬT:
|
|
1150
|
+
error && "border-destructive focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-destructive focus-visible:ring-offset-1 focus-visible:ring-offset-background focus-visible:border-transparent",
|
|
1151
|
+
resizeClasses[resize],
|
|
1152
|
+
isFocused && "shadow-md",
|
|
1153
|
+
variant !== "minimal" && "shadow-sm",
|
|
1154
|
+
className
|
|
1155
|
+
),
|
|
1156
|
+
...props
|
|
1157
|
+
}
|
|
1158
|
+
),
|
|
1159
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2 text-sm text-destructive animate-in slide-in-from-top-1 duration-200", children: [
|
|
1160
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.AlertCircle, { className: "w-4 h-4 flex-shrink-0" }),
|
|
1161
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: error })
|
|
1149
1162
|
] }),
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
), children: [
|
|
1155
|
-
charCount,
|
|
1156
|
-
"/",
|
|
1157
|
-
maxLength
|
|
1158
|
-
] })
|
|
1159
|
-
] }),
|
|
1160
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1161
|
-
"textarea",
|
|
1162
|
-
{
|
|
1163
|
-
ref,
|
|
1164
|
-
value,
|
|
1165
|
-
maxLength,
|
|
1166
|
-
required,
|
|
1167
|
-
onFocus: () => setIsFocused(true),
|
|
1168
|
-
onBlur: () => setIsFocused(false),
|
|
1169
|
-
className: cn(
|
|
1170
|
-
"w-full rounded-lg px-4 py-3 text-sm text-foreground transition-all duration-200",
|
|
1171
|
-
"placeholder:text-muted-foreground focus:outline-none min-h-[80px]",
|
|
1172
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
1173
|
-
variantStyles6[variant],
|
|
1174
|
-
error && "border-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:border-transparent",
|
|
1175
|
-
resizeClasses[resize],
|
|
1176
|
-
isFocused && "shadow-md",
|
|
1177
|
-
variant !== "minimal" && "shadow-sm",
|
|
1178
|
-
className
|
|
1179
|
-
),
|
|
1180
|
-
...props
|
|
1181
|
-
}
|
|
1182
|
-
),
|
|
1183
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2 text-sm text-destructive animate-in slide-in-from-top-1 duration-200", children: [
|
|
1184
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.AlertCircle, { className: "w-4 h-4 flex-shrink-0" }),
|
|
1185
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: error })
|
|
1186
|
-
] }),
|
|
1187
|
-
description && !error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: cn(
|
|
1188
|
-
"text-xs transition-colors duration-200",
|
|
1189
|
-
isFocused ? "text-primary/70" : "text-muted-foreground"
|
|
1190
|
-
), children: description })
|
|
1191
|
-
] });
|
|
1192
|
-
});
|
|
1163
|
+
description && !error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: cn("text-xs transition-colors duration-200", isFocused ? "text-primary/70" : "text-muted-foreground"), children: description })
|
|
1164
|
+
] });
|
|
1165
|
+
}
|
|
1166
|
+
);
|
|
1193
1167
|
Textarea.displayName = "Textarea";
|
|
1194
1168
|
var Input_default = Input;
|
|
1195
1169
|
|
|
@@ -1459,36 +1433,125 @@ var Label = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
1459
1433
|
));
|
|
1460
1434
|
Label.displayName = "Label";
|
|
1461
1435
|
|
|
1462
|
-
// ../../components/ui/
|
|
1463
|
-
var
|
|
1436
|
+
// ../../components/ui/SmartImage.tsx
|
|
1437
|
+
var import_image = __toESM(require("next/image"), 1);
|
|
1438
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
1464
1439
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1440
|
+
var DEFAULT_FALLBACK = "/images/products/hoa-hong-do.png";
|
|
1441
|
+
var FAILED_SRCS = /* @__PURE__ */ new Set();
|
|
1442
|
+
function SmartImage({
|
|
1443
|
+
src,
|
|
1444
|
+
alt,
|
|
1445
|
+
className,
|
|
1446
|
+
ratioClass,
|
|
1447
|
+
roundedClass = "rounded-lg",
|
|
1448
|
+
fill = true,
|
|
1449
|
+
width,
|
|
1450
|
+
height,
|
|
1451
|
+
sizes = "(max-width: 768px) 100vw, 33vw",
|
|
1452
|
+
priority = false,
|
|
1453
|
+
quality = 80,
|
|
1454
|
+
fit = "cover",
|
|
1455
|
+
objectPosition,
|
|
1456
|
+
fallbackSrc = DEFAULT_FALLBACK
|
|
1457
|
+
}) {
|
|
1458
|
+
const normalize = (input) => {
|
|
1459
|
+
if (!input || input.length === 0) return fallbackSrc;
|
|
1460
|
+
const raw = input.trim();
|
|
1461
|
+
if (raw.startsWith("/images/products/") && /\.(jpg|jpeg)($|\?)/i.test(raw)) {
|
|
1462
|
+
return raw.replace(/\.(jpg|jpeg)(?=$|\?)/i, ".png");
|
|
1463
|
+
}
|
|
1464
|
+
if (raw.startsWith("//")) {
|
|
1465
|
+
return `https:${raw}`;
|
|
1466
|
+
}
|
|
1467
|
+
if (/^(https?:|data:|blob:)/i.test(raw)) {
|
|
1468
|
+
return FAILED_SRCS.has(raw) ? fallbackSrc : raw;
|
|
1469
|
+
}
|
|
1470
|
+
if (raw.startsWith("/")) {
|
|
1471
|
+
return FAILED_SRCS.has(raw) ? fallbackSrc : raw;
|
|
1472
|
+
}
|
|
1473
|
+
const normalized = `/${raw.replace(/^\.\/?/, "")}`;
|
|
1474
|
+
return FAILED_SRCS.has(normalized) ? fallbackSrc : normalized;
|
|
1475
|
+
};
|
|
1476
|
+
const [resolvedSrc, setResolvedSrc] = import_react5.default.useState(() => normalize(src));
|
|
1477
|
+
import_react5.default.useEffect(() => {
|
|
1478
|
+
setResolvedSrc(normalize(src));
|
|
1479
|
+
}, [src]);
|
|
1480
|
+
const handleError = () => {
|
|
1481
|
+
if (resolvedSrc && resolvedSrc !== fallbackSrc) FAILED_SRCS.add(resolvedSrc);
|
|
1482
|
+
if (resolvedSrc.endsWith(".jpg")) {
|
|
1483
|
+
const next = resolvedSrc.replace(/\.jpg($|\?)/, ".png$1");
|
|
1484
|
+
setResolvedSrc(next);
|
|
1485
|
+
} else if (resolvedSrc !== fallbackSrc) {
|
|
1486
|
+
setResolvedSrc(fallbackSrc);
|
|
1487
|
+
}
|
|
1488
|
+
};
|
|
1489
|
+
const Wrapper = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1490
|
+
"div",
|
|
1491
|
+
{
|
|
1492
|
+
className: cn(
|
|
1493
|
+
"relative overflow-hidden bg-muted/30",
|
|
1494
|
+
// remove any default focus outline/ring for visual consistency with Card
|
|
1495
|
+
"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0",
|
|
1496
|
+
ratioClass,
|
|
1497
|
+
roundedClass,
|
|
1498
|
+
className
|
|
1499
|
+
),
|
|
1500
|
+
children
|
|
1501
|
+
}
|
|
1502
|
+
);
|
|
1503
|
+
if (fill) {
|
|
1504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1505
|
+
import_image.default,
|
|
1506
|
+
{
|
|
1507
|
+
src: resolvedSrc,
|
|
1508
|
+
alt,
|
|
1509
|
+
fill: true,
|
|
1510
|
+
sizes,
|
|
1511
|
+
onError: handleError,
|
|
1512
|
+
priority,
|
|
1513
|
+
quality,
|
|
1514
|
+
style: { objectFit: fit, objectPosition }
|
|
1515
|
+
}
|
|
1516
|
+
) });
|
|
1517
|
+
}
|
|
1518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1519
|
+
"div",
|
|
1520
|
+
{
|
|
1521
|
+
className: cn(
|
|
1522
|
+
"relative overflow-hidden bg-muted/30",
|
|
1523
|
+
"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0",
|
|
1524
|
+
roundedClass,
|
|
1525
|
+
className
|
|
1526
|
+
),
|
|
1527
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1528
|
+
import_image.default,
|
|
1529
|
+
{
|
|
1530
|
+
src: resolvedSrc,
|
|
1531
|
+
alt,
|
|
1532
|
+
width,
|
|
1533
|
+
height,
|
|
1534
|
+
sizes,
|
|
1535
|
+
onError: handleError,
|
|
1536
|
+
priority,
|
|
1537
|
+
quality,
|
|
1538
|
+
style: { objectFit: fit, objectPosition, width: "100%", height: "100%" }
|
|
1539
|
+
}
|
|
1540
|
+
)
|
|
1541
|
+
}
|
|
1542
|
+
);
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
// ../../components/ui/Avatar.tsx
|
|
1546
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1465
1547
|
var sizeClasses = {
|
|
1466
1548
|
sm: "h-8 w-8 text-sm",
|
|
1467
1549
|
md: "h-10 w-10 text-base",
|
|
1468
1550
|
lg: "h-14 w-14 text-lg"
|
|
1469
1551
|
};
|
|
1470
1552
|
var Avatar = ({ src, alt = "avatar", fallback = "?", size = "md", className, onClick, ...props }) => {
|
|
1471
|
-
const
|
|
1472
|
-
|
|
1473
|
-
const [imageError, setImageError] = React7.useState(false);
|
|
1474
|
-
React7.useEffect(() => {
|
|
1475
|
-
if (src) {
|
|
1476
|
-
setIsImageLoading(true);
|
|
1477
|
-
setImageError(false);
|
|
1478
|
-
setLoaded(false);
|
|
1479
|
-
}
|
|
1480
|
-
}, [src]);
|
|
1481
|
-
const handleImageLoad = () => {
|
|
1482
|
-
setLoaded(true);
|
|
1483
|
-
setIsImageLoading(false);
|
|
1484
|
-
};
|
|
1485
|
-
const handleImageError = () => {
|
|
1486
|
-
setLoaded(false);
|
|
1487
|
-
setIsImageLoading(false);
|
|
1488
|
-
setImageError(true);
|
|
1489
|
-
};
|
|
1490
|
-
const hasValidSrc = src && src.trim().length > 0;
|
|
1491
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1553
|
+
const hasValidSrc = !!(src && src.trim().length > 0);
|
|
1554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1492
1555
|
"div",
|
|
1493
1556
|
{
|
|
1494
1557
|
className: cn(
|
|
@@ -1500,23 +1563,21 @@ var Avatar = ({ src, alt = "avatar", fallback = "?", size = "md", className, onC
|
|
|
1500
1563
|
onClick,
|
|
1501
1564
|
...props,
|
|
1502
1565
|
children: [
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
hasValidSrc && !imageError && // eslint-disable-next-line @next/next/no-img-element
|
|
1506
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1507
|
-
"img",
|
|
1566
|
+
hasValidSrc && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "absolute inset-0", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1567
|
+
SmartImage,
|
|
1508
1568
|
{
|
|
1509
1569
|
src,
|
|
1510
1570
|
alt,
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
className:
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1571
|
+
fill: true,
|
|
1572
|
+
ratioClass: void 0,
|
|
1573
|
+
className: "h-full w-full",
|
|
1574
|
+
roundedClass: "rounded-full",
|
|
1575
|
+
fit: "cover",
|
|
1576
|
+
objectPosition: "center",
|
|
1577
|
+
quality: 80
|
|
1517
1578
|
}
|
|
1518
|
-
),
|
|
1519
|
-
|
|
1579
|
+
) }),
|
|
1580
|
+
!hasValidSrc && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1520
1581
|
"span",
|
|
1521
1582
|
{
|
|
1522
1583
|
className: cn(
|
|
@@ -1526,7 +1587,7 @@ var Avatar = ({ src, alt = "avatar", fallback = "?", size = "md", className, onC
|
|
|
1526
1587
|
children: fallback
|
|
1527
1588
|
}
|
|
1528
1589
|
),
|
|
1529
|
-
/* @__PURE__ */ (0,
|
|
1590
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "absolute bottom-0 right-0 w-3 h-3 bg-success border-2 border-background rounded-full opacity-0 group-hover:opacity-100 transition-opacity duration-200" })
|
|
1530
1591
|
]
|
|
1531
1592
|
}
|
|
1532
1593
|
);
|
|
@@ -1534,7 +1595,7 @@ var Avatar = ({ src, alt = "avatar", fallback = "?", size = "md", className, onC
|
|
|
1534
1595
|
var Avatar_default = Avatar;
|
|
1535
1596
|
|
|
1536
1597
|
// ../../components/ui/Skeleton.tsx
|
|
1537
|
-
var
|
|
1598
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1538
1599
|
var Skeleton = ({
|
|
1539
1600
|
className,
|
|
1540
1601
|
width,
|
|
@@ -1555,7 +1616,7 @@ var Skeleton = ({
|
|
|
1555
1616
|
none: ""
|
|
1556
1617
|
};
|
|
1557
1618
|
if (variant === "text" && lines > 1) {
|
|
1558
|
-
return /* @__PURE__ */ (0,
|
|
1619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: cn("space-y-2", className), children: Array.from({ length: lines }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1559
1620
|
"div",
|
|
1560
1621
|
{
|
|
1561
1622
|
className: cn(
|
|
@@ -1573,7 +1634,7 @@ var Skeleton = ({
|
|
|
1573
1634
|
index
|
|
1574
1635
|
)) });
|
|
1575
1636
|
}
|
|
1576
|
-
return /* @__PURE__ */ (0,
|
|
1637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1577
1638
|
"div",
|
|
1578
1639
|
{
|
|
1579
1640
|
className: cn(
|
|
@@ -1595,7 +1656,7 @@ var SkeletonAvatar = ({
|
|
|
1595
1656
|
md: "w-10 h-10",
|
|
1596
1657
|
lg: "w-12 h-12"
|
|
1597
1658
|
};
|
|
1598
|
-
return /* @__PURE__ */ (0,
|
|
1659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1599
1660
|
Skeleton,
|
|
1600
1661
|
{
|
|
1601
1662
|
variant: "circular",
|
|
@@ -1612,7 +1673,7 @@ var SkeletonButton = ({
|
|
|
1612
1673
|
md: "h-10 w-24",
|
|
1613
1674
|
lg: "h-12 w-28"
|
|
1614
1675
|
};
|
|
1615
|
-
return /* @__PURE__ */ (0,
|
|
1676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1616
1677
|
Skeleton,
|
|
1617
1678
|
{
|
|
1618
1679
|
variant: "rounded",
|
|
@@ -1625,7 +1686,7 @@ var SkeletonText = ({
|
|
|
1625
1686
|
className,
|
|
1626
1687
|
width = "100%"
|
|
1627
1688
|
}) => {
|
|
1628
|
-
return /* @__PURE__ */ (0,
|
|
1689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1629
1690
|
Skeleton,
|
|
1630
1691
|
{
|
|
1631
1692
|
variant: "text",
|
|
@@ -1641,42 +1702,42 @@ var SkeletonCard = ({
|
|
|
1641
1702
|
textLines = 3,
|
|
1642
1703
|
className
|
|
1643
1704
|
}) => {
|
|
1644
|
-
return /* @__PURE__ */ (0,
|
|
1645
|
-
showAvatar && /* @__PURE__ */ (0,
|
|
1646
|
-
/* @__PURE__ */ (0,
|
|
1647
|
-
/* @__PURE__ */ (0,
|
|
1648
|
-
/* @__PURE__ */ (0,
|
|
1649
|
-
/* @__PURE__ */ (0,
|
|
1705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn("p-4 space-y-4 rounded-lg bg-card outline-none focus:outline-none", className), children: [
|
|
1706
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center space-x-3", children: [
|
|
1707
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonAvatar, {}),
|
|
1708
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-2", children: [
|
|
1709
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-4 w-24" }),
|
|
1710
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-3 w-16" })
|
|
1650
1711
|
] })
|
|
1651
1712
|
] }),
|
|
1652
|
-
showImage && /* @__PURE__ */ (0,
|
|
1653
|
-
/* @__PURE__ */ (0,
|
|
1654
|
-
/* @__PURE__ */ (0,
|
|
1655
|
-
/* @__PURE__ */ (0,
|
|
1656
|
-
/* @__PURE__ */ (0,
|
|
1713
|
+
showImage && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-48 w-full rounded-md" }),
|
|
1714
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonText, { lines: textLines }),
|
|
1715
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex space-x-2", children: [
|
|
1716
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonButton, { size: "sm" }),
|
|
1717
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonButton, { size: "sm" })
|
|
1657
1718
|
] })
|
|
1658
1719
|
] });
|
|
1659
1720
|
};
|
|
1660
1721
|
var SkeletonPost = ({ className }) => {
|
|
1661
|
-
return /* @__PURE__ */ (0,
|
|
1662
|
-
/* @__PURE__ */ (0,
|
|
1663
|
-
/* @__PURE__ */ (0,
|
|
1664
|
-
/* @__PURE__ */ (0,
|
|
1665
|
-
/* @__PURE__ */ (0,
|
|
1666
|
-
/* @__PURE__ */ (0,
|
|
1722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn("p-6 space-y-4 rounded-xl bg-card outline-none focus:outline-none", className), children: [
|
|
1723
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center space-x-3", children: [
|
|
1724
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonAvatar, { size: "lg" }),
|
|
1725
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-2", children: [
|
|
1726
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-4 w-32" }),
|
|
1727
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-3 w-20" })
|
|
1667
1728
|
] })
|
|
1668
1729
|
] }),
|
|
1669
|
-
/* @__PURE__ */ (0,
|
|
1670
|
-
/* @__PURE__ */ (0,
|
|
1671
|
-
/* @__PURE__ */ (0,
|
|
1672
|
-
/* @__PURE__ */ (0,
|
|
1673
|
-
/* @__PURE__ */ (0,
|
|
1674
|
-
/* @__PURE__ */ (0,
|
|
1730
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonText, { lines: 2 }),
|
|
1731
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-64 w-full rounded-lg" }),
|
|
1732
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center space-x-4", children: [
|
|
1733
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-3 w-16" }),
|
|
1734
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-3 w-20" }),
|
|
1735
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-3 w-12" })
|
|
1675
1736
|
] }),
|
|
1676
|
-
/* @__PURE__ */ (0,
|
|
1677
|
-
/* @__PURE__ */ (0,
|
|
1678
|
-
/* @__PURE__ */ (0,
|
|
1679
|
-
/* @__PURE__ */ (0,
|
|
1737
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex items-center justify-between pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex space-x-4", children: [
|
|
1738
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-8 w-16" }),
|
|
1739
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-8 w-20" }),
|
|
1740
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-8 w-16" })
|
|
1680
1741
|
] }) })
|
|
1681
1742
|
] });
|
|
1682
1743
|
};
|
|
@@ -1685,21 +1746,21 @@ var SkeletonMessage = ({
|
|
|
1685
1746
|
showAvatar = true,
|
|
1686
1747
|
className
|
|
1687
1748
|
}) => {
|
|
1688
|
-
return /* @__PURE__ */ (0,
|
|
1749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn(
|
|
1689
1750
|
"flex items-end space-x-2",
|
|
1690
1751
|
own && "flex-row-reverse space-x-reverse",
|
|
1691
1752
|
className
|
|
1692
1753
|
), children: [
|
|
1693
|
-
showAvatar && !own && /* @__PURE__ */ (0,
|
|
1694
|
-
/* @__PURE__ */ (0,
|
|
1754
|
+
showAvatar && !own && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonAvatar, { size: "sm" }),
|
|
1755
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn(
|
|
1695
1756
|
"max-w-xs space-y-1",
|
|
1696
1757
|
own ? "items-end" : "items-start"
|
|
1697
1758
|
), children: [
|
|
1698
|
-
/* @__PURE__ */ (0,
|
|
1759
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: cn(
|
|
1699
1760
|
"h-10 rounded-2xl",
|
|
1700
1761
|
own ? "w-32 bg-primary/20" : "w-40 bg-muted"
|
|
1701
1762
|
) }),
|
|
1702
|
-
/* @__PURE__ */ (0,
|
|
1763
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-3 w-12" })
|
|
1703
1764
|
] })
|
|
1704
1765
|
] });
|
|
1705
1766
|
};
|
|
@@ -1709,13 +1770,13 @@ var SkeletonList = ({
|
|
|
1709
1770
|
showAvatar = true,
|
|
1710
1771
|
className
|
|
1711
1772
|
}) => {
|
|
1712
|
-
return /* @__PURE__ */ (0,
|
|
1713
|
-
showAvatar && /* @__PURE__ */ (0,
|
|
1714
|
-
/* @__PURE__ */ (0,
|
|
1715
|
-
/* @__PURE__ */ (0,
|
|
1716
|
-
/* @__PURE__ */ (0,
|
|
1773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: cn("space-y-3", className), children: Array.from({ length: items }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center space-x-3 p-3 rounded-lg", children: [
|
|
1774
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonAvatar, {}),
|
|
1775
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
1776
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-4 w-3/4" }),
|
|
1777
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-3 w-1/2" })
|
|
1717
1778
|
] }),
|
|
1718
|
-
/* @__PURE__ */ (0,
|
|
1779
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-6 w-16" })
|
|
1719
1780
|
] }, index)) });
|
|
1720
1781
|
};
|
|
1721
1782
|
var SkeletonTable = ({
|
|
@@ -1723,17 +1784,17 @@ var SkeletonTable = ({
|
|
|
1723
1784
|
columns = 4,
|
|
1724
1785
|
className
|
|
1725
1786
|
}) => {
|
|
1726
|
-
return /* @__PURE__ */ (0,
|
|
1727
|
-
/* @__PURE__ */ (0,
|
|
1728
|
-
Array.from({ length: rows }).map((_, rowIndex) => /* @__PURE__ */ (0,
|
|
1787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn("space-y-3", className), children: [
|
|
1788
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex space-x-4 p-3", children: Array.from({ length: columns }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-4 flex-1" }, index)) }),
|
|
1789
|
+
Array.from({ length: rows }).map((_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex space-x-4 p-3", children: Array.from({ length: columns }).map((_2, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: "h-4 flex-1" }, colIndex)) }, rowIndex))
|
|
1729
1790
|
] });
|
|
1730
1791
|
};
|
|
1731
1792
|
var Skeleton_default = Skeleton;
|
|
1732
1793
|
|
|
1733
1794
|
// ../../components/ui/Progress.tsx
|
|
1734
|
-
var
|
|
1795
|
+
var import_react6 = __toESM(require("react"), 1);
|
|
1735
1796
|
var import_lucide_react4 = require("lucide-react");
|
|
1736
|
-
var
|
|
1797
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1737
1798
|
var variantStyles2 = {
|
|
1738
1799
|
default: "bg-muted-foreground",
|
|
1739
1800
|
primary: "bg-gradient-to-r from-primary via-primary/90 to-primary",
|
|
@@ -1765,29 +1826,29 @@ var Progress = ({
|
|
|
1765
1826
|
const percentage = Math.min(Math.max(value / max * 100, 0), 100);
|
|
1766
1827
|
const isComplete = status === "complete" || percentage >= 100;
|
|
1767
1828
|
const isError = status === "error";
|
|
1768
|
-
const labelId =
|
|
1769
|
-
const descId =
|
|
1829
|
+
const labelId = import_react6.default.useId();
|
|
1830
|
+
const descId = import_react6.default.useId();
|
|
1770
1831
|
const getStatusIcon = () => {
|
|
1771
|
-
if (isComplete) return /* @__PURE__ */ (0,
|
|
1772
|
-
if (isError) return /* @__PURE__ */ (0,
|
|
1773
|
-
if (animated || indeterminate) return /* @__PURE__ */ (0,
|
|
1832
|
+
if (isComplete) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Check, { className: "w-4 h-4 text-success" });
|
|
1833
|
+
if (isError) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.X, { className: "w-4 h-4 text-destructive" });
|
|
1834
|
+
if (animated || indeterminate) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Clock, { className: "w-4 h-4 text-muted-foreground animate-spin" });
|
|
1774
1835
|
return null;
|
|
1775
1836
|
};
|
|
1776
|
-
return /* @__PURE__ */ (0,
|
|
1777
|
-
(label || showValue || description) && /* @__PURE__ */ (0,
|
|
1778
|
-
/* @__PURE__ */ (0,
|
|
1779
|
-
/* @__PURE__ */ (0,
|
|
1780
|
-
label && /* @__PURE__ */ (0,
|
|
1837
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("w-full space-y-3", className), children: [
|
|
1838
|
+
(label || showValue || description) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1", children: [
|
|
1839
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex justify-between items-center", children: [
|
|
1840
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1841
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { id: labelId, className: "font-medium text-foreground", children: label }),
|
|
1781
1842
|
getStatusIcon()
|
|
1782
1843
|
] }),
|
|
1783
|
-
showValue && !indeterminate && /* @__PURE__ */ (0,
|
|
1844
|
+
showValue && !indeterminate && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: cn(
|
|
1784
1845
|
"text-sm font-medium",
|
|
1785
1846
|
isComplete ? "text-success" : isError ? "text-destructive" : "text-muted-foreground"
|
|
1786
1847
|
), children: isComplete ? "Complete" : isError ? "Error" : `${Math.round(percentage)}%` })
|
|
1787
1848
|
] }),
|
|
1788
|
-
description && /* @__PURE__ */ (0,
|
|
1849
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { id: descId, className: "text-sm text-muted-foreground", children: description })
|
|
1789
1850
|
] }),
|
|
1790
|
-
/* @__PURE__ */ (0,
|
|
1851
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1791
1852
|
"div",
|
|
1792
1853
|
{
|
|
1793
1854
|
role: "progressbar",
|
|
@@ -1801,7 +1862,7 @@ var Progress = ({
|
|
|
1801
1862
|
"border border-border/50",
|
|
1802
1863
|
sizeStyles2[size]
|
|
1803
1864
|
),
|
|
1804
|
-
children: /* @__PURE__ */ (0,
|
|
1865
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1805
1866
|
"div",
|
|
1806
1867
|
{
|
|
1807
1868
|
className: cn(
|
|
@@ -1854,11 +1915,11 @@ var CircularProgress = ({
|
|
|
1854
1915
|
info: "stroke-info"
|
|
1855
1916
|
};
|
|
1856
1917
|
const getContentIcon = () => {
|
|
1857
|
-
if (isComplete) return /* @__PURE__ */ (0,
|
|
1858
|
-
if (isError) return /* @__PURE__ */ (0,
|
|
1918
|
+
if (isComplete) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Check, { className: "w-5 h-5 text-success" });
|
|
1919
|
+
if (isError) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.X, { className: "w-5 h-5 text-destructive" });
|
|
1859
1920
|
return null;
|
|
1860
1921
|
};
|
|
1861
|
-
return /* @__PURE__ */ (0,
|
|
1922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1862
1923
|
"div",
|
|
1863
1924
|
{
|
|
1864
1925
|
className: cn("relative inline-flex items-center justify-center", className),
|
|
@@ -1868,7 +1929,7 @@ var CircularProgress = ({
|
|
|
1868
1929
|
"aria-valuenow": indeterminate ? void 0 : Math.round(percentage),
|
|
1869
1930
|
"aria-label": children ? void 0 : "Progress",
|
|
1870
1931
|
children: [
|
|
1871
|
-
/* @__PURE__ */ (0,
|
|
1932
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1872
1933
|
"svg",
|
|
1873
1934
|
{
|
|
1874
1935
|
width: size,
|
|
@@ -1879,7 +1940,7 @@ var CircularProgress = ({
|
|
|
1879
1940
|
),
|
|
1880
1941
|
style: { animationDuration: indeterminate ? "2s" : void 0 },
|
|
1881
1942
|
children: [
|
|
1882
|
-
/* @__PURE__ */ (0,
|
|
1943
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1883
1944
|
"circle",
|
|
1884
1945
|
{
|
|
1885
1946
|
cx: size / 2,
|
|
@@ -1891,7 +1952,7 @@ var CircularProgress = ({
|
|
|
1891
1952
|
className: trackColor
|
|
1892
1953
|
}
|
|
1893
1954
|
),
|
|
1894
|
-
/* @__PURE__ */ (0,
|
|
1955
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1895
1956
|
"circle",
|
|
1896
1957
|
{
|
|
1897
1958
|
cx: size / 2,
|
|
@@ -1915,13 +1976,13 @@ var CircularProgress = ({
|
|
|
1915
1976
|
]
|
|
1916
1977
|
}
|
|
1917
1978
|
),
|
|
1918
|
-
/* @__PURE__ */ (0,
|
|
1979
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute inset-0 flex flex-col items-center justify-center text-center", children: children ? children : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1919
1980
|
getContentIcon(),
|
|
1920
|
-
showValue && !indeterminate && /* @__PURE__ */ (0,
|
|
1981
|
+
showValue && !indeterminate && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: cn(
|
|
1921
1982
|
"text-sm font-semibold",
|
|
1922
1983
|
isComplete ? "text-success" : isError ? "text-destructive" : "text-foreground"
|
|
1923
1984
|
), children: isComplete ? "\u2713" : isError ? "\u2717" : `${Math.round(percentage)}%` }),
|
|
1924
|
-
indeterminate && /* @__PURE__ */ (0,
|
|
1985
|
+
indeterminate && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Clock, { className: "w-4 h-4 text-muted-foreground animate-pulse" })
|
|
1925
1986
|
] }) })
|
|
1926
1987
|
]
|
|
1927
1988
|
}
|
|
@@ -1944,10 +2005,10 @@ var StepProgress = ({
|
|
|
1944
2005
|
if (stepIndex === currentStep) return "current";
|
|
1945
2006
|
return "upcoming";
|
|
1946
2007
|
};
|
|
1947
|
-
return /* @__PURE__ */ (0,
|
|
2008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("w-full", className), role: "list", "aria-label": "Progress steps", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex items-center justify-between", children: steps.map((step, index) => {
|
|
1948
2009
|
const status = getStepStatus(index);
|
|
1949
|
-
return /* @__PURE__ */ (0,
|
|
1950
|
-
/* @__PURE__ */ (0,
|
|
2010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center", role: "listitem", "aria-current": status === "current" ? "step" : void 0, children: [
|
|
2011
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1951
2012
|
"div",
|
|
1952
2013
|
{
|
|
1953
2014
|
className: cn(
|
|
@@ -1968,10 +2029,10 @@ var StepProgress = ({
|
|
|
1968
2029
|
"hover:border-muted-foreground/50"
|
|
1969
2030
|
]
|
|
1970
2031
|
),
|
|
1971
|
-
children: status === "completed" ? /* @__PURE__ */ (0,
|
|
2032
|
+
children: status === "completed" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Check, { className: "w-3 h-3" }) : index + 1
|
|
1972
2033
|
}
|
|
1973
2034
|
),
|
|
1974
|
-
/* @__PURE__ */ (0,
|
|
2035
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1975
2036
|
"span",
|
|
1976
2037
|
{
|
|
1977
2038
|
className: cn(
|
|
@@ -1983,7 +2044,7 @@ var StepProgress = ({
|
|
|
1983
2044
|
children: step
|
|
1984
2045
|
}
|
|
1985
2046
|
),
|
|
1986
|
-
index < steps.length - 1 && /* @__PURE__ */ (0,
|
|
2047
|
+
index < steps.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1987
2048
|
"div",
|
|
1988
2049
|
{
|
|
1989
2050
|
className: cn(
|
|
@@ -2003,8 +2064,8 @@ var MiniProgress = ({
|
|
|
2003
2064
|
showValue = false
|
|
2004
2065
|
}) => {
|
|
2005
2066
|
const percentage = Math.min(Math.max(value / max * 100, 0), 100);
|
|
2006
|
-
return /* @__PURE__ */ (0,
|
|
2007
|
-
/* @__PURE__ */ (0,
|
|
2067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("flex items-center gap-2", className), children: [
|
|
2068
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2008
2069
|
"div",
|
|
2009
2070
|
{
|
|
2010
2071
|
className: "flex-1 h-1.5 bg-muted/50 rounded-full overflow-hidden",
|
|
@@ -2012,7 +2073,7 @@ var MiniProgress = ({
|
|
|
2012
2073
|
"aria-valuemin": 0,
|
|
2013
2074
|
"aria-valuemax": max,
|
|
2014
2075
|
"aria-valuenow": Math.round(percentage),
|
|
2015
|
-
children: /* @__PURE__ */ (0,
|
|
2076
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2016
2077
|
"div",
|
|
2017
2078
|
{
|
|
2018
2079
|
className: cn(
|
|
@@ -2024,7 +2085,7 @@ var MiniProgress = ({
|
|
|
2024
2085
|
)
|
|
2025
2086
|
}
|
|
2026
2087
|
),
|
|
2027
|
-
showValue && /* @__PURE__ */ (0,
|
|
2088
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "text-xs font-medium text-muted-foreground min-w-[2.5rem] text-right", children: [
|
|
2028
2089
|
Math.round(percentage),
|
|
2029
2090
|
"%"
|
|
2030
2091
|
] })
|
|
@@ -2044,11 +2105,11 @@ var BatteryProgress = ({
|
|
|
2044
2105
|
if (percentage <= 50) return "warning";
|
|
2045
2106
|
return "success";
|
|
2046
2107
|
};
|
|
2047
|
-
return /* @__PURE__ */ (0,
|
|
2048
|
-
/* @__PURE__ */ (0,
|
|
2049
|
-
/* @__PURE__ */ (0,
|
|
2050
|
-
/* @__PURE__ */ (0,
|
|
2051
|
-
/* @__PURE__ */ (0,
|
|
2108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("flex items-center gap-2", className), children: [
|
|
2109
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", role: "progressbar", "aria-label": "Battery level", "aria-valuemin": 0, "aria-valuemax": max, "aria-valuenow": Math.round(percentage), children: [
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w-6 h-3 border-2 border-foreground/20 rounded-sm relative", children: [
|
|
2111
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute -right-1 top-0.5 w-0.5 h-1 bg-foreground/20 rounded-r-sm" }),
|
|
2112
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2052
2113
|
"div",
|
|
2053
2114
|
{
|
|
2054
2115
|
className: cn(
|
|
@@ -2060,9 +2121,9 @@ var BatteryProgress = ({
|
|
|
2060
2121
|
}
|
|
2061
2122
|
)
|
|
2062
2123
|
] }),
|
|
2063
|
-
charging && /* @__PURE__ */ (0,
|
|
2124
|
+
charging && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w-2 h-2 text-info-foreground", children: "\u26A1" }) })
|
|
2064
2125
|
] }),
|
|
2065
|
-
showValue && /* @__PURE__ */ (0,
|
|
2126
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: cn(
|
|
2066
2127
|
"text-xs font-medium",
|
|
2067
2128
|
percentage <= 20 ? "text-destructive" : "text-muted-foreground"
|
|
2068
2129
|
), children: [
|
|
@@ -2083,7 +2144,7 @@ var SegmentedProgress = ({
|
|
|
2083
2144
|
md: "h-2",
|
|
2084
2145
|
lg: "h-3"
|
|
2085
2146
|
};
|
|
2086
|
-
return /* @__PURE__ */ (0,
|
|
2147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2087
2148
|
"div",
|
|
2088
2149
|
{
|
|
2089
2150
|
className: cn("flex gap-1", className),
|
|
@@ -2091,7 +2152,7 @@ var SegmentedProgress = ({
|
|
|
2091
2152
|
"aria-valuemin": 0,
|
|
2092
2153
|
"aria-valuemax": segments,
|
|
2093
2154
|
"aria-valuenow": activeSegments,
|
|
2094
|
-
children: Array.from({ length: segments }, (_, index) => /* @__PURE__ */ (0,
|
|
2155
|
+
children: Array.from({ length: segments }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2095
2156
|
"div",
|
|
2096
2157
|
{
|
|
2097
2158
|
className: cn(
|
|
@@ -2119,13 +2180,13 @@ var LoadingProgress = ({
|
|
|
2119
2180
|
const getStatusIcon = () => {
|
|
2120
2181
|
switch (status) {
|
|
2121
2182
|
case "complete":
|
|
2122
|
-
return /* @__PURE__ */ (0,
|
|
2183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Check, { className: "w-4 h-4 text-success" });
|
|
2123
2184
|
case "error":
|
|
2124
|
-
return /* @__PURE__ */ (0,
|
|
2185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.X, { className: "w-4 h-4 text-destructive" });
|
|
2125
2186
|
case "paused":
|
|
2126
|
-
return /* @__PURE__ */ (0,
|
|
2187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Clock, { className: "w-4 h-4 text-warning" });
|
|
2127
2188
|
default:
|
|
2128
|
-
return /* @__PURE__ */ (0,
|
|
2189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w-2 h-2 bg-primary rounded-full animate-bounce" });
|
|
2129
2190
|
}
|
|
2130
2191
|
};
|
|
2131
2192
|
const getStatusColor = () => {
|
|
@@ -2140,15 +2201,15 @@ var LoadingProgress = ({
|
|
|
2140
2201
|
return variant;
|
|
2141
2202
|
}
|
|
2142
2203
|
};
|
|
2143
|
-
return /* @__PURE__ */ (0,
|
|
2144
|
-
/* @__PURE__ */ (0,
|
|
2145
|
-
/* @__PURE__ */ (0,
|
|
2204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("w-full space-y-2", className), children: [
|
|
2205
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between text-sm", children: [
|
|
2206
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2146
2207
|
getStatusIcon(),
|
|
2147
|
-
label && /* @__PURE__ */ (0,
|
|
2208
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-medium text-foreground", children: label })
|
|
2148
2209
|
] }),
|
|
2149
|
-
/* @__PURE__ */ (0,
|
|
2210
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-muted-foreground", children: status === "complete" ? "Complete" : `${Math.round(percentage)}%` })
|
|
2150
2211
|
] }),
|
|
2151
|
-
/* @__PURE__ */ (0,
|
|
2212
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2152
2213
|
"div",
|
|
2153
2214
|
{
|
|
2154
2215
|
className: "w-full h-2 bg-muted/50 rounded-full overflow-hidden",
|
|
@@ -2157,7 +2218,7 @@ var LoadingProgress = ({
|
|
|
2157
2218
|
"aria-valuemax": max,
|
|
2158
2219
|
"aria-valuenow": Math.round(percentage),
|
|
2159
2220
|
"aria-label": label || "Loading progress",
|
|
2160
|
-
children: /* @__PURE__ */ (0,
|
|
2221
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2161
2222
|
"div",
|
|
2162
2223
|
{
|
|
2163
2224
|
className: cn(
|
|
@@ -2170,9 +2231,9 @@ var LoadingProgress = ({
|
|
|
2170
2231
|
)
|
|
2171
2232
|
}
|
|
2172
2233
|
),
|
|
2173
|
-
(speed || timeRemaining) && /* @__PURE__ */ (0,
|
|
2174
|
-
speed && /* @__PURE__ */ (0,
|
|
2175
|
-
timeRemaining && /* @__PURE__ */ (0,
|
|
2234
|
+
(speed || timeRemaining) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex justify-between text-xs text-muted-foreground", children: [
|
|
2235
|
+
speed && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: speed }),
|
|
2236
|
+
timeRemaining && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: timeRemaining })
|
|
2176
2237
|
] })
|
|
2177
2238
|
] });
|
|
2178
2239
|
};
|
|
@@ -2181,7 +2242,7 @@ var LoadingProgress = ({
|
|
|
2181
2242
|
var React9 = __toESM(require("react"), 1);
|
|
2182
2243
|
var import_react_dom = require("react-dom");
|
|
2183
2244
|
var import_lucide_react5 = require("lucide-react");
|
|
2184
|
-
var
|
|
2245
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2185
2246
|
var sizeStyles3 = {
|
|
2186
2247
|
sm: "max-w-sm",
|
|
2187
2248
|
md: "max-w-md",
|
|
@@ -2252,8 +2313,8 @@ var Modal = ({
|
|
|
2252
2313
|
if (!isMounted || !isOpen && !isVisible) {
|
|
2253
2314
|
return null;
|
|
2254
2315
|
}
|
|
2255
|
-
const modalContent = /* @__PURE__ */ (0,
|
|
2256
|
-
/* @__PURE__ */ (0,
|
|
2316
|
+
const modalContent = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: cn("fixed inset-0 z-[9999] flex items-center justify-center", overlayClassName), onClick: handleOverlayClick, children: [
|
|
2317
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2257
2318
|
"div",
|
|
2258
2319
|
{
|
|
2259
2320
|
className: "absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out",
|
|
@@ -2262,7 +2323,7 @@ var Modal = ({
|
|
|
2262
2323
|
}
|
|
2263
2324
|
}
|
|
2264
2325
|
),
|
|
2265
|
-
/* @__PURE__ */ (0,
|
|
2326
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2266
2327
|
"div",
|
|
2267
2328
|
{
|
|
2268
2329
|
className: cn(
|
|
@@ -2279,12 +2340,12 @@ var Modal = ({
|
|
|
2279
2340
|
},
|
|
2280
2341
|
onClick: (e) => e.stopPropagation(),
|
|
2281
2342
|
children: [
|
|
2282
|
-
(title || description || showCloseButton) && /* @__PURE__ */ (0,
|
|
2283
|
-
/* @__PURE__ */ (0,
|
|
2284
|
-
title && /* @__PURE__ */ (0,
|
|
2285
|
-
description && /* @__PURE__ */ (0,
|
|
2343
|
+
(title || description || showCloseButton) && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-start justify-between p-6 pb-0", children: [
|
|
2344
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1.5", children: [
|
|
2345
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h2", { className: "text-lg font-semibold leading-none tracking-tight", children: title }),
|
|
2346
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-sm text-muted-foreground", children: description })
|
|
2286
2347
|
] }),
|
|
2287
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
2348
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2288
2349
|
"button",
|
|
2289
2350
|
{
|
|
2290
2351
|
onClick: onClose,
|
|
@@ -2293,11 +2354,11 @@ var Modal = ({
|
|
|
2293
2354
|
"hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
2294
2355
|
"disabled:pointer-events-none "
|
|
2295
2356
|
),
|
|
2296
|
-
children: /* @__PURE__ */ (0,
|
|
2357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react5.X, { className: "h-4 w-4 cursor-pointer" })
|
|
2297
2358
|
}
|
|
2298
2359
|
)
|
|
2299
2360
|
] }),
|
|
2300
|
-
/* @__PURE__ */ (0,
|
|
2361
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "p-6", children })
|
|
2301
2362
|
]
|
|
2302
2363
|
}
|
|
2303
2364
|
)
|
|
@@ -2307,12 +2368,12 @@ var Modal = ({
|
|
|
2307
2368
|
var Modal_default = Modal;
|
|
2308
2369
|
|
|
2309
2370
|
// ../../components/ui/Toast.tsx
|
|
2310
|
-
var
|
|
2371
|
+
var import_react7 = require("react");
|
|
2311
2372
|
var import_lucide_react6 = require("lucide-react");
|
|
2312
|
-
var
|
|
2313
|
-
var ToastContext = (0,
|
|
2373
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2374
|
+
var ToastContext = (0, import_react7.createContext)(void 0);
|
|
2314
2375
|
var useToast = () => {
|
|
2315
|
-
const context = (0,
|
|
2376
|
+
const context = (0, import_react7.useContext)(ToastContext);
|
|
2316
2377
|
if (!context) {
|
|
2317
2378
|
throw new Error("useToast must be used within a ToastProvider");
|
|
2318
2379
|
}
|
|
@@ -2323,12 +2384,12 @@ var ToastProvider = ({
|
|
|
2323
2384
|
position = "top-right",
|
|
2324
2385
|
maxToasts = 5
|
|
2325
2386
|
}) => {
|
|
2326
|
-
const [toasts, setToasts] = (0,
|
|
2327
|
-
const idRef = (0,
|
|
2328
|
-
const removeToast = (0,
|
|
2387
|
+
const [toasts, setToasts] = (0, import_react7.useState)([]);
|
|
2388
|
+
const idRef = (0, import_react7.useRef)(0);
|
|
2389
|
+
const removeToast = (0, import_react7.useCallback)((id) => {
|
|
2329
2390
|
setToasts((prev) => prev.filter((toast) => toast.id !== id));
|
|
2330
2391
|
}, []);
|
|
2331
|
-
const addToast = (0,
|
|
2392
|
+
const addToast = (0, import_react7.useCallback)((toast) => {
|
|
2332
2393
|
const id = `toast-${++idRef.current}`;
|
|
2333
2394
|
const newToast = { ...toast, id };
|
|
2334
2395
|
setToasts((prev) => {
|
|
@@ -2349,19 +2410,19 @@ var ToastProvider = ({
|
|
|
2349
2410
|
"top-center": "top-4 left-1/2 transform -translate-x-1/2",
|
|
2350
2411
|
"bottom-center": "bottom-4 left-1/2 transform -translate-x-1/2"
|
|
2351
2412
|
};
|
|
2352
|
-
return /* @__PURE__ */ (0,
|
|
2413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(ToastContext.Provider, { value: { addToast, removeToast, toasts }, children: [
|
|
2353
2414
|
children,
|
|
2354
|
-
/* @__PURE__ */ (0,
|
|
2415
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("fixed z-50 flex flex-col gap-2 pointer-events-none", positionClasses[position]), "aria-live": "polite", "aria-atomic": true, children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToastComponent, { toast, onRemove: removeToast }, toast.id)) })
|
|
2355
2416
|
] });
|
|
2356
2417
|
};
|
|
2357
2418
|
var ToastComponent = ({ toast, onRemove }) => {
|
|
2358
|
-
const [isVisible, setIsVisible] = (0,
|
|
2359
|
-
const [progress, setProgress] = (0,
|
|
2360
|
-
const [paused, setPaused] = (0,
|
|
2361
|
-
const [startTs] = (0,
|
|
2419
|
+
const [isVisible, setIsVisible] = (0, import_react7.useState)(false);
|
|
2420
|
+
const [progress, setProgress] = (0, import_react7.useState)(100);
|
|
2421
|
+
const [paused, setPaused] = (0, import_react7.useState)(false);
|
|
2422
|
+
const [startTs] = (0, import_react7.useState)(() => Date.now());
|
|
2362
2423
|
const total = toast.duration && toast.duration > 0 ? toast.duration : 5e3;
|
|
2363
|
-
const [remaining, setRemaining] = (0,
|
|
2364
|
-
(0,
|
|
2424
|
+
const [remaining, setRemaining] = (0, import_react7.useState)(total);
|
|
2425
|
+
(0, import_react7.useEffect)(() => {
|
|
2365
2426
|
setIsVisible(true);
|
|
2366
2427
|
if (toast.duration === 0) return;
|
|
2367
2428
|
let raf;
|
|
@@ -2409,7 +2470,7 @@ var ToastComponent = ({ toast, onRemove }) => {
|
|
|
2409
2470
|
};
|
|
2410
2471
|
const config = typeConfig[toast.type];
|
|
2411
2472
|
const Icon = config.icon;
|
|
2412
|
-
return /* @__PURE__ */ (0,
|
|
2473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2413
2474
|
"div",
|
|
2414
2475
|
{
|
|
2415
2476
|
className: cn(
|
|
@@ -2423,12 +2484,12 @@ var ToastComponent = ({ toast, onRemove }) => {
|
|
|
2423
2484
|
onMouseEnter: () => setPaused(true),
|
|
2424
2485
|
onMouseLeave: () => setPaused(false),
|
|
2425
2486
|
children: [
|
|
2426
|
-
/* @__PURE__ */ (0,
|
|
2427
|
-
/* @__PURE__ */ (0,
|
|
2428
|
-
/* @__PURE__ */ (0,
|
|
2429
|
-
toast.title && /* @__PURE__ */ (0,
|
|
2430
|
-
/* @__PURE__ */ (0,
|
|
2431
|
-
toast.action && /* @__PURE__ */ (0,
|
|
2487
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-start gap-3 p-4", children: [
|
|
2488
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { className: cn("h-5 w-5 mt-0.5 shrink-0", config.iconClassName) }),
|
|
2489
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex-1 space-y-1", children: [
|
|
2490
|
+
toast.title && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { className: "font-medium text-sm leading-none", children: toast.title }),
|
|
2491
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-sm text-muted-foreground leading-relaxed", children: toast.message }),
|
|
2492
|
+
toast.action && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2432
2493
|
"button",
|
|
2433
2494
|
{
|
|
2434
2495
|
onClick: () => {
|
|
@@ -2440,7 +2501,7 @@ var ToastComponent = ({ toast, onRemove }) => {
|
|
|
2440
2501
|
}
|
|
2441
2502
|
)
|
|
2442
2503
|
] }),
|
|
2443
|
-
(toast.dismissible ?? true) && /* @__PURE__ */ (0,
|
|
2504
|
+
(toast.dismissible ?? true) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2444
2505
|
"button",
|
|
2445
2506
|
{
|
|
2446
2507
|
onClick: handleRemove,
|
|
@@ -2449,11 +2510,11 @@ var ToastComponent = ({ toast, onRemove }) => {
|
|
|
2449
2510
|
"transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-primary/50"
|
|
2450
2511
|
),
|
|
2451
2512
|
"aria-label": "Close toast",
|
|
2452
|
-
children: /* @__PURE__ */ (0,
|
|
2513
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react6.X, { className: "h-4 w-4" })
|
|
2453
2514
|
}
|
|
2454
2515
|
)
|
|
2455
2516
|
] }),
|
|
2456
|
-
toast.duration !== 0 && /* @__PURE__ */ (0,
|
|
2517
|
+
toast.duration !== 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "absolute left-0 right-0 bottom-0 h-1 bg-transparent", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2457
2518
|
"div",
|
|
2458
2519
|
{
|
|
2459
2520
|
className: cn(
|
|
@@ -2475,7 +2536,7 @@ var Toast_default = ToastProvider;
|
|
|
2475
2536
|
// ../../components/ui/Tooltip.tsx
|
|
2476
2537
|
var React11 = __toESM(require("react"), 1);
|
|
2477
2538
|
var import_react_dom2 = require("react-dom");
|
|
2478
|
-
var
|
|
2539
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2479
2540
|
var variantStyles3 = {
|
|
2480
2541
|
default: "bg-popover text-popover-foreground border-border",
|
|
2481
2542
|
info: "bg-info text-info-foreground border-info/20",
|
|
@@ -2561,7 +2622,7 @@ var Tooltip = ({
|
|
|
2561
2622
|
if (disabled || !content) {
|
|
2562
2623
|
return children;
|
|
2563
2624
|
}
|
|
2564
|
-
return /* @__PURE__ */ (0,
|
|
2625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
2565
2626
|
React11.cloneElement(children, {
|
|
2566
2627
|
ref: triggerRef,
|
|
2567
2628
|
onMouseEnter: handleMouseEnter,
|
|
@@ -2570,7 +2631,7 @@ var Tooltip = ({
|
|
|
2570
2631
|
onBlur: handleBlur
|
|
2571
2632
|
}),
|
|
2572
2633
|
isMounted && isOpen && position && (0, import_react_dom2.createPortal)(
|
|
2573
|
-
/* @__PURE__ */ (0,
|
|
2634
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2574
2635
|
"div",
|
|
2575
2636
|
{
|
|
2576
2637
|
style: {
|
|
@@ -2701,7 +2762,7 @@ var useShadCNAnimations = () => {
|
|
|
2701
2762
|
};
|
|
2702
2763
|
|
|
2703
2764
|
// ../../components/ui/Popover.tsx
|
|
2704
|
-
var
|
|
2765
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2705
2766
|
var Popover = ({
|
|
2706
2767
|
trigger,
|
|
2707
2768
|
children,
|
|
@@ -2813,7 +2874,7 @@ var Popover = ({
|
|
|
2813
2874
|
setIsOpen(next);
|
|
2814
2875
|
}
|
|
2815
2876
|
};
|
|
2816
|
-
const popoverContent = isOpen && dropdownPosition ? /* @__PURE__ */ (0,
|
|
2877
|
+
const popoverContent = isOpen && dropdownPosition ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2817
2878
|
"div",
|
|
2818
2879
|
{
|
|
2819
2880
|
"data-popover": true,
|
|
@@ -2834,7 +2895,7 @@ var Popover = ({
|
|
|
2834
2895
|
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
2835
2896
|
className
|
|
2836
2897
|
),
|
|
2837
|
-
children: /* @__PURE__ */ (0,
|
|
2898
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2838
2899
|
"div",
|
|
2839
2900
|
{
|
|
2840
2901
|
className: cn(
|
|
@@ -2848,7 +2909,7 @@ var Popover = ({
|
|
|
2848
2909
|
)
|
|
2849
2910
|
}
|
|
2850
2911
|
) : null;
|
|
2851
|
-
return /* @__PURE__ */ (0,
|
|
2912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2852
2913
|
(() => {
|
|
2853
2914
|
const triggerEl = trigger;
|
|
2854
2915
|
return React12.cloneElement(triggerEl, {
|
|
@@ -2877,7 +2938,7 @@ var Popover = ({
|
|
|
2877
2938
|
var React13 = __toESM(require("react"), 1);
|
|
2878
2939
|
var import_react_dom4 = require("react-dom");
|
|
2879
2940
|
var import_lucide_react7 = require("lucide-react");
|
|
2880
|
-
var
|
|
2941
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2881
2942
|
var sizeStyles4 = {
|
|
2882
2943
|
sm: {
|
|
2883
2944
|
right: "w-[300px]",
|
|
@@ -3004,8 +3065,8 @@ var Sheet = ({
|
|
|
3004
3065
|
onOpenChange(false);
|
|
3005
3066
|
};
|
|
3006
3067
|
if (!mounted || !open && !isVisible) return null;
|
|
3007
|
-
const sheetContent = /* @__PURE__ */ (0,
|
|
3008
|
-
/* @__PURE__ */ (0,
|
|
3068
|
+
const sheetContent = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "fixed inset-0 z-50", children: [
|
|
3069
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3009
3070
|
"div",
|
|
3010
3071
|
{
|
|
3011
3072
|
className: cn(
|
|
@@ -3016,7 +3077,7 @@ var Sheet = ({
|
|
|
3016
3077
|
onClick: handleOverlayClick
|
|
3017
3078
|
}
|
|
3018
3079
|
),
|
|
3019
|
-
/* @__PURE__ */ (0,
|
|
3080
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3020
3081
|
"div",
|
|
3021
3082
|
{
|
|
3022
3083
|
className: cn(
|
|
@@ -3038,14 +3099,14 @@ var Sheet = ({
|
|
|
3038
3099
|
transition: "transform 300ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
3039
3100
|
},
|
|
3040
3101
|
children: [
|
|
3041
|
-
(title || description || header || showClose) && /* @__PURE__ */ (0,
|
|
3042
|
-
/* @__PURE__ */ (0,
|
|
3043
|
-
title && /* @__PURE__ */ (0,
|
|
3044
|
-
description && /* @__PURE__ */ (0,
|
|
3102
|
+
(title || description || header || showClose) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex-shrink-0 border-b border-border", children: header || /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between p-4", children: [
|
|
3103
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex-1", children: [
|
|
3104
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h2", { className: "text-lg font-semibold text-foreground", children: title }),
|
|
3105
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-sm text-muted-foreground mt-1", children: description })
|
|
3045
3106
|
] }),
|
|
3046
|
-
showClose && /* @__PURE__ */ (0,
|
|
3107
|
+
showClose && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button_default, { variant: "ghost", size: "sm", onClick: handleClose, className: "h-8 w-8 p-0 rounded-md cursor-pointer", icon: import_lucide_react7.X })
|
|
3047
3108
|
] }) }),
|
|
3048
|
-
/* @__PURE__ */ (0,
|
|
3109
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3049
3110
|
"div",
|
|
3050
3111
|
{
|
|
3051
3112
|
className: "flex-1 overflow-auto p-4",
|
|
@@ -3057,7 +3118,7 @@ var Sheet = ({
|
|
|
3057
3118
|
children
|
|
3058
3119
|
}
|
|
3059
3120
|
),
|
|
3060
|
-
footer && /* @__PURE__ */ (0,
|
|
3121
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex-shrink-0 border-t border-border p-4", children: footer })
|
|
3061
3122
|
]
|
|
3062
3123
|
}
|
|
3063
3124
|
)
|
|
@@ -3065,38 +3126,38 @@ var Sheet = ({
|
|
|
3065
3126
|
return typeof window !== "undefined" ? (0, import_react_dom4.createPortal)(sheetContent, document.body) : null;
|
|
3066
3127
|
};
|
|
3067
3128
|
var Drawer = ({ placement = "right", ...props }) => {
|
|
3068
|
-
return /* @__PURE__ */ (0,
|
|
3129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Sheet, { ...props, side: placement, variant: "overlay" });
|
|
3069
3130
|
};
|
|
3070
3131
|
var SlideOver = (props) => {
|
|
3071
|
-
return /* @__PURE__ */ (0,
|
|
3132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Sheet, { ...props, side: "right", variant: "overlay", size: "lg" });
|
|
3072
3133
|
};
|
|
3073
3134
|
var BottomSheet = ({ snapPoints = ["25%", "50%", "90%"], defaultSnap = 1, ...props }) => {
|
|
3074
|
-
return /* @__PURE__ */ (0,
|
|
3135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Sheet, { ...props, side: "bottom", variant: "overlay", className: cn("rounded-t-lg", props.className) });
|
|
3075
3136
|
};
|
|
3076
3137
|
var SidebarSheet = ({ navigation, children, ...props }) => {
|
|
3077
|
-
return /* @__PURE__ */ (0,
|
|
3078
|
-
navigation && /* @__PURE__ */ (0,
|
|
3138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Sheet, { ...props, side: "left", variant: "push", size: "md", children: [
|
|
3139
|
+
navigation && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "border-b border-border pb-4 mb-4", children: navigation }),
|
|
3079
3140
|
children
|
|
3080
3141
|
] });
|
|
3081
3142
|
};
|
|
3082
3143
|
|
|
3083
3144
|
// ../../components/ui/Alert.tsx
|
|
3084
|
-
var
|
|
3145
|
+
var import_react8 = require("react");
|
|
3085
3146
|
|
|
3086
3147
|
// ../../components/icons/AlertIcons.tsx
|
|
3087
3148
|
var import_lucide_react8 = require("lucide-react");
|
|
3088
|
-
var
|
|
3149
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3089
3150
|
function InfoIcon(props) {
|
|
3090
|
-
return /* @__PURE__ */ (0,
|
|
3151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Info, { "aria-hidden": true, className: props.className });
|
|
3091
3152
|
}
|
|
3092
3153
|
function WarningIcon(props) {
|
|
3093
|
-
return /* @__PURE__ */ (0,
|
|
3154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.AlertTriangle, { "aria-hidden": true, className: props.className });
|
|
3094
3155
|
}
|
|
3095
3156
|
function CheckCircleIcon(props) {
|
|
3096
|
-
return /* @__PURE__ */ (0,
|
|
3157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.CheckCircle2, { "aria-hidden": true, className: props.className });
|
|
3097
3158
|
}
|
|
3098
3159
|
function ErrorIcon(props) {
|
|
3099
|
-
return /* @__PURE__ */ (0,
|
|
3160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.OctagonX, { "aria-hidden": true, className: props.className });
|
|
3100
3161
|
}
|
|
3101
3162
|
|
|
3102
3163
|
// ../../components/ui/Alert.tsx
|
|
@@ -3114,42 +3175,42 @@ var VARIANT_STYLES_ALERT = {
|
|
|
3114
3175
|
};
|
|
3115
3176
|
|
|
3116
3177
|
// ../../components/ui/Alert.tsx
|
|
3117
|
-
var
|
|
3178
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3118
3179
|
var variantIcons = {
|
|
3119
|
-
default: /* @__PURE__ */ (0,
|
|
3120
|
-
info: /* @__PURE__ */ (0,
|
|
3121
|
-
success: /* @__PURE__ */ (0,
|
|
3122
|
-
warning: /* @__PURE__ */ (0,
|
|
3123
|
-
error: /* @__PURE__ */ (0,
|
|
3180
|
+
default: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(InfoIcon, { className: "h-4 w-4 text-muted-foreground" }),
|
|
3181
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(InfoIcon, { className: "h-4 w-4 text-info" }),
|
|
3182
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CheckCircleIcon, { className: "h-4 w-4 text-success" }),
|
|
3183
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(WarningIcon, { className: "h-4 w-4 text-warning" }),
|
|
3184
|
+
error: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ErrorIcon, { className: "h-4 w-4 text-destructive" })
|
|
3124
3185
|
};
|
|
3125
3186
|
var Alert = ({ title, description, variant = "default", className, icon, dismissible = false, onClose, actions, closeAriaLabel }) => {
|
|
3126
|
-
const [open, setOpen] = (0,
|
|
3187
|
+
const [open, setOpen] = (0, import_react8.useState)(true);
|
|
3127
3188
|
const t = (0, import_next_intl2.useTranslations)("Common");
|
|
3128
3189
|
if (!open) return null;
|
|
3129
3190
|
const handleClose = () => {
|
|
3130
3191
|
setOpen(false);
|
|
3131
3192
|
onClose?.();
|
|
3132
3193
|
};
|
|
3133
|
-
return /* @__PURE__ */ (0,
|
|
3194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
3134
3195
|
"div",
|
|
3135
3196
|
{
|
|
3136
3197
|
className: cn("w-full p-4 rounded-md flex items-start gap-3", VARIANT_STYLES_ALERT[variant], className),
|
|
3137
3198
|
role: "alert",
|
|
3138
3199
|
"aria-live": variant === "error" ? "assertive" : "polite",
|
|
3139
3200
|
children: [
|
|
3140
|
-
/* @__PURE__ */ (0,
|
|
3141
|
-
/* @__PURE__ */ (0,
|
|
3142
|
-
title && /* @__PURE__ */ (0,
|
|
3143
|
-
description && (typeof description === "string" ? /* @__PURE__ */ (0,
|
|
3144
|
-
actions && /* @__PURE__ */ (0,
|
|
3201
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pt-1", children: icon ?? variantIcons[variant] }),
|
|
3202
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
3203
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "font-semibold text-sm leading-none mb-1 text-foreground", children: title }),
|
|
3204
|
+
description && (typeof description === "string" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-sm text-muted-foreground leading-relaxed break-words", children: description }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "text-sm text-muted-foreground leading-relaxed break-words", children: description })),
|
|
3205
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "mt-2 flex flex-wrap gap-2", children: actions })
|
|
3145
3206
|
] }),
|
|
3146
|
-
dismissible && /* @__PURE__ */ (0,
|
|
3207
|
+
dismissible && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3147
3208
|
"button",
|
|
3148
3209
|
{
|
|
3149
3210
|
onClick: handleClose,
|
|
3150
3211
|
className: "rounded-md p-1 hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3151
3212
|
"aria-label": closeAriaLabel || t("closeAlert"),
|
|
3152
|
-
children: /* @__PURE__ */ (0,
|
|
3213
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.X, { className: "h-4 w-4" })
|
|
3153
3214
|
}
|
|
3154
3215
|
)
|
|
3155
3216
|
]
|
|
@@ -3159,7 +3220,7 @@ var Alert = ({ title, description, variant = "default", className, icon, dismiss
|
|
|
3159
3220
|
var Alert_default = Alert;
|
|
3160
3221
|
|
|
3161
3222
|
// ../../components/ui/GlobalLoading.tsx
|
|
3162
|
-
var
|
|
3223
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
3163
3224
|
var import_lucide_react10 = require("lucide-react");
|
|
3164
3225
|
|
|
3165
3226
|
// ../../lib/utils/loading.ts
|
|
@@ -3205,20 +3266,20 @@ var loading = new LoadingManager();
|
|
|
3205
3266
|
|
|
3206
3267
|
// ../../components/ui/GlobalLoading.tsx
|
|
3207
3268
|
var import_next_intl3 = require("next-intl");
|
|
3208
|
-
var
|
|
3269
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3209
3270
|
var GlobalLoading = ({
|
|
3210
3271
|
className,
|
|
3211
3272
|
backdrop = true,
|
|
3212
3273
|
position = "fixed",
|
|
3213
3274
|
size = "lg"
|
|
3214
3275
|
}) => {
|
|
3215
|
-
const [state, setState] = (0,
|
|
3216
|
-
(0,
|
|
3276
|
+
const [state, setState] = (0, import_react9.useState)(() => loading.getState());
|
|
3277
|
+
(0, import_react9.useEffect)(() => {
|
|
3217
3278
|
const unsubscribe = loading.subscribe(setState);
|
|
3218
3279
|
return unsubscribe;
|
|
3219
3280
|
}, []);
|
|
3220
3281
|
if (!state.isVisible) return null;
|
|
3221
|
-
return /* @__PURE__ */ (0,
|
|
3282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3222
3283
|
"div",
|
|
3223
3284
|
{
|
|
3224
3285
|
className: cn(
|
|
@@ -3230,9 +3291,9 @@ var GlobalLoading = ({
|
|
|
3230
3291
|
role: "dialog",
|
|
3231
3292
|
"aria-modal": true,
|
|
3232
3293
|
"aria-label": "Loading",
|
|
3233
|
-
children: /* @__PURE__ */ (0,
|
|
3234
|
-
/* @__PURE__ */ (0,
|
|
3235
|
-
state.text && /* @__PURE__ */ (0,
|
|
3294
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-center space-x-3 backdrop-blur-sm rounded-lg px-6 py-4 shadow-lg", role: "status", "aria-live": "assertive", "aria-busy": true, children: [
|
|
3295
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Activity, { className: "w-6 h-6 animate-spin text-primary-background", "aria-hidden": true }),
|
|
3296
|
+
state.text && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-base font-medium text-foreground", children: state.text })
|
|
3236
3297
|
] })
|
|
3237
3298
|
}
|
|
3238
3299
|
);
|
|
@@ -3243,14 +3304,14 @@ var PageLoading = ({
|
|
|
3243
3304
|
}) => {
|
|
3244
3305
|
const t = (0, import_next_intl3.useTranslations)("Loading");
|
|
3245
3306
|
const defaultMessage = message || t("loadingPage");
|
|
3246
|
-
return /* @__PURE__ */ (0,
|
|
3307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn(
|
|
3247
3308
|
"min-h-screen flex items-center justify-center bg-background",
|
|
3248
3309
|
className
|
|
3249
|
-
), children: /* @__PURE__ */ (0,
|
|
3250
|
-
/* @__PURE__ */ (0,
|
|
3251
|
-
/* @__PURE__ */ (0,
|
|
3252
|
-
/* @__PURE__ */ (0,
|
|
3253
|
-
/* @__PURE__ */ (0,
|
|
3310
|
+
), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "text-center space-y-4", children: [
|
|
3311
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Activity, { className: "w-8 h-8 animate-spin text-primary mx-auto" }),
|
|
3312
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
|
|
3313
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-lg font-medium text-foreground", children: defaultMessage }),
|
|
3314
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-muted-foreground mt-2", children: t("pleaseWait") })
|
|
3254
3315
|
] })
|
|
3255
3316
|
] }) });
|
|
3256
3317
|
};
|
|
@@ -3266,9 +3327,9 @@ var InlineLoading = ({
|
|
|
3266
3327
|
md: "w-6 h-6",
|
|
3267
3328
|
lg: "w-8 h-8"
|
|
3268
3329
|
};
|
|
3269
|
-
return /* @__PURE__ */ (0,
|
|
3270
|
-
/* @__PURE__ */ (0,
|
|
3271
|
-
text && /* @__PURE__ */ (0,
|
|
3330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cn("flex items-center justify-center space-x-2", className), children: [
|
|
3331
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Activity, { className: cn("animate-spin text-primary", sizeClasses2[size]) }),
|
|
3332
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-sm text-muted-foreground animate-pulse", children: text })
|
|
3272
3333
|
] });
|
|
3273
3334
|
};
|
|
3274
3335
|
var ButtonLoading = ({
|
|
@@ -3278,11 +3339,11 @@ var ButtonLoading = ({
|
|
|
3278
3339
|
disabled,
|
|
3279
3340
|
loadingText
|
|
3280
3341
|
}) => {
|
|
3281
|
-
const child =
|
|
3342
|
+
const child = import_react9.default.isValidElement(children) ? import_react9.default.cloneElement(children, {
|
|
3282
3343
|
disabled: (children.props?.disabled ?? false) || disabled || isLoading,
|
|
3283
3344
|
"aria-busy": isLoading || void 0
|
|
3284
3345
|
}) : children;
|
|
3285
|
-
return /* @__PURE__ */ (0,
|
|
3346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3286
3347
|
"div",
|
|
3287
3348
|
{
|
|
3288
3349
|
className: cn(
|
|
@@ -3291,11 +3352,11 @@ var ButtonLoading = ({
|
|
|
3291
3352
|
className
|
|
3292
3353
|
),
|
|
3293
3354
|
children: [
|
|
3294
|
-
isLoading && /* @__PURE__ */ (0,
|
|
3295
|
-
/* @__PURE__ */ (0,
|
|
3296
|
-
loadingText && /* @__PURE__ */ (0,
|
|
3355
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: [
|
|
3356
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Activity, { className: "w-4 h-4 animate-spin text-primary-foreground" }),
|
|
3357
|
+
loadingText && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "ml-2 text-sm", children: loadingText })
|
|
3297
3358
|
] }),
|
|
3298
|
-
/* @__PURE__ */ (0,
|
|
3359
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn(isLoading && "opacity-50 pointer-events-none"), children: child })
|
|
3299
3360
|
]
|
|
3300
3361
|
}
|
|
3301
3362
|
);
|
|
@@ -3305,7 +3366,7 @@ var ButtonLoading = ({
|
|
|
3305
3366
|
var React15 = __toESM(require("react"), 1);
|
|
3306
3367
|
var import_link = __toESM(require("next/link"), 1);
|
|
3307
3368
|
var import_lucide_react11 = require("lucide-react");
|
|
3308
|
-
var
|
|
3369
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3309
3370
|
var sizeStyles5 = {
|
|
3310
3371
|
sm: {
|
|
3311
3372
|
text: "text-xs",
|
|
@@ -3352,16 +3413,16 @@ var Breadcrumb = ({
|
|
|
3352
3413
|
}, [items.length, maxItems, collapsible]);
|
|
3353
3414
|
const getSeparator = () => {
|
|
3354
3415
|
if (typeof separator === "string") {
|
|
3355
|
-
return /* @__PURE__ */ (0,
|
|
3416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: separator });
|
|
3356
3417
|
}
|
|
3357
3418
|
if (variant === "slash") {
|
|
3358
|
-
return /* @__PURE__ */ (0,
|
|
3419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "/" });
|
|
3359
3420
|
}
|
|
3360
3421
|
if (variant === "arrow") {
|
|
3361
|
-
return /* @__PURE__ */ (0,
|
|
3422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "\u2192" });
|
|
3362
3423
|
}
|
|
3363
3424
|
const SeparatorComponent = separator;
|
|
3364
|
-
return /* @__PURE__ */ (0,
|
|
3425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SeparatorComponent, { className: cn("text-muted-foreground", sizeStyles5[size].icon) });
|
|
3365
3426
|
};
|
|
3366
3427
|
const processedItems = React15.useMemo(() => {
|
|
3367
3428
|
let finalItems = [...items];
|
|
@@ -3382,17 +3443,17 @@ var Breadcrumb = ({
|
|
|
3382
3443
|
const handleCollapseToggle = () => {
|
|
3383
3444
|
setIsCollapsed(!isCollapsed);
|
|
3384
3445
|
};
|
|
3385
|
-
return /* @__PURE__ */ (0,
|
|
3446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3386
3447
|
"nav",
|
|
3387
3448
|
{
|
|
3388
3449
|
className: cn("flex w-full items-center", sizeStyles5[size].text, className),
|
|
3389
3450
|
"aria-label": "Breadcrumb navigation",
|
|
3390
|
-
children: /* @__PURE__ */ (0,
|
|
3451
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("ol", { className: cn("flex items-center", sizeStyles5[size].spacing), children: processedItems.map((item, index) => {
|
|
3391
3452
|
const isLast = index === processedItems.length - 1;
|
|
3392
3453
|
const isCollapsedIndicator = item.label === "...";
|
|
3393
3454
|
const Icon = item.icon;
|
|
3394
|
-
return /* @__PURE__ */ (0,
|
|
3395
|
-
isCollapsedIndicator ? /* @__PURE__ */ (0,
|
|
3455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("li", { className: "flex items-center", children: [
|
|
3456
|
+
isCollapsedIndicator ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3396
3457
|
"button",
|
|
3397
3458
|
{
|
|
3398
3459
|
onClick: handleCollapseToggle,
|
|
@@ -3403,9 +3464,9 @@ var Breadcrumb = ({
|
|
|
3403
3464
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1"
|
|
3404
3465
|
),
|
|
3405
3466
|
"aria-label": "Show all breadcrumb items",
|
|
3406
|
-
children: /* @__PURE__ */ (0,
|
|
3467
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react11.MoreHorizontal, { className: sizeStyles5[size].icon })
|
|
3407
3468
|
}
|
|
3408
|
-
) : item.href && !isLast && !item.disabled ? /* @__PURE__ */ (0,
|
|
3469
|
+
) : item.href && !isLast && !item.disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3409
3470
|
import_link.default,
|
|
3410
3471
|
{
|
|
3411
3472
|
href: item.href,
|
|
@@ -3416,11 +3477,11 @@ var Breadcrumb = ({
|
|
|
3416
3477
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 rounded-sm"
|
|
3417
3478
|
),
|
|
3418
3479
|
children: [
|
|
3419
|
-
Icon && /* @__PURE__ */ (0,
|
|
3420
|
-
/* @__PURE__ */ (0,
|
|
3480
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { className: sizeStyles5[size].icon }),
|
|
3481
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: item.label })
|
|
3421
3482
|
]
|
|
3422
3483
|
}
|
|
3423
|
-
) : /* @__PURE__ */ (0,
|
|
3484
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3424
3485
|
"span",
|
|
3425
3486
|
{
|
|
3426
3487
|
className: cn(
|
|
@@ -3430,12 +3491,12 @@ var Breadcrumb = ({
|
|
|
3430
3491
|
),
|
|
3431
3492
|
"aria-current": isLast ? "page" : void 0,
|
|
3432
3493
|
children: [
|
|
3433
|
-
Icon && /* @__PURE__ */ (0,
|
|
3434
|
-
/* @__PURE__ */ (0,
|
|
3494
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { className: sizeStyles5[size].icon }),
|
|
3495
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: item.label })
|
|
3435
3496
|
]
|
|
3436
3497
|
}
|
|
3437
3498
|
),
|
|
3438
|
-
!isLast && /* @__PURE__ */ (0,
|
|
3499
|
+
!isLast && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3439
3500
|
"span",
|
|
3440
3501
|
{
|
|
3441
3502
|
className: cn("mx-1", sizeStyles5[size].spacing),
|
|
@@ -3453,7 +3514,7 @@ var Breadcrumb_default = Breadcrumb;
|
|
|
3453
3514
|
|
|
3454
3515
|
// ../../components/ui/Tab.tsx
|
|
3455
3516
|
var React16 = __toESM(require("react"), 1);
|
|
3456
|
-
var
|
|
3517
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3457
3518
|
var sizeStyles6 = {
|
|
3458
3519
|
sm: {
|
|
3459
3520
|
tab: "py-1.5 px-3 text-xs",
|
|
@@ -3541,14 +3602,14 @@ var Tabs = ({
|
|
|
3541
3602
|
className
|
|
3542
3603
|
);
|
|
3543
3604
|
const activeTab = tabs.find((tab) => tab.value === active);
|
|
3544
|
-
return /* @__PURE__ */ (0,
|
|
3545
|
-
/* @__PURE__ */ (0,
|
|
3605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cn("w-full", orientation === "vertical" && "flex gap-6"), children: [
|
|
3606
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: containerClasses, role: "tablist", "aria-orientation": orientation, children: [
|
|
3546
3607
|
tabs.map((tab, index) => {
|
|
3547
3608
|
const isActive = active === tab.value;
|
|
3548
3609
|
const Icon = tab.icon;
|
|
3549
3610
|
const tabId = `${baseId}-tab-${index}`;
|
|
3550
3611
|
const panelId = `${baseId}-panel-${index}`;
|
|
3551
|
-
return /* @__PURE__ */ (0,
|
|
3612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3552
3613
|
"button",
|
|
3553
3614
|
{
|
|
3554
3615
|
ref: (el) => {
|
|
@@ -3600,14 +3661,14 @@ var Tabs = ({
|
|
|
3600
3661
|
}
|
|
3601
3662
|
},
|
|
3602
3663
|
children: [
|
|
3603
|
-
Icon && /* @__PURE__ */ (0,
|
|
3664
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { className: "h-4 w-4" }),
|
|
3604
3665
|
tab.label
|
|
3605
3666
|
]
|
|
3606
3667
|
},
|
|
3607
3668
|
tab.value
|
|
3608
3669
|
);
|
|
3609
3670
|
}),
|
|
3610
|
-
variant === "underline" && orientation === "horizontal" && /* @__PURE__ */ (0,
|
|
3671
|
+
variant === "underline" && orientation === "horizontal" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3611
3672
|
"div",
|
|
3612
3673
|
{
|
|
3613
3674
|
className: "absolute bottom-0 h-0.5 bg-primary transition-all duration-300 ease-out",
|
|
@@ -3615,7 +3676,7 @@ var Tabs = ({
|
|
|
3615
3676
|
}
|
|
3616
3677
|
)
|
|
3617
3678
|
] }),
|
|
3618
|
-
/* @__PURE__ */ (0,
|
|
3679
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3619
3680
|
"div",
|
|
3620
3681
|
{
|
|
3621
3682
|
role: "tabpanel",
|
|
@@ -3633,7 +3694,7 @@ var Tabs = ({
|
|
|
3633
3694
|
] });
|
|
3634
3695
|
};
|
|
3635
3696
|
var SimpleTabs = ({ tabs, defaultValue, className }) => {
|
|
3636
|
-
return /* @__PURE__ */ (0,
|
|
3697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3637
3698
|
Tabs,
|
|
3638
3699
|
{
|
|
3639
3700
|
tabs,
|
|
@@ -3645,7 +3706,7 @@ var SimpleTabs = ({ tabs, defaultValue, className }) => {
|
|
|
3645
3706
|
);
|
|
3646
3707
|
};
|
|
3647
3708
|
var PillTabs = ({ contained = true, ...props }) => {
|
|
3648
|
-
return /* @__PURE__ */ (0,
|
|
3709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3649
3710
|
Tabs,
|
|
3650
3711
|
{
|
|
3651
3712
|
...props,
|
|
@@ -3659,7 +3720,7 @@ var VerticalTabs = ({
|
|
|
3659
3720
|
className,
|
|
3660
3721
|
...props
|
|
3661
3722
|
}) => {
|
|
3662
|
-
return /* @__PURE__ */ (0,
|
|
3723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cn("flex gap-6", className), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cn(sidebarWidth, "flex-shrink-0"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3663
3724
|
Tabs,
|
|
3664
3725
|
{
|
|
3665
3726
|
...props,
|
|
@@ -3671,9 +3732,9 @@ var VerticalTabs = ({
|
|
|
3671
3732
|
};
|
|
3672
3733
|
|
|
3673
3734
|
// ../../components/ui/DropdownMenu.tsx
|
|
3674
|
-
var
|
|
3735
|
+
var import_react10 = __toESM(require("react"), 1);
|
|
3675
3736
|
var import_react_dom5 = require("react-dom");
|
|
3676
|
-
var
|
|
3737
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3677
3738
|
var DropdownMenu = ({
|
|
3678
3739
|
trigger,
|
|
3679
3740
|
children,
|
|
@@ -3686,16 +3747,16 @@ var DropdownMenu = ({
|
|
|
3686
3747
|
onOpenChange,
|
|
3687
3748
|
items
|
|
3688
3749
|
}) => {
|
|
3689
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
3690
|
-
const [position, setPosition] = (0,
|
|
3691
|
-
const triggerRef =
|
|
3692
|
-
const contentRef =
|
|
3693
|
-
const itemsRef =
|
|
3694
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
3750
|
+
const [internalOpen, setInternalOpen] = (0, import_react10.useState)(false);
|
|
3751
|
+
const [position, setPosition] = (0, import_react10.useState)(null);
|
|
3752
|
+
const triggerRef = import_react10.default.useRef(null);
|
|
3753
|
+
const contentRef = import_react10.default.useRef(null);
|
|
3754
|
+
const itemsRef = import_react10.default.useRef([]);
|
|
3755
|
+
const [activeIndex, setActiveIndex] = (0, import_react10.useState)(-1);
|
|
3695
3756
|
useShadCNAnimations();
|
|
3696
3757
|
const open = isOpen !== void 0 ? isOpen : internalOpen;
|
|
3697
3758
|
const setOpen = onOpenChange || setInternalOpen;
|
|
3698
|
-
|
|
3759
|
+
import_react10.default.useEffect(() => {
|
|
3699
3760
|
if (open && triggerRef.current && contentRef.current) {
|
|
3700
3761
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
3701
3762
|
const menuRect = contentRef.current.getBoundingClientRect();
|
|
@@ -3735,7 +3796,7 @@ var DropdownMenu = ({
|
|
|
3735
3796
|
}
|
|
3736
3797
|
if (open) setActiveIndex(-1);
|
|
3737
3798
|
}, [open, placement]);
|
|
3738
|
-
|
|
3799
|
+
import_react10.default.useEffect(() => {
|
|
3739
3800
|
if (!open) return;
|
|
3740
3801
|
const handleClickOutside = (event) => {
|
|
3741
3802
|
const target = event.target;
|
|
@@ -3795,7 +3856,7 @@ var DropdownMenu = ({
|
|
|
3795
3856
|
setOpen(false);
|
|
3796
3857
|
}
|
|
3797
3858
|
};
|
|
3798
|
-
const dropdownContent = open ? /* @__PURE__ */ (0,
|
|
3859
|
+
const dropdownContent = open ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3799
3860
|
"div",
|
|
3800
3861
|
{
|
|
3801
3862
|
"data-dropdown-menu": true,
|
|
@@ -3816,7 +3877,7 @@ var DropdownMenu = ({
|
|
|
3816
3877
|
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
3817
3878
|
className
|
|
3818
3879
|
),
|
|
3819
|
-
children: /* @__PURE__ */ (0,
|
|
3880
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3820
3881
|
"div",
|
|
3821
3882
|
{
|
|
3822
3883
|
className: cn(
|
|
@@ -3826,7 +3887,7 @@ var DropdownMenu = ({
|
|
|
3826
3887
|
),
|
|
3827
3888
|
children: items ? items.map((item, index) => {
|
|
3828
3889
|
const IconComponent = item.icon;
|
|
3829
|
-
return /* @__PURE__ */ (0,
|
|
3890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3830
3891
|
"button",
|
|
3831
3892
|
{
|
|
3832
3893
|
ref: (el) => {
|
|
@@ -3848,7 +3909,7 @@ var DropdownMenu = ({
|
|
|
3848
3909
|
item.destructive && "text-destructive hover:bg-destructive/10 focus:bg-destructive/10"
|
|
3849
3910
|
),
|
|
3850
3911
|
children: [
|
|
3851
|
-
IconComponent && /* @__PURE__ */ (0,
|
|
3912
|
+
IconComponent && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IconComponent, { className: "h-4 w-4" }),
|
|
3852
3913
|
item.label
|
|
3853
3914
|
]
|
|
3854
3915
|
},
|
|
@@ -3859,8 +3920,8 @@ var DropdownMenu = ({
|
|
|
3859
3920
|
)
|
|
3860
3921
|
}
|
|
3861
3922
|
) : null;
|
|
3862
|
-
return /* @__PURE__ */ (0,
|
|
3863
|
-
|
|
3923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
3924
|
+
import_react10.default.cloneElement(trigger, {
|
|
3864
3925
|
ref: triggerRef,
|
|
3865
3926
|
onClick: handleTriggerClick,
|
|
3866
3927
|
"aria-expanded": open,
|
|
@@ -3875,7 +3936,7 @@ var DropdownMenu = ({
|
|
|
3875
3936
|
dropdownContent && typeof window !== "undefined" && (0, import_react_dom5.createPortal)(dropdownContent, document.body)
|
|
3876
3937
|
] });
|
|
3877
3938
|
};
|
|
3878
|
-
var DropdownMenuItem = ({ children, onClick, disabled, destructive, className }) => /* @__PURE__ */ (0,
|
|
3939
|
+
var DropdownMenuItem = ({ children, onClick, disabled, destructive, className }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3879
3940
|
"button",
|
|
3880
3941
|
{
|
|
3881
3942
|
onClick,
|
|
@@ -3891,22 +3952,22 @@ var DropdownMenuItem = ({ children, onClick, disabled, destructive, className })
|
|
|
3891
3952
|
children
|
|
3892
3953
|
}
|
|
3893
3954
|
);
|
|
3894
|
-
var DropdownMenuSeparator = ({ className }) => /* @__PURE__ */ (0,
|
|
3895
|
-
var SelectDropdown = ({ options, value, onChange, placeholder = "Select...", className }) => /* @__PURE__ */ (0,
|
|
3955
|
+
var DropdownMenuSeparator = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: cn("h-px bg-border my-1", className) });
|
|
3956
|
+
var SelectDropdown = ({ options, value, onChange, placeholder = "Select...", className }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3896
3957
|
DropdownMenu,
|
|
3897
3958
|
{
|
|
3898
|
-
trigger: /* @__PURE__ */ (0,
|
|
3959
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3899
3960
|
"button",
|
|
3900
3961
|
{
|
|
3901
3962
|
className: cn(
|
|
3902
|
-
"inline-flex items-center justify-between gap-2 px-3 py-2 text-sm rounded-md border bg-background",
|
|
3963
|
+
"inline-flex items-center justify-between gap-2 px-3 py-2 text-sm rounded-md border bg-background border-border/60",
|
|
3903
3964
|
"hover:bg-accent/50",
|
|
3904
3965
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
3905
3966
|
className
|
|
3906
3967
|
),
|
|
3907
3968
|
children: [
|
|
3908
|
-
/* @__PURE__ */ (0,
|
|
3909
|
-
/* @__PURE__ */ (0,
|
|
3969
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate max-w-[16rem] text-foreground/90", children: value || placeholder }),
|
|
3970
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", className: "opacity-70", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6 8l4 4 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
3910
3971
|
]
|
|
3911
3972
|
}
|
|
3912
3973
|
),
|
|
@@ -3924,10 +3985,10 @@ var import_lucide_react13 = require("lucide-react");
|
|
|
3924
3985
|
|
|
3925
3986
|
// ../../components/ui/Combobox.tsx
|
|
3926
3987
|
var React18 = __toESM(require("react"), 1);
|
|
3927
|
-
var
|
|
3988
|
+
var import_react11 = require("react");
|
|
3928
3989
|
var import_react_dom6 = require("react-dom");
|
|
3929
3990
|
var import_lucide_react12 = require("lucide-react");
|
|
3930
|
-
var
|
|
3991
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3931
3992
|
var getOptionLabel = (option) => {
|
|
3932
3993
|
return typeof option === "string" ? option : option.label;
|
|
3933
3994
|
};
|
|
@@ -3960,7 +4021,7 @@ var Combobox = ({
|
|
|
3960
4021
|
useShadCNAnimations();
|
|
3961
4022
|
const listRef = React18.useRef([]);
|
|
3962
4023
|
const inputRef = React18.useRef(null);
|
|
3963
|
-
const autoId = (0,
|
|
4024
|
+
const autoId = (0, import_react11.useId)();
|
|
3964
4025
|
const resolvedId = id ? String(id) : `combobox-${autoId}`;
|
|
3965
4026
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
3966
4027
|
const enableSearch = options.length > 10;
|
|
@@ -4042,7 +4103,7 @@ var Combobox = ({
|
|
|
4042
4103
|
}, [open, enableSearch]);
|
|
4043
4104
|
const selectedOption = findOptionByValue(options, value);
|
|
4044
4105
|
const displayValue = selectedOption ? getOptionLabel(selectedOption) : "";
|
|
4045
|
-
const dropdownContent = /* @__PURE__ */ (0,
|
|
4106
|
+
const dropdownContent = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4046
4107
|
"div",
|
|
4047
4108
|
{
|
|
4048
4109
|
"data-combobox-dropdown": true,
|
|
@@ -4061,10 +4122,10 @@ var Combobox = ({
|
|
|
4061
4122
|
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
4062
4123
|
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"
|
|
4063
4124
|
),
|
|
4064
|
-
children: /* @__PURE__ */ (0,
|
|
4065
|
-
enableSearch && /* @__PURE__ */ (0,
|
|
4066
|
-
/* @__PURE__ */ (0,
|
|
4067
|
-
/* @__PURE__ */ (0,
|
|
4125
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("rounded-md border bg-popover text-popover-foreground shadow-md", "backdrop-blur-sm bg-popover/95 border-border/60"), children: [
|
|
4126
|
+
enableSearch && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative p-3 border-b border-border/50 bg-muted/20", children: [
|
|
4127
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Search, { className: "absolute left-6 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground transition-colors" }),
|
|
4128
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4068
4129
|
"input",
|
|
4069
4130
|
{
|
|
4070
4131
|
ref: inputRef,
|
|
@@ -4103,11 +4164,11 @@ var Combobox = ({
|
|
|
4103
4164
|
}
|
|
4104
4165
|
)
|
|
4105
4166
|
] }),
|
|
4106
|
-
/* @__PURE__ */ (0,
|
|
4167
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "max-h-64 overflow-y-auto overscroll-contain", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { className: "p-1 space-y-1", children: filteredOptions.length > 0 ? filteredOptions.map((item, index) => {
|
|
4107
4168
|
const itemValue = getOptionValue(item);
|
|
4108
4169
|
const itemLabel = getOptionLabel(item);
|
|
4109
4170
|
const isSelected = itemValue === value;
|
|
4110
|
-
return /* @__PURE__ */ (0,
|
|
4171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4111
4172
|
"li",
|
|
4112
4173
|
{
|
|
4113
4174
|
ref: (node) => {
|
|
@@ -4131,15 +4192,15 @@ var Combobox = ({
|
|
|
4131
4192
|
isSelected && "bg-accent text-accent-foreground"
|
|
4132
4193
|
),
|
|
4133
4194
|
children: [
|
|
4134
|
-
/* @__PURE__ */ (0,
|
|
4135
|
-
isSelected && /* @__PURE__ */ (0,
|
|
4195
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate", children: itemLabel }),
|
|
4196
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Check, { className: "h-4 w-4 text-primary" })
|
|
4136
4197
|
]
|
|
4137
4198
|
},
|
|
4138
4199
|
`${itemValue}-${index}`
|
|
4139
4200
|
);
|
|
4140
|
-
}) : /* @__PURE__ */ (0,
|
|
4141
|
-
/* @__PURE__ */ (0,
|
|
4142
|
-
/* @__PURE__ */ (0,
|
|
4201
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { className: "px-3 py-8 text-center text-muted-foreground text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col items-center gap-2", children: [
|
|
4202
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Search, { className: "h-6 w-6 opacity-50" }),
|
|
4203
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: emptyText })
|
|
4143
4204
|
] }) }) }) })
|
|
4144
4205
|
] })
|
|
4145
4206
|
}
|
|
@@ -4153,8 +4214,8 @@ var Combobox = ({
|
|
|
4153
4214
|
const labelSize = size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm";
|
|
4154
4215
|
const radiusClass = size === "sm" ? "rounded-md" : "rounded-lg";
|
|
4155
4216
|
const verticalGap = size === "sm" ? "space-y-1.5" : "space-y-2";
|
|
4156
|
-
return /* @__PURE__ */ (0,
|
|
4157
|
-
label && /* @__PURE__ */ (0,
|
|
4217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("w-full group", verticalGap), children: [
|
|
4218
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4158
4219
|
"label",
|
|
4159
4220
|
{
|
|
4160
4221
|
id: labelId,
|
|
@@ -4166,11 +4227,11 @@ var Combobox = ({
|
|
|
4166
4227
|
),
|
|
4167
4228
|
children: [
|
|
4168
4229
|
label,
|
|
4169
|
-
required && /* @__PURE__ */ (0,
|
|
4230
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-destructive ml-1", children: "*" })
|
|
4170
4231
|
]
|
|
4171
4232
|
}
|
|
4172
4233
|
) }),
|
|
4173
|
-
/* @__PURE__ */ (0,
|
|
4234
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4174
4235
|
"button",
|
|
4175
4236
|
{
|
|
4176
4237
|
ref: triggerRef,
|
|
@@ -4200,10 +4261,10 @@ var Combobox = ({
|
|
|
4200
4261
|
className
|
|
4201
4262
|
),
|
|
4202
4263
|
children: [
|
|
4203
|
-
/* @__PURE__ */ (0,
|
|
4204
|
-
/* @__PURE__ */ (0,
|
|
4264
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: cn("truncate", !displayValue && "text-muted-foreground", fontBold && "font-bold"), children: displayValue || placeholder }),
|
|
4265
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-1 ml-2", children: [
|
|
4205
4266
|
allowClear && value && !disabled && // FIX: Use a div instead of a nested button
|
|
4206
|
-
/* @__PURE__ */ (0,
|
|
4267
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4207
4268
|
"div",
|
|
4208
4269
|
{
|
|
4209
4270
|
role: "button",
|
|
@@ -4212,10 +4273,10 @@ var Combobox = ({
|
|
|
4212
4273
|
onClick: handleClear,
|
|
4213
4274
|
onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && handleClear(e),
|
|
4214
4275
|
className: "opacity-0 group-hover:opacity-100 transition-opacity p-0.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive",
|
|
4215
|
-
children: /* @__PURE__ */ (0,
|
|
4276
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { className: "h-3 w-3" })
|
|
4216
4277
|
}
|
|
4217
4278
|
),
|
|
4218
|
-
/* @__PURE__ */ (0,
|
|
4279
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.ChevronDown, { className: cn("h-4 w-4 text-muted-foreground transition-transform duration-200", open && "rotate-180") })
|
|
4219
4280
|
] })
|
|
4220
4281
|
]
|
|
4221
4282
|
}
|
|
@@ -4226,7 +4287,7 @@ var Combobox = ({
|
|
|
4226
4287
|
|
|
4227
4288
|
// ../../components/ui/Pagination.tsx
|
|
4228
4289
|
var import_next_intl4 = require("next-intl");
|
|
4229
|
-
var
|
|
4290
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4230
4291
|
var Pagination = ({
|
|
4231
4292
|
page,
|
|
4232
4293
|
totalPages,
|
|
@@ -4309,13 +4370,13 @@ var Pagination = ({
|
|
|
4309
4370
|
}
|
|
4310
4371
|
};
|
|
4311
4372
|
if (totalPages <= 1) return null;
|
|
4312
|
-
return /* @__PURE__ */ (0,
|
|
4313
|
-
showInfo && totalItems && /* @__PURE__ */ (0,
|
|
4314
|
-
/* @__PURE__ */ (0,
|
|
4373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("nav", { className: cn("flex flex-col gap-4", className), "aria-label": labels?.navigationLabel || t("navigationLabel"), children: [
|
|
4374
|
+
showInfo && totalItems && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: cn("text-sm text-muted-foreground", textAlignmentClass), children: labels?.showingResults ? labels.showingResults({ startItem: startItem || 0, endItem: endItem || 0, totalItems }) : t("showingResults", { startItem: startItem || 0, endItem: endItem || 0, totalItems }) }),
|
|
4375
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: cn("flex items-center justify-between", {
|
|
4315
4376
|
"flex-row-reverse": alignment === "right" || alignment === "center"
|
|
4316
4377
|
}), children: [
|
|
4317
|
-
/* @__PURE__ */ (0,
|
|
4318
|
-
showFirstLast && /* @__PURE__ */ (0,
|
|
4378
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: cn("flex items-center gap-1"), children: [
|
|
4379
|
+
showFirstLast && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4319
4380
|
Button_default,
|
|
4320
4381
|
{
|
|
4321
4382
|
variant: getButtonVariant(false),
|
|
@@ -4329,7 +4390,7 @@ var Pagination = ({
|
|
|
4329
4390
|
"aria-disabled": disabled || page === 1
|
|
4330
4391
|
}
|
|
4331
4392
|
),
|
|
4332
|
-
showPrevNext && /* @__PURE__ */ (0,
|
|
4393
|
+
showPrevNext && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4333
4394
|
Button_default,
|
|
4334
4395
|
{
|
|
4335
4396
|
variant: getButtonVariant(false),
|
|
@@ -4340,16 +4401,16 @@ var Pagination = ({
|
|
|
4340
4401
|
title: labels?.previousPage || t("previousPage"),
|
|
4341
4402
|
"aria-label": labels?.previousPage || t("previousPage"),
|
|
4342
4403
|
"aria-disabled": disabled || page === 1,
|
|
4343
|
-
children: /* @__PURE__ */ (0,
|
|
4404
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "hidden sm:inline", children: labels?.previous || t("previous") })
|
|
4344
4405
|
}
|
|
4345
4406
|
),
|
|
4346
4407
|
showPageNumbers && createPageArray().map((p, i) => {
|
|
4347
4408
|
if (p === "...") {
|
|
4348
|
-
return /* @__PURE__ */ (0,
|
|
4409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button_default, { variant: "ghost", size, disabled: true, icon: import_lucide_react13.MoreHorizontal, className: "cursor-default" }, i);
|
|
4349
4410
|
}
|
|
4350
4411
|
const pageNumber = p;
|
|
4351
4412
|
const isActive = page === pageNumber;
|
|
4352
|
-
return /* @__PURE__ */ (0,
|
|
4413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4353
4414
|
Button_default,
|
|
4354
4415
|
{
|
|
4355
4416
|
variant: getButtonVariant(isActive),
|
|
@@ -4364,7 +4425,7 @@ var Pagination = ({
|
|
|
4364
4425
|
i
|
|
4365
4426
|
);
|
|
4366
4427
|
}),
|
|
4367
|
-
showPrevNext && /* @__PURE__ */ (0,
|
|
4428
|
+
showPrevNext && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4368
4429
|
Button_default,
|
|
4369
4430
|
{
|
|
4370
4431
|
variant: getButtonVariant(false),
|
|
@@ -4375,10 +4436,10 @@ var Pagination = ({
|
|
|
4375
4436
|
title: labels?.nextPage || t("nextPage"),
|
|
4376
4437
|
"aria-label": labels?.nextPage || t("nextPage"),
|
|
4377
4438
|
"aria-disabled": disabled || page === totalPages,
|
|
4378
|
-
children: /* @__PURE__ */ (0,
|
|
4439
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "hidden sm:inline", children: labels?.next || t("next") })
|
|
4379
4440
|
}
|
|
4380
4441
|
),
|
|
4381
|
-
showFirstLast && /* @__PURE__ */ (0,
|
|
4442
|
+
showFirstLast && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4382
4443
|
Button_default,
|
|
4383
4444
|
{
|
|
4384
4445
|
variant: getButtonVariant(false),
|
|
@@ -4393,12 +4454,12 @@ var Pagination = ({
|
|
|
4393
4454
|
}
|
|
4394
4455
|
)
|
|
4395
4456
|
] }),
|
|
4396
|
-
pageSizeOptions && onPageSizeChange && /* @__PURE__ */ (0,
|
|
4397
|
-
/* @__PURE__ */ (0,
|
|
4457
|
+
pageSizeOptions && onPageSizeChange && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: cn("flex items-center gap-2 text-sm"), children: [
|
|
4458
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
4398
4459
|
labels?.itemsPerPage || t("itemsPerPage"),
|
|
4399
4460
|
":"
|
|
4400
4461
|
] }),
|
|
4401
|
-
/* @__PURE__ */ (0,
|
|
4462
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-20", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4402
4463
|
Combobox,
|
|
4403
4464
|
{
|
|
4404
4465
|
options: pageSizeOptionsStrings,
|
|
@@ -4427,8 +4488,8 @@ var SimplePagination = ({
|
|
|
4427
4488
|
pageSize = 10
|
|
4428
4489
|
}) => {
|
|
4429
4490
|
if (totalPages <= 1) return null;
|
|
4430
|
-
return /* @__PURE__ */ (0,
|
|
4431
|
-
showInfo && totalItems && /* @__PURE__ */ (0,
|
|
4491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: cn("flex flex-col gap-2", className), children: [
|
|
4492
|
+
showInfo && totalItems && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "text-sm text-muted-foreground text-center", children: [
|
|
4432
4493
|
"Page ",
|
|
4433
4494
|
page,
|
|
4434
4495
|
" of ",
|
|
@@ -4437,15 +4498,15 @@ var SimplePagination = ({
|
|
|
4437
4498
|
totalItems,
|
|
4438
4499
|
" total items)"
|
|
4439
4500
|
] }),
|
|
4440
|
-
/* @__PURE__ */ (0,
|
|
4441
|
-
/* @__PURE__ */ (0,
|
|
4442
|
-
/* @__PURE__ */ (0,
|
|
4443
|
-
/* @__PURE__ */ (0,
|
|
4444
|
-
/* @__PURE__ */ (0,
|
|
4445
|
-
/* @__PURE__ */ (0,
|
|
4446
|
-
/* @__PURE__ */ (0,
|
|
4501
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4502
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button_default, { variant, size, icon: import_lucide_react13.ChevronLeft, onClick: () => onChange(Math.max(1, page - 1)), disabled: disabled || page === 1, children: "Previous" }),
|
|
4503
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
4504
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Page" }),
|
|
4505
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-medium text-foreground", children: page }),
|
|
4506
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "of" }),
|
|
4507
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-medium text-foreground", children: totalPages })
|
|
4447
4508
|
] }),
|
|
4448
|
-
/* @__PURE__ */ (0,
|
|
4509
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4449
4510
|
Button_default,
|
|
4450
4511
|
{
|
|
4451
4512
|
variant,
|
|
@@ -4468,8 +4529,8 @@ var CompactPagination = ({
|
|
|
4468
4529
|
disabled = false
|
|
4469
4530
|
}) => {
|
|
4470
4531
|
if (totalPages <= 1) return null;
|
|
4471
|
-
return /* @__PURE__ */ (0,
|
|
4472
|
-
/* @__PURE__ */ (0,
|
|
4532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("nav", { className: cn("flex items-center gap-1", className), "aria-label": "Compact Pagination", children: [
|
|
4533
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4473
4534
|
Button_default,
|
|
4474
4535
|
{
|
|
4475
4536
|
variant,
|
|
@@ -4481,7 +4542,7 @@ var CompactPagination = ({
|
|
|
4481
4542
|
"aria-label": "First page"
|
|
4482
4543
|
}
|
|
4483
4544
|
),
|
|
4484
|
-
/* @__PURE__ */ (0,
|
|
4545
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4485
4546
|
Button_default,
|
|
4486
4547
|
{
|
|
4487
4548
|
variant,
|
|
@@ -4492,12 +4553,12 @@ var CompactPagination = ({
|
|
|
4492
4553
|
title: "Previous page"
|
|
4493
4554
|
}
|
|
4494
4555
|
),
|
|
4495
|
-
/* @__PURE__ */ (0,
|
|
4556
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "px-2 py-1 text-sm text-muted-foreground min-w-[4rem] text-center", children: [
|
|
4496
4557
|
page,
|
|
4497
4558
|
" / ",
|
|
4498
4559
|
totalPages
|
|
4499
4560
|
] }),
|
|
4500
|
-
/* @__PURE__ */ (0,
|
|
4561
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4501
4562
|
Button_default,
|
|
4502
4563
|
{
|
|
4503
4564
|
variant,
|
|
@@ -4508,7 +4569,7 @@ var CompactPagination = ({
|
|
|
4508
4569
|
title: "Next page"
|
|
4509
4570
|
}
|
|
4510
4571
|
),
|
|
4511
|
-
/* @__PURE__ */ (0,
|
|
4572
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4512
4573
|
Button_default,
|
|
4513
4574
|
{
|
|
4514
4575
|
variant,
|
|
@@ -4523,15 +4584,16 @@ var CompactPagination = ({
|
|
|
4523
4584
|
};
|
|
4524
4585
|
|
|
4525
4586
|
// ../../components/ui/Section.tsx
|
|
4526
|
-
var
|
|
4527
|
-
var
|
|
4528
|
-
var Section =
|
|
4587
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
4588
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4589
|
+
var Section = import_react12.default.forwardRef(
|
|
4529
4590
|
({
|
|
4530
4591
|
children,
|
|
4531
4592
|
className,
|
|
4532
4593
|
variant = "default",
|
|
4533
4594
|
spacing = "lg",
|
|
4534
4595
|
fullWidth = false,
|
|
4596
|
+
outlined = false,
|
|
4535
4597
|
...props
|
|
4536
4598
|
}, ref) => {
|
|
4537
4599
|
const variantClasses = {
|
|
@@ -4546,13 +4608,14 @@ var Section = import_react11.default.forwardRef(
|
|
|
4546
4608
|
lg: "py-12",
|
|
4547
4609
|
xl: "py-16"
|
|
4548
4610
|
};
|
|
4549
|
-
return /* @__PURE__ */ (0,
|
|
4611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4550
4612
|
"section",
|
|
4551
4613
|
{
|
|
4552
4614
|
ref,
|
|
4553
4615
|
className: cn(
|
|
4554
4616
|
variantClasses[variant],
|
|
4555
4617
|
spacingClasses[spacing],
|
|
4618
|
+
outlined && "rounded-lg border border-border/60",
|
|
4556
4619
|
!fullWidth && "container mx-auto px-4 md:px-6",
|
|
4557
4620
|
className
|
|
4558
4621
|
),
|
|
@@ -4566,16 +4629,16 @@ Section.displayName = "Section";
|
|
|
4566
4629
|
var Section_default = Section;
|
|
4567
4630
|
|
|
4568
4631
|
// ../../components/ui/ScrollArea.tsx
|
|
4569
|
-
var
|
|
4570
|
-
var
|
|
4571
|
-
var ScrollArea = (0,
|
|
4572
|
-
return /* @__PURE__ */ (0,
|
|
4632
|
+
var import_react13 = require("react");
|
|
4633
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4634
|
+
var ScrollArea = (0, import_react13.forwardRef)(({ className, children, ...props }, ref) => {
|
|
4635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref, className: cn("relative overflow-hidden bg-background", className), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: cn("h-full w-full overflow-y-auto scroll-area-viewport"), children }) });
|
|
4573
4636
|
});
|
|
4574
4637
|
ScrollArea.displayName = "ScrollArea";
|
|
4575
4638
|
|
|
4576
4639
|
// ../../components/ui/DatePicker.tsx
|
|
4577
4640
|
var React21 = __toESM(require("react"), 1);
|
|
4578
|
-
var
|
|
4641
|
+
var import_react14 = require("react");
|
|
4579
4642
|
var import_react_dom7 = require("react-dom");
|
|
4580
4643
|
var import_lucide_react14 = require("lucide-react");
|
|
4581
4644
|
var import_next_intl5 = require("next-intl");
|
|
@@ -4760,7 +4823,7 @@ function formatDateWithDay(date) {
|
|
|
4760
4823
|
}
|
|
4761
4824
|
|
|
4762
4825
|
// ../../components/ui/DatePicker.tsx
|
|
4763
|
-
var
|
|
4826
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4764
4827
|
var DatePicker = ({
|
|
4765
4828
|
id,
|
|
4766
4829
|
value,
|
|
@@ -4871,7 +4934,7 @@ var DatePicker = ({
|
|
|
4871
4934
|
const firstDayOfMonth = getFirstDayOfMonth(viewDate);
|
|
4872
4935
|
const days = [];
|
|
4873
4936
|
for (let i = 0; i < firstDayOfMonth; i++) {
|
|
4874
|
-
days.push(/* @__PURE__ */ (0,
|
|
4937
|
+
days.push(/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-8 h-8" }, `empty-${i}`));
|
|
4875
4938
|
}
|
|
4876
4939
|
for (let day = 1; day <= daysInMonth; day++) {
|
|
4877
4940
|
const date = new Date(viewDate.getFullYear(), viewDate.getMonth(), day);
|
|
@@ -4880,7 +4943,7 @@ var DatePicker = ({
|
|
|
4880
4943
|
const totalDaysFromStart = firstDayOfMonth + day - 1;
|
|
4881
4944
|
const rowIndex = Math.floor(totalDaysFromStart / 7);
|
|
4882
4945
|
days.push(
|
|
4883
|
-
/* @__PURE__ */ (0,
|
|
4946
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4884
4947
|
"button",
|
|
4885
4948
|
{
|
|
4886
4949
|
onClick: () => handleDateSelect(date),
|
|
@@ -4903,7 +4966,7 @@ var DatePicker = ({
|
|
|
4903
4966
|
}
|
|
4904
4967
|
return days;
|
|
4905
4968
|
};
|
|
4906
|
-
const datePickerContent = isOpen && dropdownPosition ? /* @__PURE__ */ (0,
|
|
4969
|
+
const datePickerContent = isOpen && dropdownPosition ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4907
4970
|
"div",
|
|
4908
4971
|
{
|
|
4909
4972
|
"data-datepicker": true,
|
|
@@ -4921,7 +4984,7 @@ var DatePicker = ({
|
|
|
4921
4984
|
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
4922
4985
|
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"
|
|
4923
4986
|
),
|
|
4924
|
-
children: /* @__PURE__ */ (0,
|
|
4987
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4925
4988
|
"div",
|
|
4926
4989
|
{
|
|
4927
4990
|
ref: dropdownRef,
|
|
@@ -4932,14 +4995,14 @@ var DatePicker = ({
|
|
|
4932
4995
|
),
|
|
4933
4996
|
style: { pointerEvents: "auto" },
|
|
4934
4997
|
children: [
|
|
4935
|
-
/* @__PURE__ */ (0,
|
|
4936
|
-
/* @__PURE__ */ (0,
|
|
4937
|
-
/* @__PURE__ */ (0,
|
|
4938
|
-
/* @__PURE__ */ (0,
|
|
4998
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [
|
|
4999
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button_default, { variant: "ghost", size: "sm", onClick: () => navigateMonth("prev"), className: "p-1 h-auto", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react14.ChevronLeft, { className: "h-4 w-4" }) }),
|
|
5000
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-sm font-semibold", children: viewDate.toLocaleDateString("en-US", { month: "long", year: "numeric" }) }),
|
|
5001
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button_default, { variant: "ghost", size: "sm", onClick: () => navigateMonth("next"), className: "p-1 h-auto", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react14.ChevronRight, { className: "h-4 w-4" }) })
|
|
4939
5002
|
] }),
|
|
4940
|
-
/* @__PURE__ */ (0,
|
|
4941
|
-
/* @__PURE__ */ (0,
|
|
4942
|
-
/* @__PURE__ */ (0,
|
|
5003
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cn("grid grid-cols-7 gap-1", size === "sm" ? "mb-1" : "mb-2"), children: (weekdayLabels || ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]).map((day) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cn("text-muted-foreground text-center font-medium", size === "sm" ? "text-[10px] py-0.5" : "text-xs py-1"), children: day }, day)) }),
|
|
5004
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "grid grid-cols-7 gap-1", children: renderCalendar() }),
|
|
5005
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center justify-end mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4943
5006
|
Button_default,
|
|
4944
5007
|
{
|
|
4945
5008
|
variant: "outline",
|
|
@@ -4957,14 +5020,14 @@ var DatePicker = ({
|
|
|
4957
5020
|
)
|
|
4958
5021
|
}
|
|
4959
5022
|
) : null;
|
|
4960
|
-
const autoId = (0,
|
|
5023
|
+
const autoId = (0, import_react14.useId)();
|
|
4961
5024
|
const resolvedId = id ? String(id) : `datepicker-${autoId}`;
|
|
4962
5025
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
4963
5026
|
const labelSize = size === "sm" ? "text-xs" : "text-sm";
|
|
4964
5027
|
const radiusClass = size === "sm" ? "rounded-md" : "rounded-lg";
|
|
4965
5028
|
const verticalGap = size === "sm" ? "space-y-1.5" : "space-y-2";
|
|
4966
|
-
return /* @__PURE__ */ (0,
|
|
4967
|
-
label && /* @__PURE__ */ (0,
|
|
5029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: cn("w-full group", verticalGap), children: [
|
|
5030
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4968
5031
|
"label",
|
|
4969
5032
|
{
|
|
4970
5033
|
id: labelId,
|
|
@@ -4976,11 +5039,11 @@ var DatePicker = ({
|
|
|
4976
5039
|
),
|
|
4977
5040
|
children: [
|
|
4978
5041
|
label,
|
|
4979
|
-
required && /* @__PURE__ */ (0,
|
|
5042
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-destructive ml-1", children: "*" })
|
|
4980
5043
|
]
|
|
4981
5044
|
}
|
|
4982
5045
|
) }),
|
|
4983
|
-
/* @__PURE__ */ (0,
|
|
5046
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4984
5047
|
"button",
|
|
4985
5048
|
{
|
|
4986
5049
|
ref: triggerRef,
|
|
@@ -5008,8 +5071,8 @@ var DatePicker = ({
|
|
|
5008
5071
|
className
|
|
5009
5072
|
),
|
|
5010
5073
|
children: [
|
|
5011
|
-
/* @__PURE__ */ (0,
|
|
5012
|
-
value && /* @__PURE__ */ (0,
|
|
5074
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: cn("truncate", !value && "text-muted-foreground"), children: value ? formatDateDisplay(value) : placeholder || t("placeholder") }),
|
|
5075
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5013
5076
|
"span",
|
|
5014
5077
|
{
|
|
5015
5078
|
role: "button",
|
|
@@ -5031,10 +5094,10 @@ var DatePicker = ({
|
|
|
5031
5094
|
},
|
|
5032
5095
|
className: "absolute right-8 inline-flex items-center justify-center rounded-sm text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors cursor-pointer",
|
|
5033
5096
|
style: { width: 20, height: 20 },
|
|
5034
|
-
children: /* @__PURE__ */ (0,
|
|
5097
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react14.X, { className: "h-3.5 w-3.5" })
|
|
5035
5098
|
}
|
|
5036
5099
|
),
|
|
5037
|
-
/* @__PURE__ */ (0,
|
|
5100
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react14.Calendar, { className: "h-4 w-4 text-muted-foreground ml-2" })
|
|
5038
5101
|
]
|
|
5039
5102
|
}
|
|
5040
5103
|
),
|
|
@@ -5119,7 +5182,7 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
5119
5182
|
const nodes = [];
|
|
5120
5183
|
const daysInMonth = getDaysInMonth(viewDate);
|
|
5121
5184
|
const firstDay = getFirstDayOfMonth(viewDate);
|
|
5122
|
-
for (let i = 0; i < firstDay; i++) nodes.push(/* @__PURE__ */ (0,
|
|
5185
|
+
for (let i = 0; i < firstDay; i++) nodes.push(/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-8 h-8" }, `e-${i}`));
|
|
5123
5186
|
for (let d = 1; d <= daysInMonth; d++) {
|
|
5124
5187
|
const date = new Date(viewDate.getFullYear(), viewDate.getMonth(), d);
|
|
5125
5188
|
const isSelectedStart = isSameDay(date, tempStart);
|
|
@@ -5144,7 +5207,7 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
5144
5207
|
}
|
|
5145
5208
|
}
|
|
5146
5209
|
nodes.push(
|
|
5147
|
-
/* @__PURE__ */ (0,
|
|
5210
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5148
5211
|
"button",
|
|
5149
5212
|
{
|
|
5150
5213
|
onClick: () => handleSelect(date),
|
|
@@ -5174,7 +5237,7 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
5174
5237
|
}
|
|
5175
5238
|
return nodes;
|
|
5176
5239
|
};
|
|
5177
|
-
const panel = isOpen && dropdownPosition ? /* @__PURE__ */ (0,
|
|
5240
|
+
const panel = isOpen && dropdownPosition ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5178
5241
|
"div",
|
|
5179
5242
|
{
|
|
5180
5243
|
style: { position: "absolute", top: dropdownPosition.top, left: dropdownPosition.left, width: dropdownPosition.width || 256, zIndex: 9999 },
|
|
@@ -5184,37 +5247,37 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
5184
5247
|
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
5185
5248
|
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"
|
|
5186
5249
|
),
|
|
5187
|
-
children: /* @__PURE__ */ (0,
|
|
5250
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5188
5251
|
"div",
|
|
5189
5252
|
{
|
|
5190
5253
|
ref: panelRef,
|
|
5191
5254
|
className: cn("rounded-md border bg-popover text-popover-foreground shadow-md", "backdrop-blur-sm bg-popover/95 border-border/60 p-4 w-64"),
|
|
5192
5255
|
children: [
|
|
5193
|
-
/* @__PURE__ */ (0,
|
|
5194
|
-
/* @__PURE__ */ (0,
|
|
5256
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between mb-3", children: [
|
|
5257
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5195
5258
|
Button_default,
|
|
5196
5259
|
{
|
|
5197
5260
|
variant: "ghost",
|
|
5198
5261
|
size: "sm",
|
|
5199
5262
|
onClick: () => setViewDate(new Date(viewDate.getFullYear(), viewDate.getMonth() - 1, 1)),
|
|
5200
5263
|
className: "p-1 h-auto",
|
|
5201
|
-
children: /* @__PURE__ */ (0,
|
|
5264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react14.ChevronLeft, { className: "h-4 w-4" })
|
|
5202
5265
|
}
|
|
5203
5266
|
),
|
|
5204
|
-
/* @__PURE__ */ (0,
|
|
5205
|
-
/* @__PURE__ */ (0,
|
|
5267
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-sm font-semibold", children: viewDate.toLocaleDateString("en-US", { month: "long", year: "numeric" }) }),
|
|
5268
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5206
5269
|
Button_default,
|
|
5207
5270
|
{
|
|
5208
5271
|
variant: "ghost",
|
|
5209
5272
|
size: "sm",
|
|
5210
5273
|
onClick: () => setViewDate(new Date(viewDate.getFullYear(), viewDate.getMonth() + 1, 1)),
|
|
5211
5274
|
className: "p-1 h-auto",
|
|
5212
|
-
children: /* @__PURE__ */ (0,
|
|
5275
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react14.ChevronRight, { className: "h-4 w-4" })
|
|
5213
5276
|
}
|
|
5214
5277
|
)
|
|
5215
5278
|
] }),
|
|
5216
|
-
/* @__PURE__ */ (0,
|
|
5217
|
-
/* @__PURE__ */ (0,
|
|
5279
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "grid grid-cols-7 gap-1 mb-2", children: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((d) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-xs text-muted-foreground text-center py-1 font-medium", children: d }, d)) }),
|
|
5280
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "grid grid-cols-7", children: renderGrid() })
|
|
5218
5281
|
]
|
|
5219
5282
|
}
|
|
5220
5283
|
)
|
|
@@ -5222,8 +5285,8 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
5222
5285
|
) : null;
|
|
5223
5286
|
const displayFormat = (date) => formatDateShort(date);
|
|
5224
5287
|
const label = tempStart && tempEnd ? `${displayFormat(tempStart)} - ${displayFormat(tempEnd)}` : tempStart ? `${displayFormat(tempStart)} - ...` : placeholder;
|
|
5225
|
-
return /* @__PURE__ */ (0,
|
|
5226
|
-
/* @__PURE__ */ (0,
|
|
5288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5289
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5227
5290
|
"button",
|
|
5228
5291
|
{
|
|
5229
5292
|
ref: triggerRef,
|
|
@@ -5242,8 +5305,8 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
5242
5305
|
className
|
|
5243
5306
|
),
|
|
5244
5307
|
children: [
|
|
5245
|
-
/* @__PURE__ */ (0,
|
|
5246
|
-
/* @__PURE__ */ (0,
|
|
5308
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: cn("truncate", !tempStart && !tempEnd && "text-muted-foreground"), children: label }),
|
|
5309
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react14.Calendar, { className: "h-4 w-4 text-muted-foreground ml-2" })
|
|
5247
5310
|
]
|
|
5248
5311
|
}
|
|
5249
5312
|
),
|
|
@@ -5253,10 +5316,10 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
5253
5316
|
|
|
5254
5317
|
// ../../components/ui/MultiCombobox.tsx
|
|
5255
5318
|
var React22 = __toESM(require("react"), 1);
|
|
5256
|
-
var
|
|
5319
|
+
var import_react15 = require("react");
|
|
5257
5320
|
var import_react_dom8 = require("react-dom");
|
|
5258
5321
|
var import_lucide_react15 = require("lucide-react");
|
|
5259
|
-
var
|
|
5322
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5260
5323
|
var MultiCombobox = ({
|
|
5261
5324
|
id,
|
|
5262
5325
|
options,
|
|
@@ -5394,12 +5457,12 @@ var MultiCombobox = ({
|
|
|
5394
5457
|
tag: "px-2.5 py-1 text-sm"
|
|
5395
5458
|
}
|
|
5396
5459
|
};
|
|
5397
|
-
const autoId = (0,
|
|
5460
|
+
const autoId = (0, import_react15.useId)();
|
|
5398
5461
|
const resolvedId = id ? String(id) : `multicombobox-${autoId}`;
|
|
5399
5462
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
5400
5463
|
const labelSize = size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm";
|
|
5401
|
-
return /* @__PURE__ */ (0,
|
|
5402
|
-
title && /* @__PURE__ */ (0,
|
|
5464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn("w-full space-y-2 group", className), children: [
|
|
5465
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5403
5466
|
"label",
|
|
5404
5467
|
{
|
|
5405
5468
|
className: cn(
|
|
@@ -5409,11 +5472,11 @@ var MultiCombobox = ({
|
|
|
5409
5472
|
),
|
|
5410
5473
|
children: [
|
|
5411
5474
|
title,
|
|
5412
|
-
required && /* @__PURE__ */ (0,
|
|
5475
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-destructive ml-1", children: "*" })
|
|
5413
5476
|
]
|
|
5414
5477
|
}
|
|
5415
5478
|
) }),
|
|
5416
|
-
label && /* @__PURE__ */ (0,
|
|
5479
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5417
5480
|
"label",
|
|
5418
5481
|
{
|
|
5419
5482
|
id: labelId,
|
|
@@ -5425,12 +5488,12 @@ var MultiCombobox = ({
|
|
|
5425
5488
|
),
|
|
5426
5489
|
children: [
|
|
5427
5490
|
label,
|
|
5428
|
-
required && /* @__PURE__ */ (0,
|
|
5491
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-destructive ml-1", children: "*" })
|
|
5429
5492
|
]
|
|
5430
5493
|
}
|
|
5431
5494
|
),
|
|
5432
|
-
/* @__PURE__ */ (0,
|
|
5433
|
-
/* @__PURE__ */ (0,
|
|
5495
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "relative w-full" }),
|
|
5496
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5434
5497
|
"button",
|
|
5435
5498
|
{
|
|
5436
5499
|
ref: triggerRef,
|
|
@@ -5453,11 +5516,11 @@ var MultiCombobox = ({
|
|
|
5453
5516
|
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
5454
5517
|
),
|
|
5455
5518
|
children: [
|
|
5456
|
-
/* @__PURE__ */ (0,
|
|
5519
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex items-center gap-1 flex-wrap min-h-[1.5rem] flex-1", children: value.length > 0 ? showTags ? value.map((itemValue) => {
|
|
5457
5520
|
const option = normalizedOptions.find((o) => o.value === itemValue);
|
|
5458
|
-
return /* @__PURE__ */ (0,
|
|
5459
|
-
/* @__PURE__ */ (0,
|
|
5460
|
-
/* @__PURE__ */ (0,
|
|
5521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "inline-flex items-center gap-1 bg-accent text-accent-foreground rounded px-2 py-1 text-xs", children: [
|
|
5522
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "truncate max-w-[120px]", children: option ? displayFormat(option) : itemValue }),
|
|
5523
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5461
5524
|
"span",
|
|
5462
5525
|
{
|
|
5463
5526
|
role: "button",
|
|
@@ -5480,16 +5543,16 @@ var MultiCombobox = ({
|
|
|
5480
5543
|
}
|
|
5481
5544
|
)
|
|
5482
5545
|
] }, itemValue);
|
|
5483
|
-
}) : /* @__PURE__ */ (0,
|
|
5546
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "truncate text-sm", children: [
|
|
5484
5547
|
value.length,
|
|
5485
5548
|
" selected"
|
|
5486
|
-
] }) : /* @__PURE__ */ (0,
|
|
5487
|
-
/* @__PURE__ */ (0,
|
|
5549
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: placeholder || "Select..." }) }),
|
|
5550
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react15.ChevronDown, { className: cn("opacity-50 transition-transform", sizeStyles8[size].icon, open && "rotate-180") })
|
|
5488
5551
|
]
|
|
5489
5552
|
}
|
|
5490
5553
|
),
|
|
5491
5554
|
open && dropdownPosition && typeof window !== "undefined" ? (0, import_react_dom8.createPortal)(
|
|
5492
|
-
/* @__PURE__ */ (0,
|
|
5555
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5493
5556
|
"div",
|
|
5494
5557
|
{
|
|
5495
5558
|
"data-dropdown": "multicombobox",
|
|
@@ -5506,7 +5569,7 @@ var MultiCombobox = ({
|
|
|
5506
5569
|
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
5507
5570
|
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"
|
|
5508
5571
|
),
|
|
5509
|
-
children: /* @__PURE__ */ (0,
|
|
5572
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5510
5573
|
"div",
|
|
5511
5574
|
{
|
|
5512
5575
|
className: cn(
|
|
@@ -5514,7 +5577,7 @@ var MultiCombobox = ({
|
|
|
5514
5577
|
"backdrop-blur-sm bg-popover/95 border-border/60"
|
|
5515
5578
|
),
|
|
5516
5579
|
children: [
|
|
5517
|
-
showClear && value.length > 0 && /* @__PURE__ */ (0,
|
|
5580
|
+
showClear && value.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "px-3 py-2 border-b border-border/60 flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5518
5581
|
"button",
|
|
5519
5582
|
{
|
|
5520
5583
|
type: "button",
|
|
@@ -5527,9 +5590,9 @@ var MultiCombobox = ({
|
|
|
5527
5590
|
children: "Clear all"
|
|
5528
5591
|
}
|
|
5529
5592
|
) }),
|
|
5530
|
-
enableSearch && /* @__PURE__ */ (0,
|
|
5531
|
-
/* @__PURE__ */ (0,
|
|
5532
|
-
/* @__PURE__ */ (0,
|
|
5593
|
+
enableSearch && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "relative border-b border-border/60", children: [
|
|
5594
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react15.Search, { className: cn("absolute left-2 top-2.5 text-muted-foreground", sizeStyles8[size].icon) }),
|
|
5595
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5533
5596
|
"input",
|
|
5534
5597
|
{
|
|
5535
5598
|
ref: inputRef,
|
|
@@ -5544,10 +5607,10 @@ var MultiCombobox = ({
|
|
|
5544
5607
|
}
|
|
5545
5608
|
)
|
|
5546
5609
|
] }),
|
|
5547
|
-
/* @__PURE__ */ (0,
|
|
5610
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("ul", { className: cn("max-h-60 overflow-y-auto p-1", size === "lg" ? "text-base" : size === "sm" ? "text-xs" : "text-sm"), children: filtered.length ? filtered.map((item, index) => {
|
|
5548
5611
|
const isSelected = value.includes(item.value);
|
|
5549
5612
|
const isDisabled = disabledOptions.includes(item.value);
|
|
5550
|
-
return /* @__PURE__ */ (0,
|
|
5613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5551
5614
|
"li",
|
|
5552
5615
|
{
|
|
5553
5616
|
ref: (node) => {
|
|
@@ -5571,12 +5634,12 @@ var MultiCombobox = ({
|
|
|
5571
5634
|
),
|
|
5572
5635
|
children: [
|
|
5573
5636
|
item.label,
|
|
5574
|
-
isSelected && /* @__PURE__ */ (0,
|
|
5637
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react15.Check, { className: sizeStyles8[size].icon })
|
|
5575
5638
|
]
|
|
5576
5639
|
},
|
|
5577
5640
|
item.value
|
|
5578
5641
|
);
|
|
5579
|
-
}) : /* @__PURE__ */ (0,
|
|
5642
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("li", { className: cn("px-3 py-2 text-muted-foreground", size === "lg" ? "text-base" : size === "sm" ? "text-xs" : "text-sm"), children: "No result." }) })
|
|
5580
5643
|
]
|
|
5581
5644
|
}
|
|
5582
5645
|
)
|
|
@@ -5589,7 +5652,7 @@ var MultiCombobox = ({
|
|
|
5589
5652
|
|
|
5590
5653
|
// ../../components/ui/RadioGroup.tsx
|
|
5591
5654
|
var React23 = __toESM(require("react"), 1);
|
|
5592
|
-
var
|
|
5655
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5593
5656
|
var RadioGroupContext = React23.createContext(void 0);
|
|
5594
5657
|
var useRadioGroup = () => {
|
|
5595
5658
|
const context = React23.useContext(RadioGroupContext);
|
|
@@ -5627,7 +5690,7 @@ var RadioGroup = React23.forwardRef(
|
|
|
5627
5690
|
};
|
|
5628
5691
|
const uniqueId = React23.useId();
|
|
5629
5692
|
const radioName = name || `radio-group-${uniqueId}`;
|
|
5630
|
-
return /* @__PURE__ */ (0,
|
|
5693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5631
5694
|
RadioGroupContext.Provider,
|
|
5632
5695
|
{
|
|
5633
5696
|
value: {
|
|
@@ -5638,8 +5701,8 @@ var RadioGroup = React23.forwardRef(
|
|
|
5638
5701
|
size,
|
|
5639
5702
|
variant
|
|
5640
5703
|
},
|
|
5641
|
-
children: /* @__PURE__ */ (0,
|
|
5642
|
-
/* @__PURE__ */ (0,
|
|
5704
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "space-y-2", children: [
|
|
5705
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5643
5706
|
"div",
|
|
5644
5707
|
{
|
|
5645
5708
|
ref,
|
|
@@ -5656,7 +5719,7 @@ var RadioGroup = React23.forwardRef(
|
|
|
5656
5719
|
children
|
|
5657
5720
|
}
|
|
5658
5721
|
),
|
|
5659
|
-
error && errorMessage && /* @__PURE__ */ (0,
|
|
5722
|
+
error && errorMessage && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-sm text-destructive mt-1", children: errorMessage })
|
|
5660
5723
|
] })
|
|
5661
5724
|
}
|
|
5662
5725
|
);
|
|
@@ -5698,7 +5761,7 @@ var RadioGroupItem = React23.forwardRef(
|
|
|
5698
5761
|
const Icon = icon;
|
|
5699
5762
|
const radioId = id || `radio-${value}`;
|
|
5700
5763
|
if (variant === "card") {
|
|
5701
|
-
return /* @__PURE__ */ (0,
|
|
5764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5702
5765
|
"div",
|
|
5703
5766
|
{
|
|
5704
5767
|
className: cn(
|
|
@@ -5710,8 +5773,8 @@ var RadioGroupItem = React23.forwardRef(
|
|
|
5710
5773
|
className
|
|
5711
5774
|
),
|
|
5712
5775
|
children: [
|
|
5713
|
-
/* @__PURE__ */ (0,
|
|
5714
|
-
/* @__PURE__ */ (0,
|
|
5776
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
5777
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5715
5778
|
"button",
|
|
5716
5779
|
{
|
|
5717
5780
|
ref,
|
|
@@ -5730,22 +5793,22 @@ var RadioGroupItem = React23.forwardRef(
|
|
|
5730
5793
|
sizeStyles7[size].radio
|
|
5731
5794
|
),
|
|
5732
5795
|
onClick: () => onValueChange?.(value),
|
|
5733
|
-
children: /* @__PURE__ */ (0,
|
|
5796
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5734
5797
|
"span",
|
|
5735
5798
|
{
|
|
5736
5799
|
className: cn(
|
|
5737
5800
|
"flex items-center justify-center w-full h-full rounded-full transition-all duration-200",
|
|
5738
5801
|
isSelected && "bg-primary"
|
|
5739
5802
|
),
|
|
5740
|
-
children: isSelected && /* @__PURE__ */ (0,
|
|
5803
|
+
children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: cn("bg-primary-foreground rounded-full", sizeStyles7[size].dot) })
|
|
5741
5804
|
}
|
|
5742
5805
|
)
|
|
5743
5806
|
}
|
|
5744
5807
|
),
|
|
5745
|
-
/* @__PURE__ */ (0,
|
|
5746
|
-
/* @__PURE__ */ (0,
|
|
5747
|
-
Icon && /* @__PURE__ */ (0,
|
|
5748
|
-
/* @__PURE__ */ (0,
|
|
5808
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
5809
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5810
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { className: "h-4 w-4 text-foreground" }),
|
|
5811
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5749
5812
|
"label",
|
|
5750
5813
|
{
|
|
5751
5814
|
htmlFor: radioId,
|
|
@@ -5757,10 +5820,10 @@ var RadioGroupItem = React23.forwardRef(
|
|
|
5757
5820
|
}
|
|
5758
5821
|
)
|
|
5759
5822
|
] }),
|
|
5760
|
-
description && /* @__PURE__ */ (0,
|
|
5823
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground mt-1 text-xs", children: description })
|
|
5761
5824
|
] })
|
|
5762
5825
|
] }),
|
|
5763
|
-
/* @__PURE__ */ (0,
|
|
5826
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5764
5827
|
"input",
|
|
5765
5828
|
{
|
|
5766
5829
|
type: "radio",
|
|
@@ -5778,7 +5841,7 @@ var RadioGroupItem = React23.forwardRef(
|
|
|
5778
5841
|
);
|
|
5779
5842
|
}
|
|
5780
5843
|
if (variant === "button") {
|
|
5781
|
-
return /* @__PURE__ */ (0,
|
|
5844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5782
5845
|
"button",
|
|
5783
5846
|
{
|
|
5784
5847
|
ref,
|
|
@@ -5800,9 +5863,9 @@ var RadioGroupItem = React23.forwardRef(
|
|
|
5800
5863
|
),
|
|
5801
5864
|
onClick: () => onValueChange?.(value),
|
|
5802
5865
|
children: [
|
|
5803
|
-
Icon && /* @__PURE__ */ (0,
|
|
5866
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { className: "h-4 w-4" }),
|
|
5804
5867
|
label || children,
|
|
5805
|
-
/* @__PURE__ */ (0,
|
|
5868
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5806
5869
|
"input",
|
|
5807
5870
|
{
|
|
5808
5871
|
type: "radio",
|
|
@@ -5819,8 +5882,8 @@ var RadioGroupItem = React23.forwardRef(
|
|
|
5819
5882
|
}
|
|
5820
5883
|
);
|
|
5821
5884
|
}
|
|
5822
|
-
return /* @__PURE__ */ (0,
|
|
5823
|
-
/* @__PURE__ */ (0,
|
|
5885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: cn("flex items-center gap-2", className), children: [
|
|
5886
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5824
5887
|
"button",
|
|
5825
5888
|
{
|
|
5826
5889
|
ref,
|
|
@@ -5839,19 +5902,19 @@ var RadioGroupItem = React23.forwardRef(
|
|
|
5839
5902
|
sizeStyles7[size].radio
|
|
5840
5903
|
),
|
|
5841
5904
|
onClick: () => onValueChange?.(value),
|
|
5842
|
-
children: /* @__PURE__ */ (0,
|
|
5905
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5843
5906
|
"span",
|
|
5844
5907
|
{
|
|
5845
5908
|
className: cn(
|
|
5846
5909
|
"flex items-center justify-center w-full h-full rounded-full transition-all duration-200",
|
|
5847
5910
|
isSelected && "bg-primary"
|
|
5848
5911
|
),
|
|
5849
|
-
children: isSelected && /* @__PURE__ */ (0,
|
|
5912
|
+
children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: cn("bg-primary-foreground rounded-full", sizeStyles7[size].dot) })
|
|
5850
5913
|
}
|
|
5851
5914
|
)
|
|
5852
5915
|
}
|
|
5853
5916
|
),
|
|
5854
|
-
(label || children) && /* @__PURE__ */ (0,
|
|
5917
|
+
(label || children) && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5855
5918
|
"label",
|
|
5856
5919
|
{
|
|
5857
5920
|
htmlFor: radioId,
|
|
@@ -5862,15 +5925,15 @@ var RadioGroupItem = React23.forwardRef(
|
|
|
5862
5925
|
isDisabled && "cursor-not-allowed opacity-50"
|
|
5863
5926
|
),
|
|
5864
5927
|
children: [
|
|
5865
|
-
/* @__PURE__ */ (0,
|
|
5866
|
-
Icon && /* @__PURE__ */ (0,
|
|
5867
|
-
/* @__PURE__ */ (0,
|
|
5928
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5929
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { className: "h-4 w-4" }),
|
|
5930
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: label || children })
|
|
5868
5931
|
] }),
|
|
5869
|
-
description && /* @__PURE__ */ (0,
|
|
5932
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground mt-0.5 text-xs", children: description })
|
|
5870
5933
|
]
|
|
5871
5934
|
}
|
|
5872
5935
|
),
|
|
5873
|
-
/* @__PURE__ */ (0,
|
|
5936
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5874
5937
|
"input",
|
|
5875
5938
|
{
|
|
5876
5939
|
type: "radio",
|
|
@@ -5890,7 +5953,7 @@ RadioGroupItem.displayName = "RadioGroupItem";
|
|
|
5890
5953
|
|
|
5891
5954
|
// ../../components/ui/Slider.tsx
|
|
5892
5955
|
var React24 = __toESM(require("react"), 1);
|
|
5893
|
-
var
|
|
5956
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5894
5957
|
var SIZE_STYLES = {
|
|
5895
5958
|
sm: {
|
|
5896
5959
|
track: "h-1",
|
|
@@ -5950,20 +6013,20 @@ var Slider = React24.forwardRef(
|
|
|
5950
6013
|
const displayValue = formatValue ? formatValue(currentValue) : currentValue.toString();
|
|
5951
6014
|
if (orientation === "vertical") {
|
|
5952
6015
|
}
|
|
5953
|
-
return /* @__PURE__ */ (0,
|
|
5954
|
-
(label || showValue) && /* @__PURE__ */ (0,
|
|
5955
|
-
label && /* @__PURE__ */ (0,
|
|
5956
|
-
showValue && /* @__PURE__ */ (0,
|
|
6016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: cn("w-full space-y-2", containerClassName), children: [
|
|
6017
|
+
(label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6018
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("label", { className: cn("text-sm font-medium text-foreground", labelClassName), children: label }),
|
|
6019
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: cn("text-xs font-mono text-muted-foreground min-w-[2rem] text-right", valueClassName), children: displayValue })
|
|
5957
6020
|
] }),
|
|
5958
|
-
/* @__PURE__ */ (0,
|
|
5959
|
-
/* @__PURE__ */ (0,
|
|
6021
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: cn("relative flex items-center", sizeStyles8.container), children: [
|
|
6022
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cn("w-full rounded-full bg-secondary relative overflow-hidden", sizeStyles8.track, trackClassName), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5960
6023
|
"div",
|
|
5961
6024
|
{
|
|
5962
6025
|
className: "absolute left-0 top-0 h-full bg-primary rounded-full transition-all duration-150 ease-out",
|
|
5963
6026
|
style: { width: `${percentage}%` }
|
|
5964
6027
|
}
|
|
5965
6028
|
) }),
|
|
5966
|
-
/* @__PURE__ */ (0,
|
|
6029
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5967
6030
|
"input",
|
|
5968
6031
|
{
|
|
5969
6032
|
ref,
|
|
@@ -6028,8 +6091,8 @@ Slider.displayName = "Slider";
|
|
|
6028
6091
|
|
|
6029
6092
|
// ../../components/ui/OverlayControls.tsx
|
|
6030
6093
|
var import_lucide_react16 = require("lucide-react");
|
|
6031
|
-
var
|
|
6032
|
-
var
|
|
6094
|
+
var import_react16 = __toESM(require("react"), 1);
|
|
6095
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6033
6096
|
function OverlayControls({
|
|
6034
6097
|
mode,
|
|
6035
6098
|
value,
|
|
@@ -6059,24 +6122,24 @@ function OverlayControls({
|
|
|
6059
6122
|
}) {
|
|
6060
6123
|
const hoverClasses = showOnHover ? "opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto" : "opacity-100 pointer-events-auto";
|
|
6061
6124
|
const showControlsBar = mode === "review";
|
|
6062
|
-
const [rateOpen, setRateOpen] =
|
|
6063
|
-
const rateWrapRef =
|
|
6064
|
-
const [controlsVisible, setControlsVisible] =
|
|
6065
|
-
const hideTimerRef =
|
|
6066
|
-
const [previewData, setPreviewData] =
|
|
6067
|
-
const sliderRef =
|
|
6068
|
-
const [isDragging, setIsDragging] =
|
|
6069
|
-
const [dragValue, setDragValue] =
|
|
6070
|
-
|
|
6125
|
+
const [rateOpen, setRateOpen] = import_react16.default.useState(false);
|
|
6126
|
+
const rateWrapRef = import_react16.default.useRef(null);
|
|
6127
|
+
const [controlsVisible, setControlsVisible] = import_react16.default.useState(true);
|
|
6128
|
+
const hideTimerRef = import_react16.default.useRef(null);
|
|
6129
|
+
const [previewData, setPreviewData] = import_react16.default.useState(null);
|
|
6130
|
+
const sliderRef = import_react16.default.useRef(null);
|
|
6131
|
+
const [isDragging, setIsDragging] = import_react16.default.useState(false);
|
|
6132
|
+
const [dragValue, setDragValue] = import_react16.default.useState(value);
|
|
6133
|
+
import_react16.default.useEffect(() => {
|
|
6071
6134
|
if (!isDragging) {
|
|
6072
6135
|
setDragValue(value);
|
|
6073
6136
|
}
|
|
6074
6137
|
}, [value, isDragging]);
|
|
6075
|
-
const [keyboardFeedback, setKeyboardFeedback] =
|
|
6076
|
-
const feedbackTimerRef =
|
|
6077
|
-
const seekAccumulatorRef =
|
|
6078
|
-
const seekAccumulatorTimerRef =
|
|
6079
|
-
|
|
6138
|
+
const [keyboardFeedback, setKeyboardFeedback] = import_react16.default.useState(null);
|
|
6139
|
+
const feedbackTimerRef = import_react16.default.useRef(null);
|
|
6140
|
+
const seekAccumulatorRef = import_react16.default.useRef(0);
|
|
6141
|
+
const seekAccumulatorTimerRef = import_react16.default.useRef(null);
|
|
6142
|
+
import_react16.default.useEffect(() => {
|
|
6080
6143
|
const onDocDown = (e) => {
|
|
6081
6144
|
if (!rateOpen) return;
|
|
6082
6145
|
const wrap = rateWrapRef.current;
|
|
@@ -6087,7 +6150,7 @@ function OverlayControls({
|
|
|
6087
6150
|
document.addEventListener("mousedown", onDocDown);
|
|
6088
6151
|
return () => document.removeEventListener("mousedown", onDocDown);
|
|
6089
6152
|
}, [rateOpen]);
|
|
6090
|
-
|
|
6153
|
+
import_react16.default.useEffect(() => {
|
|
6091
6154
|
if (!autoHide || showOnHover) return;
|
|
6092
6155
|
const resetTimer = () => {
|
|
6093
6156
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
@@ -6125,7 +6188,7 @@ function OverlayControls({
|
|
|
6125
6188
|
seekAccumulatorRef.current = 0;
|
|
6126
6189
|
}, 1e3);
|
|
6127
6190
|
};
|
|
6128
|
-
|
|
6191
|
+
import_react16.default.useEffect(() => {
|
|
6129
6192
|
if (!enableKeyboardShortcuts) return;
|
|
6130
6193
|
const handleKeyDown = (e) => {
|
|
6131
6194
|
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return;
|
|
@@ -6182,8 +6245,10 @@ function OverlayControls({
|
|
|
6182
6245
|
break;
|
|
6183
6246
|
case "f":
|
|
6184
6247
|
case "F":
|
|
6185
|
-
e.
|
|
6186
|
-
|
|
6248
|
+
if (!e.ctrlKey && !e.metaKey) {
|
|
6249
|
+
e.preventDefault();
|
|
6250
|
+
onToggleFullscreen?.();
|
|
6251
|
+
}
|
|
6187
6252
|
break;
|
|
6188
6253
|
case "m":
|
|
6189
6254
|
case "M":
|
|
@@ -6250,41 +6315,41 @@ function OverlayControls({
|
|
|
6250
6315
|
const handleSliderMouseLeave = () => {
|
|
6251
6316
|
setPreviewData(null);
|
|
6252
6317
|
};
|
|
6253
|
-
return /* @__PURE__ */ (0,
|
|
6254
|
-
keyboardFeedback && /* @__PURE__ */ (0,
|
|
6318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
6319
|
+
keyboardFeedback && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6255
6320
|
"div",
|
|
6256
6321
|
{
|
|
6257
6322
|
className: cn(
|
|
6258
6323
|
"absolute inset-0 flex items-center pointer-events-none z-50",
|
|
6259
6324
|
keyboardFeedback.type === "seek" && (keyboardFeedback.value ?? 0) > 0 ? "justify-end pr-32" : keyboardFeedback.type === "seek" && (keyboardFeedback.value ?? 0) < 0 ? "justify-start pl-32" : "justify-center"
|
|
6260
6325
|
),
|
|
6261
|
-
children: /* @__PURE__ */ (0,
|
|
6262
|
-
keyboardFeedback.type === "play" && /* @__PURE__ */ (0,
|
|
6263
|
-
keyboardFeedback.type === "pause" && /* @__PURE__ */ (0,
|
|
6264
|
-
keyboardFeedback.type === "seek" && /* @__PURE__ */ (0,
|
|
6265
|
-
(keyboardFeedback.value ?? 0) > 0 ? /* @__PURE__ */ (0,
|
|
6266
|
-
/* @__PURE__ */ (0,
|
|
6326
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "bg-black/50 backdrop-blur-sm rounded-xl px-6 py-4 shadow-xl border border-white/10 animate-in fade-in zoom-in duration-200", children: [
|
|
6327
|
+
keyboardFeedback.type === "play" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Play, { className: "w-16 h-16 text-white", fill: "white" }),
|
|
6328
|
+
keyboardFeedback.type === "pause" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Pause, { className: "w-16 h-16 text-white", fill: "white" }),
|
|
6329
|
+
keyboardFeedback.type === "seek" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
6330
|
+
(keyboardFeedback.value ?? 0) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.RotateCw, { className: "w-12 h-12 text-white" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.RotateCcw, { className: "w-12 h-12 text-white" }),
|
|
6331
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "text-3xl font-bold text-white", children: [
|
|
6267
6332
|
keyboardFeedback.value && keyboardFeedback.value > 0 ? "+" : "",
|
|
6268
6333
|
keyboardFeedback.value,
|
|
6269
6334
|
"s"
|
|
6270
6335
|
] })
|
|
6271
6336
|
] }),
|
|
6272
|
-
keyboardFeedback.type === "volume" && /* @__PURE__ */ (0,
|
|
6273
|
-
/* @__PURE__ */ (0,
|
|
6274
|
-
/* @__PURE__ */ (0,
|
|
6275
|
-
/* @__PURE__ */ (0,
|
|
6337
|
+
keyboardFeedback.type === "volume" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
6338
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Volume2, { className: "w-12 h-12 text-white" }),
|
|
6339
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
6340
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "text-2xl font-bold text-white", children: [
|
|
6276
6341
|
keyboardFeedback.value,
|
|
6277
6342
|
"%"
|
|
6278
6343
|
] }),
|
|
6279
|
-
/* @__PURE__ */ (0,
|
|
6344
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-32 h-1.5 bg-white/30 rounded-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-full bg-white rounded-full transition-all", style: { width: `${keyboardFeedback.value}%` } }) })
|
|
6280
6345
|
] })
|
|
6281
6346
|
] }),
|
|
6282
|
-
keyboardFeedback.type === "mute" && /* @__PURE__ */ (0,
|
|
6283
|
-
keyboardFeedback.type === "unmute" && /* @__PURE__ */ (0,
|
|
6347
|
+
keyboardFeedback.type === "mute" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.VolumeX, { className: "w-16 h-16 text-white" }),
|
|
6348
|
+
keyboardFeedback.type === "unmute" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Volume2, { className: "w-16 h-16 text-white" })
|
|
6284
6349
|
] })
|
|
6285
6350
|
}
|
|
6286
6351
|
),
|
|
6287
|
-
/* @__PURE__ */ (0,
|
|
6352
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6288
6353
|
"div",
|
|
6289
6354
|
{
|
|
6290
6355
|
className: cn(
|
|
@@ -6293,9 +6358,9 @@ function OverlayControls({
|
|
|
6293
6358
|
autoHide && !controlsVisible && "opacity-0 pointer-events-none",
|
|
6294
6359
|
className
|
|
6295
6360
|
),
|
|
6296
|
-
children: /* @__PURE__ */ (0,
|
|
6297
|
-
/* @__PURE__ */ (0,
|
|
6298
|
-
/* @__PURE__ */ (0,
|
|
6361
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "px-4", children: [
|
|
6362
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { ref: sliderRef, onMouseMove: handleSliderMouseMove, onMouseLeave: handleSliderMouseLeave, className: "relative", children: [
|
|
6363
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6299
6364
|
Slider,
|
|
6300
6365
|
{
|
|
6301
6366
|
min: 0,
|
|
@@ -6320,14 +6385,14 @@ function OverlayControls({
|
|
|
6320
6385
|
noFocus: true
|
|
6321
6386
|
}
|
|
6322
6387
|
),
|
|
6323
|
-
previewData && /* @__PURE__ */ (0,
|
|
6324
|
-
/* @__PURE__ */ (0,
|
|
6325
|
-
/* @__PURE__ */ (0,
|
|
6326
|
-
] }) : /* @__PURE__ */ (0,
|
|
6388
|
+
previewData && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "absolute bottom-full mb-2 transform -translate-x-1/2 pointer-events-none z-30", style: { left: `${previewData.x}px` }, children: previewData.url ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "bg-background/95 backdrop-blur rounded-md border border-border shadow-lg overflow-hidden", children: [
|
|
6389
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("img", { src: previewData.url, alt: "Preview", className: "w-40 h-24 object-cover" }),
|
|
6390
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "px-2 py-1 text-xs font-mono text-center bg-background/80", children: formatTime2(previewData.time) })
|
|
6391
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "px-3 py-1.5 rounded-md bg-background/90 backdrop-blur border border-border shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "text-xs font-mono text-center", children: formatTime2(previewData.time) }) }) })
|
|
6327
6392
|
] }),
|
|
6328
|
-
showControlsBar && /* @__PURE__ */ (0,
|
|
6329
|
-
/* @__PURE__ */ (0,
|
|
6330
|
-
/* @__PURE__ */ (0,
|
|
6393
|
+
showControlsBar && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "mt-2 flex items-center justify-between gap-2", children: [
|
|
6394
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
6395
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6331
6396
|
Button_default,
|
|
6332
6397
|
{
|
|
6333
6398
|
variant: "ghost",
|
|
@@ -6335,10 +6400,10 @@ function OverlayControls({
|
|
|
6335
6400
|
onClick: onTogglePlay,
|
|
6336
6401
|
title: playing ? "T\u1EA1m d\u1EEBng" : "Ph\xE1t",
|
|
6337
6402
|
className: "bg-background/60 hover:bg-background/80 border-transparent shadow-sm outline-none focus:outline-none focus:ring-0",
|
|
6338
|
-
children: playing ? /* @__PURE__ */ (0,
|
|
6403
|
+
children: playing ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Pause, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Play, { className: "w-4 h-4" })
|
|
6339
6404
|
}
|
|
6340
6405
|
),
|
|
6341
|
-
onSkip && /* @__PURE__ */ (0,
|
|
6406
|
+
onSkip && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6342
6407
|
Button_default,
|
|
6343
6408
|
{
|
|
6344
6409
|
variant: "ghost",
|
|
@@ -6346,10 +6411,10 @@ function OverlayControls({
|
|
|
6346
6411
|
onClick: () => onSkip(-skipSeconds),
|
|
6347
6412
|
title: `L\xF9i ${skipSeconds}s`,
|
|
6348
6413
|
className: "bg-background/60 hover:bg-background/80 border-transparent shadow-sm outline-none focus:outline-none focus:ring-0",
|
|
6349
|
-
children: /* @__PURE__ */ (0,
|
|
6414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.RotateCcw, { className: "w-4 h-4" })
|
|
6350
6415
|
}
|
|
6351
6416
|
),
|
|
6352
|
-
onSkip && /* @__PURE__ */ (0,
|
|
6417
|
+
onSkip && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6353
6418
|
Button_default,
|
|
6354
6419
|
{
|
|
6355
6420
|
variant: "ghost",
|
|
@@ -6357,16 +6422,16 @@ function OverlayControls({
|
|
|
6357
6422
|
onClick: () => onSkip(skipSeconds),
|
|
6358
6423
|
title: `Tua ${skipSeconds}s`,
|
|
6359
6424
|
className: "bg-background/60 hover:bg-background/80 border-transparent shadow-sm outline-none focus:outline-none focus:ring-0",
|
|
6360
|
-
children: /* @__PURE__ */ (0,
|
|
6425
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.RotateCw, { className: "w-4 h-4" })
|
|
6361
6426
|
}
|
|
6362
6427
|
),
|
|
6363
|
-
(showTime ?? true) && /* @__PURE__ */ (0,
|
|
6428
|
+
(showTime ?? true) && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "px-3 py-1 rounded-full text-xs font-mono bg-background/60 text-foreground shadow-sm border border-border whitespace-nowrap", children: [
|
|
6364
6429
|
formatTime2(dragValue),
|
|
6365
6430
|
" / ",
|
|
6366
6431
|
formatTime2(max)
|
|
6367
6432
|
] }),
|
|
6368
|
-
/* @__PURE__ */ (0,
|
|
6369
|
-
/* @__PURE__ */ (0,
|
|
6433
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
6434
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6370
6435
|
Button_default,
|
|
6371
6436
|
{
|
|
6372
6437
|
variant: "ghost",
|
|
@@ -6374,10 +6439,10 @@ function OverlayControls({
|
|
|
6374
6439
|
onClick: onToggleMute,
|
|
6375
6440
|
title: muted ? "B\u1EADt ti\u1EBFng" : "T\u1EAFt ti\u1EBFng",
|
|
6376
6441
|
className: "bg-background/60 hover:bg-background/80 border-transparent shadow-sm outline-none focus:outline-none focus:ring-0",
|
|
6377
|
-
children: muted || (volume ?? 1) === 0 ? /* @__PURE__ */ (0,
|
|
6442
|
+
children: muted || (volume ?? 1) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.VolumeX, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Volume2, { className: "w-4 h-4" })
|
|
6378
6443
|
}
|
|
6379
6444
|
),
|
|
6380
|
-
/* @__PURE__ */ (0,
|
|
6445
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-24", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6381
6446
|
Slider,
|
|
6382
6447
|
{
|
|
6383
6448
|
min: 0,
|
|
@@ -6392,8 +6457,8 @@ function OverlayControls({
|
|
|
6392
6457
|
) })
|
|
6393
6458
|
] })
|
|
6394
6459
|
] }),
|
|
6395
|
-
/* @__PURE__ */ (0,
|
|
6396
|
-
onGoLive && /* @__PURE__ */ (0,
|
|
6460
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2 relative", children: [
|
|
6461
|
+
onGoLive && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6397
6462
|
Button_default,
|
|
6398
6463
|
{
|
|
6399
6464
|
variant: "ghost",
|
|
@@ -6402,13 +6467,13 @@ function OverlayControls({
|
|
|
6402
6467
|
title: "Tr\u1EF1c ti\u1EBFp (v\u1EC1 Live)",
|
|
6403
6468
|
className: "bg-background/60 hover:bg-background/80 border-transparent shadow-sm outline-none focus:outline-none focus:ring-0",
|
|
6404
6469
|
children: [
|
|
6405
|
-
/* @__PURE__ */ (0,
|
|
6470
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Dot, { className: "w-10 h-10 text-destructive" }),
|
|
6406
6471
|
"Tr\u1EF1c ti\u1EBFp"
|
|
6407
6472
|
]
|
|
6408
6473
|
}
|
|
6409
6474
|
),
|
|
6410
|
-
onChangeRate && /* @__PURE__ */ (0,
|
|
6411
|
-
/* @__PURE__ */ (0,
|
|
6475
|
+
onChangeRate && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "relative", ref: rateWrapRef, children: [
|
|
6476
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6412
6477
|
Button_default,
|
|
6413
6478
|
{
|
|
6414
6479
|
variant: "ghost",
|
|
@@ -6422,7 +6487,7 @@ function OverlayControls({
|
|
|
6422
6487
|
]
|
|
6423
6488
|
}
|
|
6424
6489
|
),
|
|
6425
|
-
rateOpen && /* @__PURE__ */ (0,
|
|
6490
|
+
rateOpen && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "absolute bottom-9 right-0 bg-background/90 backdrop-blur rounded-md border border-border shadow-lg p-1 z-30", children: [0.5, 0.75, 1, 1.25, 1.5].map((r) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6426
6491
|
"button",
|
|
6427
6492
|
{
|
|
6428
6493
|
onClick: () => {
|
|
@@ -6438,7 +6503,7 @@ function OverlayControls({
|
|
|
6438
6503
|
r
|
|
6439
6504
|
)) })
|
|
6440
6505
|
] }),
|
|
6441
|
-
onToggleFullscreen && /* @__PURE__ */ (0,
|
|
6506
|
+
onToggleFullscreen && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6442
6507
|
Button_default,
|
|
6443
6508
|
{
|
|
6444
6509
|
variant: "ghost",
|
|
@@ -6446,7 +6511,7 @@ function OverlayControls({
|
|
|
6446
6511
|
onClick: onToggleFullscreen,
|
|
6447
6512
|
title: "To\xE0n m\xE0n h\xECnh",
|
|
6448
6513
|
className: "px-3 bg-background/60 hover:bg-background/80 border-transparent shadow-sm outline-none focus:outline-none focus:ring-0",
|
|
6449
|
-
children: /* @__PURE__ */ (0,
|
|
6514
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Maximize2, { className: "w-4 h-4" })
|
|
6450
6515
|
}
|
|
6451
6516
|
)
|
|
6452
6517
|
] })
|
|
@@ -6458,12 +6523,12 @@ function OverlayControls({
|
|
|
6458
6523
|
}
|
|
6459
6524
|
|
|
6460
6525
|
// ../../components/ui/CategoryTreeSelect.tsx
|
|
6461
|
-
var
|
|
6526
|
+
var import_react17 = require("react");
|
|
6462
6527
|
var import_lucide_react17 = require("lucide-react");
|
|
6463
|
-
var
|
|
6528
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6464
6529
|
function CategoryTreeSelect({ categories, value, onChange, placeholder = "Ch\u1ECDn danh m\u1EE5c", disabled }) {
|
|
6465
|
-
const [isOpen, setIsOpen] = (0,
|
|
6466
|
-
const [expandedNodes, setExpandedNodes] = (0,
|
|
6530
|
+
const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
|
|
6531
|
+
const [expandedNodes, setExpandedNodes] = (0, import_react17.useState)(/* @__PURE__ */ new Set());
|
|
6467
6532
|
const parentCategories = categories.filter((c) => !c.parent_id);
|
|
6468
6533
|
const childrenMap = /* @__PURE__ */ new Map();
|
|
6469
6534
|
categories.forEach((cat) => {
|
|
@@ -6502,18 +6567,26 @@ function CategoryTreeSelect({ categories, value, onChange, placeholder = "Ch\u1E
|
|
|
6502
6567
|
const hasChildren = children.length > 0;
|
|
6503
6568
|
const isExpanded = expandedNodes.has(category.id);
|
|
6504
6569
|
const isSelected = value.includes(category.id);
|
|
6505
|
-
return /* @__PURE__ */ (0,
|
|
6506
|
-
/* @__PURE__ */ (0,
|
|
6570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
|
|
6571
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
6507
6572
|
"div",
|
|
6508
6573
|
{
|
|
6509
6574
|
className: cn(
|
|
6510
|
-
"flex items-center gap-2 px-3 py-2 cursor-pointer rounded-md transition-colors",
|
|
6575
|
+
"relative flex items-center gap-2 px-3 py-2 cursor-pointer rounded-md transition-colors",
|
|
6511
6576
|
"hover:bg-accent",
|
|
6512
|
-
|
|
6577
|
+
// Selected state: subtle bg + square left indicator, avoid left rounding
|
|
6578
|
+
isSelected && "bg-primary/10 rounded-r-md"
|
|
6513
6579
|
),
|
|
6514
6580
|
style: { paddingLeft: `${level * 1.5 + 0.75}rem` },
|
|
6515
6581
|
children: [
|
|
6516
|
-
|
|
6582
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6583
|
+
"span",
|
|
6584
|
+
{
|
|
6585
|
+
"aria-hidden": true,
|
|
6586
|
+
className: "absolute left-0 top-0 bottom-0 w-1 bg-primary"
|
|
6587
|
+
}
|
|
6588
|
+
),
|
|
6589
|
+
hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6517
6590
|
"button",
|
|
6518
6591
|
{
|
|
6519
6592
|
type: "button",
|
|
@@ -6522,130 +6595,76 @@ function CategoryTreeSelect({ categories, value, onChange, placeholder = "Ch\u1E
|
|
|
6522
6595
|
toggleExpand(category.id);
|
|
6523
6596
|
},
|
|
6524
6597
|
className: "p-0.5 hover:bg-accent rounded",
|
|
6525
|
-
children: isExpanded ? /* @__PURE__ */ (0,
|
|
6598
|
+
children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react17.ChevronDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react17.ChevronRight, { className: "w-4 h-4" })
|
|
6526
6599
|
}
|
|
6527
|
-
) : /* @__PURE__ */ (0,
|
|
6528
|
-
/* @__PURE__ */ (0,
|
|
6600
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "w-5" }),
|
|
6601
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
6529
6602
|
"div",
|
|
6530
6603
|
{
|
|
6531
6604
|
onClick: () => handleSelect(category.id, category),
|
|
6532
6605
|
className: "flex items-center gap-2 flex-1",
|
|
6533
6606
|
children: [
|
|
6534
|
-
/* @__PURE__ */ (0,
|
|
6607
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6535
6608
|
"div",
|
|
6536
6609
|
{
|
|
6537
6610
|
className: cn(
|
|
6538
6611
|
"w-4 h-4 border-2 rounded flex items-center justify-center transition-colors",
|
|
6539
6612
|
isSelected ? "bg-primary border-primary" : "border-muted-foreground/30"
|
|
6540
6613
|
),
|
|
6541
|
-
children: isSelected && /* @__PURE__ */ (0,
|
|
6614
|
+
children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react17.Check, { className: "w-3 h-3 text-primary-foreground" })
|
|
6542
6615
|
}
|
|
6543
6616
|
),
|
|
6544
|
-
/* @__PURE__ */ (0,
|
|
6617
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: cn("text-sm", isSelected && "font-medium text-primary"), children: category.name })
|
|
6545
6618
|
]
|
|
6546
6619
|
}
|
|
6547
6620
|
)
|
|
6548
6621
|
]
|
|
6549
6622
|
}
|
|
6550
6623
|
),
|
|
6551
|
-
hasChildren && isExpanded && /* @__PURE__ */ (0,
|
|
6624
|
+
hasChildren && isExpanded && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: children.map((child) => renderCategory(child, level + 1)) })
|
|
6552
6625
|
] }, category.id);
|
|
6553
6626
|
};
|
|
6554
6627
|
const selectedCount = value.length;
|
|
6555
6628
|
const displayText = selectedCount > 0 ? `\u0110\xE3 ch\u1ECDn ${selectedCount} danh m\u1EE5c` : placeholder;
|
|
6556
|
-
return /* @__PURE__ */ (0,
|
|
6557
|
-
/* @__PURE__ */ (0,
|
|
6629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "relative", children: [
|
|
6630
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
6558
6631
|
"button",
|
|
6559
6632
|
{
|
|
6560
6633
|
type: "button",
|
|
6561
6634
|
onClick: () => !disabled && setIsOpen(!isOpen),
|
|
6562
6635
|
disabled,
|
|
6563
6636
|
className: cn(
|
|
6564
|
-
|
|
6565
|
-
"
|
|
6637
|
+
// Match Combobox trigger outline + focus styles
|
|
6638
|
+
"flex w-full items-center justify-between px-3 bg-background border border-input",
|
|
6639
|
+
"rounded-md h-10 py-2 text-sm",
|
|
6640
|
+
"hover:bg-accent/5 transition-colors hover:border-primary/40 focus:border-primary",
|
|
6641
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
6566
6642
|
disabled && "opacity-50 cursor-not-allowed",
|
|
6567
|
-
isOpen && "border-primary
|
|
6643
|
+
isOpen && "border-primary"
|
|
6568
6644
|
),
|
|
6569
6645
|
children: [
|
|
6570
|
-
/* @__PURE__ */ (0,
|
|
6571
|
-
/* @__PURE__ */ (0,
|
|
6646
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: cn("text-sm", selectedCount === 0 && "text-muted-foreground"), children: displayText }),
|
|
6647
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react17.ChevronDown, { className: cn("w-4 h-4 transition-transform", isOpen && "transform rotate-180") })
|
|
6572
6648
|
]
|
|
6573
6649
|
}
|
|
6574
6650
|
),
|
|
6575
|
-
isOpen && !disabled && /* @__PURE__ */ (0,
|
|
6576
|
-
/* @__PURE__ */ (0,
|
|
6577
|
-
/* @__PURE__ */ (0,
|
|
6651
|
+
isOpen && !disabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
6652
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "fixed inset-0 z-10", onClick: () => setIsOpen(false) }),
|
|
6653
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6654
|
+
"div",
|
|
6655
|
+
{
|
|
6656
|
+
className: cn(
|
|
6657
|
+
"absolute z-20 mt-1 w-full max-h-80 overflow-auto",
|
|
6658
|
+
"rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
6659
|
+
"backdrop-blur-sm bg-popover/95 border-border/60"
|
|
6660
|
+
),
|
|
6661
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "p-1", children: parentCategories.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "px-3 py-2 text-sm text-muted-foreground", children: "Kh\xF4ng c\xF3 danh m\u1EE5c n\xE0o" }) : parentCategories.map((cat) => renderCategory(cat)) })
|
|
6662
|
+
}
|
|
6663
|
+
)
|
|
6578
6664
|
] })
|
|
6579
6665
|
] });
|
|
6580
6666
|
}
|
|
6581
6667
|
|
|
6582
|
-
// ../../components/ui/SmartImage.tsx
|
|
6583
|
-
var import_image = __toESM(require("next/image"), 1);
|
|
6584
|
-
var import_react17 = __toESM(require("react"), 1);
|
|
6585
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6586
|
-
var DEFAULT_FALLBACK = "/images/products/hoa-hong-do.png";
|
|
6587
|
-
function SmartImage({
|
|
6588
|
-
src,
|
|
6589
|
-
alt,
|
|
6590
|
-
className,
|
|
6591
|
-
ratioClass,
|
|
6592
|
-
roundedClass = "rounded-lg",
|
|
6593
|
-
fill = true,
|
|
6594
|
-
width,
|
|
6595
|
-
height,
|
|
6596
|
-
sizes = "(max-width: 768px) 100vw, 33vw",
|
|
6597
|
-
priority = false,
|
|
6598
|
-
quality = 80,
|
|
6599
|
-
fit = "cover",
|
|
6600
|
-
fallbackSrc = DEFAULT_FALLBACK
|
|
6601
|
-
}) {
|
|
6602
|
-
const normalize = (input) => {
|
|
6603
|
-
if (!input || input.length === 0) return fallbackSrc;
|
|
6604
|
-
if (input.startsWith("/images/products/") && /\.(jpg|jpeg)($|\?)/i.test(input)) {
|
|
6605
|
-
return input.replace(/\.(jpg|jpeg)(?=$|\?)/i, ".png");
|
|
6606
|
-
}
|
|
6607
|
-
return input;
|
|
6608
|
-
};
|
|
6609
|
-
const [resolvedSrc, setResolvedSrc] = import_react17.default.useState(() => normalize(src));
|
|
6610
|
-
const handleError = () => {
|
|
6611
|
-
if (resolvedSrc.endsWith(".jpg")) {
|
|
6612
|
-
setResolvedSrc(resolvedSrc.replace(/\.jpg($|\?)/, ".png$1"));
|
|
6613
|
-
} else if (resolvedSrc !== fallbackSrc) {
|
|
6614
|
-
setResolvedSrc(fallbackSrc);
|
|
6615
|
-
}
|
|
6616
|
-
};
|
|
6617
|
-
const Wrapper = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cn("relative overflow-hidden bg-muted/30", ratioClass, roundedClass, className), children });
|
|
6618
|
-
if (fill) {
|
|
6619
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6620
|
-
import_image.default,
|
|
6621
|
-
{
|
|
6622
|
-
src: resolvedSrc,
|
|
6623
|
-
alt,
|
|
6624
|
-
fill: true,
|
|
6625
|
-
sizes,
|
|
6626
|
-
onError: handleError,
|
|
6627
|
-
priority,
|
|
6628
|
-
quality,
|
|
6629
|
-
style: { objectFit: fit }
|
|
6630
|
-
}
|
|
6631
|
-
) });
|
|
6632
|
-
}
|
|
6633
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cn("relative overflow-hidden bg-muted/30", roundedClass, className), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6634
|
-
import_image.default,
|
|
6635
|
-
{
|
|
6636
|
-
src: resolvedSrc,
|
|
6637
|
-
alt,
|
|
6638
|
-
width,
|
|
6639
|
-
height,
|
|
6640
|
-
sizes,
|
|
6641
|
-
onError: handleError,
|
|
6642
|
-
priority,
|
|
6643
|
-
quality,
|
|
6644
|
-
style: { objectFit: fit, width: "100%", height: "100%" }
|
|
6645
|
-
}
|
|
6646
|
-
) });
|
|
6647
|
-
}
|
|
6648
|
-
|
|
6649
6668
|
// ../../components/ui/ImageUpload.tsx
|
|
6650
6669
|
var import_react18 = require("react");
|
|
6651
6670
|
var import_lucide_react18 = require("lucide-react");
|
|
@@ -6875,20 +6894,20 @@ function ImageUpload({
|
|
|
6875
6894
|
}
|
|
6876
6895
|
|
|
6877
6896
|
// ../../components/ui/Carousel.tsx
|
|
6878
|
-
var
|
|
6897
|
+
var React27 = __toESM(require("react"), 1);
|
|
6879
6898
|
var import_lucide_react19 = require("lucide-react");
|
|
6880
6899
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6881
6900
|
function Carousel({ children, autoScroll = true, autoScrollInterval = 5e3 }) {
|
|
6882
|
-
const [currentIndex, setCurrentIndex] =
|
|
6883
|
-
const totalSlides =
|
|
6884
|
-
const [isPaused, setIsPaused] =
|
|
6885
|
-
const scrollPrev =
|
|
6901
|
+
const [currentIndex, setCurrentIndex] = React27.useState(0);
|
|
6902
|
+
const totalSlides = React27.Children.count(children);
|
|
6903
|
+
const [isPaused, setIsPaused] = React27.useState(false);
|
|
6904
|
+
const scrollPrev = React27.useCallback(() => {
|
|
6886
6905
|
setCurrentIndex((prev) => prev > 0 ? prev - 1 : totalSlides - 1);
|
|
6887
6906
|
}, [totalSlides]);
|
|
6888
|
-
const scrollNext =
|
|
6907
|
+
const scrollNext = React27.useCallback(() => {
|
|
6889
6908
|
setCurrentIndex((prev) => prev < totalSlides - 1 ? prev + 1 : 0);
|
|
6890
6909
|
}, [totalSlides]);
|
|
6891
|
-
|
|
6910
|
+
React27.useEffect(() => {
|
|
6892
6911
|
if (!autoScroll || isPaused || totalSlides <= 1) return;
|
|
6893
6912
|
const interval = setInterval(() => {
|
|
6894
6913
|
scrollNext();
|
|
@@ -6896,7 +6915,7 @@ function Carousel({ children, autoScroll = true, autoScrollInterval = 5e3 }) {
|
|
|
6896
6915
|
return () => clearInterval(interval);
|
|
6897
6916
|
}, [autoScroll, isPaused, totalSlides, autoScrollInterval, scrollNext]);
|
|
6898
6917
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "relative w-full overflow-hidden", onMouseEnter: () => setIsPaused(true), onMouseLeave: () => setIsPaused(false), children: [
|
|
6899
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex transition-transform duration-500 ease-in-out", style: { transform: `translateX(-${currentIndex * 100}%)` }, children:
|
|
6918
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex transition-transform duration-500 ease-in-out", style: { transform: `translateX(-${currentIndex * 100}%)` }, children: React27.Children.map(children, (child, idx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex-shrink-0 w-full h-full", children: child }, idx)) }),
|
|
6900
6919
|
totalSlides > 1 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
6901
6920
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6902
6921
|
Button_default,
|
|
@@ -7171,6 +7190,7 @@ function DataTable({
|
|
|
7171
7190
|
enableDensityToggle = true,
|
|
7172
7191
|
striped = true,
|
|
7173
7192
|
// Mặc định bật màu nền sẽn kẽ cho các dòng
|
|
7193
|
+
columnDividers = false,
|
|
7174
7194
|
className,
|
|
7175
7195
|
labels
|
|
7176
7196
|
}) {
|
|
@@ -7252,11 +7272,15 @@ function DataTable({
|
|
|
7252
7272
|
}
|
|
7253
7273
|
return null;
|
|
7254
7274
|
};
|
|
7255
|
-
const renderHeader = /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableRow, { children: visibleColumns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7275
|
+
const renderHeader = /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableRow, { children: visibleColumns.map((col, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7256
7276
|
TableHead,
|
|
7257
7277
|
{
|
|
7258
7278
|
style: { width: col.width },
|
|
7259
|
-
className: cn(
|
|
7279
|
+
className: cn(
|
|
7280
|
+
col.align === "right" && "text-right",
|
|
7281
|
+
col.align === "center" && "text-center",
|
|
7282
|
+
columnDividers && colIdx > 0 && "border-l border-border/60"
|
|
7283
|
+
),
|
|
7260
7284
|
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center justify-between gap-2 select-none min-h-[2.5rem]", children: [
|
|
7261
7285
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center gap-1 min-w-0 flex-1", children: [
|
|
7262
7286
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "truncate font-medium text-sm", children: col.title }),
|
|
@@ -7406,10 +7430,10 @@ function DataTable({
|
|
|
7406
7430
|
toolbar
|
|
7407
7431
|
] })
|
|
7408
7432
|
] }),
|
|
7409
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: cn("relative rounded-
|
|
7433
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: cn("relative rounded-md border border-border/50 overflow-hidden", loading2 && "opacity-60 pointer-events-none"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
7410
7434
|
Table,
|
|
7411
7435
|
{
|
|
7412
|
-
containerClassName: "border-0 rounded-none shadow-none",
|
|
7436
|
+
containerClassName: "border-0 md:border-0 rounded-none md:rounded-none shadow-none bg-transparent",
|
|
7413
7437
|
className: "[&_thead]:sticky [&_thead]:top-0 [&_thead]:z-[5] [&_thead]:bg-background [&_thead]:backdrop-blur-sm",
|
|
7414
7438
|
children: [
|
|
7415
7439
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableHeader, { children: renderHeader }),
|
|
@@ -7426,7 +7450,7 @@ function DataTable({
|
|
|
7426
7450
|
)
|
|
7427
7451
|
] }),
|
|
7428
7452
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-sm", children: "Loading..." })
|
|
7429
|
-
] }) }) }) : !displayedData || displayedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableCell, { colSpan: visibleColumns.length, className: "text-center py-6 text-muted-foreground", children: "No data" }) }) : displayedData.map((row, idx) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableRow, { className: cn(densityRowClass, striped && idx % 2 === 0 && "bg-muted/30"), children: visibleColumns.map((col) => {
|
|
7453
|
+
] }) }) }) : !displayedData || displayedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableCell, { colSpan: visibleColumns.length, className: "text-center py-6 text-muted-foreground", children: "No data" }) }) : displayedData.map((row, idx) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableRow, { className: cn(densityRowClass, striped && idx % 2 === 0 && "bg-muted/30"), children: visibleColumns.map((col, colIdx) => {
|
|
7430
7454
|
const value = col.dataIndex ? row[col.dataIndex] : void 0;
|
|
7431
7455
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7432
7456
|
TableCell,
|
|
@@ -7435,8 +7459,9 @@ function DataTable({
|
|
|
7435
7459
|
cellPadding,
|
|
7436
7460
|
col.align === "right" && "text-right",
|
|
7437
7461
|
col.align === "center" && "text-center",
|
|
7438
|
-
|
|
7439
|
-
idx === data.length - 1 && col === visibleColumns[
|
|
7462
|
+
columnDividers && colIdx > 0 && "border-l border-border/60",
|
|
7463
|
+
idx === data.length - 1 && col === visibleColumns[0] && "rounded-bl-md",
|
|
7464
|
+
idx === data.length - 1 && col === visibleColumns[visibleColumns.length - 1] && "rounded-br-md"
|
|
7440
7465
|
),
|
|
7441
7466
|
children: col.render ? col.render(value, row, idx) : String(value ?? "")
|
|
7442
7467
|
},
|
|
@@ -7446,7 +7471,7 @@ function DataTable({
|
|
|
7446
7471
|
]
|
|
7447
7472
|
}
|
|
7448
7473
|
) }),
|
|
7449
|
-
totalItems > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "border-t bg-muted/30 p-4 rounded-b-
|
|
7474
|
+
totalItems > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "border-t bg-muted/30 p-4 rounded-b-md", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7450
7475
|
Pagination,
|
|
7451
7476
|
{
|
|
7452
7477
|
page: curPage,
|
|
@@ -7468,7 +7493,7 @@ function DataTable({
|
|
|
7468
7493
|
var DataTable_default = DataTable;
|
|
7469
7494
|
|
|
7470
7495
|
// ../../components/ui/Form.tsx
|
|
7471
|
-
var
|
|
7496
|
+
var React31 = __toESM(require("react"), 1);
|
|
7472
7497
|
|
|
7473
7498
|
// ../../node_modules/react-hook-form/dist/index.esm.mjs
|
|
7474
7499
|
var import_react22 = __toESM(require("react"), 1);
|
|
@@ -9237,7 +9262,7 @@ function useForm(props = {}) {
|
|
|
9237
9262
|
// ../../components/ui/Form.tsx
|
|
9238
9263
|
var import_next_intl8 = require("next-intl");
|
|
9239
9264
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
9240
|
-
var FormConfigContext =
|
|
9265
|
+
var FormConfigContext = React31.createContext({ size: "md" });
|
|
9241
9266
|
var FormWrapper = ({
|
|
9242
9267
|
children,
|
|
9243
9268
|
onSubmit,
|
|
@@ -9250,7 +9275,7 @@ var FormWrapper = ({
|
|
|
9250
9275
|
const methods = useForm({
|
|
9251
9276
|
defaultValues: initialValues
|
|
9252
9277
|
});
|
|
9253
|
-
|
|
9278
|
+
React31.useEffect(() => {
|
|
9254
9279
|
if (initialValues) {
|
|
9255
9280
|
methods.reset(initialValues);
|
|
9256
9281
|
}
|
|
@@ -9259,15 +9284,15 @@ var FormWrapper = ({
|
|
|
9259
9284
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormProvider, { ...methods, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormConfigContext.Provider, { value: { size }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("form", { onSubmit: methods.handleSubmit(onSubmit), className, ...formProps, children }) }) });
|
|
9260
9285
|
};
|
|
9261
9286
|
var Form = FormWrapper;
|
|
9262
|
-
var FormFieldContext =
|
|
9287
|
+
var FormFieldContext = React31.createContext({});
|
|
9263
9288
|
var FormField = ({
|
|
9264
9289
|
...props
|
|
9265
9290
|
}) => {
|
|
9266
9291
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Controller, { ...props }) });
|
|
9267
9292
|
};
|
|
9268
9293
|
var useFormField = () => {
|
|
9269
|
-
const fieldContext =
|
|
9270
|
-
const itemContext =
|
|
9294
|
+
const fieldContext = React31.useContext(FormFieldContext);
|
|
9295
|
+
const itemContext = React31.useContext(FormItemContext);
|
|
9271
9296
|
const { getFieldState, formState } = useFormContext();
|
|
9272
9297
|
if (!fieldContext) {
|
|
9273
9298
|
try {
|
|
@@ -9288,20 +9313,20 @@ var useFormField = () => {
|
|
|
9288
9313
|
...fieldState
|
|
9289
9314
|
};
|
|
9290
9315
|
};
|
|
9291
|
-
var FormItemContext =
|
|
9292
|
-
var FormItem =
|
|
9293
|
-
const id =
|
|
9316
|
+
var FormItemContext = React31.createContext({});
|
|
9317
|
+
var FormItem = React31.forwardRef(({ className, ...props }, ref) => {
|
|
9318
|
+
const id = React31.useId();
|
|
9294
9319
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
9295
9320
|
});
|
|
9296
9321
|
FormItem.displayName = "FormItem";
|
|
9297
|
-
var FormLabel =
|
|
9322
|
+
var FormLabel = React31.forwardRef(({ className, ...props }, ref) => {
|
|
9298
9323
|
const { error, formItemId } = useFormField();
|
|
9299
|
-
const config =
|
|
9324
|
+
const config = React31.useContext(FormConfigContext);
|
|
9300
9325
|
const sizeClass = config.size === "sm" ? "text-xs" : config.size === "lg" ? "text-base" : "text-sm";
|
|
9301
9326
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Label, { ref, className: cn(sizeClass, error && "text-destructive", className), htmlFor: formItemId, ...props });
|
|
9302
9327
|
});
|
|
9303
9328
|
FormLabel.displayName = "FormLabel";
|
|
9304
|
-
var FormControl =
|
|
9329
|
+
var FormControl = React31.forwardRef(({ ...props }, ref) => {
|
|
9305
9330
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
9306
9331
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
9307
9332
|
"div",
|
|
@@ -9315,12 +9340,12 @@ var FormControl = React32.forwardRef(({ ...props }, ref) => {
|
|
|
9315
9340
|
);
|
|
9316
9341
|
});
|
|
9317
9342
|
FormControl.displayName = "FormControl";
|
|
9318
|
-
var FormDescription =
|
|
9343
|
+
var FormDescription = React31.forwardRef(({ className, ...props }, ref) => {
|
|
9319
9344
|
const { formDescriptionId } = useFormField();
|
|
9320
9345
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { ref, id: formDescriptionId, className: cn("text-sm text-muted-foreground", className), ...props });
|
|
9321
9346
|
});
|
|
9322
9347
|
FormDescription.displayName = "FormDescription";
|
|
9323
|
-
var FormMessage =
|
|
9348
|
+
var FormMessage = React31.forwardRef(({ className, children, ...props }, ref) => {
|
|
9324
9349
|
const { error, formMessageId } = useFormField();
|
|
9325
9350
|
const body = error ? String(error?.message) : children;
|
|
9326
9351
|
if (!body) {
|
|
@@ -9329,7 +9354,7 @@ var FormMessage = React32.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
9329
9354
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { ref, id: formMessageId, className: cn("text-sm font-medium text-destructive", className), ...props, children: body });
|
|
9330
9355
|
});
|
|
9331
9356
|
FormMessage.displayName = "FormMessage";
|
|
9332
|
-
var FormInput =
|
|
9357
|
+
var FormInput = React31.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
9333
9358
|
FormField,
|
|
9334
9359
|
{
|
|
9335
9360
|
name,
|
|
@@ -9340,7 +9365,7 @@ var FormInput = React32.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */
|
|
|
9340
9365
|
}
|
|
9341
9366
|
) }));
|
|
9342
9367
|
FormInput.displayName = "FormInput";
|
|
9343
|
-
var FormCheckbox =
|
|
9368
|
+
var FormCheckbox = React31.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
9344
9369
|
FormField,
|
|
9345
9370
|
{
|
|
9346
9371
|
name,
|
|
@@ -9364,9 +9389,9 @@ var FormCheckbox = React32.forwardRef(({ name, ...props }, ref) => /* @__PURE__
|
|
|
9364
9389
|
}
|
|
9365
9390
|
) }));
|
|
9366
9391
|
FormCheckbox.displayName = "FormCheckbox";
|
|
9367
|
-
var FormActions =
|
|
9392
|
+
var FormActions = React31.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { ref, className: cn("flex gap-2 justify-end", className), ...props }));
|
|
9368
9393
|
FormActions.displayName = "FormActions";
|
|
9369
|
-
var FormSubmitButton =
|
|
9394
|
+
var FormSubmitButton = React31.forwardRef(({ children, loading: loading2, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button_default, { ref, type: "submit", size: props.size ?? size, disabled: loading2, ...props, children }) }));
|
|
9370
9395
|
FormSubmitButton.displayName = "FormSubmitButton";
|
|
9371
9396
|
|
|
9372
9397
|
// ../../components/ui/NotificationModal.tsx
|