@bison-lab/ui 0.9.0 → 0.10.1
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/charts.d.mts +143 -0
- package/dist/charts.d.mts.map +1 -0
- package/dist/charts.mjs +272 -0
- package/dist/charts.mjs.map +1 -0
- package/dist/index.d.mts +249 -151
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +610 -262
- package/dist/index.mjs.map +1 -1
- package/dist/utils-DPv8mMhD.mjs +11 -0
- package/dist/utils-DPv8mMhD.mjs.map +1 -0
- package/package.json +6 -2
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { twMerge } from "tailwind-merge";
|
|
2
|
+
import { t as cn } from "./utils-DPv8mMhD.mjs";
|
|
4
3
|
import * as React from "react";
|
|
5
|
-
import { defaultFontWeights, densityPresets, deriveDarkPalette, deriveLightPalette, motionPresets, radiusPresets, shadowPresets, zIndexTokens } from "@bison-lab/tokens";
|
|
4
|
+
import { defaultFontWeights, densityPresets, deriveDarkPalette, deriveLightPalette, generateBrandScales, generateScaleCSS, motionPresets, radiusPresets, shadowPresets, zIndexTokens } from "@bison-lab/tokens";
|
|
6
5
|
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";
|
|
6
|
+
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
7
|
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";
|
|
8
|
+
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
9
|
import { Toaster as Toaster$1, toast } from "sonner";
|
|
11
10
|
import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
12
11
|
import { Command as Command$1 } from "cmdk";
|
|
13
|
-
import { Area, AreaChart as AreaChart$1, Bar, BarChart as BarChart$1, CartesianGrid, Cell, Legend, Pie, PieChart, ResponsiveContainer, Tooltip as Tooltip$2, XAxis, YAxis } from "recharts";
|
|
14
|
-
//#region src/lib/utils.ts
|
|
15
|
-
function cn(...inputs) {
|
|
16
|
-
return twMerge(clsx(inputs));
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
12
|
//#region src/hooks/use-scroll-reveal.ts
|
|
20
13
|
/**
|
|
21
14
|
* Returns a ref and a boolean indicating whether the element is in view.
|
|
@@ -56,6 +49,20 @@ function useScrollReveal(options = {}) {
|
|
|
56
49
|
};
|
|
57
50
|
}
|
|
58
51
|
//#endregion
|
|
52
|
+
//#region src/hooks/use-mobile.ts
|
|
53
|
+
const MOBILE_BREAKPOINT = 768;
|
|
54
|
+
function useIsMobile() {
|
|
55
|
+
const [isMobile, setIsMobile] = React.useState(void 0);
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
58
|
+
const onChange = () => setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
59
|
+
mql.addEventListener("change", onChange);
|
|
60
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
61
|
+
return () => mql.removeEventListener("change", onChange);
|
|
62
|
+
}, []);
|
|
63
|
+
return !!isMobile;
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
59
66
|
//#region src/providers/theme-provider.tsx
|
|
60
67
|
const ThemeProviderContext = React.createContext(void 0);
|
|
61
68
|
function ThemeProvider({ children, defaultTheme = "system", storageKey = "bison-theme", attribute = "data-theme", ...props }) {
|
|
@@ -150,6 +157,9 @@ function BisonProvider({ children, brandColors, radius = "rounded", shadow = "su
|
|
|
150
157
|
const resolvedHeadingFont = headingFont ?? bodyFont;
|
|
151
158
|
const lightPalette = React.useMemo(() => deriveLightPalette(brandColors), [brandColors]);
|
|
152
159
|
const darkPalette = React.useMemo(() => deriveDarkPalette(brandColors), [brandColors]);
|
|
160
|
+
const scaleCSS = React.useMemo(() => {
|
|
161
|
+
return generateScaleCSS(generateBrandScales(brandColors));
|
|
162
|
+
}, [brandColors]);
|
|
153
163
|
const fontsUrl = React.useMemo(() => {
|
|
154
164
|
const fonts = [bodyFont];
|
|
155
165
|
if (headingFont && headingFont.family !== bodyFont.family) fonts.push(headingFont);
|
|
@@ -178,7 +188,7 @@ function BisonProvider({ children, brandColors, radius = "rounded", shadow = "su
|
|
|
178
188
|
const lightColorVars = Object.entries(lightPalette).map(([key, value]) => ` --${key}: ${value};`).join("\n");
|
|
179
189
|
const darkColorVars = Object.entries(darkPalette).map(([key, value]) => ` --${key}: ${value};`).join("\n");
|
|
180
190
|
const zIndexVars = Object.entries(zIndexTokens).map(([key, value]) => ` ${key}: ${value};`).join("\n");
|
|
181
|
-
return `:root {\n${lightColorVars}\n${[
|
|
191
|
+
return `:root {\n${lightColorVars}\n\n${scaleCSS}\n${[
|
|
182
192
|
...Object.entries(radiusVars),
|
|
183
193
|
...Object.entries(shadowVars),
|
|
184
194
|
...Object.entries(motionVars),
|
|
@@ -196,7 +206,8 @@ function BisonProvider({ children, brandColors, radius = "rounded", shadow = "su
|
|
|
196
206
|
monoFont,
|
|
197
207
|
fontWeights,
|
|
198
208
|
lightPalette,
|
|
199
|
-
darkPalette
|
|
209
|
+
darkPalette,
|
|
210
|
+
scaleCSS
|
|
200
211
|
]);
|
|
201
212
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
202
213
|
/* @__PURE__ */ jsx("link", {
|
|
@@ -1685,269 +1696,385 @@ const CommandShortcut = ({ className, ...props }) => /* @__PURE__ */ jsx("span",
|
|
|
1685
1696
|
//#region src/components/aspect-ratio.tsx
|
|
1686
1697
|
const AspectRatio = AspectRatio$1.Root;
|
|
1687
1698
|
//#endregion
|
|
1688
|
-
//#region src/
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
if (typeof window === "undefined") return `hsl(var(${token}))`;
|
|
1707
|
-
const target = el ?? document.documentElement;
|
|
1708
|
-
const raw = getComputedStyle(target).getPropertyValue(token).trim();
|
|
1709
|
-
if (!raw) return `hsl(var(${token}))`;
|
|
1710
|
-
if (raw.startsWith("hsl")) return raw;
|
|
1711
|
-
return `hsl(${raw})`;
|
|
1699
|
+
//#region src/components/collapsible.tsx
|
|
1700
|
+
function Collapsible({ ...props }) {
|
|
1701
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Root, {
|
|
1702
|
+
"data-slot": "collapsible",
|
|
1703
|
+
...props
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
function CollapsibleTrigger({ ...props }) {
|
|
1707
|
+
return /* @__PURE__ */ jsx(Collapsible$1.CollapsibleTrigger, {
|
|
1708
|
+
"data-slot": "collapsible-trigger",
|
|
1709
|
+
...props
|
|
1710
|
+
});
|
|
1711
|
+
}
|
|
1712
|
+
function CollapsibleContent({ ...props }) {
|
|
1713
|
+
return /* @__PURE__ */ jsx(Collapsible$1.CollapsibleContent, {
|
|
1714
|
+
"data-slot": "collapsible-content",
|
|
1715
|
+
...props
|
|
1716
|
+
});
|
|
1712
1717
|
}
|
|
1713
|
-
/**
|
|
1714
|
-
* Returns an array of resolved theme colors for chart series.
|
|
1715
|
-
* Consumers can override with explicit `colors` prop.
|
|
1716
|
-
*/
|
|
1717
|
-
function getThemeColors(el) {
|
|
1718
|
-
return chartColorTokens.map((token) => resolveHslToken(token, el));
|
|
1719
|
-
}
|
|
1720
|
-
/** Chart size presets (height in px) */
|
|
1721
|
-
const chartSizeMap = {
|
|
1722
|
-
sm: 200,
|
|
1723
|
-
md: 300,
|
|
1724
|
-
lg: 400
|
|
1725
|
-
};
|
|
1726
1718
|
//#endregion
|
|
1727
|
-
//#region src/components/
|
|
1728
|
-
const
|
|
1729
|
-
|
|
1730
|
-
|
|
1719
|
+
//#region src/components/sidebar.tsx
|
|
1720
|
+
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
1721
|
+
const SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
|
|
1722
|
+
const SIDEBAR_WIDTH = "16rem";
|
|
1723
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
1724
|
+
const SIDEBAR_WIDTH_ICON = "3rem";
|
|
1725
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
1726
|
+
const SidebarContext = React.createContext(null);
|
|
1727
|
+
function useSidebar() {
|
|
1728
|
+
const context = React.useContext(SidebarContext);
|
|
1729
|
+
if (!context) throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
1730
|
+
return context;
|
|
1731
|
+
}
|
|
1732
|
+
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }) {
|
|
1733
|
+
const isMobile = useIsMobile();
|
|
1734
|
+
const [openMobile, setOpenMobile] = React.useState(false);
|
|
1735
|
+
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
1736
|
+
const open = openProp ?? _open;
|
|
1737
|
+
const setOpen = React.useCallback((value) => {
|
|
1738
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
1739
|
+
if (setOpenProp) setOpenProp(openState);
|
|
1740
|
+
else _setOpen(openState);
|
|
1741
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
1742
|
+
}, [setOpenProp, open]);
|
|
1743
|
+
const toggleSidebar = React.useCallback(() => {
|
|
1744
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
1745
|
+
}, [
|
|
1746
|
+
isMobile,
|
|
1747
|
+
setOpen,
|
|
1748
|
+
setOpenMobile
|
|
1749
|
+
]);
|
|
1731
1750
|
React.useEffect(() => {
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
const
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
axisLine: false,
|
|
1774
|
-
width: 40,
|
|
1775
|
-
className: "[&_text]:fill-content-secondary"
|
|
1776
|
-
}),
|
|
1777
|
-
showTooltip && /* @__PURE__ */ jsx(Tooltip$2, { contentStyle: {
|
|
1778
|
-
backgroundColor: "hsl(var(--popover))",
|
|
1779
|
-
border: "1px solid hsl(var(--border))",
|
|
1780
|
-
borderRadius: "var(--radius-md)",
|
|
1781
|
-
color: "hsl(var(--popover-foreground))",
|
|
1782
|
-
fontSize: 12
|
|
1783
|
-
} }),
|
|
1784
|
-
showLegend && /* @__PURE__ */ jsx(Legend, {}),
|
|
1785
|
-
resolvedSeries.map((s, i) => {
|
|
1786
|
-
const color = s.color ?? themeColors[i % themeColors.length] ?? `hsl(var(--primary))`;
|
|
1787
|
-
return /* @__PURE__ */ jsx(Area, {
|
|
1788
|
-
type: curveType,
|
|
1789
|
-
dataKey: s.dataKey,
|
|
1790
|
-
name: s.name ?? s.dataKey,
|
|
1791
|
-
stroke: color,
|
|
1792
|
-
fill: color,
|
|
1793
|
-
fillOpacity: s.fillOpacity ?? .15,
|
|
1794
|
-
stackId: stacked ? "stack" : void 0
|
|
1795
|
-
}, s.dataKey);
|
|
1796
|
-
})
|
|
1797
|
-
]
|
|
1751
|
+
const handleKeyDown = (event) => {
|
|
1752
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
1753
|
+
event.preventDefault();
|
|
1754
|
+
toggleSidebar();
|
|
1755
|
+
}
|
|
1756
|
+
};
|
|
1757
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
1758
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1759
|
+
}, [toggleSidebar]);
|
|
1760
|
+
const state = open ? "expanded" : "collapsed";
|
|
1761
|
+
const contextValue = React.useMemo(() => ({
|
|
1762
|
+
state,
|
|
1763
|
+
open,
|
|
1764
|
+
setOpen,
|
|
1765
|
+
isMobile,
|
|
1766
|
+
openMobile,
|
|
1767
|
+
setOpenMobile,
|
|
1768
|
+
toggleSidebar
|
|
1769
|
+
}), [
|
|
1770
|
+
state,
|
|
1771
|
+
open,
|
|
1772
|
+
setOpen,
|
|
1773
|
+
isMobile,
|
|
1774
|
+
openMobile,
|
|
1775
|
+
setOpenMobile,
|
|
1776
|
+
toggleSidebar
|
|
1777
|
+
]);
|
|
1778
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, {
|
|
1779
|
+
value: contextValue,
|
|
1780
|
+
children: /* @__PURE__ */ jsx(TooltipProvider, {
|
|
1781
|
+
delayDuration: 0,
|
|
1782
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1783
|
+
"data-slot": "sidebar-wrapper",
|
|
1784
|
+
style: {
|
|
1785
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
1786
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
1787
|
+
...style
|
|
1788
|
+
},
|
|
1789
|
+
className: cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className),
|
|
1790
|
+
...props,
|
|
1791
|
+
children
|
|
1798
1792
|
})
|
|
1799
1793
|
})
|
|
1800
1794
|
});
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
const [themeColors, setThemeColors] = React.useState([]);
|
|
1808
|
-
React.useEffect(() => {
|
|
1809
|
-
const el = containerRef.current;
|
|
1810
|
-
setThemeColors(colors ?? getThemeColors(el));
|
|
1811
|
-
}, [colors]);
|
|
1812
|
-
const resolvedSeries = React.useMemo(() => {
|
|
1813
|
-
if (series) return series;
|
|
1814
|
-
return (categories ?? []).map((key) => ({
|
|
1815
|
-
dataKey: key,
|
|
1816
|
-
name: key
|
|
1817
|
-
}));
|
|
1818
|
-
}, [series, categories]);
|
|
1819
|
-
const chartHeight = height ?? chartSizeMap[size];
|
|
1820
|
-
const layout = horizontal ? "vertical" : "horizontal";
|
|
1821
|
-
return /* @__PURE__ */ jsx("div", {
|
|
1822
|
-
ref: (node) => {
|
|
1823
|
-
containerRef.current = node;
|
|
1824
|
-
if (typeof ref === "function") ref(node);
|
|
1825
|
-
else if (ref) ref.current = node;
|
|
1826
|
-
},
|
|
1827
|
-
className: cn("w-full", className),
|
|
1795
|
+
}
|
|
1796
|
+
function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, ...props }) {
|
|
1797
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
1798
|
+
if (collapsible === "none") return /* @__PURE__ */ jsx("div", {
|
|
1799
|
+
"data-slot": "sidebar",
|
|
1800
|
+
className: cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className),
|
|
1828
1801
|
...props,
|
|
1829
|
-
children
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
tick: { fontSize: 12 },
|
|
1850
|
-
tickLine: false,
|
|
1851
|
-
axisLine: false,
|
|
1852
|
-
width: 80,
|
|
1853
|
-
className: "[&_text]:fill-content-secondary"
|
|
1854
|
-
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(XAxis, {
|
|
1855
|
-
dataKey: index,
|
|
1856
|
-
tick: { fontSize: 12 },
|
|
1857
|
-
tickLine: false,
|
|
1858
|
-
axisLine: false,
|
|
1859
|
-
className: "[&_text]:fill-content-secondary"
|
|
1860
|
-
}), showYAxis && /* @__PURE__ */ jsx(YAxis, {
|
|
1861
|
-
tick: { fontSize: 12 },
|
|
1862
|
-
tickLine: false,
|
|
1863
|
-
axisLine: false,
|
|
1864
|
-
width: 40,
|
|
1865
|
-
className: "[&_text]:fill-content-secondary"
|
|
1866
|
-
})] }),
|
|
1867
|
-
showTooltip && /* @__PURE__ */ jsx(Tooltip$2, { contentStyle: {
|
|
1868
|
-
backgroundColor: "hsl(var(--popover))",
|
|
1869
|
-
border: "1px solid hsl(var(--border))",
|
|
1870
|
-
borderRadius: "var(--radius-md)",
|
|
1871
|
-
color: "hsl(var(--popover-foreground))",
|
|
1872
|
-
fontSize: 12
|
|
1873
|
-
} }),
|
|
1874
|
-
showLegend && /* @__PURE__ */ jsx(Legend, {}),
|
|
1875
|
-
resolvedSeries.map((s, i) => {
|
|
1876
|
-
const color = s.color ?? themeColors[i % themeColors.length] ?? `hsl(var(--primary))`;
|
|
1877
|
-
return /* @__PURE__ */ jsx(Bar, {
|
|
1878
|
-
dataKey: s.dataKey,
|
|
1879
|
-
name: s.name ?? s.dataKey,
|
|
1880
|
-
fill: color,
|
|
1881
|
-
radius: s.radius ?? [
|
|
1882
|
-
4,
|
|
1883
|
-
4,
|
|
1884
|
-
0,
|
|
1885
|
-
0
|
|
1886
|
-
],
|
|
1887
|
-
stackId: stacked ? "stack" : void 0
|
|
1888
|
-
}, s.dataKey);
|
|
1889
|
-
})
|
|
1890
|
-
]
|
|
1891
|
-
})
|
|
1802
|
+
children
|
|
1803
|
+
});
|
|
1804
|
+
if (isMobile) return /* @__PURE__ */ jsx(Sheet, {
|
|
1805
|
+
open: openMobile,
|
|
1806
|
+
onOpenChange: setOpenMobile,
|
|
1807
|
+
...props,
|
|
1808
|
+
children: /* @__PURE__ */ jsxs(SheetContent, {
|
|
1809
|
+
"data-sidebar": "sidebar",
|
|
1810
|
+
"data-slot": "sidebar",
|
|
1811
|
+
"data-mobile": "true",
|
|
1812
|
+
className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
|
|
1813
|
+
style: { "--sidebar-width": SIDEBAR_WIDTH_MOBILE },
|
|
1814
|
+
side,
|
|
1815
|
+
children: [/* @__PURE__ */ jsxs(SheetHeader, {
|
|
1816
|
+
className: "sr-only",
|
|
1817
|
+
children: [/* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }), /* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })]
|
|
1818
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1819
|
+
className: "flex h-full w-full flex-col",
|
|
1820
|
+
children
|
|
1821
|
+
})]
|
|
1892
1822
|
})
|
|
1893
1823
|
});
|
|
1894
|
-
});
|
|
1895
|
-
BarChart.displayName = "BarChart";
|
|
1896
|
-
//#endregion
|
|
1897
|
-
//#region src/components/donut-chart.tsx
|
|
1898
|
-
const DonutChart = React.forwardRef(({ className, data, nameKey = "name", dataKey = "value", colors, size = "md", height, showLegend = false, showTooltip = true, showLabels = false, innerRadius = "60%", outerRadius = "80%", paddingAngle = 2, centerLabel, ...props }, ref) => {
|
|
1899
|
-
const containerRef = React.useRef(null);
|
|
1900
|
-
const [themeColors, setThemeColors] = React.useState([]);
|
|
1901
|
-
React.useEffect(() => {
|
|
1902
|
-
const el = containerRef.current;
|
|
1903
|
-
setThemeColors(colors ?? getThemeColors(el));
|
|
1904
|
-
}, [colors]);
|
|
1905
|
-
const chartHeight = height ?? chartSizeMap[size];
|
|
1906
1824
|
return /* @__PURE__ */ jsxs("div", {
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
className: "
|
|
1916
|
-
|
|
1825
|
+
className: "group peer hidden text-sidebar-foreground md:block",
|
|
1826
|
+
"data-state": state,
|
|
1827
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
1828
|
+
"data-variant": variant,
|
|
1829
|
+
"data-side": side,
|
|
1830
|
+
"data-slot": "sidebar",
|
|
1831
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1832
|
+
"data-slot": "sidebar-gap",
|
|
1833
|
+
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)")
|
|
1834
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1835
|
+
"data-slot": "sidebar-container",
|
|
1836
|
+
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),
|
|
1837
|
+
...props,
|
|
1917
1838
|
children: /* @__PURE__ */ jsx("div", {
|
|
1918
|
-
|
|
1919
|
-
|
|
1839
|
+
"data-sidebar": "sidebar",
|
|
1840
|
+
"data-slot": "sidebar-inner",
|
|
1841
|
+
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",
|
|
1842
|
+
children
|
|
1920
1843
|
})
|
|
1921
|
-
}), /* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
1922
|
-
width: "100%",
|
|
1923
|
-
height: chartHeight,
|
|
1924
|
-
children: /* @__PURE__ */ jsxs(PieChart, { children: [
|
|
1925
|
-
/* @__PURE__ */ jsx(Pie, {
|
|
1926
|
-
data,
|
|
1927
|
-
nameKey,
|
|
1928
|
-
dataKey,
|
|
1929
|
-
innerRadius,
|
|
1930
|
-
outerRadius,
|
|
1931
|
-
paddingAngle,
|
|
1932
|
-
label: showLabels,
|
|
1933
|
-
strokeWidth: 0,
|
|
1934
|
-
children: data.map((_, i) => {
|
|
1935
|
-
return /* @__PURE__ */ jsx(Cell, { fill: themeColors[i % themeColors.length] ?? `hsl(var(--primary))` }, i);
|
|
1936
|
-
})
|
|
1937
|
-
}),
|
|
1938
|
-
showTooltip && /* @__PURE__ */ jsx(Tooltip$2, { contentStyle: {
|
|
1939
|
-
backgroundColor: "hsl(var(--popover))",
|
|
1940
|
-
border: "1px solid hsl(var(--border))",
|
|
1941
|
-
borderRadius: "var(--radius-md)",
|
|
1942
|
-
color: "hsl(var(--popover-foreground))",
|
|
1943
|
-
fontSize: 12
|
|
1944
|
-
} }),
|
|
1945
|
-
showLegend && /* @__PURE__ */ jsx(Legend, {})
|
|
1946
|
-
] })
|
|
1947
1844
|
})]
|
|
1948
1845
|
});
|
|
1846
|
+
}
|
|
1847
|
+
function SidebarTrigger({ className, onClick, ...props }) {
|
|
1848
|
+
const { toggleSidebar } = useSidebar();
|
|
1849
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
1850
|
+
"data-sidebar": "trigger",
|
|
1851
|
+
"data-slot": "sidebar-trigger",
|
|
1852
|
+
variant: "ghost",
|
|
1853
|
+
size: "icon",
|
|
1854
|
+
className: cn("size-7", className),
|
|
1855
|
+
onClick: (event) => {
|
|
1856
|
+
onClick?.(event);
|
|
1857
|
+
toggleSidebar();
|
|
1858
|
+
},
|
|
1859
|
+
...props,
|
|
1860
|
+
children: [/* @__PURE__ */ jsx(PanelLeftIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
1861
|
+
className: "sr-only",
|
|
1862
|
+
children: "Toggle Sidebar"
|
|
1863
|
+
})]
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1866
|
+
function SidebarRail({ className, ...props }) {
|
|
1867
|
+
const { toggleSidebar } = useSidebar();
|
|
1868
|
+
return /* @__PURE__ */ jsx("button", {
|
|
1869
|
+
"data-sidebar": "rail",
|
|
1870
|
+
"data-slot": "sidebar-rail",
|
|
1871
|
+
"aria-label": "Toggle Sidebar",
|
|
1872
|
+
tabIndex: -1,
|
|
1873
|
+
onClick: toggleSidebar,
|
|
1874
|
+
title: "Toggle Sidebar",
|
|
1875
|
+
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),
|
|
1876
|
+
...props
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
function SidebarInset({ className, ...props }) {
|
|
1880
|
+
return /* @__PURE__ */ jsx("main", {
|
|
1881
|
+
"data-slot": "sidebar-inset",
|
|
1882
|
+
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),
|
|
1883
|
+
...props
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
function SidebarInput({ className, ...props }) {
|
|
1887
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
1888
|
+
"data-slot": "sidebar-input",
|
|
1889
|
+
"data-sidebar": "input",
|
|
1890
|
+
className: cn("h-8 w-full bg-background shadow-none", className),
|
|
1891
|
+
...props
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
function SidebarHeader({ className, ...props }) {
|
|
1895
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1896
|
+
"data-slot": "sidebar-header",
|
|
1897
|
+
"data-sidebar": "header",
|
|
1898
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
1899
|
+
...props
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1902
|
+
function SidebarFooter({ className, ...props }) {
|
|
1903
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1904
|
+
"data-slot": "sidebar-footer",
|
|
1905
|
+
"data-sidebar": "footer",
|
|
1906
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
1907
|
+
...props
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1910
|
+
function SidebarSeparator({ className, ...props }) {
|
|
1911
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
1912
|
+
"data-slot": "sidebar-separator",
|
|
1913
|
+
"data-sidebar": "separator",
|
|
1914
|
+
className: cn("mx-2 w-auto bg-sidebar-border", className),
|
|
1915
|
+
...props
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
function SidebarContent({ className, ...props }) {
|
|
1919
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1920
|
+
"data-slot": "sidebar-content",
|
|
1921
|
+
"data-sidebar": "content",
|
|
1922
|
+
className: cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className),
|
|
1923
|
+
...props
|
|
1924
|
+
});
|
|
1925
|
+
}
|
|
1926
|
+
function SidebarGroup({ className, ...props }) {
|
|
1927
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1928
|
+
"data-slot": "sidebar-group",
|
|
1929
|
+
"data-sidebar": "group",
|
|
1930
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
1931
|
+
...props
|
|
1932
|
+
});
|
|
1933
|
+
}
|
|
1934
|
+
function SidebarGroupLabel({ className, asChild = false, ...props }) {
|
|
1935
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Slot : "div", {
|
|
1936
|
+
"data-slot": "sidebar-group-label",
|
|
1937
|
+
"data-sidebar": "group-label",
|
|
1938
|
+
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),
|
|
1939
|
+
...props
|
|
1940
|
+
});
|
|
1941
|
+
}
|
|
1942
|
+
function SidebarGroupAction({ className, asChild = false, ...props }) {
|
|
1943
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Slot : "button", {
|
|
1944
|
+
"data-slot": "sidebar-group-action",
|
|
1945
|
+
"data-sidebar": "group-action",
|
|
1946
|
+
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),
|
|
1947
|
+
...props
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
function SidebarGroupContent({ className, ...props }) {
|
|
1951
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1952
|
+
"data-slot": "sidebar-group-content",
|
|
1953
|
+
"data-sidebar": "group-content",
|
|
1954
|
+
className: cn("w-full text-sm", className),
|
|
1955
|
+
...props
|
|
1956
|
+
});
|
|
1957
|
+
}
|
|
1958
|
+
function SidebarMenu({ className, ...props }) {
|
|
1959
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
1960
|
+
"data-slot": "sidebar-menu",
|
|
1961
|
+
"data-sidebar": "menu",
|
|
1962
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
1963
|
+
...props
|
|
1964
|
+
});
|
|
1965
|
+
}
|
|
1966
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
1967
|
+
return /* @__PURE__ */ jsx("li", {
|
|
1968
|
+
"data-slot": "sidebar-menu-item",
|
|
1969
|
+
"data-sidebar": "menu-item",
|
|
1970
|
+
className: cn("group/menu-item relative", className),
|
|
1971
|
+
...props
|
|
1972
|
+
});
|
|
1973
|
+
}
|
|
1974
|
+
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", {
|
|
1975
|
+
variants: {
|
|
1976
|
+
variant: {
|
|
1977
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
1978
|
+
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))]"
|
|
1979
|
+
},
|
|
1980
|
+
size: {
|
|
1981
|
+
default: "h-8 text-sm",
|
|
1982
|
+
sm: "h-7 text-xs",
|
|
1983
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
1984
|
+
}
|
|
1985
|
+
},
|
|
1986
|
+
defaultVariants: {
|
|
1987
|
+
variant: "default",
|
|
1988
|
+
size: "default"
|
|
1989
|
+
}
|
|
1949
1990
|
});
|
|
1950
|
-
|
|
1991
|
+
function SidebarMenuButton({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }) {
|
|
1992
|
+
const Comp = asChild ? Slot.Slot : "button";
|
|
1993
|
+
const { isMobile, state } = useSidebar();
|
|
1994
|
+
const button = /* @__PURE__ */ jsx(Comp, {
|
|
1995
|
+
"data-slot": "sidebar-menu-button",
|
|
1996
|
+
"data-sidebar": "menu-button",
|
|
1997
|
+
"data-size": size,
|
|
1998
|
+
"data-active": isActive,
|
|
1999
|
+
className: cn(sidebarMenuButtonVariants({
|
|
2000
|
+
variant,
|
|
2001
|
+
size
|
|
2002
|
+
}), className),
|
|
2003
|
+
...props
|
|
2004
|
+
});
|
|
2005
|
+
if (!tooltip) return button;
|
|
2006
|
+
if (typeof tooltip === "string") tooltip = { children: tooltip };
|
|
2007
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
2008
|
+
asChild: true,
|
|
2009
|
+
children: button
|
|
2010
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
2011
|
+
side: "right",
|
|
2012
|
+
align: "center",
|
|
2013
|
+
hidden: state !== "collapsed" || isMobile,
|
|
2014
|
+
...tooltip
|
|
2015
|
+
})] });
|
|
2016
|
+
}
|
|
2017
|
+
function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }) {
|
|
2018
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Slot : "button", {
|
|
2019
|
+
"data-slot": "sidebar-menu-action",
|
|
2020
|
+
"data-sidebar": "menu-action",
|
|
2021
|
+
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),
|
|
2022
|
+
...props
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
function SidebarMenuBadge({ className, ...props }) {
|
|
2026
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2027
|
+
"data-slot": "sidebar-menu-badge",
|
|
2028
|
+
"data-sidebar": "menu-badge",
|
|
2029
|
+
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),
|
|
2030
|
+
...props
|
|
2031
|
+
});
|
|
2032
|
+
}
|
|
2033
|
+
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
2034
|
+
const width = React.useMemo(() => {
|
|
2035
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
2036
|
+
}, []);
|
|
2037
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2038
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
2039
|
+
"data-sidebar": "menu-skeleton",
|
|
2040
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
2041
|
+
...props,
|
|
2042
|
+
children: [showIcon && /* @__PURE__ */ jsx(Skeleton, {
|
|
2043
|
+
className: "size-4 rounded-md",
|
|
2044
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
2045
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
2046
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
2047
|
+
"data-sidebar": "menu-skeleton-text",
|
|
2048
|
+
style: { "--skeleton-width": width }
|
|
2049
|
+
})]
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
2052
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
2053
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
2054
|
+
"data-slot": "sidebar-menu-sub",
|
|
2055
|
+
"data-sidebar": "menu-sub",
|
|
2056
|
+
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),
|
|
2057
|
+
...props
|
|
2058
|
+
});
|
|
2059
|
+
}
|
|
2060
|
+
function SidebarMenuSubItem({ className, ...props }) {
|
|
2061
|
+
return /* @__PURE__ */ jsx("li", {
|
|
2062
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
2063
|
+
"data-sidebar": "menu-sub-item",
|
|
2064
|
+
className: cn("group/menu-sub-item relative", className),
|
|
2065
|
+
...props
|
|
2066
|
+
});
|
|
2067
|
+
}
|
|
2068
|
+
function SidebarMenuSubButton({ asChild = false, size = "md", isActive = false, className, ...props }) {
|
|
2069
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Slot : "a", {
|
|
2070
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
2071
|
+
"data-sidebar": "menu-sub-button",
|
|
2072
|
+
"data-size": size,
|
|
2073
|
+
"data-active": isActive,
|
|
2074
|
+
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),
|
|
2075
|
+
...props
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
1951
2078
|
//#endregion
|
|
1952
2079
|
//#region src/blocks/auth/social-providers.tsx
|
|
1953
2080
|
const providerConfig = {
|
|
@@ -2769,6 +2896,227 @@ function FooterBlock({ copyright, links = [], logo, className }) {
|
|
|
2769
2896
|
});
|
|
2770
2897
|
}
|
|
2771
2898
|
//#endregion
|
|
2899
|
+
//#region src/blocks/layout/app-sidebar/team-switcher.tsx
|
|
2900
|
+
function TeamSwitcher({ teams, activeTeam: activeTeamProp, onTeamChange, onAddTeam }) {
|
|
2901
|
+
const { isMobile } = useSidebar();
|
|
2902
|
+
const [internalActive, setInternalActive] = React.useState(teams[0]);
|
|
2903
|
+
const activeTeam = activeTeamProp ?? internalActive;
|
|
2904
|
+
if (!activeTeam) return null;
|
|
2905
|
+
return /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
2906
|
+
asChild: true,
|
|
2907
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuButton, {
|
|
2908
|
+
size: "lg",
|
|
2909
|
+
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
2910
|
+
children: [
|
|
2911
|
+
/* @__PURE__ */ jsx("div", {
|
|
2912
|
+
className: "flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground",
|
|
2913
|
+
children: /* @__PURE__ */ jsx(activeTeam.logo, { className: "size-4" })
|
|
2914
|
+
}),
|
|
2915
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2916
|
+
className: "grid flex-1 text-left text-sm leading-tight",
|
|
2917
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2918
|
+
className: "truncate font-medium",
|
|
2919
|
+
children: activeTeam.name
|
|
2920
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2921
|
+
className: "truncate text-xs",
|
|
2922
|
+
children: activeTeam.plan
|
|
2923
|
+
})]
|
|
2924
|
+
}),
|
|
2925
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-auto" })
|
|
2926
|
+
]
|
|
2927
|
+
})
|
|
2928
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
2929
|
+
className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
|
|
2930
|
+
align: "start",
|
|
2931
|
+
side: isMobile ? "bottom" : "right",
|
|
2932
|
+
sideOffset: 4,
|
|
2933
|
+
children: [
|
|
2934
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, {
|
|
2935
|
+
className: "text-xs text-muted-foreground",
|
|
2936
|
+
children: "Teams"
|
|
2937
|
+
}),
|
|
2938
|
+
teams.map((team, index) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
2939
|
+
onClick: () => {
|
|
2940
|
+
setInternalActive(team);
|
|
2941
|
+
onTeamChange?.(team);
|
|
2942
|
+
},
|
|
2943
|
+
className: "gap-2 p-2",
|
|
2944
|
+
children: [
|
|
2945
|
+
/* @__PURE__ */ jsx("div", {
|
|
2946
|
+
className: "flex size-6 items-center justify-center rounded-md border",
|
|
2947
|
+
children: /* @__PURE__ */ jsx(team.logo, { className: "size-3.5 shrink-0" })
|
|
2948
|
+
}),
|
|
2949
|
+
team.name,
|
|
2950
|
+
/* @__PURE__ */ jsxs(DropdownMenuShortcut, { children: ["⌘", index + 1] })
|
|
2951
|
+
]
|
|
2952
|
+
}, team.name)),
|
|
2953
|
+
onAddTeam && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DropdownMenuSeparator, {}), /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
2954
|
+
className: "gap-2 p-2",
|
|
2955
|
+
onClick: onAddTeam,
|
|
2956
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
2957
|
+
className: "flex size-6 items-center justify-center rounded-md border bg-transparent",
|
|
2958
|
+
children: /* @__PURE__ */ jsx(Plus, { className: "size-4" })
|
|
2959
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
2960
|
+
className: "font-medium text-muted-foreground",
|
|
2961
|
+
children: "Add team"
|
|
2962
|
+
})]
|
|
2963
|
+
})] })
|
|
2964
|
+
]
|
|
2965
|
+
})] }) }) });
|
|
2966
|
+
}
|
|
2967
|
+
//#endregion
|
|
2968
|
+
//#region src/blocks/layout/app-sidebar/sidebar-nav.tsx
|
|
2969
|
+
function SidebarNav({ groups }) {
|
|
2970
|
+
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) => {
|
|
2971
|
+
if (item.items && item.items.length > 0) return /* @__PURE__ */ jsx(Collapsible, {
|
|
2972
|
+
asChild: true,
|
|
2973
|
+
defaultOpen: item.isActive,
|
|
2974
|
+
className: "group/collapsible",
|
|
2975
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
2976
|
+
asChild: true,
|
|
2977
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuButton, {
|
|
2978
|
+
tooltip: item.title,
|
|
2979
|
+
children: [
|
|
2980
|
+
item.icon && /* @__PURE__ */ jsx(item.icon, {}),
|
|
2981
|
+
/* @__PURE__ */ jsx("span", { children: item.title }),
|
|
2982
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
|
|
2983
|
+
]
|
|
2984
|
+
})
|
|
2985
|
+
}), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: item.items.map((subItem) => /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(SidebarMenuSubButton, {
|
|
2986
|
+
asChild: true,
|
|
2987
|
+
isActive: subItem.isActive,
|
|
2988
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
2989
|
+
href: subItem.url,
|
|
2990
|
+
onClick: (e) => {
|
|
2991
|
+
if (subItem.onClick) {
|
|
2992
|
+
e.preventDefault();
|
|
2993
|
+
subItem.onClick();
|
|
2994
|
+
}
|
|
2995
|
+
},
|
|
2996
|
+
children: /* @__PURE__ */ jsx("span", { children: subItem.title })
|
|
2997
|
+
})
|
|
2998
|
+
}) }, subItem.title)) }) })] })
|
|
2999
|
+
}, item.title);
|
|
3000
|
+
return /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, {
|
|
3001
|
+
asChild: true,
|
|
3002
|
+
tooltip: item.title,
|
|
3003
|
+
isActive: item.isActive,
|
|
3004
|
+
children: /* @__PURE__ */ jsxs("a", {
|
|
3005
|
+
href: item.url,
|
|
3006
|
+
onClick: (e) => {
|
|
3007
|
+
if (item.onClick) {
|
|
3008
|
+
e.preventDefault();
|
|
3009
|
+
item.onClick();
|
|
3010
|
+
}
|
|
3011
|
+
},
|
|
3012
|
+
children: [item.icon && /* @__PURE__ */ jsx(item.icon, {}), /* @__PURE__ */ jsx("span", { children: item.title })]
|
|
3013
|
+
})
|
|
3014
|
+
}) }, item.title);
|
|
3015
|
+
}) })] }, group.label ?? groupIdx)) });
|
|
3016
|
+
}
|
|
3017
|
+
//#endregion
|
|
3018
|
+
//#region src/blocks/layout/app-sidebar/sidebar-user.tsx
|
|
3019
|
+
function getInitials(name) {
|
|
3020
|
+
return name.split(" ").map((part) => part[0]).join("").toUpperCase().slice(0, 2);
|
|
3021
|
+
}
|
|
3022
|
+
function SidebarUserNav({ user, menuGroups, onLogout }) {
|
|
3023
|
+
const { isMobile } = useSidebar();
|
|
3024
|
+
return /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
3025
|
+
asChild: true,
|
|
3026
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuButton, {
|
|
3027
|
+
size: "lg",
|
|
3028
|
+
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
3029
|
+
children: [
|
|
3030
|
+
/* @__PURE__ */ jsxs(Avatar, {
|
|
3031
|
+
className: "h-8 w-8 rounded-lg",
|
|
3032
|
+
children: [user.avatar && /* @__PURE__ */ jsx(AvatarImage, {
|
|
3033
|
+
src: user.avatar,
|
|
3034
|
+
alt: user.name
|
|
3035
|
+
}), /* @__PURE__ */ jsx(AvatarFallback, {
|
|
3036
|
+
className: "rounded-lg",
|
|
3037
|
+
children: getInitials(user.name)
|
|
3038
|
+
})]
|
|
3039
|
+
}),
|
|
3040
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3041
|
+
className: "grid flex-1 text-left text-sm leading-tight",
|
|
3042
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3043
|
+
className: "truncate font-medium",
|
|
3044
|
+
children: user.name
|
|
3045
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
3046
|
+
className: "truncate text-xs",
|
|
3047
|
+
children: user.email
|
|
3048
|
+
})]
|
|
3049
|
+
}),
|
|
3050
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-auto size-4" })
|
|
3051
|
+
]
|
|
3052
|
+
})
|
|
3053
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
3054
|
+
className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
|
|
3055
|
+
side: isMobile ? "bottom" : "right",
|
|
3056
|
+
align: "end",
|
|
3057
|
+
sideOffset: 4,
|
|
3058
|
+
children: [
|
|
3059
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, {
|
|
3060
|
+
className: "p-0 font-normal",
|
|
3061
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
3062
|
+
className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm",
|
|
3063
|
+
children: [/* @__PURE__ */ jsxs(Avatar, {
|
|
3064
|
+
className: "h-8 w-8 rounded-lg",
|
|
3065
|
+
children: [user.avatar && /* @__PURE__ */ jsx(AvatarImage, {
|
|
3066
|
+
src: user.avatar,
|
|
3067
|
+
alt: user.name
|
|
3068
|
+
}), /* @__PURE__ */ jsx(AvatarFallback, {
|
|
3069
|
+
className: "rounded-lg",
|
|
3070
|
+
children: getInitials(user.name)
|
|
3071
|
+
})]
|
|
3072
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
3073
|
+
className: "grid flex-1 text-left text-sm leading-tight",
|
|
3074
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3075
|
+
className: "truncate font-medium",
|
|
3076
|
+
children: user.name
|
|
3077
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
3078
|
+
className: "truncate text-xs",
|
|
3079
|
+
children: user.email
|
|
3080
|
+
})]
|
|
3081
|
+
})]
|
|
3082
|
+
})
|
|
3083
|
+
}),
|
|
3084
|
+
menuGroups?.map((group, groupIdx) => /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx(DropdownMenuSeparator, {}), /* @__PURE__ */ jsx(DropdownMenuGroup, { children: group.map((item) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
3085
|
+
onClick: item.onClick,
|
|
3086
|
+
children: [item.icon && /* @__PURE__ */ jsx(item.icon, {}), item.label]
|
|
3087
|
+
}, item.label)) })] }, groupIdx)),
|
|
3088
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
3089
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
3090
|
+
onClick: onLogout,
|
|
3091
|
+
children: [/* @__PURE__ */ jsx(LogOut, {}), "Log out"]
|
|
3092
|
+
})
|
|
3093
|
+
]
|
|
3094
|
+
})] }) }) });
|
|
3095
|
+
}
|
|
3096
|
+
//#endregion
|
|
3097
|
+
//#region src/blocks/layout/app-sidebar/app-sidebar-block.tsx
|
|
3098
|
+
function AppSidebarBlock({ teams, activeTeam, onTeamChange, onAddTeam, navGroups, user, userMenuGroups, onLogout, ...sidebarProps }) {
|
|
3099
|
+
return /* @__PURE__ */ jsxs(Sidebar, {
|
|
3100
|
+
collapsible: "icon",
|
|
3101
|
+
...sidebarProps,
|
|
3102
|
+
children: [
|
|
3103
|
+
/* @__PURE__ */ jsx(SidebarHeader, { children: /* @__PURE__ */ jsx(TeamSwitcher, {
|
|
3104
|
+
teams,
|
|
3105
|
+
activeTeam,
|
|
3106
|
+
onTeamChange,
|
|
3107
|
+
onAddTeam
|
|
3108
|
+
}) }),
|
|
3109
|
+
/* @__PURE__ */ jsx(SidebarContent, { children: navGroups && navGroups.length > 0 && /* @__PURE__ */ jsx(SidebarNav, { groups: navGroups }) }),
|
|
3110
|
+
/* @__PURE__ */ jsx(SidebarFooter, { children: /* @__PURE__ */ jsx(SidebarUserNav, {
|
|
3111
|
+
user,
|
|
3112
|
+
menuGroups: userMenuGroups,
|
|
3113
|
+
onLogout
|
|
3114
|
+
}) }),
|
|
3115
|
+
/* @__PURE__ */ jsx(SidebarRail, {})
|
|
3116
|
+
]
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3119
|
+
//#endregion
|
|
2772
3120
|
//#region src/blocks/settings/profile-settings-block.tsx
|
|
2773
3121
|
function ProfileSettingsBlock({ initialData, onSave, onAvatarChange, loading = false, error, disabled = false, className }) {
|
|
2774
3122
|
const fileInputRef = React.useRef(null);
|
|
@@ -3053,6 +3401,6 @@ function NotificationSettingsBlock({ groups, onSave, loading = false, error, dis
|
|
|
3053
3401
|
});
|
|
3054
3402
|
}
|
|
3055
3403
|
//#endregion
|
|
3056
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger,
|
|
3404
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, 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, 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, cn, navigationMenuTriggerStyle, progressBarVariants, spinnerVariants, toast, useDensity, useFormContext, useIsMobile, useScrollReveal, useSidebar, useTheme };
|
|
3057
3405
|
|
|
3058
3406
|
//# sourceMappingURL=index.mjs.map
|