@tmlmobilidade/ui 20250908.1919.56 → 20250909.1415.8

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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ButtonProps as ButtonProps$1, BadgeProps as BadgeProps$1, ComboboxProps, MenuProps as MenuProps$1, MenuTargetProps as MenuTargetProps$1, MenuDropdownProps as MenuDropdownProps$1, MenuItemProps as MenuItemProps$1, MenuDividerProps as MenuDividerProps$1, MenuLabelProps as MenuLabelProps$1, TooltipProps as TooltipProps$1, CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1, PopoverProps as PopoverProps$1, PopoverTargetProps as PopoverTargetProps$1, PopoverDropdownProps as PopoverDropdownProps$1, SegmentedControlProps as SegmentedControlProps$1, SliderProps as SliderProps$1, SwitchProps as SwitchProps$1, TextProps as TextProps$1, NumberInputProps as NumberInputProps$1, PasswordInputProps, PillsInputProps as PillsInputProps$1, TextareaProps as TextareaProps$1, TextInputProps as TextInputProps$1 } from '@mantine/core';
2
+ import { ButtonProps as ButtonProps$2, BadgeProps as BadgeProps$1, ComboboxProps, MenuProps as MenuProps$1, MenuTargetProps as MenuTargetProps$1, MenuDropdownProps as MenuDropdownProps$1, MenuItemProps as MenuItemProps$1, MenuDividerProps as MenuDividerProps$1, MenuLabelProps as MenuLabelProps$1, TooltipProps as TooltipProps$1, CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1, PopoverProps as PopoverProps$1, PopoverTargetProps as PopoverTargetProps$1, PopoverDropdownProps as PopoverDropdownProps$1, SegmentedControlProps as SegmentedControlProps$1, SliderProps as SliderProps$1, SwitchProps as SwitchProps$1, TextProps as TextProps$1, NumberInputProps as NumberInputProps$1, PasswordInputProps, PillsInputProps as PillsInputProps$1, TextareaProps as TextareaProps$1, TextInputProps as TextInputProps$1 } from '@mantine/core';
3
3
  export { Modal, RenderTreeNodePayload, Tree, TreeNodeData, getTreeExpandedState, useTree } from '@mantine/core';
4
4
  import * as React$1 from 'react';
5
5
  import React__default, { PropsWithChildren, ReactNode, CSSProperties, RefObject } from 'react';
@@ -40,7 +40,7 @@ interface BackButtonProps {
40
40
  }
41
41
  declare function BackButton({ onClick, type }: BackButtonProps): react_jsx_runtime.JSX.Element;
42
42
 
43
- interface ButtonProps extends ButtonProps$1 {
43
+ interface ButtonProps$1 extends ButtonProps$2 {
44
44
  href?: string;
45
45
  icon?: React__default.ReactNode;
46
46
  label?: string;
@@ -49,7 +49,7 @@ interface ButtonProps extends ButtonProps$1 {
49
49
  type?: 'button' | 'reset' | 'submit';
50
50
  variant?: 'danger' | 'disabled' | 'muted' | 'primary' | 'secondary';
51
51
  }
52
- declare function Button({ disabled, href, icon, label, loading, onClick, type, variant, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
52
+ declare function Button({ disabled, href, icon, label, loading, onClick, type, variant, ...props }: ButtonProps$1): react_jsx_runtime.JSX.Element;
53
53
 
54
54
  /**
55
55
  * Props for showing confirmation modal.
@@ -101,6 +101,24 @@ interface DeleteButtonWithoutConfirmationProps {
101
101
  }
102
102
  declare function DeleteButton(props: DeleteButtonWithConfirmationProps | DeleteButtonWithoutConfirmationProps): react_jsx_runtime.JSX.Element;
103
103
 
104
+ interface LinkProps {
105
+ href: string;
106
+ type: 'link';
107
+ }
108
+ interface ButtonProps {
109
+ onClick: () => void;
110
+ type?: 'button';
111
+ }
112
+ type IconButtonProps = (ButtonProps | LinkProps) & {
113
+ color?: string;
114
+ disabled?: boolean;
115
+ icon: React.ReactNode;
116
+ isLoading?: boolean;
117
+ isReadOnly?: boolean;
118
+ tooltip?: string;
119
+ };
120
+ declare function IconButton(props: IconButtonProps): react_jsx_runtime.JSX.Element;
121
+
104
122
  interface LockButtonProps {
105
123
  isLoading?: boolean;
106
124
  isLocked: boolean;
@@ -1121,5 +1139,5 @@ declare function AppProvider({ children }: PropsWithChildren): react_jsx_runtime
1121
1139
  */
1122
1140
  declare function BaseProvider({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element;
1123
1141
 
1124
- export { AVAILABLE_MODES, AVAILABLE_THEMES, AlertCard, AlertMessage, AppProvider, AppWrapper, BackButton, Badge, BaseProvider, Button, CMIcon, CMLogo, Checkbox, Collapsible, ComboboxComponent as Combobox, ComponentWrapper, CoordinatesInput, DataTable, DatePicker, DateTimePicker, DeleteButton, Description, Divider, ErrorDisplay, FileButton, FileUpload, FilterTarget, FilterTypeDateRange, FilterTypeList, FilterWrapper, FiltersBar, Grid, HasPermission, Indicator, Label, LineBadge, LineDisplay, LineName, LineSelect, Loader, LoadingOverlay, LockButton, MAP_STYLES, MAP_VIEWPORT, MapContextProvider, MapOverlayGeofences, MapOverlayMultipleStops, MapOverlayObservedPath, MapOverlayPins, MapOverlayScheduledPath, MapView, MapViewContextProvider, MeContextProvider, Menu, MultiSelect, NoDataLabel, NumberInput, Pane, PanesManager, PasswordInput, PillGroup, PillsInput, Popover, SearchInput, Section, SegmentedControl, Separator, Sidebar, SidebarContextProvider, Slider, Spacer, StopDisplay, StopDisplayName, StopSelect, Surface, Switch, TMLogo, TMLogoDark, TMLogoLight, Tag, TagGroup, Text, TextInput, Textarea, ThemeContextProvider, Toolbar, Tooltip, ValueDisplay, WhenDarkMode, WhenLightMode, WhenMode, accessorSearch, plainSearch, sidebarApps, useCssVariable, useCurrentUrl, useMapContext, useMapViewContext, useMeContext, useSearch, useSidebarContext, useThemeContext, useToast, useUserPreference };
1125
- export type { ButtonProps, CheckboxGroupProps, CheckboxProps, DataItem$2 as DataItem, DataTableColumn, DataTableProps, DatePickerProps, DateTimePickerProps, FileButtonProps, LabelProps, LineBadgeProps, LineDisplayProps, LineNameProps, LineSelectProps, LoaderProps, MapOverlayGeofencesPolygonDataProps, MapOverlayMultipleStopsDataProps, MapOverlayObservedPathLineDataProps, MapOverlayObservedPathPointsDataProps, MapOverlayPinsPointDataProps, MapOverlayScheduledPathLineDataProps, MapOverlayScheduledPathPointsDataProps, MapStyle, ModeType, NoDataLabelProps, NumberInputProps, PillsInputProps, PopoverDropdownProps, PopoverProps, PopoverTargetProps, SearchInputProps, SegmentedControlProps, SurfaceProps, TagGroupProps, TagProps, TextInputProps, TextProps, TextareaProps, ThemeType, ToastPromiseParams, ToastProps };
1142
+ export { AVAILABLE_MODES, AVAILABLE_THEMES, AlertCard, AlertMessage, AppProvider, AppWrapper, BackButton, Badge, BaseProvider, Button, CMIcon, CMLogo, Checkbox, Collapsible, ComboboxComponent as Combobox, ComponentWrapper, CoordinatesInput, DataTable, DatePicker, DateTimePicker, DeleteButton, Description, Divider, ErrorDisplay, FileButton, FileUpload, FilterTarget, FilterTypeDateRange, FilterTypeList, FilterWrapper, FiltersBar, Grid, HasPermission, IconButton, Indicator, Label, LineBadge, LineDisplay, LineName, LineSelect, Loader, LoadingOverlay, LockButton, MAP_STYLES, MAP_VIEWPORT, MapContextProvider, MapOverlayGeofences, MapOverlayMultipleStops, MapOverlayObservedPath, MapOverlayPins, MapOverlayScheduledPath, MapView, MapViewContextProvider, MeContextProvider, Menu, MultiSelect, NoDataLabel, NumberInput, Pane, PanesManager, PasswordInput, PillGroup, PillsInput, Popover, SearchInput, Section, SegmentedControl, Separator, Sidebar, SidebarContextProvider, Slider, Spacer, StopDisplay, StopDisplayName, StopSelect, Surface, Switch, TMLogo, TMLogoDark, TMLogoLight, Tag, TagGroup, Text, TextInput, Textarea, ThemeContextProvider, Toolbar, Tooltip, ValueDisplay, WhenDarkMode, WhenLightMode, WhenMode, accessorSearch, plainSearch, sidebarApps, useCssVariable, useCurrentUrl, useMapContext, useMapViewContext, useMeContext, useSearch, useSidebarContext, useThemeContext, useToast, useUserPreference };
1143
+ export type { ButtonProps$1 as ButtonProps, CheckboxGroupProps, CheckboxProps, DataItem$2 as DataItem, DataTableColumn, DataTableProps, DatePickerProps, DateTimePickerProps, FileButtonProps, LabelProps, LineBadgeProps, LineDisplayProps, LineNameProps, LineSelectProps, LoaderProps, MapOverlayGeofencesPolygonDataProps, MapOverlayMultipleStopsDataProps, MapOverlayObservedPathLineDataProps, MapOverlayObservedPathPointsDataProps, MapOverlayPinsPointDataProps, MapOverlayScheduledPathLineDataProps, MapOverlayScheduledPathPointsDataProps, MapStyle, ModeType, NoDataLabelProps, NumberInputProps, PillsInputProps, PopoverDropdownProps, PopoverProps, PopoverTargetProps, SearchInputProps, SegmentedControlProps, SurfaceProps, TagGroupProps, TagProps, TextInputProps, TextProps, TextareaProps, ThemeType, ToastPromiseParams, ToastProps };
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ export { HasPermission } from './src/components/authentication/HasPermission/ind
2
2
  export { BackButton } from './src/components/buttons/BackButton/index.js';
3
3
  export { Button } from './src/components/buttons/Button/index.js';
4
4
  export { DeleteButton } from './src/components/buttons/DeleteButton/index.js';
5
+ export { IconButton } from './src/components/buttons/IconButton/index.js';
5
6
  export { LockButton } from './src/components/buttons/LockButton/index.js';
6
7
  export { default as Badge } from './src/components/common/Badge/index.js';
7
8
  export { default as Combobox } from './src/components/common/Combobox/index.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,44 @@
1
+ 'use client';
2
+ import { j as jsxRuntimeExports } from '../../../../_virtual/jsx-runtime.js';
3
+ import { ActionIcon } from '@mantine/core';
4
+ import 'clsx';
5
+ import 'luxon';
6
+ import '@tabler/icons-react';
7
+ import 'react';
8
+ import 'react-viewport-list';
9
+ import '../../common/Menu/index.js';
10
+ import Tooltip from '../../common/Tooltip/index.js';
11
+ import '../../common/Checkbox/index.js';
12
+ import 'ukkonen';
13
+ import '@mantine/hooks';
14
+ import '../../common/Popover/index.js';
15
+
16
+ /* * */
17
+ function IconButton(props) {
18
+ //
19
+ //
20
+ // A. Define variables
21
+ const { color, disabled, icon, isLoading, isReadOnly, tooltip } = props;
22
+ const isLink = props.type === 'link';
23
+ //
24
+ // B. Handle actions
25
+ const handleClick = () => {
26
+ // If the button is loading or in read-only mode,
27
+ // do not trigger the onClick action
28
+ if (isLoading || isReadOnly)
29
+ return;
30
+ // Trigger the onClick action
31
+ if ('onClick' in props && props.onClick) {
32
+ props.onClick();
33
+ }
34
+ };
35
+ //
36
+ // C. Render components
37
+ const renderButton = () => {
38
+ return (jsxRuntimeExports.jsx(ActionIcon, { color: color ?? 'var(--color-primary)', component: isLink ? 'a' : 'button', "data-disabled": disabled, disabled: disabled, href: isLink ? props.href : undefined, loading: isLoading, onClick: isLink ? undefined : handleClick, variant: "subtle", children: icon }));
39
+ };
40
+ return tooltip ? jsxRuntimeExports.jsxs(Tooltip, { label: tooltip, children: [" ", renderButton()] }) : renderButton();
41
+ }
42
+
43
+ export { IconButton };
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/components/buttons/IconButton/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;AA6BA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAEM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAC,CAAA,CAAA,CAAA,CAAA,CAAsB,CAAA,CAAA;;;;AAMhD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAA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,CAAA,QAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAE,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAE;AACvF;;"}
@@ -4,8 +4,6 @@ import '@mantine/core';
4
4
  import { IconCrosshair } from '@tabler/icons-react';
5
5
  import { Button } from '../../../buttons/Button/index.js';
6
6
  import '@mantine/modals';
7
- import { SegmentedControl } from '../../../common/SegmentedControl/index.js';
8
- import { Switch } from '../../../common/Switch/index.js';
9
7
  import 'clsx';
10
8
  import 'luxon';
11
9
  import { useMemo } from 'react';
@@ -15,6 +13,8 @@ import '../../../common/Checkbox/index.js';
15
13
  import 'ukkonen';
16
14
  import '@mantine/hooks';
17
15
  import '../../../common/Popover/index.js';
16
+ import { SegmentedControl } from '../../../common/SegmentedControl/index.js';
17
+ import { Switch } from '../../../common/Switch/index.js';
18
18
  import { useMapContext } from '../../../../contexts/Map.context.js';
19
19
  import '../../../../contexts/Me.context.js';
20
20
  import '../../../../contexts/Sidebar.context.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/ui",
3
3
  "description": "UI components for Transportes Metropolitanos de Lisboa (TML) web applications.",
4
- "version": "20250908.1919.56",
4
+ "version": "20250909.1415.8",
5
5
  "author": "João de Vasconcelos & Jusi Monteiro",
6
6
  "license": "AGPL-3.0-or-later",
7
7
  "publishConfig": {