@k3-universe/react-kit 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 (59) hide show
  1. package/dist/index.js +1773 -1739
  2. package/dist/kit/builder/data-table/types.d.ts +1 -1
  3. package/dist/kit/builder/data-table/types.d.ts.map +1 -1
  4. package/dist/kit/builder/form/components/FormBuilder.d.ts +3 -172
  5. package/dist/kit/builder/form/components/FormBuilder.d.ts.map +1 -1
  6. package/dist/kit/builder/form/components/FormBuilderContext.d.ts +18 -0
  7. package/dist/kit/builder/form/components/FormBuilderContext.d.ts.map +1 -0
  8. package/dist/kit/builder/form/components/FormBuilderField.d.ts +8 -8
  9. package/dist/kit/builder/form/components/FormBuilderField.d.ts.map +1 -1
  10. package/dist/kit/builder/form/components/fields/types.d.ts +3 -3
  11. package/dist/kit/builder/form/components/fields/types.d.ts.map +1 -1
  12. package/dist/kit/builder/form/components/sectionNodes.d.ts +17 -0
  13. package/dist/kit/builder/form/components/sectionNodes.d.ts.map +1 -0
  14. package/dist/kit/builder/form/index.d.ts +1 -0
  15. package/dist/kit/builder/form/index.d.ts.map +1 -1
  16. package/dist/kit/builder/form/types.d.ts +176 -0
  17. package/dist/kit/builder/form/types.d.ts.map +1 -0
  18. package/dist/kit/builder/form/utils/common-forms.d.ts +1 -1
  19. package/dist/kit/builder/form/utils/common-forms.d.ts.map +1 -1
  20. package/dist/kit/builder/form/utils/field-factories.d.ts +3 -3
  21. package/dist/kit/builder/form/utils/field-factories.d.ts.map +1 -1
  22. package/dist/kit/builder/form/utils/section-factories.d.ts +4 -4
  23. package/dist/kit/builder/form/utils/section-factories.d.ts.map +1 -1
  24. package/dist/kit/builder/stack-dialog/provider.d.ts.map +1 -1
  25. package/dist/kit/builder/stack-dialog/renderer.d.ts.map +1 -1
  26. package/dist/kit/components/autocomplete/Autocomplete.d.ts +8 -8
  27. package/dist/kit/components/autocomplete/Autocomplete.d.ts.map +1 -1
  28. package/dist/kit/components/autocomplete/types.d.ts +6 -4
  29. package/dist/kit/components/autocomplete/types.d.ts.map +1 -1
  30. package/dist/kit/themes/clean-slate.css +3 -3
  31. package/dist/kit/themes/default.css +4 -4
  32. package/dist/kit/themes/minimal-modern.css +3 -3
  33. package/dist/kit/themes/spotify.css +3 -3
  34. package/package.json +1 -1
  35. package/src/kit/builder/data-table/components/DataTable.tsx +1 -1
  36. package/src/kit/builder/data-table/types.ts +1 -1
  37. package/src/kit/builder/form/components/FormBuilder.tsx +113 -369
  38. package/src/kit/builder/form/components/FormBuilderContext.tsx +45 -0
  39. package/src/kit/builder/form/components/FormBuilderField.tsx +42 -34
  40. package/src/kit/builder/form/components/fields/AutocompleteField.tsx +2 -2
  41. package/src/kit/builder/form/components/fields/types.ts +3 -3
  42. package/src/kit/builder/form/components/sectionNodes.tsx +116 -0
  43. package/src/kit/builder/form/index.ts +1 -0
  44. package/src/kit/builder/form/types.ts +200 -0
  45. package/src/kit/builder/form/utils/common-forms.ts +1 -1
  46. package/src/kit/builder/form/utils/field-factories.ts +5 -5
  47. package/src/kit/builder/form/utils/section-factories.ts +10 -10
  48. package/src/kit/builder/stack-dialog/provider.tsx +2 -1
  49. package/src/kit/builder/stack-dialog/renderer.tsx +6 -7
  50. package/src/kit/components/autocomplete/Autocomplete.tsx +34 -26
  51. package/src/kit/components/autocomplete/types.ts +7 -5
  52. package/src/kit/themes/default.css +1 -1
  53. package/src/shadcn/ui/button.tsx +1 -1
  54. package/src/shadcn/ui/command.tsx +1 -1
  55. package/src/shadcn/ui/input.tsx +1 -1
  56. package/src/shadcn/ui/popover.tsx +1 -1
  57. package/src/shadcn/ui/select.tsx +1 -1
  58. package/src/shadcn/ui/textarea.tsx +1 -1
  59. package/src/stories/kit/builder/Form.MultipleFormBuilder.stories.tsx +335 -0
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import React__default, { forwardRef, createElement, useLayoutEffect, useState, useRef, useCallback, useEffect, useMemo, useId as useId$2, createContext, useContext, useReducer, useImperativeHandle, Fragment as Fragment$1, memo as memo$1, use, isValidElement, PureComponent, cloneElement } from "react";
3
+ import React__default, { forwardRef, createElement, memo as memo$1, useLayoutEffect, useState, useRef, useCallback, useEffect, useMemo, useId as useId$2, createContext, useContext, useReducer, useImperativeHandle, Fragment as Fragment$1, use, isValidElement, PureComponent, cloneElement } from "react";
4
4
  import * as ReactDOM from "react-dom";
5
5
  import ReactDOM__default from "react-dom";
6
6
  import { useLocation, Link as Link$1 } from "@tanstack/react-router";
@@ -7609,7 +7609,7 @@ const buttonVariants = cva(
7609
7609
  variant: {
7610
7610
  default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
7611
7611
  destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
7612
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
7612
+ outline: "border border-border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-border dark:hover:bg-input/50",
7613
7613
  secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
7614
7614
  ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
7615
7615
  link: "text-primary underline-offset-4 hover:underline"
@@ -8081,6 +8081,58 @@ function TableCaption({
8081
8081
  }
8082
8082
  );
8083
8083
  }
8084
+ function FormBuilderActions({
8085
+ onSubmit,
8086
+ onCancel,
8087
+ onReset,
8088
+ submitLabel = "Save",
8089
+ cancelLabel = "Cancel",
8090
+ resetLabel = "Reset",
8091
+ isSubmitting = false,
8092
+ isValid: isValid2 = true,
8093
+ showReset = false,
8094
+ customActions,
8095
+ className,
8096
+ submitButtonProps,
8097
+ cancelButtonProps,
8098
+ resetButtonProps
8099
+ }) {
8100
+ return /* @__PURE__ */ jsxs("div", { className: cn$1("flex items-center justify-end space-x-4", className), children: [
8101
+ customActions,
8102
+ showReset && onReset && /* @__PURE__ */ jsx(
8103
+ Button$1,
8104
+ {
8105
+ type: "button",
8106
+ variant: "outline",
8107
+ onClick: onReset,
8108
+ disabled: isSubmitting,
8109
+ ...resetButtonProps,
8110
+ children: resetLabel
8111
+ }
8112
+ ),
8113
+ onCancel && /* @__PURE__ */ jsx(
8114
+ Button$1,
8115
+ {
8116
+ type: "button",
8117
+ variant: "outline",
8118
+ onClick: onCancel,
8119
+ disabled: isSubmitting,
8120
+ ...cancelButtonProps,
8121
+ children: cancelLabel
8122
+ }
8123
+ ),
8124
+ onSubmit && /* @__PURE__ */ jsx(
8125
+ Button$1,
8126
+ {
8127
+ type: "submit",
8128
+ onClick: onSubmit,
8129
+ disabled: isSubmitting || !isValid2,
8130
+ ...submitButtonProps,
8131
+ children: isSubmitting ? "Saving..." : submitLabel
8132
+ }
8133
+ )
8134
+ ] });
8135
+ }
8084
8136
  var isCheckBoxInput = (element) => element.type === "checkbox";
8085
8137
  var isDateObject = (value) => value instanceof Date;
8086
8138
  var isNullOrUndefined = (value) => value == null;
@@ -13377,35 +13429,122 @@ function refine(fn, _params = {}) {
13377
13429
  function superRefine(fn) {
13378
13430
  return _superRefine(fn);
13379
13431
  }
13380
- var NAME$5 = "Label";
13381
- var Label$3 = React.forwardRef((props2, forwardedRef) => {
13432
+ function Card({ className, ...props2 }) {
13382
13433
  return /* @__PURE__ */ jsx(
13383
- Primitive.label,
13434
+ "div",
13384
13435
  {
13385
- ...props2,
13386
- ref: forwardedRef,
13387
- onMouseDown: (event) => {
13388
- var _a;
13389
- const target = event.target;
13390
- if (target.closest("button, input, select, textarea")) return;
13391
- (_a = props2.onMouseDown) == null ? void 0 : _a.call(props2, event);
13392
- if (!event.defaultPrevented && event.detail > 1) event.preventDefault();
13393
- }
13436
+ "data-slot": "card",
13437
+ className: cn$1(
13438
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
13439
+ className
13440
+ ),
13441
+ ...props2
13442
+ }
13443
+ );
13444
+ }
13445
+ function CardHeader({ className, ...props2 }) {
13446
+ return /* @__PURE__ */ jsx(
13447
+ "div",
13448
+ {
13449
+ "data-slot": "card-header",
13450
+ className: cn$1(
13451
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
13452
+ className
13453
+ ),
13454
+ ...props2
13455
+ }
13456
+ );
13457
+ }
13458
+ function CardTitle({ className, ...props2 }) {
13459
+ return /* @__PURE__ */ jsx(
13460
+ "div",
13461
+ {
13462
+ "data-slot": "card-title",
13463
+ className: cn$1("leading-none font-semibold", className),
13464
+ ...props2
13465
+ }
13466
+ );
13467
+ }
13468
+ function CardDescription({ className, ...props2 }) {
13469
+ return /* @__PURE__ */ jsx(
13470
+ "div",
13471
+ {
13472
+ "data-slot": "card-description",
13473
+ className: cn$1("text-muted-foreground text-sm", className),
13474
+ ...props2
13475
+ }
13476
+ );
13477
+ }
13478
+ function CardAction({ className, ...props2 }) {
13479
+ return /* @__PURE__ */ jsx(
13480
+ "div",
13481
+ {
13482
+ "data-slot": "card-action",
13483
+ className: cn$1(
13484
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
13485
+ className
13486
+ ),
13487
+ ...props2
13488
+ }
13489
+ );
13490
+ }
13491
+ function CardContent({ className, ...props2 }) {
13492
+ return /* @__PURE__ */ jsx(
13493
+ "div",
13494
+ {
13495
+ "data-slot": "card-content",
13496
+ className: cn$1("px-6", className),
13497
+ ...props2
13498
+ }
13499
+ );
13500
+ }
13501
+ function CardFooter({ className, ...props2 }) {
13502
+ return /* @__PURE__ */ jsx(
13503
+ "div",
13504
+ {
13505
+ "data-slot": "card-footer",
13506
+ className: cn$1("flex items-center px-6 [.border-t]:pt-6", className),
13507
+ ...props2
13508
+ }
13509
+ );
13510
+ }
13511
+ var NAME$5 = "Separator";
13512
+ var DEFAULT_ORIENTATION = "horizontal";
13513
+ var ORIENTATIONS = ["horizontal", "vertical"];
13514
+ var Separator$3 = React.forwardRef((props2, forwardedRef) => {
13515
+ const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props2;
13516
+ const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
13517
+ const ariaOrientation = orientation === "vertical" ? orientation : void 0;
13518
+ const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
13519
+ return /* @__PURE__ */ jsx(
13520
+ Primitive.div,
13521
+ {
13522
+ "data-orientation": orientation,
13523
+ ...semanticProps,
13524
+ ...domProps,
13525
+ ref: forwardedRef
13394
13526
  }
13395
13527
  );
13396
13528
  });
13397
- Label$3.displayName = NAME$5;
13398
- var Root$e = Label$3;
13399
- function Label$2({
13529
+ Separator$3.displayName = NAME$5;
13530
+ function isValidOrientation(orientation) {
13531
+ return ORIENTATIONS.includes(orientation);
13532
+ }
13533
+ var Root$e = Separator$3;
13534
+ function Separator$2({
13400
13535
  className,
13536
+ orientation = "horizontal",
13537
+ decorative = true,
13401
13538
  ...props2
13402
13539
  }) {
13403
13540
  return /* @__PURE__ */ jsx(
13404
13541
  Root$e,
13405
13542
  {
13406
- "data-slot": "label",
13543
+ "data-slot": "separator",
13544
+ decorative,
13545
+ orientation,
13407
13546
  className: cn$1(
13408
- "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
13547
+ "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
13409
13548
  className
13410
13549
  ),
13411
13550
  ...props2
@@ -13422,207 +13561,970 @@ function useCallbackRef$2(callback) {
13422
13561
  return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
13423
13562
  }, []);
13424
13563
  }
13425
- function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
13426
- const onEscapeKeyDown = useCallbackRef$2(onEscapeKeyDownProp);
13564
+ var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
13565
+ var EVENT_OPTIONS$1 = { bubbles: false, cancelable: true };
13566
+ var GROUP_NAME$5 = "RovingFocusGroup";
13567
+ var [Collection$5, useCollection$5, createCollectionScope$5] = createCollection(GROUP_NAME$5);
13568
+ var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
13569
+ GROUP_NAME$5,
13570
+ [createCollectionScope$5]
13571
+ );
13572
+ var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME$5);
13573
+ var RovingFocusGroup = React.forwardRef(
13574
+ (props2, forwardedRef) => {
13575
+ return /* @__PURE__ */ jsx(Collection$5.Provider, { scope: props2.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection$5.Slot, { scope: props2.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props2, ref: forwardedRef }) }) });
13576
+ }
13577
+ );
13578
+ RovingFocusGroup.displayName = GROUP_NAME$5;
13579
+ var RovingFocusGroupImpl = React.forwardRef((props2, forwardedRef) => {
13580
+ const {
13581
+ __scopeRovingFocusGroup,
13582
+ orientation,
13583
+ loop = false,
13584
+ dir,
13585
+ currentTabStopId: currentTabStopIdProp,
13586
+ defaultCurrentTabStopId,
13587
+ onCurrentTabStopIdChange,
13588
+ onEntryFocus,
13589
+ preventScrollOnEntryFocus = false,
13590
+ ...groupProps
13591
+ } = props2;
13592
+ const ref = React.useRef(null);
13593
+ const composedRefs = useComposedRefs$1(forwardedRef, ref);
13594
+ const direction = useDirection(dir);
13595
+ const [currentTabStopId, setCurrentTabStopId] = useControllableState$1({
13596
+ prop: currentTabStopIdProp,
13597
+ defaultProp: defaultCurrentTabStopId ?? null,
13598
+ onChange: onCurrentTabStopIdChange,
13599
+ caller: GROUP_NAME$5
13600
+ });
13601
+ const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);
13602
+ const handleEntryFocus = useCallbackRef$2(onEntryFocus);
13603
+ const getItems = useCollection$5(__scopeRovingFocusGroup);
13604
+ const isClickFocusRef = React.useRef(false);
13605
+ const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);
13427
13606
  React.useEffect(() => {
13428
- const handleKeyDown = (event) => {
13429
- if (event.key === "Escape") {
13430
- onEscapeKeyDown(event);
13431
- }
13432
- };
13433
- ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
13434
- return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
13435
- }, [onEscapeKeyDown, ownerDocument]);
13436
- }
13437
- var DISMISSABLE_LAYER_NAME = "DismissableLayer";
13438
- var CONTEXT_UPDATE = "dismissableLayer.update";
13439
- var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
13440
- var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
13441
- var originalBodyPointerEvents;
13442
- var DismissableLayerContext = React.createContext({
13443
- layers: /* @__PURE__ */ new Set(),
13444
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
13445
- branches: /* @__PURE__ */ new Set()
13607
+ const node = ref.current;
13608
+ if (node) {
13609
+ node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
13610
+ return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
13611
+ }
13612
+ }, [handleEntryFocus]);
13613
+ return /* @__PURE__ */ jsx(
13614
+ RovingFocusProvider,
13615
+ {
13616
+ scope: __scopeRovingFocusGroup,
13617
+ orientation,
13618
+ dir: direction,
13619
+ loop,
13620
+ currentTabStopId,
13621
+ onItemFocus: React.useCallback(
13622
+ (tabStopId) => setCurrentTabStopId(tabStopId),
13623
+ [setCurrentTabStopId]
13624
+ ),
13625
+ onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),
13626
+ onFocusableItemAdd: React.useCallback(
13627
+ () => setFocusableItemsCount((prevCount) => prevCount + 1),
13628
+ []
13629
+ ),
13630
+ onFocusableItemRemove: React.useCallback(
13631
+ () => setFocusableItemsCount((prevCount) => prevCount - 1),
13632
+ []
13633
+ ),
13634
+ children: /* @__PURE__ */ jsx(
13635
+ Primitive.div,
13636
+ {
13637
+ tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
13638
+ "data-orientation": orientation,
13639
+ ...groupProps,
13640
+ ref: composedRefs,
13641
+ style: { outline: "none", ...props2.style },
13642
+ onMouseDown: composeEventHandlers$1(props2.onMouseDown, () => {
13643
+ isClickFocusRef.current = true;
13644
+ }),
13645
+ onFocus: composeEventHandlers$1(props2.onFocus, (event) => {
13646
+ const isKeyboardFocus = !isClickFocusRef.current;
13647
+ if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
13648
+ const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS$1);
13649
+ event.currentTarget.dispatchEvent(entryFocusEvent);
13650
+ if (!entryFocusEvent.defaultPrevented) {
13651
+ const items = getItems().filter((item) => item.focusable);
13652
+ const activeItem = items.find((item) => item.active);
13653
+ const currentItem = items.find((item) => item.id === currentTabStopId);
13654
+ const candidateItems = [activeItem, currentItem, ...items].filter(
13655
+ Boolean
13656
+ );
13657
+ const candidateNodes = candidateItems.map((item) => item.ref.current);
13658
+ focusFirst$3(candidateNodes, preventScrollOnEntryFocus);
13659
+ }
13660
+ }
13661
+ isClickFocusRef.current = false;
13662
+ }),
13663
+ onBlur: composeEventHandlers$1(props2.onBlur, () => setIsTabbingBackOut(false))
13664
+ }
13665
+ )
13666
+ }
13667
+ );
13446
13668
  });
13447
- var DismissableLayer = React.forwardRef(
13669
+ var ITEM_NAME$8 = "RovingFocusGroupItem";
13670
+ var RovingFocusGroupItem = React.forwardRef(
13448
13671
  (props2, forwardedRef) => {
13449
13672
  const {
13450
- disableOutsidePointerEvents = false,
13451
- onEscapeKeyDown,
13452
- onPointerDownOutside,
13453
- onFocusOutside,
13454
- onInteractOutside,
13455
- onDismiss,
13456
- ...layerProps
13673
+ __scopeRovingFocusGroup,
13674
+ focusable = true,
13675
+ active = false,
13676
+ tabStopId,
13677
+ children,
13678
+ ...itemProps
13457
13679
  } = props2;
13458
- const context = React.useContext(DismissableLayerContext);
13459
- const [node, setNode] = React.useState(null);
13460
- const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
13461
- const [, force] = React.useState({});
13462
- const composedRefs = useComposedRefs$1(forwardedRef, (node2) => setNode(node2));
13463
- const layers = Array.from(context.layers);
13464
- const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
13465
- const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
13466
- const index2 = node ? layers.indexOf(node) : -1;
13467
- const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
13468
- const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
13469
- const pointerDownOutside = usePointerDownOutside((event) => {
13470
- const target = event.target;
13471
- const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
13472
- if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
13473
- onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
13474
- onInteractOutside == null ? void 0 : onInteractOutside(event);
13475
- if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
13476
- }, ownerDocument);
13477
- const focusOutside = useFocusOutside((event) => {
13478
- const target = event.target;
13479
- const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
13480
- if (isFocusInBranch) return;
13481
- onFocusOutside == null ? void 0 : onFocusOutside(event);
13482
- onInteractOutside == null ? void 0 : onInteractOutside(event);
13483
- if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
13484
- }, ownerDocument);
13485
- useEscapeKeydown((event) => {
13486
- const isHighestLayer = index2 === context.layers.size - 1;
13487
- if (!isHighestLayer) return;
13488
- onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
13489
- if (!event.defaultPrevented && onDismiss) {
13490
- event.preventDefault();
13491
- onDismiss();
13492
- }
13493
- }, ownerDocument);
13680
+ const autoId = useId$1();
13681
+ const id = tabStopId || autoId;
13682
+ const context = useRovingFocusContext(ITEM_NAME$8, __scopeRovingFocusGroup);
13683
+ const isCurrentTabStop = context.currentTabStopId === id;
13684
+ const getItems = useCollection$5(__scopeRovingFocusGroup);
13685
+ const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;
13494
13686
  React.useEffect(() => {
13495
- if (!node) return;
13496
- if (disableOutsidePointerEvents) {
13497
- if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
13498
- originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
13499
- ownerDocument.body.style.pointerEvents = "none";
13500
- }
13501
- context.layersWithOutsidePointerEventsDisabled.add(node);
13687
+ if (focusable) {
13688
+ onFocusableItemAdd();
13689
+ return () => onFocusableItemRemove();
13502
13690
  }
13503
- context.layers.add(node);
13504
- dispatchUpdate();
13505
- return () => {
13506
- if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
13507
- ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
13508
- }
13509
- };
13510
- }, [node, ownerDocument, disableOutsidePointerEvents, context]);
13511
- React.useEffect(() => {
13512
- return () => {
13513
- if (!node) return;
13514
- context.layers.delete(node);
13515
- context.layersWithOutsidePointerEventsDisabled.delete(node);
13516
- dispatchUpdate();
13517
- };
13518
- }, [node, context]);
13519
- React.useEffect(() => {
13520
- const handleUpdate = () => force({});
13521
- document.addEventListener(CONTEXT_UPDATE, handleUpdate);
13522
- return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
13523
- }, []);
13691
+ }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
13524
13692
  return /* @__PURE__ */ jsx(
13525
- Primitive.div,
13693
+ Collection$5.ItemSlot,
13526
13694
  {
13527
- ...layerProps,
13528
- ref: composedRefs,
13529
- style: {
13530
- pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
13531
- ...props2.style
13532
- },
13533
- onFocusCapture: composeEventHandlers$1(props2.onFocusCapture, focusOutside.onFocusCapture),
13534
- onBlurCapture: composeEventHandlers$1(props2.onBlurCapture, focusOutside.onBlurCapture),
13535
- onPointerDownCapture: composeEventHandlers$1(
13536
- props2.onPointerDownCapture,
13537
- pointerDownOutside.onPointerDownCapture
13695
+ scope: __scopeRovingFocusGroup,
13696
+ id,
13697
+ focusable,
13698
+ active,
13699
+ children: /* @__PURE__ */ jsx(
13700
+ Primitive.span,
13701
+ {
13702
+ tabIndex: isCurrentTabStop ? 0 : -1,
13703
+ "data-orientation": context.orientation,
13704
+ ...itemProps,
13705
+ ref: forwardedRef,
13706
+ onMouseDown: composeEventHandlers$1(props2.onMouseDown, (event) => {
13707
+ if (!focusable) event.preventDefault();
13708
+ else context.onItemFocus(id);
13709
+ }),
13710
+ onFocus: composeEventHandlers$1(props2.onFocus, () => context.onItemFocus(id)),
13711
+ onKeyDown: composeEventHandlers$1(props2.onKeyDown, (event) => {
13712
+ if (event.key === "Tab" && event.shiftKey) {
13713
+ context.onItemShiftTab();
13714
+ return;
13715
+ }
13716
+ if (event.target !== event.currentTarget) return;
13717
+ const focusIntent = getFocusIntent(event, context.orientation, context.dir);
13718
+ if (focusIntent !== void 0) {
13719
+ if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
13720
+ event.preventDefault();
13721
+ const items = getItems().filter((item) => item.focusable);
13722
+ let candidateNodes = items.map((item) => item.ref.current);
13723
+ if (focusIntent === "last") candidateNodes.reverse();
13724
+ else if (focusIntent === "prev" || focusIntent === "next") {
13725
+ if (focusIntent === "prev") candidateNodes.reverse();
13726
+ const currentIndex = candidateNodes.indexOf(event.currentTarget);
13727
+ candidateNodes = context.loop ? wrapArray$3(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
13728
+ }
13729
+ setTimeout(() => focusFirst$3(candidateNodes));
13730
+ }
13731
+ }),
13732
+ children: typeof children === "function" ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children
13733
+ }
13538
13734
  )
13539
13735
  }
13540
13736
  );
13541
13737
  }
13542
13738
  );
13543
- DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
13544
- var BRANCH_NAME = "DismissableLayerBranch";
13545
- var DismissableLayerBranch = React.forwardRef((props2, forwardedRef) => {
13546
- const context = React.useContext(DismissableLayerContext);
13547
- const ref = React.useRef(null);
13548
- const composedRefs = useComposedRefs$1(forwardedRef, ref);
13549
- React.useEffect(() => {
13550
- const node = ref.current;
13551
- if (node) {
13552
- context.branches.add(node);
13553
- return () => {
13554
- context.branches.delete(node);
13555
- };
13556
- }
13557
- }, [context.branches]);
13558
- return /* @__PURE__ */ jsx(Primitive.div, { ...props2, ref: composedRefs });
13559
- });
13560
- DismissableLayerBranch.displayName = BRANCH_NAME;
13561
- function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
13562
- const handlePointerDownOutside = useCallbackRef$2(onPointerDownOutside);
13563
- const isPointerInsideReactTreeRef = React.useRef(false);
13564
- const handleClickRef = React.useRef(() => {
13565
- });
13566
- React.useEffect(() => {
13567
- const handlePointerDown2 = (event) => {
13568
- if (event.target && !isPointerInsideReactTreeRef.current) {
13569
- let handleAndDispatchPointerDownOutsideEvent2 = function() {
13570
- handleAndDispatchCustomEvent(
13571
- POINTER_DOWN_OUTSIDE,
13572
- handlePointerDownOutside,
13573
- eventDetail,
13574
- { discrete: true }
13575
- );
13576
- };
13577
- const eventDetail = { originalEvent: event };
13578
- if (event.pointerType === "touch") {
13579
- ownerDocument.removeEventListener("click", handleClickRef.current);
13580
- handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
13581
- ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
13582
- } else {
13583
- handleAndDispatchPointerDownOutsideEvent2();
13584
- }
13585
- } else {
13586
- ownerDocument.removeEventListener("click", handleClickRef.current);
13587
- }
13588
- isPointerInsideReactTreeRef.current = false;
13589
- };
13590
- const timerId = window.setTimeout(() => {
13591
- ownerDocument.addEventListener("pointerdown", handlePointerDown2);
13592
- }, 0);
13593
- return () => {
13594
- window.clearTimeout(timerId);
13595
- ownerDocument.removeEventListener("pointerdown", handlePointerDown2);
13596
- ownerDocument.removeEventListener("click", handleClickRef.current);
13597
- };
13598
- }, [ownerDocument, handlePointerDownOutside]);
13599
- return {
13600
- // ensures we check React component tree (not just DOM tree)
13601
- onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
13602
- };
13739
+ RovingFocusGroupItem.displayName = ITEM_NAME$8;
13740
+ var MAP_KEY_TO_FOCUS_INTENT = {
13741
+ ArrowLeft: "prev",
13742
+ ArrowUp: "prev",
13743
+ ArrowRight: "next",
13744
+ ArrowDown: "next",
13745
+ PageUp: "first",
13746
+ Home: "first",
13747
+ PageDown: "last",
13748
+ End: "last"
13749
+ };
13750
+ function getDirectionAwareKey(key, dir) {
13751
+ if (dir !== "rtl") return key;
13752
+ return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
13603
13753
  }
13604
- function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
13605
- const handleFocusOutside = useCallbackRef$2(onFocusOutside);
13606
- const isFocusInsideReactTreeRef = React.useRef(false);
13607
- React.useEffect(() => {
13608
- const handleFocus = (event) => {
13609
- if (event.target && !isFocusInsideReactTreeRef.current) {
13610
- const eventDetail = { originalEvent: event };
13611
- handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
13612
- discrete: false
13613
- });
13614
- }
13615
- };
13616
- ownerDocument.addEventListener("focusin", handleFocus);
13617
- return () => ownerDocument.removeEventListener("focusin", handleFocus);
13618
- }, [ownerDocument, handleFocusOutside]);
13619
- return {
13620
- onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
13621
- onBlurCapture: () => isFocusInsideReactTreeRef.current = false
13622
- };
13754
+ function getFocusIntent(event, orientation, dir) {
13755
+ const key = getDirectionAwareKey(event.key, dir);
13756
+ if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
13757
+ if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
13758
+ return MAP_KEY_TO_FOCUS_INTENT[key];
13623
13759
  }
13624
- function dispatchUpdate() {
13625
- const event = new CustomEvent(CONTEXT_UPDATE);
13760
+ function focusFirst$3(candidates, preventScroll = false) {
13761
+ const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
13762
+ for (const candidate of candidates) {
13763
+ if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
13764
+ candidate.focus({ preventScroll });
13765
+ if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
13766
+ }
13767
+ }
13768
+ function wrapArray$3(array2, startIndex) {
13769
+ return array2.map((_2, index2) => array2[(startIndex + index2) % array2.length]);
13770
+ }
13771
+ var Root$d = RovingFocusGroup;
13772
+ var Item$2 = RovingFocusGroupItem;
13773
+ var TABS_NAME = "Tabs";
13774
+ var [createTabsContext, createTabsScope] = createContextScope(TABS_NAME, [
13775
+ createRovingFocusGroupScope
13776
+ ]);
13777
+ var useRovingFocusGroupScope$4 = createRovingFocusGroupScope();
13778
+ var [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);
13779
+ var Tabs$1 = React.forwardRef(
13780
+ (props2, forwardedRef) => {
13781
+ const {
13782
+ __scopeTabs,
13783
+ value: valueProp,
13784
+ onValueChange,
13785
+ defaultValue,
13786
+ orientation = "horizontal",
13787
+ dir,
13788
+ activationMode = "automatic",
13789
+ ...tabsProps
13790
+ } = props2;
13791
+ const direction = useDirection(dir);
13792
+ const [value, setValue] = useControllableState$1({
13793
+ prop: valueProp,
13794
+ onChange: onValueChange,
13795
+ defaultProp: defaultValue ?? "",
13796
+ caller: TABS_NAME
13797
+ });
13798
+ return /* @__PURE__ */ jsx(
13799
+ TabsProvider,
13800
+ {
13801
+ scope: __scopeTabs,
13802
+ baseId: useId$1(),
13803
+ value,
13804
+ onValueChange: setValue,
13805
+ orientation,
13806
+ dir: direction,
13807
+ activationMode,
13808
+ children: /* @__PURE__ */ jsx(
13809
+ Primitive.div,
13810
+ {
13811
+ dir: direction,
13812
+ "data-orientation": orientation,
13813
+ ...tabsProps,
13814
+ ref: forwardedRef
13815
+ }
13816
+ )
13817
+ }
13818
+ );
13819
+ }
13820
+ );
13821
+ Tabs$1.displayName = TABS_NAME;
13822
+ var TAB_LIST_NAME = "TabsList";
13823
+ var TabsList$1 = React.forwardRef(
13824
+ (props2, forwardedRef) => {
13825
+ const { __scopeTabs, loop = true, ...listProps } = props2;
13826
+ const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);
13827
+ const rovingFocusGroupScope = useRovingFocusGroupScope$4(__scopeTabs);
13828
+ return /* @__PURE__ */ jsx(
13829
+ Root$d,
13830
+ {
13831
+ asChild: true,
13832
+ ...rovingFocusGroupScope,
13833
+ orientation: context.orientation,
13834
+ dir: context.dir,
13835
+ loop,
13836
+ children: /* @__PURE__ */ jsx(
13837
+ Primitive.div,
13838
+ {
13839
+ role: "tablist",
13840
+ "aria-orientation": context.orientation,
13841
+ ...listProps,
13842
+ ref: forwardedRef
13843
+ }
13844
+ )
13845
+ }
13846
+ );
13847
+ }
13848
+ );
13849
+ TabsList$1.displayName = TAB_LIST_NAME;
13850
+ var TRIGGER_NAME$a = "TabsTrigger";
13851
+ var TabsTrigger$1 = React.forwardRef(
13852
+ (props2, forwardedRef) => {
13853
+ const { __scopeTabs, value, disabled = false, ...triggerProps } = props2;
13854
+ const context = useTabsContext(TRIGGER_NAME$a, __scopeTabs);
13855
+ const rovingFocusGroupScope = useRovingFocusGroupScope$4(__scopeTabs);
13856
+ const triggerId = makeTriggerId$1(context.baseId, value);
13857
+ const contentId = makeContentId$1(context.baseId, value);
13858
+ const isSelected = value === context.value;
13859
+ return /* @__PURE__ */ jsx(
13860
+ Item$2,
13861
+ {
13862
+ asChild: true,
13863
+ ...rovingFocusGroupScope,
13864
+ focusable: !disabled,
13865
+ active: isSelected,
13866
+ children: /* @__PURE__ */ jsx(
13867
+ Primitive.button,
13868
+ {
13869
+ type: "button",
13870
+ role: "tab",
13871
+ "aria-selected": isSelected,
13872
+ "aria-controls": contentId,
13873
+ "data-state": isSelected ? "active" : "inactive",
13874
+ "data-disabled": disabled ? "" : void 0,
13875
+ disabled,
13876
+ id: triggerId,
13877
+ ...triggerProps,
13878
+ ref: forwardedRef,
13879
+ onMouseDown: composeEventHandlers$1(props2.onMouseDown, (event) => {
13880
+ if (!disabled && event.button === 0 && event.ctrlKey === false) {
13881
+ context.onValueChange(value);
13882
+ } else {
13883
+ event.preventDefault();
13884
+ }
13885
+ }),
13886
+ onKeyDown: composeEventHandlers$1(props2.onKeyDown, (event) => {
13887
+ if ([" ", "Enter"].includes(event.key)) context.onValueChange(value);
13888
+ }),
13889
+ onFocus: composeEventHandlers$1(props2.onFocus, () => {
13890
+ const isAutomaticActivation = context.activationMode !== "manual";
13891
+ if (!isSelected && !disabled && isAutomaticActivation) {
13892
+ context.onValueChange(value);
13893
+ }
13894
+ })
13895
+ }
13896
+ )
13897
+ }
13898
+ );
13899
+ }
13900
+ );
13901
+ TabsTrigger$1.displayName = TRIGGER_NAME$a;
13902
+ var CONTENT_NAME$c = "TabsContent";
13903
+ var TabsContent$1 = React.forwardRef(
13904
+ (props2, forwardedRef) => {
13905
+ const { __scopeTabs, value, forceMount, children, ...contentProps } = props2;
13906
+ const context = useTabsContext(CONTENT_NAME$c, __scopeTabs);
13907
+ const triggerId = makeTriggerId$1(context.baseId, value);
13908
+ const contentId = makeContentId$1(context.baseId, value);
13909
+ const isSelected = value === context.value;
13910
+ const isMountAnimationPreventedRef = React.useRef(isSelected);
13911
+ React.useEffect(() => {
13912
+ const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
13913
+ return () => cancelAnimationFrame(rAF);
13914
+ }, []);
13915
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || isSelected, children: ({ present }) => /* @__PURE__ */ jsx(
13916
+ Primitive.div,
13917
+ {
13918
+ "data-state": isSelected ? "active" : "inactive",
13919
+ "data-orientation": context.orientation,
13920
+ role: "tabpanel",
13921
+ "aria-labelledby": triggerId,
13922
+ hidden: !present,
13923
+ id: contentId,
13924
+ tabIndex: 0,
13925
+ ...contentProps,
13926
+ ref: forwardedRef,
13927
+ style: {
13928
+ ...props2.style,
13929
+ animationDuration: isMountAnimationPreventedRef.current ? "0s" : void 0
13930
+ },
13931
+ children: present && children
13932
+ }
13933
+ ) });
13934
+ }
13935
+ );
13936
+ TabsContent$1.displayName = CONTENT_NAME$c;
13937
+ function makeTriggerId$1(baseId, value) {
13938
+ return `${baseId}-trigger-${value}`;
13939
+ }
13940
+ function makeContentId$1(baseId, value) {
13941
+ return `${baseId}-content-${value}`;
13942
+ }
13943
+ var Root2$a = Tabs$1;
13944
+ var List$1 = TabsList$1;
13945
+ var Trigger$9 = TabsTrigger$1;
13946
+ var Content$4 = TabsContent$1;
13947
+ function Tabs({
13948
+ className,
13949
+ ...props2
13950
+ }) {
13951
+ return /* @__PURE__ */ jsx(
13952
+ Root2$a,
13953
+ {
13954
+ "data-slot": "tabs",
13955
+ className: cn$1("flex flex-col gap-2", className),
13956
+ ...props2
13957
+ }
13958
+ );
13959
+ }
13960
+ function TabsList({
13961
+ className,
13962
+ ...props2
13963
+ }) {
13964
+ return /* @__PURE__ */ jsx(
13965
+ List$1,
13966
+ {
13967
+ "data-slot": "tabs-list",
13968
+ className: cn$1(
13969
+ "bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",
13970
+ className
13971
+ ),
13972
+ ...props2
13973
+ }
13974
+ );
13975
+ }
13976
+ function TabsTrigger({
13977
+ className,
13978
+ ...props2
13979
+ }) {
13980
+ return /* @__PURE__ */ jsx(
13981
+ Trigger$9,
13982
+ {
13983
+ "data-slot": "tabs-trigger",
13984
+ className: cn$1(
13985
+ "data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
13986
+ className
13987
+ ),
13988
+ ...props2
13989
+ }
13990
+ );
13991
+ }
13992
+ function TabsContent({
13993
+ className,
13994
+ ...props2
13995
+ }) {
13996
+ return /* @__PURE__ */ jsx(
13997
+ Content$4,
13998
+ {
13999
+ "data-slot": "tabs-content",
14000
+ className: cn$1("flex-1 outline-none", className),
14001
+ ...props2
14002
+ }
14003
+ );
14004
+ }
14005
+ const GRID_COLS = {
14006
+ base: {
14007
+ 1: "grid-cols-1",
14008
+ 2: "grid-cols-2",
14009
+ 3: "grid-cols-3",
14010
+ 4: "grid-cols-4",
14011
+ 5: "grid-cols-5",
14012
+ 6: "grid-cols-6",
14013
+ 7: "grid-cols-7",
14014
+ 8: "grid-cols-8",
14015
+ 9: "grid-cols-9",
14016
+ 10: "grid-cols-10",
14017
+ 11: "grid-cols-11",
14018
+ 12: "grid-cols-12"
14019
+ },
14020
+ sm: {
14021
+ 1: "sm:grid-cols-1",
14022
+ 2: "sm:grid-cols-2",
14023
+ 3: "sm:grid-cols-3",
14024
+ 4: "sm:grid-cols-4",
14025
+ 5: "sm:grid-cols-5",
14026
+ 6: "sm:grid-cols-6",
14027
+ 7: "sm:grid-cols-7",
14028
+ 8: "sm:grid-cols-8",
14029
+ 9: "sm:grid-cols-9",
14030
+ 10: "sm:grid-cols-10",
14031
+ 11: "sm:grid-cols-11",
14032
+ 12: "sm:grid-cols-12"
14033
+ },
14034
+ md: {
14035
+ 1: "md:grid-cols-1",
14036
+ 2: "md:grid-cols-2",
14037
+ 3: "md:grid-cols-3",
14038
+ 4: "md:grid-cols-4",
14039
+ 5: "md:grid-cols-5",
14040
+ 6: "md:grid-cols-6",
14041
+ 7: "md:grid-cols-7",
14042
+ 8: "md:grid-cols-8",
14043
+ 9: "md:grid-cols-9",
14044
+ 10: "md:grid-cols-10",
14045
+ 11: "md:grid-cols-11",
14046
+ 12: "md:grid-cols-12"
14047
+ },
14048
+ lg: {
14049
+ 1: "lg:grid-cols-1",
14050
+ 2: "lg:grid-cols-2",
14051
+ 3: "lg:grid-cols-3",
14052
+ 4: "lg:grid-cols-4",
14053
+ 5: "lg:grid-cols-5",
14054
+ 6: "lg:grid-cols-6",
14055
+ 7: "lg:grid-cols-7",
14056
+ 8: "lg:grid-cols-8",
14057
+ 9: "lg:grid-cols-9",
14058
+ 10: "lg:grid-cols-10",
14059
+ 11: "lg:grid-cols-11",
14060
+ 12: "lg:grid-cols-12"
14061
+ },
14062
+ xl: {
14063
+ 1: "xl:grid-cols-1",
14064
+ 2: "xl:grid-cols-2",
14065
+ 3: "xl:grid-cols-3",
14066
+ 4: "xl:grid-cols-4",
14067
+ 5: "xl:grid-cols-5",
14068
+ 6: "xl:grid-cols-6",
14069
+ 7: "xl:grid-cols-7",
14070
+ 8: "xl:grid-cols-8",
14071
+ 9: "xl:grid-cols-9",
14072
+ 10: "xl:grid-cols-10",
14073
+ 11: "xl:grid-cols-11",
14074
+ 12: "xl:grid-cols-12"
14075
+ }
14076
+ };
14077
+ const COL_SPAN = {
14078
+ base: {
14079
+ 1: "col-span-1",
14080
+ 2: "col-span-2",
14081
+ 3: "col-span-3",
14082
+ 4: "col-span-4",
14083
+ 5: "col-span-5",
14084
+ 6: "col-span-6",
14085
+ 7: "col-span-7",
14086
+ 8: "col-span-8",
14087
+ 9: "col-span-9",
14088
+ 10: "col-span-10",
14089
+ 11: "col-span-11",
14090
+ 12: "col-span-12"
14091
+ },
14092
+ sm: {
14093
+ 1: "sm:col-span-1",
14094
+ 2: "sm:col-span-2",
14095
+ 3: "sm:col-span-3",
14096
+ 4: "sm:col-span-4",
14097
+ 5: "sm:col-span-5",
14098
+ 6: "sm:col-span-6",
14099
+ 7: "sm:col-span-7",
14100
+ 8: "sm:col-span-8",
14101
+ 9: "sm:col-span-9",
14102
+ 10: "sm:col-span-10",
14103
+ 11: "sm:col-span-11",
14104
+ 12: "sm:col-span-12"
14105
+ },
14106
+ md: {
14107
+ 1: "md:col-span-1",
14108
+ 2: "md:col-span-2",
14109
+ 3: "md:col-span-3",
14110
+ 4: "md:col-span-4",
14111
+ 5: "md:col-span-5",
14112
+ 6: "md:col-span-6",
14113
+ 7: "md:col-span-7",
14114
+ 8: "md:col-span-8",
14115
+ 9: "md:col-span-9",
14116
+ 10: "md:col-span-10",
14117
+ 11: "md:col-span-11",
14118
+ 12: "md:col-span-12"
14119
+ },
14120
+ lg: {
14121
+ 1: "lg:col-span-1",
14122
+ 2: "lg:col-span-2",
14123
+ 3: "lg:col-span-3",
14124
+ 4: "lg:col-span-4",
14125
+ 5: "lg:col-span-5",
14126
+ 6: "lg:col-span-6",
14127
+ 7: "lg:col-span-7",
14128
+ 8: "lg:col-span-8",
14129
+ 9: "lg:col-span-9",
14130
+ 10: "lg:col-span-10",
14131
+ 11: "lg:col-span-11",
14132
+ 12: "lg:col-span-12"
14133
+ },
14134
+ xl: {
14135
+ 1: "xl:col-span-1",
14136
+ 2: "xl:col-span-2",
14137
+ 3: "xl:col-span-3",
14138
+ 4: "xl:col-span-4",
14139
+ 5: "xl:col-span-5",
14140
+ 6: "xl:col-span-6",
14141
+ 7: "xl:col-span-7",
14142
+ 8: "xl:col-span-8",
14143
+ 9: "xl:col-span-9",
14144
+ 10: "xl:col-span-10",
14145
+ 11: "xl:col-span-11",
14146
+ 12: "xl:col-span-12"
14147
+ }
14148
+ };
14149
+ function gridClasses(options) {
14150
+ const cols = (options == null ? void 0 : options.cols) ?? 1;
14151
+ const sm = options == null ? void 0 : options.smCols;
14152
+ const md = options == null ? void 0 : options.mdCols;
14153
+ const lg = options == null ? void 0 : options.lgCols;
14154
+ const xl = options == null ? void 0 : options.xlCols;
14155
+ const gap = (options == null ? void 0 : options.gap) ?? "gap-4";
14156
+ return cn$1(
14157
+ "grid",
14158
+ GRID_COLS.base[cols],
14159
+ sm ? GRID_COLS.sm[sm] : void 0,
14160
+ md ? GRID_COLS.md[md] : void 0,
14161
+ lg ? GRID_COLS.lg[lg] : void 0,
14162
+ xl ? GRID_COLS.xl[xl] : void 0,
14163
+ gap
14164
+ );
14165
+ }
14166
+ function flexClasses(options) {
14167
+ const direction = (options == null ? void 0 : options.direction) ?? "col";
14168
+ const wrap = (options == null ? void 0 : options.wrap) ? "flex-wrap" : "flex-nowrap";
14169
+ const gap = (options == null ? void 0 : options.gap) ?? "gap-4";
14170
+ const align = (options == null ? void 0 : options.align) ?? "stretch";
14171
+ const justify = (options == null ? void 0 : options.justify) ?? "start";
14172
+ const alignClass = align === "start" ? "items-start" : align === "center" ? "items-center" : align === "end" ? "items-end" : "items-stretch";
14173
+ const justifyClass = justify === "start" ? "justify-start" : justify === "center" ? "justify-center" : justify === "between" ? "justify-between" : "justify-end";
14174
+ return cn$1("flex", `flex-${direction}`, wrap, gap, alignClass, justifyClass);
14175
+ }
14176
+ function leafSpanClasses(leaf) {
14177
+ if (!leaf.span) return void 0;
14178
+ const parts = [];
14179
+ if (leaf.span.base) parts.push(COL_SPAN.base[leaf.span.base]);
14180
+ if (leaf.span.sm) parts.push(COL_SPAN.sm[leaf.span.sm]);
14181
+ if (leaf.span.md) parts.push(COL_SPAN.md[leaf.span.md]);
14182
+ if (leaf.span.lg) parts.push(COL_SPAN.lg[leaf.span.lg]);
14183
+ if (leaf.span.xl) parts.push(COL_SPAN.xl[leaf.span.xl]);
14184
+ return parts.join(" ");
14185
+ }
14186
+ function isLeaf(child) {
14187
+ return child.content !== void 0;
14188
+ }
14189
+ function shallowEqualSpan(a2, b2) {
14190
+ if (a2 === b2) return true;
14191
+ if (!a2 || !b2) return !a2 && !b2;
14192
+ return a2.base === b2.base && a2.sm === b2.sm && a2.md === b2.md && a2.lg === b2.lg && a2.xl === b2.xl;
14193
+ }
14194
+ function shallowEqualLeaf(a2, b2) {
14195
+ const renderKeyEqual = (a2.renderKey ?? null) === (b2.renderKey ?? null);
14196
+ return a2.key === b2.key && a2.hidden === b2.hidden && a2.className === b2.className && a2.labelLayout === b2.labelLayout && a2.labelClassName === b2.labelClassName && a2.valueClassName === b2.valueClassName && a2.inlineLabelWidthClass === b2.inlineLabelWidthClass && shallowEqualSpan(a2.span, b2.span) && renderKeyEqual;
14197
+ }
14198
+ const SectionLeafRenderer = memo$1(
14199
+ function SectionLeafRenderer2({ leaf, renderLeaf }) {
14200
+ if (leaf.hidden) return null;
14201
+ const span = leafSpanClasses(leaf);
14202
+ if (renderLeaf) {
14203
+ return /* @__PURE__ */ jsx("div", { className: cn$1(span, leaf.className), children: renderLeaf(leaf) });
14204
+ }
14205
+ const hasLabel = leaf.label !== void 0 && leaf.label !== null && leaf.label !== "";
14206
+ const layout = leaf.labelLayout ?? "stacked";
14207
+ const labelBaseCls = "text-xs text-muted-foreground";
14208
+ const valueBaseCls = "text-sm leading-6";
14209
+ if (!hasLabel) {
14210
+ return /* @__PURE__ */ jsx("div", { className: cn$1(span, leaf.className, leaf.valueClassName), children: leaf.content });
14211
+ }
14212
+ if (layout === "inline") {
14213
+ const labelWidth = leaf.inlineLabelWidthClass ?? "w-32";
14214
+ return /* @__PURE__ */ jsxs("div", { className: cn$1(span, leaf.className, "flex items-start gap-4"), children: [
14215
+ /* @__PURE__ */ jsx("div", { className: cn$1(labelWidth, labelBaseCls, leaf.labelClassName), children: leaf.label }),
14216
+ /* @__PURE__ */ jsxs("div", { className: cn$1("flex-1", valueBaseCls, leaf.valueClassName), children: [
14217
+ leaf.content,
14218
+ leaf.description ? /* @__PURE__ */ jsx("div", { className: cn$1("mt-1", labelBaseCls), children: leaf.description }) : null
14219
+ ] })
14220
+ ] });
14221
+ }
14222
+ return /* @__PURE__ */ jsxs("div", { className: cn$1(span, leaf.className, "flex flex-col"), children: [
14223
+ /* @__PURE__ */ jsx("div", { className: cn$1(labelBaseCls, leaf.labelClassName), children: leaf.label }),
14224
+ /* @__PURE__ */ jsx("div", { className: cn$1(valueBaseCls, leaf.valueClassName), children: leaf.content }),
14225
+ leaf.description ? /* @__PURE__ */ jsx("div", { className: cn$1("mt-1", labelBaseCls), children: leaf.description }) : null
14226
+ ] });
14227
+ },
14228
+ (prev, next) => shallowEqualLeaf(prev.leaf, next.leaf) && prev.renderLeaf === next.renderLeaf
14229
+ );
14230
+ function SectionNodeRenderer({ node, renderLeaf }) {
14231
+ var _a;
14232
+ if (node.hidden) return null;
14233
+ const layout = node.layout ?? "grid";
14234
+ const containerClass = layout === "grid" ? gridClasses(node.grid) : layout === "flex" ? flexClasses(node.flex) : "";
14235
+ const SectionContainer = ({ children }) => {
14236
+ const title = node.title;
14237
+ const description = node.subtitle;
14238
+ const variant = node.variant ?? "card";
14239
+ const className = node.className;
14240
+ const headerClassName = node.headerClassName;
14241
+ const contentClassName = node.contentClassName;
14242
+ const renderHeader = () => {
14243
+ if (!title && !description) return null;
14244
+ return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-1", headerClassName), children: [
14245
+ title && /* @__PURE__ */ jsx("h3", { className: "text-lg font-medium leading-none", children: title }),
14246
+ description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description })
14247
+ ] });
14248
+ };
14249
+ const renderContent2 = () => /* @__PURE__ */ jsx("div", { className: cn$1("space-y-4", contentClassName), children });
14250
+ switch (variant) {
14251
+ case "card":
14252
+ return /* @__PURE__ */ jsxs(Card, { className, children: [
14253
+ (title || description) && /* @__PURE__ */ jsxs(CardHeader, { children: [
14254
+ title && /* @__PURE__ */ jsx(CardTitle, { children: title }),
14255
+ description && /* @__PURE__ */ jsx(CardDescription, { children: description })
14256
+ ] }),
14257
+ /* @__PURE__ */ jsx(CardContent, { children: renderContent2() })
14258
+ ] });
14259
+ case "separator":
14260
+ return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-6", className), children: [
14261
+ (title || description) && /* @__PURE__ */ jsxs(Fragment, { children: [
14262
+ renderHeader(),
14263
+ /* @__PURE__ */ jsx(Separator$2, {})
14264
+ ] }),
14265
+ renderContent2()
14266
+ ] });
14267
+ default:
14268
+ return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-6", className), children: [
14269
+ renderHeader(),
14270
+ renderContent2()
14271
+ ] });
14272
+ }
14273
+ };
14274
+ if (layout === "tabs" && node.tabs && node.tabs.length > 0) {
14275
+ const defaultTabId = node.defaultTabId ?? ((_a = node.tabs[0]) == null ? void 0 : _a.id);
14276
+ return /* @__PURE__ */ jsx(SectionContainer, { children: /* @__PURE__ */ jsxs(Tabs, { defaultValue: defaultTabId, className: cn$1("space-y-2"), children: [
14277
+ /* @__PURE__ */ jsx(TabsList, { className: cn$1(node.tabsListClassName), children: node.tabs.map((tab) => /* @__PURE__ */ jsx(TabsTrigger, { value: tab.id, className: cn$1(tab.className), children: tab.label }, tab.id)) }),
14278
+ node.tabs.map((tab) => /* @__PURE__ */ jsx(TabsContent, { value: tab.id, className: cn$1(node.tabsContentClassName, tab.contentClassName), children: /* @__PURE__ */ jsx(SectionNodeRenderer, { node: tab.node, renderLeaf }) }, tab.id))
14279
+ ] }) });
14280
+ }
14281
+ return /* @__PURE__ */ jsx(SectionContainer, { children: /* @__PURE__ */ jsx("div", { className: containerClass, children: (node.children ?? []).map((child) => {
14282
+ if (isLeaf(child)) {
14283
+ return /* @__PURE__ */ jsx(SectionLeafRenderer, { leaf: child, renderLeaf }, child.key);
14284
+ }
14285
+ if (child.hidden) return null;
14286
+ return /* @__PURE__ */ jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsx(SectionNodeRenderer, { node: child, renderLeaf }) }, child.id);
14287
+ }) }) });
14288
+ }
14289
+ function SectionBuilder({ sections, className, renderLeaf }) {
14290
+ return /* @__PURE__ */ jsx("div", { className: cn$1("space-y-6", className), children: sections.map((section) => /* @__PURE__ */ jsx(SectionNodeRenderer, { node: section, renderLeaf }, section.id)) });
14291
+ }
14292
+ var NAME$4 = "Label";
14293
+ var Label$3 = React.forwardRef((props2, forwardedRef) => {
14294
+ return /* @__PURE__ */ jsx(
14295
+ Primitive.label,
14296
+ {
14297
+ ...props2,
14298
+ ref: forwardedRef,
14299
+ onMouseDown: (event) => {
14300
+ var _a;
14301
+ const target = event.target;
14302
+ if (target.closest("button, input, select, textarea")) return;
14303
+ (_a = props2.onMouseDown) == null ? void 0 : _a.call(props2, event);
14304
+ if (!event.defaultPrevented && event.detail > 1) event.preventDefault();
14305
+ }
14306
+ }
14307
+ );
14308
+ });
14309
+ Label$3.displayName = NAME$4;
14310
+ var Root$c = Label$3;
14311
+ function Label$2({
14312
+ className,
14313
+ ...props2
14314
+ }) {
14315
+ return /* @__PURE__ */ jsx(
14316
+ Root$c,
14317
+ {
14318
+ "data-slot": "label",
14319
+ className: cn$1(
14320
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
14321
+ className
14322
+ ),
14323
+ ...props2
14324
+ }
14325
+ );
14326
+ }
14327
+ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
14328
+ const onEscapeKeyDown = useCallbackRef$2(onEscapeKeyDownProp);
14329
+ React.useEffect(() => {
14330
+ const handleKeyDown = (event) => {
14331
+ if (event.key === "Escape") {
14332
+ onEscapeKeyDown(event);
14333
+ }
14334
+ };
14335
+ ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
14336
+ return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
14337
+ }, [onEscapeKeyDown, ownerDocument]);
14338
+ }
14339
+ var DISMISSABLE_LAYER_NAME = "DismissableLayer";
14340
+ var CONTEXT_UPDATE = "dismissableLayer.update";
14341
+ var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
14342
+ var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
14343
+ var originalBodyPointerEvents;
14344
+ var DismissableLayerContext = React.createContext({
14345
+ layers: /* @__PURE__ */ new Set(),
14346
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
14347
+ branches: /* @__PURE__ */ new Set()
14348
+ });
14349
+ var DismissableLayer = React.forwardRef(
14350
+ (props2, forwardedRef) => {
14351
+ const {
14352
+ disableOutsidePointerEvents = false,
14353
+ onEscapeKeyDown,
14354
+ onPointerDownOutside,
14355
+ onFocusOutside,
14356
+ onInteractOutside,
14357
+ onDismiss,
14358
+ ...layerProps
14359
+ } = props2;
14360
+ const context = React.useContext(DismissableLayerContext);
14361
+ const [node, setNode] = React.useState(null);
14362
+ const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
14363
+ const [, force] = React.useState({});
14364
+ const composedRefs = useComposedRefs$1(forwardedRef, (node2) => setNode(node2));
14365
+ const layers = Array.from(context.layers);
14366
+ const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
14367
+ const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
14368
+ const index2 = node ? layers.indexOf(node) : -1;
14369
+ const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
14370
+ const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
14371
+ const pointerDownOutside = usePointerDownOutside((event) => {
14372
+ const target = event.target;
14373
+ const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
14374
+ if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
14375
+ onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
14376
+ onInteractOutside == null ? void 0 : onInteractOutside(event);
14377
+ if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
14378
+ }, ownerDocument);
14379
+ const focusOutside = useFocusOutside((event) => {
14380
+ const target = event.target;
14381
+ const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
14382
+ if (isFocusInBranch) return;
14383
+ onFocusOutside == null ? void 0 : onFocusOutside(event);
14384
+ onInteractOutside == null ? void 0 : onInteractOutside(event);
14385
+ if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
14386
+ }, ownerDocument);
14387
+ useEscapeKeydown((event) => {
14388
+ const isHighestLayer = index2 === context.layers.size - 1;
14389
+ if (!isHighestLayer) return;
14390
+ onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
14391
+ if (!event.defaultPrevented && onDismiss) {
14392
+ event.preventDefault();
14393
+ onDismiss();
14394
+ }
14395
+ }, ownerDocument);
14396
+ React.useEffect(() => {
14397
+ if (!node) return;
14398
+ if (disableOutsidePointerEvents) {
14399
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
14400
+ originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
14401
+ ownerDocument.body.style.pointerEvents = "none";
14402
+ }
14403
+ context.layersWithOutsidePointerEventsDisabled.add(node);
14404
+ }
14405
+ context.layers.add(node);
14406
+ dispatchUpdate();
14407
+ return () => {
14408
+ if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
14409
+ ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
14410
+ }
14411
+ };
14412
+ }, [node, ownerDocument, disableOutsidePointerEvents, context]);
14413
+ React.useEffect(() => {
14414
+ return () => {
14415
+ if (!node) return;
14416
+ context.layers.delete(node);
14417
+ context.layersWithOutsidePointerEventsDisabled.delete(node);
14418
+ dispatchUpdate();
14419
+ };
14420
+ }, [node, context]);
14421
+ React.useEffect(() => {
14422
+ const handleUpdate = () => force({});
14423
+ document.addEventListener(CONTEXT_UPDATE, handleUpdate);
14424
+ return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
14425
+ }, []);
14426
+ return /* @__PURE__ */ jsx(
14427
+ Primitive.div,
14428
+ {
14429
+ ...layerProps,
14430
+ ref: composedRefs,
14431
+ style: {
14432
+ pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
14433
+ ...props2.style
14434
+ },
14435
+ onFocusCapture: composeEventHandlers$1(props2.onFocusCapture, focusOutside.onFocusCapture),
14436
+ onBlurCapture: composeEventHandlers$1(props2.onBlurCapture, focusOutside.onBlurCapture),
14437
+ onPointerDownCapture: composeEventHandlers$1(
14438
+ props2.onPointerDownCapture,
14439
+ pointerDownOutside.onPointerDownCapture
14440
+ )
14441
+ }
14442
+ );
14443
+ }
14444
+ );
14445
+ DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
14446
+ var BRANCH_NAME = "DismissableLayerBranch";
14447
+ var DismissableLayerBranch = React.forwardRef((props2, forwardedRef) => {
14448
+ const context = React.useContext(DismissableLayerContext);
14449
+ const ref = React.useRef(null);
14450
+ const composedRefs = useComposedRefs$1(forwardedRef, ref);
14451
+ React.useEffect(() => {
14452
+ const node = ref.current;
14453
+ if (node) {
14454
+ context.branches.add(node);
14455
+ return () => {
14456
+ context.branches.delete(node);
14457
+ };
14458
+ }
14459
+ }, [context.branches]);
14460
+ return /* @__PURE__ */ jsx(Primitive.div, { ...props2, ref: composedRefs });
14461
+ });
14462
+ DismissableLayerBranch.displayName = BRANCH_NAME;
14463
+ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
14464
+ const handlePointerDownOutside = useCallbackRef$2(onPointerDownOutside);
14465
+ const isPointerInsideReactTreeRef = React.useRef(false);
14466
+ const handleClickRef = React.useRef(() => {
14467
+ });
14468
+ React.useEffect(() => {
14469
+ const handlePointerDown2 = (event) => {
14470
+ if (event.target && !isPointerInsideReactTreeRef.current) {
14471
+ let handleAndDispatchPointerDownOutsideEvent2 = function() {
14472
+ handleAndDispatchCustomEvent(
14473
+ POINTER_DOWN_OUTSIDE,
14474
+ handlePointerDownOutside,
14475
+ eventDetail,
14476
+ { discrete: true }
14477
+ );
14478
+ };
14479
+ const eventDetail = { originalEvent: event };
14480
+ if (event.pointerType === "touch") {
14481
+ ownerDocument.removeEventListener("click", handleClickRef.current);
14482
+ handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
14483
+ ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
14484
+ } else {
14485
+ handleAndDispatchPointerDownOutsideEvent2();
14486
+ }
14487
+ } else {
14488
+ ownerDocument.removeEventListener("click", handleClickRef.current);
14489
+ }
14490
+ isPointerInsideReactTreeRef.current = false;
14491
+ };
14492
+ const timerId = window.setTimeout(() => {
14493
+ ownerDocument.addEventListener("pointerdown", handlePointerDown2);
14494
+ }, 0);
14495
+ return () => {
14496
+ window.clearTimeout(timerId);
14497
+ ownerDocument.removeEventListener("pointerdown", handlePointerDown2);
14498
+ ownerDocument.removeEventListener("click", handleClickRef.current);
14499
+ };
14500
+ }, [ownerDocument, handlePointerDownOutside]);
14501
+ return {
14502
+ // ensures we check React component tree (not just DOM tree)
14503
+ onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
14504
+ };
14505
+ }
14506
+ function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
14507
+ const handleFocusOutside = useCallbackRef$2(onFocusOutside);
14508
+ const isFocusInsideReactTreeRef = React.useRef(false);
14509
+ React.useEffect(() => {
14510
+ const handleFocus = (event) => {
14511
+ if (event.target && !isFocusInsideReactTreeRef.current) {
14512
+ const eventDetail = { originalEvent: event };
14513
+ handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
14514
+ discrete: false
14515
+ });
14516
+ }
14517
+ };
14518
+ ownerDocument.addEventListener("focusin", handleFocus);
14519
+ return () => ownerDocument.removeEventListener("focusin", handleFocus);
14520
+ }, [ownerDocument, handleFocusOutside]);
14521
+ return {
14522
+ onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
14523
+ onBlurCapture: () => isFocusInsideReactTreeRef.current = false
14524
+ };
14525
+ }
14526
+ function dispatchUpdate() {
14527
+ const event = new CustomEvent(CONTEXT_UPDATE);
13626
14528
  document.dispatchEvent(event);
13627
14529
  }
13628
14530
  function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
@@ -13662,7 +14564,7 @@ function createFocusGuard() {
13662
14564
  }
13663
14565
  var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
13664
14566
  var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
13665
- var EVENT_OPTIONS$1 = { bubbles: false, cancelable: true };
14567
+ var EVENT_OPTIONS = { bubbles: false, cancelable: true };
13666
14568
  var FOCUS_SCOPE_NAME = "FocusScope";
13667
14569
  var FocusScope = React.forwardRef((props2, forwardedRef) => {
13668
14570
  const {
@@ -13727,11 +14629,11 @@ var FocusScope = React.forwardRef((props2, forwardedRef) => {
13727
14629
  const previouslyFocusedElement = document.activeElement;
13728
14630
  const hasFocusedCandidate = container.contains(previouslyFocusedElement);
13729
14631
  if (!hasFocusedCandidate) {
13730
- const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS$1);
14632
+ const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
13731
14633
  container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
13732
14634
  container.dispatchEvent(mountEvent);
13733
14635
  if (!mountEvent.defaultPrevented) {
13734
- focusFirst$3(removeLinks(getTabbableCandidates$1(container)), { select: true });
14636
+ focusFirst$2(removeLinks(getTabbableCandidates$1(container)), { select: true });
13735
14637
  if (document.activeElement === previouslyFocusedElement) {
13736
14638
  focus(container);
13737
14639
  }
@@ -13740,7 +14642,7 @@ var FocusScope = React.forwardRef((props2, forwardedRef) => {
13740
14642
  return () => {
13741
14643
  container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
13742
14644
  setTimeout(() => {
13743
- const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS$1);
14645
+ const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
13744
14646
  container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
13745
14647
  container.dispatchEvent(unmountEvent);
13746
14648
  if (!unmountEvent.defaultPrevented) {
@@ -13780,7 +14682,7 @@ var FocusScope = React.forwardRef((props2, forwardedRef) => {
13780
14682
  return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
13781
14683
  });
13782
14684
  FocusScope.displayName = FOCUS_SCOPE_NAME;
13783
- function focusFirst$3(candidates, { select = false } = {}) {
14685
+ function focusFirst$2(candidates, { select = false } = {}) {
13784
14686
  const previouslyFocusedElement = document.activeElement;
13785
14687
  for (const candidate of candidates) {
13786
14688
  focus(candidate, { select });
@@ -15729,7 +16631,7 @@ const arrow = (options, deps) => ({
15729
16631
  ...arrow$1(options),
15730
16632
  options: [options, deps]
15731
16633
  });
15732
- var NAME$4 = "Arrow";
16634
+ var NAME$3 = "Arrow";
15733
16635
  var Arrow$1 = React.forwardRef((props2, forwardedRef) => {
15734
16636
  const { children, width = 10, height = 5, ...arrowProps } = props2;
15735
16637
  return /* @__PURE__ */ jsx(
@@ -15745,8 +16647,8 @@ var Arrow$1 = React.forwardRef((props2, forwardedRef) => {
15745
16647
  }
15746
16648
  );
15747
16649
  });
15748
- Arrow$1.displayName = NAME$4;
15749
- var Root$d = Arrow$1;
16650
+ Arrow$1.displayName = NAME$3;
16651
+ var Root$b = Arrow$1;
15750
16652
  var POPPER_NAME = "Popper";
15751
16653
  var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
15752
16654
  var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
@@ -15775,8 +16677,8 @@ var PopperAnchor = React.forwardRef(
15775
16677
  }
15776
16678
  );
15777
16679
  PopperAnchor.displayName = ANCHOR_NAME$2;
15778
- var CONTENT_NAME$c = "PopperContent";
15779
- var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$c);
16680
+ var CONTENT_NAME$b = "PopperContent";
16681
+ var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$b);
15780
16682
  var PopperContent = React.forwardRef(
15781
16683
  (props2, forwardedRef) => {
15782
16684
  var _a, _b, _c, _d, _e2, _f;
@@ -15796,7 +16698,7 @@ var PopperContent = React.forwardRef(
15796
16698
  onPlaced,
15797
16699
  ...contentProps
15798
16700
  } = props2;
15799
- const context = usePopperContext(CONTENT_NAME$c, __scopePopper);
16701
+ const context = usePopperContext(CONTENT_NAME$b, __scopePopper);
15800
16702
  const [content, setContent] = React.useState(null);
15801
16703
  const composedRefs = useComposedRefs$1(forwardedRef, (node) => setContent(node));
15802
16704
  const [arrow$12, setArrow] = React.useState(null);
@@ -15919,7 +16821,7 @@ var PopperContent = React.forwardRef(
15919
16821
  );
15920
16822
  }
15921
16823
  );
15922
- PopperContent.displayName = CONTENT_NAME$c;
16824
+ PopperContent.displayName = CONTENT_NAME$b;
15923
16825
  var ARROW_NAME$8 = "PopperArrow";
15924
16826
  var OPPOSITE_SIDE = {
15925
16827
  top: "bottom",
@@ -15959,7 +16861,7 @@ var PopperArrow = React.forwardRef(function PopperArrow2(props2, forwardedRef) {
15959
16861
  visibility: contentContext.shouldHideArrow ? "hidden" : void 0
15960
16862
  },
15961
16863
  children: /* @__PURE__ */ jsx(
15962
- Root$d,
16864
+ Root$b,
15963
16865
  {
15964
16866
  ...arrowProps,
15965
16867
  ref: forwardedRef,
@@ -16014,9 +16916,9 @@ function getSideAndAlignFromPlacement(placement) {
16014
16916
  const [side, align = "center"] = placement.split("-");
16015
16917
  return [side, align];
16016
16918
  }
16017
- var Root2$a = Popper;
16919
+ var Root2$9 = Popper;
16018
16920
  var Anchor = PopperAnchor;
16019
- var Content$4 = PopperContent;
16921
+ var Content$3 = PopperContent;
16020
16922
  var Arrow = PopperArrow;
16021
16923
  var PORTAL_NAME$a = "Portal";
16022
16924
  var Portal$7 = React.forwardRef((props2, forwardedRef) => {
@@ -16852,7 +17754,7 @@ var Popover$1 = (props2) => {
16852
17754
  onChange: onOpenChange,
16853
17755
  caller: POPOVER_NAME
16854
17756
  });
16855
- return /* @__PURE__ */ jsx(Root2$a, { ...popperScope, children: /* @__PURE__ */ jsx(
17757
+ return /* @__PURE__ */ jsx(Root2$9, { ...popperScope, children: /* @__PURE__ */ jsx(
16856
17758
  PopoverProvider,
16857
17759
  {
16858
17760
  scope: __scopePopover,
@@ -16885,11 +17787,11 @@ var PopoverAnchor$1 = React.forwardRef(
16885
17787
  }
16886
17788
  );
16887
17789
  PopoverAnchor$1.displayName = ANCHOR_NAME$1;
16888
- var TRIGGER_NAME$a = "PopoverTrigger";
17790
+ var TRIGGER_NAME$9 = "PopoverTrigger";
16889
17791
  var PopoverTrigger$1 = React.forwardRef(
16890
17792
  (props2, forwardedRef) => {
16891
17793
  const { __scopePopover, ...triggerProps } = props2;
16892
- const context = usePopoverContext(TRIGGER_NAME$a, __scopePopover);
17794
+ const context = usePopoverContext(TRIGGER_NAME$9, __scopePopover);
16893
17795
  const popperScope = usePopperScope$4(__scopePopover);
16894
17796
  const composedTriggerRef = useComposedRefs$1(forwardedRef, context.triggerRef);
16895
17797
  const trigger = /* @__PURE__ */ jsx(
@@ -16908,7 +17810,7 @@ var PopoverTrigger$1 = React.forwardRef(
16908
17810
  return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: trigger });
16909
17811
  }
16910
17812
  );
16911
- PopoverTrigger$1.displayName = TRIGGER_NAME$a;
17813
+ PopoverTrigger$1.displayName = TRIGGER_NAME$9;
16912
17814
  var PORTAL_NAME$9 = "PopoverPortal";
16913
17815
  var [PortalProvider$4, usePortalContext$4] = createPopoverContext(PORTAL_NAME$9, {
16914
17816
  forceMount: void 0
@@ -16919,20 +17821,20 @@ var PopoverPortal = (props2) => {
16919
17821
  return /* @__PURE__ */ jsx(PortalProvider$4, { scope: __scopePopover, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$7, { asChild: true, container, children }) }) });
16920
17822
  };
16921
17823
  PopoverPortal.displayName = PORTAL_NAME$9;
16922
- var CONTENT_NAME$b = "PopoverContent";
17824
+ var CONTENT_NAME$a = "PopoverContent";
16923
17825
  var PopoverContent$1 = React.forwardRef(
16924
17826
  (props2, forwardedRef) => {
16925
- const portalContext = usePortalContext$4(CONTENT_NAME$b, props2.__scopePopover);
17827
+ const portalContext = usePortalContext$4(CONTENT_NAME$a, props2.__scopePopover);
16926
17828
  const { forceMount = portalContext.forceMount, ...contentProps } = props2;
16927
- const context = usePopoverContext(CONTENT_NAME$b, props2.__scopePopover);
17829
+ const context = usePopoverContext(CONTENT_NAME$a, props2.__scopePopover);
16928
17830
  return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(PopoverContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(PopoverContentNonModal, { ...contentProps, ref: forwardedRef }) });
16929
17831
  }
16930
17832
  );
16931
- PopoverContent$1.displayName = CONTENT_NAME$b;
17833
+ PopoverContent$1.displayName = CONTENT_NAME$a;
16932
17834
  var Slot$3 = /* @__PURE__ */ createSlot("PopoverContent.RemoveScroll");
16933
17835
  var PopoverContentModal = React.forwardRef(
16934
17836
  (props2, forwardedRef) => {
16935
- const context = usePopoverContext(CONTENT_NAME$b, props2.__scopePopover);
17837
+ const context = usePopoverContext(CONTENT_NAME$a, props2.__scopePopover);
16936
17838
  const contentRef = React.useRef(null);
16937
17839
  const composedRefs = useComposedRefs$1(forwardedRef, contentRef);
16938
17840
  const isRightClickOutsideRef = React.useRef(false);
@@ -16973,7 +17875,7 @@ var PopoverContentModal = React.forwardRef(
16973
17875
  );
16974
17876
  var PopoverContentNonModal = React.forwardRef(
16975
17877
  (props2, forwardedRef) => {
16976
- const context = usePopoverContext(CONTENT_NAME$b, props2.__scopePopover);
17878
+ const context = usePopoverContext(CONTENT_NAME$a, props2.__scopePopover);
16977
17879
  const hasInteractedOutsideRef = React.useRef(false);
16978
17880
  const hasPointerDownOutsideRef = React.useRef(false);
16979
17881
  return /* @__PURE__ */ jsx(
@@ -17027,7 +17929,7 @@ var PopoverContentImpl = React.forwardRef(
17027
17929
  onInteractOutside,
17028
17930
  ...contentProps
17029
17931
  } = props2;
17030
- const context = usePopoverContext(CONTENT_NAME$b, __scopePopover);
17932
+ const context = usePopoverContext(CONTENT_NAME$a, __scopePopover);
17031
17933
  const popperScope = usePopperScope$4(__scopePopover);
17032
17934
  useFocusGuards();
17033
17935
  return /* @__PURE__ */ jsx(
@@ -17049,7 +17951,7 @@ var PopoverContentImpl = React.forwardRef(
17049
17951
  onFocusOutside,
17050
17952
  onDismiss: () => context.onOpenChange(false),
17051
17953
  children: /* @__PURE__ */ jsx(
17052
- Content$4,
17954
+ Content$3,
17053
17955
  {
17054
17956
  "data-state": getState$3(context.open),
17055
17957
  role: "dialog",
@@ -17105,20 +18007,20 @@ PopoverArrow.displayName = ARROW_NAME$7;
17105
18007
  function getState$3(open) {
17106
18008
  return open ? "open" : "closed";
17107
18009
  }
17108
- var Root2$9 = Popover$1;
18010
+ var Root2$8 = Popover$1;
17109
18011
  var Anchor2$1 = PopoverAnchor$1;
17110
- var Trigger$9 = PopoverTrigger$1;
18012
+ var Trigger$8 = PopoverTrigger$1;
17111
18013
  var Portal$6 = PopoverPortal;
17112
18014
  var Content2$8 = PopoverContent$1;
17113
18015
  function Popover({
17114
18016
  ...props2
17115
18017
  }) {
17116
- return /* @__PURE__ */ jsx(Root2$9, { "data-slot": "popover", ...props2 });
18018
+ return /* @__PURE__ */ jsx(Root2$8, { "data-slot": "popover", ...props2 });
17117
18019
  }
17118
18020
  function PopoverTrigger({
17119
18021
  ...props2
17120
18022
  }) {
17121
- return /* @__PURE__ */ jsx(Trigger$9, { "data-slot": "popover-trigger", ...props2 });
18023
+ return /* @__PURE__ */ jsx(Trigger$8, { "data-slot": "popover-trigger", ...props2 });
17122
18024
  }
17123
18025
  function PopoverContent({
17124
18026
  className,
@@ -17133,7 +18035,7 @@ function PopoverContent({
17133
18035
  align,
17134
18036
  sideOffset,
17135
18037
  className: cn$1(
17136
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
18038
+ "border-border bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
17137
18039
  className
17138
18040
  ),
17139
18041
  ...props2
@@ -17198,11 +18100,11 @@ var Dialog$1 = (props2) => {
17198
18100
  );
17199
18101
  };
17200
18102
  Dialog$1.displayName = DIALOG_NAME;
17201
- var TRIGGER_NAME$9 = "DialogTrigger";
18103
+ var TRIGGER_NAME$8 = "DialogTrigger";
17202
18104
  var DialogTrigger$1 = React.forwardRef(
17203
18105
  (props2, forwardedRef) => {
17204
18106
  const { __scopeDialog, ...triggerProps } = props2;
17205
- const context = useDialogContext(TRIGGER_NAME$9, __scopeDialog);
18107
+ const context = useDialogContext(TRIGGER_NAME$8, __scopeDialog);
17206
18108
  const composedTriggerRef = useComposedRefs$1(forwardedRef, context.triggerRef);
17207
18109
  return /* @__PURE__ */ jsx(
17208
18110
  Primitive.button,
@@ -17219,7 +18121,7 @@ var DialogTrigger$1 = React.forwardRef(
17219
18121
  );
17220
18122
  }
17221
18123
  );
17222
- DialogTrigger$1.displayName = TRIGGER_NAME$9;
18124
+ DialogTrigger$1.displayName = TRIGGER_NAME$8;
17223
18125
  var PORTAL_NAME$8 = "DialogPortal";
17224
18126
  var [PortalProvider$3, usePortalContext$3] = createDialogContext(PORTAL_NAME$8, {
17225
18127
  forceMount: void 0
@@ -17260,19 +18162,19 @@ var DialogOverlayImpl = React.forwardRef(
17260
18162
  );
17261
18163
  }
17262
18164
  );
17263
- var CONTENT_NAME$a = "DialogContent";
18165
+ var CONTENT_NAME$9 = "DialogContent";
17264
18166
  var DialogContent$1 = React.forwardRef(
17265
18167
  (props2, forwardedRef) => {
17266
- const portalContext = usePortalContext$3(CONTENT_NAME$a, props2.__scopeDialog);
18168
+ const portalContext = usePortalContext$3(CONTENT_NAME$9, props2.__scopeDialog);
17267
18169
  const { forceMount = portalContext.forceMount, ...contentProps } = props2;
17268
- const context = useDialogContext(CONTENT_NAME$a, props2.__scopeDialog);
18170
+ const context = useDialogContext(CONTENT_NAME$9, props2.__scopeDialog);
17269
18171
  return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
17270
18172
  }
17271
18173
  );
17272
- DialogContent$1.displayName = CONTENT_NAME$a;
18174
+ DialogContent$1.displayName = CONTENT_NAME$9;
17273
18175
  var DialogContentModal = React.forwardRef(
17274
18176
  (props2, forwardedRef) => {
17275
- const context = useDialogContext(CONTENT_NAME$a, props2.__scopeDialog);
18177
+ const context = useDialogContext(CONTENT_NAME$9, props2.__scopeDialog);
17276
18178
  const contentRef = React.useRef(null);
17277
18179
  const composedRefs = useComposedRefs$1(forwardedRef, context.contentRef, contentRef);
17278
18180
  React.useEffect(() => {
@@ -17307,7 +18209,7 @@ var DialogContentModal = React.forwardRef(
17307
18209
  );
17308
18210
  var DialogContentNonModal = React.forwardRef(
17309
18211
  (props2, forwardedRef) => {
17310
- const context = useDialogContext(CONTENT_NAME$a, props2.__scopeDialog);
18212
+ const context = useDialogContext(CONTENT_NAME$9, props2.__scopeDialog);
17311
18213
  const hasInteractedOutsideRef = React.useRef(false);
17312
18214
  const hasPointerDownOutsideRef = React.useRef(false);
17313
18215
  return /* @__PURE__ */ jsx(
@@ -17350,7 +18252,7 @@ var DialogContentNonModal = React.forwardRef(
17350
18252
  var DialogContentImpl = React.forwardRef(
17351
18253
  (props2, forwardedRef) => {
17352
18254
  const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props2;
17353
- const context = useDialogContext(CONTENT_NAME$a, __scopeDialog);
18255
+ const context = useDialogContext(CONTENT_NAME$9, __scopeDialog);
17354
18256
  const contentRef = React.useRef(null);
17355
18257
  const composedRefs = useComposedRefs$1(forwardedRef, contentRef);
17356
18258
  useFocusGuards();
@@ -17425,7 +18327,7 @@ function getState$2(open) {
17425
18327
  }
17426
18328
  var TITLE_WARNING_NAME = "DialogTitleWarning";
17427
18329
  var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
17428
- contentName: CONTENT_NAME$a,
18330
+ contentName: CONTENT_NAME$9,
17429
18331
  titleName: TITLE_NAME$1,
17430
18332
  docsSlug: "dialog"
17431
18333
  });
@@ -17458,11 +18360,11 @@ var DescriptionWarning$1 = ({ contentRef, descriptionId }) => {
17458
18360
  }, [MESSAGE, contentRef, descriptionId]);
17459
18361
  return null;
17460
18362
  };
17461
- var Root$c = Dialog$1;
17462
- var Trigger$8 = DialogTrigger$1;
18363
+ var Root$a = Dialog$1;
18364
+ var Trigger$7 = DialogTrigger$1;
17463
18365
  var Portal$5 = DialogPortal$1;
17464
18366
  var Overlay$1 = DialogOverlay$1;
17465
- var Content$3 = DialogContent$1;
18367
+ var Content$2 = DialogContent$1;
17466
18368
  var Title = DialogTitle$1;
17467
18369
  var Description = DialogDescription$1;
17468
18370
  var Close = DialogClose$1;
@@ -17694,7 +18596,7 @@ var N$1 = '[cmdk-group=""]', Y$1 = '[cmdk-group-items=""]', be = '[cmdk-group-he
17694
18596
  }, []), React.createElement(Primitive.div, { ref: composeRefs$1(d, o2), ...c2, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": p2, "aria-label": u2, id: b2.listId }, B(r2, (m2) => React.createElement("div", { ref: composeRefs$1(f, b2.listInnerRef), "cmdk-list-sizer": "" }, m2)));
17695
18597
  }), xe = React.forwardRef((r2, o2) => {
17696
18598
  let { open: n2, onOpenChange: u2, overlayClassName: c2, contentClassName: d, container: f, ...p2 } = r2;
17697
- return React.createElement(Root$c, { open: n2, onOpenChange: u2 }, React.createElement(Portal$5, { container: f }, React.createElement(Overlay$1, { "cmdk-overlay": "", className: c2 }), React.createElement(Content$3, { "aria-label": r2.label, "cmdk-dialog": "", className: d }, React.createElement(me, { ref: o2, ...p2 }))));
18599
+ return React.createElement(Root$a, { open: n2, onOpenChange: u2 }, React.createElement(Portal$5, { container: f }, React.createElement(Overlay$1, { "cmdk-overlay": "", className: c2 }), React.createElement(Content$2, { "aria-label": r2.label, "cmdk-dialog": "", className: d }, React.createElement(me, { ref: o2, ...p2 }))));
17698
18600
  }), Ie = React.forwardRef((r2, o2) => P((u2) => u2.filtered.count === 0) ? React.createElement(Primitive.div, { ref: o2, ...r2, "cmdk-empty": "", role: "presentation" }) : null), Pe = React.forwardRef((r2, o2) => {
17699
18601
  let { progress: n2, children: u2, label: c2 = "Loading...", ...d } = r2;
17700
18602
  return React.createElement(Primitive.div, { ref: o2, ...d, "cmdk-loading": "", role: "progressbar", "aria-valuenow": n2, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": c2 }, B(r2, (f) => React.createElement("div", { "aria-hidden": true }, f)));
@@ -17761,12 +18663,12 @@ var Te = { position: "absolute", width: "1px", height: "1px", padding: "0", marg
17761
18663
  function Dialog({
17762
18664
  ...props2
17763
18665
  }) {
17764
- return /* @__PURE__ */ jsx(Root$c, { "data-slot": "dialog", ...props2 });
18666
+ return /* @__PURE__ */ jsx(Root$a, { "data-slot": "dialog", ...props2 });
17765
18667
  }
17766
18668
  function DialogTrigger({
17767
18669
  ...props2
17768
18670
  }) {
17769
- return /* @__PURE__ */ jsx(Trigger$8, { "data-slot": "dialog-trigger", ...props2 });
18671
+ return /* @__PURE__ */ jsx(Trigger$7, { "data-slot": "dialog-trigger", ...props2 });
17770
18672
  }
17771
18673
  function DialogPortal({
17772
18674
  ...props2
@@ -17803,7 +18705,7 @@ function DialogContent({
17803
18705
  return /* @__PURE__ */ jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
17804
18706
  /* @__PURE__ */ jsx(DialogOverlay, {}),
17805
18707
  /* @__PURE__ */ jsxs(
17806
- Content$3,
18708
+ Content$2,
17807
18709
  {
17808
18710
  "data-slot": "dialog-content",
17809
18711
  className: cn$1(
@@ -17925,7 +18827,7 @@ function CommandInput({
17925
18827
  "div",
17926
18828
  {
17927
18829
  "data-slot": "command-input-wrapper",
17928
- className: "flex h-9 items-center gap-2 border-b px-3",
18830
+ className: "flex h-9 items-center gap-2 border-b border-border px-3",
17929
18831
  children: [
17930
18832
  /* @__PURE__ */ jsx(Search, { className: "size-4 shrink-0 opacity-50" }),
17931
18833
  /* @__PURE__ */ jsx(
@@ -18165,8 +19067,12 @@ function Autocomplete({
18165
19067
  if (controlledValue !== void 0) setValue(controlledValue);
18166
19068
  }, [controlledValue]);
18167
19069
  const labelMapRef = useRef(/* @__PURE__ */ new Map());
19070
+ const rawMapRef = useRef(/* @__PURE__ */ new Map());
18168
19071
  const addToLabelMap = useCallback((opt) => {
18169
19072
  labelMapRef.current.set(opt.value, opt.label);
19073
+ if (Object.prototype.hasOwnProperty.call(opt, "raw") && opt.raw !== void 0) {
19074
+ rawMapRef.current.set(opt.value, opt.raw);
19075
+ }
18170
19076
  }, []);
18171
19077
  const [labelTick, setLabelTick] = useState(0);
18172
19078
  const getLabel2 = useCallback(
@@ -18186,13 +19092,15 @@ function Autocomplete({
18186
19092
  if (controlledValue === void 0) setValue(newValues);
18187
19093
  const selectedOptions = newValues.map((v) => ({
18188
19094
  value: v,
18189
- label: getLabel2(v)
19095
+ label: getLabel2(v),
19096
+ raw: rawMapRef.current.get(v)
18190
19097
  }));
18191
- onChange == null ? void 0 : onChange(newValues, selectedOptions);
19098
+ const raws = selectedOptions.map((o2) => o2.raw);
19099
+ onChange == null ? void 0 : onChange(newValues, selectedOptions, raws);
18192
19100
  } else {
18193
19101
  const newValue = next.value;
18194
19102
  if (controlledValue === void 0) setValue(newValue);
18195
- onChange == null ? void 0 : onChange(newValue, next);
19103
+ onChange == null ? void 0 : onChange(newValue, next, next.raw ?? null);
18196
19104
  setOpen(false);
18197
19105
  }
18198
19106
  },
@@ -18322,16 +19230,16 @@ function Autocomplete({
18322
19230
  [isMultiple, value]
18323
19231
  );
18324
19232
  const selectedOptionsMulti = useMemo(
18325
- () => selectedValues.map((v) => ({ value: v, label: getLabel2(v) })),
19233
+ () => selectedValues.map((v) => ({ value: v, label: getLabel2(v), raw: rawMapRef.current.get(v) })),
18326
19234
  [getLabel2, selectedValues, labelTick]
18327
19235
  );
18328
19236
  const handleClear = useCallback(() => {
18329
19237
  if (isMultiple) {
18330
19238
  if (controlledValue === void 0) setValue([]);
18331
- onChange == null ? void 0 : onChange([], []);
19239
+ onChange == null ? void 0 : onChange([], [], []);
18332
19240
  } else {
18333
19241
  if (controlledValue === void 0) setValue(null);
18334
- onChange == null ? void 0 : onChange(null, null);
19242
+ onChange == null ? void 0 : onChange(null, null, null);
18335
19243
  }
18336
19244
  }, [controlledValue, isMultiple, onChange]);
18337
19245
  const addCustomValue = useCallback(
@@ -18347,13 +19255,15 @@ function Autocomplete({
18347
19255
  if (controlledValue === void 0) setValue(newValues);
18348
19256
  const newOptions = newValues.map((v) => ({
18349
19257
  value: v,
18350
- label: getLabel2(v)
19258
+ label: getLabel2(v),
19259
+ raw: rawMapRef.current.get(v)
18351
19260
  }));
18352
- onChange == null ? void 0 : onChange(newValues, newOptions);
19261
+ const raws = newOptions.map((o2) => o2.raw);
19262
+ onChange == null ? void 0 : onChange(newValues, newOptions, raws);
18353
19263
  setSearch("");
18354
19264
  } else {
18355
19265
  if (controlledValue === void 0) setValue(created.value);
18356
- onChange == null ? void 0 : onChange(created.value, created);
19266
+ onChange == null ? void 0 : onChange(created.value, created, created.raw ?? null);
18357
19267
  setSearch("");
18358
19268
  setOpen(false);
18359
19269
  }
@@ -18378,7 +19288,7 @@ function Autocomplete({
18378
19288
  tabIndex: disabled ? -1 : 0,
18379
19289
  "aria-disabled": disabled || void 0,
18380
19290
  className: cn$1(
18381
- "w-full inline-flex items-center justify-between rounded-md border bg-background px-3 py-2 text-sm shadow-sm transition-colors",
19291
+ "w-full inline-flex items-center justify-between rounded-md border border-border bg-background px-3 py-2 text-sm shadow-sm transition-colors",
18382
19292
  "hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
18383
19293
  disabled && "opacity-50 pointer-events-none",
18384
19294
  className
@@ -18722,7 +19632,7 @@ function Autocomplete({
18722
19632
  ] });
18723
19633
  }
18724
19634
  function AutocompleteField({ field, value, onChange, className }) {
18725
- const options = (field.options ?? []).filter((o2) => o2.value !== null && o2.value !== void 0).map((o2) => ({ label: o2.label, value: o2.value }));
19635
+ const options = (field.options ?? []).filter((o2) => o2.value !== null && o2.value !== void 0).map((o2) => ({ label: o2.label, value: o2.value, raw: o2.raw }));
18726
19636
  let defaultValueShaped = void 0;
18727
19637
  if (field.defaultValue !== void 0) {
18728
19638
  if (field.multiple) {
@@ -18755,7 +19665,7 @@ function AutocompleteField({ field, value, onChange, className }) {
18755
19665
  initialSelectedOptions: field.initialSelectedOptions ?? null,
18756
19666
  loadSelected: field.loadSelected,
18757
19667
  value: field.multiple ? Array.isArray(value) ? value : value ? [value] : [] : value ?? null,
18758
- onChange: (val) => onChange(val),
19668
+ onChange: (val, option, raw) => onChange(val, option, raw),
18759
19669
  placeholder: field.placeholder,
18760
19670
  searchPlaceholder: field.searchPlaceholder,
18761
19671
  renderOption: field.renderOption,
@@ -18771,7 +19681,7 @@ function Input({ className, type, ...props2 }) {
18771
19681
  type,
18772
19682
  "data-slot": "input",
18773
19683
  className: cn$1(
18774
- "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
19684
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-border flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
18775
19685
  "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
18776
19686
  "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
18777
19687
  className
@@ -18814,7 +19724,7 @@ function Textarea({ className, ...props2 }) {
18814
19724
  {
18815
19725
  "data-slot": "textarea",
18816
19726
  className: cn$1(
18817
- "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
19727
+ "border-border placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
18818
19728
  className
18819
19729
  ),
18820
19730
  ...props2
@@ -18850,7 +19760,7 @@ var VISUALLY_HIDDEN_STYLES = Object.freeze({
18850
19760
  whiteSpace: "nowrap",
18851
19761
  wordWrap: "normal"
18852
19762
  });
18853
- var NAME$3 = "VisuallyHidden";
19763
+ var NAME$2 = "VisuallyHidden";
18854
19764
  var VisuallyHidden = React.forwardRef(
18855
19765
  (props2, forwardedRef) => {
18856
19766
  return /* @__PURE__ */ jsx(
@@ -18863,14 +19773,14 @@ var VisuallyHidden = React.forwardRef(
18863
19773
  );
18864
19774
  }
18865
19775
  );
18866
- VisuallyHidden.displayName = NAME$3;
18867
- var Root$b = VisuallyHidden;
19776
+ VisuallyHidden.displayName = NAME$2;
19777
+ var Root$9 = VisuallyHidden;
18868
19778
  var OPEN_KEYS = [" ", "Enter", "ArrowUp", "ArrowDown"];
18869
19779
  var SELECTION_KEYS$1 = [" ", "Enter"];
18870
19780
  var SELECT_NAME = "Select";
18871
- var [Collection$5, useCollection$5, createCollectionScope$5] = createCollection(SELECT_NAME);
19781
+ var [Collection$4, useCollection$4, createCollectionScope$4] = createCollection(SELECT_NAME);
18872
19782
  var [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME, [
18873
- createCollectionScope$5,
19783
+ createCollectionScope$4,
18874
19784
  createPopperScope
18875
19785
  ]);
18876
19786
  var usePopperScope$3 = createPopperScope();
@@ -18914,7 +19824,7 @@ var Select$2 = (props2) => {
18914
19824
  const isFormControl = trigger ? form || !!trigger.closest("form") : true;
18915
19825
  const [nativeOptionsSet, setNativeOptionsSet] = React.useState(/* @__PURE__ */ new Set());
18916
19826
  const nativeSelectKey = Array.from(nativeOptionsSet).map((option) => option.props.value).join(";");
18917
- return /* @__PURE__ */ jsx(Root2$a, { ...popperScope, children: /* @__PURE__ */ jsxs(
19827
+ return /* @__PURE__ */ jsx(Root2$9, { ...popperScope, children: /* @__PURE__ */ jsxs(
18918
19828
  SelectProvider,
18919
19829
  {
18920
19830
  required: required2,
@@ -18934,7 +19844,7 @@ var Select$2 = (props2) => {
18934
19844
  triggerPointerDownPosRef,
18935
19845
  disabled,
18936
19846
  children: [
18937
- /* @__PURE__ */ jsx(Collection$5.Provider, { scope: __scopeSelect, children: /* @__PURE__ */ jsx(
19847
+ /* @__PURE__ */ jsx(Collection$4.Provider, { scope: __scopeSelect, children: /* @__PURE__ */ jsx(
18938
19848
  SelectNativeOptionsProvider,
18939
19849
  {
18940
19850
  scope: props2.__scopeSelect,
@@ -18975,15 +19885,15 @@ var Select$2 = (props2) => {
18975
19885
  ) });
18976
19886
  };
18977
19887
  Select$2.displayName = SELECT_NAME;
18978
- var TRIGGER_NAME$8 = "SelectTrigger";
19888
+ var TRIGGER_NAME$7 = "SelectTrigger";
18979
19889
  var SelectTrigger$1 = React.forwardRef(
18980
19890
  (props2, forwardedRef) => {
18981
19891
  const { __scopeSelect, disabled = false, ...triggerProps } = props2;
18982
19892
  const popperScope = usePopperScope$3(__scopeSelect);
18983
- const context = useSelectContext(TRIGGER_NAME$8, __scopeSelect);
19893
+ const context = useSelectContext(TRIGGER_NAME$7, __scopeSelect);
18984
19894
  const isDisabled = context.disabled || disabled;
18985
19895
  const composedRefs = useComposedRefs$1(forwardedRef, context.onTriggerChange);
18986
- const getItems = useCollection$5(__scopeSelect);
19896
+ const getItems = useCollection$4(__scopeSelect);
18987
19897
  const pointerTypeRef = React.useRef("touch");
18988
19898
  const [searchRef, handleTypeaheadSearch, resetTypeahead] = useTypeaheadSearch((search) => {
18989
19899
  const enabledItems = getItems().filter((item) => !item.disabled);
@@ -19052,7 +19962,7 @@ var SelectTrigger$1 = React.forwardRef(
19052
19962
  ) });
19053
19963
  }
19054
19964
  );
19055
- SelectTrigger$1.displayName = TRIGGER_NAME$8;
19965
+ SelectTrigger$1.displayName = TRIGGER_NAME$7;
19056
19966
  var VALUE_NAME = "SelectValue";
19057
19967
  var SelectValue$1 = React.forwardRef(
19058
19968
  (props2, forwardedRef) => {
@@ -19089,10 +19999,10 @@ var SelectPortal = (props2) => {
19089
19999
  return /* @__PURE__ */ jsx(Portal$7, { asChild: true, ...props2 });
19090
20000
  };
19091
20001
  SelectPortal.displayName = PORTAL_NAME$7;
19092
- var CONTENT_NAME$9 = "SelectContent";
20002
+ var CONTENT_NAME$8 = "SelectContent";
19093
20003
  var SelectContent$1 = React.forwardRef(
19094
20004
  (props2, forwardedRef) => {
19095
- const context = useSelectContext(CONTENT_NAME$9, props2.__scopeSelect);
20005
+ const context = useSelectContext(CONTENT_NAME$8, props2.__scopeSelect);
19096
20006
  const [fragment, setFragment] = React.useState();
19097
20007
  useLayoutEffect2(() => {
19098
20008
  setFragment(new DocumentFragment());
@@ -19100,16 +20010,16 @@ var SelectContent$1 = React.forwardRef(
19100
20010
  if (!context.open) {
19101
20011
  const frag = fragment;
19102
20012
  return frag ? ReactDOM.createPortal(
19103
- /* @__PURE__ */ jsx(SelectContentProvider, { scope: props2.__scopeSelect, children: /* @__PURE__ */ jsx(Collection$5.Slot, { scope: props2.__scopeSelect, children: /* @__PURE__ */ jsx("div", { children: props2.children }) }) }),
20013
+ /* @__PURE__ */ jsx(SelectContentProvider, { scope: props2.__scopeSelect, children: /* @__PURE__ */ jsx(Collection$4.Slot, { scope: props2.__scopeSelect, children: /* @__PURE__ */ jsx("div", { children: props2.children }) }) }),
19104
20014
  frag
19105
20015
  ) : null;
19106
20016
  }
19107
20017
  return /* @__PURE__ */ jsx(SelectContentImpl, { ...props2, ref: forwardedRef });
19108
20018
  }
19109
20019
  );
19110
- SelectContent$1.displayName = CONTENT_NAME$9;
20020
+ SelectContent$1.displayName = CONTENT_NAME$8;
19111
20021
  var CONTENT_MARGIN = 10;
19112
- var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME$9);
20022
+ var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME$8);
19113
20023
  var CONTENT_IMPL_NAME = "SelectContentImpl";
19114
20024
  var Slot$1 = /* @__PURE__ */ createSlot("SelectContent.RemoveScroll");
19115
20025
  var SelectContentImpl = React.forwardRef(
@@ -19135,7 +20045,7 @@ var SelectContentImpl = React.forwardRef(
19135
20045
  //
19136
20046
  ...contentProps
19137
20047
  } = props2;
19138
- const context = useSelectContext(CONTENT_NAME$9, __scopeSelect);
20048
+ const context = useSelectContext(CONTENT_NAME$8, __scopeSelect);
19139
20049
  const [content, setContent] = React.useState(null);
19140
20050
  const [viewport, setViewport] = React.useState(null);
19141
20051
  const composedRefs = useComposedRefs$1(forwardedRef, (node) => setContent(node));
@@ -19143,7 +20053,7 @@ var SelectContentImpl = React.forwardRef(
19143
20053
  const [selectedItemText, setSelectedItemText] = React.useState(
19144
20054
  null
19145
20055
  );
19146
- const getItems = useCollection$5(__scopeSelect);
20056
+ const getItems = useCollection$4(__scopeSelect);
19147
20057
  const [isPositioned, setIsPositioned] = React.useState(false);
19148
20058
  const firstValidItemFoundRef = React.useRef(false);
19149
20059
  React.useEffect(() => {
@@ -19350,12 +20260,12 @@ SelectContentImpl.displayName = CONTENT_IMPL_NAME;
19350
20260
  var ITEM_ALIGNED_POSITION_NAME = "SelectItemAlignedPosition";
19351
20261
  var SelectItemAlignedPosition = React.forwardRef((props2, forwardedRef) => {
19352
20262
  const { __scopeSelect, onPlaced, ...popperProps } = props2;
19353
- const context = useSelectContext(CONTENT_NAME$9, __scopeSelect);
19354
- const contentContext = useSelectContentContext(CONTENT_NAME$9, __scopeSelect);
20263
+ const context = useSelectContext(CONTENT_NAME$8, __scopeSelect);
20264
+ const contentContext = useSelectContentContext(CONTENT_NAME$8, __scopeSelect);
19355
20265
  const [contentWrapper, setContentWrapper] = React.useState(null);
19356
20266
  const [content, setContent] = React.useState(null);
19357
20267
  const composedRefs = useComposedRefs$1(forwardedRef, (node) => setContent(node));
19358
- const getItems = useCollection$5(__scopeSelect);
20268
+ const getItems = useCollection$4(__scopeSelect);
19359
20269
  const shouldExpandOnScrollRef = React.useRef(false);
19360
20270
  const shouldRepositionRef = React.useRef(true);
19361
20271
  const { viewport, selectedItem, selectedItemText, focusSelectedItem } = contentContext;
@@ -19521,7 +20431,7 @@ var SelectPopperPosition = React.forwardRef((props2, forwardedRef) => {
19521
20431
  } = props2;
19522
20432
  const popperScope = usePopperScope$3(__scopeSelect);
19523
20433
  return /* @__PURE__ */ jsx(
19524
- Content$4,
20434
+ Content$3,
19525
20435
  {
19526
20436
  ...popperScope,
19527
20437
  ...popperProps,
@@ -19545,7 +20455,7 @@ var SelectPopperPosition = React.forwardRef((props2, forwardedRef) => {
19545
20455
  );
19546
20456
  });
19547
20457
  SelectPopperPosition.displayName = POPPER_POSITION_NAME;
19548
- var [SelectViewportProvider, useSelectViewportContext] = createSelectContext(CONTENT_NAME$9, {});
20458
+ var [SelectViewportProvider, useSelectViewportContext] = createSelectContext(CONTENT_NAME$8, {});
19549
20459
  var VIEWPORT_NAME$2 = "SelectViewport";
19550
20460
  var SelectViewport = React.forwardRef(
19551
20461
  (props2, forwardedRef) => {
@@ -19564,7 +20474,7 @@ var SelectViewport = React.forwardRef(
19564
20474
  nonce
19565
20475
  }
19566
20476
  ),
19567
- /* @__PURE__ */ jsx(Collection$5.Slot, { scope: __scopeSelect, children: /* @__PURE__ */ jsx(
20477
+ /* @__PURE__ */ jsx(Collection$4.Slot, { scope: __scopeSelect, children: /* @__PURE__ */ jsx(
19568
20478
  Primitive.div,
19569
20479
  {
19570
20480
  "data-radix-select-viewport": "",
@@ -19614,8 +20524,8 @@ var SelectViewport = React.forwardRef(
19614
20524
  }
19615
20525
  );
19616
20526
  SelectViewport.displayName = VIEWPORT_NAME$2;
19617
- var GROUP_NAME$5 = "SelectGroup";
19618
- var [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext(GROUP_NAME$5);
20527
+ var GROUP_NAME$4 = "SelectGroup";
20528
+ var [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext(GROUP_NAME$4);
19619
20529
  var SelectGroup$1 = React.forwardRef(
19620
20530
  (props2, forwardedRef) => {
19621
20531
  const { __scopeSelect, ...groupProps } = props2;
@@ -19623,7 +20533,7 @@ var SelectGroup$1 = React.forwardRef(
19623
20533
  return /* @__PURE__ */ jsx(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId, children: /* @__PURE__ */ jsx(Primitive.div, { role: "group", "aria-labelledby": groupId, ...groupProps, ref: forwardedRef }) });
19624
20534
  }
19625
20535
  );
19626
- SelectGroup$1.displayName = GROUP_NAME$5;
20536
+ SelectGroup$1.displayName = GROUP_NAME$4;
19627
20537
  var LABEL_NAME$4 = "SelectLabel";
19628
20538
  var SelectLabel$1 = React.forwardRef(
19629
20539
  (props2, forwardedRef) => {
@@ -19633,8 +20543,8 @@ var SelectLabel$1 = React.forwardRef(
19633
20543
  }
19634
20544
  );
19635
20545
  SelectLabel$1.displayName = LABEL_NAME$4;
19636
- var ITEM_NAME$8 = "SelectItem";
19637
- var [SelectItemContextProvider, useSelectItemContext] = createSelectContext(ITEM_NAME$8);
20546
+ var ITEM_NAME$7 = "SelectItem";
20547
+ var [SelectItemContextProvider, useSelectItemContext] = createSelectContext(ITEM_NAME$7);
19638
20548
  var SelectItem$1 = React.forwardRef(
19639
20549
  (props2, forwardedRef) => {
19640
20550
  const {
@@ -19644,8 +20554,8 @@ var SelectItem$1 = React.forwardRef(
19644
20554
  textValue: textValueProp,
19645
20555
  ...itemProps
19646
20556
  } = props2;
19647
- const context = useSelectContext(ITEM_NAME$8, __scopeSelect);
19648
- const contentContext = useSelectContentContext(ITEM_NAME$8, __scopeSelect);
20557
+ const context = useSelectContext(ITEM_NAME$7, __scopeSelect);
20558
+ const contentContext = useSelectContentContext(ITEM_NAME$7, __scopeSelect);
19649
20559
  const isSelected = context.value === value;
19650
20560
  const [textValue, setTextValue] = React.useState(textValueProp ?? "");
19651
20561
  const [isFocused, setIsFocused] = React.useState(false);
@@ -19681,7 +20591,7 @@ var SelectItem$1 = React.forwardRef(
19681
20591
  setTextValue((prevTextValue) => prevTextValue || ((node == null ? void 0 : node.textContent) ?? "").trim());
19682
20592
  }, []),
19683
20593
  children: /* @__PURE__ */ jsx(
19684
- Collection$5.ItemSlot,
20594
+ Collection$4.ItemSlot,
19685
20595
  {
19686
20596
  scope: __scopeSelect,
19687
20597
  value,
@@ -19741,7 +20651,7 @@ var SelectItem$1 = React.forwardRef(
19741
20651
  );
19742
20652
  }
19743
20653
  );
19744
- SelectItem$1.displayName = ITEM_NAME$8;
20654
+ SelectItem$1.displayName = ITEM_NAME$7;
19745
20655
  var ITEM_TEXT_NAME = "SelectItemText";
19746
20656
  var SelectItemText = React.forwardRef(
19747
20657
  (props2, forwardedRef) => {
@@ -19857,7 +20767,7 @@ var SelectScrollButtonImpl = React.forwardRef((props2, forwardedRef) => {
19857
20767
  const { __scopeSelect, onAutoScroll, ...scrollIndicatorProps } = props2;
19858
20768
  const contentContext = useSelectContentContext("SelectScrollButton", __scopeSelect);
19859
20769
  const autoScrollTimerRef = React.useRef(null);
19860
- const getItems = useCollection$5(__scopeSelect);
20770
+ const getItems = useCollection$4(__scopeSelect);
19861
20771
  const clearAutoScrollTimer = React.useCallback(() => {
19862
20772
  if (autoScrollTimerRef.current !== null) {
19863
20773
  window.clearInterval(autoScrollTimerRef.current);
@@ -19981,7 +20891,7 @@ function findNextItem(items, search, currentItem) {
19981
20891
  const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
19982
20892
  const normalizedSearch = isRepeated ? search[0] : search;
19983
20893
  const currentItemIndex = currentItem ? items.indexOf(currentItem) : -1;
19984
- let wrappedItems = wrapArray$3(items, Math.max(currentItemIndex, 0));
20894
+ let wrappedItems = wrapArray$2(items, Math.max(currentItemIndex, 0));
19985
20895
  const excludeCurrentItem = normalizedSearch.length === 1;
19986
20896
  if (excludeCurrentItem) wrappedItems = wrappedItems.filter((v) => v !== currentItem);
19987
20897
  const nextItem = wrappedItems.find(
@@ -19989,11 +20899,11 @@ function findNextItem(items, search, currentItem) {
19989
20899
  );
19990
20900
  return nextItem !== currentItem ? nextItem : void 0;
19991
20901
  }
19992
- function wrapArray$3(array2, startIndex) {
20902
+ function wrapArray$2(array2, startIndex) {
19993
20903
  return array2.map((_2, index2) => array2[(startIndex + index2) % array2.length]);
19994
20904
  }
19995
- var Root2$8 = Select$2;
19996
- var Trigger$7 = SelectTrigger$1;
20905
+ var Root2$7 = Select$2;
20906
+ var Trigger$6 = SelectTrigger$1;
19997
20907
  var Value = SelectValue$1;
19998
20908
  var Icon = SelectIcon;
19999
20909
  var Portal$4 = SelectPortal;
@@ -20001,16 +20911,16 @@ var Content2$7 = SelectContent$1;
20001
20911
  var Viewport$2 = SelectViewport;
20002
20912
  var Group$1 = SelectGroup$1;
20003
20913
  var Label$1 = SelectLabel$1;
20004
- var Item$2 = SelectItem$1;
20914
+ var Item$1 = SelectItem$1;
20005
20915
  var ItemText = SelectItemText;
20006
20916
  var ItemIndicator$1 = SelectItemIndicator;
20007
20917
  var ScrollUpButton = SelectScrollUpButton$1;
20008
20918
  var ScrollDownButton = SelectScrollDownButton$1;
20009
- var Separator$3 = SelectSeparator$1;
20919
+ var Separator$1 = SelectSeparator$1;
20010
20920
  function Select$1({
20011
20921
  ...props2
20012
20922
  }) {
20013
- return /* @__PURE__ */ jsx(Root2$8, { "data-slot": "select", ...props2 });
20923
+ return /* @__PURE__ */ jsx(Root2$7, { "data-slot": "select", ...props2 });
20014
20924
  }
20015
20925
  function SelectGroup({
20016
20926
  ...props2
@@ -20029,12 +20939,12 @@ function SelectTrigger({
20029
20939
  ...props2
20030
20940
  }) {
20031
20941
  return /* @__PURE__ */ jsxs(
20032
- Trigger$7,
20942
+ Trigger$6,
20033
20943
  {
20034
20944
  "data-slot": "select-trigger",
20035
20945
  "data-size": size2,
20036
20946
  className: cn$1(
20037
- "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
20947
+ "border-border data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
20038
20948
  className
20039
20949
  ),
20040
20950
  ...props2,
@@ -20098,7 +21008,7 @@ function SelectItem({
20098
21008
  ...props2
20099
21009
  }) {
20100
21010
  return /* @__PURE__ */ jsxs(
20101
- Item$2,
21011
+ Item$1,
20102
21012
  {
20103
21013
  "data-slot": "select-item",
20104
21014
  className: cn$1(
@@ -20118,7 +21028,7 @@ function SelectSeparator({
20118
21028
  ...props2
20119
21029
  }) {
20120
21030
  return /* @__PURE__ */ jsx(
20121
- Separator$3,
21031
+ Separator$1,
20122
21032
  {
20123
21033
  "data-slot": "select-separator",
20124
21034
  className: cn$1("bg-border pointer-events-none -mx-1 my-1 h-px", className),
@@ -20371,14 +21281,14 @@ SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME$2;
20371
21281
  function getState$1(checked) {
20372
21282
  return checked ? "checked" : "unchecked";
20373
21283
  }
20374
- var Root$a = Switch$1;
21284
+ var Root$8 = Switch$1;
20375
21285
  var Thumb$1 = SwitchThumb;
20376
21286
  function Switch({
20377
21287
  className,
20378
21288
  ...props2
20379
21289
  }) {
20380
21290
  return /* @__PURE__ */ jsx(
20381
- Root$a,
21291
+ Root$8,
20382
21292
  {
20383
21293
  "data-slot": "switch",
20384
21294
  className: cn$1(
@@ -20449,215 +21359,6 @@ function SwitchField({ field, fieldPath, value, onChange, className }) {
20449
21359
  ] })
20450
21360
  ] });
20451
21361
  }
20452
- var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
20453
- var EVENT_OPTIONS = { bubbles: false, cancelable: true };
20454
- var GROUP_NAME$4 = "RovingFocusGroup";
20455
- var [Collection$4, useCollection$4, createCollectionScope$4] = createCollection(GROUP_NAME$4);
20456
- var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
20457
- GROUP_NAME$4,
20458
- [createCollectionScope$4]
20459
- );
20460
- var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME$4);
20461
- var RovingFocusGroup = React.forwardRef(
20462
- (props2, forwardedRef) => {
20463
- return /* @__PURE__ */ jsx(Collection$4.Provider, { scope: props2.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection$4.Slot, { scope: props2.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props2, ref: forwardedRef }) }) });
20464
- }
20465
- );
20466
- RovingFocusGroup.displayName = GROUP_NAME$4;
20467
- var RovingFocusGroupImpl = React.forwardRef((props2, forwardedRef) => {
20468
- const {
20469
- __scopeRovingFocusGroup,
20470
- orientation,
20471
- loop = false,
20472
- dir,
20473
- currentTabStopId: currentTabStopIdProp,
20474
- defaultCurrentTabStopId,
20475
- onCurrentTabStopIdChange,
20476
- onEntryFocus,
20477
- preventScrollOnEntryFocus = false,
20478
- ...groupProps
20479
- } = props2;
20480
- const ref = React.useRef(null);
20481
- const composedRefs = useComposedRefs$1(forwardedRef, ref);
20482
- const direction = useDirection(dir);
20483
- const [currentTabStopId, setCurrentTabStopId] = useControllableState$1({
20484
- prop: currentTabStopIdProp,
20485
- defaultProp: defaultCurrentTabStopId ?? null,
20486
- onChange: onCurrentTabStopIdChange,
20487
- caller: GROUP_NAME$4
20488
- });
20489
- const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);
20490
- const handleEntryFocus = useCallbackRef$2(onEntryFocus);
20491
- const getItems = useCollection$4(__scopeRovingFocusGroup);
20492
- const isClickFocusRef = React.useRef(false);
20493
- const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);
20494
- React.useEffect(() => {
20495
- const node = ref.current;
20496
- if (node) {
20497
- node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
20498
- return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
20499
- }
20500
- }, [handleEntryFocus]);
20501
- return /* @__PURE__ */ jsx(
20502
- RovingFocusProvider,
20503
- {
20504
- scope: __scopeRovingFocusGroup,
20505
- orientation,
20506
- dir: direction,
20507
- loop,
20508
- currentTabStopId,
20509
- onItemFocus: React.useCallback(
20510
- (tabStopId) => setCurrentTabStopId(tabStopId),
20511
- [setCurrentTabStopId]
20512
- ),
20513
- onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),
20514
- onFocusableItemAdd: React.useCallback(
20515
- () => setFocusableItemsCount((prevCount) => prevCount + 1),
20516
- []
20517
- ),
20518
- onFocusableItemRemove: React.useCallback(
20519
- () => setFocusableItemsCount((prevCount) => prevCount - 1),
20520
- []
20521
- ),
20522
- children: /* @__PURE__ */ jsx(
20523
- Primitive.div,
20524
- {
20525
- tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
20526
- "data-orientation": orientation,
20527
- ...groupProps,
20528
- ref: composedRefs,
20529
- style: { outline: "none", ...props2.style },
20530
- onMouseDown: composeEventHandlers$1(props2.onMouseDown, () => {
20531
- isClickFocusRef.current = true;
20532
- }),
20533
- onFocus: composeEventHandlers$1(props2.onFocus, (event) => {
20534
- const isKeyboardFocus = !isClickFocusRef.current;
20535
- if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
20536
- const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
20537
- event.currentTarget.dispatchEvent(entryFocusEvent);
20538
- if (!entryFocusEvent.defaultPrevented) {
20539
- const items = getItems().filter((item) => item.focusable);
20540
- const activeItem = items.find((item) => item.active);
20541
- const currentItem = items.find((item) => item.id === currentTabStopId);
20542
- const candidateItems = [activeItem, currentItem, ...items].filter(
20543
- Boolean
20544
- );
20545
- const candidateNodes = candidateItems.map((item) => item.ref.current);
20546
- focusFirst$2(candidateNodes, preventScrollOnEntryFocus);
20547
- }
20548
- }
20549
- isClickFocusRef.current = false;
20550
- }),
20551
- onBlur: composeEventHandlers$1(props2.onBlur, () => setIsTabbingBackOut(false))
20552
- }
20553
- )
20554
- }
20555
- );
20556
- });
20557
- var ITEM_NAME$7 = "RovingFocusGroupItem";
20558
- var RovingFocusGroupItem = React.forwardRef(
20559
- (props2, forwardedRef) => {
20560
- const {
20561
- __scopeRovingFocusGroup,
20562
- focusable = true,
20563
- active = false,
20564
- tabStopId,
20565
- children,
20566
- ...itemProps
20567
- } = props2;
20568
- const autoId = useId$1();
20569
- const id = tabStopId || autoId;
20570
- const context = useRovingFocusContext(ITEM_NAME$7, __scopeRovingFocusGroup);
20571
- const isCurrentTabStop = context.currentTabStopId === id;
20572
- const getItems = useCollection$4(__scopeRovingFocusGroup);
20573
- const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;
20574
- React.useEffect(() => {
20575
- if (focusable) {
20576
- onFocusableItemAdd();
20577
- return () => onFocusableItemRemove();
20578
- }
20579
- }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
20580
- return /* @__PURE__ */ jsx(
20581
- Collection$4.ItemSlot,
20582
- {
20583
- scope: __scopeRovingFocusGroup,
20584
- id,
20585
- focusable,
20586
- active,
20587
- children: /* @__PURE__ */ jsx(
20588
- Primitive.span,
20589
- {
20590
- tabIndex: isCurrentTabStop ? 0 : -1,
20591
- "data-orientation": context.orientation,
20592
- ...itemProps,
20593
- ref: forwardedRef,
20594
- onMouseDown: composeEventHandlers$1(props2.onMouseDown, (event) => {
20595
- if (!focusable) event.preventDefault();
20596
- else context.onItemFocus(id);
20597
- }),
20598
- onFocus: composeEventHandlers$1(props2.onFocus, () => context.onItemFocus(id)),
20599
- onKeyDown: composeEventHandlers$1(props2.onKeyDown, (event) => {
20600
- if (event.key === "Tab" && event.shiftKey) {
20601
- context.onItemShiftTab();
20602
- return;
20603
- }
20604
- if (event.target !== event.currentTarget) return;
20605
- const focusIntent = getFocusIntent(event, context.orientation, context.dir);
20606
- if (focusIntent !== void 0) {
20607
- if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
20608
- event.preventDefault();
20609
- const items = getItems().filter((item) => item.focusable);
20610
- let candidateNodes = items.map((item) => item.ref.current);
20611
- if (focusIntent === "last") candidateNodes.reverse();
20612
- else if (focusIntent === "prev" || focusIntent === "next") {
20613
- if (focusIntent === "prev") candidateNodes.reverse();
20614
- const currentIndex = candidateNodes.indexOf(event.currentTarget);
20615
- candidateNodes = context.loop ? wrapArray$2(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
20616
- }
20617
- setTimeout(() => focusFirst$2(candidateNodes));
20618
- }
20619
- }),
20620
- children: typeof children === "function" ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children
20621
- }
20622
- )
20623
- }
20624
- );
20625
- }
20626
- );
20627
- RovingFocusGroupItem.displayName = ITEM_NAME$7;
20628
- var MAP_KEY_TO_FOCUS_INTENT = {
20629
- ArrowLeft: "prev",
20630
- ArrowUp: "prev",
20631
- ArrowRight: "next",
20632
- ArrowDown: "next",
20633
- PageUp: "first",
20634
- Home: "first",
20635
- PageDown: "last",
20636
- End: "last"
20637
- };
20638
- function getDirectionAwareKey(key, dir) {
20639
- if (dir !== "rtl") return key;
20640
- return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
20641
- }
20642
- function getFocusIntent(event, orientation, dir) {
20643
- const key = getDirectionAwareKey(event.key, dir);
20644
- if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
20645
- if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
20646
- return MAP_KEY_TO_FOCUS_INTENT[key];
20647
- }
20648
- function focusFirst$2(candidates, preventScroll = false) {
20649
- const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
20650
- for (const candidate of candidates) {
20651
- if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
20652
- candidate.focus({ preventScroll });
20653
- if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
20654
- }
20655
- }
20656
- function wrapArray$2(array2, startIndex) {
20657
- return array2.map((_2, index2) => array2[(startIndex + index2) % array2.length]);
20658
- }
20659
- var Root$9 = RovingFocusGroup;
20660
- var Item$1 = RovingFocusGroupItem;
20661
21362
  var RADIO_NAME = "Radio";
20662
21363
  var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);
20663
21364
  var [RadioProvider, useRadioContext] = createRadioContext(RADIO_NAME);
@@ -20794,7 +21495,7 @@ var [createRadioGroupContext, createRadioGroupScope] = createContextScope(RADIO_
20794
21495
  createRovingFocusGroupScope,
20795
21496
  createRadioScope
20796
21497
  ]);
20797
- var useRovingFocusGroupScope$4 = createRovingFocusGroupScope();
21498
+ var useRovingFocusGroupScope$3 = createRovingFocusGroupScope();
20798
21499
  var useRadioScope = createRadioScope();
20799
21500
  var [RadioGroupProvider$1, useRadioGroupContext$1] = createRadioGroupContext(RADIO_GROUP_NAME$4);
20800
21501
  var RadioGroup$2 = React.forwardRef(
@@ -20812,7 +21513,7 @@ var RadioGroup$2 = React.forwardRef(
20812
21513
  onValueChange,
20813
21514
  ...groupProps
20814
21515
  } = props2;
20815
- const rovingFocusGroupScope = useRovingFocusGroupScope$4(__scopeRadioGroup);
21516
+ const rovingFocusGroupScope = useRovingFocusGroupScope$3(__scopeRadioGroup);
20816
21517
  const direction = useDirection(dir);
20817
21518
  const [value, setValue] = useControllableState$1({
20818
21519
  prop: valueProp,
@@ -20830,7 +21531,7 @@ var RadioGroup$2 = React.forwardRef(
20830
21531
  value,
20831
21532
  onValueChange: setValue,
20832
21533
  children: /* @__PURE__ */ jsx(
20833
- Root$9,
21534
+ Root$d,
20834
21535
  {
20835
21536
  asChild: true,
20836
21537
  ...rovingFocusGroupScope,
@@ -20862,7 +21563,7 @@ var RadioGroupItem$1 = React.forwardRef(
20862
21563
  const { __scopeRadioGroup, disabled, ...itemProps } = props2;
20863
21564
  const context = useRadioGroupContext$1(ITEM_NAME$6, __scopeRadioGroup);
20864
21565
  const isDisabled = context.disabled || disabled;
20865
- const rovingFocusGroupScope = useRovingFocusGroupScope$4(__scopeRadioGroup);
21566
+ const rovingFocusGroupScope = useRovingFocusGroupScope$3(__scopeRadioGroup);
20866
21567
  const radioScope = useRadioScope(__scopeRadioGroup);
20867
21568
  const ref = React.useRef(null);
20868
21569
  const composedRefs = useComposedRefs$1(forwardedRef, ref);
@@ -20883,7 +21584,7 @@ var RadioGroupItem$1 = React.forwardRef(
20883
21584
  };
20884
21585
  }, []);
20885
21586
  return /* @__PURE__ */ jsx(
20886
- Item$1,
21587
+ Item$2,
20887
21588
  {
20888
21589
  asChild: true,
20889
21590
  ...rovingFocusGroupScope,
@@ -20923,7 +21624,7 @@ var RadioGroupIndicator = React.forwardRef(
20923
21624
  }
20924
21625
  );
20925
21626
  RadioGroupIndicator.displayName = INDICATOR_NAME2;
20926
- var Root2$7 = RadioGroup$2;
21627
+ var Root2$6 = RadioGroup$2;
20927
21628
  var Item2$4 = RadioGroupItem$1;
20928
21629
  var Indicator$2 = RadioGroupIndicator;
20929
21630
  function RadioGroup$1({
@@ -20931,7 +21632,7 @@ function RadioGroup$1({
20931
21632
  ...props2
20932
21633
  }) {
20933
21634
  return /* @__PURE__ */ jsx(
20934
- Root2$7,
21635
+ Root2$6,
20935
21636
  {
20936
21637
  "data-slot": "radio-group",
20937
21638
  className: cn$1("grid gap-3", className),
@@ -23324,7 +24025,7 @@ function PreviousMonthButton(props2) {
23324
24025
  const { components: components2 } = useDayPicker();
23325
24026
  return React__default.createElement(components2.Button, { ...props2 });
23326
24027
  }
23327
- function Root$8(props2) {
24028
+ function Root$7(props2) {
23328
24029
  const { rootRef, ...rest } = props2;
23329
24030
  return React__default.createElement("div", { ...rest, ref: rootRef });
23330
24031
  }
@@ -23378,7 +24079,7 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
23378
24079
  NextMonthButton,
23379
24080
  Option,
23380
24081
  PreviousMonthButton,
23381
- Root: Root$8,
24082
+ Root: Root$7,
23382
24083
  Select,
23383
24084
  Week,
23384
24085
  WeekNumber,
@@ -30670,7 +31371,7 @@ function getInvalidValueError(propValue, componentName) {
30670
31371
 
30671
31372
  Defaulting to \`null\`.`;
30672
31373
  }
30673
- var Root$7 = Progress$1;
31374
+ var Root$6 = Progress$1;
30674
31375
  var Indicator$1 = ProgressIndicator;
30675
31376
  function Progress({
30676
31377
  className,
@@ -30678,7 +31379,7 @@ function Progress({
30678
31379
  ...props2
30679
31380
  }) {
30680
31381
  return /* @__PURE__ */ jsx(
30681
- Root$7,
31382
+ Root$6,
30682
31383
  {
30683
31384
  "data-slot": "progress",
30684
31385
  className: cn$1(
@@ -30811,7 +31512,7 @@ var Tooltip$2 = (props2) => {
30811
31512
  }
30812
31513
  };
30813
31514
  }, []);
30814
- return /* @__PURE__ */ jsx(Root2$a, { ...popperScope, children: /* @__PURE__ */ jsx(
31515
+ return /* @__PURE__ */ jsx(Root2$9, { ...popperScope, children: /* @__PURE__ */ jsx(
30815
31516
  TooltipContextProvider,
30816
31517
  {
30817
31518
  scope: __scopeTooltip,
@@ -30840,12 +31541,12 @@ var Tooltip$2 = (props2) => {
30840
31541
  ) });
30841
31542
  };
30842
31543
  Tooltip$2.displayName = TOOLTIP_NAME;
30843
- var TRIGGER_NAME$7 = "TooltipTrigger";
31544
+ var TRIGGER_NAME$6 = "TooltipTrigger";
30844
31545
  var TooltipTrigger$1 = React.forwardRef(
30845
31546
  (props2, forwardedRef) => {
30846
31547
  const { __scopeTooltip, ...triggerProps } = props2;
30847
- const context = useTooltipContext(TRIGGER_NAME$7, __scopeTooltip);
30848
- const providerContext = useTooltipProviderContext(TRIGGER_NAME$7, __scopeTooltip);
31548
+ const context = useTooltipContext(TRIGGER_NAME$6, __scopeTooltip);
31549
+ const providerContext = useTooltipProviderContext(TRIGGER_NAME$6, __scopeTooltip);
30849
31550
  const popperScope = usePopperScope$2(__scopeTooltip);
30850
31551
  const ref = React.useRef(null);
30851
31552
  const composedRefs = useComposedRefs$1(forwardedRef, ref, context.onTriggerChange);
@@ -30889,7 +31590,7 @@ var TooltipTrigger$1 = React.forwardRef(
30889
31590
  ) });
30890
31591
  }
30891
31592
  );
30892
- TooltipTrigger$1.displayName = TRIGGER_NAME$7;
31593
+ TooltipTrigger$1.displayName = TRIGGER_NAME$6;
30893
31594
  var PORTAL_NAME$6 = "TooltipPortal";
30894
31595
  var [PortalProvider$2, usePortalContext$2] = createTooltipContext(PORTAL_NAME$6, {
30895
31596
  forceMount: void 0
@@ -30900,18 +31601,18 @@ var TooltipPortal = (props2) => {
30900
31601
  return /* @__PURE__ */ jsx(PortalProvider$2, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$7, { asChild: true, container, children }) }) });
30901
31602
  };
30902
31603
  TooltipPortal.displayName = PORTAL_NAME$6;
30903
- var CONTENT_NAME$8 = "TooltipContent";
31604
+ var CONTENT_NAME$7 = "TooltipContent";
30904
31605
  var TooltipContent$1 = React.forwardRef(
30905
31606
  (props2, forwardedRef) => {
30906
- const portalContext = usePortalContext$2(CONTENT_NAME$8, props2.__scopeTooltip);
31607
+ const portalContext = usePortalContext$2(CONTENT_NAME$7, props2.__scopeTooltip);
30907
31608
  const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props2;
30908
- const context = useTooltipContext(CONTENT_NAME$8, props2.__scopeTooltip);
31609
+ const context = useTooltipContext(CONTENT_NAME$7, props2.__scopeTooltip);
30909
31610
  return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsx(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
30910
31611
  }
30911
31612
  );
30912
31613
  var TooltipContentHoverable = React.forwardRef((props2, forwardedRef) => {
30913
- const context = useTooltipContext(CONTENT_NAME$8, props2.__scopeTooltip);
30914
- const providerContext = useTooltipProviderContext(CONTENT_NAME$8, props2.__scopeTooltip);
31614
+ const context = useTooltipContext(CONTENT_NAME$7, props2.__scopeTooltip);
31615
+ const providerContext = useTooltipProviderContext(CONTENT_NAME$7, props2.__scopeTooltip);
30915
31616
  const ref = React.useRef(null);
30916
31617
  const composedRefs = useComposedRefs$1(forwardedRef, ref);
30917
31618
  const [pointerGraceArea, setPointerGraceArea] = React.useState(null);
@@ -30982,7 +31683,7 @@ var TooltipContentImpl = React.forwardRef(
30982
31683
  onPointerDownOutside,
30983
31684
  ...contentProps
30984
31685
  } = props2;
30985
- const context = useTooltipContext(CONTENT_NAME$8, __scopeTooltip);
31686
+ const context = useTooltipContext(CONTENT_NAME$7, __scopeTooltip);
30986
31687
  const popperScope = usePopperScope$2(__scopeTooltip);
30987
31688
  const { onClose } = context;
30988
31689
  React.useEffect(() => {
@@ -31009,7 +31710,7 @@ var TooltipContentImpl = React.forwardRef(
31009
31710
  onFocusOutside: (event) => event.preventDefault(),
31010
31711
  onDismiss: onClose,
31011
31712
  children: /* @__PURE__ */ jsxs(
31012
- Content$4,
31713
+ Content$3,
31013
31714
  {
31014
31715
  "data-state": context.stateAttribute,
31015
31716
  ...popperScope,
@@ -31028,7 +31729,7 @@ var TooltipContentImpl = React.forwardRef(
31028
31729
  },
31029
31730
  children: [
31030
31731
  /* @__PURE__ */ jsx(Slottable$1, { children }),
31031
- /* @__PURE__ */ jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsx(Root$b, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
31732
+ /* @__PURE__ */ jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsx(Root$9, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
31032
31733
  ]
31033
31734
  }
31034
31735
  )
@@ -31036,7 +31737,7 @@ var TooltipContentImpl = React.forwardRef(
31036
31737
  );
31037
31738
  }
31038
31739
  );
31039
- TooltipContent$1.displayName = CONTENT_NAME$8;
31740
+ TooltipContent$1.displayName = CONTENT_NAME$7;
31040
31741
  var ARROW_NAME$5 = "TooltipArrow";
31041
31742
  var TooltipArrow = React.forwardRef(
31042
31743
  (props2, forwardedRef) => {
@@ -31167,7 +31868,7 @@ function getHullPresorted(points) {
31167
31868
  }
31168
31869
  var Provider = TooltipProvider$1;
31169
31870
  var Root3$2 = Tooltip$2;
31170
- var Trigger$6 = TooltipTrigger$1;
31871
+ var Trigger$5 = TooltipTrigger$1;
31171
31872
  var Portal$3 = TooltipPortal;
31172
31873
  var Content2$6 = TooltipContent$1;
31173
31874
  var Arrow2$1 = TooltipArrow;
@@ -31192,7 +31893,7 @@ function Tooltip$1({
31192
31893
  function TooltipTrigger({
31193
31894
  ...props2
31194
31895
  }) {
31195
- return /* @__PURE__ */ jsx(Trigger$6, { "data-slot": "tooltip-trigger", ...props2 });
31896
+ return /* @__PURE__ */ jsx(Trigger$5, { "data-slot": "tooltip-trigger", ...props2 });
31196
31897
  }
31197
31898
  function TooltipContent({
31198
31899
  className,
@@ -31637,85 +32338,6 @@ function FileField({ field, value, onChange, className }) {
31637
32338
  }
31638
32339
  );
31639
32340
  }
31640
- function Card({ className, ...props2 }) {
31641
- return /* @__PURE__ */ jsx(
31642
- "div",
31643
- {
31644
- "data-slot": "card",
31645
- className: cn$1(
31646
- "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
31647
- className
31648
- ),
31649
- ...props2
31650
- }
31651
- );
31652
- }
31653
- function CardHeader({ className, ...props2 }) {
31654
- return /* @__PURE__ */ jsx(
31655
- "div",
31656
- {
31657
- "data-slot": "card-header",
31658
- className: cn$1(
31659
- "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
31660
- className
31661
- ),
31662
- ...props2
31663
- }
31664
- );
31665
- }
31666
- function CardTitle({ className, ...props2 }) {
31667
- return /* @__PURE__ */ jsx(
31668
- "div",
31669
- {
31670
- "data-slot": "card-title",
31671
- className: cn$1("leading-none font-semibold", className),
31672
- ...props2
31673
- }
31674
- );
31675
- }
31676
- function CardDescription({ className, ...props2 }) {
31677
- return /* @__PURE__ */ jsx(
31678
- "div",
31679
- {
31680
- "data-slot": "card-description",
31681
- className: cn$1("text-muted-foreground text-sm", className),
31682
- ...props2
31683
- }
31684
- );
31685
- }
31686
- function CardAction({ className, ...props2 }) {
31687
- return /* @__PURE__ */ jsx(
31688
- "div",
31689
- {
31690
- "data-slot": "card-action",
31691
- className: cn$1(
31692
- "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
31693
- className
31694
- ),
31695
- ...props2
31696
- }
31697
- );
31698
- }
31699
- function CardContent({ className, ...props2 }) {
31700
- return /* @__PURE__ */ jsx(
31701
- "div",
31702
- {
31703
- "data-slot": "card-content",
31704
- className: cn$1("px-6", className),
31705
- ...props2
31706
- }
31707
- );
31708
- }
31709
- function CardFooter({ className, ...props2 }) {
31710
- return /* @__PURE__ */ jsx(
31711
- "div",
31712
- {
31713
- "data-slot": "card-footer",
31714
- className: cn$1("flex items-center px-6 [.border-t]:pt-6", className),
31715
- ...props2
31716
- }
31717
- );
31718
- }
31719
32341
  function ObjectField({ field, control, fieldPath }) {
31720
32342
  if (!field.fields) return null;
31721
32343
  return /* @__PURE__ */ jsxs(Card, { className: cn$1(field.className), children: [
@@ -31886,9 +32508,9 @@ function FormBuilderField({ field, control, onChange, parentPath }) {
31886
32508
  control,
31887
32509
  disabled: field.disabled
31888
32510
  });
31889
- const handleChange = useCallback((value) => {
32511
+ const handleChange = useCallback((value, ...extras) => {
31890
32512
  controllerField.onChange(value);
31891
- onChange == null ? void 0 : onChange(value);
32513
+ onChange == null ? void 0 : onChange(value, ...extras);
31892
32514
  }, [controllerField, onChange]);
31893
32515
  const baseClassName = cn$1(
31894
32516
  error && "border-destructive focus-visible:ring-destructive",
@@ -32131,631 +32753,147 @@ function FormBuilderField({ field, control, onChange, parentPath }) {
32131
32753
  ArrayField,
32132
32754
  {
32133
32755
  field,
32134
- control,
32135
- fieldPath,
32136
- value: controllerField.value,
32137
- onChange: handleChange,
32138
- className: baseClassName
32139
- }
32140
- );
32141
- default:
32142
- return /* @__PURE__ */ jsx(
32143
- TextField,
32144
- {
32145
- field,
32146
- control,
32147
- fieldPath,
32148
- value: controllerField.value,
32149
- onChange: handleChange,
32150
- className: baseClassName
32151
- }
32152
- );
32153
- }
32154
- };
32155
- if (field.type === "checkbox" || field.type === "switch") {
32156
- return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-2", field.gridCols && `md:col-span-${field.gridCols}`), children: [
32157
- renderField(),
32158
- field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description }),
32159
- error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error.message })
32160
- ] });
32161
- }
32162
- const placement = field.labelPlacement ?? "stacked";
32163
- if (placement === "hidden" || field.type === "array") {
32164
- return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-2", field.gridCols && `md:col-span-${field.gridCols}`), children: [
32165
- renderField(),
32166
- field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description }),
32167
- error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error.message })
32168
- ] });
32169
- }
32170
- if (placement === "inline") {
32171
- return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-1", field.gridCols && `md:col-span-${field.gridCols}`), children: [
32172
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
32173
- /* @__PURE__ */ jsxs(Label$2, { htmlFor: fieldPath, className: "text-sm font-medium", children: [
32174
- field.label,
32175
- field.required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
32176
- ] }),
32177
- renderField()
32178
- ] }),
32179
- field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description }),
32180
- error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error.message })
32181
- ] });
32182
- }
32183
- return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-2", field.gridCols && `md:col-span-${field.gridCols}`), children: [
32184
- /* @__PURE__ */ jsxs(Label$2, { htmlFor: fieldPath, className: "text-sm font-medium", children: [
32185
- field.label,
32186
- field.required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
32187
- ] }),
32188
- renderField(),
32189
- field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description }),
32190
- error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error.message })
32191
- ] });
32192
- }
32193
- var NAME$2 = "Separator";
32194
- var DEFAULT_ORIENTATION = "horizontal";
32195
- var ORIENTATIONS = ["horizontal", "vertical"];
32196
- var Separator$2 = React.forwardRef((props2, forwardedRef) => {
32197
- const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props2;
32198
- const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
32199
- const ariaOrientation = orientation === "vertical" ? orientation : void 0;
32200
- const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
32201
- return /* @__PURE__ */ jsx(
32202
- Primitive.div,
32203
- {
32204
- "data-orientation": orientation,
32205
- ...semanticProps,
32206
- ...domProps,
32207
- ref: forwardedRef
32208
- }
32209
- );
32210
- });
32211
- Separator$2.displayName = NAME$2;
32212
- function isValidOrientation(orientation) {
32213
- return ORIENTATIONS.includes(orientation);
32214
- }
32215
- var Root$6 = Separator$2;
32216
- function Separator$1({
32217
- className,
32218
- orientation = "horizontal",
32219
- decorative = true,
32220
- ...props2
32221
- }) {
32222
- return /* @__PURE__ */ jsx(
32223
- Root$6,
32224
- {
32225
- "data-slot": "separator",
32226
- decorative,
32227
- orientation,
32228
- className: cn$1(
32229
- "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
32230
- className
32231
- ),
32232
- ...props2
32233
- }
32234
- );
32235
- }
32236
- var TABS_NAME = "Tabs";
32237
- var [createTabsContext, createTabsScope] = createContextScope(TABS_NAME, [
32238
- createRovingFocusGroupScope
32239
- ]);
32240
- var useRovingFocusGroupScope$3 = createRovingFocusGroupScope();
32241
- var [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);
32242
- var Tabs$1 = React.forwardRef(
32243
- (props2, forwardedRef) => {
32244
- const {
32245
- __scopeTabs,
32246
- value: valueProp,
32247
- onValueChange,
32248
- defaultValue,
32249
- orientation = "horizontal",
32250
- dir,
32251
- activationMode = "automatic",
32252
- ...tabsProps
32253
- } = props2;
32254
- const direction = useDirection(dir);
32255
- const [value, setValue] = useControllableState$1({
32256
- prop: valueProp,
32257
- onChange: onValueChange,
32258
- defaultProp: defaultValue ?? "",
32259
- caller: TABS_NAME
32260
- });
32261
- return /* @__PURE__ */ jsx(
32262
- TabsProvider,
32263
- {
32264
- scope: __scopeTabs,
32265
- baseId: useId$1(),
32266
- value,
32267
- onValueChange: setValue,
32268
- orientation,
32269
- dir: direction,
32270
- activationMode,
32271
- children: /* @__PURE__ */ jsx(
32272
- Primitive.div,
32273
- {
32274
- dir: direction,
32275
- "data-orientation": orientation,
32276
- ...tabsProps,
32277
- ref: forwardedRef
32278
- }
32279
- )
32280
- }
32281
- );
32282
- }
32283
- );
32284
- Tabs$1.displayName = TABS_NAME;
32285
- var TAB_LIST_NAME = "TabsList";
32286
- var TabsList$1 = React.forwardRef(
32287
- (props2, forwardedRef) => {
32288
- const { __scopeTabs, loop = true, ...listProps } = props2;
32289
- const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);
32290
- const rovingFocusGroupScope = useRovingFocusGroupScope$3(__scopeTabs);
32291
- return /* @__PURE__ */ jsx(
32292
- Root$9,
32293
- {
32294
- asChild: true,
32295
- ...rovingFocusGroupScope,
32296
- orientation: context.orientation,
32297
- dir: context.dir,
32298
- loop,
32299
- children: /* @__PURE__ */ jsx(
32300
- Primitive.div,
32301
- {
32302
- role: "tablist",
32303
- "aria-orientation": context.orientation,
32304
- ...listProps,
32305
- ref: forwardedRef
32306
- }
32307
- )
32308
- }
32309
- );
32310
- }
32311
- );
32312
- TabsList$1.displayName = TAB_LIST_NAME;
32313
- var TRIGGER_NAME$6 = "TabsTrigger";
32314
- var TabsTrigger$1 = React.forwardRef(
32315
- (props2, forwardedRef) => {
32316
- const { __scopeTabs, value, disabled = false, ...triggerProps } = props2;
32317
- const context = useTabsContext(TRIGGER_NAME$6, __scopeTabs);
32318
- const rovingFocusGroupScope = useRovingFocusGroupScope$3(__scopeTabs);
32319
- const triggerId = makeTriggerId$1(context.baseId, value);
32320
- const contentId = makeContentId$1(context.baseId, value);
32321
- const isSelected = value === context.value;
32322
- return /* @__PURE__ */ jsx(
32323
- Item$1,
32324
- {
32325
- asChild: true,
32326
- ...rovingFocusGroupScope,
32327
- focusable: !disabled,
32328
- active: isSelected,
32329
- children: /* @__PURE__ */ jsx(
32330
- Primitive.button,
32756
+ control,
32757
+ fieldPath,
32758
+ value: controllerField.value,
32759
+ onChange: handleChange,
32760
+ className: baseClassName
32761
+ }
32762
+ );
32763
+ default:
32764
+ return /* @__PURE__ */ jsx(
32765
+ TextField,
32331
32766
  {
32332
- type: "button",
32333
- role: "tab",
32334
- "aria-selected": isSelected,
32335
- "aria-controls": contentId,
32336
- "data-state": isSelected ? "active" : "inactive",
32337
- "data-disabled": disabled ? "" : void 0,
32338
- disabled,
32339
- id: triggerId,
32340
- ...triggerProps,
32341
- ref: forwardedRef,
32342
- onMouseDown: composeEventHandlers$1(props2.onMouseDown, (event) => {
32343
- if (!disabled && event.button === 0 && event.ctrlKey === false) {
32344
- context.onValueChange(value);
32345
- } else {
32346
- event.preventDefault();
32347
- }
32348
- }),
32349
- onKeyDown: composeEventHandlers$1(props2.onKeyDown, (event) => {
32350
- if ([" ", "Enter"].includes(event.key)) context.onValueChange(value);
32351
- }),
32352
- onFocus: composeEventHandlers$1(props2.onFocus, () => {
32353
- const isAutomaticActivation = context.activationMode !== "manual";
32354
- if (!isSelected && !disabled && isAutomaticActivation) {
32355
- context.onValueChange(value);
32356
- }
32357
- })
32767
+ field,
32768
+ control,
32769
+ fieldPath,
32770
+ value: controllerField.value,
32771
+ onChange: handleChange,
32772
+ className: baseClassName
32358
32773
  }
32359
- )
32360
- }
32361
- );
32362
- }
32363
- );
32364
- TabsTrigger$1.displayName = TRIGGER_NAME$6;
32365
- var CONTENT_NAME$7 = "TabsContent";
32366
- var TabsContent$1 = React.forwardRef(
32367
- (props2, forwardedRef) => {
32368
- const { __scopeTabs, value, forceMount, children, ...contentProps } = props2;
32369
- const context = useTabsContext(CONTENT_NAME$7, __scopeTabs);
32370
- const triggerId = makeTriggerId$1(context.baseId, value);
32371
- const contentId = makeContentId$1(context.baseId, value);
32372
- const isSelected = value === context.value;
32373
- const isMountAnimationPreventedRef = React.useRef(isSelected);
32374
- React.useEffect(() => {
32375
- const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
32376
- return () => cancelAnimationFrame(rAF);
32377
- }, []);
32378
- return /* @__PURE__ */ jsx(Presence, { present: forceMount || isSelected, children: ({ present }) => /* @__PURE__ */ jsx(
32379
- Primitive.div,
32380
- {
32381
- "data-state": isSelected ? "active" : "inactive",
32382
- "data-orientation": context.orientation,
32383
- role: "tabpanel",
32384
- "aria-labelledby": triggerId,
32385
- hidden: !present,
32386
- id: contentId,
32387
- tabIndex: 0,
32388
- ...contentProps,
32389
- ref: forwardedRef,
32390
- style: {
32391
- ...props2.style,
32392
- animationDuration: isMountAnimationPreventedRef.current ? "0s" : void 0
32393
- },
32394
- children: present && children
32395
- }
32396
- ) });
32397
- }
32398
- );
32399
- TabsContent$1.displayName = CONTENT_NAME$7;
32400
- function makeTriggerId$1(baseId, value) {
32401
- return `${baseId}-trigger-${value}`;
32402
- }
32403
- function makeContentId$1(baseId, value) {
32404
- return `${baseId}-content-${value}`;
32405
- }
32406
- var Root2$6 = Tabs$1;
32407
- var List$1 = TabsList$1;
32408
- var Trigger$5 = TabsTrigger$1;
32409
- var Content$2 = TabsContent$1;
32410
- function Tabs({
32411
- className,
32412
- ...props2
32413
- }) {
32414
- return /* @__PURE__ */ jsx(
32415
- Root2$6,
32416
- {
32417
- "data-slot": "tabs",
32418
- className: cn$1("flex flex-col gap-2", className),
32419
- ...props2
32420
- }
32421
- );
32422
- }
32423
- function TabsList({
32424
- className,
32425
- ...props2
32426
- }) {
32427
- return /* @__PURE__ */ jsx(
32428
- List$1,
32429
- {
32430
- "data-slot": "tabs-list",
32431
- className: cn$1(
32432
- "bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",
32433
- className
32434
- ),
32435
- ...props2
32436
- }
32437
- );
32438
- }
32439
- function TabsTrigger({
32440
- className,
32441
- ...props2
32442
- }) {
32443
- return /* @__PURE__ */ jsx(
32444
- Trigger$5,
32445
- {
32446
- "data-slot": "tabs-trigger",
32447
- className: cn$1(
32448
- "data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
32449
- className
32450
- ),
32451
- ...props2
32452
- }
32453
- );
32454
- }
32455
- function TabsContent({
32456
- className,
32457
- ...props2
32458
- }) {
32459
- return /* @__PURE__ */ jsx(
32460
- Content$2,
32461
- {
32462
- "data-slot": "tabs-content",
32463
- className: cn$1("flex-1 outline-none", className),
32464
- ...props2
32774
+ );
32465
32775
  }
32466
- );
32467
- }
32468
- const GRID_COLS = {
32469
- base: {
32470
- 1: "grid-cols-1",
32471
- 2: "grid-cols-2",
32472
- 3: "grid-cols-3",
32473
- 4: "grid-cols-4",
32474
- 5: "grid-cols-5",
32475
- 6: "grid-cols-6",
32476
- 7: "grid-cols-7",
32477
- 8: "grid-cols-8",
32478
- 9: "grid-cols-9",
32479
- 10: "grid-cols-10",
32480
- 11: "grid-cols-11",
32481
- 12: "grid-cols-12"
32482
- },
32483
- sm: {
32484
- 1: "sm:grid-cols-1",
32485
- 2: "sm:grid-cols-2",
32486
- 3: "sm:grid-cols-3",
32487
- 4: "sm:grid-cols-4",
32488
- 5: "sm:grid-cols-5",
32489
- 6: "sm:grid-cols-6",
32490
- 7: "sm:grid-cols-7",
32491
- 8: "sm:grid-cols-8",
32492
- 9: "sm:grid-cols-9",
32493
- 10: "sm:grid-cols-10",
32494
- 11: "sm:grid-cols-11",
32495
- 12: "sm:grid-cols-12"
32496
- },
32497
- md: {
32498
- 1: "md:grid-cols-1",
32499
- 2: "md:grid-cols-2",
32500
- 3: "md:grid-cols-3",
32501
- 4: "md:grid-cols-4",
32502
- 5: "md:grid-cols-5",
32503
- 6: "md:grid-cols-6",
32504
- 7: "md:grid-cols-7",
32505
- 8: "md:grid-cols-8",
32506
- 9: "md:grid-cols-9",
32507
- 10: "md:grid-cols-10",
32508
- 11: "md:grid-cols-11",
32509
- 12: "md:grid-cols-12"
32510
- },
32511
- lg: {
32512
- 1: "lg:grid-cols-1",
32513
- 2: "lg:grid-cols-2",
32514
- 3: "lg:grid-cols-3",
32515
- 4: "lg:grid-cols-4",
32516
- 5: "lg:grid-cols-5",
32517
- 6: "lg:grid-cols-6",
32518
- 7: "lg:grid-cols-7",
32519
- 8: "lg:grid-cols-8",
32520
- 9: "lg:grid-cols-9",
32521
- 10: "lg:grid-cols-10",
32522
- 11: "lg:grid-cols-11",
32523
- 12: "lg:grid-cols-12"
32524
- },
32525
- xl: {
32526
- 1: "xl:grid-cols-1",
32527
- 2: "xl:grid-cols-2",
32528
- 3: "xl:grid-cols-3",
32529
- 4: "xl:grid-cols-4",
32530
- 5: "xl:grid-cols-5",
32531
- 6: "xl:grid-cols-6",
32532
- 7: "xl:grid-cols-7",
32533
- 8: "xl:grid-cols-8",
32534
- 9: "xl:grid-cols-9",
32535
- 10: "xl:grid-cols-10",
32536
- 11: "xl:grid-cols-11",
32537
- 12: "xl:grid-cols-12"
32776
+ };
32777
+ if (field.type === "checkbox" || field.type === "switch") {
32778
+ return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-2", field.gridCols && `md:col-span-${field.gridCols}`), children: [
32779
+ renderField(),
32780
+ field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description }),
32781
+ error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error.message })
32782
+ ] });
32538
32783
  }
32539
- };
32540
- const COL_SPAN = {
32541
- base: {
32542
- 1: "col-span-1",
32543
- 2: "col-span-2",
32544
- 3: "col-span-3",
32545
- 4: "col-span-4",
32546
- 5: "col-span-5",
32547
- 6: "col-span-6",
32548
- 7: "col-span-7",
32549
- 8: "col-span-8",
32550
- 9: "col-span-9",
32551
- 10: "col-span-10",
32552
- 11: "col-span-11",
32553
- 12: "col-span-12"
32554
- },
32555
- sm: {
32556
- 1: "sm:col-span-1",
32557
- 2: "sm:col-span-2",
32558
- 3: "sm:col-span-3",
32559
- 4: "sm:col-span-4",
32560
- 5: "sm:col-span-5",
32561
- 6: "sm:col-span-6",
32562
- 7: "sm:col-span-7",
32563
- 8: "sm:col-span-8",
32564
- 9: "sm:col-span-9",
32565
- 10: "sm:col-span-10",
32566
- 11: "sm:col-span-11",
32567
- 12: "sm:col-span-12"
32568
- },
32569
- md: {
32570
- 1: "md:col-span-1",
32571
- 2: "md:col-span-2",
32572
- 3: "md:col-span-3",
32573
- 4: "md:col-span-4",
32574
- 5: "md:col-span-5",
32575
- 6: "md:col-span-6",
32576
- 7: "md:col-span-7",
32577
- 8: "md:col-span-8",
32578
- 9: "md:col-span-9",
32579
- 10: "md:col-span-10",
32580
- 11: "md:col-span-11",
32581
- 12: "md:col-span-12"
32582
- },
32583
- lg: {
32584
- 1: "lg:col-span-1",
32585
- 2: "lg:col-span-2",
32586
- 3: "lg:col-span-3",
32587
- 4: "lg:col-span-4",
32588
- 5: "lg:col-span-5",
32589
- 6: "lg:col-span-6",
32590
- 7: "lg:col-span-7",
32591
- 8: "lg:col-span-8",
32592
- 9: "lg:col-span-9",
32593
- 10: "lg:col-span-10",
32594
- 11: "lg:col-span-11",
32595
- 12: "lg:col-span-12"
32596
- },
32597
- xl: {
32598
- 1: "xl:col-span-1",
32599
- 2: "xl:col-span-2",
32600
- 3: "xl:col-span-3",
32601
- 4: "xl:col-span-4",
32602
- 5: "xl:col-span-5",
32603
- 6: "xl:col-span-6",
32604
- 7: "xl:col-span-7",
32605
- 8: "xl:col-span-8",
32606
- 9: "xl:col-span-9",
32607
- 10: "xl:col-span-10",
32608
- 11: "xl:col-span-11",
32609
- 12: "xl:col-span-12"
32784
+ const placement = field.labelPlacement ?? "stacked";
32785
+ if (placement === "hidden" || field.type === "array") {
32786
+ return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-2", field.gridCols && `md:col-span-${field.gridCols}`), children: [
32787
+ renderField(),
32788
+ field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description }),
32789
+ error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error.message })
32790
+ ] });
32610
32791
  }
32611
- };
32612
- function gridClasses(options) {
32613
- const cols = (options == null ? void 0 : options.cols) ?? 1;
32614
- const sm = options == null ? void 0 : options.smCols;
32615
- const md = options == null ? void 0 : options.mdCols;
32616
- const lg = options == null ? void 0 : options.lgCols;
32617
- const xl = options == null ? void 0 : options.xlCols;
32618
- const gap = (options == null ? void 0 : options.gap) ?? "gap-4";
32619
- return cn$1(
32620
- "grid",
32621
- GRID_COLS.base[cols],
32622
- sm ? GRID_COLS.sm[sm] : void 0,
32623
- md ? GRID_COLS.md[md] : void 0,
32624
- lg ? GRID_COLS.lg[lg] : void 0,
32625
- xl ? GRID_COLS.xl[xl] : void 0,
32626
- gap
32627
- );
32628
- }
32629
- function flexClasses(options) {
32630
- const direction = (options == null ? void 0 : options.direction) ?? "col";
32631
- const wrap = (options == null ? void 0 : options.wrap) ? "flex-wrap" : "flex-nowrap";
32632
- const gap = (options == null ? void 0 : options.gap) ?? "gap-4";
32633
- const align = (options == null ? void 0 : options.align) ?? "stretch";
32634
- const justify = (options == null ? void 0 : options.justify) ?? "start";
32635
- const alignClass = align === "start" ? "items-start" : align === "center" ? "items-center" : align === "end" ? "items-end" : "items-stretch";
32636
- const justifyClass = justify === "start" ? "justify-start" : justify === "center" ? "justify-center" : justify === "between" ? "justify-between" : "justify-end";
32637
- return cn$1("flex", `flex-${direction}`, wrap, gap, alignClass, justifyClass);
32638
- }
32639
- function leafSpanClasses(leaf) {
32640
- if (!leaf.span) return void 0;
32641
- const parts = [];
32642
- if (leaf.span.base) parts.push(COL_SPAN.base[leaf.span.base]);
32643
- if (leaf.span.sm) parts.push(COL_SPAN.sm[leaf.span.sm]);
32644
- if (leaf.span.md) parts.push(COL_SPAN.md[leaf.span.md]);
32645
- if (leaf.span.lg) parts.push(COL_SPAN.lg[leaf.span.lg]);
32646
- if (leaf.span.xl) parts.push(COL_SPAN.xl[leaf.span.xl]);
32647
- return parts.join(" ");
32648
- }
32649
- function isLeaf(child) {
32650
- return child.content !== void 0;
32651
- }
32652
- function shallowEqualSpan(a2, b2) {
32653
- if (a2 === b2) return true;
32654
- if (!a2 || !b2) return !a2 && !b2;
32655
- return a2.base === b2.base && a2.sm === b2.sm && a2.md === b2.md && a2.lg === b2.lg && a2.xl === b2.xl;
32656
- }
32657
- function shallowEqualLeaf(a2, b2) {
32658
- const renderKeyEqual = (a2.renderKey ?? null) === (b2.renderKey ?? null);
32659
- return a2.key === b2.key && a2.hidden === b2.hidden && a2.className === b2.className && a2.labelLayout === b2.labelLayout && a2.labelClassName === b2.labelClassName && a2.valueClassName === b2.valueClassName && a2.inlineLabelWidthClass === b2.inlineLabelWidthClass && shallowEqualSpan(a2.span, b2.span) && renderKeyEqual;
32660
- }
32661
- const SectionLeafRenderer = memo$1(
32662
- function SectionLeafRenderer2({ leaf, renderLeaf }) {
32663
- if (leaf.hidden) return null;
32664
- const span = leafSpanClasses(leaf);
32665
- if (renderLeaf) {
32666
- return /* @__PURE__ */ jsx("div", { className: cn$1(span, leaf.className), children: renderLeaf(leaf) });
32667
- }
32668
- const hasLabel = leaf.label !== void 0 && leaf.label !== null && leaf.label !== "";
32669
- const layout = leaf.labelLayout ?? "stacked";
32670
- const labelBaseCls = "text-xs text-muted-foreground";
32671
- const valueBaseCls = "text-sm leading-6";
32672
- if (!hasLabel) {
32673
- return /* @__PURE__ */ jsx("div", { className: cn$1(span, leaf.className, leaf.valueClassName), children: leaf.content });
32674
- }
32675
- if (layout === "inline") {
32676
- const labelWidth = leaf.inlineLabelWidthClass ?? "w-32";
32677
- return /* @__PURE__ */ jsxs("div", { className: cn$1(span, leaf.className, "flex items-start gap-4"), children: [
32678
- /* @__PURE__ */ jsx("div", { className: cn$1(labelWidth, labelBaseCls, leaf.labelClassName), children: leaf.label }),
32679
- /* @__PURE__ */ jsxs("div", { className: cn$1("flex-1", valueBaseCls, leaf.valueClassName), children: [
32680
- leaf.content,
32681
- leaf.description ? /* @__PURE__ */ jsx("div", { className: cn$1("mt-1", labelBaseCls), children: leaf.description }) : null
32682
- ] })
32683
- ] });
32684
- }
32685
- return /* @__PURE__ */ jsxs("div", { className: cn$1(span, leaf.className, "flex flex-col"), children: [
32686
- /* @__PURE__ */ jsx("div", { className: cn$1(labelBaseCls, leaf.labelClassName), children: leaf.label }),
32687
- /* @__PURE__ */ jsx("div", { className: cn$1(valueBaseCls, leaf.valueClassName), children: leaf.content }),
32688
- leaf.description ? /* @__PURE__ */ jsx("div", { className: cn$1("mt-1", labelBaseCls), children: leaf.description }) : null
32792
+ if (placement === "inline") {
32793
+ return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-1", field.gridCols && `md:col-span-${field.gridCols}`), children: [
32794
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
32795
+ /* @__PURE__ */ jsxs(Label$2, { htmlFor: fieldPath, className: "text-sm font-medium", children: [
32796
+ field.label,
32797
+ field.required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
32798
+ ] }),
32799
+ renderField()
32800
+ ] }),
32801
+ field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description }),
32802
+ error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error.message })
32689
32803
  ] });
32690
- },
32691
- (prev, next) => shallowEqualLeaf(prev.leaf, next.leaf) && prev.renderLeaf === next.renderLeaf
32692
- );
32693
- function SectionNodeRenderer({ node, renderLeaf }) {
32694
- var _a;
32695
- if (node.hidden) return null;
32696
- const layout = node.layout ?? "grid";
32697
- const containerClass = layout === "grid" ? gridClasses(node.grid) : layout === "flex" ? flexClasses(node.flex) : "";
32698
- const SectionContainer = ({ children }) => {
32699
- const title = node.title;
32700
- const description = node.subtitle;
32701
- const variant = node.variant ?? "card";
32702
- const className = node.className;
32703
- const headerClassName = node.headerClassName;
32704
- const contentClassName = node.contentClassName;
32705
- const renderHeader = () => {
32706
- if (!title && !description) return null;
32707
- return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-1", headerClassName), children: [
32708
- title && /* @__PURE__ */ jsx("h3", { className: "text-lg font-medium leading-none", children: title }),
32709
- description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description })
32710
- ] });
32804
+ }
32805
+ return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-2", field.gridCols && `md:col-span-${field.gridCols}`), children: [
32806
+ /* @__PURE__ */ jsxs(Label$2, { htmlFor: fieldPath, className: "text-sm font-medium", children: [
32807
+ field.label,
32808
+ field.required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
32809
+ ] }),
32810
+ renderField(),
32811
+ field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description }),
32812
+ error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error.message })
32813
+ ] });
32814
+ }
32815
+ function buildSectionNodes(options) {
32816
+ const {
32817
+ sections,
32818
+ control,
32819
+ handleFieldDependencies,
32820
+ handleFieldChange,
32821
+ onFieldChange,
32822
+ getValues
32823
+ } = options;
32824
+ const buildLeavesFromFields = (fields) => (fields ?? []).map((field) => {
32825
+ const fieldState = handleFieldDependencies(field);
32826
+ if (field.hidden || fieldState.hidden) return null;
32827
+ const spanMd = Math.max(1, Math.min(12, field.gridCols ?? 1));
32828
+ return {
32829
+ key: field.name,
32830
+ span: { base: 1, md: spanMd },
32831
+ className: field.wrapperClassName,
32832
+ hidden: field.hidden,
32833
+ content: /* @__PURE__ */ jsx(
32834
+ FormBuilderField,
32835
+ {
32836
+ field: {
32837
+ ...field,
32838
+ disabled: field.disabled || fieldState.disabled
32839
+ },
32840
+ control,
32841
+ onChange: (value, ...extras) => {
32842
+ handleFieldChange(field, value, ...extras);
32843
+ onFieldChange == null ? void 0 : onFieldChange(field.name, value, getValues());
32844
+ },
32845
+ onFieldChange
32846
+ },
32847
+ field.name
32848
+ )
32711
32849
  };
32712
- const renderContent2 = () => /* @__PURE__ */ jsx("div", { className: cn$1("space-y-4", contentClassName), children });
32713
- switch (variant) {
32714
- case "card":
32715
- return /* @__PURE__ */ jsxs(Card, { className, children: [
32716
- (title || description) && /* @__PURE__ */ jsxs(CardHeader, { children: [
32717
- title && /* @__PURE__ */ jsx(CardTitle, { children: title }),
32718
- description && /* @__PURE__ */ jsx(CardDescription, { children: description })
32719
- ] }),
32720
- /* @__PURE__ */ jsx(CardContent, { children: renderContent2() })
32721
- ] });
32722
- case "separator":
32723
- return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-6", className), children: [
32724
- (title || description) && /* @__PURE__ */ jsxs(Fragment, { children: [
32725
- renderHeader(),
32726
- /* @__PURE__ */ jsx(Separator$1, {})
32727
- ] }),
32728
- renderContent2()
32729
- ] });
32730
- default:
32731
- return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-6", className), children: [
32732
- renderHeader(),
32733
- renderContent2()
32734
- ] });
32850
+ }).filter(Boolean);
32851
+ const buildSectionNode = (section, sectionIndex) => {
32852
+ var _a;
32853
+ const baseNode = {
32854
+ id: section.id ?? `section-${sectionIndex}`,
32855
+ title: section.title,
32856
+ subtitle: section.description,
32857
+ variant: section.variant ?? "plain",
32858
+ className: section.className,
32859
+ layout: section.layout ?? (section.tabs && section.tabs.length > 0 ? "tabs" : "grid"),
32860
+ grid: section.grid ?? { cols: 1, mdCols: 2, gap: "gap-4" },
32861
+ flex: section.flex,
32862
+ hidden: section.hidden
32863
+ };
32864
+ if (baseNode.layout === "tabs" && section.tabs && section.tabs.length > 0) {
32865
+ baseNode.defaultTabId = section.defaultTabId ?? ((_a = section.tabs[0]) == null ? void 0 : _a.id);
32866
+ baseNode.tabsListClassName = section.tabsListClassName;
32867
+ baseNode.tabsContentClassName = section.tabsContentClassName;
32868
+ baseNode.tabs = section.tabs.map((tab, _tabIdx) => {
32869
+ const nestedNodes = tab.sections.map((subSection, subIdx) => buildSectionNode(subSection, subIdx));
32870
+ const containerNode = {
32871
+ id: `${baseNode.id}-tab-${tab.id}`,
32872
+ variant: "plain",
32873
+ layout: "grid",
32874
+ grid: section.grid ?? { cols: 1, mdCols: 2, gap: "gap-4" },
32875
+ children: nestedNodes
32876
+ };
32877
+ return {
32878
+ id: tab.id,
32879
+ label: tab.label,
32880
+ className: tab.className,
32881
+ contentClassName: tab.contentClassName,
32882
+ node: containerNode
32883
+ };
32884
+ });
32885
+ return baseNode;
32735
32886
  }
32887
+ baseNode.children = buildLeavesFromFields(section.fields);
32888
+ return baseNode;
32736
32889
  };
32737
- if (layout === "tabs" && node.tabs && node.tabs.length > 0) {
32738
- const defaultTabId = node.defaultTabId ?? ((_a = node.tabs[0]) == null ? void 0 : _a.id);
32739
- return /* @__PURE__ */ jsx(SectionContainer, { children: /* @__PURE__ */ jsxs(Tabs, { defaultValue: defaultTabId, className: cn$1("space-y-2"), children: [
32740
- /* @__PURE__ */ jsx(TabsList, { className: cn$1(node.tabsListClassName), children: node.tabs.map((tab) => /* @__PURE__ */ jsx(TabsTrigger, { value: tab.id, className: cn$1(tab.className), children: tab.label }, tab.id)) }),
32741
- node.tabs.map((tab) => /* @__PURE__ */ jsx(TabsContent, { value: tab.id, className: cn$1(node.tabsContentClassName, tab.contentClassName), children: /* @__PURE__ */ jsx(SectionNodeRenderer, { node: tab.node, renderLeaf }) }, tab.id))
32742
- ] }) });
32743
- }
32744
- return /* @__PURE__ */ jsx(SectionContainer, { children: /* @__PURE__ */ jsx("div", { className: containerClass, children: (node.children ?? []).map((child) => {
32745
- if (isLeaf(child)) {
32746
- return /* @__PURE__ */ jsx(SectionLeafRenderer, { leaf: child, renderLeaf }, child.key);
32747
- }
32748
- if (child.hidden) return null;
32749
- return /* @__PURE__ */ jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsx(SectionNodeRenderer, { node: child, renderLeaf }) }, child.id);
32750
- }) }) });
32751
- }
32752
- function SectionBuilder({ sections, className, renderLeaf }) {
32753
- return /* @__PURE__ */ jsx("div", { className: cn$1("space-y-6", className), children: sections.map((section) => /* @__PURE__ */ jsx(SectionNodeRenderer, { node: section, renderLeaf }, section.id)) });
32890
+ return sections.map((section, sectionIndex) => buildSectionNode(section, sectionIndex));
32754
32891
  }
32892
+ const FormBuilderContext = createContext(null);
32755
32893
  function FormBuilder({
32756
32894
  sections,
32757
32895
  schema,
32758
- defaultValues = {},
32896
+ defaultValues,
32759
32897
  onSubmit,
32760
32898
  onCancel,
32761
32899
  onReset,
@@ -32769,7 +32907,8 @@ function FormBuilder({
32769
32907
  actionsClassName,
32770
32908
  showActions = true,
32771
32909
  customActions,
32772
- showActionsSeparator = true
32910
+ showActionsSeparator = true,
32911
+ form
32773
32912
  }) {
32774
32913
  const generatedSchema = useMemo(() => {
32775
32914
  if (schema) return schema;
@@ -32977,7 +33116,7 @@ function FormBuilder({
32977
33116
  return object(schemaObject);
32978
33117
  }, [sections, schema]);
32979
33118
  const generatedDefaultValues = useMemo(() => {
32980
- const values = { ...defaultValues };
33119
+ const values = { ...defaultValues ?? {} };
32981
33120
  const processFields = (fields) => {
32982
33121
  for (const field of fields) {
32983
33122
  if (values[field.name] === void 0 && field.defaultValue !== void 0) {
@@ -33014,13 +33153,14 @@ function FormBuilder({
33014
33153
  forEachSection(sections);
33015
33154
  return values;
33016
33155
  }, [sections, defaultValues]);
33017
- const form = useForm({
33156
+ const internalForm = useForm({
33018
33157
  // Dynamic schema shape: cast to any to satisfy resolver generics
33019
33158
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
33020
33159
  resolver: a$2(generatedSchema),
33021
33160
  defaultValues: generatedDefaultValues
33022
33161
  });
33023
- const { control, handleSubmit, reset: reset2, setValue, getValues } = form;
33162
+ const activeForm = form ?? internalForm;
33163
+ const { control, handleSubmit, reset: reset2, setValue, getValues } = activeForm;
33024
33164
  const dependencyFields = useMemo(() => {
33025
33165
  const set2 = /* @__PURE__ */ new Set();
33026
33166
  const forEachField = (secs) => {
@@ -33098,9 +33238,10 @@ function FormBuilder({
33098
33238
  }
33099
33239
  pendingValueUpdatesRef.current = [];
33100
33240
  for (const [name, value] of updatesMap) {
33101
- const current = getValues(name);
33241
+ const pathName = name;
33242
+ const current = getValues(pathName);
33102
33243
  if (current !== value) {
33103
- setValue(name, value, {
33244
+ setValue(pathName, value, {
33104
33245
  shouldDirty: false,
33105
33246
  shouldTouch: false,
33106
33247
  shouldValidate: false
@@ -33109,9 +33250,9 @@ function FormBuilder({
33109
33250
  }
33110
33251
  }, [setValue, getValues]);
33111
33252
  const handleFieldChange = useCallback(
33112
- (field, value) => {
33253
+ (field, value, ...extras) => {
33113
33254
  if (field.onChange) {
33114
- field.onChange(value, setValue, getValues);
33255
+ field.onChange(value, extras, setValue, getValues);
33115
33256
  }
33116
33257
  },
33117
33258
  [setValue, getValues]
@@ -33130,85 +33271,29 @@ function FormBuilder({
33130
33271
  reset2(generatedDefaultValues);
33131
33272
  onReset == null ? void 0 : onReset();
33132
33273
  }, [reset2, generatedDefaultValues, onReset]);
33133
- const sectionNodes = useMemo(() => {
33134
- const buildLeavesFromFields = (fields) => (fields ?? []).map((field) => {
33135
- const fieldState = handleFieldDependencies(field);
33136
- if (field.hidden || fieldState.hidden) return null;
33137
- const spanMd = Math.max(1, Math.min(12, field.gridCols ?? 1));
33138
- return {
33139
- key: field.name,
33140
- span: { base: 1, md: spanMd },
33141
- className: field.wrapperClassName,
33142
- hidden: field.hidden,
33143
- content: /* @__PURE__ */ jsx(
33144
- FormBuilderField,
33145
- {
33146
- field: {
33147
- ...field,
33148
- disabled: field.disabled || fieldState.disabled
33149
- },
33150
- control,
33151
- onChange: (value) => {
33152
- handleFieldChange(field, value);
33153
- onFieldChange == null ? void 0 : onFieldChange(field.name, value, getValues());
33154
- },
33155
- onFieldChange
33156
- },
33157
- field.name
33158
- )
33159
- };
33160
- }).filter(Boolean);
33161
- const buildSectionNode = (section, sectionIndex) => {
33162
- var _a;
33163
- const baseNode = {
33164
- id: section.id ?? `section-${sectionIndex}`,
33165
- title: section.title,
33166
- subtitle: section.description,
33167
- variant: section.variant ?? "plain",
33168
- className: section.className,
33169
- layout: section.layout ?? (section.tabs && section.tabs.length > 0 ? "tabs" : "grid"),
33170
- grid: section.grid ?? { cols: 1, mdCols: 2, gap: "gap-4" },
33171
- flex: section.flex,
33172
- hidden: section.hidden
33173
- };
33174
- if (baseNode.layout === "tabs" && section.tabs && section.tabs.length > 0) {
33175
- baseNode.defaultTabId = section.defaultTabId ?? ((_a = section.tabs[0]) == null ? void 0 : _a.id);
33176
- baseNode.tabsListClassName = section.tabsListClassName;
33177
- baseNode.tabsContentClassName = section.tabsContentClassName;
33178
- baseNode.tabs = section.tabs.map((tab, _tabIdx) => {
33179
- const nestedNodes = tab.sections.map((subSection, subIdx) => buildSectionNode(subSection, subIdx));
33180
- const containerNode = {
33181
- id: `${baseNode.id}-tab-${tab.id}`,
33182
- title: void 0,
33183
- subtitle: void 0,
33184
- variant: "plain",
33185
- layout: "grid",
33186
- grid: section.grid ?? { cols: 1, mdCols: 2, gap: "gap-4" },
33187
- children: nestedNodes
33188
- };
33189
- return {
33190
- id: tab.id,
33191
- label: tab.label,
33192
- className: tab.className,
33193
- contentClassName: tab.contentClassName,
33194
- node: containerNode
33195
- };
33196
- });
33197
- return baseNode;
33198
- }
33199
- baseNode.children = buildLeavesFromFields(section.fields);
33200
- return baseNode;
33201
- };
33202
- return sections.map((section, sectionIndex) => buildSectionNode(section, sectionIndex));
33203
- }, [
33204
- sections,
33205
- control,
33206
- handleFieldDependencies,
33207
- handleFieldChange,
33208
- onFieldChange,
33209
- getValues
33210
- ]);
33211
- return /* @__PURE__ */ jsx("div", { className: cn$1("space-y-6", className), children: /* @__PURE__ */ jsxs(
33274
+ const sectionNodes = useMemo(
33275
+ () => buildSectionNodes({
33276
+ sections,
33277
+ control,
33278
+ handleFieldDependencies,
33279
+ handleFieldChange,
33280
+ onFieldChange,
33281
+ getValues
33282
+ }),
33283
+ [sections, control, handleFieldDependencies, handleFieldChange, onFieldChange, getValues]
33284
+ );
33285
+ const contextValue = useMemo(
33286
+ () => ({
33287
+ control,
33288
+ getValues,
33289
+ setValue,
33290
+ onFieldChange,
33291
+ handleFieldDependencies,
33292
+ handleFieldChange
33293
+ }),
33294
+ [control, getValues, setValue, onFieldChange, handleFieldDependencies, handleFieldChange]
33295
+ );
33296
+ return /* @__PURE__ */ jsx(FormBuilderContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { className: cn$1("space-y-6", className), children: /* @__PURE__ */ jsxs(
33212
33297
  "form",
33213
33298
  {
33214
33299
  onSubmit: handleSubmit(handleFormSubmit),
@@ -33260,8 +33345,331 @@ function FormBuilder({
33260
33345
  )
33261
33346
  ]
33262
33347
  }
33263
- ) });
33348
+ ) }) });
33264
33349
  }
33350
+ const commonValidations = {
33351
+ email: string().email("Please enter a valid email address"),
33352
+ phone: string().regex(/^[\+]?[1-9][\d]{0,15}$/, "Please enter a valid phone number"),
33353
+ url: string().url("Please enter a valid URL"),
33354
+ password: string().min(8, "Password must be at least 8 characters"),
33355
+ strongPassword: string().min(8, "Password must be at least 8 characters").regex(
33356
+ /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]/,
33357
+ "Password must contain uppercase, lowercase, number and special character"
33358
+ ),
33359
+ required: string().min(1, "This field is required"),
33360
+ optionalString: string().optional(),
33361
+ positiveNumber: number().positive("Must be a positive number"),
33362
+ nonNegativeNumber: number().min(0, "Must be 0 or greater")
33363
+ };
33364
+ const createField = {
33365
+ text: (name, label, options = {}) => ({
33366
+ name,
33367
+ label,
33368
+ type: "text",
33369
+ required: false,
33370
+ ...options
33371
+ }),
33372
+ email: (name, label, options = {}) => ({
33373
+ name,
33374
+ label,
33375
+ type: "email",
33376
+ required: false,
33377
+ validation: commonValidations.email,
33378
+ ...options
33379
+ }),
33380
+ password: (name, label, options = {}) => ({
33381
+ name,
33382
+ label,
33383
+ type: "password",
33384
+ required: false,
33385
+ validation: commonValidations.password,
33386
+ ...options
33387
+ }),
33388
+ number: (name, label, options = {}) => ({
33389
+ name,
33390
+ label,
33391
+ type: "number",
33392
+ required: false,
33393
+ ...options
33394
+ }),
33395
+ textarea: (name, label, options = {}) => ({
33396
+ name,
33397
+ label,
33398
+ type: "textarea",
33399
+ required: false,
33400
+ gridCols: 2,
33401
+ // Default to full width
33402
+ ...options
33403
+ }),
33404
+ select: (name, label, options, fieldOptions = {}) => ({
33405
+ name,
33406
+ label,
33407
+ type: "select",
33408
+ options,
33409
+ required: false,
33410
+ ...fieldOptions
33411
+ }),
33412
+ checkbox: (name, label, options = {}) => ({
33413
+ name,
33414
+ label,
33415
+ type: "checkbox",
33416
+ required: false,
33417
+ defaultValue: false,
33418
+ ...options
33419
+ }),
33420
+ switch: (name, label, options = {}) => ({
33421
+ name,
33422
+ label,
33423
+ type: "switch",
33424
+ required: false,
33425
+ defaultValue: false,
33426
+ ...options
33427
+ }),
33428
+ radio: (name, label, options, fieldOptions = {}) => ({
33429
+ name,
33430
+ label,
33431
+ type: "radio",
33432
+ options,
33433
+ required: false,
33434
+ ...fieldOptions
33435
+ }),
33436
+ date: (name, label, options = {}) => ({
33437
+ name,
33438
+ label,
33439
+ type: "date",
33440
+ required: false,
33441
+ ...options
33442
+ }),
33443
+ file: (name, label, options = {}) => ({
33444
+ name,
33445
+ label,
33446
+ type: "file",
33447
+ required: false,
33448
+ ...options
33449
+ }),
33450
+ object: (name, label, fields, options = {}) => ({
33451
+ name,
33452
+ label,
33453
+ type: "object",
33454
+ fields,
33455
+ required: false,
33456
+ gridCols: 2,
33457
+ // Default to full width
33458
+ ...options
33459
+ }),
33460
+ array: (name, label, fields, options = {}) => ({
33461
+ name,
33462
+ label,
33463
+ type: "array",
33464
+ fields,
33465
+ required: false,
33466
+ gridCols: 2,
33467
+ // Default to full width
33468
+ defaultValue: [],
33469
+ ...options
33470
+ })
33471
+ };
33472
+ const createSection = {
33473
+ card: (title, fields, options = {}) => ({
33474
+ title,
33475
+ fields,
33476
+ variant: "card",
33477
+ ...options
33478
+ }),
33479
+ separator: (title, fields, options = {}) => ({
33480
+ title,
33481
+ fields,
33482
+ variant: "separator",
33483
+ ...options
33484
+ }),
33485
+ plain: (fields, options = {}) => ({
33486
+ fields,
33487
+ variant: "plain",
33488
+ ...options
33489
+ })
33490
+ };
33491
+ const createDependency = {
33492
+ showWhen: (field, condition) => ({
33493
+ field,
33494
+ condition,
33495
+ action: "show"
33496
+ }),
33497
+ hideWhen: (field, condition) => ({
33498
+ field,
33499
+ condition,
33500
+ action: "hide"
33501
+ }),
33502
+ enableWhen: (field, condition) => ({
33503
+ field,
33504
+ condition,
33505
+ action: "enable"
33506
+ }),
33507
+ disableWhen: (field, condition) => ({
33508
+ field,
33509
+ condition,
33510
+ action: "disable"
33511
+ }),
33512
+ setValueWhen: (field, condition, value) => ({
33513
+ field,
33514
+ condition,
33515
+ action: "setValue",
33516
+ value
33517
+ })
33518
+ };
33519
+ const conditions = {
33520
+ equals: (value) => (fieldValue) => fieldValue === value,
33521
+ notEquals: (value) => (fieldValue) => fieldValue !== value,
33522
+ includes: (value) => (fieldValue) => Array.isArray(fieldValue) && fieldValue.includes(value),
33523
+ notIncludes: (value) => (fieldValue) => Array.isArray(fieldValue) && !fieldValue.includes(value),
33524
+ isEmpty: () => (fieldValue) => !fieldValue || Array.isArray(fieldValue) && fieldValue.length === 0,
33525
+ isNotEmpty: () => (fieldValue) => fieldValue && (!Array.isArray(fieldValue) || fieldValue.length > 0),
33526
+ greaterThan: (value) => (fieldValue) => Number(fieldValue) > value,
33527
+ lessThan: (value) => (fieldValue) => Number(fieldValue) < value,
33528
+ isTrue: () => (fieldValue) => fieldValue === true,
33529
+ isFalse: () => (fieldValue) => fieldValue === false
33530
+ };
33531
+ const transformers = {
33532
+ // Transform form data before submission
33533
+ cleanEmptyStrings: (data) => {
33534
+ const clean = (obj) => {
33535
+ if (Array.isArray(obj)) {
33536
+ return obj.map(clean).filter((item) => item !== null && item !== void 0);
33537
+ }
33538
+ if (obj && typeof obj === "object") {
33539
+ const cleaned = {};
33540
+ Object.keys(obj).forEach((key) => {
33541
+ const value = clean(obj[key]);
33542
+ if (value !== "" && value !== null && value !== void 0) {
33543
+ cleaned[key] = value;
33544
+ }
33545
+ });
33546
+ return cleaned;
33547
+ }
33548
+ return obj === "" ? void 0 : obj;
33549
+ };
33550
+ return clean(data);
33551
+ },
33552
+ // Convert string numbers to actual numbers
33553
+ parseNumbers: (data, numberFields) => {
33554
+ const parsed = { ...data };
33555
+ const parseValue = (obj, path = []) => {
33556
+ if (Array.isArray(obj)) {
33557
+ return obj.map(
33558
+ (item, index2) => parseValue(item, [...path, String(index2)])
33559
+ );
33560
+ }
33561
+ if (obj && typeof obj === "object") {
33562
+ const result = {};
33563
+ Object.keys(obj).forEach((key) => {
33564
+ const currentPath = [...path, key].join(".");
33565
+ result[key] = parseValue(obj[key], [...path, key]);
33566
+ if (numberFields.includes(currentPath) && typeof result[key] === "string") {
33567
+ const num = Number(result[key]);
33568
+ if (!isNaN(num)) {
33569
+ result[key] = num;
33570
+ }
33571
+ }
33572
+ });
33573
+ return result;
33574
+ }
33575
+ return obj;
33576
+ };
33577
+ return parseValue(parsed);
33578
+ },
33579
+ // Convert dates to ISO strings
33580
+ formatDates: (data, dateFields) => {
33581
+ const formatted = { ...data };
33582
+ const formatValue = (obj, path = []) => {
33583
+ if (Array.isArray(obj)) {
33584
+ return obj.map(
33585
+ (item, index2) => formatValue(item, [...path, String(index2)])
33586
+ );
33587
+ }
33588
+ if (obj && typeof obj === "object") {
33589
+ const result = {};
33590
+ Object.keys(obj).forEach((key) => {
33591
+ const currentPath = [...path, key].join(".");
33592
+ result[key] = formatValue(obj[key], [...path, key]);
33593
+ if (dateFields.includes(currentPath) && result[key] instanceof Date) {
33594
+ result[key] = result[key].toISOString();
33595
+ }
33596
+ });
33597
+ return result;
33598
+ }
33599
+ return obj;
33600
+ };
33601
+ return formatValue(formatted);
33602
+ }
33603
+ };
33604
+ const validators = {
33605
+ // Create conditional validation
33606
+ when: (condition, schema) => any().refine(condition, { message: "Condition not met" }).pipe(schema),
33607
+ // Cross-field validation - returns a refinement function to be used on object schemas
33608
+ matchField: (fieldName, targetField) => (data) => data[fieldName] === data[targetField],
33609
+ // Array validation
33610
+ minItems: (min2, message2) => array(any()).min(min2, message2 || `Must have at least ${min2} items`),
33611
+ maxItems: (max2, message2) => array(any()).max(max2, message2 || `Must have at most ${max2} items`)
33612
+ };
33613
+ const commonForms = {
33614
+ // User registration form
33615
+ userRegistration: () => [
33616
+ createSection.card("Personal Information", [
33617
+ createField.text("firstName", "First Name", { required: true }),
33618
+ createField.text("lastName", "Last Name", { required: true }),
33619
+ createField.email("email", "Email Address", { required: true }),
33620
+ createField.password("password", "Password", { required: true }),
33621
+ createField.password("confirmPassword", "Confirm Password", {
33622
+ required: true
33623
+ })
33624
+ ]),
33625
+ createSection.card("Additional Information", [
33626
+ createField.text("phone", "Phone Number", {
33627
+ validation: commonValidations.phone
33628
+ }),
33629
+ createField.date("dateOfBirth", "Date of Birth"),
33630
+ createField.checkbox(
33631
+ "agreeToTerms",
33632
+ "I agree to the terms and conditions",
33633
+ { required: true }
33634
+ )
33635
+ ])
33636
+ ],
33637
+ // Contact form
33638
+ contact: () => [
33639
+ createSection.plain([
33640
+ createField.text("name", "Full Name", { required: true }),
33641
+ createField.email("email", "Email Address", { required: true }),
33642
+ createField.text("subject", "Subject", { required: true }),
33643
+ createField.textarea("message", "Message", {
33644
+ required: true,
33645
+ gridCols: 2
33646
+ })
33647
+ ])
33648
+ ],
33649
+ // Address form
33650
+ address: () => [
33651
+ createSection.card("Address Information", [
33652
+ createField.text("street", "Street Address", {
33653
+ required: true,
33654
+ gridCols: 2
33655
+ }),
33656
+ createField.text("city", "City", { required: true }),
33657
+ createField.text("state", "State/Province", { required: true }),
33658
+ createField.text("postalCode", "Postal Code", { required: true }),
33659
+ createField.select(
33660
+ "country",
33661
+ "Country",
33662
+ [
33663
+ { label: "United States", value: "US" },
33664
+ { label: "Canada", value: "CA" },
33665
+ { label: "United Kingdom", value: "UK" }
33666
+ // Add more countries as needed
33667
+ ],
33668
+ { required: true }
33669
+ )
33670
+ ])
33671
+ ]
33672
+ };
33265
33673
  function DataTablePagination({ table }) {
33266
33674
  const pagination = table.getState().pagination ?? { pageIndex: 0, pageSize: 10 };
33267
33675
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-2", children: [
@@ -33398,7 +33806,7 @@ var Menu$1 = (props2) => {
33398
33806
  document.removeEventListener("pointermove", handlePointer, { capture: true });
33399
33807
  };
33400
33808
  }, []);
33401
- return /* @__PURE__ */ jsx(Root2$a, { ...popperScope, children: /* @__PURE__ */ jsx(
33809
+ return /* @__PURE__ */ jsx(Root2$9, { ...popperScope, children: /* @__PURE__ */ jsx(
33402
33810
  MenuProvider,
33403
33811
  {
33404
33812
  scope: __scopeMenu,
@@ -33606,7 +34014,7 @@ var MenuContentImpl = React.forwardRef(
33606
34014
  onInteractOutside,
33607
34015
  onDismiss,
33608
34016
  children: /* @__PURE__ */ jsx(
33609
- Root$9,
34017
+ Root$d,
33610
34018
  {
33611
34019
  asChild: true,
33612
34020
  ...rovingFocusGroupScope,
@@ -33620,7 +34028,7 @@ var MenuContentImpl = React.forwardRef(
33620
34028
  }),
33621
34029
  preventScrollOnEntryFocus: true,
33622
34030
  children: /* @__PURE__ */ jsx(
33623
- Content$4,
34031
+ Content$3,
33624
34032
  {
33625
34033
  role: "menu",
33626
34034
  "aria-orientation": "vertical",
@@ -33769,7 +34177,7 @@ var MenuItemImpl = React.forwardRef(
33769
34177
  scope: __scopeMenu,
33770
34178
  disabled,
33771
34179
  textValue: textValue ?? textContent,
33772
- children: /* @__PURE__ */ jsx(Item$1, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsx(
34180
+ children: /* @__PURE__ */ jsx(Item$2, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsx(
33773
34181
  Primitive.div,
33774
34182
  {
33775
34183
  role: "menuitem",
@@ -33931,7 +34339,7 @@ var MenuSub = (props2) => {
33931
34339
  if (parentMenuContext.open === false) handleOpenChange(false);
33932
34340
  return () => handleOpenChange(false);
33933
34341
  }, [parentMenuContext.open, handleOpenChange]);
33934
- return /* @__PURE__ */ jsx(Root2$a, { ...popperScope, children: /* @__PURE__ */ jsx(
34342
+ return /* @__PURE__ */ jsx(Root2$9, { ...popperScope, children: /* @__PURE__ */ jsx(
33935
34343
  MenuProvider,
33936
34344
  {
33937
34345
  scope: __scopeMenu,
@@ -40470,7 +40878,7 @@ var useDialogScope = createDialogScope();
40470
40878
  var AlertDialog$1 = (props2) => {
40471
40879
  const { __scopeAlertDialog, ...alertDialogProps } = props2;
40472
40880
  const dialogScope = useDialogScope(__scopeAlertDialog);
40473
- return /* @__PURE__ */ jsx(Root$c, { ...dialogScope, ...alertDialogProps, modal: true });
40881
+ return /* @__PURE__ */ jsx(Root$a, { ...dialogScope, ...alertDialogProps, modal: true });
40474
40882
  };
40475
40883
  AlertDialog$1.displayName = ROOT_NAME;
40476
40884
  var TRIGGER_NAME$4 = "AlertDialogTrigger";
@@ -40478,7 +40886,7 @@ var AlertDialogTrigger$1 = React.forwardRef(
40478
40886
  (props2, forwardedRef) => {
40479
40887
  const { __scopeAlertDialog, ...triggerProps } = props2;
40480
40888
  const dialogScope = useDialogScope(__scopeAlertDialog);
40481
- return /* @__PURE__ */ jsx(Trigger$8, { ...dialogScope, ...triggerProps, ref: forwardedRef });
40889
+ return /* @__PURE__ */ jsx(Trigger$7, { ...dialogScope, ...triggerProps, ref: forwardedRef });
40482
40890
  }
40483
40891
  );
40484
40892
  AlertDialogTrigger$1.displayName = TRIGGER_NAME$4;
@@ -40515,7 +40923,7 @@ var AlertDialogContent$1 = React.forwardRef(
40515
40923
  titleName: TITLE_NAME,
40516
40924
  docsSlug: "alert-dialog",
40517
40925
  children: /* @__PURE__ */ jsx(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ jsxs(
40518
- Content$3,
40926
+ Content$2,
40519
40927
  {
40520
40928
  role: "alertdialog",
40521
40929
  ...dialogScope,
@@ -40811,381 +41219,6 @@ function DialogProvider({ children }) {
40811
41219
  ] });
40812
41220
  }
40813
41221
  const useDialog = useDialogController;
40814
- function FormBuilderActions({
40815
- onSubmit,
40816
- onCancel,
40817
- onReset,
40818
- submitLabel = "Save",
40819
- cancelLabel = "Cancel",
40820
- resetLabel = "Reset",
40821
- isSubmitting = false,
40822
- isValid: isValid2 = true,
40823
- showReset = false,
40824
- customActions,
40825
- className,
40826
- submitButtonProps,
40827
- cancelButtonProps,
40828
- resetButtonProps
40829
- }) {
40830
- return /* @__PURE__ */ jsxs("div", { className: cn$1("flex items-center justify-end space-x-4", className), children: [
40831
- customActions,
40832
- showReset && onReset && /* @__PURE__ */ jsx(
40833
- Button$1,
40834
- {
40835
- type: "button",
40836
- variant: "outline",
40837
- onClick: onReset,
40838
- disabled: isSubmitting,
40839
- ...resetButtonProps,
40840
- children: resetLabel
40841
- }
40842
- ),
40843
- onCancel && /* @__PURE__ */ jsx(
40844
- Button$1,
40845
- {
40846
- type: "button",
40847
- variant: "outline",
40848
- onClick: onCancel,
40849
- disabled: isSubmitting,
40850
- ...cancelButtonProps,
40851
- children: cancelLabel
40852
- }
40853
- ),
40854
- onSubmit && /* @__PURE__ */ jsx(
40855
- Button$1,
40856
- {
40857
- type: "submit",
40858
- onClick: onSubmit,
40859
- disabled: isSubmitting || !isValid2,
40860
- ...submitButtonProps,
40861
- children: isSubmitting ? "Saving..." : submitLabel
40862
- }
40863
- )
40864
- ] });
40865
- }
40866
- const commonValidations = {
40867
- email: string().email("Please enter a valid email address"),
40868
- phone: string().regex(/^[\+]?[1-9][\d]{0,15}$/, "Please enter a valid phone number"),
40869
- url: string().url("Please enter a valid URL"),
40870
- password: string().min(8, "Password must be at least 8 characters"),
40871
- strongPassword: string().min(8, "Password must be at least 8 characters").regex(
40872
- /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]/,
40873
- "Password must contain uppercase, lowercase, number and special character"
40874
- ),
40875
- required: string().min(1, "This field is required"),
40876
- optionalString: string().optional(),
40877
- positiveNumber: number().positive("Must be a positive number"),
40878
- nonNegativeNumber: number().min(0, "Must be 0 or greater")
40879
- };
40880
- const createField = {
40881
- text: (name, label, options = {}) => ({
40882
- name,
40883
- label,
40884
- type: "text",
40885
- required: false,
40886
- ...options
40887
- }),
40888
- email: (name, label, options = {}) => ({
40889
- name,
40890
- label,
40891
- type: "email",
40892
- required: false,
40893
- validation: commonValidations.email,
40894
- ...options
40895
- }),
40896
- password: (name, label, options = {}) => ({
40897
- name,
40898
- label,
40899
- type: "password",
40900
- required: false,
40901
- validation: commonValidations.password,
40902
- ...options
40903
- }),
40904
- number: (name, label, options = {}) => ({
40905
- name,
40906
- label,
40907
- type: "number",
40908
- required: false,
40909
- ...options
40910
- }),
40911
- textarea: (name, label, options = {}) => ({
40912
- name,
40913
- label,
40914
- type: "textarea",
40915
- required: false,
40916
- gridCols: 2,
40917
- // Default to full width
40918
- ...options
40919
- }),
40920
- select: (name, label, options, fieldOptions = {}) => ({
40921
- name,
40922
- label,
40923
- type: "select",
40924
- options,
40925
- required: false,
40926
- ...fieldOptions
40927
- }),
40928
- checkbox: (name, label, options = {}) => ({
40929
- name,
40930
- label,
40931
- type: "checkbox",
40932
- required: false,
40933
- defaultValue: false,
40934
- ...options
40935
- }),
40936
- switch: (name, label, options = {}) => ({
40937
- name,
40938
- label,
40939
- type: "switch",
40940
- required: false,
40941
- defaultValue: false,
40942
- ...options
40943
- }),
40944
- radio: (name, label, options, fieldOptions = {}) => ({
40945
- name,
40946
- label,
40947
- type: "radio",
40948
- options,
40949
- required: false,
40950
- ...fieldOptions
40951
- }),
40952
- date: (name, label, options = {}) => ({
40953
- name,
40954
- label,
40955
- type: "date",
40956
- required: false,
40957
- ...options
40958
- }),
40959
- file: (name, label, options = {}) => ({
40960
- name,
40961
- label,
40962
- type: "file",
40963
- required: false,
40964
- ...options
40965
- }),
40966
- object: (name, label, fields, options = {}) => ({
40967
- name,
40968
- label,
40969
- type: "object",
40970
- fields,
40971
- required: false,
40972
- gridCols: 2,
40973
- // Default to full width
40974
- ...options
40975
- }),
40976
- array: (name, label, fields, options = {}) => ({
40977
- name,
40978
- label,
40979
- type: "array",
40980
- fields,
40981
- required: false,
40982
- gridCols: 2,
40983
- // Default to full width
40984
- defaultValue: [],
40985
- ...options
40986
- })
40987
- };
40988
- const createSection = {
40989
- card: (title, fields, options = {}) => ({
40990
- title,
40991
- fields,
40992
- variant: "card",
40993
- ...options
40994
- }),
40995
- separator: (title, fields, options = {}) => ({
40996
- title,
40997
- fields,
40998
- variant: "separator",
40999
- ...options
41000
- }),
41001
- plain: (fields, options = {}) => ({
41002
- fields,
41003
- variant: "plain",
41004
- ...options
41005
- })
41006
- };
41007
- const createDependency = {
41008
- showWhen: (field, condition) => ({
41009
- field,
41010
- condition,
41011
- action: "show"
41012
- }),
41013
- hideWhen: (field, condition) => ({
41014
- field,
41015
- condition,
41016
- action: "hide"
41017
- }),
41018
- enableWhen: (field, condition) => ({
41019
- field,
41020
- condition,
41021
- action: "enable"
41022
- }),
41023
- disableWhen: (field, condition) => ({
41024
- field,
41025
- condition,
41026
- action: "disable"
41027
- }),
41028
- setValueWhen: (field, condition, value) => ({
41029
- field,
41030
- condition,
41031
- action: "setValue",
41032
- value
41033
- })
41034
- };
41035
- const conditions = {
41036
- equals: (value) => (fieldValue) => fieldValue === value,
41037
- notEquals: (value) => (fieldValue) => fieldValue !== value,
41038
- includes: (value) => (fieldValue) => Array.isArray(fieldValue) && fieldValue.includes(value),
41039
- notIncludes: (value) => (fieldValue) => Array.isArray(fieldValue) && !fieldValue.includes(value),
41040
- isEmpty: () => (fieldValue) => !fieldValue || Array.isArray(fieldValue) && fieldValue.length === 0,
41041
- isNotEmpty: () => (fieldValue) => fieldValue && (!Array.isArray(fieldValue) || fieldValue.length > 0),
41042
- greaterThan: (value) => (fieldValue) => Number(fieldValue) > value,
41043
- lessThan: (value) => (fieldValue) => Number(fieldValue) < value,
41044
- isTrue: () => (fieldValue) => fieldValue === true,
41045
- isFalse: () => (fieldValue) => fieldValue === false
41046
- };
41047
- const transformers = {
41048
- // Transform form data before submission
41049
- cleanEmptyStrings: (data) => {
41050
- const clean = (obj) => {
41051
- if (Array.isArray(obj)) {
41052
- return obj.map(clean).filter((item) => item !== null && item !== void 0);
41053
- }
41054
- if (obj && typeof obj === "object") {
41055
- const cleaned = {};
41056
- Object.keys(obj).forEach((key) => {
41057
- const value = clean(obj[key]);
41058
- if (value !== "" && value !== null && value !== void 0) {
41059
- cleaned[key] = value;
41060
- }
41061
- });
41062
- return cleaned;
41063
- }
41064
- return obj === "" ? void 0 : obj;
41065
- };
41066
- return clean(data);
41067
- },
41068
- // Convert string numbers to actual numbers
41069
- parseNumbers: (data, numberFields) => {
41070
- const parsed = { ...data };
41071
- const parseValue = (obj, path = []) => {
41072
- if (Array.isArray(obj)) {
41073
- return obj.map(
41074
- (item, index2) => parseValue(item, [...path, String(index2)])
41075
- );
41076
- }
41077
- if (obj && typeof obj === "object") {
41078
- const result = {};
41079
- Object.keys(obj).forEach((key) => {
41080
- const currentPath = [...path, key].join(".");
41081
- result[key] = parseValue(obj[key], [...path, key]);
41082
- if (numberFields.includes(currentPath) && typeof result[key] === "string") {
41083
- const num = Number(result[key]);
41084
- if (!isNaN(num)) {
41085
- result[key] = num;
41086
- }
41087
- }
41088
- });
41089
- return result;
41090
- }
41091
- return obj;
41092
- };
41093
- return parseValue(parsed);
41094
- },
41095
- // Convert dates to ISO strings
41096
- formatDates: (data, dateFields) => {
41097
- const formatted = { ...data };
41098
- const formatValue = (obj, path = []) => {
41099
- if (Array.isArray(obj)) {
41100
- return obj.map(
41101
- (item, index2) => formatValue(item, [...path, String(index2)])
41102
- );
41103
- }
41104
- if (obj && typeof obj === "object") {
41105
- const result = {};
41106
- Object.keys(obj).forEach((key) => {
41107
- const currentPath = [...path, key].join(".");
41108
- result[key] = formatValue(obj[key], [...path, key]);
41109
- if (dateFields.includes(currentPath) && result[key] instanceof Date) {
41110
- result[key] = result[key].toISOString();
41111
- }
41112
- });
41113
- return result;
41114
- }
41115
- return obj;
41116
- };
41117
- return formatValue(formatted);
41118
- }
41119
- };
41120
- const validators = {
41121
- // Create conditional validation
41122
- when: (condition, schema) => any().refine(condition, { message: "Condition not met" }).pipe(schema),
41123
- // Cross-field validation - returns a refinement function to be used on object schemas
41124
- matchField: (fieldName, targetField) => (data) => data[fieldName] === data[targetField],
41125
- // Array validation
41126
- minItems: (min2, message2) => array(any()).min(min2, message2 || `Must have at least ${min2} items`),
41127
- maxItems: (max2, message2) => array(any()).max(max2, message2 || `Must have at most ${max2} items`)
41128
- };
41129
- const commonForms = {
41130
- // User registration form
41131
- userRegistration: () => [
41132
- createSection.card("Personal Information", [
41133
- createField.text("firstName", "First Name", { required: true }),
41134
- createField.text("lastName", "Last Name", { required: true }),
41135
- createField.email("email", "Email Address", { required: true }),
41136
- createField.password("password", "Password", { required: true }),
41137
- createField.password("confirmPassword", "Confirm Password", {
41138
- required: true
41139
- })
41140
- ]),
41141
- createSection.card("Additional Information", [
41142
- createField.text("phone", "Phone Number", {
41143
- validation: commonValidations.phone
41144
- }),
41145
- createField.date("dateOfBirth", "Date of Birth"),
41146
- createField.checkbox(
41147
- "agreeToTerms",
41148
- "I agree to the terms and conditions",
41149
- { required: true }
41150
- )
41151
- ])
41152
- ],
41153
- // Contact form
41154
- contact: () => [
41155
- createSection.plain([
41156
- createField.text("name", "Full Name", { required: true }),
41157
- createField.email("email", "Email Address", { required: true }),
41158
- createField.text("subject", "Subject", { required: true }),
41159
- createField.textarea("message", "Message", {
41160
- required: true,
41161
- gridCols: 2
41162
- })
41163
- ])
41164
- ],
41165
- // Address form
41166
- address: () => [
41167
- createSection.card("Address Information", [
41168
- createField.text("street", "Street Address", {
41169
- required: true,
41170
- gridCols: 2
41171
- }),
41172
- createField.text("city", "City", { required: true }),
41173
- createField.text("state", "State/Province", { required: true }),
41174
- createField.text("postalCode", "Postal Code", { required: true }),
41175
- createField.select(
41176
- "country",
41177
- "Country",
41178
- [
41179
- { label: "United States", value: "US" },
41180
- { label: "Canada", value: "CA" },
41181
- { label: "United Kingdom", value: "UK" }
41182
- // Add more countries as needed
41183
- ],
41184
- { required: true }
41185
- )
41186
- ])
41187
- ]
41188
- };
41189
41222
  const widthToClass = {
41190
41223
  full: "max-w-none",
41191
41224
  sm: "max-w-screen-sm",
@@ -41299,19 +41332,19 @@ function StackDialogRenderer(props2) {
41299
41332
  const handleCloseDialog = (id) => () => {
41300
41333
  props2.closeDialog(id);
41301
41334
  };
41302
- return props2.dialogs.map((dialog) => /* @__PURE__ */ jsx(
41335
+ return props2.dialogs.map((dialog, i2) => /* @__PURE__ */ jsx(
41303
41336
  Dialog,
41304
41337
  {
41305
- open: true,
41306
- onOpenChange: (open) => !open && handleCloseDialog(dialog.id),
41338
+ open: !!props2.dialogs[i2],
41339
+ onOpenChange: handleCloseDialog(dialog.id),
41307
41340
  children: /* @__PURE__ */ jsx(
41308
- DialogContent$1,
41341
+ DialogContent,
41309
41342
  {
41310
41343
  onEscapeKeyDown: (e) => {
41311
- if (!dialog.closeOnEscapePressed) e.preventDefault();
41344
+ if (dialog.closeOnEscapePressed === false) e.preventDefault();
41312
41345
  },
41313
41346
  onInteractOutside: (e) => {
41314
- if (!dialog.closeOnInteractOutside) e.preventDefault();
41347
+ if (dialog.closeOnInteractOutside === false) e.preventDefault();
41315
41348
  },
41316
41349
  children: dialog.template
41317
41350
  }
@@ -41340,7 +41373,8 @@ function StackDialogContextProvider(props2) {
41340
41373
  const handleCloseDialog = useCallback((id) => {
41341
41374
  setActiveDialogs((prev) => {
41342
41375
  const clone2 = [...prev];
41343
- clone2.splice(clone2.findIndex((d) => d.id === (id || "")));
41376
+ if (!id) clone2.splice(clone2.length - 1, 1);
41377
+ else clone2.splice(clone2.findIndex((d) => d.id === id));
41344
41378
  return clone2;
41345
41379
  });
41346
41380
  }, [setActiveDialogs]);
@@ -41442,12 +41476,12 @@ function useIsMobile() {
41442
41476
  return !!isMobile;
41443
41477
  }
41444
41478
  function Sheet({ ...props2 }) {
41445
- return /* @__PURE__ */ jsx(Root$c, { "data-slot": "sheet", ...props2 });
41479
+ return /* @__PURE__ */ jsx(Root$a, { "data-slot": "sheet", ...props2 });
41446
41480
  }
41447
41481
  function SheetTrigger({
41448
41482
  ...props2
41449
41483
  }) {
41450
- return /* @__PURE__ */ jsx(Trigger$8, { "data-slot": "sheet-trigger", ...props2 });
41484
+ return /* @__PURE__ */ jsx(Trigger$7, { "data-slot": "sheet-trigger", ...props2 });
41451
41485
  }
41452
41486
  function SheetClose({
41453
41487
  ...props2
@@ -41484,7 +41518,7 @@ function SheetContent({
41484
41518
  return /* @__PURE__ */ jsxs(SheetPortal, { children: [
41485
41519
  /* @__PURE__ */ jsx(SheetOverlay, {}),
41486
41520
  /* @__PURE__ */ jsxs(
41487
- Content$3,
41521
+ Content$2,
41488
41522
  {
41489
41523
  "data-slot": "sheet-content",
41490
41524
  className: cn$1(
@@ -41835,7 +41869,7 @@ function SidebarSeparator({
41835
41869
  ...props2
41836
41870
  }) {
41837
41871
  return /* @__PURE__ */ jsx(
41838
- Separator$1,
41872
+ Separator$2,
41839
41873
  {
41840
41874
  "data-slot": "sidebar-separator",
41841
41875
  "data-sidebar": "separator",
@@ -42462,7 +42496,7 @@ function AdminLayoutContent({
42462
42496
  /* @__PURE__ */ jsx(SidebarGroupLabel, { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider px-3 mb-2 group-data-[collapsible=icon]:hidden", children: group.label }),
42463
42497
  /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, { className: "group-data-[collapsible=icon]:items-center", children: group.items.map((item) => renderItem(item, 0)) }) })
42464
42498
  ] }),
42465
- idx < sidebarGroups.length - 1 && /* @__PURE__ */ jsx(Separator$1, { orientation: "horizontal", className: "bg-sidebar-border group-data-[collapsible=icon]:hidden" })
42499
+ idx < sidebarGroups.length - 1 && /* @__PURE__ */ jsx(Separator$2, { orientation: "horizontal", className: "bg-sidebar-border group-data-[collapsible=icon]:hidden" })
42466
42500
  ] }, group.id)) }),
42467
42501
  /* @__PURE__ */ jsx(SidebarFooter, { className: "bg-sidebar border-t border-sidebar-border px-2 py-3", children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { className: "group-data-[collapsible=icon]:flex group-data-[collapsible=icon]:w-full group-data-[collapsible=icon]:justify-center", children: /* @__PURE__ */ jsx(
42468
42502
  SidebarMenuButton,
@@ -52508,7 +52542,7 @@ function Root$3({ open: openProp, onOpenChange, children, onDrag: onDragProp, on
52508
52542
  }, [
52509
52543
  modal
52510
52544
  ]);
52511
- return /* @__PURE__ */ React__default.createElement(Root$c, {
52545
+ return /* @__PURE__ */ React__default.createElement(Root$a, {
52512
52546
  defaultOpen,
52513
52547
  onOpenChange: (open) => {
52514
52548
  if (!dismissible && !open) return;
@@ -52619,7 +52653,7 @@ const Content$1 = /* @__PURE__ */ React__default.forwardRef(function({ onPointer
52619
52653
  wasBeyondThePointRef.current = false;
52620
52654
  onRelease(event);
52621
52655
  }
52622
- return /* @__PURE__ */ React__default.createElement(Content$3, {
52656
+ return /* @__PURE__ */ React__default.createElement(Content$2, {
52623
52657
  "data-vaul-drawer-direction": direction,
52624
52658
  "data-vaul-drawer": "",
52625
52659
  "data-vaul-delayed-snap-points": delayedSnapPoints ? "true" : "false",
@@ -52782,7 +52816,7 @@ const Drawer$1 = {
52782
52816
  Root: Root$3,
52783
52817
  Content: Content$1,
52784
52818
  Overlay,
52785
- Trigger: Trigger$8,
52819
+ Trigger: Trigger$7,
52786
52820
  Portal: Portal$1,
52787
52821
  Close,
52788
52822
  Title,
@@ -53057,7 +53091,7 @@ var HoverCard$1 = (props2) => {
53057
53091
  onDismiss: handleDismiss,
53058
53092
  hasSelectionRef,
53059
53093
  isPointerDownOnContentRef,
53060
- children: /* @__PURE__ */ jsx(Root2$a, { ...popperScope, children })
53094
+ children: /* @__PURE__ */ jsx(Root2$9, { ...popperScope, children })
53061
53095
  }
53062
53096
  );
53063
53097
  };
@@ -53177,7 +53211,7 @@ var HoverCardContentImpl = React.forwardRef((props2, forwardedRef) => {
53177
53211
  }),
53178
53212
  onDismiss: context.onDismiss,
53179
53213
  children: /* @__PURE__ */ jsx(
53180
- Content$4,
53214
+ Content$3,
53181
53215
  {
53182
53216
  ...popperScope,
53183
53217
  ...contentProps,
@@ -53566,7 +53600,7 @@ var Menubar$1 = React.forwardRef(
53566
53600
  dir: direction,
53567
53601
  loop,
53568
53602
  children: /* @__PURE__ */ jsx(Collection$2.Provider, { scope: __scopeMenubar, children: /* @__PURE__ */ jsx(Collection$2.Slot, { scope: __scopeMenubar, children: /* @__PURE__ */ jsx(
53569
- Root$9,
53603
+ Root$d,
53570
53604
  {
53571
53605
  asChild: true,
53572
53606
  ...rovingFocusGroupScope,
@@ -53636,7 +53670,7 @@ var MenubarTrigger$1 = React.forwardRef(
53636
53670
  const [isFocused, setIsFocused] = React.useState(false);
53637
53671
  const open = context.value === menuContext.value;
53638
53672
  return /* @__PURE__ */ jsx(Collection$2.ItemSlot, { scope: __scopeMenubar, value: menuContext.value, disabled, children: /* @__PURE__ */ jsx(
53639
- Item$1,
53673
+ Item$2,
53640
53674
  {
53641
53675
  asChild: true,
53642
53676
  ...rovingFocusGroupScope,
@@ -54491,7 +54525,7 @@ var NavigationMenuTrigger$1 = React.forwardRef((props2, forwardedRef) => {
54491
54525
  ) }) }),
54492
54526
  open && /* @__PURE__ */ jsxs(Fragment, { children: [
54493
54527
  /* @__PURE__ */ jsx(
54494
- Root$b,
54528
+ Root$9,
54495
54529
  {
54496
54530
  "aria-hidden": true,
54497
54531
  tabIndex: 0,
@@ -59914,7 +59948,7 @@ var ToggleGroupImpl = React__default.forwardRef(
59914
59948
  const direction = useDirection(dir);
59915
59949
  const commonProps = { role: "group", dir: direction, ...toggleGroupProps };
59916
59950
  return /* @__PURE__ */ jsx(ToggleGroupContext$1, { scope: __scopeToggleGroup, rovingFocus, disabled, children: rovingFocus ? /* @__PURE__ */ jsx(
59917
- Root$9,
59951
+ Root$d,
59918
59952
  {
59919
59953
  asChild: true,
59920
59954
  ...rovingFocusGroupScope,
@@ -59937,7 +59971,7 @@ var ToggleGroupItem$1 = React__default.forwardRef(
59937
59971
  const commonProps = { ...props2, pressed, disabled };
59938
59972
  const ref = React__default.useRef(null);
59939
59973
  return context.rovingFocus ? /* @__PURE__ */ jsx(
59940
- Item$1,
59974
+ Item$2,
59941
59975
  {
59942
59976
  asChild: true,
59943
59977
  ...rovingFocusGroupScope,
@@ -60263,7 +60297,7 @@ export {
60263
60297
  SelectSeparator,
60264
60298
  SelectTrigger,
60265
60299
  SelectValue,
60266
- Separator$1 as Separator,
60300
+ Separator$2 as Separator,
60267
60301
  Sheet,
60268
60302
  SheetClose,
60269
60303
  SheetContent,