@mesob/ui 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/app-breadcrumbs.d.ts +34 -0
- package/dist/components/app-breadcrumbs.js +177 -0
- package/dist/components/app-breadcrumbs.js.map +1 -0
- package/dist/components/app-header-actions.d.ts +39 -0
- package/dist/components/app-header-actions.js +629 -0
- package/dist/components/app-header-actions.js.map +1 -0
- package/dist/components/app-sidebar.d.ts +24 -0
- package/dist/components/app-sidebar.js +669 -0
- package/dist/components/app-sidebar.js.map +1 -0
- package/dist/components/button.d.ts +1 -1
- package/dist/components/data-table/index.d.ts +9 -2
- package/dist/components/data-table/index.js +276 -101
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/entity/index.d.ts +85 -9
- package/dist/components/entity/index.js +424 -304
- package/dist/components/entity/index.js.map +1 -1
- package/dist/components/input-group.d.ts +1 -1
- package/dist/components/item.d.ts +1 -1
- package/dist/components/link.d.ts +12 -0
- package/dist/components/link.js +51 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/mesob-context.d.ts +34 -0
- package/dist/components/mesob-context.js +53 -0
- package/dist/components/mesob-context.js.map +1 -0
- package/dist/components/page/index.d.ts +46 -0
- package/dist/components/page/index.js +197 -0
- package/dist/components/page/index.js.map +1 -0
- package/dist/components/powered-by.d.ts +4 -1
- package/dist/components/powered-by.js +28 -12
- package/dist/components/powered-by.js.map +1 -1
- package/dist/components/shell.d.ts +13 -0
- package/dist/components/shell.js +545 -0
- package/dist/components/shell.js.map +1 -0
- package/dist/components/sidebar.d.ts +4 -0
- package/dist/components/sidebar.js +37 -8
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/table.js.map +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +2 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/hooks/use-router.d.ts +7 -0
- package/dist/hooks/use-router.js +36 -0
- package/dist/hooks/use-router.js.map +1 -0
- package/dist/hooks/use-translation.d.ts +5 -0
- package/dist/hooks/use-translation.js +41 -0
- package/dist/hooks/use-translation.js.map +1 -0
- package/package.json +7 -1
- package/src/styles/globals.css +4 -0
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/lib/utils.ts
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
|
+
import { twMerge } from "tailwind-merge";
|
|
6
|
+
function cn(...inputs) {
|
|
7
|
+
return twMerge(clsx(inputs));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// src/components/breadcrumb.tsx
|
|
11
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
12
|
+
import { IconChevronRight, IconDots } from "@tabler/icons-react";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
function Breadcrumb({ ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...props });
|
|
16
|
+
}
|
|
17
|
+
function BreadcrumbList({ className, ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
"ol",
|
|
20
|
+
{
|
|
21
|
+
"data-slot": "breadcrumb-list",
|
|
22
|
+
className: cn(
|
|
23
|
+
"text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
|
|
24
|
+
className
|
|
25
|
+
),
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
"li",
|
|
33
|
+
{
|
|
34
|
+
"data-slot": "breadcrumb-item",
|
|
35
|
+
className: cn("inline-flex items-center gap-1.5", className),
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
"span",
|
|
43
|
+
{
|
|
44
|
+
"data-slot": "breadcrumb-page",
|
|
45
|
+
"aria-disabled": "true",
|
|
46
|
+
"aria-current": "page",
|
|
47
|
+
className: cn("text-foreground font-normal", className),
|
|
48
|
+
...props
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function BreadcrumbSeparator({
|
|
53
|
+
children,
|
|
54
|
+
className,
|
|
55
|
+
...props
|
|
56
|
+
}) {
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
"li",
|
|
59
|
+
{
|
|
60
|
+
"data-slot": "breadcrumb-separator",
|
|
61
|
+
role: "presentation",
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
className: cn("[&>svg]:size-3.5", className),
|
|
64
|
+
...props,
|
|
65
|
+
children: children ?? /* @__PURE__ */ jsx(IconChevronRight, {})
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// src/components/tooltip.tsx
|
|
71
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
72
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
73
|
+
function TooltipProvider({
|
|
74
|
+
delayDuration = 0,
|
|
75
|
+
...props
|
|
76
|
+
}) {
|
|
77
|
+
return /* @__PURE__ */ jsx2(
|
|
78
|
+
TooltipPrimitive.Provider,
|
|
79
|
+
{
|
|
80
|
+
"data-slot": "tooltip-provider",
|
|
81
|
+
delayDuration,
|
|
82
|
+
...props
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// src/components/mesob-context.tsx
|
|
88
|
+
import {
|
|
89
|
+
createContext,
|
|
90
|
+
useContext,
|
|
91
|
+
useMemo
|
|
92
|
+
} from "react";
|
|
93
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
94
|
+
var MesobContext = createContext(null);
|
|
95
|
+
function useMesob() {
|
|
96
|
+
return useContext(MesobContext);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/components/app-breadcrumbs.tsx
|
|
100
|
+
import {
|
|
101
|
+
createContext as createContext2,
|
|
102
|
+
Fragment,
|
|
103
|
+
useCallback,
|
|
104
|
+
useContext as useContext2,
|
|
105
|
+
useEffect,
|
|
106
|
+
useMemo as useMemo2,
|
|
107
|
+
useRef,
|
|
108
|
+
useState
|
|
109
|
+
} from "react";
|
|
110
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
111
|
+
var BreadcrumbContext = createContext2(null);
|
|
112
|
+
function useBreadcrumbs(options) {
|
|
113
|
+
const context = useContext2(BreadcrumbContext);
|
|
114
|
+
if (!context) {
|
|
115
|
+
throw new Error("useBreadcrumbs must be used within BreadcrumbProvider");
|
|
116
|
+
}
|
|
117
|
+
const { setItems } = context;
|
|
118
|
+
const prevItemsStrRef = useRef(void 0);
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
const items = options?.items;
|
|
121
|
+
if (!items) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const itemsStr = JSON.stringify(items);
|
|
125
|
+
if (prevItemsStrRef.current !== itemsStr) {
|
|
126
|
+
prevItemsStrRef.current = itemsStr;
|
|
127
|
+
setItems(items);
|
|
128
|
+
}
|
|
129
|
+
}, [options?.items, setItems]);
|
|
130
|
+
return context;
|
|
131
|
+
}
|
|
132
|
+
function BreadcrumbProvider({
|
|
133
|
+
children,
|
|
134
|
+
defaultItems = []
|
|
135
|
+
}) {
|
|
136
|
+
const [items, setItems] = useState(defaultItems);
|
|
137
|
+
const push = useCallback((item) => {
|
|
138
|
+
setItems((prev) => [...prev, item]);
|
|
139
|
+
}, []);
|
|
140
|
+
const pop = useCallback(() => {
|
|
141
|
+
setItems((prev) => prev.slice(0, -1));
|
|
142
|
+
}, []);
|
|
143
|
+
const clear = useCallback(() => {
|
|
144
|
+
setItems([]);
|
|
145
|
+
}, []);
|
|
146
|
+
const value = useMemo2(
|
|
147
|
+
() => ({
|
|
148
|
+
items,
|
|
149
|
+
setItems,
|
|
150
|
+
push,
|
|
151
|
+
pop,
|
|
152
|
+
clear
|
|
153
|
+
}),
|
|
154
|
+
[items, push, pop, clear]
|
|
155
|
+
);
|
|
156
|
+
return /* @__PURE__ */ jsx4(BreadcrumbContext.Provider, { value, children });
|
|
157
|
+
}
|
|
158
|
+
function AppBreadcrumbs({
|
|
159
|
+
linkComponent: linkProp,
|
|
160
|
+
className
|
|
161
|
+
}) {
|
|
162
|
+
const mesob = useMesob();
|
|
163
|
+
const Link = linkProp ?? mesob?.linkComponent;
|
|
164
|
+
const { items } = useBreadcrumbs(void 0);
|
|
165
|
+
if (items.length === 0) {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
return /* @__PURE__ */ jsx4(Breadcrumb, { className, children: /* @__PURE__ */ jsx4(BreadcrumbList, { children: items.map((crumb, index) => {
|
|
169
|
+
let content;
|
|
170
|
+
if (crumb.href) {
|
|
171
|
+
if (Link) {
|
|
172
|
+
content = /* @__PURE__ */ jsx4(Link, { href: crumb.href, className: "hover:underline", children: crumb.label });
|
|
173
|
+
} else {
|
|
174
|
+
content = /* @__PURE__ */ jsx4("a", { href: crumb.href, className: "hover:underline", children: crumb.label });
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
content = /* @__PURE__ */ jsx4(BreadcrumbPage, { children: crumb.label });
|
|
178
|
+
}
|
|
179
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
180
|
+
index > 0 && /* @__PURE__ */ jsx4(BreadcrumbSeparator, { className: "hidden md:block" }),
|
|
181
|
+
/* @__PURE__ */ jsx4(BreadcrumbItem, { className: index === 0 ? "hidden md:block" : "", children: content })
|
|
182
|
+
] }, `${crumb.label}-${crumb.href ?? ""}-${index}`);
|
|
183
|
+
}) }) });
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// src/components/separator.tsx
|
|
187
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
188
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
189
|
+
function Separator({
|
|
190
|
+
className,
|
|
191
|
+
orientation = "horizontal",
|
|
192
|
+
decorative = true,
|
|
193
|
+
...props
|
|
194
|
+
}) {
|
|
195
|
+
return /* @__PURE__ */ jsx5(
|
|
196
|
+
SeparatorPrimitive.Root,
|
|
197
|
+
{
|
|
198
|
+
"data-slot": "separator",
|
|
199
|
+
decorative,
|
|
200
|
+
orientation,
|
|
201
|
+
className: cn(
|
|
202
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
203
|
+
className
|
|
204
|
+
),
|
|
205
|
+
...props
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// src/components/button.tsx
|
|
211
|
+
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
212
|
+
import { cva } from "class-variance-authority";
|
|
213
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
214
|
+
var buttonVariants = cva(
|
|
215
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
216
|
+
{
|
|
217
|
+
variants: {
|
|
218
|
+
variant: {
|
|
219
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
220
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
221
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
222
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
223
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
224
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
225
|
+
},
|
|
226
|
+
size: {
|
|
227
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
228
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
229
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
230
|
+
icon: "size-9",
|
|
231
|
+
"icon-sm": "size-8",
|
|
232
|
+
"icon-lg": "size-10"
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
defaultVariants: {
|
|
236
|
+
variant: "default",
|
|
237
|
+
size: "default"
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
function Button({
|
|
242
|
+
className,
|
|
243
|
+
variant,
|
|
244
|
+
size,
|
|
245
|
+
asChild = false,
|
|
246
|
+
...props
|
|
247
|
+
}) {
|
|
248
|
+
const Comp = asChild ? Slot2 : "button";
|
|
249
|
+
return /* @__PURE__ */ jsx6(
|
|
250
|
+
Comp,
|
|
251
|
+
{
|
|
252
|
+
"data-slot": "button",
|
|
253
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
254
|
+
...props
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// src/components/input.tsx
|
|
260
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
261
|
+
|
|
262
|
+
// src/components/sheet.tsx
|
|
263
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
264
|
+
import { IconX } from "@tabler/icons-react";
|
|
265
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
266
|
+
|
|
267
|
+
// src/components/skeleton.tsx
|
|
268
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
269
|
+
|
|
270
|
+
// src/hooks/use-mobile.ts
|
|
271
|
+
import * as React from "react";
|
|
272
|
+
var MOBILE_BREAKPOINT = 768;
|
|
273
|
+
function useIsMobile() {
|
|
274
|
+
const [isMobile, setIsMobile] = React.useState(
|
|
275
|
+
void 0
|
|
276
|
+
);
|
|
277
|
+
React.useEffect(() => {
|
|
278
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
279
|
+
const onChange = () => {
|
|
280
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
281
|
+
};
|
|
282
|
+
mql.addEventListener("change", onChange);
|
|
283
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
284
|
+
return () => mql.removeEventListener("change", onChange);
|
|
285
|
+
}, []);
|
|
286
|
+
return !!isMobile;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// src/components/sidebar.tsx
|
|
290
|
+
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
291
|
+
import { IconMenu2 } from "@tabler/icons-react";
|
|
292
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
293
|
+
import * as React2 from "react";
|
|
294
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
295
|
+
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
296
|
+
var SIDEBAR_WIDTH_COOKIE = "sidebar_width";
|
|
297
|
+
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
298
|
+
var SIDEBAR_WIDTH_DEFAULT = 256;
|
|
299
|
+
var SIDEBAR_WIDTH_MIN = 200;
|
|
300
|
+
var SIDEBAR_WIDTH_MAX = 480;
|
|
301
|
+
var SIDEBAR_WIDTH = "16rem";
|
|
302
|
+
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
303
|
+
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
304
|
+
function getWidthFromCookie() {
|
|
305
|
+
if (typeof document === "undefined") {
|
|
306
|
+
return SIDEBAR_WIDTH_DEFAULT;
|
|
307
|
+
}
|
|
308
|
+
const m = document.cookie.match(
|
|
309
|
+
new RegExp(`(?:^|; )${SIDEBAR_WIDTH_COOKIE}=([^;]*)`)
|
|
310
|
+
);
|
|
311
|
+
const n = m ? Number(m[1]) : Number.NaN;
|
|
312
|
+
return Number.isFinite(n) && n >= SIDEBAR_WIDTH_MIN && n <= SIDEBAR_WIDTH_MAX ? n : SIDEBAR_WIDTH_DEFAULT;
|
|
313
|
+
}
|
|
314
|
+
function setWidthCookie(width) {
|
|
315
|
+
document.cookie = `${SIDEBAR_WIDTH_COOKIE}=${width}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
316
|
+
}
|
|
317
|
+
var SidebarContext = React2.createContext(null);
|
|
318
|
+
function useSidebar() {
|
|
319
|
+
const context = React2.useContext(SidebarContext);
|
|
320
|
+
if (!context) {
|
|
321
|
+
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
322
|
+
}
|
|
323
|
+
return context;
|
|
324
|
+
}
|
|
325
|
+
function SidebarProvider({
|
|
326
|
+
defaultOpen = true,
|
|
327
|
+
open: openProp,
|
|
328
|
+
onOpenChange: setOpenProp,
|
|
329
|
+
className,
|
|
330
|
+
style,
|
|
331
|
+
children,
|
|
332
|
+
...props
|
|
333
|
+
}) {
|
|
334
|
+
const isMobile = useIsMobile();
|
|
335
|
+
const [openMobile, setOpenMobile] = React2.useState(false);
|
|
336
|
+
const [width, setWidthState] = React2.useState(getWidthFromCookie);
|
|
337
|
+
const setWidth = React2.useCallback((w) => {
|
|
338
|
+
const clamped = Math.max(SIDEBAR_WIDTH_MIN, Math.min(SIDEBAR_WIDTH_MAX, w));
|
|
339
|
+
setWidthState(clamped);
|
|
340
|
+
setWidthCookie(clamped);
|
|
341
|
+
}, []);
|
|
342
|
+
const [_open, _setOpen] = React2.useState(defaultOpen);
|
|
343
|
+
const open = openProp ?? _open;
|
|
344
|
+
const setOpen = React2.useCallback(
|
|
345
|
+
(value) => {
|
|
346
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
347
|
+
if (setOpenProp) {
|
|
348
|
+
setOpenProp(openState);
|
|
349
|
+
} else {
|
|
350
|
+
_setOpen(openState);
|
|
351
|
+
}
|
|
352
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
353
|
+
},
|
|
354
|
+
[open, setOpenProp]
|
|
355
|
+
);
|
|
356
|
+
const toggleSidebar = React2.useCallback(() => {
|
|
357
|
+
return isMobile ? setOpenMobile((value) => !value) : setOpen((value) => !value);
|
|
358
|
+
}, [isMobile, setOpen]);
|
|
359
|
+
React2.useEffect(() => {
|
|
360
|
+
const handleKeyDown = (event) => {
|
|
361
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
362
|
+
event.preventDefault();
|
|
363
|
+
toggleSidebar();
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
367
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
368
|
+
}, [toggleSidebar]);
|
|
369
|
+
const state = open ? "expanded" : "collapsed";
|
|
370
|
+
const contextValue = {
|
|
371
|
+
state,
|
|
372
|
+
open,
|
|
373
|
+
setOpen,
|
|
374
|
+
isMobile,
|
|
375
|
+
openMobile,
|
|
376
|
+
setOpenMobile,
|
|
377
|
+
toggleSidebar,
|
|
378
|
+
width,
|
|
379
|
+
setWidth,
|
|
380
|
+
minWidth: SIDEBAR_WIDTH_MIN,
|
|
381
|
+
maxWidth: SIDEBAR_WIDTH_MAX
|
|
382
|
+
};
|
|
383
|
+
const sidebarWidthValue = open ? `${width}px` : SIDEBAR_WIDTH;
|
|
384
|
+
return /* @__PURE__ */ jsx10(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx10(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx10(
|
|
385
|
+
"div",
|
|
386
|
+
{
|
|
387
|
+
"data-slot": "sidebar-wrapper",
|
|
388
|
+
style: {
|
|
389
|
+
"--sidebar-width": sidebarWidthValue,
|
|
390
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
391
|
+
...style
|
|
392
|
+
},
|
|
393
|
+
className: cn(
|
|
394
|
+
"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
|
|
395
|
+
className
|
|
396
|
+
),
|
|
397
|
+
...props,
|
|
398
|
+
children
|
|
399
|
+
}
|
|
400
|
+
) }) });
|
|
401
|
+
}
|
|
402
|
+
function SidebarTrigger({
|
|
403
|
+
className,
|
|
404
|
+
onClick,
|
|
405
|
+
...props
|
|
406
|
+
}) {
|
|
407
|
+
const { toggleSidebar } = useSidebar();
|
|
408
|
+
return /* @__PURE__ */ jsxs5(
|
|
409
|
+
Button,
|
|
410
|
+
{
|
|
411
|
+
"data-sidebar": "trigger",
|
|
412
|
+
"data-slot": "sidebar-trigger",
|
|
413
|
+
variant: "ghost",
|
|
414
|
+
size: "icon",
|
|
415
|
+
className: cn("size-7", className),
|
|
416
|
+
onClick: (event) => {
|
|
417
|
+
onClick?.(event);
|
|
418
|
+
toggleSidebar();
|
|
419
|
+
},
|
|
420
|
+
...props,
|
|
421
|
+
children: [
|
|
422
|
+
/* @__PURE__ */ jsx10(IconMenu2, {}),
|
|
423
|
+
/* @__PURE__ */ jsx10("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
function SidebarInset({ className, ...props }) {
|
|
429
|
+
return /* @__PURE__ */ jsx10(
|
|
430
|
+
"main",
|
|
431
|
+
{
|
|
432
|
+
"data-slot": "sidebar-inset",
|
|
433
|
+
className: cn(
|
|
434
|
+
"bg-background relative flex w-full flex-1 flex-col",
|
|
435
|
+
"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",
|
|
436
|
+
className
|
|
437
|
+
),
|
|
438
|
+
...props
|
|
439
|
+
}
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
var sidebarMenuButtonVariants = cva2(
|
|
443
|
+
'peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-active focus-visible:ring-2 active:bg-sidebar-active disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:relative data-[active=true]:bg-sidebar-active data-[active=true]:pl-3 data-[active=true]:font-medium data-[active=true]:text-sidebar-primary data-[active=true]:before:absolute data-[active=true]:before:left-1 data-[active=true]:before:top-[6px] data-[active=true]:before:bottom-[6px] data-[active=true]:before:w-[3px] data-[active=true]:before:rounded-full data-[active=true]:before:bg-primary data-[active=true]:before:content-[""] data-[state=open]:hover:bg-sidebar-active group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 min-w-0',
|
|
444
|
+
{
|
|
445
|
+
variants: {
|
|
446
|
+
variant: {
|
|
447
|
+
default: "hover:bg-sidebar-active",
|
|
448
|
+
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))]"
|
|
449
|
+
},
|
|
450
|
+
size: {
|
|
451
|
+
default: "h-8 text-sm",
|
|
452
|
+
sm: "h-7 text-xs",
|
|
453
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
defaultVariants: {
|
|
457
|
+
variant: "default",
|
|
458
|
+
size: "default"
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
);
|
|
462
|
+
|
|
463
|
+
// src/components/sonner.tsx
|
|
464
|
+
import {
|
|
465
|
+
IconAlertTriangle,
|
|
466
|
+
IconCircleCheck,
|
|
467
|
+
IconInfoCircle,
|
|
468
|
+
IconLoader2,
|
|
469
|
+
IconX as IconX2
|
|
470
|
+
} from "@tabler/icons-react";
|
|
471
|
+
import { useTheme } from "next-themes";
|
|
472
|
+
import { Toaster as Sonner } from "sonner";
|
|
473
|
+
import { toast } from "sonner";
|
|
474
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
475
|
+
var Toaster = ({ ...props }) => {
|
|
476
|
+
const { theme = "system" } = useTheme();
|
|
477
|
+
return /* @__PURE__ */ jsx11(
|
|
478
|
+
Sonner,
|
|
479
|
+
{
|
|
480
|
+
theme,
|
|
481
|
+
className: "toaster group",
|
|
482
|
+
icons: {
|
|
483
|
+
success: /* @__PURE__ */ jsx11(IconCircleCheck, { className: "size-4" }),
|
|
484
|
+
info: /* @__PURE__ */ jsx11(IconInfoCircle, { className: "size-4" }),
|
|
485
|
+
warning: /* @__PURE__ */ jsx11(IconAlertTriangle, { className: "size-4" }),
|
|
486
|
+
error: /* @__PURE__ */ jsx11(IconX2, { className: "size-4" }),
|
|
487
|
+
loading: /* @__PURE__ */ jsx11(IconLoader2, { className: "size-4 animate-spin" })
|
|
488
|
+
},
|
|
489
|
+
style: {
|
|
490
|
+
"--normal-bg": "var(--popover)",
|
|
491
|
+
"--normal-text": "var(--popover-foreground)",
|
|
492
|
+
"--normal-border": "var(--border)",
|
|
493
|
+
"--border-radius": "var(--radius)"
|
|
494
|
+
},
|
|
495
|
+
...props
|
|
496
|
+
}
|
|
497
|
+
);
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
// src/components/shell.tsx
|
|
501
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
502
|
+
function Shell({
|
|
503
|
+
sidebar,
|
|
504
|
+
headerActions,
|
|
505
|
+
children,
|
|
506
|
+
showToaster = true,
|
|
507
|
+
contentClassName
|
|
508
|
+
}) {
|
|
509
|
+
return /* @__PURE__ */ jsx12(BreadcrumbProvider, { children: /* @__PURE__ */ jsxs6(SidebarProvider, { children: [
|
|
510
|
+
sidebar,
|
|
511
|
+
/* @__PURE__ */ jsxs6(SidebarInset, { children: [
|
|
512
|
+
/* @__PURE__ */ jsxs6("header", { className: "flex h-16 shrink-0 items-center justify-between gap-2 border-b px-4", children: [
|
|
513
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
514
|
+
/* @__PURE__ */ jsx12(SidebarTrigger, { className: "-ml-1" }),
|
|
515
|
+
/* @__PURE__ */ jsxs6("div", { className: "hidden md:flex md:items-center md:gap-2", children: [
|
|
516
|
+
/* @__PURE__ */ jsx12(
|
|
517
|
+
Separator,
|
|
518
|
+
{
|
|
519
|
+
orientation: "vertical",
|
|
520
|
+
className: "mr-2 data-[orientation=vertical]:h-4"
|
|
521
|
+
}
|
|
522
|
+
),
|
|
523
|
+
/* @__PURE__ */ jsx12(AppBreadcrumbs, {})
|
|
524
|
+
] })
|
|
525
|
+
] }),
|
|
526
|
+
headerActions
|
|
527
|
+
] }),
|
|
528
|
+
/* @__PURE__ */ jsx12(
|
|
529
|
+
"div",
|
|
530
|
+
{
|
|
531
|
+
className: cn(
|
|
532
|
+
"flex min-h-0 flex-1 flex-col gap-4 overflow-auto p-4",
|
|
533
|
+
contentClassName
|
|
534
|
+
),
|
|
535
|
+
children: /* @__PURE__ */ jsx12("div", { className: "mx-auto w-full max-w-7xl", children })
|
|
536
|
+
}
|
|
537
|
+
)
|
|
538
|
+
] }),
|
|
539
|
+
showToaster && /* @__PURE__ */ jsx12(Toaster, {})
|
|
540
|
+
] }) });
|
|
541
|
+
}
|
|
542
|
+
export {
|
|
543
|
+
Shell
|
|
544
|
+
};
|
|
545
|
+
//# sourceMappingURL=shell.js.map
|