@constructive-io/ui 0.1.1 → 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/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/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 +2 -6
- package/src/styles/globals.css +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
4
|
+
import * as React19 from 'react';
|
|
5
|
+
import React19__default, { createContext, memo, useState, useCallback, useMemo, useRef, useContext, useEffect, Suspense, useLayoutEffect, useReducer } from 'react';
|
|
6
6
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
8
8
|
import { Separator as Separator$1 } from '@base-ui/react/separator';
|
|
@@ -29,6 +29,7 @@ import { Collapsible as Collapsible$1 } from '@base-ui/react/collapsible';
|
|
|
29
29
|
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
30
30
|
import { Avatar as Avatar$1 } from '@base-ui/react/avatar';
|
|
31
31
|
import { Autocomplete as Autocomplete$1 } from '@base-ui/react/autocomplete';
|
|
32
|
+
import { Command as Command$1 } from 'cmdk';
|
|
32
33
|
import { Combobox as Combobox$1 } from '@base-ui/react/combobox';
|
|
33
34
|
import { RiSearchLine, RiLoader4Line, RiCheckLine, RiCloseLine } from '@remixicon/react';
|
|
34
35
|
import { matchSorter } from 'match-sorter';
|
|
@@ -83,22 +84,22 @@ function mergePropsWithRef(parentProps, childElement) {
|
|
|
83
84
|
return mergedProps;
|
|
84
85
|
}
|
|
85
86
|
function isSlottable(child) {
|
|
86
|
-
return
|
|
87
|
+
return React19.isValidElement(child);
|
|
87
88
|
}
|
|
88
|
-
var Slot =
|
|
89
|
+
var Slot = React19.forwardRef((props, forwardedRef) => {
|
|
89
90
|
const { children, ...slotProps } = props;
|
|
90
91
|
if (isSlottable(children)) {
|
|
91
92
|
const childProps = children.props;
|
|
92
93
|
const childRef = childProps.ref;
|
|
93
|
-
return
|
|
94
|
+
return React19.cloneElement(children, {
|
|
94
95
|
...mergeProps(slotProps, childProps),
|
|
95
96
|
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
|
-
if (
|
|
99
|
-
const childrenArray =
|
|
99
|
+
if (React19.Children.count(children) > 1) {
|
|
100
|
+
const childrenArray = React19.Children.toArray(children);
|
|
100
101
|
const slottableChild = childrenArray.find(
|
|
101
|
-
(child) =>
|
|
102
|
+
(child) => React19.isValidElement(child) && child.type === Slottable
|
|
102
103
|
);
|
|
103
104
|
if (slottableChild) {
|
|
104
105
|
const newElement = slottableChild.props.children;
|
|
@@ -106,12 +107,12 @@ var Slot = React20.forwardRef((props, forwardedRef) => {
|
|
|
106
107
|
const newElementProps = newElement.props;
|
|
107
108
|
const newChildren = childrenArray.map((child) => {
|
|
108
109
|
if (child === slottableChild) {
|
|
109
|
-
return
|
|
110
|
+
return React19.Children.count(newElementProps.children) > 1 ? React19.Children.only(null) : newElementProps.children;
|
|
110
111
|
}
|
|
111
112
|
return child;
|
|
112
113
|
});
|
|
113
114
|
const childRef = newElementProps.ref;
|
|
114
|
-
return
|
|
115
|
+
return React19.cloneElement(newElement, {
|
|
115
116
|
...mergeProps(slotProps, newElementProps),
|
|
116
117
|
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
|
|
117
118
|
children: newChildren
|
|
@@ -311,12 +312,12 @@ var buttonVariants = cva(
|
|
|
311
312
|
}
|
|
312
313
|
}
|
|
313
314
|
);
|
|
314
|
-
var Button =
|
|
315
|
+
var Button = React19.forwardRef(
|
|
315
316
|
({ className, variant, size, asChild, children, type = "button", ...props }, ref) => {
|
|
316
317
|
const buttonClasses = cn(buttonVariants({ className, size, variant }));
|
|
317
|
-
if (asChild &&
|
|
318
|
+
if (asChild && React19.isValidElement(children)) {
|
|
318
319
|
const childProps = children.props;
|
|
319
|
-
return
|
|
320
|
+
return React19.cloneElement(children, {
|
|
320
321
|
...props,
|
|
321
322
|
className: cn(buttonClasses, childProps.className),
|
|
322
323
|
"data-slot": "button"
|
|
@@ -352,7 +353,7 @@ var badgeVariants = cva(
|
|
|
352
353
|
}
|
|
353
354
|
}
|
|
354
355
|
);
|
|
355
|
-
var Badge =
|
|
356
|
+
var Badge = React19.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ jsx("span", { ref, "data-slot": "badge", className: cn(badgeVariants({ variant, size }), className), ...props }));
|
|
356
357
|
Badge.displayName = "Badge";
|
|
357
358
|
function Label({ className, ...props }) {
|
|
358
359
|
return /* @__PURE__ */ jsx(
|
|
@@ -458,13 +459,13 @@ var alertVariants = cva(
|
|
|
458
459
|
}
|
|
459
460
|
}
|
|
460
461
|
);
|
|
461
|
-
var Alert =
|
|
462
|
+
var Alert = React19.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, role: "alert", className: cn(alertVariants({ variant }), className), ...props }));
|
|
462
463
|
Alert.displayName = "Alert";
|
|
463
|
-
var AlertTitle =
|
|
464
|
+
var AlertTitle = React19.forwardRef(
|
|
464
465
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx("h5", { ref, className: cn("mb-1 leading-none font-medium tracking-tight", className), ...props })
|
|
465
466
|
);
|
|
466
467
|
AlertTitle.displayName = "AlertTitle";
|
|
467
|
-
var AlertDescription =
|
|
468
|
+
var AlertDescription = React19.forwardRef(
|
|
468
469
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("text-sm [&_p]:leading-relaxed", className), ...props })
|
|
469
470
|
);
|
|
470
471
|
AlertDescription.displayName = "AlertDescription";
|
|
@@ -476,7 +477,7 @@ function Input({ className, size = "default", unstyled = false, ...props }) {
|
|
|
476
477
|
className: cn(
|
|
477
478
|
!unstyled && [
|
|
478
479
|
// Base layout
|
|
479
|
-
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base
|
|
480
|
+
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base transition-shadow",
|
|
480
481
|
// Inner shadow highlight
|
|
481
482
|
"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)]",
|
|
482
483
|
"not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)]",
|
|
@@ -522,7 +523,7 @@ function Textarea({ className, size = "default", unstyled = false, ...props }) {
|
|
|
522
523
|
className: cn(
|
|
523
524
|
!unstyled && [
|
|
524
525
|
// Base layout
|
|
525
|
-
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base
|
|
526
|
+
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base transition-shadow",
|
|
526
527
|
// Inner shadow highlight
|
|
527
528
|
"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)]",
|
|
528
529
|
"not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)]",
|
|
@@ -557,7 +558,7 @@ function Textarea({ className, size = "default", unstyled = false, ...props }) {
|
|
|
557
558
|
}
|
|
558
559
|
);
|
|
559
560
|
}
|
|
560
|
-
var Checkbox =
|
|
561
|
+
var Checkbox = React19.forwardRef(({ className, ...props }, ref) => {
|
|
561
562
|
return /* @__PURE__ */ jsx(
|
|
562
563
|
Checkbox$1.Root,
|
|
563
564
|
{
|
|
@@ -664,7 +665,7 @@ function Switch({ className, ...props }) {
|
|
|
664
665
|
);
|
|
665
666
|
}
|
|
666
667
|
var PORTAL_ROOT_ID = "portal-root";
|
|
667
|
-
var PortalContext =
|
|
668
|
+
var PortalContext = React19.createContext({
|
|
668
669
|
layer: "base",
|
|
669
670
|
depth: 0,
|
|
670
671
|
floatingPortalStrategy: "root",
|
|
@@ -675,9 +676,9 @@ function ModalPortalScope({
|
|
|
675
676
|
floatingPortalStrategy = "nested",
|
|
676
677
|
floatingZIndex = "default"
|
|
677
678
|
}) {
|
|
678
|
-
const parentContext =
|
|
679
|
+
const parentContext = React19.useContext(PortalContext);
|
|
679
680
|
const depth = parentContext.layer === "modal" ? parentContext.depth + 1 : 0;
|
|
680
|
-
const value =
|
|
681
|
+
const value = React19.useMemo(
|
|
681
682
|
() => ({
|
|
682
683
|
layer: "modal",
|
|
683
684
|
depth,
|
|
@@ -689,14 +690,14 @@ function ModalPortalScope({
|
|
|
689
690
|
return /* @__PURE__ */ jsx(PortalContext.Provider, { value, children });
|
|
690
691
|
}
|
|
691
692
|
function usePortalContext() {
|
|
692
|
-
return
|
|
693
|
+
return React19.useContext(PortalContext);
|
|
693
694
|
}
|
|
694
695
|
function useInModalOverlay() {
|
|
695
|
-
return
|
|
696
|
+
return React19.useContext(PortalContext).layer === "modal";
|
|
696
697
|
}
|
|
697
698
|
function useRootPortalContainer() {
|
|
698
|
-
const [container, setContainer] =
|
|
699
|
-
|
|
699
|
+
const [container, setContainer] = React19.useState(null);
|
|
700
|
+
React19.useLayoutEffect(() => {
|
|
700
701
|
const el = document.getElementById(PORTAL_ROOT_ID);
|
|
701
702
|
setContainer(el);
|
|
702
703
|
}, []);
|
|
@@ -704,7 +705,7 @@ function useRootPortalContainer() {
|
|
|
704
705
|
}
|
|
705
706
|
function useFloatingOverlayPortalProps() {
|
|
706
707
|
const rootContainer = useRootPortalContainer();
|
|
707
|
-
const { floatingPortalStrategy, floatingZIndex } =
|
|
708
|
+
const { floatingPortalStrategy, floatingZIndex } = React19.useContext(PortalContext);
|
|
708
709
|
const container = floatingPortalStrategy === "nested" ? void 0 : rootContainer ?? null;
|
|
709
710
|
const zIndexClass = floatingZIndex === "elevated" ? "z-[var(--z-layer-floating-elevated)]" : "z-[var(--z-layer-floating)]";
|
|
710
711
|
return { container, zIndexClass };
|
|
@@ -743,14 +744,14 @@ function Select({ onValueChange, ...props }) {
|
|
|
743
744
|
}
|
|
744
745
|
);
|
|
745
746
|
}
|
|
746
|
-
var SelectTrigger =
|
|
747
|
+
var SelectTrigger = React19.forwardRef(
|
|
747
748
|
({ className, size = "default", children, ...props }, ref) => {
|
|
748
749
|
return /* @__PURE__ */ jsxs(
|
|
749
750
|
Select$1.Trigger,
|
|
750
751
|
{
|
|
751
752
|
ref,
|
|
752
753
|
className: cn(
|
|
753
|
-
"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
|
|
754
|
+
"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",
|
|
754
755
|
size === "sm" && "min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7",
|
|
755
756
|
size === "lg" && "min-h-10 sm:min-h-9",
|
|
756
757
|
className
|
|
@@ -884,10 +885,10 @@ function SelectSeparator({
|
|
|
884
885
|
}
|
|
885
886
|
);
|
|
886
887
|
}
|
|
887
|
-
function SelectGroup(props) {
|
|
888
|
+
function SelectGroup({ ...props }) {
|
|
888
889
|
return /* @__PURE__ */ jsx(Select$1.Group, { "data-slot": "select-group", ...props });
|
|
889
890
|
}
|
|
890
|
-
function SelectGroupLabel(props) {
|
|
891
|
+
function SelectGroupLabel({ ...props }) {
|
|
891
892
|
return /* @__PURE__ */ jsx(
|
|
892
893
|
Select$1.GroupLabel,
|
|
893
894
|
{
|
|
@@ -998,15 +999,15 @@ function Progress({ className, value, ...props }) {
|
|
|
998
999
|
) });
|
|
999
1000
|
}
|
|
1000
1001
|
var Form = FormProvider;
|
|
1001
|
-
var FormFieldContext =
|
|
1002
|
+
var FormFieldContext = React19.createContext({});
|
|
1002
1003
|
var FormField = ({
|
|
1003
1004
|
...props
|
|
1004
1005
|
}) => {
|
|
1005
1006
|
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
1006
1007
|
};
|
|
1007
1008
|
var useFormField = () => {
|
|
1008
|
-
const fieldContext =
|
|
1009
|
-
const itemContext =
|
|
1009
|
+
const fieldContext = React19.useContext(FormFieldContext);
|
|
1010
|
+
const itemContext = React19.useContext(FormItemContext);
|
|
1010
1011
|
const { getFieldState } = useFormContext();
|
|
1011
1012
|
const formState = useFormState({ name: fieldContext.name });
|
|
1012
1013
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1023,9 +1024,9 @@ var useFormField = () => {
|
|
|
1023
1024
|
...fieldState
|
|
1024
1025
|
};
|
|
1025
1026
|
};
|
|
1026
|
-
var FormItemContext =
|
|
1027
|
+
var FormItemContext = React19.createContext({});
|
|
1027
1028
|
function FormItem({ className, ...props }) {
|
|
1028
|
-
const id =
|
|
1029
|
+
const id = React19.useId();
|
|
1029
1030
|
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
1030
1031
|
}
|
|
1031
1032
|
function FormLabel({ className, ...props }) {
|
|
@@ -1075,7 +1076,7 @@ function FormMessage({ className, ...props }) {
|
|
|
1075
1076
|
return /* @__PURE__ */ jsx("p", { "data-slot": "form-message", id: formMessageId, className: cn("text-destructive text-sm", className), ...props, children: body });
|
|
1076
1077
|
}
|
|
1077
1078
|
function FormControl2({ children, label, id, layout = "stacked", error, className }) {
|
|
1078
|
-
const generatedId =
|
|
1079
|
+
const generatedId = React19.useId();
|
|
1079
1080
|
const inputId = id || generatedId;
|
|
1080
1081
|
const errorId = error ? `${inputId}-error` : void 0;
|
|
1081
1082
|
const childProps = {
|
|
@@ -1086,7 +1087,7 @@ function FormControl2({ children, label, id, layout = "stacked", error, classNam
|
|
|
1086
1087
|
if (layout === "floating") {
|
|
1087
1088
|
childProps.placeholder = " ";
|
|
1088
1089
|
}
|
|
1089
|
-
const childWithProps =
|
|
1090
|
+
const childWithProps = React19.cloneElement(children, childProps);
|
|
1090
1091
|
if (layout === "floating") {
|
|
1091
1092
|
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-1", className), children: [
|
|
1092
1093
|
/* @__PURE__ */ jsxs(
|
|
@@ -1315,7 +1316,7 @@ function Tooltip({ delayDuration: _delayDuration, ...props }) {
|
|
|
1315
1316
|
return /* @__PURE__ */ jsx(Tooltip$1.Root, { "data-slot": "tooltip", ...props });
|
|
1316
1317
|
}
|
|
1317
1318
|
function TooltipTrigger({ delay = 0, asChild, children, ...props }) {
|
|
1318
|
-
if (asChild &&
|
|
1319
|
+
if (asChild && React19.isValidElement(children)) {
|
|
1319
1320
|
return /* @__PURE__ */ jsx(
|
|
1320
1321
|
Tooltip$1.Trigger,
|
|
1321
1322
|
{
|
|
@@ -1323,7 +1324,7 @@ function TooltipTrigger({ delay = 0, asChild, children, ...props }) {
|
|
|
1323
1324
|
delay,
|
|
1324
1325
|
...props,
|
|
1325
1326
|
render: (triggerProps) => {
|
|
1326
|
-
return
|
|
1327
|
+
return React19.cloneElement(
|
|
1327
1328
|
children,
|
|
1328
1329
|
mergePropsWithRef(triggerProps, children)
|
|
1329
1330
|
);
|
|
@@ -1367,7 +1368,7 @@ function Popover({ ...props }) {
|
|
|
1367
1368
|
return /* @__PURE__ */ jsx(Popover$1.Root, { "data-slot": "popover", ...props });
|
|
1368
1369
|
}
|
|
1369
1370
|
function PopoverTrigger({ asChild, nativeButton, children, ...props }) {
|
|
1370
|
-
if (asChild &&
|
|
1371
|
+
if (asChild && React19.isValidElement(children)) {
|
|
1371
1372
|
return /* @__PURE__ */ jsx(
|
|
1372
1373
|
Popover$1.Trigger,
|
|
1373
1374
|
{
|
|
@@ -1376,7 +1377,7 @@ function PopoverTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1376
1377
|
...props,
|
|
1377
1378
|
render: (triggerProps) => {
|
|
1378
1379
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
1379
|
-
return
|
|
1380
|
+
return React19.cloneElement(
|
|
1380
1381
|
children,
|
|
1381
1382
|
mergePropsWithRef(rest, children)
|
|
1382
1383
|
);
|
|
@@ -1432,7 +1433,7 @@ function PopoverContent({
|
|
|
1432
1433
|
function PopoverAnchor({ ...props }) {
|
|
1433
1434
|
return /* @__PURE__ */ jsx("div", { "data-slot": "popover-anchor", ...props });
|
|
1434
1435
|
}
|
|
1435
|
-
var ScrollArea =
|
|
1436
|
+
var ScrollArea = React19.forwardRef(
|
|
1436
1437
|
({ className, children, scrollFade = false, scrollbarGutter = false, ...props }, ref) => {
|
|
1437
1438
|
return /* @__PURE__ */ jsxs(
|
|
1438
1439
|
ScrollArea$1.Root,
|
|
@@ -1499,7 +1500,7 @@ function DialogPortal({ keepMounted = true, ...props }) {
|
|
|
1499
1500
|
return /* @__PURE__ */ jsx(Dialog$1.Portal, { keepMounted, container, ...props, style });
|
|
1500
1501
|
}
|
|
1501
1502
|
function DialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
1502
|
-
if (asChild &&
|
|
1503
|
+
if (asChild && React19.isValidElement(children)) {
|
|
1503
1504
|
return /* @__PURE__ */ jsx(
|
|
1504
1505
|
Dialog$1.Trigger,
|
|
1505
1506
|
{
|
|
@@ -1508,7 +1509,7 @@ function DialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1508
1509
|
...props,
|
|
1509
1510
|
render: (triggerProps) => {
|
|
1510
1511
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
1511
|
-
return
|
|
1512
|
+
return React19.cloneElement(
|
|
1512
1513
|
children,
|
|
1513
1514
|
mergePropsWithRef(rest, children)
|
|
1514
1515
|
);
|
|
@@ -1519,7 +1520,7 @@ function DialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1519
1520
|
return /* @__PURE__ */ jsx(Dialog$1.Trigger, { "data-slot": "dialog-trigger", nativeButton, ...props, children });
|
|
1520
1521
|
}
|
|
1521
1522
|
function DialogClose({ asChild, nativeButton, children, ...props }) {
|
|
1522
|
-
if (asChild &&
|
|
1523
|
+
if (asChild && React19.isValidElement(children)) {
|
|
1523
1524
|
return /* @__PURE__ */ jsx(
|
|
1524
1525
|
Dialog$1.Close,
|
|
1525
1526
|
{
|
|
@@ -1528,7 +1529,7 @@ function DialogClose({ asChild, nativeButton, children, ...props }) {
|
|
|
1528
1529
|
...props,
|
|
1529
1530
|
render: (closeProps) => {
|
|
1530
1531
|
const { nativeButton: _, ...rest } = closeProps;
|
|
1531
|
-
return
|
|
1532
|
+
return React19.cloneElement(
|
|
1532
1533
|
children,
|
|
1533
1534
|
mergePropsWithRef(rest, children)
|
|
1534
1535
|
);
|
|
@@ -1683,7 +1684,7 @@ function AlertDialog({ ...props }) {
|
|
|
1683
1684
|
return /* @__PURE__ */ jsx(AlertDialog$1.Root, { "data-slot": "alert-dialog", ...props });
|
|
1684
1685
|
}
|
|
1685
1686
|
function AlertDialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
1686
|
-
if (asChild &&
|
|
1687
|
+
if (asChild && React19.isValidElement(children)) {
|
|
1687
1688
|
return /* @__PURE__ */ jsx(
|
|
1688
1689
|
AlertDialog$1.Trigger,
|
|
1689
1690
|
{
|
|
@@ -1692,7 +1693,7 @@ function AlertDialogTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1692
1693
|
...props,
|
|
1693
1694
|
render: (triggerProps) => {
|
|
1694
1695
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
1695
|
-
return
|
|
1696
|
+
return React19.cloneElement(
|
|
1696
1697
|
children,
|
|
1697
1698
|
mergePropsWithRef(rest, children)
|
|
1698
1699
|
);
|
|
@@ -1823,7 +1824,7 @@ function DropdownMenuPortal({ ...props }) {
|
|
|
1823
1824
|
return /* @__PURE__ */ jsx(Menu.Portal, { "data-slot": "dropdown-menu-portal", container, ...props });
|
|
1824
1825
|
}
|
|
1825
1826
|
function DropdownMenuTrigger({ asChild, nativeButton, children, ...props }) {
|
|
1826
|
-
if (asChild &&
|
|
1827
|
+
if (asChild && React19.isValidElement(children)) {
|
|
1827
1828
|
return /* @__PURE__ */ jsx(
|
|
1828
1829
|
Menu.Trigger,
|
|
1829
1830
|
{
|
|
@@ -1832,7 +1833,7 @@ function DropdownMenuTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
1832
1833
|
...props,
|
|
1833
1834
|
render: (triggerProps) => {
|
|
1834
1835
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
1835
|
-
return
|
|
1836
|
+
return React19.cloneElement(
|
|
1836
1837
|
children,
|
|
1837
1838
|
mergePropsWithRef(rest, children)
|
|
1838
1839
|
);
|
|
@@ -1891,7 +1892,7 @@ function DropdownMenuItem({
|
|
|
1891
1892
|
data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0`,
|
|
1892
1893
|
className
|
|
1893
1894
|
);
|
|
1894
|
-
if (asChild &&
|
|
1895
|
+
if (asChild && React19.isValidElement(children)) {
|
|
1895
1896
|
return /* @__PURE__ */ jsx(
|
|
1896
1897
|
Menu.Item,
|
|
1897
1898
|
{
|
|
@@ -1902,7 +1903,7 @@ function DropdownMenuItem({
|
|
|
1902
1903
|
render: (itemProps) => {
|
|
1903
1904
|
const childProps = children.props;
|
|
1904
1905
|
const itemOnClick = itemProps.onClick;
|
|
1905
|
-
return
|
|
1906
|
+
return React19.cloneElement(children, {
|
|
1906
1907
|
...itemProps,
|
|
1907
1908
|
className: cn(itemClassName, childProps.className),
|
|
1908
1909
|
onClick: (e) => {
|
|
@@ -2075,19 +2076,19 @@ function DropdownMenuSubContent({ className, ...props }) {
|
|
|
2075
2076
|
}
|
|
2076
2077
|
) }) });
|
|
2077
2078
|
}
|
|
2078
|
-
var SheetStackContext =
|
|
2079
|
+
var SheetStackContext = React19.createContext(void 0);
|
|
2079
2080
|
var SHEET_INDENT = 24;
|
|
2080
2081
|
var useSheetStack = () => {
|
|
2081
|
-
return
|
|
2082
|
+
return React19.useContext(SheetStackContext);
|
|
2082
2083
|
};
|
|
2083
|
-
var SheetNestingContext =
|
|
2084
|
+
var SheetNestingContext = React19.createContext({
|
|
2084
2085
|
level: 0,
|
|
2085
2086
|
parentSheetId: null
|
|
2086
2087
|
});
|
|
2087
|
-
var useSheetNesting = () =>
|
|
2088
|
-
var SheetContext =
|
|
2088
|
+
var useSheetNesting = () => React19.useContext(SheetNestingContext);
|
|
2089
|
+
var SheetContext = React19.createContext(void 0);
|
|
2089
2090
|
var useSheet = () => {
|
|
2090
|
-
const context =
|
|
2091
|
+
const context = React19.useContext(SheetContext);
|
|
2091
2092
|
if (!context) {
|
|
2092
2093
|
throw new Error("useSheet must be used within a Sheet");
|
|
2093
2094
|
}
|
|
@@ -2095,23 +2096,23 @@ var useSheet = () => {
|
|
|
2095
2096
|
};
|
|
2096
2097
|
var sheetIdCounter = 0;
|
|
2097
2098
|
function Sheet({ children, sheetId: providedId, ...props }) {
|
|
2098
|
-
const [isOpen, setIsOpen] =
|
|
2099
|
+
const [isOpen, setIsOpen] = React19.useState(props?.open ?? props?.defaultOpen ?? false);
|
|
2099
2100
|
const sheetStack = useSheetStack();
|
|
2100
2101
|
const nesting = useSheetNesting();
|
|
2101
|
-
const sheetIdRef =
|
|
2102
|
+
const sheetIdRef = React19.useRef(providedId ?? `sheet-${++sheetIdCounter}`);
|
|
2102
2103
|
const sheetId = sheetIdRef.current;
|
|
2103
2104
|
const depth = nesting.level;
|
|
2104
|
-
const onOpenChangeRef =
|
|
2105
|
+
const onOpenChangeRef = React19.useRef(props.onOpenChange);
|
|
2105
2106
|
onOpenChangeRef.current = props.onOpenChange;
|
|
2106
|
-
const close =
|
|
2107
|
+
const close = React19.useCallback(() => {
|
|
2107
2108
|
setIsOpen(false);
|
|
2108
2109
|
onOpenChangeRef.current?.(false);
|
|
2109
2110
|
}, []);
|
|
2110
|
-
const registerSheetRef =
|
|
2111
|
-
const unregisterSheetRef =
|
|
2111
|
+
const registerSheetRef = React19.useRef(sheetStack?.registerSheet);
|
|
2112
|
+
const unregisterSheetRef = React19.useRef(sheetStack?.unregisterSheet);
|
|
2112
2113
|
registerSheetRef.current = sheetStack?.registerSheet;
|
|
2113
2114
|
unregisterSheetRef.current = sheetStack?.unregisterSheet;
|
|
2114
|
-
|
|
2115
|
+
React19.useEffect(() => {
|
|
2115
2116
|
if (registerSheetRef.current && isOpen) {
|
|
2116
2117
|
if (document.activeElement instanceof HTMLElement) {
|
|
2117
2118
|
document.activeElement.blur();
|
|
@@ -2120,10 +2121,10 @@ function Sheet({ children, sheetId: providedId, ...props }) {
|
|
|
2120
2121
|
return () => unregisterSheetRef.current?.(sheetId);
|
|
2121
2122
|
}
|
|
2122
2123
|
}, [isOpen, sheetId, depth, close]);
|
|
2123
|
-
|
|
2124
|
+
React19.useEffect(() => {
|
|
2124
2125
|
if (props?.open !== void 0) setIsOpen(props.open);
|
|
2125
2126
|
}, [props?.open]);
|
|
2126
|
-
const handleOpenChange =
|
|
2127
|
+
const handleOpenChange = React19.useCallback((open, _eventDetails) => {
|
|
2127
2128
|
setIsOpen(open);
|
|
2128
2129
|
onOpenChangeRef.current?.(open);
|
|
2129
2130
|
}, []);
|
|
@@ -2143,7 +2144,7 @@ function Sheet({ children, sheetId: providedId, ...props }) {
|
|
|
2143
2144
|
) }) });
|
|
2144
2145
|
}
|
|
2145
2146
|
function SheetTrigger({ asChild, nativeButton, children, ...props }) {
|
|
2146
|
-
if (asChild &&
|
|
2147
|
+
if (asChild && React19.isValidElement(children)) {
|
|
2147
2148
|
return /* @__PURE__ */ jsx(
|
|
2148
2149
|
Dialog$1.Trigger,
|
|
2149
2150
|
{
|
|
@@ -2152,7 +2153,7 @@ function SheetTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
2152
2153
|
...props,
|
|
2153
2154
|
render: (triggerProps) => {
|
|
2154
2155
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
2155
|
-
return
|
|
2156
|
+
return React19.cloneElement(
|
|
2156
2157
|
children,
|
|
2157
2158
|
mergePropsWithRef(rest, children)
|
|
2158
2159
|
);
|
|
@@ -2163,7 +2164,7 @@ function SheetTrigger({ asChild, nativeButton, children, ...props }) {
|
|
|
2163
2164
|
return /* @__PURE__ */ jsx(Dialog$1.Trigger, { "data-slot": "sheet-trigger", nativeButton, ...props, children });
|
|
2164
2165
|
}
|
|
2165
2166
|
function SheetClose({ asChild, nativeButton, children, ...props }) {
|
|
2166
|
-
if (asChild &&
|
|
2167
|
+
if (asChild && React19.isValidElement(children)) {
|
|
2167
2168
|
return /* @__PURE__ */ jsx(
|
|
2168
2169
|
Dialog$1.Close,
|
|
2169
2170
|
{
|
|
@@ -2172,7 +2173,7 @@ function SheetClose({ asChild, nativeButton, children, ...props }) {
|
|
|
2172
2173
|
...props,
|
|
2173
2174
|
render: (closeProps) => {
|
|
2174
2175
|
const { nativeButton: _, ...rest } = closeProps;
|
|
2175
|
-
return
|
|
2176
|
+
return React19.cloneElement(
|
|
2176
2177
|
children,
|
|
2177
2178
|
mergePropsWithRef(rest, children)
|
|
2178
2179
|
);
|
|
@@ -2289,8 +2290,8 @@ function SheetContent({
|
|
|
2289
2290
|
const topSheetSize = topSheetId ? sheetStack?.getSheetSize(topSheetId) : void 0;
|
|
2290
2291
|
const collapseBaseSize = topSheetSize ? resolvedSide === "left" || resolvedSide === "right" ? topSheetSize.width : topSheetSize.height : void 0;
|
|
2291
2292
|
const pushOffset = getPushOffset(resolvedSide, sheetsAbove, stackMode, collapseBaseSize ?? NESTED_SHEET_WIDTH);
|
|
2292
|
-
const contentRef =
|
|
2293
|
-
|
|
2293
|
+
const contentRef = React19.useRef(null);
|
|
2294
|
+
React19.useLayoutEffect(() => {
|
|
2294
2295
|
if (!isOpen) return;
|
|
2295
2296
|
if (!sheetStack) return;
|
|
2296
2297
|
const el = contentRef.current;
|
|
@@ -2321,11 +2322,11 @@ function SheetContent({
|
|
|
2321
2322
|
duration: durations.normal,
|
|
2322
2323
|
ease: easings.physicalExit
|
|
2323
2324
|
};
|
|
2324
|
-
const isTargetInsideSheet =
|
|
2325
|
+
const isTargetInsideSheet = React19.useCallback((target) => {
|
|
2325
2326
|
if (!target || !(target instanceof HTMLElement)) return false;
|
|
2326
2327
|
return !!target.closest('[data-slot="sheet-content"]');
|
|
2327
2328
|
}, []);
|
|
2328
|
-
const isTargetInsidePopup =
|
|
2329
|
+
const isTargetInsidePopup = React19.useCallback((target) => {
|
|
2329
2330
|
if (!target || !(target instanceof HTMLElement)) return false;
|
|
2330
2331
|
return !!target.closest(
|
|
2331
2332
|
[
|
|
@@ -2338,7 +2339,7 @@ function SheetContent({
|
|
|
2338
2339
|
].join(", ")
|
|
2339
2340
|
);
|
|
2340
2341
|
}, []);
|
|
2341
|
-
|
|
2342
|
+
React19.useEffect(() => {
|
|
2342
2343
|
if (!isOpen) return;
|
|
2343
2344
|
const handlePointerDown = (event) => {
|
|
2344
2345
|
if (sheetsAbove > 0) return;
|
|
@@ -2480,7 +2481,7 @@ function DrawerOverlay({ className, ...props }) {
|
|
|
2480
2481
|
);
|
|
2481
2482
|
}
|
|
2482
2483
|
function DrawerContent({ className, children, ...props }) {
|
|
2483
|
-
return /* @__PURE__ */ jsxs(DrawerPortal, {
|
|
2484
|
+
return /* @__PURE__ */ jsxs(DrawerPortal, { children: [
|
|
2484
2485
|
/* @__PURE__ */ jsx(DrawerOverlay, {}),
|
|
2485
2486
|
/* @__PURE__ */ jsxs(
|
|
2486
2487
|
Drawer$1.Content,
|
|
@@ -2600,7 +2601,7 @@ function Collapsible({
|
|
|
2600
2601
|
}
|
|
2601
2602
|
);
|
|
2602
2603
|
}
|
|
2603
|
-
var CollapsibleTrigger =
|
|
2604
|
+
var CollapsibleTrigger = React19.forwardRef(({ className, asChild, nativeButton, children, ...props }, ref) => {
|
|
2604
2605
|
const triggerClassName = cn(
|
|
2605
2606
|
"group/trigger flex w-full cursor-pointer items-center justify-between text-sm font-medium outline-none transition-colors",
|
|
2606
2607
|
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
|
|
@@ -2609,7 +2610,7 @@ var CollapsibleTrigger = React20.forwardRef(({ className, asChild, nativeButton,
|
|
|
2609
2610
|
"[&[data-panel-open]_[data-slot=collapsible-icon]]:rotate-180",
|
|
2610
2611
|
className
|
|
2611
2612
|
);
|
|
2612
|
-
if (asChild &&
|
|
2613
|
+
if (asChild && React19.isValidElement(children)) {
|
|
2613
2614
|
return /* @__PURE__ */ jsx(
|
|
2614
2615
|
Collapsible$1.Trigger,
|
|
2615
2616
|
{
|
|
@@ -2620,7 +2621,7 @@ var CollapsibleTrigger = React20.forwardRef(({ className, asChild, nativeButton,
|
|
|
2620
2621
|
render: (triggerProps) => {
|
|
2621
2622
|
const { nativeButton: _, ...rest } = triggerProps;
|
|
2622
2623
|
const childProps = children.props;
|
|
2623
|
-
return
|
|
2624
|
+
return React19.cloneElement(
|
|
2624
2625
|
children,
|
|
2625
2626
|
{
|
|
2626
2627
|
...rest,
|
|
@@ -2644,7 +2645,7 @@ var CollapsibleTrigger = React20.forwardRef(({ className, asChild, nativeButton,
|
|
|
2644
2645
|
);
|
|
2645
2646
|
});
|
|
2646
2647
|
CollapsibleTrigger.displayName = "CollapsibleTrigger";
|
|
2647
|
-
var CollapsiblePanel =
|
|
2648
|
+
var CollapsiblePanel = React19.forwardRef(
|
|
2648
2649
|
({ className, innerClassName, children, ...props }, ref) => {
|
|
2649
2650
|
return /* @__PURE__ */ jsx(
|
|
2650
2651
|
Collapsible$1.Panel,
|
|
@@ -3052,35 +3053,6 @@ function AutocompleteSeparator({
|
|
|
3052
3053
|
}
|
|
3053
3054
|
);
|
|
3054
3055
|
}
|
|
3055
|
-
function AutocompleteGroup({
|
|
3056
|
-
className,
|
|
3057
|
-
...props
|
|
3058
|
-
}) {
|
|
3059
|
-
return /* @__PURE__ */ jsx(
|
|
3060
|
-
Autocomplete$1.Group,
|
|
3061
|
-
{
|
|
3062
|
-
className: cn("[[role=group]+&]:mt-1.5", className),
|
|
3063
|
-
"data-slot": "autocomplete-group",
|
|
3064
|
-
...props
|
|
3065
|
-
}
|
|
3066
|
-
);
|
|
3067
|
-
}
|
|
3068
|
-
function AutocompleteGroupLabel({
|
|
3069
|
-
className,
|
|
3070
|
-
...props
|
|
3071
|
-
}) {
|
|
3072
|
-
return /* @__PURE__ */ jsx(
|
|
3073
|
-
Autocomplete$1.GroupLabel,
|
|
3074
|
-
{
|
|
3075
|
-
className: cn(
|
|
3076
|
-
"px-2 py-1.5 font-medium text-muted-foreground text-xs",
|
|
3077
|
-
className
|
|
3078
|
-
),
|
|
3079
|
-
"data-slot": "autocomplete-group-label",
|
|
3080
|
-
...props
|
|
3081
|
-
}
|
|
3082
|
-
);
|
|
3083
|
-
}
|
|
3084
3056
|
function AutocompleteEmpty({
|
|
3085
3057
|
className,
|
|
3086
3058
|
...props
|
|
@@ -3097,22 +3069,6 @@ function AutocompleteEmpty({
|
|
|
3097
3069
|
}
|
|
3098
3070
|
);
|
|
3099
3071
|
}
|
|
3100
|
-
function AutocompleteList({
|
|
3101
|
-
className,
|
|
3102
|
-
...props
|
|
3103
|
-
}) {
|
|
3104
|
-
return /* @__PURE__ */ jsx(ScrollArea, { scrollbarGutter: true, scrollFade: true, children: /* @__PURE__ */ jsx(
|
|
3105
|
-
Autocomplete$1.List,
|
|
3106
|
-
{
|
|
3107
|
-
className: cn(
|
|
3108
|
-
"not-empty:scroll-py-1 not-empty:p-1 in-data-has-overflow-y:pe-3",
|
|
3109
|
-
className
|
|
3110
|
-
),
|
|
3111
|
-
"data-slot": "autocomplete-list",
|
|
3112
|
-
...props
|
|
3113
|
-
}
|
|
3114
|
-
) });
|
|
3115
|
-
}
|
|
3116
3072
|
function AutocompleteClear({
|
|
3117
3073
|
className,
|
|
3118
3074
|
...props
|
|
@@ -3143,49 +3099,46 @@ function AutocompleteTrigger({
|
|
|
3143
3099
|
}
|
|
3144
3100
|
);
|
|
3145
3101
|
}
|
|
3146
|
-
var CommandInputContext = React20.createContext({
|
|
3147
|
-
inputRef: null
|
|
3148
|
-
});
|
|
3149
|
-
Dialog$1.Root;
|
|
3150
3102
|
function Command({
|
|
3151
|
-
|
|
3152
|
-
keepHighlight = true,
|
|
3153
|
-
open = true,
|
|
3103
|
+
className,
|
|
3154
3104
|
...props
|
|
3155
3105
|
}) {
|
|
3156
|
-
const AutocompleteAny = Autocomplete;
|
|
3157
3106
|
return /* @__PURE__ */ jsx(
|
|
3158
|
-
|
|
3107
|
+
Command$1,
|
|
3159
3108
|
{
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3109
|
+
className: cn(
|
|
3110
|
+
"flex h-full w-full flex-col overflow-hidden rounded-2xl",
|
|
3111
|
+
className
|
|
3112
|
+
),
|
|
3113
|
+
"data-slot": "command",
|
|
3163
3114
|
...props
|
|
3164
3115
|
}
|
|
3165
3116
|
);
|
|
3166
3117
|
}
|
|
3167
3118
|
function CommandInput({
|
|
3168
3119
|
className,
|
|
3169
|
-
placeholder
|
|
3170
|
-
value,
|
|
3171
|
-
onValueChange,
|
|
3120
|
+
placeholder,
|
|
3172
3121
|
...props
|
|
3173
3122
|
}) {
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
AutocompleteInput,
|
|
3123
|
+
return /* @__PURE__ */ jsx("div", { className: "px-2.5 py-1.5", "data-slot": "command-input-wrapper", children: /* @__PURE__ */ jsxs(
|
|
3124
|
+
"div",
|
|
3177
3125
|
{
|
|
3178
3126
|
className: cn(
|
|
3179
|
-
"
|
|
3127
|
+
"flex items-center gap-2 rounded-lg px-3 text-base",
|
|
3180
3128
|
className
|
|
3181
3129
|
),
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3130
|
+
children: [
|
|
3131
|
+
/* @__PURE__ */ jsx(SearchIcon, { className: "size-4 shrink-0 text-muted-foreground" }),
|
|
3132
|
+
/* @__PURE__ */ jsx(
|
|
3133
|
+
Command$1.Input,
|
|
3134
|
+
{
|
|
3135
|
+
className: "flex h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
3136
|
+
placeholder,
|
|
3137
|
+
"data-slot": "command-input",
|
|
3138
|
+
...props
|
|
3139
|
+
}
|
|
3140
|
+
)
|
|
3141
|
+
]
|
|
3189
3142
|
}
|
|
3190
3143
|
) });
|
|
3191
3144
|
}
|
|
@@ -3194,9 +3147,9 @@ function CommandList({
|
|
|
3194
3147
|
...props
|
|
3195
3148
|
}) {
|
|
3196
3149
|
return /* @__PURE__ */ jsx(
|
|
3197
|
-
|
|
3150
|
+
Command$1.List,
|
|
3198
3151
|
{
|
|
3199
|
-
className: cn("not-empty:scroll-py-2 not-empty:p-2", className),
|
|
3152
|
+
className: cn("not-empty:scroll-py-2 not-empty:p-2 max-h-[300px] overflow-y-auto overflow-x-hidden", className),
|
|
3200
3153
|
"data-slot": "command-list",
|
|
3201
3154
|
...props
|
|
3202
3155
|
}
|
|
@@ -3207,7 +3160,7 @@ function CommandEmpty({
|
|
|
3207
3160
|
...props
|
|
3208
3161
|
}) {
|
|
3209
3162
|
return /* @__PURE__ */ jsx(
|
|
3210
|
-
|
|
3163
|
+
Command$1.Empty,
|
|
3211
3164
|
{
|
|
3212
3165
|
className: cn("not-empty:py-6", className),
|
|
3213
3166
|
"data-slot": "command-empty",
|
|
@@ -3221,29 +3174,17 @@ function CommandGroup({
|
|
|
3221
3174
|
children,
|
|
3222
3175
|
...props
|
|
3223
3176
|
}) {
|
|
3224
|
-
return /* @__PURE__ */
|
|
3225
|
-
|
|
3177
|
+
return /* @__PURE__ */ jsx(
|
|
3178
|
+
Command$1.Group,
|
|
3226
3179
|
{
|
|
3227
|
-
className
|
|
3180
|
+
className: cn(
|
|
3181
|
+
"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",
|
|
3182
|
+
className
|
|
3183
|
+
),
|
|
3184
|
+
heading,
|
|
3228
3185
|
"data-slot": "command-group",
|
|
3229
3186
|
...props,
|
|
3230
|
-
children
|
|
3231
|
-
heading && /* @__PURE__ */ jsx(CommandGroupLabel, { children: heading }),
|
|
3232
|
-
children
|
|
3233
|
-
]
|
|
3234
|
-
}
|
|
3235
|
-
);
|
|
3236
|
-
}
|
|
3237
|
-
function CommandGroupLabel({
|
|
3238
|
-
className,
|
|
3239
|
-
...props
|
|
3240
|
-
}) {
|
|
3241
|
-
return /* @__PURE__ */ jsx(
|
|
3242
|
-
AutocompleteGroupLabel,
|
|
3243
|
-
{
|
|
3244
|
-
className,
|
|
3245
|
-
"data-slot": "command-group-label",
|
|
3246
|
-
...props
|
|
3187
|
+
children
|
|
3247
3188
|
}
|
|
3248
3189
|
);
|
|
3249
3190
|
}
|
|
@@ -3252,20 +3193,23 @@ function CommandItem({
|
|
|
3252
3193
|
...props
|
|
3253
3194
|
}) {
|
|
3254
3195
|
return /* @__PURE__ */ jsx(
|
|
3255
|
-
|
|
3196
|
+
Command$1.Item,
|
|
3256
3197
|
{
|
|
3257
|
-
className: cn(
|
|
3198
|
+
className: cn(
|
|
3199
|
+
"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",
|
|
3200
|
+
className
|
|
3201
|
+
),
|
|
3258
3202
|
"data-slot": "command-item",
|
|
3259
3203
|
...props
|
|
3260
3204
|
}
|
|
3261
3205
|
);
|
|
3262
3206
|
}
|
|
3263
|
-
var ComboboxContext =
|
|
3207
|
+
var ComboboxContext = React19.createContext({
|
|
3264
3208
|
chipsRef: null,
|
|
3265
3209
|
multiple: false
|
|
3266
3210
|
});
|
|
3267
3211
|
function Combobox(props) {
|
|
3268
|
-
const chipsRef =
|
|
3212
|
+
const chipsRef = React19.useRef(null);
|
|
3269
3213
|
return /* @__PURE__ */ jsx(ComboboxContext.Provider, { value: { chipsRef, multiple: !!props.multiple }, children: /* @__PURE__ */ jsx(
|
|
3270
3214
|
Combobox$1.Root,
|
|
3271
3215
|
{
|
|
@@ -3281,7 +3225,7 @@ function ComboboxInput({
|
|
|
3281
3225
|
size,
|
|
3282
3226
|
...props
|
|
3283
3227
|
}) {
|
|
3284
|
-
const { multiple } =
|
|
3228
|
+
const { multiple } = React19.useContext(ComboboxContext);
|
|
3285
3229
|
const sizeValue = size ?? "default";
|
|
3286
3230
|
if (multiple) {
|
|
3287
3231
|
return /* @__PURE__ */ jsx(
|
|
@@ -3363,7 +3307,7 @@ function ComboboxPopup({
|
|
|
3363
3307
|
sideOffset = 4,
|
|
3364
3308
|
...props
|
|
3365
3309
|
}) {
|
|
3366
|
-
const { chipsRef, multiple } =
|
|
3310
|
+
const { chipsRef, multiple } = React19.useContext(ComboboxContext);
|
|
3367
3311
|
const { container, zIndexClass } = useFloatingOverlayPortalProps();
|
|
3368
3312
|
return /* @__PURE__ */ jsx(Combobox$1.Portal, { container, children: /* @__PURE__ */ jsx(
|
|
3369
3313
|
Combobox$1.Positioner,
|
|
@@ -3441,7 +3385,10 @@ function ComboboxSeparator({
|
|
|
3441
3385
|
}
|
|
3442
3386
|
);
|
|
3443
3387
|
}
|
|
3444
|
-
function ComboboxGroup({
|
|
3388
|
+
function ComboboxGroup({
|
|
3389
|
+
className,
|
|
3390
|
+
...props
|
|
3391
|
+
}) {
|
|
3445
3392
|
return /* @__PURE__ */ jsx(
|
|
3446
3393
|
Combobox$1.Group,
|
|
3447
3394
|
{
|
|
@@ -3451,7 +3398,10 @@ function ComboboxGroup({ className, ...props }) {
|
|
|
3451
3398
|
}
|
|
3452
3399
|
);
|
|
3453
3400
|
}
|
|
3454
|
-
function ComboboxEmpty({
|
|
3401
|
+
function ComboboxEmpty({
|
|
3402
|
+
className,
|
|
3403
|
+
...props
|
|
3404
|
+
}) {
|
|
3455
3405
|
return /* @__PURE__ */ jsx(
|
|
3456
3406
|
Combobox$1.Empty,
|
|
3457
3407
|
{
|
|
@@ -3464,7 +3414,10 @@ function ComboboxEmpty({ className, ...props }) {
|
|
|
3464
3414
|
}
|
|
3465
3415
|
);
|
|
3466
3416
|
}
|
|
3467
|
-
function ComboboxList({
|
|
3417
|
+
function ComboboxList({
|
|
3418
|
+
className,
|
|
3419
|
+
...props
|
|
3420
|
+
}) {
|
|
3468
3421
|
return /* @__PURE__ */ jsx(ScrollArea, { scrollbarGutter: true, scrollFade: true, children: /* @__PURE__ */ jsx(
|
|
3469
3422
|
Combobox$1.List,
|
|
3470
3423
|
{
|
|
@@ -3477,7 +3430,10 @@ function ComboboxList({ className, ...props }) {
|
|
|
3477
3430
|
}
|
|
3478
3431
|
) });
|
|
3479
3432
|
}
|
|
3480
|
-
function ComboboxClear({
|
|
3433
|
+
function ComboboxClear({
|
|
3434
|
+
className,
|
|
3435
|
+
...props
|
|
3436
|
+
}) {
|
|
3481
3437
|
return /* @__PURE__ */ jsx(
|
|
3482
3438
|
Combobox$1.Clear,
|
|
3483
3439
|
{
|
|
@@ -3553,7 +3509,7 @@ function OptionItem({
|
|
|
3553
3509
|
}
|
|
3554
3510
|
);
|
|
3555
3511
|
}
|
|
3556
|
-
var MultiSelect =
|
|
3512
|
+
var MultiSelect = React19.forwardRef(
|
|
3557
3513
|
({
|
|
3558
3514
|
options,
|
|
3559
3515
|
onValueChange,
|
|
@@ -3579,38 +3535,38 @@ var MultiSelect = React20.forwardRef(
|
|
|
3579
3535
|
onClick,
|
|
3580
3536
|
...props
|
|
3581
3537
|
}, ref) => {
|
|
3582
|
-
const [selectedValues, setSelectedValues] =
|
|
3583
|
-
const [isPopoverOpen, setIsPopoverOpen] =
|
|
3584
|
-
const [searchValue, setSearchValue] =
|
|
3585
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
3586
|
-
const multiSelectId =
|
|
3538
|
+
const [selectedValues, setSelectedValues] = React19.useState(defaultValue);
|
|
3539
|
+
const [isPopoverOpen, setIsPopoverOpen] = React19.useState(false);
|
|
3540
|
+
const [searchValue, setSearchValue] = React19.useState("");
|
|
3541
|
+
const [highlightedIndex, setHighlightedIndex] = React19.useState(-1);
|
|
3542
|
+
const multiSelectId = React19.useId();
|
|
3587
3543
|
const listboxId = `${multiSelectId}-listbox`;
|
|
3588
3544
|
const triggerDescriptionId = `${multiSelectId}-description`;
|
|
3589
3545
|
const selectedCountId = `${multiSelectId}-count`;
|
|
3590
3546
|
const searchInputId = `${multiSelectId}-search`;
|
|
3591
|
-
const searchInputRef =
|
|
3592
|
-
const listRef =
|
|
3593
|
-
const prevDefaultValueRef =
|
|
3594
|
-
const isGroupedOptions =
|
|
3547
|
+
const searchInputRef = React19.useRef(null);
|
|
3548
|
+
const listRef = React19.useRef(null);
|
|
3549
|
+
const prevDefaultValueRef = React19.useRef(defaultValue);
|
|
3550
|
+
const isGroupedOptions = React19.useCallback(
|
|
3595
3551
|
(opts) => {
|
|
3596
3552
|
return opts.length > 0 && "heading" in opts[0];
|
|
3597
3553
|
},
|
|
3598
3554
|
[]
|
|
3599
3555
|
);
|
|
3600
|
-
const arraysEqual =
|
|
3556
|
+
const arraysEqual = React19.useCallback((a, b) => {
|
|
3601
3557
|
if (a.length !== b.length) return false;
|
|
3602
3558
|
const sortedA = [...a].sort();
|
|
3603
3559
|
const sortedB = [...b].sort();
|
|
3604
3560
|
return sortedA.every((val, index) => val === sortedB[index]);
|
|
3605
3561
|
}, []);
|
|
3606
|
-
const resetToDefault =
|
|
3562
|
+
const resetToDefault = React19.useCallback(() => {
|
|
3607
3563
|
setSelectedValues(defaultValue);
|
|
3608
3564
|
setIsPopoverOpen(false);
|
|
3609
3565
|
setSearchValue("");
|
|
3610
3566
|
onValueChange(defaultValue);
|
|
3611
3567
|
}, [defaultValue, onValueChange]);
|
|
3612
|
-
const buttonRef =
|
|
3613
|
-
|
|
3568
|
+
const buttonRef = React19.useRef(null);
|
|
3569
|
+
React19.useImperativeHandle(
|
|
3614
3570
|
ref,
|
|
3615
3571
|
() => ({
|
|
3616
3572
|
reset: resetToDefault,
|
|
@@ -3641,8 +3597,8 @@ var MultiSelect = React20.forwardRef(
|
|
|
3641
3597
|
}),
|
|
3642
3598
|
[resetToDefault, selectedValues, onValueChange]
|
|
3643
3599
|
);
|
|
3644
|
-
const [screenSize, setScreenSize] =
|
|
3645
|
-
|
|
3600
|
+
const [screenSize, setScreenSize] = React19.useState("desktop");
|
|
3601
|
+
React19.useEffect(() => {
|
|
3646
3602
|
if (typeof window === "undefined") return;
|
|
3647
3603
|
const handleResize = () => {
|
|
3648
3604
|
const width = window.innerWidth;
|
|
@@ -3691,7 +3647,7 @@ var MultiSelect = React20.forwardRef(
|
|
|
3691
3647
|
};
|
|
3692
3648
|
};
|
|
3693
3649
|
const responsiveSettings = getResponsiveSettings();
|
|
3694
|
-
const getAllOptions =
|
|
3650
|
+
const getAllOptions = React19.useCallback(() => {
|
|
3695
3651
|
if (options.length === 0) return [];
|
|
3696
3652
|
let allOptions;
|
|
3697
3653
|
if (isGroupedOptions(options)) {
|
|
@@ -3721,7 +3677,7 @@ var MultiSelect = React20.forwardRef(
|
|
|
3721
3677
|
}
|
|
3722
3678
|
return deduplicateOptions ? uniqueOptions : allOptions;
|
|
3723
3679
|
}, [options, deduplicateOptions, isGroupedOptions]);
|
|
3724
|
-
const getOptionByValue =
|
|
3680
|
+
const getOptionByValue = React19.useCallback(
|
|
3725
3681
|
(value) => {
|
|
3726
3682
|
const option = getAllOptions().find((option2) => option2.value === value);
|
|
3727
3683
|
if (!option && process.env.NODE_ENV === "development") {
|
|
@@ -3731,7 +3687,7 @@ var MultiSelect = React20.forwardRef(
|
|
|
3731
3687
|
},
|
|
3732
3688
|
[getAllOptions]
|
|
3733
3689
|
);
|
|
3734
|
-
const filteredOptions =
|
|
3690
|
+
const filteredOptions = React19.useMemo(() => {
|
|
3735
3691
|
if (!searchable || !searchValue) return options;
|
|
3736
3692
|
if (options.length === 0) return [];
|
|
3737
3693
|
if (isGroupedOptions(options)) {
|
|
@@ -3746,13 +3702,13 @@ var MultiSelect = React20.forwardRef(
|
|
|
3746
3702
|
(option) => option.label.toLowerCase().includes(searchValue.toLowerCase()) || option.value.toLowerCase().includes(searchValue.toLowerCase())
|
|
3747
3703
|
);
|
|
3748
3704
|
}, [options, searchValue, searchable, isGroupedOptions]);
|
|
3749
|
-
const flatFilteredOptions =
|
|
3705
|
+
const flatFilteredOptions = React19.useMemo(() => {
|
|
3750
3706
|
if (isGroupedOptions(filteredOptions)) {
|
|
3751
3707
|
return filteredOptions.flatMap((group) => group.options);
|
|
3752
3708
|
}
|
|
3753
3709
|
return filteredOptions;
|
|
3754
3710
|
}, [filteredOptions, isGroupedOptions]);
|
|
3755
|
-
const toggleOption =
|
|
3711
|
+
const toggleOption = React19.useCallback(
|
|
3756
3712
|
(optionValue) => {
|
|
3757
3713
|
if (disabled) return;
|
|
3758
3714
|
const option = getOptionByValue(optionValue);
|
|
@@ -3781,7 +3737,7 @@ var MultiSelect = React20.forwardRef(
|
|
|
3781
3737
|
setSelectedValues(newSelectedValues);
|
|
3782
3738
|
onValueChange(newSelectedValues);
|
|
3783
3739
|
};
|
|
3784
|
-
const handleKeyDown =
|
|
3740
|
+
const handleKeyDown = React19.useCallback(
|
|
3785
3741
|
(event) => {
|
|
3786
3742
|
const optionsCount = flatFilteredOptions.length;
|
|
3787
3743
|
if (optionsCount === 0) return;
|
|
@@ -3819,7 +3775,7 @@ var MultiSelect = React20.forwardRef(
|
|
|
3819
3775
|
},
|
|
3820
3776
|
[flatFilteredOptions, highlightedIndex, toggleOption, searchValue, selectedValues, onValueChange]
|
|
3821
3777
|
);
|
|
3822
|
-
|
|
3778
|
+
React19.useEffect(() => {
|
|
3823
3779
|
if (!resetOnDefaultValueChange) return;
|
|
3824
3780
|
const prevDefaultValue = prevDefaultValueRef.current;
|
|
3825
3781
|
if (!arraysEqual(prevDefaultValue, defaultValue)) {
|
|
@@ -3840,17 +3796,17 @@ var MultiSelect = React20.forwardRef(
|
|
|
3840
3796
|
};
|
|
3841
3797
|
};
|
|
3842
3798
|
const widthConstraints = getWidthConstraints();
|
|
3843
|
-
const effectiveDropdownMaxHeight =
|
|
3799
|
+
const effectiveDropdownMaxHeight = React19.useMemo(() => {
|
|
3844
3800
|
if (dropdownMaxHeight) return dropdownMaxHeight;
|
|
3845
3801
|
return screenSize === "mobile" ? "70vh" : "60vh";
|
|
3846
3802
|
}, [dropdownMaxHeight, screenSize]);
|
|
3847
|
-
|
|
3803
|
+
React19.useEffect(() => {
|
|
3848
3804
|
if (!isPopoverOpen) {
|
|
3849
3805
|
setSearchValue("");
|
|
3850
3806
|
setHighlightedIndex(-1);
|
|
3851
3807
|
}
|
|
3852
3808
|
}, [isPopoverOpen]);
|
|
3853
|
-
|
|
3809
|
+
React19.useEffect(() => {
|
|
3854
3810
|
if (isPopoverOpen && searchable && searchInputRef.current) {
|
|
3855
3811
|
const timer = setTimeout(() => {
|
|
3856
3812
|
searchInputRef.current?.focus();
|
|
@@ -3858,10 +3814,10 @@ var MultiSelect = React20.forwardRef(
|
|
|
3858
3814
|
return () => clearTimeout(timer);
|
|
3859
3815
|
}
|
|
3860
3816
|
}, [isPopoverOpen, searchable]);
|
|
3861
|
-
|
|
3817
|
+
React19.useEffect(() => {
|
|
3862
3818
|
setHighlightedIndex(flatFilteredOptions.length > 0 ? 0 : -1);
|
|
3863
3819
|
}, [searchValue, flatFilteredOptions.length]);
|
|
3864
|
-
const totalFilteredCount =
|
|
3820
|
+
const totalFilteredCount = React19.useMemo(() => {
|
|
3865
3821
|
if (isGroupedOptions(filteredOptions)) {
|
|
3866
3822
|
return filteredOptions.reduce((acc, group) => acc + group.options.length, 0);
|
|
3867
3823
|
}
|
|
@@ -4378,8 +4334,8 @@ function Stepper({
|
|
|
4378
4334
|
className,
|
|
4379
4335
|
...props
|
|
4380
4336
|
}) {
|
|
4381
|
-
const [activeStep, setInternalStep] =
|
|
4382
|
-
const setActiveStep =
|
|
4337
|
+
const [activeStep, setInternalStep] = React19.useState(defaultValue);
|
|
4338
|
+
const setActiveStep = React19.useCallback(
|
|
4383
4339
|
(step) => {
|
|
4384
4340
|
if (value === void 0) {
|
|
4385
4341
|
setInternalStep(step);
|
|
@@ -4548,8 +4504,8 @@ function StepperSeparator({ className, ...props }) {
|
|
|
4548
4504
|
}
|
|
4549
4505
|
var MOBILE_BREAKPOINT = 768;
|
|
4550
4506
|
function useIsMobile() {
|
|
4551
|
-
const [isMobile, setIsMobile] =
|
|
4552
|
-
|
|
4507
|
+
const [isMobile, setIsMobile] = React19.useState(false);
|
|
4508
|
+
React19.useEffect(() => {
|
|
4553
4509
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
4554
4510
|
const onChange = () => {
|
|
4555
4511
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -4566,9 +4522,9 @@ var SIDEBAR_WIDTH = "14rem";
|
|
|
4566
4522
|
var SIDEBAR_WIDTH_MOBILE = "16rem";
|
|
4567
4523
|
var SIDEBAR_WIDTH_ICON = "4rem";
|
|
4568
4524
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
4569
|
-
var SidebarContext =
|
|
4525
|
+
var SidebarContext = React19.createContext(null);
|
|
4570
4526
|
function useSidebar() {
|
|
4571
|
-
const context =
|
|
4527
|
+
const context = React19.useContext(SidebarContext);
|
|
4572
4528
|
if (!context) {
|
|
4573
4529
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
4574
4530
|
}
|
|
@@ -4584,11 +4540,11 @@ function SidebarProvider({
|
|
|
4584
4540
|
...props
|
|
4585
4541
|
}) {
|
|
4586
4542
|
const isMobile = useIsMobile();
|
|
4587
|
-
const [openMobile, setOpenMobile] =
|
|
4588
|
-
const [isHovered, setIsHovered] =
|
|
4589
|
-
const [_open, _setOpen] =
|
|
4543
|
+
const [openMobile, setOpenMobile] = React19.useState(false);
|
|
4544
|
+
const [isHovered, setIsHovered] = React19.useState(false);
|
|
4545
|
+
const [_open, _setOpen] = React19.useState(defaultOpen);
|
|
4590
4546
|
const open = openProp ?? _open;
|
|
4591
|
-
const setOpen =
|
|
4547
|
+
const setOpen = React19.useCallback(
|
|
4592
4548
|
(value) => {
|
|
4593
4549
|
const openState = typeof value === "function" ? value(open) : value;
|
|
4594
4550
|
if (setOpenProp) {
|
|
@@ -4600,10 +4556,10 @@ function SidebarProvider({
|
|
|
4600
4556
|
},
|
|
4601
4557
|
[setOpenProp, open]
|
|
4602
4558
|
);
|
|
4603
|
-
const toggleSidebar =
|
|
4559
|
+
const toggleSidebar = React19.useCallback(() => {
|
|
4604
4560
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
4605
4561
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
4606
|
-
|
|
4562
|
+
React19.useEffect(() => {
|
|
4607
4563
|
const handleKeyDown = (event) => {
|
|
4608
4564
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
4609
4565
|
event.preventDefault();
|
|
@@ -4615,7 +4571,7 @@ function SidebarProvider({
|
|
|
4615
4571
|
}, [toggleSidebar]);
|
|
4616
4572
|
const effectiveOpen = isMobile ? open : isHovered || open;
|
|
4617
4573
|
const state = effectiveOpen ? "expanded" : "collapsed";
|
|
4618
|
-
const contextValue =
|
|
4574
|
+
const contextValue = React19.useMemo(
|
|
4619
4575
|
() => ({
|
|
4620
4576
|
state,
|
|
4621
4577
|
open,
|
|
@@ -5036,7 +4992,7 @@ function SidebarMenuSkeleton({
|
|
|
5036
4992
|
showIcon = false,
|
|
5037
4993
|
...props
|
|
5038
4994
|
}) {
|
|
5039
|
-
const width =
|
|
4995
|
+
const width = React19.useMemo(() => {
|
|
5040
4996
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
5041
4997
|
}, []);
|
|
5042
4998
|
return /* @__PURE__ */ jsxs(
|
|
@@ -5186,7 +5142,7 @@ function RangeCalendar({ className, ...props }) {
|
|
|
5186
5142
|
/* @__PURE__ */ jsx(CalendarGridComponent, { isRange: true })
|
|
5187
5143
|
] });
|
|
5188
5144
|
}
|
|
5189
|
-
var AceEditor =
|
|
5145
|
+
var AceEditor = React19.lazy(async () => {
|
|
5190
5146
|
const ace = await import('react-ace');
|
|
5191
5147
|
await import('ace-builds/src-noconflict/mode-json');
|
|
5192
5148
|
await import('ace-builds/src-noconflict/theme-textmate');
|
|
@@ -5335,7 +5291,7 @@ var dockVariants = cva(
|
|
|
5335
5291
|
// Solid themed surface (no glass/blur)
|
|
5336
5292
|
"mx-auto mt-8 flex h-[58px] w-max items-center justify-center gap-2 rounded-2xl border bg-card p-2 shadow"
|
|
5337
5293
|
);
|
|
5338
|
-
var Dock =
|
|
5294
|
+
var Dock = React19__default.forwardRef(
|
|
5339
5295
|
({
|
|
5340
5296
|
className,
|
|
5341
5297
|
children,
|
|
@@ -5347,9 +5303,9 @@ var Dock = React20__default.forwardRef(
|
|
|
5347
5303
|
}, ref) => {
|
|
5348
5304
|
const mouseX = useMotionValue(Infinity);
|
|
5349
5305
|
const renderChildren = () => {
|
|
5350
|
-
return
|
|
5351
|
-
if (
|
|
5352
|
-
return
|
|
5306
|
+
return React19__default.Children.map(children, (child) => {
|
|
5307
|
+
if (React19__default.isValidElement(child) && child.type === DockIcon) {
|
|
5308
|
+
return React19__default.cloneElement(child, {
|
|
5353
5309
|
...child.props,
|
|
5354
5310
|
mouseX,
|
|
5355
5311
|
size: iconSize,
|
|
@@ -5575,9 +5531,9 @@ var MotionGrid = ({
|
|
|
5575
5531
|
}) => {
|
|
5576
5532
|
const [cols, rows] = gridSize;
|
|
5577
5533
|
const frames = useLoadingFrames(cols, rows);
|
|
5578
|
-
const [index, setIndex] =
|
|
5579
|
-
const intervalRef =
|
|
5580
|
-
|
|
5534
|
+
const [index, setIndex] = React19.useState(0);
|
|
5535
|
+
const intervalRef = React19.useRef(null);
|
|
5536
|
+
React19.useEffect(() => {
|
|
5581
5537
|
if (!animate || frames.length === 0) return;
|
|
5582
5538
|
intervalRef.current = setInterval(() => setIndex((i) => (i + 1) % frames.length), duration);
|
|
5583
5539
|
return () => clearInterval(intervalRef.current);
|
|
@@ -5610,7 +5566,7 @@ var MotionGrid = ({
|
|
|
5610
5566
|
);
|
|
5611
5567
|
};
|
|
5612
5568
|
var useLoadingFrames = (cols = 8, rows = 4) => {
|
|
5613
|
-
const loadingFrames =
|
|
5569
|
+
const loadingFrames = React19.useMemo(() => {
|
|
5614
5570
|
const frames = [];
|
|
5615
5571
|
for (let s = 0; s < cols + rows; s++) {
|
|
5616
5572
|
const dots = [];
|
|
@@ -5760,10 +5716,12 @@ function ResponsiveDiagram({ children, targetRatio = 0.95, className }) {
|
|
|
5760
5716
|
const calculateZoom = useCallback(() => {
|
|
5761
5717
|
if (!containerRef.current || !contentRef.current) return;
|
|
5762
5718
|
contentRef.current.style.transform = "scale(1)";
|
|
5763
|
-
const
|
|
5764
|
-
const
|
|
5765
|
-
const
|
|
5766
|
-
const
|
|
5719
|
+
const style = getComputedStyle(containerRef.current);
|
|
5720
|
+
const padH = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
|
|
5721
|
+
const containerW = containerRef.current.clientWidth - padH;
|
|
5722
|
+
const contentW = contentRef.current.scrollWidth;
|
|
5723
|
+
const targetW = containerW * targetRatio;
|
|
5724
|
+
const newZoom = contentW > targetW ? targetW / contentW : 1;
|
|
5767
5725
|
setZoom(newZoom);
|
|
5768
5726
|
contentRef.current.style.transform = `scale(${newZoom})`;
|
|
5769
5727
|
}, [targetRatio]);
|
|
@@ -5895,6 +5853,13 @@ function stackReducer(state, action) {
|
|
|
5895
5853
|
newCards[index] = { ...newCards[index], width: action.width };
|
|
5896
5854
|
return { cards: newCards };
|
|
5897
5855
|
}
|
|
5856
|
+
case "SET_DISMISSABLE": {
|
|
5857
|
+
const index = state.cards.findIndex((c) => c.id === action.id);
|
|
5858
|
+
if (index === -1) return state;
|
|
5859
|
+
const newCards = [...state.cards];
|
|
5860
|
+
newCards[index] = { ...newCards[index], dismissable: action.dismissable };
|
|
5861
|
+
return { cards: newCards };
|
|
5862
|
+
}
|
|
5898
5863
|
case "DISMISS": {
|
|
5899
5864
|
const index = state.cards.findIndex((c) => c.id === action.id);
|
|
5900
5865
|
if (index === -1) return state;
|
|
@@ -6011,6 +5976,9 @@ function CardStackProvider({
|
|
|
6011
5976
|
const setWidth = (id, width) => {
|
|
6012
5977
|
dispatch({ type: "SET_WIDTH", id, width });
|
|
6013
5978
|
};
|
|
5979
|
+
const setDismissable = (id, dismissable) => {
|
|
5980
|
+
dispatch({ type: "SET_DISMISSABLE", id, dismissable });
|
|
5981
|
+
};
|
|
6014
5982
|
const dismiss = (id, options) => {
|
|
6015
5983
|
const cascade = options?.cascade ?? true;
|
|
6016
5984
|
dispatch({ type: "DISMISS", id, cascade });
|
|
@@ -6038,6 +6006,7 @@ function CardStackProvider({
|
|
|
6038
6006
|
setTitle,
|
|
6039
6007
|
setDescription,
|
|
6040
6008
|
setWidth,
|
|
6009
|
+
setDismissable,
|
|
6041
6010
|
dismiss,
|
|
6042
6011
|
insertAt
|
|
6043
6012
|
};
|
|
@@ -6047,7 +6016,10 @@ function CardStackProvider({
|
|
|
6047
6016
|
if (event.key === "Escape" && stateRef.current.cards.length > 0) {
|
|
6048
6017
|
event.preventDefault();
|
|
6049
6018
|
event.stopPropagation();
|
|
6050
|
-
|
|
6019
|
+
const topCard = stateRef.current.cards[stateRef.current.cards.length - 1];
|
|
6020
|
+
if (topCard.dismissable !== false) {
|
|
6021
|
+
api.pop();
|
|
6022
|
+
}
|
|
6051
6023
|
}
|
|
6052
6024
|
};
|
|
6053
6025
|
document.addEventListener("keydown", handleEscape, true);
|
|
@@ -6119,6 +6091,7 @@ function useCardInjectedProps(id) {
|
|
|
6119
6091
|
setTitle: (title) => api.setTitle(id, title),
|
|
6120
6092
|
setDescription: (description) => api.setDescription(id, description),
|
|
6121
6093
|
setWidth: (width) => api.setWidth(id, width),
|
|
6094
|
+
setDismissable: (dismissable) => api.setDismissable(id, dismissable),
|
|
6122
6095
|
updateProps: (patch) => api.updateProps(id, patch)
|
|
6123
6096
|
}
|
|
6124
6097
|
}),
|
|
@@ -6263,16 +6236,17 @@ var reducedMotionBackdropVariants = {
|
|
|
6263
6236
|
exit: { opacity: 0, transition: { duration: 0 } }
|
|
6264
6237
|
};
|
|
6265
6238
|
function StackBackdrop({ className, onClick, config: backdropConfig }) {
|
|
6266
|
-
const { config } = useStackContext();
|
|
6239
|
+
const { config, state } = useStackContext();
|
|
6267
6240
|
const api = useCardStack();
|
|
6268
6241
|
const prefersReducedMotion = useReducedMotion();
|
|
6269
|
-
const handleClick =
|
|
6242
|
+
const handleClick = React19.useCallback(() => {
|
|
6243
|
+
if (state.cards.some((c) => c.dismissable === false)) return;
|
|
6270
6244
|
if (onClick) {
|
|
6271
6245
|
onClick();
|
|
6272
6246
|
} else {
|
|
6273
6247
|
api.clear();
|
|
6274
6248
|
}
|
|
6275
|
-
}, [onClick, api]);
|
|
6249
|
+
}, [onClick, api, state.cards]);
|
|
6276
6250
|
const variants2 = prefersReducedMotion ? reducedMotionBackdropVariants : backdropVariants;
|
|
6277
6251
|
const useBlur = backdropConfig?.blur ?? false;
|
|
6278
6252
|
return /* @__PURE__ */ jsx(
|
|
@@ -6341,7 +6315,7 @@ function StackHeader({ card, onClose, className, renderTitle }) {
|
|
|
6341
6315
|
title && /* @__PURE__ */ jsx("h2", { className: cn("text-foreground truncate", styles.title), children: title }),
|
|
6342
6316
|
card.description && /* @__PURE__ */ jsx("p", { className: cn("text-muted-foreground truncate", styles.description), children: card.description })
|
|
6343
6317
|
] }),
|
|
6344
|
-
/* @__PURE__ */ jsx(
|
|
6318
|
+
card.dismissable !== false && /* @__PURE__ */ jsx(
|
|
6345
6319
|
"button",
|
|
6346
6320
|
{
|
|
6347
6321
|
type: "button",
|
|
@@ -6732,11 +6706,15 @@ function StackCardInner({
|
|
|
6732
6706
|
api.dismiss(card.id);
|
|
6733
6707
|
}, [api, card.id]);
|
|
6734
6708
|
const handlePeekClick = useCallback(() => {
|
|
6709
|
+
const cardsAbove = state.cards.slice(index + 1);
|
|
6710
|
+
if (cardsAbove.some((c) => c.dismissable === false)) return;
|
|
6735
6711
|
api.popTo(card.id);
|
|
6736
|
-
}, [api, card.id]);
|
|
6712
|
+
}, [api, card.id, state.cards, index]);
|
|
6737
6713
|
const handlePeekDragDismiss = useCallback(() => {
|
|
6714
|
+
const cardsAbove = state.cards.slice(index + 1);
|
|
6715
|
+
if (cardsAbove.some((c) => c.dismissable === false)) return;
|
|
6738
6716
|
onPeekDragEnd?.(index, true);
|
|
6739
|
-
}, [index, onPeekDragEnd]);
|
|
6717
|
+
}, [index, onPeekDragEnd, state.cards]);
|
|
6740
6718
|
const handlePeekDrag = useCallback(
|
|
6741
6719
|
(offset) => {
|
|
6742
6720
|
onPeekDrag?.(index, offset);
|
|
@@ -7029,6 +7007,8 @@ function CardStackViewport({
|
|
|
7029
7007
|
}, [viewportWidth, cardWidths, cards.length, config.defaultPeekOffset, config.layoutMode]);
|
|
7030
7008
|
const useFullScreen = isMobile || responsiveOffset.shouldCollapse;
|
|
7031
7009
|
const handleDismiss = useCallback(() => {
|
|
7010
|
+
const topCard = api.top();
|
|
7011
|
+
if (topCard?.dismissable === false) return;
|
|
7032
7012
|
api.pop();
|
|
7033
7013
|
}, [api]);
|
|
7034
7014
|
const swipeThreshold = mobile?.gestures?.swipeThreshold ?? Math.max(120, Math.round(viewportWidth * 0.35));
|
|
@@ -7062,6 +7042,11 @@ function CardStackViewport({
|
|
|
7062
7042
|
const handlePeekDragEnd = useCallback(
|
|
7063
7043
|
(cardIndex, shouldDismiss) => {
|
|
7064
7044
|
if (shouldDismiss) {
|
|
7045
|
+
const cardsAbove = cards.slice(cardIndex + 1);
|
|
7046
|
+
if (cardsAbove.some((c) => c.dismissable === false)) {
|
|
7047
|
+
setPeekDrag({ sourceIndex: -1, offset: 0 });
|
|
7048
|
+
return;
|
|
7049
|
+
}
|
|
7065
7050
|
const card = cards[cardIndex];
|
|
7066
7051
|
if (card) {
|
|
7067
7052
|
api.popTo(card.id);
|
|
@@ -7079,7 +7064,7 @@ function CardStackViewport({
|
|
|
7079
7064
|
const defaultBackdrop = /* @__PURE__ */ jsx(StackBackdrop, { className: "pointer-events-auto", config: config2 }, "backdrop");
|
|
7080
7065
|
if (renderBackdrop) {
|
|
7081
7066
|
const customBackdrop = renderBackdrop();
|
|
7082
|
-
return
|
|
7067
|
+
return React19.isValidElement(customBackdrop) ? React19.cloneElement(customBackdrop, { key: "backdrop" }) : defaultBackdrop;
|
|
7083
7068
|
}
|
|
7084
7069
|
return defaultBackdrop;
|
|
7085
7070
|
};
|