@egose/shadcn-theme 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/widgets/dialog-manager/index.js +1 -1
- package/components/widgets/dialog-manager/index.js.map +1 -1
- package/components/widgets/dialog-manager/index.mjs +1 -1
- package/layouts/sidebar1/index.d.mts +7 -1
- package/layouts/sidebar1/index.d.ts +7 -1
- package/layouts/sidebar1/index.js +24 -4
- package/layouts/sidebar1/index.js.map +1 -1
- package/layouts/sidebar1/index.mjs +24 -4
- package/layouts/sidebar1/index.mjs.map +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/jahn/projects/shadcn-theme/packages/react/dist/components/widgets/dialog-manager/index.js"],"names":[],"mappings":"AAAA,qFAAY;AACZ
|
|
1
|
+
{"version":3,"sources":["/home/jahn/projects/shadcn-theme/packages/react/dist/components/widgets/dialog-manager/index.js"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACF,6DAAmC;AACnC,sCAAmC;AACnC;AACE;AACA;AACA;AACF,6DAAmC;AACnC,sCAAmC;AACnC;AACE;AACA;AACA;AACA;AACF,wOAAC","file":"/home/jahn/projects/shadcn-theme/packages/react/dist/components/widgets/dialog-manager/index.js"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { ref } from 'valtio';
|
|
2
3
|
import { ISidebarData } from './app-sidebar.mjs';
|
|
3
4
|
export { INavUser } from './nav-user.mjs';
|
|
4
5
|
import './context-switcher.mjs';
|
|
@@ -23,5 +24,10 @@ declare function SidebarLayout({ children, aslink, data, classNames, }: Readonly
|
|
|
23
24
|
main?: string;
|
|
24
25
|
};
|
|
25
26
|
}>): React.JSX.Element;
|
|
27
|
+
interface HeaderState {
|
|
28
|
+
content: React.ReactNode | ReturnType<typeof ref<object>>;
|
|
29
|
+
}
|
|
30
|
+
declare const headerStore: HeaderState;
|
|
31
|
+
declare const setLayoutHeader: (node: React.ReactNode) => void;
|
|
26
32
|
|
|
27
|
-
export { ISidebarData, SidebarLayout as default };
|
|
33
|
+
export { ISidebarData, SidebarLayout as default, headerStore, setLayoutHeader };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { ref } from 'valtio';
|
|
2
3
|
import { ISidebarData } from './app-sidebar.js';
|
|
3
4
|
export { INavUser } from './nav-user.js';
|
|
4
5
|
import './context-switcher.js';
|
|
@@ -23,5 +24,10 @@ declare function SidebarLayout({ children, aslink, data, classNames, }: Readonly
|
|
|
23
24
|
main?: string;
|
|
24
25
|
};
|
|
25
26
|
}>): React.JSX.Element;
|
|
27
|
+
interface HeaderState {
|
|
28
|
+
content: React.ReactNode | ReturnType<typeof ref<object>>;
|
|
29
|
+
}
|
|
30
|
+
declare const headerStore: HeaderState;
|
|
31
|
+
declare const setLayoutHeader: (node: React.ReactNode) => void;
|
|
26
32
|
|
|
27
|
-
export { ISidebarData, SidebarLayout as default };
|
|
33
|
+
export { ISidebarData, SidebarLayout as default, headerStore, setLayoutHeader };
|
|
@@ -39,6 +39,7 @@ require('../../chunk-2NMEKWO5.js');
|
|
|
39
39
|
|
|
40
40
|
// layouts/sidebar1/index.tsx
|
|
41
41
|
var _react = require('react'); var React = _interopRequireWildcard(_react);
|
|
42
|
+
var _valtio = require('valtio');
|
|
42
43
|
var _nextthemes = require('next-themes');
|
|
43
44
|
function SidebarLayout({
|
|
44
45
|
children,
|
|
@@ -68,12 +69,31 @@ function SidebarLayout({
|
|
|
68
69
|
classNames == null ? void 0 : classNames.header
|
|
69
70
|
)
|
|
70
71
|
},
|
|
71
|
-
/* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 px-4" }, /* @__PURE__ */ React.createElement(_chunkWREXRSAAjs.SidebarTrigger, { className: "-ml-1" }), /* @__PURE__ */ React.createElement(_chunkK4JVHEI2js.Separator, { orientation: "vertical", className: "
|
|
72
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, { key: bread }, index > 0 && /* @__PURE__ */ React.createElement(_chunkJZXOJAMQjs.BreadcrumbSeparator, null), /* @__PURE__ */ React.createElement(_chunkJZXOJAMQjs.BreadcrumbItem, null, /* @__PURE__ */ React.createElement(_chunkJZXOJAMQjs.BreadcrumbPage, { className: "" }, bread)));
|
|
73
|
-
}))))
|
|
72
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 px-4" }, /* @__PURE__ */ React.createElement(_chunkWREXRSAAjs.SidebarTrigger, { className: "-ml-1" }), /* @__PURE__ */ React.createElement(_chunkK4JVHEI2js.Separator, { orientation: "vertical", className: "" }), /* @__PURE__ */ React.createElement(LayoutHeader, { items: activeItems }))
|
|
74
73
|
), /* @__PURE__ */ React.createElement("main", { className: _chunkPSPAJNNBjs.cn.call(void 0, "px-4 pb-2 overflow-auto", classNames == null ? void 0 : classNames.main) }, children))));
|
|
75
74
|
}
|
|
75
|
+
var headerStore = _valtio.proxy.call(void 0, {
|
|
76
|
+
content: null
|
|
77
|
+
});
|
|
78
|
+
var setLayoutHeader = (node) => {
|
|
79
|
+
if (node !== null && typeof node === "object") {
|
|
80
|
+
headerStore.content = _valtio.ref.call(void 0, node);
|
|
81
|
+
} else {
|
|
82
|
+
headerStore.content = node;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
function LayoutHeader({ items }) {
|
|
86
|
+
const snap = _valtio.useSnapshot.call(void 0, headerStore);
|
|
87
|
+
if (snap.content) {
|
|
88
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, snap.content);
|
|
89
|
+
}
|
|
90
|
+
return /* @__PURE__ */ React.createElement(_chunkJZXOJAMQjs.Breadcrumb, null, /* @__PURE__ */ React.createElement(_chunkJZXOJAMQjs.BreadcrumbList, { className: "text-dark" }, items.map((bread, index) => {
|
|
91
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, { key: bread }, index > 0 && /* @__PURE__ */ React.createElement(_chunkJZXOJAMQjs.BreadcrumbSeparator, null), /* @__PURE__ */ React.createElement(_chunkJZXOJAMQjs.BreadcrumbItem, null, /* @__PURE__ */ React.createElement(_chunkJZXOJAMQjs.BreadcrumbPage, { className: "" }, bread)));
|
|
92
|
+
})));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
76
96
|
|
|
77
97
|
|
|
78
|
-
exports.default = SidebarLayout;
|
|
98
|
+
exports.default = SidebarLayout; exports.headerStore = headerStore; exports.setLayoutHeader = setLayoutHeader;
|
|
79
99
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/jahn/projects/shadcn-theme/packages/react/dist/layouts/sidebar1/index.js","../../../layouts/sidebar1/index.tsx"],"names":[],"mappings":"AAAA,uWAAY;AACZ;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACE;AACA;AACA;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACE;AACA;AACA;AACA;AACA;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC;AACA;ACrCA,2EAAuB;
|
|
1
|
+
{"version":3,"sources":["/home/jahn/projects/shadcn-theme/packages/react/dist/layouts/sidebar1/index.js","../../../layouts/sidebar1/index.tsx"],"names":[],"mappings":"AAAA,uWAAY;AACZ;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACE;AACA;AACA;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACE;AACA;AACA;AACA;AACA;AACF,0DAAg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QAAA,EAAU,yBAAA,IAAkB,CAAA;AAAA,EAC1C,EAAA,KAAO;AACL,IAAA,WAAA,CAAY,QAAA,EAAU,IAAA;AAAA,EACxB;AACF,CAAA;AAEA,SAAS,YAAA,CAAa,EAAE,MAAM,CAAA,EAAwB;AACpD,EAAA,MAAM,KAAA,EAAO,iCAAA,WAAuB,CAAA;AACpC,EAAA,GAAA,CAAI,IAAA,CAAK,OAAA,EAAS;AAChB,IAAA,uBAAO,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAG,IAAA,CAAK,OAAQ,CAAA;AAAA,EACzB;AAEA,EAAA,uBACE,KAAA,CAAA,aAAA,CAAC,2BAAA,EAAA,IAAA,kBACC,KAAA,CAAA,aAAA,CAAC,+BAAA,EAAA,EAAe,SAAA,EAAU,YAAA,CAAA,EACvB,KAAA,CAAM,GAAA,CAAI,CAAC,KAAA,EAAO,KAAA,EAAA,GAAU;AAC3B,IAAA,uBACE,KAAA,CAAA,aAAA,CAAO,KAAA,CAAA,QAAA,EAAN,EAAe,GAAA,EAAK,MAAA,CAAA,EAClB,MAAA,EAAQ,EAAA,mBAAK,KAAA,CAAA,aAAA,CAAC,oCAAA,EAAA,IAAoB,CAAA,kBACnC,KAAA,CAAA,aAAA,CAAC,+BAAA,EAAA,IAAA,kBACC,KAAA,CAAA,aAAA,CAAC,+BAAA,EAAA,EAAe,SAAA,EAAU,GAAA,CAAA,EAAI,KAAM,CACtC,CACF,CAAA;AAAA,EAEJ,CAAC,CACH,CACF,CAAA;AAEJ;ADxBA;AACE;AACA;AACA;AACF,8GAAC","file":"/home/jahn/projects/shadcn-theme/packages/react/dist/layouts/sidebar1/index.js","sourcesContent":[null,"\"use client\";\nimport * as React from 'react';\nimport { proxy, ref, useSnapshot } from 'valtio';\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from '../../components/ui/breadcrumb';\nimport { Separator } from '../../components/ui/separator';\nimport { SidebarInset, SidebarProvider, SidebarTrigger } from '../../components/ui/sidebar';\nimport { AppSidebar, ISidebarData } from './app-sidebar';\nimport { INavUser } from './nav-user';\nimport { cn } from '../../utils/ui';\nimport { ThemeProvider } from 'next-themes';\nexport type { ISidebarData };\nexport type { INavUser };\n\nexport default function SidebarLayout({\n children,\n aslink,\n data,\n classNames,\n}: Readonly<{\n children: React.ReactNode;\n aslink: React.ElementType;\n data: ISidebarData;\n classNames?: {\n sidebar?: string;\n inset?: string;\n header?: string;\n main?: string;\n };\n}>) {\n const activeItems: string[] = [];\n\n data.menus.forEach((menu) => {\n menu.items.forEach((item) => {\n if (item.subItems) {\n item.subItems.forEach((subItem) => {\n if (subItem.isActive) {\n activeItems.push(item.title, subItem.title);\n }\n });\n } else if (item.isActive) {\n activeItems.push(item.title);\n }\n });\n });\n\n return (\n <ThemeProvider attribute=\"class\" defaultTheme=\"system\" enableSystem>\n <SidebarProvider>\n <AppSidebar aslink={aslink} data={data} className={cn(classNames?.sidebar)} />\n <SidebarInset className={cn(classNames?.inset)}>\n <header\n className={cn(\n 'flex h-14 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12',\n classNames?.header,\n )}\n >\n <div className=\"flex items-center gap-2 px-4\">\n <SidebarTrigger className=\"-ml-1\" />\n <Separator orientation=\"vertical\" className=\"\" />\n <LayoutHeader items={activeItems} />\n </div>\n </header>\n <main className={cn('px-4 pb-2 overflow-auto', classNames?.main)}>{children}</main>\n </SidebarInset>\n </SidebarProvider>\n </ThemeProvider>\n );\n}\n\ninterface HeaderState {\n content: React.ReactNode | ReturnType<typeof ref<object>>;\n}\n\nexport const headerStore = proxy<HeaderState>({\n content: null,\n});\n\nexport const setLayoutHeader = (node: React.ReactNode) => {\n if (node !== null && typeof node === 'object') {\n // We cast to any here to satisfy the internal Valtio ref assignment\n // or use a utility type\n headerStore.content = ref(node as object);\n } else {\n headerStore.content = node;\n }\n};\n\nfunction LayoutHeader({ items }: { items: string[] }) {\n const snap = useSnapshot(headerStore);\n if (snap.content) {\n return <>{snap.content}</>;\n }\n\n return (\n <Breadcrumb>\n <BreadcrumbList className=\"text-dark\">\n {items.map((bread, index) => {\n return (\n <React.Fragment key={bread}>\n {index > 0 && <BreadcrumbSeparator />}\n <BreadcrumbItem>\n <BreadcrumbPage className=\"\">{bread}</BreadcrumbPage>\n </BreadcrumbItem>\n </React.Fragment>\n );\n })}\n </BreadcrumbList>\n </Breadcrumb>\n );\n}\n"]}
|
|
@@ -38,6 +38,7 @@ import "../../chunk-YOSPWY5K.mjs";
|
|
|
38
38
|
|
|
39
39
|
// layouts/sidebar1/index.tsx
|
|
40
40
|
import * as React from "react";
|
|
41
|
+
import { proxy, ref, useSnapshot } from "valtio";
|
|
41
42
|
import { ThemeProvider } from "next-themes";
|
|
42
43
|
function SidebarLayout({
|
|
43
44
|
children,
|
|
@@ -67,12 +68,31 @@ function SidebarLayout({
|
|
|
67
68
|
classNames == null ? void 0 : classNames.header
|
|
68
69
|
)
|
|
69
70
|
},
|
|
70
|
-
/* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 px-4" }, /* @__PURE__ */ React.createElement(SidebarTrigger, { className: "-ml-1" }), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical", className: "
|
|
71
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, { key: bread }, index > 0 && /* @__PURE__ */ React.createElement(BreadcrumbSeparator, null), /* @__PURE__ */ React.createElement(BreadcrumbItem, null, /* @__PURE__ */ React.createElement(BreadcrumbPage, { className: "" }, bread)));
|
|
72
|
-
}))))
|
|
71
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 px-4" }, /* @__PURE__ */ React.createElement(SidebarTrigger, { className: "-ml-1" }), /* @__PURE__ */ React.createElement(Separator, { orientation: "vertical", className: "" }), /* @__PURE__ */ React.createElement(LayoutHeader, { items: activeItems }))
|
|
73
72
|
), /* @__PURE__ */ React.createElement("main", { className: cn("px-4 pb-2 overflow-auto", classNames == null ? void 0 : classNames.main) }, children))));
|
|
74
73
|
}
|
|
74
|
+
var headerStore = proxy({
|
|
75
|
+
content: null
|
|
76
|
+
});
|
|
77
|
+
var setLayoutHeader = (node) => {
|
|
78
|
+
if (node !== null && typeof node === "object") {
|
|
79
|
+
headerStore.content = ref(node);
|
|
80
|
+
} else {
|
|
81
|
+
headerStore.content = node;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
function LayoutHeader({ items }) {
|
|
85
|
+
const snap = useSnapshot(headerStore);
|
|
86
|
+
if (snap.content) {
|
|
87
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, snap.content);
|
|
88
|
+
}
|
|
89
|
+
return /* @__PURE__ */ React.createElement(Breadcrumb, null, /* @__PURE__ */ React.createElement(BreadcrumbList, { className: "text-dark" }, items.map((bread, index) => {
|
|
90
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, { key: bread }, index > 0 && /* @__PURE__ */ React.createElement(BreadcrumbSeparator, null), /* @__PURE__ */ React.createElement(BreadcrumbItem, null, /* @__PURE__ */ React.createElement(BreadcrumbPage, { className: "" }, bread)));
|
|
91
|
+
})));
|
|
92
|
+
}
|
|
75
93
|
export {
|
|
76
|
-
SidebarLayout as default
|
|
94
|
+
SidebarLayout as default,
|
|
95
|
+
headerStore,
|
|
96
|
+
setLayoutHeader
|
|
77
97
|
};
|
|
78
98
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../layouts/sidebar1/index.tsx"],"sourcesContent":["\"use client\";\nimport * as React from 'react';\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from '../../components/ui/breadcrumb';\nimport { Separator } from '../../components/ui/separator';\nimport { SidebarInset, SidebarProvider, SidebarTrigger } from '../../components/ui/sidebar';\nimport { AppSidebar, ISidebarData } from './app-sidebar';\nimport { INavUser } from './nav-user';\nimport { cn } from '../../utils/ui';\nimport { ThemeProvider } from 'next-themes';\nexport type { ISidebarData };\nexport type { INavUser };\n\nexport default function SidebarLayout({\n children,\n aslink,\n data,\n classNames,\n}: Readonly<{\n children: React.ReactNode;\n aslink: React.ElementType;\n data: ISidebarData;\n classNames?: {\n sidebar?: string;\n inset?: string;\n header?: string;\n main?: string;\n };\n}>) {\n const activeItems: string[] = [];\n\n data.menus.forEach((menu) => {\n menu.items.forEach((item) => {\n if (item.subItems) {\n item.subItems.forEach((subItem) => {\n if (subItem.isActive) {\n activeItems.push(item.title, subItem.title);\n }\n });\n } else if (item.isActive) {\n activeItems.push(item.title);\n }\n });\n });\n\n return (\n <ThemeProvider attribute=\"class\" defaultTheme=\"system\" enableSystem>\n <SidebarProvider>\n <AppSidebar aslink={aslink} data={data} className={cn(classNames?.sidebar)} />\n <SidebarInset className={cn(classNames?.inset)}>\n <header\n className={cn(\n 'flex h-14 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12',\n classNames?.header,\n )}\n >\n <div className=\"flex items-center gap-2 px-4\">\n <SidebarTrigger className=\"-ml-1\" />\n <Separator orientation=\"vertical\" className=\"
|
|
1
|
+
{"version":3,"sources":["../../../layouts/sidebar1/index.tsx"],"sourcesContent":["\"use client\";\nimport * as React from 'react';\nimport { proxy, ref, useSnapshot } from 'valtio';\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from '../../components/ui/breadcrumb';\nimport { Separator } from '../../components/ui/separator';\nimport { SidebarInset, SidebarProvider, SidebarTrigger } from '../../components/ui/sidebar';\nimport { AppSidebar, ISidebarData } from './app-sidebar';\nimport { INavUser } from './nav-user';\nimport { cn } from '../../utils/ui';\nimport { ThemeProvider } from 'next-themes';\nexport type { ISidebarData };\nexport type { INavUser };\n\nexport default function SidebarLayout({\n children,\n aslink,\n data,\n classNames,\n}: Readonly<{\n children: React.ReactNode;\n aslink: React.ElementType;\n data: ISidebarData;\n classNames?: {\n sidebar?: string;\n inset?: string;\n header?: string;\n main?: string;\n };\n}>) {\n const activeItems: string[] = [];\n\n data.menus.forEach((menu) => {\n menu.items.forEach((item) => {\n if (item.subItems) {\n item.subItems.forEach((subItem) => {\n if (subItem.isActive) {\n activeItems.push(item.title, subItem.title);\n }\n });\n } else if (item.isActive) {\n activeItems.push(item.title);\n }\n });\n });\n\n return (\n <ThemeProvider attribute=\"class\" defaultTheme=\"system\" enableSystem>\n <SidebarProvider>\n <AppSidebar aslink={aslink} data={data} className={cn(classNames?.sidebar)} />\n <SidebarInset className={cn(classNames?.inset)}>\n <header\n className={cn(\n 'flex h-14 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12',\n classNames?.header,\n )}\n >\n <div className=\"flex items-center gap-2 px-4\">\n <SidebarTrigger className=\"-ml-1\" />\n <Separator orientation=\"vertical\" className=\"\" />\n <LayoutHeader items={activeItems} />\n </div>\n </header>\n <main className={cn('px-4 pb-2 overflow-auto', classNames?.main)}>{children}</main>\n </SidebarInset>\n </SidebarProvider>\n </ThemeProvider>\n );\n}\n\ninterface HeaderState {\n content: React.ReactNode | ReturnType<typeof ref<object>>;\n}\n\nexport const headerStore = proxy<HeaderState>({\n content: null,\n});\n\nexport const setLayoutHeader = (node: React.ReactNode) => {\n if (node !== null && typeof node === 'object') {\n // We cast to any here to satisfy the internal Valtio ref assignment\n // or use a utility type\n headerStore.content = ref(node as object);\n } else {\n headerStore.content = node;\n }\n};\n\nfunction LayoutHeader({ items }: { items: string[] }) {\n const snap = useSnapshot(headerStore);\n if (snap.content) {\n return <>{snap.content}</>;\n }\n\n return (\n <Breadcrumb>\n <BreadcrumbList className=\"text-dark\">\n {items.map((bread, index) => {\n return (\n <React.Fragment key={bread}>\n {index > 0 && <BreadcrumbSeparator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c,MAAmB;AAAA,EAC5C,SAAS;AACX,CAAC;AAEM,IAAM,kBAAkB,CAAC,SAA0B;AACxD,MAAI,SAAS,QAAQ,OAAO,SAAS,UAAU;AAG7C,gBAAY,UAAU,IAAI,IAAc;AAAA,EAC1C,OAAO;AACL,gBAAY,UAAU;AAAA,EACxB;AACF;AAEA,SAAS,aAAa,EAAE,MAAM,GAAwB;AACpD,QAAM,OAAO,YAAY,WAAW;AACpC,MAAI,KAAK,SAAS;AAChB,WAAO,0DAAG,KAAK,OAAQ;AAAA,EACzB;AAEA,SACE,oCAAC,kBACC,oCAAC,kBAAe,WAAU,eACvB,MAAM,IAAI,CAAC,OAAO,UAAU;AAC3B,WACE,oCAAO,gBAAN,EAAe,KAAK,SAClB,QAAQ,KAAK,oCAAC,yBAAoB,GACnC,oCAAC,sBACC,oCAAC,kBAAe,WAAU,MAAI,KAAM,CACtC,CACF;AAAA,EAEJ,CAAC,CACH,CACF;AAEJ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.5",
|
|
3
3
|
"description": "shadcn UI theme",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
"lucide-react": "^0.555.0",
|
|
22
22
|
"next-themes": "^0.4.4",
|
|
23
23
|
"radix-ui": "^1.4.3",
|
|
24
|
+
"react-day-picker": "9.13.0",
|
|
24
25
|
"react-resizable-panels": "^4.7.4",
|
|
25
26
|
"tailwind-merge": "^3.5.0",
|
|
26
|
-
"
|
|
27
|
+
"valtio": "^2.3.1",
|
|
27
28
|
"vaul": "^1.1.2",
|
|
28
29
|
"zod": "^4.3.6"
|
|
29
30
|
},
|