@tmlmobilidade/ui 20250305.1754.42 → 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,6 +9,7 @@ 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';
@@ -1570,6 +1571,14 @@ function useIsActivePage(href) {
1570
1571
  return isActive;
1571
1572
  }
1572
1573
 
1574
+ function generateIcon(name) {
1575
+ const IconComponent = Icon[name];
1576
+ if (!IconComponent) {
1577
+ return null;
1578
+ }
1579
+ return createElement(IconComponent);
1580
+ }
1581
+
1573
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"};
1574
1583
 
1575
1584
  function Sidebar({ items, }) {
@@ -1586,7 +1595,7 @@ function SidebarItem({ classNames, disabled, href, icon, label, }) {
1586
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, {
1587
1596
  [styles$7.disabled]: disabled,
1588
1597
  [styles$7.selected]: isActive,
1589
- }), children: icon }) }) }));
1598
+ }), children: typeof icon === 'string' ? generateIcon(icon) : icon }) }) }));
1590
1599
  }
1591
1600
 
1592
1601
  /* * */