@tmlmobilidade/ui 20250305.1841.5 → 20250306.1453.58

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.
@@ -2,14 +2,16 @@ import { MenuDividerProps as MantineMenuDividerProps, MenuDropdownProps as Manti
2
2
  export type MenuProps = MantineMenuProps;
3
3
  export type MenuTargetProps = MantineMenuTargetProps;
4
4
  export type MenuDropdownProps = MantineMenuDropdownProps;
5
- export type MenuItemProps = MantineMenuItemProps;
5
+ export type MenuItemProps = MantineMenuItemProps & {
6
+ href: string;
7
+ };
6
8
  export type MenuDividerProps = MantineMenuDividerProps;
7
9
  export type MenuLabelProps = MantineMenuLabelProps;
8
10
  declare function Menu(props: MenuProps): import("react/jsx-runtime").JSX.Element;
9
11
  declare namespace Menu {
10
12
  var Target: (props: MenuTargetProps) => import("react/jsx-runtime").JSX.Element;
11
13
  var Dropdown: (props: MenuDropdownProps) => import("react/jsx-runtime").JSX.Element;
12
- var Item: (props: MenuItemProps) => import("react/jsx-runtime").JSX.Element;
14
+ var Item: ({ href, ...props }: MenuItemProps) => import("react/jsx-runtime").JSX.Element;
13
15
  var Divider: (props: MenuDividerProps) => import("react/jsx-runtime").JSX.Element;
14
16
  var Label: (props: MenuLabelProps) => import("react/jsx-runtime").JSX.Element;
15
17
  }
@@ -1 +1,2 @@
1
- export default function Header(): import("react/jsx-runtime").JSX.Element;
1
+ import { HeaderProps } from '..';
2
+ export default function Header({ user_name }: HeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,14 @@
1
1
  import { SidebarItemProps } from '../Sidebar';
2
- interface AppWrapperProps {
2
+ export interface HeaderProps {
3
+ user_name?: string;
4
+ }
5
+ export interface AppWrapperProps {
3
6
  children: React.ReactNode;
7
+ headerProps?: HeaderProps;
4
8
  icon: React.ReactNode | {
5
9
  href: string;
6
10
  icon: React.ReactNode;
7
11
  };
8
12
  sidebarItems: SidebarItemProps[];
9
13
  }
10
- export default function AppWrapper({ children, icon, sidebarItems, }: AppWrapperProps): import("react/jsx-runtime").JSX.Element;
11
- export {};
14
+ export default function AppWrapper({ children, headerProps, icon, sidebarItems, }: AppWrapperProps): import("react/jsx-runtime").JSX.Element;
@@ -7,4 +7,4 @@ export interface SidebarItemProps {
7
7
  export interface SidebarProps {
8
8
  items: SidebarItemProps[];
9
9
  }
10
- export default function Sidebar({ items, }: SidebarProps): import("react/jsx-runtime").JSX.Element;
10
+ export default function Sidebar({ items, }: SidebarProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,6 +1,7 @@
1
1
  export { default as AppWrapper } from './AppWrapper';
2
2
  export { default as Grid } from './Grid';
3
3
  export { default as Section } from './Section';
4
+ export { SidebarItemProps } from './Sidebar';
4
5
  export { default as Sidebar } from './Sidebar';
5
6
  export { SimpleSurface } from './SimpleSurface';
6
7
  export { default as Spacer } from './Spacer';
package/dist/esm/index.js CHANGED
@@ -10,7 +10,7 @@ import { ModalsProvider, modals as modals$1 } from '@mantine/modals';
10
10
  export * from '@mantine/modals';
11
11
  import { Notifications, notifications } from '@mantine/notifications';
12
12
  import * as Icon from '@tabler/icons-react';
13
- import { IconX, IconCaretDownFilled, IconCalendar, IconTrash, IconUpload, IconEye, IconEyeClosed, IconInfoCircle, IconArrowUpRhombus, IconArrowDownRhombus, IconArrowsUpDown, IconSettings, IconLogin, IconCaretLeftFilled } from '@tabler/icons-react';
13
+ import { IconX, IconCaretDownFilled, IconCalendar, IconTrash, IconUpload, IconEye, IconEyeClosed, IconInfoCircle, IconArrowUpRhombus, IconArrowDownRhombus, IconArrowsUpDown, IconCaretLeftFilled } from '@tabler/icons-react';
14
14
  import { ViewportList } from 'react-viewport-list';
15
15
  import { useDebouncedValue } from '@mantine/hooks';
16
16
  export * from '@mantine/hooks';
@@ -1258,8 +1258,8 @@ Menu.Target = function MenuTarget(props) {
1258
1258
  Menu.Dropdown = function MenuDropdown(props) {
1259
1259
  return jsxRuntimeExports.jsx(Menu$1.Dropdown, { ...props, className: styles$i.dropdown });
1260
1260
  };
1261
- Menu.Item = function MenuItem(props) {
1262
- return jsxRuntimeExports.jsx(Menu$1.Item, { ...props, className: styles$i.item });
1261
+ Menu.Item = function MenuItem({ href, ...props }) {
1262
+ return (jsxRuntimeExports.jsx(Menu$1.Item, { className: styles$i.item, component: href ? 'a' : undefined, href: href, ...props }));
1263
1263
  };
1264
1264
  Menu.Divider = function MenuDivider(props) {
1265
1265
  return jsxRuntimeExports.jsx(Menu$1.Divider, { ...props, className: styles$i.divider });
@@ -1579,7 +1579,8 @@ function generateIcon(name) {
1579
1579
  var styles$7 = {"container":"styles-module_container__tduxg","navWrapper":"styles-module_navWrapper__Xb59N","navButton":"styles-module_navButton__kTv0k","selected":"styles-module_selected__w-GVG","disabled":"styles-module_disabled__lxQjN"};
1580
1580
 
1581
1581
  function Sidebar({ items, }) {
1582
- //
1582
+ if (!items || items.length === 0)
1583
+ return null;
1583
1584
  //
1584
1585
  // A. Render components
1585
1586
  return (jsxRuntimeExports.jsx("div", { className: cn(styles$7.container), children: jsxRuntimeExports.jsx("div", { className: cn(styles$7.navWrapper), children: items.map((item) => {
@@ -1595,45 +1596,32 @@ function SidebarItem({ classNames, disabled, href, icon, label, }) {
1595
1596
  }), children: typeof icon === 'string' ? generateIcon(icon) : icon }) }) }));
1596
1597
  }
1597
1598
 
1598
- /* * */
1599
- function AppOptions() {
1600
- //
1601
- //
1602
- // A. Setup variables
1603
- //
1604
- // B. Handle actions
1605
- //
1606
- // C. Render components
1607
- return (jsxRuntimeExports.jsxs(Menu, { offset: 15, position: "bottom-end", shadow: "lg", children: [jsxRuntimeExports.jsx(Menu.Target, { children: jsxRuntimeExports.jsx(ActionIcon, { color: "gray", variant: "muted", children: jsxRuntimeExports.jsx(IconSettings, { size: 20 }) }) }), jsxRuntimeExports.jsxs(Menu.Dropdown, { children: [jsxRuntimeExports.jsx(Menu.Divider, {}), jsxRuntimeExports.jsxs(Menu.Item, { color: "red", children: [jsxRuntimeExports.jsx(IconLogin, { size: 20 }), "Logout"] }), jsxRuntimeExports.jsx(Menu.Divider, {})] })] }));
1608
- //
1609
- }
1610
-
1611
1599
  var styles$6 = {"container":"styles-module_container__G0H4W","greeting":"styles-module_greeting__Zw9r-","options":"styles-module_options__RyJJ1"};
1612
1600
 
1613
1601
  /* * */
1614
1602
  const greetings = ['Olá', 'Hi', 'Hey', 'Oi', 'Hallo', 'Ciao', 'Hej'];
1615
1603
  /* * */
1616
- function Header() {
1604
+ function Header({ user_name }) {
1617
1605
  //
1618
1606
  //
1619
1607
  // A. Setup variables
1620
1608
  const [drawnGreeting] = useState(greetings[(greetings.length * Math.random()) | 0]);
1621
1609
  //
1622
1610
  // B. Render components
1623
- return (jsxRuntimeExports.jsxs("div", { className: styles$6.container, children: [jsxRuntimeExports.jsx("p", { className: styles$6.greeting, children: drawnGreeting }), jsxRuntimeExports.jsx("div", { className: styles$6.options, children: jsxRuntimeExports.jsx(AppOptions, {}) })] }));
1611
+ return (jsxRuntimeExports.jsxs("div", { className: styles$6.container, children: [jsxRuntimeExports.jsxs("p", { className: styles$6.greeting, children: [drawnGreeting, " ", user_name] }), jsxRuntimeExports.jsx("div", { className: styles$6.options })] }));
1624
1612
  //
1625
1613
  }
1626
1614
 
1627
1615
  var styles$5 = {"container":"styles-module_container__V2XNO","appIcon":"styles-module_appIcon__QFZYG","content":"styles-module_content__N1Zgw"};
1628
1616
 
1629
- function AppWrapper({ children, icon, sidebarItems, }) {
1617
+ function AppWrapper({ children, headerProps, icon, sidebarItems, }) {
1630
1618
  const appIcon = () => {
1631
1619
  if (icon && typeof icon === 'object' && 'href' in icon) {
1632
1620
  return jsxRuntimeExports.jsx("a", { href: icon.href, children: icon.icon });
1633
1621
  }
1634
1622
  return icon;
1635
1623
  };
1636
- return (jsxRuntimeExports.jsxs("div", { className: styles$5.container, children: [jsxRuntimeExports.jsx("div", { className: styles$5.appIcon, children: appIcon() }), jsxRuntimeExports.jsx(Header, {}), jsxRuntimeExports.jsx(Sidebar, { items: sidebarItems }), jsxRuntimeExports.jsx("div", { className: styles$5.content, children: children })] }));
1624
+ return (jsxRuntimeExports.jsxs("div", { className: styles$5.container, children: [jsxRuntimeExports.jsx("div", { className: styles$5.appIcon, children: appIcon() }), jsxRuntimeExports.jsx(Header, { ...headerProps }), jsxRuntimeExports.jsx(Sidebar, { items: sidebarItems }), jsxRuntimeExports.jsx("div", { className: styles$5.content, children: children })] }));
1637
1625
  }
1638
1626
 
1639
1627
  var styles$4 = {"container":"styles-module_container__u-Ao-","hAlignstart":"styles-module_hAlignstart__Poz-6","hAligncenter":"styles-module_hAligncenter__-8-PQ","hAlignend":"styles-module_hAlignend__9-hiG","vAlignstart":"styles-module_vAlignstart__UHr2W","vAligncenter":"styles-module_vAligncenter__AI3ka","vAlignend":"styles-module_vAlignend__Ufwik","gapnone":"styles-module_gapnone__yv7lm","gapxs":"styles-module_gapxs__qCDUv","gapsm":"styles-module_gapsm__9Pnop","gapmd":"styles-module_gapmd__9lCqV","gaplg":"styles-module_gaplg__kvQt9","gapxl":"styles-module_gapxl__5-mrY","a":"styles-module_a__NDsdd","aab":"styles-module_aab__xvehZ","ab":"styles-module_ab__JtDDA","abb":"styles-module_abb__jlnJf","abc":"styles-module_abc__XRK-M","abcd":"styles-module_abcd__3jl83"};