@tradalab/lyra 1.9.0 → 1.11.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/README.md +1 -1
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/index.js +1 -1
- package/dist/blocks/index.js.map +1 -1
- package/dist/data-table/index.d.ts +9 -1
- package/dist/data-table/index.js +57 -14
- package/dist/data-table/index.js.map +1 -1
- package/dist/shell/index.d.ts +68 -4
- package/dist/shell/index.js +121 -85
- package/dist/shell/index.js.map +1 -1
- package/dist/ui/index.d.ts +34 -1
- package/dist/ui/index.js +27 -1
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
package/dist/shell/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { SidebarInset, SidebarProvider, Sidebar, SidebarGroup, SidebarGroupLabel, SidebarGroupContent, SidebarMenu, SidebarMenuItem, SidebarMenuButton, useSidebar, defaultAccountMenuLabels, Avatar, AvatarImage, AvatarFallback, initialsOf, ScrollArea, ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuSeparator, ScrollBar, Breadcrumb, BreadcrumbList,
|
|
2
|
+
import { SidebarInset, SidebarProvider, Sidebar, SidebarGroup, SidebarGroupLabel, SidebarGroupContent, SidebarMenu, SidebarMenuItem, SidebarMenuButton, useSidebar, defaultAccountMenuLabels, Avatar, AvatarImage, AvatarFallback, initialsOf, ScrollArea, ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuSeparator, ScrollBar, Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbPage, BreadcrumbLink, BreadcrumbSeparator, InputGroup, InputGroupAddon, InputGroupInput } from '../chunk-V6TVUMAU.js';
|
|
3
3
|
import '../chunk-QYA2HGKW.js';
|
|
4
4
|
import { Card, CardTitle, CardDescription } from '../chunk-ZG5ZPKFL.js';
|
|
5
5
|
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuSeparator, DropdownMenuLabel, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuItem } from '../chunk-SQA4ILAK.js';
|
|
6
6
|
import { Button } from '../chunk-KFQOYZ64.js';
|
|
7
7
|
import { cn } from '../chunk-XH55BHUU.js';
|
|
8
8
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
9
|
-
import
|
|
9
|
+
import Link2 from 'next/link';
|
|
10
10
|
import { usePathname } from 'next/navigation';
|
|
11
11
|
import { Fragment, useRef, useEffect } from 'react';
|
|
12
12
|
import { ChevronsUpDown, CircleUser, Palette, Sun, Moon, Monitor, UserRoundCog, LogOut, LogIn, Pin, X, PinOff, ListX, Trash2, ChevronDown, Search } from 'lucide-react';
|
|
13
|
-
import { useTheme } from 'next-themes';
|
|
14
13
|
import { iconNames, DynamicIcon } from 'lucide-react/dynamic';
|
|
14
|
+
import { useTheme } from 'next-themes';
|
|
15
15
|
|
|
16
16
|
function AppShell({ children, ...rest }) {
|
|
17
17
|
return /* @__PURE__ */ jsx(SidebarProvider, { ...rest, children });
|
|
@@ -103,21 +103,27 @@ function useActiveRoute() {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
+
var looksExternal = (href) => /^([a-z][a-z0-9+.-]*:)?\/\//i.test(href) || /^(mailto|tel):/i.test(href);
|
|
106
107
|
function NavItem({
|
|
107
108
|
href,
|
|
108
109
|
label,
|
|
109
110
|
icon,
|
|
110
111
|
tooltip,
|
|
111
|
-
matchMode = "prefix"
|
|
112
|
+
matchMode = "prefix",
|
|
113
|
+
external
|
|
112
114
|
}) {
|
|
113
115
|
const { isActive } = useActiveRoute();
|
|
116
|
+
const isExternal = external ?? looksExternal(href);
|
|
114
117
|
return /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
115
118
|
SidebarMenuButton,
|
|
116
119
|
{
|
|
117
120
|
asChild: true,
|
|
118
|
-
isActive: isActive(href, matchMode),
|
|
121
|
+
isActive: !isExternal && isActive(href, matchMode),
|
|
119
122
|
tooltip,
|
|
120
|
-
children: /* @__PURE__ */ jsxs(
|
|
123
|
+
children: isExternal ? /* @__PURE__ */ jsxs("a", { href, target: "_blank", rel: "noopener noreferrer", children: [
|
|
124
|
+
icon,
|
|
125
|
+
/* @__PURE__ */ jsx("span", { children: label })
|
|
126
|
+
] }) : /* @__PURE__ */ jsxs(Link2, { href, children: [
|
|
121
127
|
icon,
|
|
122
128
|
/* @__PURE__ */ jsx("span", { children: label })
|
|
123
129
|
] })
|
|
@@ -191,6 +197,100 @@ function NavBrand({
|
|
|
191
197
|
)
|
|
192
198
|
] }) : /* @__PURE__ */ jsx(SidebarMenuButton, { size: "lg", asChild: true, tooltip: app.name, children: /* @__PURE__ */ jsx("a", { href: app.href, children: /* @__PURE__ */ jsx(BrandContent, { app }) }) }) }) });
|
|
193
199
|
}
|
|
200
|
+
var APP_ICON_NAMES = iconNames;
|
|
201
|
+
var ICON_NAME_SET = new Set(iconNames);
|
|
202
|
+
function toIconName(name) {
|
|
203
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
204
|
+
}
|
|
205
|
+
function isLucideIcon(name) {
|
|
206
|
+
return ICON_NAME_SET.has(toIconName(name));
|
|
207
|
+
}
|
|
208
|
+
var APP_COLORS = [
|
|
209
|
+
"#64748b",
|
|
210
|
+
"#ef4444",
|
|
211
|
+
"#f97316",
|
|
212
|
+
"#f59e0b",
|
|
213
|
+
"#eab308",
|
|
214
|
+
"#22c55e",
|
|
215
|
+
"#10b981",
|
|
216
|
+
"#14b8a6",
|
|
217
|
+
"#06b6d4",
|
|
218
|
+
"#3b82f6",
|
|
219
|
+
"#6366f1",
|
|
220
|
+
"#8b5cf6",
|
|
221
|
+
"#a855f7",
|
|
222
|
+
"#ec4899",
|
|
223
|
+
"#f43f5e"
|
|
224
|
+
];
|
|
225
|
+
function isIconUrl(s) {
|
|
226
|
+
return /^(https?:)?\/\//.test(s) || s.startsWith("/") || s.startsWith("data:");
|
|
227
|
+
}
|
|
228
|
+
function hexA(hex, alpha) {
|
|
229
|
+
const a = Math.round(alpha * 255).toString(16).padStart(2, "0");
|
|
230
|
+
return /^#[0-9a-fA-F]{6}$/.test(hex) ? `${hex}${a}` : hex;
|
|
231
|
+
}
|
|
232
|
+
function AppGlyph({ icon, color, name, className }) {
|
|
233
|
+
const box = cn("flex size-9 shrink-0 items-center justify-center rounded-none", className);
|
|
234
|
+
if (icon && isIconUrl(icon)) {
|
|
235
|
+
return /* @__PURE__ */ jsx(
|
|
236
|
+
"span",
|
|
237
|
+
{
|
|
238
|
+
"aria-hidden": true,
|
|
239
|
+
className: cn(box, "bg-muted bg-cover bg-center"),
|
|
240
|
+
style: { backgroundImage: `url("${encodeURI(icon)}")` }
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
const tint = color ? { backgroundColor: hexA(color, 0.14) } : void 0;
|
|
245
|
+
const fg = color ? { color } : void 0;
|
|
246
|
+
const iconName = icon ? toIconName(icon) : "";
|
|
247
|
+
if (iconName && ICON_NAME_SET.has(iconName)) {
|
|
248
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cn(box, !color && "bg-primary/10"), style: tint, children: /* @__PURE__ */ jsx(
|
|
249
|
+
DynamicIcon,
|
|
250
|
+
{
|
|
251
|
+
name: iconName,
|
|
252
|
+
className: cn("size-5", !color && "text-primary"),
|
|
253
|
+
style: fg
|
|
254
|
+
}
|
|
255
|
+
) });
|
|
256
|
+
}
|
|
257
|
+
const ch = (name || icon || "?").charAt(0).toUpperCase();
|
|
258
|
+
return /* @__PURE__ */ jsx(
|
|
259
|
+
"span",
|
|
260
|
+
{
|
|
261
|
+
"aria-hidden": true,
|
|
262
|
+
className: cn(box, "text-sm font-semibold", !color && "bg-primary/10 text-primary"),
|
|
263
|
+
style: color ? { ...tint, ...fg } : void 0,
|
|
264
|
+
children: ch
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
function AppSwitcher({
|
|
269
|
+
app,
|
|
270
|
+
sections,
|
|
271
|
+
appsLabel,
|
|
272
|
+
fallback
|
|
273
|
+
}) {
|
|
274
|
+
const groups = sections.filter((s) => s.apps.length > 0).map((s) => ({
|
|
275
|
+
key: s.key,
|
|
276
|
+
label: s.label,
|
|
277
|
+
apps: s.apps.map((a) => ({
|
|
278
|
+
name: a.name,
|
|
279
|
+
description: a.description,
|
|
280
|
+
href: a.url,
|
|
281
|
+
icon: /* @__PURE__ */ jsx(AppGlyph, { icon: a.icon, color: a.color, name: a.name })
|
|
282
|
+
}))
|
|
283
|
+
}));
|
|
284
|
+
return /* @__PURE__ */ jsx(
|
|
285
|
+
NavBrand,
|
|
286
|
+
{
|
|
287
|
+
app,
|
|
288
|
+
groups: groups.length ? groups : void 0,
|
|
289
|
+
apps: groups.length ? void 0 : fallback,
|
|
290
|
+
appsLabel
|
|
291
|
+
}
|
|
292
|
+
);
|
|
293
|
+
}
|
|
194
294
|
var defaultNavUserThemeLabels = {
|
|
195
295
|
theme: "Theme",
|
|
196
296
|
light: "Light",
|
|
@@ -499,19 +599,23 @@ function TabBar({
|
|
|
499
599
|
}
|
|
500
600
|
);
|
|
501
601
|
}
|
|
502
|
-
function Breadcrumbs({ separator, labels, ...rest }) {
|
|
602
|
+
function Breadcrumbs({ separator, labels, leading, ...rest }) {
|
|
503
603
|
const { pathname } = useActiveRoute();
|
|
504
604
|
const segments = pathname.split("/").filter(Boolean);
|
|
505
|
-
if (segments.length === 0) return null;
|
|
605
|
+
if (segments.length === 0 && !leading) return null;
|
|
506
606
|
const last = segments.length - 1;
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
607
|
+
const hideLeading = leading?.hideOnMobile ?? true;
|
|
608
|
+
return /* @__PURE__ */ jsx(Breadcrumb, { ...rest, children: /* @__PURE__ */ jsxs(BreadcrumbList, { children: [
|
|
609
|
+
leading ? /* @__PURE__ */ jsx(BreadcrumbItem, { className: hideLeading ? "hidden md:block" : void 0, children: segments.length === 0 ? /* @__PURE__ */ jsx(BreadcrumbPage, { children: leading.label }) : leading.href ? /* @__PURE__ */ jsx(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsx(Link2, { href: leading.href, children: leading.label }) }) : leading.label }) : null,
|
|
610
|
+
segments.map((seg, i) => {
|
|
611
|
+
const href = "/" + segments.slice(0, i + 1).join("/");
|
|
612
|
+
const label = labels?.[seg] ?? seg;
|
|
613
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
614
|
+
i > 0 || leading ? /* @__PURE__ */ jsx(BreadcrumbSeparator, { className: i === 0 && hideLeading && leading ? "hidden md:block" : void 0, children: separator }) : null,
|
|
615
|
+
/* @__PURE__ */ jsx(BreadcrumbItem, { children: i === last ? /* @__PURE__ */ jsx(BreadcrumbPage, { children: label }) : /* @__PURE__ */ jsx(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsx(Link2, { href, children: label }) }) })
|
|
616
|
+
] }, href);
|
|
617
|
+
})
|
|
618
|
+
] }) });
|
|
515
619
|
}
|
|
516
620
|
var defaultAppGridLabels = {
|
|
517
621
|
searchPlaceholder: "Search apps\u2026",
|
|
@@ -585,75 +689,7 @@ function AppTile({ app }) {
|
|
|
585
689
|
}
|
|
586
690
|
);
|
|
587
691
|
}
|
|
588
|
-
var APP_ICON_NAMES = iconNames;
|
|
589
|
-
var ICON_NAME_SET = new Set(iconNames);
|
|
590
|
-
function toIconName(name) {
|
|
591
|
-
return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
592
|
-
}
|
|
593
|
-
function isLucideIcon(name) {
|
|
594
|
-
return ICON_NAME_SET.has(toIconName(name));
|
|
595
|
-
}
|
|
596
|
-
var APP_COLORS = [
|
|
597
|
-
"#64748b",
|
|
598
|
-
"#ef4444",
|
|
599
|
-
"#f97316",
|
|
600
|
-
"#f59e0b",
|
|
601
|
-
"#eab308",
|
|
602
|
-
"#22c55e",
|
|
603
|
-
"#10b981",
|
|
604
|
-
"#14b8a6",
|
|
605
|
-
"#06b6d4",
|
|
606
|
-
"#3b82f6",
|
|
607
|
-
"#6366f1",
|
|
608
|
-
"#8b5cf6",
|
|
609
|
-
"#a855f7",
|
|
610
|
-
"#ec4899",
|
|
611
|
-
"#f43f5e"
|
|
612
|
-
];
|
|
613
|
-
function isIconUrl(s) {
|
|
614
|
-
return /^(https?:)?\/\//.test(s) || s.startsWith("/") || s.startsWith("data:");
|
|
615
|
-
}
|
|
616
|
-
function hexA(hex, alpha) {
|
|
617
|
-
const a = Math.round(alpha * 255).toString(16).padStart(2, "0");
|
|
618
|
-
return /^#[0-9a-fA-F]{6}$/.test(hex) ? `${hex}${a}` : hex;
|
|
619
|
-
}
|
|
620
|
-
function AppGlyph({ icon, color, name, className }) {
|
|
621
|
-
const box = cn("flex size-9 shrink-0 items-center justify-center rounded-none", className);
|
|
622
|
-
if (icon && isIconUrl(icon)) {
|
|
623
|
-
return /* @__PURE__ */ jsx(
|
|
624
|
-
"span",
|
|
625
|
-
{
|
|
626
|
-
"aria-hidden": true,
|
|
627
|
-
className: cn(box, "bg-muted bg-cover bg-center"),
|
|
628
|
-
style: { backgroundImage: `url("${encodeURI(icon)}")` }
|
|
629
|
-
}
|
|
630
|
-
);
|
|
631
|
-
}
|
|
632
|
-
const tint = color ? { backgroundColor: hexA(color, 0.14) } : void 0;
|
|
633
|
-
const fg = color ? { color } : void 0;
|
|
634
|
-
const iconName = icon ? toIconName(icon) : "";
|
|
635
|
-
if (iconName && ICON_NAME_SET.has(iconName)) {
|
|
636
|
-
return /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cn(box, !color && "bg-primary/10"), style: tint, children: /* @__PURE__ */ jsx(
|
|
637
|
-
DynamicIcon,
|
|
638
|
-
{
|
|
639
|
-
name: iconName,
|
|
640
|
-
className: cn("size-5", !color && "text-primary"),
|
|
641
|
-
style: fg
|
|
642
|
-
}
|
|
643
|
-
) });
|
|
644
|
-
}
|
|
645
|
-
const ch = (name || icon || "?").charAt(0).toUpperCase();
|
|
646
|
-
return /* @__PURE__ */ jsx(
|
|
647
|
-
"span",
|
|
648
|
-
{
|
|
649
|
-
"aria-hidden": true,
|
|
650
|
-
className: cn(box, "text-sm font-semibold", !color && "bg-primary/10 text-primary"),
|
|
651
|
-
style: color ? { ...tint, ...fg } : void 0,
|
|
652
|
-
children: ch
|
|
653
|
-
}
|
|
654
|
-
);
|
|
655
|
-
}
|
|
656
692
|
|
|
657
|
-
export { APP_COLORS, APP_ICON_NAMES, AppGlyph, AppGrid, AppShell, AppShellBody, AppShellHeader, AppShellMain, AppTile, Breadcrumbs, NavBrand, NavGroup, NavItem, NavSection, NavUser, SidebarDock, SidebarPanel, StackedSidebar, TabBar, defaultAppGridLabels, defaultNavBrandAppsLabel, defaultNavUserThemeLabels, defaultTabBarLabels, isIconUrl, isLucideIcon, toIconName, useActiveRoute };
|
|
693
|
+
export { APP_COLORS, APP_ICON_NAMES, AppGlyph, AppGrid, AppShell, AppShellBody, AppShellHeader, AppShellMain, AppSwitcher, AppTile, Breadcrumbs, NavBrand, NavGroup, NavItem, NavSection, NavUser, SidebarDock, SidebarPanel, StackedSidebar, TabBar, defaultAppGridLabels, defaultNavBrandAppsLabel, defaultNavUserThemeLabels, defaultTabBarLabels, isIconUrl, isLucideIcon, toIconName, useActiveRoute };
|
|
658
694
|
//# sourceMappingURL=index.js.map
|
|
659
695
|
//# sourceMappingURL=index.js.map
|