@moontra/moonui 2.2.0 → 2.2.2

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.
Files changed (44) hide show
  1. package/dist/index.d.mts +91 -14
  2. package/dist/index.d.ts +91 -14
  3. package/dist/index.js +1714 -369
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1546 -371
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +2 -2
  8. package/src/components/ui/alert.tsx +123 -93
  9. package/src/components/ui/avatar.tsx +2 -0
  10. package/src/components/ui/badge.tsx +19 -17
  11. package/src/components/ui/breadcrumb.tsx +2 -0
  12. package/src/components/ui/button.stories.tsx +4 -2
  13. package/src/components/ui/button.tsx +39 -33
  14. package/src/components/ui/calendar.tsx +1 -1
  15. package/src/components/ui/card-input.tsx +231 -0
  16. package/src/components/ui/card.stories.tsx +2 -0
  17. package/src/components/ui/card.tsx +2 -0
  18. package/src/components/ui/data-table.stories.tsx +4 -2
  19. package/src/components/ui/data-table.tsx +7 -7
  20. package/src/components/ui/date-picker.stories.tsx +2 -0
  21. package/src/components/ui/date-picker.tsx +18 -9
  22. package/src/components/ui/draggable-list.tsx +2 -0
  23. package/src/components/ui/index.ts +357 -44
  24. package/src/components/ui/input.stories.tsx +2 -0
  25. package/src/components/ui/input.tsx +2 -0
  26. package/src/components/ui/locked-component.tsx +222 -0
  27. package/src/components/ui/pagination.tsx +2 -0
  28. package/src/components/ui/phone-input.tsx +172 -0
  29. package/src/components/ui/popover-pro.tsx +424 -0
  30. package/src/components/ui/rich-text-editor/index.tsx +2 -1
  31. package/src/components/ui/scroll-area.tsx +48 -0
  32. package/src/components/ui/select.tsx +5 -1
  33. package/src/components/ui/separator.tsx +2 -2
  34. package/src/components/ui/swipeable-card.tsx +2 -0
  35. package/src/components/ui/table.tsx +2 -0
  36. package/src/components/ui/tabs.tsx +2 -0
  37. package/src/components/ui/tags-input.tsx +130 -0
  38. package/src/components/ui/textarea.tsx +2 -0
  39. package/src/components/ui/toast.tsx +2 -0
  40. package/src/index.tsx +4 -46
  41. package/src/lib/performance-profiler.ts +79 -0
  42. package/src/styles/index.css +315 -2
  43. package/src/use-performance-optimizer.ts +26 -26
  44. package/src/use-scroll-animation.ts +5 -7
package/dist/index.mjs CHANGED
@@ -1,10 +1,12 @@
1
- import { clsx } from 'clsx';
2
- import { twMerge } from 'tailwind-merge';
1
+ 'use client';
2
+
3
3
  import * as t from 'react';
4
4
  import t__default, { useState, useCallback, useEffect } from 'react';
5
5
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
6
- import { ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal, Loader2, Minus, Search, ChevronUp, ChevronRight, Circle, Upload, Bold, Italic, Underline, Strikethrough, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, Quote, Code, Link, Image, Palette, Undo, Redo, Edit, Eye, Copy, Download, RefreshCw, Columns, ArrowDown, ArrowUp, ArrowUpDown, ChevronsLeft, ChevronLeft, ChevronsRight, Calendar as Calendar$1, Clock, CheckCircle, Star, GitFork, ExternalLink, Video, Music, FileText, File } from 'lucide-react';
6
+ import { ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal, Loader2, CreditCard, Minus, Search, ChevronUp, ChevronRight, Circle, Upload, Phone, Bold, Italic, Underline, Strikethrough, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, Quote, Code, Link, Image, Palette, Undo, Redo, Edit, Eye, Copy, Download, RefreshCw, Columns, ArrowDown, ArrowUp, ArrowUpDown, ChevronsLeft, ChevronLeft, ChevronsRight, Calendar as Calendar$1, Clock, CheckCircle, Star, GitFork, ExternalLink, Crown, Lock, Zap, Video, Music, FileText, File } from 'lucide-react';
7
7
  export { Palette, Pipette } from 'lucide-react';
8
+ import { clsx } from 'clsx';
9
+ import { twMerge } from 'tailwind-merge';
8
10
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
11
  import { cva } from 'class-variance-authority';
10
12
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
@@ -25,8 +27,6 @@ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
25
27
  import * as SwitchPrimitives from '@radix-ui/react-switch';
26
28
  import * as ToastPrimitives from '@radix-ui/react-toast';
27
29
 
28
- /** @license MoonUI v1.0.0 - MIT License - https://moonui.dev */
29
-
30
30
  function cn(...inputs) {
31
31
  return twMerge(clsx(inputs));
32
32
  }
@@ -109,7 +109,17 @@ var alertVariants = cva(
109
109
  }
110
110
  );
111
111
  var Alert = t.forwardRef(
112
- ({ className, variant = "default", size, radius, hideIcon = false, closable = false, onClose, children, ...props }, ref) => {
112
+ ({
113
+ className,
114
+ variant = "default",
115
+ size,
116
+ radius,
117
+ hideIcon = false,
118
+ closable = false,
119
+ onClose,
120
+ children,
121
+ ...props
122
+ }, ref) => {
113
123
  const Icon2 = t.useMemo(() => {
114
124
  switch (variant) {
115
125
  case "success":
@@ -129,7 +139,16 @@ var Alert = t.forwardRef(
129
139
  {
130
140
  ref,
131
141
  role: "alert",
132
- className: cn("moonui-theme", alertVariants({ variant, size, radius, withClose: closable }), className),
142
+ className: cn(
143
+ "moonui-theme",
144
+ alertVariants({
145
+ variant,
146
+ size,
147
+ radius,
148
+ withClose: closable
149
+ }),
150
+ className
151
+ ),
133
152
  ...props,
134
153
  children: [
135
154
  !hideIcon && /* @__PURE__ */ jsx(Icon2, { className: "h-5 w-5" }),
@@ -153,7 +172,11 @@ var AlertTitle = t.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
153
172
  "h5",
154
173
  {
155
174
  ref,
156
- className: cn("moonui-theme", "font-semibold leading-tight tracking-tight mb-1", className),
175
+ className: cn(
176
+ "moonui-theme",
177
+ "font-semibold leading-tight tracking-tight mb-1",
178
+ className
179
+ ),
157
180
  ...props
158
181
  }
159
182
  ));
@@ -162,7 +185,11 @@ var AlertDescription = t.forwardRef(({ className, ...props }, ref) => /* @__PURE
162
185
  "div",
163
186
  {
164
187
  ref,
165
- className: cn("moonui-theme", "text-sm leading-5 text-muted-foreground", className),
188
+ className: cn(
189
+ "moonui-theme",
190
+ "text-sm leading-5 text-muted-foreground",
191
+ className
192
+ ),
166
193
  ...props
167
194
  }
168
195
  ));
@@ -311,7 +338,7 @@ var AvatarGroup = t.forwardRef(
311
338
  AvatarGroup.displayName = "AvatarGroup";
312
339
  var badgeVariants = cva(
313
340
  [
314
- "inline-flex items-center gap-1.5",
341
+ "inline-flex items-center justify-center gap-1.5",
315
342
  "font-medium transition-colors duration-200",
316
343
  "border focus:outline-none",
317
344
  "focus-visible:ring-2 focus-visible:ring-offset-1"
@@ -320,23 +347,23 @@ var badgeVariants = cva(
320
347
  variants: {
321
348
  variant: {
322
349
  primary: [
323
- "border-transparent bg-primary text-primary-foreground",
324
- "hover:bg-primary-hover dark:hover:bg-primary/90",
325
- "focus-visible:ring-primary/30 dark:focus-visible:ring-primary/40",
326
- "dark:bg-primary/90 dark:text-white dark:shadow-inner dark:shadow-primary/10"
350
+ "border-transparent bg-gray-900 text-white",
351
+ "hover:bg-gray-800 dark:hover:bg-gray-700",
352
+ "focus-visible:ring-gray-500/30 dark:focus-visible:ring-gray-400/40",
353
+ "dark:bg-gray-700 dark:text-gray-50 dark:shadow-inner dark:shadow-gray-950/10"
327
354
  ],
328
355
  secondary: [
329
356
  "border-transparent bg-secondary text-secondary-foreground",
330
- "hover:bg-gray-200 dark:hover:bg-gray-700/90",
357
+ "hover:bg-gray-200 dark:hover:bg-gray-600",
331
358
  "focus-visible:ring-gray-400/30 dark:focus-visible:ring-gray-500/40",
332
- "dark:bg-gray-800 dark:text-gray-100 dark:shadow-inner dark:shadow-gray-950/10"
359
+ "dark:bg-gray-700/50 dark:text-gray-50 dark:shadow-inner dark:shadow-gray-950/10"
333
360
  ],
334
361
  outline: [
335
- "border-gray-200 dark:border-gray-700",
362
+ "border-gray-200 dark:border-gray-600",
336
363
  "bg-transparent text-foreground",
337
- "hover:border-gray-300 dark:hover:border-gray-600",
364
+ "hover:border-gray-300 dark:hover:border-gray-500",
338
365
  "focus-visible:ring-gray-400/30 dark:focus-visible:ring-gray-500/40",
339
- "dark:text-gray-200 dark:bg-transparent dark:backdrop-blur-sm"
366
+ "dark:text-gray-100 dark:bg-transparent dark:backdrop-blur-sm"
340
367
  ],
341
368
  destructive: [
342
369
  "border-transparent bg-error text-white",
@@ -357,11 +384,11 @@ var badgeVariants = cva(
357
384
  "dark:bg-warning/90 dark:text-gray-900 dark:shadow-inner dark:shadow-warning/10"
358
385
  ],
359
386
  ghost: [
360
- "border-transparent bg-transparent text-foreground",
361
- "hover:bg-gray-100 dark:hover:bg-gray-800/80",
387
+ "border border-gray-200 bg-gray-50/50 text-gray-700",
388
+ "hover:bg-gray-100 dark:hover:bg-gray-800/60",
362
389
  "focus-visible:ring-gray-400/30 dark:focus-visible:ring-gray-500/40",
363
- "dark:text-gray-200 dark:backdrop-blur-sm",
364
- "transition-colors duration-200"
390
+ "dark:border-gray-700 dark:bg-gray-800/30 dark:text-gray-300",
391
+ "transition-all duration-200"
365
392
  ],
366
393
  pro: [
367
394
  "border-transparent bg-gradient-to-r from-purple-600 to-pink-600 text-white",
@@ -440,9 +467,9 @@ function Badge({
440
467
  "aria-hidden": "true"
441
468
  }
442
469
  ),
443
- autoLeftIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0", children: autoLeftIcon }),
444
- /* @__PURE__ */ jsx("span", { className: "truncate", children: autoChildren }),
445
- rightIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0", children: rightIcon }),
470
+ autoLeftIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0 items-center", children: autoLeftIcon }),
471
+ /* @__PURE__ */ jsx("span", { className: "inline-flex items-center", children: autoChildren }),
472
+ rightIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0 items-center", children: rightIcon }),
446
473
  removable && onRemove && /* @__PURE__ */ jsx(
447
474
  "button",
448
475
  {
@@ -653,11 +680,11 @@ var buttonVariants = cva(
653
680
  "transition-all duration-200"
654
681
  ],
655
682
  secondary: [
656
- "bg-muted text-muted-foreground",
657
- "dark:bg-muted dark:text-muted-foreground",
658
- "hover:bg-muted/80 dark:hover:bg-muted/80",
659
- "active:bg-muted/70 dark:active:bg-muted/70",
660
- "border border-input dark:border-input",
683
+ "bg-gray-100 text-gray-900",
684
+ "dark:bg-gray-800 dark:text-gray-100",
685
+ "hover:bg-gray-200 dark:hover:bg-gray-700",
686
+ "active:bg-gray-300 dark:active:bg-gray-600",
687
+ "border border-gray-200 dark:border-gray-700",
661
688
  "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
662
689
  "shadow-sm hover:shadow-md"
663
690
  ],
@@ -671,10 +698,10 @@ var buttonVariants = cva(
671
698
  "transition-all duration-200"
672
699
  ],
673
700
  ghost: [
674
- "text-foreground",
675
- "dark:text-foreground",
676
- "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent dark:hover:text-accent-foreground",
677
- "active:bg-accent/80 dark:active:bg-accent/80",
701
+ "text-gray-700",
702
+ "dark:text-gray-300",
703
+ "hover:bg-gray-100 hover:text-gray-900 dark:hover:bg-gray-800 dark:hover:text-gray-100",
704
+ "active:bg-gray-200 dark:active:bg-gray-700",
678
705
  "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
679
706
  "transition-all duration-200"
680
707
  ],
@@ -704,19 +731,21 @@ var buttonVariants = cva(
704
731
  "transition-colors duration-200"
705
732
  ],
706
733
  gradient: [
707
- "bg-gradient-to-r from-blue-600 to-purple-600 text-white",
708
- "hover:from-blue-700 hover:to-purple-700",
709
- "active:from-blue-800 active:to-purple-800",
710
- "shadow-lg shadow-purple-500/25",
734
+ "bg-gradient-to-r from-purple-500 to-pink-500 text-white",
735
+ "hover:from-purple-600 hover:to-pink-600",
736
+ "active:from-purple-700 active:to-pink-700",
737
+ "shadow-xl shadow-purple-500/40",
738
+ "hover:shadow-2xl hover:shadow-purple-500/50",
711
739
  "focus-visible:ring-purple-500/50",
712
740
  "transition-all duration-300"
713
741
  ],
714
742
  glow: [
715
- "bg-primary text-primary-foreground",
716
- "shadow-lg shadow-primary/50",
717
- "hover:shadow-xl hover:shadow-primary/60",
718
- "active:shadow-md active:shadow-primary/40",
719
- "focus-visible:ring-primary/50",
743
+ "bg-blue-500 text-white",
744
+ "shadow-[0_0_30px_rgba(59,130,246,0.5)]",
745
+ "hover:shadow-[0_0_40px_rgba(59,130,246,0.7)]",
746
+ "active:shadow-[0_0_20px_rgba(59,130,246,0.4)]",
747
+ "hover:bg-blue-600",
748
+ "focus-visible:ring-blue-500/50",
720
749
  "transition-all duration-300"
721
750
  ],
722
751
  soft: [
@@ -740,29 +769,31 @@ var buttonVariants = cva(
740
769
  "transition-all duration-200"
741
770
  ],
742
771
  neon: [
743
- "bg-transparent text-primary",
744
- "border-2 border-primary",
745
- "hover:bg-primary hover:text-primary-foreground",
746
- "hover:shadow-[0_0_20px_rgba(var(--primary),0.5)]",
747
- "active:shadow-[0_0_10px_rgba(var(--primary),0.3)]",
748
- "focus-visible:ring-primary/50",
772
+ "bg-transparent text-green-400",
773
+ "border-2 border-green-400",
774
+ "hover:bg-green-400 hover:text-gray-900",
775
+ "hover:shadow-[0_0_30px_rgba(74,222,128,0.6)]",
776
+ "active:shadow-[0_0_15px_rgba(74,222,128,0.4)]",
777
+ "focus-visible:ring-green-400/50",
749
778
  "transition-all duration-300"
750
779
  ]
751
780
  },
752
781
  size: {
753
- xs: "h-7 px-2.5 text-xs rounded-md",
754
- sm: "h-8 px-3 text-sm rounded-md",
755
- md: "h-10 px-4 text-base rounded-lg",
756
- lg: "h-12 px-6 text-lg rounded-lg",
757
- xl: "h-14 px-8 text-xl rounded-xl",
758
- icon: "h-10 w-10 p-2 rounded-lg",
759
- "icon-sm": "h-8 w-8 p-1.5 rounded-md",
760
- "icon-lg": "h-12 w-12 p-3 rounded-xl"
782
+ xs: "h-7 px-2.5 text-xs",
783
+ sm: "h-8 px-3 text-sm",
784
+ md: "h-10 px-4 text-base",
785
+ lg: "h-12 px-6 text-lg",
786
+ xl: "h-14 px-8 text-xl",
787
+ icon: "h-10 w-10 p-2",
788
+ "icon-sm": "h-8 w-8 p-1.5",
789
+ "icon-lg": "h-12 w-12 p-3"
761
790
  },
762
791
  rounded: {
763
- default: "",
792
+ default: "rounded-xl",
764
793
  full: "rounded-full",
765
- none: "rounded-none"
794
+ none: "rounded-none",
795
+ sm: "rounded-lg",
796
+ lg: "rounded-2xl"
766
797
  },
767
798
  fullWidth: {
768
799
  true: "w-full"
@@ -942,32 +973,6 @@ var tapAnimations = {
942
973
  transition: { duration: 0.1 }
943
974
  }
944
975
  };
945
- var pageTransitions = {
946
- fadeIn: {
947
- initial: { opacity: 0 },
948
- animate: { opacity: 1 },
949
- exit: { opacity: 0 },
950
- transition: { duration: 0.3 }
951
- },
952
- slideUp: {
953
- initial: { opacity: 0, y: 20 },
954
- animate: { opacity: 1, y: 0 },
955
- exit: { opacity: 0, y: -20 },
956
- transition: springAnimations.smooth
957
- },
958
- slideRight: {
959
- initial: { opacity: 0, x: -20 },
960
- animate: { opacity: 1, x: 0 },
961
- exit: { opacity: 0, x: 20 },
962
- transition: springAnimations.smooth
963
- },
964
- scale: {
965
- initial: { opacity: 0, scale: 0.95 },
966
- animate: { opacity: 1, scale: 1 },
967
- exit: { opacity: 0, scale: 1.05 },
968
- transition: springAnimations.smooth
969
- }
970
- };
971
976
  var skeletonAnimation = {
972
977
  initial: { opacity: 0.5 },
973
978
  animate: {
@@ -1082,6 +1087,183 @@ var CardFooter = t.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
1082
1087
  }
1083
1088
  ));
1084
1089
  CardFooter.displayName = "CardFooter";
1090
+ var getCardType = (number) => {
1091
+ const patterns = {
1092
+ visa: /^4/,
1093
+ mastercard: /^5[1-5]/,
1094
+ amex: /^3[47]/,
1095
+ discover: /^6(?:011|5)/,
1096
+ diners: /^3(?:0[0-5]|[68])/,
1097
+ jcb: /^35/
1098
+ };
1099
+ for (const [type, pattern] of Object.entries(patterns)) {
1100
+ if (pattern.test(number))
1101
+ return type;
1102
+ }
1103
+ return "unknown";
1104
+ };
1105
+ var formatCardNumber = (value, cardType) => {
1106
+ const cleaned = value.replace(/\s+/g, "");
1107
+ const groups = cardType === "amex" ? [4, 6, 5] : [4, 4, 4, 4];
1108
+ let formatted = "";
1109
+ let position = 0;
1110
+ for (const group of groups) {
1111
+ if (position >= cleaned.length)
1112
+ break;
1113
+ if (formatted)
1114
+ formatted += " ";
1115
+ formatted += cleaned.slice(position, position + group);
1116
+ position += group;
1117
+ }
1118
+ return formatted;
1119
+ };
1120
+ var CardNumberInput = t.forwardRef(
1121
+ ({ className, value = "", onChange, showIcon = true, size, ...props }, ref) => {
1122
+ const [cardType, setCardType] = t.useState("unknown");
1123
+ const handleChange = (e) => {
1124
+ const rawValue = e.target.value.replace(/\D/g, "");
1125
+ const detectedType = getCardType(rawValue);
1126
+ setCardType(detectedType);
1127
+ const maxLength = detectedType === "amex" ? 15 : 16;
1128
+ const truncated = rawValue.slice(0, maxLength);
1129
+ const formatted = formatCardNumber(truncated, detectedType);
1130
+ onChange?.(truncated, detectedType);
1131
+ e.target.value = formatted;
1132
+ };
1133
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1134
+ /* @__PURE__ */ jsx(
1135
+ Input,
1136
+ {
1137
+ ref,
1138
+ type: "text",
1139
+ inputMode: "numeric",
1140
+ autoComplete: "cc-number",
1141
+ placeholder: "1234 5678 9012 3456",
1142
+ value: formatCardNumber(value, cardType),
1143
+ onChange: handleChange,
1144
+ className: cn(showIcon && "pl-10", className),
1145
+ ...props
1146
+ }
1147
+ ),
1148
+ showIcon && /* @__PURE__ */ jsx(CreditCard, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" })
1149
+ ] });
1150
+ }
1151
+ );
1152
+ CardNumberInput.displayName = "CardNumberInput";
1153
+ var CardExpiryInput = t.forwardRef(
1154
+ ({ className, value = "", onChange, size, ...props }, ref) => {
1155
+ const handleChange = (e) => {
1156
+ let rawValue = e.target.value.replace(/\D/g, "");
1157
+ if (rawValue.length >= 2) {
1158
+ const month = parseInt(rawValue.slice(0, 2));
1159
+ if (month > 12) {
1160
+ rawValue = "12" + rawValue.slice(2);
1161
+ } else if (month === 0) {
1162
+ rawValue = "01" + rawValue.slice(2);
1163
+ }
1164
+ }
1165
+ rawValue = rawValue.slice(0, 4);
1166
+ let formatted = rawValue;
1167
+ if (rawValue.length >= 2) {
1168
+ formatted = rawValue.slice(0, 2) + "/" + rawValue.slice(2);
1169
+ }
1170
+ onChange?.(rawValue);
1171
+ e.target.value = formatted;
1172
+ };
1173
+ const formattedValue = value.length >= 2 ? value.slice(0, 2) + "/" + value.slice(2) : value;
1174
+ return /* @__PURE__ */ jsx(
1175
+ Input,
1176
+ {
1177
+ ref,
1178
+ type: "text",
1179
+ inputMode: "numeric",
1180
+ autoComplete: "cc-exp",
1181
+ placeholder: "MM/YY",
1182
+ value: formattedValue,
1183
+ onChange: handleChange,
1184
+ className,
1185
+ ...props
1186
+ }
1187
+ );
1188
+ }
1189
+ );
1190
+ CardExpiryInput.displayName = "CardExpiryInput";
1191
+ var CardCVCInput = t.forwardRef(
1192
+ ({ className, value = "", onChange, cardType = "unknown", size, ...props }, ref) => {
1193
+ const maxLength = cardType === "amex" ? 4 : 3;
1194
+ const handleChange = (e) => {
1195
+ const rawValue = e.target.value.replace(/\D/g, "").slice(0, maxLength);
1196
+ onChange?.(rawValue);
1197
+ };
1198
+ return /* @__PURE__ */ jsx(
1199
+ Input,
1200
+ {
1201
+ ref,
1202
+ type: "text",
1203
+ inputMode: "numeric",
1204
+ autoComplete: "cc-csc",
1205
+ placeholder: cardType === "amex" ? "1234" : "123",
1206
+ value,
1207
+ onChange: handleChange,
1208
+ maxLength,
1209
+ className,
1210
+ ...props
1211
+ }
1212
+ );
1213
+ }
1214
+ );
1215
+ CardCVCInput.displayName = "CardCVCInput";
1216
+ var CardZipInput = t.forwardRef(
1217
+ ({ className, value = "", onChange, format: format4 = "US", size, ...props }, ref) => {
1218
+ const handleChange = (e) => {
1219
+ let rawValue = e.target.value;
1220
+ switch (format4) {
1221
+ case "US":
1222
+ rawValue = rawValue.replace(/\D/g, "").slice(0, 5);
1223
+ break;
1224
+ case "CA":
1225
+ rawValue = rawValue.toUpperCase().replace(/[^A-Z0-9]/g, "").slice(0, 6);
1226
+ if (rawValue.length >= 3) {
1227
+ rawValue = rawValue.slice(0, 3) + " " + rawValue.slice(3);
1228
+ }
1229
+ break;
1230
+ case "UK":
1231
+ rawValue = rawValue.toUpperCase().replace(/[^A-Z0-9\s]/g, "").slice(0, 8);
1232
+ break;
1233
+ default:
1234
+ rawValue = rawValue.slice(0, 10);
1235
+ }
1236
+ onChange?.(rawValue.replace(/\s/g, ""));
1237
+ e.target.value = rawValue;
1238
+ };
1239
+ const getPlaceholder = () => {
1240
+ switch (format4) {
1241
+ case "US":
1242
+ return "12345";
1243
+ case "CA":
1244
+ return "K1A 0B1";
1245
+ case "UK":
1246
+ return "SW1A 1AA";
1247
+ default:
1248
+ return "Postal Code";
1249
+ }
1250
+ };
1251
+ return /* @__PURE__ */ jsx(
1252
+ Input,
1253
+ {
1254
+ ref,
1255
+ type: "text",
1256
+ autoComplete: "postal-code",
1257
+ placeholder: getPlaceholder(),
1258
+ value,
1259
+ onChange: handleChange,
1260
+ className,
1261
+ ...props
1262
+ }
1263
+ );
1264
+ }
1265
+ );
1266
+ CardZipInput.displayName = "CardZipInput";
1085
1267
  var checkboxVariants = cva(
1086
1268
  "peer shrink-0 border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:text-primary-foreground",
1087
1269
  {
@@ -1232,7 +1414,7 @@ var CheckboxWithLabel = t.forwardRef(({
1232
1414
  });
1233
1415
  CheckboxWithLabel.displayName = "CheckboxWithLabel";
1234
1416
 
1235
- // node_modules/@radix-ui/primitive/dist/index.mjs
1417
+ // ../../node_modules/@radix-ui/primitive/dist/index.mjs
1236
1418
  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
1237
1419
  return function handleEvent(event) {
1238
1420
  originalEventHandler?.(event);
@@ -3049,85 +3231,6 @@ function D(_) {
3049
3231
  function W(_, C, h) {
3050
3232
  return _ = h && h.length > 0 ? `${_ + " " + h.join(" ")}` : _, G(_, C, D(_), D(C), 0, 0, {});
3051
3233
  }
3052
- var NODES2 = [
3053
- "a",
3054
- "button",
3055
- "div",
3056
- "form",
3057
- "h2",
3058
- "h3",
3059
- "img",
3060
- "input",
3061
- "label",
3062
- "li",
3063
- "nav",
3064
- "ol",
3065
- "p",
3066
- "select",
3067
- "span",
3068
- "svg",
3069
- "ul"
3070
- ];
3071
- var Primitive2 = NODES2.reduce((primitive, node) => {
3072
- const Slot = createSlot(`Primitive.${node}`);
3073
- const Node = t.forwardRef((props, forwardedRef) => {
3074
- const { asChild, ...primitiveProps } = props;
3075
- const Comp = asChild ? Slot : node;
3076
- if (typeof window !== "undefined") {
3077
- window[Symbol.for("radix-ui")] = true;
3078
- }
3079
- return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
3080
- });
3081
- Node.displayName = `Primitive.${node}`;
3082
- return { ...primitive, [node]: Node };
3083
- }, {});
3084
- var useLayoutEffect22 = globalThis?.document ? t.useLayoutEffect : () => {
3085
- };
3086
-
3087
- // ../../node_modules/@radix-ui/react-id/dist/index.mjs
3088
- var useReactId2 = t[" useId ".trim().toString()] || (() => void 0);
3089
- var count2 = 0;
3090
- function useId3(deterministicId) {
3091
- const [id, setId] = t.useState(useReactId2());
3092
- useLayoutEffect22(() => {
3093
- if (!deterministicId)
3094
- setId((reactId) => reactId ?? String(count2++));
3095
- }, [deterministicId]);
3096
- return deterministicId || (id ? `radix-${id}` : "");
3097
- }
3098
- function setRef2(ref, value) {
3099
- if (typeof ref === "function") {
3100
- return ref(value);
3101
- } else if (ref !== null && ref !== void 0) {
3102
- ref.current = value;
3103
- }
3104
- }
3105
- function composeRefs2(...refs) {
3106
- return (node) => {
3107
- let hasCleanup = false;
3108
- const cleanups = refs.map((ref) => {
3109
- const cleanup = setRef2(ref, node);
3110
- if (!hasCleanup && typeof cleanup == "function") {
3111
- hasCleanup = true;
3112
- }
3113
- return cleanup;
3114
- });
3115
- if (hasCleanup) {
3116
- return () => {
3117
- for (let i = 0; i < cleanups.length; i++) {
3118
- const cleanup = cleanups[i];
3119
- if (typeof cleanup == "function") {
3120
- cleanup();
3121
- } else {
3122
- setRef2(refs[i], null);
3123
- }
3124
- }
3125
- };
3126
- }
3127
- };
3128
- }
3129
-
3130
- // ../../node_modules/cmdk/dist/index.mjs
3131
3234
  var N = '[cmdk-group=""]';
3132
3235
  var Y2 = '[cmdk-group-items=""]';
3133
3236
  var be = '[cmdk-group-heading=""]';
@@ -3145,7 +3248,7 @@ var me = t.forwardRef((r, o) => {
3145
3248
  let n = L(() => {
3146
3249
  var e, a;
3147
3250
  return { search: "", value: (a = (e = r.value) != null ? e : r.defaultValue) != null ? a : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
3148
- }), u2 = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p2 = pe(r), { label: b, children: m2, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = false, vimBindings: j = true, ...O } = r, $2 = useId3(), q = useId3(), _ = useId3(), I = t.useRef(null), v = ke();
3251
+ }), u2 = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p2 = pe(r), { label: b, children: m2, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = false, vimBindings: j = true, ...O } = r, $2 = useId2(), q = useId2(), _ = useId2(), I = t.useRef(null), v = ke();
3149
3252
  k2(() => {
3150
3253
  if (R !== void 0) {
3151
3254
  let e = R.trim();
@@ -3260,7 +3363,7 @@ var me = t.forwardRef((r, o) => {
3260
3363
  var e;
3261
3364
  return Array.from(((e = I.current) == null ? void 0 : e.querySelectorAll(ce)) || []);
3262
3365
  }
3263
- function X7(e) {
3366
+ function X8(e) {
3264
3367
  let s = V()[e];
3265
3368
  s && E.setState("value", s.getAttribute(T));
3266
3369
  }
@@ -3275,12 +3378,12 @@ var me = t.forwardRef((r, o) => {
3275
3378
  s = e > 0 ? we(s, N) : De(s, N), i = s == null ? void 0 : s.querySelector(ce);
3276
3379
  i ? E.setState("value", i.getAttribute(T)) : Q(e);
3277
3380
  }
3278
- let oe = () => X7(V().length - 1), ie = (e) => {
3381
+ let oe = () => X8(V().length - 1), ie = (e) => {
3279
3382
  e.preventDefault(), e.metaKey ? oe() : e.altKey ? re(1) : Q(1);
3280
3383
  }, se = (e) => {
3281
- e.preventDefault(), e.metaKey ? X7(0) : e.altKey ? re(-1) : Q(-1);
3384
+ e.preventDefault(), e.metaKey ? X8(0) : e.altKey ? re(-1) : Q(-1);
3282
3385
  };
3283
- return t.createElement(Primitive2.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => {
3386
+ return t.createElement(Primitive.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => {
3284
3387
  var s;
3285
3388
  (s = O.onKeyDown) == null || s.call(O, e);
3286
3389
  let a = e.nativeEvent.isComposing || e.keyCode === 229;
@@ -3305,7 +3408,7 @@ var me = t.forwardRef((r, o) => {
3305
3408
  break;
3306
3409
  }
3307
3410
  case "Home": {
3308
- e.preventDefault(), X7(0);
3411
+ e.preventDefault(), X8(0);
3309
3412
  break;
3310
3413
  }
3311
3414
  case "End": {
@@ -3325,7 +3428,7 @@ var me = t.forwardRef((r, o) => {
3325
3428
  });
3326
3429
  var he = t.forwardRef((r, o) => {
3327
3430
  var _, I;
3328
- let n = useId3(), u2 = t.useRef(null), c = t.useContext(fe), d = K2(), f = pe(r), p2 = (I = (_ = f.current) == null ? void 0 : _.forceMount) != null ? I : c == null ? void 0 : c.forceMount;
3431
+ let n = useId2(), u2 = t.useRef(null), c = t.useContext(fe), d = K2(), f = pe(r), p2 = (I = (_ = f.current) == null ? void 0 : _.forceMount) != null ? I : c == null ? void 0 : c.forceMount;
3329
3432
  k2(() => {
3330
3433
  if (!p2)
3331
3434
  return d.item(n, c == null ? void 0 : c.id);
@@ -3346,23 +3449,23 @@ var he = t.forwardRef((r, o) => {
3346
3449
  if (!x)
3347
3450
  return null;
3348
3451
  let { disabled: A, value: ge, onSelect: j, forceMount: O, keywords: $2, ...q } = r;
3349
- return t.createElement(Primitive2.div, { ref: composeRefs2(u2, o), ...q, id: n, "cmdk-item": "", role: "option", "aria-disabled": !!A, "aria-selected": !!R, "data-disabled": !!A, "data-selected": !!R, onPointerMove: A || d.getDisablePointerSelection() ? void 0 : S, onClick: A ? void 0 : C }, r.children);
3452
+ return t.createElement(Primitive.div, { ref: composeRefs(u2, o), ...q, id: n, "cmdk-item": "", role: "option", "aria-disabled": !!A, "aria-selected": !!R, "data-disabled": !!A, "data-selected": !!R, onPointerMove: A || d.getDisablePointerSelection() ? void 0 : S, onClick: A ? void 0 : C }, r.children);
3350
3453
  });
3351
3454
  var Ee = t.forwardRef((r, o) => {
3352
- let { heading: n, children: u2, forceMount: c, ...d } = r, f = useId3(), p2 = t.useRef(null), b = t.useRef(null), m2 = useId3(), R = K2(), x = P((S) => c || R.filter() === false ? true : S.search ? S.filtered.groups.has(f) : true);
3455
+ let { heading: n, children: u2, forceMount: c, ...d } = r, f = useId2(), p2 = t.useRef(null), b = t.useRef(null), m2 = useId2(), R = K2(), x = P((S) => c || R.filter() === false ? true : S.search ? S.filtered.groups.has(f) : true);
3353
3456
  k2(() => R.group(f), []), ve(f, p2, [r.value, r.heading, b]);
3354
3457
  let C = t.useMemo(() => ({ id: f, forceMount: c }), [c]);
3355
- return t.createElement(Primitive2.div, { ref: composeRefs2(p2, o), ...d, "cmdk-group": "", role: "presentation", hidden: x ? void 0 : true }, n && t.createElement("div", { ref: b, "cmdk-group-heading": "", "aria-hidden": true, id: m2 }, n), B2(r, (S) => t.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": n ? m2 : void 0 }, t.createElement(fe.Provider, { value: C }, S))));
3458
+ return t.createElement(Primitive.div, { ref: composeRefs(p2, o), ...d, "cmdk-group": "", role: "presentation", hidden: x ? void 0 : true }, n && t.createElement("div", { ref: b, "cmdk-group-heading": "", "aria-hidden": true, id: m2 }, n), B2(r, (S) => t.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": n ? m2 : void 0 }, t.createElement(fe.Provider, { value: C }, S))));
3356
3459
  });
3357
3460
  var ye = t.forwardRef((r, o) => {
3358
3461
  let { alwaysRender: n, ...u2 } = r, c = t.useRef(null), d = P((f) => !f.search);
3359
- return !n && !d ? null : t.createElement(Primitive2.div, { ref: composeRefs2(c, o), ...u2, "cmdk-separator": "", role: "separator" });
3462
+ return !n && !d ? null : t.createElement(Primitive.div, { ref: composeRefs(c, o), ...u2, "cmdk-separator": "", role: "separator" });
3360
3463
  });
3361
3464
  var Se = t.forwardRef((r, o) => {
3362
3465
  let { onValueChange: n, ...u2 } = r, c = r.value != null, d = ee(), f = P((m2) => m2.search), p2 = P((m2) => m2.selectedItemId), b = K2();
3363
3466
  return t.useEffect(() => {
3364
3467
  r.value != null && d.setState("search", r.value);
3365
- }, [r.value]), t.createElement(Primitive2.input, { ref: o, ...u2, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: false, "aria-autocomplete": "list", role: "combobox", "aria-expanded": true, "aria-controls": b.listId, "aria-labelledby": b.labelId, "aria-activedescendant": p2, id: b.inputId, type: "text", value: c ? r.value : f, onChange: (m2) => {
3468
+ }, [r.value]), t.createElement(Primitive.input, { ref: o, ...u2, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: false, "aria-autocomplete": "list", role: "combobox", "aria-expanded": true, "aria-controls": b.listId, "aria-labelledby": b.labelId, "aria-activedescendant": p2, id: b.inputId, type: "text", value: c ? r.value : f, onChange: (m2) => {
3366
3469
  c || d.setState("search", m2.target.value), n == null || n(m2.target.value);
3367
3470
  } });
3368
3471
  });
@@ -3380,16 +3483,16 @@ var Ce = t.forwardRef((r, o) => {
3380
3483
  cancelAnimationFrame(x), C.unobserve(m2);
3381
3484
  };
3382
3485
  }
3383
- }, []), t.createElement(Primitive2.div, { ref: composeRefs2(d, o), ...c, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": p2, "aria-label": u2, id: b.listId }, B2(r, (m2) => t.createElement("div", { ref: composeRefs2(f, b.listInnerRef), "cmdk-list-sizer": "" }, m2)));
3486
+ }, []), t.createElement(Primitive.div, { ref: composeRefs(d, o), ...c, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": p2, "aria-label": u2, id: b.listId }, B2(r, (m2) => t.createElement("div", { ref: composeRefs(f, b.listInnerRef), "cmdk-list-sizer": "" }, m2)));
3384
3487
  });
3385
3488
  var xe = t.forwardRef((r, o) => {
3386
3489
  let { open: n, onOpenChange: u2, overlayClassName: c, contentClassName: d, container: f, ...p2 } = r;
3387
3490
  return t.createElement(DialogPrimitive.Root, { open: n, onOpenChange: u2 }, t.createElement(DialogPrimitive.Portal, { container: f }, t.createElement(DialogPrimitive.Overlay, { "cmdk-overlay": "", className: c }), t.createElement(DialogPrimitive.Content, { "aria-label": r.label, "cmdk-dialog": "", className: d }, t.createElement(me, { ref: o, ...p2 }))));
3388
3491
  });
3389
- var Ie = t.forwardRef((r, o) => P((u2) => u2.filtered.count === 0) ? t.createElement(Primitive2.div, { ref: o, ...r, "cmdk-empty": "", role: "presentation" }) : null);
3492
+ var Ie = t.forwardRef((r, o) => P((u2) => u2.filtered.count === 0) ? t.createElement(Primitive.div, { ref: o, ...r, "cmdk-empty": "", role: "presentation" }) : null);
3390
3493
  var Pe = t.forwardRef((r, o) => {
3391
3494
  let { progress: n, children: u2, label: c = "Loading...", ...d } = r;
3392
- return t.createElement(Primitive2.div, { ref: o, ...d, "cmdk-loading": "", role: "progressbar", "aria-valuenow": n, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": c }, B2(r, (f) => t.createElement("div", { "aria-hidden": true }, f)));
3495
+ return t.createElement(Primitive.div, { ref: o, ...d, "cmdk-loading": "", role: "progressbar", "aria-valuenow": n, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": c }, B2(r, (f) => t.createElement("div", { "aria-hidden": true }, f)));
3393
3496
  });
3394
3497
  var _e = Object.assign(me, { List: Ce, Item: he, Input: Se, Group: Ee, Separator: ye, Dialog: xe, Empty: Ie, Loading: Pe });
3395
3498
  function we(r, o) {
@@ -4542,16 +4645,16 @@ var extent = (columnId, _leafRows, childRows) => {
4542
4645
  return [min2, max2];
4543
4646
  };
4544
4647
  var mean = (columnId, leafRows) => {
4545
- let count4 = 0;
4648
+ let count3 = 0;
4546
4649
  let sum2 = 0;
4547
4650
  leafRows.forEach((row) => {
4548
4651
  let value = row.getValue(columnId);
4549
4652
  if (value != null && (value = +value) >= value) {
4550
- ++count4, sum2 += value;
4653
+ ++count3, sum2 += value;
4551
4654
  }
4552
4655
  });
4553
- if (count4)
4554
- return sum2 / count4;
4656
+ if (count3)
4657
+ return sum2 / count3;
4555
4658
  return;
4556
4659
  };
4557
4660
  var median = (columnId, leafRows) => {
@@ -4575,7 +4678,7 @@ var unique = (columnId, leafRows) => {
4575
4678
  var uniqueCount = (columnId, leafRows) => {
4576
4679
  return new Set(leafRows.map((d) => d.getValue(columnId))).size;
4577
4680
  };
4578
- var count3 = (_columnId, leafRows) => {
4681
+ var count2 = (_columnId, leafRows) => {
4579
4682
  return leafRows.length;
4580
4683
  };
4581
4684
  var aggregationFns = {
@@ -4587,7 +4690,7 @@ var aggregationFns = {
4587
4690
  median,
4588
4691
  unique,
4589
4692
  uniqueCount,
4590
- count: count3
4693
+ count: count2
4591
4694
  };
4592
4695
  var ColumnGrouping = {
4593
4696
  getDefaultColumnDef: () => {
@@ -7118,10 +7221,14 @@ var SelectScrollDownButton = t.forwardRef(({ className, ...props }, ref) => /* @
7118
7221
  }
7119
7222
  ));
7120
7223
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
7121
- var SelectContent = t.forwardRef(({ className, children, position = "item-aligned", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
7224
+ var SelectContent = t.forwardRef(({ className, children, position = "popper", side = "bottom", sideOffset = 4, align = "start", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
7122
7225
  SelectPrimitive.Content,
7123
7226
  {
7124
7227
  ref,
7228
+ side,
7229
+ sideOffset,
7230
+ align,
7231
+ avoidCollisions: false,
7125
7232
  className: cn(
7126
7233
  [
7127
7234
  "relative z-50 max-h-96 min-w-[8rem] overflow-hidden",
@@ -7700,49 +7807,47 @@ function DataTable({
7700
7807
  title && /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold", children: title }),
7701
7808
  description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description })
7702
7809
  ] }),
7703
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 md:flex-row md:items-center md:justify-between", children: [
7704
- /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-2", children: [
7705
- enableFiltering && /* @__PURE__ */ jsx(Fragment, { children: customFilter || /* @__PURE__ */ jsxs("div", { className: "relative flex-1 max-w-sm", children: [
7706
- /* @__PURE__ */ jsx(Search, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
7707
- /* @__PURE__ */ jsx(
7708
- Input,
7709
- {
7710
- placeholder: filterPlaceholder,
7711
- value: filterColumn ? table.getColumn(filterColumn)?.getFilterValue() ?? "" : globalFilter,
7712
- onChange: (event) => {
7713
- const value = event.target.value;
7714
- if (filterColumn) {
7715
- table.getColumn(filterColumn)?.setFilterValue(value);
7716
- } else {
7717
- setGlobalFilter(value);
7718
- }
7719
- },
7720
- className: "pl-8"
7721
- }
7722
- ),
7723
- (filterColumn && table.getColumn(filterColumn)?.getFilterValue() || !filterColumn && globalFilter) && /* @__PURE__ */ jsx(
7724
- Button,
7725
- {
7726
- variant: "ghost",
7727
- size: "sm",
7728
- className: "absolute right-0 top-0 h-full px-2",
7729
- onClick: () => {
7730
- if (filterColumn) {
7731
- table.getColumn(filterColumn)?.setFilterValue("");
7732
- } else {
7733
- setGlobalFilter("");
7734
- }
7735
- },
7736
- children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
7737
- }
7738
- )
7739
- ] }) }),
7810
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
7811
+ /* @__PURE__ */ jsx("div", { className: "flex-1 max-w-sm", children: enableFiltering && /* @__PURE__ */ jsx(Fragment, { children: customFilter || /* @__PURE__ */ jsxs("div", { className: "relative", children: [
7812
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
7813
+ /* @__PURE__ */ jsx(
7814
+ Input,
7815
+ {
7816
+ placeholder: filterPlaceholder,
7817
+ value: filterColumn ? table.getColumn(filterColumn)?.getFilterValue() ?? "" : globalFilter,
7818
+ onChange: (event) => {
7819
+ const value = event.target.value;
7820
+ if (filterColumn) {
7821
+ table.getColumn(filterColumn)?.setFilterValue(value);
7822
+ } else {
7823
+ setGlobalFilter(value);
7824
+ }
7825
+ },
7826
+ className: "pl-8"
7827
+ }
7828
+ ),
7829
+ (filterColumn && table.getColumn(filterColumn)?.getFilterValue() || !filterColumn && globalFilter) && /* @__PURE__ */ jsx(
7830
+ Button,
7831
+ {
7832
+ variant: "ghost",
7833
+ size: "sm",
7834
+ className: "absolute right-0 top-0 h-full px-2",
7835
+ onClick: () => {
7836
+ if (filterColumn) {
7837
+ table.getColumn(filterColumn)?.setFilterValue("");
7838
+ } else {
7839
+ setGlobalFilter("");
7840
+ }
7841
+ },
7842
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
7843
+ }
7844
+ )
7845
+ ] }) }) }),
7846
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
7740
7847
  enableRowSelection && selectedRows.length > 0 && /* @__PURE__ */ jsxs(Badge, { variant: "secondary", className: "whitespace-nowrap", children: [
7741
7848
  selectedRows.length,
7742
7849
  " selected"
7743
- ] })
7744
- ] }),
7745
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
7850
+ ] }),
7746
7851
  toolbarActions,
7747
7852
  enableExport && onExport && /* @__PURE__ */ jsxs(
7748
7853
  Button,
@@ -8061,7 +8166,7 @@ function Calendar({
8061
8166
  };
8062
8167
  const days = getDaysInMonth();
8063
8168
  return /* @__PURE__ */ jsxs("div", { className: cn("moonui-theme", "p-0", className), children: [
8064
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
8169
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4 border-b border-border/50 dark:border-gray-700/50", children: [
8065
8170
  /* @__PURE__ */ jsx(
8066
8171
  "button",
8067
8172
  {
@@ -8139,6 +8244,11 @@ function Calendar({
8139
8244
  ] });
8140
8245
  }
8141
8246
  Calendar.displayName = "Calendar";
8247
+ var pageTransitions2 = {
8248
+ initial: { opacity: 0, x: 20 },
8249
+ animate: { opacity: 1, x: 0 },
8250
+ exit: { opacity: 0, x: -20 }
8251
+ };
8142
8252
  var datePickerVariants = cva(
8143
8253
  "w-full justify-start text-left font-normal",
8144
8254
  {
@@ -8197,9 +8307,10 @@ function DatePicker({
8197
8307
  setInternalDate(value);
8198
8308
  }, [value]);
8199
8309
  const handleSelect = (date) => {
8200
- setInternalDate(date);
8201
- onChange?.(date);
8202
- if (date) {
8310
+ const singleDate = Array.isArray(date) ? date[0] : date && typeof date === "object" && "from" in date ? date.from : date;
8311
+ setInternalDate(singleDate);
8312
+ onChange?.(singleDate);
8313
+ if (singleDate) {
8203
8314
  setOpen(false);
8204
8315
  }
8205
8316
  };
@@ -8301,13 +8412,13 @@ function DatePicker({
8301
8412
  /* @__PURE__ */ jsx(
8302
8413
  PopoverContent,
8303
8414
  {
8304
- className: "w-[360px] p-0 shadow-xl rounded-2xl border-0 bg-background/95 backdrop-blur-sm",
8415
+ className: "w-[360px] p-0 shadow-2xl rounded-2xl border border-gray-200 dark:border-gray-700 bg-background/95 backdrop-blur-sm z-[1000]",
8305
8416
  align: "start",
8306
8417
  sideOffset: 12,
8307
8418
  children: /* @__PURE__ */ jsxs(
8308
8419
  motion.div,
8309
8420
  {
8310
- ...pageTransitions.fadeIn,
8421
+ ...pageTransitions2,
8311
8422
  className: "rounded-2xl bg-background overflow-hidden",
8312
8423
  children: [
8313
8424
  /* @__PURE__ */ jsx(
@@ -8392,7 +8503,7 @@ function DateRangePicker({
8392
8503
  ]
8393
8504
  }
8394
8505
  ) }),
8395
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 shadow-xl rounded-2xl border-0 bg-background/95 backdrop-blur-sm", align: "start", sideOffset: 12, children: /* @__PURE__ */ jsx(
8506
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 shadow-2xl rounded-2xl border border-gray-200 dark:border-gray-700 bg-background/95 backdrop-blur-sm z-[1000]", align: "start", sideOffset: 12, children: /* @__PURE__ */ jsx(
8396
8507
  Calendar,
8397
8508
  {
8398
8509
  mode: "range",
@@ -8550,7 +8661,7 @@ function MonthPicker({
8550
8661
  ]
8551
8662
  }
8552
8663
  ) }),
8553
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-64 p-0", align: "start", children: /* @__PURE__ */ jsxs("div", { className: "p-3", children: [
8664
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-64 p-0 shadow-2xl border border-gray-200 dark:border-gray-700 bg-background z-[1000]", align: "start", children: /* @__PURE__ */ jsxs("div", { className: "p-3", children: [
8554
8665
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
8555
8666
  /* @__PURE__ */ jsx(
8556
8667
  Button,
@@ -9329,59 +9440,193 @@ function GitHubStarButton({
9329
9440
  }
9330
9441
  );
9331
9442
  }
9332
- function MoonLogo({
9443
+ function LockedComponent({
9444
+ children,
9445
+ componentName,
9333
9446
  className,
9334
- variant = "default",
9335
- showText = true,
9336
- ...props
9447
+ showPreview = true,
9448
+ previewDuration = 2e3
9337
9449
  }) {
9338
- const logoId = t.useId();
9339
- const gradientId = `moon-gradient-${logoId}`;
9340
- return /* @__PURE__ */ jsxs("div", { className: cn("moonui-theme", "flex items-center gap-2", className), children: [
9341
- /* @__PURE__ */ jsxs(
9342
- "svg",
9343
- {
9344
- width: "32",
9345
- height: "32",
9346
- viewBox: "0 0 32 32",
9347
- fill: "none",
9348
- xmlns: "http://www.w3.org/2000/svg",
9349
- className: "flex-shrink-0",
9350
- ...props,
9351
- children: [
9352
- variant === "gradient" && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
9353
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#3B82F6" }),
9354
- /* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: "#8B5CF6" }),
9355
- /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#EC4899" })
9356
- ] }) }),
9357
- /* @__PURE__ */ jsx(
9358
- "circle",
9359
- {
9360
- cx: "16",
9361
- cy: "16",
9362
- r: "14",
9363
- fill: variant === "gradient" ? `url(#${gradientId})` : "currentColor",
9364
- className: variant === "default" ? "fill-primary" : ""
9365
- }
9366
- ),
9367
- /* @__PURE__ */ jsx(
9368
- "circle",
9369
- {
9370
- cx: "22",
9371
- cy: "10",
9372
- r: "10",
9373
- fill: "white",
9374
- className: "dark:fill-background"
9375
- }
9376
- )
9377
- ]
9378
- }
9379
- ),
9380
- showText && /* @__PURE__ */ jsxs("span", { className: "text-xl font-bold", children: [
9381
- /* @__PURE__ */ jsx("span", { className: "text-foreground", children: "Moon" }),
9382
- /* @__PURE__ */ jsx("span", { className: "text-primary", children: "UI" })
9383
- ] })
9384
- ] });
9450
+ const [isPreviewActive, setIsPreviewActive] = useState(false);
9451
+ const [previewTimeout, setPreviewTimeout] = useState(null);
9452
+ const handleMouseEnter = () => {
9453
+ if (!showPreview)
9454
+ return;
9455
+ setIsPreviewActive(true);
9456
+ if (previewTimeout) {
9457
+ clearTimeout(previewTimeout);
9458
+ }
9459
+ const timeout = setTimeout(() => {
9460
+ setIsPreviewActive(false);
9461
+ }, previewDuration);
9462
+ setPreviewTimeout(timeout);
9463
+ };
9464
+ const handleMouseLeave = () => {
9465
+ if (previewTimeout) {
9466
+ clearTimeout(previewTimeout);
9467
+ setPreviewTimeout(null);
9468
+ }
9469
+ setIsPreviewActive(false);
9470
+ };
9471
+ return /* @__PURE__ */ jsxs(
9472
+ "div",
9473
+ {
9474
+ className: cn(
9475
+ "relative group cursor-pointer transition-all duration-300",
9476
+ className
9477
+ ),
9478
+ onMouseEnter: handleMouseEnter,
9479
+ onMouseLeave: handleMouseLeave,
9480
+ children: [
9481
+ /* @__PURE__ */ jsx(
9482
+ "div",
9483
+ {
9484
+ className: cn(
9485
+ "transition-all duration-300",
9486
+ !isPreviewActive && "blur-sm grayscale-[0.3] opacity-60"
9487
+ ),
9488
+ children
9489
+ }
9490
+ ),
9491
+ /* @__PURE__ */ jsx(
9492
+ "div",
9493
+ {
9494
+ className: cn(
9495
+ "absolute inset-0 bg-gradient-to-br from-amber-500/10 via-transparent to-purple-500/10",
9496
+ "border-2 border-dashed border-amber-400/30 rounded-lg",
9497
+ "flex items-center justify-center",
9498
+ "transition-all duration-300",
9499
+ isPreviewActive ? "opacity-0" : "opacity-100"
9500
+ ),
9501
+ children: /* @__PURE__ */ jsxs("div", { className: "text-center space-y-3 p-6", children: [
9502
+ /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxs(
9503
+ Badge,
9504
+ {
9505
+ variant: "secondary",
9506
+ className: "bg-gradient-to-r from-amber-500 to-orange-500 text-white border-0 px-3 py-1",
9507
+ children: [
9508
+ /* @__PURE__ */ jsx(Crown, { className: "w-3 h-3 mr-1" }),
9509
+ "PRO ONLY"
9510
+ ]
9511
+ }
9512
+ ) }),
9513
+ /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx("div", { className: "p-3 rounded-full bg-amber-100 dark:bg-amber-900/30", children: /* @__PURE__ */ jsx(Lock, { className: "w-6 h-6 text-amber-600 dark:text-amber-400" }) }) }),
9514
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold text-gray-900 dark:text-gray-100", children: componentName }),
9515
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 dark:text-gray-400 max-w-xs", children: "This premium component is available with Pro subscription" }),
9516
+ /* @__PURE__ */ jsxs(
9517
+ Button,
9518
+ {
9519
+ size: "sm",
9520
+ className: "bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 border-0",
9521
+ onClick: () => {
9522
+ if (typeof window !== "undefined") {
9523
+ window.location.href = "/pricing";
9524
+ }
9525
+ },
9526
+ children: [
9527
+ /* @__PURE__ */ jsx(Zap, { className: "w-4 h-4 mr-2" }),
9528
+ "Upgrade to Pro"
9529
+ ]
9530
+ }
9531
+ )
9532
+ ] })
9533
+ }
9534
+ ),
9535
+ showPreview && !isPreviewActive && /* @__PURE__ */ jsx("div", { className: "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200", children: /* @__PURE__ */ jsx("div", { className: "bg-black/80 text-white text-xs px-2 py-1 rounded", children: "Hover to preview" }) })
9536
+ ]
9537
+ }
9538
+ );
9539
+ }
9540
+ function ProComponentWrapper({
9541
+ children,
9542
+ componentId,
9543
+ componentName,
9544
+ className,
9545
+ fallback
9546
+ }) {
9547
+ {
9548
+ return /* @__PURE__ */ jsx("div", { className, children });
9549
+ }
9550
+ }
9551
+ function ProBadge({ className }) {
9552
+ return /* @__PURE__ */ jsxs(
9553
+ Badge,
9554
+ {
9555
+ variant: "secondary",
9556
+ className: cn(
9557
+ "bg-gradient-to-r from-amber-500 to-orange-500 text-white border-0 text-xs",
9558
+ className
9559
+ ),
9560
+ children: [
9561
+ /* @__PURE__ */ jsx(Crown, { className: "w-3 h-3 mr-1" }),
9562
+ "PRO"
9563
+ ]
9564
+ }
9565
+ );
9566
+ }
9567
+ function FreeBadge({ className }) {
9568
+ return /* @__PURE__ */ jsx(
9569
+ Badge,
9570
+ {
9571
+ variant: "outline",
9572
+ className: cn("border-green-500 text-green-600 dark:text-green-400 text-xs", className),
9573
+ children: "FREE"
9574
+ }
9575
+ );
9576
+ }
9577
+ function MoonLogo({
9578
+ className,
9579
+ variant = "default",
9580
+ showText = true,
9581
+ ...props
9582
+ }) {
9583
+ const logoId = t.useId();
9584
+ const gradientId = `moon-gradient-${logoId}`;
9585
+ return /* @__PURE__ */ jsxs("div", { className: cn("moonui-theme", "flex items-center gap-2", className), children: [
9586
+ /* @__PURE__ */ jsxs(
9587
+ "svg",
9588
+ {
9589
+ width: "32",
9590
+ height: "32",
9591
+ viewBox: "0 0 32 32",
9592
+ fill: "none",
9593
+ xmlns: "http://www.w3.org/2000/svg",
9594
+ className: "flex-shrink-0",
9595
+ ...props,
9596
+ children: [
9597
+ variant === "gradient" && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
9598
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#3B82F6" }),
9599
+ /* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: "#8B5CF6" }),
9600
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#EC4899" })
9601
+ ] }) }),
9602
+ /* @__PURE__ */ jsx(
9603
+ "circle",
9604
+ {
9605
+ cx: "16",
9606
+ cy: "16",
9607
+ r: "14",
9608
+ fill: variant === "gradient" ? `url(#${gradientId})` : "currentColor",
9609
+ className: variant === "default" ? "fill-primary" : ""
9610
+ }
9611
+ ),
9612
+ /* @__PURE__ */ jsx(
9613
+ "circle",
9614
+ {
9615
+ cx: "22",
9616
+ cy: "10",
9617
+ r: "10",
9618
+ fill: "white",
9619
+ className: "dark:fill-background"
9620
+ }
9621
+ )
9622
+ ]
9623
+ }
9624
+ ),
9625
+ showText && /* @__PURE__ */ jsxs("span", { className: "text-xl font-bold", children: [
9626
+ /* @__PURE__ */ jsx("span", { className: "text-foreground", children: "Moon" }),
9627
+ /* @__PURE__ */ jsx("span", { className: "text-primary", children: "UI" })
9628
+ ] })
9629
+ ] });
9385
9630
  }
9386
9631
  function MoonLogoIcon({
9387
9632
  className,
@@ -9500,6 +9745,141 @@ var PaginationEllipsis = ({
9500
9745
  }
9501
9746
  );
9502
9747
  PaginationEllipsis.displayName = "PaginationEllipsis";
9748
+ var countryCodes = [
9749
+ { code: "+1", country: "US", flag: "\u{1F1FA}\u{1F1F8}", name: "United States" },
9750
+ { code: "+44", country: "GB", flag: "\u{1F1EC}\u{1F1E7}", name: "United Kingdom" },
9751
+ { code: "+49", country: "DE", flag: "\u{1F1E9}\u{1F1EA}", name: "Germany" },
9752
+ { code: "+33", country: "FR", flag: "\u{1F1EB}\u{1F1F7}", name: "France" },
9753
+ { code: "+39", country: "IT", flag: "\u{1F1EE}\u{1F1F9}", name: "Italy" },
9754
+ { code: "+34", country: "ES", flag: "\u{1F1EA}\u{1F1F8}", name: "Spain" },
9755
+ { code: "+31", country: "NL", flag: "\u{1F1F3}\u{1F1F1}", name: "Netherlands" },
9756
+ { code: "+46", country: "SE", flag: "\u{1F1F8}\u{1F1EA}", name: "Sweden" },
9757
+ { code: "+47", country: "NO", flag: "\u{1F1F3}\u{1F1F4}", name: "Norway" },
9758
+ { code: "+45", country: "DK", flag: "\u{1F1E9}\u{1F1F0}", name: "Denmark" },
9759
+ { code: "+358", country: "FI", flag: "\u{1F1EB}\u{1F1EE}", name: "Finland" },
9760
+ { code: "+48", country: "PL", flag: "\u{1F1F5}\u{1F1F1}", name: "Poland" },
9761
+ { code: "+90", country: "TR", flag: "\u{1F1F9}\u{1F1F7}", name: "Turkey" },
9762
+ { code: "+86", country: "CN", flag: "\u{1F1E8}\u{1F1F3}", name: "China" },
9763
+ { code: "+81", country: "JP", flag: "\u{1F1EF}\u{1F1F5}", name: "Japan" },
9764
+ { code: "+82", country: "KR", flag: "\u{1F1F0}\u{1F1F7}", name: "South Korea" },
9765
+ { code: "+91", country: "IN", flag: "\u{1F1EE}\u{1F1F3}", name: "India" },
9766
+ { code: "+61", country: "AU", flag: "\u{1F1E6}\u{1F1FA}", name: "Australia" },
9767
+ { code: "+64", country: "NZ", flag: "\u{1F1F3}\u{1F1FF}", name: "New Zealand" },
9768
+ { code: "+27", country: "ZA", flag: "\u{1F1FF}\u{1F1E6}", name: "South Africa" },
9769
+ { code: "+55", country: "BR", flag: "\u{1F1E7}\u{1F1F7}", name: "Brazil" },
9770
+ { code: "+52", country: "MX", flag: "\u{1F1F2}\u{1F1FD}", name: "Mexico" },
9771
+ { code: "+54", country: "AR", flag: "\u{1F1E6}\u{1F1F7}", name: "Argentina" },
9772
+ { code: "+20", country: "EG", flag: "\u{1F1EA}\u{1F1EC}", name: "Egypt" },
9773
+ { code: "+966", country: "SA", flag: "\u{1F1F8}\u{1F1E6}", name: "Saudi Arabia" },
9774
+ { code: "+971", country: "AE", flag: "\u{1F1E6}\u{1F1EA}", name: "UAE" }
9775
+ ];
9776
+ var formatPhoneNumber = (value, countryCode) => {
9777
+ const cleaned = value.replace(/\D/g, "");
9778
+ switch (countryCode) {
9779
+ case "+1":
9780
+ if (cleaned.length <= 3)
9781
+ return cleaned;
9782
+ if (cleaned.length <= 6)
9783
+ return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3)}`;
9784
+ return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)}-${cleaned.slice(6, 10)}`;
9785
+ case "+44":
9786
+ if (cleaned.length <= 4)
9787
+ return cleaned;
9788
+ if (cleaned.length <= 7)
9789
+ return `${cleaned.slice(0, 4)} ${cleaned.slice(4)}`;
9790
+ return `${cleaned.slice(0, 4)} ${cleaned.slice(4, 7)} ${cleaned.slice(7, 11)}`;
9791
+ case "+90":
9792
+ if (cleaned.length <= 3)
9793
+ return cleaned;
9794
+ if (cleaned.length <= 6)
9795
+ return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3)}`;
9796
+ if (cleaned.length <= 9)
9797
+ return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)} ${cleaned.slice(6)}`;
9798
+ return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)} ${cleaned.slice(6, 8)} ${cleaned.slice(8, 10)}`;
9799
+ default:
9800
+ let formatted = "";
9801
+ for (let i = 0; i < cleaned.length; i++) {
9802
+ if (i > 0 && i % 3 === 0)
9803
+ formatted += " ";
9804
+ formatted += cleaned[i];
9805
+ }
9806
+ return formatted;
9807
+ }
9808
+ };
9809
+ var getMaxLength = (countryCode) => {
9810
+ switch (countryCode) {
9811
+ case "+1":
9812
+ return 10;
9813
+ case "+44":
9814
+ return 11;
9815
+ case "+90":
9816
+ return 10;
9817
+ default:
9818
+ return 15;
9819
+ }
9820
+ };
9821
+ var PhoneInput = t.forwardRef(
9822
+ ({
9823
+ className,
9824
+ value = "",
9825
+ onChange,
9826
+ defaultCountry = "+1",
9827
+ showIcon = true,
9828
+ showCountrySelect = true,
9829
+ countries = countryCodes,
9830
+ size,
9831
+ ...props
9832
+ }, ref) => {
9833
+ const [countryCode, setCountryCode] = t.useState(defaultCountry);
9834
+ const [phoneNumber, setPhoneNumber] = t.useState(value);
9835
+ const selectedCountry = countries.find((c) => c.code === countryCode) || countries[0];
9836
+ const handlePhoneChange = (e) => {
9837
+ const rawValue = e.target.value.replace(/\D/g, "");
9838
+ const maxLength = getMaxLength(countryCode);
9839
+ const truncated = rawValue.slice(0, maxLength);
9840
+ const formatted = formatPhoneNumber(truncated, countryCode);
9841
+ setPhoneNumber(truncated);
9842
+ onChange?.(truncated, countryCode);
9843
+ e.target.value = formatted;
9844
+ };
9845
+ const handleCountryChange = (newCountryCode) => {
9846
+ setCountryCode(newCountryCode);
9847
+ onChange?.(phoneNumber, newCountryCode);
9848
+ };
9849
+ const formattedValue = formatPhoneNumber(phoneNumber, countryCode);
9850
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative flex gap-2", className), children: [
9851
+ showCountrySelect && /* @__PURE__ */ jsxs(Select, { value: countryCode, onValueChange: handleCountryChange, children: [
9852
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "w-[120px]", children: /* @__PURE__ */ jsx(SelectValue, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9853
+ /* @__PURE__ */ jsx("span", { children: selectedCountry.flag }),
9854
+ /* @__PURE__ */ jsx("span", { children: selectedCountry.code })
9855
+ ] }) }) }),
9856
+ /* @__PURE__ */ jsx(SelectContent, { children: countries.map((country) => /* @__PURE__ */ jsx(SelectItem, { value: country.code, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9857
+ /* @__PURE__ */ jsx("span", { children: country.flag }),
9858
+ /* @__PURE__ */ jsx("span", { children: country.code }),
9859
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: country.name })
9860
+ ] }) }, country.code)) })
9861
+ ] }),
9862
+ /* @__PURE__ */ jsxs("div", { className: "relative flex-1", children: [
9863
+ /* @__PURE__ */ jsx(
9864
+ Input,
9865
+ {
9866
+ ref,
9867
+ type: "tel",
9868
+ inputMode: "numeric",
9869
+ autoComplete: "tel",
9870
+ placeholder: countryCode === "+1" ? "(555) 123-4567" : "123 456 789",
9871
+ value: formattedValue,
9872
+ onChange: handlePhoneChange,
9873
+ className: cn(showIcon && "pl-10", className),
9874
+ ...props
9875
+ }
9876
+ ),
9877
+ showIcon && /* @__PURE__ */ jsx(Phone, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" })
9878
+ ] })
9879
+ ] });
9880
+ }
9881
+ );
9882
+ PhoneInput.displayName = "PhoneInput";
9503
9883
  var radioGroupItemVariants = cva(
9504
9884
  "aspect-square border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
9505
9885
  {
@@ -9689,6 +10069,767 @@ function RichTextEditor({
9689
10069
  )
9690
10070
  ] });
9691
10071
  }
10072
+ function useCallbackRef(callback) {
10073
+ const callbackRef = t.useRef(callback);
10074
+ t.useEffect(() => {
10075
+ callbackRef.current = callback;
10076
+ });
10077
+ return t.useMemo(() => (...args) => callbackRef.current?.(...args), []);
10078
+ }
10079
+ var DirectionContext = t.createContext(void 0);
10080
+ function useDirection(localDir) {
10081
+ const globalDir = t.useContext(DirectionContext);
10082
+ return localDir || globalDir || "ltr";
10083
+ }
10084
+
10085
+ // ../../node_modules/@radix-ui/number/dist/index.mjs
10086
+ function clamp(value, [min2, max2]) {
10087
+ return Math.min(max2, Math.max(min2, value));
10088
+ }
10089
+ function useStateMachine2(initialState, machine) {
10090
+ return t.useReducer((state, event) => {
10091
+ const nextState = machine[state][event];
10092
+ return nextState ?? state;
10093
+ }, initialState);
10094
+ }
10095
+ var SCROLL_AREA_NAME = "ScrollArea";
10096
+ var [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME);
10097
+ var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);
10098
+ var ScrollArea = t.forwardRef(
10099
+ (props, forwardedRef) => {
10100
+ const {
10101
+ __scopeScrollArea,
10102
+ type = "hover",
10103
+ dir,
10104
+ scrollHideDelay = 600,
10105
+ ...scrollAreaProps
10106
+ } = props;
10107
+ const [scrollArea, setScrollArea] = t.useState(null);
10108
+ const [viewport, setViewport] = t.useState(null);
10109
+ const [content, setContent] = t.useState(null);
10110
+ const [scrollbarX, setScrollbarX] = t.useState(null);
10111
+ const [scrollbarY, setScrollbarY] = t.useState(null);
10112
+ const [cornerWidth, setCornerWidth] = t.useState(0);
10113
+ const [cornerHeight, setCornerHeight] = t.useState(0);
10114
+ const [scrollbarXEnabled, setScrollbarXEnabled] = t.useState(false);
10115
+ const [scrollbarYEnabled, setScrollbarYEnabled] = t.useState(false);
10116
+ const composedRefs = useComposedRefs(forwardedRef, (node) => setScrollArea(node));
10117
+ const direction = useDirection(dir);
10118
+ return /* @__PURE__ */ jsx(
10119
+ ScrollAreaProvider,
10120
+ {
10121
+ scope: __scopeScrollArea,
10122
+ type,
10123
+ dir: direction,
10124
+ scrollHideDelay,
10125
+ scrollArea,
10126
+ viewport,
10127
+ onViewportChange: setViewport,
10128
+ content,
10129
+ onContentChange: setContent,
10130
+ scrollbarX,
10131
+ onScrollbarXChange: setScrollbarX,
10132
+ scrollbarXEnabled,
10133
+ onScrollbarXEnabledChange: setScrollbarXEnabled,
10134
+ scrollbarY,
10135
+ onScrollbarYChange: setScrollbarY,
10136
+ scrollbarYEnabled,
10137
+ onScrollbarYEnabledChange: setScrollbarYEnabled,
10138
+ onCornerWidthChange: setCornerWidth,
10139
+ onCornerHeightChange: setCornerHeight,
10140
+ children: /* @__PURE__ */ jsx(
10141
+ Primitive.div,
10142
+ {
10143
+ dir: direction,
10144
+ ...scrollAreaProps,
10145
+ ref: composedRefs,
10146
+ style: {
10147
+ position: "relative",
10148
+ // Pass corner sizes as CSS vars to reduce re-renders of context consumers
10149
+ ["--radix-scroll-area-corner-width"]: cornerWidth + "px",
10150
+ ["--radix-scroll-area-corner-height"]: cornerHeight + "px",
10151
+ ...props.style
10152
+ }
10153
+ }
10154
+ )
10155
+ }
10156
+ );
10157
+ }
10158
+ );
10159
+ ScrollArea.displayName = SCROLL_AREA_NAME;
10160
+ var VIEWPORT_NAME = "ScrollAreaViewport";
10161
+ var ScrollAreaViewport = t.forwardRef(
10162
+ (props, forwardedRef) => {
10163
+ const { __scopeScrollArea, children, nonce, ...viewportProps } = props;
10164
+ const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);
10165
+ const ref = t.useRef(null);
10166
+ const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);
10167
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
10168
+ /* @__PURE__ */ jsx(
10169
+ "style",
10170
+ {
10171
+ dangerouslySetInnerHTML: {
10172
+ __html: `[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`
10173
+ },
10174
+ nonce
10175
+ }
10176
+ ),
10177
+ /* @__PURE__ */ jsx(
10178
+ Primitive.div,
10179
+ {
10180
+ "data-radix-scroll-area-viewport": "",
10181
+ ...viewportProps,
10182
+ ref: composedRefs,
10183
+ style: {
10184
+ /**
10185
+ * We don't support `visible` because the intention is to have at least one scrollbar
10186
+ * if this component is used and `visible` will behave like `auto` in that case
10187
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description
10188
+ *
10189
+ * We don't handle `auto` because the intention is for the native implementation
10190
+ * to be hidden if using this component. We just want to ensure the node is scrollable
10191
+ * so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
10192
+ * the browser from having to work out whether to render native scrollbars or not,
10193
+ * we tell it to with the intention of hiding them in CSS.
10194
+ */
10195
+ overflowX: context.scrollbarXEnabled ? "scroll" : "hidden",
10196
+ overflowY: context.scrollbarYEnabled ? "scroll" : "hidden",
10197
+ ...props.style
10198
+ },
10199
+ children: /* @__PURE__ */ jsx("div", { ref: context.onContentChange, style: { minWidth: "100%", display: "table" }, children })
10200
+ }
10201
+ )
10202
+ ] });
10203
+ }
10204
+ );
10205
+ ScrollAreaViewport.displayName = VIEWPORT_NAME;
10206
+ var SCROLLBAR_NAME = "ScrollAreaScrollbar";
10207
+ var ScrollAreaScrollbar = t.forwardRef(
10208
+ (props, forwardedRef) => {
10209
+ const { forceMount, ...scrollbarProps } = props;
10210
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
10211
+ const { onScrollbarXEnabledChange, onScrollbarYEnabledChange } = context;
10212
+ const isHorizontal = props.orientation === "horizontal";
10213
+ t.useEffect(() => {
10214
+ isHorizontal ? onScrollbarXEnabledChange(true) : onScrollbarYEnabledChange(true);
10215
+ return () => {
10216
+ isHorizontal ? onScrollbarXEnabledChange(false) : onScrollbarYEnabledChange(false);
10217
+ };
10218
+ }, [isHorizontal, onScrollbarXEnabledChange, onScrollbarYEnabledChange]);
10219
+ return context.type === "hover" ? /* @__PURE__ */ jsx(ScrollAreaScrollbarHover, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === "scroll" ? /* @__PURE__ */ jsx(ScrollAreaScrollbarScroll, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === "auto" ? /* @__PURE__ */ jsx(ScrollAreaScrollbarAuto, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === "always" ? /* @__PURE__ */ jsx(ScrollAreaScrollbarVisible, { ...scrollbarProps, ref: forwardedRef }) : null;
10220
+ }
10221
+ );
10222
+ ScrollAreaScrollbar.displayName = SCROLLBAR_NAME;
10223
+ var ScrollAreaScrollbarHover = t.forwardRef((props, forwardedRef) => {
10224
+ const { forceMount, ...scrollbarProps } = props;
10225
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
10226
+ const [visible, setVisible] = t.useState(false);
10227
+ t.useEffect(() => {
10228
+ const scrollArea = context.scrollArea;
10229
+ let hideTimer = 0;
10230
+ if (scrollArea) {
10231
+ const handlePointerEnter = () => {
10232
+ window.clearTimeout(hideTimer);
10233
+ setVisible(true);
10234
+ };
10235
+ const handlePointerLeave = () => {
10236
+ hideTimer = window.setTimeout(() => setVisible(false), context.scrollHideDelay);
10237
+ };
10238
+ scrollArea.addEventListener("pointerenter", handlePointerEnter);
10239
+ scrollArea.addEventListener("pointerleave", handlePointerLeave);
10240
+ return () => {
10241
+ window.clearTimeout(hideTimer);
10242
+ scrollArea.removeEventListener("pointerenter", handlePointerEnter);
10243
+ scrollArea.removeEventListener("pointerleave", handlePointerLeave);
10244
+ };
10245
+ }
10246
+ }, [context.scrollArea, context.scrollHideDelay]);
10247
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || visible, children: /* @__PURE__ */ jsx(
10248
+ ScrollAreaScrollbarAuto,
10249
+ {
10250
+ "data-state": visible ? "visible" : "hidden",
10251
+ ...scrollbarProps,
10252
+ ref: forwardedRef
10253
+ }
10254
+ ) });
10255
+ });
10256
+ var ScrollAreaScrollbarScroll = t.forwardRef((props, forwardedRef) => {
10257
+ const { forceMount, ...scrollbarProps } = props;
10258
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
10259
+ const isHorizontal = props.orientation === "horizontal";
10260
+ const debounceScrollEnd = useDebounceCallback(() => send("SCROLL_END"), 100);
10261
+ const [state, send] = useStateMachine2("hidden", {
10262
+ hidden: {
10263
+ SCROLL: "scrolling"
10264
+ },
10265
+ scrolling: {
10266
+ SCROLL_END: "idle",
10267
+ POINTER_ENTER: "interacting"
10268
+ },
10269
+ interacting: {
10270
+ SCROLL: "interacting",
10271
+ POINTER_LEAVE: "idle"
10272
+ },
10273
+ idle: {
10274
+ HIDE: "hidden",
10275
+ SCROLL: "scrolling",
10276
+ POINTER_ENTER: "interacting"
10277
+ }
10278
+ });
10279
+ t.useEffect(() => {
10280
+ if (state === "idle") {
10281
+ const hideTimer = window.setTimeout(() => send("HIDE"), context.scrollHideDelay);
10282
+ return () => window.clearTimeout(hideTimer);
10283
+ }
10284
+ }, [state, context.scrollHideDelay, send]);
10285
+ t.useEffect(() => {
10286
+ const viewport = context.viewport;
10287
+ const scrollDirection = isHorizontal ? "scrollLeft" : "scrollTop";
10288
+ if (viewport) {
10289
+ let prevScrollPos = viewport[scrollDirection];
10290
+ const handleScroll = () => {
10291
+ const scrollPos = viewport[scrollDirection];
10292
+ const hasScrollInDirectionChanged = prevScrollPos !== scrollPos;
10293
+ if (hasScrollInDirectionChanged) {
10294
+ send("SCROLL");
10295
+ debounceScrollEnd();
10296
+ }
10297
+ prevScrollPos = scrollPos;
10298
+ };
10299
+ viewport.addEventListener("scroll", handleScroll);
10300
+ return () => viewport.removeEventListener("scroll", handleScroll);
10301
+ }
10302
+ }, [context.viewport, isHorizontal, send, debounceScrollEnd]);
10303
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || state !== "hidden", children: /* @__PURE__ */ jsx(
10304
+ ScrollAreaScrollbarVisible,
10305
+ {
10306
+ "data-state": state === "hidden" ? "hidden" : "visible",
10307
+ ...scrollbarProps,
10308
+ ref: forwardedRef,
10309
+ onPointerEnter: composeEventHandlers(props.onPointerEnter, () => send("POINTER_ENTER")),
10310
+ onPointerLeave: composeEventHandlers(props.onPointerLeave, () => send("POINTER_LEAVE"))
10311
+ }
10312
+ ) });
10313
+ });
10314
+ var ScrollAreaScrollbarAuto = t.forwardRef((props, forwardedRef) => {
10315
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
10316
+ const { forceMount, ...scrollbarProps } = props;
10317
+ const [visible, setVisible] = t.useState(false);
10318
+ const isHorizontal = props.orientation === "horizontal";
10319
+ const handleResize = useDebounceCallback(() => {
10320
+ if (context.viewport) {
10321
+ const isOverflowX = context.viewport.offsetWidth < context.viewport.scrollWidth;
10322
+ const isOverflowY = context.viewport.offsetHeight < context.viewport.scrollHeight;
10323
+ setVisible(isHorizontal ? isOverflowX : isOverflowY);
10324
+ }
10325
+ }, 10);
10326
+ useResizeObserver(context.viewport, handleResize);
10327
+ useResizeObserver(context.content, handleResize);
10328
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || visible, children: /* @__PURE__ */ jsx(
10329
+ ScrollAreaScrollbarVisible,
10330
+ {
10331
+ "data-state": visible ? "visible" : "hidden",
10332
+ ...scrollbarProps,
10333
+ ref: forwardedRef
10334
+ }
10335
+ ) });
10336
+ });
10337
+ var ScrollAreaScrollbarVisible = t.forwardRef((props, forwardedRef) => {
10338
+ const { orientation = "vertical", ...scrollbarProps } = props;
10339
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
10340
+ const thumbRef = t.useRef(null);
10341
+ const pointerOffsetRef = t.useRef(0);
10342
+ const [sizes, setSizes] = t.useState({
10343
+ content: 0,
10344
+ viewport: 0,
10345
+ scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
10346
+ });
10347
+ const thumbRatio = getThumbRatio(sizes.viewport, sizes.content);
10348
+ const commonProps = {
10349
+ ...scrollbarProps,
10350
+ sizes,
10351
+ onSizesChange: setSizes,
10352
+ hasThumb: Boolean(thumbRatio > 0 && thumbRatio < 1),
10353
+ onThumbChange: (thumb) => thumbRef.current = thumb,
10354
+ onThumbPointerUp: () => pointerOffsetRef.current = 0,
10355
+ onThumbPointerDown: (pointerPos) => pointerOffsetRef.current = pointerPos
10356
+ };
10357
+ function getScrollPosition(pointerPos, dir) {
10358
+ return getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes, dir);
10359
+ }
10360
+ if (orientation === "horizontal") {
10361
+ return /* @__PURE__ */ jsx(
10362
+ ScrollAreaScrollbarX,
10363
+ {
10364
+ ...commonProps,
10365
+ ref: forwardedRef,
10366
+ onThumbPositionChange: () => {
10367
+ if (context.viewport && thumbRef.current) {
10368
+ const scrollPos = context.viewport.scrollLeft;
10369
+ const offset = getThumbOffsetFromScroll(scrollPos, sizes, context.dir);
10370
+ thumbRef.current.style.transform = `translate3d(${offset}px, 0, 0)`;
10371
+ }
10372
+ },
10373
+ onWheelScroll: (scrollPos) => {
10374
+ if (context.viewport)
10375
+ context.viewport.scrollLeft = scrollPos;
10376
+ },
10377
+ onDragScroll: (pointerPos) => {
10378
+ if (context.viewport) {
10379
+ context.viewport.scrollLeft = getScrollPosition(pointerPos, context.dir);
10380
+ }
10381
+ }
10382
+ }
10383
+ );
10384
+ }
10385
+ if (orientation === "vertical") {
10386
+ return /* @__PURE__ */ jsx(
10387
+ ScrollAreaScrollbarY,
10388
+ {
10389
+ ...commonProps,
10390
+ ref: forwardedRef,
10391
+ onThumbPositionChange: () => {
10392
+ if (context.viewport && thumbRef.current) {
10393
+ const scrollPos = context.viewport.scrollTop;
10394
+ const offset = getThumbOffsetFromScroll(scrollPos, sizes);
10395
+ thumbRef.current.style.transform = `translate3d(0, ${offset}px, 0)`;
10396
+ }
10397
+ },
10398
+ onWheelScroll: (scrollPos) => {
10399
+ if (context.viewport)
10400
+ context.viewport.scrollTop = scrollPos;
10401
+ },
10402
+ onDragScroll: (pointerPos) => {
10403
+ if (context.viewport)
10404
+ context.viewport.scrollTop = getScrollPosition(pointerPos);
10405
+ }
10406
+ }
10407
+ );
10408
+ }
10409
+ return null;
10410
+ });
10411
+ var ScrollAreaScrollbarX = t.forwardRef((props, forwardedRef) => {
10412
+ const { sizes, onSizesChange, ...scrollbarProps } = props;
10413
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
10414
+ const [computedStyle, setComputedStyle] = t.useState();
10415
+ const ref = t.useRef(null);
10416
+ const composeRefs2 = useComposedRefs(forwardedRef, ref, context.onScrollbarXChange);
10417
+ t.useEffect(() => {
10418
+ if (ref.current)
10419
+ setComputedStyle(getComputedStyle(ref.current));
10420
+ }, [ref]);
10421
+ return /* @__PURE__ */ jsx(
10422
+ ScrollAreaScrollbarImpl,
10423
+ {
10424
+ "data-orientation": "horizontal",
10425
+ ...scrollbarProps,
10426
+ ref: composeRefs2,
10427
+ sizes,
10428
+ style: {
10429
+ bottom: 0,
10430
+ left: context.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
10431
+ right: context.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
10432
+ ["--radix-scroll-area-thumb-width"]: getThumbSize(sizes) + "px",
10433
+ ...props.style
10434
+ },
10435
+ onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.x),
10436
+ onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.x),
10437
+ onWheelScroll: (event, maxScrollPos) => {
10438
+ if (context.viewport) {
10439
+ const scrollPos = context.viewport.scrollLeft + event.deltaX;
10440
+ props.onWheelScroll(scrollPos);
10441
+ if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) {
10442
+ event.preventDefault();
10443
+ }
10444
+ }
10445
+ },
10446
+ onResize: () => {
10447
+ if (ref.current && context.viewport && computedStyle) {
10448
+ onSizesChange({
10449
+ content: context.viewport.scrollWidth,
10450
+ viewport: context.viewport.offsetWidth,
10451
+ scrollbar: {
10452
+ size: ref.current.clientWidth,
10453
+ paddingStart: toInt(computedStyle.paddingLeft),
10454
+ paddingEnd: toInt(computedStyle.paddingRight)
10455
+ }
10456
+ });
10457
+ }
10458
+ }
10459
+ }
10460
+ );
10461
+ });
10462
+ var ScrollAreaScrollbarY = t.forwardRef((props, forwardedRef) => {
10463
+ const { sizes, onSizesChange, ...scrollbarProps } = props;
10464
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
10465
+ const [computedStyle, setComputedStyle] = t.useState();
10466
+ const ref = t.useRef(null);
10467
+ const composeRefs2 = useComposedRefs(forwardedRef, ref, context.onScrollbarYChange);
10468
+ t.useEffect(() => {
10469
+ if (ref.current)
10470
+ setComputedStyle(getComputedStyle(ref.current));
10471
+ }, [ref]);
10472
+ return /* @__PURE__ */ jsx(
10473
+ ScrollAreaScrollbarImpl,
10474
+ {
10475
+ "data-orientation": "vertical",
10476
+ ...scrollbarProps,
10477
+ ref: composeRefs2,
10478
+ sizes,
10479
+ style: {
10480
+ top: 0,
10481
+ right: context.dir === "ltr" ? 0 : void 0,
10482
+ left: context.dir === "rtl" ? 0 : void 0,
10483
+ bottom: "var(--radix-scroll-area-corner-height)",
10484
+ ["--radix-scroll-area-thumb-height"]: getThumbSize(sizes) + "px",
10485
+ ...props.style
10486
+ },
10487
+ onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.y),
10488
+ onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.y),
10489
+ onWheelScroll: (event, maxScrollPos) => {
10490
+ if (context.viewport) {
10491
+ const scrollPos = context.viewport.scrollTop + event.deltaY;
10492
+ props.onWheelScroll(scrollPos);
10493
+ if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) {
10494
+ event.preventDefault();
10495
+ }
10496
+ }
10497
+ },
10498
+ onResize: () => {
10499
+ if (ref.current && context.viewport && computedStyle) {
10500
+ onSizesChange({
10501
+ content: context.viewport.scrollHeight,
10502
+ viewport: context.viewport.offsetHeight,
10503
+ scrollbar: {
10504
+ size: ref.current.clientHeight,
10505
+ paddingStart: toInt(computedStyle.paddingTop),
10506
+ paddingEnd: toInt(computedStyle.paddingBottom)
10507
+ }
10508
+ });
10509
+ }
10510
+ }
10511
+ }
10512
+ );
10513
+ });
10514
+ var [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME);
10515
+ var ScrollAreaScrollbarImpl = t.forwardRef((props, forwardedRef) => {
10516
+ const {
10517
+ __scopeScrollArea,
10518
+ sizes,
10519
+ hasThumb,
10520
+ onThumbChange,
10521
+ onThumbPointerUp,
10522
+ onThumbPointerDown,
10523
+ onThumbPositionChange,
10524
+ onDragScroll,
10525
+ onWheelScroll,
10526
+ onResize,
10527
+ ...scrollbarProps
10528
+ } = props;
10529
+ const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea);
10530
+ const [scrollbar, setScrollbar] = t.useState(null);
10531
+ const composeRefs2 = useComposedRefs(forwardedRef, (node) => setScrollbar(node));
10532
+ const rectRef = t.useRef(null);
10533
+ const prevWebkitUserSelectRef = t.useRef("");
10534
+ const viewport = context.viewport;
10535
+ const maxScrollPos = sizes.content - sizes.viewport;
10536
+ const handleWheelScroll = useCallbackRef(onWheelScroll);
10537
+ const handleThumbPositionChange = useCallbackRef(onThumbPositionChange);
10538
+ const handleResize = useDebounceCallback(onResize, 10);
10539
+ function handleDragScroll(event) {
10540
+ if (rectRef.current) {
10541
+ const x = event.clientX - rectRef.current.left;
10542
+ const y = event.clientY - rectRef.current.top;
10543
+ onDragScroll({ x, y });
10544
+ }
10545
+ }
10546
+ t.useEffect(() => {
10547
+ const handleWheel = (event) => {
10548
+ const element = event.target;
10549
+ const isScrollbarWheel = scrollbar?.contains(element);
10550
+ if (isScrollbarWheel)
10551
+ handleWheelScroll(event, maxScrollPos);
10552
+ };
10553
+ document.addEventListener("wheel", handleWheel, { passive: false });
10554
+ return () => document.removeEventListener("wheel", handleWheel, { passive: false });
10555
+ }, [viewport, scrollbar, maxScrollPos, handleWheelScroll]);
10556
+ t.useEffect(handleThumbPositionChange, [sizes, handleThumbPositionChange]);
10557
+ useResizeObserver(scrollbar, handleResize);
10558
+ useResizeObserver(context.content, handleResize);
10559
+ return /* @__PURE__ */ jsx(
10560
+ ScrollbarProvider,
10561
+ {
10562
+ scope: __scopeScrollArea,
10563
+ scrollbar,
10564
+ hasThumb,
10565
+ onThumbChange: useCallbackRef(onThumbChange),
10566
+ onThumbPointerUp: useCallbackRef(onThumbPointerUp),
10567
+ onThumbPositionChange: handleThumbPositionChange,
10568
+ onThumbPointerDown: useCallbackRef(onThumbPointerDown),
10569
+ children: /* @__PURE__ */ jsx(
10570
+ Primitive.div,
10571
+ {
10572
+ ...scrollbarProps,
10573
+ ref: composeRefs2,
10574
+ style: { position: "absolute", ...scrollbarProps.style },
10575
+ onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
10576
+ const mainPointer = 0;
10577
+ if (event.button === mainPointer) {
10578
+ const element = event.target;
10579
+ element.setPointerCapture(event.pointerId);
10580
+ rectRef.current = scrollbar.getBoundingClientRect();
10581
+ prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;
10582
+ document.body.style.webkitUserSelect = "none";
10583
+ if (context.viewport)
10584
+ context.viewport.style.scrollBehavior = "auto";
10585
+ handleDragScroll(event);
10586
+ }
10587
+ }),
10588
+ onPointerMove: composeEventHandlers(props.onPointerMove, handleDragScroll),
10589
+ onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {
10590
+ const element = event.target;
10591
+ if (element.hasPointerCapture(event.pointerId)) {
10592
+ element.releasePointerCapture(event.pointerId);
10593
+ }
10594
+ document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
10595
+ if (context.viewport)
10596
+ context.viewport.style.scrollBehavior = "";
10597
+ rectRef.current = null;
10598
+ })
10599
+ }
10600
+ )
10601
+ }
10602
+ );
10603
+ });
10604
+ var THUMB_NAME = "ScrollAreaThumb";
10605
+ var ScrollAreaThumb = t.forwardRef(
10606
+ (props, forwardedRef) => {
10607
+ const { forceMount, ...thumbProps } = props;
10608
+ const scrollbarContext = useScrollbarContext(THUMB_NAME, props.__scopeScrollArea);
10609
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || scrollbarContext.hasThumb, children: /* @__PURE__ */ jsx(ScrollAreaThumbImpl, { ref: forwardedRef, ...thumbProps }) });
10610
+ }
10611
+ );
10612
+ var ScrollAreaThumbImpl = t.forwardRef(
10613
+ (props, forwardedRef) => {
10614
+ const { __scopeScrollArea, style, ...thumbProps } = props;
10615
+ const scrollAreaContext = useScrollAreaContext(THUMB_NAME, __scopeScrollArea);
10616
+ const scrollbarContext = useScrollbarContext(THUMB_NAME, __scopeScrollArea);
10617
+ const { onThumbPositionChange } = scrollbarContext;
10618
+ const composedRef = useComposedRefs(
10619
+ forwardedRef,
10620
+ (node) => scrollbarContext.onThumbChange(node)
10621
+ );
10622
+ const removeUnlinkedScrollListenerRef = t.useRef(void 0);
10623
+ const debounceScrollEnd = useDebounceCallback(() => {
10624
+ if (removeUnlinkedScrollListenerRef.current) {
10625
+ removeUnlinkedScrollListenerRef.current();
10626
+ removeUnlinkedScrollListenerRef.current = void 0;
10627
+ }
10628
+ }, 100);
10629
+ t.useEffect(() => {
10630
+ const viewport = scrollAreaContext.viewport;
10631
+ if (viewport) {
10632
+ const handleScroll = () => {
10633
+ debounceScrollEnd();
10634
+ if (!removeUnlinkedScrollListenerRef.current) {
10635
+ const listener = addUnlinkedScrollListener(viewport, onThumbPositionChange);
10636
+ removeUnlinkedScrollListenerRef.current = listener;
10637
+ onThumbPositionChange();
10638
+ }
10639
+ };
10640
+ onThumbPositionChange();
10641
+ viewport.addEventListener("scroll", handleScroll);
10642
+ return () => viewport.removeEventListener("scroll", handleScroll);
10643
+ }
10644
+ }, [scrollAreaContext.viewport, debounceScrollEnd, onThumbPositionChange]);
10645
+ return /* @__PURE__ */ jsx(
10646
+ Primitive.div,
10647
+ {
10648
+ "data-state": scrollbarContext.hasThumb ? "visible" : "hidden",
10649
+ ...thumbProps,
10650
+ ref: composedRef,
10651
+ style: {
10652
+ width: "var(--radix-scroll-area-thumb-width)",
10653
+ height: "var(--radix-scroll-area-thumb-height)",
10654
+ ...style
10655
+ },
10656
+ onPointerDownCapture: composeEventHandlers(props.onPointerDownCapture, (event) => {
10657
+ const thumb = event.target;
10658
+ const thumbRect = thumb.getBoundingClientRect();
10659
+ const x = event.clientX - thumbRect.left;
10660
+ const y = event.clientY - thumbRect.top;
10661
+ scrollbarContext.onThumbPointerDown({ x, y });
10662
+ }),
10663
+ onPointerUp: composeEventHandlers(props.onPointerUp, scrollbarContext.onThumbPointerUp)
10664
+ }
10665
+ );
10666
+ }
10667
+ );
10668
+ ScrollAreaThumb.displayName = THUMB_NAME;
10669
+ var CORNER_NAME = "ScrollAreaCorner";
10670
+ var ScrollAreaCorner = t.forwardRef(
10671
+ (props, forwardedRef) => {
10672
+ const context = useScrollAreaContext(CORNER_NAME, props.__scopeScrollArea);
10673
+ const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
10674
+ const hasCorner = context.type !== "scroll" && hasBothScrollbarsVisible;
10675
+ return hasCorner ? /* @__PURE__ */ jsx(ScrollAreaCornerImpl, { ...props, ref: forwardedRef }) : null;
10676
+ }
10677
+ );
10678
+ ScrollAreaCorner.displayName = CORNER_NAME;
10679
+ var ScrollAreaCornerImpl = t.forwardRef((props, forwardedRef) => {
10680
+ const { __scopeScrollArea, ...cornerProps } = props;
10681
+ const context = useScrollAreaContext(CORNER_NAME, __scopeScrollArea);
10682
+ const [width, setWidth] = t.useState(0);
10683
+ const [height, setHeight] = t.useState(0);
10684
+ const hasSize = Boolean(width && height);
10685
+ useResizeObserver(context.scrollbarX, () => {
10686
+ const height2 = context.scrollbarX?.offsetHeight || 0;
10687
+ context.onCornerHeightChange(height2);
10688
+ setHeight(height2);
10689
+ });
10690
+ useResizeObserver(context.scrollbarY, () => {
10691
+ const width2 = context.scrollbarY?.offsetWidth || 0;
10692
+ context.onCornerWidthChange(width2);
10693
+ setWidth(width2);
10694
+ });
10695
+ return hasSize ? /* @__PURE__ */ jsx(
10696
+ Primitive.div,
10697
+ {
10698
+ ...cornerProps,
10699
+ ref: forwardedRef,
10700
+ style: {
10701
+ width,
10702
+ height,
10703
+ position: "absolute",
10704
+ right: context.dir === "ltr" ? 0 : void 0,
10705
+ left: context.dir === "rtl" ? 0 : void 0,
10706
+ bottom: 0,
10707
+ ...props.style
10708
+ }
10709
+ }
10710
+ ) : null;
10711
+ });
10712
+ function toInt(value) {
10713
+ return value ? parseInt(value, 10) : 0;
10714
+ }
10715
+ function getThumbRatio(viewportSize, contentSize) {
10716
+ const ratio = viewportSize / contentSize;
10717
+ return isNaN(ratio) ? 0 : ratio;
10718
+ }
10719
+ function getThumbSize(sizes) {
10720
+ const ratio = getThumbRatio(sizes.viewport, sizes.content);
10721
+ const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
10722
+ const thumbSize = (sizes.scrollbar.size - scrollbarPadding) * ratio;
10723
+ return Math.max(thumbSize, 18);
10724
+ }
10725
+ function getScrollPositionFromPointer(pointerPos, pointerOffset, sizes, dir = "ltr") {
10726
+ const thumbSizePx = getThumbSize(sizes);
10727
+ const thumbCenter = thumbSizePx / 2;
10728
+ const offset = pointerOffset || thumbCenter;
10729
+ const thumbOffsetFromEnd = thumbSizePx - offset;
10730
+ const minPointerPos = sizes.scrollbar.paddingStart + offset;
10731
+ const maxPointerPos = sizes.scrollbar.size - sizes.scrollbar.paddingEnd - thumbOffsetFromEnd;
10732
+ const maxScrollPos = sizes.content - sizes.viewport;
10733
+ const scrollRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
10734
+ const interpolate = linearScale([minPointerPos, maxPointerPos], scrollRange);
10735
+ return interpolate(pointerPos);
10736
+ }
10737
+ function getThumbOffsetFromScroll(scrollPos, sizes, dir = "ltr") {
10738
+ const thumbSizePx = getThumbSize(sizes);
10739
+ const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
10740
+ const scrollbar = sizes.scrollbar.size - scrollbarPadding;
10741
+ const maxScrollPos = sizes.content - sizes.viewport;
10742
+ const maxThumbPos = scrollbar - thumbSizePx;
10743
+ const scrollClampRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
10744
+ const scrollWithoutMomentum = clamp(scrollPos, scrollClampRange);
10745
+ const interpolate = linearScale([0, maxScrollPos], [0, maxThumbPos]);
10746
+ return interpolate(scrollWithoutMomentum);
10747
+ }
10748
+ function linearScale(input, output) {
10749
+ return (value) => {
10750
+ if (input[0] === input[1] || output[0] === output[1])
10751
+ return output[0];
10752
+ const ratio = (output[1] - output[0]) / (input[1] - input[0]);
10753
+ return output[0] + ratio * (value - input[0]);
10754
+ };
10755
+ }
10756
+ function isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos) {
10757
+ return scrollPos > 0 && scrollPos < maxScrollPos;
10758
+ }
10759
+ var addUnlinkedScrollListener = (node, handler = () => {
10760
+ }) => {
10761
+ let prevPosition = { left: node.scrollLeft, top: node.scrollTop };
10762
+ let rAF = 0;
10763
+ (function loop() {
10764
+ const position = { left: node.scrollLeft, top: node.scrollTop };
10765
+ const isHorizontalScroll = prevPosition.left !== position.left;
10766
+ const isVerticalScroll = prevPosition.top !== position.top;
10767
+ if (isHorizontalScroll || isVerticalScroll)
10768
+ handler();
10769
+ prevPosition = position;
10770
+ rAF = window.requestAnimationFrame(loop);
10771
+ })();
10772
+ return () => window.cancelAnimationFrame(rAF);
10773
+ };
10774
+ function useDebounceCallback(callback, delay) {
10775
+ const handleCallback = useCallbackRef(callback);
10776
+ const debounceTimerRef = t.useRef(0);
10777
+ t.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
10778
+ return t.useCallback(() => {
10779
+ window.clearTimeout(debounceTimerRef.current);
10780
+ debounceTimerRef.current = window.setTimeout(handleCallback, delay);
10781
+ }, [handleCallback, delay]);
10782
+ }
10783
+ function useResizeObserver(element, onResize) {
10784
+ const handleResize = useCallbackRef(onResize);
10785
+ useLayoutEffect2(() => {
10786
+ let rAF = 0;
10787
+ if (element) {
10788
+ const resizeObserver = new ResizeObserver(() => {
10789
+ cancelAnimationFrame(rAF);
10790
+ rAF = window.requestAnimationFrame(handleResize);
10791
+ });
10792
+ resizeObserver.observe(element);
10793
+ return () => {
10794
+ window.cancelAnimationFrame(rAF);
10795
+ resizeObserver.unobserve(element);
10796
+ };
10797
+ }
10798
+ }, [element, handleResize]);
10799
+ }
10800
+ var Root12 = ScrollArea;
10801
+ var Viewport2 = ScrollAreaViewport;
10802
+ var Corner = ScrollAreaCorner;
10803
+ var ScrollArea2 = t.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
10804
+ Root12,
10805
+ {
10806
+ ref,
10807
+ className: cn("relative overflow-hidden", className),
10808
+ ...props,
10809
+ children: [
10810
+ /* @__PURE__ */ jsx(Viewport2, { className: "h-full w-full rounded-[inherit]", children }),
10811
+ /* @__PURE__ */ jsx(ScrollBar, {}),
10812
+ /* @__PURE__ */ jsx(Corner, {})
10813
+ ]
10814
+ }
10815
+ ));
10816
+ ScrollArea2.displayName = Root12.displayName;
10817
+ var ScrollBar = t.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
10818
+ ScrollAreaScrollbar,
10819
+ {
10820
+ ref,
10821
+ orientation,
10822
+ className: cn(
10823
+ "flex touch-none select-none transition-colors",
10824
+ orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
10825
+ orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
10826
+ className
10827
+ ),
10828
+ ...props,
10829
+ children: /* @__PURE__ */ jsx(ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
10830
+ }
10831
+ ));
10832
+ ScrollBar.displayName = ScrollAreaScrollbar.displayName;
9692
10833
  var separatorVariants = cva(
9693
10834
  "shrink-0 bg-border",
9694
10835
  {
@@ -9799,7 +10940,7 @@ var Separator3 = t.forwardRef(
9799
10940
  {
9800
10941
  ref,
9801
10942
  decorative,
9802
- orientation,
10943
+ orientation: orientation || void 0,
9803
10944
  className: cn(
9804
10945
  separatorVariants({ orientation, variant, size }),
9805
10946
  className
@@ -9809,91 +10950,17 @@ var Separator3 = t.forwardRef(
9809
10950
  )
9810
10951
  );
9811
10952
  Separator3.displayName = SeparatorPrimitive.Root.displayName;
9812
-
9813
- // ../../node_modules/@radix-ui/primitive/dist/index.mjs
9814
- function composeEventHandlers2(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
9815
- return function handleEvent(event) {
9816
- originalEventHandler?.(event);
9817
- if (checkForDefaultPrevented === false || !event.defaultPrevented) {
9818
- return ourEventHandler?.(event);
9819
- }
9820
- };
9821
- }
9822
- var useInsertionEffect2 = t[" useInsertionEffect ".trim().toString()] || useLayoutEffect22;
9823
- function useControllableState2({
9824
- prop,
9825
- defaultProp,
9826
- onChange = () => {
9827
- },
9828
- caller
9829
- }) {
9830
- const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState2({
9831
- defaultProp,
9832
- onChange
9833
- });
9834
- const isControlled = prop !== void 0;
9835
- const value = isControlled ? prop : uncontrolledProp;
9836
- {
9837
- const isControlledRef = t.useRef(prop !== void 0);
9838
- t.useEffect(() => {
9839
- const wasControlled = isControlledRef.current;
9840
- if (wasControlled !== isControlled) {
9841
- const from = wasControlled ? "controlled" : "uncontrolled";
9842
- const to = isControlled ? "controlled" : "uncontrolled";
9843
- console.warn(
9844
- `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
9845
- );
9846
- }
9847
- isControlledRef.current = isControlled;
9848
- }, [isControlled, caller]);
9849
- }
9850
- const setValue = t.useCallback(
9851
- (nextValue) => {
9852
- if (isControlled) {
9853
- const value2 = isFunction3(nextValue) ? nextValue(prop) : nextValue;
9854
- if (value2 !== prop) {
9855
- onChangeRef.current?.(value2);
9856
- }
9857
- } else {
9858
- setUncontrolledProp(nextValue);
9859
- }
9860
- },
9861
- [isControlled, prop, setUncontrolledProp, onChangeRef]
9862
- );
9863
- return [value, setValue];
9864
- }
9865
- function useUncontrolledState2({
9866
- defaultProp,
9867
- onChange
9868
- }) {
9869
- const [value, setValue] = t.useState(defaultProp);
9870
- const prevValueRef = t.useRef(value);
9871
- const onChangeRef = t.useRef(onChange);
9872
- useInsertionEffect2(() => {
9873
- onChangeRef.current = onChange;
9874
- }, [onChange]);
9875
- t.useEffect(() => {
9876
- if (prevValueRef.current !== value) {
9877
- onChangeRef.current?.(value);
9878
- prevValueRef.current = value;
9879
- }
9880
- }, [value, prevValueRef]);
9881
- return [value, setValue, onChangeRef];
9882
- }
9883
- function isFunction3(value) {
9884
- return typeof value === "function";
9885
- }
9886
10953
  var NAME = "Toggle";
9887
10954
  var Toggle = t.forwardRef((props, forwardedRef) => {
9888
10955
  const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props;
9889
- const [pressed, setPressed] = useControllableState2({
10956
+ const [pressed, setPressed] = useControllableState({
9890
10957
  prop: pressedProp,
9891
10958
  onChange: onPressedChange,
9892
10959
  defaultProp: defaultPressed ?? false,
9893
10960
  caller: NAME
9894
10961
  });
9895
10962
  return /* @__PURE__ */ jsx(
9896
- Primitive2.button,
10963
+ Primitive.button,
9897
10964
  {
9898
10965
  type: "button",
9899
10966
  "aria-pressed": pressed,
@@ -9901,7 +10968,7 @@ var Toggle = t.forwardRef((props, forwardedRef) => {
9901
10968
  "data-disabled": props.disabled ? "" : void 0,
9902
10969
  ...buttonProps,
9903
10970
  ref: forwardedRef,
9904
- onClick: composeEventHandlers2(props.onClick, () => {
10971
+ onClick: composeEventHandlers(props.onClick, () => {
9905
10972
  if (!props.disabled) {
9906
10973
  setPressed(!pressed);
9907
10974
  }
@@ -9910,7 +10977,7 @@ var Toggle = t.forwardRef((props, forwardedRef) => {
9910
10977
  );
9911
10978
  });
9912
10979
  Toggle.displayName = NAME;
9913
- var Root13 = Toggle;
10980
+ var Root14 = Toggle;
9914
10981
  var toggleVariants = cva(
9915
10982
  "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
9916
10983
  {
@@ -9932,14 +10999,14 @@ var toggleVariants = cva(
9932
10999
  }
9933
11000
  );
9934
11001
  var Toggle2 = t.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ jsx(
9935
- Root13,
11002
+ Root14,
9936
11003
  {
9937
11004
  ref,
9938
11005
  className: cn("moonui-theme", toggleVariants({ variant, size, className })),
9939
11006
  ...props
9940
11007
  }
9941
11008
  ));
9942
- Toggle2.displayName = Root13.displayName;
11009
+ Toggle2.displayName = Root14.displayName;
9943
11010
  var TooltipProvider = TooltipPrimitive.Provider;
9944
11011
  var tooltipVariants = cva(
9945
11012
  "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
@@ -10587,7 +11654,7 @@ var SimpleEditor = t__default.forwardRef(
10587
11654
  );
10588
11655
  SimpleEditor.displayName = "SimpleEditor";
10589
11656
  var CharacterCount = ({ content }) => {
10590
- const [count4, setCount] = useState(0);
11657
+ const [count3, setCount] = useState(0);
10591
11658
  useEffect(() => {
10592
11659
  const getPlainText = (html) => {
10593
11660
  const div = document.createElement("div");
@@ -10597,7 +11664,7 @@ var CharacterCount = ({ content }) => {
10597
11664
  setCount(getPlainText(content).length);
10598
11665
  }, [content]);
10599
11666
  return /* @__PURE__ */ jsxs(Fragment, { children: [
10600
- count4,
11667
+ count3,
10601
11668
  " characters"
10602
11669
  ] });
10603
11670
  };
@@ -10698,6 +11765,112 @@ var Switch = t.forwardRef(({ className, size = "md", variant = "primary", loadin
10698
11765
  description && /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: description })
10699
11766
  ] }));
10700
11767
  Switch.displayName = SwitchPrimitives.Root.displayName;
11768
+ var TagsInput = t.forwardRef(
11769
+ ({
11770
+ value = [],
11771
+ onChange,
11772
+ maxTags,
11773
+ variant = "primary",
11774
+ allowDuplicates = false,
11775
+ delimiter = ",",
11776
+ placeholder = "Add tag and press Enter",
11777
+ className,
11778
+ disabled,
11779
+ ...props
11780
+ }, ref) => {
11781
+ const [inputValue, setInputValue] = t.useState("");
11782
+ const [error, setError] = t.useState("");
11783
+ const handleKeyDown = (e) => {
11784
+ if (e.key === "Enter" || e.key === delimiter) {
11785
+ e.preventDefault();
11786
+ addTag();
11787
+ } else if (e.key === "Backspace" && inputValue === "" && value.length > 0) {
11788
+ removeTag(value.length - 1);
11789
+ }
11790
+ };
11791
+ const addTag = () => {
11792
+ const tag = inputValue.trim();
11793
+ if (!tag)
11794
+ return;
11795
+ if (!allowDuplicates && value.includes(tag)) {
11796
+ setError("This tag already exists");
11797
+ setTimeout(() => setError(""), 2e3);
11798
+ return;
11799
+ }
11800
+ if (maxTags && value.length >= maxTags) {
11801
+ setError(`Maximum ${maxTags} tags allowed`);
11802
+ setTimeout(() => setError(""), 2e3);
11803
+ return;
11804
+ }
11805
+ onChange([...value, tag]);
11806
+ setInputValue("");
11807
+ setError("");
11808
+ };
11809
+ const removeTag = (index) => {
11810
+ if (disabled)
11811
+ return;
11812
+ onChange(value.filter((_, i) => i !== index));
11813
+ };
11814
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
11815
+ /* @__PURE__ */ jsxs(
11816
+ "div",
11817
+ {
11818
+ className: cn(
11819
+ "flex min-h-[2.5rem] w-full flex-wrap gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background",
11820
+ "dark:bg-zinc-950/50 dark:border-zinc-800",
11821
+ "focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
11822
+ disabled && "cursor-not-allowed opacity-50",
11823
+ className
11824
+ ),
11825
+ children: [
11826
+ value.map((tag, index) => /* @__PURE__ */ jsxs(
11827
+ Badge,
11828
+ {
11829
+ variant,
11830
+ className: "gap-1 pr-1.5",
11831
+ children: [
11832
+ /* @__PURE__ */ jsx("span", { className: "text-xs", children: tag }),
11833
+ !disabled && /* @__PURE__ */ jsx(
11834
+ "button",
11835
+ {
11836
+ type: "button",
11837
+ onClick: () => removeTag(index),
11838
+ className: "ml-1 rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",
11839
+ children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3 text-muted-foreground hover:text-foreground transition-colors" })
11840
+ }
11841
+ )
11842
+ ]
11843
+ },
11844
+ index
11845
+ )),
11846
+ /* @__PURE__ */ jsx(
11847
+ "input",
11848
+ {
11849
+ ref,
11850
+ type: "text",
11851
+ value: inputValue,
11852
+ onChange: (e) => setInputValue(e.target.value),
11853
+ onKeyDown: handleKeyDown,
11854
+ onBlur: addTag,
11855
+ disabled,
11856
+ placeholder: value.length === 0 ? placeholder : "",
11857
+ className: cn(
11858
+ "flex-1 bg-transparent outline-none placeholder:text-muted-foreground",
11859
+ "dark:placeholder:text-zinc-500",
11860
+ "min-w-[120px]",
11861
+ disabled && "cursor-not-allowed"
11862
+ ),
11863
+ ...props
11864
+ }
11865
+ )
11866
+ ]
11867
+ }
11868
+ ),
11869
+ error && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-destructive", children: error })
11870
+ ] });
11871
+ }
11872
+ );
11873
+ TagsInput.displayName = "TagsInput";
10701
11874
  var Textarea = t.forwardRef(
10702
11875
  ({
10703
11876
  className,
@@ -10872,6 +12045,8 @@ var reducer = (state, action) => {
10872
12045
  ...state,
10873
12046
  toasts: state.toasts.filter((t2) => t2.id !== action.toastId)
10874
12047
  };
12048
+ default:
12049
+ return state;
10875
12050
  }
10876
12051
  };
10877
12052
  var listeners = [];
@@ -10968,6 +12143,6 @@ function Toaster() {
10968
12143
  *)
10969
12144
  */
10970
12145
 
10971
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroup, CheckboxLabel, CheckboxWithLabel, Collapsible2 as Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorPicker, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DataTable, DatePicker, DateRangePicker, DateTimePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogForm, DialogHeader, DialogTitle, DialogTrigger, DraggableList, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FileUpload, GestureDrawer, GitHubStarButton, GitHubStars, GradientPicker, Input, Label, MonthPicker, MoonLogo, MoonLogoAnimated, MoonLogoIcon, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverFooter, PopoverHeader, PopoverSeparator, PopoverTrigger, Progress, RadioGroup2 as RadioGroup, RadioGroupItem, RadioItemWithLabel, RadioLabel, RichTextEditor, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, SimpleColorPicker, SimpleEditor, SimpleTooltip, Skeleton, SkeletonAvatar, SkeletonCard, SkeletonText, Slider, SwipeableCard, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Toaster, Toggle2 as Toggle, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger, aspectRatioVariants, badgeVariants, buttonVariants, cn, collapsibleContentVariants, collapsibleTriggerVariants, createFilterableColumn, createSortableHeader, popoverContentVariants, progressVariants, separatorVariants, skeletonVariants, toast, toggleVariants, tooltipVariants, useToast };
12146
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardCVCInput, CardContent, CardDescription, CardExpiryInput, CardFooter, CardHeader, CardNumberInput, CardTitle, CardZipInput, Checkbox, CheckboxGroup, CheckboxLabel, CheckboxWithLabel, Collapsible2 as Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorPicker, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DataTable, DatePicker, DateRangePicker, DateTimePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogForm, DialogHeader, DialogTitle, DialogTrigger, DraggableList, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FileUpload, FreeBadge, GestureDrawer, GitHubStarButton, GitHubStars, GradientPicker, Input, Label, LockedComponent, MonthPicker, MoonLogo, MoonLogoAnimated, MoonLogoIcon, Accordion as MoonUIAccordion, AccordionContent as MoonUIAccordionContent, AccordionItem as MoonUIAccordionItem, AccordionTrigger as MoonUIAccordionTrigger, Alert as MoonUIAlert, AlertDescription as MoonUIAlertDescription, AlertTitle as MoonUIAlertTitle, AspectRatio as MoonUIAspectRatio, Avatar as MoonUIAvatar, AvatarFallback as MoonUIAvatarFallback, AvatarGroup as MoonUIAvatarGroup, AvatarImage as MoonUIAvatarImage, Badge as MoonUIBadge, Breadcrumb as MoonUIBreadcrumb, BreadcrumbEllipsis as MoonUIBreadcrumbEllipsis, BreadcrumbItem as MoonUIBreadcrumbItem, BreadcrumbLink as MoonUIBreadcrumbLink, BreadcrumbList as MoonUIBreadcrumbList, BreadcrumbPage as MoonUIBreadcrumbPage, BreadcrumbSeparator as MoonUIBreadcrumbSeparator, Button as MoonUIButton, Card as MoonUICard, CardCVCInput as MoonUICardCVCInput, CardContent as MoonUICardContent, CardDescription as MoonUICardDescription, CardExpiryInput as MoonUICardExpiryInput, CardFooter as MoonUICardFooter, CardHeader as MoonUICardHeader, CardNumberInput as MoonUICardNumberInput, CardTitle as MoonUICardTitle, CardZipInput as MoonUICardZipInput, Checkbox as MoonUICheckbox, CheckboxGroup as MoonUICheckboxGroup, CheckboxLabel as MoonUICheckboxLabel, CheckboxWithLabel as MoonUICheckboxWithLabel, Collapsible2 as MoonUICollapsible, CollapsibleContent2 as MoonUICollapsibleContent, CollapsibleTrigger2 as MoonUICollapsibleTrigger, ColorPicker as MoonUIColorPicker, Command as MoonUICommand, CommandDialog as MoonUICommandDialog, CommandEmpty as MoonUICommandEmpty, CommandGroup as MoonUICommandGroup, CommandInput as MoonUICommandInput, CommandItem as MoonUICommandItem, CommandList as MoonUICommandList, CommandSeparator as MoonUICommandSeparator, CommandShortcut as MoonUICommandShortcut, DataTable as MoonUIDataTable, DatePicker as MoonUIDatePicker, DateRangePicker as MoonUIDateRangePicker, DateTimePicker as MoonUIDateTimePicker, Dialog as MoonUIDialog, DialogClose as MoonUIDialogClose, DialogContent as MoonUIDialogContent, DialogDescription as MoonUIDialogDescription, DialogFooter as MoonUIDialogFooter, DialogHeader as MoonUIDialogHeader, DialogTitle as MoonUIDialogTitle, DialogTrigger as MoonUIDialogTrigger, DraggableList as MoonUIDraggableList, DropdownMenu as MoonUIDropdownMenu, DropdownMenuCheckboxItem as MoonUIDropdownMenuCheckboxItem, DropdownMenuContent as MoonUIDropdownMenuContent, DropdownMenuGroup as MoonUIDropdownMenuGroup, DropdownMenuItem as MoonUIDropdownMenuItem, DropdownMenuLabel as MoonUIDropdownMenuLabel, DropdownMenuPortal as MoonUIDropdownMenuPortal, DropdownMenuRadioGroup as MoonUIDropdownMenuRadioGroup, DropdownMenuRadioItem as MoonUIDropdownMenuRadioItem, DropdownMenuSeparator as MoonUIDropdownMenuSeparator, DropdownMenuShortcut as MoonUIDropdownMenuShortcut, DropdownMenuSub as MoonUIDropdownMenuSub, DropdownMenuSubContent as MoonUIDropdownMenuSubContent, DropdownMenuSubTrigger as MoonUIDropdownMenuSubTrigger, DropdownMenuTrigger as MoonUIDropdownMenuTrigger, FileUpload as MoonUIFileUpload, FreeBadge as MoonUIFreeBadge, GestureDrawer as MoonUIGestureDrawer, GitHubStars as MoonUIGitHubStars, GradientPicker as MoonUIGradientPicker, Input as MoonUIInput, Label as MoonUILabel, LockedComponent as MoonUILockedComponent, MonthPicker as MoonUIMonthPicker, MoonLogo as MoonUIMoonLogo, Pagination as MoonUIPagination, PaginationContent as MoonUIPaginationContent, PaginationEllipsis as MoonUIPaginationEllipsis, PaginationItem as MoonUIPaginationItem, PaginationLink as MoonUIPaginationLink, PaginationNext as MoonUIPaginationNext, PaginationPrevious as MoonUIPaginationPrevious, PhoneInput as MoonUIPhoneInput, Popover as MoonUIPopover, PopoverContent as MoonUIPopoverContent, PopoverTrigger as MoonUIPopoverTrigger, ProBadge as MoonUIProBadge, ProComponentWrapper as MoonUIProComponentWrapper, Progress as MoonUIProgress, RadioGroup2 as MoonUIRadioGroup, RadioGroupItem as MoonUIRadioGroupItem, RadioItemWithLabel as MoonUIRadioItemWithLabel, RadioLabel as MoonUIRadioLabel, RichTextEditor as MoonUIRichTextEditor, ScrollArea2 as MoonUIScrollArea, ScrollBar as MoonUIScrollBar, Select as MoonUISelect, SelectContent as MoonUISelectContent, SelectGroup as MoonUISelectGroup, SelectItem as MoonUISelectItem, SelectLabel as MoonUISelectLabel, SelectScrollDownButton as MoonUISelectScrollDownButton, SelectScrollUpButton as MoonUISelectScrollUpButton, SelectSeparator as MoonUISelectSeparator, SelectTrigger as MoonUISelectTrigger, SelectValue as MoonUISelectValue, Separator3 as MoonUISeparator, SimpleColorPicker as MoonUISimpleColorPicker, SimpleEditor as MoonUISimpleEditor, Skeleton as MoonUISkeleton, SkeletonAvatar as MoonUISkeletonAvatar, SkeletonCard as MoonUISkeletonCard, SkeletonText as MoonUISkeletonText, Slider as MoonUISlider, SwipeableCard as MoonUISwipeableCard, Switch as MoonUISwitch, Table as MoonUITable, TableBody as MoonUITableBody, TableCaption as MoonUITableCaption, TableCell as MoonUITableCell, TableFooter as MoonUITableFooter, TableHead as MoonUITableHead, TableHeader as MoonUITableHeader, TableRow as MoonUITableRow, Tabs as MoonUITabs, TabsContent as MoonUITabsContent, TabsList as MoonUITabsList, TabsTrigger as MoonUITabsTrigger, TagsInput as MoonUITagsInput, Textarea as MoonUITextarea, Toast as MoonUIToast, ToastAction as MoonUIToastAction, ToastClose as MoonUIToastClose, ToastDescription as MoonUIToastDescription, ToastProvider as MoonUIToastProvider, ToastTitle as MoonUIToastTitle, ToastViewport as MoonUIToastViewport, Toaster as MoonUIToaster, Toggle2 as MoonUIToggle, Tooltip as MoonUITooltip, TooltipContent as MoonUITooltipContent, TooltipProvider as MoonUITooltipProvider, TooltipTrigger as MoonUITooltipTrigger, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PhoneInput, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverFooter, PopoverHeader, PopoverSeparator, PopoverTrigger, ProBadge, ProComponentWrapper, Progress, RadioGroup2 as RadioGroup, RadioGroupItem, RadioItemWithLabel, RadioLabel, RichTextEditor, ScrollArea2 as ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, SimpleColorPicker, SimpleEditor, SimpleTooltip, Skeleton, SkeletonAvatar, SkeletonCard, SkeletonText, Slider, SwipeableCard, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagsInput, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Toaster, Toggle2 as Toggle, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger, aspectRatioVariants, badgeVariants, buttonVariants, cn, collapsibleContentVariants, collapsibleTriggerVariants, createFilterableColumn, createSortableHeader, badgeVariants as moonUIBadgeVariants, buttonVariants as moonUIButtonVariants, skeletonVariants as moonUISkeletonVariants, toggleVariants as moonUIToggleVariants, popoverContentVariants, progressVariants, separatorVariants, skeletonVariants, toast, toggleVariants, tooltipVariants, useToast };
10972
12147
  //# sourceMappingURL=out.js.map
10973
12148
  //# sourceMappingURL=index.mjs.map