react-shadcn-kit 0.0.1 → 0.0.3
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/README.md +6 -6
- package/dist/assets/global.css +1 -1
- package/dist/atoms/chart.d.ts +12 -2
- package/dist/atoms/chart.js +35 -35
- package/dist/atoms/sidebar.d.ts +2 -1
- package/dist/atoms/sidebar.js +44 -42
- package/dist/config/blog-layout.config.js +19 -0
- package/dist/config/default-Sidebar.js +83 -0
- package/dist/config/default-layout.js +21 -0
- package/dist/config/default-navigation.js +3 -82
- package/dist/config/sidebar.config.js +11 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +348 -341
- package/dist/layouts/blog-layout.d.ts +7 -0
- package/dist/layouts/blog-layout.js +29 -0
- package/dist/layouts/default-layout.d.ts +7 -0
- package/dist/layouts/default-layout.js +54 -0
- package/dist/layouts/sidebar-scroll-layout.d.ts +8 -0
- package/dist/layouts/sidebar-scroll-layout.js +49 -0
- package/dist/molecules/theme-toggle.d.ts +9 -0
- package/dist/molecules/theme-toggle.js +30 -0
- package/dist/molecules/user-menu.d.ts +18 -0
- package/dist/molecules/user-menu.js +29 -0
- package/dist/{molecules → organisms}/app-navbar.d.ts +4 -2
- package/dist/organisms/app-navbar.js +89 -0
- package/dist/{molecules → organisms}/app-sidebar.d.ts +4 -1
- package/dist/organisms/app-sidebar.js +169 -0
- package/package.json +33 -10
- package/dist/molecules/app-navbar.js +0 -117
- package/dist/molecules/app-sidebar.js +0 -121
- package/dist/organisms/layout.d.ts +0 -3
- package/dist/organisms/layout.js +0 -16
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SidebarConfig } from '../types/navigation';
|
|
2
|
+
export default function BlogLayout({ children, userConfig, scrollable, maxWidth, }: {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
userConfig?: Partial<SidebarConfig>;
|
|
5
|
+
scrollable?: boolean;
|
|
6
|
+
maxWidth?: string;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { SidebarProvider as t, SidebarInset as f, SidebarTrigger as m } from "../atoms/sidebar.js";
|
|
3
|
+
import { AppSidebar as d } from "../organisms/app-sidebar.js";
|
|
4
|
+
import { blogLayoutConfig as n } from "../config/blog-layout.config.js";
|
|
5
|
+
function b({
|
|
6
|
+
children: i,
|
|
7
|
+
userConfig: a,
|
|
8
|
+
scrollable: s = !1,
|
|
9
|
+
maxWidth: r
|
|
10
|
+
}) {
|
|
11
|
+
const o = { ...n, ...a };
|
|
12
|
+
return /* @__PURE__ */ l(t, { style: o.style, children: [
|
|
13
|
+
/* @__PURE__ */ e(d, { config: o, scrollable: s }),
|
|
14
|
+
/* @__PURE__ */ l(f, { children: [
|
|
15
|
+
/* @__PURE__ */ e("header", { className: "flex h-16 shrink-0 items-center gap-2 border-b px-4", children: /* @__PURE__ */ e(m, { className: "-ml-1" }) }),
|
|
16
|
+
/* @__PURE__ */ e(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
className: "flex flex-1 flex-col gap-4 p-4 mx-auto w-full",
|
|
20
|
+
style: r ? { maxWidth: r } : void 0,
|
|
21
|
+
children: i
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
] })
|
|
25
|
+
] });
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
b as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LayoutConfig } from '../types/layout';
|
|
2
|
+
export default function Layout({ children, userConfig, scrollable, maxWidth, }: {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
userConfig?: Partial<LayoutConfig>;
|
|
5
|
+
scrollable?: boolean;
|
|
6
|
+
maxWidth?: string;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as r, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { SidebarProvider as v, SidebarInset as f } from "../atoms/sidebar.js";
|
|
3
|
+
import { AppSidebar as h } from "../organisms/app-sidebar.js";
|
|
4
|
+
import { AppNavbar as m } from "../organisms/app-navbar.js";
|
|
5
|
+
import { defaultSidebarConfig as p } from "../config/default-Sidebar.js";
|
|
6
|
+
import { defaultLayoutConfig as i } from "../config/default-layout.js";
|
|
7
|
+
function y({
|
|
8
|
+
children: o,
|
|
9
|
+
userConfig: e,
|
|
10
|
+
scrollable: t = !1,
|
|
11
|
+
maxWidth: n
|
|
12
|
+
}) {
|
|
13
|
+
const a = {
|
|
14
|
+
...i,
|
|
15
|
+
...e,
|
|
16
|
+
sidebar: { ...i.sidebar, ...e?.sidebar || {} },
|
|
17
|
+
navbar: { ...i.navbar, ...e?.navbar || {} }
|
|
18
|
+
}, b = {
|
|
19
|
+
...a.navbar,
|
|
20
|
+
branding: a.sidebar?.hasBranding ? p.branding : void 0
|
|
21
|
+
}, l = {
|
|
22
|
+
...a.sidebar?.width ? { "--sidebar-width": a.sidebar.width } : {}
|
|
23
|
+
}, s = a.sidebar?.visible ?? !0, c = a.navbar?.visible ?? !0;
|
|
24
|
+
return /* @__PURE__ */ r("div", { className: "[--header-height:calc(--spacing(14))]", children: /* @__PURE__ */ d(v, { className: "flex flex-col", style: l, children: [
|
|
25
|
+
c && /* @__PURE__ */ r(
|
|
26
|
+
m,
|
|
27
|
+
{
|
|
28
|
+
config: b,
|
|
29
|
+
className: a.navbar?.transparent ? "bg-transparent" : void 0,
|
|
30
|
+
style: {
|
|
31
|
+
backgroundColor: a.navbar?.transparent ? "transparent" : a.navbar?.color,
|
|
32
|
+
height: a.navbar?.height,
|
|
33
|
+
boxShadow: a.navbar?.shadow ? void 0 : "none"
|
|
34
|
+
},
|
|
35
|
+
showSidebarTrigger: s
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ d("div", { className: "flex flex-1", children: [
|
|
39
|
+
s && /* @__PURE__ */ r(
|
|
40
|
+
h,
|
|
41
|
+
{
|
|
42
|
+
hideBranding: !0,
|
|
43
|
+
side: a.sidebar?.placement || "left",
|
|
44
|
+
scrollable: t,
|
|
45
|
+
className: "pt-14"
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ r(f, { children: /* @__PURE__ */ r("div", { className: "p-4 mx-auto w-full", style: n ? { maxWidth: n } : void 0, children: o }) })
|
|
49
|
+
] })
|
|
50
|
+
] }) });
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
y as default
|
|
54
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LayoutConfig } from '../types/layout';
|
|
2
|
+
export default function SidebarScrollLayout({ children, userConfig, scrollable, // Default to true for this specific layout variation
|
|
3
|
+
maxWidth, }: {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
userConfig?: Partial<LayoutConfig>;
|
|
6
|
+
scrollable?: boolean;
|
|
7
|
+
maxWidth?: string;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { SidebarProvider as c, SidebarInset as v } from "../atoms/sidebar.js";
|
|
3
|
+
import { AppSidebar as h } from "../organisms/app-sidebar.js";
|
|
4
|
+
import { AppNavbar as p } from "../organisms/app-navbar.js";
|
|
5
|
+
import { defaultLayoutConfig as i } from "../config/default-layout.js";
|
|
6
|
+
function S({
|
|
7
|
+
children: n,
|
|
8
|
+
userConfig: e,
|
|
9
|
+
scrollable: o = !0,
|
|
10
|
+
// Default to true for this specific layout variation
|
|
11
|
+
maxWidth: s
|
|
12
|
+
}) {
|
|
13
|
+
const a = {
|
|
14
|
+
...i,
|
|
15
|
+
...e,
|
|
16
|
+
sidebar: { ...i.sidebar, ...e?.sidebar || {} },
|
|
17
|
+
navbar: { ...i.navbar, ...e?.navbar || {} }
|
|
18
|
+
}, b = {
|
|
19
|
+
...a.sidebar?.width ? { "--sidebar-width": a.sidebar.width } : {}
|
|
20
|
+
}, d = a.sidebar?.visible ?? !0, l = a.navbar?.visible ?? !0;
|
|
21
|
+
return /* @__PURE__ */ r("div", { className: "[--header-height:calc(--spacing(14))]", children: /* @__PURE__ */ t(c, { className: "flex flex-col", style: b, children: [
|
|
22
|
+
l && /* @__PURE__ */ r(
|
|
23
|
+
p,
|
|
24
|
+
{
|
|
25
|
+
className: a.navbar?.transparent ? "bg-transparent" : void 0,
|
|
26
|
+
style: {
|
|
27
|
+
backgroundColor: a.navbar?.transparent ? "transparent" : a.navbar?.color,
|
|
28
|
+
height: a.navbar?.height,
|
|
29
|
+
boxShadow: a.navbar?.shadow ? void 0 : "none"
|
|
30
|
+
},
|
|
31
|
+
showSidebarTrigger: d
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ t("div", { className: "flex flex-1", children: [
|
|
35
|
+
d && /* @__PURE__ */ r(
|
|
36
|
+
h,
|
|
37
|
+
{
|
|
38
|
+
hideBranding: a.sidebar?.hasBranding === !1,
|
|
39
|
+
side: a.sidebar?.placement || "left",
|
|
40
|
+
scrollable: o
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ r(v, { children: /* @__PURE__ */ r("div", { className: "p-4 mx-auto w-full", style: s ? { maxWidth: s } : void 0, children: n }) })
|
|
44
|
+
] })
|
|
45
|
+
] }) });
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
S as default
|
|
49
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ThemeToggleProps {
|
|
3
|
+
align?: "center" | "start" | "end";
|
|
4
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
5
|
+
sideOffset?: number;
|
|
6
|
+
className?: string;
|
|
7
|
+
trigger?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function ThemeToggle({ align, side, sideOffset, className, trigger, }: ThemeToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Sun as m, Moon as c } from "lucide-react";
|
|
3
|
+
import { useTheme as d } from "next-themes";
|
|
4
|
+
import { Button as h } from "../atoms/button.js";
|
|
5
|
+
import { DropdownMenu as p, DropdownMenuTrigger as u, DropdownMenuContent as k, DropdownMenuItem as n } from "../atoms/dropdown-menu.js";
|
|
6
|
+
import { cn as f } from "../lib/utils.js";
|
|
7
|
+
function N({
|
|
8
|
+
align: a = "end",
|
|
9
|
+
side: l = "bottom",
|
|
10
|
+
sideOffset: s = 4,
|
|
11
|
+
className: i,
|
|
12
|
+
trigger: t
|
|
13
|
+
}) {
|
|
14
|
+
const { setTheme: r } = d();
|
|
15
|
+
return /* @__PURE__ */ o(p, { children: [
|
|
16
|
+
/* @__PURE__ */ e(u, { asChild: !0, children: t || /* @__PURE__ */ o(h, { variant: "ghost", size: "icon", className: f("h-9 w-9", i), children: [
|
|
17
|
+
/* @__PURE__ */ e(m, { className: "h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" }),
|
|
18
|
+
/* @__PURE__ */ e(c, { className: "absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" }),
|
|
19
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "Toggle theme" })
|
|
20
|
+
] }) }),
|
|
21
|
+
/* @__PURE__ */ o(k, { align: a, side: l, sideOffset: s, children: [
|
|
22
|
+
/* @__PURE__ */ e(n, { onClick: () => r("light"), children: "Light" }),
|
|
23
|
+
/* @__PURE__ */ e(n, { onClick: () => r("dark"), children: "Dark" }),
|
|
24
|
+
/* @__PURE__ */ e(n, { onClick: () => r("system"), children: "System" })
|
|
25
|
+
] })
|
|
26
|
+
] });
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
N as ThemeToggle
|
|
30
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface UserMenuProps {
|
|
3
|
+
user: {
|
|
4
|
+
name: string;
|
|
5
|
+
email: string;
|
|
6
|
+
avatar?: string;
|
|
7
|
+
};
|
|
8
|
+
items?: Array<{
|
|
9
|
+
label: string;
|
|
10
|
+
href?: string;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
icon?: React.ComponentType<{
|
|
13
|
+
className?: string;
|
|
14
|
+
}>;
|
|
15
|
+
}>;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function UserMenu({ user, items, className }: UserMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import { Avatar as t, AvatarImage as m, AvatarFallback as h } from "../atoms/avatar.js";
|
|
4
|
+
import { Button as s } from "../atoms/button.js";
|
|
5
|
+
import { DropdownMenu as p, DropdownMenuTrigger as f, DropdownMenuContent as u, DropdownMenuLabel as g, DropdownMenuSeparator as x, DropdownMenuItem as o } from "../atoms/dropdown-menu.js";
|
|
6
|
+
import { cn as w } from "../lib/utils.js";
|
|
7
|
+
function b({ user: n, items: l, className: i }) {
|
|
8
|
+
return /* @__PURE__ */ a(p, { children: [
|
|
9
|
+
/* @__PURE__ */ e(f, { asChild: !0, children: /* @__PURE__ */ e(s, { variant: "ghost", size: "icon", className: w("rounded-full", i), children: /* @__PURE__ */ a(t, { className: "h-8 w-8", children: [
|
|
10
|
+
/* @__PURE__ */ e(m, { src: n.avatar, alt: n.name }),
|
|
11
|
+
/* @__PURE__ */ e(h, { children: n.name?.[0] ?? "U" })
|
|
12
|
+
] }) }) }),
|
|
13
|
+
/* @__PURE__ */ a(u, { align: "end", children: [
|
|
14
|
+
/* @__PURE__ */ e(g, { className: "p-0 font-normal", children: /* @__PURE__ */ a("div", { className: "flex flex-col space-y-1", children: [
|
|
15
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium leading-none", children: n.name }),
|
|
16
|
+
/* @__PURE__ */ e("p", { className: "text-xs leading-none text-muted-foreground", children: n.email })
|
|
17
|
+
] }) }),
|
|
18
|
+
/* @__PURE__ */ e(x, {}),
|
|
19
|
+
l?.map((r, c) => /* @__PURE__ */ e(o, { asChild: !0, children: /* @__PURE__ */ a("a", { href: r.href ?? "#", onClick: r.onClick, children: [
|
|
20
|
+
r.icon && d.createElement(r.icon, { className: "mr-2 h-4 w-4" }),
|
|
21
|
+
/* @__PURE__ */ e("span", { children: r.label })
|
|
22
|
+
] }) }, c)),
|
|
23
|
+
!l?.length && /* @__PURE__ */ e(o, { asChild: !0, children: /* @__PURE__ */ e("a", { href: "#profile", children: "Profile" }) })
|
|
24
|
+
] })
|
|
25
|
+
] });
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
b as UserMenu
|
|
29
|
+
};
|
|
@@ -3,9 +3,11 @@ interface AppNavbarProps {
|
|
|
3
3
|
config?: Partial<NavbarConfig>;
|
|
4
4
|
showSearch?: boolean;
|
|
5
5
|
showSidebarTrigger?: boolean;
|
|
6
|
-
showThemeToggle?: boolean;
|
|
7
6
|
showUserMenu?: boolean;
|
|
7
|
+
showThemeToggle?: boolean;
|
|
8
8
|
showNotifications?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
style?: React.CSSProperties;
|
|
9
11
|
}
|
|
10
|
-
export declare function AppNavbar({ config, showSearch, showSidebarTrigger,
|
|
12
|
+
export declare function AppNavbar({ config, showSearch, showSidebarTrigger, showUserMenu, showThemeToggle, showNotifications, className, style, }: AppNavbarProps): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsxs as t, Fragment as h, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Search as f, Bell as g } from "lucide-react";
|
|
3
|
+
import { Input as N } from "../atoms/input.js";
|
|
4
|
+
import { SidebarTrigger as b } from "../atoms/sidebar.js";
|
|
5
|
+
import { Separator as x } from "../atoms/separator.js";
|
|
6
|
+
import { defaultNavbarConfig as n } from "../config/default-navigation.js";
|
|
7
|
+
import { Button as w } from "../atoms/button.js";
|
|
8
|
+
import { DropdownMenu as M, DropdownMenuTrigger as v, DropdownMenuContent as D, DropdownMenuLabel as I, DropdownMenuSeparator as C, DropdownMenuItem as P } from "../atoms/dropdown-menu.js";
|
|
9
|
+
import { ThemeToggle as S } from "../molecules/theme-toggle.js";
|
|
10
|
+
import { UserMenu as T } from "../molecules/user-menu.js";
|
|
11
|
+
function q({
|
|
12
|
+
config: a,
|
|
13
|
+
showSearch: o = !0,
|
|
14
|
+
showSidebarTrigger: l = !0,
|
|
15
|
+
showUserMenu: m = !0,
|
|
16
|
+
showThemeToggle: c = !0,
|
|
17
|
+
showNotifications: d = !0,
|
|
18
|
+
className: i,
|
|
19
|
+
style: u
|
|
20
|
+
}) {
|
|
21
|
+
const r = {
|
|
22
|
+
items: a?.items || n.items,
|
|
23
|
+
searchPlaceholder: a?.searchPlaceholder || n.searchPlaceholder,
|
|
24
|
+
user: a?.user || n.user,
|
|
25
|
+
userMenuItems: a?.userMenuItems || n.userMenuItems,
|
|
26
|
+
notifications: a?.notifications || n.notifications,
|
|
27
|
+
branding: a?.branding || n.branding
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ t(
|
|
30
|
+
"header",
|
|
31
|
+
{
|
|
32
|
+
className: "flex h-16 shrink-0 items-center gap-2 border-b px-4 bg-background sticky top-0 z-50" + (i ? ` ${i}` : ""),
|
|
33
|
+
style: u,
|
|
34
|
+
children: [
|
|
35
|
+
l && /* @__PURE__ */ t(h, { children: [
|
|
36
|
+
/* @__PURE__ */ e(b, { className: "-ml-1" }),
|
|
37
|
+
/* @__PURE__ */ e(x, { orientation: "vertical", className: "mr-2 h-4" })
|
|
38
|
+
] }),
|
|
39
|
+
r.branding && /* @__PURE__ */ t("a", { href: r.branding.href || "#", className: "flex items-center gap-2 mr-4", children: [
|
|
40
|
+
r.branding.logo && /* @__PURE__ */ e(r.branding.logo, { className: "h-6 w-6" }),
|
|
41
|
+
/* @__PURE__ */ e("span", { className: "font-semibold", children: r.branding.name })
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ t("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
44
|
+
o && /* @__PURE__ */ t("div", { className: "relative", children: [
|
|
45
|
+
/* @__PURE__ */ e(f, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
46
|
+
/* @__PURE__ */ e(
|
|
47
|
+
N,
|
|
48
|
+
{
|
|
49
|
+
placeholder: r.searchPlaceholder,
|
|
50
|
+
className: "pl-8 w-[200px] lg:w-[300px]"
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] }),
|
|
54
|
+
c && /* @__PURE__ */ e(S, {}),
|
|
55
|
+
m && r.user && /* @__PURE__ */ e(T, { user: r.user, items: r.userMenuItems }),
|
|
56
|
+
d && r.notifications && /* @__PURE__ */ t(M, { children: [
|
|
57
|
+
/* @__PURE__ */ e(v, { asChild: !0, children: /* @__PURE__ */ t(w, { variant: "ghost", size: "icon", className: "relative", children: [
|
|
58
|
+
/* @__PURE__ */ e(g, { className: "h-5 w-5" }),
|
|
59
|
+
r.notifications.some((s) => !s.read) && /* @__PURE__ */ e("span", { className: "absolute right-2 top-2 h-2 w-2 rounded-full bg-red-600" }),
|
|
60
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "Notifications" })
|
|
61
|
+
] }) }),
|
|
62
|
+
/* @__PURE__ */ t(D, { align: "end", className: "w-80", children: [
|
|
63
|
+
/* @__PURE__ */ e(I, { children: "Notifications" }),
|
|
64
|
+
/* @__PURE__ */ e(C, {}),
|
|
65
|
+
r.notifications.map((s, p) => /* @__PURE__ */ t(
|
|
66
|
+
P,
|
|
67
|
+
{
|
|
68
|
+
className: "flex flex-col items-start gap-1 p-3 cursor-pointer",
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ t("div", { className: "flex w-full items-center justify-between", children: [
|
|
71
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: s.title }),
|
|
72
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: s.date })
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground line-clamp-2", children: s.description })
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
p
|
|
78
|
+
)),
|
|
79
|
+
r.notifications.length === 0 && /* @__PURE__ */ e("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "No new notifications" })
|
|
80
|
+
] })
|
|
81
|
+
] })
|
|
82
|
+
] })
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
q as AppNavbar
|
|
89
|
+
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { Sidebar } from '../atoms/sidebar';
|
|
1
2
|
import { SidebarConfig } from '../types/navigation';
|
|
2
3
|
interface AppSidebarProps {
|
|
3
4
|
config?: Partial<SidebarConfig>;
|
|
4
5
|
side?: "left" | "right";
|
|
5
6
|
variant?: "sidebar" | "floating" | "inset";
|
|
6
7
|
collapsible?: "offcanvas" | "icon" | "none";
|
|
8
|
+
hideBranding?: boolean;
|
|
9
|
+
showThemeToggle?: boolean;
|
|
7
10
|
}
|
|
8
|
-
export declare function AppSidebar({ config, side, variant, collapsible, }: AppSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function AppSidebar({ config, side, variant, collapsible, hideBranding, showThemeToggle, className, style, scrollable, ...props }: AppSidebarProps & React.ComponentProps<typeof Sidebar>): import("react/jsx-runtime").JSX.Element;
|
|
9
12
|
export {};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDown as m, Sun as B, Moon as F, LogOut as E } from "lucide-react";
|
|
3
|
+
import { useTheme as H } from "next-themes";
|
|
4
|
+
import { Sidebar as J, SidebarHeader as f, SidebarMenu as d, SidebarMenuItem as c, SidebarMenuButton as t, SidebarContent as K, SidebarGroup as P, SidebarGroupLabel as g, SidebarGroupContent as N, SidebarMenuSub as Q, SidebarMenuSubItem as R, SidebarMenuSubButton as U, SidebarFooter as V } from "../atoms/sidebar.js";
|
|
5
|
+
import { Collapsible as x, CollapsibleTrigger as v, CollapsibleContent as C } from "../atoms/collapsible.js";
|
|
6
|
+
import { cn as W } from "../lib/utils.js";
|
|
7
|
+
import { defaultSidebarConfig as n } from "../config/default-Sidebar.js";
|
|
8
|
+
import { defaultSidebarStyles as b } from "../config/sidebar.config.js";
|
|
9
|
+
import { Avatar as S, AvatarImage as w, AvatarFallback as M } from "../atoms/avatar.js";
|
|
10
|
+
import { DropdownMenu as y, DropdownMenuTrigger as k, DropdownMenuContent as A, DropdownMenuItem as o, DropdownMenuLabel as X, DropdownMenuSeparator as Y } from "../atoms/dropdown-menu.js";
|
|
11
|
+
function te({
|
|
12
|
+
config: i,
|
|
13
|
+
side: z = "left",
|
|
14
|
+
variant: D,
|
|
15
|
+
collapsible: I,
|
|
16
|
+
hideBranding: T = !1,
|
|
17
|
+
showThemeToggle: L = !0,
|
|
18
|
+
className: j,
|
|
19
|
+
style: O,
|
|
20
|
+
scrollable: G,
|
|
21
|
+
...q
|
|
22
|
+
}) {
|
|
23
|
+
const { setTheme: u } = H(), r = {
|
|
24
|
+
groups: i?.groups || n.groups,
|
|
25
|
+
header: i?.header || n.header,
|
|
26
|
+
footer: i?.footer || n.footer,
|
|
27
|
+
user: i?.user || n.user,
|
|
28
|
+
userMenuItems: i?.userMenuItems || n.userMenuItems,
|
|
29
|
+
branding: T ? void 0 : i?.branding || n.branding,
|
|
30
|
+
fixed: i?.fixed ?? n.fixed,
|
|
31
|
+
variant: D ?? i?.variant ?? b.variant,
|
|
32
|
+
collapsible: I ?? i?.collapsible ?? b.collapsible,
|
|
33
|
+
scrollable: G ?? i?.scrollable ?? !1,
|
|
34
|
+
style: { ...b.style, ...i?.style, ...O },
|
|
35
|
+
className: i?.className
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ a(
|
|
38
|
+
J,
|
|
39
|
+
{
|
|
40
|
+
side: z,
|
|
41
|
+
variant: r.variant,
|
|
42
|
+
collapsible: r.collapsible,
|
|
43
|
+
scrollable: r.scrollable,
|
|
44
|
+
className: W(
|
|
45
|
+
r.fixed ? void 0 : "absolute h-full",
|
|
46
|
+
r.className,
|
|
47
|
+
j
|
|
48
|
+
),
|
|
49
|
+
style: r.style,
|
|
50
|
+
...q,
|
|
51
|
+
children: [
|
|
52
|
+
r.header && /* @__PURE__ */ e(f, { children: r.header }),
|
|
53
|
+
r.branding && !r.header && /* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(c, { children: /* @__PURE__ */ e(t, { size: "lg", asChild: !0, children: /* @__PURE__ */ a("a", { href: r.branding.href || "#", children: [
|
|
54
|
+
/* @__PURE__ */ e("div", { className: "bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg", children: r.branding.logo && /* @__PURE__ */ e(r.branding.logo, { className: "size-4" }) }),
|
|
55
|
+
/* @__PURE__ */ a("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
56
|
+
/* @__PURE__ */ e("span", { className: "truncate font-semibold", children: r.branding.name }),
|
|
57
|
+
/* @__PURE__ */ e("span", { className: "truncate text-xs", children: "Enterprise" })
|
|
58
|
+
] })
|
|
59
|
+
] }) }) }) }) }),
|
|
60
|
+
/* @__PURE__ */ e(K, { children: r.groups.map((s, p) => /* @__PURE__ */ a(P, { children: [
|
|
61
|
+
s.label && (s.collapsible ? /* @__PURE__ */ a(x, { defaultOpen: !0, className: "group/collapsible", children: [
|
|
62
|
+
/* @__PURE__ */ e(g, { asChild: !0, children: /* @__PURE__ */ a(v, { children: [
|
|
63
|
+
s.label,
|
|
64
|
+
/* @__PURE__ */ e(m, { className: "ml-auto transition-transform group-data-[state=open]/collapsible:rotate-180" })
|
|
65
|
+
] }) }),
|
|
66
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(N, { children: /* @__PURE__ */ e(d, { children: s.items.map((l) => /* @__PURE__ */ e(c, { children: /* @__PURE__ */ e(t, { asChild: !0, isActive: l.isActive, children: /* @__PURE__ */ a("a", { href: l.href, children: [
|
|
67
|
+
l.icon && /* @__PURE__ */ e(l.icon, {}),
|
|
68
|
+
/* @__PURE__ */ e("span", { children: l.label })
|
|
69
|
+
] }) }) }, l.href)) }) }) })
|
|
70
|
+
] }) : /* @__PURE__ */ e(g, { children: s.label })),
|
|
71
|
+
!s.collapsible && /* @__PURE__ */ e(N, { children: /* @__PURE__ */ e(d, { children: s.items.map((l) => /* @__PURE__ */ e(c, { children: l.items && l.items.length > 0 ? /* @__PURE__ */ a(x, { className: "group/collapsible", children: [
|
|
72
|
+
/* @__PURE__ */ e(t, { asChild: !0, isActive: l.isActive, children: /* @__PURE__ */ a(v, { children: [
|
|
73
|
+
l.icon && /* @__PURE__ */ e(l.icon, {}),
|
|
74
|
+
/* @__PURE__ */ e("span", { children: l.label }),
|
|
75
|
+
/* @__PURE__ */ e(m, { className: "ml-auto transition-transform group-data-[state=open]/collapsible:rotate-180" })
|
|
76
|
+
] }) }),
|
|
77
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(Q, { children: l.items.map((h) => /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(U, { asChild: !0, isActive: h.isActive, children: /* @__PURE__ */ e("a", { href: h.href, children: /* @__PURE__ */ e("span", { children: h.label }) }) }) }, h.href)) }) })
|
|
78
|
+
] }) : /* @__PURE__ */ e(t, { asChild: !0, isActive: l.isActive, children: /* @__PURE__ */ a("a", { href: l.href, children: [
|
|
79
|
+
l.icon && /* @__PURE__ */ e(l.icon, {}),
|
|
80
|
+
/* @__PURE__ */ e("span", { children: l.label })
|
|
81
|
+
] }) }) }, l.href)) }) })
|
|
82
|
+
] }, s.label || p)) }),
|
|
83
|
+
/* @__PURE__ */ a(V, { children: [
|
|
84
|
+
L && /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(c, { children: /* @__PURE__ */ a(y, { children: [
|
|
85
|
+
/* @__PURE__ */ e(k, { asChild: !0, children: /* @__PURE__ */ a(t, { size: "lg", children: [
|
|
86
|
+
/* @__PURE__ */ a("div", { className: "flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground", children: [
|
|
87
|
+
/* @__PURE__ */ e(B, { className: "size-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" }),
|
|
88
|
+
/* @__PURE__ */ e(F, { className: "absolute size-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" })
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ a("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
91
|
+
/* @__PURE__ */ e("span", { className: "truncate font-semibold", children: "Theme" }),
|
|
92
|
+
/* @__PURE__ */ e("span", { className: "truncate text-xs", children: "Toggle theme" })
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ e(m, { className: "ml-auto size-4" })
|
|
95
|
+
] }) }),
|
|
96
|
+
/* @__PURE__ */ a(
|
|
97
|
+
A,
|
|
98
|
+
{
|
|
99
|
+
className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
|
|
100
|
+
side: "bottom",
|
|
101
|
+
align: "end",
|
|
102
|
+
sideOffset: 4,
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ e(o, { onClick: () => u("light"), children: "Light" }),
|
|
105
|
+
/* @__PURE__ */ e(o, { onClick: () => u("dark"), children: "Dark" }),
|
|
106
|
+
/* @__PURE__ */ e(o, { onClick: () => u("system"), children: "System" })
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
] }) }) }),
|
|
111
|
+
r.user && /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(c, { children: /* @__PURE__ */ a(y, { children: [
|
|
112
|
+
/* @__PURE__ */ e(k, { asChild: !0, children: /* @__PURE__ */ a(
|
|
113
|
+
t,
|
|
114
|
+
{
|
|
115
|
+
size: "lg",
|
|
116
|
+
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ a(S, { className: "h-8 w-8 rounded-lg", children: [
|
|
119
|
+
/* @__PURE__ */ e(w, { src: r.user.avatar, alt: r.user.name }),
|
|
120
|
+
/* @__PURE__ */ e(M, { className: "rounded-lg", children: "CN" })
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ a("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
123
|
+
/* @__PURE__ */ e("span", { className: "truncate font-semibold", children: r.user.name }),
|
|
124
|
+
/* @__PURE__ */ e("span", { className: "truncate text-xs", children: r.user.email })
|
|
125
|
+
] }),
|
|
126
|
+
/* @__PURE__ */ e(m, { className: "ml-auto size-4" })
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
) }),
|
|
130
|
+
/* @__PURE__ */ a(
|
|
131
|
+
A,
|
|
132
|
+
{
|
|
133
|
+
className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
|
|
134
|
+
side: "bottom",
|
|
135
|
+
align: "end",
|
|
136
|
+
sideOffset: 4,
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ e(X, { className: "p-0 font-normal", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
|
|
139
|
+
/* @__PURE__ */ a(S, { className: "h-8 w-8 rounded-lg", children: [
|
|
140
|
+
/* @__PURE__ */ e(w, { src: r.user.avatar, alt: r.user.name }),
|
|
141
|
+
/* @__PURE__ */ e(M, { className: "rounded-lg", children: "CN" })
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ a("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
144
|
+
/* @__PURE__ */ e("span", { className: "truncate font-semibold", children: r.user.name }),
|
|
145
|
+
/* @__PURE__ */ e("span", { className: "truncate text-xs", children: r.user.email })
|
|
146
|
+
] })
|
|
147
|
+
] }) }),
|
|
148
|
+
/* @__PURE__ */ e(Y, {}),
|
|
149
|
+
r.userMenuItems?.map((s, p) => /* @__PURE__ */ e(o, { asChild: !0, children: /* @__PURE__ */ a("a", { href: s.href || "#", onClick: s.onClick, children: [
|
|
150
|
+
s.icon && /* @__PURE__ */ e(s.icon, { className: "mr-2 h-4 w-4" }),
|
|
151
|
+
/* @__PURE__ */ e("span", { children: s.label })
|
|
152
|
+
] }) }, p)),
|
|
153
|
+
!r.userMenuItems && /* @__PURE__ */ a(o, { children: [
|
|
154
|
+
/* @__PURE__ */ e(E, { className: "mr-2 h-4 w-4" }),
|
|
155
|
+
/* @__PURE__ */ e("span", { children: "Log out" })
|
|
156
|
+
] })
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
] }) }) }),
|
|
161
|
+
r.footer
|
|
162
|
+
] })
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
te as AppSidebar
|
|
169
|
+
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "react-shadcn-kit",
|
|
3
3
|
"author": "Tushar Yadav",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.3",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
@@ -15,15 +15,37 @@
|
|
|
15
15
|
],
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
20
|
},
|
|
21
|
-
"./atoms/*":
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"./
|
|
26
|
-
|
|
21
|
+
"./atoms/*": {
|
|
22
|
+
"types": "./dist/atoms/*.d.ts",
|
|
23
|
+
"import": "./dist/atoms/*.js"
|
|
24
|
+
},
|
|
25
|
+
"./molecules/*": {
|
|
26
|
+
"types": "./dist/molecules/*.d.ts",
|
|
27
|
+
"import": "./dist/molecules/*.js"
|
|
28
|
+
},
|
|
29
|
+
"./organisms/*": {
|
|
30
|
+
"types": "./dist/organisms/*.d.ts",
|
|
31
|
+
"import": "./dist/organisms/*.js"
|
|
32
|
+
},
|
|
33
|
+
"./layouts/*": {
|
|
34
|
+
"types": "./dist/layouts/*.d.ts",
|
|
35
|
+
"import": "./dist/layouts/*.js"
|
|
36
|
+
},
|
|
37
|
+
"./hooks/*": {
|
|
38
|
+
"types": "./dist/hooks/*.d.ts",
|
|
39
|
+
"import": "./dist/hooks/*.js"
|
|
40
|
+
},
|
|
41
|
+
"./lib/*": {
|
|
42
|
+
"types": "./dist/lib/*.d.ts",
|
|
43
|
+
"import": "./dist/lib/*.js"
|
|
44
|
+
},
|
|
45
|
+
"./config/*": {
|
|
46
|
+
"types": "./dist/config/*.d.ts",
|
|
47
|
+
"import": "./dist/config/*.js"
|
|
48
|
+
}
|
|
27
49
|
},
|
|
28
50
|
"scripts": {
|
|
29
51
|
"dev": "vite",
|
|
@@ -35,7 +57,8 @@
|
|
|
35
57
|
"lint": "eslint . --report-unused-disable-directives",
|
|
36
58
|
"preview": "vite preview",
|
|
37
59
|
"format": "prettier --write .",
|
|
38
|
-
"test": "vitest"
|
|
60
|
+
"test": "vitest",
|
|
61
|
+
"test:exports": "node scripts/test-exports.mjs"
|
|
39
62
|
},
|
|
40
63
|
"peerDependencies": {
|
|
41
64
|
"react": "^19.2.0",
|