@mateosuarezdev/react-ui 1.0.50 → 1.0.52

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
@@ -13,6 +13,7 @@ import { ClassValue } from 'clsx';
13
13
  import { ComponentPropsWithoutRef } from 'react';
14
14
  import { CSSProperties } from 'react';
15
15
  import { default as default_2 } from 'react';
16
+ import { EventEmitter as EventEmitter_2 } from '@mateosuarezdev/event-emitter';
16
17
  import { FieldErrors } from 'react-hook-form';
17
18
  import { FieldValues } from 'react-hook-form';
18
19
  import { ForwardRefExoticComponent } from 'react';
@@ -186,6 +187,17 @@ declare type ConfirmationDialogProps = {
186
187
  trigger?: (open: () => void) => React.ReactNode;
187
188
  };
188
189
 
190
+ export declare const createToastManager: (eventEmitter: EventEmitter_2) => {
191
+ simple: (message: string, data?: Partial<Toast>) => void;
192
+ info: (message: string, data?: Partial<Toast>) => void;
193
+ success: (message: string, data?: Partial<Toast>) => void;
194
+ warning: (message: string, data?: Partial<Toast>) => void;
195
+ error: (message: string, data?: Partial<Toast>) => void;
196
+ loading: (message: string, data?: Partial<Toast>) => string;
197
+ update: (id: string, newToast: Omit<Partial<Toast>, "id">) => void;
198
+ dismiss: (id: string) => void;
199
+ };
200
+
189
201
  export declare const DatePickerDemo: default_2.FC;
190
202
 
191
203
  export declare function DatePickerPopover({ customTrigger, scrollerId, }: {
@@ -244,6 +256,14 @@ export declare const ElasticHeader: ({ scrollY, height, className, children, }:
244
256
  children?: React.ReactNode;
245
257
  }) => JSX.Element;
246
258
 
259
+ export declare class EventEmitter {
260
+ private listeners;
261
+ emit<T>(eventName: string, data?: T): void;
262
+ listen<T>(eventName: string, listener: Listener<T>): () => void;
263
+ }
264
+
265
+ export declare const eventEmitter: EventEmitter_2;
266
+
247
267
  /**
248
268
  * Extracts only the dirty fields from form data
249
269
  * @param data The complete form data
@@ -421,6 +441,8 @@ export declare const List: ({ lightSolid, className, children, ...others }: {
421
441
  others?: any;
422
442
  }) => JSX.Element;
423
443
 
444
+ export declare type Listener<T> = (data: T) => void;
445
+
424
446
  export declare const ListItem: ({ onClick, lightSolid, className, children, }: {
425
447
  onClick?: MouseEventHandler<HTMLButtonElement>;
426
448
  lightSolid?: boolean;
@@ -814,6 +836,27 @@ declare const titleSizes: {
814
836
  "6": string;
815
837
  };
816
838
 
839
+ declare type Toast = {
840
+ id: string;
841
+ type: "simple" | "info" | "success" | "warning" | "error" | "loading";
842
+ message: string;
843
+ duration?: number;
844
+ timeout?: number;
845
+ };
846
+
847
+ declare type ToastColors = {
848
+ success?: string;
849
+ simple?: string;
850
+ info?: string;
851
+ warning?: string;
852
+ error?: string;
853
+ loading?: string;
854
+ };
855
+
856
+ export declare const Toaster: ({ colors }: {
857
+ colors?: ToastColors;
858
+ }) => JSX.Element;
859
+
817
860
  export declare function toTitleCase(str: string): string;
818
861
 
819
862
  export declare function useClickAway<T extends HTMLElement = HTMLElement>(callback: () => void): RefObject<T | null>;
@@ -828,6 +871,8 @@ declare interface UseClickOutsideOptions {
828
871
  excludeRefs?: React.RefObject<HTMLElement>[];
829
872
  }
830
873
 
874
+ export declare function useEventListener<T>(eventName: string, callback: (data: T) => void, activeCondition?: boolean): void;
875
+
831
876
  export declare const useKeepAlive: () => KeepAliveContextType;
832
877
 
833
878
  /**