@greatapps/greatauth-ui 0.3.13 → 0.3.14
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/index.d.ts +2 -0
- package/dist/index.js +68 -21
- package/dist/index.js.map +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +6 -1
- package/dist/ui.js.map +1 -1
- package/package.json +1 -1
- package/src/components/app-header.tsx +8 -1
- package/src/components/app-sidebar.tsx +29 -11
- package/src/components/ui/collapsible.tsx +7 -0
- package/src/components/ui/sidebar.tsx +1 -1
- package/src/theme.css +49 -24
- package/src/types/index.ts +2 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -362,7 +362,7 @@ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
|
362
362
|
var SIDEBAR_STORAGE_KEY = "sidebar_state";
|
|
363
363
|
var SIDEBAR_WIDTH = "16rem";
|
|
364
364
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
365
|
-
var SIDEBAR_WIDTH_ICON = "
|
|
365
|
+
var SIDEBAR_WIDTH_ICON = "3.5rem";
|
|
366
366
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
367
367
|
var SidebarContext = React.createContext(null);
|
|
368
368
|
function useSidebar() {
|
|
@@ -572,6 +572,30 @@ function SidebarTrigger({
|
|
|
572
572
|
}
|
|
573
573
|
);
|
|
574
574
|
}
|
|
575
|
+
function SidebarRail({ className, ...props }) {
|
|
576
|
+
const { toggleSidebar } = useSidebar();
|
|
577
|
+
return /* @__PURE__ */ jsx7(
|
|
578
|
+
"button",
|
|
579
|
+
{
|
|
580
|
+
"data-sidebar": "rail",
|
|
581
|
+
"data-slot": "sidebar-rail",
|
|
582
|
+
"aria-label": "Toggle Sidebar",
|
|
583
|
+
tabIndex: -1,
|
|
584
|
+
onClick: toggleSidebar,
|
|
585
|
+
title: "Toggle Sidebar",
|
|
586
|
+
className: cn(
|
|
587
|
+
"hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2",
|
|
588
|
+
"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
|
|
589
|
+
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
590
|
+
"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
|
|
591
|
+
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
592
|
+
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
593
|
+
className
|
|
594
|
+
),
|
|
595
|
+
...props
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
}
|
|
575
599
|
function SidebarInset({ className, ...props }) {
|
|
576
600
|
return /* @__PURE__ */ jsx7(
|
|
577
601
|
"main",
|
|
@@ -757,7 +781,7 @@ function SidebarMenuButton({
|
|
|
757
781
|
// src/components/app-sidebar.tsx
|
|
758
782
|
import { usePathname, useRouter } from "next/navigation";
|
|
759
783
|
import Link from "next/link";
|
|
760
|
-
import {
|
|
784
|
+
import { ChevronsUpDown, ChevronRight as ChevronRight2, LogOut } from "lucide-react";
|
|
761
785
|
|
|
762
786
|
// src/components/ui/collapsible.tsx
|
|
763
787
|
import { Collapsible as CollapsiblePrimitive } from "radix-ui";
|
|
@@ -779,12 +803,17 @@ function CollapsibleTrigger({
|
|
|
779
803
|
);
|
|
780
804
|
}
|
|
781
805
|
function CollapsibleContent({
|
|
806
|
+
className,
|
|
782
807
|
...props
|
|
783
808
|
}) {
|
|
784
809
|
return /* @__PURE__ */ jsx8(
|
|
785
810
|
CollapsiblePrimitive.CollapsibleContent,
|
|
786
811
|
{
|
|
787
812
|
"data-slot": "collapsible-content",
|
|
813
|
+
className: cn(
|
|
814
|
+
"overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",
|
|
815
|
+
className
|
|
816
|
+
),
|
|
788
817
|
...props
|
|
789
818
|
}
|
|
790
819
|
);
|
|
@@ -981,23 +1010,35 @@ function getUserInitials(name, email) {
|
|
|
981
1010
|
return parts[0][0].toUpperCase();
|
|
982
1011
|
}
|
|
983
1012
|
function SimpleMenuItem({ item, pathname }) {
|
|
984
|
-
const isActive = pathname.startsWith(item.href);
|
|
1013
|
+
const isActive = item.isActive ?? pathname.startsWith(item.href);
|
|
985
1014
|
const Icon = item.icon;
|
|
986
|
-
return /* @__PURE__ */ jsx12(SidebarMenuItem, { children: /* @__PURE__ */ jsx12(SidebarMenuButton, { asChild: true, isActive, tooltip: item.label, children: /* @__PURE__ */ jsxs5(Link, { href: item.href, onClick: item.onClick, children: [
|
|
1015
|
+
return /* @__PURE__ */ jsx12(SidebarMenuItem, { children: /* @__PURE__ */ jsx12(SidebarMenuButton, { asChild: true, isActive, tooltip: item.label, children: /* @__PURE__ */ jsxs5(Link, { href: item.href, onClick: item.onClick, "aria-current": isActive ? "page" : void 0, children: [
|
|
987
1016
|
/* @__PURE__ */ jsx12(Icon, { className: "size-4" }),
|
|
988
|
-
/* @__PURE__ */ jsx12("span", { children: item.label })
|
|
1017
|
+
/* @__PURE__ */ jsx12("span", { children: item.label }),
|
|
1018
|
+
item.badge != null && /* @__PURE__ */ jsx12("span", { className: "ml-auto flex h-5 min-w-5 items-center justify-center rounded-full bg-primary/10 px-1.5 text-[10px] font-semibold text-primary tabular-nums", children: item.badge })
|
|
989
1019
|
] }) }) });
|
|
990
1020
|
}
|
|
991
1021
|
function CollapsibleMenuItem({ item, pathname }) {
|
|
992
1022
|
const Icon = item.icon;
|
|
993
|
-
const
|
|
994
|
-
|
|
995
|
-
|
|
1023
|
+
const isParentActive = pathname.startsWith(item.href);
|
|
1024
|
+
const isChildActive = item.children?.some(
|
|
1025
|
+
(child) => child.isActive !== void 0 ? child.isActive : pathname.startsWith(child.href)
|
|
1026
|
+
) ?? false;
|
|
1027
|
+
return /* @__PURE__ */ jsx12(Collapsible, { defaultOpen: isParentActive || isChildActive, className: "group/collapsible", children: /* @__PURE__ */ jsxs5(SidebarMenuItem, { children: [
|
|
1028
|
+
/* @__PURE__ */ jsx12(SidebarMenuButton, { asChild: true, isActive: isParentActive, tooltip: item.label, children: /* @__PURE__ */ jsxs5(Link, { href: item.href, onClick: item.onClick, children: [
|
|
996
1029
|
/* @__PURE__ */ jsx12(Icon, { className: "size-4" }),
|
|
997
|
-
/* @__PURE__ */ jsx12("span", { children: item.label })
|
|
998
|
-
/* @__PURE__ */ jsx12(ChevronRight2, { className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
|
|
1030
|
+
/* @__PURE__ */ jsx12("span", { children: item.label })
|
|
999
1031
|
] }) }),
|
|
1000
|
-
/* @__PURE__ */ jsx12(
|
|
1032
|
+
/* @__PURE__ */ jsx12(CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsx12(
|
|
1033
|
+
"button",
|
|
1034
|
+
{
|
|
1035
|
+
"data-sidebar": "menu-action",
|
|
1036
|
+
className: "absolute right-1 top-1.5 flex h-5 w-5 items-center justify-center rounded-md text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground outline-hidden focus-visible:ring-2 ring-sidebar-ring transition-colors group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden",
|
|
1037
|
+
"aria-label": "Expandir submenu",
|
|
1038
|
+
children: /* @__PURE__ */ jsx12(ChevronRight2, { className: "size-3.5 shrink-0 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
|
|
1039
|
+
}
|
|
1040
|
+
) }),
|
|
1041
|
+
/* @__PURE__ */ jsx12(CollapsibleContent, { children: /* @__PURE__ */ jsx12(SidebarMenu, { className: "ml-4 border-l pl-2", children: item.children?.map((child) => /* @__PURE__ */ jsx12(SimpleMenuItem, { item: child, pathname }, child.href + child.label)) }) })
|
|
1001
1042
|
] }) });
|
|
1002
1043
|
}
|
|
1003
1044
|
function AppSidebar({ config }) {
|
|
@@ -1034,7 +1075,7 @@ function AppSidebar({ config }) {
|
|
|
1034
1075
|
/* @__PURE__ */ jsx12("span", { className: "truncate font-semibold", children: userName }),
|
|
1035
1076
|
/* @__PURE__ */ jsx12("span", { className: "truncate text-xs text-muted-foreground", children: userEmail })
|
|
1036
1077
|
] }),
|
|
1037
|
-
/* @__PURE__ */ jsx12(
|
|
1078
|
+
/* @__PURE__ */ jsx12(ChevronsUpDown, { className: "ml-auto size-4 group-data-[collapsible=icon]:hidden" })
|
|
1038
1079
|
] }) }),
|
|
1039
1080
|
/* @__PURE__ */ jsxs5(
|
|
1040
1081
|
DropdownMenuContent,
|
|
@@ -1057,7 +1098,8 @@ function AppSidebar({ config }) {
|
|
|
1057
1098
|
]
|
|
1058
1099
|
}
|
|
1059
1100
|
)
|
|
1060
|
-
] }) }) }) })
|
|
1101
|
+
] }) }) }) }),
|
|
1102
|
+
/* @__PURE__ */ jsx12(SidebarRail, {})
|
|
1061
1103
|
] });
|
|
1062
1104
|
}
|
|
1063
1105
|
|
|
@@ -1204,9 +1246,10 @@ function ThemeToggle() {
|
|
|
1204
1246
|
}
|
|
1205
1247
|
|
|
1206
1248
|
// src/components/app-header.tsx
|
|
1207
|
-
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1249
|
+
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1208
1250
|
function AppHeader({ config }) {
|
|
1209
1251
|
const pathname = usePathname2();
|
|
1252
|
+
const { state } = useSidebar();
|
|
1210
1253
|
const segments = pathname.split("/").filter(Boolean);
|
|
1211
1254
|
const breadcrumbs = useMemo2(() => {
|
|
1212
1255
|
const items = [];
|
|
@@ -1223,6 +1266,10 @@ function AppHeader({ config }) {
|
|
|
1223
1266
|
const showEllipsis = breadcrumbs.length > 2;
|
|
1224
1267
|
return /* @__PURE__ */ jsxs8("header", { className: "flex h-14 shrink-0 items-center gap-2 border-b px-4", children: [
|
|
1225
1268
|
/* @__PURE__ */ jsx15(SidebarTrigger, { className: "-ml-1" }),
|
|
1269
|
+
state === "collapsed" && config.appIcon && /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1270
|
+
/* @__PURE__ */ jsx15(Separator, { orientation: "vertical", className: "!h-4" }),
|
|
1271
|
+
/* @__PURE__ */ jsx15("div", { className: "shrink-0 text-sidebar-foreground", children: config.appIcon })
|
|
1272
|
+
] }),
|
|
1226
1273
|
/* @__PURE__ */ jsx15(Separator, { orientation: "vertical", className: "mr-2 !h-4" }),
|
|
1227
1274
|
/* @__PURE__ */ jsx15(Breadcrumb, { className: "flex-1", children: /* @__PURE__ */ jsx15(BreadcrumbList, { children: breadcrumbs.length > 0 ? breadcrumbs.map((crumb, i) => {
|
|
1228
1275
|
const hiddenOnMobile = showEllipsis && i < breadcrumbs.length - 2;
|
|
@@ -1237,9 +1284,9 @@ function AppHeader({ config }) {
|
|
|
1237
1284
|
}
|
|
1238
1285
|
|
|
1239
1286
|
// src/components/app-shell.tsx
|
|
1240
|
-
import { Fragment as
|
|
1287
|
+
import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1241
1288
|
function AppShell({ config, children, renderAbove }) {
|
|
1242
|
-
return /* @__PURE__ */ jsxs9(
|
|
1289
|
+
return /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1243
1290
|
renderAbove,
|
|
1244
1291
|
/* @__PURE__ */ jsx16(TooltipProvider, { children: /* @__PURE__ */ jsxs9(SidebarProvider, { className: "!h-svh !overflow-hidden", children: [
|
|
1245
1292
|
/* @__PURE__ */ jsx16(AppSidebar, { config }),
|
|
@@ -1277,7 +1324,7 @@ function Label({
|
|
|
1277
1324
|
}
|
|
1278
1325
|
|
|
1279
1326
|
// src/components/login-form.tsx
|
|
1280
|
-
import { Fragment as
|
|
1327
|
+
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1281
1328
|
function LoginForm({ config }) {
|
|
1282
1329
|
const router = useRouter2();
|
|
1283
1330
|
const searchParams = useSearchParams();
|
|
@@ -1405,7 +1452,7 @@ function LoginForm({ config }) {
|
|
|
1405
1452
|
type: "submit",
|
|
1406
1453
|
className: cn("w-full", loading && "cursor-wait"),
|
|
1407
1454
|
disabled: loading,
|
|
1408
|
-
children: loading ? /* @__PURE__ */ jsxs10(
|
|
1455
|
+
children: loading ? /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1409
1456
|
/* @__PURE__ */ jsx18(Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
1410
1457
|
"A entrar..."
|
|
1411
1458
|
] }) : "Entrar"
|
|
@@ -1990,7 +2037,7 @@ import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
|
1990
2037
|
|
|
1991
2038
|
// src/components/ui/select.tsx
|
|
1992
2039
|
import { Select as SelectPrimitive } from "radix-ui";
|
|
1993
|
-
import { ChevronsUpDown, Check as Check2, ChevronUp
|
|
2040
|
+
import { ChevronsUpDown as ChevronsUpDown2, Check as Check2, ChevronUp, ChevronDown } from "lucide-react";
|
|
1994
2041
|
import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1995
2042
|
function Select({
|
|
1996
2043
|
...props
|
|
@@ -2020,7 +2067,7 @@ function SelectTrigger({
|
|
|
2020
2067
|
...props,
|
|
2021
2068
|
children: [
|
|
2022
2069
|
children,
|
|
2023
|
-
/* @__PURE__ */ jsx23(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx23(
|
|
2070
|
+
/* @__PURE__ */ jsx23(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx23(ChevronsUpDown2, { className: "text-muted-foreground size-4 pointer-events-none" }) })
|
|
2024
2071
|
]
|
|
2025
2072
|
}
|
|
2026
2073
|
);
|
|
@@ -2090,7 +2137,7 @@ function SelectScrollUpButton({
|
|
|
2090
2137
|
"data-slot": "select-scroll-up-button",
|
|
2091
2138
|
className: cn("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2092
2139
|
...props,
|
|
2093
|
-
children: /* @__PURE__ */ jsx23(
|
|
2140
|
+
children: /* @__PURE__ */ jsx23(ChevronUp, {})
|
|
2094
2141
|
}
|
|
2095
2142
|
);
|
|
2096
2143
|
}
|