@constructive-io/ui 0.1.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.d.ts +31 -0
- package/dist/components/alert-dialog.js +314 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/alert.d.ts +14 -0
- package/dist/components/alert.js +38 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/autocomplete.d.ts +28 -0
- package/dist/components/autocomplete.js +395 -0
- package/dist/components/autocomplete.js.map +1 -0
- package/dist/components/avatar.d.ts +13 -0
- package/dist/components/avatar.js +37 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +15 -0
- package/dist/components/badge.js +43 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +14 -0
- package/dist/components/breadcrumb.js +154 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button.d.ts +17 -0
- package/dist/components/button.js +62 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar-rac.d.ts +13 -0
- package/dist/components/calendar-rac.js +82 -0
- package/dist/components/calendar-rac.js.map +1 -0
- package/dist/components/card.d.ts +19 -0
- package/dist/components/card.js +75 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/checkbox-group.d.ts +7 -0
- package/dist/components/checkbox-group.js +16 -0
- package/dist/components/checkbox-group.js.map +1 -0
- package/dist/components/checkbox.d.ts +8 -0
- package/dist/components/checkbox.js +67 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/collapsible.d.ts +54 -0
- package/dist/components/collapsible.js +121 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/combobox.d.ts +44 -0
- package/dist/components/combobox.js +486 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/command.d.ts +43 -0
- package/dist/components/command.js +690 -0
- package/dist/components/command.js.map +1 -0
- package/dist/components/dialog.d.ts +35 -0
- package/dist/components/dialog.js +440 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dock.d.ts +31 -0
- package/dist/components/dock.js +111 -0
- package/dist/components/dock.js.map +1 -0
- package/dist/components/drawer.d.ts +16 -0
- package/dist/components/drawer.js +147 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +50 -0
- package/dist/components/dropdown-menu.js +380 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/field.d.ts +51 -0
- package/dist/components/field.js +115 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/flickering-grid.d.ts +15 -0
- package/dist/components/flickering-grid.js +147 -0
- package/dist/components/flickering-grid.js.map +1 -0
- package/dist/components/form-control.d.ts +15 -0
- package/dist/components/form-control.js +173 -0
- package/dist/components/form-control.js.map +1 -0
- package/dist/components/form.d.ts +37 -0
- package/dist/components/form.js +179 -0
- package/dist/components/form.js.map +1 -0
- package/dist/components/input-group.d.ts +18 -0
- package/dist/components/input-group.js +177 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input.d.ts +11 -0
- package/dist/components/input.js +60 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/json-input.d.ts +25 -0
- package/dist/components/json-input.js +351 -0
- package/dist/components/json-input.js.map +1 -0
- package/dist/components/label.d.ts +11 -0
- package/dist/components/label.js +27 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/motion-grid.d.ts +20 -0
- package/dist/components/motion-grid.js +81 -0
- package/dist/components/motion-grid.js.map +1 -0
- package/dist/components/multi-select.d.ts +198 -0
- package/dist/components/multi-select.js +882 -0
- package/dist/components/multi-select.js.map +1 -0
- package/dist/components/page-header.d.ts +17 -0
- package/dist/components/page-header.js +17 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/pagination.d.ts +19 -0
- package/dist/components/pagination.js +144 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/popover.d.ts +35 -0
- package/dist/components/popover.js +188 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/portal.d.ts +108 -0
- package/dist/components/portal.js +75 -0
- package/dist/components/portal.js.map +1 -0
- package/dist/components/progress.d.ts +10 -0
- package/dist/components/progress.js +30 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/progressive-blur-scroll-container.d.ts +25 -0
- package/dist/components/progressive-blur-scroll-container.js +142 -0
- package/dist/components/progressive-blur-scroll-container.js.map +1 -0
- package/dist/components/progressive-blur.d.ts +16 -0
- package/dist/components/progressive-blur.js +68 -0
- package/dist/components/progressive-blur.js.map +1 -0
- package/dist/components/radio-group.d.ts +10 -0
- package/dist/components/radio-group.js +37 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/record-picker.d.ts +16 -0
- package/dist/components/record-picker.js +366 -0
- package/dist/components/record-picker.js.map +1 -0
- package/dist/components/resizable.d.ts +11 -0
- package/dist/components/resizable.js +52 -0
- package/dist/components/resizable.js.map +1 -0
- package/dist/components/responsive-diagram.d.ts +10 -0
- package/dist/components/responsive-diagram.js +63 -0
- package/dist/components/responsive-diagram.js.map +1 -0
- package/dist/components/scroll-area.d.ts +12 -0
- package/dist/components/scroll-area.js +69 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/select.d.ts +47 -0
- package/dist/components/select.js +287 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +11 -0
- package/dist/components/separator.js +24 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.d.ts +112 -0
- package/dist/components/sheet.js +600 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/sidebar.d.ts +77 -0
- package/dist/components/sidebar.js +1217 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton.d.ts +7 -0
- package/dist/components/skeleton.js +16 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/sonner.d.ts +10 -0
- package/dist/components/sonner.js +23 -0
- package/dist/components/sonner.js.map +1 -0
- package/dist/components/stack/index.d.ts +663 -0
- package/dist/components/stack/index.js +1418 -0
- package/dist/components/stack/index.js.map +1 -0
- package/dist/components/stepper.d.ts +30 -0
- package/dist/components/stepper.js +280 -0
- package/dist/components/stepper.js.map +1 -0
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.js +40 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.d.ts +15 -0
- package/dist/components/table.js +65 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +10 -0
- package/dist/components/tabs.js +48 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/tags.d.ts +42 -0
- package/dist/components/tags.js +728 -0
- package/dist/components/tags.js.map +1 -0
- package/dist/components/textarea.d.ts +10 -0
- package/dist/components/textarea.js +54 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/toast/index.d.ts +52 -0
- package/dist/components/toast/index.js +221 -0
- package/dist/components/toast/index.js.map +1 -0
- package/dist/components/tooltip.d.ts +29 -0
- package/dist/components/tooltip.js +174 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/unlink-button.d.ts +14 -0
- package/dist/components/unlink-button.js +91 -0
- package/dist/components/unlink-button.js.map +1 -0
- package/dist/index.cjs +7692 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2157 -0
- package/dist/index.d.ts +2157 -0
- package/dist/index.js +7375 -0
- package/dist/index.js.map +1 -0
- package/package.json +490 -0
- package/src/styles/globals.css +397 -0
|
@@ -0,0 +1,1217 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React5 from 'react';
|
|
3
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { PanelLeftIcon, X } from 'lucide-react';
|
|
6
|
+
import { clsx } from 'clsx';
|
|
7
|
+
import { twMerge } from 'tailwind-merge';
|
|
8
|
+
import { Input as Input$1 } from '@base-ui/react/input';
|
|
9
|
+
import { Separator as Separator$1 } from '@base-ui/react/separator';
|
|
10
|
+
import { Dialog } from '@base-ui/react/dialog';
|
|
11
|
+
import { AnimatePresence, motion } from 'motion/react';
|
|
12
|
+
import { Tooltip as Tooltip$1 } from '@base-ui/react/tooltip';
|
|
13
|
+
|
|
14
|
+
function composeRefs(...refs) {
|
|
15
|
+
return (node) => {
|
|
16
|
+
refs.forEach((ref) => {
|
|
17
|
+
if (typeof ref === "function") {
|
|
18
|
+
ref(node);
|
|
19
|
+
} else if (ref != null) {
|
|
20
|
+
ref.current = node;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function mergeProps(slotProps, childProps) {
|
|
26
|
+
const overrideProps = { ...childProps };
|
|
27
|
+
for (const propName in childProps) {
|
|
28
|
+
if (propName === "ref") continue;
|
|
29
|
+
const slotPropValue = slotProps[propName];
|
|
30
|
+
const childPropValue = childProps[propName];
|
|
31
|
+
if (/^on[A-Z]/.test(propName) && typeof slotPropValue === "function" && typeof childPropValue === "function") {
|
|
32
|
+
overrideProps[propName] = (...args) => {
|
|
33
|
+
childPropValue(...args);
|
|
34
|
+
slotPropValue(...args);
|
|
35
|
+
};
|
|
36
|
+
} else if (propName === "className" && typeof slotPropValue === "string" && typeof childPropValue === "string") {
|
|
37
|
+
overrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();
|
|
38
|
+
} else if (propName === "style" && typeof slotPropValue === "object" && typeof childPropValue === "object") {
|
|
39
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return { ...slotProps, ...overrideProps };
|
|
43
|
+
}
|
|
44
|
+
function mergePropsWithRef(parentProps, childElement) {
|
|
45
|
+
const childProps = childElement.props;
|
|
46
|
+
const parentRef = parentProps.ref;
|
|
47
|
+
const childRef = childProps.ref;
|
|
48
|
+
const mergedProps = mergeProps(parentProps, childProps);
|
|
49
|
+
if (parentRef || childRef) {
|
|
50
|
+
mergedProps.ref = composeRefs(parentRef, childRef);
|
|
51
|
+
}
|
|
52
|
+
return mergedProps;
|
|
53
|
+
}
|
|
54
|
+
function isSlottable(child) {
|
|
55
|
+
return React5.isValidElement(child);
|
|
56
|
+
}
|
|
57
|
+
var Slot = React5.forwardRef((props, forwardedRef) => {
|
|
58
|
+
const { children, ...slotProps } = props;
|
|
59
|
+
if (isSlottable(children)) {
|
|
60
|
+
const childProps = children.props;
|
|
61
|
+
const childRef = childProps.ref;
|
|
62
|
+
return React5.cloneElement(children, {
|
|
63
|
+
...mergeProps(slotProps, childProps),
|
|
64
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (React5.Children.count(children) > 1) {
|
|
68
|
+
const childrenArray = React5.Children.toArray(children);
|
|
69
|
+
const slottableChild = childrenArray.find(
|
|
70
|
+
(child) => React5.isValidElement(child) && child.type === Slottable
|
|
71
|
+
);
|
|
72
|
+
if (slottableChild) {
|
|
73
|
+
const newElement = slottableChild.props.children;
|
|
74
|
+
if (isSlottable(newElement)) {
|
|
75
|
+
const newElementProps = newElement.props;
|
|
76
|
+
const newChildren = childrenArray.map((child) => {
|
|
77
|
+
if (child === slottableChild) {
|
|
78
|
+
return React5.Children.count(newElementProps.children) > 1 ? React5.Children.only(null) : newElementProps.children;
|
|
79
|
+
}
|
|
80
|
+
return child;
|
|
81
|
+
});
|
|
82
|
+
const childRef = newElementProps.ref;
|
|
83
|
+
return React5.cloneElement(newElement, {
|
|
84
|
+
...mergeProps(slotProps, newElementProps),
|
|
85
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
|
|
86
|
+
children: newChildren
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
92
|
+
});
|
|
93
|
+
Slot.displayName = "Slot";
|
|
94
|
+
function Slottable({ children }) {
|
|
95
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
96
|
+
}
|
|
97
|
+
var MOBILE_BREAKPOINT = 768;
|
|
98
|
+
function useIsMobile() {
|
|
99
|
+
const [isMobile, setIsMobile] = React5.useState(false);
|
|
100
|
+
React5.useEffect(() => {
|
|
101
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
102
|
+
const onChange = () => {
|
|
103
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
104
|
+
};
|
|
105
|
+
mql.addEventListener("change", onChange);
|
|
106
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
107
|
+
return () => mql.removeEventListener("change", onChange);
|
|
108
|
+
}, []);
|
|
109
|
+
return isMobile;
|
|
110
|
+
}
|
|
111
|
+
function cn(...inputs) {
|
|
112
|
+
return twMerge(clsx(inputs));
|
|
113
|
+
}
|
|
114
|
+
var buttonVariants = cva(
|
|
115
|
+
"[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 sm:text-sm [&_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",
|
|
116
|
+
{
|
|
117
|
+
defaultVariants: {
|
|
118
|
+
size: "default",
|
|
119
|
+
variant: "default"
|
|
120
|
+
},
|
|
121
|
+
variants: {
|
|
122
|
+
size: {
|
|
123
|
+
default: "h-9 px-[calc(--spacing(3)-1px)] sm:h-8",
|
|
124
|
+
icon: "size-9 sm:size-8",
|
|
125
|
+
"icon-lg": "size-10 sm:size-9",
|
|
126
|
+
"icon-sm": "size-8 sm:size-7",
|
|
127
|
+
"icon-xl": 'size-11 sm:size-10 [&_svg:not([class*="size-"])]:size-5 sm:[&_svg:not([class*="size-"])]:size-4.5',
|
|
128
|
+
"icon-xs": 'size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*="size-"])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*="size-"])]:size-3.5',
|
|
129
|
+
lg: "h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9",
|
|
130
|
+
sm: "h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7",
|
|
131
|
+
xl: 'h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*="size-"])]:size-5 sm:[&_svg:not([class*="size-"])]:size-4.5',
|
|
132
|
+
xs: 'h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*="size-"])]:size-4 sm:[&_svg:not([class*="size-"])]:size-3.5'
|
|
133
|
+
},
|
|
134
|
+
variant: {
|
|
135
|
+
default: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
|
|
136
|
+
destructive: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
|
|
137
|
+
"destructive-outline": "border-destructive/40 bg-transparent bg-clip-padding text-destructive shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/60 [:hover,[data-pressed]]:bg-destructive/8",
|
|
138
|
+
ghost: "border-transparent hover:bg-accent data-pressed:bg-accent",
|
|
139
|
+
link: "border-transparent underline-offset-4 hover:underline",
|
|
140
|
+
outline: "border-border bg-background bg-clip-padding shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64",
|
|
141
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 [:active,[data-pressed]]:bg-secondary/80"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
var Button = React5.forwardRef(
|
|
147
|
+
({ className, variant, size, asChild, children, type = "button", ...props }, ref) => {
|
|
148
|
+
const buttonClasses = cn(buttonVariants({ className, size, variant }));
|
|
149
|
+
if (asChild && React5.isValidElement(children)) {
|
|
150
|
+
const childProps = children.props;
|
|
151
|
+
return React5.cloneElement(children, {
|
|
152
|
+
...props,
|
|
153
|
+
className: cn(buttonClasses, childProps.className),
|
|
154
|
+
"data-slot": "button"
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
return /* @__PURE__ */ jsx("button", { ref, type, className: buttonClasses, "data-slot": "button", ...props, children });
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
Button.displayName = "Button";
|
|
161
|
+
function Input({ className, size = "default", unstyled = false, ...props }) {
|
|
162
|
+
const isFloating = props.placeholder === " ";
|
|
163
|
+
return /* @__PURE__ */ jsx(
|
|
164
|
+
"span",
|
|
165
|
+
{
|
|
166
|
+
className: cn(
|
|
167
|
+
!unstyled && [
|
|
168
|
+
// Base layout
|
|
169
|
+
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base shadow-xs transition-shadow",
|
|
170
|
+
// Inner shadow highlight
|
|
171
|
+
"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)]",
|
|
172
|
+
"not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)]",
|
|
173
|
+
// Focus state - use primary brand color
|
|
174
|
+
"has-focus-visible:border-primary/60 has-focus-visible:ring-[3px] has-focus-visible:ring-primary/35",
|
|
175
|
+
// Invalid state
|
|
176
|
+
"has-aria-invalid:border-destructive/36",
|
|
177
|
+
"has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16",
|
|
178
|
+
// Disabled state
|
|
179
|
+
"has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none",
|
|
180
|
+
// Dark mode
|
|
181
|
+
"sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border",
|
|
182
|
+
"dark:has-aria-invalid:ring-destructive/24",
|
|
183
|
+
"dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/8%)]"
|
|
184
|
+
],
|
|
185
|
+
className
|
|
186
|
+
) || void 0,
|
|
187
|
+
"data-size": size,
|
|
188
|
+
"data-slot": "input-control",
|
|
189
|
+
children: /* @__PURE__ */ jsx(
|
|
190
|
+
Input$1,
|
|
191
|
+
{
|
|
192
|
+
className: cn(
|
|
193
|
+
"w-full min-w-0 rounded-[inherit] bg-transparent px-[calc(--spacing(3)-1px)] outline-none",
|
|
194
|
+
isFloating ? "h-11 pt-4.5 pb-1 leading-none placeholder:text-transparent sm:h-10" : "h-8.5 leading-8.5 placeholder:text-muted-foreground/72 sm:h-7.5 sm:leading-7.5",
|
|
195
|
+
size === "sm" && (isFloating ? "h-10 px-[calc(--spacing(2.5)-1px)] pt-4 pb-1 sm:h-9" : "h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:h-6.5 sm:leading-6.5"),
|
|
196
|
+
size === "lg" && (isFloating ? "h-12 pt-5 pb-1.5 sm:h-11" : "h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5"),
|
|
197
|
+
props.type === "search" && "[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none",
|
|
198
|
+
props.type === "file" && "text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm"
|
|
199
|
+
),
|
|
200
|
+
"data-slot": "input",
|
|
201
|
+
size: typeof size === "number" ? size : void 0,
|
|
202
|
+
...props
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
function Separator({ className, orientation = "horizontal", decorative: _decorative, ...props }) {
|
|
209
|
+
return /* @__PURE__ */ jsx(
|
|
210
|
+
Separator$1,
|
|
211
|
+
{
|
|
212
|
+
"data-slot": "separator-root",
|
|
213
|
+
orientation,
|
|
214
|
+
className: cn("bg-border shrink-0", orientation === "horizontal" ? "h-px w-full" : "h-full w-px", className),
|
|
215
|
+
...props
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// src/lib/motion/motion-config.ts
|
|
221
|
+
var easings = {
|
|
222
|
+
/** Physical feel for exit animations */
|
|
223
|
+
physicalExit: [0.4, 0, 0.6, 1]
|
|
224
|
+
};
|
|
225
|
+
var durations = {
|
|
226
|
+
/** Quick transitions (tooltips, small elements) */
|
|
227
|
+
fast: 0.15,
|
|
228
|
+
/** Standard UI transitions (modals, panels) */
|
|
229
|
+
normal: 0.2};
|
|
230
|
+
var PORTAL_ROOT_ID = "portal-root";
|
|
231
|
+
var PortalContext = React5.createContext({
|
|
232
|
+
layer: "base",
|
|
233
|
+
depth: 0,
|
|
234
|
+
floatingPortalStrategy: "root",
|
|
235
|
+
floatingZIndex: "default"
|
|
236
|
+
});
|
|
237
|
+
function ModalPortalScope({
|
|
238
|
+
children,
|
|
239
|
+
floatingPortalStrategy = "nested",
|
|
240
|
+
floatingZIndex = "default"
|
|
241
|
+
}) {
|
|
242
|
+
const parentContext = React5.useContext(PortalContext);
|
|
243
|
+
const depth = parentContext.layer === "modal" ? parentContext.depth + 1 : 0;
|
|
244
|
+
const value = React5.useMemo(
|
|
245
|
+
() => ({
|
|
246
|
+
layer: "modal",
|
|
247
|
+
depth,
|
|
248
|
+
floatingPortalStrategy,
|
|
249
|
+
floatingZIndex
|
|
250
|
+
}),
|
|
251
|
+
[depth, floatingPortalStrategy, floatingZIndex]
|
|
252
|
+
);
|
|
253
|
+
return /* @__PURE__ */ jsx(PortalContext.Provider, { value, children });
|
|
254
|
+
}
|
|
255
|
+
function useRootPortalContainer() {
|
|
256
|
+
const [container, setContainer] = React5.useState(null);
|
|
257
|
+
React5.useLayoutEffect(() => {
|
|
258
|
+
const el = document.getElementById(PORTAL_ROOT_ID);
|
|
259
|
+
setContainer(el);
|
|
260
|
+
}, []);
|
|
261
|
+
return container;
|
|
262
|
+
}
|
|
263
|
+
function useFloatingOverlayPortalProps() {
|
|
264
|
+
const rootContainer = useRootPortalContainer();
|
|
265
|
+
const { floatingPortalStrategy, floatingZIndex } = React5.useContext(PortalContext);
|
|
266
|
+
const container = floatingPortalStrategy === "nested" ? void 0 : rootContainer ?? null;
|
|
267
|
+
const zIndexClass = floatingZIndex === "elevated" ? "z-[var(--z-layer-floating-elevated)]" : "z-[var(--z-layer-floating)]";
|
|
268
|
+
return { container, zIndexClass };
|
|
269
|
+
}
|
|
270
|
+
var SheetStackContext = React5.createContext(void 0);
|
|
271
|
+
var SHEET_INDENT = 24;
|
|
272
|
+
var useSheetStack = () => {
|
|
273
|
+
return React5.useContext(SheetStackContext);
|
|
274
|
+
};
|
|
275
|
+
var SheetNestingContext = React5.createContext({
|
|
276
|
+
level: 0,
|
|
277
|
+
parentSheetId: null
|
|
278
|
+
});
|
|
279
|
+
var useSheetNesting = () => React5.useContext(SheetNestingContext);
|
|
280
|
+
var SheetContext = React5.createContext(void 0);
|
|
281
|
+
var useSheet = () => {
|
|
282
|
+
const context = React5.useContext(SheetContext);
|
|
283
|
+
if (!context) {
|
|
284
|
+
throw new Error("useSheet must be used within a Sheet");
|
|
285
|
+
}
|
|
286
|
+
return context;
|
|
287
|
+
};
|
|
288
|
+
var sheetIdCounter = 0;
|
|
289
|
+
function Sheet({ children, sheetId: providedId, ...props }) {
|
|
290
|
+
const [isOpen, setIsOpen] = React5.useState(props?.open ?? props?.defaultOpen ?? false);
|
|
291
|
+
const sheetStack = useSheetStack();
|
|
292
|
+
const nesting = useSheetNesting();
|
|
293
|
+
const sheetIdRef = React5.useRef(providedId ?? `sheet-${++sheetIdCounter}`);
|
|
294
|
+
const sheetId = sheetIdRef.current;
|
|
295
|
+
const depth = nesting.level;
|
|
296
|
+
const onOpenChangeRef = React5.useRef(props.onOpenChange);
|
|
297
|
+
onOpenChangeRef.current = props.onOpenChange;
|
|
298
|
+
const close = React5.useCallback(() => {
|
|
299
|
+
setIsOpen(false);
|
|
300
|
+
onOpenChangeRef.current?.(false);
|
|
301
|
+
}, []);
|
|
302
|
+
const registerSheetRef = React5.useRef(sheetStack?.registerSheet);
|
|
303
|
+
const unregisterSheetRef = React5.useRef(sheetStack?.unregisterSheet);
|
|
304
|
+
registerSheetRef.current = sheetStack?.registerSheet;
|
|
305
|
+
unregisterSheetRef.current = sheetStack?.unregisterSheet;
|
|
306
|
+
React5.useEffect(() => {
|
|
307
|
+
if (registerSheetRef.current && isOpen) {
|
|
308
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
309
|
+
document.activeElement.blur();
|
|
310
|
+
}
|
|
311
|
+
registerSheetRef.current({ id: sheetId, depth, close });
|
|
312
|
+
return () => unregisterSheetRef.current?.(sheetId);
|
|
313
|
+
}
|
|
314
|
+
}, [isOpen, sheetId, depth, close]);
|
|
315
|
+
React5.useEffect(() => {
|
|
316
|
+
if (props?.open !== void 0) setIsOpen(props.open);
|
|
317
|
+
}, [props?.open]);
|
|
318
|
+
const handleOpenChange = React5.useCallback((open, _eventDetails) => {
|
|
319
|
+
setIsOpen(open);
|
|
320
|
+
onOpenChangeRef.current?.(open);
|
|
321
|
+
}, []);
|
|
322
|
+
const sheetsAbove = sheetStack?.getSheetsAbove(sheetId) ?? 0;
|
|
323
|
+
const isTopSheet = sheetStack?.isTopSheet(sheetId) ?? true;
|
|
324
|
+
const isNested = depth > 0;
|
|
325
|
+
return /* @__PURE__ */ jsx(SheetNestingContext.Provider, { value: { level: depth + 1, parentSheetId: sheetId }, children: /* @__PURE__ */ jsx(SheetContext.Provider, { value: { isOpen, sheetId, depth, sheetsAbove, isTopSheet, close }, children: /* @__PURE__ */ jsx(
|
|
326
|
+
Dialog.Root,
|
|
327
|
+
{
|
|
328
|
+
"data-slot": "sheet",
|
|
329
|
+
...props,
|
|
330
|
+
open: isOpen,
|
|
331
|
+
modal: isNested ? false : props.modal,
|
|
332
|
+
onOpenChange: handleOpenChange,
|
|
333
|
+
children
|
|
334
|
+
}
|
|
335
|
+
) }) });
|
|
336
|
+
}
|
|
337
|
+
function SheetPortal({ forceMount: _forceMount, ...props }) {
|
|
338
|
+
const container = useRootPortalContainer();
|
|
339
|
+
const style = {
|
|
340
|
+
...props.style ?? {},
|
|
341
|
+
["--z-layer-floating"]: "var(--z-layer-floating-elevated)"
|
|
342
|
+
};
|
|
343
|
+
return /* @__PURE__ */ jsx(Dialog.Portal, { "data-slot": "sheet-portal", container, ...props, style });
|
|
344
|
+
}
|
|
345
|
+
var sheetVariants = cva("fixed flex flex-col gap-3 bg-background p-4 shadow-lg", {
|
|
346
|
+
variants: {
|
|
347
|
+
side: {
|
|
348
|
+
top: "inset-x-0 top-0 border-b",
|
|
349
|
+
bottom: "inset-x-0 bottom-0 border-t",
|
|
350
|
+
left: "inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
|
|
351
|
+
right: "inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm"
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
defaultVariants: {
|
|
355
|
+
side: "right"
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
var NESTED_SHEET_WIDTH = 448;
|
|
359
|
+
var SHEET_STACK_GAP = 0;
|
|
360
|
+
function getPushOffset(side, sheetsAbove, stackMode = "cascade", collapseBaseSize = NESTED_SHEET_WIDTH) {
|
|
361
|
+
if (sheetsAbove === 0) {
|
|
362
|
+
return { x: 0, y: 0 };
|
|
363
|
+
}
|
|
364
|
+
if (stackMode === "collapse") {
|
|
365
|
+
const baseOffset = collapseBaseSize + SHEET_STACK_GAP;
|
|
366
|
+
const offset2 = baseOffset + (sheetsAbove - 1) * SHEET_INDENT;
|
|
367
|
+
switch (side) {
|
|
368
|
+
case "right":
|
|
369
|
+
return { x: -offset2 };
|
|
370
|
+
case "left":
|
|
371
|
+
return { x: offset2 };
|
|
372
|
+
case "top":
|
|
373
|
+
return { y: offset2 };
|
|
374
|
+
case "bottom":
|
|
375
|
+
return { y: -offset2 };
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
const offset = sheetsAbove * SHEET_INDENT;
|
|
379
|
+
switch (side) {
|
|
380
|
+
case "right":
|
|
381
|
+
return { x: -offset };
|
|
382
|
+
case "left":
|
|
383
|
+
return { x: offset };
|
|
384
|
+
case "top":
|
|
385
|
+
return { y: offset };
|
|
386
|
+
case "bottom":
|
|
387
|
+
return { y: -offset };
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
function getInitialPosition(side) {
|
|
391
|
+
switch (side) {
|
|
392
|
+
case "right":
|
|
393
|
+
return { x: "100%" };
|
|
394
|
+
case "left":
|
|
395
|
+
return { x: "-100%" };
|
|
396
|
+
case "top":
|
|
397
|
+
return { y: "-100%" };
|
|
398
|
+
case "bottom":
|
|
399
|
+
return { y: "100%" };
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
function getExitPosition(side) {
|
|
403
|
+
switch (side) {
|
|
404
|
+
case "right":
|
|
405
|
+
return { x: "100%" };
|
|
406
|
+
case "left":
|
|
407
|
+
return { x: "-100%" };
|
|
408
|
+
case "top":
|
|
409
|
+
return { y: "-100%" };
|
|
410
|
+
case "bottom":
|
|
411
|
+
return { y: "100%" };
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
var defaultSheetTransition = {
|
|
415
|
+
type: "tween",
|
|
416
|
+
duration: durations.normal,
|
|
417
|
+
ease: [0.32, 0.72, 0, 1]
|
|
418
|
+
// Custom ease-out for snappy feel
|
|
419
|
+
};
|
|
420
|
+
function SheetContent({
|
|
421
|
+
side = "right",
|
|
422
|
+
className,
|
|
423
|
+
transition = defaultSheetTransition,
|
|
424
|
+
overlay = true,
|
|
425
|
+
showClose = true,
|
|
426
|
+
children,
|
|
427
|
+
forceMount: _forceMount,
|
|
428
|
+
onInteractOutside: _onInteractOutside,
|
|
429
|
+
onPointerDownOutside: _onPointerDownOutside,
|
|
430
|
+
onEscapeKeyDown: _onEscapeKeyDown,
|
|
431
|
+
onFocusOutside: _onFocusOutside,
|
|
432
|
+
...props
|
|
433
|
+
}) {
|
|
434
|
+
const { isOpen, depth, sheetId, close } = useSheet();
|
|
435
|
+
const sheetStack = useSheetStack();
|
|
436
|
+
const sheetsAbove = sheetStack?.getSheetsAbove(sheetId) ?? 0;
|
|
437
|
+
const stackMode = sheetStack?.stackMode ?? "cascade";
|
|
438
|
+
const resolvedSide = side ?? "right";
|
|
439
|
+
const zIndex = `calc(var(--z-layer-modal-content) + ${depth * 10})`;
|
|
440
|
+
const topSheetId = sheetStack?.sheets[sheetStack.sheets.length - 1]?.id;
|
|
441
|
+
const topSheetSize = topSheetId ? sheetStack?.getSheetSize(topSheetId) : void 0;
|
|
442
|
+
const collapseBaseSize = topSheetSize ? resolvedSide === "left" || resolvedSide === "right" ? topSheetSize.width : topSheetSize.height : void 0;
|
|
443
|
+
const pushOffset = getPushOffset(resolvedSide, sheetsAbove, stackMode, collapseBaseSize ?? NESTED_SHEET_WIDTH);
|
|
444
|
+
const contentRef = React5.useRef(null);
|
|
445
|
+
React5.useLayoutEffect(() => {
|
|
446
|
+
if (!isOpen) return;
|
|
447
|
+
if (!sheetStack) return;
|
|
448
|
+
const el = contentRef.current;
|
|
449
|
+
if (!el) return;
|
|
450
|
+
let rafId = 0;
|
|
451
|
+
const update = () => {
|
|
452
|
+
const rect = el.getBoundingClientRect();
|
|
453
|
+
sheetStack.setSheetSize(sheetId, { width: rect.width, height: rect.height });
|
|
454
|
+
};
|
|
455
|
+
update();
|
|
456
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
457
|
+
const ro = new ResizeObserver(() => {
|
|
458
|
+
cancelAnimationFrame(rafId);
|
|
459
|
+
rafId = requestAnimationFrame(update);
|
|
460
|
+
});
|
|
461
|
+
ro.observe(el);
|
|
462
|
+
return () => {
|
|
463
|
+
cancelAnimationFrame(rafId);
|
|
464
|
+
ro.disconnect();
|
|
465
|
+
};
|
|
466
|
+
}, [isOpen, sheetId, sheetStack]);
|
|
467
|
+
const animatePosition = {
|
|
468
|
+
x: pushOffset.x ?? 0,
|
|
469
|
+
y: pushOffset.y ?? 0
|
|
470
|
+
};
|
|
471
|
+
const exitTransition = {
|
|
472
|
+
type: "tween",
|
|
473
|
+
duration: durations.normal,
|
|
474
|
+
ease: easings.physicalExit
|
|
475
|
+
};
|
|
476
|
+
const isTargetInsideSheet = React5.useCallback((target) => {
|
|
477
|
+
if (!target || !(target instanceof HTMLElement)) return false;
|
|
478
|
+
return !!target.closest('[data-slot="sheet-content"]');
|
|
479
|
+
}, []);
|
|
480
|
+
const isTargetInsidePopup = React5.useCallback((target) => {
|
|
481
|
+
if (!target || !(target instanceof HTMLElement)) return false;
|
|
482
|
+
return !!target.closest(
|
|
483
|
+
[
|
|
484
|
+
'[data-slot="select-popup"]',
|
|
485
|
+
'[data-slot="autocomplete-popup"]',
|
|
486
|
+
'[data-slot="dropdown-menu-content"]',
|
|
487
|
+
'[data-slot="dropdown-menu-sub-content"]',
|
|
488
|
+
'[data-slot="popover-content"]',
|
|
489
|
+
'[data-slot="tooltip-content"]'
|
|
490
|
+
].join(", ")
|
|
491
|
+
);
|
|
492
|
+
}, []);
|
|
493
|
+
React5.useEffect(() => {
|
|
494
|
+
if (!isOpen) return;
|
|
495
|
+
const handlePointerDown = (event) => {
|
|
496
|
+
if (sheetsAbove > 0) return;
|
|
497
|
+
const target = event.target;
|
|
498
|
+
if (isTargetInsideSheet(target) || isTargetInsidePopup(target)) return;
|
|
499
|
+
close();
|
|
500
|
+
};
|
|
501
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
502
|
+
return () => document.removeEventListener("pointerdown", handlePointerDown);
|
|
503
|
+
}, [isOpen, sheetsAbove, isTargetInsideSheet, isTargetInsidePopup, close]);
|
|
504
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsxs(SheetPortal, { "data-slot": "sheet-portal", children: [
|
|
505
|
+
overlay && depth === 0 && /* @__PURE__ */ jsx(
|
|
506
|
+
motion.div,
|
|
507
|
+
{
|
|
508
|
+
"data-slot": "sheet-overlay",
|
|
509
|
+
className: "fixed inset-0 bg-black/80",
|
|
510
|
+
initial: { opacity: 0 },
|
|
511
|
+
animate: { opacity: 1 },
|
|
512
|
+
exit: { opacity: 0 },
|
|
513
|
+
transition: { duration: durations.fast, ease: "easeOut" },
|
|
514
|
+
style: { willChange: "opacity", zIndex: "var(--z-layer-modal-backdrop)" }
|
|
515
|
+
},
|
|
516
|
+
"sheet-overlay"
|
|
517
|
+
),
|
|
518
|
+
/* @__PURE__ */ jsxs(
|
|
519
|
+
Dialog.Popup,
|
|
520
|
+
{
|
|
521
|
+
"data-slot": "sheet-content",
|
|
522
|
+
"data-sheet-depth": depth,
|
|
523
|
+
"data-sheet-id": sheetId,
|
|
524
|
+
...props,
|
|
525
|
+
render: /* @__PURE__ */ jsx(
|
|
526
|
+
motion.div,
|
|
527
|
+
{
|
|
528
|
+
ref: contentRef,
|
|
529
|
+
variants: {
|
|
530
|
+
initial: getInitialPosition(resolvedSide),
|
|
531
|
+
animate: animatePosition,
|
|
532
|
+
exit: {
|
|
533
|
+
...getExitPosition(resolvedSide),
|
|
534
|
+
transition: exitTransition
|
|
535
|
+
}
|
|
536
|
+
},
|
|
537
|
+
initial: "initial",
|
|
538
|
+
animate: "animate",
|
|
539
|
+
exit: "exit",
|
|
540
|
+
transition,
|
|
541
|
+
style: {
|
|
542
|
+
zIndex,
|
|
543
|
+
willChange: "transform"
|
|
544
|
+
},
|
|
545
|
+
className: cn(sheetVariants({ side: resolvedSide }), className)
|
|
546
|
+
},
|
|
547
|
+
`sheet-content-${sheetId}`
|
|
548
|
+
),
|
|
549
|
+
children: [
|
|
550
|
+
/* @__PURE__ */ jsx(ModalPortalScope, { children }),
|
|
551
|
+
showClose && /* @__PURE__ */ jsxs(
|
|
552
|
+
Dialog.Close,
|
|
553
|
+
{
|
|
554
|
+
"data-slot": "sheet-close",
|
|
555
|
+
className: "ring-offset-background focus:ring-ring data-[open]:bg-secondary absolute top-4 right-4\n rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2\n focus:outline-none disabled:pointer-events-none",
|
|
556
|
+
children: [
|
|
557
|
+
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
558
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
559
|
+
]
|
|
560
|
+
}
|
|
561
|
+
)
|
|
562
|
+
]
|
|
563
|
+
}
|
|
564
|
+
)
|
|
565
|
+
] }) });
|
|
566
|
+
}
|
|
567
|
+
function SheetHeader({ className, ...props }) {
|
|
568
|
+
return /* @__PURE__ */ jsx(
|
|
569
|
+
"div",
|
|
570
|
+
{
|
|
571
|
+
"data-slot": "sheet-header",
|
|
572
|
+
className: cn("flex flex-col space-y-2 pb-4 text-center sm:text-left", className),
|
|
573
|
+
...props
|
|
574
|
+
}
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
function SheetTitle({ className, ...props }) {
|
|
578
|
+
return /* @__PURE__ */ jsx(
|
|
579
|
+
Dialog.Title,
|
|
580
|
+
{
|
|
581
|
+
"data-slot": "sheet-title",
|
|
582
|
+
className: cn("text-foreground text-lg font-semibold", className),
|
|
583
|
+
...props
|
|
584
|
+
}
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
function SheetDescription({ className, ...props }) {
|
|
588
|
+
return /* @__PURE__ */ jsx(
|
|
589
|
+
Dialog.Description,
|
|
590
|
+
{
|
|
591
|
+
"data-slot": "sheet-description",
|
|
592
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
593
|
+
...props
|
|
594
|
+
}
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
function Skeleton({ className, ...props }) {
|
|
598
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "skeleton", className: cn("bg-primary/10 animate-pulse rounded-md", className), ...props });
|
|
599
|
+
}
|
|
600
|
+
function TooltipProvider({ delay = 0, delayDuration, ...props }) {
|
|
601
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Provider, { "data-slot": "tooltip-provider", delay: delayDuration ?? delay, ...props });
|
|
602
|
+
}
|
|
603
|
+
function Tooltip({ delayDuration: _delayDuration, ...props }) {
|
|
604
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Root, { "data-slot": "tooltip", ...props });
|
|
605
|
+
}
|
|
606
|
+
function TooltipTrigger({ delay = 0, asChild, children, ...props }) {
|
|
607
|
+
if (asChild && React5.isValidElement(children)) {
|
|
608
|
+
return /* @__PURE__ */ jsx(
|
|
609
|
+
Tooltip$1.Trigger,
|
|
610
|
+
{
|
|
611
|
+
"data-slot": "tooltip-trigger",
|
|
612
|
+
delay,
|
|
613
|
+
...props,
|
|
614
|
+
render: (triggerProps) => {
|
|
615
|
+
return React5.cloneElement(
|
|
616
|
+
children,
|
|
617
|
+
mergePropsWithRef(triggerProps, children)
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Trigger, { "data-slot": "tooltip-trigger", delay, ...props, children });
|
|
624
|
+
}
|
|
625
|
+
function TooltipContent({
|
|
626
|
+
className,
|
|
627
|
+
sideOffset = 4,
|
|
628
|
+
showArrow = false,
|
|
629
|
+
side = "top",
|
|
630
|
+
align = "center",
|
|
631
|
+
children,
|
|
632
|
+
...props
|
|
633
|
+
}) {
|
|
634
|
+
const { container, zIndexClass } = useFloatingOverlayPortalProps();
|
|
635
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Portal, { container, children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, { side, align, sideOffset, className: zIndexClass, children: /* @__PURE__ */ jsxs(
|
|
636
|
+
Tooltip$1.Popup,
|
|
637
|
+
{
|
|
638
|
+
"data-slot": "tooltip-content",
|
|
639
|
+
className: cn(
|
|
640
|
+
`bg-popover text-popover-foreground data-[open]:animate-in data-[open]:fade-in-0 data-[open]:zoom-in-95
|
|
641
|
+
data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95
|
|
642
|
+
data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2
|
|
643
|
+
data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2
|
|
644
|
+
relative max-w-70 rounded-md border px-2 py-1 text-xs`,
|
|
645
|
+
className
|
|
646
|
+
),
|
|
647
|
+
...props,
|
|
648
|
+
children: [
|
|
649
|
+
children,
|
|
650
|
+
showArrow && /* @__PURE__ */ jsx(Tooltip$1.Arrow, { className: "fill-popover -my-px drop-shadow-[0_1px_0_hsl(var(--border))]" })
|
|
651
|
+
]
|
|
652
|
+
}
|
|
653
|
+
) }) });
|
|
654
|
+
}
|
|
655
|
+
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
656
|
+
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
657
|
+
var SIDEBAR_WIDTH = "14rem";
|
|
658
|
+
var SIDEBAR_WIDTH_MOBILE = "16rem";
|
|
659
|
+
var SIDEBAR_WIDTH_ICON = "4rem";
|
|
660
|
+
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
661
|
+
var SidebarContext = React5.createContext(null);
|
|
662
|
+
function useSidebar() {
|
|
663
|
+
const context = React5.useContext(SidebarContext);
|
|
664
|
+
if (!context) {
|
|
665
|
+
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
666
|
+
}
|
|
667
|
+
return context;
|
|
668
|
+
}
|
|
669
|
+
function SidebarProvider({
|
|
670
|
+
defaultOpen = false,
|
|
671
|
+
open: openProp,
|
|
672
|
+
onOpenChange: setOpenProp,
|
|
673
|
+
className,
|
|
674
|
+
style,
|
|
675
|
+
children,
|
|
676
|
+
...props
|
|
677
|
+
}) {
|
|
678
|
+
const isMobile = useIsMobile();
|
|
679
|
+
const [openMobile, setOpenMobile] = React5.useState(false);
|
|
680
|
+
const [isHovered, setIsHovered] = React5.useState(false);
|
|
681
|
+
const [_open, _setOpen] = React5.useState(defaultOpen);
|
|
682
|
+
const open = openProp ?? _open;
|
|
683
|
+
const setOpen = React5.useCallback(
|
|
684
|
+
(value) => {
|
|
685
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
686
|
+
if (setOpenProp) {
|
|
687
|
+
setOpenProp(openState);
|
|
688
|
+
} else {
|
|
689
|
+
_setOpen(openState);
|
|
690
|
+
}
|
|
691
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
692
|
+
},
|
|
693
|
+
[setOpenProp, open]
|
|
694
|
+
);
|
|
695
|
+
const toggleSidebar = React5.useCallback(() => {
|
|
696
|
+
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
697
|
+
}, [isMobile, setOpen, setOpenMobile]);
|
|
698
|
+
React5.useEffect(() => {
|
|
699
|
+
const handleKeyDown = (event) => {
|
|
700
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
701
|
+
event.preventDefault();
|
|
702
|
+
toggleSidebar();
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
706
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
707
|
+
}, [toggleSidebar]);
|
|
708
|
+
const effectiveOpen = isMobile ? open : isHovered || open;
|
|
709
|
+
const state = effectiveOpen ? "expanded" : "collapsed";
|
|
710
|
+
const contextValue = React5.useMemo(
|
|
711
|
+
() => ({
|
|
712
|
+
state,
|
|
713
|
+
open,
|
|
714
|
+
setOpen,
|
|
715
|
+
isMobile,
|
|
716
|
+
openMobile,
|
|
717
|
+
setOpenMobile,
|
|
718
|
+
toggleSidebar,
|
|
719
|
+
isHovered,
|
|
720
|
+
setIsHovered
|
|
721
|
+
}),
|
|
722
|
+
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar, isHovered, setIsHovered]
|
|
723
|
+
);
|
|
724
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx(
|
|
725
|
+
"div",
|
|
726
|
+
{
|
|
727
|
+
"data-slot": "sidebar-wrapper",
|
|
728
|
+
style: {
|
|
729
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
730
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
731
|
+
...style
|
|
732
|
+
},
|
|
733
|
+
className: cn("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", className),
|
|
734
|
+
...props,
|
|
735
|
+
children
|
|
736
|
+
}
|
|
737
|
+
) }) });
|
|
738
|
+
}
|
|
739
|
+
function Sidebar({
|
|
740
|
+
side = "left",
|
|
741
|
+
variant = "sidebar",
|
|
742
|
+
collapsible = "icon",
|
|
743
|
+
className,
|
|
744
|
+
children,
|
|
745
|
+
...props
|
|
746
|
+
}) {
|
|
747
|
+
const { isMobile, state, openMobile, setOpenMobile, setIsHovered } = useSidebar();
|
|
748
|
+
if (collapsible === "none") {
|
|
749
|
+
return /* @__PURE__ */ jsx(
|
|
750
|
+
"div",
|
|
751
|
+
{
|
|
752
|
+
"data-slot": "sidebar",
|
|
753
|
+
className: cn("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", className),
|
|
754
|
+
...props,
|
|
755
|
+
children
|
|
756
|
+
}
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
if (isMobile) {
|
|
760
|
+
return /* @__PURE__ */ jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs(
|
|
761
|
+
SheetContent,
|
|
762
|
+
{
|
|
763
|
+
"data-sidebar": "sidebar",
|
|
764
|
+
"data-slot": "sidebar",
|
|
765
|
+
"data-mobile": "true",
|
|
766
|
+
className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
|
|
767
|
+
style: {
|
|
768
|
+
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
|
|
769
|
+
},
|
|
770
|
+
side,
|
|
771
|
+
children: [
|
|
772
|
+
/* @__PURE__ */ jsxs(SheetHeader, { className: "sr-only", children: [
|
|
773
|
+
/* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }),
|
|
774
|
+
/* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })
|
|
775
|
+
] }),
|
|
776
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-full w-full flex-col", children })
|
|
777
|
+
]
|
|
778
|
+
}
|
|
779
|
+
) });
|
|
780
|
+
}
|
|
781
|
+
return /* @__PURE__ */ jsxs(
|
|
782
|
+
"div",
|
|
783
|
+
{
|
|
784
|
+
className: "group peer text-sidebar-foreground hidden data-[side=right]:order-last md:block",
|
|
785
|
+
"data-state": state,
|
|
786
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
787
|
+
"data-variant": variant,
|
|
788
|
+
"data-side": side,
|
|
789
|
+
"data-slot": "sidebar",
|
|
790
|
+
onMouseEnter: () => setIsHovered(true),
|
|
791
|
+
onMouseLeave: () => setIsHovered(false),
|
|
792
|
+
children: [
|
|
793
|
+
/* @__PURE__ */ jsx(
|
|
794
|
+
"div",
|
|
795
|
+
{
|
|
796
|
+
"data-slot": "sidebar-gap",
|
|
797
|
+
className: cn(
|
|
798
|
+
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-300 ease-in-out",
|
|
799
|
+
"group-data-[collapsible=offcanvas]:w-0",
|
|
800
|
+
"group-data-[side=right]:rotate-180",
|
|
801
|
+
variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
|
|
802
|
+
)
|
|
803
|
+
}
|
|
804
|
+
),
|
|
805
|
+
/* @__PURE__ */ jsx(
|
|
806
|
+
"div",
|
|
807
|
+
{
|
|
808
|
+
"data-slot": "sidebar-container",
|
|
809
|
+
className: cn(
|
|
810
|
+
`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width,margin]
|
|
811
|
+
duration-[.3s,.3s,.3s,.15s] ease-in-out md:flex`,
|
|
812
|
+
side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
813
|
+
// Adjust the padding for floating and inset variants.
|
|
814
|
+
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : `group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r
|
|
815
|
+
group-data-[side=right]:border-l`,
|
|
816
|
+
className
|
|
817
|
+
),
|
|
818
|
+
...props,
|
|
819
|
+
children: /* @__PURE__ */ jsx(
|
|
820
|
+
"div",
|
|
821
|
+
{
|
|
822
|
+
"data-sidebar": "sidebar",
|
|
823
|
+
"data-slot": "sidebar-inner",
|
|
824
|
+
className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border/60 flex h-full w-full flex-col\n group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border\n group-data-[variant=floating]:shadow-sm",
|
|
825
|
+
children
|
|
826
|
+
}
|
|
827
|
+
)
|
|
828
|
+
}
|
|
829
|
+
)
|
|
830
|
+
]
|
|
831
|
+
}
|
|
832
|
+
);
|
|
833
|
+
}
|
|
834
|
+
function SidebarTrigger({ className, onClick, ...props }) {
|
|
835
|
+
const { toggleSidebar } = useSidebar();
|
|
836
|
+
return /* @__PURE__ */ jsxs(
|
|
837
|
+
Button,
|
|
838
|
+
{
|
|
839
|
+
"data-sidebar": "trigger",
|
|
840
|
+
"data-slot": "sidebar-trigger",
|
|
841
|
+
variant: "ghost",
|
|
842
|
+
size: "icon",
|
|
843
|
+
className: cn("size-7", className),
|
|
844
|
+
onClick: (event) => {
|
|
845
|
+
onClick?.(event);
|
|
846
|
+
toggleSidebar();
|
|
847
|
+
},
|
|
848
|
+
...props,
|
|
849
|
+
children: [
|
|
850
|
+
/* @__PURE__ */ jsx(PanelLeftIcon, {}),
|
|
851
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
852
|
+
]
|
|
853
|
+
}
|
|
854
|
+
);
|
|
855
|
+
}
|
|
856
|
+
function SidebarInset({ className, ...props }) {
|
|
857
|
+
return /* @__PURE__ */ jsx(
|
|
858
|
+
"main",
|
|
859
|
+
{
|
|
860
|
+
"data-slot": "sidebar-inset",
|
|
861
|
+
className: cn(
|
|
862
|
+
"bg-background relative flex w-full flex-1 flex-col transition-[margin] duration-300 ease-in-out",
|
|
863
|
+
`md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl
|
|
864
|
+
md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,
|
|
865
|
+
className
|
|
866
|
+
),
|
|
867
|
+
...props
|
|
868
|
+
}
|
|
869
|
+
);
|
|
870
|
+
}
|
|
871
|
+
function SidebarInput({ className, ...props }) {
|
|
872
|
+
return /* @__PURE__ */ jsx(
|
|
873
|
+
Input,
|
|
874
|
+
{
|
|
875
|
+
"data-slot": "sidebar-input",
|
|
876
|
+
"data-sidebar": "input",
|
|
877
|
+
className: cn("bg-background h-8 w-full shadow-none", className),
|
|
878
|
+
...props
|
|
879
|
+
}
|
|
880
|
+
);
|
|
881
|
+
}
|
|
882
|
+
function SidebarHeader({ className, ...props }) {
|
|
883
|
+
return /* @__PURE__ */ jsx(
|
|
884
|
+
"div",
|
|
885
|
+
{
|
|
886
|
+
"data-slot": "sidebar-header",
|
|
887
|
+
"data-sidebar": "header",
|
|
888
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
889
|
+
...props
|
|
890
|
+
}
|
|
891
|
+
);
|
|
892
|
+
}
|
|
893
|
+
function SidebarFooter({ className, ...props }) {
|
|
894
|
+
return /* @__PURE__ */ jsx(
|
|
895
|
+
"div",
|
|
896
|
+
{
|
|
897
|
+
"data-slot": "sidebar-footer",
|
|
898
|
+
"data-sidebar": "footer",
|
|
899
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
900
|
+
...props
|
|
901
|
+
}
|
|
902
|
+
);
|
|
903
|
+
}
|
|
904
|
+
function SidebarSeparator({ className, ...props }) {
|
|
905
|
+
return /* @__PURE__ */ jsx(
|
|
906
|
+
Separator,
|
|
907
|
+
{
|
|
908
|
+
"data-slot": "sidebar-separator",
|
|
909
|
+
"data-sidebar": "separator",
|
|
910
|
+
className: cn("bg-sidebar-border/60 mx-2 w-auto", className),
|
|
911
|
+
...props
|
|
912
|
+
}
|
|
913
|
+
);
|
|
914
|
+
}
|
|
915
|
+
function SidebarContent({ className, ...props }) {
|
|
916
|
+
return /* @__PURE__ */ jsx(
|
|
917
|
+
"div",
|
|
918
|
+
{
|
|
919
|
+
"data-slot": "sidebar-content",
|
|
920
|
+
"data-sidebar": "content",
|
|
921
|
+
className: cn(
|
|
922
|
+
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
923
|
+
className
|
|
924
|
+
),
|
|
925
|
+
...props
|
|
926
|
+
}
|
|
927
|
+
);
|
|
928
|
+
}
|
|
929
|
+
function SidebarGroup({ className, ...props }) {
|
|
930
|
+
return /* @__PURE__ */ jsx(
|
|
931
|
+
"div",
|
|
932
|
+
{
|
|
933
|
+
"data-slot": "sidebar-group",
|
|
934
|
+
"data-sidebar": "group",
|
|
935
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
936
|
+
...props
|
|
937
|
+
}
|
|
938
|
+
);
|
|
939
|
+
}
|
|
940
|
+
function SidebarGroupLabel({
|
|
941
|
+
className,
|
|
942
|
+
asChild = false,
|
|
943
|
+
...props
|
|
944
|
+
}) {
|
|
945
|
+
const Comp = asChild ? Slot : "div";
|
|
946
|
+
return /* @__PURE__ */ jsx(
|
|
947
|
+
Comp,
|
|
948
|
+
{
|
|
949
|
+
"data-slot": "sidebar-group-label",
|
|
950
|
+
"data-sidebar": "group-label",
|
|
951
|
+
className: cn(
|
|
952
|
+
`text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium
|
|
953
|
+
outline-hidden transition-[margin,opacity] duration-300 ease-in-out focus-visible:ring-2 [&>svg]:size-4
|
|
954
|
+
[&>svg]:shrink-0`,
|
|
955
|
+
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
956
|
+
className
|
|
957
|
+
),
|
|
958
|
+
...props
|
|
959
|
+
}
|
|
960
|
+
);
|
|
961
|
+
}
|
|
962
|
+
function SidebarGroupAction({
|
|
963
|
+
className,
|
|
964
|
+
asChild = false,
|
|
965
|
+
...props
|
|
966
|
+
}) {
|
|
967
|
+
const Comp = asChild ? Slot : "button";
|
|
968
|
+
return /* @__PURE__ */ jsx(
|
|
969
|
+
Comp,
|
|
970
|
+
{
|
|
971
|
+
"data-slot": "sidebar-group-action",
|
|
972
|
+
"data-sidebar": "group-action",
|
|
973
|
+
className: cn(
|
|
974
|
+
`text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute
|
|
975
|
+
top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden
|
|
976
|
+
transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,
|
|
977
|
+
// Increases the hit area of the button on mobile.
|
|
978
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
979
|
+
"group-data-[collapsible=icon]:hidden",
|
|
980
|
+
className
|
|
981
|
+
),
|
|
982
|
+
...props
|
|
983
|
+
}
|
|
984
|
+
);
|
|
985
|
+
}
|
|
986
|
+
function SidebarGroupContent({ className, ...props }) {
|
|
987
|
+
return /* @__PURE__ */ jsx(
|
|
988
|
+
"div",
|
|
989
|
+
{
|
|
990
|
+
"data-slot": "sidebar-group-content",
|
|
991
|
+
"data-sidebar": "group-content",
|
|
992
|
+
className: cn("w-full text-sm", className),
|
|
993
|
+
...props
|
|
994
|
+
}
|
|
995
|
+
);
|
|
996
|
+
}
|
|
997
|
+
function SidebarMenu({ className, ...props }) {
|
|
998
|
+
return /* @__PURE__ */ jsx(
|
|
999
|
+
"ul",
|
|
1000
|
+
{
|
|
1001
|
+
"data-slot": "sidebar-menu",
|
|
1002
|
+
"data-sidebar": "menu",
|
|
1003
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
1004
|
+
...props
|
|
1005
|
+
}
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
1008
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
1009
|
+
return /* @__PURE__ */ jsx(
|
|
1010
|
+
"li",
|
|
1011
|
+
{
|
|
1012
|
+
"data-slot": "sidebar-menu-item",
|
|
1013
|
+
"data-sidebar": "menu-item",
|
|
1014
|
+
className: cn("group/menu-item relative", className),
|
|
1015
|
+
...props
|
|
1016
|
+
}
|
|
1017
|
+
);
|
|
1018
|
+
}
|
|
1019
|
+
var sidebarMenuButtonVariants = cva(
|
|
1020
|
+
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding,margin,gap] duration-200 ease-[cubic-bezier(0.25,1,0.5,1)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:h-8! group-data-[collapsible=icon]:w-9! group-data-[collapsible=icon]:mx-auto group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
1021
|
+
{
|
|
1022
|
+
variants: {
|
|
1023
|
+
variant: {
|
|
1024
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
1025
|
+
outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
|
|
1026
|
+
},
|
|
1027
|
+
size: {
|
|
1028
|
+
default: "h-8 text-sm",
|
|
1029
|
+
sm: "h-7 text-xs",
|
|
1030
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
1031
|
+
}
|
|
1032
|
+
},
|
|
1033
|
+
defaultVariants: {
|
|
1034
|
+
variant: "default",
|
|
1035
|
+
size: "default"
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
);
|
|
1039
|
+
function SidebarMenuButton({
|
|
1040
|
+
asChild = false,
|
|
1041
|
+
isActive = false,
|
|
1042
|
+
variant = "default",
|
|
1043
|
+
size = "default",
|
|
1044
|
+
tooltip,
|
|
1045
|
+
className,
|
|
1046
|
+
...props
|
|
1047
|
+
}) {
|
|
1048
|
+
const Comp = asChild ? Slot : "button";
|
|
1049
|
+
const { isMobile, state } = useSidebar();
|
|
1050
|
+
const button = /* @__PURE__ */ jsx(
|
|
1051
|
+
Comp,
|
|
1052
|
+
{
|
|
1053
|
+
"data-slot": "sidebar-menu-button",
|
|
1054
|
+
"data-sidebar": "menu-button",
|
|
1055
|
+
"data-size": size,
|
|
1056
|
+
"data-active": isActive,
|
|
1057
|
+
className: cn(sidebarMenuButtonVariants({ variant, size }), className),
|
|
1058
|
+
...props
|
|
1059
|
+
}
|
|
1060
|
+
);
|
|
1061
|
+
if (!tooltip) {
|
|
1062
|
+
return button;
|
|
1063
|
+
}
|
|
1064
|
+
if (typeof tooltip === "string") {
|
|
1065
|
+
tooltip = {
|
|
1066
|
+
children: tooltip
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
1070
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: button }),
|
|
1071
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", align: "center", hidden: state !== "collapsed" || isMobile, ...tooltip })
|
|
1072
|
+
] });
|
|
1073
|
+
}
|
|
1074
|
+
function SidebarMenuAction({
|
|
1075
|
+
className,
|
|
1076
|
+
asChild = false,
|
|
1077
|
+
showOnHover = false,
|
|
1078
|
+
...props
|
|
1079
|
+
}) {
|
|
1080
|
+
const Comp = asChild ? Slot : "button";
|
|
1081
|
+
return /* @__PURE__ */ jsx(
|
|
1082
|
+
Comp,
|
|
1083
|
+
{
|
|
1084
|
+
"data-slot": "sidebar-menu-action",
|
|
1085
|
+
"data-sidebar": "menu-action",
|
|
1086
|
+
className: cn(
|
|
1087
|
+
`text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground
|
|
1088
|
+
peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5
|
|
1089
|
+
items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2
|
|
1090
|
+
[&>svg]:size-4 [&>svg]:shrink-0`,
|
|
1091
|
+
// Increases the hit area of the button on mobile.
|
|
1092
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
1093
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
1094
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
1095
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
1096
|
+
"group-data-[collapsible=icon]:hidden",
|
|
1097
|
+
showOnHover && `peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100
|
|
1098
|
+
group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0`,
|
|
1099
|
+
className
|
|
1100
|
+
),
|
|
1101
|
+
...props
|
|
1102
|
+
}
|
|
1103
|
+
);
|
|
1104
|
+
}
|
|
1105
|
+
function SidebarMenuBadge({ className, ...props }) {
|
|
1106
|
+
return /* @__PURE__ */ jsx(
|
|
1107
|
+
"div",
|
|
1108
|
+
{
|
|
1109
|
+
"data-slot": "sidebar-menu-badge",
|
|
1110
|
+
"data-sidebar": "menu-badge",
|
|
1111
|
+
className: cn(
|
|
1112
|
+
`text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center
|
|
1113
|
+
rounded-md px-1 text-xs font-medium tabular-nums select-none`,
|
|
1114
|
+
`peer-hover/menu-button:text-sidebar-accent-foreground
|
|
1115
|
+
peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,
|
|
1116
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
1117
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
1118
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
1119
|
+
"group-data-[collapsible=icon]:hidden",
|
|
1120
|
+
className
|
|
1121
|
+
),
|
|
1122
|
+
...props
|
|
1123
|
+
}
|
|
1124
|
+
);
|
|
1125
|
+
}
|
|
1126
|
+
function SidebarMenuSkeleton({
|
|
1127
|
+
className,
|
|
1128
|
+
showIcon = false,
|
|
1129
|
+
...props
|
|
1130
|
+
}) {
|
|
1131
|
+
const width = React5.useMemo(() => {
|
|
1132
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
1133
|
+
}, []);
|
|
1134
|
+
return /* @__PURE__ */ jsxs(
|
|
1135
|
+
"div",
|
|
1136
|
+
{
|
|
1137
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
1138
|
+
"data-sidebar": "menu-skeleton",
|
|
1139
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
1140
|
+
...props,
|
|
1141
|
+
children: [
|
|
1142
|
+
showIcon && /* @__PURE__ */ jsx(Skeleton, { className: "size-4 rounded-md", "data-sidebar": "menu-skeleton-icon" }),
|
|
1143
|
+
/* @__PURE__ */ jsx(
|
|
1144
|
+
Skeleton,
|
|
1145
|
+
{
|
|
1146
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
1147
|
+
"data-sidebar": "menu-skeleton-text",
|
|
1148
|
+
style: {
|
|
1149
|
+
"--skeleton-width": width
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
)
|
|
1153
|
+
]
|
|
1154
|
+
}
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
1158
|
+
return /* @__PURE__ */ jsx(
|
|
1159
|
+
"ul",
|
|
1160
|
+
{
|
|
1161
|
+
"data-slot": "sidebar-menu-sub",
|
|
1162
|
+
"data-sidebar": "menu-sub",
|
|
1163
|
+
className: cn(
|
|
1164
|
+
"border-sidebar-border/60 mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5",
|
|
1165
|
+
"group-data-[collapsible=icon]:hidden",
|
|
1166
|
+
className
|
|
1167
|
+
),
|
|
1168
|
+
...props
|
|
1169
|
+
}
|
|
1170
|
+
);
|
|
1171
|
+
}
|
|
1172
|
+
function SidebarMenuSubItem({ className, ...props }) {
|
|
1173
|
+
return /* @__PURE__ */ jsx(
|
|
1174
|
+
"li",
|
|
1175
|
+
{
|
|
1176
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
1177
|
+
"data-sidebar": "menu-sub-item",
|
|
1178
|
+
className: cn("group/menu-sub-item relative", className),
|
|
1179
|
+
...props
|
|
1180
|
+
}
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1183
|
+
function SidebarMenuSubButton({
|
|
1184
|
+
asChild = false,
|
|
1185
|
+
size = "md",
|
|
1186
|
+
isActive = false,
|
|
1187
|
+
className,
|
|
1188
|
+
...props
|
|
1189
|
+
}) {
|
|
1190
|
+
const Comp = asChild ? Slot : "a";
|
|
1191
|
+
return /* @__PURE__ */ jsx(
|
|
1192
|
+
Comp,
|
|
1193
|
+
{
|
|
1194
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
1195
|
+
"data-sidebar": "menu-sub-button",
|
|
1196
|
+
"data-size": size,
|
|
1197
|
+
"data-active": isActive,
|
|
1198
|
+
className: cn(
|
|
1199
|
+
`text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground
|
|
1200
|
+
active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7
|
|
1201
|
+
min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2
|
|
1202
|
+
disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50
|
|
1203
|
+
[&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,
|
|
1204
|
+
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
1205
|
+
size === "sm" && "text-xs",
|
|
1206
|
+
size === "md" && "text-sm",
|
|
1207
|
+
"group-data-[collapsible=icon]:hidden",
|
|
1208
|
+
className
|
|
1209
|
+
),
|
|
1210
|
+
...props
|
|
1211
|
+
}
|
|
1212
|
+
);
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarSeparator, SidebarTrigger, useSidebar };
|
|
1216
|
+
//# sourceMappingURL=sidebar.js.map
|
|
1217
|
+
//# sourceMappingURL=sidebar.js.map
|