@bison-lab/ui 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +238 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +625 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { clsx } from "clsx";
|
|
3
3
|
import { twMerge } from "tailwind-merge";
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import { defaultFontWeights, densityPresets, deriveDarkPalette, deriveLightPalette, motionPresets, radiusPresets, shadowPresets, zIndexTokens } from "@bison-lab/tokens";
|
|
5
|
+
import { defaultFontWeights, densityPresets, deriveDarkPalette, deriveLightPalette, generateBrandScales, generateScaleCSS, motionPresets, radiusPresets, shadowPresets, zIndexTokens } from "@bison-lab/tokens";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { Accordion as Accordion$1, AlertDialog as AlertDialog$1, AspectRatio as AspectRatio$1, Avatar as Avatar$1, Checkbox as Checkbox$1, ContextMenu as ContextMenu$1, Dialog as Dialog$1, DropdownMenu as DropdownMenu$1, Label as Label$1, NavigationMenu as NavigationMenu$1, Popover as Popover$1, Progress as Progress$1, RadioGroup as RadioGroup$1, ScrollArea as ScrollArea$1, Select as Select$1, Separator as Separator$1, Slider as Slider$1, Slot, Switch as Switch$1, Tabs as Tabs$1, Tooltip as Tooltip$1 } from "radix-ui";
|
|
7
|
+
import { Accordion as Accordion$1, AlertDialog as AlertDialog$1, AspectRatio as AspectRatio$1, Avatar as Avatar$1, Checkbox as Checkbox$1, Collapsible as Collapsible$1, ContextMenu as ContextMenu$1, Dialog as Dialog$1, DropdownMenu as DropdownMenu$1, Label as Label$1, NavigationMenu as NavigationMenu$1, Popover as Popover$1, Progress as Progress$1, RadioGroup as RadioGroup$1, ScrollArea as ScrollArea$1, Select as Select$1, Separator as Separator$1, Slider as Slider$1, Slot, Switch as Switch$1, Tabs as Tabs$1, Tooltip as Tooltip$1 } from "radix-ui";
|
|
8
8
|
import { cva } from "class-variance-authority";
|
|
9
|
-
import { ArrowDown, ArrowLeft, ArrowUp, ArrowUpDown, Camera, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, ChevronsLeft, ChevronsRight, Circle, FileQuestion, Inbox, Loader2, Mail, Menu, MoreHorizontal, Search, ServerCrash, SlidersHorizontal, Wrench, X } from "lucide-react";
|
|
9
|
+
import { ArrowDown, ArrowLeft, ArrowUp, ArrowUpDown, Camera, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, ChevronsLeft, ChevronsRight, ChevronsUpDown, Circle, FileQuestion, Inbox, Loader2, LogOut, Mail, Menu, MoreHorizontal, PanelLeftIcon, Plus, Search, ServerCrash, SlidersHorizontal, Wrench, X } from "lucide-react";
|
|
10
10
|
import { Toaster as Toaster$1, toast } from "sonner";
|
|
11
11
|
import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
12
12
|
import { Command as Command$1 } from "cmdk";
|
|
@@ -56,6 +56,20 @@ function useScrollReveal(options = {}) {
|
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
//#endregion
|
|
59
|
+
//#region src/hooks/use-mobile.ts
|
|
60
|
+
const MOBILE_BREAKPOINT = 768;
|
|
61
|
+
function useIsMobile() {
|
|
62
|
+
const [isMobile, setIsMobile] = React.useState(void 0);
|
|
63
|
+
React.useEffect(() => {
|
|
64
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
65
|
+
const onChange = () => setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
66
|
+
mql.addEventListener("change", onChange);
|
|
67
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
68
|
+
return () => mql.removeEventListener("change", onChange);
|
|
69
|
+
}, []);
|
|
70
|
+
return !!isMobile;
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
59
73
|
//#region src/providers/theme-provider.tsx
|
|
60
74
|
const ThemeProviderContext = React.createContext(void 0);
|
|
61
75
|
function ThemeProvider({ children, defaultTheme = "system", storageKey = "bison-theme", attribute = "data-theme", ...props }) {
|
|
@@ -150,6 +164,9 @@ function BisonProvider({ children, brandColors, radius = "rounded", shadow = "su
|
|
|
150
164
|
const resolvedHeadingFont = headingFont ?? bodyFont;
|
|
151
165
|
const lightPalette = React.useMemo(() => deriveLightPalette(brandColors), [brandColors]);
|
|
152
166
|
const darkPalette = React.useMemo(() => deriveDarkPalette(brandColors), [brandColors]);
|
|
167
|
+
const scaleCSS = React.useMemo(() => {
|
|
168
|
+
return generateScaleCSS(generateBrandScales(brandColors));
|
|
169
|
+
}, [brandColors]);
|
|
153
170
|
const fontsUrl = React.useMemo(() => {
|
|
154
171
|
const fonts = [bodyFont];
|
|
155
172
|
if (headingFont && headingFont.family !== bodyFont.family) fonts.push(headingFont);
|
|
@@ -178,7 +195,7 @@ function BisonProvider({ children, brandColors, radius = "rounded", shadow = "su
|
|
|
178
195
|
const lightColorVars = Object.entries(lightPalette).map(([key, value]) => ` --${key}: ${value};`).join("\n");
|
|
179
196
|
const darkColorVars = Object.entries(darkPalette).map(([key, value]) => ` --${key}: ${value};`).join("\n");
|
|
180
197
|
const zIndexVars = Object.entries(zIndexTokens).map(([key, value]) => ` ${key}: ${value};`).join("\n");
|
|
181
|
-
return `:root {\n${lightColorVars}\n${[
|
|
198
|
+
return `:root {\n${lightColorVars}\n\n${scaleCSS}\n${[
|
|
182
199
|
...Object.entries(radiusVars),
|
|
183
200
|
...Object.entries(shadowVars),
|
|
184
201
|
...Object.entries(motionVars),
|
|
@@ -196,7 +213,8 @@ function BisonProvider({ children, brandColors, radius = "rounded", shadow = "su
|
|
|
196
213
|
monoFont,
|
|
197
214
|
fontWeights,
|
|
198
215
|
lightPalette,
|
|
199
|
-
darkPalette
|
|
216
|
+
darkPalette,
|
|
217
|
+
scaleCSS
|
|
200
218
|
]);
|
|
201
219
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
202
220
|
/* @__PURE__ */ jsx("link", {
|
|
@@ -1685,6 +1703,386 @@ const CommandShortcut = ({ className, ...props }) => /* @__PURE__ */ jsx("span",
|
|
|
1685
1703
|
//#region src/components/aspect-ratio.tsx
|
|
1686
1704
|
const AspectRatio = AspectRatio$1.Root;
|
|
1687
1705
|
//#endregion
|
|
1706
|
+
//#region src/components/collapsible.tsx
|
|
1707
|
+
function Collapsible({ ...props }) {
|
|
1708
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Root, {
|
|
1709
|
+
"data-slot": "collapsible",
|
|
1710
|
+
...props
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
function CollapsibleTrigger({ ...props }) {
|
|
1714
|
+
return /* @__PURE__ */ jsx(Collapsible$1.CollapsibleTrigger, {
|
|
1715
|
+
"data-slot": "collapsible-trigger",
|
|
1716
|
+
...props
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1719
|
+
function CollapsibleContent({ ...props }) {
|
|
1720
|
+
return /* @__PURE__ */ jsx(Collapsible$1.CollapsibleContent, {
|
|
1721
|
+
"data-slot": "collapsible-content",
|
|
1722
|
+
...props
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
//#endregion
|
|
1726
|
+
//#region src/components/sidebar.tsx
|
|
1727
|
+
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
1728
|
+
const SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
|
|
1729
|
+
const SIDEBAR_WIDTH = "16rem";
|
|
1730
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
1731
|
+
const SIDEBAR_WIDTH_ICON = "3rem";
|
|
1732
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
1733
|
+
const SidebarContext = React.createContext(null);
|
|
1734
|
+
function useSidebar() {
|
|
1735
|
+
const context = React.useContext(SidebarContext);
|
|
1736
|
+
if (!context) throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
1737
|
+
return context;
|
|
1738
|
+
}
|
|
1739
|
+
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }) {
|
|
1740
|
+
const isMobile = useIsMobile();
|
|
1741
|
+
const [openMobile, setOpenMobile] = React.useState(false);
|
|
1742
|
+
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
1743
|
+
const open = openProp ?? _open;
|
|
1744
|
+
const setOpen = React.useCallback((value) => {
|
|
1745
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
1746
|
+
if (setOpenProp) setOpenProp(openState);
|
|
1747
|
+
else _setOpen(openState);
|
|
1748
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
1749
|
+
}, [setOpenProp, open]);
|
|
1750
|
+
const toggleSidebar = React.useCallback(() => {
|
|
1751
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
1752
|
+
}, [
|
|
1753
|
+
isMobile,
|
|
1754
|
+
setOpen,
|
|
1755
|
+
setOpenMobile
|
|
1756
|
+
]);
|
|
1757
|
+
React.useEffect(() => {
|
|
1758
|
+
const handleKeyDown = (event) => {
|
|
1759
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
1760
|
+
event.preventDefault();
|
|
1761
|
+
toggleSidebar();
|
|
1762
|
+
}
|
|
1763
|
+
};
|
|
1764
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
1765
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1766
|
+
}, [toggleSidebar]);
|
|
1767
|
+
const state = open ? "expanded" : "collapsed";
|
|
1768
|
+
const contextValue = React.useMemo(() => ({
|
|
1769
|
+
state,
|
|
1770
|
+
open,
|
|
1771
|
+
setOpen,
|
|
1772
|
+
isMobile,
|
|
1773
|
+
openMobile,
|
|
1774
|
+
setOpenMobile,
|
|
1775
|
+
toggleSidebar
|
|
1776
|
+
}), [
|
|
1777
|
+
state,
|
|
1778
|
+
open,
|
|
1779
|
+
setOpen,
|
|
1780
|
+
isMobile,
|
|
1781
|
+
openMobile,
|
|
1782
|
+
setOpenMobile,
|
|
1783
|
+
toggleSidebar
|
|
1784
|
+
]);
|
|
1785
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, {
|
|
1786
|
+
value: contextValue,
|
|
1787
|
+
children: /* @__PURE__ */ jsx(TooltipProvider, {
|
|
1788
|
+
delayDuration: 0,
|
|
1789
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1790
|
+
"data-slot": "sidebar-wrapper",
|
|
1791
|
+
style: {
|
|
1792
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
1793
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
1794
|
+
...style
|
|
1795
|
+
},
|
|
1796
|
+
className: cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className),
|
|
1797
|
+
...props,
|
|
1798
|
+
children
|
|
1799
|
+
})
|
|
1800
|
+
})
|
|
1801
|
+
});
|
|
1802
|
+
}
|
|
1803
|
+
function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, ...props }) {
|
|
1804
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
1805
|
+
if (collapsible === "none") return /* @__PURE__ */ jsx("div", {
|
|
1806
|
+
"data-slot": "sidebar",
|
|
1807
|
+
className: cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className),
|
|
1808
|
+
...props,
|
|
1809
|
+
children
|
|
1810
|
+
});
|
|
1811
|
+
if (isMobile) return /* @__PURE__ */ jsx(Sheet, {
|
|
1812
|
+
open: openMobile,
|
|
1813
|
+
onOpenChange: setOpenMobile,
|
|
1814
|
+
...props,
|
|
1815
|
+
children: /* @__PURE__ */ jsxs(SheetContent, {
|
|
1816
|
+
"data-sidebar": "sidebar",
|
|
1817
|
+
"data-slot": "sidebar",
|
|
1818
|
+
"data-mobile": "true",
|
|
1819
|
+
className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
|
|
1820
|
+
style: { "--sidebar-width": SIDEBAR_WIDTH_MOBILE },
|
|
1821
|
+
side,
|
|
1822
|
+
children: [/* @__PURE__ */ jsxs(SheetHeader, {
|
|
1823
|
+
className: "sr-only",
|
|
1824
|
+
children: [/* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }), /* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })]
|
|
1825
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1826
|
+
className: "flex h-full w-full flex-col",
|
|
1827
|
+
children
|
|
1828
|
+
})]
|
|
1829
|
+
})
|
|
1830
|
+
});
|
|
1831
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1832
|
+
className: "group peer hidden text-sidebar-foreground md:block",
|
|
1833
|
+
"data-state": state,
|
|
1834
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
1835
|
+
"data-variant": variant,
|
|
1836
|
+
"data-side": side,
|
|
1837
|
+
"data-slot": "sidebar",
|
|
1838
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1839
|
+
"data-slot": "sidebar-gap",
|
|
1840
|
+
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" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)")
|
|
1841
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1842
|
+
"data-slot": "sidebar-container",
|
|
1843
|
+
className: cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex", side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]", variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", className),
|
|
1844
|
+
...props,
|
|
1845
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1846
|
+
"data-sidebar": "sidebar",
|
|
1847
|
+
"data-slot": "sidebar-inner",
|
|
1848
|
+
className: "flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm",
|
|
1849
|
+
children
|
|
1850
|
+
})
|
|
1851
|
+
})]
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1854
|
+
function SidebarTrigger({ className, onClick, ...props }) {
|
|
1855
|
+
const { toggleSidebar } = useSidebar();
|
|
1856
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
1857
|
+
"data-sidebar": "trigger",
|
|
1858
|
+
"data-slot": "sidebar-trigger",
|
|
1859
|
+
variant: "ghost",
|
|
1860
|
+
size: "icon",
|
|
1861
|
+
className: cn("size-7", className),
|
|
1862
|
+
onClick: (event) => {
|
|
1863
|
+
onClick?.(event);
|
|
1864
|
+
toggleSidebar();
|
|
1865
|
+
},
|
|
1866
|
+
...props,
|
|
1867
|
+
children: [/* @__PURE__ */ jsx(PanelLeftIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
1868
|
+
className: "sr-only",
|
|
1869
|
+
children: "Toggle Sidebar"
|
|
1870
|
+
})]
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
function SidebarRail({ className, ...props }) {
|
|
1874
|
+
const { toggleSidebar } = useSidebar();
|
|
1875
|
+
return /* @__PURE__ */ jsx("button", {
|
|
1876
|
+
"data-sidebar": "rail",
|
|
1877
|
+
"data-slot": "sidebar-rail",
|
|
1878
|
+
"aria-label": "Toggle Sidebar",
|
|
1879
|
+
tabIndex: -1,
|
|
1880
|
+
onClick: toggleSidebar,
|
|
1881
|
+
title: "Toggle Sidebar",
|
|
1882
|
+
className: cn("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear 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] hover:after:bg-sidebar-border sm:flex", "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),
|
|
1883
|
+
...props
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
function SidebarInset({ className, ...props }) {
|
|
1887
|
+
return /* @__PURE__ */ jsx("main", {
|
|
1888
|
+
"data-slot": "sidebar-inset",
|
|
1889
|
+
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),
|
|
1890
|
+
...props
|
|
1891
|
+
});
|
|
1892
|
+
}
|
|
1893
|
+
function SidebarInput({ className, ...props }) {
|
|
1894
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
1895
|
+
"data-slot": "sidebar-input",
|
|
1896
|
+
"data-sidebar": "input",
|
|
1897
|
+
className: cn("h-8 w-full bg-background shadow-none", className),
|
|
1898
|
+
...props
|
|
1899
|
+
});
|
|
1900
|
+
}
|
|
1901
|
+
function SidebarHeader({ className, ...props }) {
|
|
1902
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1903
|
+
"data-slot": "sidebar-header",
|
|
1904
|
+
"data-sidebar": "header",
|
|
1905
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
1906
|
+
...props
|
|
1907
|
+
});
|
|
1908
|
+
}
|
|
1909
|
+
function SidebarFooter({ className, ...props }) {
|
|
1910
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1911
|
+
"data-slot": "sidebar-footer",
|
|
1912
|
+
"data-sidebar": "footer",
|
|
1913
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
1914
|
+
...props
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
function SidebarSeparator({ className, ...props }) {
|
|
1918
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
1919
|
+
"data-slot": "sidebar-separator",
|
|
1920
|
+
"data-sidebar": "separator",
|
|
1921
|
+
className: cn("mx-2 w-auto bg-sidebar-border", className),
|
|
1922
|
+
...props
|
|
1923
|
+
});
|
|
1924
|
+
}
|
|
1925
|
+
function SidebarContent({ className, ...props }) {
|
|
1926
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1927
|
+
"data-slot": "sidebar-content",
|
|
1928
|
+
"data-sidebar": "content",
|
|
1929
|
+
className: cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className),
|
|
1930
|
+
...props
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1933
|
+
function SidebarGroup({ className, ...props }) {
|
|
1934
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1935
|
+
"data-slot": "sidebar-group",
|
|
1936
|
+
"data-sidebar": "group",
|
|
1937
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
1938
|
+
...props
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1941
|
+
function SidebarGroupLabel({ className, asChild = false, ...props }) {
|
|
1942
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Slot : "div", {
|
|
1943
|
+
"data-slot": "sidebar-group-label",
|
|
1944
|
+
"data-sidebar": "group-label",
|
|
1945
|
+
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 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", className),
|
|
1946
|
+
...props
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
function SidebarGroupAction({ className, asChild = false, ...props }) {
|
|
1950
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Slot : "button", {
|
|
1951
|
+
"data-slot": "sidebar-group-action",
|
|
1952
|
+
"data-sidebar": "group-action",
|
|
1953
|
+
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 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 md:after:hidden", "group-data-[collapsible=icon]:hidden", className),
|
|
1954
|
+
...props
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1957
|
+
function SidebarGroupContent({ className, ...props }) {
|
|
1958
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1959
|
+
"data-slot": "sidebar-group-content",
|
|
1960
|
+
"data-sidebar": "group-content",
|
|
1961
|
+
className: cn("w-full text-sm", className),
|
|
1962
|
+
...props
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
function SidebarMenu({ className, ...props }) {
|
|
1966
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
1967
|
+
"data-slot": "sidebar-menu",
|
|
1968
|
+
"data-sidebar": "menu",
|
|
1969
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
1970
|
+
...props
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1973
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
1974
|
+
return /* @__PURE__ */ jsx("li", {
|
|
1975
|
+
"data-slot": "sidebar-menu-item",
|
|
1976
|
+
"data-sidebar": "menu-item",
|
|
1977
|
+
className: cn("group/menu-item relative", className),
|
|
1978
|
+
...props
|
|
1979
|
+
});
|
|
1980
|
+
}
|
|
1981
|
+
const sidebarMenuButtonVariants = cva("peer/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-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", {
|
|
1982
|
+
variants: {
|
|
1983
|
+
variant: {
|
|
1984
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
1985
|
+
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))]"
|
|
1986
|
+
},
|
|
1987
|
+
size: {
|
|
1988
|
+
default: "h-8 text-sm",
|
|
1989
|
+
sm: "h-7 text-xs",
|
|
1990
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
1991
|
+
}
|
|
1992
|
+
},
|
|
1993
|
+
defaultVariants: {
|
|
1994
|
+
variant: "default",
|
|
1995
|
+
size: "default"
|
|
1996
|
+
}
|
|
1997
|
+
});
|
|
1998
|
+
function SidebarMenuButton({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }) {
|
|
1999
|
+
const Comp = asChild ? Slot.Slot : "button";
|
|
2000
|
+
const { isMobile, state } = useSidebar();
|
|
2001
|
+
const button = /* @__PURE__ */ jsx(Comp, {
|
|
2002
|
+
"data-slot": "sidebar-menu-button",
|
|
2003
|
+
"data-sidebar": "menu-button",
|
|
2004
|
+
"data-size": size,
|
|
2005
|
+
"data-active": isActive,
|
|
2006
|
+
className: cn(sidebarMenuButtonVariants({
|
|
2007
|
+
variant,
|
|
2008
|
+
size
|
|
2009
|
+
}), className),
|
|
2010
|
+
...props
|
|
2011
|
+
});
|
|
2012
|
+
if (!tooltip) return button;
|
|
2013
|
+
if (typeof tooltip === "string") tooltip = { children: tooltip };
|
|
2014
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
2015
|
+
asChild: true,
|
|
2016
|
+
children: button
|
|
2017
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
2018
|
+
side: "right",
|
|
2019
|
+
align: "center",
|
|
2020
|
+
hidden: state !== "collapsed" || isMobile,
|
|
2021
|
+
...tooltip
|
|
2022
|
+
})] });
|
|
2023
|
+
}
|
|
2024
|
+
function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }) {
|
|
2025
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Slot : "button", {
|
|
2026
|
+
"data-slot": "sidebar-menu-action",
|
|
2027
|
+
"data-sidebar": "menu-action",
|
|
2028
|
+
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 peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 md:after:hidden", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground data-[state=open]:opacity-100 md:opacity-0", className),
|
|
2029
|
+
...props
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
function SidebarMenuBadge({ className, ...props }) {
|
|
2033
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2034
|
+
"data-slot": "sidebar-menu-badge",
|
|
2035
|
+
"data-sidebar": "menu-badge",
|
|
2036
|
+
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", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", className),
|
|
2037
|
+
...props
|
|
2038
|
+
});
|
|
2039
|
+
}
|
|
2040
|
+
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
2041
|
+
const width = React.useMemo(() => {
|
|
2042
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
2043
|
+
}, []);
|
|
2044
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2045
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
2046
|
+
"data-sidebar": "menu-skeleton",
|
|
2047
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
2048
|
+
...props,
|
|
2049
|
+
children: [showIcon && /* @__PURE__ */ jsx(Skeleton, {
|
|
2050
|
+
className: "size-4 rounded-md",
|
|
2051
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
2052
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
2053
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
2054
|
+
"data-sidebar": "menu-skeleton-text",
|
|
2055
|
+
style: { "--skeleton-width": width }
|
|
2056
|
+
})]
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
2059
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
2060
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
2061
|
+
"data-slot": "sidebar-menu-sub",
|
|
2062
|
+
"data-sidebar": "menu-sub",
|
|
2063
|
+
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),
|
|
2064
|
+
...props
|
|
2065
|
+
});
|
|
2066
|
+
}
|
|
2067
|
+
function SidebarMenuSubItem({ className, ...props }) {
|
|
2068
|
+
return /* @__PURE__ */ jsx("li", {
|
|
2069
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
2070
|
+
"data-sidebar": "menu-sub-item",
|
|
2071
|
+
className: cn("group/menu-sub-item relative", className),
|
|
2072
|
+
...props
|
|
2073
|
+
});
|
|
2074
|
+
}
|
|
2075
|
+
function SidebarMenuSubButton({ asChild = false, size = "md", isActive = false, className, ...props }) {
|
|
2076
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Slot : "a", {
|
|
2077
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
2078
|
+
"data-sidebar": "menu-sub-button",
|
|
2079
|
+
"data-size": size,
|
|
2080
|
+
"data-active": isActive,
|
|
2081
|
+
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 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 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", size === "sm" && "text-xs", size === "md" && "text-sm", "group-data-[collapsible=icon]:hidden", className),
|
|
2082
|
+
...props
|
|
2083
|
+
});
|
|
2084
|
+
}
|
|
2085
|
+
//#endregion
|
|
1688
2086
|
//#region src/lib/chart-utils.ts
|
|
1689
2087
|
/**
|
|
1690
2088
|
* Shared utilities for chart components.
|
|
@@ -2769,6 +3167,227 @@ function FooterBlock({ copyright, links = [], logo, className }) {
|
|
|
2769
3167
|
});
|
|
2770
3168
|
}
|
|
2771
3169
|
//#endregion
|
|
3170
|
+
//#region src/blocks/layout/app-sidebar/team-switcher.tsx
|
|
3171
|
+
function TeamSwitcher({ teams, activeTeam: activeTeamProp, onTeamChange, onAddTeam }) {
|
|
3172
|
+
const { isMobile } = useSidebar();
|
|
3173
|
+
const [internalActive, setInternalActive] = React.useState(teams[0]);
|
|
3174
|
+
const activeTeam = activeTeamProp ?? internalActive;
|
|
3175
|
+
if (!activeTeam) return null;
|
|
3176
|
+
return /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
3177
|
+
asChild: true,
|
|
3178
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuButton, {
|
|
3179
|
+
size: "lg",
|
|
3180
|
+
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
3181
|
+
children: [
|
|
3182
|
+
/* @__PURE__ */ jsx("div", {
|
|
3183
|
+
className: "flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground",
|
|
3184
|
+
children: /* @__PURE__ */ jsx(activeTeam.logo, { className: "size-4" })
|
|
3185
|
+
}),
|
|
3186
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3187
|
+
className: "grid flex-1 text-left text-sm leading-tight",
|
|
3188
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3189
|
+
className: "truncate font-medium",
|
|
3190
|
+
children: activeTeam.name
|
|
3191
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
3192
|
+
className: "truncate text-xs",
|
|
3193
|
+
children: activeTeam.plan
|
|
3194
|
+
})]
|
|
3195
|
+
}),
|
|
3196
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-auto" })
|
|
3197
|
+
]
|
|
3198
|
+
})
|
|
3199
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
3200
|
+
className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
|
|
3201
|
+
align: "start",
|
|
3202
|
+
side: isMobile ? "bottom" : "right",
|
|
3203
|
+
sideOffset: 4,
|
|
3204
|
+
children: [
|
|
3205
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, {
|
|
3206
|
+
className: "text-xs text-muted-foreground",
|
|
3207
|
+
children: "Teams"
|
|
3208
|
+
}),
|
|
3209
|
+
teams.map((team, index) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
3210
|
+
onClick: () => {
|
|
3211
|
+
setInternalActive(team);
|
|
3212
|
+
onTeamChange?.(team);
|
|
3213
|
+
},
|
|
3214
|
+
className: "gap-2 p-2",
|
|
3215
|
+
children: [
|
|
3216
|
+
/* @__PURE__ */ jsx("div", {
|
|
3217
|
+
className: "flex size-6 items-center justify-center rounded-md border",
|
|
3218
|
+
children: /* @__PURE__ */ jsx(team.logo, { className: "size-3.5 shrink-0" })
|
|
3219
|
+
}),
|
|
3220
|
+
team.name,
|
|
3221
|
+
/* @__PURE__ */ jsxs(DropdownMenuShortcut, { children: ["⌘", index + 1] })
|
|
3222
|
+
]
|
|
3223
|
+
}, team.name)),
|
|
3224
|
+
onAddTeam && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DropdownMenuSeparator, {}), /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
3225
|
+
className: "gap-2 p-2",
|
|
3226
|
+
onClick: onAddTeam,
|
|
3227
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
3228
|
+
className: "flex size-6 items-center justify-center rounded-md border bg-transparent",
|
|
3229
|
+
children: /* @__PURE__ */ jsx(Plus, { className: "size-4" })
|
|
3230
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
3231
|
+
className: "font-medium text-muted-foreground",
|
|
3232
|
+
children: "Add team"
|
|
3233
|
+
})]
|
|
3234
|
+
})] })
|
|
3235
|
+
]
|
|
3236
|
+
})] }) }) });
|
|
3237
|
+
}
|
|
3238
|
+
//#endregion
|
|
3239
|
+
//#region src/blocks/layout/app-sidebar/sidebar-nav.tsx
|
|
3240
|
+
function SidebarNav({ groups }) {
|
|
3241
|
+
return /* @__PURE__ */ jsx(Fragment, { children: groups.map((group, groupIdx) => /* @__PURE__ */ jsxs(SidebarGroup, { children: [group.label && /* @__PURE__ */ jsx(SidebarGroupLabel, { children: group.label }), /* @__PURE__ */ jsx(SidebarMenu, { children: group.items.map((item) => {
|
|
3242
|
+
if (item.items && item.items.length > 0) return /* @__PURE__ */ jsx(Collapsible, {
|
|
3243
|
+
asChild: true,
|
|
3244
|
+
defaultOpen: item.isActive,
|
|
3245
|
+
className: "group/collapsible",
|
|
3246
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
3247
|
+
asChild: true,
|
|
3248
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuButton, {
|
|
3249
|
+
tooltip: item.title,
|
|
3250
|
+
children: [
|
|
3251
|
+
item.icon && /* @__PURE__ */ jsx(item.icon, {}),
|
|
3252
|
+
/* @__PURE__ */ jsx("span", { children: item.title }),
|
|
3253
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
|
|
3254
|
+
]
|
|
3255
|
+
})
|
|
3256
|
+
}), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: item.items.map((subItem) => /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(SidebarMenuSubButton, {
|
|
3257
|
+
asChild: true,
|
|
3258
|
+
isActive: subItem.isActive,
|
|
3259
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
3260
|
+
href: subItem.url,
|
|
3261
|
+
onClick: (e) => {
|
|
3262
|
+
if (subItem.onClick) {
|
|
3263
|
+
e.preventDefault();
|
|
3264
|
+
subItem.onClick();
|
|
3265
|
+
}
|
|
3266
|
+
},
|
|
3267
|
+
children: /* @__PURE__ */ jsx("span", { children: subItem.title })
|
|
3268
|
+
})
|
|
3269
|
+
}) }, subItem.title)) }) })] })
|
|
3270
|
+
}, item.title);
|
|
3271
|
+
return /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, {
|
|
3272
|
+
asChild: true,
|
|
3273
|
+
tooltip: item.title,
|
|
3274
|
+
isActive: item.isActive,
|
|
3275
|
+
children: /* @__PURE__ */ jsxs("a", {
|
|
3276
|
+
href: item.url,
|
|
3277
|
+
onClick: (e) => {
|
|
3278
|
+
if (item.onClick) {
|
|
3279
|
+
e.preventDefault();
|
|
3280
|
+
item.onClick();
|
|
3281
|
+
}
|
|
3282
|
+
},
|
|
3283
|
+
children: [item.icon && /* @__PURE__ */ jsx(item.icon, {}), /* @__PURE__ */ jsx("span", { children: item.title })]
|
|
3284
|
+
})
|
|
3285
|
+
}) }, item.title);
|
|
3286
|
+
}) })] }, group.label ?? groupIdx)) });
|
|
3287
|
+
}
|
|
3288
|
+
//#endregion
|
|
3289
|
+
//#region src/blocks/layout/app-sidebar/sidebar-user.tsx
|
|
3290
|
+
function getInitials(name) {
|
|
3291
|
+
return name.split(" ").map((part) => part[0]).join("").toUpperCase().slice(0, 2);
|
|
3292
|
+
}
|
|
3293
|
+
function SidebarUserNav({ user, menuGroups, onLogout }) {
|
|
3294
|
+
const { isMobile } = useSidebar();
|
|
3295
|
+
return /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
3296
|
+
asChild: true,
|
|
3297
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuButton, {
|
|
3298
|
+
size: "lg",
|
|
3299
|
+
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
3300
|
+
children: [
|
|
3301
|
+
/* @__PURE__ */ jsxs(Avatar, {
|
|
3302
|
+
className: "h-8 w-8 rounded-lg",
|
|
3303
|
+
children: [user.avatar && /* @__PURE__ */ jsx(AvatarImage, {
|
|
3304
|
+
src: user.avatar,
|
|
3305
|
+
alt: user.name
|
|
3306
|
+
}), /* @__PURE__ */ jsx(AvatarFallback, {
|
|
3307
|
+
className: "rounded-lg",
|
|
3308
|
+
children: getInitials(user.name)
|
|
3309
|
+
})]
|
|
3310
|
+
}),
|
|
3311
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3312
|
+
className: "grid flex-1 text-left text-sm leading-tight",
|
|
3313
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3314
|
+
className: "truncate font-medium",
|
|
3315
|
+
children: user.name
|
|
3316
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
3317
|
+
className: "truncate text-xs",
|
|
3318
|
+
children: user.email
|
|
3319
|
+
})]
|
|
3320
|
+
}),
|
|
3321
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-auto size-4" })
|
|
3322
|
+
]
|
|
3323
|
+
})
|
|
3324
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
3325
|
+
className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
|
|
3326
|
+
side: isMobile ? "bottom" : "right",
|
|
3327
|
+
align: "end",
|
|
3328
|
+
sideOffset: 4,
|
|
3329
|
+
children: [
|
|
3330
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, {
|
|
3331
|
+
className: "p-0 font-normal",
|
|
3332
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
3333
|
+
className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm",
|
|
3334
|
+
children: [/* @__PURE__ */ jsxs(Avatar, {
|
|
3335
|
+
className: "h-8 w-8 rounded-lg",
|
|
3336
|
+
children: [user.avatar && /* @__PURE__ */ jsx(AvatarImage, {
|
|
3337
|
+
src: user.avatar,
|
|
3338
|
+
alt: user.name
|
|
3339
|
+
}), /* @__PURE__ */ jsx(AvatarFallback, {
|
|
3340
|
+
className: "rounded-lg",
|
|
3341
|
+
children: getInitials(user.name)
|
|
3342
|
+
})]
|
|
3343
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
3344
|
+
className: "grid flex-1 text-left text-sm leading-tight",
|
|
3345
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3346
|
+
className: "truncate font-medium",
|
|
3347
|
+
children: user.name
|
|
3348
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
3349
|
+
className: "truncate text-xs",
|
|
3350
|
+
children: user.email
|
|
3351
|
+
})]
|
|
3352
|
+
})]
|
|
3353
|
+
})
|
|
3354
|
+
}),
|
|
3355
|
+
menuGroups?.map((group, groupIdx) => /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx(DropdownMenuSeparator, {}), /* @__PURE__ */ jsx(DropdownMenuGroup, { children: group.map((item) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
3356
|
+
onClick: item.onClick,
|
|
3357
|
+
children: [item.icon && /* @__PURE__ */ jsx(item.icon, {}), item.label]
|
|
3358
|
+
}, item.label)) })] }, groupIdx)),
|
|
3359
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
3360
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
3361
|
+
onClick: onLogout,
|
|
3362
|
+
children: [/* @__PURE__ */ jsx(LogOut, {}), "Log out"]
|
|
3363
|
+
})
|
|
3364
|
+
]
|
|
3365
|
+
})] }) }) });
|
|
3366
|
+
}
|
|
3367
|
+
//#endregion
|
|
3368
|
+
//#region src/blocks/layout/app-sidebar/app-sidebar-block.tsx
|
|
3369
|
+
function AppSidebarBlock({ teams, activeTeam, onTeamChange, onAddTeam, navGroups, user, userMenuGroups, onLogout, ...sidebarProps }) {
|
|
3370
|
+
return /* @__PURE__ */ jsxs(Sidebar, {
|
|
3371
|
+
collapsible: "icon",
|
|
3372
|
+
...sidebarProps,
|
|
3373
|
+
children: [
|
|
3374
|
+
/* @__PURE__ */ jsx(SidebarHeader, { children: /* @__PURE__ */ jsx(TeamSwitcher, {
|
|
3375
|
+
teams,
|
|
3376
|
+
activeTeam,
|
|
3377
|
+
onTeamChange,
|
|
3378
|
+
onAddTeam
|
|
3379
|
+
}) }),
|
|
3380
|
+
/* @__PURE__ */ jsx(SidebarContent, { children: navGroups && navGroups.length > 0 && /* @__PURE__ */ jsx(SidebarNav, { groups: navGroups }) }),
|
|
3381
|
+
/* @__PURE__ */ jsx(SidebarFooter, { children: /* @__PURE__ */ jsx(SidebarUserNav, {
|
|
3382
|
+
user,
|
|
3383
|
+
menuGroups: userMenuGroups,
|
|
3384
|
+
onLogout
|
|
3385
|
+
}) }),
|
|
3386
|
+
/* @__PURE__ */ jsx(SidebarRail, {})
|
|
3387
|
+
]
|
|
3388
|
+
});
|
|
3389
|
+
}
|
|
3390
|
+
//#endregion
|
|
2772
3391
|
//#region src/blocks/settings/profile-settings-block.tsx
|
|
2773
3392
|
function ProfileSettingsBlock({ initialData, onSave, onAvatarChange, loading = false, error, disabled = false, className }) {
|
|
2774
3393
|
const fileInputRef = React.useRef(null);
|
|
@@ -3053,6 +3672,6 @@ function NotificationSettingsBlock({ groups, onSave, loading = false, error, dis
|
|
|
3053
3672
|
});
|
|
3054
3673
|
}
|
|
3055
3674
|
//#endregion
|
|
3056
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AreaChart, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BarChart, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataTable, DataTableColumnHeader, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DonutChart, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyStateBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, Input, Label, MaintenanceBlock, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, ResetPasswordBlock, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SidebarBlock, SignInBlock, SignUpBlock, Skeleton, Slider, SocialProviders, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VerifyBlock, badgeVariants, buttonVariants, chartColorTokens, chartSizeMap, cn, getThemeColors, navigationMenuTriggerStyle, progressBarVariants, resolveHslToken, spinnerVariants, toast, useDensity, useFormContext, useScrollReveal, useTheme };
|
|
3675
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppSidebarBlock, AreaChart, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BarChart, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataTable, DataTableColumnHeader, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DonutChart, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyStateBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, Input, Label, MaintenanceBlock, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, ResetPasswordBlock, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialProviders, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VerifyBlock, badgeVariants, buttonVariants, chartColorTokens, chartSizeMap, cn, getThemeColors, navigationMenuTriggerStyle, progressBarVariants, resolveHslToken, spinnerVariants, toast, useDensity, useFormContext, useIsMobile, useScrollReveal, useSidebar, useTheme };
|
|
3057
3676
|
|
|
3058
3677
|
//# sourceMappingURL=index.mjs.map
|