@constructive-io/ui 0.3.1 → 0.6.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/LICENSE +21 -0
- package/README.md +17 -22
- package/dist/components/alert-dialog.cjs +333 -0
- package/dist/components/alert-dialog.cjs.map +1 -0
- package/dist/components/alert-dialog.d.cts +32 -0
- package/dist/components/alert-dialog.d.ts +16 -15
- package/dist/components/alert-dialog.js +89 -102
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.cjs +119 -0
- package/dist/components/alert.cjs.map +1 -0
- package/dist/components/alert.d.cts +19 -0
- package/dist/components/alert.d.ts +10 -5
- package/dist/components/alert.js +62 -6
- package/dist/components/alert.js.map +1 -1
- package/dist/components/app-bar.cjs +367 -0
- package/dist/components/app-bar.cjs.map +1 -0
- package/dist/components/app-bar.d.cts +26 -0
- package/dist/components/app-bar.d.ts +26 -0
- package/dist/components/app-bar.js +344 -0
- package/dist/components/app-bar.js.map +1 -0
- package/dist/components/app-shell.cjs +1792 -0
- package/dist/components/app-shell.cjs.map +1 -0
- package/dist/components/app-shell.d.cts +106 -0
- package/dist/components/app-shell.d.ts +106 -0
- package/dist/components/app-shell.js +1771 -0
- package/dist/components/app-shell.js.map +1 -0
- package/dist/components/autocomplete.cjs +418 -0
- package/dist/components/autocomplete.cjs.map +1 -0
- package/dist/components/autocomplete.d.cts +28 -0
- package/dist/components/autocomplete.d.ts +15 -15
- package/dist/components/autocomplete.js +9 -30
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.cjs +51 -0
- package/dist/components/avatar.cjs.map +1 -0
- package/dist/components/avatar.d.cts +12 -0
- package/dist/components/avatar.d.ts +3 -4
- package/dist/components/avatar.js +11 -1
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.cjs +66 -0
- package/dist/components/badge.cjs.map +1 -0
- package/dist/components/badge.d.cts +15 -0
- package/dist/components/badge.js +1 -1
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.cjs +118 -0
- package/dist/components/breadcrumb.cjs.map +1 -0
- package/dist/components/breadcrumb.d.cts +14 -0
- package/dist/components/breadcrumb.d.ts +9 -9
- package/dist/components/breadcrumb.js +19 -83
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button.cjs +169 -0
- package/dist/components/button.cjs.map +1 -0
- package/dist/components/button.d.cts +20 -0
- package/dist/components/button.d.ts +3 -0
- package/dist/components/button.js +105 -21
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-rac.cjs +85 -0
- package/dist/components/calendar-rac.cjs.map +1 -0
- package/dist/components/calendar-rac.d.cts +13 -0
- package/dist/components/calendar-rac.d.ts +3 -3
- package/dist/components/card.cjs +99 -0
- package/dist/components/card.cjs.map +1 -0
- package/dist/components/card.d.cts +18 -0
- package/dist/components/card.d.ts +7 -8
- package/dist/components/card.js +23 -8
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox-group.cjs +18 -0
- package/dist/components/checkbox-group.cjs.map +1 -0
- package/dist/components/checkbox-group.d.cts +7 -0
- package/dist/components/checkbox-group.d.ts +2 -2
- package/dist/components/checkbox.cjs +121 -0
- package/dist/components/checkbox.cjs.map +1 -0
- package/dist/components/checkbox.d.cts +8 -0
- package/dist/components/checkbox.d.ts +3 -3
- package/dist/components/checkbox.js +73 -41
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.cjs +127 -0
- package/dist/components/collapsible.cjs.map +1 -0
- package/dist/components/collapsible.d.cts +44 -0
- package/dist/components/collapsible.d.ts +8 -18
- package/dist/components/collapsible.js +7 -27
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.cjs +551 -0
- package/dist/components/combobox.cjs.map +1 -0
- package/dist/components/combobox.d.cts +43 -0
- package/dist/components/combobox.d.ts +17 -18
- package/dist/components/combobox.js +37 -48
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.cjs +236 -0
- package/dist/components/command.cjs.map +1 -0
- package/dist/components/command.d.cts +23 -0
- package/dist/components/command.d.ts +14 -15
- package/dist/components/command.js +5 -38
- package/dist/components/command.js.map +1 -1
- package/dist/components/dialog.cjs +431 -0
- package/dist/components/dialog.cjs.map +1 -0
- package/dist/components/dialog.d.cts +30 -0
- package/dist/components/dialog.d.ts +13 -18
- package/dist/components/dialog.js +75 -119
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.cjs +121 -0
- package/dist/components/dock.cjs.map +1 -0
- package/dist/components/dock.d.cts +30 -0
- package/dist/components/dock.d.ts +1 -2
- package/dist/components/dock.js +7 -5
- package/dist/components/dock.js.map +1 -1
- package/dist/components/drawer.cjs +149 -0
- package/dist/components/drawer.cjs.map +1 -0
- package/dist/components/drawer.d.cts +15 -0
- package/dist/components/drawer.d.ts +10 -11
- package/dist/components/drawer.js +11 -40
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +292 -0
- package/dist/components/dropdown-menu.cjs.map +1 -0
- package/dist/components/dropdown-menu.d.cts +52 -0
- package/dist/components/dropdown-menu.d.ts +23 -21
- package/dist/components/dropdown-menu.js +67 -191
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty.cjs +106 -0
- package/dist/components/empty.cjs.map +1 -0
- package/dist/components/empty.d.cts +15 -0
- package/dist/components/empty.d.ts +15 -0
- package/dist/components/empty.js +99 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/field.cjs +295 -0
- package/dist/components/field.cjs.map +1 -0
- package/dist/components/field.d.cts +46 -0
- package/dist/components/field.d.ts +34 -39
- package/dist/components/field.js +220 -72
- package/dist/components/field.js.map +1 -1
- package/dist/components/flickering-grid.cjs +176 -0
- package/dist/components/flickering-grid.cjs.map +1 -0
- package/dist/components/flickering-grid.d.cts +15 -0
- package/dist/components/flickering-grid.js +25 -2
- package/dist/components/flickering-grid.js.map +1 -1
- package/dist/components/flow-zoom-panel.cjs +194 -0
- package/dist/components/flow-zoom-panel.cjs.map +1 -0
- package/dist/components/flow-zoom-panel.d.cts +12 -0
- package/dist/components/flow-zoom-panel.d.ts +12 -0
- package/dist/components/flow-zoom-panel.js +173 -0
- package/dist/components/flow-zoom-panel.js.map +1 -0
- package/dist/components/form-control.cjs +193 -0
- package/dist/components/form-control.cjs.map +1 -0
- package/dist/components/form-control.d.cts +14 -0
- package/dist/components/form-control.d.ts +1 -2
- package/dist/components/form-control.js +2 -4
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/form.cjs +208 -0
- package/dist/components/form.cjs.map +1 -0
- package/dist/components/form.d.cts +36 -0
- package/dist/components/form.d.ts +7 -8
- package/dist/components/input-group.cjs +184 -0
- package/dist/components/input-group.cjs.map +1 -0
- package/dist/components/input-group.d.cts +17 -0
- package/dist/components/input-group.d.ts +6 -7
- package/dist/components/input-group.js +3 -2
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input.cjs +62 -0
- package/dist/components/input.cjs.map +1 -0
- package/dist/components/input.d.cts +10 -0
- package/dist/components/input.d.ts +1 -2
- package/dist/components/input.js +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/json-input.cjs +351 -0
- package/dist/components/json-input.cjs.map +1 -0
- package/dist/components/json-input.d.cts +25 -0
- package/dist/components/json-input.d.ts +3 -3
- package/dist/components/json-input.js +89 -112
- package/dist/components/json-input.js.map +1 -1
- package/dist/components/label.cjs +29 -0
- package/dist/components/label.cjs.map +1 -0
- package/dist/components/label.d.cts +10 -0
- package/dist/components/label.d.ts +1 -2
- package/dist/components/motion-grid.cjs +108 -0
- package/dist/components/motion-grid.cjs.map +1 -0
- package/dist/components/motion-grid.d.cts +19 -0
- package/dist/components/motion-grid.d.ts +1 -2
- package/dist/components/motion-grid.js +9 -4
- package/dist/components/motion-grid.js.map +1 -1
- package/dist/components/multi-select.cjs +796 -0
- package/dist/components/multi-select.cjs.map +1 -0
- package/dist/components/multi-select.d.cts +198 -0
- package/dist/components/multi-select.js +54 -162
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/page-header.cjs +19 -0
- package/dist/components/page-header.cjs.map +1 -0
- package/dist/components/page-header.d.cts +17 -0
- package/dist/components/page-header.d.ts +2 -2
- package/dist/components/pagination.cjs +295 -0
- package/dist/components/pagination.cjs.map +1 -0
- package/dist/components/pagination.d.cts +18 -0
- package/dist/components/pagination.d.ts +7 -8
- package/dist/components/pagination.js +152 -29
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.cjs +140 -0
- package/dist/components/popover.cjs.map +1 -0
- package/dist/components/popover.d.cts +39 -0
- package/dist/components/popover.d.ts +13 -9
- package/dist/components/popover.js +56 -132
- package/dist/components/popover.js.map +1 -1
- package/dist/components/portal.cjs +109 -0
- package/dist/components/portal.cjs.map +1 -0
- package/dist/components/portal.d.cts +117 -0
- package/dist/components/portal.d.ts +16 -7
- package/dist/components/portal.js +13 -8
- package/dist/components/portal.js.map +1 -1
- package/dist/components/progress.cjs +31 -0
- package/dist/components/progress.cjs.map +1 -0
- package/dist/components/progress.d.cts +9 -0
- package/dist/components/progress.d.ts +1 -2
- package/dist/components/progress.js +1 -2
- package/dist/components/progress.js.map +1 -1
- package/dist/components/progressive-blur-scroll-container.cjs +144 -0
- package/dist/components/progressive-blur-scroll-container.cjs.map +1 -0
- package/dist/components/progressive-blur-scroll-container.d.cts +25 -0
- package/dist/components/progressive-blur-scroll-container.d.ts +2 -2
- package/dist/components/progressive-blur.cjs +70 -0
- package/dist/components/progressive-blur.cjs.map +1 -0
- package/dist/components/progressive-blur.d.cts +16 -0
- package/dist/components/progressive-blur.d.ts +2 -2
- package/dist/components/radio-group.cjs +52 -0
- package/dist/components/radio-group.cjs.map +1 -0
- package/dist/components/radio-group.d.cts +10 -0
- package/dist/components/radio-group.d.ts +3 -3
- package/dist/components/radio-group.js +21 -10
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/record-picker.cjs +420 -0
- package/dist/components/record-picker.cjs.map +1 -0
- package/dist/components/record-picker.d.cts +16 -0
- package/dist/components/record-picker.d.ts +2 -2
- package/dist/components/record-picker.js +76 -43
- package/dist/components/record-picker.js.map +1 -1
- package/dist/components/resizable.cjs +76 -0
- package/dist/components/resizable.cjs.map +1 -0
- package/dist/components/resizable.d.cts +10 -0
- package/dist/components/resizable.d.ts +3 -4
- package/dist/components/responsive-diagram.cjs +67 -0
- package/dist/components/responsive-diagram.cjs.map +1 -0
- package/dist/components/responsive-diagram.d.cts +10 -0
- package/dist/components/responsive-diagram.d.ts +2 -2
- package/dist/components/scroll-area.cjs +92 -0
- package/dist/components/scroll-area.cjs.map +1 -0
- package/dist/components/scroll-area.d.cts +11 -0
- package/dist/components/scroll-area.d.ts +5 -6
- package/dist/components/select.cjs +329 -0
- package/dist/components/select.cjs.map +1 -0
- package/dist/components/select.d.cts +46 -0
- package/dist/components/select.d.ts +13 -14
- package/dist/components/select.js +76 -67
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +26 -0
- package/dist/components/separator.cjs.map +1 -0
- package/dist/components/separator.d.cts +10 -0
- package/dist/components/separator.d.ts +1 -2
- package/dist/components/sheet.cjs +489 -0
- package/dist/components/sheet.cjs.map +1 -0
- package/dist/components/sheet.d.cts +107 -0
- package/dist/components/sheet.d.ts +14 -19
- package/dist/components/sheet.js +119 -264
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.cjs +1300 -0
- package/dist/components/sidebar.cjs.map +1 -0
- package/dist/components/sidebar.d.cts +70 -0
- package/dist/components/sidebar.d.ts +32 -39
- package/dist/components/sidebar.js +401 -362
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton.cjs +36 -0
- package/dist/components/skeleton.cjs.map +1 -0
- package/dist/components/skeleton.d.cts +10 -0
- package/dist/components/skeleton.d.ts +5 -2
- package/dist/components/skeleton.js +19 -1
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/sonner.cjs +25 -0
- package/dist/components/sonner.cjs.map +1 -0
- package/dist/components/sonner.d.cts +10 -0
- package/dist/components/sonner.d.ts +2 -2
- package/dist/components/stack/index.cjs +1516 -0
- package/dist/components/stack/index.cjs.map +1 -0
- package/dist/components/stack/index.d.cts +672 -0
- package/dist/components/stack/index.d.ts +36 -38
- package/dist/components/stack/index.js +42 -31
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/stepper.cjs +314 -0
- package/dist/components/stepper.cjs.map +1 -0
- package/dist/components/stepper.d.cts +31 -0
- package/dist/components/stepper.d.ts +9 -8
- package/dist/components/stepper.js +22 -15
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.cjs +46 -0
- package/dist/components/switch.cjs.map +1 -0
- package/dist/components/switch.d.cts +7 -0
- package/dist/components/switch.d.ts +1 -2
- package/dist/components/switch.js +9 -5
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +133 -0
- package/dist/components/table.cjs.map +1 -0
- package/dist/components/table.d.cts +22 -0
- package/dist/components/table.d.ts +19 -12
- package/dist/components/table.js +72 -13
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.cjs +53 -0
- package/dist/components/tabs.cjs.map +1 -0
- package/dist/components/tabs.d.cts +9 -0
- package/dist/components/tabs.d.ts +4 -5
- package/dist/components/tabs.js +2 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tags.cjs +451 -0
- package/dist/components/tags.cjs.map +1 -0
- package/dist/components/tags.d.cts +40 -0
- package/dist/components/tags.d.ts +10 -10
- package/dist/components/tags.js +129 -154
- package/dist/components/tags.js.map +1 -1
- package/dist/components/textarea.cjs +56 -0
- package/dist/components/textarea.cjs.map +1 -0
- package/dist/components/textarea.d.cts +9 -0
- package/dist/components/textarea.d.ts +1 -2
- package/dist/components/toast/index.cjs +612 -0
- package/dist/components/toast/index.cjs.map +1 -0
- package/dist/components/toast/index.d.cts +52 -0
- package/dist/components/toast/index.js +90 -127
- package/dist/components/toast/index.js.map +1 -1
- package/dist/components/tooltip.cjs +92 -0
- package/dist/components/tooltip.cjs.map +1 -0
- package/dist/components/tooltip.d.cts +28 -0
- package/dist/components/tooltip.d.ts +5 -6
- package/dist/components/tooltip.js +23 -130
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unlink-button.cjs +197 -0
- package/dist/components/unlink-button.cjs.map +1 -0
- package/dist/components/unlink-button.d.cts +14 -0
- package/dist/components/unlink-button.d.ts +2 -2
- package/dist/components/unlink-button.js +105 -21
- package/dist/components/unlink-button.js.map +1 -1
- package/dist/index.cjs +2040 -1577
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +492 -509
- package/dist/index.d.ts +492 -509
- package/dist/index.js +1862 -1443
- package/dist/index.js.map +1 -1
- package/package.json +286 -45
- package/src/styles/globals.css +155 -203
- package/dist/components/org-chart/index.d.ts +0 -54
- package/dist/components/org-chart/index.js +0 -861
- package/dist/components/org-chart/index.js.map +0 -1
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
2
|
+
import * as React4 from 'react';
|
|
3
|
+
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
4
|
+
import { mergeProps as mergeProps$1 } from '@base-ui/react/merge-props';
|
|
5
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
6
|
import { cva } from 'class-variance-authority';
|
|
5
7
|
import { PanelLeftIcon, X } from 'lucide-react';
|
|
6
8
|
import { clsx } from 'clsx';
|
|
7
9
|
import { twMerge } from 'tailwind-merge';
|
|
10
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
8
11
|
import { Input as Input$1 } from '@base-ui/react/input';
|
|
9
12
|
import { Separator as Separator$1 } from '@base-ui/react/separator';
|
|
10
13
|
import { Dialog } from '@base-ui/react/dialog';
|
|
11
14
|
import { AnimatePresence, motion } from 'motion/react';
|
|
15
|
+
import { ModalPortalScope, useFloatingOverlayPortalProps, useRootPortalContainer } from '@constructive-io/ui/portal';
|
|
12
16
|
import { Tooltip as Tooltip$1 } from '@base-ui/react/tooltip';
|
|
13
17
|
|
|
18
|
+
var MOBILE_BREAKPOINT = 768;
|
|
19
|
+
function useIsMobile() {
|
|
20
|
+
const [isMobile, setIsMobile] = React4.useState(false);
|
|
21
|
+
React4.useEffect(() => {
|
|
22
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
23
|
+
const onChange = () => {
|
|
24
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
25
|
+
};
|
|
26
|
+
mql.addEventListener("change", onChange);
|
|
27
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
28
|
+
return () => mql.removeEventListener("change", onChange);
|
|
29
|
+
}, []);
|
|
30
|
+
return isMobile;
|
|
31
|
+
}
|
|
32
|
+
function cn(...inputs) {
|
|
33
|
+
return twMerge(clsx(inputs));
|
|
34
|
+
}
|
|
14
35
|
function composeRefs(...refs) {
|
|
15
36
|
return (node) => {
|
|
16
37
|
refs.forEach((ref) => {
|
|
@@ -41,33 +62,23 @@ function mergeProps(slotProps, childProps) {
|
|
|
41
62
|
}
|
|
42
63
|
return { ...slotProps, ...overrideProps };
|
|
43
64
|
}
|
|
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
65
|
function isSlottable(child) {
|
|
55
|
-
return
|
|
66
|
+
return React4.isValidElement(child);
|
|
56
67
|
}
|
|
57
|
-
var Slot =
|
|
68
|
+
var Slot = React4.forwardRef((props, forwardedRef) => {
|
|
58
69
|
const { children, ...slotProps } = props;
|
|
59
70
|
if (isSlottable(children)) {
|
|
60
71
|
const childProps = children.props;
|
|
61
72
|
const childRef = childProps.ref;
|
|
62
|
-
return
|
|
73
|
+
return React4.cloneElement(children, {
|
|
63
74
|
...mergeProps(slotProps, childProps),
|
|
64
75
|
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
|
|
65
76
|
});
|
|
66
77
|
}
|
|
67
|
-
if (
|
|
68
|
-
const childrenArray =
|
|
78
|
+
if (React4.Children.count(children) > 1) {
|
|
79
|
+
const childrenArray = React4.Children.toArray(children);
|
|
69
80
|
const slottableChild = childrenArray.find(
|
|
70
|
-
(child) =>
|
|
81
|
+
(child) => React4.isValidElement(child) && child.type === Slottable
|
|
71
82
|
);
|
|
72
83
|
if (slottableChild) {
|
|
73
84
|
const newElement = slottableChild.props.children;
|
|
@@ -75,12 +86,12 @@ var Slot = React5.forwardRef((props, forwardedRef) => {
|
|
|
75
86
|
const newElementProps = newElement.props;
|
|
76
87
|
const newChildren = childrenArray.map((child) => {
|
|
77
88
|
if (child === slottableChild) {
|
|
78
|
-
return
|
|
89
|
+
return React4.Children.count(newElementProps.children) > 1 ? React4.Children.only(null) : newElementProps.children;
|
|
79
90
|
}
|
|
80
91
|
return child;
|
|
81
92
|
});
|
|
82
93
|
const childRef = newElementProps.ref;
|
|
83
|
-
return
|
|
94
|
+
return React4.cloneElement(newElement, {
|
|
84
95
|
...mergeProps(slotProps, newElementProps),
|
|
85
96
|
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
|
|
86
97
|
children: newChildren
|
|
@@ -94,42 +105,30 @@ Slot.displayName = "Slot";
|
|
|
94
105
|
function Slottable({ children }) {
|
|
95
106
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
96
107
|
}
|
|
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
108
|
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-
|
|
109
|
+
"[&_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-sm outline-none transition-[box-shadow,scale] duration-150 ease-out before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] 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 motion-reduce:transition-shadow [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
116
110
|
{
|
|
117
111
|
defaultVariants: {
|
|
118
112
|
size: "default",
|
|
113
|
+
static: false,
|
|
119
114
|
variant: "default"
|
|
120
115
|
},
|
|
121
116
|
variants: {
|
|
117
|
+
static: {
|
|
118
|
+
false: "motion-safe:active:not-disabled:scale-[0.96]",
|
|
119
|
+
true: null
|
|
120
|
+
},
|
|
122
121
|
size: {
|
|
123
|
-
default: "h-
|
|
124
|
-
icon: "size-
|
|
125
|
-
"icon-lg": "size-
|
|
126
|
-
"icon-sm": "size-8
|
|
127
|
-
"icon-xl": 'size-11
|
|
128
|
-
"icon-xs": 'size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)]
|
|
129
|
-
lg: "h-
|
|
130
|
-
sm: "h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)]
|
|
131
|
-
xl: 'h-
|
|
132
|
-
xs: 'h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-
|
|
122
|
+
default: "h-10 min-w-10 px-[calc(--spacing(3)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11",
|
|
123
|
+
icon: "size-10 pointer-coarse:size-11",
|
|
124
|
+
"icon-lg": "size-11",
|
|
125
|
+
"icon-sm": "size-8 pointer-coarse:size-11",
|
|
126
|
+
"icon-xl": 'size-11 [&_svg:not([class*="size-"])]:size-5',
|
|
127
|
+
"icon-xs": 'size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] pointer-coarse:size-11 not-in-data-[slot=input-group]:[&_svg:not([class*="size-"])]:size-4',
|
|
128
|
+
lg: "h-11 min-w-11 px-[calc(--spacing(3.5)-1px)]",
|
|
129
|
+
sm: "h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11",
|
|
130
|
+
xl: 'h-12 min-w-12 px-[calc(--spacing(4)-1px)] text-lg [&_svg:not([class*="size-"])]:size-5',
|
|
131
|
+
xs: 'h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-xs before:rounded-[calc(var(--radius-md)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11 [&_svg:not([class*="size-"])]:size-3.5'
|
|
133
132
|
},
|
|
134
133
|
variant: {
|
|
135
134
|
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",
|
|
@@ -143,16 +142,22 @@ var buttonVariants = cva(
|
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
144
|
);
|
|
146
|
-
var Button =
|
|
147
|
-
({ className, variant, size, asChild, children, type = "button", ...props }, ref) => {
|
|
148
|
-
const buttonClasses = cn(buttonVariants({ className, size, variant }));
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
145
|
+
var Button = React4.forwardRef(
|
|
146
|
+
({ className, variant, size, static: isStatic, asChild, children, type = "button", ...props }, ref) => {
|
|
147
|
+
const buttonClasses = cn(buttonVariants({ className, size, static: isStatic, variant }));
|
|
148
|
+
const Comp = asChild ? Slot : "button";
|
|
149
|
+
if (asChild) {
|
|
150
|
+
const SlottedComp = Comp;
|
|
151
|
+
return /* @__PURE__ */ jsx(
|
|
152
|
+
SlottedComp,
|
|
153
|
+
{
|
|
154
|
+
ref,
|
|
155
|
+
className: buttonClasses,
|
|
156
|
+
"data-slot": "button",
|
|
157
|
+
...props,
|
|
158
|
+
children
|
|
159
|
+
}
|
|
160
|
+
);
|
|
156
161
|
}
|
|
157
162
|
return /* @__PURE__ */ jsx("button", { ref, type, className: buttonClasses, "data-slot": "button", ...props, children });
|
|
158
163
|
}
|
|
@@ -190,7 +195,7 @@ function Input({ className, size = "default", unstyled = false, ...props }) {
|
|
|
190
195
|
Input$1,
|
|
191
196
|
{
|
|
192
197
|
className: cn(
|
|
193
|
-
"w-full min-w-0 rounded-[inherit] bg-transparent px-[calc(--spacing(3)-1px)] outline-none",
|
|
198
|
+
"w-full min-w-0 rounded-[inherit] bg-transparent px-[calc(--spacing(3)-1px)] outline-none pointer-coarse:min-h-11",
|
|
194
199
|
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
200
|
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
201
|
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"),
|
|
@@ -227,98 +232,83 @@ var durations = {
|
|
|
227
232
|
fast: 0.15,
|
|
228
233
|
/** Standard UI transitions (modals, panels) */
|
|
229
234
|
normal: 0.2};
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
floatingPortalStrategy: "root",
|
|
235
|
-
floatingZIndex: "default"
|
|
236
|
-
});
|
|
237
|
-
function ModalPortalScope({
|
|
238
|
-
children,
|
|
239
|
-
floatingPortalStrategy = "nested",
|
|
240
|
-
floatingZIndex = "default"
|
|
235
|
+
function useControllableState({
|
|
236
|
+
prop,
|
|
237
|
+
defaultProp,
|
|
238
|
+
onChange
|
|
241
239
|
}) {
|
|
242
|
-
const
|
|
243
|
-
const
|
|
244
|
-
const value =
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
240
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultProp);
|
|
241
|
+
const isControlled = prop !== void 0;
|
|
242
|
+
const value = isControlled ? prop : uncontrolledValue;
|
|
243
|
+
const onChangeRef = useRef(onChange);
|
|
244
|
+
useEffect(() => {
|
|
245
|
+
onChangeRef.current = onChange;
|
|
246
|
+
}, [onChange]);
|
|
247
|
+
const setValue = useCallback(
|
|
248
|
+
(newValue) => {
|
|
249
|
+
if (!isControlled) {
|
|
250
|
+
setUncontrolledValue(newValue);
|
|
251
|
+
}
|
|
252
|
+
onChangeRef.current?.(newValue);
|
|
253
|
+
},
|
|
254
|
+
[isControlled]
|
|
252
255
|
);
|
|
253
|
-
return
|
|
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 };
|
|
256
|
+
return [value, setValue];
|
|
269
257
|
}
|
|
270
|
-
var SheetStackContext =
|
|
258
|
+
var SheetStackContext = React4.createContext(void 0);
|
|
271
259
|
var SHEET_INDENT = 24;
|
|
272
260
|
var useSheetStack = () => {
|
|
273
|
-
return
|
|
261
|
+
return React4.useContext(SheetStackContext);
|
|
274
262
|
};
|
|
275
|
-
var SheetNestingContext =
|
|
263
|
+
var SheetNestingContext = React4.createContext({
|
|
276
264
|
level: 0,
|
|
277
265
|
parentSheetId: null
|
|
278
266
|
});
|
|
279
|
-
var useSheetNesting = () =>
|
|
280
|
-
var SheetContext =
|
|
267
|
+
var useSheetNesting = () => React4.useContext(SheetNestingContext);
|
|
268
|
+
var SheetContext = React4.createContext(void 0);
|
|
281
269
|
var useSheet = () => {
|
|
282
|
-
const context =
|
|
270
|
+
const context = React4.useContext(SheetContext);
|
|
283
271
|
if (!context) {
|
|
284
272
|
throw new Error("useSheet must be used within a Sheet");
|
|
285
273
|
}
|
|
286
274
|
return context;
|
|
287
275
|
};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
276
|
+
function Sheet({
|
|
277
|
+
children,
|
|
278
|
+
sheetId: providedId,
|
|
279
|
+
open: openProp,
|
|
280
|
+
defaultOpen = false,
|
|
281
|
+
onOpenChange,
|
|
282
|
+
modal,
|
|
283
|
+
...props
|
|
284
|
+
}) {
|
|
285
|
+
const [isOpen, setIsOpen] = useControllableState({
|
|
286
|
+
prop: openProp,
|
|
287
|
+
defaultProp: defaultOpen,
|
|
288
|
+
onChange: onOpenChange
|
|
289
|
+
});
|
|
291
290
|
const sheetStack = useSheetStack();
|
|
292
291
|
const nesting = useSheetNesting();
|
|
293
|
-
const
|
|
294
|
-
const sheetId =
|
|
292
|
+
const generatedId = React4.useId();
|
|
293
|
+
const sheetId = providedId ?? `sheet-${generatedId.replace(/:/g, "")}`;
|
|
295
294
|
const depth = nesting.level;
|
|
296
|
-
const
|
|
297
|
-
onOpenChangeRef.current = props.onOpenChange;
|
|
298
|
-
const close = React5.useCallback(() => {
|
|
295
|
+
const close = React4.useCallback(() => {
|
|
299
296
|
setIsOpen(false);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
unregisterSheetRef.current = sheetStack?.unregisterSheet;
|
|
306
|
-
React5.useEffect(() => {
|
|
307
|
-
if (registerSheetRef.current && isOpen) {
|
|
297
|
+
}, [setIsOpen]);
|
|
298
|
+
const registerSheet = sheetStack?.registerSheet;
|
|
299
|
+
const unregisterSheet = sheetStack?.unregisterSheet;
|
|
300
|
+
React4.useEffect(() => {
|
|
301
|
+
if (registerSheet && isOpen) {
|
|
308
302
|
if (document.activeElement instanceof HTMLElement) {
|
|
309
303
|
document.activeElement.blur();
|
|
310
304
|
}
|
|
311
|
-
|
|
312
|
-
return () =>
|
|
305
|
+
registerSheet({ id: sheetId, depth, close });
|
|
306
|
+
return () => unregisterSheet?.(sheetId);
|
|
313
307
|
}
|
|
314
|
-
}, [isOpen, sheetId, depth, close]);
|
|
315
|
-
|
|
316
|
-
if (props?.open !== void 0) setIsOpen(props.open);
|
|
317
|
-
}, [props?.open]);
|
|
318
|
-
const handleOpenChange = React5.useCallback((open, _eventDetails) => {
|
|
308
|
+
}, [isOpen, sheetId, depth, close, registerSheet, unregisterSheet]);
|
|
309
|
+
const handleOpenChange = React4.useCallback((open, _eventDetails) => {
|
|
319
310
|
setIsOpen(open);
|
|
320
|
-
|
|
321
|
-
}, []);
|
|
311
|
+
}, [setIsOpen]);
|
|
322
312
|
const sheetsAbove = sheetStack?.getSheetsAbove(sheetId) ?? 0;
|
|
323
313
|
const isTopSheet = sheetStack?.isTopSheet(sheetId) ?? true;
|
|
324
314
|
const isNested = depth > 0;
|
|
@@ -328,14 +318,15 @@ function Sheet({ children, sheetId: providedId, ...props }) {
|
|
|
328
318
|
"data-slot": "sheet",
|
|
329
319
|
...props,
|
|
330
320
|
open: isOpen,
|
|
331
|
-
modal: isNested ? false :
|
|
321
|
+
modal: isNested ? false : modal,
|
|
332
322
|
onOpenChange: handleOpenChange,
|
|
333
323
|
children
|
|
334
324
|
}
|
|
335
325
|
) }) });
|
|
336
326
|
}
|
|
337
|
-
function SheetPortal({ forceMount: _forceMount, ...props }) {
|
|
338
|
-
const
|
|
327
|
+
function SheetPortal({ forceMount: _forceMount, container: containerProp, ...props }) {
|
|
328
|
+
const rootContainer = useRootPortalContainer();
|
|
329
|
+
const container = containerProp === void 0 ? rootContainer ?? void 0 : containerProp;
|
|
339
330
|
const style = {
|
|
340
331
|
...props.style ?? {},
|
|
341
332
|
["--z-layer-floating"]: "var(--z-layer-floating-elevated)"
|
|
@@ -431,7 +422,7 @@ function SheetContent({
|
|
|
431
422
|
onFocusOutside: _onFocusOutside,
|
|
432
423
|
...props
|
|
433
424
|
}) {
|
|
434
|
-
const { isOpen, depth, sheetId
|
|
425
|
+
const { isOpen, depth, sheetId } = useSheet();
|
|
435
426
|
const sheetStack = useSheetStack();
|
|
436
427
|
const sheetsAbove = sheetStack?.getSheetsAbove(sheetId) ?? 0;
|
|
437
428
|
const stackMode = sheetStack?.stackMode ?? "cascade";
|
|
@@ -441,8 +432,8 @@ function SheetContent({
|
|
|
441
432
|
const topSheetSize = topSheetId ? sheetStack?.getSheetSize(topSheetId) : void 0;
|
|
442
433
|
const collapseBaseSize = topSheetSize ? resolvedSide === "left" || resolvedSide === "right" ? topSheetSize.width : topSheetSize.height : void 0;
|
|
443
434
|
const pushOffset = getPushOffset(resolvedSide, sheetsAbove, stackMode, collapseBaseSize ?? NESTED_SHEET_WIDTH);
|
|
444
|
-
const contentRef =
|
|
445
|
-
|
|
435
|
+
const contentRef = React4.useRef(null);
|
|
436
|
+
React4.useLayoutEffect(() => {
|
|
446
437
|
if (!isOpen) return;
|
|
447
438
|
if (!sheetStack) return;
|
|
448
439
|
const el = contentRef.current;
|
|
@@ -473,47 +464,24 @@ function SheetContent({
|
|
|
473
464
|
duration: durations.normal,
|
|
474
465
|
ease: easings.physicalExit
|
|
475
466
|
};
|
|
476
|
-
|
|
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: [
|
|
467
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: isOpen && /* @__PURE__ */ jsxs(SheetPortal, { "data-slot": "sheet-portal", children: [
|
|
505
468
|
overlay && depth === 0 && /* @__PURE__ */ jsx(
|
|
506
|
-
|
|
469
|
+
Dialog.Backdrop,
|
|
507
470
|
{
|
|
508
471
|
"data-slot": "sheet-overlay",
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
472
|
+
render: /* @__PURE__ */ jsx(
|
|
473
|
+
motion.div,
|
|
474
|
+
{
|
|
475
|
+
className: "fixed inset-0 bg-black/80",
|
|
476
|
+
initial: { opacity: 0 },
|
|
477
|
+
animate: { opacity: 1 },
|
|
478
|
+
exit: { opacity: 0 },
|
|
479
|
+
transition: { duration: durations.fast, ease: "easeOut" },
|
|
480
|
+
style: { zIndex: "var(--z-layer-modal-backdrop)" }
|
|
481
|
+
},
|
|
482
|
+
"sheet-overlay"
|
|
483
|
+
)
|
|
484
|
+
}
|
|
517
485
|
),
|
|
518
486
|
/* @__PURE__ */ jsxs(
|
|
519
487
|
Dialog.Popup,
|
|
@@ -538,10 +506,7 @@ function SheetContent({
|
|
|
538
506
|
animate: "animate",
|
|
539
507
|
exit: "exit",
|
|
540
508
|
transition,
|
|
541
|
-
style: {
|
|
542
|
-
zIndex,
|
|
543
|
-
willChange: "transform"
|
|
544
|
-
},
|
|
509
|
+
style: { zIndex },
|
|
545
510
|
className: cn(sheetVariants({ side: resolvedSide }), className)
|
|
546
511
|
},
|
|
547
512
|
`sheet-content-${sheetId}`
|
|
@@ -595,7 +560,25 @@ function SheetDescription({ className, ...props }) {
|
|
|
595
560
|
);
|
|
596
561
|
}
|
|
597
562
|
function Skeleton({ className, ...props }) {
|
|
598
|
-
return /* @__PURE__ */ jsx(
|
|
563
|
+
return /* @__PURE__ */ jsx(
|
|
564
|
+
"div",
|
|
565
|
+
{
|
|
566
|
+
"data-slot": "skeleton",
|
|
567
|
+
className: cn(
|
|
568
|
+
"rounded-md",
|
|
569
|
+
// Quiet base (muted, not primary/10)
|
|
570
|
+
"bg-muted",
|
|
571
|
+
// Soft, low-contrast band — mostly muted with a faint lift mid-pass
|
|
572
|
+
"[background-image:linear-gradient(90deg,var(--muted)_0%,color-mix(in_oklch,var(--muted)_92%,var(--foreground))_50%,var(--muted)_100%)]",
|
|
573
|
+
"bg-[length:220%_100%]",
|
|
574
|
+
// Slow, relaxed sweep
|
|
575
|
+
"animate-[shimmer_4.5s_ease-in-out_infinite]",
|
|
576
|
+
"motion-reduce:animate-none",
|
|
577
|
+
className
|
|
578
|
+
),
|
|
579
|
+
...props
|
|
580
|
+
}
|
|
581
|
+
);
|
|
599
582
|
}
|
|
600
583
|
function TooltipProvider({ delay = 0, delayDuration, ...props }) {
|
|
601
584
|
return /* @__PURE__ */ jsx(Tooltip$1.Provider, { "data-slot": "tooltip-provider", delay: delayDuration ?? delay, ...props });
|
|
@@ -603,24 +586,18 @@ function TooltipProvider({ delay = 0, delayDuration, ...props }) {
|
|
|
603
586
|
function Tooltip({ delayDuration: _delayDuration, ...props }) {
|
|
604
587
|
return /* @__PURE__ */ jsx(Tooltip$1.Root, { "data-slot": "tooltip", ...props });
|
|
605
588
|
}
|
|
606
|
-
function TooltipTrigger({ delay = 0, asChild, children, ...props }) {
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
);
|
|
622
|
-
}
|
|
623
|
-
return /* @__PURE__ */ jsx(Tooltip$1.Trigger, { "data-slot": "tooltip-trigger", delay, ...props, children });
|
|
589
|
+
function TooltipTrigger({ delay = 0, asChild, children, render, ...props }) {
|
|
590
|
+
const childRender = render === void 0 && asChild && React4.isValidElement(children) ? children : void 0;
|
|
591
|
+
return /* @__PURE__ */ jsx(
|
|
592
|
+
Tooltip$1.Trigger,
|
|
593
|
+
{
|
|
594
|
+
"data-slot": "tooltip-trigger",
|
|
595
|
+
delay,
|
|
596
|
+
render: render ?? childRender,
|
|
597
|
+
...props,
|
|
598
|
+
children: childRender ? void 0 : children
|
|
599
|
+
}
|
|
600
|
+
);
|
|
624
601
|
}
|
|
625
602
|
function TooltipContent({
|
|
626
603
|
className,
|
|
@@ -637,14 +614,17 @@ function TooltipContent({
|
|
|
637
614
|
{
|
|
638
615
|
"data-slot": "tooltip-content",
|
|
639
616
|
className: cn(
|
|
640
|
-
`bg-popover text-popover-foreground
|
|
641
|
-
|
|
642
|
-
data-
|
|
643
|
-
data-[side=
|
|
644
|
-
|
|
617
|
+
`bg-popover text-popover-foreground origin-(--transform-origin) relative max-w-70 rounded-md border px-2 py-1
|
|
618
|
+
text-xs transition-[scale,opacity,translate] duration-150 ease-out data-starting-style:scale-95
|
|
619
|
+
data-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0
|
|
620
|
+
data-[side=bottom]:data-starting-style:-translate-y-2
|
|
621
|
+
data-[side=left]:data-starting-style:translate-x-2
|
|
622
|
+
data-[side=right]:data-starting-style:-translate-x-2
|
|
623
|
+
data-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,
|
|
645
624
|
className
|
|
646
625
|
),
|
|
647
626
|
...props,
|
|
627
|
+
role: "tooltip",
|
|
648
628
|
children: [
|
|
649
629
|
children,
|
|
650
630
|
showArrow && /* @__PURE__ */ jsx(Tooltip$1.Arrow, { className: "fill-popover -my-px drop-shadow-[0_1px_0_hsl(var(--border))]" })
|
|
@@ -654,20 +634,20 @@ function TooltipContent({
|
|
|
654
634
|
}
|
|
655
635
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
656
636
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
657
|
-
var SIDEBAR_WIDTH = "
|
|
658
|
-
var SIDEBAR_WIDTH_MOBILE = "
|
|
659
|
-
var SIDEBAR_WIDTH_ICON = "
|
|
637
|
+
var SIDEBAR_WIDTH = "16rem";
|
|
638
|
+
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
639
|
+
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
660
640
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
661
|
-
var SidebarContext =
|
|
641
|
+
var SidebarContext = React4.createContext(null);
|
|
662
642
|
function useSidebar() {
|
|
663
|
-
const context =
|
|
643
|
+
const context = React4.useContext(SidebarContext);
|
|
664
644
|
if (!context) {
|
|
665
645
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
666
646
|
}
|
|
667
647
|
return context;
|
|
668
648
|
}
|
|
669
649
|
function SidebarProvider({
|
|
670
|
-
defaultOpen =
|
|
650
|
+
defaultOpen = true,
|
|
671
651
|
open: openProp,
|
|
672
652
|
onOpenChange: setOpenProp,
|
|
673
653
|
className,
|
|
@@ -676,11 +656,11 @@ function SidebarProvider({
|
|
|
676
656
|
...props
|
|
677
657
|
}) {
|
|
678
658
|
const isMobile = useIsMobile();
|
|
679
|
-
const
|
|
680
|
-
const [
|
|
681
|
-
const [_open, _setOpen] =
|
|
659
|
+
const sidebarId = React4.useId();
|
|
660
|
+
const [openMobile, setOpenMobile] = React4.useState(false);
|
|
661
|
+
const [_open, _setOpen] = React4.useState(defaultOpen);
|
|
682
662
|
const open = openProp ?? _open;
|
|
683
|
-
const setOpen =
|
|
663
|
+
const setOpen = React4.useCallback(
|
|
684
664
|
(value) => {
|
|
685
665
|
const openState = typeof value === "function" ? value(open) : value;
|
|
686
666
|
if (setOpenProp) {
|
|
@@ -690,12 +670,12 @@ function SidebarProvider({
|
|
|
690
670
|
}
|
|
691
671
|
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
692
672
|
},
|
|
693
|
-
[
|
|
673
|
+
[open, setOpenProp]
|
|
694
674
|
);
|
|
695
|
-
const toggleSidebar =
|
|
696
|
-
return isMobile ? setOpenMobile((
|
|
697
|
-
}, [isMobile, setOpen
|
|
698
|
-
|
|
675
|
+
const toggleSidebar = React4.useCallback(() => {
|
|
676
|
+
return isMobile ? setOpenMobile((currentOpen) => !currentOpen) : setOpen((currentOpen) => !currentOpen);
|
|
677
|
+
}, [isMobile, setOpen]);
|
|
678
|
+
React4.useEffect(() => {
|
|
699
679
|
const handleKeyDown = (event) => {
|
|
700
680
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
701
681
|
event.preventDefault();
|
|
@@ -705,23 +685,21 @@ function SidebarProvider({
|
|
|
705
685
|
window.addEventListener("keydown", handleKeyDown);
|
|
706
686
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
707
687
|
}, [toggleSidebar]);
|
|
708
|
-
const
|
|
709
|
-
const
|
|
710
|
-
const contextValue = React5.useMemo(
|
|
688
|
+
const state = open ? "expanded" : "collapsed";
|
|
689
|
+
const contextValue = React4.useMemo(
|
|
711
690
|
() => ({
|
|
691
|
+
sidebarId,
|
|
712
692
|
state,
|
|
713
693
|
open,
|
|
714
694
|
setOpen,
|
|
715
695
|
isMobile,
|
|
716
696
|
openMobile,
|
|
717
697
|
setOpenMobile,
|
|
718
|
-
toggleSidebar
|
|
719
|
-
isHovered,
|
|
720
|
-
setIsHovered
|
|
698
|
+
toggleSidebar
|
|
721
699
|
}),
|
|
722
|
-
[state, open, setOpen, isMobile, openMobile,
|
|
700
|
+
[sidebarId, state, open, setOpen, isMobile, openMobile, toggleSidebar]
|
|
723
701
|
);
|
|
724
|
-
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(TooltipProvider, {
|
|
702
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(TooltipProvider, { delay: 0, children: /* @__PURE__ */ jsx(
|
|
725
703
|
"div",
|
|
726
704
|
{
|
|
727
705
|
"data-slot": "sidebar-wrapper",
|
|
@@ -730,7 +708,7 @@ function SidebarProvider({
|
|
|
730
708
|
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
731
709
|
...style
|
|
732
710
|
},
|
|
733
|
-
className: cn("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar
|
|
711
|
+
className: cn("group/sidebar-wrapper flex min-h-dvh w-full has-data-[variant=inset]:bg-sidebar", className),
|
|
734
712
|
...props,
|
|
735
713
|
children
|
|
736
714
|
}
|
|
@@ -739,18 +717,20 @@ function SidebarProvider({
|
|
|
739
717
|
function Sidebar({
|
|
740
718
|
side = "left",
|
|
741
719
|
variant = "sidebar",
|
|
742
|
-
collapsible = "
|
|
720
|
+
collapsible = "offcanvas",
|
|
743
721
|
className,
|
|
744
722
|
children,
|
|
723
|
+
dir,
|
|
745
724
|
...props
|
|
746
725
|
}) {
|
|
747
|
-
const { isMobile, state, openMobile, setOpenMobile
|
|
726
|
+
const { isMobile, sidebarId, state, openMobile, setOpenMobile } = useSidebar();
|
|
748
727
|
if (collapsible === "none") {
|
|
749
728
|
return /* @__PURE__ */ jsx(
|
|
750
729
|
"div",
|
|
751
730
|
{
|
|
731
|
+
id: sidebarId,
|
|
752
732
|
"data-slot": "sidebar",
|
|
753
|
-
className: cn("
|
|
733
|
+
className: cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className),
|
|
754
734
|
...props,
|
|
755
735
|
children
|
|
756
736
|
}
|
|
@@ -760,10 +740,18 @@ function Sidebar({
|
|
|
760
740
|
return /* @__PURE__ */ jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs(
|
|
761
741
|
SheetContent,
|
|
762
742
|
{
|
|
743
|
+
id: sidebarId,
|
|
744
|
+
dir,
|
|
763
745
|
"data-sidebar": "sidebar",
|
|
764
746
|
"data-slot": "sidebar",
|
|
765
747
|
"data-mobile": "true",
|
|
766
|
-
className:
|
|
748
|
+
className: `w-(--sidebar-width) bg-sidebar pt-[env(safe-area-inset-top)]
|
|
749
|
+
pb-[env(safe-area-inset-bottom)] text-sidebar-foreground [&_[data-sidebar=header]]:pr-12
|
|
750
|
+
[&>[data-slot=sheet-close]]:top-[calc(env(safe-area-inset-top)+0.5rem)]
|
|
751
|
+
[&>[data-slot=sheet-close]]:right-2 [&>[data-slot=sheet-close]]:flex
|
|
752
|
+
[&>[data-slot=sheet-close]]:size-10 [&>[data-slot=sheet-close]]:items-center
|
|
753
|
+
[&>[data-slot=sheet-close]]:justify-center [&>[data-slot=sheet-close]]:rounded-lg
|
|
754
|
+
[&>[data-slot=sheet-close]]:opacity-100 pointer-coarse:[&>[data-slot=sheet-close]]:size-11`,
|
|
767
755
|
style: {
|
|
768
756
|
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
|
|
769
757
|
},
|
|
@@ -781,21 +769,20 @@ function Sidebar({
|
|
|
781
769
|
return /* @__PURE__ */ jsxs(
|
|
782
770
|
"div",
|
|
783
771
|
{
|
|
784
|
-
|
|
772
|
+
id: sidebarId,
|
|
773
|
+
className: "group peer hidden text-sidebar-foreground md:block",
|
|
785
774
|
"data-state": state,
|
|
786
775
|
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
787
776
|
"data-variant": variant,
|
|
788
777
|
"data-side": side,
|
|
789
778
|
"data-slot": "sidebar",
|
|
790
|
-
onMouseEnter: () => setIsHovered(true),
|
|
791
|
-
onMouseLeave: () => setIsHovered(false),
|
|
792
779
|
children: [
|
|
793
780
|
/* @__PURE__ */ jsx(
|
|
794
781
|
"div",
|
|
795
782
|
{
|
|
796
783
|
"data-slot": "sidebar-gap",
|
|
797
784
|
className: cn(
|
|
798
|
-
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-
|
|
785
|
+
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear motion-reduce:transition-none",
|
|
799
786
|
"group-data-[collapsible=offcanvas]:w-0",
|
|
800
787
|
"group-data-[side=right]:rotate-180",
|
|
801
788
|
variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
|
|
@@ -806,11 +793,12 @@ function Sidebar({
|
|
|
806
793
|
"div",
|
|
807
794
|
{
|
|
808
795
|
"data-slot": "sidebar-container",
|
|
796
|
+
"data-side": side,
|
|
809
797
|
className: cn(
|
|
810
|
-
`fixed inset-y-0 z-10 hidden h-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
798
|
+
`fixed inset-y-0 z-10 hidden h-dvh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear
|
|
799
|
+
data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]
|
|
800
|
+
data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]
|
|
801
|
+
motion-reduce:transition-none md:flex`,
|
|
814
802
|
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
803
|
group-data-[side=right]:border-l`,
|
|
816
804
|
className
|
|
@@ -821,7 +809,7 @@ function Sidebar({
|
|
|
821
809
|
{
|
|
822
810
|
"data-sidebar": "sidebar",
|
|
823
811
|
"data-slot": "sidebar-inner",
|
|
824
|
-
className: "bg-sidebar group-data-[variant=floating]:
|
|
812
|
+
className: "flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg\n group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1\n group-data-[variant=floating]:ring-sidebar-border",
|
|
825
813
|
children
|
|
826
814
|
}
|
|
827
815
|
)
|
|
@@ -832,15 +820,17 @@ function Sidebar({
|
|
|
832
820
|
);
|
|
833
821
|
}
|
|
834
822
|
function SidebarTrigger({ className, onClick, ...props }) {
|
|
835
|
-
const { toggleSidebar } = useSidebar();
|
|
823
|
+
const { isMobile, open, openMobile, sidebarId, toggleSidebar } = useSidebar();
|
|
836
824
|
return /* @__PURE__ */ jsxs(
|
|
837
825
|
Button,
|
|
838
826
|
{
|
|
827
|
+
"aria-controls": sidebarId,
|
|
828
|
+
"aria-expanded": isMobile ? openMobile : open,
|
|
839
829
|
"data-sidebar": "trigger",
|
|
840
830
|
"data-slot": "sidebar-trigger",
|
|
841
831
|
variant: "ghost",
|
|
842
|
-
size: "icon",
|
|
843
|
-
className: cn(
|
|
832
|
+
size: "icon-sm",
|
|
833
|
+
className: cn(className),
|
|
844
834
|
onClick: (event) => {
|
|
845
835
|
onClick?.(event);
|
|
846
836
|
toggleSidebar();
|
|
@@ -853,14 +843,43 @@ function SidebarTrigger({ className, onClick, ...props }) {
|
|
|
853
843
|
}
|
|
854
844
|
);
|
|
855
845
|
}
|
|
846
|
+
function SidebarRail({ className, ...props }) {
|
|
847
|
+
const { toggleSidebar } = useSidebar();
|
|
848
|
+
return /* @__PURE__ */ jsx(
|
|
849
|
+
"button",
|
|
850
|
+
{
|
|
851
|
+
type: "button",
|
|
852
|
+
"data-sidebar": "rail",
|
|
853
|
+
"data-slot": "sidebar-rail",
|
|
854
|
+
"aria-label": "Toggle Sidebar",
|
|
855
|
+
tabIndex: -1,
|
|
856
|
+
onClick: toggleSidebar,
|
|
857
|
+
title: "Toggle Sidebar",
|
|
858
|
+
className: cn(
|
|
859
|
+
`absolute inset-y-0 z-20 hidden w-4 transition-[transform,background-color] duration-200 ease-linear group-data-[side=left]:-right-4
|
|
860
|
+
group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-px
|
|
861
|
+
hover:after:bg-sidebar-border motion-reduce:transition-none sm:flex ltr:-translate-x-1/2 rtl:translate-x-1/2`,
|
|
862
|
+
"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
|
|
863
|
+
`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize
|
|
864
|
+
[[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,
|
|
865
|
+
`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:start-full
|
|
866
|
+
hover:group-data-[collapsible=offcanvas]:bg-sidebar`,
|
|
867
|
+
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
868
|
+
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
869
|
+
className
|
|
870
|
+
),
|
|
871
|
+
...props
|
|
872
|
+
}
|
|
873
|
+
);
|
|
874
|
+
}
|
|
856
875
|
function SidebarInset({ className, ...props }) {
|
|
857
876
|
return /* @__PURE__ */ jsx(
|
|
858
877
|
"main",
|
|
859
878
|
{
|
|
860
879
|
"data-slot": "sidebar-inset",
|
|
861
880
|
className: cn(
|
|
862
|
-
|
|
863
|
-
|
|
881
|
+
`relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2
|
|
882
|
+
md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl
|
|
864
883
|
md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,
|
|
865
884
|
className
|
|
866
885
|
),
|
|
@@ -874,7 +893,7 @@ function SidebarInput({ className, ...props }) {
|
|
|
874
893
|
{
|
|
875
894
|
"data-slot": "sidebar-input",
|
|
876
895
|
"data-sidebar": "input",
|
|
877
|
-
className: cn("
|
|
896
|
+
className: cn("h-8 w-full bg-background shadow-none", className),
|
|
878
897
|
...props
|
|
879
898
|
}
|
|
880
899
|
);
|
|
@@ -907,7 +926,7 @@ function SidebarSeparator({ className, ...props }) {
|
|
|
907
926
|
{
|
|
908
927
|
"data-slot": "sidebar-separator",
|
|
909
928
|
"data-sidebar": "separator",
|
|
910
|
-
className: cn("
|
|
929
|
+
className: cn("mx-2 w-auto bg-sidebar-border", className),
|
|
911
930
|
...props
|
|
912
931
|
}
|
|
913
932
|
);
|
|
@@ -919,7 +938,7 @@ function SidebarContent({ className, ...props }) {
|
|
|
919
938
|
"data-slot": "sidebar-content",
|
|
920
939
|
"data-sidebar": "content",
|
|
921
940
|
className: cn(
|
|
922
|
-
"flex min-h-0 flex-1 flex-col gap-
|
|
941
|
+
"scrollbar-hide flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
923
942
|
className
|
|
924
943
|
),
|
|
925
944
|
...props
|
|
@@ -939,49 +958,56 @@ function SidebarGroup({ className, ...props }) {
|
|
|
939
958
|
}
|
|
940
959
|
function SidebarGroupLabel({
|
|
941
960
|
className,
|
|
942
|
-
|
|
961
|
+
render,
|
|
943
962
|
...props
|
|
944
963
|
}) {
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
964
|
+
return useRender({
|
|
965
|
+
defaultTagName: "div",
|
|
966
|
+
props: mergeProps$1(
|
|
967
|
+
{
|
|
968
|
+
className: cn(
|
|
969
|
+
`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70
|
|
970
|
+
ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear
|
|
971
|
+
group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2
|
|
972
|
+
motion-reduce:transition-none [&>svg]:size-4 [&>svg]:shrink-0`,
|
|
973
|
+
className
|
|
974
|
+
)
|
|
975
|
+
},
|
|
976
|
+
props
|
|
977
|
+
),
|
|
978
|
+
render,
|
|
979
|
+
state: {
|
|
980
|
+
slot: "sidebar-group-label",
|
|
981
|
+
sidebar: "group-label"
|
|
959
982
|
}
|
|
960
|
-
);
|
|
983
|
+
});
|
|
961
984
|
}
|
|
962
985
|
function SidebarGroupAction({
|
|
963
986
|
className,
|
|
964
|
-
|
|
987
|
+
render,
|
|
965
988
|
...props
|
|
966
989
|
}) {
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
990
|
+
return useRender({
|
|
991
|
+
defaultTagName: "button",
|
|
992
|
+
props: mergeProps$1(
|
|
993
|
+
{
|
|
994
|
+
className: cn(
|
|
995
|
+
`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0
|
|
996
|
+
text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform
|
|
997
|
+
group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent
|
|
998
|
+
hover:text-sidebar-accent-foreground focus-visible:ring-2 motion-reduce:transition-none md:after:hidden
|
|
999
|
+
[&>svg]:size-4 [&>svg]:shrink-0`,
|
|
1000
|
+
className
|
|
1001
|
+
)
|
|
1002
|
+
},
|
|
1003
|
+
props
|
|
1004
|
+
),
|
|
1005
|
+
render,
|
|
1006
|
+
state: {
|
|
1007
|
+
slot: "sidebar-group-action",
|
|
1008
|
+
sidebar: "group-action"
|
|
983
1009
|
}
|
|
984
|
-
);
|
|
1010
|
+
});
|
|
985
1011
|
}
|
|
986
1012
|
function SidebarGroupContent({ className, ...props }) {
|
|
987
1013
|
return /* @__PURE__ */ jsx(
|
|
@@ -1000,7 +1026,7 @@ function SidebarMenu({ className, ...props }) {
|
|
|
1000
1026
|
{
|
|
1001
1027
|
"data-slot": "sidebar-menu",
|
|
1002
1028
|
"data-sidebar": "menu",
|
|
1003
|
-
className: cn("flex w-full min-w-0 flex-col gap-
|
|
1029
|
+
className: cn("flex w-full min-w-0 flex-col gap-0", className),
|
|
1004
1030
|
...props
|
|
1005
1031
|
}
|
|
1006
1032
|
);
|
|
@@ -1017,12 +1043,20 @@ function SidebarMenuItem({ className, ...props }) {
|
|
|
1017
1043
|
);
|
|
1018
1044
|
}
|
|
1019
1045
|
var sidebarMenuButtonVariants = cva(
|
|
1020
|
-
|
|
1046
|
+
`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm
|
|
1047
|
+
ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8
|
|
1048
|
+
group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent
|
|
1049
|
+
hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent
|
|
1050
|
+
active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50
|
|
1051
|
+
aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent
|
|
1052
|
+
data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium
|
|
1053
|
+
data-active:text-sidebar-accent-foreground pointer-coarse:min-h-11 motion-reduce:transition-none [&_svg]:size-4 [&_svg]:shrink-0
|
|
1054
|
+
[&>span:last-child]:truncate`,
|
|
1021
1055
|
{
|
|
1022
1056
|
variants: {
|
|
1023
1057
|
variant: {
|
|
1024
1058
|
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
1025
|
-
outline: "bg-background shadow-[
|
|
1059
|
+
outline: "bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"
|
|
1026
1060
|
},
|
|
1027
1061
|
size: {
|
|
1028
1062
|
default: "h-8 text-sm",
|
|
@@ -1037,7 +1071,7 @@ var sidebarMenuButtonVariants = cva(
|
|
|
1037
1071
|
}
|
|
1038
1072
|
);
|
|
1039
1073
|
function SidebarMenuButton({
|
|
1040
|
-
|
|
1074
|
+
render,
|
|
1041
1075
|
isActive = false,
|
|
1042
1076
|
variant = "default",
|
|
1043
1077
|
size = "default",
|
|
@@ -1045,62 +1079,63 @@ function SidebarMenuButton({
|
|
|
1045
1079
|
className,
|
|
1046
1080
|
...props
|
|
1047
1081
|
}) {
|
|
1048
|
-
const Comp = asChild ? Slot : "button";
|
|
1049
1082
|
const { isMobile, state } = useSidebar();
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1083
|
+
const component = useRender({
|
|
1084
|
+
defaultTagName: "button",
|
|
1085
|
+
props: mergeProps$1(
|
|
1086
|
+
{
|
|
1087
|
+
className: cn(sidebarMenuButtonVariants({ variant, size }), className)
|
|
1088
|
+
},
|
|
1089
|
+
props
|
|
1090
|
+
),
|
|
1091
|
+
render: !tooltip ? render : /* @__PURE__ */ jsx(TooltipTrigger, { render }),
|
|
1092
|
+
state: {
|
|
1093
|
+
slot: "sidebar-menu-button",
|
|
1094
|
+
sidebar: "menu-button",
|
|
1095
|
+
size,
|
|
1096
|
+
active: isActive
|
|
1059
1097
|
}
|
|
1060
|
-
);
|
|
1098
|
+
});
|
|
1061
1099
|
if (!tooltip) {
|
|
1062
|
-
return
|
|
1063
|
-
}
|
|
1064
|
-
if (typeof tooltip === "string") {
|
|
1065
|
-
tooltip = {
|
|
1066
|
-
children: tooltip
|
|
1067
|
-
};
|
|
1100
|
+
return component;
|
|
1068
1101
|
}
|
|
1102
|
+
const tooltipProps = typeof tooltip === "string" ? { children: tooltip } : tooltip;
|
|
1069
1103
|
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
1070
|
-
|
|
1071
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", align: "center", hidden: state !== "collapsed" || isMobile, ...
|
|
1104
|
+
component,
|
|
1105
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", align: "center", hidden: state !== "collapsed" || isMobile, ...tooltipProps })
|
|
1072
1106
|
] });
|
|
1073
1107
|
}
|
|
1074
1108
|
function SidebarMenuAction({
|
|
1075
1109
|
className,
|
|
1076
|
-
|
|
1110
|
+
render,
|
|
1077
1111
|
showOnHover = false,
|
|
1078
1112
|
...props
|
|
1079
1113
|
}) {
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1114
|
+
return useRender({
|
|
1115
|
+
defaultTagName: "button",
|
|
1116
|
+
props: mergeProps$1(
|
|
1117
|
+
{
|
|
1118
|
+
className: cn(
|
|
1119
|
+
`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0
|
|
1120
|
+
text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform
|
|
1121
|
+
group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground
|
|
1122
|
+
peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5
|
|
1123
|
+
peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent
|
|
1124
|
+
hover:text-sidebar-accent-foreground focus-visible:ring-2 motion-reduce:transition-none md:after:hidden
|
|
1125
|
+
[&>svg]:size-4 [&>svg]:shrink-0`,
|
|
1126
|
+
showOnHover && `group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100
|
|
1127
|
+
peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,
|
|
1128
|
+
className
|
|
1129
|
+
)
|
|
1130
|
+
},
|
|
1131
|
+
props
|
|
1132
|
+
),
|
|
1133
|
+
render,
|
|
1134
|
+
state: {
|
|
1135
|
+
slot: "sidebar-menu-action",
|
|
1136
|
+
sidebar: "menu-action"
|
|
1102
1137
|
}
|
|
1103
|
-
);
|
|
1138
|
+
});
|
|
1104
1139
|
}
|
|
1105
1140
|
function SidebarMenuBadge({ className, ...props }) {
|
|
1106
1141
|
return /* @__PURE__ */ jsx(
|
|
@@ -1109,14 +1144,11 @@ function SidebarMenuBadge({ className, ...props }) {
|
|
|
1109
1144
|
"data-slot": "sidebar-menu-badge",
|
|
1110
1145
|
"data-sidebar": "menu-badge",
|
|
1111
1146
|
className: cn(
|
|
1112
|
-
`
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
peer-data-[
|
|
1116
|
-
|
|
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",
|
|
1147
|
+
`pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1
|
|
1148
|
+
text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden
|
|
1149
|
+
peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5
|
|
1150
|
+
peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1
|
|
1151
|
+
peer-data-active/menu-button:text-sidebar-accent-foreground`,
|
|
1120
1152
|
className
|
|
1121
1153
|
),
|
|
1122
1154
|
...props
|
|
@@ -1128,9 +1160,14 @@ function SidebarMenuSkeleton({
|
|
|
1128
1160
|
showIcon = false,
|
|
1129
1161
|
...props
|
|
1130
1162
|
}) {
|
|
1131
|
-
const
|
|
1132
|
-
|
|
1133
|
-
|
|
1163
|
+
const id = React4.useId();
|
|
1164
|
+
const width = React4.useMemo(() => {
|
|
1165
|
+
let hash = 0;
|
|
1166
|
+
for (const character of id) {
|
|
1167
|
+
hash = hash * 31 + character.charCodeAt(0) >>> 0;
|
|
1168
|
+
}
|
|
1169
|
+
return `${50 + hash % 40}%`;
|
|
1170
|
+
}, [id]);
|
|
1134
1171
|
return /* @__PURE__ */ jsxs(
|
|
1135
1172
|
"div",
|
|
1136
1173
|
{
|
|
@@ -1161,8 +1198,8 @@ function SidebarMenuSub({ className, ...props }) {
|
|
|
1161
1198
|
"data-slot": "sidebar-menu-sub",
|
|
1162
1199
|
"data-sidebar": "menu-sub",
|
|
1163
1200
|
className: cn(
|
|
1164
|
-
|
|
1165
|
-
|
|
1201
|
+
`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5
|
|
1202
|
+
group-data-[collapsible=icon]:hidden`,
|
|
1166
1203
|
className
|
|
1167
1204
|
),
|
|
1168
1205
|
...props
|
|
@@ -1181,37 +1218,39 @@ function SidebarMenuSubItem({ className, ...props }) {
|
|
|
1181
1218
|
);
|
|
1182
1219
|
}
|
|
1183
1220
|
function SidebarMenuSubButton({
|
|
1184
|
-
|
|
1221
|
+
render,
|
|
1185
1222
|
size = "md",
|
|
1186
1223
|
isActive = false,
|
|
1187
1224
|
className,
|
|
1188
1225
|
...props
|
|
1189
1226
|
}) {
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1227
|
+
return useRender({
|
|
1228
|
+
defaultTagName: "a",
|
|
1229
|
+
props: mergeProps$1(
|
|
1230
|
+
{
|
|
1231
|
+
className: cn(
|
|
1232
|
+
`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2
|
|
1233
|
+
text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden
|
|
1234
|
+
hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent
|
|
1235
|
+
active:text-sidebar-accent-foreground aria-disabled:pointer-events-none aria-disabled:opacity-50
|
|
1236
|
+
data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent
|
|
1237
|
+
data-active:text-sidebar-accent-foreground pointer-coarse:min-h-11 [&>span:last-child]:truncate [&>svg]:size-4
|
|
1238
|
+
[&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,
|
|
1239
|
+
className
|
|
1240
|
+
)
|
|
1241
|
+
},
|
|
1242
|
+
props
|
|
1243
|
+
),
|
|
1244
|
+
render,
|
|
1245
|
+
state: {
|
|
1246
|
+
slot: "sidebar-menu-sub-button",
|
|
1247
|
+
sidebar: "menu-sub-button",
|
|
1248
|
+
size,
|
|
1249
|
+
active: isActive
|
|
1211
1250
|
}
|
|
1212
|
-
);
|
|
1251
|
+
});
|
|
1213
1252
|
}
|
|
1214
1253
|
|
|
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 };
|
|
1254
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar };
|
|
1216
1255
|
//# sourceMappingURL=sidebar.js.map
|
|
1217
1256
|
//# sourceMappingURL=sidebar.js.map
|