@constructive-io/ui 0.1.0 → 0.2.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/README.md +236 -0
- 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/combobox.d.ts +1 -1
- package/dist/components/combobox.js +49 -13
- 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.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 +2 -2
- 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/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 +1 -1
- 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 +348 -363
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -24
- package/dist/index.d.ts +22 -24
- package/dist/index.js +235 -250
- package/dist/index.js.map +1 -1
- package/package.json +12 -15
- 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,6 +30,7 @@ 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 cmdk = require('cmdk');
|
|
33
34
|
var combobox = require('@base-ui/react/combobox');
|
|
34
35
|
var react$1 = require('@remixicon/react');
|
|
35
36
|
var matchSorter = require('match-sorter');
|
|
@@ -57,7 +58,7 @@ function _interopNamespace(e) {
|
|
|
57
58
|
return Object.freeze(n);
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
var
|
|
61
|
+
var React19__namespace = /*#__PURE__*/_interopNamespace(React19);
|
|
61
62
|
var ResizablePrimitive__namespace = /*#__PURE__*/_interopNamespace(ResizablePrimitive);
|
|
62
63
|
|
|
63
64
|
// src/lib/utils.ts
|
|
@@ -105,22 +106,22 @@ function mergePropsWithRef(parentProps, childElement) {
|
|
|
105
106
|
return mergedProps;
|
|
106
107
|
}
|
|
107
108
|
function isSlottable(child) {
|
|
108
|
-
return
|
|
109
|
+
return React19__namespace.isValidElement(child);
|
|
109
110
|
}
|
|
110
|
-
var Slot =
|
|
111
|
+
var Slot = React19__namespace.forwardRef((props, forwardedRef) => {
|
|
111
112
|
const { children, ...slotProps } = props;
|
|
112
113
|
if (isSlottable(children)) {
|
|
113
114
|
const childProps = children.props;
|
|
114
115
|
const childRef = childProps.ref;
|
|
115
|
-
return
|
|
116
|
+
return React19__namespace.cloneElement(children, {
|
|
116
117
|
...mergeProps(slotProps, childProps),
|
|
117
118
|
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
|
|
118
119
|
});
|
|
119
120
|
}
|
|
120
|
-
if (
|
|
121
|
-
const childrenArray =
|
|
121
|
+
if (React19__namespace.Children.count(children) > 1) {
|
|
122
|
+
const childrenArray = React19__namespace.Children.toArray(children);
|
|
122
123
|
const slottableChild = childrenArray.find(
|
|
123
|
-
(child) =>
|
|
124
|
+
(child) => React19__namespace.isValidElement(child) && child.type === Slottable
|
|
124
125
|
);
|
|
125
126
|
if (slottableChild) {
|
|
126
127
|
const newElement = slottableChild.props.children;
|
|
@@ -128,12 +129,12 @@ var Slot = React20__namespace.forwardRef((props, forwardedRef) => {
|
|
|
128
129
|
const newElementProps = newElement.props;
|
|
129
130
|
const newChildren = childrenArray.map((child) => {
|
|
130
131
|
if (child === slottableChild) {
|
|
131
|
-
return
|
|
132
|
+
return React19__namespace.Children.count(newElementProps.children) > 1 ? React19__namespace.Children.only(null) : newElementProps.children;
|
|
132
133
|
}
|
|
133
134
|
return child;
|
|
134
135
|
});
|
|
135
136
|
const childRef = newElementProps.ref;
|
|
136
|
-
return
|
|
137
|
+
return React19__namespace.cloneElement(newElement, {
|
|
137
138
|
...mergeProps(slotProps, newElementProps),
|
|
138
139
|
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
|
|
139
140
|
children: newChildren
|
|
@@ -152,12 +153,12 @@ function useControllableState({
|
|
|
152
153
|
defaultProp,
|
|
153
154
|
onChange
|
|
154
155
|
}) {
|
|
155
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
156
|
+
const [uncontrolledValue, setUncontrolledValue] = React19.useState(defaultProp);
|
|
156
157
|
const isControlled = prop !== void 0;
|
|
157
158
|
const value = isControlled ? prop : uncontrolledValue;
|
|
158
|
-
const onChangeRef =
|
|
159
|
+
const onChangeRef = React19.useRef(onChange);
|
|
159
160
|
onChangeRef.current = onChange;
|
|
160
|
-
const setValue =
|
|
161
|
+
const setValue = React19.useCallback(
|
|
161
162
|
(newValue) => {
|
|
162
163
|
if (!isControlled) {
|
|
163
164
|
setUncontrolledValue(newValue);
|
|
@@ -333,12 +334,12 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
333
334
|
}
|
|
334
335
|
}
|
|
335
336
|
);
|
|
336
|
-
var Button =
|
|
337
|
+
var Button = React19__namespace.forwardRef(
|
|
337
338
|
({ className, variant, size, asChild, children, type = "button", ...props }, ref) => {
|
|
338
339
|
const buttonClasses = cn(buttonVariants({ className, size, variant }));
|
|
339
|
-
if (asChild &&
|
|
340
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
340
341
|
const childProps = children.props;
|
|
341
|
-
return
|
|
342
|
+
return React19__namespace.cloneElement(children, {
|
|
342
343
|
...props,
|
|
343
344
|
className: cn(buttonClasses, childProps.className),
|
|
344
345
|
"data-slot": "button"
|
|
@@ -374,7 +375,7 @@ var badgeVariants = classVarianceAuthority.cva(
|
|
|
374
375
|
}
|
|
375
376
|
}
|
|
376
377
|
);
|
|
377
|
-
var Badge =
|
|
378
|
+
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
379
|
Badge.displayName = "Badge";
|
|
379
380
|
function Label({ className, ...props }) {
|
|
380
381
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -480,13 +481,13 @@ var alertVariants = classVarianceAuthority.cva(
|
|
|
480
481
|
}
|
|
481
482
|
}
|
|
482
483
|
);
|
|
483
|
-
var Alert =
|
|
484
|
+
var Alert = React19__namespace.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, role: "alert", className: cn(alertVariants({ variant }), className), ...props }));
|
|
484
485
|
Alert.displayName = "Alert";
|
|
485
|
-
var AlertTitle =
|
|
486
|
+
var AlertTitle = React19__namespace.forwardRef(
|
|
486
487
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("h5", { ref, className: cn("mb-1 leading-none font-medium tracking-tight", className), ...props })
|
|
487
488
|
);
|
|
488
489
|
AlertTitle.displayName = "AlertTitle";
|
|
489
|
-
var AlertDescription =
|
|
490
|
+
var AlertDescription = React19__namespace.forwardRef(
|
|
490
491
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("text-sm [&_p]:leading-relaxed", className), ...props })
|
|
491
492
|
);
|
|
492
493
|
AlertDescription.displayName = "AlertDescription";
|
|
@@ -498,7 +499,7 @@ function Input({ className, size = "default", unstyled = false, ...props }) {
|
|
|
498
499
|
className: cn(
|
|
499
500
|
!unstyled && [
|
|
500
501
|
// Base layout
|
|
501
|
-
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base
|
|
502
|
+
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base transition-shadow",
|
|
502
503
|
// Inner shadow highlight
|
|
503
504
|
"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)]",
|
|
504
505
|
"not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)]",
|
|
@@ -544,7 +545,7 @@ function Textarea({ className, size = "default", unstyled = false, ...props }) {
|
|
|
544
545
|
className: cn(
|
|
545
546
|
!unstyled && [
|
|
546
547
|
// Base layout
|
|
547
|
-
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base
|
|
548
|
+
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base transition-shadow",
|
|
548
549
|
// Inner shadow highlight
|
|
549
550
|
"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)]",
|
|
550
551
|
"not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)]",
|
|
@@ -579,7 +580,7 @@ function Textarea({ className, size = "default", unstyled = false, ...props }) {
|
|
|
579
580
|
}
|
|
580
581
|
);
|
|
581
582
|
}
|
|
582
|
-
var Checkbox =
|
|
583
|
+
var Checkbox = React19__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
583
584
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
584
585
|
checkbox.Checkbox.Root,
|
|
585
586
|
{
|
|
@@ -686,7 +687,7 @@ function Switch({ className, ...props }) {
|
|
|
686
687
|
);
|
|
687
688
|
}
|
|
688
689
|
var PORTAL_ROOT_ID = "portal-root";
|
|
689
|
-
var PortalContext =
|
|
690
|
+
var PortalContext = React19__namespace.createContext({
|
|
690
691
|
layer: "base",
|
|
691
692
|
depth: 0,
|
|
692
693
|
floatingPortalStrategy: "root",
|
|
@@ -697,9 +698,9 @@ function ModalPortalScope({
|
|
|
697
698
|
floatingPortalStrategy = "nested",
|
|
698
699
|
floatingZIndex = "default"
|
|
699
700
|
}) {
|
|
700
|
-
const parentContext =
|
|
701
|
+
const parentContext = React19__namespace.useContext(PortalContext);
|
|
701
702
|
const depth = parentContext.layer === "modal" ? parentContext.depth + 1 : 0;
|
|
702
|
-
const value =
|
|
703
|
+
const value = React19__namespace.useMemo(
|
|
703
704
|
() => ({
|
|
704
705
|
layer: "modal",
|
|
705
706
|
depth,
|
|
@@ -711,14 +712,14 @@ function ModalPortalScope({
|
|
|
711
712
|
return /* @__PURE__ */ jsxRuntime.jsx(PortalContext.Provider, { value, children });
|
|
712
713
|
}
|
|
713
714
|
function usePortalContext() {
|
|
714
|
-
return
|
|
715
|
+
return React19__namespace.useContext(PortalContext);
|
|
715
716
|
}
|
|
716
717
|
function useInModalOverlay() {
|
|
717
|
-
return
|
|
718
|
+
return React19__namespace.useContext(PortalContext).layer === "modal";
|
|
718
719
|
}
|
|
719
720
|
function useRootPortalContainer() {
|
|
720
|
-
const [container, setContainer] =
|
|
721
|
-
|
|
721
|
+
const [container, setContainer] = React19__namespace.useState(null);
|
|
722
|
+
React19__namespace.useLayoutEffect(() => {
|
|
722
723
|
const el = document.getElementById(PORTAL_ROOT_ID);
|
|
723
724
|
setContainer(el);
|
|
724
725
|
}, []);
|
|
@@ -726,7 +727,7 @@ function useRootPortalContainer() {
|
|
|
726
727
|
}
|
|
727
728
|
function useFloatingOverlayPortalProps() {
|
|
728
729
|
const rootContainer = useRootPortalContainer();
|
|
729
|
-
const { floatingPortalStrategy, floatingZIndex } =
|
|
730
|
+
const { floatingPortalStrategy, floatingZIndex } = React19__namespace.useContext(PortalContext);
|
|
730
731
|
const container = floatingPortalStrategy === "nested" ? void 0 : rootContainer ?? null;
|
|
731
732
|
const zIndexClass = floatingZIndex === "elevated" ? "z-[var(--z-layer-floating-elevated)]" : "z-[var(--z-layer-floating)]";
|
|
732
733
|
return { container, zIndexClass };
|
|
@@ -765,14 +766,14 @@ function Select({ onValueChange, ...props }) {
|
|
|
765
766
|
}
|
|
766
767
|
);
|
|
767
768
|
}
|
|
768
|
-
var SelectTrigger =
|
|
769
|
+
var SelectTrigger = React19__namespace.forwardRef(
|
|
769
770
|
({ className, size = "default", children, ...props }, ref) => {
|
|
770
771
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
771
772
|
select.Select.Trigger,
|
|
772
773
|
{
|
|
773
774
|
ref,
|
|
774
775
|
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
|
|
776
|
+
"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
777
|
size === "sm" && "min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7",
|
|
777
778
|
size === "lg" && "min-h-10 sm:min-h-9",
|
|
778
779
|
className
|
|
@@ -906,10 +907,10 @@ function SelectSeparator({
|
|
|
906
907
|
}
|
|
907
908
|
);
|
|
908
909
|
}
|
|
909
|
-
function SelectGroup(props) {
|
|
910
|
+
function SelectGroup({ ...props }) {
|
|
910
911
|
return /* @__PURE__ */ jsxRuntime.jsx(select.Select.Group, { "data-slot": "select-group", ...props });
|
|
911
912
|
}
|
|
912
|
-
function SelectGroupLabel(props) {
|
|
913
|
+
function SelectGroupLabel({ ...props }) {
|
|
913
914
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
914
915
|
select.Select.GroupLabel,
|
|
915
916
|
{
|
|
@@ -1020,15 +1021,15 @@ function Progress({ className, value, ...props }) {
|
|
|
1020
1021
|
) });
|
|
1021
1022
|
}
|
|
1022
1023
|
var Form = reactHookForm.FormProvider;
|
|
1023
|
-
var FormFieldContext =
|
|
1024
|
+
var FormFieldContext = React19__namespace.createContext({});
|
|
1024
1025
|
var FormField = ({
|
|
1025
1026
|
...props
|
|
1026
1027
|
}) => {
|
|
1027
1028
|
return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
|
|
1028
1029
|
};
|
|
1029
1030
|
var useFormField = () => {
|
|
1030
|
-
const fieldContext =
|
|
1031
|
-
const itemContext =
|
|
1031
|
+
const fieldContext = React19__namespace.useContext(FormFieldContext);
|
|
1032
|
+
const itemContext = React19__namespace.useContext(FormItemContext);
|
|
1032
1033
|
const { getFieldState } = reactHookForm.useFormContext();
|
|
1033
1034
|
const formState = reactHookForm.useFormState({ name: fieldContext.name });
|
|
1034
1035
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1045,9 +1046,9 @@ var useFormField = () => {
|
|
|
1045
1046
|
...fieldState
|
|
1046
1047
|
};
|
|
1047
1048
|
};
|
|
1048
|
-
var FormItemContext =
|
|
1049
|
+
var FormItemContext = React19__namespace.createContext({});
|
|
1049
1050
|
function FormItem({ className, ...props }) {
|
|
1050
|
-
const id =
|
|
1051
|
+
const id = React19__namespace.useId();
|
|
1051
1052
|
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
1053
|
}
|
|
1053
1054
|
function FormLabel({ className, ...props }) {
|
|
@@ -1097,7 +1098,7 @@ function FormMessage({ className, ...props }) {
|
|
|
1097
1098
|
return /* @__PURE__ */ jsxRuntime.jsx("p", { "data-slot": "form-message", id: formMessageId, className: cn("text-destructive text-sm", className), ...props, children: body });
|
|
1098
1099
|
}
|
|
1099
1100
|
function FormControl2({ children, label, id, layout = "stacked", error, className }) {
|
|
1100
|
-
const generatedId =
|
|
1101
|
+
const generatedId = React19__namespace.useId();
|
|
1101
1102
|
const inputId = id || generatedId;
|
|
1102
1103
|
const errorId = error ? `${inputId}-error` : void 0;
|
|
1103
1104
|
const childProps = {
|
|
@@ -1108,7 +1109,7 @@ function FormControl2({ children, label, id, layout = "stacked", error, classNam
|
|
|
1108
1109
|
if (layout === "floating") {
|
|
1109
1110
|
childProps.placeholder = " ";
|
|
1110
1111
|
}
|
|
1111
|
-
const childWithProps =
|
|
1112
|
+
const childWithProps = React19__namespace.cloneElement(children, childProps);
|
|
1112
1113
|
if (layout === "floating") {
|
|
1113
1114
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-1", className), children: [
|
|
1114
1115
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1337,7 +1338,7 @@ function Tooltip({ delayDuration: _delayDuration, ...props }) {
|
|
|
1337
1338
|
return /* @__PURE__ */ jsxRuntime.jsx(tooltip.Tooltip.Root, { "data-slot": "tooltip", ...props });
|
|
1338
1339
|
}
|
|
1339
1340
|
function TooltipTrigger({ delay = 0, asChild, children, ...props }) {
|
|
1340
|
-
if (asChild &&
|
|
1341
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1341
1342
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1342
1343
|
tooltip.Tooltip.Trigger,
|
|
1343
1344
|
{
|
|
@@ -1345,7 +1346,7 @@ function TooltipTrigger({ delay = 0, asChild, children, ...props }) {
|
|
|
1345
1346
|
delay,
|
|
1346
1347
|
...props,
|
|
1347
1348
|
render: (triggerProps) => {
|
|
1348
|
-
return
|
|
1349
|
+
return React19__namespace.cloneElement(
|
|
1349
1350
|
children,
|
|
1350
1351
|
mergePropsWithRef(triggerProps, children)
|
|
1351
1352
|
);
|
|
@@ -1389,7 +1390,7 @@ function Popover({ ...props }) {
|
|
|
1389
1390
|
return /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Root, { "data-slot": "popover", ...props });
|
|
1390
1391
|
}
|
|
1391
1392
|
function PopoverTrigger({ asChild, nativeButton, children, ...props }) {
|
|
1392
|
-
if (asChild &&
|
|
1393
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1393
1394
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1394
1395
|
popover.Popover.Trigger,
|
|
1395
1396
|
{
|
|
@@ -1398,7 +1399,7 @@ function PopoverTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1398
1399
|
...props,
|
|
1399
1400
|
render: (triggerProps) => {
|
|
1400
1401
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
1401
|
-
return
|
|
1402
|
+
return React19__namespace.cloneElement(
|
|
1402
1403
|
children,
|
|
1403
1404
|
mergePropsWithRef(rest, children)
|
|
1404
1405
|
);
|
|
@@ -1454,7 +1455,7 @@ function PopoverContent({
|
|
|
1454
1455
|
function PopoverAnchor({ ...props }) {
|
|
1455
1456
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "popover-anchor", ...props });
|
|
1456
1457
|
}
|
|
1457
|
-
var ScrollArea =
|
|
1458
|
+
var ScrollArea = React19__namespace.forwardRef(
|
|
1458
1459
|
({ className, children, scrollFade = false, scrollbarGutter = false, ...props }, ref) => {
|
|
1459
1460
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1460
1461
|
scrollArea.ScrollArea.Root,
|
|
@@ -1521,7 +1522,7 @@ function DialogPortal({ keepMounted = true, ...props }) {
|
|
|
1521
1522
|
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Portal, { keepMounted, container, ...props, style });
|
|
1522
1523
|
}
|
|
1523
1524
|
function DialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
1524
|
-
if (asChild &&
|
|
1525
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1525
1526
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1526
1527
|
dialog.Dialog.Trigger,
|
|
1527
1528
|
{
|
|
@@ -1530,7 +1531,7 @@ function DialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1530
1531
|
...props,
|
|
1531
1532
|
render: (triggerProps) => {
|
|
1532
1533
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
1533
|
-
return
|
|
1534
|
+
return React19__namespace.cloneElement(
|
|
1534
1535
|
children,
|
|
1535
1536
|
mergePropsWithRef(rest, children)
|
|
1536
1537
|
);
|
|
@@ -1541,7 +1542,7 @@ function DialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1541
1542
|
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Trigger, { "data-slot": "dialog-trigger", nativeButton, ...props, children });
|
|
1542
1543
|
}
|
|
1543
1544
|
function DialogClose({ asChild, nativeButton, children, ...props }) {
|
|
1544
|
-
if (asChild &&
|
|
1545
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1545
1546
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1546
1547
|
dialog.Dialog.Close,
|
|
1547
1548
|
{
|
|
@@ -1550,7 +1551,7 @@ function DialogClose({ asChild, nativeButton, children, ...props }) {
|
|
|
1550
1551
|
...props,
|
|
1551
1552
|
render: (closeProps) => {
|
|
1552
1553
|
const { nativeButton: _, ...rest } = closeProps;
|
|
1553
|
-
return
|
|
1554
|
+
return React19__namespace.cloneElement(
|
|
1554
1555
|
children,
|
|
1555
1556
|
mergePropsWithRef(rest, children)
|
|
1556
1557
|
);
|
|
@@ -1705,7 +1706,7 @@ function AlertDialog({ ...props }) {
|
|
|
1705
1706
|
return /* @__PURE__ */ jsxRuntime.jsx(alertDialog.AlertDialog.Root, { "data-slot": "alert-dialog", ...props });
|
|
1706
1707
|
}
|
|
1707
1708
|
function AlertDialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
1708
|
-
if (asChild &&
|
|
1709
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1709
1710
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1710
1711
|
alertDialog.AlertDialog.Trigger,
|
|
1711
1712
|
{
|
|
@@ -1714,7 +1715,7 @@ function AlertDialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1714
1715
|
...props,
|
|
1715
1716
|
render: (triggerProps) => {
|
|
1716
1717
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
1717
|
-
return
|
|
1718
|
+
return React19__namespace.cloneElement(
|
|
1718
1719
|
children,
|
|
1719
1720
|
mergePropsWithRef(rest, children)
|
|
1720
1721
|
);
|
|
@@ -1845,7 +1846,7 @@ function DropdownMenuPortal({ ...props }) {
|
|
|
1845
1846
|
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Portal, { "data-slot": "dropdown-menu-portal", container, ...props });
|
|
1846
1847
|
}
|
|
1847
1848
|
function DropdownMenuTrigger({ asChild, nativeButton, children, ...props }) {
|
|
1848
|
-
if (asChild &&
|
|
1849
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1849
1850
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1850
1851
|
menu.Menu.Trigger,
|
|
1851
1852
|
{
|
|
@@ -1854,7 +1855,7 @@ function DropdownMenuTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1854
1855
|
...props,
|
|
1855
1856
|
render: (triggerProps) => {
|
|
1856
1857
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
1857
|
-
return
|
|
1858
|
+
return React19__namespace.cloneElement(
|
|
1858
1859
|
children,
|
|
1859
1860
|
mergePropsWithRef(rest, children)
|
|
1860
1861
|
);
|
|
@@ -1913,7 +1914,7 @@ function DropdownMenuItem({
|
|
|
1913
1914
|
data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0`,
|
|
1914
1915
|
className
|
|
1915
1916
|
);
|
|
1916
|
-
if (asChild &&
|
|
1917
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
1917
1918
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1918
1919
|
menu.Menu.Item,
|
|
1919
1920
|
{
|
|
@@ -1924,7 +1925,7 @@ function DropdownMenuItem({
|
|
|
1924
1925
|
render: (itemProps) => {
|
|
1925
1926
|
const childProps = children.props;
|
|
1926
1927
|
const itemOnClick = itemProps.onClick;
|
|
1927
|
-
return
|
|
1928
|
+
return React19__namespace.cloneElement(children, {
|
|
1928
1929
|
...itemProps,
|
|
1929
1930
|
className: cn(itemClassName, childProps.className),
|
|
1930
1931
|
onClick: (e) => {
|
|
@@ -2097,19 +2098,19 @@ function DropdownMenuSubContent({ className, ...props }) {
|
|
|
2097
2098
|
}
|
|
2098
2099
|
) }) });
|
|
2099
2100
|
}
|
|
2100
|
-
var SheetStackContext =
|
|
2101
|
+
var SheetStackContext = React19__namespace.createContext(void 0);
|
|
2101
2102
|
var SHEET_INDENT = 24;
|
|
2102
2103
|
var useSheetStack = () => {
|
|
2103
|
-
return
|
|
2104
|
+
return React19__namespace.useContext(SheetStackContext);
|
|
2104
2105
|
};
|
|
2105
|
-
var SheetNestingContext =
|
|
2106
|
+
var SheetNestingContext = React19__namespace.createContext({
|
|
2106
2107
|
level: 0,
|
|
2107
2108
|
parentSheetId: null
|
|
2108
2109
|
});
|
|
2109
|
-
var useSheetNesting = () =>
|
|
2110
|
-
var SheetContext =
|
|
2110
|
+
var useSheetNesting = () => React19__namespace.useContext(SheetNestingContext);
|
|
2111
|
+
var SheetContext = React19__namespace.createContext(void 0);
|
|
2111
2112
|
var useSheet = () => {
|
|
2112
|
-
const context =
|
|
2113
|
+
const context = React19__namespace.useContext(SheetContext);
|
|
2113
2114
|
if (!context) {
|
|
2114
2115
|
throw new Error("useSheet must be used within a Sheet");
|
|
2115
2116
|
}
|
|
@@ -2117,23 +2118,23 @@ var useSheet = () => {
|
|
|
2117
2118
|
};
|
|
2118
2119
|
var sheetIdCounter = 0;
|
|
2119
2120
|
function Sheet({ children, sheetId: providedId, ...props }) {
|
|
2120
|
-
const [isOpen, setIsOpen] =
|
|
2121
|
+
const [isOpen, setIsOpen] = React19__namespace.useState(props?.open ?? props?.defaultOpen ?? false);
|
|
2121
2122
|
const sheetStack = useSheetStack();
|
|
2122
2123
|
const nesting = useSheetNesting();
|
|
2123
|
-
const sheetIdRef =
|
|
2124
|
+
const sheetIdRef = React19__namespace.useRef(providedId ?? `sheet-${++sheetIdCounter}`);
|
|
2124
2125
|
const sheetId = sheetIdRef.current;
|
|
2125
2126
|
const depth = nesting.level;
|
|
2126
|
-
const onOpenChangeRef =
|
|
2127
|
+
const onOpenChangeRef = React19__namespace.useRef(props.onOpenChange);
|
|
2127
2128
|
onOpenChangeRef.current = props.onOpenChange;
|
|
2128
|
-
const close =
|
|
2129
|
+
const close = React19__namespace.useCallback(() => {
|
|
2129
2130
|
setIsOpen(false);
|
|
2130
2131
|
onOpenChangeRef.current?.(false);
|
|
2131
2132
|
}, []);
|
|
2132
|
-
const registerSheetRef =
|
|
2133
|
-
const unregisterSheetRef =
|
|
2133
|
+
const registerSheetRef = React19__namespace.useRef(sheetStack?.registerSheet);
|
|
2134
|
+
const unregisterSheetRef = React19__namespace.useRef(sheetStack?.unregisterSheet);
|
|
2134
2135
|
registerSheetRef.current = sheetStack?.registerSheet;
|
|
2135
2136
|
unregisterSheetRef.current = sheetStack?.unregisterSheet;
|
|
2136
|
-
|
|
2137
|
+
React19__namespace.useEffect(() => {
|
|
2137
2138
|
if (registerSheetRef.current && isOpen) {
|
|
2138
2139
|
if (document.activeElement instanceof HTMLElement) {
|
|
2139
2140
|
document.activeElement.blur();
|
|
@@ -2142,10 +2143,10 @@ function Sheet({ children, sheetId: providedId, ...props }) {
|
|
|
2142
2143
|
return () => unregisterSheetRef.current?.(sheetId);
|
|
2143
2144
|
}
|
|
2144
2145
|
}, [isOpen, sheetId, depth, close]);
|
|
2145
|
-
|
|
2146
|
+
React19__namespace.useEffect(() => {
|
|
2146
2147
|
if (props?.open !== void 0) setIsOpen(props.open);
|
|
2147
2148
|
}, [props?.open]);
|
|
2148
|
-
const handleOpenChange =
|
|
2149
|
+
const handleOpenChange = React19__namespace.useCallback((open, _eventDetails) => {
|
|
2149
2150
|
setIsOpen(open);
|
|
2150
2151
|
onOpenChangeRef.current?.(open);
|
|
2151
2152
|
}, []);
|
|
@@ -2165,7 +2166,7 @@ function Sheet({ children, sheetId: providedId, ...props }) {
|
|
|
2165
2166
|
) }) });
|
|
2166
2167
|
}
|
|
2167
2168
|
function SheetTrigger({ asChild, nativeButton, children, ...props }) {
|
|
2168
|
-
if (asChild &&
|
|
2169
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
2169
2170
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2170
2171
|
dialog.Dialog.Trigger,
|
|
2171
2172
|
{
|
|
@@ -2174,7 +2175,7 @@ function SheetTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
2174
2175
|
...props,
|
|
2175
2176
|
render: (triggerProps) => {
|
|
2176
2177
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
2177
|
-
return
|
|
2178
|
+
return React19__namespace.cloneElement(
|
|
2178
2179
|
children,
|
|
2179
2180
|
mergePropsWithRef(rest, children)
|
|
2180
2181
|
);
|
|
@@ -2185,7 +2186,7 @@ function SheetTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
2185
2186
|
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Trigger, { "data-slot": "sheet-trigger", nativeButton, ...props, children });
|
|
2186
2187
|
}
|
|
2187
2188
|
function SheetClose({ asChild, nativeButton, children, ...props }) {
|
|
2188
|
-
if (asChild &&
|
|
2189
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
2189
2190
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2190
2191
|
dialog.Dialog.Close,
|
|
2191
2192
|
{
|
|
@@ -2194,7 +2195,7 @@ function SheetClose({ asChild, nativeButton, children, ...props }) {
|
|
|
2194
2195
|
...props,
|
|
2195
2196
|
render: (closeProps) => {
|
|
2196
2197
|
const { nativeButton: _, ...rest } = closeProps;
|
|
2197
|
-
return
|
|
2198
|
+
return React19__namespace.cloneElement(
|
|
2198
2199
|
children,
|
|
2199
2200
|
mergePropsWithRef(rest, children)
|
|
2200
2201
|
);
|
|
@@ -2311,8 +2312,8 @@ function SheetContent({
|
|
|
2311
2312
|
const topSheetSize = topSheetId ? sheetStack?.getSheetSize(topSheetId) : void 0;
|
|
2312
2313
|
const collapseBaseSize = topSheetSize ? resolvedSide === "left" || resolvedSide === "right" ? topSheetSize.width : topSheetSize.height : void 0;
|
|
2313
2314
|
const pushOffset = getPushOffset(resolvedSide, sheetsAbove, stackMode, collapseBaseSize ?? NESTED_SHEET_WIDTH);
|
|
2314
|
-
const contentRef =
|
|
2315
|
-
|
|
2315
|
+
const contentRef = React19__namespace.useRef(null);
|
|
2316
|
+
React19__namespace.useLayoutEffect(() => {
|
|
2316
2317
|
if (!isOpen) return;
|
|
2317
2318
|
if (!sheetStack) return;
|
|
2318
2319
|
const el = contentRef.current;
|
|
@@ -2343,11 +2344,11 @@ function SheetContent({
|
|
|
2343
2344
|
duration: durations.normal,
|
|
2344
2345
|
ease: easings.physicalExit
|
|
2345
2346
|
};
|
|
2346
|
-
const isTargetInsideSheet =
|
|
2347
|
+
const isTargetInsideSheet = React19__namespace.useCallback((target) => {
|
|
2347
2348
|
if (!target || !(target instanceof HTMLElement)) return false;
|
|
2348
2349
|
return !!target.closest('[data-slot="sheet-content"]');
|
|
2349
2350
|
}, []);
|
|
2350
|
-
const isTargetInsidePopup =
|
|
2351
|
+
const isTargetInsidePopup = React19__namespace.useCallback((target) => {
|
|
2351
2352
|
if (!target || !(target instanceof HTMLElement)) return false;
|
|
2352
2353
|
return !!target.closest(
|
|
2353
2354
|
[
|
|
@@ -2360,7 +2361,7 @@ function SheetContent({
|
|
|
2360
2361
|
].join(", ")
|
|
2361
2362
|
);
|
|
2362
2363
|
}, []);
|
|
2363
|
-
|
|
2364
|
+
React19__namespace.useEffect(() => {
|
|
2364
2365
|
if (!isOpen) return;
|
|
2365
2366
|
const handlePointerDown = (event) => {
|
|
2366
2367
|
if (sheetsAbove > 0) return;
|
|
@@ -2502,7 +2503,7 @@ function DrawerOverlay({ className, ...props }) {
|
|
|
2502
2503
|
);
|
|
2503
2504
|
}
|
|
2504
2505
|
function DrawerContent({ className, children, ...props }) {
|
|
2505
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(DrawerPortal, {
|
|
2506
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DrawerPortal, { children: [
|
|
2506
2507
|
/* @__PURE__ */ jsxRuntime.jsx(DrawerOverlay, {}),
|
|
2507
2508
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2508
2509
|
vaul.Drawer.Content,
|
|
@@ -2622,7 +2623,7 @@ function Collapsible({
|
|
|
2622
2623
|
}
|
|
2623
2624
|
);
|
|
2624
2625
|
}
|
|
2625
|
-
var CollapsibleTrigger =
|
|
2626
|
+
var CollapsibleTrigger = React19__namespace.forwardRef(({ className, asChild, nativeButton, children, ...props }, ref) => {
|
|
2626
2627
|
const triggerClassName = cn(
|
|
2627
2628
|
"group/trigger flex w-full cursor-pointer items-center justify-between text-sm font-medium outline-none transition-colors",
|
|
2628
2629
|
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
|
|
@@ -2631,7 +2632,7 @@ var CollapsibleTrigger = React20__namespace.forwardRef(({ className, asChild, na
|
|
|
2631
2632
|
"[&[data-panel-open]_[data-slot=collapsible-icon]]:rotate-180",
|
|
2632
2633
|
className
|
|
2633
2634
|
);
|
|
2634
|
-
if (asChild &&
|
|
2635
|
+
if (asChild && React19__namespace.isValidElement(children)) {
|
|
2635
2636
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2636
2637
|
collapsible.Collapsible.Trigger,
|
|
2637
2638
|
{
|
|
@@ -2642,7 +2643,7 @@ var CollapsibleTrigger = React20__namespace.forwardRef(({ className, asChild, na
|
|
|
2642
2643
|
render: (triggerProps) => {
|
|
2643
2644
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
2644
2645
|
const childProps = children.props;
|
|
2645
|
-
return
|
|
2646
|
+
return React19__namespace.cloneElement(
|
|
2646
2647
|
children,
|
|
2647
2648
|
{
|
|
2648
2649
|
...rest,
|
|
@@ -2666,7 +2667,7 @@ var CollapsibleTrigger = React20__namespace.forwardRef(({ className, asChild, na
|
|
|
2666
2667
|
);
|
|
2667
2668
|
});
|
|
2668
2669
|
CollapsibleTrigger.displayName = "CollapsibleTrigger";
|
|
2669
|
-
var CollapsiblePanel =
|
|
2670
|
+
var CollapsiblePanel = React19__namespace.forwardRef(
|
|
2670
2671
|
({ className, innerClassName, children, ...props }, ref) => {
|
|
2671
2672
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2672
2673
|
collapsible.Collapsible.Panel,
|
|
@@ -3074,35 +3075,6 @@ function AutocompleteSeparator({
|
|
|
3074
3075
|
}
|
|
3075
3076
|
);
|
|
3076
3077
|
}
|
|
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
3078
|
function AutocompleteEmpty({
|
|
3107
3079
|
className,
|
|
3108
3080
|
...props
|
|
@@ -3119,22 +3091,6 @@ function AutocompleteEmpty({
|
|
|
3119
3091
|
}
|
|
3120
3092
|
);
|
|
3121
3093
|
}
|
|
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
3094
|
function AutocompleteClear({
|
|
3139
3095
|
className,
|
|
3140
3096
|
...props
|
|
@@ -3165,49 +3121,46 @@ function AutocompleteTrigger({
|
|
|
3165
3121
|
}
|
|
3166
3122
|
);
|
|
3167
3123
|
}
|
|
3168
|
-
var CommandInputContext = React20__namespace.createContext({
|
|
3169
|
-
inputRef: null
|
|
3170
|
-
});
|
|
3171
|
-
dialog.Dialog.Root;
|
|
3172
3124
|
function Command({
|
|
3173
|
-
|
|
3174
|
-
keepHighlight = true,
|
|
3175
|
-
open = true,
|
|
3125
|
+
className,
|
|
3176
3126
|
...props
|
|
3177
3127
|
}) {
|
|
3178
|
-
const AutocompleteAny = Autocomplete;
|
|
3179
3128
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3180
|
-
|
|
3129
|
+
cmdk.Command,
|
|
3181
3130
|
{
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3131
|
+
className: cn(
|
|
3132
|
+
"flex h-full w-full flex-col overflow-hidden rounded-2xl",
|
|
3133
|
+
className
|
|
3134
|
+
),
|
|
3135
|
+
"data-slot": "command",
|
|
3185
3136
|
...props
|
|
3186
3137
|
}
|
|
3187
3138
|
);
|
|
3188
3139
|
}
|
|
3189
3140
|
function CommandInput({
|
|
3190
3141
|
className,
|
|
3191
|
-
placeholder
|
|
3192
|
-
value,
|
|
3193
|
-
onValueChange,
|
|
3142
|
+
placeholder,
|
|
3194
3143
|
...props
|
|
3195
3144
|
}) {
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
AutocompleteInput,
|
|
3145
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2.5 py-1.5", "data-slot": "command-input-wrapper", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3146
|
+
"div",
|
|
3199
3147
|
{
|
|
3200
3148
|
className: cn(
|
|
3201
|
-
"
|
|
3149
|
+
"flex items-center gap-2 rounded-lg px-3 text-base",
|
|
3202
3150
|
className
|
|
3203
3151
|
),
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3152
|
+
children: [
|
|
3153
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "size-4 shrink-0 text-muted-foreground" }),
|
|
3154
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3155
|
+
cmdk.Command.Input,
|
|
3156
|
+
{
|
|
3157
|
+
className: "flex h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
3158
|
+
placeholder,
|
|
3159
|
+
"data-slot": "command-input",
|
|
3160
|
+
...props
|
|
3161
|
+
}
|
|
3162
|
+
)
|
|
3163
|
+
]
|
|
3211
3164
|
}
|
|
3212
3165
|
) });
|
|
3213
3166
|
}
|
|
@@ -3216,9 +3169,9 @@ function CommandList({
|
|
|
3216
3169
|
...props
|
|
3217
3170
|
}) {
|
|
3218
3171
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3219
|
-
|
|
3172
|
+
cmdk.Command.List,
|
|
3220
3173
|
{
|
|
3221
|
-
className: cn("not-empty:scroll-py-2 not-empty:p-2", className),
|
|
3174
|
+
className: cn("not-empty:scroll-py-2 not-empty:p-2 max-h-[300px] overflow-y-auto overflow-x-hidden", className),
|
|
3222
3175
|
"data-slot": "command-list",
|
|
3223
3176
|
...props
|
|
3224
3177
|
}
|
|
@@ -3229,7 +3182,7 @@ function CommandEmpty({
|
|
|
3229
3182
|
...props
|
|
3230
3183
|
}) {
|
|
3231
3184
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3232
|
-
|
|
3185
|
+
cmdk.Command.Empty,
|
|
3233
3186
|
{
|
|
3234
3187
|
className: cn("not-empty:py-6", className),
|
|
3235
3188
|
"data-slot": "command-empty",
|
|
@@ -3243,29 +3196,17 @@ function CommandGroup({
|
|
|
3243
3196
|
children,
|
|
3244
3197
|
...props
|
|
3245
3198
|
}) {
|
|
3246
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
3247
|
-
|
|
3199
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3200
|
+
cmdk.Command.Group,
|
|
3248
3201
|
{
|
|
3249
|
-
className
|
|
3202
|
+
className: cn(
|
|
3203
|
+
"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",
|
|
3204
|
+
className
|
|
3205
|
+
),
|
|
3206
|
+
heading,
|
|
3250
3207
|
"data-slot": "command-group",
|
|
3251
3208
|
...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
|
|
3209
|
+
children
|
|
3269
3210
|
}
|
|
3270
3211
|
);
|
|
3271
3212
|
}
|
|
@@ -3274,20 +3215,23 @@ function CommandItem({
|
|
|
3274
3215
|
...props
|
|
3275
3216
|
}) {
|
|
3276
3217
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3277
|
-
|
|
3218
|
+
cmdk.Command.Item,
|
|
3278
3219
|
{
|
|
3279
|
-
className: cn(
|
|
3220
|
+
className: cn(
|
|
3221
|
+
"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",
|
|
3222
|
+
className
|
|
3223
|
+
),
|
|
3280
3224
|
"data-slot": "command-item",
|
|
3281
3225
|
...props
|
|
3282
3226
|
}
|
|
3283
3227
|
);
|
|
3284
3228
|
}
|
|
3285
|
-
var ComboboxContext =
|
|
3229
|
+
var ComboboxContext = React19__namespace.createContext({
|
|
3286
3230
|
chipsRef: null,
|
|
3287
3231
|
multiple: false
|
|
3288
3232
|
});
|
|
3289
3233
|
function Combobox(props) {
|
|
3290
|
-
const chipsRef =
|
|
3234
|
+
const chipsRef = React19__namespace.useRef(null);
|
|
3291
3235
|
return /* @__PURE__ */ jsxRuntime.jsx(ComboboxContext.Provider, { value: { chipsRef, multiple: !!props.multiple }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3292
3236
|
combobox.Combobox.Root,
|
|
3293
3237
|
{
|
|
@@ -3303,7 +3247,7 @@ function ComboboxInput({
|
|
|
3303
3247
|
size,
|
|
3304
3248
|
...props
|
|
3305
3249
|
}) {
|
|
3306
|
-
const { multiple } =
|
|
3250
|
+
const { multiple } = React19__namespace.useContext(ComboboxContext);
|
|
3307
3251
|
const sizeValue = size ?? "default";
|
|
3308
3252
|
if (multiple) {
|
|
3309
3253
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3385,7 +3329,7 @@ function ComboboxPopup({
|
|
|
3385
3329
|
sideOffset = 4,
|
|
3386
3330
|
...props
|
|
3387
3331
|
}) {
|
|
3388
|
-
const { chipsRef, multiple } =
|
|
3332
|
+
const { chipsRef, multiple } = React19__namespace.useContext(ComboboxContext);
|
|
3389
3333
|
const { container, zIndexClass } = useFloatingOverlayPortalProps();
|
|
3390
3334
|
return /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3391
3335
|
combobox.Combobox.Positioner,
|
|
@@ -3463,7 +3407,10 @@ function ComboboxSeparator({
|
|
|
3463
3407
|
}
|
|
3464
3408
|
);
|
|
3465
3409
|
}
|
|
3466
|
-
function ComboboxGroup({
|
|
3410
|
+
function ComboboxGroup({
|
|
3411
|
+
className,
|
|
3412
|
+
...props
|
|
3413
|
+
}) {
|
|
3467
3414
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3468
3415
|
combobox.Combobox.Group,
|
|
3469
3416
|
{
|
|
@@ -3473,7 +3420,10 @@ function ComboboxGroup({ className, ...props }) {
|
|
|
3473
3420
|
}
|
|
3474
3421
|
);
|
|
3475
3422
|
}
|
|
3476
|
-
function ComboboxEmpty({
|
|
3423
|
+
function ComboboxEmpty({
|
|
3424
|
+
className,
|
|
3425
|
+
...props
|
|
3426
|
+
}) {
|
|
3477
3427
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3478
3428
|
combobox.Combobox.Empty,
|
|
3479
3429
|
{
|
|
@@ -3486,7 +3436,10 @@ function ComboboxEmpty({ className, ...props }) {
|
|
|
3486
3436
|
}
|
|
3487
3437
|
);
|
|
3488
3438
|
}
|
|
3489
|
-
function ComboboxList({
|
|
3439
|
+
function ComboboxList({
|
|
3440
|
+
className,
|
|
3441
|
+
...props
|
|
3442
|
+
}) {
|
|
3490
3443
|
return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { scrollbarGutter: true, scrollFade: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3491
3444
|
combobox.Combobox.List,
|
|
3492
3445
|
{
|
|
@@ -3499,7 +3452,10 @@ function ComboboxList({ className, ...props }) {
|
|
|
3499
3452
|
}
|
|
3500
3453
|
) });
|
|
3501
3454
|
}
|
|
3502
|
-
function ComboboxClear({
|
|
3455
|
+
function ComboboxClear({
|
|
3456
|
+
className,
|
|
3457
|
+
...props
|
|
3458
|
+
}) {
|
|
3503
3459
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3504
3460
|
combobox.Combobox.Clear,
|
|
3505
3461
|
{
|
|
@@ -3575,7 +3531,7 @@ function OptionItem({
|
|
|
3575
3531
|
}
|
|
3576
3532
|
);
|
|
3577
3533
|
}
|
|
3578
|
-
var MultiSelect =
|
|
3534
|
+
var MultiSelect = React19__namespace.forwardRef(
|
|
3579
3535
|
({
|
|
3580
3536
|
options,
|
|
3581
3537
|
onValueChange,
|
|
@@ -3601,38 +3557,38 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3601
3557
|
onClick,
|
|
3602
3558
|
...props
|
|
3603
3559
|
}, ref) => {
|
|
3604
|
-
const [selectedValues, setSelectedValues] =
|
|
3605
|
-
const [isPopoverOpen, setIsPopoverOpen] =
|
|
3606
|
-
const [searchValue, setSearchValue] =
|
|
3607
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
3608
|
-
const multiSelectId =
|
|
3560
|
+
const [selectedValues, setSelectedValues] = React19__namespace.useState(defaultValue);
|
|
3561
|
+
const [isPopoverOpen, setIsPopoverOpen] = React19__namespace.useState(false);
|
|
3562
|
+
const [searchValue, setSearchValue] = React19__namespace.useState("");
|
|
3563
|
+
const [highlightedIndex, setHighlightedIndex] = React19__namespace.useState(-1);
|
|
3564
|
+
const multiSelectId = React19__namespace.useId();
|
|
3609
3565
|
const listboxId = `${multiSelectId}-listbox`;
|
|
3610
3566
|
const triggerDescriptionId = `${multiSelectId}-description`;
|
|
3611
3567
|
const selectedCountId = `${multiSelectId}-count`;
|
|
3612
3568
|
const searchInputId = `${multiSelectId}-search`;
|
|
3613
|
-
const searchInputRef =
|
|
3614
|
-
const listRef =
|
|
3615
|
-
const prevDefaultValueRef =
|
|
3616
|
-
const isGroupedOptions =
|
|
3569
|
+
const searchInputRef = React19__namespace.useRef(null);
|
|
3570
|
+
const listRef = React19__namespace.useRef(null);
|
|
3571
|
+
const prevDefaultValueRef = React19__namespace.useRef(defaultValue);
|
|
3572
|
+
const isGroupedOptions = React19__namespace.useCallback(
|
|
3617
3573
|
(opts) => {
|
|
3618
3574
|
return opts.length > 0 && "heading" in opts[0];
|
|
3619
3575
|
},
|
|
3620
3576
|
[]
|
|
3621
3577
|
);
|
|
3622
|
-
const arraysEqual =
|
|
3578
|
+
const arraysEqual = React19__namespace.useCallback((a, b) => {
|
|
3623
3579
|
if (a.length !== b.length) return false;
|
|
3624
3580
|
const sortedA = [...a].sort();
|
|
3625
3581
|
const sortedB = [...b].sort();
|
|
3626
3582
|
return sortedA.every((val, index) => val === sortedB[index]);
|
|
3627
3583
|
}, []);
|
|
3628
|
-
const resetToDefault =
|
|
3584
|
+
const resetToDefault = React19__namespace.useCallback(() => {
|
|
3629
3585
|
setSelectedValues(defaultValue);
|
|
3630
3586
|
setIsPopoverOpen(false);
|
|
3631
3587
|
setSearchValue("");
|
|
3632
3588
|
onValueChange(defaultValue);
|
|
3633
3589
|
}, [defaultValue, onValueChange]);
|
|
3634
|
-
const buttonRef =
|
|
3635
|
-
|
|
3590
|
+
const buttonRef = React19__namespace.useRef(null);
|
|
3591
|
+
React19__namespace.useImperativeHandle(
|
|
3636
3592
|
ref,
|
|
3637
3593
|
() => ({
|
|
3638
3594
|
reset: resetToDefault,
|
|
@@ -3663,8 +3619,8 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3663
3619
|
}),
|
|
3664
3620
|
[resetToDefault, selectedValues, onValueChange]
|
|
3665
3621
|
);
|
|
3666
|
-
const [screenSize, setScreenSize] =
|
|
3667
|
-
|
|
3622
|
+
const [screenSize, setScreenSize] = React19__namespace.useState("desktop");
|
|
3623
|
+
React19__namespace.useEffect(() => {
|
|
3668
3624
|
if (typeof window === "undefined") return;
|
|
3669
3625
|
const handleResize = () => {
|
|
3670
3626
|
const width = window.innerWidth;
|
|
@@ -3713,7 +3669,7 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3713
3669
|
};
|
|
3714
3670
|
};
|
|
3715
3671
|
const responsiveSettings = getResponsiveSettings();
|
|
3716
|
-
const getAllOptions =
|
|
3672
|
+
const getAllOptions = React19__namespace.useCallback(() => {
|
|
3717
3673
|
if (options.length === 0) return [];
|
|
3718
3674
|
let allOptions;
|
|
3719
3675
|
if (isGroupedOptions(options)) {
|
|
@@ -3743,7 +3699,7 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3743
3699
|
}
|
|
3744
3700
|
return deduplicateOptions ? uniqueOptions : allOptions;
|
|
3745
3701
|
}, [options, deduplicateOptions, isGroupedOptions]);
|
|
3746
|
-
const getOptionByValue =
|
|
3702
|
+
const getOptionByValue = React19__namespace.useCallback(
|
|
3747
3703
|
(value) => {
|
|
3748
3704
|
const option = getAllOptions().find((option2) => option2.value === value);
|
|
3749
3705
|
if (!option && process.env.NODE_ENV === "development") {
|
|
@@ -3753,7 +3709,7 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3753
3709
|
},
|
|
3754
3710
|
[getAllOptions]
|
|
3755
3711
|
);
|
|
3756
|
-
const filteredOptions =
|
|
3712
|
+
const filteredOptions = React19__namespace.useMemo(() => {
|
|
3757
3713
|
if (!searchable || !searchValue) return options;
|
|
3758
3714
|
if (options.length === 0) return [];
|
|
3759
3715
|
if (isGroupedOptions(options)) {
|
|
@@ -3768,13 +3724,13 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3768
3724
|
(option) => option.label.toLowerCase().includes(searchValue.toLowerCase()) || option.value.toLowerCase().includes(searchValue.toLowerCase())
|
|
3769
3725
|
);
|
|
3770
3726
|
}, [options, searchValue, searchable, isGroupedOptions]);
|
|
3771
|
-
const flatFilteredOptions =
|
|
3727
|
+
const flatFilteredOptions = React19__namespace.useMemo(() => {
|
|
3772
3728
|
if (isGroupedOptions(filteredOptions)) {
|
|
3773
3729
|
return filteredOptions.flatMap((group) => group.options);
|
|
3774
3730
|
}
|
|
3775
3731
|
return filteredOptions;
|
|
3776
3732
|
}, [filteredOptions, isGroupedOptions]);
|
|
3777
|
-
const toggleOption =
|
|
3733
|
+
const toggleOption = React19__namespace.useCallback(
|
|
3778
3734
|
(optionValue) => {
|
|
3779
3735
|
if (disabled) return;
|
|
3780
3736
|
const option = getOptionByValue(optionValue);
|
|
@@ -3803,7 +3759,7 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3803
3759
|
setSelectedValues(newSelectedValues);
|
|
3804
3760
|
onValueChange(newSelectedValues);
|
|
3805
3761
|
};
|
|
3806
|
-
const handleKeyDown =
|
|
3762
|
+
const handleKeyDown = React19__namespace.useCallback(
|
|
3807
3763
|
(event) => {
|
|
3808
3764
|
const optionsCount = flatFilteredOptions.length;
|
|
3809
3765
|
if (optionsCount === 0) return;
|
|
@@ -3841,7 +3797,7 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3841
3797
|
},
|
|
3842
3798
|
[flatFilteredOptions, highlightedIndex, toggleOption, searchValue, selectedValues, onValueChange]
|
|
3843
3799
|
);
|
|
3844
|
-
|
|
3800
|
+
React19__namespace.useEffect(() => {
|
|
3845
3801
|
if (!resetOnDefaultValueChange) return;
|
|
3846
3802
|
const prevDefaultValue = prevDefaultValueRef.current;
|
|
3847
3803
|
if (!arraysEqual(prevDefaultValue, defaultValue)) {
|
|
@@ -3862,17 +3818,17 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3862
3818
|
};
|
|
3863
3819
|
};
|
|
3864
3820
|
const widthConstraints = getWidthConstraints();
|
|
3865
|
-
const effectiveDropdownMaxHeight =
|
|
3821
|
+
const effectiveDropdownMaxHeight = React19__namespace.useMemo(() => {
|
|
3866
3822
|
if (dropdownMaxHeight) return dropdownMaxHeight;
|
|
3867
3823
|
return screenSize === "mobile" ? "70vh" : "60vh";
|
|
3868
3824
|
}, [dropdownMaxHeight, screenSize]);
|
|
3869
|
-
|
|
3825
|
+
React19__namespace.useEffect(() => {
|
|
3870
3826
|
if (!isPopoverOpen) {
|
|
3871
3827
|
setSearchValue("");
|
|
3872
3828
|
setHighlightedIndex(-1);
|
|
3873
3829
|
}
|
|
3874
3830
|
}, [isPopoverOpen]);
|
|
3875
|
-
|
|
3831
|
+
React19__namespace.useEffect(() => {
|
|
3876
3832
|
if (isPopoverOpen && searchable && searchInputRef.current) {
|
|
3877
3833
|
const timer = setTimeout(() => {
|
|
3878
3834
|
searchInputRef.current?.focus();
|
|
@@ -3880,10 +3836,10 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
3880
3836
|
return () => clearTimeout(timer);
|
|
3881
3837
|
}
|
|
3882
3838
|
}, [isPopoverOpen, searchable]);
|
|
3883
|
-
|
|
3839
|
+
React19__namespace.useEffect(() => {
|
|
3884
3840
|
setHighlightedIndex(flatFilteredOptions.length > 0 ? 0 : -1);
|
|
3885
3841
|
}, [searchValue, flatFilteredOptions.length]);
|
|
3886
|
-
const totalFilteredCount =
|
|
3842
|
+
const totalFilteredCount = React19__namespace.useMemo(() => {
|
|
3887
3843
|
if (isGroupedOptions(filteredOptions)) {
|
|
3888
3844
|
return filteredOptions.reduce((acc, group) => acc + group.options.length, 0);
|
|
3889
3845
|
}
|
|
@@ -4166,7 +4122,7 @@ var MultiSelect = React20__namespace.forwardRef(
|
|
|
4166
4122
|
}
|
|
4167
4123
|
);
|
|
4168
4124
|
MultiSelect.displayName = "MultiSelect";
|
|
4169
|
-
var TagsContext =
|
|
4125
|
+
var TagsContext = React19.createContext({
|
|
4170
4126
|
value: void 0,
|
|
4171
4127
|
setValue: void 0,
|
|
4172
4128
|
open: false,
|
|
@@ -4176,7 +4132,7 @@ var TagsContext = React20.createContext({
|
|
|
4176
4132
|
setWidth: void 0
|
|
4177
4133
|
});
|
|
4178
4134
|
var useTagsContext = () => {
|
|
4179
|
-
const context =
|
|
4135
|
+
const context = React19.useContext(TagsContext);
|
|
4180
4136
|
if (!context) {
|
|
4181
4137
|
throw new Error("useTagsContext must be used within a TagsProvider");
|
|
4182
4138
|
}
|
|
@@ -4190,12 +4146,12 @@ var Tags = ({
|
|
|
4190
4146
|
children,
|
|
4191
4147
|
className
|
|
4192
4148
|
}) => {
|
|
4193
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
4194
|
-
const [width, setWidth] =
|
|
4195
|
-
const ref =
|
|
4149
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React19.useState(false);
|
|
4150
|
+
const [width, setWidth] = React19.useState();
|
|
4151
|
+
const ref = React19.useRef(null);
|
|
4196
4152
|
const open = controlledOpen ?? uncontrolledOpen;
|
|
4197
4153
|
const onOpenChange = controlledOnOpenChange ?? setUncontrolledOpen;
|
|
4198
|
-
|
|
4154
|
+
React19.useEffect(() => {
|
|
4199
4155
|
if (!ref.current) {
|
|
4200
4156
|
return;
|
|
4201
4157
|
}
|
|
@@ -4245,8 +4201,8 @@ var TagsEmpty = ({ children, className: _className, ...props }) => /* @__PURE__
|
|
|
4245
4201
|
var TagsGroup = CommandGroup;
|
|
4246
4202
|
var TagsItem = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(CommandItem, { className: cn("cursor-pointer items-center justify-between", className), ...props });
|
|
4247
4203
|
function useDebounce(value, delay) {
|
|
4248
|
-
const [debouncedValue, setDebouncedValue] =
|
|
4249
|
-
|
|
4204
|
+
const [debouncedValue, setDebouncedValue] = React19.useState(value);
|
|
4205
|
+
React19.useEffect(() => {
|
|
4250
4206
|
const handler = setTimeout(() => {
|
|
4251
4207
|
setDebouncedValue(value);
|
|
4252
4208
|
}, delay);
|
|
@@ -4267,9 +4223,9 @@ function RecordPicker({
|
|
|
4267
4223
|
placeholder = "Search records...",
|
|
4268
4224
|
maxHeight = "300px"
|
|
4269
4225
|
}) {
|
|
4270
|
-
const [searchQuery, setSearchQuery] =
|
|
4226
|
+
const [searchQuery, setSearchQuery] = React19.useState("");
|
|
4271
4227
|
const debouncedSearchQuery = useDebounce(searchQuery, 300);
|
|
4272
|
-
const filteredRecords =
|
|
4228
|
+
const filteredRecords = React19.useMemo(() => {
|
|
4273
4229
|
if (!debouncedSearchQuery.trim()) {
|
|
4274
4230
|
return records;
|
|
4275
4231
|
}
|
|
@@ -4278,7 +4234,7 @@ function RecordPicker({
|
|
|
4278
4234
|
threshold: matchSorter.matchSorter.rankings.CONTAINS
|
|
4279
4235
|
});
|
|
4280
4236
|
}, [records, debouncedSearchQuery, searchFields]);
|
|
4281
|
-
const { linkedRecords, unlinkableRecords } =
|
|
4237
|
+
const { linkedRecords, unlinkableRecords } = React19.useMemo(() => {
|
|
4282
4238
|
const linked = [];
|
|
4283
4239
|
const unlinkable = [];
|
|
4284
4240
|
filteredRecords.forEach((record) => {
|
|
@@ -4291,7 +4247,7 @@ function RecordPicker({
|
|
|
4291
4247
|
});
|
|
4292
4248
|
return { linkedRecords: linked, unlinkableRecords: unlinkable };
|
|
4293
4249
|
}, [filteredRecords, linkedRecordIds, getRecordId]);
|
|
4294
|
-
const handleLinkRecord =
|
|
4250
|
+
const handleLinkRecord = React19.useCallback(
|
|
4295
4251
|
(record) => {
|
|
4296
4252
|
onLink(record);
|
|
4297
4253
|
},
|
|
@@ -4376,17 +4332,17 @@ function RecordPicker({
|
|
|
4376
4332
|
] }) })
|
|
4377
4333
|
] });
|
|
4378
4334
|
}
|
|
4379
|
-
var StepperContext =
|
|
4380
|
-
var StepItemContext =
|
|
4335
|
+
var StepperContext = React19.createContext(void 0);
|
|
4336
|
+
var StepItemContext = React19.createContext(void 0);
|
|
4381
4337
|
var useStepper = () => {
|
|
4382
|
-
const context =
|
|
4338
|
+
const context = React19.useContext(StepperContext);
|
|
4383
4339
|
if (!context) {
|
|
4384
4340
|
throw new Error("useStepper must be used within a Stepper");
|
|
4385
4341
|
}
|
|
4386
4342
|
return context;
|
|
4387
4343
|
};
|
|
4388
4344
|
var useStepItem = () => {
|
|
4389
|
-
const context =
|
|
4345
|
+
const context = React19.useContext(StepItemContext);
|
|
4390
4346
|
if (!context) {
|
|
4391
4347
|
throw new Error("useStepItem must be used within a StepperItem");
|
|
4392
4348
|
}
|
|
@@ -4400,8 +4356,8 @@ function Stepper({
|
|
|
4400
4356
|
className,
|
|
4401
4357
|
...props
|
|
4402
4358
|
}) {
|
|
4403
|
-
const [activeStep, setInternalStep] =
|
|
4404
|
-
const setActiveStep =
|
|
4359
|
+
const [activeStep, setInternalStep] = React19__namespace.useState(defaultValue);
|
|
4360
|
+
const setActiveStep = React19__namespace.useCallback(
|
|
4405
4361
|
(step) => {
|
|
4406
4362
|
if (value === void 0) {
|
|
4407
4363
|
setInternalStep(step);
|
|
@@ -4570,8 +4526,8 @@ function StepperSeparator({ className, ...props }) {
|
|
|
4570
4526
|
}
|
|
4571
4527
|
var MOBILE_BREAKPOINT = 768;
|
|
4572
4528
|
function useIsMobile() {
|
|
4573
|
-
const [isMobile, setIsMobile] =
|
|
4574
|
-
|
|
4529
|
+
const [isMobile, setIsMobile] = React19__namespace.useState(false);
|
|
4530
|
+
React19__namespace.useEffect(() => {
|
|
4575
4531
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
4576
4532
|
const onChange = () => {
|
|
4577
4533
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -4588,9 +4544,9 @@ var SIDEBAR_WIDTH = "14rem";
|
|
|
4588
4544
|
var SIDEBAR_WIDTH_MOBILE = "16rem";
|
|
4589
4545
|
var SIDEBAR_WIDTH_ICON = "4rem";
|
|
4590
4546
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
4591
|
-
var SidebarContext =
|
|
4547
|
+
var SidebarContext = React19__namespace.createContext(null);
|
|
4592
4548
|
function useSidebar() {
|
|
4593
|
-
const context =
|
|
4549
|
+
const context = React19__namespace.useContext(SidebarContext);
|
|
4594
4550
|
if (!context) {
|
|
4595
4551
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
4596
4552
|
}
|
|
@@ -4606,11 +4562,11 @@ function SidebarProvider({
|
|
|
4606
4562
|
...props
|
|
4607
4563
|
}) {
|
|
4608
4564
|
const isMobile = useIsMobile();
|
|
4609
|
-
const [openMobile, setOpenMobile] =
|
|
4610
|
-
const [isHovered, setIsHovered] =
|
|
4611
|
-
const [_open, _setOpen] =
|
|
4565
|
+
const [openMobile, setOpenMobile] = React19__namespace.useState(false);
|
|
4566
|
+
const [isHovered, setIsHovered] = React19__namespace.useState(false);
|
|
4567
|
+
const [_open, _setOpen] = React19__namespace.useState(defaultOpen);
|
|
4612
4568
|
const open = openProp ?? _open;
|
|
4613
|
-
const setOpen =
|
|
4569
|
+
const setOpen = React19__namespace.useCallback(
|
|
4614
4570
|
(value) => {
|
|
4615
4571
|
const openState = typeof value === "function" ? value(open) : value;
|
|
4616
4572
|
if (setOpenProp) {
|
|
@@ -4622,10 +4578,10 @@ function SidebarProvider({
|
|
|
4622
4578
|
},
|
|
4623
4579
|
[setOpenProp, open]
|
|
4624
4580
|
);
|
|
4625
|
-
const toggleSidebar =
|
|
4581
|
+
const toggleSidebar = React19__namespace.useCallback(() => {
|
|
4626
4582
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
4627
4583
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
4628
|
-
|
|
4584
|
+
React19__namespace.useEffect(() => {
|
|
4629
4585
|
const handleKeyDown = (event) => {
|
|
4630
4586
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
4631
4587
|
event.preventDefault();
|
|
@@ -4637,7 +4593,7 @@ function SidebarProvider({
|
|
|
4637
4593
|
}, [toggleSidebar]);
|
|
4638
4594
|
const effectiveOpen = isMobile ? open : isHovered || open;
|
|
4639
4595
|
const state = effectiveOpen ? "expanded" : "collapsed";
|
|
4640
|
-
const contextValue =
|
|
4596
|
+
const contextValue = React19__namespace.useMemo(
|
|
4641
4597
|
() => ({
|
|
4642
4598
|
state,
|
|
4643
4599
|
open,
|
|
@@ -5058,7 +5014,7 @@ function SidebarMenuSkeleton({
|
|
|
5058
5014
|
showIcon = false,
|
|
5059
5015
|
...props
|
|
5060
5016
|
}) {
|
|
5061
|
-
const width =
|
|
5017
|
+
const width = React19__namespace.useMemo(() => {
|
|
5062
5018
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
5063
5019
|
}, []);
|
|
5064
5020
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -5208,7 +5164,7 @@ function RangeCalendar({ className, ...props }) {
|
|
|
5208
5164
|
/* @__PURE__ */ jsxRuntime.jsx(CalendarGridComponent, { isRange: true })
|
|
5209
5165
|
] });
|
|
5210
5166
|
}
|
|
5211
|
-
var AceEditor =
|
|
5167
|
+
var AceEditor = React19__namespace.lazy(async () => {
|
|
5212
5168
|
const ace = await import('react-ace');
|
|
5213
5169
|
await import('ace-builds/src-noconflict/mode-json');
|
|
5214
5170
|
await import('ace-builds/src-noconflict/theme-textmate');
|
|
@@ -5238,12 +5194,12 @@ var displayJsonState = (jsonState) => {
|
|
|
5238
5194
|
return jsonStateMap[jsonState.state];
|
|
5239
5195
|
};
|
|
5240
5196
|
var JsonInput = ({ value = "", setValue, minLines = 16, className, theme = "light" }) => {
|
|
5241
|
-
const [jsonState, setJsonState] =
|
|
5197
|
+
const [jsonState, setJsonState] = React19.useState({ state: "empty" });
|
|
5242
5198
|
const handleChange = (val) => {
|
|
5243
5199
|
setJsonState({ state: "loading" });
|
|
5244
5200
|
setValue(val);
|
|
5245
5201
|
};
|
|
5246
|
-
|
|
5202
|
+
React19.useEffect(() => {
|
|
5247
5203
|
const timeoutId = setTimeout(() => {
|
|
5248
5204
|
const error = validateJson(value);
|
|
5249
5205
|
if (value.trim().length === 0) setJsonState({ state: "empty" });
|
|
@@ -5254,7 +5210,7 @@ var JsonInput = ({ value = "", setValue, minLines = 16, className, theme = "ligh
|
|
|
5254
5210
|
}, [value]);
|
|
5255
5211
|
const { icon, text, className: textClassName } = displayJsonState(jsonState);
|
|
5256
5212
|
const isValidJson = validateJson(value) === null;
|
|
5257
|
-
const lines =
|
|
5213
|
+
const lines = React19.useMemo(() => {
|
|
5258
5214
|
return Math.max(countJsonLines(value), minLines);
|
|
5259
5215
|
}, [value, minLines]);
|
|
5260
5216
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -5316,7 +5272,7 @@ var JsonEditor = ({
|
|
|
5316
5272
|
value,
|
|
5317
5273
|
onChange: setValue
|
|
5318
5274
|
};
|
|
5319
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5275
|
+
return /* @__PURE__ */ jsxRuntime.jsx(React19.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(EditorLoading, {}), children: /* @__PURE__ */ jsxRuntime.jsx(AceEditor, { ...editorProps }) });
|
|
5320
5276
|
};
|
|
5321
5277
|
var validateJson = (text) => {
|
|
5322
5278
|
try {
|
|
@@ -5357,7 +5313,7 @@ var dockVariants = classVarianceAuthority.cva(
|
|
|
5357
5313
|
// Solid themed surface (no glass/blur)
|
|
5358
5314
|
"mx-auto mt-8 flex h-[58px] w-max items-center justify-center gap-2 rounded-2xl border bg-card p-2 shadow"
|
|
5359
5315
|
);
|
|
5360
|
-
var Dock =
|
|
5316
|
+
var Dock = React19__namespace.default.forwardRef(
|
|
5361
5317
|
({
|
|
5362
5318
|
className,
|
|
5363
5319
|
children,
|
|
@@ -5369,9 +5325,9 @@ var Dock = React20__namespace.default.forwardRef(
|
|
|
5369
5325
|
}, ref) => {
|
|
5370
5326
|
const mouseX = react.useMotionValue(Infinity);
|
|
5371
5327
|
const renderChildren = () => {
|
|
5372
|
-
return
|
|
5373
|
-
if (
|
|
5374
|
-
return
|
|
5328
|
+
return React19__namespace.default.Children.map(children, (child) => {
|
|
5329
|
+
if (React19__namespace.default.isValidElement(child) && child.type === DockIcon) {
|
|
5330
|
+
return React19__namespace.default.cloneElement(child, {
|
|
5375
5331
|
...child.props,
|
|
5376
5332
|
mouseX,
|
|
5377
5333
|
size: iconSize,
|
|
@@ -5409,7 +5365,7 @@ var DockIcon = ({
|
|
|
5409
5365
|
children,
|
|
5410
5366
|
...props
|
|
5411
5367
|
}) => {
|
|
5412
|
-
const ref =
|
|
5368
|
+
const ref = React19.useRef(null);
|
|
5413
5369
|
const padding = Math.max(6, size * 0.2);
|
|
5414
5370
|
const defaultMouseX = react.useMotionValue(Infinity);
|
|
5415
5371
|
const distanceCalc = react.useTransform(mouseX ?? defaultMouseX, (val) => {
|
|
@@ -5460,11 +5416,11 @@ var FlickeringGrid = ({
|
|
|
5460
5416
|
maxOpacity = 0.3,
|
|
5461
5417
|
...props
|
|
5462
5418
|
}) => {
|
|
5463
|
-
const canvasRef =
|
|
5464
|
-
const containerRef =
|
|
5465
|
-
const [isInView, setIsInView] =
|
|
5466
|
-
const [canvasSize, setCanvasSize] =
|
|
5467
|
-
const memoizedColor =
|
|
5419
|
+
const canvasRef = React19.useRef(null);
|
|
5420
|
+
const containerRef = React19.useRef(null);
|
|
5421
|
+
const [isInView, setIsInView] = React19.useState(false);
|
|
5422
|
+
const [canvasSize, setCanvasSize] = React19.useState({ width: 0, height: 0 });
|
|
5423
|
+
const memoizedColor = React19.useMemo(() => {
|
|
5468
5424
|
const toRGBA = (color2) => {
|
|
5469
5425
|
if (typeof window === "undefined") {
|
|
5470
5426
|
return `rgba(0, 0, 0,`;
|
|
@@ -5480,7 +5436,7 @@ var FlickeringGrid = ({
|
|
|
5480
5436
|
};
|
|
5481
5437
|
return toRGBA(color);
|
|
5482
5438
|
}, [color]);
|
|
5483
|
-
const setupCanvas =
|
|
5439
|
+
const setupCanvas = React19.useCallback(
|
|
5484
5440
|
(canvas, width2, height2) => {
|
|
5485
5441
|
const dpr = window.devicePixelRatio || 1;
|
|
5486
5442
|
canvas.width = width2 * dpr;
|
|
@@ -5497,7 +5453,7 @@ var FlickeringGrid = ({
|
|
|
5497
5453
|
},
|
|
5498
5454
|
[squareSize, gridGap, maxOpacity]
|
|
5499
5455
|
);
|
|
5500
|
-
const updateSquares =
|
|
5456
|
+
const updateSquares = React19.useCallback(
|
|
5501
5457
|
(squares, deltaTime) => {
|
|
5502
5458
|
for (let i = 0; i < squares.length; i++) {
|
|
5503
5459
|
if (Math.random() < flickerChance * deltaTime) {
|
|
@@ -5507,7 +5463,7 @@ var FlickeringGrid = ({
|
|
|
5507
5463
|
},
|
|
5508
5464
|
[flickerChance, maxOpacity]
|
|
5509
5465
|
);
|
|
5510
|
-
const drawGrid =
|
|
5466
|
+
const drawGrid = React19.useCallback(
|
|
5511
5467
|
(ctx, width2, height2, cols, rows, squares, dpr) => {
|
|
5512
5468
|
ctx.clearRect(0, 0, width2, height2);
|
|
5513
5469
|
ctx.fillStyle = "transparent";
|
|
@@ -5527,7 +5483,7 @@ var FlickeringGrid = ({
|
|
|
5527
5483
|
},
|
|
5528
5484
|
[memoizedColor, squareSize, gridGap]
|
|
5529
5485
|
);
|
|
5530
|
-
|
|
5486
|
+
React19.useEffect(() => {
|
|
5531
5487
|
const canvas = canvasRef.current;
|
|
5532
5488
|
const container = containerRef.current;
|
|
5533
5489
|
if (!canvas || !container) return;
|
|
@@ -5597,9 +5553,9 @@ var MotionGrid = ({
|
|
|
5597
5553
|
}) => {
|
|
5598
5554
|
const [cols, rows] = gridSize;
|
|
5599
5555
|
const frames = useLoadingFrames(cols, rows);
|
|
5600
|
-
const [index, setIndex] =
|
|
5601
|
-
const intervalRef =
|
|
5602
|
-
|
|
5556
|
+
const [index, setIndex] = React19__namespace.useState(0);
|
|
5557
|
+
const intervalRef = React19__namespace.useRef(null);
|
|
5558
|
+
React19__namespace.useEffect(() => {
|
|
5603
5559
|
if (!animate || frames.length === 0) return;
|
|
5604
5560
|
intervalRef.current = setInterval(() => setIndex((i) => (i + 1) % frames.length), duration);
|
|
5605
5561
|
return () => clearInterval(intervalRef.current);
|
|
@@ -5632,7 +5588,7 @@ var MotionGrid = ({
|
|
|
5632
5588
|
);
|
|
5633
5589
|
};
|
|
5634
5590
|
var useLoadingFrames = (cols = 8, rows = 4) => {
|
|
5635
|
-
const loadingFrames =
|
|
5591
|
+
const loadingFrames = React19__namespace.useMemo(() => {
|
|
5636
5592
|
const frames = [];
|
|
5637
5593
|
for (let s = 0; s < cols + rows; s++) {
|
|
5638
5594
|
const dots = [];
|
|
@@ -5711,11 +5667,11 @@ function ProgressiveBlurScrollContainer({
|
|
|
5711
5667
|
blurProps,
|
|
5712
5668
|
showBlur = true
|
|
5713
5669
|
}) {
|
|
5714
|
-
const [hasOverflow, setHasOverflow] =
|
|
5715
|
-
const [isScrolledFromTop, setIsScrolledFromTop] =
|
|
5716
|
-
const [isScrolledFromBottom, setIsScrolledFromBottom] =
|
|
5717
|
-
const scrollRef =
|
|
5718
|
-
const checkScrollPosition =
|
|
5670
|
+
const [hasOverflow, setHasOverflow] = React19.useState(false);
|
|
5671
|
+
const [isScrolledFromTop, setIsScrolledFromTop] = React19.useState(false);
|
|
5672
|
+
const [isScrolledFromBottom, setIsScrolledFromBottom] = React19.useState(true);
|
|
5673
|
+
const scrollRef = React19.useRef(null);
|
|
5674
|
+
const checkScrollPosition = React19.useCallback(() => {
|
|
5719
5675
|
if (scrollRef.current) {
|
|
5720
5676
|
const el = scrollRef.current;
|
|
5721
5677
|
const scrollTop = el.scrollTop;
|
|
@@ -5725,7 +5681,7 @@ function ProgressiveBlurScrollContainer({
|
|
|
5725
5681
|
setIsScrolledFromBottom(scrollTop + clientHeight < scrollHeight - 10);
|
|
5726
5682
|
}
|
|
5727
5683
|
}, []);
|
|
5728
|
-
|
|
5684
|
+
React19.useEffect(() => {
|
|
5729
5685
|
const checkOverflow = () => {
|
|
5730
5686
|
if (scrollRef.current) {
|
|
5731
5687
|
const el = scrollRef.current;
|
|
@@ -5737,7 +5693,7 @@ function ProgressiveBlurScrollContainer({
|
|
|
5737
5693
|
window.addEventListener("resize", checkOverflow);
|
|
5738
5694
|
return () => window.removeEventListener("resize", checkOverflow);
|
|
5739
5695
|
}, [children, checkScrollPosition]);
|
|
5740
|
-
|
|
5696
|
+
React19.useEffect(() => {
|
|
5741
5697
|
const el = scrollRef.current;
|
|
5742
5698
|
if (!el) return;
|
|
5743
5699
|
el.addEventListener("scroll", checkScrollPosition, { passive: true });
|
|
@@ -5776,26 +5732,28 @@ function ProgressiveBlurScrollContainer({
|
|
|
5776
5732
|
] });
|
|
5777
5733
|
}
|
|
5778
5734
|
function ResponsiveDiagram({ children, targetRatio = 0.95, className }) {
|
|
5779
|
-
const containerRef =
|
|
5780
|
-
const contentRef =
|
|
5781
|
-
const [zoom, setZoom] =
|
|
5782
|
-
const calculateZoom =
|
|
5735
|
+
const containerRef = React19.useRef(null);
|
|
5736
|
+
const contentRef = React19.useRef(null);
|
|
5737
|
+
const [zoom, setZoom] = React19.useState(1);
|
|
5738
|
+
const calculateZoom = React19.useCallback(() => {
|
|
5783
5739
|
if (!containerRef.current || !contentRef.current) return;
|
|
5784
5740
|
contentRef.current.style.transform = "scale(1)";
|
|
5785
|
-
const
|
|
5786
|
-
const
|
|
5787
|
-
const
|
|
5788
|
-
const
|
|
5741
|
+
const style = getComputedStyle(containerRef.current);
|
|
5742
|
+
const padH = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
|
|
5743
|
+
const containerW = containerRef.current.clientWidth - padH;
|
|
5744
|
+
const contentW = contentRef.current.scrollWidth;
|
|
5745
|
+
const targetW = containerW * targetRatio;
|
|
5746
|
+
const newZoom = contentW > targetW ? targetW / contentW : 1;
|
|
5789
5747
|
setZoom(newZoom);
|
|
5790
5748
|
contentRef.current.style.transform = `scale(${newZoom})`;
|
|
5791
5749
|
}, [targetRatio]);
|
|
5792
|
-
|
|
5750
|
+
React19.useLayoutEffect(() => {
|
|
5793
5751
|
const rafId = requestAnimationFrame(() => {
|
|
5794
5752
|
calculateZoom();
|
|
5795
5753
|
});
|
|
5796
5754
|
return () => cancelAnimationFrame(rafId);
|
|
5797
5755
|
}, [calculateZoom, children]);
|
|
5798
|
-
|
|
5756
|
+
React19.useEffect(() => {
|
|
5799
5757
|
const resizeObserver = new ResizeObserver(() => {
|
|
5800
5758
|
calculateZoom();
|
|
5801
5759
|
});
|
|
@@ -5917,6 +5875,13 @@ function stackReducer(state, action) {
|
|
|
5917
5875
|
newCards[index] = { ...newCards[index], width: action.width };
|
|
5918
5876
|
return { cards: newCards };
|
|
5919
5877
|
}
|
|
5878
|
+
case "SET_DISMISSABLE": {
|
|
5879
|
+
const index = state.cards.findIndex((c) => c.id === action.id);
|
|
5880
|
+
if (index === -1) return state;
|
|
5881
|
+
const newCards = [...state.cards];
|
|
5882
|
+
newCards[index] = { ...newCards[index], dismissable: action.dismissable };
|
|
5883
|
+
return { cards: newCards };
|
|
5884
|
+
}
|
|
5920
5885
|
case "DISMISS": {
|
|
5921
5886
|
const index = state.cards.findIndex((c) => c.id === action.id);
|
|
5922
5887
|
if (index === -1) return state;
|
|
@@ -5937,7 +5902,7 @@ function stackReducer(state, action) {
|
|
|
5937
5902
|
return state;
|
|
5938
5903
|
}
|
|
5939
5904
|
}
|
|
5940
|
-
var StackContext =
|
|
5905
|
+
var StackContext = React19.createContext(null);
|
|
5941
5906
|
function CardStackProvider({
|
|
5942
5907
|
children,
|
|
5943
5908
|
routes = {},
|
|
@@ -5948,9 +5913,9 @@ function CardStackProvider({
|
|
|
5948
5913
|
defaultPeekOffset = DEFAULT_PEEK_OFFSET,
|
|
5949
5914
|
defaultWidth = DEFAULT_WIDTH
|
|
5950
5915
|
}) {
|
|
5951
|
-
const [state, dispatch] =
|
|
5952
|
-
const prevCardsRef =
|
|
5953
|
-
|
|
5916
|
+
const [state, dispatch] = React19.useReducer(stackReducer, { cards: initial });
|
|
5917
|
+
const prevCardsRef = React19.useRef(state.cards);
|
|
5918
|
+
React19.useEffect(() => {
|
|
5954
5919
|
if (prevCardsRef.current !== state.cards) {
|
|
5955
5920
|
const prevCards = prevCardsRef.current;
|
|
5956
5921
|
const currentIds = new Set(state.cards.map((c) => c.id));
|
|
@@ -5963,11 +5928,11 @@ function CardStackProvider({
|
|
|
5963
5928
|
onChange?.(state.cards);
|
|
5964
5929
|
}
|
|
5965
5930
|
}, [state.cards, onChange]);
|
|
5966
|
-
const routesRef =
|
|
5931
|
+
const routesRef = React19.useRef(routes);
|
|
5967
5932
|
routesRef.current = routes;
|
|
5968
|
-
const stateRef =
|
|
5933
|
+
const stateRef = React19.useRef(state);
|
|
5969
5934
|
stateRef.current = state;
|
|
5970
|
-
const api =
|
|
5935
|
+
const api = React19.useMemo(() => {
|
|
5971
5936
|
const top = () => {
|
|
5972
5937
|
const cards = stateRef.current.cards;
|
|
5973
5938
|
return cards.length > 0 ? cards[cards.length - 1] : null;
|
|
@@ -6033,6 +5998,9 @@ function CardStackProvider({
|
|
|
6033
5998
|
const setWidth = (id, width) => {
|
|
6034
5999
|
dispatch({ type: "SET_WIDTH", id, width });
|
|
6035
6000
|
};
|
|
6001
|
+
const setDismissable = (id, dismissable) => {
|
|
6002
|
+
dispatch({ type: "SET_DISMISSABLE", id, dismissable });
|
|
6003
|
+
};
|
|
6036
6004
|
const dismiss = (id, options) => {
|
|
6037
6005
|
const cascade = options?.cascade ?? true;
|
|
6038
6006
|
dispatch({ type: "DISMISS", id, cascade });
|
|
@@ -6060,22 +6028,26 @@ function CardStackProvider({
|
|
|
6060
6028
|
setTitle,
|
|
6061
6029
|
setDescription,
|
|
6062
6030
|
setWidth,
|
|
6031
|
+
setDismissable,
|
|
6063
6032
|
dismiss,
|
|
6064
6033
|
insertAt
|
|
6065
6034
|
};
|
|
6066
6035
|
}, []);
|
|
6067
|
-
|
|
6036
|
+
React19.useEffect(() => {
|
|
6068
6037
|
const handleEscape = (event) => {
|
|
6069
6038
|
if (event.key === "Escape" && stateRef.current.cards.length > 0) {
|
|
6070
6039
|
event.preventDefault();
|
|
6071
6040
|
event.stopPropagation();
|
|
6072
|
-
|
|
6041
|
+
const topCard = stateRef.current.cards[stateRef.current.cards.length - 1];
|
|
6042
|
+
if (topCard.dismissable !== false) {
|
|
6043
|
+
api.pop();
|
|
6044
|
+
}
|
|
6073
6045
|
}
|
|
6074
6046
|
};
|
|
6075
6047
|
document.addEventListener("keydown", handleEscape, true);
|
|
6076
6048
|
return () => document.removeEventListener("keydown", handleEscape, true);
|
|
6077
6049
|
}, [api]);
|
|
6078
|
-
const contextValue =
|
|
6050
|
+
const contextValue = React19.useMemo(
|
|
6079
6051
|
() => ({
|
|
6080
6052
|
state,
|
|
6081
6053
|
api,
|
|
@@ -6092,14 +6064,14 @@ function CardStackProvider({
|
|
|
6092
6064
|
return /* @__PURE__ */ jsxRuntime.jsx(StackContext.Provider, { value: contextValue, children });
|
|
6093
6065
|
}
|
|
6094
6066
|
function useCardStack() {
|
|
6095
|
-
const context =
|
|
6067
|
+
const context = React19.useContext(StackContext);
|
|
6096
6068
|
if (!context) {
|
|
6097
6069
|
throw new Error("useCardStack must be used within a CardStackProvider");
|
|
6098
6070
|
}
|
|
6099
6071
|
return context.api;
|
|
6100
6072
|
}
|
|
6101
6073
|
function useStackContext() {
|
|
6102
|
-
const context =
|
|
6074
|
+
const context = React19.useContext(StackContext);
|
|
6103
6075
|
if (!context) {
|
|
6104
6076
|
throw new Error("useStackContext must be used within a CardStackProvider");
|
|
6105
6077
|
}
|
|
@@ -6124,7 +6096,7 @@ function useCardIndex(id) {
|
|
|
6124
6096
|
}
|
|
6125
6097
|
function useCardInjectedProps(id) {
|
|
6126
6098
|
const api = useCardStack();
|
|
6127
|
-
return
|
|
6099
|
+
return React19.useMemo(
|
|
6128
6100
|
() => ({
|
|
6129
6101
|
card: {
|
|
6130
6102
|
id,
|
|
@@ -6141,22 +6113,23 @@ function useCardInjectedProps(id) {
|
|
|
6141
6113
|
setTitle: (title) => api.setTitle(id, title),
|
|
6142
6114
|
setDescription: (description) => api.setDescription(id, description),
|
|
6143
6115
|
setWidth: (width) => api.setWidth(id, width),
|
|
6116
|
+
setDismissable: (dismissable) => api.setDismissable(id, dismissable),
|
|
6144
6117
|
updateProps: (patch) => api.updateProps(id, patch)
|
|
6145
6118
|
}
|
|
6146
6119
|
}),
|
|
6147
6120
|
[id, api]
|
|
6148
6121
|
);
|
|
6149
6122
|
}
|
|
6150
|
-
var CardReadyContext =
|
|
6123
|
+
var CardReadyContext = React19.createContext(null);
|
|
6151
6124
|
function CardReadyProvider({
|
|
6152
6125
|
children,
|
|
6153
6126
|
isAnimationComplete
|
|
6154
6127
|
}) {
|
|
6155
|
-
const value =
|
|
6128
|
+
const value = React19.useMemo(() => ({ isAnimationComplete }), [isAnimationComplete]);
|
|
6156
6129
|
return /* @__PURE__ */ jsxRuntime.jsx(CardReadyContext.Provider, { value, children });
|
|
6157
6130
|
}
|
|
6158
6131
|
function useCardReady() {
|
|
6159
|
-
const context =
|
|
6132
|
+
const context = React19.useContext(CardReadyContext);
|
|
6160
6133
|
if (!context) {
|
|
6161
6134
|
return { isReady: true };
|
|
6162
6135
|
}
|
|
@@ -6285,16 +6258,17 @@ var reducedMotionBackdropVariants = {
|
|
|
6285
6258
|
exit: { opacity: 0, transition: { duration: 0 } }
|
|
6286
6259
|
};
|
|
6287
6260
|
function StackBackdrop({ className, onClick, config: backdropConfig }) {
|
|
6288
|
-
const { config } = useStackContext();
|
|
6261
|
+
const { config, state } = useStackContext();
|
|
6289
6262
|
const api = useCardStack();
|
|
6290
6263
|
const prefersReducedMotion = react.useReducedMotion();
|
|
6291
|
-
const handleClick =
|
|
6264
|
+
const handleClick = React19__namespace.useCallback(() => {
|
|
6265
|
+
if (state.cards.some((c) => c.dismissable === false)) return;
|
|
6292
6266
|
if (onClick) {
|
|
6293
6267
|
onClick();
|
|
6294
6268
|
} else {
|
|
6295
6269
|
api.clear();
|
|
6296
6270
|
}
|
|
6297
|
-
}, [onClick, api]);
|
|
6271
|
+
}, [onClick, api, state.cards]);
|
|
6298
6272
|
const variants2 = prefersReducedMotion ? reducedMotionBackdropVariants : backdropVariants;
|
|
6299
6273
|
const useBlur = backdropConfig?.blur ?? false;
|
|
6300
6274
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6363,7 +6337,7 @@ function StackHeader({ card, onClose, className, renderTitle }) {
|
|
|
6363
6337
|
title && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: cn("text-foreground truncate", styles.title), children: title }),
|
|
6364
6338
|
card.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("text-muted-foreground truncate", styles.description), children: card.description })
|
|
6365
6339
|
] }),
|
|
6366
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6340
|
+
card.dismissable !== false && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6367
6341
|
"button",
|
|
6368
6342
|
{
|
|
6369
6343
|
type: "button",
|
|
@@ -6595,24 +6569,24 @@ function usePeekGestures(options) {
|
|
|
6595
6569
|
onPeekDragCancel
|
|
6596
6570
|
} = options;
|
|
6597
6571
|
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 =
|
|
6572
|
+
const [isHovered, setIsHovered] = React19.useState(false);
|
|
6573
|
+
const [isDragging, setIsDragging] = React19.useState(false);
|
|
6574
|
+
const [dragOffset, setDragOffset] = React19.useState(0);
|
|
6575
|
+
const startXRef = React19.useRef(0);
|
|
6576
|
+
const startTimeRef = React19.useRef(0);
|
|
6577
|
+
const pointerIdRef = React19.useRef(null);
|
|
6578
|
+
const hasDraggedRef = React19.useRef(false);
|
|
6605
6579
|
const isTopCard = cardIndex === totalCards - 1;
|
|
6606
6580
|
const isEnabled = enabled && !isTopCard;
|
|
6607
|
-
const handleMouseEnter =
|
|
6581
|
+
const handleMouseEnter = React19.useCallback(() => {
|
|
6608
6582
|
if (!isEnabled || prefersReducedMotion) return;
|
|
6609
6583
|
setIsHovered(true);
|
|
6610
6584
|
}, [isEnabled, prefersReducedMotion]);
|
|
6611
|
-
const handleMouseLeave =
|
|
6585
|
+
const handleMouseLeave = React19.useCallback(() => {
|
|
6612
6586
|
if (!isEnabled) return;
|
|
6613
6587
|
setIsHovered(false);
|
|
6614
6588
|
}, [isEnabled]);
|
|
6615
|
-
const handleClick =
|
|
6589
|
+
const handleClick = React19.useCallback(
|
|
6616
6590
|
(e) => {
|
|
6617
6591
|
if (!isEnabled) return;
|
|
6618
6592
|
if (hasDraggedRef.current) {
|
|
@@ -6624,7 +6598,7 @@ function usePeekGestures(options) {
|
|
|
6624
6598
|
},
|
|
6625
6599
|
[isEnabled, onPeekClick]
|
|
6626
6600
|
);
|
|
6627
|
-
const handlePointerDown =
|
|
6601
|
+
const handlePointerDown = React19.useCallback(
|
|
6628
6602
|
(e) => {
|
|
6629
6603
|
if (!isEnabled || !dragToDismiss) return;
|
|
6630
6604
|
if (e.pointerType === "mouse" && e.button !== 0) return;
|
|
@@ -6638,7 +6612,7 @@ function usePeekGestures(options) {
|
|
|
6638
6612
|
},
|
|
6639
6613
|
[isEnabled, dragToDismiss]
|
|
6640
6614
|
);
|
|
6641
|
-
const handlePointerMove =
|
|
6615
|
+
const handlePointerMove = React19.useCallback(
|
|
6642
6616
|
(e) => {
|
|
6643
6617
|
if (!isEnabled || pointerIdRef.current !== e.pointerId) return;
|
|
6644
6618
|
const deltaX = e.clientX - startXRef.current;
|
|
@@ -6652,7 +6626,7 @@ function usePeekGestures(options) {
|
|
|
6652
6626
|
},
|
|
6653
6627
|
[isEnabled, onPeekDrag]
|
|
6654
6628
|
);
|
|
6655
|
-
const handlePointerUp =
|
|
6629
|
+
const handlePointerUp = React19.useCallback(
|
|
6656
6630
|
(e) => {
|
|
6657
6631
|
if (!isEnabled || pointerIdRef.current !== e.pointerId) return;
|
|
6658
6632
|
e.target.releasePointerCapture(e.pointerId);
|
|
@@ -6672,7 +6646,7 @@ function usePeekGestures(options) {
|
|
|
6672
6646
|
},
|
|
6673
6647
|
[isEnabled, dragThreshold, dragVelocityThreshold, onPeekDragDismiss, onPeekDragCancel]
|
|
6674
6648
|
);
|
|
6675
|
-
const handlePointerCancel =
|
|
6649
|
+
const handlePointerCancel = React19.useCallback(
|
|
6676
6650
|
(e) => {
|
|
6677
6651
|
if (pointerIdRef.current === e.pointerId) {
|
|
6678
6652
|
pointerIdRef.current = null;
|
|
@@ -6726,8 +6700,8 @@ function StackCardInner({
|
|
|
6726
6700
|
const { config, api, state } = useStackContext();
|
|
6727
6701
|
const prefersReducedMotion = react.useReducedMotion();
|
|
6728
6702
|
const injectedProps = useCardInjectedProps(card.id);
|
|
6729
|
-
const [isAnimationComplete, setAnimationComplete] =
|
|
6730
|
-
const handleAnimationComplete =
|
|
6703
|
+
const [isAnimationComplete, setAnimationComplete] = React19.useState(prefersReducedMotion ?? false);
|
|
6704
|
+
const handleAnimationComplete = React19.useCallback(() => {
|
|
6731
6705
|
setAnimationComplete(true);
|
|
6732
6706
|
}, []);
|
|
6733
6707
|
const isTopCard = index === totalCards - 1;
|
|
@@ -6735,7 +6709,7 @@ function StackCardInner({
|
|
|
6735
6709
|
const hasPeekZone = !isTopCard && !isMobile && !(config.layoutMode === "side-by-side" && isSecondCard);
|
|
6736
6710
|
const zIndex = getCardZIndex(index, config.zIndexBase);
|
|
6737
6711
|
const effectivePeekOffset = adjustedPeekOffset ?? config.defaultPeekOffset;
|
|
6738
|
-
const baseOffset =
|
|
6712
|
+
const baseOffset = React19.useMemo(
|
|
6739
6713
|
() => getResponsiveCardOffset(
|
|
6740
6714
|
index,
|
|
6741
6715
|
totalCards,
|
|
@@ -6750,28 +6724,32 @@ function StackCardInner({
|
|
|
6750
6724
|
);
|
|
6751
6725
|
const cardWidth = isMobile ? "100%" : normalizeWidth(card.width, config.defaultWidth);
|
|
6752
6726
|
const offsetTransition = createOffsetTransition(animation);
|
|
6753
|
-
const handleClose =
|
|
6727
|
+
const handleClose = React19.useCallback(() => {
|
|
6754
6728
|
api.dismiss(card.id);
|
|
6755
6729
|
}, [api, card.id]);
|
|
6756
|
-
const handlePeekClick =
|
|
6730
|
+
const handlePeekClick = React19.useCallback(() => {
|
|
6731
|
+
const cardsAbove = state.cards.slice(index + 1);
|
|
6732
|
+
if (cardsAbove.some((c) => c.dismissable === false)) return;
|
|
6757
6733
|
api.popTo(card.id);
|
|
6758
|
-
}, [api, card.id]);
|
|
6759
|
-
const handlePeekDragDismiss =
|
|
6734
|
+
}, [api, card.id, state.cards, index]);
|
|
6735
|
+
const handlePeekDragDismiss = React19.useCallback(() => {
|
|
6736
|
+
const cardsAbove = state.cards.slice(index + 1);
|
|
6737
|
+
if (cardsAbove.some((c) => c.dismissable === false)) return;
|
|
6760
6738
|
onPeekDragEnd?.(index, true);
|
|
6761
|
-
}, [index, onPeekDragEnd]);
|
|
6762
|
-
const handlePeekDrag =
|
|
6739
|
+
}, [index, onPeekDragEnd, state.cards]);
|
|
6740
|
+
const handlePeekDrag = React19.useCallback(
|
|
6763
6741
|
(offset) => {
|
|
6764
6742
|
onPeekDrag?.(index, offset);
|
|
6765
6743
|
},
|
|
6766
6744
|
[index, onPeekDrag]
|
|
6767
6745
|
);
|
|
6768
|
-
const handlePeekDragCancel =
|
|
6746
|
+
const handlePeekDragCancel = React19.useCallback(() => {
|
|
6769
6747
|
onPeekDragEnd?.(index, false);
|
|
6770
6748
|
}, [index, onPeekDragEnd]);
|
|
6771
|
-
const handlePeekHoverStart =
|
|
6749
|
+
const handlePeekHoverStart = React19.useCallback(() => {
|
|
6772
6750
|
onPeekHoverStart?.(index);
|
|
6773
6751
|
}, [index, onPeekHoverStart]);
|
|
6774
|
-
const handlePeekHoverEnd =
|
|
6752
|
+
const handlePeekHoverEnd = React19.useCallback(() => {
|
|
6775
6753
|
onPeekHoverEnd?.(index);
|
|
6776
6754
|
}, [index, onPeekHoverEnd]);
|
|
6777
6755
|
const peekGestures = usePeekGestures({
|
|
@@ -6786,7 +6764,7 @@ function StackCardInner({
|
|
|
6786
6764
|
const hoverExpansion = hasPeekZone && isPeekHovered && !peekGestures.isDragging && !prefersReducedMotion ? peekGestureConfig?.hoverExpansion ?? DEFAULT_HOVER_EXPANSION2 : 0;
|
|
6787
6765
|
const xOffset = -baseOffset + dragX - hoverExpansion + peekDragOffset;
|
|
6788
6766
|
const CardComponent = card.Component;
|
|
6789
|
-
const cardContent =
|
|
6767
|
+
const cardContent = React19.useMemo(() => {
|
|
6790
6768
|
return /* @__PURE__ */ jsxRuntime.jsx(CardReadyProvider, { isAnimationComplete, children: /* @__PURE__ */ jsxRuntime.jsx(CardComponent, { ...card.props, ...injectedProps }) });
|
|
6791
6769
|
}, [CardComponent, card.props, injectedProps, isAnimationComplete]);
|
|
6792
6770
|
const headerContent = renderHeader ? renderHeader(card, api) : /* @__PURE__ */ jsxRuntime.jsx(StackHeader, { card, onClose: handleClose });
|
|
@@ -6882,7 +6860,7 @@ function StackCardInner({
|
|
|
6882
6860
|
}
|
|
6883
6861
|
);
|
|
6884
6862
|
}
|
|
6885
|
-
var StackCard =
|
|
6863
|
+
var StackCard = React19.memo(StackCardInner);
|
|
6886
6864
|
var DEFAULT_SWIPE_THRESHOLD = 120;
|
|
6887
6865
|
var DEFAULT_VELOCITY_THRESHOLD2 = 0.6;
|
|
6888
6866
|
var MIN_VELOCITY_DISTANCE = 60;
|
|
@@ -6898,12 +6876,12 @@ function useStackGestures(options) {
|
|
|
6898
6876
|
} = options;
|
|
6899
6877
|
const prefersReducedMotion = react.useReducedMotion();
|
|
6900
6878
|
const isEnabled = enabled && swipeToPop && !prefersReducedMotion;
|
|
6901
|
-
const [dragX, setDragX] =
|
|
6902
|
-
const [isDragging, setIsDragging] =
|
|
6903
|
-
const handleDismiss =
|
|
6879
|
+
const [dragX, setDragX] = React19.useState(0);
|
|
6880
|
+
const [isDragging, setIsDragging] = React19.useState(false);
|
|
6881
|
+
const handleDismiss = React19.useCallback(() => {
|
|
6904
6882
|
onDismiss();
|
|
6905
6883
|
}, [onDismiss]);
|
|
6906
|
-
const dismissedRef =
|
|
6884
|
+
const dismissedRef = React19.useRef(false);
|
|
6907
6885
|
const velocityMinDistance = Math.max(MIN_VELOCITY_DISTANCE, swipeThreshold * 0.25);
|
|
6908
6886
|
const bind = react$2.useDrag(
|
|
6909
6887
|
({ active, movement: [mx], velocity: [vx], direction: [dx], initial: [initialX], xy: [currentX], cancel, first }) => {
|
|
@@ -6961,14 +6939,14 @@ function useStackGestures(options) {
|
|
|
6961
6939
|
var DEFAULT_MOBILE_BREAKPOINT = 768;
|
|
6962
6940
|
function useStackResponsive(options = {}) {
|
|
6963
6941
|
const { breakpoint = DEFAULT_MOBILE_BREAKPOINT } = options;
|
|
6964
|
-
const [state, setState] =
|
|
6942
|
+
const [state, setState] = React19.useState(() => {
|
|
6965
6943
|
if (typeof window === "undefined") {
|
|
6966
6944
|
return { isMobile: false, viewportWidth: 1024 };
|
|
6967
6945
|
}
|
|
6968
6946
|
const width = window.innerWidth;
|
|
6969
6947
|
return { isMobile: width < breakpoint, viewportWidth: width };
|
|
6970
6948
|
});
|
|
6971
|
-
const updateState =
|
|
6949
|
+
const updateState = React19.useCallback(() => {
|
|
6972
6950
|
const width = window.innerWidth;
|
|
6973
6951
|
setState((prev) => {
|
|
6974
6952
|
const isMobile = width < breakpoint;
|
|
@@ -6978,7 +6956,7 @@ function useStackResponsive(options = {}) {
|
|
|
6978
6956
|
return { isMobile, viewportWidth: width };
|
|
6979
6957
|
});
|
|
6980
6958
|
}, [breakpoint]);
|
|
6981
|
-
|
|
6959
|
+
React19.useEffect(() => {
|
|
6982
6960
|
updateState();
|
|
6983
6961
|
window.addEventListener("resize", updateState);
|
|
6984
6962
|
return () => window.removeEventListener("resize", updateState);
|
|
@@ -7008,17 +6986,17 @@ function CardStackViewport({
|
|
|
7008
6986
|
const { config, api } = useStackContext();
|
|
7009
6987
|
const cards = useStackCards();
|
|
7010
6988
|
const { isMobile, viewportWidth } = useStackResponsive(mobile);
|
|
7011
|
-
const [peekDrag, setPeekDrag] =
|
|
7012
|
-
const [peekHover, setPeekHover] =
|
|
7013
|
-
const hoverEndTimeoutRef =
|
|
7014
|
-
const prevCardCountRef =
|
|
7015
|
-
const [exitComplete, setExitComplete] =
|
|
7016
|
-
|
|
6989
|
+
const [peekDrag, setPeekDrag] = React19.useState({ sourceIndex: -1, offset: 0 });
|
|
6990
|
+
const [peekHover, setPeekHover] = React19.useState({ hoveredIndex: -1 });
|
|
6991
|
+
const hoverEndTimeoutRef = React19.useRef(null);
|
|
6992
|
+
const prevCardCountRef = React19.useRef(cards.length);
|
|
6993
|
+
const [exitComplete, setExitComplete] = React19.useState(cards.length === 0);
|
|
6994
|
+
React19.useEffect(() => {
|
|
7017
6995
|
if (cards.length > 0) {
|
|
7018
6996
|
setExitComplete(false);
|
|
7019
6997
|
}
|
|
7020
6998
|
}, [cards.length]);
|
|
7021
|
-
|
|
6999
|
+
React19.useEffect(() => {
|
|
7022
7000
|
if (cards.length !== prevCardCountRef.current) {
|
|
7023
7001
|
setPeekHover({ hoveredIndex: -1 });
|
|
7024
7002
|
if (hoverEndTimeoutRef.current) {
|
|
@@ -7028,10 +7006,10 @@ function CardStackViewport({
|
|
|
7028
7006
|
prevCardCountRef.current = cards.length;
|
|
7029
7007
|
}
|
|
7030
7008
|
}, [cards.length]);
|
|
7031
|
-
const handleExitComplete =
|
|
7009
|
+
const handleExitComplete = React19.useCallback(() => {
|
|
7032
7010
|
setExitComplete(true);
|
|
7033
7011
|
}, []);
|
|
7034
|
-
const cardWidths =
|
|
7012
|
+
const cardWidths = React19.useMemo(() => {
|
|
7035
7013
|
if (cards.length === 0) return { topCardWidth: 0, secondCardWidth: 0 };
|
|
7036
7014
|
const topCard = cards[cards.length - 1];
|
|
7037
7015
|
const topCardWidth = parseWidthToPixels(topCard.width ?? config.defaultWidth) ?? 480;
|
|
@@ -7039,7 +7017,7 @@ function CardStackViewport({
|
|
|
7039
7017
|
const secondCardWidth = secondCard ? parseWidthToPixels(secondCard.width ?? config.defaultWidth) ?? 480 : 0;
|
|
7040
7018
|
return { topCardWidth, secondCardWidth };
|
|
7041
7019
|
}, [cards, config.defaultWidth]);
|
|
7042
|
-
const responsiveOffset =
|
|
7020
|
+
const responsiveOffset = React19.useMemo(() => {
|
|
7043
7021
|
return calculateResponsiveOffset({
|
|
7044
7022
|
viewportWidth,
|
|
7045
7023
|
topCardWidth: cardWidths.topCardWidth,
|
|
@@ -7050,7 +7028,9 @@ function CardStackViewport({
|
|
|
7050
7028
|
});
|
|
7051
7029
|
}, [viewportWidth, cardWidths, cards.length, config.defaultPeekOffset, config.layoutMode]);
|
|
7052
7030
|
const useFullScreen = isMobile || responsiveOffset.shouldCollapse;
|
|
7053
|
-
const handleDismiss =
|
|
7031
|
+
const handleDismiss = React19.useCallback(() => {
|
|
7032
|
+
const topCard = api.top();
|
|
7033
|
+
if (topCard?.dismissable === false) return;
|
|
7054
7034
|
api.pop();
|
|
7055
7035
|
}, [api]);
|
|
7056
7036
|
const swipeThreshold = mobile?.gestures?.swipeThreshold ?? Math.max(120, Math.round(viewportWidth * 0.35));
|
|
@@ -7062,14 +7042,14 @@ function CardStackViewport({
|
|
|
7062
7042
|
autoDismissThreshold,
|
|
7063
7043
|
onDismiss: handleDismiss
|
|
7064
7044
|
});
|
|
7065
|
-
const handlePeekHoverStart =
|
|
7045
|
+
const handlePeekHoverStart = React19.useCallback((cardIndex) => {
|
|
7066
7046
|
if (hoverEndTimeoutRef.current) {
|
|
7067
7047
|
clearTimeout(hoverEndTimeoutRef.current);
|
|
7068
7048
|
hoverEndTimeoutRef.current = null;
|
|
7069
7049
|
}
|
|
7070
7050
|
setPeekHover({ hoveredIndex: cardIndex });
|
|
7071
7051
|
}, []);
|
|
7072
|
-
const handlePeekHoverEnd =
|
|
7052
|
+
const handlePeekHoverEnd = React19.useCallback((cardIndex) => {
|
|
7073
7053
|
if (hoverEndTimeoutRef.current) {
|
|
7074
7054
|
clearTimeout(hoverEndTimeoutRef.current);
|
|
7075
7055
|
}
|
|
@@ -7078,12 +7058,17 @@ function CardStackViewport({
|
|
|
7078
7058
|
hoverEndTimeoutRef.current = null;
|
|
7079
7059
|
}, 100);
|
|
7080
7060
|
}, []);
|
|
7081
|
-
const handlePeekDrag =
|
|
7061
|
+
const handlePeekDrag = React19.useCallback((cardIndex, offset) => {
|
|
7082
7062
|
setPeekDrag({ sourceIndex: cardIndex, offset });
|
|
7083
7063
|
}, []);
|
|
7084
|
-
const handlePeekDragEnd =
|
|
7064
|
+
const handlePeekDragEnd = React19.useCallback(
|
|
7085
7065
|
(cardIndex, shouldDismiss) => {
|
|
7086
7066
|
if (shouldDismiss) {
|
|
7067
|
+
const cardsAbove = cards.slice(cardIndex + 1);
|
|
7068
|
+
if (cardsAbove.some((c) => c.dismissable === false)) {
|
|
7069
|
+
setPeekDrag({ sourceIndex: -1, offset: 0 });
|
|
7070
|
+
return;
|
|
7071
|
+
}
|
|
7087
7072
|
const card = cards[cardIndex];
|
|
7088
7073
|
if (card) {
|
|
7089
7074
|
api.popTo(card.id);
|
|
@@ -7093,7 +7078,7 @@ function CardStackViewport({
|
|
|
7093
7078
|
},
|
|
7094
7079
|
[api, cards]
|
|
7095
7080
|
);
|
|
7096
|
-
const visibleCards =
|
|
7081
|
+
const visibleCards = React19.useMemo(() => {
|
|
7097
7082
|
return cards.filter((_, index) => isCardVisible(index, cards.length, peekDepth));
|
|
7098
7083
|
}, [cards, peekDepth]);
|
|
7099
7084
|
const portalContainer = useRootPortalContainer();
|
|
@@ -7101,12 +7086,12 @@ function CardStackViewport({
|
|
|
7101
7086
|
const defaultBackdrop = /* @__PURE__ */ jsxRuntime.jsx(StackBackdrop, { className: "pointer-events-auto", config: config2 }, "backdrop");
|
|
7102
7087
|
if (renderBackdrop) {
|
|
7103
7088
|
const customBackdrop = renderBackdrop();
|
|
7104
|
-
return
|
|
7089
|
+
return React19__namespace.isValidElement(customBackdrop) ? React19__namespace.cloneElement(customBackdrop, { key: "backdrop" }) : defaultBackdrop;
|
|
7105
7090
|
}
|
|
7106
7091
|
return defaultBackdrop;
|
|
7107
7092
|
};
|
|
7108
7093
|
const hasCards = cards.length > 0;
|
|
7109
|
-
const resolvedBackdrop =
|
|
7094
|
+
const resolvedBackdrop = React19.useMemo(() => {
|
|
7110
7095
|
const firstCard = cards[0];
|
|
7111
7096
|
const cardBackdrop = firstCard?.backdrop;
|
|
7112
7097
|
if (cardBackdrop !== void 0) {
|
|
@@ -7178,8 +7163,8 @@ function DeferredCardContent({
|
|
|
7178
7163
|
priority = "normal",
|
|
7179
7164
|
onReady
|
|
7180
7165
|
}) {
|
|
7181
|
-
const [ready, setReady] =
|
|
7182
|
-
|
|
7166
|
+
const [ready, setReady] = React19.useState(immediate);
|
|
7167
|
+
React19.useEffect(() => {
|
|
7183
7168
|
if (immediate) {
|
|
7184
7169
|
onReady?.();
|
|
7185
7170
|
return;
|