@mateosuarezdev/react-ui 1.0.9 → 1.0.14
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.cjs +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +263 -4
- package/dist/index.js +5295 -1411
- package/dist/index.js.map +1 -1
- package/package.json +12 -6
package/dist/index.d.ts
CHANGED
|
@@ -8,10 +8,13 @@ import { FieldValues } from 'react-hook-form';
|
|
|
8
8
|
import { ForwardRefExoticComponent } from 'react';
|
|
9
9
|
import { InputHTMLAttributes } from 'react';
|
|
10
10
|
import { JSX } from 'react/jsx-runtime';
|
|
11
|
+
import { Locale } from 'date-fns';
|
|
12
|
+
import { MouseEventHandler } from 'react';
|
|
13
|
+
import { ReactNode } from 'react';
|
|
11
14
|
import { ReactPortal } from 'react';
|
|
12
15
|
import { RefAttributes } from 'react';
|
|
13
16
|
import { RefObject } from 'react';
|
|
14
|
-
import { SubmitHandler
|
|
17
|
+
import { SubmitHandler } from 'react-hook-form';
|
|
15
18
|
import { TextareaHTMLAttributes } from 'react';
|
|
16
19
|
import { UseFormReturn } from 'react-hook-form';
|
|
17
20
|
import { z } from 'zod';
|
|
@@ -89,6 +92,37 @@ export declare const calculatePopoverPosition: ({ triggerRect, popoverWidth, pop
|
|
|
89
92
|
bottom: number | undefined;
|
|
90
93
|
};
|
|
91
94
|
|
|
95
|
+
export declare const Calendar: default_2.FC<CalendarProps>;
|
|
96
|
+
|
|
97
|
+
declare interface CalendarProps {
|
|
98
|
+
selectedDate?: Date | null;
|
|
99
|
+
onDateSelect?: (date: Date) => void;
|
|
100
|
+
disabledDates?: string[];
|
|
101
|
+
disabledDaysOfWeek?: number[];
|
|
102
|
+
minDate?: Date;
|
|
103
|
+
maxDate?: Date;
|
|
104
|
+
locale?: Locale;
|
|
105
|
+
weekStartsOnMonday?: boolean;
|
|
106
|
+
className?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare interface CardContentProps {
|
|
110
|
+
children: React.ReactNode;
|
|
111
|
+
className?: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
declare interface CardFooterProps {
|
|
115
|
+
children: React.ReactNode;
|
|
116
|
+
className?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare interface CardHeaderProps {
|
|
120
|
+
title: string;
|
|
121
|
+
subtitle?: string;
|
|
122
|
+
onClose?: () => void;
|
|
123
|
+
className?: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
92
126
|
export declare const Checkbox: default_2.ForwardRefExoticComponent<CheckboxProps & default_2.RefAttributes<HTMLButtonElement>>;
|
|
93
127
|
|
|
94
128
|
declare interface CheckboxProps {
|
|
@@ -127,6 +161,18 @@ declare const colorStyles: {
|
|
|
127
161
|
disabled: string;
|
|
128
162
|
};
|
|
129
163
|
|
|
164
|
+
export declare const DatePickerDemo: default_2.FC;
|
|
165
|
+
|
|
166
|
+
export declare function DatePickerPopover({ customTrigger, scrollerId, }: {
|
|
167
|
+
customTrigger?: (toggle: VoidFunction, triggerRef: default_2.RefObject<HTMLButtonElement | null>) => ReactNode;
|
|
168
|
+
/**
|
|
169
|
+
* To point scroller id for dismiss on scroll
|
|
170
|
+
*/
|
|
171
|
+
scrollerId?: string;
|
|
172
|
+
}): JSX.Element;
|
|
173
|
+
|
|
174
|
+
export declare const DateTimePicker: () => JSX.Element;
|
|
175
|
+
|
|
130
176
|
/**
|
|
131
177
|
* Creates a debounced function that delays invoking func until after delay milliseconds
|
|
132
178
|
* have elapsed since the last time the debounced function was invoked. Each call resets
|
|
@@ -213,9 +259,11 @@ export declare const FormTextArea: ({ name, customRead, customSet, ...others }:
|
|
|
213
259
|
customSet?: (value: string) => string | null | undefined;
|
|
214
260
|
} & TextAreaProps) => JSX.Element;
|
|
215
261
|
|
|
262
|
+
export declare const FormWorkingHours: () => JSX.Element;
|
|
263
|
+
|
|
216
264
|
declare type FormWrapperProps<T extends FieldValues> = {
|
|
217
265
|
methods: UseFormReturn<T>;
|
|
218
|
-
onSubmit:
|
|
266
|
+
onSubmit: SubmitHandler<T>;
|
|
219
267
|
onError?: (errors: FieldErrors<T>) => void;
|
|
220
268
|
children: default_2.ReactNode;
|
|
221
269
|
logErrors?: boolean;
|
|
@@ -303,6 +351,40 @@ declare type KeepAliveProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
303
351
|
enabled?: boolean;
|
|
304
352
|
};
|
|
305
353
|
|
|
354
|
+
declare type KeyMapping = {
|
|
355
|
+
[key: string]: (event: KeyboardEvent) => void;
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
export declare const List: ({ lightSolid, className, children, ...others }: {
|
|
359
|
+
lightSolid?: boolean;
|
|
360
|
+
className?: string;
|
|
361
|
+
children: React.ReactNode;
|
|
362
|
+
others?: any;
|
|
363
|
+
}) => JSX.Element;
|
|
364
|
+
|
|
365
|
+
export declare const ListItem: ({ onClick, lightSolid, className, children, }: {
|
|
366
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
367
|
+
lightSolid?: boolean;
|
|
368
|
+
className?: string;
|
|
369
|
+
children: React.ReactNode;
|
|
370
|
+
}) => JSX.Element;
|
|
371
|
+
|
|
372
|
+
declare interface ModalsContextType {
|
|
373
|
+
add: (id: string) => void;
|
|
374
|
+
remove: (id: string) => void;
|
|
375
|
+
getPrevId: () => string | undefined;
|
|
376
|
+
animateParentModal: (el: HTMLElement, mode?: "modal" | "sheet") => void;
|
|
377
|
+
restoreParentModal: (el: HTMLElement) => void;
|
|
378
|
+
getModals: () => string[];
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export declare const ModalsProvider: React.FC<ModalsProviderProps>;
|
|
382
|
+
|
|
383
|
+
declare interface ModalsProviderProps {
|
|
384
|
+
children: ReactNode;
|
|
385
|
+
debug?: boolean;
|
|
386
|
+
}
|
|
387
|
+
|
|
306
388
|
export declare const MultiSelect: <T>({ label, labelPosition, options, selectedValues, onChange, idExtractor, labelExtractor, customSetter, valid, error, placeholder, maxSelections, searchable, disabled, className, }: MultiSelectProps<T>) => JSX.Element;
|
|
307
389
|
|
|
308
390
|
declare interface MultiSelectProps<T> {
|
|
@@ -352,6 +434,51 @@ declare type OverflowInfo = {
|
|
|
352
434
|
scrollTop: number;
|
|
353
435
|
};
|
|
354
436
|
|
|
437
|
+
export declare const PageTitle: ({ title, description, size, descriptionClassName, className, }: {
|
|
438
|
+
title: string;
|
|
439
|
+
description?: string;
|
|
440
|
+
size?: keyof typeof titleSizes;
|
|
441
|
+
descriptionClassName?: string;
|
|
442
|
+
className?: string;
|
|
443
|
+
}) => JSX.Element;
|
|
444
|
+
|
|
445
|
+
export declare const PopoverCard: React.FC<PopoverCardProps>;
|
|
446
|
+
|
|
447
|
+
export declare const PopoverCardContent: React.FC<CardContentProps>;
|
|
448
|
+
|
|
449
|
+
export declare const PopoverCardFooter: React.FC<CardFooterProps>;
|
|
450
|
+
|
|
451
|
+
export declare const PopoverCardHeader: React.FC<CardHeaderProps>;
|
|
452
|
+
|
|
453
|
+
export declare interface PopoverCardProps {
|
|
454
|
+
children: ReactNode | ((close: VoidFunction) => ReactNode);
|
|
455
|
+
customTrigger?: ({ triggerRef, triggerProps, toggle, open, close, }: {
|
|
456
|
+
triggerRef: RefObject<HTMLButtonElement | null>;
|
|
457
|
+
triggerProps: any;
|
|
458
|
+
toggle: VoidFunction;
|
|
459
|
+
open: boolean;
|
|
460
|
+
close: VoidFunction;
|
|
461
|
+
}) => React.ReactNode;
|
|
462
|
+
triggerContent?: React.ReactNode;
|
|
463
|
+
align?: "start" | "center" | "end";
|
|
464
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
465
|
+
offset?: number;
|
|
466
|
+
className?: string;
|
|
467
|
+
triggerClassName?: string;
|
|
468
|
+
popoverClassName?: string;
|
|
469
|
+
closeOnEscape?: boolean;
|
|
470
|
+
closeOnClickAway?: boolean;
|
|
471
|
+
/**
|
|
472
|
+
* To point to scroller for dismiss on scroll
|
|
473
|
+
*/
|
|
474
|
+
scrollerId?: string;
|
|
475
|
+
onOpen?: () => void;
|
|
476
|
+
onClose?: () => void;
|
|
477
|
+
maxHeight?: string | number;
|
|
478
|
+
minWidth?: string | number;
|
|
479
|
+
maxWidth?: string | number;
|
|
480
|
+
}
|
|
481
|
+
|
|
355
482
|
export declare const Portal: ({ children, node }: PortalProps) => ReactPortal;
|
|
356
483
|
|
|
357
484
|
declare type PortalProps = {
|
|
@@ -372,7 +499,83 @@ declare type PositionOptions_2 = {
|
|
|
372
499
|
|
|
373
500
|
export declare function removeWhitespaces(text: string): string;
|
|
374
501
|
|
|
375
|
-
export
|
|
502
|
+
export declare const SearchInput: ForwardRefExoticComponent<SearchInputProps & RefAttributes<HTMLInputElement>>;
|
|
503
|
+
|
|
504
|
+
declare interface SearchInputProps {
|
|
505
|
+
placeholder?: string;
|
|
506
|
+
value?: string;
|
|
507
|
+
exposedRef?: (ref: RefObject<HTMLInputElement | null>) => void;
|
|
508
|
+
autoFocus?: (lg: boolean) => boolean;
|
|
509
|
+
onClear?: () => void;
|
|
510
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
511
|
+
className?: string;
|
|
512
|
+
onMount?: (ref: RefObject<HTMLInputElement>, lg: boolean) => Promise<void> | void;
|
|
513
|
+
error?: string | null;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export declare const SeeMoreText: ({ text, length, size, className, buttonClassName, }: {
|
|
517
|
+
text: string;
|
|
518
|
+
length?: number;
|
|
519
|
+
size?: "sm" | "md";
|
|
520
|
+
className?: string;
|
|
521
|
+
buttonClassName?: string;
|
|
522
|
+
}) => JSX.Element;
|
|
523
|
+
|
|
524
|
+
export declare const SegmentedControl: <T>({ options, selected, onChange, keyExtractor, labelExtractor, itemColor, itemClassName, color, unselectedColor, width, border, rounded, trackScroll, className, }: {
|
|
525
|
+
options: T[];
|
|
526
|
+
selected: T;
|
|
527
|
+
onChange: (option: T) => void;
|
|
528
|
+
keyExtractor: (option: T) => string | number;
|
|
529
|
+
labelExtractor: (option: T) => string;
|
|
530
|
+
/**
|
|
531
|
+
*
|
|
532
|
+
* @param selected
|
|
533
|
+
* @description let you override default items colors
|
|
534
|
+
* using tailwind classnames based on it's selected status
|
|
535
|
+
* @returns classnames string
|
|
536
|
+
*/
|
|
537
|
+
itemColor?: (selected: boolean) => string;
|
|
538
|
+
itemClassName?: string;
|
|
539
|
+
color?: keyof typeof segmentedControlStyles.colors;
|
|
540
|
+
unselectedColor?: keyof typeof segmentedControlStyles.unselectedColors;
|
|
541
|
+
width?: keyof typeof segmentedControlStyles.widths;
|
|
542
|
+
border?: keyof typeof segmentedControlStyles.border;
|
|
543
|
+
rounded?: keyof typeof segmentedControlStyles.rounded;
|
|
544
|
+
trackScroll?: boolean;
|
|
545
|
+
className?: string;
|
|
546
|
+
}) => JSX.Element;
|
|
547
|
+
|
|
548
|
+
declare const segmentedControlStyles: {
|
|
549
|
+
rounded: {
|
|
550
|
+
3: string;
|
|
551
|
+
6: string;
|
|
552
|
+
full: string;
|
|
553
|
+
};
|
|
554
|
+
colors: {
|
|
555
|
+
solid: string;
|
|
556
|
+
brand: string;
|
|
557
|
+
contrast: string;
|
|
558
|
+
};
|
|
559
|
+
unselectedColors: {
|
|
560
|
+
none: string;
|
|
561
|
+
solid: string;
|
|
562
|
+
};
|
|
563
|
+
border: {
|
|
564
|
+
solid: string;
|
|
565
|
+
subtle: string;
|
|
566
|
+
brand: string;
|
|
567
|
+
};
|
|
568
|
+
widths: {
|
|
569
|
+
fit: {
|
|
570
|
+
container: string;
|
|
571
|
+
item: string;
|
|
572
|
+
};
|
|
573
|
+
full: {
|
|
574
|
+
container: string;
|
|
575
|
+
item: string;
|
|
576
|
+
};
|
|
577
|
+
};
|
|
578
|
+
};
|
|
376
579
|
|
|
377
580
|
export declare const Separator: ({ className }: {
|
|
378
581
|
className?: string;
|
|
@@ -409,7 +612,24 @@ declare type SpinnerProps = {
|
|
|
409
612
|
spinnerClassName?: string;
|
|
410
613
|
};
|
|
411
614
|
|
|
412
|
-
export declare
|
|
615
|
+
export declare const SuperModal: ({ title, description, showHeader, mode, onReplace, className, contentClassName, children, }: SuperModalProps) => JSX.Element;
|
|
616
|
+
|
|
617
|
+
declare type SuperModalProps = {
|
|
618
|
+
title?: string;
|
|
619
|
+
description?: string;
|
|
620
|
+
showHeader?: boolean;
|
|
621
|
+
mode?: "modal" | "sheet";
|
|
622
|
+
/**
|
|
623
|
+
* Where to redirect to if the modal
|
|
624
|
+
* is loaded as the first page
|
|
625
|
+
* with no previous pathname history
|
|
626
|
+
* defaults to auto generated prevPath
|
|
627
|
+
*/
|
|
628
|
+
onReplace?: string;
|
|
629
|
+
className?: string;
|
|
630
|
+
contentClassName?: string;
|
|
631
|
+
children: ReactNode;
|
|
632
|
+
};
|
|
413
633
|
|
|
414
634
|
export declare function Switch({ checked, onCheckedChange, disabled, name, required, className, }: SwitchProps): JSX.Element;
|
|
415
635
|
|
|
@@ -464,6 +684,15 @@ declare interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaEleme
|
|
|
464
684
|
*/
|
|
465
685
|
export declare function throttle<T extends (...args: any[]) => any>(func: T, limit?: number): (...args: Parameters<T>) => void;
|
|
466
686
|
|
|
687
|
+
export declare const TimePicker: () => JSX.Element;
|
|
688
|
+
|
|
689
|
+
declare const titleSizes: {
|
|
690
|
+
"2": string;
|
|
691
|
+
"4": string;
|
|
692
|
+
"5": string;
|
|
693
|
+
"6": string;
|
|
694
|
+
};
|
|
695
|
+
|
|
467
696
|
export declare function toTitleCase(str: string): string;
|
|
468
697
|
|
|
469
698
|
export declare function useClickAway<T extends HTMLElement = HTMLElement>(callback: () => void): RefObject<T | null>;
|
|
@@ -480,6 +709,34 @@ declare interface UseClickOutsideOptions {
|
|
|
480
709
|
|
|
481
710
|
export declare const useKeepAlive: () => KeepAliveContextType;
|
|
482
711
|
|
|
712
|
+
/**
|
|
713
|
+
* Custom hook for handling keyboard events in React
|
|
714
|
+
*
|
|
715
|
+
* @param keyMap - Object mapping keys to callback functions
|
|
716
|
+
* @param options - Additional options for event handling
|
|
717
|
+
*
|
|
718
|
+
* @example
|
|
719
|
+
* useKeyListener({
|
|
720
|
+
* 'Escape': (e) => {
|
|
721
|
+
* e.preventDefault();
|
|
722
|
+
* setIsOpen(false);
|
|
723
|
+
* },
|
|
724
|
+
* 'Tab': (e) => {
|
|
725
|
+
* if (document.activeElement === inputRef.current) {
|
|
726
|
+
* e.preventDefault();
|
|
727
|
+
* // Custom tab handling logic
|
|
728
|
+
* }
|
|
729
|
+
* }
|
|
730
|
+
* });
|
|
731
|
+
*/
|
|
732
|
+
export declare function useKeyListener(keyMap: KeyMapping, { target, event, enabled }?: UseKeyListenerOptions): void;
|
|
733
|
+
|
|
734
|
+
declare type UseKeyListenerOptions = {
|
|
735
|
+
target?: EventTarget | HTMLElement;
|
|
736
|
+
event?: "keydown" | "keyup" | "keypress";
|
|
737
|
+
enabled?: boolean;
|
|
738
|
+
};
|
|
739
|
+
|
|
483
740
|
/**
|
|
484
741
|
* Custom hook that returns whether the current viewport is larger than the 'lg' breakpoint.
|
|
485
742
|
*
|
|
@@ -512,6 +769,8 @@ export declare function useMergedRef<T>(...refs: React.Ref<T>[]): React.RefCallb
|
|
|
512
769
|
*/
|
|
513
770
|
export declare function useMethods<TSchema extends ZodTypeAny>(schema: TSchema, defaultValues?: Partial<z.infer<TSchema>>): UseFormReturn<z.infer<TSchema>>;
|
|
514
771
|
|
|
772
|
+
export declare const useModals: () => ModalsContextType;
|
|
773
|
+
|
|
515
774
|
export declare const useOverflow: <T extends HTMLElement>({ onOverflow, trackScroll, withObserver, enabled, deps, }?: {
|
|
516
775
|
onOverflow?: (info: OverflowInfo) => void;
|
|
517
776
|
trackScroll?: boolean;
|