@wow-two-beta/ui 0.0.13 → 0.0.15

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 (137) 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 +3 -3
  4. package/dist/actions/speedDial/SpeedDial.d.ts +38 -0
  5. package/dist/actions/speedDial/SpeedDial.d.ts.map +1 -0
  6. package/dist/actions/speedDial/index.d.ts +3 -0
  7. package/dist/actions/speedDial/index.d.ts.map +1 -0
  8. package/dist/{chunk-EU6JT5B4.js → chunk-2VAZKEQD.js} +22 -272
  9. package/dist/chunk-2VAZKEQD.js.map +1 -0
  10. package/dist/{chunk-RIW2V3N4.js → chunk-3IN5ULKY.js} +213 -5
  11. package/dist/chunk-3IN5ULKY.js.map +1 -0
  12. package/dist/{chunk-UGHPZ3I7.js → chunk-4ESR253U.js} +331 -5
  13. package/dist/chunk-4ESR253U.js.map +1 -0
  14. package/dist/chunk-ASIHQQDQ.js +27 -0
  15. package/dist/chunk-ASIHQQDQ.js.map +1 -0
  16. package/dist/chunk-FFQENBTW.js +31 -0
  17. package/dist/chunk-FFQENBTW.js.map +1 -0
  18. package/dist/{chunk-A4N52LL6.js → chunk-ILYL6ROC.js} +716 -342
  19. package/dist/chunk-ILYL6ROC.js.map +1 -0
  20. package/dist/{chunk-YMSAS7M7.js → chunk-NC2CBGX2.js} +24 -4
  21. package/dist/chunk-NC2CBGX2.js.map +1 -0
  22. package/dist/{chunk-ULAOIBCP.js → chunk-NRAJPSEK.js} +164 -7
  23. package/dist/chunk-NRAJPSEK.js.map +1 -0
  24. package/dist/chunk-SM2TOB4U.js +641 -0
  25. package/dist/chunk-SM2TOB4U.js.map +1 -0
  26. package/dist/{chunk-PRRVOVUC.js → chunk-W7LQZKTH.js} +766 -42
  27. package/dist/chunk-W7LQZKTH.js.map +1 -0
  28. package/dist/chunk-XHGWBSIR.js +222 -0
  29. package/dist/chunk-XHGWBSIR.js.map +1 -0
  30. package/dist/chunk-ZCA365IX.js +44 -0
  31. package/dist/chunk-ZCA365IX.js.map +1 -0
  32. package/dist/display/carousel/Carousel.d.ts +47 -0
  33. package/dist/display/carousel/Carousel.d.ts.map +1 -0
  34. package/dist/display/carousel/index.d.ts +3 -0
  35. package/dist/display/carousel/index.d.ts.map +1 -0
  36. package/dist/display/dataTable/DataTable.d.ts +34 -0
  37. package/dist/display/dataTable/DataTable.d.ts.map +1 -0
  38. package/dist/display/dataTable/index.d.ts +2 -0
  39. package/dist/display/dataTable/index.d.ts.map +1 -0
  40. package/dist/display/index.d.ts +6 -0
  41. package/dist/display/index.d.ts.map +1 -1
  42. package/dist/display/index.js +4 -3
  43. package/dist/display/list/List.d.ts +23 -0
  44. package/dist/display/list/List.d.ts.map +1 -0
  45. package/dist/display/list/List.variants.d.ts +89 -0
  46. package/dist/display/list/List.variants.d.ts.map +1 -0
  47. package/dist/display/list/index.d.ts +2 -0
  48. package/dist/display/list/index.d.ts.map +1 -0
  49. package/dist/display/table/Table.d.ts +35 -0
  50. package/dist/display/table/Table.d.ts.map +1 -0
  51. package/dist/display/table/index.d.ts +2 -0
  52. package/dist/display/table/index.d.ts.map +1 -0
  53. package/dist/display/timeline/Timeline.d.ts +29 -0
  54. package/dist/display/timeline/Timeline.d.ts.map +1 -0
  55. package/dist/display/timeline/index.d.ts +2 -0
  56. package/dist/display/timeline/index.d.ts.map +1 -0
  57. package/dist/display/tree/Tree.d.ts +30 -0
  58. package/dist/display/tree/Tree.d.ts.map +1 -0
  59. package/dist/display/tree/index.d.ts +2 -0
  60. package/dist/display/tree/index.d.ts.map +1 -0
  61. package/dist/feedback/index.d.ts +2 -0
  62. package/dist/feedback/index.d.ts.map +1 -1
  63. package/dist/feedback/index.js +4 -1
  64. package/dist/feedback/loadingOverlay/LoadingOverlay.d.ts +19 -0
  65. package/dist/feedback/loadingOverlay/LoadingOverlay.d.ts.map +1 -0
  66. package/dist/feedback/loadingOverlay/index.d.ts +2 -0
  67. package/dist/feedback/loadingOverlay/index.d.ts.map +1 -0
  68. package/dist/feedback/toaster/Toaster.d.ts +49 -0
  69. package/dist/feedback/toaster/Toaster.d.ts.map +1 -0
  70. package/dist/feedback/toaster/index.d.ts +2 -0
  71. package/dist/feedback/toaster/index.d.ts.map +1 -0
  72. package/dist/forms/MonthGrid.d.ts +29 -0
  73. package/dist/forms/MonthGrid.d.ts.map +1 -0
  74. package/dist/forms/calendar/Calendar.d.ts.map +1 -1
  75. package/dist/forms/editable/Editable.d.ts +37 -0
  76. package/dist/forms/editable/Editable.d.ts.map +1 -0
  77. package/dist/forms/editable/index.d.ts +3 -0
  78. package/dist/forms/editable/index.d.ts.map +1 -0
  79. package/dist/forms/fileUpload/FileUpload.d.ts +25 -0
  80. package/dist/forms/fileUpload/FileUpload.d.ts.map +1 -0
  81. package/dist/forms/fileUpload/index.d.ts +2 -0
  82. package/dist/forms/fileUpload/index.d.ts.map +1 -0
  83. package/dist/forms/index.d.ts +3 -0
  84. package/dist/forms/index.d.ts.map +1 -1
  85. package/dist/forms/index.js +8 -4
  86. package/dist/forms/multiSelect/MultiSelect.d.ts +4 -5
  87. package/dist/forms/multiSelect/MultiSelect.d.ts.map +1 -1
  88. package/dist/forms/rangeCalendar/RangeCalendar.d.ts.map +1 -1
  89. package/dist/forms/select/Select.d.ts +5 -9
  90. package/dist/forms/select/Select.d.ts.map +1 -1
  91. package/dist/forms/tagsInput/TagsInput.d.ts +26 -0
  92. package/dist/forms/tagsInput/TagsInput.d.ts.map +1 -0
  93. package/dist/forms/tagsInput/index.d.ts +2 -0
  94. package/dist/forms/tagsInput/index.d.ts.map +1 -0
  95. package/dist/index.js +13 -9
  96. package/dist/layout/index.d.ts +1 -0
  97. package/dist/layout/index.d.ts.map +1 -1
  98. package/dist/layout/index.js +3 -1
  99. package/dist/layout/resizablePanels/ResizablePanels.d.ts +27 -0
  100. package/dist/layout/resizablePanels/ResizablePanels.d.ts.map +1 -0
  101. package/dist/layout/resizablePanels/index.d.ts +3 -0
  102. package/dist/layout/resizablePanels/index.d.ts.map +1 -0
  103. package/dist/nav/commandPalette/CommandPalette.d.ts +48 -0
  104. package/dist/nav/commandPalette/CommandPalette.d.ts.map +1 -0
  105. package/dist/nav/commandPalette/index.d.ts +3 -0
  106. package/dist/nav/commandPalette/index.d.ts.map +1 -0
  107. package/dist/nav/index.d.ts +1 -0
  108. package/dist/nav/index.d.ts.map +1 -1
  109. package/dist/nav/index.js +6 -3
  110. package/dist/overlays/OverlayChrome.d.ts +34 -0
  111. package/dist/overlays/OverlayChrome.d.ts.map +1 -0
  112. package/dist/overlays/dialog/Dialog.d.ts +7 -25
  113. package/dist/overlays/dialog/Dialog.d.ts.map +1 -1
  114. package/dist/overlays/dialog/index.d.ts +1 -1
  115. package/dist/overlays/dialog/index.d.ts.map +1 -1
  116. package/dist/overlays/drawer/Drawer.d.ts +7 -21
  117. package/dist/overlays/drawer/Drawer.d.ts.map +1 -1
  118. package/dist/overlays/drawer/index.d.ts +1 -1
  119. package/dist/overlays/drawer/index.d.ts.map +1 -1
  120. package/dist/overlays/index.js +5 -3
  121. package/dist/primitives/announce/Announce.d.ts +13 -0
  122. package/dist/primitives/announce/Announce.d.ts.map +1 -0
  123. package/dist/primitives/announce/index.d.ts +2 -0
  124. package/dist/primitives/announce/index.d.ts.map +1 -0
  125. package/dist/primitives/index.d.ts +1 -0
  126. package/dist/primitives/index.d.ts.map +1 -1
  127. package/dist/primitives/index.js +2 -2
  128. package/package.json +1 -1
  129. package/dist/chunk-A4N52LL6.js.map +0 -1
  130. package/dist/chunk-EU6JT5B4.js.map +0 -1
  131. package/dist/chunk-NKGNOOXJ.js +0 -330
  132. package/dist/chunk-NKGNOOXJ.js.map +0 -1
  133. package/dist/chunk-PRRVOVUC.js.map +0 -1
  134. package/dist/chunk-RIW2V3N4.js.map +0 -1
  135. package/dist/chunk-UGHPZ3I7.js.map +0 -1
  136. package/dist/chunk-ULAOIBCP.js.map +0 -1
  137. package/dist/chunk-YMSAS7M7.js.map +0 -1
@@ -1,16 +1,17 @@
1
- import { Popover, PopoverTrigger, PopoverContent } from './chunk-EU6JT5B4.js';
1
+ import { listboxVariants, listboxItemVariants, listboxGroupLabelVariants, listboxSeparatorVariants, listboxEmptyVariants } from './chunk-FFQENBTW.js';
2
+ import { PopoverTrigger, Popover, PopoverContent } from './chunk-2VAZKEQD.js';
3
+ import { Tag } from './chunk-ZCA365IX.js';
2
4
  import { useControlled } from './chunk-4P2TFUVW.js';
3
- import { useFormControl, FormControlProvider, RovingFocusGroup, useRovingFocusItem, Portal, AnchoredPositioner, DismissableLayer } from './chunk-YMSAS7M7.js';
4
- import { useId } from './chunk-KDXJQNB6.js';
5
5
  import { tv, dataAttr } from './chunk-BMBIZLO4.js';
6
6
  import { Icon } from './chunk-TDX22OWF.js';
7
+ import { useFormControl, FormControlProvider, RovingFocusGroup, useRovingFocusItem, Portal, AnchoredPositioner, DismissableLayer } from './chunk-NC2CBGX2.js';
7
8
  import { composeRefs } from './chunk-DN7WBRIV.js';
9
+ import { useId } from './chunk-KDXJQNB6.js';
8
10
  import { cn } from './chunk-KZ4VFY2T.js';
9
11
  import * as React from 'react';
10
12
  import { forwardRef, useRef, useImperativeHandle, useState, Children, isValidElement, cloneElement, useId as useId$1, createContext, useMemo, useCallback, useEffect, useContext } from 'react';
11
13
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
12
- import { Minus, Plus, EyeOff, Eye, Search, X, Check, Upload, ChevronDown, ChevronLeft, ChevronRight, Calendar as Calendar$1, Clock } from 'lucide-react';
13
- import { FocusScope } from '@radix-ui/react-focus-scope';
14
+ import { Minus, Plus, EyeOff, Eye, Search, X, Check, Upload, ChevronDown, Calendar as Calendar$1, Clock, UploadCloud, ChevronLeft, ChevronRight } from 'lucide-react';
14
15
 
15
16
  var Label = forwardRef(
16
17
  ({ className, required, htmlFor, id, children, ...props }, ref) => {
@@ -1116,32 +1117,6 @@ var FilePicker = forwardRef(
1116
1117
  }
1117
1118
  );
1118
1119
  FilePicker.displayName = "FilePicker";
1119
-
1120
- // src/forms/listbox/Listbox.variants.ts
1121
- var listboxVariants = tv({
1122
- base: "flex max-h-72 flex-col gap-0.5 overflow-y-auto rounded-md border border-border bg-popover p-1 text-sm text-popover-foreground shadow-md outline-none"
1123
- });
1124
- var listboxItemVariants = tv({
1125
- base: "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",
1126
- variants: {
1127
- state: {
1128
- default: "text-popover-foreground",
1129
- active: "bg-muted text-foreground",
1130
- selected: "bg-primary-soft text-primary-soft-foreground",
1131
- disabled: "pointer-events-none opacity-50"
1132
- }
1133
- },
1134
- defaultVariants: { state: "default" }
1135
- });
1136
- var listboxGroupLabelVariants = tv({
1137
- base: "px-2 py-1.5 text-xs font-semibold text-muted-foreground"
1138
- });
1139
- var listboxSeparatorVariants = tv({
1140
- base: "-mx-1 my-1 h-px bg-border"
1141
- });
1142
- var listboxEmptyVariants = tv({
1143
- base: "px-2 py-6 text-center text-sm text-muted-foreground"
1144
- });
1145
1120
  var ListboxContext = createContext(null);
1146
1121
  function useListboxContext() {
1147
1122
  const ctx = useContext(ListboxContext);
@@ -1389,6 +1364,7 @@ function Select({
1389
1364
  defaultOpen = false,
1390
1365
  open: openProp,
1391
1366
  onOpenChange,
1367
+ placement = "bottom",
1392
1368
  children
1393
1369
  }) {
1394
1370
  const [openState, setOpenState] = useControlled({
@@ -1401,7 +1377,6 @@ function Select({
1401
1377
  default: defaultValue ?? "",
1402
1378
  onChange: onValueChange
1403
1379
  });
1404
- const triggerRef = useRef(null);
1405
1380
  const [labels, setLabels] = useState({});
1406
1381
  const registerLabel = useCallback((v, label) => {
1407
1382
  setLabels((prev) => prev[v] === label ? prev : { ...prev, [v]: label });
@@ -1418,7 +1393,6 @@ function Select({
1418
1393
  (next) => {
1419
1394
  setValueState(next);
1420
1395
  setOpenState(false);
1421
- requestAnimationFrame(() => triggerRef.current?.focus());
1422
1396
  },
1423
1397
  [setValueState, setOpenState]
1424
1398
  );
@@ -1428,7 +1402,6 @@ function Select({
1428
1402
  setOpen: setOpenState,
1429
1403
  value: valueState,
1430
1404
  onSelect,
1431
- triggerRef,
1432
1405
  labels,
1433
1406
  registerLabel,
1434
1407
  unregisterLabel,
@@ -1449,26 +1422,27 @@ function Select({
1449
1422
  invalid
1450
1423
  ]
1451
1424
  );
1452
- return /* @__PURE__ */ jsx(SelectContext.Provider, { value: ctx, children });
1425
+ return /* @__PURE__ */ jsx(SelectContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
1426
+ Popover,
1427
+ {
1428
+ open: openState,
1429
+ onOpenChange: setOpenState,
1430
+ placement,
1431
+ offset: 6,
1432
+ children
1433
+ }
1434
+ ) });
1453
1435
  }
1454
1436
  var SelectTrigger = forwardRef(
1455
- function SelectTrigger2({ size, state, className, onClick, children, ...rest }, forwardedRef) {
1437
+ function SelectTrigger2({ size, state, className, children, ...rest }, ref) {
1456
1438
  const ctx = useSelectContext();
1457
1439
  const triggerState = state ?? (ctx.invalid ? "invalid" : "default");
1458
- return /* @__PURE__ */ jsxs(
1440
+ return /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
1459
1441
  "button",
1460
1442
  {
1461
- ref: composeRefs(forwardedRef, ctx.triggerRef),
1443
+ ref,
1462
1444
  type: "button",
1463
- "aria-haspopup": "listbox",
1464
- "aria-expanded": ctx.open,
1465
- "data-state": ctx.open ? "open" : "closed",
1466
1445
  disabled: ctx.disabled,
1467
- onClick: (e) => {
1468
- onClick?.(e);
1469
- if (e.defaultPrevented) return;
1470
- ctx.setOpen(!ctx.open);
1471
- },
1472
1446
  className: cn(selectTriggerVariants({ size, state: triggerState }), className),
1473
1447
  ...rest,
1474
1448
  children: [
@@ -1484,7 +1458,7 @@ var SelectTrigger = forwardRef(
1484
1458
  )
1485
1459
  ]
1486
1460
  }
1487
- );
1461
+ ) });
1488
1462
  }
1489
1463
  );
1490
1464
  function SelectValue({ placeholder, children }) {
@@ -1493,35 +1467,18 @@ function SelectValue({ placeholder, children }) {
1493
1467
  const label = ctx.value ? ctx.labels[ctx.value] ?? ctx.value : null;
1494
1468
  return /* @__PURE__ */ jsx("span", { className: cn("truncate", !label && "text-subtle-foreground"), children: label ?? placeholder });
1495
1469
  }
1496
- function SelectContent({
1497
- className,
1498
- placement = "bottom",
1499
- offset = 6,
1500
- children
1501
- }) {
1470
+ function SelectContent({ className, children }) {
1502
1471
  const ctx = useSelectContext();
1503
- if (!ctx.open) return null;
1504
- return /* @__PURE__ */ jsxs(Portal, { children: [
1505
- /* @__PURE__ */ jsx(AnchoredPositioner, { anchor: ctx.triggerRef.current, placement, offset, children: /* @__PURE__ */ jsx(FocusScope, { asChild: true, trapped: true, loop: true, children: /* @__PURE__ */ jsx(
1506
- DismissableLayer,
1472
+ return /* @__PURE__ */ jsxs(PopoverContent, { bare: true, children: [
1473
+ /* @__PURE__ */ jsx(
1474
+ Listbox,
1507
1475
  {
1508
- onEscape: () => ctx.setOpen(false),
1509
- onOutsidePointerDown: (e) => {
1510
- if (ctx.triggerRef.current?.contains(e.target)) return;
1511
- ctx.setOpen(false);
1512
- },
1513
- children: /* @__PURE__ */ jsx(
1514
- Listbox,
1515
- {
1516
- value: ctx.value,
1517
- onValueChange: (v) => ctx.onSelect(v),
1518
- className: cn("min-w-[var(--radix-anchor-width)]", className),
1519
- style: ctx.triggerRef.current ? { minWidth: ctx.triggerRef.current.offsetWidth } : void 0,
1520
- children
1521
- }
1522
- )
1476
+ value: ctx.value,
1477
+ onValueChange: (v) => ctx.onSelect(v),
1478
+ className: cn("min-w-[var(--anchor-width)]", className),
1479
+ children
1523
1480
  }
1524
- ) }) }),
1481
+ ),
1525
1482
  ctx.name && /* @__PURE__ */ jsx("input", { type: "hidden", name: ctx.name, value: ctx.value })
1526
1483
  ] });
1527
1484
  }
@@ -1556,6 +1513,7 @@ function MultiSelect({
1556
1513
  defaultOpen = false,
1557
1514
  open: openProp,
1558
1515
  onOpenChange,
1516
+ placement = "bottom",
1559
1517
  children
1560
1518
  }) {
1561
1519
  const [openState, setOpenState] = useControlled({
@@ -1568,7 +1526,6 @@ function MultiSelect({
1568
1526
  default: defaultValue ?? [],
1569
1527
  onChange: onValueChange
1570
1528
  });
1571
- const triggerRef = useRef(null);
1572
1529
  const [labels, setLabels] = useState({});
1573
1530
  const registerLabel = useCallback((v, label) => {
1574
1531
  setLabels((prev) => prev[v] === label ? prev : { ...prev, [v]: label });
@@ -1587,7 +1544,6 @@ function MultiSelect({
1587
1544
  setOpen: setOpenState,
1588
1545
  values: valuesState,
1589
1546
  setValues: setValuesState,
1590
- triggerRef,
1591
1547
  labels,
1592
1548
  registerLabel,
1593
1549
  unregisterLabel,
@@ -1608,26 +1564,27 @@ function MultiSelect({
1608
1564
  invalid
1609
1565
  ]
1610
1566
  );
1611
- return /* @__PURE__ */ jsx(MultiSelectContext.Provider, { value: ctx, children });
1567
+ return /* @__PURE__ */ jsx(MultiSelectContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
1568
+ Popover,
1569
+ {
1570
+ open: openState,
1571
+ onOpenChange: setOpenState,
1572
+ placement,
1573
+ offset: 6,
1574
+ children
1575
+ }
1576
+ ) });
1612
1577
  }
1613
1578
  var MultiSelectTrigger = forwardRef(
1614
- function MultiSelectTrigger2({ size, state, className, onClick, onKeyDown, children, ...rest }, forwardedRef) {
1579
+ function MultiSelectTrigger2({ size, state, className, onKeyDown, children, ...rest }, ref) {
1615
1580
  const ctx = useMultiSelectContext();
1616
1581
  const triggerState = state ?? (ctx.invalid ? "invalid" : "default");
1617
- return /* @__PURE__ */ jsxs(
1582
+ return /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
1618
1583
  "button",
1619
1584
  {
1620
- ref: composeRefs(forwardedRef, ctx.triggerRef),
1585
+ ref,
1621
1586
  type: "button",
1622
- "aria-haspopup": "listbox",
1623
- "aria-expanded": ctx.open,
1624
- "data-state": ctx.open ? "open" : "closed",
1625
1587
  disabled: ctx.disabled,
1626
- onClick: (e) => {
1627
- onClick?.(e);
1628
- if (e.defaultPrevented) return;
1629
- ctx.setOpen(!ctx.open);
1630
- },
1631
1588
  onKeyDown: (e) => {
1632
1589
  onKeyDown?.(e);
1633
1590
  if (e.defaultPrevented) return;
@@ -1654,7 +1611,7 @@ var MultiSelectTrigger = forwardRef(
1654
1611
  )
1655
1612
  ]
1656
1613
  }
1657
- );
1614
+ ) });
1658
1615
  }
1659
1616
  );
1660
1617
  function MultiSelectTags({ placeholder }) {
@@ -1688,39 +1645,19 @@ function MultiSelectTags({ placeholder }) {
1688
1645
  v
1689
1646
  )) });
1690
1647
  }
1691
- function MultiSelectContent({
1692
- className,
1693
- placement = "bottom",
1694
- offset = 6,
1695
- children
1696
- }) {
1648
+ function MultiSelectContent({ className, children }) {
1697
1649
  const ctx = useMultiSelectContext();
1698
- if (!ctx.open) return null;
1699
- return /* @__PURE__ */ jsxs(Portal, { children: [
1700
- /* @__PURE__ */ jsx(AnchoredPositioner, { anchor: ctx.triggerRef.current, placement, offset, children: /* @__PURE__ */ jsx(FocusScope, { asChild: true, trapped: true, loop: true, children: /* @__PURE__ */ jsx(
1701
- DismissableLayer,
1650
+ return /* @__PURE__ */ jsxs(PopoverContent, { bare: true, children: [
1651
+ /* @__PURE__ */ jsx(
1652
+ Listbox,
1702
1653
  {
1703
- onEscape: () => {
1704
- ctx.setOpen(false);
1705
- requestAnimationFrame(() => ctx.triggerRef.current?.focus());
1706
- },
1707
- onOutsidePointerDown: (e) => {
1708
- if (ctx.triggerRef.current?.contains(e.target)) return;
1709
- ctx.setOpen(false);
1710
- },
1711
- children: /* @__PURE__ */ jsx(
1712
- Listbox,
1713
- {
1714
- multiple: true,
1715
- value: ctx.values,
1716
- onValueChange: (v) => ctx.setValues(v),
1717
- className: cn(className),
1718
- style: ctx.triggerRef.current ? { minWidth: ctx.triggerRef.current.offsetWidth } : void 0,
1719
- children
1720
- }
1721
- )
1654
+ multiple: true,
1655
+ value: ctx.values,
1656
+ onValueChange: (v) => ctx.setValues(v),
1657
+ className: cn("min-w-[var(--anchor-width)]", className),
1658
+ children
1722
1659
  }
1723
- ) }) }),
1660
+ ),
1724
1661
  ctx.name && ctx.values.map((v) => /* @__PURE__ */ jsx("input", { type: "hidden", name: ctx.name, value: v }, v))
1725
1662
  ] });
1726
1663
  }
@@ -2130,29 +2067,17 @@ function isInRange(d, start, end) {
2130
2067
  const e = startOfDay(end).getTime();
2131
2068
  return t >= Math.min(s, e) && t <= Math.max(s, e);
2132
2069
  }
2133
- var Calendar = forwardRef(function Calendar2({
2134
- value,
2135
- defaultValue,
2136
- onChange,
2137
- defaultMonth,
2138
- min,
2139
- max,
2140
- isDisabled,
2070
+ function MonthGrid({
2071
+ viewMonth,
2072
+ onViewMonthChange,
2073
+ focusedDate,
2074
+ onFocusedDateChange,
2075
+ isDayDisabled,
2076
+ onDayActivate,
2077
+ dayProps,
2141
2078
  "aria-label": ariaLabel = "Calendar",
2142
- className,
2143
- ...rest
2144
- }, ref) {
2145
- const [selected, setSelected] = useControlled({
2146
- controlled: value,
2147
- default: defaultValue ?? null,
2148
- onChange
2149
- });
2150
- const [viewMonth, setViewMonth] = useState(
2151
- () => startOfMonth(defaultMonth ?? selected ?? /* @__PURE__ */ new Date())
2152
- );
2153
- const [focusedDate, setFocusedDate] = useState(
2154
- () => selected ?? /* @__PURE__ */ new Date()
2155
- );
2079
+ className
2080
+ }) {
2156
2081
  const gridRef = useRef(null);
2157
2082
  useEffect(() => {
2158
2083
  const cell = gridRef.current?.querySelector(
@@ -2163,14 +2088,14 @@ var Calendar = forwardRef(function Calendar2({
2163
2088
  const moveFocus = useCallback(
2164
2089
  (next) => {
2165
2090
  if (next.getMonth() !== viewMonth.getMonth() || next.getFullYear() !== viewMonth.getFullYear()) {
2166
- setViewMonth(startOfMonth(next));
2091
+ onViewMonthChange(startOfMonth(next));
2167
2092
  }
2168
- setFocusedDate(next);
2093
+ onFocusedDateChange(next);
2169
2094
  },
2170
- [viewMonth]
2095
+ [viewMonth, onViewMonthChange, onFocusedDateChange]
2171
2096
  );
2172
2097
  const onCellKeyDown = useCallback(
2173
- (e, date) => {
2098
+ (e, date, outOfMonth) => {
2174
2099
  switch (e.key) {
2175
2100
  case "ArrowRight":
2176
2101
  e.preventDefault();
@@ -2207,26 +2132,22 @@ var Calendar = forwardRef(function Calendar2({
2207
2132
  case "Enter":
2208
2133
  case " ":
2209
2134
  e.preventDefault();
2210
- if (!isDateDisabled(date, { min, max, isDisabled })) {
2211
- setSelected(date);
2212
- }
2135
+ if (!isDayDisabled?.(date)) onDayActivate?.(date, { outOfMonth });
2213
2136
  break;
2214
2137
  }
2215
2138
  },
2216
- [moveFocus, setSelected, min, max, isDisabled]
2139
+ [moveFocus, onDayActivate, isDayDisabled]
2217
2140
  );
2218
2141
  const cells = buildMonthGrid(viewMonth.getFullYear(), viewMonth.getMonth());
2219
2142
  return /* @__PURE__ */ jsxs(
2220
2143
  "div",
2221
2144
  {
2222
- ref,
2223
2145
  role: "application",
2224
2146
  "aria-label": ariaLabel,
2225
2147
  className: cn(
2226
2148
  "inline-flex flex-col gap-2 rounded-md border border-border bg-popover p-3 text-popover-foreground",
2227
2149
  className
2228
2150
  ),
2229
- ...rest,
2230
2151
  children: [
2231
2152
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 px-1", children: [
2232
2153
  /* @__PURE__ */ jsx(
@@ -2234,7 +2155,7 @@ var Calendar = forwardRef(function Calendar2({
2234
2155
  {
2235
2156
  type: "button",
2236
2157
  "aria-label": "Previous month",
2237
- onClick: () => setViewMonth((m) => addMonths(m, -1)),
2158
+ onClick: () => onViewMonthChange(addMonths(viewMonth, -1)),
2238
2159
  className: "grid h-7 w-7 place-items-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2239
2160
  children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
2240
2161
  }
@@ -2249,7 +2170,7 @@ var Calendar = forwardRef(function Calendar2({
2249
2170
  {
2250
2171
  type: "button",
2251
2172
  "aria-label": "Next month",
2252
- onClick: () => setViewMonth((m) => addMonths(m, 1)),
2173
+ onClick: () => onViewMonthChange(addMonths(viewMonth, 1)),
2253
2174
  className: "grid h-7 w-7 place-items-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2254
2175
  children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
2255
2176
  }
@@ -2264,18 +2185,17 @@ var Calendar = forwardRef(function Calendar2({
2264
2185
  w
2265
2186
  )) }),
2266
2187
  /* @__PURE__ */ jsx("div", { ref: gridRef, className: "grid grid-cols-7 gap-0 px-1", role: "grid", children: cells.map(({ date, outOfMonth }) => {
2267
- const disabled = isDateDisabled(date, { min, max, isDisabled });
2268
- const isSelectedCell = isSameDay(selected, date);
2188
+ const disabled = isDayDisabled?.(date) ?? false;
2269
2189
  const isFocusedCell = isSameDay(focusedDate, date);
2190
+ const consumerProps = dayProps?.(date, { outOfMonth }) ?? {};
2191
+ const { className: cellClassName, ...consumerRest } = consumerProps;
2270
2192
  return /* @__PURE__ */ jsx(
2271
2193
  "button",
2272
2194
  {
2273
2195
  type: "button",
2274
2196
  role: "gridcell",
2275
2197
  "data-date": date.toDateString(),
2276
- "aria-selected": isSelectedCell,
2277
2198
  "aria-disabled": disabled || void 0,
2278
- "data-selected": isSelectedCell ? "" : void 0,
2279
2199
  "data-today": isToday(date) ? "" : void 0,
2280
2200
  "data-out-of-month": outOfMonth ? "" : void 0,
2281
2201
  "data-disabled": disabled ? "" : void 0,
@@ -2283,19 +2203,19 @@ var Calendar = forwardRef(function Calendar2({
2283
2203
  disabled,
2284
2204
  onClick: () => {
2285
2205
  if (disabled) return;
2286
- setSelected(date);
2287
- setFocusedDate(date);
2288
- if (outOfMonth) setViewMonth(startOfMonth(date));
2206
+ onDayActivate?.(date, { outOfMonth });
2207
+ onFocusedDateChange(date);
2208
+ if (outOfMonth) onViewMonthChange(startOfMonth(date));
2289
2209
  },
2290
- onKeyDown: (e) => onCellKeyDown(e, date),
2210
+ onKeyDown: (e) => onCellKeyDown(e, date, outOfMonth),
2211
+ ...consumerRest,
2291
2212
  className: cn(
2292
- "grid h-9 w-9 place-items-center rounded-sm text-sm transition-colors",
2213
+ "grid h-9 w-9 place-items-center text-sm transition-colors",
2293
2214
  "hover:bg-muted hover:text-foreground",
2294
2215
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2295
2216
  outOfMonth && "text-muted-foreground/60",
2296
- isToday(date) && !isSelectedCell && "border border-border",
2297
- isSelectedCell && "bg-primary text-primary-foreground hover:bg-primary",
2298
- disabled && "pointer-events-none opacity-40"
2217
+ disabled && "pointer-events-none opacity-40",
2218
+ cellClassName
2299
2219
  ),
2300
2220
  children: date.getDate()
2301
2221
  },
@@ -2305,6 +2225,52 @@ var Calendar = forwardRef(function Calendar2({
2305
2225
  ]
2306
2226
  }
2307
2227
  );
2228
+ }
2229
+ var Calendar = forwardRef(function Calendar2({
2230
+ value,
2231
+ defaultValue,
2232
+ onChange,
2233
+ defaultMonth,
2234
+ min,
2235
+ max,
2236
+ isDisabled,
2237
+ "aria-label": ariaLabel = "Calendar",
2238
+ className,
2239
+ ...rest
2240
+ }, ref) {
2241
+ const [selected, setSelected] = useControlled({
2242
+ controlled: value,
2243
+ default: defaultValue ?? null,
2244
+ onChange
2245
+ });
2246
+ const [viewMonth, setViewMonth] = useState(
2247
+ () => startOfMonth(defaultMonth ?? selected ?? /* @__PURE__ */ new Date())
2248
+ );
2249
+ const [focusedDate, setFocusedDate] = useState(() => selected ?? /* @__PURE__ */ new Date());
2250
+ return /* @__PURE__ */ jsx("div", { ref, className: cn(className), ...rest, children: /* @__PURE__ */ jsx(
2251
+ MonthGrid,
2252
+ {
2253
+ viewMonth,
2254
+ onViewMonthChange: setViewMonth,
2255
+ focusedDate,
2256
+ onFocusedDateChange: setFocusedDate,
2257
+ isDayDisabled: (d) => isDateDisabled(d, { min, max, isDisabled }),
2258
+ onDayActivate: (d) => setSelected(d),
2259
+ dayProps: (date) => {
2260
+ const isSelectedCell = isSameDay(selected, date);
2261
+ return {
2262
+ "aria-selected": isSelectedCell,
2263
+ "data-selected": isSelectedCell ? "" : void 0,
2264
+ className: cn(
2265
+ "rounded-sm",
2266
+ isToday(date) && !isSelectedCell && "border border-border",
2267
+ isSelectedCell && "bg-primary text-primary-foreground hover:bg-primary"
2268
+ )
2269
+ };
2270
+ },
2271
+ "aria-label": ariaLabel
2272
+ }
2273
+ ) });
2308
2274
  });
2309
2275
  var DateField = forwardRef(function DateField2({ value, defaultValue, onChange, min, max, size, state, className, id, disabled, required, ...rest }, ref) {
2310
2276
  const ctx = useFormControl();
@@ -2383,190 +2349,59 @@ var RangeCalendar = forwardRef(
2383
2349
  const [viewMonth, setViewMonth] = useState(
2384
2350
  () => startOfMonth(defaultMonth ?? range?.start ?? /* @__PURE__ */ new Date())
2385
2351
  );
2386
- const [focusedDate, setFocusedDate] = useState(
2387
- () => range?.start ?? /* @__PURE__ */ new Date()
2388
- );
2352
+ const [focusedDate, setFocusedDate] = useState(() => range?.start ?? /* @__PURE__ */ new Date());
2389
2353
  const [hoveredDate, setHoveredDate] = useState(null);
2390
2354
  const [pendingStart, setPendingStart] = useState(null);
2391
- const gridRef = useRef(null);
2392
- useEffect(() => {
2393
- const cell = gridRef.current?.querySelector(
2394
- `[data-date="${focusedDate.toDateString()}"]`
2395
- );
2396
- cell?.focus();
2397
- }, [focusedDate]);
2398
- const moveFocus = useCallback(
2399
- (next) => {
2400
- if (next.getMonth() !== viewMonth.getMonth() || next.getFullYear() !== viewMonth.getFullYear()) {
2401
- setViewMonth(startOfMonth(next));
2402
- }
2403
- setFocusedDate(next);
2404
- },
2405
- [viewMonth]
2406
- );
2407
- const onSelectDay = useCallback(
2408
- (date) => {
2409
- if (isDateDisabled(date, { min, max, isDisabled })) return;
2410
- if (!pendingStart) {
2411
- setPendingStart(date);
2412
- setRange({ start: date, end: null });
2413
- return;
2414
- }
2415
- const startTime = startOfDay(pendingStart).getTime();
2416
- const endTime = startOfDay(date).getTime();
2417
- const finalStart = startTime <= endTime ? pendingStart : date;
2418
- const finalEnd = startTime <= endTime ? date : pendingStart;
2419
- setRange({ start: finalStart, end: finalEnd });
2420
- setPendingStart(null);
2421
- },
2422
- [pendingStart, setRange, min, max, isDisabled]
2423
- );
2424
- const onCellKeyDown = useCallback(
2425
- (e, date) => {
2426
- switch (e.key) {
2427
- case "ArrowRight":
2428
- e.preventDefault();
2429
- moveFocus(addDays(date, 1));
2430
- break;
2431
- case "ArrowLeft":
2432
- e.preventDefault();
2433
- moveFocus(addDays(date, -1));
2434
- break;
2435
- case "ArrowDown":
2436
- e.preventDefault();
2437
- moveFocus(addDays(date, 7));
2438
- break;
2439
- case "ArrowUp":
2440
- e.preventDefault();
2441
- moveFocus(addDays(date, -7));
2442
- break;
2443
- case "Home":
2444
- e.preventDefault();
2445
- moveFocus(addDays(date, -date.getDay()));
2446
- break;
2447
- case "End":
2448
- e.preventDefault();
2449
- moveFocus(addDays(date, 6 - date.getDay()));
2450
- break;
2451
- case "PageDown":
2452
- e.preventDefault();
2453
- moveFocus(addMonths(date, e.shiftKey ? 12 : 1));
2454
- break;
2455
- case "PageUp":
2456
- e.preventDefault();
2457
- moveFocus(addMonths(date, e.shiftKey ? -12 : -1));
2458
- break;
2459
- case "Enter":
2460
- case " ":
2461
- e.preventDefault();
2462
- onSelectDay(date);
2463
- break;
2464
- }
2465
- },
2466
- [moveFocus, onSelectDay]
2467
- );
2468
- const cells = buildMonthGrid(viewMonth.getFullYear(), viewMonth.getMonth());
2355
+ const handleActivate = (date) => {
2356
+ if (!pendingStart) {
2357
+ setPendingStart(date);
2358
+ setRange({ start: date, end: null });
2359
+ return;
2360
+ }
2361
+ const startTime = startOfDay(pendingStart).getTime();
2362
+ const endTime = startOfDay(date).getTime();
2363
+ const finalStart = startTime <= endTime ? pendingStart : date;
2364
+ const finalEnd = startTime <= endTime ? date : pendingStart;
2365
+ setRange({ start: finalStart, end: finalEnd });
2366
+ setPendingStart(null);
2367
+ };
2469
2368
  const previewEnd = pendingStart ? hoveredDate : range?.end;
2470
2369
  const isStart = (d) => isSameDay(d, range?.start ?? null) || isSameDay(d, pendingStart);
2471
2370
  const isEnd = (d) => isSameDay(d, range?.end ?? null);
2472
2371
  const inRange = (d) => isInRange(d, pendingStart ?? range?.start, previewEnd ?? null);
2473
- return /* @__PURE__ */ jsxs(
2474
- "div",
2372
+ return /* @__PURE__ */ jsx("div", { ref, className: cn(className), ...rest, children: /* @__PURE__ */ jsx(
2373
+ MonthGrid,
2475
2374
  {
2476
- ref,
2477
- role: "application",
2478
- "aria-label": ariaLabel,
2479
- className: cn(
2480
- "inline-flex flex-col gap-2 rounded-md border border-border bg-popover p-3 text-popover-foreground",
2481
- className
2482
- ),
2483
- ...rest,
2484
- children: [
2485
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 px-1", children: [
2486
- /* @__PURE__ */ jsx(
2487
- "button",
2488
- {
2489
- type: "button",
2490
- "aria-label": "Previous month",
2491
- onClick: () => setViewMonth((m) => addMonths(m, -1)),
2492
- className: "grid h-7 w-7 place-items-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2493
- children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
2494
- }
2495
- ),
2496
- /* @__PURE__ */ jsxs("div", { className: "text-sm font-medium", "aria-live": "polite", children: [
2497
- MONTHS_LONG[viewMonth.getMonth()],
2498
- " ",
2499
- viewMonth.getFullYear()
2500
- ] }),
2501
- /* @__PURE__ */ jsx(
2502
- "button",
2503
- {
2504
- type: "button",
2505
- "aria-label": "Next month",
2506
- onClick: () => setViewMonth((m) => addMonths(m, 1)),
2507
- className: "grid h-7 w-7 place-items-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2508
- children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
2509
- }
2375
+ viewMonth,
2376
+ onViewMonthChange: setViewMonth,
2377
+ focusedDate,
2378
+ onFocusedDateChange: setFocusedDate,
2379
+ isDayDisabled: (d) => isDateDisabled(d, { min, max, isDisabled }),
2380
+ onDayActivate: handleActivate,
2381
+ dayProps: (date) => {
2382
+ const startCell = isStart(date);
2383
+ const endCell = isEnd(date);
2384
+ const rangeCell = inRange(date) && !startCell && !endCell;
2385
+ const selected = startCell || endCell;
2386
+ return {
2387
+ "aria-selected": selected,
2388
+ "data-range-start": startCell ? "" : void 0,
2389
+ "data-range-end": endCell ? "" : void 0,
2390
+ "data-in-range": rangeCell ? "" : void 0,
2391
+ onPointerEnter: () => setHoveredDate(date),
2392
+ onPointerLeave: () => setHoveredDate((h) => isSameDay(h, date) ? null : h),
2393
+ className: cn(
2394
+ isToday(date) && !startCell && !endCell && "border border-border rounded-sm",
2395
+ rangeCell && "bg-primary-soft text-primary-soft-foreground",
2396
+ startCell && "bg-primary text-primary-foreground rounded-l-sm",
2397
+ endCell && "bg-primary text-primary-foreground rounded-r-sm",
2398
+ !startCell && !endCell && !rangeCell && "rounded-sm"
2510
2399
  )
2511
- ] }),
2512
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-0 px-1", children: WEEKDAYS_SHORT.map((w) => /* @__PURE__ */ jsx(
2513
- "div",
2514
- {
2515
- className: "grid h-7 w-9 place-items-center text-xs font-medium text-muted-foreground",
2516
- children: w
2517
- },
2518
- w
2519
- )) }),
2520
- /* @__PURE__ */ jsx("div", { ref: gridRef, className: "grid grid-cols-7 gap-0 px-1", role: "grid", children: cells.map(({ date, outOfMonth }) => {
2521
- const disabled = isDateDisabled(date, { min, max, isDisabled });
2522
- const startCell = isStart(date);
2523
- const endCell = isEnd(date);
2524
- const rangeCell = inRange(date) && !startCell && !endCell;
2525
- const isFocusedCell = isSameDay(focusedDate, date);
2526
- return /* @__PURE__ */ jsx(
2527
- "button",
2528
- {
2529
- type: "button",
2530
- role: "gridcell",
2531
- "data-date": date.toDateString(),
2532
- "data-range-start": startCell ? "" : void 0,
2533
- "data-range-end": endCell ? "" : void 0,
2534
- "data-in-range": rangeCell ? "" : void 0,
2535
- "data-today": isToday(date) ? "" : void 0,
2536
- "data-out-of-month": outOfMonth ? "" : void 0,
2537
- "data-disabled": disabled ? "" : void 0,
2538
- "aria-selected": startCell || endCell,
2539
- "aria-disabled": disabled || void 0,
2540
- tabIndex: isFocusedCell ? 0 : -1,
2541
- disabled,
2542
- onPointerEnter: () => setHoveredDate(date),
2543
- onPointerLeave: () => setHoveredDate((h) => isSameDay(h, date) ? null : h),
2544
- onClick: () => {
2545
- onSelectDay(date);
2546
- setFocusedDate(date);
2547
- if (outOfMonth) setViewMonth(startOfMonth(date));
2548
- },
2549
- onKeyDown: (e) => onCellKeyDown(e, date),
2550
- className: cn(
2551
- "grid h-9 w-9 place-items-center text-sm transition-colors",
2552
- "hover:bg-muted hover:text-foreground",
2553
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2554
- outOfMonth && "text-muted-foreground/60",
2555
- isToday(date) && !startCell && !endCell && "border border-border rounded-sm",
2556
- rangeCell && "bg-primary-soft text-primary-soft-foreground",
2557
- startCell && "bg-primary text-primary-foreground rounded-l-sm",
2558
- endCell && "bg-primary text-primary-foreground rounded-r-sm",
2559
- !startCell && !endCell && !rangeCell && "rounded-sm",
2560
- disabled && "pointer-events-none opacity-40"
2561
- ),
2562
- children: date.getDate()
2563
- },
2564
- date.toDateString()
2565
- );
2566
- }) })
2567
- ]
2400
+ };
2401
+ },
2402
+ "aria-label": ariaLabel
2568
2403
  }
2569
- );
2404
+ ) });
2570
2405
  }
2571
2406
  );
2572
2407
  var defaultFormat = (d) => d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
@@ -3866,7 +3701,546 @@ var StepperPanel = forwardRef(function StepperPanel2({ value, className, childre
3866
3701
  Stepper.List = StepperList;
3867
3702
  Stepper.Step = StepperStep;
3868
3703
  Stepper.Panel = StepperPanel;
3704
+ var TagsInput = forwardRef(function TagsInput2({
3705
+ value,
3706
+ defaultValue,
3707
+ onValueChange,
3708
+ inputValue,
3709
+ onInputChange,
3710
+ placeholder = "Add tag\u2026",
3711
+ delimiters = [","],
3712
+ validate = (t) => t.trim().length > 0,
3713
+ allowDuplicates = false,
3714
+ max,
3715
+ invalid,
3716
+ disabled,
3717
+ readOnly,
3718
+ name,
3719
+ tagVariant = "neutral",
3720
+ size,
3721
+ className,
3722
+ onKeyDown,
3723
+ onBlur,
3724
+ ...rest
3725
+ }, forwardedRef) {
3726
+ const [tags, setTags] = useControlled({
3727
+ controlled: value,
3728
+ default: defaultValue ?? [],
3729
+ onChange: onValueChange
3730
+ });
3731
+ const [text, setText] = useControlled({
3732
+ controlled: inputValue,
3733
+ default: "",
3734
+ onChange: onInputChange
3735
+ });
3736
+ const inputRef = useRef(null);
3737
+ const [pendingDelete, setPendingDelete] = useState(false);
3738
+ const state = invalid ? "invalid" : "default";
3739
+ const commit = useCallback(
3740
+ (raw) => {
3741
+ const trimmed = raw.trim();
3742
+ if (!trimmed || !validate(trimmed)) return;
3743
+ if (!allowDuplicates && tags.includes(trimmed)) return;
3744
+ if (max != null && tags.length >= max) return;
3745
+ setTags([...tags, trimmed]);
3746
+ setText("");
3747
+ },
3748
+ [tags, validate, allowDuplicates, max, setTags, setText]
3749
+ );
3750
+ const removeAt = useCallback(
3751
+ (idx) => {
3752
+ setTags(tags.filter((_, i) => i !== idx));
3753
+ },
3754
+ [tags, setTags]
3755
+ );
3756
+ const handleKeyDown = (e) => {
3757
+ onKeyDown?.(e);
3758
+ if (e.defaultPrevented || disabled || readOnly) return;
3759
+ if (e.key === "Enter" || e.key === "Tab" && text) {
3760
+ if (text) {
3761
+ e.preventDefault();
3762
+ commit(text);
3763
+ setPendingDelete(false);
3764
+ }
3765
+ return;
3766
+ }
3767
+ if (delimiters.includes(e.key)) {
3768
+ e.preventDefault();
3769
+ commit(text);
3770
+ setPendingDelete(false);
3771
+ return;
3772
+ }
3773
+ if (e.key === "Backspace" && !text && tags.length > 0) {
3774
+ if (pendingDelete) {
3775
+ e.preventDefault();
3776
+ removeAt(tags.length - 1);
3777
+ setPendingDelete(false);
3778
+ } else {
3779
+ setPendingDelete(true);
3780
+ }
3781
+ return;
3782
+ }
3783
+ setPendingDelete(false);
3784
+ };
3785
+ const handleContainerClick = (e) => {
3786
+ if (e.target === e.currentTarget) inputRef.current?.focus();
3787
+ };
3788
+ return /* @__PURE__ */ jsxs(
3789
+ "div",
3790
+ {
3791
+ role: "group",
3792
+ onClick: handleContainerClick,
3793
+ "data-disabled": disabled || void 0,
3794
+ "data-readonly": readOnly || void 0,
3795
+ "data-invalid": invalid || void 0,
3796
+ className: cn(
3797
+ inputBaseVariants({ size, state }),
3798
+ "h-auto min-h-10 flex-wrap items-center gap-1.5 py-1.5",
3799
+ disabled && "cursor-not-allowed opacity-60",
3800
+ className
3801
+ ),
3802
+ children: [
3803
+ tags.map((t, i) => /* @__PURE__ */ jsx(
3804
+ Tag,
3805
+ {
3806
+ variant: tagVariant,
3807
+ "data-pending-delete": pendingDelete && i === tags.length - 1 ? "" : void 0,
3808
+ onClose: !disabled && !readOnly ? () => removeAt(i) : void 0,
3809
+ className: cn(pendingDelete && i === tags.length - 1 && "ring-1 ring-ring"),
3810
+ children: t
3811
+ },
3812
+ `${t}-${i}`
3813
+ )),
3814
+ /* @__PURE__ */ jsx(
3815
+ "input",
3816
+ {
3817
+ ...rest,
3818
+ ref: composeRefs(forwardedRef, inputRef),
3819
+ type: "text",
3820
+ value: text,
3821
+ placeholder: tags.length === 0 ? placeholder : void 0,
3822
+ disabled,
3823
+ readOnly,
3824
+ "aria-invalid": invalid || void 0,
3825
+ onChange: (e) => setText(e.target.value),
3826
+ onKeyDown: handleKeyDown,
3827
+ onBlur: (e) => {
3828
+ onBlur?.(e);
3829
+ if (text) commit(text);
3830
+ setPendingDelete(false);
3831
+ },
3832
+ className: "min-w-[6rem] flex-1 border-0 bg-transparent p-0 text-sm outline-none placeholder:text-subtle-foreground disabled:cursor-not-allowed"
3833
+ }
3834
+ ),
3835
+ name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: tags.join(",") })
3836
+ ]
3837
+ }
3838
+ );
3839
+ });
3840
+ TagsInput.displayName = "TagsInput";
3841
+ function matchesAccept(file, accept) {
3842
+ if (!accept) return true;
3843
+ const tokens = accept.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
3844
+ if (tokens.length === 0) return true;
3845
+ const fileType = file.type.toLowerCase();
3846
+ const fileName = file.name.toLowerCase();
3847
+ return tokens.some((t) => {
3848
+ if (t.startsWith(".")) return fileName.endsWith(t);
3849
+ if (t.endsWith("/*")) return fileType.startsWith(t.slice(0, -1));
3850
+ return fileType === t;
3851
+ });
3852
+ }
3853
+ var FileUpload = forwardRef(function FileUpload2({
3854
+ accept,
3855
+ multiple = false,
3856
+ maxSize,
3857
+ maxFiles,
3858
+ onFilesChange,
3859
+ disabled,
3860
+ invalid,
3861
+ label = "Drop files here, or click to browse",
3862
+ hint,
3863
+ children,
3864
+ className,
3865
+ name,
3866
+ ...rest
3867
+ }, forwardedRef) {
3868
+ const inputRef = useRef(null);
3869
+ useImperativeHandle(forwardedRef, () => inputRef.current);
3870
+ const dragCounter = useRef(0);
3871
+ const [dragState, setDragState] = useState("idle");
3872
+ const partition = useCallback(
3873
+ (files) => {
3874
+ const accepted = [];
3875
+ const rejected = [];
3876
+ const arr = Array.from(files);
3877
+ for (const f of arr) {
3878
+ if (!matchesAccept(f, accept)) {
3879
+ rejected.push({ file: f, reason: "type" });
3880
+ continue;
3881
+ }
3882
+ if (maxSize != null && f.size > maxSize) {
3883
+ rejected.push({ file: f, reason: "size" });
3884
+ continue;
3885
+ }
3886
+ accepted.push(f);
3887
+ }
3888
+ if (maxFiles != null && accepted.length > maxFiles) {
3889
+ const overflow = accepted.splice(maxFiles);
3890
+ for (const f of overflow) rejected.push({ file: f, reason: "count" });
3891
+ }
3892
+ return [accepted, rejected];
3893
+ },
3894
+ [accept, maxSize, maxFiles]
3895
+ );
3896
+ const openPicker = () => {
3897
+ if (!disabled) inputRef.current?.click();
3898
+ };
3899
+ const handleDragEnter = (e) => {
3900
+ if (disabled) return;
3901
+ e.preventDefault();
3902
+ dragCounter.current += 1;
3903
+ const items = e.dataTransfer?.items;
3904
+ let reject = false;
3905
+ if (items && (accept || maxSize)) {
3906
+ if (accept) {
3907
+ const tokens = accept.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
3908
+ for (let i = 0; i < items.length; i++) {
3909
+ const it = items[i];
3910
+ if (!it || it.kind !== "file") continue;
3911
+ const t = it.type.toLowerCase();
3912
+ const ok = tokens.some((tk) => {
3913
+ if (tk.startsWith(".")) return false;
3914
+ if (tk.endsWith("/*")) return t.startsWith(tk.slice(0, -1));
3915
+ return t === tk;
3916
+ });
3917
+ if (!ok) {
3918
+ reject = true;
3919
+ break;
3920
+ }
3921
+ }
3922
+ }
3923
+ }
3924
+ setDragState(reject ? "reject" : "over");
3925
+ };
3926
+ const handleDragOver = (e) => {
3927
+ if (disabled) return;
3928
+ e.preventDefault();
3929
+ e.dataTransfer.dropEffect = "copy";
3930
+ };
3931
+ const handleDragLeave = (e) => {
3932
+ if (disabled) return;
3933
+ e.preventDefault();
3934
+ dragCounter.current -= 1;
3935
+ if (dragCounter.current <= 0) {
3936
+ dragCounter.current = 0;
3937
+ setDragState("idle");
3938
+ }
3939
+ };
3940
+ const handleDrop = (e) => {
3941
+ if (disabled) return;
3942
+ e.preventDefault();
3943
+ dragCounter.current = 0;
3944
+ setDragState("idle");
3945
+ const files = e.dataTransfer?.files;
3946
+ if (!files || files.length === 0) return;
3947
+ const [accepted, rejected] = partition(files);
3948
+ onFilesChange?.(accepted, rejected);
3949
+ };
3950
+ const handleKeyDown = (e) => {
3951
+ if (disabled) return;
3952
+ if (e.key === "Enter" || e.key === " ") {
3953
+ e.preventDefault();
3954
+ openPicker();
3955
+ }
3956
+ };
3957
+ const showError = invalid || dragState === "reject";
3958
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-3", className), children: [
3959
+ /* @__PURE__ */ jsxs(
3960
+ "div",
3961
+ {
3962
+ role: "button",
3963
+ tabIndex: disabled ? -1 : 0,
3964
+ "aria-disabled": disabled || void 0,
3965
+ "data-drag-state": dragState,
3966
+ "data-invalid": showError || void 0,
3967
+ onClick: openPicker,
3968
+ onKeyDown: handleKeyDown,
3969
+ onDragEnter: handleDragEnter,
3970
+ onDragOver: handleDragOver,
3971
+ onDragLeave: handleDragLeave,
3972
+ onDrop: handleDrop,
3973
+ className: cn(
3974
+ "flex flex-col items-center justify-center gap-2 rounded-md border-2 border-dashed border-input bg-background px-6 py-10 text-center text-sm text-muted-foreground transition-colors",
3975
+ "hover:border-border-strong hover:bg-muted/40",
3976
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3977
+ dragState === "over" && "border-primary bg-primary-soft/30 text-foreground",
3978
+ showError && "border-destructive bg-destructive-soft/30 text-destructive",
3979
+ disabled && "cursor-not-allowed opacity-60 hover:border-input hover:bg-background"
3980
+ ),
3981
+ children: [
3982
+ /* @__PURE__ */ jsx(
3983
+ Icon,
3984
+ {
3985
+ icon: UploadCloud,
3986
+ size: 28,
3987
+ className: cn(
3988
+ "text-muted-foreground",
3989
+ dragState === "over" && "text-primary",
3990
+ showError && "text-destructive"
3991
+ )
3992
+ }
3993
+ ),
3994
+ /* @__PURE__ */ jsx("div", { className: "font-medium text-foreground", children: label }),
3995
+ hint && /* @__PURE__ */ jsx("div", { className: "text-xs", children: hint }),
3996
+ /* @__PURE__ */ jsx(
3997
+ "input",
3998
+ {
3999
+ ...rest,
4000
+ ref: inputRef,
4001
+ type: "file",
4002
+ accept,
4003
+ multiple,
4004
+ disabled,
4005
+ name,
4006
+ className: "sr-only",
4007
+ onChange: (e) => {
4008
+ const files = e.target.files;
4009
+ if (!files || files.length === 0) return;
4010
+ const [accepted, rejected] = partition(files);
4011
+ onFilesChange?.(accepted, rejected);
4012
+ e.target.value = "";
4013
+ }
4014
+ }
4015
+ )
4016
+ ]
4017
+ }
4018
+ ),
4019
+ children
4020
+ ] });
4021
+ });
4022
+ FileUpload.displayName = "FileUpload";
4023
+ var EditableContext = createContext(null);
4024
+ function useEditableContext() {
4025
+ const ctx = useContext(EditableContext);
4026
+ if (!ctx) throw new Error("Editable.* must be used inside <Editable>");
4027
+ return ctx;
4028
+ }
4029
+ function Editable({
4030
+ value: valueProp,
4031
+ defaultValue,
4032
+ onValueChange,
4033
+ editing: editingProp,
4034
+ defaultEditing = false,
4035
+ onEditingChange,
4036
+ placeholder = "Click to edit",
4037
+ submitOnBlur = true,
4038
+ submitOnEnter = true,
4039
+ cancelOnEscape = true,
4040
+ disabled = false,
4041
+ readOnly = false,
4042
+ name,
4043
+ className,
4044
+ children
4045
+ }) {
4046
+ const [value, setValue] = useControlled({
4047
+ controlled: valueProp,
4048
+ default: defaultValue ?? "",
4049
+ onChange: onValueChange
4050
+ });
4051
+ const [editing, setEditing] = useControlled({
4052
+ controlled: editingProp,
4053
+ default: defaultEditing,
4054
+ onChange: onEditingChange
4055
+ });
4056
+ const [draft, setDraft] = useState(value);
4057
+ const inputRef = useRef(null);
4058
+ useEffect(() => {
4059
+ if (editing) setDraft(value);
4060
+ }, [editing, value]);
4061
+ const submit = useCallback(() => {
4062
+ setValue(draft);
4063
+ setEditing(false);
4064
+ }, [draft, setValue, setEditing]);
4065
+ const cancel = useCallback(() => {
4066
+ setDraft(value);
4067
+ setEditing(false);
4068
+ }, [value, setEditing]);
4069
+ const ctx = useMemo(
4070
+ () => ({
4071
+ value,
4072
+ draft,
4073
+ setDraft,
4074
+ editing,
4075
+ setEditing,
4076
+ submit,
4077
+ cancel,
4078
+ placeholder,
4079
+ disabled,
4080
+ readOnly,
4081
+ submitOnBlur,
4082
+ submitOnEnter,
4083
+ cancelOnEscape,
4084
+ inputRef
4085
+ }),
4086
+ [
4087
+ value,
4088
+ draft,
4089
+ editing,
4090
+ setEditing,
4091
+ submit,
4092
+ cancel,
4093
+ placeholder,
4094
+ disabled,
4095
+ readOnly,
4096
+ submitOnBlur,
4097
+ submitOnEnter,
4098
+ cancelOnEscape
4099
+ ]
4100
+ );
4101
+ return /* @__PURE__ */ jsx(EditableContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs("div", { className: cn("inline-flex items-center gap-1.5", className), children: [
4102
+ children,
4103
+ name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value })
4104
+ ] }) });
4105
+ }
4106
+ var EditablePreview = forwardRef(
4107
+ function EditablePreview2({ className, onClick, onKeyDown, ...rest }, forwardedRef) {
4108
+ const ctx = useEditableContext();
4109
+ if (ctx.editing) return null;
4110
+ const isEmpty = !ctx.value;
4111
+ const interactive = !ctx.disabled && !ctx.readOnly;
4112
+ return /* @__PURE__ */ jsx(
4113
+ "span",
4114
+ {
4115
+ ref: forwardedRef,
4116
+ role: interactive ? "button" : void 0,
4117
+ tabIndex: interactive ? 0 : -1,
4118
+ "aria-disabled": !interactive || void 0,
4119
+ onClick: (e) => {
4120
+ onClick?.(e);
4121
+ if (e.defaultPrevented || !interactive) return;
4122
+ ctx.setEditing(true);
4123
+ },
4124
+ onKeyDown: (e) => {
4125
+ onKeyDown?.(e);
4126
+ if (e.defaultPrevented || !interactive) return;
4127
+ if (e.key === "Enter" || e.key === " ") {
4128
+ e.preventDefault();
4129
+ ctx.setEditing(true);
4130
+ }
4131
+ },
4132
+ className: cn(
4133
+ "cursor-text rounded-sm px-1 py-0.5 text-sm text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
4134
+ isEmpty && "italic text-subtle-foreground",
4135
+ !interactive && "cursor-default hover:bg-transparent",
4136
+ className
4137
+ ),
4138
+ ...rest,
4139
+ children: ctx.value || ctx.placeholder
4140
+ }
4141
+ );
4142
+ }
4143
+ );
4144
+ var EditableInput = forwardRef(
4145
+ function EditableInput2({ className, size, state, onKeyDown, onBlur, ...rest }, forwardedRef) {
4146
+ const ctx = useEditableContext();
4147
+ useEffect(() => {
4148
+ if (ctx.editing && ctx.inputRef.current) {
4149
+ ctx.inputRef.current.focus();
4150
+ const len = ctx.inputRef.current.value.length;
4151
+ ctx.inputRef.current.setSelectionRange(len, len);
4152
+ }
4153
+ }, [ctx.editing, ctx.inputRef]);
4154
+ if (!ctx.editing) return null;
4155
+ const handleKeyDown = (e) => {
4156
+ onKeyDown?.(e);
4157
+ if (e.defaultPrevented) return;
4158
+ if (ctx.submitOnEnter && e.key === "Enter") {
4159
+ e.preventDefault();
4160
+ ctx.submit();
4161
+ } else if (ctx.cancelOnEscape && e.key === "Escape") {
4162
+ e.preventDefault();
4163
+ ctx.cancel();
4164
+ }
4165
+ };
4166
+ return /* @__PURE__ */ jsx(
4167
+ "input",
4168
+ {
4169
+ ref: composeRefs(forwardedRef, ctx.inputRef),
4170
+ type: "text",
4171
+ value: ctx.draft,
4172
+ disabled: ctx.disabled,
4173
+ readOnly: ctx.readOnly,
4174
+ onChange: (e) => ctx.setDraft(e.target.value),
4175
+ onKeyDown: handleKeyDown,
4176
+ onBlur: (e) => {
4177
+ onBlur?.(e);
4178
+ if (e.defaultPrevented) return;
4179
+ if (ctx.submitOnBlur) ctx.submit();
4180
+ },
4181
+ className: cn(inputBaseVariants({ size, state }), className),
4182
+ ...rest
4183
+ }
4184
+ );
4185
+ }
4186
+ );
4187
+ var EditableSubmit = forwardRef(
4188
+ function EditableSubmit2({ className, onClick, children, type = "button", ...rest }, forwardedRef) {
4189
+ const ctx = useEditableContext();
4190
+ if (!ctx.editing) return null;
4191
+ return /* @__PURE__ */ jsx(
4192
+ "button",
4193
+ {
4194
+ ref: forwardedRef,
4195
+ type,
4196
+ "aria-label": "Submit",
4197
+ onMouseDown: (e) => e.preventDefault(),
4198
+ onClick: (e) => {
4199
+ onClick?.(e);
4200
+ if (e.defaultPrevented) return;
4201
+ ctx.submit();
4202
+ },
4203
+ className: cn(
4204
+ "inline-flex h-8 w-8 items-center justify-center rounded-md text-success transition-colors hover:bg-success-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
4205
+ className
4206
+ ),
4207
+ ...rest,
4208
+ children: children ?? /* @__PURE__ */ jsx(Icon, { icon: Check, size: 14 })
4209
+ }
4210
+ );
4211
+ }
4212
+ );
4213
+ var EditableCancel = forwardRef(
4214
+ function EditableCancel2({ className, onClick, children, type = "button", ...rest }, forwardedRef) {
4215
+ const ctx = useEditableContext();
4216
+ if (!ctx.editing) return null;
4217
+ return /* @__PURE__ */ jsx(
4218
+ "button",
4219
+ {
4220
+ ref: forwardedRef,
4221
+ type,
4222
+ "aria-label": "Cancel",
4223
+ onMouseDown: (e) => e.preventDefault(),
4224
+ onClick: (e) => {
4225
+ onClick?.(e);
4226
+ if (e.defaultPrevented) return;
4227
+ ctx.cancel();
4228
+ },
4229
+ className: cn(
4230
+ "inline-flex h-8 w-8 items-center justify-center rounded-md text-destructive transition-colors hover:bg-destructive-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
4231
+ className
4232
+ ),
4233
+ ...rest,
4234
+ children: children ?? /* @__PURE__ */ jsx(Icon, { icon: X, size: 14 })
4235
+ }
4236
+ );
4237
+ }
4238
+ );
4239
+ Editable.Preview = EditablePreview;
4240
+ Editable.Input = EditableInput;
4241
+ Editable.Submit = EditableSubmit;
4242
+ Editable.Cancel = EditableCancel;
3869
4243
 
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
4244
+ 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, Editable, EditableCancel, EditableInput, EditablePreview, EditableSubmit, EmailInput, Fieldset, FilePicker, FileUpload, 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, TagsInput, TelInput, TextInput, Textarea, TimeField, TimePicker, UrlInput, colorSwatchVariants };
4245
+ //# sourceMappingURL=chunk-ILYL6ROC.js.map
4246
+ //# sourceMappingURL=chunk-ILYL6ROC.js.map