@wheelhouse/ui 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/columns/columns-types.d.ts +25 -1
- package/dist/blocks/columns/columns-types.d.ts.map +1 -1
- package/dist/blocks/columns/columns-types.js +4 -0
- package/dist/blocks/columns/columns-utils.d.ts +31 -1
- package/dist/blocks/columns/columns-utils.d.ts.map +1 -1
- package/dist/blocks/columns/columns-utils.js +86 -1
- package/dist/blocks/columns/columns.d.ts +1 -1
- package/dist/blocks/columns/columns.d.ts.map +1 -1
- package/dist/blocks/columns/columns.js +81 -20
- package/dist/blocks/columns/columns.stories.d.ts +1 -0
- package/dist/blocks/columns/columns.stories.d.ts.map +1 -1
- package/dist/blocks/columns/columns.stories.js +21 -1
- package/dist/blocks/columns/index.d.ts +1 -1
- package/dist/blocks/columns/index.d.ts.map +1 -1
- package/dist/blocks/floating-menu-widget/floating-menu-widget.d.ts +26 -0
- package/dist/blocks/floating-menu-widget/floating-menu-widget.d.ts.map +1 -0
- package/dist/blocks/floating-menu-widget/floating-menu-widget.js +200 -0
- package/dist/blocks/floating-menu-widget/floating-menu-widget.stories.d.ts +15 -0
- package/dist/blocks/floating-menu-widget/floating-menu-widget.stories.d.ts.map +1 -0
- package/dist/blocks/floating-menu-widget/floating-menu-widget.stories.js +22 -0
- package/dist/blocks/floating-menu-widget/index.d.ts +3 -0
- package/dist/blocks/floating-menu-widget/index.d.ts.map +1 -0
- package/dist/blocks/floating-menu-widget/index.js +1 -0
- package/dist/blocks/index.d.ts +1 -0
- package/dist/blocks/index.d.ts.map +1 -1
- package/dist/blocks/index.js +1 -0
- package/dist/components/button/button.d.ts +18 -11
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +27 -14
- package/dist/components/button/button.stories.d.ts +11 -0
- package/dist/components/button/button.stories.d.ts.map +1 -1
- package/dist/components/button/button.stories.js +84 -0
- package/dist/components/data-grid/data-grid-column-filter.d.ts +15 -0
- package/dist/components/data-grid/data-grid-column-filter.d.ts.map +1 -0
- package/dist/components/data-grid/data-grid-column-filter.js +36 -0
- package/dist/components/data-grid/data-grid-column-header.d.ts +15 -0
- package/dist/components/data-grid/data-grid-column-header.d.ts.map +1 -0
- package/dist/components/data-grid/data-grid-column-header.js +137 -0
- package/dist/components/data-grid/data-grid-column-visibility.d.ts +8 -0
- package/dist/components/data-grid/data-grid-column-visibility.d.ts.map +1 -0
- package/dist/components/data-grid/data-grid-column-visibility.js +13 -0
- package/dist/components/data-grid/data-grid-pagination.d.ts +20 -0
- package/dist/components/data-grid/data-grid-pagination.d.ts.map +1 -0
- package/dist/components/data-grid/data-grid-pagination.js +76 -0
- package/dist/components/data-grid/data-grid-scroll-area.d.ts +11 -0
- package/dist/components/data-grid/data-grid-scroll-area.d.ts.map +1 -0
- package/dist/components/data-grid/data-grid-scroll-area.js +218 -0
- package/dist/components/data-grid/data-grid-table-dnd-rows.d.ts +12 -0
- package/dist/components/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -0
- package/dist/components/data-grid/data-grid-table-dnd-rows.js +91 -0
- package/dist/components/data-grid/data-grid-table-dnd.d.ts +8 -0
- package/dist/components/data-grid/data-grid-table-dnd.d.ts.map +1 -0
- package/dist/components/data-grid/data-grid-table-dnd.js +95 -0
- package/dist/components/data-grid/data-grid-table-virtual.d.ts +28 -0
- package/dist/components/data-grid/data-grid-table-virtual.d.ts.map +1 -0
- package/dist/components/data-grid/data-grid-table-virtual.js +133 -0
- package/dist/components/data-grid/data-grid-table.d.ts +98 -0
- package/dist/components/data-grid/data-grid-table.d.ts.map +1 -0
- package/dist/components/data-grid/data-grid-table.js +560 -0
- package/dist/components/data-grid/data-grid.d.ts +94 -0
- package/dist/components/data-grid/data-grid.d.ts.map +1 -0
- package/dist/components/data-grid/data-grid.js +123 -0
- package/dist/components/data-grid/data-grid.stories.d.ts +14 -0
- package/dist/components/data-grid/data-grid.stories.d.ts.map +1 -0
- package/dist/components/data-grid/data-grid.stories.js +47 -0
- package/dist/components/data-grid/index.d.ts +14 -0
- package/dist/components/data-grid/index.d.ts.map +1 -0
- package/dist/components/data-grid/index.js +10 -0
- package/dist/components/filters/filter-date-metric-value.d.ts.map +1 -1
- package/dist/components/filters/filter-date-metric-value.js +83 -8
- package/dist/components/filters/filter-fields-listing-demo.d.ts +12 -0
- package/dist/components/filters/filter-fields-listing-demo.d.ts.map +1 -0
- package/dist/components/filters/filter-fields-listing-demo.js +565 -0
- package/dist/components/filters/filters-types.d.ts +7 -0
- package/dist/components/filters/filters-types.d.ts.map +1 -1
- package/dist/components/filters/filters.stories.d.ts.map +1 -1
- package/dist/components/filters/filters.stories.js +8 -149
- package/dist/components/filters/index.d.ts +1 -0
- package/dist/components/filters/index.d.ts.map +1 -1
- package/dist/components/filters/index.js +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3 -0
- package/dist/components/popover/index.d.ts +1 -0
- package/dist/components/popover/index.d.ts.map +1 -1
- package/dist/components/popover/index.js +1 -0
- package/dist/components/popover/popover-handle.d.ts +6 -0
- package/dist/components/popover/popover-handle.d.ts.map +1 -0
- package/dist/components/popover/popover-handle.js +6 -0
- package/dist/components/popover/popover.d.ts +41 -7
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/popover/popover.js +50 -3
- package/dist/components/progress/progress.js +1 -1
- package/dist/components/progress/progress.stories.d.ts +11 -2
- package/dist/components/progress/progress.stories.d.ts.map +1 -1
- package/dist/components/progress/progress.stories.js +77 -4
- package/dist/components/sidebar/index.d.ts +2 -0
- package/dist/components/sidebar/index.d.ts.map +1 -0
- package/dist/components/sidebar/index.js +1 -0
- package/dist/components/sidebar/sidebar.d.ts +64 -0
- package/dist/components/sidebar/sidebar.d.ts.map +1 -0
- package/dist/components/sidebar/sidebar.js +255 -0
- package/dist/components/sidebar/sidebar.stories.d.ts +20 -0
- package/dist/components/sidebar/sidebar.stories.d.ts.map +1 -0
- package/dist/components/sidebar/sidebar.stories.js +181 -0
- package/dist/components/skeleton/index.d.ts +3 -0
- package/dist/components/skeleton/index.d.ts.map +1 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/skeleton/skeleton.d.ts +7 -0
- package/dist/components/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton.js +8 -0
- package/dist/components/sortable/sortable.d.ts +4 -2
- package/dist/components/sortable/sortable.d.ts.map +1 -1
- package/dist/components/sortable/sortable.js +4 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/llms.txt +1 -1
- package/package.json +7 -4
- package/src/styles/globals.css +26 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { Button } from '../button';
|
|
5
|
+
import { Input } from '../input';
|
|
6
|
+
import { Separator } from '../separator';
|
|
7
|
+
import { TooltipContent } from '../tooltip';
|
|
8
|
+
type SidebarContextProps = {
|
|
9
|
+
state: 'expanded' | 'collapsed';
|
|
10
|
+
open: boolean;
|
|
11
|
+
setOpen: (open: boolean) => void;
|
|
12
|
+
openMobile: boolean;
|
|
13
|
+
setOpenMobile: (open: boolean) => void;
|
|
14
|
+
isMobile: boolean;
|
|
15
|
+
toggleSidebar: () => void;
|
|
16
|
+
};
|
|
17
|
+
declare function useSidebar(): SidebarContextProps;
|
|
18
|
+
declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }: React.ComponentProps<'div'> & {
|
|
19
|
+
defaultOpen?: boolean;
|
|
20
|
+
open?: boolean;
|
|
21
|
+
onOpenChange?: (open: boolean) => void;
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare function Sidebar({ side, variant, collapsible, className, children, dir, ...props }: React.ComponentProps<'div'> & {
|
|
24
|
+
side?: 'left' | 'right';
|
|
25
|
+
variant?: 'sidebar' | 'floating' | 'inset';
|
|
26
|
+
collapsible?: 'offcanvas' | 'icon' | 'none';
|
|
27
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
declare function SidebarRail({ className, ...props }: React.ComponentProps<'button'>): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
declare function SidebarInset({ className, ...props }: React.ComponentProps<'main'>): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
declare function SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
declare function SidebarHeader({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
declare function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
declare function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
declare function SidebarContent({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
declare function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
declare function SidebarGroupLabel({ className, render, ...props }: useRender.ComponentProps<'div'> & React.ComponentProps<'div'>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
38
|
+
declare function SidebarGroupAction({ className, render, ...props }: useRender.ComponentProps<'button'> & React.ComponentProps<'button'>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
39
|
+
declare function SidebarGroupContent({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
declare function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
declare function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
declare const sidebarMenuButtonVariants: (props?: ({
|
|
43
|
+
variant?: "default" | "outline" | null | undefined;
|
|
44
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
45
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
46
|
+
declare function SidebarMenuButton({ render, isActive, variant, size, tooltip, className, ...props }: useRender.ComponentProps<'button'> & React.ComponentProps<'button'> & {
|
|
47
|
+
isActive?: boolean;
|
|
48
|
+
tooltip?: string | React.ComponentProps<typeof TooltipContent>;
|
|
49
|
+
} & VariantProps<typeof sidebarMenuButtonVariants>): import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
declare function SidebarMenuAction({ className, render, showOnHover, ...props }: useRender.ComponentProps<'button'> & React.ComponentProps<'button'> & {
|
|
51
|
+
showOnHover?: boolean;
|
|
52
|
+
}): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
53
|
+
declare function SidebarMenuBadge({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
declare function SidebarMenuSkeleton({ className, showIcon, ...props }: React.ComponentProps<'div'> & {
|
|
55
|
+
showIcon?: boolean;
|
|
56
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
declare function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
declare function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<'li'>): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
declare function SidebarMenuSubButton({ render, size, isActive, className, ...props }: useRender.ComponentProps<'a'> & React.ComponentProps<'a'> & {
|
|
60
|
+
size?: 'sm' | 'md';
|
|
61
|
+
isActive?: boolean;
|
|
62
|
+
}): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
63
|
+
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, };
|
|
64
|
+
//# sourceMappingURL=sidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/sidebar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAW,cAAc,EAAkB,MAAM,YAAY,CAAC;AAUrE,KAAK,mBAAmB,GAAG;IACvB,KAAK,EAAE,UAAU,GAAG,WAAW,CAAC;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAIF,iBAAS,UAAU,wBAOlB;AAED,iBAAS,eAAe,CAAC,EACrB,WAAkB,EAClB,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,WAAW,EACzB,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,KAAK,CAAC,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0EAoBJ;AAED,OAAO,EACH,OAAO,EACP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,UAAU,GACb,CAAC"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
5
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
6
|
+
import { cva } from 'class-variance-authority';
|
|
7
|
+
import { useIsMobile } from '../../hooks/use-mobile';
|
|
8
|
+
import { cn } from '../../lib/utils';
|
|
9
|
+
import { Button } from '../button';
|
|
10
|
+
import { Input } from '../input';
|
|
11
|
+
import { Separator } from '../separator';
|
|
12
|
+
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from '../sheet';
|
|
13
|
+
import { Skeleton } from '../skeleton';
|
|
14
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip';
|
|
15
|
+
import { PanelLeftIcon } from 'lucide-react';
|
|
16
|
+
const SIDEBAR_COOKIE_NAME = 'sidebar_state';
|
|
17
|
+
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
18
|
+
const SIDEBAR_WIDTH = '16rem';
|
|
19
|
+
const SIDEBAR_WIDTH_MOBILE = '18rem';
|
|
20
|
+
const SIDEBAR_WIDTH_ICON = '3rem';
|
|
21
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
|
22
|
+
const SidebarContext = React.createContext(null);
|
|
23
|
+
function useSidebar() {
|
|
24
|
+
const context = React.useContext(SidebarContext);
|
|
25
|
+
if (!context) {
|
|
26
|
+
throw new Error('useSidebar must be used within a SidebarProvider.');
|
|
27
|
+
}
|
|
28
|
+
return context;
|
|
29
|
+
}
|
|
30
|
+
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }) {
|
|
31
|
+
const isMobile = useIsMobile();
|
|
32
|
+
const [openMobile, setOpenMobile] = React.useState(false);
|
|
33
|
+
// This is the internal state of the sidebar.
|
|
34
|
+
// We use openProp and setOpenProp for control from outside the component.
|
|
35
|
+
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
36
|
+
const open = openProp ?? _open;
|
|
37
|
+
const setOpen = React.useCallback((value) => {
|
|
38
|
+
const openState = typeof value === 'function' ? value(open) : value;
|
|
39
|
+
if (setOpenProp) {
|
|
40
|
+
setOpenProp(openState);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
_setOpen(openState);
|
|
44
|
+
}
|
|
45
|
+
// This sets the cookie to keep the sidebar state.
|
|
46
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
47
|
+
}, [setOpenProp, open]);
|
|
48
|
+
// Helper to toggle the sidebar.
|
|
49
|
+
const toggleSidebar = React.useCallback(() => {
|
|
50
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
51
|
+
}, [isMobile, setOpen, setOpenMobile]);
|
|
52
|
+
// Adds a keyboard shortcut to toggle the sidebar.
|
|
53
|
+
React.useEffect(() => {
|
|
54
|
+
const handleKeyDown = (event) => {
|
|
55
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
toggleSidebar();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
61
|
+
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
62
|
+
}, [toggleSidebar]);
|
|
63
|
+
// We add a state so that we can do data-state="expanded" or "collapsed".
|
|
64
|
+
// This makes it easier to style the sidebar with Tailwind classes.
|
|
65
|
+
const state = open ? 'expanded' : 'collapsed';
|
|
66
|
+
const contextValue = React.useMemo(() => ({
|
|
67
|
+
state,
|
|
68
|
+
open,
|
|
69
|
+
setOpen,
|
|
70
|
+
isMobile,
|
|
71
|
+
openMobile,
|
|
72
|
+
setOpenMobile,
|
|
73
|
+
toggleSidebar,
|
|
74
|
+
}), [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]);
|
|
75
|
+
return (_jsx(SidebarContext.Provider, { value: contextValue, children: _jsx("div", { "data-slot": "sidebar-wrapper", style: {
|
|
76
|
+
'--sidebar-width': SIDEBAR_WIDTH,
|
|
77
|
+
'--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
|
|
78
|
+
...style,
|
|
79
|
+
}, className: cn('group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar', className), ...props, children: children }) }));
|
|
80
|
+
}
|
|
81
|
+
function Sidebar({ side = 'left', variant = 'sidebar', collapsible = 'offcanvas', className, children, dir, ...props }) {
|
|
82
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
83
|
+
if (collapsible === 'none') {
|
|
84
|
+
return (_jsx("div", { "data-slot": "sidebar", className: cn('flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground', className), ...props, children: children }));
|
|
85
|
+
}
|
|
86
|
+
if (isMobile) {
|
|
87
|
+
return (_jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: _jsxs(SheetContent, { dir: dir, "data-sidebar": "sidebar", "data-slot": "sidebar", "data-mobile": "true", className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden", style: {
|
|
88
|
+
'--sidebar-width': SIDEBAR_WIDTH_MOBILE,
|
|
89
|
+
}, side: side, children: [_jsxs(SheetHeader, { className: "sr-only", children: [_jsx(SheetTitle, { children: "Sidebar" }), _jsx(SheetDescription, { children: "Displays the mobile sidebar." })] }), _jsx("div", { className: "flex h-full w-full flex-col", children: children })] }) }));
|
|
90
|
+
}
|
|
91
|
+
return (_jsxs("div", { className: "group peer hidden text-sidebar-foreground md:block", "data-state": state, "data-collapsible": state === 'collapsed' ? collapsible : '', "data-variant": variant, "data-side": side, "data-slot": "sidebar", children: [_jsx("div", { "data-slot": "sidebar-gap", 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', variant === 'floating' || variant === 'inset'
|
|
92
|
+
? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'
|
|
93
|
+
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)') }), _jsx("div", { "data-slot": "sidebar-container", "data-side": side, className: cn('fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex',
|
|
94
|
+
// Adjust the padding for floating and inset variants.
|
|
95
|
+
variant === 'floating' || variant === 'inset'
|
|
96
|
+
? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
|
|
97
|
+
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l', className), ...props, children: _jsx("div", { "data-sidebar": "sidebar", "data-slot": "sidebar-inner", className: "flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border", children: children }) })] }));
|
|
98
|
+
}
|
|
99
|
+
function SidebarTrigger({ className, onClick, ...props }) {
|
|
100
|
+
const { toggleSidebar } = useSidebar();
|
|
101
|
+
return (_jsxs(Button, { "data-sidebar": "trigger", "data-slot": "sidebar-trigger", variant: "ghost", size: "icon-sm", className: cn(className), onClick: (event) => {
|
|
102
|
+
onClick?.(event);
|
|
103
|
+
toggleSidebar();
|
|
104
|
+
}, ...props, children: [_jsx(PanelLeftIcon, {}), _jsx("span", { className: "sr-only", children: "Toggle Sidebar" })] }));
|
|
105
|
+
}
|
|
106
|
+
function SidebarRail({ className, ...props }) {
|
|
107
|
+
const { toggleSidebar } = useSidebar();
|
|
108
|
+
return (_jsx("button", { "data-sidebar": "rail", "data-slot": "sidebar-rail", "aria-label": "Toggle Sidebar", tabIndex: -1, onClick: toggleSidebar, title: "Toggle Sidebar", className: cn('absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2', 'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize', '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize', 'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar', '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2', '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2', className), ...props }));
|
|
109
|
+
}
|
|
110
|
+
function SidebarInset({ className, ...props }) {
|
|
111
|
+
return (_jsx("main", { "data-slot": "sidebar-inset", className: cn('relative flex w-full flex-1 flex-col bg-background 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), ...props }));
|
|
112
|
+
}
|
|
113
|
+
function SidebarInput({ className, ...props }) {
|
|
114
|
+
return _jsx(Input, { "data-slot": "sidebar-input", "data-sidebar": "input", className: cn('h-8 w-full bg-background shadow-none', className), ...props });
|
|
115
|
+
}
|
|
116
|
+
function SidebarHeader({ className, ...props }) {
|
|
117
|
+
return _jsx("div", { "data-slot": "sidebar-header", "data-sidebar": "header", className: cn('flex flex-col gap-2 p-2', className), ...props });
|
|
118
|
+
}
|
|
119
|
+
function SidebarFooter({ className, ...props }) {
|
|
120
|
+
return _jsx("div", { "data-slot": "sidebar-footer", "data-sidebar": "footer", className: cn('flex flex-col gap-2 p-2', className), ...props });
|
|
121
|
+
}
|
|
122
|
+
function SidebarSeparator({ className, ...props }) {
|
|
123
|
+
return _jsx(Separator, { "data-slot": "sidebar-separator", "data-sidebar": "separator", className: cn('mx-2 w-auto bg-sidebar-border', className), ...props });
|
|
124
|
+
}
|
|
125
|
+
function SidebarContent({ className, ...props }) {
|
|
126
|
+
return (_jsx("div", { "data-slot": "sidebar-content", "data-sidebar": "content", className: cn('no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden', className), ...props }));
|
|
127
|
+
}
|
|
128
|
+
function SidebarGroup({ className, ...props }) {
|
|
129
|
+
return _jsx("div", { "data-slot": "sidebar-group", "data-sidebar": "group", className: cn('relative flex w-full min-w-0 flex-col p-2', className), ...props });
|
|
130
|
+
}
|
|
131
|
+
function SidebarGroupLabel({ className, render, ...props }) {
|
|
132
|
+
return useRender({
|
|
133
|
+
defaultTagName: 'div',
|
|
134
|
+
props: mergeProps({
|
|
135
|
+
className: cn('flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0', className),
|
|
136
|
+
}, props),
|
|
137
|
+
render,
|
|
138
|
+
state: {
|
|
139
|
+
slot: 'sidebar-group-label',
|
|
140
|
+
sidebar: 'group-label',
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function SidebarGroupAction({ className, render, ...props }) {
|
|
145
|
+
return useRender({
|
|
146
|
+
defaultTagName: 'button',
|
|
147
|
+
props: mergeProps({
|
|
148
|
+
className: cn('absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0', className),
|
|
149
|
+
}, props),
|
|
150
|
+
render,
|
|
151
|
+
state: {
|
|
152
|
+
slot: 'sidebar-group-action',
|
|
153
|
+
sidebar: 'group-action',
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function SidebarGroupContent({ className, ...props }) {
|
|
158
|
+
return _jsx("div", { "data-slot": "sidebar-group-content", "data-sidebar": "group-content", className: cn('w-full text-sm', className), ...props });
|
|
159
|
+
}
|
|
160
|
+
function SidebarMenu({ className, ...props }) {
|
|
161
|
+
return _jsx("ul", { "data-slot": "sidebar-menu", "data-sidebar": "menu", className: cn('flex w-full min-w-0 flex-col gap-0', className), ...props });
|
|
162
|
+
}
|
|
163
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
164
|
+
return _jsx("li", { "data-slot": "sidebar-menu-item", "data-sidebar": "menu-item", className: cn('group/menu-item relative', className), ...props });
|
|
165
|
+
}
|
|
166
|
+
const sidebarMenuButtonVariants = cva('peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate', {
|
|
167
|
+
variants: {
|
|
168
|
+
variant: {
|
|
169
|
+
default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
170
|
+
outline: 'bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]',
|
|
171
|
+
},
|
|
172
|
+
size: {
|
|
173
|
+
default: 'h-8 text-sm',
|
|
174
|
+
sm: 'h-7 text-xs',
|
|
175
|
+
lg: 'h-12 text-sm group-data-[collapsible=icon]:p-0!',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
defaultVariants: {
|
|
179
|
+
variant: 'default',
|
|
180
|
+
size: 'default',
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
function SidebarMenuButton({ render, isActive = false, variant = 'default', size = 'default', tooltip, className, ...props }) {
|
|
184
|
+
const { isMobile, state } = useSidebar();
|
|
185
|
+
const comp = useRender({
|
|
186
|
+
defaultTagName: 'button',
|
|
187
|
+
props: mergeProps({
|
|
188
|
+
className: cn(sidebarMenuButtonVariants({ variant, size }), className),
|
|
189
|
+
}, props),
|
|
190
|
+
render: !tooltip ? render : _jsx(TooltipTrigger, { render: render }),
|
|
191
|
+
state: {
|
|
192
|
+
slot: 'sidebar-menu-button',
|
|
193
|
+
sidebar: 'menu-button',
|
|
194
|
+
size,
|
|
195
|
+
active: isActive,
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
if (!tooltip) {
|
|
199
|
+
return comp;
|
|
200
|
+
}
|
|
201
|
+
if (typeof tooltip === 'string') {
|
|
202
|
+
tooltip = {
|
|
203
|
+
children: tooltip,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
return (_jsxs(Tooltip, { children: [comp, _jsx(TooltipContent, { side: "right", align: "center", hidden: state !== 'collapsed' || isMobile, ...tooltip })] }));
|
|
207
|
+
}
|
|
208
|
+
function SidebarMenuAction({ className, render, showOnHover = false, ...props }) {
|
|
209
|
+
return useRender({
|
|
210
|
+
defaultTagName: 'button',
|
|
211
|
+
props: mergeProps({
|
|
212
|
+
className: cn('absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground 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 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0', showOnHover &&
|
|
213
|
+
'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0', className),
|
|
214
|
+
}, props),
|
|
215
|
+
render,
|
|
216
|
+
state: {
|
|
217
|
+
slot: 'sidebar-menu-action',
|
|
218
|
+
sidebar: 'menu-action',
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function SidebarMenuBadge({ className, ...props }) {
|
|
223
|
+
return (_jsx("div", { "data-slot": "sidebar-menu-badge", "data-sidebar": "menu-badge", className: cn('pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground 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 peer-data-active/menu-button:text-sidebar-accent-foreground', className), ...props }));
|
|
224
|
+
}
|
|
225
|
+
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
226
|
+
// Random width between 50 to 90%.
|
|
227
|
+
const [width] = React.useState(() => {
|
|
228
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
229
|
+
});
|
|
230
|
+
return (_jsxs("div", { "data-slot": "sidebar-menu-skeleton", "data-sidebar": "menu-skeleton", className: cn('flex h-8 items-center gap-2 rounded-md px-2', className), ...props, children: [showIcon && _jsx(Skeleton, { className: "size-4 rounded-md", "data-sidebar": "menu-skeleton-icon" }), _jsx(Skeleton, { className: "h-4 max-w-(--skeleton-width) flex-1", "data-sidebar": "menu-skeleton-text", style: {
|
|
231
|
+
'--skeleton-width': width,
|
|
232
|
+
} })] }));
|
|
233
|
+
}
|
|
234
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
235
|
+
return (_jsx("ul", { "data-slot": "sidebar-menu-sub", "data-sidebar": "menu-sub", className: cn('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 group-data-[collapsible=icon]:hidden', className), ...props }));
|
|
236
|
+
}
|
|
237
|
+
function SidebarMenuSubItem({ className, ...props }) {
|
|
238
|
+
return _jsx("li", { "data-slot": "sidebar-menu-sub-item", "data-sidebar": "menu-sub-item", className: cn('group/menu-sub-item relative', className), ...props });
|
|
239
|
+
}
|
|
240
|
+
function SidebarMenuSubButton({ render, size = 'md', isActive = false, className, ...props }) {
|
|
241
|
+
return useRender({
|
|
242
|
+
defaultTagName: 'a',
|
|
243
|
+
props: mergeProps({
|
|
244
|
+
className: cn('flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground', className),
|
|
245
|
+
}, props),
|
|
246
|
+
render,
|
|
247
|
+
state: {
|
|
248
|
+
slot: 'sidebar-menu-sub-button',
|
|
249
|
+
sidebar: 'menu-sub-button',
|
|
250
|
+
size,
|
|
251
|
+
active: isActive,
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
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, };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import { SidebarProvider } from './sidebar';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof SidebarProvider;
|
|
6
|
+
tags: string[];
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: string;
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
decorators: ((Story: React.ComponentType) => import("react/jsx-runtime").JSX.Element)[];
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
19
|
+
export declare const Default: Story;
|
|
20
|
+
//# sourceMappingURL=sidebar.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar.stories.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/sidebar.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AA6BvD,OAAO,EAeH,eAAe,EAIlB,MAAM,WAAW,CAAC;AA+YnB,QAAA,MAAM,IAAI;;;;;;;;;;;;yBAxIY,KAAK,CAAC,aAAa;CAsJD,CAAC;AAEzC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAqBnC,eAAO,MAAM,OAAO,EAAE,KAmCrB,CAAC"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { AudioWaveform, BadgeCheck, Bell, BookOpen, Bot, Calendar, ChevronRight, ChevronsUpDown, Command, CreditCard, Folder, Forward, Frame, LogOut, Map, MoreHorizontal, PieChart, Plus, Settings2, Sparkles, SquareTerminal, Trash2, } from 'lucide-react';
|
|
4
|
+
import { Separator } from '../separator';
|
|
5
|
+
import { TooltipProvider } from '../tooltip';
|
|
6
|
+
import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarTrigger, useSidebar, } from './sidebar';
|
|
7
|
+
import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from '../breadcrumb';
|
|
8
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../collapsible';
|
|
9
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, } from '../dropdown-menu';
|
|
10
|
+
import { Avatar, AvatarFallback, AvatarImage } from '../avatar';
|
|
11
|
+
function NavMain({ items, }) {
|
|
12
|
+
return (_jsxs(SidebarGroup, { children: [_jsx(SidebarGroupLabel, { children: "Platform" }), _jsx(SidebarMenu, { children: items.map((item) => (_jsxs(Collapsible, { defaultOpen: item.isActive, className: "group/collapsible", render: _jsx(SidebarMenuItem, {}), children: [_jsx(CollapsibleTrigger, { render: _jsxs(SidebarMenuButton, { tooltip: item.title, children: [item.icon && _jsx(item.icon, {}), _jsx("span", { children: item.title }), _jsx(ChevronRight, { className: "ml-auto transition-transform duration-200 group-data-open/collapsible:rotate-90" })] }) }), _jsx(CollapsibleContent, { children: _jsx(SidebarMenuSub, { children: item.items?.map((subItem) => (_jsx(SidebarMenuSubItem, { children: _jsx(SidebarMenuSubButton, { render: _jsx("a", { href: subItem.url, "aria-label": subItem.title }), children: _jsx("span", { children: subItem.title }) }) }, subItem.title))) }) })] }, item.title))) })] }));
|
|
13
|
+
}
|
|
14
|
+
function TeamSwitcher({ teams, }) {
|
|
15
|
+
const { isMobile } = useSidebar();
|
|
16
|
+
const [activeTeam, setActiveTeam] = useState(teams[0]);
|
|
17
|
+
if (!activeTeam) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return (_jsx(SidebarMenu, { children: _jsx(SidebarMenuItem, { children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsxs(SidebarMenuButton, { size: "lg", className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground", children: [_jsx("div", { className: "flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground", children: _jsx(activeTeam.logo, { className: "size-4" }) }), _jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [_jsx("span", { className: "truncate font-medium", children: activeTeam.name }), _jsx("span", { className: "truncate text-xs", children: activeTeam.plan })] }), _jsx(ChevronsUpDown, { className: "ml-auto" })] }) }), _jsxs(DropdownMenuContent, { className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg", align: "start", side: isMobile ? 'bottom' : 'right', sideOffset: 4, children: [_jsx(DropdownMenuLabel, { className: "text-xs text-muted-foreground", children: "Teams" }), teams.map((team, index) => (_jsxs(DropdownMenuItem, { onClick: () => setActiveTeam(team), className: "gap-2 p-2", children: [_jsx("div", { className: "flex size-6 items-center justify-center rounded-md border", children: _jsx(team.logo, { className: "size-3.5 shrink-0" }) }), team.name, _jsxs(DropdownMenuShortcut, { children: ["\u2318", index + 1] })] }, team.name))), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { className: "gap-2 p-2", children: [_jsx("div", { className: "flex size-6 items-center justify-center rounded-md border bg-transparent", children: _jsx(Plus, { className: "size-4" }) }), _jsx("div", { className: "font-medium text-muted-foreground", children: "Add team" })] })] })] }) }) }));
|
|
21
|
+
}
|
|
22
|
+
function NavUser({ user, }) {
|
|
23
|
+
const { isMobile } = useSidebar();
|
|
24
|
+
return (_jsx(SidebarMenu, { children: _jsx(SidebarMenuItem, { children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsxs(SidebarMenuButton, { size: "lg", className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground", children: [_jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [_jsx(AvatarImage, { src: user.avatar, alt: user.name }), _jsx(AvatarFallback, { className: "rounded-lg", children: "CN" })] }), _jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [_jsx("span", { className: "truncate font-medium", children: user.name }), _jsx("span", { className: "truncate text-xs", children: user.email })] }), _jsx(ChevronsUpDown, { className: "ml-auto size-4" })] }) }), _jsxs(DropdownMenuContent, { className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg", side: isMobile ? 'bottom' : 'right', align: "end", sideOffset: 4, children: [_jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: _jsxs("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [_jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [_jsx(AvatarImage, { src: user.avatar, alt: user.name }), _jsx(AvatarFallback, { className: "rounded-lg", children: "CN" })] }), _jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [_jsx("span", { className: "truncate font-medium", children: user.name }), _jsx("span", { className: "truncate text-xs", children: user.email })] })] }) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuGroup, { children: _jsxs(DropdownMenuItem, { children: [_jsx(Sparkles, {}), "Upgrade to Pro"] }) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuGroup, { children: [_jsxs(DropdownMenuItem, { children: [_jsx(BadgeCheck, {}), "Account"] }), _jsxs(DropdownMenuItem, { children: [_jsx(CreditCard, {}), "Billing"] }), _jsxs(DropdownMenuItem, { children: [_jsx(Bell, {}), "Notifications"] })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { children: [_jsx(LogOut, {}), "Log out"] })] })] }) }) }));
|
|
25
|
+
}
|
|
26
|
+
function NavProjects({ projects, }) {
|
|
27
|
+
const { isMobile } = useSidebar();
|
|
28
|
+
return (_jsxs(SidebarGroup, { className: "group-data-[collapsible=icon]:hidden", children: [_jsx(SidebarGroupLabel, { children: "Projects" }), _jsxs(SidebarMenu, { children: [projects.map((item) => (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { render: _jsx("a", { href: item.url, "aria-label": item.name }), children: [_jsx(item.icon, {}), _jsx("span", { children: item.name })] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsxs(SidebarMenuAction, { showOnHover: true, children: [_jsx(MoreHorizontal, {}), _jsx("span", { className: "sr-only", children: "More" })] }) }), _jsxs(DropdownMenuContent, { className: "w-48 rounded-lg", side: isMobile ? 'bottom' : 'right', align: isMobile ? 'end' : 'start', children: [_jsxs(DropdownMenuItem, { children: [_jsx(Folder, { className: "text-muted-foreground" }), _jsx("span", { children: "View Project" })] }), _jsxs(DropdownMenuItem, { children: [_jsx(Forward, { className: "text-muted-foreground" }), _jsx("span", { children: "Share Project" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { children: [_jsx(Trash2, { className: "text-muted-foreground" }), _jsx("span", { children: "Delete Project" })] })] })] })] }, item.name))), _jsx(SidebarMenuItem, { children: _jsxs(SidebarMenuButton, { className: "text-sidebar-foreground/70", children: [_jsx(MoreHorizontal, { className: "text-sidebar-foreground/70" }), _jsx("span", { children: "More" })] }) })] })] }));
|
|
29
|
+
}
|
|
30
|
+
const shell = (Story) => (_jsx("div", { className: "h-[min(720px,85vh)] w-full min-w-0 overflow-hidden rounded-lg border bg-background text-foreground", children: _jsx(Story, {}) }));
|
|
31
|
+
// This is sample data.
|
|
32
|
+
const data = {
|
|
33
|
+
user: {
|
|
34
|
+
name: 'shadcn',
|
|
35
|
+
email: 'm@example.com',
|
|
36
|
+
avatar: '/avatars/shadcn.jpg',
|
|
37
|
+
},
|
|
38
|
+
teams: [
|
|
39
|
+
{
|
|
40
|
+
name: 'Acme Inc',
|
|
41
|
+
logo: Calendar,
|
|
42
|
+
plan: 'Enterprise',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Acme Corp.',
|
|
46
|
+
logo: AudioWaveform,
|
|
47
|
+
plan: 'Startup',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'Evil Corp.',
|
|
51
|
+
logo: Command,
|
|
52
|
+
plan: 'Free',
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
navMain: [
|
|
56
|
+
{
|
|
57
|
+
title: 'Playground',
|
|
58
|
+
url: '#',
|
|
59
|
+
icon: SquareTerminal,
|
|
60
|
+
isActive: true,
|
|
61
|
+
items: [
|
|
62
|
+
{
|
|
63
|
+
title: 'History',
|
|
64
|
+
url: '#',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
title: 'Starred',
|
|
68
|
+
url: '#',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
title: 'Settings',
|
|
72
|
+
url: '#',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
title: 'Models',
|
|
78
|
+
url: '#',
|
|
79
|
+
icon: Bot,
|
|
80
|
+
items: [
|
|
81
|
+
{
|
|
82
|
+
title: 'Genesis',
|
|
83
|
+
url: '#',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
title: 'Explorer',
|
|
87
|
+
url: '#',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
title: 'Quantum',
|
|
91
|
+
url: '#',
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
title: 'Documentation',
|
|
97
|
+
url: '#',
|
|
98
|
+
icon: BookOpen,
|
|
99
|
+
items: [
|
|
100
|
+
{
|
|
101
|
+
title: 'Introduction',
|
|
102
|
+
url: '#',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
title: 'Get Started',
|
|
106
|
+
url: '#',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
title: 'Tutorials',
|
|
110
|
+
url: '#',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
title: 'Changelog',
|
|
114
|
+
url: '#',
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
title: 'Settings',
|
|
120
|
+
url: '#',
|
|
121
|
+
icon: Settings2,
|
|
122
|
+
items: [
|
|
123
|
+
{
|
|
124
|
+
title: 'General',
|
|
125
|
+
url: '#',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
title: 'Team',
|
|
129
|
+
url: '#',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
title: 'Billing',
|
|
133
|
+
url: '#',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
title: 'Limits',
|
|
137
|
+
url: '#',
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
projects: [
|
|
143
|
+
{
|
|
144
|
+
name: 'Design Engineering',
|
|
145
|
+
url: '#',
|
|
146
|
+
icon: Frame,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: 'Sales & Marketing',
|
|
150
|
+
url: '#',
|
|
151
|
+
icon: PieChart,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: 'Travel',
|
|
155
|
+
url: '#',
|
|
156
|
+
icon: Map,
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
};
|
|
160
|
+
const meta = {
|
|
161
|
+
title: 'Components/Sidebar',
|
|
162
|
+
component: SidebarProvider,
|
|
163
|
+
tags: ['autodocs'],
|
|
164
|
+
parameters: {
|
|
165
|
+
layout: 'fullscreen',
|
|
166
|
+
docs: {
|
|
167
|
+
description: {
|
|
168
|
+
component: 'Composable app shell sidebar (provider, rail, grouped menus, mobile sheet). Matches the layout pattern in the [shadcn/ui Sidebar docs](https://ui.shadcn.com/docs/components/radix/sidebar).',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
decorators: [shell],
|
|
173
|
+
};
|
|
174
|
+
export default meta;
|
|
175
|
+
/** Same structure as the [shadcn Sidebar usage](https://ui.shadcn.com/docs/components/radix/sidebar): `SidebarProvider` → app sidebar → `SidebarInset` with `SidebarTrigger` and main content. Uses `collapsible="icon"` like the docs demo. */
|
|
176
|
+
function AppSidebar({ ...props }) {
|
|
177
|
+
return (_jsxs(Sidebar, { collapsible: "icon", ...props, children: [_jsx(SidebarHeader, { children: _jsx(TeamSwitcher, { teams: data.teams }) }), _jsxs(SidebarContent, { children: [_jsx(NavMain, { items: data.navMain }), _jsx(NavProjects, { projects: data.projects })] }), _jsx(SidebarFooter, { children: _jsx(NavUser, { user: data.user }) }), _jsx(SidebarRail, {})] }));
|
|
178
|
+
}
|
|
179
|
+
export const Default = {
|
|
180
|
+
render: () => (_jsx(TooltipProvider, { delay: 0, children: _jsxs(SidebarProvider, { children: [_jsx(AppSidebar, {}), _jsxs(SidebarInset, { children: [_jsx("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: _jsxs("div", { className: "flex items-center gap-2 px-4", children: [_jsx(SidebarTrigger, { className: "-ml-1" }), _jsx(Separator, { orientation: "vertical", className: "mr-2 self-center! data-[orientation=vertical]:h-4" }), _jsx(Breadcrumb, { children: _jsxs(BreadcrumbList, { children: [_jsx(BreadcrumbItem, { className: "hidden md:block", children: _jsx(BreadcrumbLink, { href: "#", children: "Build Your Application" }) }), _jsx(BreadcrumbSeparator, { className: "hidden md:block" }), _jsx(BreadcrumbItem, { children: _jsx(BreadcrumbPage, { children: "Data Fetching" }) })] }) })] }) }), _jsxs("div", { className: "flex flex-1 flex-col gap-4 p-4 pt-0", children: [_jsxs("div", { className: "grid auto-rows-min gap-4 md:grid-cols-3", children: [_jsx("div", { className: "aspect-video rounded-xl bg-muted/50" }), _jsx("div", { className: "aspect-video rounded-xl bg-muted/50" }), _jsx("div", { className: "aspect-video rounded-xl bg-muted/50" })] }), _jsx("div", { className: "min-h-[100vh] flex-1 rounded-xl bg-muted/50 md:min-h-min" })] })] })] }) })),
|
|
181
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/skeleton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Skeleton } from './skeleton';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** Props for `Skeleton` — a pulsing placeholder block. */
|
|
3
|
+
export type SkeletonProps = React.ComponentProps<'div'>;
|
|
4
|
+
/** Animated placeholder for loading rows, cards, and media. */
|
|
5
|
+
declare function Skeleton({ className, ...props }: SkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export { Skeleton };
|
|
7
|
+
//# sourceMappingURL=skeleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../../src/components/skeleton/skeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,0DAA0D;AAC1D,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAExD,+DAA+D;AAC/D,iBAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,2CAEvD;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
/** Animated placeholder for loading rows, cards, and media. */
|
|
5
|
+
function Skeleton({ className, ...props }) {
|
|
6
|
+
return _jsx("div", { "data-slot": "skeleton", className: cn('animate-pulse rounded-md bg-muted', className), ...props });
|
|
7
|
+
}
|
|
8
|
+
export { Skeleton };
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import * as React from 'react';
|
|
11
11
|
import { type ReactNode } from 'react';
|
|
12
12
|
import { useRender } from '@base-ui/react/use-render';
|
|
13
|
-
import { type DragEndEvent, DragOverlay, type DragStartEvent, type Modifiers, type UniqueIdentifier } from '@dnd-kit/core';
|
|
13
|
+
import { type CollisionDetection, type DragEndEvent, DragOverlay, type DragStartEvent, type Modifiers, type UniqueIdentifier } from '@dnd-kit/core';
|
|
14
14
|
/**
|
|
15
15
|
* Props for {@link Sortable}. `T` is your row model; stable string ids come from {@link SortableRootProps.getItemValue}.
|
|
16
16
|
*
|
|
@@ -45,13 +45,15 @@ export interface SortableRootProps<T> extends Omit<useRender.ComponentProps<'div
|
|
|
45
45
|
onDragEnd?: (event: DragEndEvent) => void;
|
|
46
46
|
/** Optional dnd-kit modifiers (e.g. `restrictToParentElement`) for both context and overlay. */
|
|
47
47
|
modifiers?: Modifiers;
|
|
48
|
+
/** Override pointer collision detection for `DndContext` (e.g. restrict valid drop targets). */
|
|
49
|
+
collisionDetection?: CollisionDetection;
|
|
48
50
|
}
|
|
49
51
|
/**
|
|
50
52
|
* Root for a sortable region. Wires `DndContext`, `SortableContext`, sensors, and a `DragOverlay` portal on the client.
|
|
51
53
|
*
|
|
52
54
|
* Renders the default element as a `div` with `data-slot="sortable"` (see Base UI `useRender` / `render` prop).
|
|
53
55
|
*/
|
|
54
|
-
declare function Sortable<T>({ value, onValueChange, getItemValue, className, render, onMove, strategy, onDragStart, onDragEnd, modifiers, children, ...props }: SortableRootProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
declare function Sortable<T>({ value, onValueChange, getItemValue, className, render, onMove, strategy, onDragStart, onDragEnd, modifiers, collisionDetection, children, ...props }: SortableRootProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
55
57
|
/**
|
|
56
58
|
* Props for {@link SortableItem}. `value` is the sortable id (string) registered with dnd-kit.
|
|
57
59
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortable.d.ts","sourceRoot":"","sources":["../../../src/components/sortable/sortable.tsx"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAMH,KAAK,SAAS,EAMjB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,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