@scripso-homepad/ui 0.4.15 → 0.4.16

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.
@@ -91,11 +91,20 @@ type SidebarProps = {
91
91
  branding: AdminSidebarBranding;
92
92
  labels: AdminSidebarLabels;
93
93
  sidebarStorageKey: string;
94
+ /**
95
+ * Current location pathname from the host app router.
96
+ * Pass `useLocation().pathname` from the app that owns `BrowserRouter`.
97
+ */
98
+ pathname: string;
94
99
  user?: AdminSidebarUser;
95
100
  onLogout?: () => void;
96
101
  className?: string;
97
102
  mobileOpen: boolean;
98
103
  onMobileClose?: () => void;
104
+ /**
105
+ * Host-owned navigation. Call `navigate(item.to)` from the app router here.
106
+ * The sidebar never imports react-router, so this must perform the route change.
107
+ */
99
108
  onNavItemClick?: (item: AdminNavItem) => void;
100
109
  collapseIcon?: ReactNode;
101
110
  expandIcon?: ReactNode;
@@ -104,7 +113,7 @@ type SidebarProps = {
104
113
  collapsed?: boolean;
105
114
  onCollapsedChange?: (collapsed: boolean) => void;
106
115
  };
107
- declare function Sidebar({ navItems, footerNavItems, branding, labels, sidebarStorageKey, user, onLogout, className, mobileOpen, onMobileClose, onNavItemClick, collapseIcon, expandIcon, closeIcon, initialCollapsed, collapsed, onCollapsedChange, }: SidebarProps): react.JSX.Element;
116
+ declare function Sidebar({ navItems, footerNavItems, branding, labels, sidebarStorageKey, pathname, user, onLogout, className, mobileOpen, onMobileClose, onNavItemClick, collapseIcon, expandIcon, closeIcon, initialCollapsed, collapsed, onCollapsedChange, }: SidebarProps): react.JSX.Element;
108
117
 
109
118
  type SidebarMobileHeaderProps = {
110
119
  branding: Pick<AdminSidebarBranding, 'logoIconSrc' | 'logoTitle' | 'logoTagline'>;
@@ -128,9 +137,16 @@ declare function DashboardLayout({ sidebar, header, mobileHeader, children, clas
128
137
  type SidebarNavItemProps = {
129
138
  item: AdminNavItem;
130
139
  isOpen: boolean;
140
+ isActive: boolean;
131
141
  onNavigate?: (item: AdminNavItem) => void;
132
142
  };
133
- declare function SidebarNavItem({ item, isOpen, onNavigate }: SidebarNavItemProps): react.JSX.Element | null;
143
+ declare function SidebarNavItem({ item, isOpen, isActive, onNavigate }: SidebarNavItemProps): react.JSX.Element | null;
144
+
145
+ /**
146
+ * Matches React Router `<NavLink end>` semantics using a host-provided pathname.
147
+ * Keeps `@scripso-homepad/ui` free of react-router so apps never get duplicate contexts.
148
+ */
149
+ declare function isNavItemActive(pathname: string, item: Pick<AdminNavItem, 'to' | 'end'>): boolean;
134
150
 
135
151
  type SidebarUserCardProps = {
136
152
  user: AdminSidebarUser;
@@ -254,7 +270,7 @@ type TableActionsMenuProps = {
254
270
  menuClassName?: string;
255
271
  /** Dropdown menu width in pixels. Defaults to 231. Ignored when menuFitContent is true. */
256
272
  menuWidth?: number;
257
- /** Size the menu to its content width instead of a fixed pixel width. */
273
+ /** Size the menu to its content width instead of a fixed pixel width. Defaults to true so labels stay on one line. */
258
274
  menuFitContent?: boolean;
259
275
  };
260
276
  declare function TableActionsMenu({ items, triggerAriaLabel, className, menuClassName, menuWidth, menuFitContent, }: TableActionsMenuProps): react.JSX.Element | null;
@@ -494,13 +510,15 @@ type ConfirmModalProps = {
494
510
  confirmText: string;
495
511
  onCancel: () => void;
496
512
  onConfirm: () => void;
513
+ /** Optional centered icon above the title (e.g. trash for delete confirmations). */
514
+ icon?: ReactNode;
497
515
  cancelDisabled?: boolean;
498
516
  confirmDisabled?: boolean;
499
517
  closeOnBackdrop?: boolean;
500
518
  containerClassName?: string;
501
519
  buttonClassName?: string;
502
520
  };
503
- declare function ConfirmModal({ open, title, description, cancelText, confirmText, onCancel, onConfirm, cancelDisabled, confirmDisabled, closeOnBackdrop, containerClassName, buttonClassName, }: ConfirmModalProps): react.JSX.Element | null;
521
+ declare function ConfirmModal({ open, title, description, cancelText, confirmText, onCancel, onConfirm, icon, cancelDisabled, confirmDisabled, closeOnBackdrop, containerClassName, buttonClassName, }: ConfirmModalProps): react.JSX.Element | null;
504
522
 
505
523
  declare function useMediaQuery(query: string): boolean;
506
524
 
@@ -509,4 +527,4 @@ declare function useOnClickOutside<T extends HTMLElement>(ref: OutsideTarget<T>,
509
527
 
510
528
  declare function cn(...inputs: ClassValue[]): string;
511
529
 
512
- export { type AdminBuildingOption, type AdminHeaderLabels, type AdminLayoutLabels, type AdminNavItem, type AdminSidebarBranding, type AdminSidebarLabels, type AdminSidebarUser, AppHeader, type AppHeaderProps, Badge, type BadgeProps, type BadgeVariant, BellIcon, BuildingIcon, BuildingSelect, type BuildingSelectProps, ConfirmModal, type ConfirmModalProps, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, type DashboardLayoutProps, DataTable, type DataTableClassNames, type DataTableProps, Drawer, type DrawerProps, HistoryTimeline, type HistoryTimelineItem, type HistoryTimelineProps, type HomepadToasterProps, Modal, type ModalFooterAlign, type ModalFooterLayout, type ModalProps, type MutationToastMessages, type MutationToastResult, Pagination, type PaginationLabels, type PaginationProps, type PaginationVariant, type RunMutationWithToastOptions, Sidebar, SidebarMobileHeader, type SidebarMobileHeaderProps, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarUserCard, type SidebarUserCardProps, StatusBadge, type StatusBadgeProps, type StatusBadgeTone, Table, TableActionButton, type TableActionButtonProps, type TableActionButtonVariant, TableActionsCell, type TableActionsCellProps, TableActionsMenu, type TableActionsMenuItem, type TableActionsMenuItemTone, type TableActionsMenuProps, TableBody, type TableBodyProps, TableCell, type TableCellProps, type TableCellVariant, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, TableIconText, type TableIconTextProps, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, type TableProps, TableRow, type TableRowActionsConfig, type TableRowProps, TableRowStatusActions, type TableRowStatusActionsProps, TableScrollArea, type TableScrollAreaProps, type TableSortDirection, TableSortIcon, TableStatusActionsCell, type TableStatusActionsCellProps, Toaster, ToasterProvider, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, runMutationWithToast, tableRowDisabledCellClassName, useMediaQuery, useOnClickOutside };
530
+ export { type AdminBuildingOption, type AdminHeaderLabels, type AdminLayoutLabels, type AdminNavItem, type AdminSidebarBranding, type AdminSidebarLabels, type AdminSidebarUser, AppHeader, type AppHeaderProps, Badge, type BadgeProps, type BadgeVariant, BellIcon, BuildingIcon, BuildingSelect, type BuildingSelectProps, ConfirmModal, type ConfirmModalProps, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, type DashboardLayoutProps, DataTable, type DataTableClassNames, type DataTableProps, Drawer, type DrawerProps, HistoryTimeline, type HistoryTimelineItem, type HistoryTimelineProps, type HomepadToasterProps, Modal, type ModalFooterAlign, type ModalFooterLayout, type ModalProps, type MutationToastMessages, type MutationToastResult, Pagination, type PaginationLabels, type PaginationProps, type PaginationVariant, type RunMutationWithToastOptions, Sidebar, SidebarMobileHeader, type SidebarMobileHeaderProps, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarUserCard, type SidebarUserCardProps, StatusBadge, type StatusBadgeProps, type StatusBadgeTone, Table, TableActionButton, type TableActionButtonProps, type TableActionButtonVariant, TableActionsCell, type TableActionsCellProps, TableActionsMenu, type TableActionsMenuItem, type TableActionsMenuItemTone, type TableActionsMenuProps, TableBody, type TableBodyProps, TableCell, type TableCellProps, type TableCellVariant, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, TableIconText, type TableIconTextProps, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, type TableProps, TableRow, type TableRowActionsConfig, type TableRowProps, TableRowStatusActions, type TableRowStatusActionsProps, TableScrollArea, type TableScrollAreaProps, type TableSortDirection, TableSortIcon, TableStatusActionsCell, type TableStatusActionsCellProps, Toaster, ToasterProvider, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, isNavItemActive, runMutationWithToast, tableRowDisabledCellClassName, useMediaQuery, useOnClickOutside };
@@ -91,11 +91,20 @@ type SidebarProps = {
91
91
  branding: AdminSidebarBranding;
92
92
  labels: AdminSidebarLabels;
93
93
  sidebarStorageKey: string;
94
+ /**
95
+ * Current location pathname from the host app router.
96
+ * Pass `useLocation().pathname` from the app that owns `BrowserRouter`.
97
+ */
98
+ pathname: string;
94
99
  user?: AdminSidebarUser;
95
100
  onLogout?: () => void;
96
101
  className?: string;
97
102
  mobileOpen: boolean;
98
103
  onMobileClose?: () => void;
104
+ /**
105
+ * Host-owned navigation. Call `navigate(item.to)` from the app router here.
106
+ * The sidebar never imports react-router, so this must perform the route change.
107
+ */
99
108
  onNavItemClick?: (item: AdminNavItem) => void;
100
109
  collapseIcon?: ReactNode;
101
110
  expandIcon?: ReactNode;
@@ -104,7 +113,7 @@ type SidebarProps = {
104
113
  collapsed?: boolean;
105
114
  onCollapsedChange?: (collapsed: boolean) => void;
106
115
  };
107
- declare function Sidebar({ navItems, footerNavItems, branding, labels, sidebarStorageKey, user, onLogout, className, mobileOpen, onMobileClose, onNavItemClick, collapseIcon, expandIcon, closeIcon, initialCollapsed, collapsed, onCollapsedChange, }: SidebarProps): react.JSX.Element;
116
+ declare function Sidebar({ navItems, footerNavItems, branding, labels, sidebarStorageKey, pathname, user, onLogout, className, mobileOpen, onMobileClose, onNavItemClick, collapseIcon, expandIcon, closeIcon, initialCollapsed, collapsed, onCollapsedChange, }: SidebarProps): react.JSX.Element;
108
117
 
109
118
  type SidebarMobileHeaderProps = {
110
119
  branding: Pick<AdminSidebarBranding, 'logoIconSrc' | 'logoTitle' | 'logoTagline'>;
@@ -128,9 +137,16 @@ declare function DashboardLayout({ sidebar, header, mobileHeader, children, clas
128
137
  type SidebarNavItemProps = {
129
138
  item: AdminNavItem;
130
139
  isOpen: boolean;
140
+ isActive: boolean;
131
141
  onNavigate?: (item: AdminNavItem) => void;
132
142
  };
133
- declare function SidebarNavItem({ item, isOpen, onNavigate }: SidebarNavItemProps): react.JSX.Element | null;
143
+ declare function SidebarNavItem({ item, isOpen, isActive, onNavigate }: SidebarNavItemProps): react.JSX.Element | null;
144
+
145
+ /**
146
+ * Matches React Router `<NavLink end>` semantics using a host-provided pathname.
147
+ * Keeps `@scripso-homepad/ui` free of react-router so apps never get duplicate contexts.
148
+ */
149
+ declare function isNavItemActive(pathname: string, item: Pick<AdminNavItem, 'to' | 'end'>): boolean;
134
150
 
135
151
  type SidebarUserCardProps = {
136
152
  user: AdminSidebarUser;
@@ -254,7 +270,7 @@ type TableActionsMenuProps = {
254
270
  menuClassName?: string;
255
271
  /** Dropdown menu width in pixels. Defaults to 231. Ignored when menuFitContent is true. */
256
272
  menuWidth?: number;
257
- /** Size the menu to its content width instead of a fixed pixel width. */
273
+ /** Size the menu to its content width instead of a fixed pixel width. Defaults to true so labels stay on one line. */
258
274
  menuFitContent?: boolean;
259
275
  };
260
276
  declare function TableActionsMenu({ items, triggerAriaLabel, className, menuClassName, menuWidth, menuFitContent, }: TableActionsMenuProps): react.JSX.Element | null;
@@ -494,13 +510,15 @@ type ConfirmModalProps = {
494
510
  confirmText: string;
495
511
  onCancel: () => void;
496
512
  onConfirm: () => void;
513
+ /** Optional centered icon above the title (e.g. trash for delete confirmations). */
514
+ icon?: ReactNode;
497
515
  cancelDisabled?: boolean;
498
516
  confirmDisabled?: boolean;
499
517
  closeOnBackdrop?: boolean;
500
518
  containerClassName?: string;
501
519
  buttonClassName?: string;
502
520
  };
503
- declare function ConfirmModal({ open, title, description, cancelText, confirmText, onCancel, onConfirm, cancelDisabled, confirmDisabled, closeOnBackdrop, containerClassName, buttonClassName, }: ConfirmModalProps): react.JSX.Element | null;
521
+ declare function ConfirmModal({ open, title, description, cancelText, confirmText, onCancel, onConfirm, icon, cancelDisabled, confirmDisabled, closeOnBackdrop, containerClassName, buttonClassName, }: ConfirmModalProps): react.JSX.Element | null;
504
522
 
505
523
  declare function useMediaQuery(query: string): boolean;
506
524
 
@@ -509,4 +527,4 @@ declare function useOnClickOutside<T extends HTMLElement>(ref: OutsideTarget<T>,
509
527
 
510
528
  declare function cn(...inputs: ClassValue[]): string;
511
529
 
512
- export { type AdminBuildingOption, type AdminHeaderLabels, type AdminLayoutLabels, type AdminNavItem, type AdminSidebarBranding, type AdminSidebarLabels, type AdminSidebarUser, AppHeader, type AppHeaderProps, Badge, type BadgeProps, type BadgeVariant, BellIcon, BuildingIcon, BuildingSelect, type BuildingSelectProps, ConfirmModal, type ConfirmModalProps, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, type DashboardLayoutProps, DataTable, type DataTableClassNames, type DataTableProps, Drawer, type DrawerProps, HistoryTimeline, type HistoryTimelineItem, type HistoryTimelineProps, type HomepadToasterProps, Modal, type ModalFooterAlign, type ModalFooterLayout, type ModalProps, type MutationToastMessages, type MutationToastResult, Pagination, type PaginationLabels, type PaginationProps, type PaginationVariant, type RunMutationWithToastOptions, Sidebar, SidebarMobileHeader, type SidebarMobileHeaderProps, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarUserCard, type SidebarUserCardProps, StatusBadge, type StatusBadgeProps, type StatusBadgeTone, Table, TableActionButton, type TableActionButtonProps, type TableActionButtonVariant, TableActionsCell, type TableActionsCellProps, TableActionsMenu, type TableActionsMenuItem, type TableActionsMenuItemTone, type TableActionsMenuProps, TableBody, type TableBodyProps, TableCell, type TableCellProps, type TableCellVariant, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, TableIconText, type TableIconTextProps, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, type TableProps, TableRow, type TableRowActionsConfig, type TableRowProps, TableRowStatusActions, type TableRowStatusActionsProps, TableScrollArea, type TableScrollAreaProps, type TableSortDirection, TableSortIcon, TableStatusActionsCell, type TableStatusActionsCellProps, Toaster, ToasterProvider, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, runMutationWithToast, tableRowDisabledCellClassName, useMediaQuery, useOnClickOutside };
530
+ export { type AdminBuildingOption, type AdminHeaderLabels, type AdminLayoutLabels, type AdminNavItem, type AdminSidebarBranding, type AdminSidebarLabels, type AdminSidebarUser, AppHeader, type AppHeaderProps, Badge, type BadgeProps, type BadgeVariant, BellIcon, BuildingIcon, BuildingSelect, type BuildingSelectProps, ConfirmModal, type ConfirmModalProps, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, type DashboardLayoutProps, DataTable, type DataTableClassNames, type DataTableProps, Drawer, type DrawerProps, HistoryTimeline, type HistoryTimelineItem, type HistoryTimelineProps, type HomepadToasterProps, Modal, type ModalFooterAlign, type ModalFooterLayout, type ModalProps, type MutationToastMessages, type MutationToastResult, Pagination, type PaginationLabels, type PaginationProps, type PaginationVariant, type RunMutationWithToastOptions, Sidebar, SidebarMobileHeader, type SidebarMobileHeaderProps, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarUserCard, type SidebarUserCardProps, StatusBadge, type StatusBadgeProps, type StatusBadgeTone, Table, TableActionButton, type TableActionButtonProps, type TableActionButtonVariant, TableActionsCell, type TableActionsCellProps, TableActionsMenu, type TableActionsMenuItem, type TableActionsMenuItemTone, type TableActionsMenuProps, TableBody, type TableBodyProps, TableCell, type TableCellProps, type TableCellVariant, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, TableIconText, type TableIconTextProps, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, type TableProps, TableRow, type TableRowActionsConfig, type TableRowProps, TableRowStatusActions, type TableRowStatusActionsProps, TableScrollArea, type TableScrollAreaProps, type TableSortDirection, TableSortIcon, TableStatusActionsCell, type TableStatusActionsCellProps, Toaster, ToasterProvider, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, isNavItemActive, runMutationWithToast, tableRowDisabledCellClassName, useMediaQuery, useOnClickOutside };
package/dist/web/index.js CHANGED
@@ -1,10 +1,9 @@
1
- import { __commonJS, __require, __toESM, Input, Button } from '../chunk-3G3ZKFHX.js';
1
+ import { __commonJS, __require, __toESM, Input, Button } from '../chunk-U7OSCJKA.js';
2
2
  import { ChevronsUpDown, Search, LogOut, PanelLeftClose, PanelLeftOpen, X, Menu, ChevronLeft, ChevronRight } from 'lucide-react';
3
3
  import { clsx } from 'clsx';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
6
  import { createContext, forwardRef, useRef, useEffect, useState, useId, useCallback, useMemo, useContext, useLayoutEffect } from 'react';
7
- import { NavLink, useLocation } from 'react-router-dom';
8
7
  import { Toaster as Toaster$1, toast } from 'sonner';
9
8
  export { toast } from 'sonner';
10
9
  import 'sonner/dist/styles.css';
@@ -7371,7 +7370,7 @@ var require_react_dom_development = __commonJS({
7371
7370
  var HostPortal = 4;
7372
7371
  var HostComponent = 5;
7373
7372
  var HostText = 6;
7374
- var Fragment5 = 7;
7373
+ var Fragment4 = 7;
7375
7374
  var Mode = 8;
7376
7375
  var ContextConsumer = 9;
7377
7376
  var ContextProvider = 10;
@@ -8526,7 +8525,7 @@ var require_react_dom_development = __commonJS({
8526
8525
  return "DehydratedFragment";
8527
8526
  case ForwardRef:
8528
8527
  return getWrappedName$1(type, type.render, "ForwardRef");
8529
- case Fragment5:
8528
+ case Fragment4:
8530
8529
  return "Fragment";
8531
8530
  case HostComponent:
8532
8531
  return type;
@@ -16951,7 +16950,7 @@ var require_react_dom_development = __commonJS({
16951
16950
  }
16952
16951
  }
16953
16952
  function updateFragment2(returnFiber, current2, fragment, lanes, key) {
16954
- if (current2 === null || current2.tag !== Fragment5) {
16953
+ if (current2 === null || current2.tag !== Fragment4) {
16955
16954
  var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
16956
16955
  created.return = returnFiber;
16957
16956
  return created;
@@ -17354,7 +17353,7 @@ var require_react_dom_development = __commonJS({
17354
17353
  if (child.key === key) {
17355
17354
  var elementType = element.type;
17356
17355
  if (elementType === REACT_FRAGMENT_TYPE) {
17357
- if (child.tag === Fragment5) {
17356
+ if (child.tag === Fragment4) {
17358
17357
  deleteRemainingChildren(returnFiber, child.sibling);
17359
17358
  var existing = useFiber(child, element.props.children);
17360
17359
  existing.return = returnFiber;
@@ -22828,7 +22827,7 @@ var require_react_dom_development = __commonJS({
22828
22827
  var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
22829
22828
  return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
22830
22829
  }
22831
- case Fragment5:
22830
+ case Fragment4:
22832
22831
  return updateFragment(current2, workInProgress2, renderLanes2);
22833
22832
  case Mode:
22834
22833
  return updateMode(current2, workInProgress2, renderLanes2);
@@ -23100,7 +23099,7 @@ var require_react_dom_development = __commonJS({
23100
23099
  case SimpleMemoComponent:
23101
23100
  case FunctionComponent:
23102
23101
  case ForwardRef:
23103
- case Fragment5:
23102
+ case Fragment4:
23104
23103
  case Mode:
23105
23104
  case Profiler:
23106
23105
  case ContextConsumer:
@@ -27352,7 +27351,7 @@ var require_react_dom_development = __commonJS({
27352
27351
  return fiber;
27353
27352
  }
27354
27353
  function createFiberFromFragment(elements, mode, lanes, key) {
27355
- var fiber = createFiber(Fragment5, elements, key, mode);
27354
+ var fiber = createFiber(Fragment4, elements, key, mode);
27356
27355
  fiber.lanes = lanes;
27357
27356
  return fiber;
27358
27357
  }
@@ -28875,29 +28874,48 @@ function useMediaQuery(query) {
28875
28874
  }, [query]);
28876
28875
  return matches;
28877
28876
  }
28878
- function SidebarNavItem({ item, isOpen, onNavigate }) {
28877
+
28878
+ // src/web/layout/nav-active.ts
28879
+ function isNavItemActive(pathname, item) {
28880
+ if (item.end) {
28881
+ return pathname === item.to;
28882
+ }
28883
+ return pathname === item.to || pathname.startsWith(`${item.to}/`);
28884
+ }
28885
+ function isModifiedClick(event) {
28886
+ return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0;
28887
+ }
28888
+ function SidebarNavItem({ item, isOpen, isActive, onNavigate }) {
28879
28889
  if (item.hidden) {
28880
28890
  return null;
28881
28891
  }
28882
- const handleClick = () => {
28892
+ const handleClick = (event) => {
28893
+ if (item.disabled) {
28894
+ event.preventDefault();
28895
+ return;
28896
+ }
28897
+ if (event.defaultPrevented || isModifiedClick(event)) {
28898
+ return;
28899
+ }
28900
+ event.preventDefault();
28883
28901
  item.onClick?.();
28884
28902
  onNavigate?.(item);
28885
28903
  };
28886
- return /* @__PURE__ */ jsx(
28887
- NavLink,
28904
+ return /* @__PURE__ */ jsxs(
28905
+ "a",
28888
28906
  {
28889
- to: item.to,
28890
- end: item.end,
28907
+ href: item.to,
28891
28908
  onClick: handleClick,
28909
+ "aria-current": isActive ? "page" : void 0,
28892
28910
  "aria-disabled": item.disabled,
28893
28911
  tabIndex: item.disabled ? -1 : void 0,
28894
- className: ({ isActive }) => cn(
28912
+ className: cn(
28895
28913
  "relative flex items-center rounded-xl px-4 py-3 transition-[background-color,color,gap,padding] duration-300 ease-in-out",
28896
28914
  isOpen ? "w-full gap-4" : "justify-center gap-0 px-3",
28897
28915
  item.disabled && "pointer-events-none opacity-50",
28898
28916
  isActive ? "bg-black/12 text-white" : "text-navy-100 hover:bg-white/5"
28899
28917
  ),
28900
- children: ({ isActive }) => /* @__PURE__ */ jsxs(Fragment, { children: [
28918
+ children: [
28901
28919
  /* @__PURE__ */ jsx(
28902
28920
  "span",
28903
28921
  {
@@ -28919,7 +28937,7 @@ function SidebarNavItem({ item, isOpen, onNavigate }) {
28919
28937
  children: item.label
28920
28938
  }
28921
28939
  )
28922
- ] })
28940
+ ]
28923
28941
  }
28924
28942
  );
28925
28943
  }
@@ -28994,6 +29012,7 @@ function Sidebar({
28994
29012
  branding,
28995
29013
  labels,
28996
29014
  sidebarStorageKey,
29015
+ pathname,
28997
29016
  user,
28998
29017
  onLogout,
28999
29018
  className,
@@ -29007,7 +29026,6 @@ function Sidebar({
29007
29026
  collapsed,
29008
29027
  onCollapsedChange
29009
29028
  }) {
29010
- const location = useLocation();
29011
29029
  const isDesktop = useMediaQuery("(min-width: 768px)");
29012
29030
  const [internalCollapsed, setInternalCollapsed] = useState(
29013
29031
  () => readInitialCollapsedState(sidebarStorageKey, initialCollapsed)
@@ -29043,16 +29061,16 @@ function Sidebar({
29043
29061
  },
29044
29062
  [isDesktop, onMobileClose, onNavItemClick]
29045
29063
  );
29046
- const pathnameRef = useRef(location.pathname);
29064
+ const pathnameRef = useRef(pathname);
29047
29065
  useEffect(() => {
29048
- if (pathnameRef.current === location.pathname) {
29066
+ if (pathnameRef.current === pathname) {
29049
29067
  return;
29050
29068
  }
29051
- pathnameRef.current = location.pathname;
29069
+ pathnameRef.current = pathname;
29052
29070
  if (!isDesktop) {
29053
29071
  onMobileClose?.();
29054
29072
  }
29055
- }, [location.pathname, isDesktop, onMobileClose]);
29073
+ }, [pathname, isDesktop, onMobileClose]);
29056
29074
  useEffect(() => {
29057
29075
  if (!mobileOpen || isDesktop) {
29058
29076
  return;
@@ -29133,6 +29151,7 @@ function Sidebar({
29133
29151
  {
29134
29152
  item,
29135
29153
  isOpen: isExpanded,
29154
+ isActive: isNavItemActive(pathname, item),
29136
29155
  onNavigate: handleNavItemNavigate
29137
29156
  },
29138
29157
  item.to
@@ -29143,6 +29162,7 @@ function Sidebar({
29143
29162
  {
29144
29163
  item,
29145
29164
  isOpen: isExpanded,
29165
+ isActive: isNavItemActive(pathname, item),
29146
29166
  onNavigate: handleNavItemNavigate
29147
29167
  },
29148
29168
  item.to
@@ -29905,7 +29925,7 @@ function TableActionsMenu({
29905
29925
  className,
29906
29926
  menuClassName,
29907
29927
  menuWidth = MENU_WIDTH_PX,
29908
- menuFitContent = false
29928
+ menuFitContent = true
29909
29929
  }) {
29910
29930
  const [open, setOpen] = useState(false);
29911
29931
  const [menuPosition, setMenuPosition] = useState(null);
@@ -29918,11 +29938,14 @@ function TableActionsMenu({
29918
29938
  }, []);
29919
29939
  const updateMenuPosition = useCallback(() => {
29920
29940
  const trigger = triggerRef.current;
29941
+ const menuEl = menuRef.current;
29921
29942
  if (!trigger) {
29922
29943
  return;
29923
29944
  }
29924
29945
  const rect = trigger.getBoundingClientRect();
29925
- const resolvedMenuWidth = menuFitContent ? menuRef.current?.getBoundingClientRect().width ?? menuWidth : menuWidth;
29946
+ const viewportMaxWidth = typeof window === "undefined" ? menuWidth : Math.max(menuWidth, window.innerWidth - MENU_VIEWPORT_MARGIN_PX * 2);
29947
+ const measuredWidth = menuFitContent ? menuEl?.offsetWidth || menuEl?.getBoundingClientRect().width || menuWidth : menuWidth;
29948
+ const resolvedMenuWidth = Math.min(Math.max(measuredWidth, 1), viewportMaxWidth);
29926
29949
  setMenuPosition({
29927
29950
  top: rect.bottom + MENU_OFFSET_PX,
29928
29951
  left: clampMenuLeft(rect.right - resolvedMenuWidth, resolvedMenuWidth)
@@ -29935,13 +29958,7 @@ function TableActionsMenu({
29935
29958
  return;
29936
29959
  }
29937
29960
  updateMenuPosition();
29938
- }, [open, updateMenuPosition]);
29939
- useIsomorphicLayoutEffect(() => {
29940
- if (!open || !menuFitContent) {
29941
- return;
29942
- }
29943
- updateMenuPosition();
29944
- }, [items, menuFitContent, open, updateMenuPosition]);
29961
+ }, [open, items, menuFitContent, updateMenuPosition]);
29945
29962
  useEffect(() => {
29946
29963
  if (!open) {
29947
29964
  return;
@@ -29967,7 +29984,7 @@ function TableActionsMenu({
29967
29984
  if (items.length === 0) {
29968
29985
  return null;
29969
29986
  }
29970
- const menu = open && menuPosition != null ? /* @__PURE__ */ jsx(
29987
+ const menu = open ? /* @__PURE__ */ jsx(
29971
29988
  "div",
29972
29989
  {
29973
29990
  ref: menuRef,
@@ -29975,9 +29992,13 @@ function TableActionsMenu({
29975
29992
  role: "menu",
29976
29993
  style: {
29977
29994
  position: "fixed",
29978
- top: menuPosition.top,
29979
- left: menuPosition.left,
29980
- ...menuFitContent ? { width: "max-content" } : { width: menuWidth }
29995
+ top: menuPosition?.top ?? 0,
29996
+ left: menuPosition?.left ?? 0,
29997
+ maxWidth: `calc(100vw - ${MENU_VIEWPORT_MARGIN_PX * 2}px)`,
29998
+ ...menuFitContent ? { width: "max-content" } : { width: menuWidth },
29999
+ // Hide until we have a measured viewport-safe position.
30000
+ visibility: menuPosition != null ? "visible" : "hidden",
30001
+ pointerEvents: menuPosition != null ? "auto" : "none"
29981
30002
  },
29982
30003
  className: cn(
29983
30004
  "z-50 overflow-hidden rounded-2xl border border-storm-gray-50 bg-white shadow-[0_4px_20px_0_rgba(0,0,0,0.05)]",
@@ -29999,14 +30020,13 @@ function TableActionsMenu({
29999
30020
  item.onSelect();
30000
30021
  },
30001
30022
  className: cn(
30002
- "flex h-[51px] cursor-pointer items-center gap-2.5 px-3 text-left typography-14 font-medium text-storm-gray-900 transition-colors hover:bg-storm-gray-0",
30003
- menuFitContent ? "w-auto" : "w-full",
30023
+ "flex h-[51px] w-full cursor-pointer items-center gap-2.5 px-3 text-left typography-14 font-medium text-storm-gray-900 transition-colors hover:bg-storm-gray-0",
30004
30024
  index > 0 && "border-t border-storm-gray-50",
30005
30025
  item.disabled && "cursor-not-allowed opacity-50"
30006
30026
  ),
30007
30027
  children: [
30008
30028
  icon ? /* @__PURE__ */ jsx("span", { className: "inline-flex size-5 shrink-0 items-center justify-center text-storm-gray-200", children: icon }) : null,
30009
- /* @__PURE__ */ jsx("span", { children: item.label })
30029
+ /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: item.label })
30010
30030
  ]
30011
30031
  },
30012
30032
  item.id
@@ -30808,6 +30828,7 @@ function ConfirmModal({
30808
30828
  confirmText,
30809
30829
  onCancel,
30810
30830
  onConfirm,
30831
+ icon,
30811
30832
  cancelDisabled = false,
30812
30833
  confirmDisabled = false,
30813
30834
  closeOnBackdrop = true,
@@ -30853,7 +30874,8 @@ function ConfirmModal({
30853
30874
  event.stopPropagation();
30854
30875
  },
30855
30876
  children: [
30856
- /* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 text-center", children: [
30877
+ /* @__PURE__ */ jsxs("header", { className: "flex flex-col items-center gap-3 text-center", children: [
30878
+ icon ? /* @__PURE__ */ jsx("div", { className: "flex size-14 items-center justify-center rounded-2xl bg-storm-gray-50 text-storm-gray-500", children: icon }) : null,
30857
30879
  /* @__PURE__ */ jsx(
30858
30880
  "h2",
30859
30881
  {
@@ -30963,6 +30985,6 @@ react-dom/cjs/react-dom.development.js:
30963
30985
  *)
30964
30986
  */
30965
30987
 
30966
- export { AppHeader, Badge, BellIcon, BuildingIcon, BuildingSelect, ConfirmModal, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, DataTable, Drawer, HistoryTimeline, Modal, Pagination, Sidebar, SidebarMobileHeader, SidebarNavItem, SidebarUserCard, StatusBadge, Table, TableActionButton, TableActionsCell, TableActionsMenu, TableBody, TableCell, TableHead, TableHeader, TableIconText, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, TableRow, TableRowStatusActions, TableScrollArea, TableSortIcon, TableStatusActionsCell, Toaster, ToasterProvider, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, runMutationWithToast, tableRowDisabledCellClassName, useMediaQuery, useOnClickOutside };
30988
+ export { AppHeader, Badge, BellIcon, BuildingIcon, BuildingSelect, ConfirmModal, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, DataTable, Drawer, HistoryTimeline, Modal, Pagination, Sidebar, SidebarMobileHeader, SidebarNavItem, SidebarUserCard, StatusBadge, Table, TableActionButton, TableActionsCell, TableActionsMenu, TableBody, TableCell, TableHead, TableHeader, TableIconText, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, TableRow, TableRowStatusActions, TableScrollArea, TableSortIcon, TableStatusActionsCell, Toaster, ToasterProvider, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, isNavItemActive, runMutationWithToast, tableRowDisabledCellClassName, useMediaQuery, useOnClickOutside };
30967
30989
  //# sourceMappingURL=index.js.map
30968
30990
  //# sourceMappingURL=index.js.map