@tmlmobilidade/ui 0.0.4 → 20250124.1545.56

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.
@@ -11,3 +11,4 @@ export { default as Switch } from './Switch';
11
11
  export { default as Slider } from './Slider';
12
12
  export { default as ActionIcon } from './ActionIcon';
13
13
  export { default as Menu } from './Menu';
14
+ export * from './AppLogos';
@@ -2,4 +2,3 @@ export * from './common';
2
2
  export * from './layout';
3
3
  export * from './datatable';
4
4
  export * from './theme';
5
- export * from './authentication';
@@ -0,0 +1,64 @@
1
+ import { NotificationData } from '@mantine/notifications';
2
+ export interface ToastProps extends NotificationData {
3
+ type?: 'error' | 'info' | 'success' | 'warning';
4
+ }
5
+ export interface ToastPromiseParams {
6
+ error?: string;
7
+ pending?: string;
8
+ success?: string;
9
+ }
10
+ declare class Toast {
11
+ /**
12
+ * Hides all toasts
13
+ */
14
+ clean(): void;
15
+ /**
16
+ * Shows an error toast
17
+ * @param props - The toast props
18
+ */
19
+ error(props: Omit<ToastProps, 'type'>): string;
20
+ /**
21
+ * Hides specific toast
22
+ * @param id - The toast id
23
+ */
24
+ hide(id: string): void;
25
+ /**
26
+ * Shows an info toast
27
+ * @param props - The toast props
28
+ */
29
+ info(props: Omit<ToastProps, 'type'>): string;
30
+ /**
31
+ * Shows a loading toast
32
+ * @param props - The toast props
33
+ */
34
+ loading(props: Omit<ToastProps, 'loading' | 'type'>): string;
35
+ /**
36
+ * Promise wrapper for toast
37
+ * @param promise - The promise to be wrapped
38
+ * @param statusMessages - The status messages for the promise
39
+ */
40
+ promise<T>(promise: (() => Promise<T>) | Promise<T>, { error, pending, success }: ToastPromiseParams): void;
41
+ /**
42
+ * Shows a toast
43
+ * @param props - The toast props
44
+ */
45
+ show(props: ToastProps): string;
46
+ /**
47
+ * Shows a success toast
48
+ * @param props - The toast props
49
+ */
50
+ success(props: Omit<ToastProps, 'type'>): string;
51
+ /**
52
+ * Updates a toast given its id
53
+ * @param id - The toast id
54
+ * @param props - The toast props
55
+ */
56
+ update(id: string, props: ToastProps): void;
57
+ /**
58
+ * Shows a warning toast
59
+ * @param props - The toast props
60
+ */
61
+ warning(props: Omit<ToastProps, 'type'>): string;
62
+ }
63
+ export declare const useToast: Toast;
64
+ export {};
@@ -1,4 +1,5 @@
1
1
  import "./styles/index.css";
2
2
  export * from "./components";
3
3
  export * from "./hooks/use-screen-size";
4
+ export * from "./hooks/toast";
4
5
  export * from "@mantine/hooks";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ButtonProps as ButtonProps$1, CheckboxProps as CheckboxProps$1, SegmentedControlProps as SegmentedControlProps$1, TextInputProps as TextInputProps$1, PasswordInputProps as PasswordInputProps$1, TextareaProps, ComboboxProps, BadgeProps as BadgeProps$1, TooltipProps as TooltipProps$1, SwitchProps as SwitchProps$1, SliderProps as SliderProps$1, ActionIconProps as ActionIconProps$1, MenuProps as MenuProps$1, MenuTargetProps as MenuTargetProps$1, MenuDropdownProps as MenuDropdownProps$1, MenuItemProps as MenuItemProps$1, MenuDividerProps as MenuDividerProps$1, MenuLabelProps as MenuLabelProps$1 } from '@mantine/core';
3
3
  import React$1 from 'react';
4
+ import { NotificationData } from '@mantine/notifications';
4
5
  export * from '@mantine/hooks';
5
6
 
6
7
  interface ButtonProps extends ButtonProps$1 {
@@ -94,6 +95,12 @@ declare namespace Menu {
94
95
  var Label: (props: MenuLabelProps) => react_jsx_runtime.JSX.Element;
95
96
  }
96
97
 
98
+ declare function CMIcon(): react_jsx_runtime.JSX.Element;
99
+ declare function CMLogo(): react_jsx_runtime.JSX.Element;
100
+ declare function TMLogoLight(): react_jsx_runtime.JSX.Element;
101
+ declare function TMLogoDark(): react_jsx_runtime.JSX.Element;
102
+ declare function TMLogo(): react_jsx_runtime.JSX.Element;
103
+
97
104
  interface Props$1 extends React.HTMLAttributes<HTMLDivElement> {
98
105
  columns?: 'a' | 'aab' | 'ab' | 'abb' | 'abc' | 'abcd';
99
106
  hAlign?: 'center' | 'end' | 'start';
@@ -329,51 +336,69 @@ declare function Themer({ dark, light }: {
329
336
  light: React.ReactNode;
330
337
  }): react_jsx_runtime.JSX.Element;
331
338
 
332
- interface LoginFormProps {
339
+ declare function useScreenSize(): "mobile" | "tablet" | "desktop" | undefined;
340
+
341
+ interface ToastProps extends NotificationData {
342
+ type?: 'error' | 'info' | 'success' | 'warning';
343
+ }
344
+ interface ToastPromiseParams {
345
+ error?: string;
346
+ pending?: string;
347
+ success?: string;
348
+ }
349
+ declare class Toast {
350
+ /**
351
+ * Hides all toasts
352
+ */
353
+ clean(): void;
333
354
  /**
334
- * Optional title for the login form.
355
+ * Shows an error toast
356
+ * @param props - The toast props
335
357
  */
336
- title: string;
358
+ error(props: Omit<ToastProps, 'type'>): string;
337
359
  /**
338
- * Optional description for the login form.
360
+ * Hides specific toast
361
+ * @param id - The toast id
339
362
  */
340
- description: string;
363
+ hide(id: string): void;
341
364
  /**
342
- * Optional label for the login button.
343
- * @default "Login"
365
+ * Shows an info toast
366
+ * @param props - The toast props
344
367
  */
345
- buttonLabel?: string;
368
+ info(props: Omit<ToastProps, 'type'>): string;
346
369
  /**
347
- * Optional icon to be rendered next to the button label.
348
- * @default <IconArrowRight size={20} />
370
+ * Shows a loading toast
371
+ * @param props - The toast props
372
+ */
373
+ loading(props: Omit<ToastProps, 'loading' | 'type'>): string;
374
+ /**
375
+ * Promise wrapper for toast
376
+ * @param promise - The promise to be wrapped
377
+ * @param statusMessages - The status messages for the promise
378
+ */
379
+ promise<T>(promise: (() => Promise<T>) | Promise<T>, { error, pending, success }: ToastPromiseParams): void;
380
+ /**
381
+ * Shows a toast
382
+ * @param props - The toast props
349
383
  */
350
- buttonIcon?: React.ReactNode;
384
+ show(props: ToastProps): string;
351
385
  /**
352
- * Optional React node to be rendered as footer links in the form.
386
+ * Shows a success toast
387
+ * @param props - The toast props
353
388
  */
354
- footerLinks?: React.ReactNode[];
389
+ success(props: Omit<ToastProps, 'type'>): string;
355
390
  /**
356
- * The URL to be used for the login request.
391
+ * Updates a toast given its id
392
+ * @param id - The toast id
393
+ * @param props - The toast props
357
394
  */
358
- authUrl: string;
395
+ update(id: string, props: ToastProps): void;
359
396
  /**
360
- * Optional class names for various elements within the LoginForm component.
397
+ * Shows a warning toast
398
+ * @param props - The toast props
361
399
  */
362
- classNames?: {
363
- root?: string;
364
- header?: string;
365
- headerContent?: string;
366
- headerTitle?: string;
367
- headerDescription?: string;
368
- headerImage?: string;
369
- form?: string;
370
- formFooter?: string;
371
- formFooterLinks?: string;
372
- formButton?: string;
373
- };
400
+ warning(props: Omit<ToastProps, 'type'>): string;
374
401
  }
375
- declare function LoginForm({ authUrl, classNames, footerLinks, title, description, buttonLabel, buttonIcon, }: LoginFormProps): react_jsx_runtime.JSX.Element;
376
-
377
- declare function useScreenSize(): "mobile" | "tablet" | "desktop" | undefined;
402
+ declare const useToast: Toast;
378
403
 
379
- export { ActionIcon, Badge, Component$4 as Button, Checkbox, Component as Combobox, DataTable, type DataTableColumn, type DataTableColumnProps, type DataTableHeaderProps, type DataTableProps, type DataTableRowProps, type DataTableSearchProps, type DataTableTitleProps, Grid, LoginForm, Menu, Component$2 as PasswordInput, Section, SegmentedControl, Sidebar, Slider, Spacer, Surface, Switch, Component$1 as TextArea, Component$3 as TextInput, ThemeDark, ThemeLight, ThemeProvider, ThemeSwitcher, Themer, Tooltip, useScreenSize, useTheme };
404
+ export { ActionIcon, Badge, Component$4 as Button, CMIcon, CMLogo, Checkbox, Component as Combobox, DataTable, type DataTableColumn, type DataTableColumnProps, type DataTableHeaderProps, type DataTableProps, type DataTableRowProps, type DataTableSearchProps, type DataTableTitleProps, Grid, Menu, Component$2 as PasswordInput, Section, SegmentedControl, Sidebar, Slider, Spacer, Surface, Switch, TMLogo, TMLogoDark, TMLogoLight, Component$1 as TextArea, Component$3 as TextInput, ThemeDark, ThemeLight, ThemeProvider, ThemeSwitcher, Themer, type ToastPromiseParams, type ToastProps, Tooltip, useScreenSize, useTheme, useToast };