@tmlmobilidade/ui 20250305.1746.10 → 20250305.1809.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.
@@ -1,7 +1,7 @@
1
1
  export interface SidebarItemProps {
2
2
  disabled?: boolean;
3
3
  href: string;
4
- icon: React.ReactNode;
4
+ icon: React.ReactNode | string;
5
5
  label: string;
6
6
  }
7
7
  export interface SidebarProps {
@@ -0,0 +1 @@
1
+ export declare function generateIcon(name: string): React.ReactNode;
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import * as React from 'react';
3
- import React__default, { createContext, useState, useEffect, useMemo, useContext, useCallback } from 'react';
3
+ import React__default, { createContext, useState, useEffect, useMemo, useContext, useCallback, createElement } from 'react';
4
4
  import { clsx } from 'clsx';
5
5
  import { DateTime } from 'luxon';
6
6
  import { ActionIcon as ActionIcon$1, createTheme, TextInput, Textarea, PasswordInput as PasswordInput$1, Button as Button$1, MantineProvider, Menu as Menu$1, ColorSwatch, Badge as Badge$1, Checkbox as Checkbox$1, useCombobox, Combobox, Group, CheckIcon, PillsInput, Pill, InputBase, Input, SegmentedControl as SegmentedControl$1, Slider as Slider$1, Switch as Switch$1, Text as Text$1, Tooltip as Tooltip$1, Center, rem, Table, Accordion } from '@mantine/core';
@@ -9,11 +9,11 @@ import { DatesProvider, DateTimePicker as DateTimePicker$1 } from '@mantine/date
9
9
  import { ModalsProvider, modals as modals$1 } from '@mantine/modals';
10
10
  export * from '@mantine/modals';
11
11
  import { Notifications, notifications } from '@mantine/notifications';
12
+ import * as Icon from '@tabler/icons-react';
12
13
  import { IconX, IconCaretDownFilled, IconCalendar, IconTrash, IconUpload, IconEye, IconEyeClosed, IconInfoCircle, IconArrowUpRhombus, IconArrowDownRhombus, IconArrowsUpDown, IconSettings, IconLogin, IconCaretLeftFilled } from '@tabler/icons-react';
13
14
  import { ViewportList } from 'react-viewport-list';
14
15
  import { useDebouncedValue } from '@mantine/hooks';
15
16
  export * from '@mantine/hooks';
16
- import pjson from 'package.json';
17
17
  export * from '@mantine/form';
18
18
 
19
19
  var jsxRuntime = {exports: {}};
@@ -1571,6 +1571,14 @@ function useIsActivePage(href) {
1571
1571
  return isActive;
1572
1572
  }
1573
1573
 
1574
+ function generateIcon(name) {
1575
+ const IconComponent = Icon[name];
1576
+ if (!IconComponent) {
1577
+ return null;
1578
+ }
1579
+ return createElement(IconComponent);
1580
+ }
1581
+
1574
1582
  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"};
1575
1583
 
1576
1584
  function Sidebar({ items, }) {
@@ -1587,7 +1595,7 @@ function SidebarItem({ classNames, disabled, href, icon, label, }) {
1587
1595
  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, {
1588
1596
  [styles$7.disabled]: disabled,
1589
1597
  [styles$7.selected]: isActive,
1590
- }), children: icon }) }) }));
1598
+ }), children: typeof icon === 'string' ? generateIcon(icon) : icon }) }) }));
1591
1599
  }
1592
1600
 
1593
1601
  /* * */
@@ -1599,7 +1607,7 @@ function AppOptions() {
1599
1607
  // B. Handle actions
1600
1608
  //
1601
1609
  // C. Render components
1602
- 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, {}), jsxRuntimeExports.jsxs(Menu.Label, { children: ["Version ", pjson.version] })] })] }));
1610
+ 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, {})] })] }));
1603
1611
  //
1604
1612
  }
1605
1613