@boxcustodia/library 2.0.0-alpha.17 → 2.0.0-alpha.18
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.js +1 -1
- package/dist/index.d.ts +40 -14
- package/dist/index.es.js +310 -282
- package/package.json +1 -1
- package/src/__doc__/V2.mdx +37 -1
- package/src/components/accordion/accordion.test.tsx +117 -0
- package/src/components/alert-dialog/alert-dialog.test.tsx +208 -22
- package/src/components/alert-dialog/alert-dialog.tsx +4 -4
- package/src/components/avatar/avatar.test.tsx +166 -29
- package/src/components/combobox/combobox.tsx +1 -1
- package/src/components/dialog/dialog.tsx +1 -1
- package/src/components/input/input.stories.tsx +2 -3
- package/src/components/input/input.test.tsx +109 -0
- package/src/components/label/label.tsx +1 -1
- package/src/components/number-input/number-input.test.tsx +155 -48
- package/src/components/toast/toast.tsx +1 -1
- package/src/hooks/index.ts +4 -3
- package/src/hooks/use-clipboard/index.ts +1 -0
- package/src/hooks/use-clipboard/use-clipboard.stories.tsx +168 -0
- package/src/hooks/use-clipboard/use-clipboard.test.tsx +83 -0
- package/src/hooks/use-clipboard/use-clipboard.tsx +64 -0
- package/src/hooks/use-document-title/index.ts +1 -0
- package/src/hooks/use-document-title/use-document-title.stories.tsx +72 -0
- package/src/hooks/use-document-title/use-document-title.test.tsx +75 -0
- package/src/hooks/use-document-title/use-document-title.tsx +32 -0
- package/src/hooks/use-hover/index.ts +1 -0
- package/src/hooks/use-hover/use-hover.stories.tsx +90 -0
- package/src/hooks/use-hover/use-hover.test.tsx +93 -0
- package/src/hooks/use-hover/use-hover.tsx +45 -0
- package/src/hooks/use-on-mount/index.ts +1 -0
- package/src/hooks/use-on-mount/use-on-mount.stories.tsx +85 -0
- package/src/hooks/use-on-mount/use-on-mount.test.tsx +44 -0
- package/src/hooks/use-on-mount/use-on-mount.tsx +13 -0
- package/src/utils/form.tsx +0 -2
- package/src/hooks/useClipboard/__doc__/useClipboard.stories.tsx +0 -43
- package/src/hooks/useClipboard/__test__/useClipboard.test.tsx +0 -19
- package/src/hooks/useClipboard/index.ts +0 -1
- package/src/hooks/useClipboard/useClipboard.tsx +0 -28
- package/src/hooks/useDocumentTitle/__doc__/useDocumentTitle.stories.tsx +0 -26
- package/src/hooks/useDocumentTitle/index.ts +0 -1
- package/src/hooks/useDocumentTitle/useDocumentTitle.tsx +0 -11
- package/src/hooks/useHover/__doc__/useHover.stories.tsx +0 -41
- package/src/hooks/useHover/__test__/useHover.test.tsx +0 -45
- package/src/hooks/useHover/index.ts +0 -1
- package/src/hooks/useHover/useHover.tsx +0 -40
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ import * as React_2 from 'react';
|
|
|
45
45
|
import { ReactElement } from 'react';
|
|
46
46
|
import { ReactNode } from 'react';
|
|
47
47
|
import { ReactPortal } from 'react';
|
|
48
|
+
import { RefCallback } from 'react';
|
|
48
49
|
import { RefObject } from 'react';
|
|
49
50
|
import { RegisterOptions } from 'react-hook-form';
|
|
50
51
|
import { ScrollArea as ScrollAreaPrimitive } from '@base-ui/react/scroll-area';
|
|
@@ -177,9 +178,9 @@ export declare type AlertDialogProps = Omit<AlertDialogPrimitive.Root.Props, "ch
|
|
|
177
178
|
onAction?: () => void;
|
|
178
179
|
/** Visual variant for the action button. @default "default" */
|
|
179
180
|
variant?: VariantProps<typeof buttonVariants>["variant"];
|
|
180
|
-
/** Label for the cancel button. @default "
|
|
181
|
+
/** Label for the cancel button. @default "Cancelar" */
|
|
181
182
|
closeText?: ReactNode;
|
|
182
|
-
/** Label for the action button. @default "
|
|
183
|
+
/** Label for the action button. @default "Confirmar" */
|
|
183
184
|
actionText?: ReactNode;
|
|
184
185
|
/** Styles the dialog popup panel. */
|
|
185
186
|
className?: string;
|
|
@@ -714,10 +715,6 @@ export declare type ControllableState<T> = {
|
|
|
714
715
|
onChange?: (state: T) => void;
|
|
715
716
|
};
|
|
716
717
|
|
|
717
|
-
declare type CopiedValue = string | null;
|
|
718
|
-
|
|
719
|
-
declare type CopyFunction = (text: string) => Promise<boolean>;
|
|
720
|
-
|
|
721
718
|
export declare const createSafeContext: <T>() => readonly [() => T & ({} | undefined), default_2.Provider<T | null>];
|
|
722
719
|
|
|
723
720
|
export declare function createToastManager(): ToastManager<any> & {
|
|
@@ -2416,7 +2413,23 @@ export declare const useAutocompleteFilter: typeof AutocompletePrimitive.useFilt
|
|
|
2416
2413
|
|
|
2417
2414
|
export declare const useClickOutside: <T extends HTMLElement = HTMLElement>(callback: () => void, watch?: boolean) => RefObject<T | null>;
|
|
2418
2415
|
|
|
2419
|
-
export declare function useClipboard():
|
|
2416
|
+
export declare function useClipboard(options?: UseClipboardInput): UseClipboardReturnValue;
|
|
2417
|
+
|
|
2418
|
+
export declare interface UseClipboardInput {
|
|
2419
|
+
/** Time in ms after which the copied state will reset, `2000` by default */
|
|
2420
|
+
timeout?: number;
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
export declare interface UseClipboardReturnValue {
|
|
2424
|
+
/** Function to copy a string value to the clipboard */
|
|
2425
|
+
copy: (value: string) => void;
|
|
2426
|
+
/** Function to reset copied state and error */
|
|
2427
|
+
reset: () => void;
|
|
2428
|
+
/** Error if copying failed, `null` otherwise */
|
|
2429
|
+
error: Error | null;
|
|
2430
|
+
/** Boolean indicating if the value was copied successfully */
|
|
2431
|
+
copied: boolean;
|
|
2432
|
+
}
|
|
2420
2433
|
|
|
2421
2434
|
export declare const useComboboxFilter: typeof ComboboxPrimitive.useFilter;
|
|
2422
2435
|
|
|
@@ -2435,7 +2448,12 @@ export declare function useDisclosure(initialState?: boolean, callbacks?: {
|
|
|
2435
2448
|
readonly toggle: () => void;
|
|
2436
2449
|
}];
|
|
2437
2450
|
|
|
2438
|
-
export declare function useDocumentTitle(title: string): void;
|
|
2451
|
+
export declare function useDocumentTitle(title: string, options?: UseDocumentTitleInput): void;
|
|
2452
|
+
|
|
2453
|
+
export declare interface UseDocumentTitleInput {
|
|
2454
|
+
/** Restore the previous `document.title` when the component unmounts. Defaults to `false`. */
|
|
2455
|
+
restoreOnUnmount?: boolean;
|
|
2456
|
+
}
|
|
2439
2457
|
|
|
2440
2458
|
export declare function useEventListener<K extends keyof HTMLElementEventMap, T extends HTMLElement = any>(type: K, listener: (this: HTMLDivElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): RefObject<T | null>;
|
|
2441
2459
|
|
|
@@ -2447,15 +2465,19 @@ export declare function useHookForm<T extends FieldValues = FieldValues>(schema:
|
|
|
2447
2465
|
|
|
2448
2466
|
export declare function useHotkey(keys: string | string[], handler: (event: KeyboardEvent) => void, options?: HotkeyOptions): RefObject<any>;
|
|
2449
2467
|
|
|
2450
|
-
export declare function useHover<T extends HTMLElement>(options?:
|
|
2451
|
-
ref: React.RefObject<T | null>;
|
|
2452
|
-
isHovering: boolean;
|
|
2453
|
-
};
|
|
2468
|
+
export declare function useHover<T extends HTMLElement = HTMLElement>(options?: UseHoverInput): UseHoverReturnValue<T>;
|
|
2454
2469
|
|
|
2455
|
-
declare
|
|
2470
|
+
export declare interface UseHoverInput {
|
|
2471
|
+
/** Fired when the pointer enters the target element. Receives the native MouseEvent. */
|
|
2456
2472
|
onHoverStart?: (event: MouseEvent) => void;
|
|
2473
|
+
/** Fired when the pointer leaves the target element. Receives the native MouseEvent. */
|
|
2457
2474
|
onHoverEnd?: (event: MouseEvent) => void;
|
|
2458
|
-
}
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
export declare interface UseHoverReturnValue<T extends HTMLElement = HTMLElement> {
|
|
2478
|
+
hovered: boolean;
|
|
2479
|
+
ref: RefCallback<T>;
|
|
2480
|
+
}
|
|
2459
2481
|
|
|
2460
2482
|
export declare function useIsInsideFieldRoot(): boolean;
|
|
2461
2483
|
|
|
@@ -2498,6 +2520,10 @@ export declare function useObject<T extends GenericObject_2>(): MaybeReturn<T>;
|
|
|
2498
2520
|
|
|
2499
2521
|
export declare function useObject<T extends GenericObject_2>(initialValue: T): Return<T>;
|
|
2500
2522
|
|
|
2523
|
+
export declare function useOnMount(callback: UseOnMountCallback): void;
|
|
2524
|
+
|
|
2525
|
+
export declare type UseOnMountCallback = () => void | (() => void);
|
|
2526
|
+
|
|
2501
2527
|
export declare function usePagination({ totalItems, pageSize, currentPage: currentPageProp, defaultCurrentPage, onCurrentPageChange, initialCurrentPage, onChange, }: usePaginationProps): {
|
|
2502
2528
|
next: () => void;
|
|
2503
2529
|
prev: () => void;
|