@bizapps/design-system-testing 1.0.4 → 1.0.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/dist/main.cjs CHANGED
@@ -1558,7 +1558,7 @@ function Separator({
1558
1558
  decorative,
1559
1559
  orientation,
1560
1560
  className: cn(
1561
- "bg-foreground/20 flex h-10 shrink-0 items-center data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
1561
+ "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",
1562
1562
  className
1563
1563
  ),
1564
1564
  ...props
@@ -1677,12 +1677,12 @@ function Slider({
1677
1677
  radixUi.Slider.Track,
1678
1678
  {
1679
1679
  "data-slot": "slider-track",
1680
- 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",
1680
+ 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",
1681
1681
  children: /* @__PURE__ */ jsxRuntime.jsx(
1682
1682
  radixUi.Slider.Range,
1683
1683
  {
1684
1684
  "data-slot": "slider-range",
1685
- className: "bg-primary absolute select-none data-horizontal:h-full data-vertical:w-full"
1685
+ className: "bg-primary absolute select-none data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
1686
1686
  }
1687
1687
  )
1688
1688
  }
@@ -1932,7 +1932,7 @@ function TabsContent({
1932
1932
  className
1933
1933
  ),
1934
1934
  ...props,
1935
- children: /* @__PURE__ */ jsxRuntime.jsx(react$1.AnimatePresence, { mode: "wait", initial: false, children: isActive && /* @__PURE__ */ jsxRuntime.jsx(
1935
+ children: /* @__PURE__ */ jsxRuntime.jsx(react$1.AnimatePresence, { mode: "popLayout", initial: false, children: isActive && /* @__PURE__ */ jsxRuntime.jsx(
1936
1936
  react$1.motion.div,
1937
1937
  {
1938
1938
  className: "mt-2",
@@ -2148,7 +2148,7 @@ function ToggleGroup2({
2148
2148
  "data-orientation": orientation,
2149
2149
  style: { "--gap": spacing },
2150
2150
  className: cn(
2151
- "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",
2151
+ "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",
2152
2152
  className
2153
2153
  ),
2154
2154
  ...props,
@@ -2172,7 +2172,7 @@ function ToggleGroupItem({
2172
2172
  "data-size": context.size || size,
2173
2173
  "data-spacing": context.spacing,
2174
2174
  className: cn(
2175
- "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",
2175
+ "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",
2176
2176
  toggleVariants({
2177
2177
  variant: context.variant || variant,
2178
2178
  size: context.size || size
@@ -2790,7 +2790,7 @@ function Combobox({
2790
2790
  className: cn(
2791
2791
  "border-input w-64 justify-between border bg-transparent text-sm font-normal shadow-xs",
2792
2792
  "hover:text-foreground focus-visible:ring-ring/30 hover:bg-transparent",
2793
- !selected && "text-muted-foreground",
2793
+ selected ? "text-foreground" : "text-muted-foreground",
2794
2794
  className
2795
2795
  ),
2796
2796
  children: [
@@ -4329,16 +4329,32 @@ var Navbar = react.forwardRef(
4329
4329
  utilityLinks = defaultUtilityLinks,
4330
4330
  navigationLinks = defaultNavigationLinks,
4331
4331
  notificationCount = 1,
4332
+ notifications,
4332
4333
  avatarSrc,
4333
4334
  avatarFallback,
4334
4335
  onNavLinkClick,
4335
4336
  onSearchClick,
4336
4337
  onHelpClick,
4337
4338
  onAvatarClick,
4339
+ onNotificationClick,
4338
4340
  ...props
4339
4341
  }, ref) => {
4340
4342
  const containerRef = react.useRef(null);
4343
+ const notifRef = react.useRef(null);
4341
4344
  const [isMobile, setIsMobile] = react.useState(false);
4345
+ const [notifOpen, setNotifOpen] = react.useState(false);
4346
+ const notifArray = Array.isArray(notifications) ? notifications : void 0;
4347
+ const unreadCount = notifArray ? notifArray.filter((n) => !n.read).length : notificationCount;
4348
+ react.useEffect(() => {
4349
+ if (!notifOpen) return;
4350
+ const handler = (e) => {
4351
+ if (notifRef.current && !notifRef.current.contains(e.target)) {
4352
+ setNotifOpen(false);
4353
+ }
4354
+ };
4355
+ document.addEventListener("mousedown", handler);
4356
+ return () => document.removeEventListener("mousedown", handler);
4357
+ }, [notifOpen]);
4342
4358
  react.useEffect(() => {
4343
4359
  const checkWidth = () => {
4344
4360
  if (containerRef.current) {
@@ -4400,17 +4416,64 @@ var Navbar = react.forwardRef(
4400
4416
  )
4401
4417
  ] }, i)) }),
4402
4418
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
4403
- /* @__PURE__ */ jsxRuntime.jsxs(
4404
- "button",
4405
- {
4406
- type: "button",
4407
- className: "text-muted-foreground hover:text-foreground hover:bg-muted relative flex size-7 cursor-pointer items-center justify-center rounded-md transition-colors",
4408
- children: [
4409
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BellIcon, { className: "size-3.5" }),
4410
- notificationCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-secondary absolute top-1 right-1 flex size-1.5 rounded-full" })
4411
- ]
4412
- }
4413
- ),
4419
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: notifRef, className: "relative", children: [
4420
+ /* @__PURE__ */ jsxRuntime.jsxs(
4421
+ "button",
4422
+ {
4423
+ type: "button",
4424
+ onClick: () => notifArray && setNotifOpen((o) => !o),
4425
+ className: "text-muted-foreground hover:text-foreground hover:bg-muted relative flex size-7 cursor-pointer items-center justify-center rounded-md transition-colors",
4426
+ children: [
4427
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BellIcon, { className: "size-3.5" }),
4428
+ unreadCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-secondary absolute top-1 right-1 flex size-1.5 rounded-full" })
4429
+ ]
4430
+ }
4431
+ ),
4432
+ notifArray && /* @__PURE__ */ jsxRuntime.jsxs(
4433
+ "div",
4434
+ {
4435
+ className: cn(
4436
+ "border-border bg-popover absolute right-0 top-full z-50 w-80 overflow-hidden rounded-lg border shadow-lg transition-all duration-150",
4437
+ notifOpen ? "pointer-events-auto translate-y-1 opacity-100" : "pointer-events-none -translate-y-1 opacity-0"
4438
+ ),
4439
+ children: [
4440
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-border border-b px-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold", children: "Notifications" }) }),
4441
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-80 overflow-y-auto", children: notifArray.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground px-4 py-6 text-center text-sm", children: "No notifications" }) : notifArray.map((n) => /* @__PURE__ */ jsxRuntime.jsxs(
4442
+ "button",
4443
+ {
4444
+ type: "button",
4445
+ onClick: () => {
4446
+ onNotificationClick?.(n.id);
4447
+ setNotifOpen(false);
4448
+ },
4449
+ className: cn(
4450
+ "hover:bg-muted flex w-full items-start gap-3 px-4 py-3 text-left transition-colors",
4451
+ !n.read && "bg-muted/40"
4452
+ ),
4453
+ children: [
4454
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
4455
+ /* @__PURE__ */ jsxRuntime.jsx(
4456
+ "p",
4457
+ {
4458
+ className: cn(
4459
+ "text-sm",
4460
+ !n.read && "font-semibold"
4461
+ ),
4462
+ children: n.title
4463
+ }
4464
+ ),
4465
+ n.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mt-0.5 truncate text-xs", children: n.description }),
4466
+ n.timestamp && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: n.timestamp })
4467
+ ] }),
4468
+ !n.read && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-secondary mt-1.5 size-2 shrink-0 rounded-full" })
4469
+ ]
4470
+ },
4471
+ n.id
4472
+ )) })
4473
+ ]
4474
+ }
4475
+ )
4476
+ ] }),
4414
4477
  /* @__PURE__ */ jsxRuntime.jsx(
4415
4478
  "button",
4416
4479
  {
@@ -4820,12 +4883,13 @@ function SideBar({
4820
4883
  brandName = "Total Portal",
4821
4884
  showHeader = true,
4822
4885
  className,
4886
+ mainClassName,
4823
4887
  children
4824
4888
  }) {
4825
4889
  return /* @__PURE__ */ jsxRuntime.jsxs(SidebarProvider, { className: cn("min-h-0", className), children: [
4826
4890
  /* @__PURE__ */ jsxRuntime.jsxs(Sidebar, { collapsible: "icon", children: [
4827
4891
  /* @__PURE__ */ jsxRuntime.jsxs(SidebarHeader, { className: "flex flex-row items-center gap-2 p-2", children: [
4828
- /* @__PURE__ */ jsxRuntime.jsx(SidebarTrigger, { variant: "outline", className: "size-8 shrink-0" }),
4892
+ /* @__PURE__ */ jsxRuntime.jsx(SidebarTrigger, { variant: "ghost", className: "size-8 shrink-0" }),
4829
4893
  /* @__PURE__ */ jsxRuntime.jsx(SidebarBrand, { brandName })
4830
4894
  ] }),
4831
4895
  /* @__PURE__ */ jsxRuntime.jsx(SidebarContent, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4845,7 +4909,7 @@ function SideBar({
4845
4909
  ] }),
4846
4910
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col", children: [
4847
4911
  showHeader && /* @__PURE__ */ jsxRuntime.jsx("header", { className: "flex h-14 items-center justify-between border-b px-4", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: brandName }) }),
4848
- /* @__PURE__ */ jsxRuntime.jsx("main", { className: "overflow-y-auto flex-1 p-6", children })
4912
+ /* @__PURE__ */ jsxRuntime.jsx("main", { className: cn("overflow-y-auto flex-1 p-6", mainClassName), children })
4849
4913
  ] })
4850
4914
  ] });
4851
4915
  }
@@ -7427,6 +7491,17 @@ function CanNot({ permission, mode = "any", fallback = null, children }) {
7427
7491
  return /* @__PURE__ */ jsxRuntime.jsx(Can, { permission, mode, negate: true, fallback, children });
7428
7492
  }
7429
7493
  CanNot.displayName = "CanNot";
7494
+ function TCCEProvider({
7495
+ children,
7496
+ permissions,
7497
+ toasterPosition,
7498
+ tooltipDelayDuration
7499
+ }) {
7500
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration: tooltipDelayDuration, children: /* @__PURE__ */ jsxRuntime.jsxs(AbilityProvider, { permissions, children: [
7501
+ children,
7502
+ /* @__PURE__ */ jsxRuntime.jsx(Toaster, { position: toasterPosition })
7503
+ ] }) });
7504
+ }
7430
7505
 
7431
7506
  Object.defineProperty(exports, "Controller", {
7432
7507
  enumerable: true,
@@ -7621,6 +7696,7 @@ exports.Status = Status;
7621
7696
  exports.StatusIndicator = StatusIndicator;
7622
7697
  exports.StatusLabel = StatusLabel;
7623
7698
  exports.Switch = Switch;
7699
+ exports.TCCEProvider = TCCEProvider;
7624
7700
  exports.TEXT_SIZES = TEXT_SIZES;
7625
7701
  exports.TEXT_WEIGHTS = TEXT_WEIGHTS;
7626
7702
  exports.Table = Table;