@tmlmobilidade/ui 20250305.1809.16 → 20250305.1816.36

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.
@@ -0,0 +1 @@
1
+ export declare function useIsActiveDomain(domain: string): boolean;
package/dist/esm/index.js CHANGED
@@ -1543,15 +1543,12 @@ function DataTableContent({ classnames, columns, maxHeight, onRowClick, onRowCon
1543
1543
  return (jsxRuntimeExports.jsxs("div", { className: cn(styles$8.root, classnames?.root), children: [jsxRuntimeExports.jsx(DataTableTitle, { search: search, title: title ?? '' }), jsxRuntimeExports.jsx("div", { className: cn(styles$8.tableWrapper, classnames?.tableWrapper), style: { maxHeight: maxHeight || '100%' }, children: jsxRuntimeExports.jsxs(Table, { className: cn(styles$8.table, classnames?.table, 'block'), children: [jsxRuntimeExports.jsx(DataTableHeader, { columns: columns }), jsxRuntimeExports.jsx(Table.Tbody, { children: jsxRuntimeExports.jsx(ViewportList, { itemMargin: 0, items: data.records, children: (record, rowIndex) => (jsxRuntimeExports.jsx(DataTableRow, { columns: columns, onRowClick: onRowClick, onRowContextMenu: onRowContextMenu, onRowDoubleClick: onRowDoubleClick, record: record }, rowIdAccessor ? getValueAtPath(record, rowIdAccessor) : rowIndex)) }) })] }) })] }));
1544
1544
  }
1545
1545
 
1546
- function useIsActivePage(href) {
1546
+ function useIsActiveDomain(domain) {
1547
1547
  const [isActive, setIsActive] = useState(false);
1548
1548
  useEffect(() => {
1549
1549
  const handleRouteChange = () => {
1550
- const pathname = window.location.pathname;
1551
- if (href === pathname || (href === '/' && pathname === '/')) {
1552
- setIsActive(true);
1553
- }
1554
- else if (href && pathname.includes(href) && href !== '/') {
1550
+ const currentDomain = window.location.hostname;
1551
+ if (domain === currentDomain) {
1555
1552
  setIsActive(true);
1556
1553
  }
1557
1554
  else {
@@ -1567,7 +1564,7 @@ function useIsActivePage(href) {
1567
1564
  window.removeEventListener('pushState', handleRouteChange);
1568
1565
  window.removeEventListener('replaceState', handleRouteChange);
1569
1566
  };
1570
- }, [href]);
1567
+ }, [domain]);
1571
1568
  return isActive;
1572
1569
  }
1573
1570
 
@@ -1591,7 +1588,7 @@ function Sidebar({ items, }) {
1591
1588
  //
1592
1589
  }
1593
1590
  function SidebarItem({ classNames, disabled, href, icon, label, }) {
1594
- const isActive = useIsActivePage(href);
1591
+ const isActive = useIsActiveDomain(href);
1595
1592
  return (jsxRuntimeExports.jsx(Tooltip$1, { label: label, position: "right", children: jsxRuntimeExports.jsx("a", { href: href, children: jsxRuntimeExports.jsx(ActionIcon$1, { size: "xl", className: cn(styles$7.navButton, classNames?.navButton, {
1596
1593
  [styles$7.disabled]: disabled,
1597
1594
  [styles$7.selected]: isActive,