@constructive-io/ui 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/autocomplete.js +11 -3
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/card.d.ts +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/combobox.d.ts +1 -1
- package/dist/components/combobox.js +50 -14
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.d.ts +16 -35
- package/dist/components/command.js +72 -508
- package/dist/components/command.js.map +1 -1
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/drawer.js +1 -1
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.js +3 -3
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/form.js.map +1 -1
- package/dist/components/input-group.js +3 -3
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/json-input.js.map +1 -1
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/org-chart/index.d.ts +54 -0
- package/dist/components/org-chart/index.js +861 -0
- package/dist/components/org-chart/index.js.map +1 -0
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/portal.js.map +1 -1
- package/dist/components/record-picker.js +3 -3
- package/dist/components/record-picker.js.map +1 -1
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/responsive-diagram.js +6 -4
- package/dist/components/responsive-diagram.js.map +1 -1
- package/dist/components/select.d.ts +2 -2
- package/dist/components/select.js +3 -3
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/stack/index.d.ts +11 -0
- package/dist/components/stack/index.js +33 -6
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tags.d.ts +1 -3
- package/dist/components/tags.js +107 -388
- package/dist/components/tags.js.map +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/index.cjs +867 -378
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -24
- package/dist/index.d.ts +82 -24
- package/dist/index.js +746 -259
- package/dist/index.js.map +1 -1
- package/package.json +13 -6
- package/src/styles/globals.css +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var clsx = require('clsx');
|
|
5
5
|
var tailwindMerge = require('tailwind-merge');
|
|
6
|
-
var
|
|
6
|
+
var React19 = require('react');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var classVarianceAuthority = require('class-variance-authority');
|
|
9
9
|
var separator = require('@base-ui/react/separator');
|
|
@@ -30,14 +30,17 @@ var collapsible = require('@base-ui/react/collapsible');
|
|
|
30
30
|
var ResizablePrimitive = require('react-resizable-panels');
|
|
31
31
|
var avatar = require('@base-ui/react/avatar');
|
|
32
32
|
var autocomplete = require('@base-ui/react/autocomplete');
|
|
33
|
+
var react$1 = require('@xyflow/react');
|
|
34
|
+
var react$2 = require('@remixicon/react');
|
|
35
|
+
var cmdk = require('cmdk');
|
|
33
36
|
var combobox = require('@base-ui/react/combobox');
|
|
34
|
-
var react$1 = require('@remixicon/react');
|
|
35
37
|
var matchSorter = require('match-sorter');
|
|
36
38
|
var date = require('@internationalized/date');
|
|
37
39
|
var reactAriaComponents = require('react-aria-components');
|
|
38
40
|
var sonner = require('sonner');
|
|
39
41
|
var reactDom = require('react-dom');
|
|
40
|
-
var react$
|
|
42
|
+
var react$3 = require('@use-gesture/react');
|
|
43
|
+
require('@xyflow/react/dist/style.css');
|
|
41
44
|
|
|
42
45
|
function _interopNamespace(e) {
|
|
43
46
|
if (e && e.__esModule) return e;
|
|
@@ -57,7 +60,7 @@ function _interopNamespace(e) {
|
|
|
57
60
|
return Object.freeze(n);
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
var
|
|
63
|
+
var React19__namespace = /*#__PURE__*/_interopNamespace(React19);
|
|
61
64
|
var ResizablePrimitive__namespace = /*#__PURE__*/_interopNamespace(ResizablePrimitive);
|
|
62
65
|
|
|
63
66
|
// src/lib/utils.ts
|
|
@@ -105,22 +108,22 @@ function mergePropsWithRef(parentProps, childElement) {
|
|
|
105
108
|
return mergedProps;
|
|
106
109
|
}
|
|
107
110
|
function isSlottable(child) {
|
|
108
|
-
return
|
|
111
|
+
return React19__namespace.isValidElement(child);
|
|
109
112
|
}
|
|
110
|
-
var Slot =
|
|
113
|
+
var Slot = React19__namespace.forwardRef((props, forwardedRef) => {
|
|
111
114
|
const { children, ...slotProps } = props;
|
|
112
115
|
if (isSlottable(children)) {
|
|
113
116
|
const childProps = children.props;
|
|
114
117
|
const childRef = childProps.ref;
|
|
115
|
-
return
|
|
118
|
+
return React19__namespace.cloneElement(children, {
|
|
116
119
|
...mergeProps(slotProps, childProps),
|
|
117
120
|
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
|
|
118
121
|
});
|
|
119
122
|
}
|
|
120
|
-
if (
|
|
121
|
-
const childrenArray =
|
|
123
|
+
if (React19__namespace.Children.count(children) > 1) {
|
|
124
|
+
const childrenArray = React19__namespace.Children.toArray(children);
|
|
122
125
|
const slottableChild = childrenArray.find(
|
|
123
|
-
(child) =>
|
|
126
|
+
(child) => React19__namespace.isValidElement(child) && child.type === Slottable
|
|
124
127
|
);
|
|
125
128
|
if (slottableChild) {
|
|
126
129
|
const newElement = slottableChild.props.children;
|
|
@@ -128,12 +131,12 @@ var Slot = React20__namespace.forwardRef((props, forwardedRef) => {
|
|
|
128
131
|
const newElementProps = newElement.props;
|
|
129
132
|
const newChildren = childrenArray.map((child) => {
|
|
130
133
|
if (child === slottableChild) {
|
|
131
|
-
return
|
|
134
|
+
return React19__namespace.Children.count(newElementProps.children) > 1 ? React19__namespace.Children.only(null) : newElementProps.children;
|
|
132
135
|
}
|
|
133
136
|
return child;
|
|
134
137
|
});
|
|
135
138
|
const childRef = newElementProps.ref;
|
|
136
|
-
return
|
|
139
|
+
return React19__namespace.cloneElement(newElement, {
|
|
137
140
|
...mergeProps(slotProps, newElementProps),
|
|
138
141
|
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
|
|
139
142
|
children: newChildren
|
|
@@ -152,12 +155,12 @@ function useControllableState({
|
|
|
152
155
|
defaultProp,
|
|
153
156
|
onChange
|
|
154
157
|
}) {
|
|
155
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
158
|
+
const [uncontrolledValue, setUncontrolledValue] = React19.useState(defaultProp);
|
|
156
159
|
const isControlled = prop !== void 0;
|
|
157
160
|
const value = isControlled ? prop : uncontrolledValue;
|
|
158
|
-
const onChangeRef =
|
|
161
|
+
const onChangeRef = React19.useRef(onChange);
|
|
159
162
|
onChangeRef.current = onChange;
|
|
160
|
-
const setValue =
|
|
163
|
+
const setValue = React19.useCallback(
|
|
161
164
|
(newValue) => {
|
|
162
165
|
if (!isControlled) {
|
|
163
166
|
setUncontrolledValue(newValue);
|
|
@@ -333,12 +336,12 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
333
336
|
}
|
|
334
337
|
}
|
|
335
338
|
);
|
|
336
|
-
var Button =
|
|
339
|
+
var Button = React19__namespace.forwardRef(
|
|
337
340
|
({ className, variant, size, asChild, children, type = "button", ...props }, ref) => {
|
|
338
341
|
const buttonClasses = cn(buttonVariants({ className, size, variant }));
|
|
339
|
-
if (asChild &&
|
|
342
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
340
343
|
const childProps = children.props;
|
|
341
|
-
return
|
|
344
|
+
return React19__namespace.cloneElement(children, {
|
|
342
345
|
...props,
|
|
343
346
|
className: cn(buttonClasses, childProps.className),
|
|
344
347
|
"data-slot": "button"
|
|
@@ -374,7 +377,7 @@ var badgeVariants = classVarianceAuthority.cva(
|
|
|
374
377
|
}
|
|
375
378
|
}
|
|
376
379
|
);
|
|
377
|
-
var Badge =
|
|
380
|
+
var Badge = React19__namespace.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("span", { ref, "data-slot": "badge", className: cn(badgeVariants({ variant, size }), className), ...props }));
|
|
378
381
|
Badge.displayName = "Badge";
|
|
379
382
|
function Label({ className, ...props }) {
|
|
380
383
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -480,13 +483,13 @@ var alertVariants = classVarianceAuthority.cva(
|
|
|
480
483
|
}
|
|
481
484
|
}
|
|
482
485
|
);
|
|
483
|
-
var Alert =
|
|
486
|
+
var Alert = React19__namespace.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, role: "alert", className: cn(alertVariants({ variant }), className), ...props }));
|
|
484
487
|
Alert.displayName = "Alert";
|
|
485
|
-
var AlertTitle =
|
|
488
|
+
var AlertTitle = React19__namespace.forwardRef(
|
|
486
489
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("h5", { ref, className: cn("mb-1 leading-none font-medium tracking-tight", className), ...props })
|
|
487
490
|
);
|
|
488
491
|
AlertTitle.displayName = "AlertTitle";
|
|
489
|
-
var AlertDescription =
|
|
492
|
+
var AlertDescription = React19__namespace.forwardRef(
|
|
490
493
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("text-sm [&_p]:leading-relaxed", className), ...props })
|
|
491
494
|
);
|
|
492
495
|
AlertDescription.displayName = "AlertDescription";
|
|
@@ -498,7 +501,7 @@ function Input({ className, size = "default", unstyled = false, ...props }) {
|
|
|
498
501
|
className: cn(
|
|
499
502
|
!unstyled && [
|
|
500
503
|
// Base layout
|
|
501
|
-
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base
|
|
504
|
+
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base transition-shadow",
|
|
502
505
|
// Inner shadow highlight
|
|
503
506
|
"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)]",
|
|
504
507
|
"not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)]",
|
|
@@ -544,7 +547,7 @@ function Textarea({ className, size = "default", unstyled = false, ...props }) {
|
|
|
544
547
|
className: cn(
|
|
545
548
|
!unstyled && [
|
|
546
549
|
// Base layout
|
|
547
|
-
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base
|
|
550
|
+
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base transition-shadow",
|
|
548
551
|
// Inner shadow highlight
|
|
549
552
|
"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)]",
|
|
550
553
|
"not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)]",
|
|
@@ -579,13 +582,13 @@ function Textarea({ className, size = "default", unstyled = false, ...props }) {
|
|
|
579
582
|
}
|
|
580
583
|
);
|
|
581
584
|
}
|
|
582
|
-
var Checkbox =
|
|
585
|
+
var Checkbox = React19__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
583
586
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
584
587
|
checkbox.Checkbox.Root,
|
|
585
588
|
{
|
|
586
589
|
ref,
|
|
587
590
|
className: cn(
|
|
588
|
-
"relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[4px] border border-input bg-background bg-clip-padding
|
|
591
|
+
"relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[4px] border border-input bg-background bg-clip-padding outline-none ring-ring transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:bg-clip-border dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/8%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none",
|
|
589
592
|
className
|
|
590
593
|
),
|
|
591
594
|
"data-slot": "checkbox",
|
|
@@ -686,7 +689,7 @@ function Switch({ className, ...props }) {
|
|
|
686
689
|
);
|
|
687
690
|
}
|
|
688
691
|
var PORTAL_ROOT_ID = "portal-root";
|
|
689
|
-
var PortalContext =
|
|
692
|
+
var PortalContext = React19__namespace.createContext({
|
|
690
693
|
layer: "base",
|
|
691
694
|
depth: 0,
|
|
692
695
|
floatingPortalStrategy: "root",
|
|
@@ -697,9 +700,9 @@ function ModalPortalScope({
|
|
|
697
700
|
floatingPortalStrategy = "nested",
|
|
698
701
|
floatingZIndex = "default"
|
|
699
702
|
}) {
|
|
700
|
-
const parentContext =
|
|
703
|
+
const parentContext = React19__namespace.useContext(PortalContext);
|
|
701
704
|
const depth = parentContext.layer === "modal" ? parentContext.depth + 1 : 0;
|
|
702
|
-
const value =
|
|
705
|
+
const value = React19__namespace.useMemo(
|
|
703
706
|
() => ({
|
|
704
707
|
layer: "modal",
|
|
705
708
|
depth,
|
|
@@ -711,14 +714,14 @@ function ModalPortalScope({
|
|
|
711
714
|
return /* @__PURE__ */ jsxRuntime.jsx(PortalContext.Provider, { value, children });
|
|
712
715
|
}
|
|
713
716
|
function usePortalContext() {
|
|
714
|
-
return
|
|
717
|
+
return React19__namespace.useContext(PortalContext);
|
|
715
718
|
}
|
|
716
719
|
function useInModalOverlay() {
|
|
717
|
-
return
|
|
720
|
+
return React19__namespace.useContext(PortalContext).layer === "modal";
|
|
718
721
|
}
|
|
719
722
|
function useRootPortalContainer() {
|
|
720
|
-
const [container, setContainer] =
|
|
721
|
-
|
|
723
|
+
const [container, setContainer] = React19__namespace.useState(null);
|
|
724
|
+
React19__namespace.useLayoutEffect(() => {
|
|
722
725
|
const el = document.getElementById(PORTAL_ROOT_ID);
|
|
723
726
|
setContainer(el);
|
|
724
727
|
}, []);
|
|
@@ -726,7 +729,7 @@ function useRootPortalContainer() {
|
|
|
726
729
|
}
|
|
727
730
|
function useFloatingOverlayPortalProps() {
|
|
728
731
|
const rootContainer = useRootPortalContainer();
|
|
729
|
-
const { floatingPortalStrategy, floatingZIndex } =
|
|
732
|
+
const { floatingPortalStrategy, floatingZIndex } = React19__namespace.useContext(PortalContext);
|
|
730
733
|
const container = floatingPortalStrategy === "nested" ? void 0 : rootContainer ?? null;
|
|
731
734
|
const zIndexClass = floatingZIndex === "elevated" ? "z-[var(--z-layer-floating-elevated)]" : "z-[var(--z-layer-floating)]";
|
|
732
735
|
return { container, zIndexClass };
|
|
@@ -765,14 +768,14 @@ function Select({ onValueChange, ...props }) {
|
|
|
765
768
|
}
|
|
766
769
|
);
|
|
767
770
|
}
|
|
768
|
-
var SelectTrigger =
|
|
771
|
+
var SelectTrigger = React19__namespace.forwardRef(
|
|
769
772
|
({ className, size = "default", children, ...props }, ref) => {
|
|
770
773
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
771
774
|
select.Select.Trigger,
|
|
772
775
|
{
|
|
773
776
|
ref,
|
|
774
777
|
className: cn(
|
|
775
|
-
"relative inline-flex min-h-9 w-full min-w-36 select-none items-center justify-between gap-2 rounded-lg border border-input bg-background bg-clip-padding px-[calc(--spacing(3)-1px)] text-left text-base
|
|
778
|
+
"relative inline-flex min-h-9 w-full min-w-36 select-none items-center justify-between gap-2 rounded-lg border border-input bg-background bg-clip-padding px-[calc(--spacing(3)-1px)] text-left text-base outline-none ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 focus-visible:border-ring focus-visible:ring-[3px] aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 data-disabled:pointer-events-none data-disabled:opacity-64 sm:min-h-8 sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [[data-disabled],:focus-visible,[aria-invalid],[data-pressed]]:shadow-none",
|
|
776
779
|
size === "sm" && "min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7",
|
|
777
780
|
size === "lg" && "min-h-10 sm:min-h-9",
|
|
778
781
|
className
|
|
@@ -906,10 +909,10 @@ function SelectSeparator({
|
|
|
906
909
|
}
|
|
907
910
|
);
|
|
908
911
|
}
|
|
909
|
-
function SelectGroup(props) {
|
|
912
|
+
function SelectGroup({ ...props }) {
|
|
910
913
|
return /* @__PURE__ */ jsxRuntime.jsx(select.Select.Group, { "data-slot": "select-group", ...props });
|
|
911
914
|
}
|
|
912
|
-
function SelectGroupLabel(props) {
|
|
915
|
+
function SelectGroupLabel({ ...props }) {
|
|
913
916
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
914
917
|
select.Select.GroupLabel,
|
|
915
918
|
{
|
|
@@ -1020,15 +1023,15 @@ function Progress({ className, value, ...props }) {
|
|
|
1020
1023
|
) });
|
|
1021
1024
|
}
|
|
1022
1025
|
var Form = reactHookForm.FormProvider;
|
|
1023
|
-
var FormFieldContext =
|
|
1026
|
+
var FormFieldContext = React19__namespace.createContext({});
|
|
1024
1027
|
var FormField = ({
|
|
1025
1028
|
...props
|
|
1026
1029
|
}) => {
|
|
1027
1030
|
return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
|
|
1028
1031
|
};
|
|
1029
1032
|
var useFormField = () => {
|
|
1030
|
-
const fieldContext =
|
|
1031
|
-
const itemContext =
|
|
1033
|
+
const fieldContext = React19__namespace.useContext(FormFieldContext);
|
|
1034
|
+
const itemContext = React19__namespace.useContext(FormItemContext);
|
|
1032
1035
|
const { getFieldState } = reactHookForm.useFormContext();
|
|
1033
1036
|
const formState = reactHookForm.useFormState({ name: fieldContext.name });
|
|
1034
1037
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1045,9 +1048,9 @@ var useFormField = () => {
|
|
|
1045
1048
|
...fieldState
|
|
1046
1049
|
};
|
|
1047
1050
|
};
|
|
1048
|
-
var FormItemContext =
|
|
1051
|
+
var FormItemContext = React19__namespace.createContext({});
|
|
1049
1052
|
function FormItem({ className, ...props }) {
|
|
1050
|
-
const id =
|
|
1053
|
+
const id = React19__namespace.useId();
|
|
1051
1054
|
return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
1052
1055
|
}
|
|
1053
1056
|
function FormLabel({ className, ...props }) {
|
|
@@ -1097,7 +1100,7 @@ function FormMessage({ className, ...props }) {
|
|
|
1097
1100
|
return /* @__PURE__ */ jsxRuntime.jsx("p", { "data-slot": "form-message", id: formMessageId, className: cn("text-destructive text-sm", className), ...props, children: body });
|
|
1098
1101
|
}
|
|
1099
1102
|
function FormControl2({ children, label, id, layout = "stacked", error, className }) {
|
|
1100
|
-
const generatedId =
|
|
1103
|
+
const generatedId = React19__namespace.useId();
|
|
1101
1104
|
const inputId = id || generatedId;
|
|
1102
1105
|
const errorId = error ? `${inputId}-error` : void 0;
|
|
1103
1106
|
const childProps = {
|
|
@@ -1108,7 +1111,7 @@ function FormControl2({ children, label, id, layout = "stacked", error, classNam
|
|
|
1108
1111
|
if (layout === "floating") {
|
|
1109
1112
|
childProps.placeholder = " ";
|
|
1110
1113
|
}
|
|
1111
|
-
const childWithProps =
|
|
1114
|
+
const childWithProps = React19__namespace.cloneElement(children, childProps);
|
|
1112
1115
|
if (layout === "floating") {
|
|
1113
1116
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-1", className), children: [
|
|
1114
1117
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1173,7 +1176,7 @@ function InputGroup({ className, ...props }) {
|
|
|
1173
1176
|
"div",
|
|
1174
1177
|
{
|
|
1175
1178
|
className: cn(
|
|
1176
|
-
"relative inline-flex w-full min-w-0 items-center rounded-lg border border-input bg-background bg-clip-padding text-base
|
|
1179
|
+
"relative inline-flex w-full min-w-0 items-center rounded-lg border border-input bg-background bg-clip-padding text-base transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_1px_--theme(--color-black/4%)] has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/64 has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/16 has-[textarea]:h-auto has-data-[align=block-end]:h-auto has-data-[align=block-start]:h-auto has-data-[align=block-end]:flex-col has-data-[align=block-start]:flex-col has-[input:focus-visible,textarea:focus-visible]:border-primary/60 has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/36 has-[input:disabled,textarea:disabled]:opacity-64 has-[input:disabled,textarea:disabled,input:focus-visible,textarea:focus-visible,input[aria-invalid],textarea[aria-invalid]]:shadow-none has-[input:focus-visible,textarea:focus-visible]:ring-[3px] has-[input:focus-visible,textarea:focus-visible]:ring-primary/35 sm:text-sm dark:bg-input/32 dark:bg-clip-border dark:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/24 dark:not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_-1px_--theme(--color-white/8%)] has-data-[align=inline-start]:**:[[data-size=sm]_input]:ps-1.5 has-data-[align=inline-end]:**:[[data-size=sm]_input]:pe-1.5 *:[[data-slot=input-control],[data-slot=textarea-control]]:contents *:[[data-slot=input-control],[data-slot=textarea-control]]:before:hidden has-[[data-align=block-start],[data-align=block-end]]:**:[input]:h-auto has-data-[align=inline-start]:**:[input]:ps-2 has-data-[align=inline-end]:**:[input]:pe-2 has-data-[align=block-end]:**:[input]:pt-1.5 has-data-[align=block-start]:**:[input]:pb-1.5 **:[textarea]:min-h-20.5 **:[textarea]:resize-none **:[textarea]:py-[calc(--spacing(3)-1px)] **:[textarea]:max-sm:min-h-23.5 **:[textarea_button]:rounded-[calc(var(--radius-md)-1px)]",
|
|
1177
1180
|
className
|
|
1178
1181
|
),
|
|
1179
1182
|
"data-slot": "input-group",
|
|
@@ -1337,7 +1340,7 @@ function Tooltip({ delayDuration: _delayDuration, ...props }) {
|
|
|
1337
1340
|
return /* @__PURE__ */ jsxRuntime.jsx(tooltip.Tooltip.Root, { "data-slot": "tooltip", ...props });
|
|
1338
1341
|
}
|
|
1339
1342
|
function TooltipTrigger({ delay = 0, asChild, children, ...props }) {
|
|
1340
|
-
if (asChild &&
|
|
1343
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1341
1344
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1342
1345
|
tooltip.Tooltip.Trigger,
|
|
1343
1346
|
{
|
|
@@ -1345,7 +1348,7 @@ function TooltipTrigger({ delay = 0, asChild, children, ...props }) {
|
|
|
1345
1348
|
delay,
|
|
1346
1349
|
...props,
|
|
1347
1350
|
render: (triggerProps) => {
|
|
1348
|
-
return
|
|
1351
|
+
return React19__namespace.cloneElement(
|
|
1349
1352
|
children,
|
|
1350
1353
|
mergePropsWithRef(triggerProps, children)
|
|
1351
1354
|
);
|
|
@@ -1389,7 +1392,7 @@ function Popover({ ...props }) {
|
|
|
1389
1392
|
return /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Root, { "data-slot": "popover", ...props });
|
|
1390
1393
|
}
|
|
1391
1394
|
function PopoverTrigger({ asChild, nativeButton, children, ...props }) {
|
|
1392
|
-
if (asChild &&
|
|
1395
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1393
1396
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1394
1397
|
popover.Popover.Trigger,
|
|
1395
1398
|
{
|
|
@@ -1398,7 +1401,7 @@ function PopoverTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1398
1401
|
...props,
|
|
1399
1402
|
render: (triggerProps) => {
|
|
1400
1403
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
1401
|
-
return
|
|
1404
|
+
return React19__namespace.cloneElement(
|
|
1402
1405
|
children,
|
|
1403
1406
|
mergePropsWithRef(rest, children)
|
|
1404
1407
|
);
|
|
@@ -1454,7 +1457,7 @@ function PopoverContent({
|
|
|
1454
1457
|
function PopoverAnchor({ ...props }) {
|
|
1455
1458
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "popover-anchor", ...props });
|
|
1456
1459
|
}
|
|
1457
|
-
var ScrollArea =
|
|
1460
|
+
var ScrollArea = React19__namespace.forwardRef(
|
|
1458
1461
|
({ className, children, scrollFade = false, scrollbarGutter = false, ...props }, ref) => {
|
|
1459
1462
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1460
1463
|
scrollArea.ScrollArea.Root,
|
|
@@ -1521,7 +1524,7 @@ function DialogPortal({ keepMounted = true, ...props }) {
|
|
|
1521
1524
|
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Portal, { keepMounted, container, ...props, style });
|
|
1522
1525
|
}
|
|
1523
1526
|
function DialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
1524
|
-
if (asChild &&
|
|
1527
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1525
1528
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1526
1529
|
dialog.Dialog.Trigger,
|
|
1527
1530
|
{
|
|
@@ -1530,7 +1533,7 @@ function DialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1530
1533
|
...props,
|
|
1531
1534
|
render: (triggerProps) => {
|
|
1532
1535
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
1533
|
-
return
|
|
1536
|
+
return React19__namespace.cloneElement(
|
|
1534
1537
|
children,
|
|
1535
1538
|
mergePropsWithRef(rest, children)
|
|
1536
1539
|
);
|
|
@@ -1541,7 +1544,7 @@ function DialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1541
1544
|
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Trigger, { "data-slot": "dialog-trigger", nativeButton, ...props, children });
|
|
1542
1545
|
}
|
|
1543
1546
|
function DialogClose({ asChild, nativeButton, children, ...props }) {
|
|
1544
|
-
if (asChild &&
|
|
1547
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1545
1548
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1546
1549
|
dialog.Dialog.Close,
|
|
1547
1550
|
{
|
|
@@ -1550,7 +1553,7 @@ function DialogClose({ asChild, nativeButton, children, ...props }) {
|
|
|
1550
1553
|
...props,
|
|
1551
1554
|
render: (closeProps) => {
|
|
1552
1555
|
const { nativeButton: _, ...rest } = closeProps;
|
|
1553
|
-
return
|
|
1556
|
+
return React19__namespace.cloneElement(
|
|
1554
1557
|
children,
|
|
1555
1558
|
mergePropsWithRef(rest, children)
|
|
1556
1559
|
);
|
|
@@ -1705,7 +1708,7 @@ function AlertDialog({ ...props }) {
|
|
|
1705
1708
|
return /* @__PURE__ */ jsxRuntime.jsx(alertDialog.AlertDialog.Root, { "data-slot": "alert-dialog", ...props });
|
|
1706
1709
|
}
|
|
1707
1710
|
function AlertDialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
1708
|
-
if (asChild &&
|
|
1711
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1709
1712
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1710
1713
|
alertDialog.AlertDialog.Trigger,
|
|
1711
1714
|
{
|
|
@@ -1714,7 +1717,7 @@ function AlertDialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1714
1717
|
...props,
|
|
1715
1718
|
render: (triggerProps) => {
|
|
1716
1719
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
1717
|
-
return
|
|
1720
|
+
return React19__namespace.cloneElement(
|
|
1718
1721
|
children,
|
|
1719
1722
|
mergePropsWithRef(rest, children)
|
|
1720
1723
|
);
|
|
@@ -1845,7 +1848,7 @@ function DropdownMenuPortal({ ...props }) {
|
|
|
1845
1848
|
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Portal, { "data-slot": "dropdown-menu-portal", container, ...props });
|
|
1846
1849
|
}
|
|
1847
1850
|
function DropdownMenuTrigger({ asChild, nativeButton, children, ...props }) {
|
|
1848
|
-
if (asChild &&
|
|
1851
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1849
1852
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1850
1853
|
menu.Menu.Trigger,
|
|
1851
1854
|
{
|
|
@@ -1854,7 +1857,7 @@ function DropdownMenuTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1854
1857
|
...props,
|
|
1855
1858
|
render: (triggerProps) => {
|
|
1856
1859
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
1857
|
-
return
|
|
1860
|
+
return React19__namespace.cloneElement(
|
|
1858
1861
|
children,
|
|
1859
1862
|
mergePropsWithRef(rest, children)
|
|
1860
1863
|
);
|
|
@@ -1905,15 +1908,15 @@ function DropdownMenuItem({
|
|
|
1905
1908
|
...props
|
|
1906
1909
|
}) {
|
|
1907
1910
|
const itemClassName = cn(
|
|
1908
|
-
`data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[variant=destructive]:text-destructive
|
|
1911
|
+
`data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[variant=destructive]:text-destructive
|
|
1909
1912
|
data-[variant=destructive]:data-[highlighted]:bg-destructive/10 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/40
|
|
1910
|
-
data-[variant=destructive]:data-[highlighted]:text-destructive
|
|
1911
|
-
data-[variant=destructive]:*:[svg]:!text-destructive
|
|
1913
|
+
data-[variant=destructive]:data-[highlighted]:text-destructive
|
|
1914
|
+
data-[variant=destructive]:*:[svg]:!text-destructive relative flex cursor-default items-center gap-2
|
|
1912
1915
|
rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none
|
|
1913
1916
|
data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0`,
|
|
1914
1917
|
className
|
|
1915
1918
|
);
|
|
1916
|
-
if (asChild &&
|
|
1919
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1917
1920
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1918
1921
|
menu.Menu.Item,
|
|
1919
1922
|
{
|
|
@@ -1924,7 +1927,7 @@ function DropdownMenuItem({
|
|
|
1924
1927
|
render: (itemProps) => {
|
|
1925
1928
|
const childProps = children.props;
|
|
1926
1929
|
const itemOnClick = itemProps.onClick;
|
|
1927
|
-
return
|
|
1930
|
+
return React19__namespace.cloneElement(children, {
|
|
1928
1931
|
...itemProps,
|
|
1929
1932
|
className: cn(itemClassName, childProps.className),
|
|
1930
1933
|
onClick: (e) => {
|
|
@@ -2097,19 +2100,19 @@ function DropdownMenuSubContent({ className, ...props }) {
|
|
|
2097
2100
|
}
|
|
2098
2101
|
) }) });
|
|
2099
2102
|
}
|
|
2100
|
-
var SheetStackContext =
|
|
2103
|
+
var SheetStackContext = React19__namespace.createContext(void 0);
|
|
2101
2104
|
var SHEET_INDENT = 24;
|
|
2102
2105
|
var useSheetStack = () => {
|
|
2103
|
-
return
|
|
2106
|
+
return React19__namespace.useContext(SheetStackContext);
|
|
2104
2107
|
};
|
|
2105
|
-
var SheetNestingContext =
|
|
2108
|
+
var SheetNestingContext = React19__namespace.createContext({
|
|
2106
2109
|
level: 0,
|
|
2107
2110
|
parentSheetId: null
|
|
2108
2111
|
});
|
|
2109
|
-
var useSheetNesting = () =>
|
|
2110
|
-
var SheetContext =
|
|
2112
|
+
var useSheetNesting = () => React19__namespace.useContext(SheetNestingContext);
|
|
2113
|
+
var SheetContext = React19__namespace.createContext(void 0);
|
|
2111
2114
|
var useSheet = () => {
|
|
2112
|
-
const context =
|
|
2115
|
+
const context = React19__namespace.useContext(SheetContext);
|
|
2113
2116
|
if (!context) {
|
|
2114
2117
|
throw new Error("useSheet must be used within a Sheet");
|
|
2115
2118
|
}
|
|
@@ -2117,23 +2120,23 @@ var useSheet = () => {
|
|
|
2117
2120
|
};
|
|
2118
2121
|
var sheetIdCounter = 0;
|
|
2119
2122
|
function Sheet({ children, sheetId: providedId, ...props }) {
|
|
2120
|
-
const [isOpen, setIsOpen] =
|
|
2123
|
+
const [isOpen, setIsOpen] = React19__namespace.useState(props?.open ?? props?.defaultOpen ?? false);
|
|
2121
2124
|
const sheetStack = useSheetStack();
|
|
2122
2125
|
const nesting = useSheetNesting();
|
|
2123
|
-
const sheetIdRef =
|
|
2126
|
+
const sheetIdRef = React19__namespace.useRef(providedId ?? `sheet-${++sheetIdCounter}`);
|
|
2124
2127
|
const sheetId = sheetIdRef.current;
|
|
2125
2128
|
const depth = nesting.level;
|
|
2126
|
-
const onOpenChangeRef =
|
|
2129
|
+
const onOpenChangeRef = React19__namespace.useRef(props.onOpenChange);
|
|
2127
2130
|
onOpenChangeRef.current = props.onOpenChange;
|
|
2128
|
-
const close =
|
|
2131
|
+
const close = React19__namespace.useCallback(() => {
|
|
2129
2132
|
setIsOpen(false);
|
|
2130
2133
|
onOpenChangeRef.current?.(false);
|
|
2131
2134
|
}, []);
|
|
2132
|
-
const registerSheetRef =
|
|
2133
|
-
const unregisterSheetRef =
|
|
2135
|
+
const registerSheetRef = React19__namespace.useRef(sheetStack?.registerSheet);
|
|
2136
|
+
const unregisterSheetRef = React19__namespace.useRef(sheetStack?.unregisterSheet);
|
|
2134
2137
|
registerSheetRef.current = sheetStack?.registerSheet;
|
|
2135
2138
|
unregisterSheetRef.current = sheetStack?.unregisterSheet;
|
|
2136
|
-
|
|
2139
|
+
React19__namespace.useEffect(() => {
|
|
2137
2140
|
if (registerSheetRef.current && isOpen) {
|
|
2138
2141
|
if (document.activeElement instanceof HTMLElement) {
|
|
2139
2142
|
document.activeElement.blur();
|
|
@@ -2142,10 +2145,10 @@ function Sheet({ children, sheetId: providedId, ...props }) {
|
|
|
2142
2145
|
return () => unregisterSheetRef.current?.(sheetId);
|
|
2143
2146
|
}
|
|
2144
2147
|
}, [isOpen, sheetId, depth, close]);
|
|
2145
|
-
|
|
2148
|
+
React19__namespace.useEffect(() => {
|
|
2146
2149
|
if (props?.open !== void 0) setIsOpen(props.open);
|
|
2147
2150
|
}, [props?.open]);
|
|
2148
|
-
const handleOpenChange =
|
|
2151
|
+
const handleOpenChange = React19__namespace.useCallback((open, _eventDetails) => {
|
|
2149
2152
|
setIsOpen(open);
|
|
2150
2153
|
onOpenChangeRef.current?.(open);
|
|
2151
2154
|
}, []);
|
|
@@ -2165,7 +2168,7 @@ function Sheet({ children, sheetId: providedId, ...props }) {
|
|
|
2165
2168
|
) }) });
|
|
2166
2169
|
}
|
|
2167
2170
|
function SheetTrigger({ asChild, nativeButton, children, ...props }) {
|
|
2168
|
-
if (asChild &&
|
|
2171
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
2169
2172
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2170
2173
|
dialog.Dialog.Trigger,
|
|
2171
2174
|
{
|
|
@@ -2174,7 +2177,7 @@ function SheetTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
2174
2177
|
...props,
|
|
2175
2178
|
render: (triggerProps) => {
|
|
2176
2179
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
2177
|
-
return
|
|
2180
|
+
return React19__namespace.cloneElement(
|
|
2178
2181
|
children,
|
|
2179
2182
|
mergePropsWithRef(rest, children)
|
|
2180
2183
|
);
|
|
@@ -2185,7 +2188,7 @@ function SheetTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
2185
2188
|
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Trigger, { "data-slot": "sheet-trigger", nativeButton, ...props, children });
|
|
2186
2189
|
}
|
|
2187
2190
|
function SheetClose({ asChild, nativeButton, children, ...props }) {
|
|
2188
|
-
if (asChild &&
|
|
2191
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
2189
2192
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2190
2193
|
dialog.Dialog.Close,
|
|
2191
2194
|
{
|
|
@@ -2194,7 +2197,7 @@ function SheetClose({ asChild, nativeButton, children, ...props }) {
|
|
|
2194
2197
|
...props,
|
|
2195
2198
|
render: (closeProps) => {
|
|
2196
2199
|
const { nativeButton: _, ...rest } = closeProps;
|
|
2197
|
-
return
|
|
2200
|
+
return React19__namespace.cloneElement(
|
|
2198
2201
|
children,
|
|
2199
2202
|
mergePropsWithRef(rest, children)
|
|
2200
2203
|
);
|
|
@@ -2311,8 +2314,8 @@ function SheetContent({
|
|
|
2311
2314
|
const topSheetSize = topSheetId ? sheetStack?.getSheetSize(topSheetId) : void 0;
|
|
2312
2315
|
const collapseBaseSize = topSheetSize ? resolvedSide === "left" || resolvedSide === "right" ? topSheetSize.width : topSheetSize.height : void 0;
|
|
2313
2316
|
const pushOffset = getPushOffset(resolvedSide, sheetsAbove, stackMode, collapseBaseSize ?? NESTED_SHEET_WIDTH);
|
|
2314
|
-
const contentRef =
|
|
2315
|
-
|
|
2317
|
+
const contentRef = React19__namespace.useRef(null);
|
|
2318
|
+
React19__namespace.useLayoutEffect(() => {
|
|
2316
2319
|
if (!isOpen) return;
|
|
2317
2320
|
if (!sheetStack) return;
|
|
2318
2321
|
const el = contentRef.current;
|
|
@@ -2343,11 +2346,11 @@ function SheetContent({
|
|
|
2343
2346
|
duration: durations.normal,
|
|
2344
2347
|
ease: easings.physicalExit
|
|
2345
2348
|
};
|
|
2346
|
-
const isTargetInsideSheet =
|
|
2349
|
+
const isTargetInsideSheet = React19__namespace.useCallback((target) => {
|
|
2347
2350
|
if (!target || !(target instanceof HTMLElement)) return false;
|
|
2348
2351
|
return !!target.closest('[data-slot="sheet-content"]');
|
|
2349
2352
|
}, []);
|
|
2350
|
-
const isTargetInsidePopup =
|
|
2353
|
+
const isTargetInsidePopup = React19__namespace.useCallback((target) => {
|
|
2351
2354
|
if (!target || !(target instanceof HTMLElement)) return false;
|
|
2352
2355
|
return !!target.closest(
|
|
2353
2356
|
[
|
|
@@ -2360,7 +2363,7 @@ function SheetContent({
|
|
|
2360
2363
|
].join(", ")
|
|
2361
2364
|
);
|
|
2362
2365
|
}, []);
|
|
2363
|
-
|
|
2366
|
+
React19__namespace.useEffect(() => {
|
|
2364
2367
|
if (!isOpen) return;
|
|
2365
2368
|
const handlePointerDown = (event) => {
|
|
2366
2369
|
if (sheetsAbove > 0) return;
|
|
@@ -2502,7 +2505,7 @@ function DrawerOverlay({ className, ...props }) {
|
|
|
2502
2505
|
);
|
|
2503
2506
|
}
|
|
2504
2507
|
function DrawerContent({ className, children, ...props }) {
|
|
2505
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(DrawerPortal, {
|
|
2508
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DrawerPortal, { children: [
|
|
2506
2509
|
/* @__PURE__ */ jsxRuntime.jsx(DrawerOverlay, {}),
|
|
2507
2510
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2508
2511
|
vaul.Drawer.Content,
|
|
@@ -2622,7 +2625,7 @@ function Collapsible({
|
|
|
2622
2625
|
}
|
|
2623
2626
|
);
|
|
2624
2627
|
}
|
|
2625
|
-
var CollapsibleTrigger =
|
|
2628
|
+
var CollapsibleTrigger = React19__namespace.forwardRef(({ className, asChild, nativeButton, children, ...props }, ref) => {
|
|
2626
2629
|
const triggerClassName = cn(
|
|
2627
2630
|
"group/trigger flex w-full cursor-pointer items-center justify-between text-sm font-medium outline-none transition-colors",
|
|
2628
2631
|
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
|
|
@@ -2631,7 +2634,7 @@ var CollapsibleTrigger = React20__namespace.forwardRef(({ className, asChild, na
|
|
|
2631
2634
|
"[&[data-panel-open]_[data-slot=collapsible-icon]]:rotate-180",
|
|
2632
2635
|
className
|
|
2633
2636
|
);
|
|
2634
|
-
if (asChild &&
|
|
2637
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
2635
2638
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2636
2639
|
collapsible.Collapsible.Trigger,
|
|
2637
2640
|
{
|
|
@@ -2642,7 +2645,7 @@ var CollapsibleTrigger = React20__namespace.forwardRef(({ className, asChild, na
|
|
|
2642
2645
|
render: (triggerProps) => {
|
|
2643
2646
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
2644
2647
|
const childProps = children.props;
|
|
2645
|
-
return
|
|
2648
|
+
return React19__namespace.cloneElement(
|
|
2646
2649
|
children,
|
|
2647
2650
|
{
|
|
2648
2651
|
...rest,
|
|
@@ -2666,7 +2669,7 @@ var CollapsibleTrigger = React20__namespace.forwardRef(({ className, asChild, na
|
|
|
2666
2669
|
);
|
|
2667
2670
|
});
|
|
2668
2671
|
CollapsibleTrigger.displayName = "CollapsibleTrigger";
|
|
2669
|
-
var CollapsiblePanel =
|
|
2672
|
+
var CollapsiblePanel = React19__namespace.forwardRef(
|
|
2670
2673
|
({ className, innerClassName, children, ...props }, ref) => {
|
|
2671
2674
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2672
2675
|
collapsible.Collapsible.Panel,
|
|
@@ -3074,35 +3077,6 @@ function AutocompleteSeparator({
|
|
|
3074
3077
|
}
|
|
3075
3078
|
);
|
|
3076
3079
|
}
|
|
3077
|
-
function AutocompleteGroup({
|
|
3078
|
-
className,
|
|
3079
|
-
...props
|
|
3080
|
-
}) {
|
|
3081
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3082
|
-
autocomplete.Autocomplete.Group,
|
|
3083
|
-
{
|
|
3084
|
-
className: cn("[[role=group]+&]:mt-1.5", className),
|
|
3085
|
-
"data-slot": "autocomplete-group",
|
|
3086
|
-
...props
|
|
3087
|
-
}
|
|
3088
|
-
);
|
|
3089
|
-
}
|
|
3090
|
-
function AutocompleteGroupLabel({
|
|
3091
|
-
className,
|
|
3092
|
-
...props
|
|
3093
|
-
}) {
|
|
3094
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3095
|
-
autocomplete.Autocomplete.GroupLabel,
|
|
3096
|
-
{
|
|
3097
|
-
className: cn(
|
|
3098
|
-
"px-2 py-1.5 font-medium text-muted-foreground text-xs",
|
|
3099
|
-
className
|
|
3100
|
-
),
|
|
3101
|
-
"data-slot": "autocomplete-group-label",
|
|
3102
|
-
...props
|
|
3103
|
-
}
|
|
3104
|
-
);
|
|
3105
|
-
}
|
|
3106
3080
|
function AutocompleteEmpty({
|
|
3107
3081
|
className,
|
|
3108
3082
|
...props
|
|
@@ -3119,22 +3093,6 @@ function AutocompleteEmpty({
|
|
|
3119
3093
|
}
|
|
3120
3094
|
);
|
|
3121
3095
|
}
|
|
3122
|
-
function AutocompleteList({
|
|
3123
|
-
className,
|
|
3124
|
-
...props
|
|
3125
|
-
}) {
|
|
3126
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { scrollbarGutter: true, scrollFade: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3127
|
-
autocomplete.Autocomplete.List,
|
|
3128
|
-
{
|
|
3129
|
-
className: cn(
|
|
3130
|
-
"not-empty:scroll-py-1 not-empty:p-1 in-data-has-overflow-y:pe-3",
|
|
3131
|
-
className
|
|
3132
|
-
),
|
|
3133
|
-
"data-slot": "autocomplete-list",
|
|
3134
|
-
...props
|
|
3135
|
-
}
|
|
3136
|
-
) });
|
|
3137
|
-
}
|
|
3138
3096
|
function AutocompleteClear({
|
|
3139
3097
|
className,
|
|
3140
3098
|
...props
|
|
@@ -3165,49 +3123,71 @@ function AutocompleteTrigger({
|
|
|
3165
3123
|
}
|
|
3166
3124
|
);
|
|
3167
3125
|
}
|
|
3168
|
-
var
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3126
|
+
var BUTTON_CLASS = "text-muted-foreground/80 hover:text-muted-foreground bg-card size-10 rounded-none shadow-none first:rounded-s-lg last:rounded-e-lg focus-visible:z-10";
|
|
3127
|
+
function FlowZoomPanel({
|
|
3128
|
+
className,
|
|
3129
|
+
position = "bottom-right",
|
|
3130
|
+
fitViewIcon = /* @__PURE__ */ jsxRuntime.jsx(react$2.RiFocus3Line, { className: "size-5", "aria-hidden": "true" }),
|
|
3131
|
+
fitViewOptions
|
|
3132
|
+
}) {
|
|
3133
|
+
const { zoomIn, zoomOut, fitView } = react$1.useReactFlow();
|
|
3134
|
+
const onFitView = React19.useCallback(() => {
|
|
3135
|
+
fitView(fitViewOptions);
|
|
3136
|
+
}, [fitView, fitViewOptions]);
|
|
3137
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3138
|
+
react$1.Panel,
|
|
3139
|
+
{
|
|
3140
|
+
"data-slot": "flow-zoom-panel",
|
|
3141
|
+
position,
|
|
3142
|
+
className: cn("inline-flex -space-x-px rounded-md shadow-xs rtl:space-x-reverse", className),
|
|
3143
|
+
children: [
|
|
3144
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "icon", className: BUTTON_CLASS, onClick: () => zoomIn(), "aria-label": "Zoom in", children: /* @__PURE__ */ jsxRuntime.jsx(react$2.RiAddLine, { className: "size-5", "aria-hidden": "true" }) }),
|
|
3145
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "icon", className: BUTTON_CLASS, onClick: () => zoomOut(), "aria-label": "Zoom out", children: /* @__PURE__ */ jsxRuntime.jsx(react$2.RiSubtractLine, { className: "size-5", "aria-hidden": "true" }) }),
|
|
3146
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "icon", className: BUTTON_CLASS, onClick: onFitView, "aria-label": "Fit view", children: fitViewIcon })
|
|
3147
|
+
]
|
|
3148
|
+
}
|
|
3149
|
+
);
|
|
3150
|
+
}
|
|
3172
3151
|
function Command({
|
|
3173
|
-
|
|
3174
|
-
keepHighlight = true,
|
|
3175
|
-
open = true,
|
|
3152
|
+
className,
|
|
3176
3153
|
...props
|
|
3177
3154
|
}) {
|
|
3178
|
-
const AutocompleteAny = Autocomplete;
|
|
3179
3155
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3180
|
-
|
|
3156
|
+
cmdk.Command,
|
|
3181
3157
|
{
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3158
|
+
className: cn(
|
|
3159
|
+
"flex h-full w-full flex-col overflow-hidden rounded-2xl",
|
|
3160
|
+
className
|
|
3161
|
+
),
|
|
3162
|
+
"data-slot": "command",
|
|
3185
3163
|
...props
|
|
3186
3164
|
}
|
|
3187
3165
|
);
|
|
3188
3166
|
}
|
|
3189
3167
|
function CommandInput({
|
|
3190
3168
|
className,
|
|
3191
|
-
placeholder
|
|
3192
|
-
value,
|
|
3193
|
-
onValueChange,
|
|
3169
|
+
placeholder,
|
|
3194
3170
|
...props
|
|
3195
3171
|
}) {
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
AutocompleteInput,
|
|
3172
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2.5 py-1.5", "data-slot": "command-input-wrapper", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3173
|
+
"div",
|
|
3199
3174
|
{
|
|
3200
3175
|
className: cn(
|
|
3201
|
-
"
|
|
3176
|
+
"flex items-center gap-2 rounded-lg px-3 text-base",
|
|
3202
3177
|
className
|
|
3203
3178
|
),
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3179
|
+
children: [
|
|
3180
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "size-4 shrink-0 text-muted-foreground" }),
|
|
3181
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3182
|
+
cmdk.Command.Input,
|
|
3183
|
+
{
|
|
3184
|
+
className: "flex h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
3185
|
+
placeholder,
|
|
3186
|
+
"data-slot": "command-input",
|
|
3187
|
+
...props
|
|
3188
|
+
}
|
|
3189
|
+
)
|
|
3190
|
+
]
|
|
3211
3191
|
}
|
|
3212
3192
|
) });
|
|
3213
3193
|
}
|
|
@@ -3216,9 +3196,9 @@ function CommandList({
|
|
|
3216
3196
|
...props
|
|
3217
3197
|
}) {
|
|
3218
3198
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3219
|
-
|
|
3199
|
+
cmdk.Command.List,
|
|
3220
3200
|
{
|
|
3221
|
-
className: cn("not-empty:scroll-py-2 not-empty:p-2", className),
|
|
3201
|
+
className: cn("not-empty:scroll-py-2 not-empty:p-2 max-h-[300px] overflow-y-auto overflow-x-hidden", className),
|
|
3222
3202
|
"data-slot": "command-list",
|
|
3223
3203
|
...props
|
|
3224
3204
|
}
|
|
@@ -3229,7 +3209,7 @@ function CommandEmpty({
|
|
|
3229
3209
|
...props
|
|
3230
3210
|
}) {
|
|
3231
3211
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3232
|
-
|
|
3212
|
+
cmdk.Command.Empty,
|
|
3233
3213
|
{
|
|
3234
3214
|
className: cn("not-empty:py-6", className),
|
|
3235
3215
|
"data-slot": "command-empty",
|
|
@@ -3243,29 +3223,17 @@ function CommandGroup({
|
|
|
3243
3223
|
children,
|
|
3244
3224
|
...props
|
|
3245
3225
|
}) {
|
|
3246
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
3247
|
-
|
|
3226
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3227
|
+
cmdk.Command.Group,
|
|
3248
3228
|
{
|
|
3249
|
-
className
|
|
3229
|
+
className: cn(
|
|
3230
|
+
"overflow-hidden text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
3231
|
+
className
|
|
3232
|
+
),
|
|
3233
|
+
heading,
|
|
3250
3234
|
"data-slot": "command-group",
|
|
3251
3235
|
...props,
|
|
3252
|
-
children
|
|
3253
|
-
heading && /* @__PURE__ */ jsxRuntime.jsx(CommandGroupLabel, { children: heading }),
|
|
3254
|
-
children
|
|
3255
|
-
]
|
|
3256
|
-
}
|
|
3257
|
-
);
|
|
3258
|
-
}
|
|
3259
|
-
function CommandGroupLabel({
|
|
3260
|
-
className,
|
|
3261
|
-
...props
|
|
3262
|
-
}) {
|
|
3263
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3264
|
-
AutocompleteGroupLabel,
|
|
3265
|
-
{
|
|
3266
|
-
className,
|
|
3267
|
-
"data-slot": "command-group-label",
|
|
3268
|
-
...props
|
|
3236
|
+
children
|
|
3269
3237
|
}
|
|
3270
3238
|
);
|
|
3271
3239
|
}
|
|
@@ -3274,20 +3242,23 @@ function CommandItem({
|
|
|
3274
3242
|
...props
|
|
3275
3243
|
}) {
|
|
3276
3244
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3277
|
-
|
|
3245
|
+
cmdk.Command.Item,
|
|
3278
3246
|
{
|
|
3279
|
-
className: cn(
|
|
3247
|
+
className: cn(
|
|
3248
|
+
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",
|
|
3249
|
+
className
|
|
3250
|
+
),
|
|
3280
3251
|
"data-slot": "command-item",
|
|
3281
3252
|
...props
|
|
3282
3253
|
}
|
|
3283
3254
|
);
|
|
3284
3255
|
}
|
|
3285
|
-
var ComboboxContext =
|
|
3256
|
+
var ComboboxContext = React19__namespace.createContext({
|
|
3286
3257
|
chipsRef: null,
|
|
3287
3258
|
multiple: false
|
|
3288
3259
|
});
|
|
3289
3260
|
function Combobox(props) {
|
|
3290
|
-
const chipsRef =
|
|
3261
|
+
const chipsRef = React19__namespace.useRef(null);
|
|
3291
3262
|
return /* @__PURE__ */ jsxRuntime.jsx(ComboboxContext.Provider, { value: { chipsRef, multiple: !!props.multiple }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3292
3263
|
combobox.Combobox.Root,
|
|
3293
3264
|
{
|
|
@@ -3303,7 +3274,7 @@ function ComboboxInput({
|
|
|
3303
3274
|
size,
|
|
3304
3275
|
...props
|
|
3305
3276
|
}) {
|
|
3306
|
-
const { multiple } =
|
|
3277
|
+
const { multiple } = React19__namespace.useContext(ComboboxContext);
|
|
3307
3278
|
const sizeValue = size ?? "default";
|
|
3308
3279
|
if (multiple) {
|
|
3309
3280
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3326,7 +3297,7 @@ function ComboboxInput({
|
|
|
3326
3297
|
"div",
|
|
3327
3298
|
{
|
|
3328
3299
|
"aria-hidden": "true",
|
|
3329
|
-
className: "[&_svg]:-mx-0.5 pointer-events-none absolute inset-y-0 start-px z-10 flex items-center ps-[calc(--spacing(3)-1px)]
|
|
3300
|
+
className: "[&_svg]:-mx-0.5 pointer-events-none absolute inset-y-0 start-px z-10 flex items-center ps-[calc(--spacing(3)-1px)] has-[+[data-size=sm]]:ps-[calc(--spacing(2.5)-1px)] [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:opacity-80",
|
|
3330
3301
|
"data-slot": "combobox-start-addon",
|
|
3331
3302
|
children: startAddon
|
|
3332
3303
|
}
|
|
@@ -3385,7 +3356,7 @@ function ComboboxPopup({
|
|
|
3385
3356
|
sideOffset = 4,
|
|
3386
3357
|
...props
|
|
3387
3358
|
}) {
|
|
3388
|
-
const { chipsRef, multiple } =
|
|
3359
|
+
const { chipsRef, multiple } = React19__namespace.useContext(ComboboxContext);
|
|
3389
3360
|
const { container, zIndexClass } = useFloatingOverlayPortalProps();
|
|
3390
3361
|
return /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3391
3362
|
combobox.Combobox.Positioner,
|
|
@@ -3463,7 +3434,10 @@ function ComboboxSeparator({
|
|
|
3463
3434
|
}
|
|
3464
3435
|
);
|
|
3465
3436
|
}
|
|
3466
|
-
function ComboboxGroup({
|
|
3437
|
+
function ComboboxGroup({
|
|
3438
|
+
className,
|
|
3439
|
+
...props
|
|
3440
|
+
}) {
|
|
3467
3441
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3468
3442
|
combobox.Combobox.Group,
|
|
3469
3443
|
{
|
|
@@ -3473,7 +3447,10 @@ function ComboboxGroup({ className, ...props }) {
|
|
|
3473
3447
|
}
|
|
3474
3448
|
);
|
|
3475
3449
|
}
|
|
3476
|
-
function ComboboxEmpty({
|
|
3450
|
+
function ComboboxEmpty({
|
|
3451
|
+
className,
|
|
3452
|
+
...props
|
|
3453
|
+
}) {
|
|
3477
3454
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3478
3455
|
combobox.Combobox.Empty,
|
|
3479
3456
|
{
|
|
@@ -3486,7 +3463,10 @@ function ComboboxEmpty({ className, ...props }) {
|
|
|
3486
3463
|
}
|
|
3487
3464
|
);
|
|
3488
3465
|
}
|
|
3489
|
-
function ComboboxList({
|
|
3466
|
+
function ComboboxList({
|
|
3467
|
+
className,
|
|
3468
|
+
...props
|
|
3469
|
+
}) {
|
|
3490
3470
|
return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { scrollbarGutter: true, scrollFade: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3491
3471
|
combobox.Combobox.List,
|
|
3492
3472
|
{
|
|
@@ -3499,7 +3479,10 @@ function ComboboxList({ className, ...props }) {
|
|
|
3499
3479
|
}
|
|
3500
3480
|
) });
|
|
3501
3481
|
}
|
|
3502
|
-
function ComboboxClear({
|
|
3482
|
+
function ComboboxClear({
|
|
3483
|
+
className,
|
|
3484
|
+
...props
|
|
3485
|
+
}) {
|
|
3503
3486
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3504
3487
|
combobox.Combobox.Clear,
|
|
3505
3488
|
{
|
|
@@ -3575,7 +3558,7 @@ function OptionItem({
|
|
|
3575
3558
|
}
|
|
3576
3559
|
);
|
|
3577
3560
|
}
|
|
3578
|
-
var MultiSelect =
|
|
3561
|
+
var MultiSelect = React19__namespace.forwardRef(
|
|
3579
3562
|
({
|
|
3580
3563
|
options,
|
|
3581
3564
|
onValueChange,
|
|
@@ -3601,38 +3584,38 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3601
3584
|
onClick,
|
|
3602
3585
|
...props
|
|
3603
3586
|
}, ref) => {
|
|
3604
|
-
const [selectedValues, setSelectedValues] =
|
|
3605
|
-
const [isPopoverOpen, setIsPopoverOpen] =
|
|
3606
|
-
const [searchValue, setSearchValue] =
|
|
3607
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
3608
|
-
const multiSelectId =
|
|
3587
|
+
const [selectedValues, setSelectedValues] = React19__namespace.useState(defaultValue);
|
|
3588
|
+
const [isPopoverOpen, setIsPopoverOpen] = React19__namespace.useState(false);
|
|
3589
|
+
const [searchValue, setSearchValue] = React19__namespace.useState("");
|
|
3590
|
+
const [highlightedIndex, setHighlightedIndex] = React19__namespace.useState(-1);
|
|
3591
|
+
const multiSelectId = React19__namespace.useId();
|
|
3609
3592
|
const listboxId = `${multiSelectId}-listbox`;
|
|
3610
3593
|
const triggerDescriptionId = `${multiSelectId}-description`;
|
|
3611
3594
|
const selectedCountId = `${multiSelectId}-count`;
|
|
3612
3595
|
const searchInputId = `${multiSelectId}-search`;
|
|
3613
|
-
const searchInputRef =
|
|
3614
|
-
const listRef =
|
|
3615
|
-
const prevDefaultValueRef =
|
|
3616
|
-
const isGroupedOptions =
|
|
3596
|
+
const searchInputRef = React19__namespace.useRef(null);
|
|
3597
|
+
const listRef = React19__namespace.useRef(null);
|
|
3598
|
+
const prevDefaultValueRef = React19__namespace.useRef(defaultValue);
|
|
3599
|
+
const isGroupedOptions = React19__namespace.useCallback(
|
|
3617
3600
|
(opts) => {
|
|
3618
3601
|
return opts.length > 0 && "heading" in opts[0];
|
|
3619
3602
|
},
|
|
3620
3603
|
[]
|
|
3621
3604
|
);
|
|
3622
|
-
const arraysEqual =
|
|
3605
|
+
const arraysEqual = React19__namespace.useCallback((a, b) => {
|
|
3623
3606
|
if (a.length !== b.length) return false;
|
|
3624
3607
|
const sortedA = [...a].sort();
|
|
3625
3608
|
const sortedB = [...b].sort();
|
|
3626
3609
|
return sortedA.every((val, index) => val === sortedB[index]);
|
|
3627
3610
|
}, []);
|
|
3628
|
-
const resetToDefault =
|
|
3611
|
+
const resetToDefault = React19__namespace.useCallback(() => {
|
|
3629
3612
|
setSelectedValues(defaultValue);
|
|
3630
3613
|
setIsPopoverOpen(false);
|
|
3631
3614
|
setSearchValue("");
|
|
3632
3615
|
onValueChange(defaultValue);
|
|
3633
3616
|
}, [defaultValue, onValueChange]);
|
|
3634
|
-
const buttonRef =
|
|
3635
|
-
|
|
3617
|
+
const buttonRef = React19__namespace.useRef(null);
|
|
3618
|
+
React19__namespace.useImperativeHandle(
|
|
3636
3619
|
ref,
|
|
3637
3620
|
() => ({
|
|
3638
3621
|
reset: resetToDefault,
|
|
@@ -3663,8 +3646,8 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3663
3646
|
}),
|
|
3664
3647
|
[resetToDefault, selectedValues, onValueChange]
|
|
3665
3648
|
);
|
|
3666
|
-
const [screenSize, setScreenSize] =
|
|
3667
|
-
|
|
3649
|
+
const [screenSize, setScreenSize] = React19__namespace.useState("desktop");
|
|
3650
|
+
React19__namespace.useEffect(() => {
|
|
3668
3651
|
if (typeof window === "undefined") return;
|
|
3669
3652
|
const handleResize = () => {
|
|
3670
3653
|
const width = window.innerWidth;
|
|
@@ -3713,7 +3696,7 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3713
3696
|
};
|
|
3714
3697
|
};
|
|
3715
3698
|
const responsiveSettings = getResponsiveSettings();
|
|
3716
|
-
const getAllOptions =
|
|
3699
|
+
const getAllOptions = React19__namespace.useCallback(() => {
|
|
3717
3700
|
if (options.length === 0) return [];
|
|
3718
3701
|
let allOptions;
|
|
3719
3702
|
if (isGroupedOptions(options)) {
|
|
@@ -3743,7 +3726,7 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3743
3726
|
}
|
|
3744
3727
|
return deduplicateOptions ? uniqueOptions : allOptions;
|
|
3745
3728
|
}, [options, deduplicateOptions, isGroupedOptions]);
|
|
3746
|
-
const getOptionByValue =
|
|
3729
|
+
const getOptionByValue = React19__namespace.useCallback(
|
|
3747
3730
|
(value) => {
|
|
3748
3731
|
const option = getAllOptions().find((option2) => option2.value === value);
|
|
3749
3732
|
if (!option && process.env.NODE_ENV === "development") {
|
|
@@ -3753,7 +3736,7 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3753
3736
|
},
|
|
3754
3737
|
[getAllOptions]
|
|
3755
3738
|
);
|
|
3756
|
-
const filteredOptions =
|
|
3739
|
+
const filteredOptions = React19__namespace.useMemo(() => {
|
|
3757
3740
|
if (!searchable || !searchValue) return options;
|
|
3758
3741
|
if (options.length === 0) return [];
|
|
3759
3742
|
if (isGroupedOptions(options)) {
|
|
@@ -3768,13 +3751,13 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3768
3751
|
(option) => option.label.toLowerCase().includes(searchValue.toLowerCase()) || option.value.toLowerCase().includes(searchValue.toLowerCase())
|
|
3769
3752
|
);
|
|
3770
3753
|
}, [options, searchValue, searchable, isGroupedOptions]);
|
|
3771
|
-
const flatFilteredOptions =
|
|
3754
|
+
const flatFilteredOptions = React19__namespace.useMemo(() => {
|
|
3772
3755
|
if (isGroupedOptions(filteredOptions)) {
|
|
3773
3756
|
return filteredOptions.flatMap((group) => group.options);
|
|
3774
3757
|
}
|
|
3775
3758
|
return filteredOptions;
|
|
3776
3759
|
}, [filteredOptions, isGroupedOptions]);
|
|
3777
|
-
const toggleOption =
|
|
3760
|
+
const toggleOption = React19__namespace.useCallback(
|
|
3778
3761
|
(optionValue) => {
|
|
3779
3762
|
if (disabled) return;
|
|
3780
3763
|
const option = getOptionByValue(optionValue);
|
|
@@ -3803,7 +3786,7 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3803
3786
|
setSelectedValues(newSelectedValues);
|
|
3804
3787
|
onValueChange(newSelectedValues);
|
|
3805
3788
|
};
|
|
3806
|
-
const handleKeyDown =
|
|
3789
|
+
const handleKeyDown = React19__namespace.useCallback(
|
|
3807
3790
|
(event) => {
|
|
3808
3791
|
const optionsCount = flatFilteredOptions.length;
|
|
3809
3792
|
if (optionsCount === 0) return;
|
|
@@ -3841,7 +3824,7 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3841
3824
|
},
|
|
3842
3825
|
[flatFilteredOptions, highlightedIndex, toggleOption, searchValue, selectedValues, onValueChange]
|
|
3843
3826
|
);
|
|
3844
|
-
|
|
3827
|
+
React19__namespace.useEffect(() => {
|
|
3845
3828
|
if (!resetOnDefaultValueChange) return;
|
|
3846
3829
|
const prevDefaultValue = prevDefaultValueRef.current;
|
|
3847
3830
|
if (!arraysEqual(prevDefaultValue, defaultValue)) {
|
|
@@ -3862,17 +3845,17 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3862
3845
|
};
|
|
3863
3846
|
};
|
|
3864
3847
|
const widthConstraints = getWidthConstraints();
|
|
3865
|
-
const effectiveDropdownMaxHeight =
|
|
3848
|
+
const effectiveDropdownMaxHeight = React19__namespace.useMemo(() => {
|
|
3866
3849
|
if (dropdownMaxHeight) return dropdownMaxHeight;
|
|
3867
3850
|
return screenSize === "mobile" ? "70vh" : "60vh";
|
|
3868
3851
|
}, [dropdownMaxHeight, screenSize]);
|
|
3869
|
-
|
|
3852
|
+
React19__namespace.useEffect(() => {
|
|
3870
3853
|
if (!isPopoverOpen) {
|
|
3871
3854
|
setSearchValue("");
|
|
3872
3855
|
setHighlightedIndex(-1);
|
|
3873
3856
|
}
|
|
3874
3857
|
}, [isPopoverOpen]);
|
|
3875
|
-
|
|
3858
|
+
React19__namespace.useEffect(() => {
|
|
3876
3859
|
if (isPopoverOpen && searchable && searchInputRef.current) {
|
|
3877
3860
|
const timer = setTimeout(() => {
|
|
3878
3861
|
searchInputRef.current?.focus();
|
|
@@ -3880,10 +3863,10 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3880
3863
|
return () => clearTimeout(timer);
|
|
3881
3864
|
}
|
|
3882
3865
|
}, [isPopoverOpen, searchable]);
|
|
3883
|
-
|
|
3866
|
+
React19__namespace.useEffect(() => {
|
|
3884
3867
|
setHighlightedIndex(flatFilteredOptions.length > 0 ? 0 : -1);
|
|
3885
3868
|
}, [searchValue, flatFilteredOptions.length]);
|
|
3886
|
-
const totalFilteredCount =
|
|
3869
|
+
const totalFilteredCount = React19__namespace.useMemo(() => {
|
|
3887
3870
|
if (isGroupedOptions(filteredOptions)) {
|
|
3888
3871
|
return filteredOptions.reduce((acc, group) => acc + group.options.length, 0);
|
|
3889
3872
|
}
|
|
@@ -4166,7 +4149,7 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
4166
4149
|
}
|
|
4167
4150
|
);
|
|
4168
4151
|
MultiSelect.displayName = "MultiSelect";
|
|
4169
|
-
var TagsContext =
|
|
4152
|
+
var TagsContext = React19.createContext({
|
|
4170
4153
|
value: void 0,
|
|
4171
4154
|
setValue: void 0,
|
|
4172
4155
|
open: false,
|
|
@@ -4176,7 +4159,7 @@ var TagsContext = React20.createContext({
|
|
|
4176
4159
|
setWidth: void 0
|
|
4177
4160
|
});
|
|
4178
4161
|
var useTagsContext = () => {
|
|
4179
|
-
const context =
|
|
4162
|
+
const context = React19.useContext(TagsContext);
|
|
4180
4163
|
if (!context) {
|
|
4181
4164
|
throw new Error("useTagsContext must be used within a TagsProvider");
|
|
4182
4165
|
}
|
|
@@ -4190,12 +4173,12 @@ var Tags = ({
|
|
|
4190
4173
|
children,
|
|
4191
4174
|
className
|
|
4192
4175
|
}) => {
|
|
4193
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
4194
|
-
const [width, setWidth] =
|
|
4195
|
-
const ref =
|
|
4176
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React19.useState(false);
|
|
4177
|
+
const [width, setWidth] = React19.useState();
|
|
4178
|
+
const ref = React19.useRef(null);
|
|
4196
4179
|
const open = controlledOpen ?? uncontrolledOpen;
|
|
4197
4180
|
const onOpenChange = controlledOnOpenChange ?? setUncontrolledOpen;
|
|
4198
|
-
|
|
4181
|
+
React19.useEffect(() => {
|
|
4199
4182
|
if (!ref.current) {
|
|
4200
4183
|
return;
|
|
4201
4184
|
}
|
|
@@ -4245,8 +4228,8 @@ var TagsEmpty = ({ children, className: _className, ...props }) => /* @__PURE__
|
|
|
4245
4228
|
var TagsGroup = CommandGroup;
|
|
4246
4229
|
var TagsItem = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(CommandItem, { className: cn("cursor-pointer items-center justify-between", className), ...props });
|
|
4247
4230
|
function useDebounce(value, delay) {
|
|
4248
|
-
const [debouncedValue, setDebouncedValue] =
|
|
4249
|
-
|
|
4231
|
+
const [debouncedValue, setDebouncedValue] = React19.useState(value);
|
|
4232
|
+
React19.useEffect(() => {
|
|
4250
4233
|
const handler = setTimeout(() => {
|
|
4251
4234
|
setDebouncedValue(value);
|
|
4252
4235
|
}, delay);
|
|
@@ -4267,9 +4250,9 @@ function RecordPicker({
|
|
|
4267
4250
|
placeholder = "Search records...",
|
|
4268
4251
|
maxHeight = "300px"
|
|
4269
4252
|
}) {
|
|
4270
|
-
const [searchQuery, setSearchQuery] =
|
|
4253
|
+
const [searchQuery, setSearchQuery] = React19.useState("");
|
|
4271
4254
|
const debouncedSearchQuery = useDebounce(searchQuery, 300);
|
|
4272
|
-
const filteredRecords =
|
|
4255
|
+
const filteredRecords = React19.useMemo(() => {
|
|
4273
4256
|
if (!debouncedSearchQuery.trim()) {
|
|
4274
4257
|
return records;
|
|
4275
4258
|
}
|
|
@@ -4278,7 +4261,7 @@ function RecordPicker({
|
|
|
4278
4261
|
threshold: matchSorter.matchSorter.rankings.CONTAINS
|
|
4279
4262
|
});
|
|
4280
4263
|
}, [records, debouncedSearchQuery, searchFields]);
|
|
4281
|
-
const { linkedRecords, unlinkableRecords } =
|
|
4264
|
+
const { linkedRecords, unlinkableRecords } = React19.useMemo(() => {
|
|
4282
4265
|
const linked = [];
|
|
4283
4266
|
const unlinkable = [];
|
|
4284
4267
|
filteredRecords.forEach((record) => {
|
|
@@ -4291,7 +4274,7 @@ function RecordPicker({
|
|
|
4291
4274
|
});
|
|
4292
4275
|
return { linkedRecords: linked, unlinkableRecords: unlinkable };
|
|
4293
4276
|
}, [filteredRecords, linkedRecordIds, getRecordId]);
|
|
4294
|
-
const handleLinkRecord =
|
|
4277
|
+
const handleLinkRecord = React19.useCallback(
|
|
4295
4278
|
(record) => {
|
|
4296
4279
|
onLink(record);
|
|
4297
4280
|
},
|
|
@@ -4299,7 +4282,7 @@ function RecordPicker({
|
|
|
4299
4282
|
);
|
|
4300
4283
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
4301
4284
|
/* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
4302
|
-
/* @__PURE__ */ jsxRuntime.jsx(InputGroupAddon, { children: /* @__PURE__ */ jsxRuntime.jsx(react$
|
|
4285
|
+
/* @__PURE__ */ jsxRuntime.jsx(InputGroupAddon, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.RiSearchLine, {}) }),
|
|
4303
4286
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4304
4287
|
InputGroupInput,
|
|
4305
4288
|
{
|
|
@@ -4343,7 +4326,7 @@ function RecordPicker({
|
|
|
4343
4326
|
children: label
|
|
4344
4327
|
}
|
|
4345
4328
|
),
|
|
4346
|
-
isLinking && /* @__PURE__ */ jsxRuntime.jsx(react$
|
|
4329
|
+
isLinking && /* @__PURE__ */ jsxRuntime.jsx(react$2.RiLoader4Line, { className: "text-muted-foreground h-4 w-4 flex-shrink-0 animate-spin" })
|
|
4347
4330
|
]
|
|
4348
4331
|
},
|
|
4349
4332
|
recordId
|
|
@@ -4360,33 +4343,33 @@ function RecordPicker({
|
|
|
4360
4343
|
const recordId = getRecordId(record);
|
|
4361
4344
|
const label = getRecordLabel(record);
|
|
4362
4345
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted/30 flex items-center space-x-3 rounded-md p-2", children: [
|
|
4363
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-4 w-4 flex-shrink-0 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(react$
|
|
4346
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-4 w-4 flex-shrink-0 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(react$2.RiCheckLine, { className: "h-3 w-3 text-green-600" }) }),
|
|
4364
4347
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground flex-1 truncate text-sm", title: label, children: label })
|
|
4365
4348
|
] }, recordId);
|
|
4366
4349
|
})
|
|
4367
4350
|
] }),
|
|
4368
4351
|
filteredRecords.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-muted-foreground py-8 text-center", children: [
|
|
4369
|
-
/* @__PURE__ */ jsxRuntime.jsx(react$
|
|
4352
|
+
/* @__PURE__ */ jsxRuntime.jsx(react$2.RiSearchLine, { className: "mx-auto mb-2 h-8 w-8 opacity-50" }),
|
|
4370
4353
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", children: searchQuery ? "No records match your search" : "No records available" })
|
|
4371
4354
|
] }),
|
|
4372
4355
|
filteredRecords.length > 0 && unlinkableRecords.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-muted-foreground py-4 text-center", children: [
|
|
4373
|
-
/* @__PURE__ */ jsxRuntime.jsx(react$
|
|
4356
|
+
/* @__PURE__ */ jsxRuntime.jsx(react$2.RiCheckLine, { className: "mx-auto mb-2 h-6 w-6 opacity-50" }),
|
|
4374
4357
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", children: "All matching records are already linked" })
|
|
4375
4358
|
] })
|
|
4376
4359
|
] }) })
|
|
4377
4360
|
] });
|
|
4378
4361
|
}
|
|
4379
|
-
var StepperContext =
|
|
4380
|
-
var StepItemContext =
|
|
4362
|
+
var StepperContext = React19.createContext(void 0);
|
|
4363
|
+
var StepItemContext = React19.createContext(void 0);
|
|
4381
4364
|
var useStepper = () => {
|
|
4382
|
-
const context =
|
|
4365
|
+
const context = React19.useContext(StepperContext);
|
|
4383
4366
|
if (!context) {
|
|
4384
4367
|
throw new Error("useStepper must be used within a Stepper");
|
|
4385
4368
|
}
|
|
4386
4369
|
return context;
|
|
4387
4370
|
};
|
|
4388
4371
|
var useStepItem = () => {
|
|
4389
|
-
const context =
|
|
4372
|
+
const context = React19.useContext(StepItemContext);
|
|
4390
4373
|
if (!context) {
|
|
4391
4374
|
throw new Error("useStepItem must be used within a StepperItem");
|
|
4392
4375
|
}
|
|
@@ -4400,8 +4383,8 @@ function Stepper({
|
|
|
4400
4383
|
className,
|
|
4401
4384
|
...props
|
|
4402
4385
|
}) {
|
|
4403
|
-
const [activeStep, setInternalStep] =
|
|
4404
|
-
const setActiveStep =
|
|
4386
|
+
const [activeStep, setInternalStep] = React19__namespace.useState(defaultValue);
|
|
4387
|
+
const setActiveStep = React19__namespace.useCallback(
|
|
4405
4388
|
(step) => {
|
|
4406
4389
|
if (value === void 0) {
|
|
4407
4390
|
setInternalStep(step);
|
|
@@ -4570,8 +4553,8 @@ function StepperSeparator({ className, ...props }) {
|
|
|
4570
4553
|
}
|
|
4571
4554
|
var MOBILE_BREAKPOINT = 768;
|
|
4572
4555
|
function useIsMobile() {
|
|
4573
|
-
const [isMobile, setIsMobile] =
|
|
4574
|
-
|
|
4556
|
+
const [isMobile, setIsMobile] = React19__namespace.useState(false);
|
|
4557
|
+
React19__namespace.useEffect(() => {
|
|
4575
4558
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
4576
4559
|
const onChange = () => {
|
|
4577
4560
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -4588,9 +4571,9 @@ var SIDEBAR_WIDTH = "14rem";
|
|
|
4588
4571
|
var SIDEBAR_WIDTH_MOBILE = "16rem";
|
|
4589
4572
|
var SIDEBAR_WIDTH_ICON = "4rem";
|
|
4590
4573
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
4591
|
-
var SidebarContext =
|
|
4574
|
+
var SidebarContext = React19__namespace.createContext(null);
|
|
4592
4575
|
function useSidebar() {
|
|
4593
|
-
const context =
|
|
4576
|
+
const context = React19__namespace.useContext(SidebarContext);
|
|
4594
4577
|
if (!context) {
|
|
4595
4578
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
4596
4579
|
}
|
|
@@ -4606,11 +4589,11 @@ function SidebarProvider({
|
|
|
4606
4589
|
...props
|
|
4607
4590
|
}) {
|
|
4608
4591
|
const isMobile = useIsMobile();
|
|
4609
|
-
const [openMobile, setOpenMobile] =
|
|
4610
|
-
const [isHovered, setIsHovered] =
|
|
4611
|
-
const [_open, _setOpen] =
|
|
4592
|
+
const [openMobile, setOpenMobile] = React19__namespace.useState(false);
|
|
4593
|
+
const [isHovered, setIsHovered] = React19__namespace.useState(false);
|
|
4594
|
+
const [_open, _setOpen] = React19__namespace.useState(defaultOpen);
|
|
4612
4595
|
const open = openProp ?? _open;
|
|
4613
|
-
const setOpen =
|
|
4596
|
+
const setOpen = React19__namespace.useCallback(
|
|
4614
4597
|
(value) => {
|
|
4615
4598
|
const openState = typeof value === "function" ? value(open) : value;
|
|
4616
4599
|
if (setOpenProp) {
|
|
@@ -4622,10 +4605,10 @@ function SidebarProvider({
|
|
|
4622
4605
|
},
|
|
4623
4606
|
[setOpenProp, open]
|
|
4624
4607
|
);
|
|
4625
|
-
const toggleSidebar =
|
|
4608
|
+
const toggleSidebar = React19__namespace.useCallback(() => {
|
|
4626
4609
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
4627
4610
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
4628
|
-
|
|
4611
|
+
React19__namespace.useEffect(() => {
|
|
4629
4612
|
const handleKeyDown = (event) => {
|
|
4630
4613
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
4631
4614
|
event.preventDefault();
|
|
@@ -4637,7 +4620,7 @@ function SidebarProvider({
|
|
|
4637
4620
|
}, [toggleSidebar]);
|
|
4638
4621
|
const effectiveOpen = isMobile ? open : isHovered || open;
|
|
4639
4622
|
const state = effectiveOpen ? "expanded" : "collapsed";
|
|
4640
|
-
const contextValue =
|
|
4623
|
+
const contextValue = React19__namespace.useMemo(
|
|
4641
4624
|
() => ({
|
|
4642
4625
|
state,
|
|
4643
4626
|
open,
|
|
@@ -5058,7 +5041,7 @@ function SidebarMenuSkeleton({
|
|
|
5058
5041
|
showIcon = false,
|
|
5059
5042
|
...props
|
|
5060
5043
|
}) {
|
|
5061
|
-
const width =
|
|
5044
|
+
const width = React19__namespace.useMemo(() => {
|
|
5062
5045
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
5063
5046
|
}, []);
|
|
5064
5047
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -5208,7 +5191,7 @@ function RangeCalendar({ className, ...props }) {
|
|
|
5208
5191
|
/* @__PURE__ */ jsxRuntime.jsx(CalendarGridComponent, { isRange: true })
|
|
5209
5192
|
] });
|
|
5210
5193
|
}
|
|
5211
|
-
var AceEditor =
|
|
5194
|
+
var AceEditor = React19__namespace.lazy(async () => {
|
|
5212
5195
|
const ace = await import('react-ace');
|
|
5213
5196
|
await import('ace-builds/src-noconflict/mode-json');
|
|
5214
5197
|
await import('ace-builds/src-noconflict/theme-textmate');
|
|
@@ -5238,12 +5221,12 @@ var displayJsonState = (jsonState) => {
|
|
|
5238
5221
|
return jsonStateMap[jsonState.state];
|
|
5239
5222
|
};
|
|
5240
5223
|
var JsonInput = ({ value = "", setValue, minLines = 16, className, theme = "light" }) => {
|
|
5241
|
-
const [jsonState, setJsonState] =
|
|
5224
|
+
const [jsonState, setJsonState] = React19.useState({ state: "empty" });
|
|
5242
5225
|
const handleChange = (val) => {
|
|
5243
5226
|
setJsonState({ state: "loading" });
|
|
5244
5227
|
setValue(val);
|
|
5245
5228
|
};
|
|
5246
|
-
|
|
5229
|
+
React19.useEffect(() => {
|
|
5247
5230
|
const timeoutId = setTimeout(() => {
|
|
5248
5231
|
const error = validateJson(value);
|
|
5249
5232
|
if (value.trim().length === 0) setJsonState({ state: "empty" });
|
|
@@ -5254,7 +5237,7 @@ var JsonInput = ({ value = "", setValue, minLines = 16, className, theme = "ligh
|
|
|
5254
5237
|
}, [value]);
|
|
5255
5238
|
const { icon, text, className: textClassName } = displayJsonState(jsonState);
|
|
5256
5239
|
const isValidJson = validateJson(value) === null;
|
|
5257
|
-
const lines =
|
|
5240
|
+
const lines = React19.useMemo(() => {
|
|
5258
5241
|
return Math.max(countJsonLines(value), minLines);
|
|
5259
5242
|
}, [value, minLines]);
|
|
5260
5243
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -5316,7 +5299,7 @@ var JsonEditor = ({
|
|
|
5316
5299
|
value,
|
|
5317
5300
|
onChange: setValue
|
|
5318
5301
|
};
|
|
5319
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5302
|
+
return /* @__PURE__ */ jsxRuntime.jsx(React19.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(EditorLoading, {}), children: /* @__PURE__ */ jsxRuntime.jsx(AceEditor, { ...editorProps }) });
|
|
5320
5303
|
};
|
|
5321
5304
|
var validateJson = (text) => {
|
|
5322
5305
|
try {
|
|
@@ -5357,7 +5340,7 @@ var dockVariants = classVarianceAuthority.cva(
|
|
|
5357
5340
|
// Solid themed surface (no glass/blur)
|
|
5358
5341
|
"mx-auto mt-8 flex h-[58px] w-max items-center justify-center gap-2 rounded-2xl border bg-card p-2 shadow"
|
|
5359
5342
|
);
|
|
5360
|
-
var Dock =
|
|
5343
|
+
var Dock = React19__namespace.default.forwardRef(
|
|
5361
5344
|
({
|
|
5362
5345
|
className,
|
|
5363
5346
|
children,
|
|
@@ -5369,9 +5352,9 @@ var Dock = React20__namespace.default.forwardRef(
|
|
|
5369
5352
|
}, ref) => {
|
|
5370
5353
|
const mouseX = react.useMotionValue(Infinity);
|
|
5371
5354
|
const renderChildren = () => {
|
|
5372
|
-
return
|
|
5373
|
-
if (
|
|
5374
|
-
return
|
|
5355
|
+
return React19__namespace.default.Children.map(children, (child) => {
|
|
5356
|
+
if (React19__namespace.default.isValidElement(child) && child.type === DockIcon) {
|
|
5357
|
+
return React19__namespace.default.cloneElement(child, {
|
|
5375
5358
|
...child.props,
|
|
5376
5359
|
mouseX,
|
|
5377
5360
|
size: iconSize,
|
|
@@ -5409,7 +5392,7 @@ var DockIcon = ({
|
|
|
5409
5392
|
children,
|
|
5410
5393
|
...props
|
|
5411
5394
|
}) => {
|
|
5412
|
-
const ref =
|
|
5395
|
+
const ref = React19.useRef(null);
|
|
5413
5396
|
const padding = Math.max(6, size * 0.2);
|
|
5414
5397
|
const defaultMouseX = react.useMotionValue(Infinity);
|
|
5415
5398
|
const distanceCalc = react.useTransform(mouseX ?? defaultMouseX, (val) => {
|
|
@@ -5460,11 +5443,11 @@ var FlickeringGrid = ({
|
|
|
5460
5443
|
maxOpacity = 0.3,
|
|
5461
5444
|
...props
|
|
5462
5445
|
}) => {
|
|
5463
|
-
const canvasRef =
|
|
5464
|
-
const containerRef =
|
|
5465
|
-
const [isInView, setIsInView] =
|
|
5466
|
-
const [canvasSize, setCanvasSize] =
|
|
5467
|
-
const memoizedColor =
|
|
5446
|
+
const canvasRef = React19.useRef(null);
|
|
5447
|
+
const containerRef = React19.useRef(null);
|
|
5448
|
+
const [isInView, setIsInView] = React19.useState(false);
|
|
5449
|
+
const [canvasSize, setCanvasSize] = React19.useState({ width: 0, height: 0 });
|
|
5450
|
+
const memoizedColor = React19.useMemo(() => {
|
|
5468
5451
|
const toRGBA = (color2) => {
|
|
5469
5452
|
if (typeof window === "undefined") {
|
|
5470
5453
|
return `rgba(0, 0, 0,`;
|
|
@@ -5480,7 +5463,7 @@ var FlickeringGrid = ({
|
|
|
5480
5463
|
};
|
|
5481
5464
|
return toRGBA(color);
|
|
5482
5465
|
}, [color]);
|
|
5483
|
-
const setupCanvas =
|
|
5466
|
+
const setupCanvas = React19.useCallback(
|
|
5484
5467
|
(canvas, width2, height2) => {
|
|
5485
5468
|
const dpr = window.devicePixelRatio || 1;
|
|
5486
5469
|
canvas.width = width2 * dpr;
|
|
@@ -5497,7 +5480,7 @@ var FlickeringGrid = ({
|
|
|
5497
5480
|
},
|
|
5498
5481
|
[squareSize, gridGap, maxOpacity]
|
|
5499
5482
|
);
|
|
5500
|
-
const updateSquares =
|
|
5483
|
+
const updateSquares = React19.useCallback(
|
|
5501
5484
|
(squares, deltaTime) => {
|
|
5502
5485
|
for (let i = 0; i < squares.length; i++) {
|
|
5503
5486
|
if (Math.random() < flickerChance * deltaTime) {
|
|
@@ -5507,7 +5490,7 @@ var FlickeringGrid = ({
|
|
|
5507
5490
|
},
|
|
5508
5491
|
[flickerChance, maxOpacity]
|
|
5509
5492
|
);
|
|
5510
|
-
const drawGrid =
|
|
5493
|
+
const drawGrid = React19.useCallback(
|
|
5511
5494
|
(ctx, width2, height2, cols, rows, squares, dpr) => {
|
|
5512
5495
|
ctx.clearRect(0, 0, width2, height2);
|
|
5513
5496
|
ctx.fillStyle = "transparent";
|
|
@@ -5527,7 +5510,7 @@ var FlickeringGrid = ({
|
|
|
5527
5510
|
},
|
|
5528
5511
|
[memoizedColor, squareSize, gridGap]
|
|
5529
5512
|
);
|
|
5530
|
-
|
|
5513
|
+
React19.useEffect(() => {
|
|
5531
5514
|
const canvas = canvasRef.current;
|
|
5532
5515
|
const container = containerRef.current;
|
|
5533
5516
|
if (!canvas || !container) return;
|
|
@@ -5597,9 +5580,9 @@ var MotionGrid = ({
|
|
|
5597
5580
|
}) => {
|
|
5598
5581
|
const [cols, rows] = gridSize;
|
|
5599
5582
|
const frames = useLoadingFrames(cols, rows);
|
|
5600
|
-
const [index, setIndex] =
|
|
5601
|
-
const intervalRef =
|
|
5602
|
-
|
|
5583
|
+
const [index, setIndex] = React19__namespace.useState(0);
|
|
5584
|
+
const intervalRef = React19__namespace.useRef(null);
|
|
5585
|
+
React19__namespace.useEffect(() => {
|
|
5603
5586
|
if (!animate || frames.length === 0) return;
|
|
5604
5587
|
intervalRef.current = setInterval(() => setIndex((i) => (i + 1) % frames.length), duration);
|
|
5605
5588
|
return () => clearInterval(intervalRef.current);
|
|
@@ -5632,7 +5615,7 @@ var MotionGrid = ({
|
|
|
5632
5615
|
);
|
|
5633
5616
|
};
|
|
5634
5617
|
var useLoadingFrames = (cols = 8, rows = 4) => {
|
|
5635
|
-
const loadingFrames =
|
|
5618
|
+
const loadingFrames = React19__namespace.useMemo(() => {
|
|
5636
5619
|
const frames = [];
|
|
5637
5620
|
for (let s = 0; s < cols + rows; s++) {
|
|
5638
5621
|
const dots = [];
|
|
@@ -5711,11 +5694,11 @@ function ProgressiveBlurScrollContainer({
|
|
|
5711
5694
|
blurProps,
|
|
5712
5695
|
showBlur = true
|
|
5713
5696
|
}) {
|
|
5714
|
-
const [hasOverflow, setHasOverflow] =
|
|
5715
|
-
const [isScrolledFromTop, setIsScrolledFromTop] =
|
|
5716
|
-
const [isScrolledFromBottom, setIsScrolledFromBottom] =
|
|
5717
|
-
const scrollRef =
|
|
5718
|
-
const checkScrollPosition =
|
|
5697
|
+
const [hasOverflow, setHasOverflow] = React19.useState(false);
|
|
5698
|
+
const [isScrolledFromTop, setIsScrolledFromTop] = React19.useState(false);
|
|
5699
|
+
const [isScrolledFromBottom, setIsScrolledFromBottom] = React19.useState(true);
|
|
5700
|
+
const scrollRef = React19.useRef(null);
|
|
5701
|
+
const checkScrollPosition = React19.useCallback(() => {
|
|
5719
5702
|
if (scrollRef.current) {
|
|
5720
5703
|
const el = scrollRef.current;
|
|
5721
5704
|
const scrollTop = el.scrollTop;
|
|
@@ -5725,7 +5708,7 @@ function ProgressiveBlurScrollContainer({
|
|
|
5725
5708
|
setIsScrolledFromBottom(scrollTop + clientHeight < scrollHeight - 10);
|
|
5726
5709
|
}
|
|
5727
5710
|
}, []);
|
|
5728
|
-
|
|
5711
|
+
React19.useEffect(() => {
|
|
5729
5712
|
const checkOverflow = () => {
|
|
5730
5713
|
if (scrollRef.current) {
|
|
5731
5714
|
const el = scrollRef.current;
|
|
@@ -5737,7 +5720,7 @@ function ProgressiveBlurScrollContainer({
|
|
|
5737
5720
|
window.addEventListener("resize", checkOverflow);
|
|
5738
5721
|
return () => window.removeEventListener("resize", checkOverflow);
|
|
5739
5722
|
}, [children, checkScrollPosition]);
|
|
5740
|
-
|
|
5723
|
+
React19.useEffect(() => {
|
|
5741
5724
|
const el = scrollRef.current;
|
|
5742
5725
|
if (!el) return;
|
|
5743
5726
|
el.addEventListener("scroll", checkScrollPosition, { passive: true });
|
|
@@ -5776,26 +5759,28 @@ function ProgressiveBlurScrollContainer({
|
|
|
5776
5759
|
] });
|
|
5777
5760
|
}
|
|
5778
5761
|
function ResponsiveDiagram({ children, targetRatio = 0.95, className }) {
|
|
5779
|
-
const containerRef =
|
|
5780
|
-
const contentRef =
|
|
5781
|
-
const [zoom, setZoom] =
|
|
5782
|
-
const calculateZoom =
|
|
5762
|
+
const containerRef = React19.useRef(null);
|
|
5763
|
+
const contentRef = React19.useRef(null);
|
|
5764
|
+
const [zoom, setZoom] = React19.useState(1);
|
|
5765
|
+
const calculateZoom = React19.useCallback(() => {
|
|
5783
5766
|
if (!containerRef.current || !contentRef.current) return;
|
|
5784
5767
|
contentRef.current.style.transform = "scale(1)";
|
|
5785
|
-
const
|
|
5786
|
-
const
|
|
5787
|
-
const
|
|
5788
|
-
const
|
|
5768
|
+
const style = getComputedStyle(containerRef.current);
|
|
5769
|
+
const padH = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
|
|
5770
|
+
const containerW = containerRef.current.clientWidth - padH;
|
|
5771
|
+
const contentW = contentRef.current.scrollWidth;
|
|
5772
|
+
const targetW = containerW * targetRatio;
|
|
5773
|
+
const newZoom = contentW > targetW ? targetW / contentW : 1;
|
|
5789
5774
|
setZoom(newZoom);
|
|
5790
5775
|
contentRef.current.style.transform = `scale(${newZoom})`;
|
|
5791
5776
|
}, [targetRatio]);
|
|
5792
|
-
|
|
5777
|
+
React19.useLayoutEffect(() => {
|
|
5793
5778
|
const rafId = requestAnimationFrame(() => {
|
|
5794
5779
|
calculateZoom();
|
|
5795
5780
|
});
|
|
5796
5781
|
return () => cancelAnimationFrame(rafId);
|
|
5797
5782
|
}, [calculateZoom, children]);
|
|
5798
|
-
|
|
5783
|
+
React19.useEffect(() => {
|
|
5799
5784
|
const resizeObserver = new ResizeObserver(() => {
|
|
5800
5785
|
calculateZoom();
|
|
5801
5786
|
});
|
|
@@ -5849,7 +5834,7 @@ function UnlinkButton({
|
|
|
5849
5834
|
),
|
|
5850
5835
|
"aria-label": ariaLabel,
|
|
5851
5836
|
title: isUnlinking ? "Unlinking..." : "Unlink record",
|
|
5852
|
-
children: isUnlinking ? /* @__PURE__ */ jsxRuntime.jsx(react$
|
|
5837
|
+
children: isUnlinking ? /* @__PURE__ */ jsxRuntime.jsx(react$2.RiLoader4Line, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(react$2.RiCloseLine, { className: "h-3 w-3" })
|
|
5853
5838
|
}
|
|
5854
5839
|
);
|
|
5855
5840
|
}
|
|
@@ -5917,6 +5902,13 @@ function stackReducer(state, action) {
|
|
|
5917
5902
|
newCards[index] = { ...newCards[index], width: action.width };
|
|
5918
5903
|
return { cards: newCards };
|
|
5919
5904
|
}
|
|
5905
|
+
case "SET_DISMISSABLE": {
|
|
5906
|
+
const index = state.cards.findIndex((c) => c.id === action.id);
|
|
5907
|
+
if (index === -1) return state;
|
|
5908
|
+
const newCards = [...state.cards];
|
|
5909
|
+
newCards[index] = { ...newCards[index], dismissable: action.dismissable };
|
|
5910
|
+
return { cards: newCards };
|
|
5911
|
+
}
|
|
5920
5912
|
case "DISMISS": {
|
|
5921
5913
|
const index = state.cards.findIndex((c) => c.id === action.id);
|
|
5922
5914
|
if (index === -1) return state;
|
|
@@ -5937,7 +5929,7 @@ function stackReducer(state, action) {
|
|
|
5937
5929
|
return state;
|
|
5938
5930
|
}
|
|
5939
5931
|
}
|
|
5940
|
-
var StackContext =
|
|
5932
|
+
var StackContext = React19.createContext(null);
|
|
5941
5933
|
function CardStackProvider({
|
|
5942
5934
|
children,
|
|
5943
5935
|
routes = {},
|
|
@@ -5948,9 +5940,9 @@ function CardStackProvider({
|
|
|
5948
5940
|
defaultPeekOffset = DEFAULT_PEEK_OFFSET,
|
|
5949
5941
|
defaultWidth = DEFAULT_WIDTH
|
|
5950
5942
|
}) {
|
|
5951
|
-
const [state, dispatch] =
|
|
5952
|
-
const prevCardsRef =
|
|
5953
|
-
|
|
5943
|
+
const [state, dispatch] = React19.useReducer(stackReducer, { cards: initial });
|
|
5944
|
+
const prevCardsRef = React19.useRef(state.cards);
|
|
5945
|
+
React19.useEffect(() => {
|
|
5954
5946
|
if (prevCardsRef.current !== state.cards) {
|
|
5955
5947
|
const prevCards = prevCardsRef.current;
|
|
5956
5948
|
const currentIds = new Set(state.cards.map((c) => c.id));
|
|
@@ -5963,11 +5955,11 @@ function CardStackProvider({
|
|
|
5963
5955
|
onChange?.(state.cards);
|
|
5964
5956
|
}
|
|
5965
5957
|
}, [state.cards, onChange]);
|
|
5966
|
-
const routesRef =
|
|
5958
|
+
const routesRef = React19.useRef(routes);
|
|
5967
5959
|
routesRef.current = routes;
|
|
5968
|
-
const stateRef =
|
|
5960
|
+
const stateRef = React19.useRef(state);
|
|
5969
5961
|
stateRef.current = state;
|
|
5970
|
-
const api =
|
|
5962
|
+
const api = React19.useMemo(() => {
|
|
5971
5963
|
const top = () => {
|
|
5972
5964
|
const cards = stateRef.current.cards;
|
|
5973
5965
|
return cards.length > 0 ? cards[cards.length - 1] : null;
|
|
@@ -6033,6 +6025,9 @@ function CardStackProvider({
|
|
|
6033
6025
|
const setWidth = (id, width) => {
|
|
6034
6026
|
dispatch({ type: "SET_WIDTH", id, width });
|
|
6035
6027
|
};
|
|
6028
|
+
const setDismissable = (id, dismissable) => {
|
|
6029
|
+
dispatch({ type: "SET_DISMISSABLE", id, dismissable });
|
|
6030
|
+
};
|
|
6036
6031
|
const dismiss = (id, options) => {
|
|
6037
6032
|
const cascade = options?.cascade ?? true;
|
|
6038
6033
|
dispatch({ type: "DISMISS", id, cascade });
|
|
@@ -6060,22 +6055,26 @@ function CardStackProvider({
|
|
|
6060
6055
|
setTitle,
|
|
6061
6056
|
setDescription,
|
|
6062
6057
|
setWidth,
|
|
6058
|
+
setDismissable,
|
|
6063
6059
|
dismiss,
|
|
6064
6060
|
insertAt
|
|
6065
6061
|
};
|
|
6066
6062
|
}, []);
|
|
6067
|
-
|
|
6063
|
+
React19.useEffect(() => {
|
|
6068
6064
|
const handleEscape = (event) => {
|
|
6069
6065
|
if (event.key === "Escape" && stateRef.current.cards.length > 0) {
|
|
6070
6066
|
event.preventDefault();
|
|
6071
6067
|
event.stopPropagation();
|
|
6072
|
-
|
|
6068
|
+
const topCard = stateRef.current.cards[stateRef.current.cards.length - 1];
|
|
6069
|
+
if (topCard.dismissable !== false) {
|
|
6070
|
+
api.pop();
|
|
6071
|
+
}
|
|
6073
6072
|
}
|
|
6074
6073
|
};
|
|
6075
6074
|
document.addEventListener("keydown", handleEscape, true);
|
|
6076
6075
|
return () => document.removeEventListener("keydown", handleEscape, true);
|
|
6077
6076
|
}, [api]);
|
|
6078
|
-
const contextValue =
|
|
6077
|
+
const contextValue = React19.useMemo(
|
|
6079
6078
|
() => ({
|
|
6080
6079
|
state,
|
|
6081
6080
|
api,
|
|
@@ -6092,14 +6091,14 @@ function CardStackProvider({
|
|
|
6092
6091
|
return /* @__PURE__ */ jsxRuntime.jsx(StackContext.Provider, { value: contextValue, children });
|
|
6093
6092
|
}
|
|
6094
6093
|
function useCardStack() {
|
|
6095
|
-
const context =
|
|
6094
|
+
const context = React19.useContext(StackContext);
|
|
6096
6095
|
if (!context) {
|
|
6097
6096
|
throw new Error("useCardStack must be used within a CardStackProvider");
|
|
6098
6097
|
}
|
|
6099
6098
|
return context.api;
|
|
6100
6099
|
}
|
|
6101
6100
|
function useStackContext() {
|
|
6102
|
-
const context =
|
|
6101
|
+
const context = React19.useContext(StackContext);
|
|
6103
6102
|
if (!context) {
|
|
6104
6103
|
throw new Error("useStackContext must be used within a CardStackProvider");
|
|
6105
6104
|
}
|
|
@@ -6124,7 +6123,7 @@ function useCardIndex(id) {
|
|
|
6124
6123
|
}
|
|
6125
6124
|
function useCardInjectedProps(id) {
|
|
6126
6125
|
const api = useCardStack();
|
|
6127
|
-
return
|
|
6126
|
+
return React19.useMemo(
|
|
6128
6127
|
() => ({
|
|
6129
6128
|
card: {
|
|
6130
6129
|
id,
|
|
@@ -6141,22 +6140,23 @@ function useCardInjectedProps(id) {
|
|
|
6141
6140
|
setTitle: (title) => api.setTitle(id, title),
|
|
6142
6141
|
setDescription: (description) => api.setDescription(id, description),
|
|
6143
6142
|
setWidth: (width) => api.setWidth(id, width),
|
|
6143
|
+
setDismissable: (dismissable) => api.setDismissable(id, dismissable),
|
|
6144
6144
|
updateProps: (patch) => api.updateProps(id, patch)
|
|
6145
6145
|
}
|
|
6146
6146
|
}),
|
|
6147
6147
|
[id, api]
|
|
6148
6148
|
);
|
|
6149
6149
|
}
|
|
6150
|
-
var CardReadyContext =
|
|
6150
|
+
var CardReadyContext = React19.createContext(null);
|
|
6151
6151
|
function CardReadyProvider({
|
|
6152
6152
|
children,
|
|
6153
6153
|
isAnimationComplete
|
|
6154
6154
|
}) {
|
|
6155
|
-
const value =
|
|
6155
|
+
const value = React19.useMemo(() => ({ isAnimationComplete }), [isAnimationComplete]);
|
|
6156
6156
|
return /* @__PURE__ */ jsxRuntime.jsx(CardReadyContext.Provider, { value, children });
|
|
6157
6157
|
}
|
|
6158
6158
|
function useCardReady() {
|
|
6159
|
-
const context =
|
|
6159
|
+
const context = React19.useContext(CardReadyContext);
|
|
6160
6160
|
if (!context) {
|
|
6161
6161
|
return { isReady: true };
|
|
6162
6162
|
}
|
|
@@ -6285,16 +6285,17 @@ var reducedMotionBackdropVariants = {
|
|
|
6285
6285
|
exit: { opacity: 0, transition: { duration: 0 } }
|
|
6286
6286
|
};
|
|
6287
6287
|
function StackBackdrop({ className, onClick, config: backdropConfig }) {
|
|
6288
|
-
const { config } = useStackContext();
|
|
6288
|
+
const { config, state } = useStackContext();
|
|
6289
6289
|
const api = useCardStack();
|
|
6290
6290
|
const prefersReducedMotion = react.useReducedMotion();
|
|
6291
|
-
const handleClick =
|
|
6291
|
+
const handleClick = React19__namespace.useCallback(() => {
|
|
6292
|
+
if (state.cards.some((c) => c.dismissable === false)) return;
|
|
6292
6293
|
if (onClick) {
|
|
6293
6294
|
onClick();
|
|
6294
6295
|
} else {
|
|
6295
6296
|
api.clear();
|
|
6296
6297
|
}
|
|
6297
|
-
}, [onClick, api]);
|
|
6298
|
+
}, [onClick, api, state.cards]);
|
|
6298
6299
|
const variants2 = prefersReducedMotion ? reducedMotionBackdropVariants : backdropVariants;
|
|
6299
6300
|
const useBlur = backdropConfig?.blur ?? false;
|
|
6300
6301
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6363,7 +6364,7 @@ function StackHeader({ card, onClose, className, renderTitle }) {
|
|
|
6363
6364
|
title && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: cn("text-foreground truncate", styles.title), children: title }),
|
|
6364
6365
|
card.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("text-muted-foreground truncate", styles.description), children: card.description })
|
|
6365
6366
|
] }),
|
|
6366
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6367
|
+
card.dismissable !== false && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6367
6368
|
"button",
|
|
6368
6369
|
{
|
|
6369
6370
|
type: "button",
|
|
@@ -6595,24 +6596,24 @@ function usePeekGestures(options) {
|
|
|
6595
6596
|
onPeekDragCancel
|
|
6596
6597
|
} = options;
|
|
6597
6598
|
const prefersReducedMotion = react.useReducedMotion();
|
|
6598
|
-
const [isHovered, setIsHovered] =
|
|
6599
|
-
const [isDragging, setIsDragging] =
|
|
6600
|
-
const [dragOffset, setDragOffset] =
|
|
6601
|
-
const startXRef =
|
|
6602
|
-
const startTimeRef =
|
|
6603
|
-
const pointerIdRef =
|
|
6604
|
-
const hasDraggedRef =
|
|
6599
|
+
const [isHovered, setIsHovered] = React19.useState(false);
|
|
6600
|
+
const [isDragging, setIsDragging] = React19.useState(false);
|
|
6601
|
+
const [dragOffset, setDragOffset] = React19.useState(0);
|
|
6602
|
+
const startXRef = React19.useRef(0);
|
|
6603
|
+
const startTimeRef = React19.useRef(0);
|
|
6604
|
+
const pointerIdRef = React19.useRef(null);
|
|
6605
|
+
const hasDraggedRef = React19.useRef(false);
|
|
6605
6606
|
const isTopCard = cardIndex === totalCards - 1;
|
|
6606
6607
|
const isEnabled = enabled && !isTopCard;
|
|
6607
|
-
const handleMouseEnter =
|
|
6608
|
+
const handleMouseEnter = React19.useCallback(() => {
|
|
6608
6609
|
if (!isEnabled || prefersReducedMotion) return;
|
|
6609
6610
|
setIsHovered(true);
|
|
6610
6611
|
}, [isEnabled, prefersReducedMotion]);
|
|
6611
|
-
const handleMouseLeave =
|
|
6612
|
+
const handleMouseLeave = React19.useCallback(() => {
|
|
6612
6613
|
if (!isEnabled) return;
|
|
6613
6614
|
setIsHovered(false);
|
|
6614
6615
|
}, [isEnabled]);
|
|
6615
|
-
const handleClick =
|
|
6616
|
+
const handleClick = React19.useCallback(
|
|
6616
6617
|
(e) => {
|
|
6617
6618
|
if (!isEnabled) return;
|
|
6618
6619
|
if (hasDraggedRef.current) {
|
|
@@ -6624,7 +6625,7 @@ function usePeekGestures(options) {
|
|
|
6624
6625
|
},
|
|
6625
6626
|
[isEnabled, onPeekClick]
|
|
6626
6627
|
);
|
|
6627
|
-
const handlePointerDown =
|
|
6628
|
+
const handlePointerDown = React19.useCallback(
|
|
6628
6629
|
(e) => {
|
|
6629
6630
|
if (!isEnabled || !dragToDismiss) return;
|
|
6630
6631
|
if (e.pointerType === "mouse" && e.button !== 0) return;
|
|
@@ -6638,7 +6639,7 @@ function usePeekGestures(options) {
|
|
|
6638
6639
|
},
|
|
6639
6640
|
[isEnabled, dragToDismiss]
|
|
6640
6641
|
);
|
|
6641
|
-
const handlePointerMove =
|
|
6642
|
+
const handlePointerMove = React19.useCallback(
|
|
6642
6643
|
(e) => {
|
|
6643
6644
|
if (!isEnabled || pointerIdRef.current !== e.pointerId) return;
|
|
6644
6645
|
const deltaX = e.clientX - startXRef.current;
|
|
@@ -6652,7 +6653,7 @@ function usePeekGestures(options) {
|
|
|
6652
6653
|
},
|
|
6653
6654
|
[isEnabled, onPeekDrag]
|
|
6654
6655
|
);
|
|
6655
|
-
const handlePointerUp =
|
|
6656
|
+
const handlePointerUp = React19.useCallback(
|
|
6656
6657
|
(e) => {
|
|
6657
6658
|
if (!isEnabled || pointerIdRef.current !== e.pointerId) return;
|
|
6658
6659
|
e.target.releasePointerCapture(e.pointerId);
|
|
@@ -6672,7 +6673,7 @@ function usePeekGestures(options) {
|
|
|
6672
6673
|
},
|
|
6673
6674
|
[isEnabled, dragThreshold, dragVelocityThreshold, onPeekDragDismiss, onPeekDragCancel]
|
|
6674
6675
|
);
|
|
6675
|
-
const handlePointerCancel =
|
|
6676
|
+
const handlePointerCancel = React19.useCallback(
|
|
6676
6677
|
(e) => {
|
|
6677
6678
|
if (pointerIdRef.current === e.pointerId) {
|
|
6678
6679
|
pointerIdRef.current = null;
|
|
@@ -6726,8 +6727,8 @@ function StackCardInner({
|
|
|
6726
6727
|
const { config, api, state } = useStackContext();
|
|
6727
6728
|
const prefersReducedMotion = react.useReducedMotion();
|
|
6728
6729
|
const injectedProps = useCardInjectedProps(card.id);
|
|
6729
|
-
const [isAnimationComplete, setAnimationComplete] =
|
|
6730
|
-
const handleAnimationComplete =
|
|
6730
|
+
const [isAnimationComplete, setAnimationComplete] = React19.useState(prefersReducedMotion ?? false);
|
|
6731
|
+
const handleAnimationComplete = React19.useCallback(() => {
|
|
6731
6732
|
setAnimationComplete(true);
|
|
6732
6733
|
}, []);
|
|
6733
6734
|
const isTopCard = index === totalCards - 1;
|
|
@@ -6735,7 +6736,7 @@ function StackCardInner({
|
|
|
6735
6736
|
const hasPeekZone = !isTopCard && !isMobile && !(config.layoutMode === "side-by-side" && isSecondCard);
|
|
6736
6737
|
const zIndex = getCardZIndex(index, config.zIndexBase);
|
|
6737
6738
|
const effectivePeekOffset = adjustedPeekOffset ?? config.defaultPeekOffset;
|
|
6738
|
-
const baseOffset =
|
|
6739
|
+
const baseOffset = React19.useMemo(
|
|
6739
6740
|
() => getResponsiveCardOffset(
|
|
6740
6741
|
index,
|
|
6741
6742
|
totalCards,
|
|
@@ -6750,28 +6751,32 @@ function StackCardInner({
|
|
|
6750
6751
|
);
|
|
6751
6752
|
const cardWidth = isMobile ? "100%" : normalizeWidth(card.width, config.defaultWidth);
|
|
6752
6753
|
const offsetTransition = createOffsetTransition(animation);
|
|
6753
|
-
const handleClose =
|
|
6754
|
+
const handleClose = React19.useCallback(() => {
|
|
6754
6755
|
api.dismiss(card.id);
|
|
6755
6756
|
}, [api, card.id]);
|
|
6756
|
-
const handlePeekClick =
|
|
6757
|
+
const handlePeekClick = React19.useCallback(() => {
|
|
6758
|
+
const cardsAbove = state.cards.slice(index + 1);
|
|
6759
|
+
if (cardsAbove.some((c) => c.dismissable === false)) return;
|
|
6757
6760
|
api.popTo(card.id);
|
|
6758
|
-
}, [api, card.id]);
|
|
6759
|
-
const handlePeekDragDismiss =
|
|
6761
|
+
}, [api, card.id, state.cards, index]);
|
|
6762
|
+
const handlePeekDragDismiss = React19.useCallback(() => {
|
|
6763
|
+
const cardsAbove = state.cards.slice(index + 1);
|
|
6764
|
+
if (cardsAbove.some((c) => c.dismissable === false)) return;
|
|
6760
6765
|
onPeekDragEnd?.(index, true);
|
|
6761
|
-
}, [index, onPeekDragEnd]);
|
|
6762
|
-
const handlePeekDrag =
|
|
6766
|
+
}, [index, onPeekDragEnd, state.cards]);
|
|
6767
|
+
const handlePeekDrag = React19.useCallback(
|
|
6763
6768
|
(offset) => {
|
|
6764
6769
|
onPeekDrag?.(index, offset);
|
|
6765
6770
|
},
|
|
6766
6771
|
[index, onPeekDrag]
|
|
6767
6772
|
);
|
|
6768
|
-
const handlePeekDragCancel =
|
|
6773
|
+
const handlePeekDragCancel = React19.useCallback(() => {
|
|
6769
6774
|
onPeekDragEnd?.(index, false);
|
|
6770
6775
|
}, [index, onPeekDragEnd]);
|
|
6771
|
-
const handlePeekHoverStart =
|
|
6776
|
+
const handlePeekHoverStart = React19.useCallback(() => {
|
|
6772
6777
|
onPeekHoverStart?.(index);
|
|
6773
6778
|
}, [index, onPeekHoverStart]);
|
|
6774
|
-
const handlePeekHoverEnd =
|
|
6779
|
+
const handlePeekHoverEnd = React19.useCallback(() => {
|
|
6775
6780
|
onPeekHoverEnd?.(index);
|
|
6776
6781
|
}, [index, onPeekHoverEnd]);
|
|
6777
6782
|
const peekGestures = usePeekGestures({
|
|
@@ -6786,7 +6791,7 @@ function StackCardInner({
|
|
|
6786
6791
|
const hoverExpansion = hasPeekZone && isPeekHovered && !peekGestures.isDragging && !prefersReducedMotion ? peekGestureConfig?.hoverExpansion ?? DEFAULT_HOVER_EXPANSION2 : 0;
|
|
6787
6792
|
const xOffset = -baseOffset + dragX - hoverExpansion + peekDragOffset;
|
|
6788
6793
|
const CardComponent = card.Component;
|
|
6789
|
-
const cardContent =
|
|
6794
|
+
const cardContent = React19.useMemo(() => {
|
|
6790
6795
|
return /* @__PURE__ */ jsxRuntime.jsx(CardReadyProvider, { isAnimationComplete, children: /* @__PURE__ */ jsxRuntime.jsx(CardComponent, { ...card.props, ...injectedProps }) });
|
|
6791
6796
|
}, [CardComponent, card.props, injectedProps, isAnimationComplete]);
|
|
6792
6797
|
const headerContent = renderHeader ? renderHeader(card, api) : /* @__PURE__ */ jsxRuntime.jsx(StackHeader, { card, onClose: handleClose });
|
|
@@ -6882,7 +6887,7 @@ function StackCardInner({
|
|
|
6882
6887
|
}
|
|
6883
6888
|
);
|
|
6884
6889
|
}
|
|
6885
|
-
var StackCard =
|
|
6890
|
+
var StackCard = React19.memo(StackCardInner);
|
|
6886
6891
|
var DEFAULT_SWIPE_THRESHOLD = 120;
|
|
6887
6892
|
var DEFAULT_VELOCITY_THRESHOLD2 = 0.6;
|
|
6888
6893
|
var MIN_VELOCITY_DISTANCE = 60;
|
|
@@ -6898,14 +6903,14 @@ function useStackGestures(options) {
|
|
|
6898
6903
|
} = options;
|
|
6899
6904
|
const prefersReducedMotion = react.useReducedMotion();
|
|
6900
6905
|
const isEnabled = enabled && swipeToPop && !prefersReducedMotion;
|
|
6901
|
-
const [dragX, setDragX] =
|
|
6902
|
-
const [isDragging, setIsDragging] =
|
|
6903
|
-
const handleDismiss =
|
|
6906
|
+
const [dragX, setDragX] = React19.useState(0);
|
|
6907
|
+
const [isDragging, setIsDragging] = React19.useState(false);
|
|
6908
|
+
const handleDismiss = React19.useCallback(() => {
|
|
6904
6909
|
onDismiss();
|
|
6905
6910
|
}, [onDismiss]);
|
|
6906
|
-
const dismissedRef =
|
|
6911
|
+
const dismissedRef = React19.useRef(false);
|
|
6907
6912
|
const velocityMinDistance = Math.max(MIN_VELOCITY_DISTANCE, swipeThreshold * 0.25);
|
|
6908
|
-
const bind = react$
|
|
6913
|
+
const bind = react$3.useDrag(
|
|
6909
6914
|
({ active, movement: [mx], velocity: [vx], direction: [dx], initial: [initialX], xy: [currentX], cancel, first }) => {
|
|
6910
6915
|
if (first && initialX < EDGE_IGNORE_ZONE) {
|
|
6911
6916
|
cancel();
|
|
@@ -6961,14 +6966,14 @@ function useStackGestures(options) {
|
|
|
6961
6966
|
var DEFAULT_MOBILE_BREAKPOINT = 768;
|
|
6962
6967
|
function useStackResponsive(options = {}) {
|
|
6963
6968
|
const { breakpoint = DEFAULT_MOBILE_BREAKPOINT } = options;
|
|
6964
|
-
const [state, setState] =
|
|
6969
|
+
const [state, setState] = React19.useState(() => {
|
|
6965
6970
|
if (typeof window === "undefined") {
|
|
6966
6971
|
return { isMobile: false, viewportWidth: 1024 };
|
|
6967
6972
|
}
|
|
6968
6973
|
const width = window.innerWidth;
|
|
6969
6974
|
return { isMobile: width < breakpoint, viewportWidth: width };
|
|
6970
6975
|
});
|
|
6971
|
-
const updateState =
|
|
6976
|
+
const updateState = React19.useCallback(() => {
|
|
6972
6977
|
const width = window.innerWidth;
|
|
6973
6978
|
setState((prev) => {
|
|
6974
6979
|
const isMobile = width < breakpoint;
|
|
@@ -6978,7 +6983,7 @@ function useStackResponsive(options = {}) {
|
|
|
6978
6983
|
return { isMobile, viewportWidth: width };
|
|
6979
6984
|
});
|
|
6980
6985
|
}, [breakpoint]);
|
|
6981
|
-
|
|
6986
|
+
React19.useEffect(() => {
|
|
6982
6987
|
updateState();
|
|
6983
6988
|
window.addEventListener("resize", updateState);
|
|
6984
6989
|
return () => window.removeEventListener("resize", updateState);
|
|
@@ -7008,17 +7013,17 @@ function CardStackViewport({
|
|
|
7008
7013
|
const { config, api } = useStackContext();
|
|
7009
7014
|
const cards = useStackCards();
|
|
7010
7015
|
const { isMobile, viewportWidth } = useStackResponsive(mobile);
|
|
7011
|
-
const [peekDrag, setPeekDrag] =
|
|
7012
|
-
const [peekHover, setPeekHover] =
|
|
7013
|
-
const hoverEndTimeoutRef =
|
|
7014
|
-
const prevCardCountRef =
|
|
7015
|
-
const [exitComplete, setExitComplete] =
|
|
7016
|
-
|
|
7016
|
+
const [peekDrag, setPeekDrag] = React19.useState({ sourceIndex: -1, offset: 0 });
|
|
7017
|
+
const [peekHover, setPeekHover] = React19.useState({ hoveredIndex: -1 });
|
|
7018
|
+
const hoverEndTimeoutRef = React19.useRef(null);
|
|
7019
|
+
const prevCardCountRef = React19.useRef(cards.length);
|
|
7020
|
+
const [exitComplete, setExitComplete] = React19.useState(cards.length === 0);
|
|
7021
|
+
React19.useEffect(() => {
|
|
7017
7022
|
if (cards.length > 0) {
|
|
7018
7023
|
setExitComplete(false);
|
|
7019
7024
|
}
|
|
7020
7025
|
}, [cards.length]);
|
|
7021
|
-
|
|
7026
|
+
React19.useEffect(() => {
|
|
7022
7027
|
if (cards.length !== prevCardCountRef.current) {
|
|
7023
7028
|
setPeekHover({ hoveredIndex: -1 });
|
|
7024
7029
|
if (hoverEndTimeoutRef.current) {
|
|
@@ -7028,10 +7033,10 @@ function CardStackViewport({
|
|
|
7028
7033
|
prevCardCountRef.current = cards.length;
|
|
7029
7034
|
}
|
|
7030
7035
|
}, [cards.length]);
|
|
7031
|
-
const handleExitComplete =
|
|
7036
|
+
const handleExitComplete = React19.useCallback(() => {
|
|
7032
7037
|
setExitComplete(true);
|
|
7033
7038
|
}, []);
|
|
7034
|
-
const cardWidths =
|
|
7039
|
+
const cardWidths = React19.useMemo(() => {
|
|
7035
7040
|
if (cards.length === 0) return { topCardWidth: 0, secondCardWidth: 0 };
|
|
7036
7041
|
const topCard = cards[cards.length - 1];
|
|
7037
7042
|
const topCardWidth = parseWidthToPixels(topCard.width ?? config.defaultWidth) ?? 480;
|
|
@@ -7039,7 +7044,7 @@ function CardStackViewport({
|
|
|
7039
7044
|
const secondCardWidth = secondCard ? parseWidthToPixels(secondCard.width ?? config.defaultWidth) ?? 480 : 0;
|
|
7040
7045
|
return { topCardWidth, secondCardWidth };
|
|
7041
7046
|
}, [cards, config.defaultWidth]);
|
|
7042
|
-
const responsiveOffset =
|
|
7047
|
+
const responsiveOffset = React19.useMemo(() => {
|
|
7043
7048
|
return calculateResponsiveOffset({
|
|
7044
7049
|
viewportWidth,
|
|
7045
7050
|
topCardWidth: cardWidths.topCardWidth,
|
|
@@ -7050,7 +7055,9 @@ function CardStackViewport({
|
|
|
7050
7055
|
});
|
|
7051
7056
|
}, [viewportWidth, cardWidths, cards.length, config.defaultPeekOffset, config.layoutMode]);
|
|
7052
7057
|
const useFullScreen = isMobile || responsiveOffset.shouldCollapse;
|
|
7053
|
-
const handleDismiss =
|
|
7058
|
+
const handleDismiss = React19.useCallback(() => {
|
|
7059
|
+
const topCard = api.top();
|
|
7060
|
+
if (topCard?.dismissable === false) return;
|
|
7054
7061
|
api.pop();
|
|
7055
7062
|
}, [api]);
|
|
7056
7063
|
const swipeThreshold = mobile?.gestures?.swipeThreshold ?? Math.max(120, Math.round(viewportWidth * 0.35));
|
|
@@ -7062,14 +7069,14 @@ function CardStackViewport({
|
|
|
7062
7069
|
autoDismissThreshold,
|
|
7063
7070
|
onDismiss: handleDismiss
|
|
7064
7071
|
});
|
|
7065
|
-
const handlePeekHoverStart =
|
|
7072
|
+
const handlePeekHoverStart = React19.useCallback((cardIndex) => {
|
|
7066
7073
|
if (hoverEndTimeoutRef.current) {
|
|
7067
7074
|
clearTimeout(hoverEndTimeoutRef.current);
|
|
7068
7075
|
hoverEndTimeoutRef.current = null;
|
|
7069
7076
|
}
|
|
7070
7077
|
setPeekHover({ hoveredIndex: cardIndex });
|
|
7071
7078
|
}, []);
|
|
7072
|
-
const handlePeekHoverEnd =
|
|
7079
|
+
const handlePeekHoverEnd = React19.useCallback((cardIndex) => {
|
|
7073
7080
|
if (hoverEndTimeoutRef.current) {
|
|
7074
7081
|
clearTimeout(hoverEndTimeoutRef.current);
|
|
7075
7082
|
}
|
|
@@ -7078,12 +7085,17 @@ function CardStackViewport({
|
|
|
7078
7085
|
hoverEndTimeoutRef.current = null;
|
|
7079
7086
|
}, 100);
|
|
7080
7087
|
}, []);
|
|
7081
|
-
const handlePeekDrag =
|
|
7088
|
+
const handlePeekDrag = React19.useCallback((cardIndex, offset) => {
|
|
7082
7089
|
setPeekDrag({ sourceIndex: cardIndex, offset });
|
|
7083
7090
|
}, []);
|
|
7084
|
-
const handlePeekDragEnd =
|
|
7091
|
+
const handlePeekDragEnd = React19.useCallback(
|
|
7085
7092
|
(cardIndex, shouldDismiss) => {
|
|
7086
7093
|
if (shouldDismiss) {
|
|
7094
|
+
const cardsAbove = cards.slice(cardIndex + 1);
|
|
7095
|
+
if (cardsAbove.some((c) => c.dismissable === false)) {
|
|
7096
|
+
setPeekDrag({ sourceIndex: -1, offset: 0 });
|
|
7097
|
+
return;
|
|
7098
|
+
}
|
|
7087
7099
|
const card = cards[cardIndex];
|
|
7088
7100
|
if (card) {
|
|
7089
7101
|
api.popTo(card.id);
|
|
@@ -7093,7 +7105,7 @@ function CardStackViewport({
|
|
|
7093
7105
|
},
|
|
7094
7106
|
[api, cards]
|
|
7095
7107
|
);
|
|
7096
|
-
const visibleCards =
|
|
7108
|
+
const visibleCards = React19.useMemo(() => {
|
|
7097
7109
|
return cards.filter((_, index) => isCardVisible(index, cards.length, peekDepth));
|
|
7098
7110
|
}, [cards, peekDepth]);
|
|
7099
7111
|
const portalContainer = useRootPortalContainer();
|
|
@@ -7101,12 +7113,12 @@ function CardStackViewport({
|
|
|
7101
7113
|
const defaultBackdrop = /* @__PURE__ */ jsxRuntime.jsx(StackBackdrop, { className: "pointer-events-auto", config: config2 }, "backdrop");
|
|
7102
7114
|
if (renderBackdrop) {
|
|
7103
7115
|
const customBackdrop = renderBackdrop();
|
|
7104
|
-
return
|
|
7116
|
+
return React19__namespace.isValidElement(customBackdrop) ? React19__namespace.cloneElement(customBackdrop, { key: "backdrop" }) : defaultBackdrop;
|
|
7105
7117
|
}
|
|
7106
7118
|
return defaultBackdrop;
|
|
7107
7119
|
};
|
|
7108
7120
|
const hasCards = cards.length > 0;
|
|
7109
|
-
const resolvedBackdrop =
|
|
7121
|
+
const resolvedBackdrop = React19.useMemo(() => {
|
|
7110
7122
|
const firstCard = cards[0];
|
|
7111
7123
|
const cardBackdrop = firstCard?.backdrop;
|
|
7112
7124
|
if (cardBackdrop !== void 0) {
|
|
@@ -7178,8 +7190,8 @@ function DeferredCardContent({
|
|
|
7178
7190
|
priority = "normal",
|
|
7179
7191
|
onReady
|
|
7180
7192
|
}) {
|
|
7181
|
-
const [ready, setReady] =
|
|
7182
|
-
|
|
7193
|
+
const [ready, setReady] = React19.useState(immediate);
|
|
7194
|
+
React19.useEffect(() => {
|
|
7183
7195
|
if (immediate) {
|
|
7184
7196
|
onReady?.();
|
|
7185
7197
|
return;
|
|
@@ -7392,6 +7404,481 @@ var toast5 = {
|
|
|
7392
7404
|
warning: showWarningToast
|
|
7393
7405
|
};
|
|
7394
7406
|
|
|
7407
|
+
// src/components/org-chart/layout.ts
|
|
7408
|
+
var NODE_WIDTH = 260;
|
|
7409
|
+
var NODE_HEIGHT = 100;
|
|
7410
|
+
var RANK_SEP = 80;
|
|
7411
|
+
var NODE_SEP = 40;
|
|
7412
|
+
var ROOT_KEY = "__root__";
|
|
7413
|
+
function computeLayout(edges) {
|
|
7414
|
+
const edgeById = /* @__PURE__ */ new Map();
|
|
7415
|
+
const childCountMap = /* @__PURE__ */ new Map();
|
|
7416
|
+
const childrenMap = /* @__PURE__ */ new Map();
|
|
7417
|
+
for (const e of edges) {
|
|
7418
|
+
edgeById.set(e.id, e);
|
|
7419
|
+
if (e.parentId) {
|
|
7420
|
+
childCountMap.set(e.parentId, (childCountMap.get(e.parentId) ?? 0) + 1);
|
|
7421
|
+
}
|
|
7422
|
+
const parent = e.parentId ?? ROOT_KEY;
|
|
7423
|
+
const bucket = childrenMap.get(parent);
|
|
7424
|
+
if (bucket) bucket.push(e.id);
|
|
7425
|
+
else childrenMap.set(parent, [e.id]);
|
|
7426
|
+
}
|
|
7427
|
+
for (const children of childrenMap.values()) {
|
|
7428
|
+
children.sort((a, b) => {
|
|
7429
|
+
const nameA = edgeById.get(a)?.displayName?.toLowerCase() ?? "";
|
|
7430
|
+
const nameB = edgeById.get(b)?.displayName?.toLowerCase() ?? "";
|
|
7431
|
+
return nameA.localeCompare(nameB);
|
|
7432
|
+
});
|
|
7433
|
+
}
|
|
7434
|
+
const widthCache = /* @__PURE__ */ new Map();
|
|
7435
|
+
const subtreeWidth = (nodeId) => {
|
|
7436
|
+
if (widthCache.has(nodeId)) return widthCache.get(nodeId);
|
|
7437
|
+
const children = childrenMap.get(nodeId);
|
|
7438
|
+
if (!children || children.length === 0) {
|
|
7439
|
+
widthCache.set(nodeId, NODE_WIDTH);
|
|
7440
|
+
return NODE_WIDTH;
|
|
7441
|
+
}
|
|
7442
|
+
const totalChildWidth = children.reduce((sum, c) => sum + subtreeWidth(c), 0);
|
|
7443
|
+
const gaps = (children.length - 1) * NODE_SEP;
|
|
7444
|
+
const w = Math.max(NODE_WIDTH, totalChildWidth + gaps);
|
|
7445
|
+
widthCache.set(nodeId, w);
|
|
7446
|
+
return w;
|
|
7447
|
+
};
|
|
7448
|
+
const positions = /* @__PURE__ */ new Map();
|
|
7449
|
+
const positionSubtree = (nodeId, centerX, y) => {
|
|
7450
|
+
positions.set(nodeId, { x: centerX, y });
|
|
7451
|
+
const children = childrenMap.get(nodeId);
|
|
7452
|
+
if (!children || children.length === 0) return;
|
|
7453
|
+
const totalWidth = children.reduce((sum, c) => sum + subtreeWidth(c), 0) + (children.length - 1) * NODE_SEP;
|
|
7454
|
+
let currentX = centerX - totalWidth / 2;
|
|
7455
|
+
for (const childId of children) {
|
|
7456
|
+
const childW = subtreeWidth(childId);
|
|
7457
|
+
positionSubtree(childId, currentX + childW / 2, y + NODE_HEIGHT + RANK_SEP);
|
|
7458
|
+
currentX += childW + NODE_SEP;
|
|
7459
|
+
}
|
|
7460
|
+
};
|
|
7461
|
+
const roots = childrenMap.get(ROOT_KEY) ?? [];
|
|
7462
|
+
if (roots.length === 1) {
|
|
7463
|
+
positionSubtree(roots[0], 0, 0);
|
|
7464
|
+
} else {
|
|
7465
|
+
const totalWidth = roots.reduce((sum, r) => sum + subtreeWidth(r), 0) + (roots.length - 1) * NODE_SEP;
|
|
7466
|
+
let currentX = -totalWidth / 2;
|
|
7467
|
+
for (const rootId of roots) {
|
|
7468
|
+
const w = subtreeWidth(rootId);
|
|
7469
|
+
positionSubtree(rootId, currentX + w / 2, 0);
|
|
7470
|
+
currentX += w + NODE_SEP;
|
|
7471
|
+
}
|
|
7472
|
+
}
|
|
7473
|
+
const nodes = edges.map((e) => {
|
|
7474
|
+
const pos = positions.get(e.id);
|
|
7475
|
+
return {
|
|
7476
|
+
id: e.id,
|
|
7477
|
+
type: "orgChartNode",
|
|
7478
|
+
width: NODE_WIDTH,
|
|
7479
|
+
height: NODE_HEIGHT,
|
|
7480
|
+
position: {
|
|
7481
|
+
x: pos.x - NODE_WIDTH / 2,
|
|
7482
|
+
y: pos.y
|
|
7483
|
+
},
|
|
7484
|
+
data: {
|
|
7485
|
+
id: e.id,
|
|
7486
|
+
displayName: e.displayName,
|
|
7487
|
+
avatarUrl: e.avatarUrl,
|
|
7488
|
+
positionTitle: e.positionTitle,
|
|
7489
|
+
parentId: e.parentId,
|
|
7490
|
+
childCount: childCountMap.get(e.id) ?? 0,
|
|
7491
|
+
isRoot: !e.parentId
|
|
7492
|
+
}
|
|
7493
|
+
};
|
|
7494
|
+
});
|
|
7495
|
+
const flowEdges = edges.filter((e) => e.parentId).map((e) => ({
|
|
7496
|
+
id: `edge-${e.parentId}-${e.id}`,
|
|
7497
|
+
source: e.parentId,
|
|
7498
|
+
target: e.id,
|
|
7499
|
+
type: "orgChartEdge"
|
|
7500
|
+
}));
|
|
7501
|
+
return { nodes, edges: flowEdges };
|
|
7502
|
+
}
|
|
7503
|
+
var NodeActionsContext = React19.createContext(null);
|
|
7504
|
+
var OrgChartContext = React19.createContext(null);
|
|
7505
|
+
function OrgChartProvider({ children, editable }) {
|
|
7506
|
+
const [selectedNodeId, setSelectedNodeId] = React19.useState(null);
|
|
7507
|
+
const [draggedNodeId, setDraggedNodeId] = React19.useState(null);
|
|
7508
|
+
const [dropTargetNodeId, setDropTargetNodeId] = React19.useState(null);
|
|
7509
|
+
const selectNode = React19.useCallback((nodeId) => setSelectedNodeId(nodeId), []);
|
|
7510
|
+
const clearSelection = React19.useCallback(() => setSelectedNodeId(null), []);
|
|
7511
|
+
const value = React19.useMemo(
|
|
7512
|
+
() => ({
|
|
7513
|
+
selectedNodeId,
|
|
7514
|
+
selectNode,
|
|
7515
|
+
clearSelection,
|
|
7516
|
+
editable,
|
|
7517
|
+
draggedNodeId,
|
|
7518
|
+
setDraggedNodeId,
|
|
7519
|
+
dropTargetNodeId,
|
|
7520
|
+
setDropTargetNodeId
|
|
7521
|
+
}),
|
|
7522
|
+
[selectedNodeId, selectNode, clearSelection, editable, draggedNodeId, dropTargetNodeId]
|
|
7523
|
+
);
|
|
7524
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OrgChartContext.Provider, { value, children });
|
|
7525
|
+
}
|
|
7526
|
+
function useOrgChartContext() {
|
|
7527
|
+
const ctx = React19.useContext(OrgChartContext);
|
|
7528
|
+
if (!ctx) throw new Error("useOrgChartContext must be used within OrgChartProvider");
|
|
7529
|
+
return ctx;
|
|
7530
|
+
}
|
|
7531
|
+
function NodeActionsProvider({
|
|
7532
|
+
children,
|
|
7533
|
+
onEditNode,
|
|
7534
|
+
onRemoveNode
|
|
7535
|
+
}) {
|
|
7536
|
+
const value = React19.useMemo(() => ({ onEditNode, onRemoveNode }), [onEditNode, onRemoveNode]);
|
|
7537
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NodeActionsContext.Provider, { value, children });
|
|
7538
|
+
}
|
|
7539
|
+
function useNodeActions() {
|
|
7540
|
+
const ctx = React19.useContext(NodeActionsContext);
|
|
7541
|
+
if (!ctx) throw new Error("useNodeActions must be used within NodeActionsProvider");
|
|
7542
|
+
return ctx;
|
|
7543
|
+
}
|
|
7544
|
+
function OrgChartEdge({
|
|
7545
|
+
sourceX,
|
|
7546
|
+
sourceY,
|
|
7547
|
+
targetX,
|
|
7548
|
+
targetY,
|
|
7549
|
+
sourcePosition,
|
|
7550
|
+
targetPosition,
|
|
7551
|
+
style = {}
|
|
7552
|
+
}) {
|
|
7553
|
+
const [edgePath] = react$1.getSmoothStepPath({
|
|
7554
|
+
sourceX,
|
|
7555
|
+
sourceY,
|
|
7556
|
+
sourcePosition,
|
|
7557
|
+
targetX,
|
|
7558
|
+
targetY,
|
|
7559
|
+
targetPosition,
|
|
7560
|
+
borderRadius: 12
|
|
7561
|
+
});
|
|
7562
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react$1.BaseEdge, { path: edgePath, style });
|
|
7563
|
+
}
|
|
7564
|
+
function OrgChartEmpty({ editable, onAddRoot }) {
|
|
7565
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-card border-border/60 flex flex-col items-center justify-center rounded-xl border py-16", children: [
|
|
7566
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted mb-4 flex size-14 items-center justify-center rounded-2xl", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Network, { className: "text-muted-foreground size-7" }) }),
|
|
7567
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-foreground text-base font-semibold", children: "No Org Chart Yet" }),
|
|
7568
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mt-1.5 max-w-sm text-center text-sm", children: "Build your organization hierarchy by adding the first person." }),
|
|
7569
|
+
editable && /* @__PURE__ */ jsxRuntime.jsxs(Button, { className: "mt-5 gap-1.5", onClick: onAddRoot, children: [
|
|
7570
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserPlus, { className: "size-3.5" }),
|
|
7571
|
+
"Add First Member"
|
|
7572
|
+
] })
|
|
7573
|
+
] });
|
|
7574
|
+
}
|
|
7575
|
+
|
|
7576
|
+
// src/components/org-chart/org-chart-utils.ts
|
|
7577
|
+
function getInitials(name) {
|
|
7578
|
+
if (!name) return "--";
|
|
7579
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
7580
|
+
if (parts.length === 0) return "--";
|
|
7581
|
+
if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
|
|
7582
|
+
return (parts[0][0] + parts[1][0]).toUpperCase();
|
|
7583
|
+
}
|
|
7584
|
+
function OrgChartNodeComponent({ id, data }) {
|
|
7585
|
+
const { selectedNodeId, dropTargetNodeId, editable } = useOrgChartContext();
|
|
7586
|
+
const { onEditNode, onRemoveNode } = useNodeActions();
|
|
7587
|
+
const isSelected = selectedNodeId === id;
|
|
7588
|
+
const isDropTarget = dropTargetNodeId === id;
|
|
7589
|
+
const [isHovered, setIsHovered] = React19.useState(false);
|
|
7590
|
+
const [isMenuOpen, setIsMenuOpen] = React19.useState(false);
|
|
7591
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7592
|
+
"div",
|
|
7593
|
+
{
|
|
7594
|
+
style: { width: NODE_WIDTH },
|
|
7595
|
+
className: cn(
|
|
7596
|
+
"bg-card dark:bg-muted relative rounded-xl border shadow-sm transition-all",
|
|
7597
|
+
"border-border/60",
|
|
7598
|
+
isSelected && "ring-primary ring-2 ring-offset-2 dark:ring-offset-zinc-900",
|
|
7599
|
+
isDropTarget && "ring-primary/50 border-primary scale-105 ring-2"
|
|
7600
|
+
),
|
|
7601
|
+
onMouseEnter: () => setIsHovered(true),
|
|
7602
|
+
onMouseLeave: () => setIsHovered(false),
|
|
7603
|
+
children: [
|
|
7604
|
+
!data.isRoot && /* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { type: "target", position: react$1.Position.Top, className: "!bg-border !size-2 !rounded-full !border-0" }),
|
|
7605
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 px-4 py-3", children: [
|
|
7606
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "size-10 shrink-0", children: [
|
|
7607
|
+
data.avatarUrl && /* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: data.avatarUrl, alt: data.displayName ?? "" }),
|
|
7608
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "bg-primary/10 text-primary text-xs font-medium", children: getInitials(data.displayName) })
|
|
7609
|
+
] }),
|
|
7610
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
7611
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground truncate text-sm font-semibold", children: data.displayName ?? "Unknown" }),
|
|
7612
|
+
data.positionTitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground truncate text-xs", children: data.positionTitle })
|
|
7613
|
+
] }),
|
|
7614
|
+
editable && (isHovered || isMenuOpen) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nodrag nopan shrink-0", children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { open: isMenuOpen, onOpenChange: setIsMenuOpen, children: [
|
|
7615
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7616
|
+
Button,
|
|
7617
|
+
{
|
|
7618
|
+
variant: "ghost",
|
|
7619
|
+
size: "icon",
|
|
7620
|
+
className: "size-7 rounded-full",
|
|
7621
|
+
onClick: (e) => e.stopPropagation(),
|
|
7622
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Ellipsis, { className: "size-4" })
|
|
7623
|
+
}
|
|
7624
|
+
) }),
|
|
7625
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align: "start", side: "right", className: "translate-x-1 -translate-y-3.5", children: [
|
|
7626
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7627
|
+
DropdownMenuItem,
|
|
7628
|
+
{
|
|
7629
|
+
onClick: (e) => {
|
|
7630
|
+
e.stopPropagation();
|
|
7631
|
+
setIsMenuOpen(false);
|
|
7632
|
+
onEditNode(data);
|
|
7633
|
+
},
|
|
7634
|
+
children: [
|
|
7635
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "mr-2 size-3.5" }),
|
|
7636
|
+
"Edit Position"
|
|
7637
|
+
]
|
|
7638
|
+
}
|
|
7639
|
+
),
|
|
7640
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
7641
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7642
|
+
DropdownMenuItem,
|
|
7643
|
+
{
|
|
7644
|
+
className: "text-destructive hover:bg-destructive/10 focus:bg-destructive/10 hover:text-destructive\n focus:text-destructive data-[highlighted]:bg-destructive/10 data-[highlighted]:text-destructive",
|
|
7645
|
+
onClick: (e) => {
|
|
7646
|
+
e.stopPropagation();
|
|
7647
|
+
setIsMenuOpen(false);
|
|
7648
|
+
onRemoveNode(data);
|
|
7649
|
+
},
|
|
7650
|
+
children: [
|
|
7651
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "mr-2 size-3.5" }),
|
|
7652
|
+
"Remove from Chart"
|
|
7653
|
+
]
|
|
7654
|
+
}
|
|
7655
|
+
)
|
|
7656
|
+
] })
|
|
7657
|
+
] }) }) : data.childCount > 0 && /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "secondary", className: "shrink-0 text-[10px]", children: data.childCount })
|
|
7658
|
+
] }),
|
|
7659
|
+
/* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { type: "source", position: react$1.Position.Bottom, className: "!bg-border !size-2 !rounded-full !border-0" })
|
|
7660
|
+
]
|
|
7661
|
+
}
|
|
7662
|
+
);
|
|
7663
|
+
}
|
|
7664
|
+
var OrgChartNodeMemo = React19.memo(OrgChartNodeComponent);
|
|
7665
|
+
var FIT_VIEW_OPTIONS = { padding: 0.12 };
|
|
7666
|
+
function getDescendantIds(nodeId, nodes) {
|
|
7667
|
+
const descendants = /* @__PURE__ */ new Set();
|
|
7668
|
+
const queue = [nodeId];
|
|
7669
|
+
while (queue.length > 0) {
|
|
7670
|
+
const current = queue.pop();
|
|
7671
|
+
for (const n of nodes) {
|
|
7672
|
+
if (n.data.parentId === current && !descendants.has(n.id)) {
|
|
7673
|
+
descendants.add(n.id);
|
|
7674
|
+
queue.push(n.id);
|
|
7675
|
+
}
|
|
7676
|
+
}
|
|
7677
|
+
}
|
|
7678
|
+
return descendants;
|
|
7679
|
+
}
|
|
7680
|
+
function mergeWithMeasured(prev, layoutNodes) {
|
|
7681
|
+
const prevMap = new Map(prev.map((n) => [n.id, n]));
|
|
7682
|
+
return layoutNodes.map((n) => {
|
|
7683
|
+
const existing = prevMap.get(n.id);
|
|
7684
|
+
if (!existing) return n;
|
|
7685
|
+
return existing.data.isRoot !== n.data.isRoot ? n : { ...n, measured: existing.measured };
|
|
7686
|
+
});
|
|
7687
|
+
}
|
|
7688
|
+
function OrgChartInner({
|
|
7689
|
+
className,
|
|
7690
|
+
edges: controlledEdges,
|
|
7691
|
+
defaultEdges,
|
|
7692
|
+
isLoading = false,
|
|
7693
|
+
editable = true,
|
|
7694
|
+
onReparent,
|
|
7695
|
+
onAddToChart,
|
|
7696
|
+
onEditNode,
|
|
7697
|
+
onRemoveNode,
|
|
7698
|
+
onReparentSuccess,
|
|
7699
|
+
onReparentError
|
|
7700
|
+
}) {
|
|
7701
|
+
const isControlled = controlledEdges !== void 0;
|
|
7702
|
+
const {
|
|
7703
|
+
selectNode,
|
|
7704
|
+
clearSelection,
|
|
7705
|
+
setDraggedNodeId,
|
|
7706
|
+
setDropTargetNodeId
|
|
7707
|
+
} = useOrgChartContext();
|
|
7708
|
+
const [internalEdges, setInternalEdges] = React19.useState(defaultEdges ?? []);
|
|
7709
|
+
const defaultEdgesHash = React19.useMemo(
|
|
7710
|
+
() => defaultEdges?.map((e) => `${e.id}:${e.parentId}:${e.positionTitle ?? ""}:${e.displayName ?? ""}`).join(",") ?? "",
|
|
7711
|
+
[defaultEdges]
|
|
7712
|
+
);
|
|
7713
|
+
React19.useEffect(() => {
|
|
7714
|
+
if (!isControlled && defaultEdges) {
|
|
7715
|
+
setInternalEdges(defaultEdges);
|
|
7716
|
+
}
|
|
7717
|
+
}, [defaultEdgesHash]);
|
|
7718
|
+
const apiEdges = controlledEdges ?? internalEdges;
|
|
7719
|
+
const layout = React19.useMemo(() => apiEdges.length > 0 ? computeLayout(apiEdges) : null, [apiEdges]);
|
|
7720
|
+
const layoutNodes = layout?.nodes ?? [];
|
|
7721
|
+
const layoutEdges = layout?.edges ?? [];
|
|
7722
|
+
const isEmpty = apiEdges.length === 0 && !isLoading;
|
|
7723
|
+
const { fitView, getIntersectingNodes } = react$1.useReactFlow();
|
|
7724
|
+
const [nodes, setNodes, onNodesChange] = react$1.useNodesState([]);
|
|
7725
|
+
const [rfEdges, setRfEdges, onEdgesChange] = react$1.useEdgesState([]);
|
|
7726
|
+
const nodesHash = React19.useMemo(
|
|
7727
|
+
() => layoutNodes.map((n) => `${n.id}:${n.data.parentId ?? ""}:${n.data.positionTitle ?? ""}:${n.data.displayName ?? ""}`).join(","),
|
|
7728
|
+
[layoutNodes]
|
|
7729
|
+
);
|
|
7730
|
+
const edgesHash = React19.useMemo(() => layoutEdges.map((e) => `${e.id}:${e.source}:${e.target}`).join(","), [layoutEdges]);
|
|
7731
|
+
const fitViewRef = React19.useRef(fitView);
|
|
7732
|
+
fitViewRef.current = fitView;
|
|
7733
|
+
React19.useEffect(() => {
|
|
7734
|
+
setNodes((prev) => mergeWithMeasured(prev, layoutNodes));
|
|
7735
|
+
setRfEdges(layoutEdges);
|
|
7736
|
+
const raf = requestAnimationFrame(() => fitViewRef.current(FIT_VIEW_OPTIONS));
|
|
7737
|
+
return () => cancelAnimationFrame(raf);
|
|
7738
|
+
}, [nodesHash, edgesHash]);
|
|
7739
|
+
const draggedNodeRef = React19.useRef(null);
|
|
7740
|
+
const dropTargetIdRef = React19.useRef(null);
|
|
7741
|
+
const nodeTypes = React19.useMemo(() => ({ orgChartNode: OrgChartNodeMemo }), []);
|
|
7742
|
+
const edgeTypes = React19.useMemo(() => ({ orgChartEdge: OrgChartEdge }), []);
|
|
7743
|
+
const onNodeDragStart = React19.useCallback(
|
|
7744
|
+
(_, node) => {
|
|
7745
|
+
if (!editable) return;
|
|
7746
|
+
draggedNodeRef.current = node.id;
|
|
7747
|
+
setDraggedNodeId(node.id);
|
|
7748
|
+
},
|
|
7749
|
+
[editable, setDraggedNodeId]
|
|
7750
|
+
);
|
|
7751
|
+
const onNodeDrag = React19.useCallback(
|
|
7752
|
+
(_, node) => {
|
|
7753
|
+
if (!editable || !draggedNodeRef.current) return;
|
|
7754
|
+
const intersecting = getIntersectingNodes(node);
|
|
7755
|
+
const target = intersecting.find((n) => n.id !== node.id);
|
|
7756
|
+
const targetId = target?.id ?? null;
|
|
7757
|
+
if (targetId === dropTargetIdRef.current) return;
|
|
7758
|
+
dropTargetIdRef.current = targetId;
|
|
7759
|
+
setDropTargetNodeId(targetId);
|
|
7760
|
+
},
|
|
7761
|
+
[editable, getIntersectingNodes, setDropTargetNodeId]
|
|
7762
|
+
);
|
|
7763
|
+
const applyOptimisticReparent = React19.useCallback((childId, newParentId) => {
|
|
7764
|
+
setInternalEdges(
|
|
7765
|
+
(prev) => prev.map((e) => e.id === childId ? { ...e, parentId: newParentId } : e)
|
|
7766
|
+
);
|
|
7767
|
+
}, []);
|
|
7768
|
+
const snapBack = React19.useCallback(() => {
|
|
7769
|
+
setNodes((prev) => mergeWithMeasured(prev, layoutNodes));
|
|
7770
|
+
}, [layoutNodes, setNodes]);
|
|
7771
|
+
const onNodeDragStop = React19.useCallback(
|
|
7772
|
+
async (_, _node) => {
|
|
7773
|
+
if (!editable || !draggedNodeRef.current) return;
|
|
7774
|
+
const childId = draggedNodeRef.current;
|
|
7775
|
+
const newParentId = dropTargetIdRef.current;
|
|
7776
|
+
draggedNodeRef.current = null;
|
|
7777
|
+
dropTargetIdRef.current = null;
|
|
7778
|
+
setDraggedNodeId(null);
|
|
7779
|
+
setDropTargetNodeId(null);
|
|
7780
|
+
if (!newParentId || newParentId === childId) {
|
|
7781
|
+
snapBack();
|
|
7782
|
+
return;
|
|
7783
|
+
}
|
|
7784
|
+
if (getDescendantIds(childId, layoutNodes).has(newParentId)) {
|
|
7785
|
+
onReparentError?.("Cannot create circular reporting chain");
|
|
7786
|
+
snapBack();
|
|
7787
|
+
return;
|
|
7788
|
+
}
|
|
7789
|
+
const draggedData = layoutNodes.find((n) => n.id === childId)?.data;
|
|
7790
|
+
if (!draggedData || newParentId === draggedData.parentId) {
|
|
7791
|
+
snapBack();
|
|
7792
|
+
return;
|
|
7793
|
+
}
|
|
7794
|
+
const targetName = layoutNodes.find((n) => n.id === newParentId)?.data.displayName;
|
|
7795
|
+
const preserve = { positionTitle: draggedData.positionTitle };
|
|
7796
|
+
if (!isControlled) {
|
|
7797
|
+
const snapshotEdges = internalEdges;
|
|
7798
|
+
applyOptimisticReparent(childId, newParentId);
|
|
7799
|
+
try {
|
|
7800
|
+
await onReparent?.(childId, newParentId, preserve);
|
|
7801
|
+
onReparentSuccess?.(draggedData.displayName ?? "Member", targetName ?? "new manager");
|
|
7802
|
+
} catch (err) {
|
|
7803
|
+
console.error("[OrgChart] reparent failed", err);
|
|
7804
|
+
setInternalEdges(snapshotEdges);
|
|
7805
|
+
onReparentError?.("Failed to update reporting line");
|
|
7806
|
+
}
|
|
7807
|
+
} else {
|
|
7808
|
+
snapBack();
|
|
7809
|
+
try {
|
|
7810
|
+
await onReparent?.(childId, newParentId, preserve);
|
|
7811
|
+
onReparentSuccess?.(draggedData.displayName ?? "Member", targetName ?? "new manager");
|
|
7812
|
+
} catch (err) {
|
|
7813
|
+
console.error("[OrgChart] reparent failed", err);
|
|
7814
|
+
onReparentError?.("Failed to update reporting line");
|
|
7815
|
+
}
|
|
7816
|
+
}
|
|
7817
|
+
},
|
|
7818
|
+
[editable, isControlled, internalEdges, layoutNodes, onReparent, onReparentSuccess, onReparentError, applyOptimisticReparent, snapBack, setDraggedNodeId, setDropTargetNodeId]
|
|
7819
|
+
);
|
|
7820
|
+
const onNodeClick = React19.useCallback((_, node) => selectNode(node.id), [selectNode]);
|
|
7821
|
+
const onPaneClick = React19.useCallback(() => clearSelection(), [clearSelection]);
|
|
7822
|
+
const handleEditNode = React19.useCallback(
|
|
7823
|
+
(nodeData) => onEditNode?.(nodeData),
|
|
7824
|
+
[onEditNode]
|
|
7825
|
+
);
|
|
7826
|
+
const handleRemoveNode = React19.useCallback(
|
|
7827
|
+
(nodeData) => onRemoveNode?.(nodeData),
|
|
7828
|
+
[onRemoveNode]
|
|
7829
|
+
);
|
|
7830
|
+
if (isLoading) {
|
|
7831
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-card border-border/60 flex items-center justify-center rounded-xl border p-16", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "text-muted-foreground size-6 animate-spin" }) });
|
|
7832
|
+
}
|
|
7833
|
+
if (isEmpty) {
|
|
7834
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OrgChartEmpty, { editable, onAddRoot: onAddToChart ?? (() => {
|
|
7835
|
+
}) });
|
|
7836
|
+
}
|
|
7837
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NodeActionsProvider, { onEditNode: handleEditNode, onRemoveNode: handleRemoveNode, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("border-border/60 h-[600px] overflow-hidden rounded-xl border", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7838
|
+
react$1.ReactFlow,
|
|
7839
|
+
{
|
|
7840
|
+
nodes,
|
|
7841
|
+
edges: rfEdges,
|
|
7842
|
+
onNodesChange,
|
|
7843
|
+
onEdgesChange,
|
|
7844
|
+
onNodeClick,
|
|
7845
|
+
proOptions: { hideAttribution: true },
|
|
7846
|
+
onPaneClick,
|
|
7847
|
+
onNodeDragStart,
|
|
7848
|
+
onNodeDrag,
|
|
7849
|
+
onNodeDragStop,
|
|
7850
|
+
nodeTypes,
|
|
7851
|
+
edgeTypes,
|
|
7852
|
+
fitView: true,
|
|
7853
|
+
fitViewOptions: FIT_VIEW_OPTIONS,
|
|
7854
|
+
minZoom: 0.3,
|
|
7855
|
+
maxZoom: 1.5,
|
|
7856
|
+
nodesDraggable: editable,
|
|
7857
|
+
nodesConnectable: false,
|
|
7858
|
+
elementsSelectable: true,
|
|
7859
|
+
selectNodesOnDrag: false,
|
|
7860
|
+
panOnDrag: true,
|
|
7861
|
+
zoomOnScroll: true,
|
|
7862
|
+
preventScrolling: true,
|
|
7863
|
+
style: {
|
|
7864
|
+
"--xy-background-pattern-dots-color-default": "var(--color-border)",
|
|
7865
|
+
"--xy-edge-stroke-width-default": 2,
|
|
7866
|
+
"--xy-edge-stroke-default": "var(--color-border)",
|
|
7867
|
+
"--xy-edge-stroke-selected-default": "var(--color-foreground)",
|
|
7868
|
+
"--xy-attribution-background-color-default": "transparent"
|
|
7869
|
+
},
|
|
7870
|
+
attributionPosition: "bottom-left",
|
|
7871
|
+
children: [
|
|
7872
|
+
/* @__PURE__ */ jsxRuntime.jsx(react$1.Background, { variant: react$1.BackgroundVariant.Dots, gap: 20, size: 2 }),
|
|
7873
|
+
/* @__PURE__ */ jsxRuntime.jsx(FlowZoomPanel, { fitViewOptions: FIT_VIEW_OPTIONS })
|
|
7874
|
+
]
|
|
7875
|
+
}
|
|
7876
|
+
) }) });
|
|
7877
|
+
}
|
|
7878
|
+
function OrgChart(props) {
|
|
7879
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react$1.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(OrgChartProvider, { editable: props.editable ?? true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(OrgChartInner, { ...props }) }) }) });
|
|
7880
|
+
}
|
|
7881
|
+
|
|
7395
7882
|
exports.Alert = Alert;
|
|
7396
7883
|
exports.AlertDescription = AlertDescription;
|
|
7397
7884
|
exports.AlertDialog = AlertDialog;
|
|
@@ -7495,6 +7982,7 @@ exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
|
7495
7982
|
exports.Field = Field;
|
|
7496
7983
|
exports.FieldRow = FieldRow;
|
|
7497
7984
|
exports.FlickeringGrid = FlickeringGrid;
|
|
7985
|
+
exports.FlowZoomPanel = FlowZoomPanel;
|
|
7498
7986
|
exports.Form = Form;
|
|
7499
7987
|
exports.FormControl = FormControl;
|
|
7500
7988
|
exports.FormControlComponent = FormControl2;
|
|
@@ -7515,6 +8003,7 @@ exports.Label = Label;
|
|
|
7515
8003
|
exports.ModalPortalScope = ModalPortalScope;
|
|
7516
8004
|
exports.MotionGrid = MotionGrid;
|
|
7517
8005
|
exports.MultiSelect = MultiSelect;
|
|
8006
|
+
exports.OrgChart = OrgChart;
|
|
7518
8007
|
exports.PORTAL_ROOT_ID = PORTAL_ROOT_ID;
|
|
7519
8008
|
exports.PageHeader = PageHeader;
|
|
7520
8009
|
exports.Pagination = Pagination;
|