@codefast/ui 0.3.9 → 0.3.10
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/CHANGELOG.md +11 -0
- package/dist/components/accordion.cjs +97 -1
- package/dist/components/accordion.d.ts +4 -4
- package/dist/components/accordion.js +51 -1
- package/dist/components/alert-dialog.cjs +155 -1
- package/dist/components/alert-dialog.d.ts +11 -11
- package/dist/components/alert-dialog.js +94 -1
- package/dist/components/alert.cjs +84 -1
- package/dist/components/alert.d.ts +5 -5
- package/dist/components/alert.js +41 -1
- package/dist/components/aspect-ratio.cjs +43 -1
- package/dist/components/aspect-ratio.d.ts +2 -2
- package/dist/components/aspect-ratio.js +9 -1
- package/dist/components/avatar.cjs +65 -1
- package/dist/components/avatar.d.ts +2 -2
- package/dist/components/avatar.js +25 -1
- package/dist/components/badge.cjs +66 -1
- package/dist/components/badge.d.ts +3 -3
- package/dist/components/badge.js +29 -1
- package/dist/components/breadcrumb.cjs +126 -1
- package/dist/components/breadcrumb.d.ts +8 -8
- package/dist/components/breadcrumb.js +74 -1
- package/dist/components/button-group.cjs +86 -1
- package/dist/components/button-group.d.ts +5 -5
- package/dist/components/button-group.js +43 -1
- package/dist/components/button.cjs +92 -1
- package/dist/components/button.d.ts +6 -6
- package/dist/components/button.js +55 -1
- package/dist/components/calendar.cjs +150 -1
- package/dist/components/calendar.d.ts +12 -19
- package/dist/components/calendar.js +113 -1
- package/dist/components/card.cjs +105 -1
- package/dist/components/card.d.ts +8 -8
- package/dist/components/card.js +53 -1
- package/dist/components/carousel.cjs +210 -1
- package/dist/components/carousel.d.ts +10 -10
- package/dist/components/carousel.js +151 -1
- package/dist/components/chart.cjs +250 -3
- package/dist/components/chart.d.ts +9 -9
- package/dist/components/chart.js +198 -3
- package/dist/components/checkbox-cards.cjs +69 -1
- package/dist/components/checkbox-cards.d.ts +2 -2
- package/dist/components/checkbox-cards.js +32 -1
- package/dist/components/checkbox-group.cjs +63 -1
- package/dist/components/checkbox-group.d.ts +2 -2
- package/dist/components/checkbox-group.js +26 -1
- package/dist/components/checkbox.cjs +53 -1
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.js +19 -1
- package/dist/components/collapsible.cjs +61 -1
- package/dist/components/collapsible.d.ts +2 -2
- package/dist/components/collapsible.js +21 -1
- package/dist/components/command.cjs +167 -1
- package/dist/components/command.d.ts +4 -4
- package/dist/components/command.js +106 -1
- package/dist/components/context-menu.cjs +218 -1
- package/dist/components/context-menu.d.ts +4 -4
- package/dist/components/context-menu.js +142 -1
- package/dist/components/dialog.cjs +164 -1
- package/dist/components/dialog.d.ts +10 -10
- package/dist/components/dialog.js +106 -1
- package/dist/components/drawer.cjs +143 -1
- package/dist/components/drawer.d.ts +9 -9
- package/dist/components/drawer.js +85 -1
- package/dist/components/dropdown-menu.cjs +221 -1
- package/dist/components/dropdown-menu.d.ts +4 -4
- package/dist/components/dropdown-menu.js +145 -1
- package/dist/components/empty.cjs +113 -1
- package/dist/components/empty.d.ts +9 -9
- package/dist/components/empty.js +61 -1
- package/dist/components/field.cjs +193 -1
- package/dist/components/field.d.ts +14 -14
- package/dist/components/field.js +129 -1
- package/dist/components/form.cjs +151 -1
- package/dist/components/form.d.ts +10 -10
- package/dist/components/form.js +96 -1
- package/dist/components/hover-card.cjs +77 -1
- package/dist/components/hover-card.d.ts +2 -2
- package/dist/components/hover-card.js +34 -1
- package/dist/components/input-group.cjs +155 -1
- package/dist/components/input-group.d.ts +15 -15
- package/dist/components/input-group.js +97 -1
- package/dist/components/input-number.cjs +98 -1
- package/dist/components/input-number.d.ts +2 -2
- package/dist/components/input-number.js +64 -1
- package/dist/components/input-otp.cjs +101 -1
- package/dist/components/input-otp.d.ts +6 -6
- package/dist/components/input-otp.js +49 -1
- package/dist/components/input-password.cjs +71 -1
- package/dist/components/input-password.d.ts +3 -3
- package/dist/components/input-password.js +37 -1
- package/dist/components/input-search.cjs +80 -1
- package/dist/components/input-search.d.ts +3 -3
- package/dist/components/input-search.js +46 -1
- package/dist/components/input.cjs +45 -1
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +11 -1
- package/dist/components/item.cjs +186 -1
- package/dist/components/item.d.ts +12 -12
- package/dist/components/item.js +119 -1
- package/dist/components/kbd.cjs +54 -1
- package/dist/components/kbd.d.ts +3 -3
- package/dist/components/kbd.js +17 -1
- package/dist/components/label.cjs +45 -1
- package/dist/components/label.d.ts +2 -2
- package/dist/components/label.js +11 -1
- package/dist/components/menubar.cjs +232 -1
- package/dist/components/menubar.d.ts +4 -4
- package/dist/components/menubar.js +153 -1
- package/dist/components/native-select.cjs +75 -1
- package/dist/components/native-select.d.ts +4 -4
- package/dist/components/native-select.js +35 -1
- package/dist/components/navigation-menu.cjs +146 -2
- package/dist/components/navigation-menu.d.ts +2 -2
- package/dist/components/navigation-menu.js +94 -2
- package/dist/components/pagination.cjs +138 -1
- package/dist/components/pagination.d.ts +10 -10
- package/dist/components/pagination.js +86 -1
- package/dist/components/popover.cjs +86 -1
- package/dist/components/popover.d.ts +3 -3
- package/dist/components/popover.js +40 -1
- package/dist/components/progress-circle.cjs +184 -1
- package/dist/components/progress-circle.d.ts +5 -5
- package/dist/components/progress-circle.js +147 -1
- package/dist/components/progress.cjs +52 -1
- package/dist/components/progress.d.ts +2 -2
- package/dist/components/progress.js +18 -1
- package/dist/components/radio-cards.cjs +66 -1
- package/dist/components/radio-cards.d.ts +2 -2
- package/dist/components/radio-cards.js +29 -1
- package/dist/components/radio-group.cjs +59 -1
- package/dist/components/radio-group.d.ts +2 -2
- package/dist/components/radio-group.js +22 -1
- package/dist/components/radio.cjs +47 -1
- package/dist/components/radio.d.ts +2 -2
- package/dist/components/radio.js +13 -1
- package/dist/components/resizable.cjs +71 -1
- package/dist/components/resizable.d.ts +8 -8
- package/dist/components/resizable.js +31 -1
- package/dist/components/scroll-area.cjs +140 -1
- package/dist/components/scroll-area.d.ts +5 -5
- package/dist/components/scroll-area.js +100 -1
- package/dist/components/select.cjs +180 -1
- package/dist/components/select.d.ts +5 -5
- package/dist/components/select.js +119 -1
- package/dist/components/separator.cjs +82 -1
- package/dist/components/separator.d.ts +5 -5
- package/dist/components/separator.js +42 -1
- package/dist/components/sheet.cjs +184 -1
- package/dist/components/sheet.d.ts +9 -9
- package/dist/components/sheet.js +123 -1
- package/dist/components/sidebar.cjs +506 -1
- package/dist/components/sidebar.d.ts +31 -31
- package/dist/components/sidebar.js +400 -1
- package/dist/components/skeleton.cjs +44 -1
- package/dist/components/skeleton.d.ts +2 -2
- package/dist/components/skeleton.js +10 -1
- package/dist/components/slider.cjs +79 -1
- package/dist/components/slider.d.ts +2 -2
- package/dist/components/slider.js +45 -1
- package/dist/components/sonner.cjs +57 -1
- package/dist/components/sonner.d.ts +3 -3
- package/dist/components/sonner.js +17 -1
- package/dist/components/spinner.cjs +75 -1
- package/dist/components/spinner.d.ts +2 -2
- package/dist/components/spinner.js +41 -1
- package/dist/components/switch.cjs +49 -1
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/switch.js +15 -1
- package/dist/components/table.cjs +118 -1
- package/dist/components/table.d.ts +9 -9
- package/dist/components/table.js +63 -1
- package/dist/components/tabs.cjs +75 -1
- package/dist/components/tabs.d.ts +3 -3
- package/dist/components/tabs.js +32 -1
- package/dist/components/textarea.cjs +44 -1
- package/dist/components/textarea.d.ts +2 -2
- package/dist/components/textarea.js +10 -1
- package/dist/components/toggle-group.cjs +90 -1
- package/dist/components/toggle-group.d.ts +10 -12
- package/dist/components/toggle-group.js +53 -1
- package/dist/components/toggle.cjs +71 -1
- package/dist/components/toggle.d.ts +10 -12
- package/dist/components/toggle.js +34 -1
- package/dist/components/tooltip.cjs +90 -1
- package/dist/components/tooltip.d.ts +3 -3
- package/dist/components/tooltip.js +44 -1
- package/dist/css/amber.css +95 -1
- package/dist/css/blue.css +95 -1
- package/dist/css/cyan.css +95 -1
- package/dist/css/emerald.css +95 -1
- package/dist/css/fuchsia.css +95 -1
- package/dist/css/gray.css +95 -1
- package/dist/css/green.css +95 -1
- package/dist/css/indigo.css +95 -1
- package/dist/css/lime.css +95 -1
- package/dist/css/neutral.css +95 -1
- package/dist/css/orange.css +95 -1
- package/dist/css/pink.css +95 -1
- package/dist/css/preset.css +118 -1
- package/dist/css/purple.css +95 -1
- package/dist/css/red.css +95 -1
- package/dist/css/rose.css +95 -1
- package/dist/css/sky.css +95 -1
- package/dist/css/slate.css +95 -1
- package/dist/css/stone.css +95 -1
- package/dist/css/style.css +3 -1
- package/dist/css/teal.css +95 -1
- package/dist/css/violet.css +95 -1
- package/dist/css/yellow.css +95 -1
- package/dist/css/zinc.css +95 -1
- package/dist/hooks/use-animated-value.cjs +74 -1
- package/dist/hooks/use-animated-value.d.ts +9 -10
- package/dist/hooks/use-animated-value.js +40 -1
- package/dist/hooks/use-copy-to-clipboard.cjs +57 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +18 -1
- package/dist/hooks/use-copy-to-clipboard.js +23 -1
- package/dist/hooks/use-is-mobile.cjs +39 -1
- package/dist/hooks/use-is-mobile.d.ts +15 -6
- package/dist/hooks/use-is-mobile.js +5 -1
- package/dist/hooks/use-media-query.cjs +56 -1
- package/dist/hooks/use-media-query.d.ts +11 -3
- package/dist/hooks/use-media-query.js +22 -1
- package/dist/hooks/use-mutation-observer.cjs +56 -1
- package/dist/hooks/use-mutation-observer.d.ts +8 -12
- package/dist/hooks/use-mutation-observer.js +22 -1
- package/dist/hooks/use-pagination.cjs +92 -1
- package/dist/hooks/use-pagination.d.ts +12 -10
- package/dist/hooks/use-pagination.js +55 -1
- package/dist/index.cjs +1081 -1
- package/dist/index.d.ts +130 -131
- package/dist/index.js +69 -1
- package/dist/primitives/checkbox-group.cjs +151 -1
- package/dist/primitives/checkbox-group.d.ts +11 -11
- package/dist/primitives/checkbox-group.js +99 -1
- package/dist/primitives/input-number.cjs +439 -1
- package/dist/primitives/input-number.d.ts +8 -8
- package/dist/primitives/input-number.js +381 -1
- package/dist/primitives/input.cjs +99 -1
- package/dist/primitives/input.d.ts +4 -4
- package/dist/primitives/input.js +53 -1
- package/dist/primitives/progress-circle.cjs +198 -1
- package/dist/primitives/progress-circle.d.ts +7 -7
- package/dist/primitives/progress-circle.js +128 -1
- package/package.json +385 -38
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import { Button } from
|
|
4
|
-
import { Input } from
|
|
5
|
-
import { Separator } from
|
|
6
|
-
import { TooltipContent } from
|
|
1
|
+
import type { VariantProps } from '@codefast/tailwind-variants';
|
|
2
|
+
import type { ComponentProps, Dispatch, JSX, SetStateAction } from 'react';
|
|
3
|
+
import { Button } from './button';
|
|
4
|
+
import { Input } from './input';
|
|
5
|
+
import { Separator } from './separator';
|
|
6
|
+
import { TooltipContent } from './tooltip';
|
|
7
7
|
declare const sidebarMenuButtonVariants: import("@codefast/tailwind-variants").VariantFunctionType<{
|
|
8
8
|
size: {
|
|
9
9
|
sm: string;
|
|
@@ -21,79 +21,79 @@ interface SidebarContextValue {
|
|
|
21
21
|
openMobile: boolean;
|
|
22
22
|
setOpen: (open: boolean) => void;
|
|
23
23
|
setOpenMobile: Dispatch<SetStateAction<boolean>>;
|
|
24
|
-
state:
|
|
24
|
+
state: 'collapsed' | 'expanded';
|
|
25
25
|
toggleSidebar: () => void;
|
|
26
26
|
}
|
|
27
27
|
declare const useSidebar: (consumerName: string) => SidebarContextValue;
|
|
28
|
-
interface SidebarProviderProps extends ComponentProps<
|
|
28
|
+
interface SidebarProviderProps extends ComponentProps<'div'> {
|
|
29
29
|
defaultOpen?: boolean;
|
|
30
30
|
onOpenChange?: (open: boolean) => void;
|
|
31
31
|
open?: boolean;
|
|
32
32
|
}
|
|
33
33
|
declare function SidebarProvider({ children, className, defaultOpen, onOpenChange: setOpenProperty, open: openProperty, style, ...props }: SidebarProviderProps): JSX.Element;
|
|
34
|
-
interface SidebarProps extends ComponentProps<
|
|
35
|
-
collapsible?:
|
|
36
|
-
side?:
|
|
37
|
-
variant?:
|
|
34
|
+
interface SidebarProps extends ComponentProps<'div'> {
|
|
35
|
+
collapsible?: 'icon' | 'none' | 'offcanvas';
|
|
36
|
+
side?: 'left' | 'right';
|
|
37
|
+
variant?: 'floating' | 'inset' | 'sidebar';
|
|
38
38
|
}
|
|
39
39
|
declare function Sidebar({ children, className, collapsible, side, variant, ...props }: SidebarProps): JSX.Element;
|
|
40
40
|
type SidebarTriggerProps = ComponentProps<typeof Button>;
|
|
41
41
|
declare function SidebarTrigger({ className, onClick, ...props }: SidebarTriggerProps): JSX.Element;
|
|
42
|
-
type SidebarRailProps = ComponentProps<
|
|
42
|
+
type SidebarRailProps = ComponentProps<'button'>;
|
|
43
43
|
declare function SidebarRail({ className, ...props }: SidebarRailProps): JSX.Element;
|
|
44
|
-
type SidebarInsetProps = ComponentProps<
|
|
44
|
+
type SidebarInsetProps = ComponentProps<'main'>;
|
|
45
45
|
declare function SidebarInset({ className, ...props }: SidebarInsetProps): JSX.Element;
|
|
46
46
|
type SidebarInputProps = ComponentProps<typeof Input>;
|
|
47
47
|
declare function SidebarInput({ className, ...props }: SidebarInputProps): JSX.Element;
|
|
48
|
-
type SidebarHeaderProps = ComponentProps<
|
|
48
|
+
type SidebarHeaderProps = ComponentProps<'div'>;
|
|
49
49
|
declare function SidebarHeader({ className, ...props }: SidebarHeaderProps): JSX.Element;
|
|
50
|
-
type SidebarFooterProps = ComponentProps<
|
|
50
|
+
type SidebarFooterProps = ComponentProps<'div'>;
|
|
51
51
|
declare function SidebarFooter({ className, ...props }: SidebarFooterProps): JSX.Element;
|
|
52
52
|
type SidebarSeparatorProps = ComponentProps<typeof Separator>;
|
|
53
53
|
declare function SidebarSeparator({ className, ...props }: SidebarSeparatorProps): JSX.Element;
|
|
54
|
-
type SidebarContentProps = ComponentProps<
|
|
54
|
+
type SidebarContentProps = ComponentProps<'div'>;
|
|
55
55
|
declare function SidebarContent({ className, ...props }: SidebarContentProps): JSX.Element;
|
|
56
|
-
type SidebarGroupProps = ComponentProps<
|
|
56
|
+
type SidebarGroupProps = ComponentProps<'div'>;
|
|
57
57
|
declare function SidebarGroup({ className, ...props }: SidebarGroupProps): JSX.Element;
|
|
58
|
-
interface SidebarGroupLabelProps extends ComponentProps<
|
|
58
|
+
interface SidebarGroupLabelProps extends ComponentProps<'div'> {
|
|
59
59
|
asChild?: boolean;
|
|
60
60
|
}
|
|
61
61
|
declare function SidebarGroupLabel({ asChild, className, ...props }: SidebarGroupLabelProps): JSX.Element;
|
|
62
|
-
interface SidebarGroupActionProps extends ComponentProps<
|
|
62
|
+
interface SidebarGroupActionProps extends ComponentProps<'button'> {
|
|
63
63
|
asChild?: boolean;
|
|
64
64
|
}
|
|
65
65
|
declare function SidebarGroupAction({ asChild, className, ...props }: SidebarGroupActionProps): JSX.Element;
|
|
66
|
-
type SidebarGroupContentProps = ComponentProps<
|
|
66
|
+
type SidebarGroupContentProps = ComponentProps<'div'>;
|
|
67
67
|
declare function SidebarGroupContent({ className, ...props }: SidebarGroupContentProps): JSX.Element;
|
|
68
|
-
type SidebarMenuProps = ComponentProps<
|
|
68
|
+
type SidebarMenuProps = ComponentProps<'ul'>;
|
|
69
69
|
declare function SidebarMenu({ className, ...props }: SidebarMenuProps): JSX.Element;
|
|
70
|
-
type SidebarMenuItemProps = ComponentProps<
|
|
70
|
+
type SidebarMenuItemProps = ComponentProps<'li'>;
|
|
71
71
|
declare function SidebarMenuItem({ className, ...props }: SidebarMenuItemProps): JSX.Element;
|
|
72
|
-
interface SidebarMenuButtonProps extends ComponentProps<
|
|
72
|
+
interface SidebarMenuButtonProps extends ComponentProps<'button'>, VariantProps<typeof sidebarMenuButtonVariants> {
|
|
73
73
|
asChild?: boolean;
|
|
74
74
|
isActive?: boolean;
|
|
75
75
|
tooltip?: ComponentProps<typeof TooltipContent> | string;
|
|
76
76
|
}
|
|
77
77
|
declare function SidebarMenuButton({ asChild, className, isActive, size, tooltip, variant, ...props }: SidebarMenuButtonProps): JSX.Element;
|
|
78
|
-
interface SidebarMenuActionProps extends ComponentProps<
|
|
78
|
+
interface SidebarMenuActionProps extends ComponentProps<'button'> {
|
|
79
79
|
asChild?: boolean;
|
|
80
80
|
showOnHover?: boolean;
|
|
81
81
|
}
|
|
82
82
|
declare function SidebarMenuAction({ asChild, className, showOnHover, ...props }: SidebarMenuActionProps): JSX.Element;
|
|
83
|
-
type SidebarMenuBadgeProps = ComponentProps<
|
|
83
|
+
type SidebarMenuBadgeProps = ComponentProps<'div'>;
|
|
84
84
|
declare function SidebarMenuBadge({ className, ...props }: SidebarMenuBadgeProps): JSX.Element;
|
|
85
|
-
interface SidebarMenuSkeletonProps extends ComponentProps<
|
|
85
|
+
interface SidebarMenuSkeletonProps extends ComponentProps<'div'> {
|
|
86
86
|
showIcon?: boolean;
|
|
87
87
|
}
|
|
88
88
|
declare function SidebarMenuSkeleton({ className, showIcon, ...props }: SidebarMenuSkeletonProps): JSX.Element;
|
|
89
|
-
type SidebarMenuSubProps = ComponentProps<
|
|
89
|
+
type SidebarMenuSubProps = ComponentProps<'ul'>;
|
|
90
90
|
declare function SidebarMenuSub({ className, ...props }: SidebarMenuSubProps): JSX.Element;
|
|
91
|
-
type SidebarMenuSubItemProps = ComponentProps<
|
|
91
|
+
type SidebarMenuSubItemProps = ComponentProps<'li'>;
|
|
92
92
|
declare function SidebarMenuSubItem({ className, ...props }: SidebarMenuSubItemProps): JSX.Element;
|
|
93
|
-
interface SidebarMenuSubButtonProps extends ComponentProps<
|
|
93
|
+
interface SidebarMenuSubButtonProps extends ComponentProps<'a'> {
|
|
94
94
|
asChild?: boolean;
|
|
95
95
|
isActive?: boolean;
|
|
96
|
-
size?:
|
|
96
|
+
size?: 'md' | 'sm';
|
|
97
97
|
}
|
|
98
98
|
declare function SidebarMenuSubButton({ asChild, className, isActive, size, ...props }: SidebarMenuSubButtonProps): JSX.Element;
|
|
99
99
|
export { sidebarMenuButtonVariants };
|
|
@@ -1,2 +1,401 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{PanelLeftIcon as t}from"lucide-react";import{useCallback as r,useEffect as i,useState as d}from"react";import{Button as n}from"./button.js";import{Input as s}from"./input.js";import{Separator as o}from"./separator.js";import{Sheet as l,SheetContent as u,SheetDescription as c,SheetHeader as b,SheetTitle as p}from"./sheet.js";import{Skeleton as f}from"./skeleton.js";import{Tooltip as m,TooltipContent as g,TooltipProvider as h,TooltipTrigger as v}from"./tooltip.js";import{useIsMobile as x}from"../hooks/use-is-mobile.js";import{cn as w,tv as S}from"@codefast/tailwind-variants";import{createContext as N}from"@radix-ui/react-context";import{Slot as y}from"@radix-ui/react-slot";let k=S({base:"peer/menu-button outline-hidden ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground group-has-data-[sidebar=menu-action]/menu-item:pr-8 data-[active=true]:bg-sidebar-accent 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]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-3 flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm transition-[width,height,padding] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:font-medium [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",defaultVariants:{size:"md",variant:"default"},variants:{size:{sm:"h-7 text-xs",md:"h-8 text-sm",lg:"group-data-[collapsible=icon]:p-0! h-12 text-sm"},variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"}}}),[z,M]=N("SidebarProvider");function _({children:a,className:t,defaultOpen:n=!0,onOpenChange:s,open:o,style:l,...u}){let c=x(),[b,p]=d(!1),[f,m]=d(n),g=o??f,v=r(e=>{let a="function"==typeof e?e(g):e;s?s(a):m(a),document.cookie=`sidebar_state=${a.toString()}; path=/; max-age=604800`},[s,g]),S=r(()=>{c?p(e=>!e):v(e=>!e)},[c,v]);i(()=>{let e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),S())};return globalThis.addEventListener("keydown",e),()=>{globalThis.removeEventListener("keydown",e)}},[S]);let N=g?"expanded":"collapsed";return e(z,{isMobile:c,open:g,openMobile:b,setOpen:v,setOpenMobile:p,state:N,toggleSidebar:S,children:e(h,{delayDuration:0,children:e("div",{className:w("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",t),"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"16rem","--sidebar-width-icon":"3.0625rem",...l},...u,children:a})})})}function j({children:t,className:r,collapsible:i="offcanvas",side:d="left",variant:n="sidebar",...s}){let{isMobile:o,openMobile:f,setOpenMobile:m,state:g}=M("Sidebar");return"none"===i?e("div",{className:w("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",r),"data-slot":"sidebar",...s,children:t}):o?e(l,{open:f,onOpenChange:m,...s,children:a(u,{className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden","data-mobile":"true","data-sidebar":"sidebar","data-slot":"sidebar",side:d,style:{"--sidebar-width":"18rem"},children:[a(b,{className:"sr-only",children:[e(p,{children:"Sidebar"}),e(c,{children:"Displays the mobile sidebar."})]}),e("div",{className:"flex h-full w-full flex-col",children:t})]})}):a("div",{className:w("text-sidebar-foreground group peer hidden md:block",r),"data-collapsible":"collapsed"===g?i:"","data-side":d,"data-slot":"sidebar","data-state":g,"data-variant":n,children:[e("div",{className:w("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear group-data-[collapsible=offcanvas]:w-0 group-data-[side=right]:rotate-180","floating"===n||"inset"===n?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)"),"data-slot":"sidebar-gap"}),e("div",{className:w("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex","left"===d?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===n||"inset"===n?"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 group-data-[side=right]:border-l",r),"data-slot":"sidebar-container",...s,children:e("div",{className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm","data-sidebar":"sidebar","data-slot":"sidebar-inner",children:t})})]})}function C({className:r,onClick:i,...d}){let{toggleSidebar:s}=M("SidebarTrigger");return a(n,{className:w("size-7",r),"data-sidebar":"trigger","data-slot":"sidebar-trigger",size:"icon",variant:"ghost",onClick:e=>{i?.(e),s()},...d,children:[e(t,{}),e("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function T({className:a,...t}){let{toggleSidebar:r}=M("SidebarRail");return e("button",{className:w("hover:after:bg-sidebar-border hover:group-data-[collapsible=offcanvas]:bg-sidebar absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[collapsible=offcanvas]:translate-x-0 group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[collapsible=offcanvas]:after:left-full in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize sm:flex [[data-side=left][data-collapsible=offcanvas]_&]:-right-2 [[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-collapsible=offcanvas]_&]:-left-2 [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",a),"data-sidebar":"rail","data-slot":"sidebar-rail",title:"Toggle Sidebar",type:"button",onClick:r,...t})}function B({className:a,...t}){return e("main",{className:w("bg-background relative flex w-full min-w-0 flex-1 flex-col md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",a),"data-slot":"sidebar-inset",...t})}function G({className:a,...t}){return e(s,{className:w("bg-background h-8 w-full shadow-none",a),"data-sidebar":"input","data-slot":"sidebar-input",...t})}function I({className:a,...t}){return e("div",{className:w("flex flex-col gap-2 p-2",a),"data-sidebar":"header","data-slot":"sidebar-header",...t})}function O({className:a,...t}){return e("div",{className:w("flex flex-col gap-2 p-2",a),"data-sidebar":"footer","data-slot":"sidebar-footer",...t})}function D({className:a,...t}){return e(o,{className:w("bg-sidebar-border mx-2 w-auto",a),"data-sidebar":"separator","data-slot":"sidebar-separator",...t})}function L({className:a,...t}){return e("div",{className:w("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",a),"data-sidebar":"content","data-slot":"sidebar-content",...t})}function q({className:a,...t}){return e("div",{className:w("relative flex w-full min-w-0 flex-col p-2",a),"data-sidebar":"group","data-slot":"sidebar-group",...t})}function A({asChild:a=!1,className:t,...r}){return e(a?y:"div",{className:w("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center truncate rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-3 [&>svg]:size-4 [&>svg]:shrink-0",t),"data-sidebar":"group-label","data-slot":"sidebar-group-label",...r})}function E({asChild:a=!1,className:t,...r}){return e(a?y:"button",{className:w("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 focus-visible:ring-3 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",t),"data-sidebar":"group-action","data-slot":"sidebar-group-action",...r})}function K({className:a,...t}){return e("div",{className:w("w-full text-sm",a),"data-sidebar":"group-content","data-slot":"sidebar-group-content",...t})}function P({className:a,...t}){return e("ul",{className:w("flex w-full min-w-0 flex-col gap-1",a),"data-sidebar":"menu","data-slot":"sidebar-menu",...t})}function R({className:a,...t}){return e("li",{className:w("group/menu-item relative",a),"data-sidebar":"menu-item","data-slot":"sidebar-menu-item",...t})}function V({asChild:t=!1,className:r,isActive:i=!1,size:d="md",tooltip:n,variant:s="default",...o}){let{isMobile:l,state:u}=M("SidebarMenuButton"),c=e(t?y:"button",{className:w(k({size:d,variant:s}),r),"data-active":i,"data-sidebar":"menu-button","data-size":d,"data-slot":"sidebar-menu-button",...o});return n?("string"==typeof n&&(n={children:n}),a(m,{children:[e(v,{asChild:!0,children:c}),e(g,{align:"center",hidden:"collapsed"!==u||l,side:"right",...n})]})):c}function $({asChild:a=!1,className:t,showOnHover:r=!1,...i}){return e(a?y:"button",{className:w("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 focus-visible:ring-3 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",r&&"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",t),"data-sidebar":"menu-action","data-slot":"sidebar-menu-action",...i})}function F({className:a,...t}){return e("div",{className:w("text-sidebar-foreground peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none group-data-[collapsible=icon]:hidden peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1",a),"data-sidebar":"menu-badge","data-slot":"sidebar-menu-badge",...t})}function H({className:t,showIcon:r=!1,...i}){let[n]=d(()=>`${String(Math.floor(40*Math.random())+50)}%`);return a("div",{className:w("flex h-8 items-center gap-2 rounded-md px-2",t),"data-sidebar":"menu-skeleton","data-slot":"sidebar-menu-skeleton",...i,children:[r?e(f,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}):null,e(f,{className:"h-4 max-w-(--skeleton-width) flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":n}})]})}function J({className:a,...t}){return e("ul",{className:w("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",a),"data-sidebar":"menu-sub","data-slot":"sidebar-menu-sub",...t})}function Q({className:a,...t}){return e("li",{className:w("group/menu-sub-item relative",a),"data-sidebar":"menu-sub-item","data-slot":"sidebar-menu-sub-item",...t})}function U({asChild:a=!1,className:t,isActive:r=!1,size:i="md",...d}){return e(a?y:"a",{className:w("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-3 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0","sm"===i&&"text-xs","md"===i&&"text-sm","group-data-[collapsible=icon]:hidden",t),"data-active":r,"data-sidebar":"menu-sub-button","data-size":i,"data-slot":"sidebar-menu-sub-button",...d})}export{j as Sidebar,L as SidebarContent,O as SidebarFooter,q as SidebarGroup,E as SidebarGroupAction,K as SidebarGroupContent,A as SidebarGroupLabel,I as SidebarHeader,G as SidebarInput,B as SidebarInset,P as SidebarMenu,$ as SidebarMenuAction,F as SidebarMenuBadge,V as SidebarMenuButton,R as SidebarMenuItem,H as SidebarMenuSkeleton,J as SidebarMenuSub,U as SidebarMenuSubButton,Q as SidebarMenuSubItem,_ as SidebarProvider,T as SidebarRail,D as SidebarSeparator,C as SidebarTrigger,k as sidebarMenuButtonVariants,M as useSidebar};
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn, tv } from "@codefast/tailwind-variants";
|
|
4
|
+
import { createContext } from "@radix-ui/react-context";
|
|
5
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
6
|
+
import { PanelLeftIcon } from "lucide-react";
|
|
7
|
+
import { useCallback, useEffect, useState } from "react";
|
|
8
|
+
import { Button } from "./button.js";
|
|
9
|
+
import { Input } from "./input.js";
|
|
10
|
+
import { Separator } from "./separator.js";
|
|
11
|
+
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "./sheet.js";
|
|
12
|
+
import { Skeleton } from "./skeleton.js";
|
|
13
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
|
|
14
|
+
import { useIsMobile } from "../hooks/use-is-mobile.js";
|
|
15
|
+
const sidebarMenuButtonVariants = tv({
|
|
16
|
+
base: 'peer/menu-button outline-hidden ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground group-has-data-[sidebar=menu-action]/menu-item:pr-8 data-[active=true]:bg-sidebar-accent 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]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-3 flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm transition-[width,height,padding] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:font-medium [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
size: 'md',
|
|
19
|
+
variant: 'default'
|
|
20
|
+
},
|
|
21
|
+
variants: {
|
|
22
|
+
size: {
|
|
23
|
+
sm: 'h-7 text-xs',
|
|
24
|
+
md: 'h-8 text-sm',
|
|
25
|
+
lg: 'group-data-[collapsible=icon]:p-0! h-12 text-sm'
|
|
26
|
+
},
|
|
27
|
+
variant: {
|
|
28
|
+
default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
29
|
+
outline: 'bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const SIDEBAR_COOKIE_NAME = 'sidebar_state';
|
|
34
|
+
const SIDEBAR_COOKIE_MAX_AGE = 604800;
|
|
35
|
+
const SIDEBAR_WIDTH = '16rem';
|
|
36
|
+
const SIDEBAR_WIDTH_MOBILE = '18rem';
|
|
37
|
+
const SIDEBAR_WIDTH_ICON = '3.0625rem';
|
|
38
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
|
39
|
+
const SIDEBAR_PROVIDER_NAME = 'SidebarProvider';
|
|
40
|
+
const [SidebarContextProvider, useSidebar] = createContext(SIDEBAR_PROVIDER_NAME);
|
|
41
|
+
function SidebarProvider({ children, className, defaultOpen = true, onOpenChange: setOpenProperty, open: openProperty, style, ...props }) {
|
|
42
|
+
const isMobile = useIsMobile();
|
|
43
|
+
const [openMobile, setOpenMobile] = useState(false);
|
|
44
|
+
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
45
|
+
const open = openProperty ?? isOpen;
|
|
46
|
+
const setOpen = useCallback((value)=>{
|
|
47
|
+
const openState = 'function' == typeof value ? value(open) : value;
|
|
48
|
+
if (setOpenProperty) setOpenProperty(openState);
|
|
49
|
+
else setIsOpen(openState);
|
|
50
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState.toString()}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE.toString()}`;
|
|
51
|
+
}, [
|
|
52
|
+
setOpenProperty,
|
|
53
|
+
open
|
|
54
|
+
]);
|
|
55
|
+
const toggleSidebar = useCallback(()=>{
|
|
56
|
+
if (isMobile) setOpenMobile((currentValue)=>!currentValue);
|
|
57
|
+
else setOpen((currentValue)=>!currentValue);
|
|
58
|
+
}, [
|
|
59
|
+
isMobile,
|
|
60
|
+
setOpen
|
|
61
|
+
]);
|
|
62
|
+
useEffect(()=>{
|
|
63
|
+
const handleKeyDown = (event)=>{
|
|
64
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
toggleSidebar();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
70
|
+
return ()=>{
|
|
71
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
72
|
+
};
|
|
73
|
+
}, [
|
|
74
|
+
toggleSidebar
|
|
75
|
+
]);
|
|
76
|
+
const state = open ? 'expanded' : 'collapsed';
|
|
77
|
+
return /*#__PURE__*/ jsx(SidebarContextProvider, {
|
|
78
|
+
isMobile: isMobile,
|
|
79
|
+
open: open,
|
|
80
|
+
openMobile: openMobile,
|
|
81
|
+
setOpen: setOpen,
|
|
82
|
+
setOpenMobile: setOpenMobile,
|
|
83
|
+
state: state,
|
|
84
|
+
toggleSidebar: toggleSidebar,
|
|
85
|
+
children: /*#__PURE__*/ jsx(TooltipProvider, {
|
|
86
|
+
delayDuration: 0,
|
|
87
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
88
|
+
className: cn('group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full', className),
|
|
89
|
+
"data-slot": "sidebar-wrapper",
|
|
90
|
+
style: {
|
|
91
|
+
'--sidebar-width': SIDEBAR_WIDTH,
|
|
92
|
+
'--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
|
|
93
|
+
...style
|
|
94
|
+
},
|
|
95
|
+
...props,
|
|
96
|
+
children: children
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
const SIDEBAR_NAME = 'Sidebar';
|
|
102
|
+
function Sidebar({ children, className, collapsible = 'offcanvas', side = 'left', variant = 'sidebar', ...props }) {
|
|
103
|
+
const { isMobile, openMobile, setOpenMobile, state } = useSidebar(SIDEBAR_NAME);
|
|
104
|
+
if ('none' === collapsible) return /*#__PURE__*/ jsx("div", {
|
|
105
|
+
className: cn('bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col', className),
|
|
106
|
+
"data-slot": "sidebar",
|
|
107
|
+
...props,
|
|
108
|
+
children: children
|
|
109
|
+
});
|
|
110
|
+
if (isMobile) return /*#__PURE__*/ jsx(Sheet, {
|
|
111
|
+
open: openMobile,
|
|
112
|
+
onOpenChange: setOpenMobile,
|
|
113
|
+
...props,
|
|
114
|
+
children: /*#__PURE__*/ jsxs(SheetContent, {
|
|
115
|
+
className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
|
|
116
|
+
"data-mobile": "true",
|
|
117
|
+
"data-sidebar": "sidebar",
|
|
118
|
+
"data-slot": "sidebar",
|
|
119
|
+
side: side,
|
|
120
|
+
style: {
|
|
121
|
+
'--sidebar-width': SIDEBAR_WIDTH_MOBILE
|
|
122
|
+
},
|
|
123
|
+
children: [
|
|
124
|
+
/*#__PURE__*/ jsxs(SheetHeader, {
|
|
125
|
+
className: "sr-only",
|
|
126
|
+
children: [
|
|
127
|
+
/*#__PURE__*/ jsx(SheetTitle, {
|
|
128
|
+
children: "Sidebar"
|
|
129
|
+
}),
|
|
130
|
+
/*#__PURE__*/ jsx(SheetDescription, {
|
|
131
|
+
children: "Displays the mobile sidebar."
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
}),
|
|
135
|
+
/*#__PURE__*/ jsx("div", {
|
|
136
|
+
className: "flex h-full w-full flex-col",
|
|
137
|
+
children: children
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
})
|
|
141
|
+
});
|
|
142
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
143
|
+
className: cn('text-sidebar-foreground group peer hidden md:block', className),
|
|
144
|
+
"data-collapsible": 'collapsed' === state ? collapsible : '',
|
|
145
|
+
"data-side": side,
|
|
146
|
+
"data-slot": "sidebar",
|
|
147
|
+
"data-state": state,
|
|
148
|
+
"data-variant": variant,
|
|
149
|
+
children: [
|
|
150
|
+
/*#__PURE__*/ jsx("div", {
|
|
151
|
+
className: cn('relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear group-data-[collapsible=offcanvas]:w-0 group-data-[side=right]:rotate-180', 'floating' === variant || 'inset' === variant ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]' : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)'),
|
|
152
|
+
"data-slot": "sidebar-gap"
|
|
153
|
+
}),
|
|
154
|
+
/*#__PURE__*/ jsx("div", {
|
|
155
|
+
className: cn('fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex', 'left' === side ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]' : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]', 'floating' === variant || 'inset' === variant ? '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 group-data-[side=right]:border-l', className),
|
|
156
|
+
"data-slot": "sidebar-container",
|
|
157
|
+
...props,
|
|
158
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
159
|
+
className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",
|
|
160
|
+
"data-sidebar": "sidebar",
|
|
161
|
+
"data-slot": "sidebar-inner",
|
|
162
|
+
children: children
|
|
163
|
+
})
|
|
164
|
+
})
|
|
165
|
+
]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
const SIDEBAR_TRIGGER_NAME = 'SidebarTrigger';
|
|
169
|
+
function SidebarTrigger({ className, onClick, ...props }) {
|
|
170
|
+
const { toggleSidebar } = useSidebar(SIDEBAR_TRIGGER_NAME);
|
|
171
|
+
return /*#__PURE__*/ jsxs(Button, {
|
|
172
|
+
className: cn('size-7', className),
|
|
173
|
+
"data-sidebar": "trigger",
|
|
174
|
+
"data-slot": "sidebar-trigger",
|
|
175
|
+
size: "icon",
|
|
176
|
+
variant: "ghost",
|
|
177
|
+
onClick: (event)=>{
|
|
178
|
+
onClick?.(event);
|
|
179
|
+
toggleSidebar();
|
|
180
|
+
},
|
|
181
|
+
...props,
|
|
182
|
+
children: [
|
|
183
|
+
/*#__PURE__*/ jsx(PanelLeftIcon, {}),
|
|
184
|
+
/*#__PURE__*/ jsx("span", {
|
|
185
|
+
className: "sr-only",
|
|
186
|
+
children: "Toggle Sidebar"
|
|
187
|
+
})
|
|
188
|
+
]
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
const SIDEBAR_RAIL_NAME = 'SidebarRail';
|
|
192
|
+
function SidebarRail({ className, ...props }) {
|
|
193
|
+
const { toggleSidebar } = useSidebar(SIDEBAR_RAIL_NAME);
|
|
194
|
+
return /*#__PURE__*/ jsx("button", {
|
|
195
|
+
className: cn('hover:after:bg-sidebar-border hover:group-data-[collapsible=offcanvas]:bg-sidebar absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[collapsible=offcanvas]:translate-x-0 group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 group-data-[collapsible=offcanvas]:after:left-full in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize sm:flex [[data-side=left][data-collapsible=offcanvas]_&]:-right-2 [[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-collapsible=offcanvas]_&]:-left-2 [[data-side=right][data-state=collapsed]_&]:cursor-w-resize', className),
|
|
196
|
+
"data-sidebar": "rail",
|
|
197
|
+
"data-slot": "sidebar-rail",
|
|
198
|
+
title: "Toggle Sidebar",
|
|
199
|
+
type: "button",
|
|
200
|
+
onClick: toggleSidebar,
|
|
201
|
+
...props
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function SidebarInset({ className, ...props }) {
|
|
205
|
+
return /*#__PURE__*/ jsx("main", {
|
|
206
|
+
className: cn('bg-background relative flex w-full min-w-0 flex-1 flex-col md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2', className),
|
|
207
|
+
"data-slot": "sidebar-inset",
|
|
208
|
+
...props
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function SidebarInput({ className, ...props }) {
|
|
212
|
+
return /*#__PURE__*/ jsx(Input, {
|
|
213
|
+
className: cn('bg-background h-8 w-full shadow-none', className),
|
|
214
|
+
"data-sidebar": "input",
|
|
215
|
+
"data-slot": "sidebar-input",
|
|
216
|
+
...props
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function SidebarHeader({ className, ...props }) {
|
|
220
|
+
return /*#__PURE__*/ jsx("div", {
|
|
221
|
+
className: cn('flex flex-col gap-2 p-2', className),
|
|
222
|
+
"data-sidebar": "header",
|
|
223
|
+
"data-slot": "sidebar-header",
|
|
224
|
+
...props
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function SidebarFooter({ className, ...props }) {
|
|
228
|
+
return /*#__PURE__*/ jsx("div", {
|
|
229
|
+
className: cn('flex flex-col gap-2 p-2', className),
|
|
230
|
+
"data-sidebar": "footer",
|
|
231
|
+
"data-slot": "sidebar-footer",
|
|
232
|
+
...props
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
function SidebarSeparator({ className, ...props }) {
|
|
236
|
+
return /*#__PURE__*/ jsx(Separator, {
|
|
237
|
+
className: cn('bg-sidebar-border mx-2 w-auto', className),
|
|
238
|
+
"data-sidebar": "separator",
|
|
239
|
+
"data-slot": "sidebar-separator",
|
|
240
|
+
...props
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function SidebarContent({ className, ...props }) {
|
|
244
|
+
return /*#__PURE__*/ jsx("div", {
|
|
245
|
+
className: cn('flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden', className),
|
|
246
|
+
"data-sidebar": "content",
|
|
247
|
+
"data-slot": "sidebar-content",
|
|
248
|
+
...props
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function SidebarGroup({ className, ...props }) {
|
|
252
|
+
return /*#__PURE__*/ jsx("div", {
|
|
253
|
+
className: cn('relative flex w-full min-w-0 flex-col p-2', className),
|
|
254
|
+
"data-sidebar": "group",
|
|
255
|
+
"data-slot": "sidebar-group",
|
|
256
|
+
...props
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function SidebarGroupLabel({ asChild = false, className, ...props }) {
|
|
260
|
+
const Component = asChild ? Slot : 'div';
|
|
261
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
262
|
+
className: cn('text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center truncate rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-3 [&>svg]:size-4 [&>svg]:shrink-0', className),
|
|
263
|
+
"data-sidebar": "group-label",
|
|
264
|
+
"data-slot": "sidebar-group-label",
|
|
265
|
+
...props
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function SidebarGroupAction({ asChild = false, className, ...props }) {
|
|
269
|
+
const Component = asChild ? Slot : 'button';
|
|
270
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
271
|
+
className: cn('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 focus-visible:ring-3 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0', className),
|
|
272
|
+
"data-sidebar": "group-action",
|
|
273
|
+
"data-slot": "sidebar-group-action",
|
|
274
|
+
...props
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
function SidebarGroupContent({ className, ...props }) {
|
|
278
|
+
return /*#__PURE__*/ jsx("div", {
|
|
279
|
+
className: cn('w-full text-sm', className),
|
|
280
|
+
"data-sidebar": "group-content",
|
|
281
|
+
"data-slot": "sidebar-group-content",
|
|
282
|
+
...props
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function SidebarMenu({ className, ...props }) {
|
|
286
|
+
return /*#__PURE__*/ jsx("ul", {
|
|
287
|
+
className: cn('flex w-full min-w-0 flex-col gap-1', className),
|
|
288
|
+
"data-sidebar": "menu",
|
|
289
|
+
"data-slot": "sidebar-menu",
|
|
290
|
+
...props
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
294
|
+
return /*#__PURE__*/ jsx("li", {
|
|
295
|
+
className: cn('group/menu-item relative', className),
|
|
296
|
+
"data-sidebar": "menu-item",
|
|
297
|
+
"data-slot": "sidebar-menu-item",
|
|
298
|
+
...props
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
const SIDEBAR_MENU_BUTTON_NAME = 'SidebarMenuButton';
|
|
302
|
+
function SidebarMenuButton({ asChild = false, className, isActive = false, size = 'md', tooltip, variant = 'default', ...props }) {
|
|
303
|
+
const Component = asChild ? Slot : 'button';
|
|
304
|
+
const { isMobile, state } = useSidebar(SIDEBAR_MENU_BUTTON_NAME);
|
|
305
|
+
const button = /*#__PURE__*/ jsx(Component, {
|
|
306
|
+
className: cn(sidebarMenuButtonVariants({
|
|
307
|
+
size,
|
|
308
|
+
variant
|
|
309
|
+
}), className),
|
|
310
|
+
"data-active": isActive,
|
|
311
|
+
"data-sidebar": "menu-button",
|
|
312
|
+
"data-size": size,
|
|
313
|
+
"data-slot": "sidebar-menu-button",
|
|
314
|
+
...props
|
|
315
|
+
});
|
|
316
|
+
if (!tooltip) return button;
|
|
317
|
+
if ('string' == typeof tooltip) tooltip = {
|
|
318
|
+
children: tooltip
|
|
319
|
+
};
|
|
320
|
+
return /*#__PURE__*/ jsxs(Tooltip, {
|
|
321
|
+
children: [
|
|
322
|
+
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
323
|
+
asChild: true,
|
|
324
|
+
children: button
|
|
325
|
+
}),
|
|
326
|
+
/*#__PURE__*/ jsx(TooltipContent, {
|
|
327
|
+
align: "center",
|
|
328
|
+
hidden: 'collapsed' !== state || isMobile,
|
|
329
|
+
side: "right",
|
|
330
|
+
...tooltip
|
|
331
|
+
})
|
|
332
|
+
]
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
function SidebarMenuAction({ asChild = false, className, showOnHover = false, ...props }) {
|
|
336
|
+
const Component = asChild ? Slot : 'button';
|
|
337
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
338
|
+
className: cn('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 focus-visible:ring-3 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0', showOnHover && 'peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0', className),
|
|
339
|
+
"data-sidebar": "menu-action",
|
|
340
|
+
"data-slot": "sidebar-menu-action",
|
|
341
|
+
...props
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
function SidebarMenuBadge({ className, ...props }) {
|
|
345
|
+
return /*#__PURE__*/ jsx("div", {
|
|
346
|
+
className: cn('text-sidebar-foreground peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none group-data-[collapsible=icon]:hidden peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1', className),
|
|
347
|
+
"data-sidebar": "menu-badge",
|
|
348
|
+
"data-slot": "sidebar-menu-badge",
|
|
349
|
+
...props
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
353
|
+
const [width] = useState(()=>`${String(Math.floor(40 * Math.random()) + 50)}%`);
|
|
354
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
355
|
+
className: cn('flex h-8 items-center gap-2 rounded-md px-2', className),
|
|
356
|
+
"data-sidebar": "menu-skeleton",
|
|
357
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
358
|
+
...props,
|
|
359
|
+
children: [
|
|
360
|
+
showIcon ? /*#__PURE__*/ jsx(Skeleton, {
|
|
361
|
+
className: "size-4 rounded-md",
|
|
362
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
363
|
+
}) : null,
|
|
364
|
+
/*#__PURE__*/ jsx(Skeleton, {
|
|
365
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
366
|
+
"data-sidebar": "menu-skeleton-text",
|
|
367
|
+
style: {
|
|
368
|
+
'--skeleton-width': width
|
|
369
|
+
}
|
|
370
|
+
})
|
|
371
|
+
]
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
375
|
+
return /*#__PURE__*/ jsx("ul", {
|
|
376
|
+
className: cn('border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden', className),
|
|
377
|
+
"data-sidebar": "menu-sub",
|
|
378
|
+
"data-slot": "sidebar-menu-sub",
|
|
379
|
+
...props
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
function SidebarMenuSubItem({ className, ...props }) {
|
|
383
|
+
return /*#__PURE__*/ jsx("li", {
|
|
384
|
+
className: cn('group/menu-sub-item relative', className),
|
|
385
|
+
"data-sidebar": "menu-sub-item",
|
|
386
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
387
|
+
...props
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
function SidebarMenuSubButton({ asChild = false, className, isActive = false, size = 'md', ...props }) {
|
|
391
|
+
const Component = asChild ? Slot : 'a';
|
|
392
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
393
|
+
className: cn('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-3 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0', 'sm' === size && 'text-xs', 'md' === size && 'text-sm', 'group-data-[collapsible=icon]:hidden', className),
|
|
394
|
+
"data-active": isActive,
|
|
395
|
+
"data-sidebar": "menu-sub-button",
|
|
396
|
+
"data-size": size,
|
|
397
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
398
|
+
...props
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, sidebarMenuButtonVariants, useSidebar };
|
|
@@ -1 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
Skeleton: ()=>Skeleton
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const tailwind_variants_namespaceObject = require("@codefast/tailwind-variants");
|
|
31
|
+
function Skeleton({ className, ...props }) {
|
|
32
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
33
|
+
className: (0, tailwind_variants_namespaceObject.cn)('bg-muted animate-pulse rounded-lg', className),
|
|
34
|
+
"data-slot": "skeleton",
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
exports.Skeleton = __webpack_exports__.Skeleton;
|
|
39
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
40
|
+
"Skeleton"
|
|
41
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
42
|
+
Object.defineProperty(exports, '__esModule', {
|
|
43
|
+
value: true
|
|
44
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComponentProps, JSX } from
|
|
2
|
-
type SkeletonProps = ComponentProps<
|
|
1
|
+
import type { ComponentProps, JSX } from 'react';
|
|
2
|
+
type SkeletonProps = ComponentProps<'div'>;
|
|
3
3
|
declare function Skeleton({ className, ...props }: SkeletonProps): JSX.Element;
|
|
4
4
|
export { Skeleton };
|
|
5
5
|
export type { SkeletonProps };
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@codefast/tailwind-variants";
|
|
3
|
+
function Skeleton({ className, ...props }) {
|
|
4
|
+
return /*#__PURE__*/ jsx("div", {
|
|
5
|
+
className: cn('bg-muted animate-pulse rounded-lg', className),
|
|
6
|
+
"data-slot": "skeleton",
|
|
7
|
+
...props
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export { Skeleton };
|