@wow-two-beta/ui 0.0.11 → 0.0.13

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 (131) hide show
  1. package/dist/actions/index.d.ts +1 -0
  2. package/dist/actions/index.d.ts.map +1 -1
  3. package/dist/actions/index.js +2 -2
  4. package/dist/actions/toolbar/Toolbar.d.ts +23 -0
  5. package/dist/actions/toolbar/Toolbar.d.ts.map +1 -0
  6. package/dist/actions/toolbar/index.d.ts +2 -0
  7. package/dist/actions/toolbar/index.d.ts.map +1 -0
  8. package/dist/{chunk-PFM3IQKM.js → chunk-A4N52LL6.js} +1132 -170
  9. package/dist/chunk-A4N52LL6.js.map +1 -0
  10. package/dist/{chunk-52DFDWY3.js → chunk-EU6JT5B4.js} +6 -6
  11. package/dist/chunk-EU6JT5B4.js.map +1 -0
  12. package/dist/{chunk-VTLWHUMD.js → chunk-PRRVOVUC.js} +384 -8
  13. package/dist/chunk-PRRVOVUC.js.map +1 -0
  14. package/dist/{chunk-ZTHJ5OTI.js → chunk-UGHPZ3I7.js} +212 -6
  15. package/dist/chunk-UGHPZ3I7.js.map +1 -0
  16. package/dist/{chunk-D5CHR6RX.js → chunk-ULAOIBCP.js} +113 -5
  17. package/dist/chunk-ULAOIBCP.js.map +1 -0
  18. package/dist/{chunk-YANOG5YR.js → chunk-YMSAS7M7.js} +104 -55
  19. package/dist/chunk-YMSAS7M7.js.map +1 -0
  20. package/dist/display/accordion/Accordion.d.ts +41 -0
  21. package/dist/display/accordion/Accordion.d.ts.map +1 -0
  22. package/dist/display/accordion/index.d.ts +2 -0
  23. package/dist/display/accordion/index.d.ts.map +1 -0
  24. package/dist/display/collapsible/Collapsible.d.ts +26 -0
  25. package/dist/display/collapsible/Collapsible.d.ts.map +1 -0
  26. package/dist/display/collapsible/index.d.ts +2 -0
  27. package/dist/display/collapsible/index.d.ts.map +1 -0
  28. package/dist/display/index.d.ts +3 -0
  29. package/dist/display/index.d.ts.map +1 -1
  30. package/dist/display/index.js +2 -3
  31. package/dist/display/tabs/Tabs.d.ts +31 -0
  32. package/dist/display/tabs/Tabs.d.ts.map +1 -0
  33. package/dist/display/tabs/index.d.ts +2 -0
  34. package/dist/display/tabs/index.d.ts.map +1 -0
  35. package/dist/forms/ColorExtensions.d.ts +38 -0
  36. package/dist/forms/ColorExtensions.d.ts.map +1 -0
  37. package/dist/forms/{_dateUtils.d.ts → DateExtensions.d.ts} +1 -1
  38. package/dist/forms/DateExtensions.d.ts.map +1 -0
  39. package/dist/forms/{_styles.d.ts → InputStyles.d.ts} +1 -1
  40. package/dist/forms/InputStyles.d.ts.map +1 -0
  41. package/dist/forms/colorArea/ColorArea.d.ts +18 -0
  42. package/dist/forms/colorArea/ColorArea.d.ts.map +1 -0
  43. package/dist/forms/colorArea/index.d.ts +2 -0
  44. package/dist/forms/colorArea/index.d.ts.map +1 -0
  45. package/dist/forms/colorField/ColorField.d.ts +11 -0
  46. package/dist/forms/colorField/ColorField.d.ts.map +1 -0
  47. package/dist/forms/colorField/index.d.ts +2 -0
  48. package/dist/forms/colorField/index.d.ts.map +1 -0
  49. package/dist/forms/colorPicker/ColorPicker.d.ts +15 -0
  50. package/dist/forms/colorPicker/ColorPicker.d.ts.map +1 -0
  51. package/dist/forms/colorPicker/index.d.ts +2 -0
  52. package/dist/forms/colorPicker/index.d.ts.map +1 -0
  53. package/dist/forms/colorSlider/ColorSlider.d.ts +15 -0
  54. package/dist/forms/colorSlider/ColorSlider.d.ts.map +1 -0
  55. package/dist/forms/colorSlider/index.d.ts +2 -0
  56. package/dist/forms/colorSlider/index.d.ts.map +1 -0
  57. package/dist/forms/colorSwatch/ColorSwatch.d.ts +21 -0
  58. package/dist/forms/colorSwatch/ColorSwatch.d.ts.map +1 -0
  59. package/dist/forms/colorSwatch/ColorSwatch.variants.d.ts +165 -0
  60. package/dist/forms/colorSwatch/ColorSwatch.variants.d.ts.map +1 -0
  61. package/dist/forms/colorSwatch/index.d.ts +3 -0
  62. package/dist/forms/colorSwatch/index.d.ts.map +1 -0
  63. package/dist/forms/colorSwatchPicker/ColorSwatchPicker.d.ts +13 -0
  64. package/dist/forms/colorSwatchPicker/ColorSwatchPicker.d.ts.map +1 -0
  65. package/dist/forms/colorSwatchPicker/index.d.ts +2 -0
  66. package/dist/forms/colorSwatchPicker/index.d.ts.map +1 -0
  67. package/dist/forms/colorWheel/ColorWheel.d.ts +13 -0
  68. package/dist/forms/colorWheel/ColorWheel.d.ts.map +1 -0
  69. package/dist/forms/colorWheel/index.d.ts +2 -0
  70. package/dist/forms/colorWheel/index.d.ts.map +1 -0
  71. package/dist/forms/combobox/Combobox.d.ts +1 -1
  72. package/dist/forms/combobox/Combobox.d.ts.map +1 -1
  73. package/dist/forms/dateField/DateField.d.ts +1 -1
  74. package/dist/forms/dateField/DateField.d.ts.map +1 -1
  75. package/dist/forms/datePicker/DatePicker.d.ts.map +1 -1
  76. package/dist/forms/dateRangePicker/DateRangePicker.d.ts.map +1 -1
  77. package/dist/forms/emailInput/EmailInput.d.ts +1 -1
  78. package/dist/forms/emailInput/EmailInput.d.ts.map +1 -1
  79. package/dist/forms/index.d.ts +8 -0
  80. package/dist/forms/index.d.ts.map +1 -1
  81. package/dist/forms/index.js +3 -3
  82. package/dist/forms/maskedInput/MaskedInput.d.ts +1 -1
  83. package/dist/forms/maskedInput/MaskedInput.d.ts.map +1 -1
  84. package/dist/forms/numberInput/NumberInput.d.ts +1 -1
  85. package/dist/forms/numberInput/NumberInput.d.ts.map +1 -1
  86. package/dist/forms/passwordInput/PasswordInput.d.ts +1 -1
  87. package/dist/forms/passwordInput/PasswordInput.d.ts.map +1 -1
  88. package/dist/forms/searchInput/SearchInput.d.ts +1 -1
  89. package/dist/forms/searchInput/SearchInput.d.ts.map +1 -1
  90. package/dist/forms/stepper/Stepper.d.ts +32 -0
  91. package/dist/forms/stepper/Stepper.d.ts.map +1 -0
  92. package/dist/forms/stepper/index.d.ts +2 -0
  93. package/dist/forms/stepper/index.d.ts.map +1 -0
  94. package/dist/forms/telInput/TelInput.d.ts +1 -1
  95. package/dist/forms/telInput/TelInput.d.ts.map +1 -1
  96. package/dist/forms/textInput/TextInput.d.ts +1 -1
  97. package/dist/forms/textInput/TextInput.d.ts.map +1 -1
  98. package/dist/forms/textarea/Textarea.d.ts +1 -1
  99. package/dist/forms/textarea/Textarea.d.ts.map +1 -1
  100. package/dist/forms/timeField/TimeField.d.ts +1 -1
  101. package/dist/forms/timeField/TimeField.d.ts.map +1 -1
  102. package/dist/forms/timePicker/TimePicker.d.ts.map +1 -1
  103. package/dist/forms/urlInput/UrlInput.d.ts +1 -1
  104. package/dist/forms/urlInput/UrlInput.d.ts.map +1 -1
  105. package/dist/index.js +6 -7
  106. package/dist/nav/index.d.ts +1 -0
  107. package/dist/nav/index.d.ts.map +1 -1
  108. package/dist/nav/index.js +2 -3
  109. package/dist/nav/navigationMenu/NavigationMenu.d.ts +39 -0
  110. package/dist/nav/navigationMenu/NavigationMenu.d.ts.map +1 -0
  111. package/dist/nav/navigationMenu/index.d.ts +2 -0
  112. package/dist/nav/navigationMenu/index.d.ts.map +1 -0
  113. package/dist/overlays/index.js +2 -3
  114. package/dist/overlays/popover/Popover.d.ts +7 -0
  115. package/dist/overlays/popover/Popover.d.ts.map +1 -1
  116. package/dist/primitives/anchoredPositioner/AnchoredPositioner.d.ts +8 -0
  117. package/dist/primitives/anchoredPositioner/AnchoredPositioner.d.ts.map +1 -1
  118. package/dist/primitives/index.js +1 -2
  119. package/dist/primitives/rovingFocusGroup/RovingFocusGroup.d.ts +1 -1
  120. package/dist/primitives/rovingFocusGroup/RovingFocusGroup.d.ts.map +1 -1
  121. package/package.json +1 -1
  122. package/dist/chunk-33IOXQYO.js +0 -47
  123. package/dist/chunk-33IOXQYO.js.map +0 -1
  124. package/dist/chunk-52DFDWY3.js.map +0 -1
  125. package/dist/chunk-D5CHR6RX.js.map +0 -1
  126. package/dist/chunk-PFM3IQKM.js.map +0 -1
  127. package/dist/chunk-VTLWHUMD.js.map +0 -1
  128. package/dist/chunk-YANOG5YR.js.map +0 -1
  129. package/dist/chunk-ZTHJ5OTI.js.map +0 -1
  130. package/dist/forms/_dateUtils.d.ts.map +0 -1
  131. package/dist/forms/_styles.d.ts.map +0 -1
@@ -1,7 +1,8 @@
1
- import { useFormControl, FormControlProvider, Portal, AnchoredPositioner, DismissableLayer } from './chunk-YANOG5YR.js';
1
+ import { Popover, PopoverTrigger, PopoverContent } from './chunk-EU6JT5B4.js';
2
2
  import { useControlled } from './chunk-4P2TFUVW.js';
3
+ import { useFormControl, FormControlProvider, RovingFocusGroup, useRovingFocusItem, Portal, AnchoredPositioner, DismissableLayer } from './chunk-YMSAS7M7.js';
3
4
  import { useId } from './chunk-KDXJQNB6.js';
4
- import { tv } from './chunk-BMBIZLO4.js';
5
+ import { tv, dataAttr } from './chunk-BMBIZLO4.js';
5
6
  import { Icon } from './chunk-TDX22OWF.js';
6
7
  import { composeRefs } from './chunk-DN7WBRIV.js';
7
8
  import { cn } from './chunk-KZ4VFY2T.js';
@@ -91,7 +92,7 @@ var Legend = forwardRef(
91
92
  );
92
93
  Legend.displayName = "Legend";
93
94
 
94
- // src/forms/_styles.ts
95
+ // src/forms/InputStyles.ts
95
96
  var inputBaseVariants = tv({
96
97
  base: "flex w-full rounded-md border bg-background text-foreground placeholder:text-subtle-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60 read-only:bg-muted",
97
98
  variants: {
@@ -2029,7 +2030,7 @@ Combobox.Group = ComboboxGroup;
2029
2030
  Combobox.Separator = ComboboxSeparator;
2030
2031
  Combobox.Empty = ComboboxEmpty;
2031
2032
 
2032
- // src/forms/_dateUtils.ts
2033
+ // src/forms/DateExtensions.ts
2033
2034
  var WEEKDAYS_SHORT = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
2034
2035
  var MONTHS_LONG = [
2035
2036
  "January",
@@ -2584,7 +2585,6 @@ var DatePicker = forwardRef(function DatePicker2({
2584
2585
  state,
2585
2586
  className,
2586
2587
  disabled,
2587
- onClick,
2588
2588
  ...rest
2589
2589
  }, forwardedRef) {
2590
2590
  const [date, setDate] = useControlled({
@@ -2596,23 +2596,14 @@ var DatePicker = forwardRef(function DatePicker2({
2596
2596
  controlled: void 0,
2597
2597
  default: false
2598
2598
  });
2599
- const triggerRef = useRef(null);
2600
2599
  const triggerState = state ?? (invalid ? "invalid" : "default");
2601
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2602
- /* @__PURE__ */ jsxs(
2600
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, placement: "bottom-start", offset: 6, children: [
2601
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
2603
2602
  "button",
2604
2603
  {
2605
- ref: composeRefs(forwardedRef, triggerRef),
2604
+ ref: forwardedRef,
2606
2605
  type: "button",
2607
- "aria-haspopup": "dialog",
2608
- "aria-expanded": open,
2609
- "data-state": open ? "open" : "closed",
2610
2606
  disabled,
2611
- onClick: (e) => {
2612
- onClick?.(e);
2613
- if (e.defaultPrevented) return;
2614
- setOpen(!open);
2615
- },
2616
2607
  className: cn(selectTriggerVariants({ size, state: triggerState }), className),
2617
2608
  ...rest,
2618
2609
  children: [
@@ -2620,36 +2611,21 @@ var DatePicker = forwardRef(function DatePicker2({
2620
2611
  /* @__PURE__ */ jsx(Calendar$1, { className: "h-4 w-4 shrink-0 text-muted-foreground" })
2621
2612
  ]
2622
2613
  }
2623
- ),
2624
- open && /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(AnchoredPositioner, { anchor: triggerRef.current, placement: "bottom-start", offset: 6, children: /* @__PURE__ */ jsx(FocusScope, { asChild: true, trapped: true, loop: true, children: /* @__PURE__ */ jsx(
2625
- DismissableLayer,
2614
+ ) }),
2615
+ /* @__PURE__ */ jsx(PopoverContent, { bare: true, children: /* @__PURE__ */ jsx(
2616
+ Calendar,
2626
2617
  {
2627
- onEscape: () => {
2628
- setOpen(false);
2629
- requestAnimationFrame(() => triggerRef.current?.focus());
2630
- },
2631
- onOutsidePointerDown: (e) => {
2632
- if (triggerRef.current?.contains(e.target)) return;
2618
+ value: date,
2619
+ onChange: (d) => {
2620
+ setDate(d);
2633
2621
  setOpen(false);
2634
2622
  },
2635
- children: /* @__PURE__ */ jsx(
2636
- Calendar,
2637
- {
2638
- value: date,
2639
- onChange: (d) => {
2640
- setDate(d);
2641
- setOpen(false);
2642
- requestAnimationFrame(() => triggerRef.current?.focus());
2643
- },
2644
- defaultMonth: date ?? /* @__PURE__ */ new Date(),
2645
- min,
2646
- max,
2647
- isDisabled: dayDisabled,
2648
- className: "shadow-md"
2649
- }
2650
- )
2623
+ defaultMonth: date ?? /* @__PURE__ */ new Date(),
2624
+ min,
2625
+ max,
2626
+ isDisabled: dayDisabled
2651
2627
  }
2652
- ) }) }) }),
2628
+ ) }),
2653
2629
  name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: formatISODate(date) })
2654
2630
  ] });
2655
2631
  });
@@ -2668,7 +2644,6 @@ var TimePicker = forwardRef(function TimePicker2({
2668
2644
  state,
2669
2645
  className,
2670
2646
  disabled,
2671
- onClick,
2672
2647
  ...rest
2673
2648
  }, forwardedRef) {
2674
2649
  const [time, setTime] = useControlled({
@@ -2680,7 +2655,6 @@ var TimePicker = forwardRef(function TimePicker2({
2680
2655
  controlled: void 0,
2681
2656
  default: false
2682
2657
  });
2683
- const triggerRef = useRef(null);
2684
2658
  const hoursRef = useRef(null);
2685
2659
  const minutesRef = useRef(null);
2686
2660
  const minutes = useMemo(() => {
@@ -2703,21 +2677,13 @@ var TimePicker = forwardRef(function TimePicker2({
2703
2677
  };
2704
2678
  setTime(merged);
2705
2679
  };
2706
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2707
- /* @__PURE__ */ jsxs(
2680
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, placement: "bottom-start", offset: 6, children: [
2681
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
2708
2682
  "button",
2709
2683
  {
2710
- ref: composeRefs(forwardedRef, triggerRef),
2684
+ ref: forwardedRef,
2711
2685
  type: "button",
2712
- "aria-haspopup": "dialog",
2713
- "aria-expanded": open,
2714
- "data-state": open ? "open" : "closed",
2715
2686
  disabled,
2716
- onClick: (e) => {
2717
- onClick?.(e);
2718
- if (e.defaultPrevented) return;
2719
- setOpen(!open);
2720
- },
2721
2687
  className: cn(selectTriggerVariants({ size, state: triggerState }), className),
2722
2688
  ...rest,
2723
2689
  children: [
@@ -2725,79 +2691,66 @@ var TimePicker = forwardRef(function TimePicker2({
2725
2691
  /* @__PURE__ */ jsx(Clock, { className: "h-4 w-4 shrink-0 text-muted-foreground" })
2726
2692
  ]
2727
2693
  }
2728
- ),
2729
- open && /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(AnchoredPositioner, { anchor: triggerRef.current, placement: "bottom-start", offset: 6, children: /* @__PURE__ */ jsx(FocusScope, { asChild: true, trapped: true, loop: true, children: /* @__PURE__ */ jsx(
2730
- DismissableLayer,
2731
- {
2732
- onEscape: () => {
2733
- setOpen(false);
2734
- requestAnimationFrame(() => triggerRef.current?.focus());
2735
- },
2736
- onOutsidePointerDown: (e) => {
2737
- if (triggerRef.current?.contains(e.target)) return;
2738
- setOpen(false);
2739
- },
2740
- children: /* @__PURE__ */ jsxs("div", { className: "z-50 flex gap-1 rounded-md border border-border bg-popover p-2 text-popover-foreground shadow-md outline-none animate-in fade-in-0 zoom-in-95", children: [
2741
- /* @__PURE__ */ jsx(
2742
- "div",
2743
- {
2744
- ref: hoursRef,
2745
- role: "listbox",
2746
- "aria-label": "Hours",
2747
- className: "flex max-h-56 flex-col gap-0.5 overflow-y-auto pr-1",
2748
- children: HOURS.map((h) => {
2749
- const selected = time?.hours === h;
2750
- return /* @__PURE__ */ jsx(
2751
- "button",
2752
- {
2753
- type: "button",
2754
- role: "option",
2755
- "aria-selected": selected,
2756
- "data-selected": selected ? "" : void 0,
2757
- onClick: () => update({ hours: h }),
2758
- className: cn(
2759
- "grid h-8 w-12 place-items-center rounded-sm text-sm transition-colors hover:bg-muted",
2760
- selected && "bg-primary text-primary-foreground hover:bg-primary"
2761
- ),
2762
- children: String(h).padStart(2, "0")
2763
- },
2764
- h
2765
- );
2766
- })
2767
- }
2768
- ),
2769
- /* @__PURE__ */ jsx("div", { className: "w-px self-stretch bg-border" }),
2770
- /* @__PURE__ */ jsx(
2771
- "div",
2772
- {
2773
- ref: minutesRef,
2774
- role: "listbox",
2775
- "aria-label": "Minutes",
2776
- className: "flex max-h-56 flex-col gap-0.5 overflow-y-auto pl-1",
2777
- children: minutes.map((m) => {
2778
- const selected = time?.minutes === m;
2779
- return /* @__PURE__ */ jsx(
2780
- "button",
2781
- {
2782
- type: "button",
2783
- role: "option",
2784
- "aria-selected": selected,
2785
- "data-selected": selected ? "" : void 0,
2786
- onClick: () => update({ minutes: m }),
2787
- className: cn(
2788
- "grid h-8 w-12 place-items-center rounded-sm text-sm transition-colors hover:bg-muted",
2789
- selected && "bg-primary text-primary-foreground hover:bg-primary"
2790
- ),
2791
- children: String(m).padStart(2, "0")
2792
- },
2793
- m
2794
- );
2795
- })
2796
- }
2797
- )
2798
- ] })
2799
- }
2800
- ) }) }) }),
2694
+ ) }),
2695
+ /* @__PURE__ */ jsx(PopoverContent, { bare: true, children: /* @__PURE__ */ jsxs("div", { className: "flex gap-1 rounded-md border border-border bg-popover p-2 text-popover-foreground shadow-md", children: [
2696
+ /* @__PURE__ */ jsx(
2697
+ "div",
2698
+ {
2699
+ ref: hoursRef,
2700
+ role: "listbox",
2701
+ "aria-label": "Hours",
2702
+ className: "flex max-h-56 flex-col gap-0.5 overflow-y-auto pr-1",
2703
+ children: HOURS.map((h) => {
2704
+ const selected = time?.hours === h;
2705
+ return /* @__PURE__ */ jsx(
2706
+ "button",
2707
+ {
2708
+ type: "button",
2709
+ role: "option",
2710
+ "aria-selected": selected,
2711
+ "data-selected": selected ? "" : void 0,
2712
+ onClick: () => update({ hours: h }),
2713
+ className: cn(
2714
+ "grid h-8 w-12 place-items-center rounded-sm text-sm transition-colors hover:bg-muted",
2715
+ selected && "bg-primary text-primary-foreground hover:bg-primary"
2716
+ ),
2717
+ children: String(h).padStart(2, "0")
2718
+ },
2719
+ h
2720
+ );
2721
+ })
2722
+ }
2723
+ ),
2724
+ /* @__PURE__ */ jsx("div", { className: "w-px self-stretch bg-border" }),
2725
+ /* @__PURE__ */ jsx(
2726
+ "div",
2727
+ {
2728
+ ref: minutesRef,
2729
+ role: "listbox",
2730
+ "aria-label": "Minutes",
2731
+ className: "flex max-h-56 flex-col gap-0.5 overflow-y-auto pl-1",
2732
+ children: minutes.map((m) => {
2733
+ const selected = time?.minutes === m;
2734
+ return /* @__PURE__ */ jsx(
2735
+ "button",
2736
+ {
2737
+ type: "button",
2738
+ role: "option",
2739
+ "aria-selected": selected,
2740
+ "data-selected": selected ? "" : void 0,
2741
+ onClick: () => update({ minutes: m }),
2742
+ className: cn(
2743
+ "grid h-8 w-12 place-items-center rounded-sm text-sm transition-colors hover:bg-muted",
2744
+ selected && "bg-primary text-primary-foreground hover:bg-primary"
2745
+ ),
2746
+ children: String(m).padStart(2, "0")
2747
+ },
2748
+ m
2749
+ );
2750
+ })
2751
+ }
2752
+ )
2753
+ ] }) }),
2801
2754
  name && time && /* @__PURE__ */ jsx(
2802
2755
  "input",
2803
2756
  {
@@ -2825,7 +2778,6 @@ var DateRangePicker = forwardRef(
2825
2778
  state,
2826
2779
  className,
2827
2780
  disabled,
2828
- onClick,
2829
2781
  ...rest
2830
2782
  }, forwardedRef) {
2831
2783
  const [range, setRange] = useControlled({
@@ -2837,33 +2789,23 @@ var DateRangePicker = forwardRef(
2837
2789
  controlled: void 0,
2838
2790
  default: false
2839
2791
  });
2840
- const triggerRef = useRef(null);
2841
2792
  const triggerState = state ?? (invalid ? "invalid" : "default");
2842
2793
  const wasComplete = useRef(false);
2843
2794
  useEffect(() => {
2844
2795
  const complete = !!(range?.start && range?.end);
2845
2796
  if (complete && !wasComplete.current && open) {
2846
2797
  setOpen(false);
2847
- requestAnimationFrame(() => triggerRef.current?.focus());
2848
2798
  }
2849
2799
  wasComplete.current = complete;
2850
2800
  }, [range, open, setOpen]);
2851
2801
  const display = range?.start ? range.end ? `${format(range.start)} \u2192 ${format(range.end)}` : `${format(range.start)} \u2192 \u2026` : null;
2852
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2853
- /* @__PURE__ */ jsxs(
2802
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, placement: "bottom-start", offset: 6, children: [
2803
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
2854
2804
  "button",
2855
2805
  {
2856
- ref: composeRefs(forwardedRef, triggerRef),
2806
+ ref: forwardedRef,
2857
2807
  type: "button",
2858
- "aria-haspopup": "dialog",
2859
- "aria-expanded": open,
2860
- "data-state": open ? "open" : "closed",
2861
2808
  disabled,
2862
- onClick: (e) => {
2863
- onClick?.(e);
2864
- if (e.defaultPrevented) return;
2865
- setOpen(!open);
2866
- },
2867
2809
  className: cn(selectTriggerVariants({ size, state: triggerState }), className),
2868
2810
  ...rest,
2869
2811
  children: [
@@ -2871,32 +2813,18 @@ var DateRangePicker = forwardRef(
2871
2813
  /* @__PURE__ */ jsx(Calendar$1, { className: "h-4 w-4 shrink-0 text-muted-foreground" })
2872
2814
  ]
2873
2815
  }
2874
- ),
2875
- open && /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(AnchoredPositioner, { anchor: triggerRef.current, placement: "bottom-start", offset: 6, children: /* @__PURE__ */ jsx(FocusScope, { asChild: true, trapped: true, loop: true, children: /* @__PURE__ */ jsx(
2876
- DismissableLayer,
2816
+ ) }),
2817
+ /* @__PURE__ */ jsx(PopoverContent, { bare: true, children: /* @__PURE__ */ jsx(
2818
+ RangeCalendar,
2877
2819
  {
2878
- onEscape: () => {
2879
- setOpen(false);
2880
- requestAnimationFrame(() => triggerRef.current?.focus());
2881
- },
2882
- onOutsidePointerDown: (e) => {
2883
- if (triggerRef.current?.contains(e.target)) return;
2884
- setOpen(false);
2885
- },
2886
- children: /* @__PURE__ */ jsx(
2887
- RangeCalendar,
2888
- {
2889
- value: range,
2890
- onChange: setRange,
2891
- defaultMonth: range?.start ?? /* @__PURE__ */ new Date(),
2892
- min,
2893
- max,
2894
- isDisabled: dayDisabled,
2895
- className: "shadow-md"
2896
- }
2897
- )
2820
+ value: range,
2821
+ onChange: setRange,
2822
+ defaultMonth: range?.start ?? /* @__PURE__ */ new Date(),
2823
+ min,
2824
+ max,
2825
+ isDisabled: dayDisabled
2898
2826
  }
2899
- ) }) }) }),
2827
+ ) }),
2900
2828
  name && /* @__PURE__ */ jsxs(Fragment, { children: [
2901
2829
  /* @__PURE__ */ jsx("input", { type: "hidden", name: `${name}_start`, value: formatISODate(range?.start) }),
2902
2830
  /* @__PURE__ */ jsx("input", { type: "hidden", name: `${name}_end`, value: formatISODate(range?.end) })
@@ -2905,6 +2833,1040 @@ var DateRangePicker = forwardRef(
2905
2833
  }
2906
2834
  );
2907
2835
 
2908
- export { Calendar, CharacterCount, Checkbox, CheckboxField, CheckboxGroup, ChoiceCard, Combobox, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxSeparator, CurrencyInput, DateField, DatePicker, DateRangePicker, EmailInput, Fieldset, FilePicker, FormErrorMessage, FormField, FormHelperText, InputAddon, InputGroup, Label, LabeledInput, Legend, Listbox, ListboxEmpty, ListboxGroup, ListboxItem, ListboxSeparator, MaskedInput, MultiSelect, MultiSelectContent, MultiSelectItem, MultiSelectTags, MultiSelectTrigger, NumberInput, PasswordInput, PasswordStrength, PercentInput, PinInput, Radio, RadioField, RadioGroup, RangeCalendar, SearchInput, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Slider, Switch, SwitchField, TelInput, TextInput, Textarea, TimeField, TimePicker, UrlInput };
2909
- //# sourceMappingURL=chunk-PFM3IQKM.js.map
2910
- //# sourceMappingURL=chunk-PFM3IQKM.js.map
2836
+ // src/forms/colorSwatch/ColorSwatch.variants.ts
2837
+ var colorSwatchVariants = tv({
2838
+ base: "inline-block shrink-0 border border-border bg-[image:linear-gradient(45deg,_#ddd_25%,_transparent_25%),_linear-gradient(-45deg,_#ddd_25%,_transparent_25%),_linear-gradient(45deg,_transparent_75%,_#ddd_75%),_linear-gradient(-45deg,_transparent_75%,_#ddd_75%)] bg-[length:8px_8px] bg-[position:0_0,_0_4px,_4px_-4px,_-4px_0px]",
2839
+ variants: {
2840
+ size: {
2841
+ xs: "h-4 w-4",
2842
+ sm: "h-5 w-5",
2843
+ md: "h-6 w-6",
2844
+ lg: "h-9 w-9"
2845
+ },
2846
+ shape: {
2847
+ square: "rounded-sm",
2848
+ circle: "rounded-full"
2849
+ },
2850
+ interactive: {
2851
+ true: "cursor-pointer transition-shadow focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 hover:shadow-sm",
2852
+ false: ""
2853
+ },
2854
+ selected: {
2855
+ true: "ring-2 ring-ring ring-offset-1",
2856
+ false: ""
2857
+ },
2858
+ disabled: {
2859
+ true: "cursor-not-allowed opacity-50",
2860
+ false: ""
2861
+ }
2862
+ },
2863
+ defaultVariants: {
2864
+ size: "md",
2865
+ shape: "square",
2866
+ interactive: false,
2867
+ selected: false,
2868
+ disabled: false
2869
+ }
2870
+ });
2871
+ var ColorSwatch = forwardRef(function ColorSwatch2({ color = "#000000", size, shape, selected, disabled, className, onClick, style, ...rest }, ref) {
2872
+ const interactive = !!onClick;
2873
+ const classes = cn(
2874
+ colorSwatchVariants({ size, shape, interactive, selected, disabled }),
2875
+ className
2876
+ );
2877
+ const styleWithColor = {
2878
+ ...style,
2879
+ boxShadow: `inset 0 0 0 100px ${color}`
2880
+ };
2881
+ if (interactive) {
2882
+ const buttonProps = rest;
2883
+ return /* @__PURE__ */ jsx(
2884
+ "button",
2885
+ {
2886
+ ref,
2887
+ type: "button",
2888
+ disabled,
2889
+ onClick,
2890
+ style: styleWithColor,
2891
+ className: classes,
2892
+ ...buttonProps
2893
+ }
2894
+ );
2895
+ }
2896
+ const divProps = rest;
2897
+ return /* @__PURE__ */ jsx(
2898
+ "div",
2899
+ {
2900
+ ref,
2901
+ style: styleWithColor,
2902
+ className: classes,
2903
+ ...divProps
2904
+ }
2905
+ );
2906
+ });
2907
+
2908
+ // src/forms/ColorExtensions.ts
2909
+ function clamp01(n) {
2910
+ return Math.max(0, Math.min(1, n));
2911
+ }
2912
+ function clampHue(h) {
2913
+ let v = h % 360;
2914
+ if (v < 0) v += 360;
2915
+ return v;
2916
+ }
2917
+ function clampByte(n) {
2918
+ return Math.max(0, Math.min(255, Math.round(n)));
2919
+ }
2920
+ function parseHex(input) {
2921
+ if (!input) return null;
2922
+ const s = input.trim().replace(/^#/, "");
2923
+ let m = null;
2924
+ if (/^[0-9a-fA-F]{3}$/.test(s)) {
2925
+ m = s.split("").map((c) => c + c).join("");
2926
+ } else if (/^[0-9a-fA-F]{4}$/.test(s)) {
2927
+ m = s.split("").map((c) => c + c).join("");
2928
+ } else if (/^[0-9a-fA-F]{6}$/.test(s) || /^[0-9a-fA-F]{8}$/.test(s)) {
2929
+ m = s;
2930
+ }
2931
+ if (!m) return null;
2932
+ const r = parseInt(m.slice(0, 2), 16);
2933
+ const g = parseInt(m.slice(2, 4), 16);
2934
+ const b = parseInt(m.slice(4, 6), 16);
2935
+ const a = m.length === 8 ? parseInt(m.slice(6, 8), 16) / 255 : 1;
2936
+ return { r, g, b, a };
2937
+ }
2938
+ function formatHex(rgb, options) {
2939
+ if (!rgb) return "";
2940
+ const r = clampByte(rgb.r).toString(16).padStart(2, "0");
2941
+ const g = clampByte(rgb.g).toString(16).padStart(2, "0");
2942
+ const b = clampByte(rgb.b).toString(16).padStart(2, "0");
2943
+ const includeAlpha = options?.withAlpha ?? (rgb.a !== void 0 && rgb.a < 1);
2944
+ if (includeAlpha) {
2945
+ const a = clampByte((rgb.a ?? 1) * 255).toString(16).padStart(2, "0");
2946
+ return `#${r}${g}${b}${a}`;
2947
+ }
2948
+ return `#${r}${g}${b}`;
2949
+ }
2950
+ function rgbToHsv({ r, g, b, a = 1 }) {
2951
+ const rn = r / 255;
2952
+ const gn = g / 255;
2953
+ const bn = b / 255;
2954
+ const max = Math.max(rn, gn, bn);
2955
+ const min = Math.min(rn, gn, bn);
2956
+ const d = max - min;
2957
+ let h = 0;
2958
+ if (d !== 0) {
2959
+ if (max === rn) h = (gn - bn) / d % 6;
2960
+ else if (max === gn) h = (bn - rn) / d + 2;
2961
+ else h = (rn - gn) / d + 4;
2962
+ h *= 60;
2963
+ if (h < 0) h += 360;
2964
+ }
2965
+ const s = max === 0 ? 0 : d / max;
2966
+ const v = max;
2967
+ return { h, s, v, a };
2968
+ }
2969
+ function hsvToRgb({ h, s, v, a = 1 }) {
2970
+ const c = v * s;
2971
+ const hh = clampHue(h) / 60;
2972
+ const x = c * (1 - Math.abs(hh % 2 - 1));
2973
+ let r1 = 0;
2974
+ let g1 = 0;
2975
+ let b1 = 0;
2976
+ if (hh >= 0 && hh < 1) [r1, g1, b1] = [c, x, 0];
2977
+ else if (hh < 2) [r1, g1, b1] = [x, c, 0];
2978
+ else if (hh < 3) [r1, g1, b1] = [0, c, x];
2979
+ else if (hh < 4) [r1, g1, b1] = [0, x, c];
2980
+ else if (hh < 5) [r1, g1, b1] = [x, 0, c];
2981
+ else [r1, g1, b1] = [c, 0, x];
2982
+ const m = v - c;
2983
+ return {
2984
+ r: Math.round((r1 + m) * 255),
2985
+ g: Math.round((g1 + m) * 255),
2986
+ b: Math.round((b1 + m) * 255),
2987
+ a
2988
+ };
2989
+ }
2990
+ function parseColorToHsv(input) {
2991
+ const rgb = parseHex(input);
2992
+ if (!rgb) return null;
2993
+ return rgbToHsv(rgb);
2994
+ }
2995
+ function hsvToHex(hsv, options) {
2996
+ return formatHex(hsvToRgb(hsv), options);
2997
+ }
2998
+ function commitHex(text, withAlpha) {
2999
+ const normalised = text.startsWith("#") ? text : `#${text}`;
3000
+ const rgb = parseHex(normalised);
3001
+ if (!rgb) return null;
3002
+ return formatHex(rgb, { withAlpha });
3003
+ }
3004
+ var ColorField = forwardRef(function ColorField2({
3005
+ value,
3006
+ defaultValue,
3007
+ onChange,
3008
+ swatchShape = "square",
3009
+ withAlpha = false,
3010
+ size,
3011
+ state,
3012
+ className,
3013
+ id,
3014
+ disabled,
3015
+ required,
3016
+ onBlur,
3017
+ onKeyDown,
3018
+ ...rest
3019
+ }, ref) {
3020
+ const ctx = useFormControl();
3021
+ const [committed, setCommitted] = useControlled({
3022
+ controlled: value,
3023
+ default: defaultValue ?? null,
3024
+ onChange
3025
+ });
3026
+ const [draft, setDraft] = useState(committed ?? "");
3027
+ useEffect(() => {
3028
+ setDraft(committed ?? "");
3029
+ }, [committed]);
3030
+ const commit = () => {
3031
+ if (!draft) {
3032
+ setCommitted(null);
3033
+ return;
3034
+ }
3035
+ const next = commitHex(draft, withAlpha);
3036
+ if (next) {
3037
+ setCommitted(next);
3038
+ setDraft(next);
3039
+ } else {
3040
+ setDraft(committed ?? "");
3041
+ }
3042
+ };
3043
+ return /* @__PURE__ */ jsxs("div", { className: "relative inline-flex w-full items-stretch", children: [
3044
+ /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute inset-y-0 left-2 flex items-center", children: /* @__PURE__ */ jsx(ColorSwatch, { color: committed ?? "#00000000", size: "sm", shape: swatchShape }) }),
3045
+ /* @__PURE__ */ jsx(
3046
+ "input",
3047
+ {
3048
+ ref,
3049
+ type: "text",
3050
+ id: id ?? ctx?.id,
3051
+ disabled: disabled ?? ctx?.isDisabled,
3052
+ required: required ?? ctx?.isRequired,
3053
+ "aria-invalid": ctx?.isInvalid || void 0,
3054
+ "aria-describedby": ctx ? `${ctx.helperId} ${ctx.errorId}` : void 0,
3055
+ spellCheck: false,
3056
+ autoCapitalize: "none",
3057
+ autoCorrect: "off",
3058
+ value: draft,
3059
+ onChange: (e) => setDraft(e.target.value),
3060
+ onBlur: (e) => {
3061
+ onBlur?.(e);
3062
+ commit();
3063
+ },
3064
+ onKeyDown: (e) => {
3065
+ onKeyDown?.(e);
3066
+ if (e.defaultPrevented) return;
3067
+ if (e.key === "Enter") {
3068
+ e.preventDefault();
3069
+ commit();
3070
+ }
3071
+ },
3072
+ className: cn(
3073
+ inputBaseVariants({ size, state: state ?? (ctx?.isInvalid ? "invalid" : "default") }),
3074
+ "pl-9 font-mono uppercase",
3075
+ className
3076
+ ),
3077
+ ...rest
3078
+ }
3079
+ )
3080
+ ] });
3081
+ });
3082
+ function channelMax(channel) {
3083
+ return channel === "hue" ? 360 : 1;
3084
+ }
3085
+ function defaultStep(channel) {
3086
+ return channel === "hue" ? 1 : 0.01;
3087
+ }
3088
+ function buildGradient(channel, color) {
3089
+ if (channel === "hue") {
3090
+ return "linear-gradient(to right, hsl(0,100%,50%), hsl(60,100%,50%), hsl(120,100%,50%), hsl(180,100%,50%), hsl(240,100%,50%), hsl(300,100%,50%), hsl(360,100%,50%))";
3091
+ }
3092
+ const ctx = color ?? { h: 0, s: 1, v: 1 };
3093
+ if (channel === "saturation") {
3094
+ const start = hsvToHex({ h: ctx.h, s: 0, v: ctx.v });
3095
+ const end = hsvToHex({ h: ctx.h, s: 1, v: ctx.v });
3096
+ return `linear-gradient(to right, ${start}, ${end})`;
3097
+ }
3098
+ if (channel === "value") {
3099
+ const end = hsvToHex({ h: ctx.h, s: ctx.s, v: 1 });
3100
+ return `linear-gradient(to right, #000000, ${end})`;
3101
+ }
3102
+ const opaque = hsvToHex({ h: ctx.h, s: ctx.s, v: ctx.v });
3103
+ return `linear-gradient(to right, transparent, ${opaque})`;
3104
+ }
3105
+ var CHECKERBOARD = {
3106
+ backgroundImage: "linear-gradient(45deg, #ddd 25%, transparent 25%), linear-gradient(-45deg, #ddd 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ddd 75%), linear-gradient(-45deg, transparent 75%, #ddd 75%)",
3107
+ backgroundSize: "8px 8px",
3108
+ backgroundPosition: "0 0, 0 4px, 4px -4px, -4px 0px"
3109
+ };
3110
+ var ColorSlider = forwardRef(function ColorSlider2({
3111
+ channel = "hue",
3112
+ value,
3113
+ defaultValue,
3114
+ onChange,
3115
+ color,
3116
+ step,
3117
+ disabled = false,
3118
+ className,
3119
+ "aria-label": ariaLabel,
3120
+ ...rest
3121
+ }, forwardedRef) {
3122
+ const max = channelMax(channel);
3123
+ const stepValue = step ?? defaultStep(channel);
3124
+ const [val, setVal] = useControlled({
3125
+ controlled: value,
3126
+ default: defaultValue ?? 0,
3127
+ onChange
3128
+ });
3129
+ const trackRef = useRef(null);
3130
+ const updateFromClientX = useCallback(
3131
+ (clientX) => {
3132
+ const track = trackRef.current;
3133
+ if (!track) return;
3134
+ const rect = track.getBoundingClientRect();
3135
+ const ratio2 = clamp01((clientX - rect.left) / rect.width);
3136
+ const next = ratio2 * max;
3137
+ setVal(channel === "hue" ? clampHue(next) : clamp01(next));
3138
+ },
3139
+ [channel, max, setVal]
3140
+ );
3141
+ const handlePointerDown = useCallback(
3142
+ (e) => {
3143
+ if (disabled) return;
3144
+ e.preventDefault();
3145
+ e.target.setPointerCapture?.(e.pointerId);
3146
+ updateFromClientX(e.clientX);
3147
+ },
3148
+ [disabled, updateFromClientX]
3149
+ );
3150
+ const handlePointerMove = useCallback(
3151
+ (e) => {
3152
+ if (disabled) return;
3153
+ if (e.buttons !== 1) return;
3154
+ updateFromClientX(e.clientX);
3155
+ },
3156
+ [disabled, updateFromClientX]
3157
+ );
3158
+ const handleKeyDown = useCallback(
3159
+ (e) => {
3160
+ if (disabled) return;
3161
+ let next = val;
3162
+ switch (e.key) {
3163
+ case "ArrowRight":
3164
+ case "ArrowUp":
3165
+ next = val + stepValue;
3166
+ break;
3167
+ case "ArrowLeft":
3168
+ case "ArrowDown":
3169
+ next = val - stepValue;
3170
+ break;
3171
+ case "PageUp":
3172
+ next = val + stepValue * 10;
3173
+ break;
3174
+ case "PageDown":
3175
+ next = val - stepValue * 10;
3176
+ break;
3177
+ case "Home":
3178
+ next = 0;
3179
+ break;
3180
+ case "End":
3181
+ next = max;
3182
+ break;
3183
+ default:
3184
+ return;
3185
+ }
3186
+ e.preventDefault();
3187
+ setVal(channel === "hue" ? clampHue(next) : clamp01(next));
3188
+ },
3189
+ [channel, disabled, max, setVal, stepValue, val]
3190
+ );
3191
+ const ratio = channel === "hue" ? clampHue(val) / 360 : clamp01(val);
3192
+ const gradient = buildGradient(channel, color);
3193
+ const trackStyle = {
3194
+ backgroundImage: gradient,
3195
+ ...channel === "alpha" ? { backgroundColor: "transparent" } : null
3196
+ };
3197
+ return /* @__PURE__ */ jsxs(
3198
+ "div",
3199
+ {
3200
+ ref: forwardedRef,
3201
+ className: cn("relative inline-flex w-full select-none items-center", className),
3202
+ ...rest,
3203
+ children: [
3204
+ channel === "alpha" && /* @__PURE__ */ jsx(
3205
+ "div",
3206
+ {
3207
+ "aria-hidden": "true",
3208
+ className: "absolute inset-0 rounded-full",
3209
+ style: CHECKERBOARD
3210
+ }
3211
+ ),
3212
+ /* @__PURE__ */ jsx(
3213
+ "div",
3214
+ {
3215
+ ref: composeRefs(trackRef),
3216
+ role: "slider",
3217
+ tabIndex: disabled ? -1 : 0,
3218
+ "aria-label": ariaLabel ?? `${channel} slider`,
3219
+ "aria-valuemin": 0,
3220
+ "aria-valuemax": max,
3221
+ "aria-valuenow": Math.round(val * 100) / 100,
3222
+ "aria-disabled": disabled || void 0,
3223
+ "aria-orientation": "horizontal",
3224
+ "data-disabled": disabled ? "" : void 0,
3225
+ onPointerDown: handlePointerDown,
3226
+ onPointerMove: handlePointerMove,
3227
+ onKeyDown: handleKeyDown,
3228
+ style: trackStyle,
3229
+ className: cn(
3230
+ "relative h-3 w-full rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
3231
+ disabled && "pointer-events-none opacity-50"
3232
+ ),
3233
+ children: /* @__PURE__ */ jsx(
3234
+ "div",
3235
+ {
3236
+ "aria-hidden": "true",
3237
+ className: "absolute top-1/2 h-4 w-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white bg-transparent shadow-md ring-1 ring-black/20",
3238
+ style: { left: `${ratio * 100}%` }
3239
+ }
3240
+ )
3241
+ }
3242
+ )
3243
+ ]
3244
+ }
3245
+ );
3246
+ });
3247
+ var ColorArea = forwardRef(function ColorArea2({
3248
+ hue = 0,
3249
+ saturation,
3250
+ defaultSaturation,
3251
+ value,
3252
+ defaultValue,
3253
+ onChange,
3254
+ step = 0.01,
3255
+ disabled = false,
3256
+ className,
3257
+ "aria-label": ariaLabel = "Saturation and value",
3258
+ ...rest
3259
+ }, forwardedRef) {
3260
+ const [s, setS] = useControlled({
3261
+ controlled: saturation,
3262
+ default: defaultSaturation ?? 1
3263
+ });
3264
+ const [v, setV] = useControlled({
3265
+ controlled: value,
3266
+ default: defaultValue ?? 1
3267
+ });
3268
+ const trackRef = useRef(null);
3269
+ const emit = useCallback(
3270
+ (nextS, nextV) => {
3271
+ const cs = clamp01(nextS);
3272
+ const cv = clamp01(nextV);
3273
+ setS(cs);
3274
+ setV(cv);
3275
+ onChange?.({ saturation: cs, value: cv });
3276
+ },
3277
+ [onChange, setS, setV]
3278
+ );
3279
+ const updateFromClient = useCallback(
3280
+ (clientX, clientY) => {
3281
+ const track = trackRef.current;
3282
+ if (!track) return;
3283
+ const rect = track.getBoundingClientRect();
3284
+ const xRatio = clamp01((clientX - rect.left) / rect.width);
3285
+ const yRatio = clamp01((clientY - rect.top) / rect.height);
3286
+ emit(xRatio, 1 - yRatio);
3287
+ },
3288
+ [emit]
3289
+ );
3290
+ const handlePointerDown = useCallback(
3291
+ (e) => {
3292
+ if (disabled) return;
3293
+ e.preventDefault();
3294
+ e.target.setPointerCapture?.(e.pointerId);
3295
+ updateFromClient(e.clientX, e.clientY);
3296
+ },
3297
+ [disabled, updateFromClient]
3298
+ );
3299
+ const handlePointerMove = useCallback(
3300
+ (e) => {
3301
+ if (disabled || e.buttons !== 1) return;
3302
+ updateFromClient(e.clientX, e.clientY);
3303
+ },
3304
+ [disabled, updateFromClient]
3305
+ );
3306
+ const handleKeyDown = useCallback(
3307
+ (e) => {
3308
+ if (disabled) return;
3309
+ const big = step * 10;
3310
+ let nextS = s;
3311
+ let nextV = v;
3312
+ switch (e.key) {
3313
+ case "ArrowRight":
3314
+ nextS = s + step;
3315
+ break;
3316
+ case "ArrowLeft":
3317
+ nextS = s - step;
3318
+ break;
3319
+ case "ArrowUp":
3320
+ nextV = v + step;
3321
+ break;
3322
+ case "ArrowDown":
3323
+ nextV = v - step;
3324
+ break;
3325
+ case "PageUp":
3326
+ nextV = v + big;
3327
+ break;
3328
+ case "PageDown":
3329
+ nextV = v - big;
3330
+ break;
3331
+ case "Home":
3332
+ nextS = 0;
3333
+ nextV = 1;
3334
+ break;
3335
+ case "End":
3336
+ nextS = 1;
3337
+ nextV = 0;
3338
+ break;
3339
+ default:
3340
+ return;
3341
+ }
3342
+ e.preventDefault();
3343
+ emit(nextS, nextV);
3344
+ },
3345
+ [disabled, emit, s, step, v]
3346
+ );
3347
+ const baseColor = `hsl(${hue}, 100%, 50%)`;
3348
+ const trackStyle = {
3349
+ backgroundImage: `linear-gradient(to bottom, transparent, #000), linear-gradient(to right, #fff, transparent)`,
3350
+ backgroundColor: baseColor
3351
+ };
3352
+ const thumbColor = hsvToHex({ h: hue, s, v });
3353
+ const thumbStyle = {
3354
+ left: `${s * 100}%`,
3355
+ top: `${(1 - v) * 100}%`,
3356
+ backgroundColor: thumbColor
3357
+ };
3358
+ return /* @__PURE__ */ jsx(
3359
+ "div",
3360
+ {
3361
+ ref: composeRefs(forwardedRef, trackRef),
3362
+ role: "slider",
3363
+ tabIndex: disabled ? -1 : 0,
3364
+ "aria-label": ariaLabel,
3365
+ "aria-valuetext": `saturation ${(s * 100).toFixed(0)}%, value ${(v * 100).toFixed(0)}%`,
3366
+ "aria-disabled": disabled || void 0,
3367
+ "data-disabled": disabled ? "" : void 0,
3368
+ onPointerDown: handlePointerDown,
3369
+ onPointerMove: handlePointerMove,
3370
+ onKeyDown: handleKeyDown,
3371
+ style: trackStyle,
3372
+ className: cn(
3373
+ "relative aspect-square w-full select-none rounded-md border border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
3374
+ disabled && "pointer-events-none opacity-50",
3375
+ className
3376
+ ),
3377
+ ...rest,
3378
+ children: /* @__PURE__ */ jsx(
3379
+ "div",
3380
+ {
3381
+ "aria-hidden": "true",
3382
+ style: thumbStyle,
3383
+ className: "absolute h-4 w-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-md ring-1 ring-black/20"
3384
+ }
3385
+ )
3386
+ }
3387
+ );
3388
+ });
3389
+ function angleFromCenter(clientX, clientY, rect) {
3390
+ const cx = rect.left + rect.width / 2;
3391
+ const cy = rect.top + rect.height / 2;
3392
+ const dx = clientX - cx;
3393
+ const dy = clientY - cy;
3394
+ const angle = Math.atan2(dx, -dy) * 180 / Math.PI;
3395
+ return (angle + 360) % 360;
3396
+ }
3397
+ var ColorWheel = forwardRef(function ColorWheel2({
3398
+ value,
3399
+ defaultValue,
3400
+ onChange,
3401
+ size = 200,
3402
+ thickness = 30,
3403
+ step = 1,
3404
+ disabled = false,
3405
+ className,
3406
+ "aria-label": ariaLabel = "Hue",
3407
+ ...rest
3408
+ }, forwardedRef) {
3409
+ const [hue, setHue] = useControlled({
3410
+ controlled: value,
3411
+ default: defaultValue ?? 0,
3412
+ onChange
3413
+ });
3414
+ const trackRef = useRef(null);
3415
+ const updateFromClient = useCallback(
3416
+ (clientX, clientY) => {
3417
+ const track = trackRef.current;
3418
+ if (!track) return;
3419
+ setHue(clampHue(angleFromCenter(clientX, clientY, track.getBoundingClientRect())));
3420
+ },
3421
+ [setHue]
3422
+ );
3423
+ const handlePointerDown = useCallback(
3424
+ (e) => {
3425
+ if (disabled) return;
3426
+ e.preventDefault();
3427
+ e.target.setPointerCapture?.(e.pointerId);
3428
+ updateFromClient(e.clientX, e.clientY);
3429
+ },
3430
+ [disabled, updateFromClient]
3431
+ );
3432
+ const handlePointerMove = useCallback(
3433
+ (e) => {
3434
+ if (disabled || e.buttons !== 1) return;
3435
+ updateFromClient(e.clientX, e.clientY);
3436
+ },
3437
+ [disabled, updateFromClient]
3438
+ );
3439
+ const handleKeyDown = useCallback(
3440
+ (e) => {
3441
+ if (disabled) return;
3442
+ let next = hue;
3443
+ switch (e.key) {
3444
+ case "ArrowRight":
3445
+ case "ArrowDown":
3446
+ next = hue + step;
3447
+ break;
3448
+ case "ArrowLeft":
3449
+ case "ArrowUp":
3450
+ next = hue - step;
3451
+ break;
3452
+ case "PageUp":
3453
+ next = hue + step * 10;
3454
+ break;
3455
+ case "PageDown":
3456
+ next = hue - step * 10;
3457
+ break;
3458
+ case "Home":
3459
+ next = 0;
3460
+ break;
3461
+ case "End":
3462
+ next = 359;
3463
+ break;
3464
+ default:
3465
+ return;
3466
+ }
3467
+ e.preventDefault();
3468
+ setHue(clampHue(next));
3469
+ },
3470
+ [disabled, hue, setHue, step]
3471
+ );
3472
+ const radius = (size - thickness) / 2;
3473
+ const angleRad = hue * Math.PI / 180;
3474
+ const thumbX = size / 2 + radius * Math.sin(angleRad);
3475
+ const thumbY = size / 2 - radius * Math.cos(angleRad);
3476
+ const wheelStyle = {
3477
+ width: size,
3478
+ height: size,
3479
+ background: "conic-gradient(from 0deg, hsl(0,100%,50%), hsl(60,100%,50%), hsl(120,100%,50%), hsl(180,100%,50%), hsl(240,100%,50%), hsl(300,100%,50%), hsl(360,100%,50%))",
3480
+ WebkitMaskImage: `radial-gradient(circle, transparent ${radius - thickness / 2}px, black ${radius - thickness / 2 + 1}px, black ${radius + thickness / 2}px, transparent ${radius + thickness / 2 + 1}px)`,
3481
+ maskImage: `radial-gradient(circle, transparent ${radius - thickness / 2}px, black ${radius - thickness / 2 + 1}px, black ${radius + thickness / 2}px, transparent ${radius + thickness / 2 + 1}px)`
3482
+ };
3483
+ return /* @__PURE__ */ jsx(
3484
+ "div",
3485
+ {
3486
+ ref: composeRefs(forwardedRef, trackRef),
3487
+ role: "slider",
3488
+ tabIndex: disabled ? -1 : 0,
3489
+ "aria-label": ariaLabel,
3490
+ "aria-valuemin": 0,
3491
+ "aria-valuemax": 360,
3492
+ "aria-valuenow": Math.round(hue),
3493
+ "aria-disabled": disabled || void 0,
3494
+ "data-disabled": disabled ? "" : void 0,
3495
+ onPointerDown: handlePointerDown,
3496
+ onPointerMove: handlePointerMove,
3497
+ onKeyDown: handleKeyDown,
3498
+ style: wheelStyle,
3499
+ className: cn(
3500
+ "relative inline-block select-none rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3501
+ disabled && "pointer-events-none opacity-50",
3502
+ className
3503
+ ),
3504
+ ...rest,
3505
+ children: /* @__PURE__ */ jsx(
3506
+ "div",
3507
+ {
3508
+ "aria-hidden": "true",
3509
+ style: {
3510
+ left: thumbX,
3511
+ top: thumbY,
3512
+ backgroundColor: `hsl(${hue}, 100%, 50%)`
3513
+ },
3514
+ className: "pointer-events-none absolute h-5 w-5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-md ring-1 ring-black/30"
3515
+ }
3516
+ )
3517
+ }
3518
+ );
3519
+ });
3520
+ function ColorSwatchItem({ color, selected, disabled, size, shape, onSelect }) {
3521
+ const roving = useRovingFocusItem();
3522
+ return /* @__PURE__ */ jsx(
3523
+ ColorSwatch,
3524
+ {
3525
+ ref: roving.ref,
3526
+ color,
3527
+ size,
3528
+ shape,
3529
+ selected,
3530
+ disabled,
3531
+ tabIndex: roving.tabIndex,
3532
+ onClick: () => onSelect(color),
3533
+ onKeyDown: (e) => {
3534
+ roving.onKeyDown(e);
3535
+ if (e.defaultPrevented) return;
3536
+ if (e.key === "Enter" || e.key === " ") {
3537
+ e.preventDefault();
3538
+ onSelect(color);
3539
+ }
3540
+ },
3541
+ onFocus: roving.onFocus,
3542
+ "data-roving-focus-item": true,
3543
+ "aria-label": color
3544
+ }
3545
+ );
3546
+ }
3547
+ function ColorSwatchPicker({
3548
+ colors,
3549
+ value,
3550
+ defaultValue,
3551
+ onChange,
3552
+ swatchSize = "md",
3553
+ swatchShape = "square",
3554
+ disabled = false,
3555
+ className,
3556
+ ...rest
3557
+ }) {
3558
+ const [selected, setSelected] = useControlled({
3559
+ controlled: value,
3560
+ default: defaultValue ?? null,
3561
+ onChange
3562
+ });
3563
+ return /* @__PURE__ */ jsx(
3564
+ RovingFocusGroup,
3565
+ {
3566
+ orientation: "both",
3567
+ loop: true,
3568
+ className: cn("flex flex-wrap gap-1.5", className),
3569
+ ...rest,
3570
+ children: colors.map((c) => /* @__PURE__ */ jsx(
3571
+ ColorSwatchItem,
3572
+ {
3573
+ color: c,
3574
+ selected: selected === c,
3575
+ disabled,
3576
+ size: swatchSize,
3577
+ shape: swatchShape,
3578
+ onSelect: (color) => setSelected(color)
3579
+ },
3580
+ c
3581
+ ))
3582
+ }
3583
+ );
3584
+ }
3585
+ var FALLBACK_HSV = { h: 217, s: 0.91, v: 0.96, a: 1 };
3586
+ var ColorPicker = forwardRef(function ColorPicker2({
3587
+ value,
3588
+ defaultValue = "#3b82f6",
3589
+ onChange,
3590
+ withAlpha = false,
3591
+ presets,
3592
+ triggerSize = "md",
3593
+ disabled = false,
3594
+ name,
3595
+ className,
3596
+ "aria-label": ariaLabel = "Pick a color"
3597
+ }, ref) {
3598
+ const [hex, setHex] = useControlled({
3599
+ controlled: value,
3600
+ default: defaultValue ?? null,
3601
+ onChange
3602
+ });
3603
+ const [hsv, setHsvState] = useState(() => parseColorToHsv(hex) ?? FALLBACK_HSV);
3604
+ useEffect(() => {
3605
+ if (!hex) return;
3606
+ const parsed = parseColorToHsv(hex);
3607
+ if (!parsed) return;
3608
+ const currentHex = hsvToHex(hsv, { withAlpha });
3609
+ if (currentHex.toLowerCase() !== hex.toLowerCase()) {
3610
+ setHsvState({ ...parsed, a: hsv.a });
3611
+ }
3612
+ }, [hex, withAlpha]);
3613
+ const updateHsv = (next) => {
3614
+ setHsvState(next);
3615
+ setHex(hsvToHex(next, { withAlpha }));
3616
+ };
3617
+ return /* @__PURE__ */ jsxs(Popover, { children: [
3618
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
3619
+ "button",
3620
+ {
3621
+ ref,
3622
+ type: "button",
3623
+ "aria-label": ariaLabel,
3624
+ disabled,
3625
+ className: cn(
3626
+ "inline-flex items-center gap-2 rounded-md border border-border bg-background px-2 py-1 text-sm transition-colors hover:border-border-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60",
3627
+ className
3628
+ ),
3629
+ children: [
3630
+ /* @__PURE__ */ jsx(ColorSwatch, { color: hex ?? "#00000000", size: triggerSize }),
3631
+ /* @__PURE__ */ jsx("span", { className: "font-mono uppercase", children: hex ?? "\u2014" })
3632
+ ]
3633
+ }
3634
+ ) }),
3635
+ /* @__PURE__ */ jsxs(PopoverContent, { className: "flex w-64 flex-col gap-3", children: [
3636
+ /* @__PURE__ */ jsx(
3637
+ ColorArea,
3638
+ {
3639
+ hue: hsv.h,
3640
+ saturation: hsv.s,
3641
+ value: hsv.v,
3642
+ onChange: ({ saturation, value: value2 }) => updateHsv({ ...hsv, s: saturation, v: value2 })
3643
+ }
3644
+ ),
3645
+ /* @__PURE__ */ jsx(
3646
+ ColorSlider,
3647
+ {
3648
+ channel: "hue",
3649
+ value: hsv.h,
3650
+ onChange: (h) => updateHsv({ ...hsv, h }),
3651
+ "aria-label": "Hue"
3652
+ }
3653
+ ),
3654
+ withAlpha && /* @__PURE__ */ jsx(
3655
+ ColorSlider,
3656
+ {
3657
+ channel: "alpha",
3658
+ value: hsv.a ?? 1,
3659
+ color: hsv,
3660
+ onChange: (a) => updateHsv({ ...hsv, a }),
3661
+ "aria-label": "Alpha"
3662
+ }
3663
+ ),
3664
+ /* @__PURE__ */ jsx(
3665
+ ColorField,
3666
+ {
3667
+ value: hex,
3668
+ onChange: (next) => setHex(next),
3669
+ withAlpha
3670
+ }
3671
+ ),
3672
+ presets && presets.length > 0 && /* @__PURE__ */ jsx(
3673
+ ColorSwatchPicker,
3674
+ {
3675
+ colors: presets,
3676
+ value: hex,
3677
+ onChange: setHex,
3678
+ swatchSize: "sm"
3679
+ }
3680
+ )
3681
+ ] }),
3682
+ name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: hex ?? "" })
3683
+ ] });
3684
+ });
3685
+ var StepperContext = createContext(null);
3686
+ function useStepperContext() {
3687
+ const ctx = useContext(StepperContext);
3688
+ if (!ctx) throw new Error("Stepper.* must be used inside <Stepper>");
3689
+ return ctx;
3690
+ }
3691
+ var Stepper = forwardRef(function Stepper2({
3692
+ value,
3693
+ defaultValue,
3694
+ onValueChange,
3695
+ orientation = "horizontal",
3696
+ className,
3697
+ children,
3698
+ ...rest
3699
+ }, ref) {
3700
+ const [active, setActive] = useControlled({
3701
+ controlled: value,
3702
+ default: defaultValue ?? "",
3703
+ onChange: onValueChange
3704
+ });
3705
+ const baseId = useId$1();
3706
+ const stepsRef = useRef([]);
3707
+ const registerStep = useCallback((v) => {
3708
+ if (!stepsRef.current.includes(v)) stepsRef.current.push(v);
3709
+ }, []);
3710
+ const unregisterStep = useCallback((v) => {
3711
+ stepsRef.current = stepsRef.current.filter((x) => x !== v);
3712
+ }, []);
3713
+ const ctx = useMemo(
3714
+ () => ({
3715
+ value: active,
3716
+ setValue: setActive,
3717
+ orientation,
3718
+ baseId,
3719
+ registerStep,
3720
+ unregisterStep,
3721
+ stepsRef
3722
+ }),
3723
+ [active, setActive, orientation, baseId, registerStep, unregisterStep]
3724
+ );
3725
+ return /* @__PURE__ */ jsx(StepperContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
3726
+ "div",
3727
+ {
3728
+ ref,
3729
+ "data-orientation": orientation,
3730
+ className: cn(
3731
+ orientation === "vertical" ? "flex gap-4" : "flex flex-col gap-4",
3732
+ className
3733
+ ),
3734
+ ...rest,
3735
+ children
3736
+ }
3737
+ ) });
3738
+ });
3739
+ var StepperList = forwardRef(function StepperList2({ className, children, ...rest }, ref) {
3740
+ const ctx = useStepperContext();
3741
+ return /* @__PURE__ */ jsx(
3742
+ RovingFocusGroup,
3743
+ {
3744
+ ref,
3745
+ orientation: ctx.orientation,
3746
+ role: "tablist",
3747
+ "aria-orientation": ctx.orientation,
3748
+ "data-orientation": ctx.orientation,
3749
+ className: cn(
3750
+ "flex",
3751
+ ctx.orientation === "vertical" ? "flex-col gap-4" : "flex-row items-center gap-2",
3752
+ className
3753
+ ),
3754
+ ...rest,
3755
+ children
3756
+ }
3757
+ );
3758
+ });
3759
+ var StepperStep = forwardRef(function StepperStep2({ value, description, disabled = false, className, onClick, children, ...rest }, ref) {
3760
+ const ctx = useStepperContext();
3761
+ const roving = useRovingFocusItem();
3762
+ useEffect(() => {
3763
+ ctx.registerStep(value);
3764
+ return () => ctx.unregisterStep(value);
3765
+ }, [ctx, value]);
3766
+ const ordered = ctx.stepsRef.current;
3767
+ const idx = ordered.indexOf(value);
3768
+ const activeIdx = ordered.indexOf(ctx.value);
3769
+ const status = idx < activeIdx ? "complete" : idx === activeIdx ? "active" : "pending";
3770
+ const stepId = `${ctx.baseId}-step-${value}`;
3771
+ const panelId = `${ctx.baseId}-panel-${value}`;
3772
+ const stepNumber = idx + 1;
3773
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-2", children: [
3774
+ /* @__PURE__ */ jsxs(
3775
+ "button",
3776
+ {
3777
+ ref: (node) => {
3778
+ roving.ref(node);
3779
+ if (typeof ref === "function") ref(node);
3780
+ else if (ref) ref.current = node;
3781
+ },
3782
+ id: stepId,
3783
+ type: "button",
3784
+ role: "tab",
3785
+ "aria-selected": status === "active",
3786
+ "aria-controls": panelId,
3787
+ "aria-current": status === "active" ? "step" : void 0,
3788
+ "data-status": status,
3789
+ "data-disabled": dataAttr(disabled),
3790
+ tabIndex: roving.tabIndex,
3791
+ disabled,
3792
+ onClick: (e) => {
3793
+ onClick?.(e);
3794
+ if (e.defaultPrevented || disabled) return;
3795
+ ctx.setValue(value);
3796
+ },
3797
+ onFocus: roving.onFocus,
3798
+ onKeyDown: roving.onKeyDown,
3799
+ className: cn(
3800
+ "group flex items-center gap-2 text-left text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",
3801
+ disabled && "pointer-events-none opacity-50",
3802
+ className
3803
+ ),
3804
+ ...rest,
3805
+ children: [
3806
+ /* @__PURE__ */ jsx(
3807
+ "span",
3808
+ {
3809
+ "aria-hidden": "true",
3810
+ className: cn(
3811
+ "grid h-7 w-7 shrink-0 place-items-center rounded-full border-2 text-xs font-semibold transition-colors",
3812
+ status === "pending" && "border-border text-muted-foreground",
3813
+ status === "active" && "border-primary bg-primary text-primary-foreground",
3814
+ status === "complete" && "border-primary bg-primary text-primary-foreground"
3815
+ ),
3816
+ children: status === "complete" ? /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) : stepNumber
3817
+ }
3818
+ ),
3819
+ /* @__PURE__ */ jsxs("span", { className: "flex flex-col", children: [
3820
+ /* @__PURE__ */ jsx(
3821
+ "span",
3822
+ {
3823
+ className: cn(
3824
+ "font-medium",
3825
+ status === "pending" ? "text-muted-foreground" : "text-foreground"
3826
+ ),
3827
+ children
3828
+ }
3829
+ ),
3830
+ description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: description })
3831
+ ] })
3832
+ ]
3833
+ }
3834
+ ),
3835
+ ctx.orientation === "horizontal" && idx < ordered.length - 1 && /* @__PURE__ */ jsx(
3836
+ "span",
3837
+ {
3838
+ "aria-hidden": "true",
3839
+ className: cn(
3840
+ "h-px flex-1 transition-colors",
3841
+ status === "pending" ? "bg-border" : "bg-primary"
3842
+ )
3843
+ }
3844
+ )
3845
+ ] });
3846
+ });
3847
+ var StepperPanel = forwardRef(function StepperPanel2({ value, className, children, ...rest }, ref) {
3848
+ const ctx = useStepperContext();
3849
+ if (ctx.value !== value) return null;
3850
+ const stepId = `${ctx.baseId}-step-${value}`;
3851
+ const panelId = `${ctx.baseId}-panel-${value}`;
3852
+ return /* @__PURE__ */ jsx(
3853
+ "div",
3854
+ {
3855
+ ref,
3856
+ id: panelId,
3857
+ role: "tabpanel",
3858
+ "aria-labelledby": stepId,
3859
+ tabIndex: 0,
3860
+ className: cn("flex-1 outline-none", className),
3861
+ ...rest,
3862
+ children
3863
+ }
3864
+ );
3865
+ });
3866
+ Stepper.List = StepperList;
3867
+ Stepper.Step = StepperStep;
3868
+ Stepper.Panel = StepperPanel;
3869
+
3870
+ export { Calendar, CharacterCount, Checkbox, CheckboxField, CheckboxGroup, ChoiceCard, ColorArea, ColorField, ColorPicker, ColorSlider, ColorSwatch, ColorSwatchPicker, ColorWheel, Combobox, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxSeparator, CurrencyInput, DateField, DatePicker, DateRangePicker, EmailInput, Fieldset, FilePicker, FormErrorMessage, FormField, FormHelperText, InputAddon, InputGroup, Label, LabeledInput, Legend, Listbox, ListboxEmpty, ListboxGroup, ListboxItem, ListboxSeparator, MaskedInput, MultiSelect, MultiSelectContent, MultiSelectItem, MultiSelectTags, MultiSelectTrigger, NumberInput, PasswordInput, PasswordStrength, PercentInput, PinInput, Radio, RadioField, RadioGroup, RangeCalendar, SearchInput, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Slider, Stepper, StepperList, StepperPanel, StepperStep, Switch, SwitchField, TelInput, TextInput, Textarea, TimeField, TimePicker, UrlInput, colorSwatchVariants };
3871
+ //# sourceMappingURL=chunk-A4N52LL6.js.map
3872
+ //# sourceMappingURL=chunk-A4N52LL6.js.map