@bizapps/design-system-testing 1.0.4 → 1.0.6
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/main.cjs +210 -117
- package/dist/main.cjs.map +1 -1
- package/dist/main.css +1 -1
- package/dist/main.d.cts +41 -5
- package/dist/main.d.ts +41 -5
- package/dist/main.js +208 -117
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -400,7 +400,7 @@ var buttonVariants = cva(
|
|
|
400
400
|
secondary: "cursor-pointer bg-secondary text-secondary-foreground hover:bg-[var(--color-orange-700)] focus-visible:ring-secondary/30",
|
|
401
401
|
cancel: "cursor-pointer bg-destructive text-secondary-foreground hover:bg-[var(--color-red-600)] focus-visible:ring-destructive/30",
|
|
402
402
|
outline: " border-2 border-foreground/50 bg-transparent text-muted-foreground hover:bg-foreground/50 hover:text-white",
|
|
403
|
-
ghost: "cursor-pointer bg-transparent text-muted-foreground hover:bg-foreground/10 hover:text-primary focus-visible:ring-ring/30",
|
|
403
|
+
ghost: "cursor-pointer bg-transparent text-muted-foreground hover:bg-foreground/10 hover:text-primary focus-visible:ring-ring/30 border-none",
|
|
404
404
|
cancelGhost: "cursor-pointer bg-destructive/10 text-red-600 hover:bg-destructive/15 hover:text-red-600 focus-visible:ring-ring/30"
|
|
405
405
|
},
|
|
406
406
|
size: {
|
|
@@ -1553,7 +1553,7 @@ function Separator({
|
|
|
1553
1553
|
decorative,
|
|
1554
1554
|
orientation,
|
|
1555
1555
|
className: cn(
|
|
1556
|
-
"bg-foreground/20
|
|
1556
|
+
"bg-foreground/20 shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",
|
|
1557
1557
|
className
|
|
1558
1558
|
),
|
|
1559
1559
|
...props
|
|
@@ -1672,12 +1672,12 @@ function Slider({
|
|
|
1672
1672
|
Slider$1.Track,
|
|
1673
1673
|
{
|
|
1674
1674
|
"data-slot": "slider-track",
|
|
1675
|
-
className: "bg-input/90 relative grow overflow-hidden rounded-full data-horizontal:h-2 data-horizontal:w-full data-vertical:h-full data-vertical:w-2",
|
|
1675
|
+
className: "bg-input/90 relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-2 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-2",
|
|
1676
1676
|
children: /* @__PURE__ */ jsx(
|
|
1677
1677
|
Slider$1.Range,
|
|
1678
1678
|
{
|
|
1679
1679
|
"data-slot": "slider-range",
|
|
1680
|
-
className: "bg-primary absolute select-none data-horizontal:h-full data-vertical:w-full"
|
|
1680
|
+
className: "bg-primary absolute select-none data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
|
|
1681
1681
|
}
|
|
1682
1682
|
)
|
|
1683
1683
|
}
|
|
@@ -1927,7 +1927,7 @@ function TabsContent({
|
|
|
1927
1927
|
className
|
|
1928
1928
|
),
|
|
1929
1929
|
...props,
|
|
1930
|
-
children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "
|
|
1930
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, children: isActive && /* @__PURE__ */ jsx(
|
|
1931
1931
|
motion.div,
|
|
1932
1932
|
{
|
|
1933
1933
|
className: "mt-2",
|
|
@@ -2143,7 +2143,7 @@ function ToggleGroup2({
|
|
|
2143
2143
|
"data-orientation": orientation,
|
|
2144
2144
|
style: { "--gap": spacing },
|
|
2145
2145
|
className: cn(
|
|
2146
|
-
"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-vertical:flex-col data-vertical:items-stretch data-[spacing=0]:data-[variant=outline]:rounded-md",
|
|
2146
|
+
"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch data-[spacing=0]:data-[variant=outline]:rounded-md",
|
|
2147
2147
|
className
|
|
2148
2148
|
),
|
|
2149
2149
|
...props,
|
|
@@ -2167,7 +2167,7 @@ function ToggleGroupItem({
|
|
|
2167
2167
|
"data-size": context.size || size,
|
|
2168
2168
|
"data-spacing": context.spacing,
|
|
2169
2169
|
className: cn(
|
|
2170
|
-
"shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-3 group-data-[spacing=0]/toggle-group:shadow-none focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-2.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-2.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",
|
|
2170
|
+
"shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-3 group-data-[spacing=0]/toggle-group:shadow-none focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-2.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-2.5 group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:last:rounded-b-md group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",
|
|
2171
2171
|
toggleVariants({
|
|
2172
2172
|
variant: context.variant || variant,
|
|
2173
2173
|
size: context.size || size
|
|
@@ -2371,10 +2371,7 @@ function DialogPortal({ children, ...props }) {
|
|
|
2371
2371
|
function DialogClose({ ...props }) {
|
|
2372
2372
|
return /* @__PURE__ */ jsx(Dialog$1.Close, { "data-slot": "dialog-close", ...props });
|
|
2373
2373
|
}
|
|
2374
|
-
function DialogOverlay({
|
|
2375
|
-
className,
|
|
2376
|
-
...props
|
|
2377
|
-
}) {
|
|
2374
|
+
function DialogOverlay({ className, ...props }) {
|
|
2378
2375
|
return /* @__PURE__ */ jsx(Dialog$1.Overlay, { "data-slot": "dialog-overlay", asChild: true, forceMount: true, ...props, children: /* @__PURE__ */ jsx(
|
|
2379
2376
|
motion.div,
|
|
2380
2377
|
{
|
|
@@ -2447,6 +2444,16 @@ function DialogHeader({ className, ...props }) {
|
|
|
2447
2444
|
}
|
|
2448
2445
|
);
|
|
2449
2446
|
}
|
|
2447
|
+
function DialogBody({ className, ...props }) {
|
|
2448
|
+
return /* @__PURE__ */ jsx(
|
|
2449
|
+
"div",
|
|
2450
|
+
{
|
|
2451
|
+
"data-slot": "dialog-body",
|
|
2452
|
+
className: cn("flex-1 overflow-y-auto px-6 pb-6", className),
|
|
2453
|
+
...props
|
|
2454
|
+
}
|
|
2455
|
+
);
|
|
2456
|
+
}
|
|
2450
2457
|
function DialogFooter({
|
|
2451
2458
|
className,
|
|
2452
2459
|
showCloseButton = false,
|
|
@@ -2785,7 +2792,7 @@ function Combobox({
|
|
|
2785
2792
|
className: cn(
|
|
2786
2793
|
"border-input w-64 justify-between border bg-transparent text-sm font-normal shadow-xs",
|
|
2787
2794
|
"hover:text-foreground focus-visible:ring-ring/30 hover:bg-transparent",
|
|
2788
|
-
|
|
2795
|
+
selected ? "text-foreground" : "text-muted-foreground",
|
|
2789
2796
|
className
|
|
2790
2797
|
),
|
|
2791
2798
|
children: [
|
|
@@ -4324,16 +4331,32 @@ var Navbar = forwardRef(
|
|
|
4324
4331
|
utilityLinks = defaultUtilityLinks,
|
|
4325
4332
|
navigationLinks = defaultNavigationLinks,
|
|
4326
4333
|
notificationCount = 1,
|
|
4334
|
+
notifications,
|
|
4327
4335
|
avatarSrc,
|
|
4328
4336
|
avatarFallback,
|
|
4329
4337
|
onNavLinkClick,
|
|
4330
4338
|
onSearchClick,
|
|
4331
4339
|
onHelpClick,
|
|
4332
4340
|
onAvatarClick,
|
|
4341
|
+
onNotificationClick,
|
|
4333
4342
|
...props
|
|
4334
4343
|
}, ref) => {
|
|
4335
4344
|
const containerRef = useRef(null);
|
|
4345
|
+
const notifRef = useRef(null);
|
|
4336
4346
|
const [isMobile, setIsMobile] = useState(false);
|
|
4347
|
+
const [notifOpen, setNotifOpen] = useState(false);
|
|
4348
|
+
const notifArray = Array.isArray(notifications) ? notifications : void 0;
|
|
4349
|
+
const unreadCount = notifArray ? notifArray.filter((n) => !n.read).length : notificationCount;
|
|
4350
|
+
useEffect(() => {
|
|
4351
|
+
if (!notifOpen) return;
|
|
4352
|
+
const handler = (e) => {
|
|
4353
|
+
if (notifRef.current && !notifRef.current.contains(e.target)) {
|
|
4354
|
+
setNotifOpen(false);
|
|
4355
|
+
}
|
|
4356
|
+
};
|
|
4357
|
+
document.addEventListener("mousedown", handler);
|
|
4358
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
4359
|
+
}, [notifOpen]);
|
|
4337
4360
|
useEffect(() => {
|
|
4338
4361
|
const checkWidth = () => {
|
|
4339
4362
|
if (containerRef.current) {
|
|
@@ -4395,17 +4418,64 @@ var Navbar = forwardRef(
|
|
|
4395
4418
|
)
|
|
4396
4419
|
] }, i)) }),
|
|
4397
4420
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
4398
|
-
/* @__PURE__ */ jsxs(
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4421
|
+
/* @__PURE__ */ jsxs("div", { ref: notifRef, className: "relative", children: [
|
|
4422
|
+
/* @__PURE__ */ jsxs(
|
|
4423
|
+
"button",
|
|
4424
|
+
{
|
|
4425
|
+
type: "button",
|
|
4426
|
+
onClick: () => notifArray && setNotifOpen((o) => !o),
|
|
4427
|
+
className: "text-muted-foreground hover:text-foreground hover:bg-muted relative flex size-7 cursor-pointer items-center justify-center rounded-md transition-colors",
|
|
4428
|
+
children: [
|
|
4429
|
+
/* @__PURE__ */ jsx(BellIcon, { className: "size-3.5" }),
|
|
4430
|
+
unreadCount > 0 && /* @__PURE__ */ jsx("span", { className: "bg-secondary absolute top-1 right-1 flex size-1.5 rounded-full" })
|
|
4431
|
+
]
|
|
4432
|
+
}
|
|
4433
|
+
),
|
|
4434
|
+
notifArray && /* @__PURE__ */ jsxs(
|
|
4435
|
+
"div",
|
|
4436
|
+
{
|
|
4437
|
+
className: cn(
|
|
4438
|
+
"border-border bg-popover absolute right-0 top-full z-50 w-80 overflow-hidden rounded-lg border shadow-lg transition-all duration-150",
|
|
4439
|
+
notifOpen ? "pointer-events-auto translate-y-1 opacity-100" : "pointer-events-none -translate-y-1 opacity-0"
|
|
4440
|
+
),
|
|
4441
|
+
children: [
|
|
4442
|
+
/* @__PURE__ */ jsx("div", { className: "border-border border-b px-4 py-2", children: /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold", children: "Notifications" }) }),
|
|
4443
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-80 overflow-y-auto", children: notifArray.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground px-4 py-6 text-center text-sm", children: "No notifications" }) : notifArray.map((n) => /* @__PURE__ */ jsxs(
|
|
4444
|
+
"button",
|
|
4445
|
+
{
|
|
4446
|
+
type: "button",
|
|
4447
|
+
onClick: () => {
|
|
4448
|
+
onNotificationClick?.(n.id);
|
|
4449
|
+
setNotifOpen(false);
|
|
4450
|
+
},
|
|
4451
|
+
className: cn(
|
|
4452
|
+
"hover:bg-muted flex w-full items-start gap-3 px-4 py-3 text-left transition-colors",
|
|
4453
|
+
!n.read && "bg-muted/40"
|
|
4454
|
+
),
|
|
4455
|
+
children: [
|
|
4456
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
4457
|
+
/* @__PURE__ */ jsx(
|
|
4458
|
+
"p",
|
|
4459
|
+
{
|
|
4460
|
+
className: cn(
|
|
4461
|
+
"text-sm",
|
|
4462
|
+
!n.read && "font-semibold"
|
|
4463
|
+
),
|
|
4464
|
+
children: n.title
|
|
4465
|
+
}
|
|
4466
|
+
),
|
|
4467
|
+
n.description && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-0.5 truncate text-xs", children: n.description }),
|
|
4468
|
+
n.timestamp && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: n.timestamp })
|
|
4469
|
+
] }),
|
|
4470
|
+
!n.read && /* @__PURE__ */ jsx("span", { className: "bg-secondary mt-1.5 size-2 shrink-0 rounded-full" })
|
|
4471
|
+
]
|
|
4472
|
+
},
|
|
4473
|
+
n.id
|
|
4474
|
+
)) })
|
|
4475
|
+
]
|
|
4476
|
+
}
|
|
4477
|
+
)
|
|
4478
|
+
] }),
|
|
4409
4479
|
/* @__PURE__ */ jsx(
|
|
4410
4480
|
"button",
|
|
4411
4481
|
{
|
|
@@ -4580,6 +4650,84 @@ function NavigationMenuIndicator({
|
|
|
4580
4650
|
}
|
|
4581
4651
|
);
|
|
4582
4652
|
}
|
|
4653
|
+
function matchPermission(pattern, permission) {
|
|
4654
|
+
if (pattern === "*") return true;
|
|
4655
|
+
if (pattern === permission) return true;
|
|
4656
|
+
const patternParts = pattern.split(".");
|
|
4657
|
+
const permParts = permission.split(".");
|
|
4658
|
+
if (patternParts.length !== permParts.length) return false;
|
|
4659
|
+
return patternParts.every((part, i) => part === "*" || part === permParts[i]);
|
|
4660
|
+
}
|
|
4661
|
+
function matchesAny(permissionSet, permission) {
|
|
4662
|
+
if (permissionSet.has(permission)) return true;
|
|
4663
|
+
for (const pattern of permissionSet) {
|
|
4664
|
+
if (matchPermission(pattern, permission)) return true;
|
|
4665
|
+
}
|
|
4666
|
+
return false;
|
|
4667
|
+
}
|
|
4668
|
+
var AbilityContext = createContext(void 0);
|
|
4669
|
+
AbilityContext.displayName = "AbilityContext";
|
|
4670
|
+
function AbilityProvider({ children, permissions }) {
|
|
4671
|
+
const [permissionSet, setPermissionSet] = useState(
|
|
4672
|
+
() => new Set(permissions ?? [])
|
|
4673
|
+
);
|
|
4674
|
+
const can = useCallback(
|
|
4675
|
+
(perms, mode = "any") => {
|
|
4676
|
+
const list = Array.isArray(perms) ? perms : [perms];
|
|
4677
|
+
if (list.length === 0) return false;
|
|
4678
|
+
if (permissionSet.has("*")) return true;
|
|
4679
|
+
if (mode === "all") {
|
|
4680
|
+
return list.every((p) => matchesAny(permissionSet, p));
|
|
4681
|
+
}
|
|
4682
|
+
return list.some((p) => matchesAny(permissionSet, p));
|
|
4683
|
+
},
|
|
4684
|
+
[permissionSet]
|
|
4685
|
+
);
|
|
4686
|
+
const setAbilities = useCallback((perms) => {
|
|
4687
|
+
setPermissionSet(new Set(perms));
|
|
4688
|
+
}, []);
|
|
4689
|
+
const clearAbilities = useCallback(() => {
|
|
4690
|
+
setPermissionSet(/* @__PURE__ */ new Set());
|
|
4691
|
+
}, []);
|
|
4692
|
+
const syncedKey = useRef(permissions ? permissions.join("|") : null);
|
|
4693
|
+
useEffect(() => {
|
|
4694
|
+
if (permissions === void 0) return;
|
|
4695
|
+
const key = permissions.join("|");
|
|
4696
|
+
if (key === syncedKey.current) return;
|
|
4697
|
+
syncedKey.current = key;
|
|
4698
|
+
setPermissionSet(new Set(permissions));
|
|
4699
|
+
}, [permissions]);
|
|
4700
|
+
const value = useMemo(
|
|
4701
|
+
() => ({ can, setAbilities, clearAbilities }),
|
|
4702
|
+
[can, setAbilities, clearAbilities]
|
|
4703
|
+
);
|
|
4704
|
+
return /* @__PURE__ */ jsx(AbilityContext.Provider, { value, children });
|
|
4705
|
+
}
|
|
4706
|
+
function useAbility() {
|
|
4707
|
+
const context = useContext(AbilityContext);
|
|
4708
|
+
if (!context) {
|
|
4709
|
+
throw new Error("useAbility must be used within an AbilityProvider");
|
|
4710
|
+
}
|
|
4711
|
+
return context;
|
|
4712
|
+
}
|
|
4713
|
+
function useCan(permissions, mode = "any") {
|
|
4714
|
+
const { can } = useAbility();
|
|
4715
|
+
return can(permissions, mode);
|
|
4716
|
+
}
|
|
4717
|
+
function Can({ permission, mode = "any", negate = false, fallback = null, children }) {
|
|
4718
|
+
const { can } = useAbility();
|
|
4719
|
+
const hasPermission = can(permission, mode);
|
|
4720
|
+
const show = negate ? !hasPermission : hasPermission;
|
|
4721
|
+
if (typeof children === "function") {
|
|
4722
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: children(show) });
|
|
4723
|
+
}
|
|
4724
|
+
return show ? /* @__PURE__ */ jsx(Fragment$1, { children }) : /* @__PURE__ */ jsx(Fragment$1, { children: fallback });
|
|
4725
|
+
}
|
|
4726
|
+
Can.displayName = "Can";
|
|
4727
|
+
function CanNot({ permission, mode = "any", fallback = null, children }) {
|
|
4728
|
+
return /* @__PURE__ */ jsx(Can, { permission, mode, negate: true, fallback, children });
|
|
4729
|
+
}
|
|
4730
|
+
CanNot.displayName = "CanNot";
|
|
4583
4731
|
var SidebarContext = createContext({
|
|
4584
4732
|
open: true,
|
|
4585
4733
|
setOpen: () => {
|
|
@@ -4808,39 +4956,52 @@ function SidebarBrand({ brandName }) {
|
|
|
4808
4956
|
/* @__PURE__ */ jsx("span", { className: "truncate text-sm font-semibold", children: brandName })
|
|
4809
4957
|
] });
|
|
4810
4958
|
}
|
|
4811
|
-
function
|
|
4959
|
+
function AppShell({
|
|
4812
4960
|
items = defaultItems,
|
|
4813
4961
|
activeItem,
|
|
4814
4962
|
onItemClick,
|
|
4815
4963
|
brandName = "Total Portal",
|
|
4816
4964
|
showHeader = true,
|
|
4817
4965
|
className,
|
|
4966
|
+
mainClassName,
|
|
4818
4967
|
children
|
|
4819
4968
|
}) {
|
|
4820
4969
|
return /* @__PURE__ */ jsxs(SidebarProvider, { className: cn("min-h-0", className), children: [
|
|
4821
4970
|
/* @__PURE__ */ jsxs(Sidebar, { collapsible: "icon", children: [
|
|
4822
4971
|
/* @__PURE__ */ jsxs(SidebarHeader, { className: "flex flex-row items-center gap-2 p-2", children: [
|
|
4823
|
-
/* @__PURE__ */ jsx(SidebarTrigger, { variant: "
|
|
4972
|
+
/* @__PURE__ */ jsx(SidebarTrigger, { variant: "ghost", className: "size-8 shrink-0" }),
|
|
4824
4973
|
/* @__PURE__ */ jsx(SidebarBrand, { brandName })
|
|
4825
4974
|
] }),
|
|
4826
|
-
/* @__PURE__ */ jsx(SidebarContent, { children: /* @__PURE__ */ jsx(SidebarGroup, { children: /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: items.map((item) =>
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4975
|
+
/* @__PURE__ */ jsx(SidebarContent, { children: /* @__PURE__ */ jsx(SidebarGroup, { children: /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: items.map((item) => {
|
|
4976
|
+
const menuItem = /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(
|
|
4977
|
+
SidebarMenuButton,
|
|
4978
|
+
{
|
|
4979
|
+
isActive: activeItem === item.label || item.active,
|
|
4980
|
+
onClick: () => {
|
|
4981
|
+
item.onClick?.();
|
|
4982
|
+
onItemClick?.(item.label);
|
|
4983
|
+
},
|
|
4984
|
+
children: [
|
|
4985
|
+
item.icon,
|
|
4986
|
+
/* @__PURE__ */ jsx("span", { children: item.label })
|
|
4987
|
+
]
|
|
4988
|
+
}
|
|
4989
|
+
) }, item.label);
|
|
4990
|
+
if (!item.permission) return menuItem;
|
|
4991
|
+
return /* @__PURE__ */ jsx(
|
|
4992
|
+
Can,
|
|
4993
|
+
{
|
|
4994
|
+
permission: item.permission,
|
|
4995
|
+
mode: item.permissionMode,
|
|
4996
|
+
children: menuItem
|
|
4833
4997
|
},
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
]
|
|
4838
|
-
}
|
|
4839
|
-
) }, item.label)) }) }) }) })
|
|
4998
|
+
item.label
|
|
4999
|
+
);
|
|
5000
|
+
}) }) }) }) })
|
|
4840
5001
|
] }),
|
|
4841
5002
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col", children: [
|
|
4842
5003
|
showHeader && /* @__PURE__ */ jsx("header", { className: "flex h-14 items-center justify-between border-b px-4", children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: brandName }) }),
|
|
4843
|
-
/* @__PURE__ */ jsx("main", { className: "overflow-y-auto flex-1 p-6", children })
|
|
5004
|
+
/* @__PURE__ */ jsx("main", { className: cn("overflow-y-auto flex-1 p-6", mainClassName), children })
|
|
4844
5005
|
] })
|
|
4845
5006
|
] });
|
|
4846
5007
|
}
|
|
@@ -7344,85 +7505,15 @@ function DataTableSearch({
|
|
|
7344
7505
|
)
|
|
7345
7506
|
] });
|
|
7346
7507
|
}
|
|
7347
|
-
function
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
return
|
|
7354
|
-
}
|
|
7355
|
-
function matchesAny(permissionSet, permission) {
|
|
7356
|
-
if (permissionSet.has(permission)) return true;
|
|
7357
|
-
for (const pattern of permissionSet) {
|
|
7358
|
-
if (matchPermission(pattern, permission)) return true;
|
|
7359
|
-
}
|
|
7360
|
-
return false;
|
|
7361
|
-
}
|
|
7362
|
-
var AbilityContext = createContext(void 0);
|
|
7363
|
-
AbilityContext.displayName = "AbilityContext";
|
|
7364
|
-
function AbilityProvider({ children, permissions }) {
|
|
7365
|
-
const [permissionSet, setPermissionSet] = useState(
|
|
7366
|
-
() => new Set(permissions ?? [])
|
|
7367
|
-
);
|
|
7368
|
-
const can = useCallback(
|
|
7369
|
-
(perms, mode = "any") => {
|
|
7370
|
-
const list = Array.isArray(perms) ? perms : [perms];
|
|
7371
|
-
if (list.length === 0) return false;
|
|
7372
|
-
if (permissionSet.has("*")) return true;
|
|
7373
|
-
if (mode === "all") {
|
|
7374
|
-
return list.every((p) => matchesAny(permissionSet, p));
|
|
7375
|
-
}
|
|
7376
|
-
return list.some((p) => matchesAny(permissionSet, p));
|
|
7377
|
-
},
|
|
7378
|
-
[permissionSet]
|
|
7379
|
-
);
|
|
7380
|
-
const setAbilities = useCallback((perms) => {
|
|
7381
|
-
setPermissionSet(new Set(perms));
|
|
7382
|
-
}, []);
|
|
7383
|
-
const clearAbilities = useCallback(() => {
|
|
7384
|
-
setPermissionSet(/* @__PURE__ */ new Set());
|
|
7385
|
-
}, []);
|
|
7386
|
-
const syncedKey = useRef(permissions ? permissions.join("|") : null);
|
|
7387
|
-
useEffect(() => {
|
|
7388
|
-
if (permissions === void 0) return;
|
|
7389
|
-
const key = permissions.join("|");
|
|
7390
|
-
if (key === syncedKey.current) return;
|
|
7391
|
-
syncedKey.current = key;
|
|
7392
|
-
setPermissionSet(new Set(permissions));
|
|
7393
|
-
}, [permissions]);
|
|
7394
|
-
const value = useMemo(
|
|
7395
|
-
() => ({ can, setAbilities, clearAbilities }),
|
|
7396
|
-
[can, setAbilities, clearAbilities]
|
|
7397
|
-
);
|
|
7398
|
-
return /* @__PURE__ */ jsx(AbilityContext.Provider, { value, children });
|
|
7399
|
-
}
|
|
7400
|
-
function useAbility() {
|
|
7401
|
-
const context = useContext(AbilityContext);
|
|
7402
|
-
if (!context) {
|
|
7403
|
-
throw new Error("useAbility must be used within an AbilityProvider");
|
|
7404
|
-
}
|
|
7405
|
-
return context;
|
|
7406
|
-
}
|
|
7407
|
-
function useCan(permissions, mode = "any") {
|
|
7408
|
-
const { can } = useAbility();
|
|
7409
|
-
return can(permissions, mode);
|
|
7410
|
-
}
|
|
7411
|
-
function Can({ permission, mode = "any", negate = false, fallback = null, children }) {
|
|
7412
|
-
const { can } = useAbility();
|
|
7413
|
-
const hasPermission = can(permission, mode);
|
|
7414
|
-
const show = negate ? !hasPermission : hasPermission;
|
|
7415
|
-
if (typeof children === "function") {
|
|
7416
|
-
return /* @__PURE__ */ jsx(Fragment$1, { children: children(show) });
|
|
7417
|
-
}
|
|
7418
|
-
return show ? /* @__PURE__ */ jsx(Fragment$1, { children }) : /* @__PURE__ */ jsx(Fragment$1, { children: fallback });
|
|
7419
|
-
}
|
|
7420
|
-
Can.displayName = "Can";
|
|
7421
|
-
function CanNot({ permission, mode = "any", fallback = null, children }) {
|
|
7422
|
-
return /* @__PURE__ */ jsx(Can, { permission, mode, negate: true, fallback, children });
|
|
7508
|
+
function TCCEProvider({
|
|
7509
|
+
children,
|
|
7510
|
+
permissions,
|
|
7511
|
+
toasterPosition,
|
|
7512
|
+
tooltipDelayDuration
|
|
7513
|
+
}) {
|
|
7514
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: tooltipDelayDuration, children: /* @__PURE__ */ jsx(AbilityProvider, { permissions, children: /* @__PURE__ */ jsx(Toaster, { position: toasterPosition, children }) }) });
|
|
7423
7515
|
}
|
|
7424
|
-
CanNot.displayName = "CanNot";
|
|
7425
7516
|
|
|
7426
|
-
export { AbilityProvider, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge2 as Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, Can, CanNot, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, ColorPicker, ColorPickerAlpha, ColorPickerEyeDropper, ColorPickerFormat, ColorPickerHue, ColorPickerOutput, ColorPickerPresets, ColorPickerSelection, Combobox, DataTable, DataTableCardView, DataTableColumnFilter, DataTableFooter, DataTableHeaderCell, DataTableRowActions, DataTableSearch, DataTableSkeleton, DataTableToolbar, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, DropzoneContent, DropzoneEmptyState, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, EventCalendar, Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FilterOption, Input, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Link, Logo, MiniCalendar, MiniCalendarDay, MiniCalendarDays, MiniCalendarNavigation, Navbar, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PinInput, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, SegmentedControl, SegmentedControlItem, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator,
|
|
7517
|
+
export { AbilityProvider, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppShell, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge2 as Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, Can, CanNot, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, ColorPicker, ColorPickerAlpha, ColorPickerEyeDropper, ColorPickerFormat, ColorPickerHue, ColorPickerOutput, ColorPickerPresets, ColorPickerSelection, Combobox, DataTable, DataTableCardView, DataTableColumnFilter, DataTableFooter, DataTableHeaderCell, DataTableRowActions, DataTableSearch, DataTableSkeleton, DataTableToolbar, DatePicker, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, DropzoneContent, DropzoneEmptyState, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, EventCalendar, Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FilterOption, Input, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Link, Logo, MiniCalendar, MiniCalendarDay, MiniCalendarDays, MiniCalendarNavigation, Navbar, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PinInput, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, SegmentedControl, SegmentedControlItem, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SidebarProvider, SidebarTrigger, Skeleton, Slider, Spinner, SpinnerDots, SpinnerLoader, Status, StatusIndicator, StatusLabel, Switch, TCCEProvider, TEXT_SIZES, TEXT_WEIGHTS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TablePagination, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Text, Textarea, Toaster, Toggle, ToggleGroup2 as ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, alertVariants, animation, avatarVariants, badgeVariants2 as badgeVariants, buttonVariants, columnFiltersToArrayQueryParams, columnFiltersToJsonString, columnFiltersToQueryParams, columnFiltersToRecord, createBackendParams, createBackendParamsWithFilters, duration, ease, fadeIn, getActiveFilterCount, getActiveFilterValues, getColumnValueCounts, getUniqueColumnValues, hasActiveFilters, linkVariants, logos, matchPermission, mergeFilters, multiSelectFilter, navigationMenuTriggerStyle, parseJsonToFilters, parseQueryParamsToFilters, progressIndicatorVariants, progressVariants, scaleIn, searchInArray, skeletonVariants, slideRight, slideUp, sortRecordToSortingState, sortingStateToJsonString, sortingStateToRecord, spinnerDotsVariants, spinnerLoaderVariants, spinnerVariants, spring, stagger, toggleVariants, tooltipContentVariants, transition, useAbility, useAppForm, useCan, useCarousel, useColorPicker, useColumnFilter, useTableContext, useTableData, useTableFiltering, useTableGlobalFilter, useTableSizing, useTableSorting, useTableVisibility, useToast };
|
|
7427
7518
|
//# sourceMappingURL=main.js.map
|
|
7428
7519
|
//# sourceMappingURL=main.js.map
|