@sikka/hawa
Version:
Modern UI Kit made with Tailwind
144 lines (127 loc) • 4.79 kB
text/typescript
import * as React$1 from 'react';
import React__default, { useLayoutEffect, RefObject } from 'react';
import { T as ToasterToastProps } from '../Toast-CKWr23kg.mjs';
import 'class-variance-authority/types';
import '@radix-ui/react-toast';
import 'class-variance-authority';
import '../commonTypes-C-g8nFFC.mjs';
declare const useIsomorphicEffect: typeof useLayoutEffect;
declare const actionTypes: {
readonly ADD_TOAST: "ADD_TOAST";
readonly UPDATE_TOAST: "UPDATE_TOAST";
readonly DISMISS_TOAST: "DISMISS_TOAST";
readonly REMOVE_TOAST: "REMOVE_TOAST";
};
type ActionType = typeof actionTypes;
type Action = {
type: ActionType["ADD_TOAST"];
toast: ToasterToastProps;
} | {
type: ActionType["UPDATE_TOAST"];
toast: Partial<ToasterToastProps>;
} | {
type: ActionType["DISMISS_TOAST"];
toastId?: ToasterToastProps["id"];
} | {
type: ActionType["REMOVE_TOAST"];
toastId?: ToasterToastProps["id"];
};
interface State {
toasts: ToasterToastProps[];
}
declare const reducer: (state: State, action: Action) => State;
type Toast = Omit<ToasterToastProps, "id">;
declare function toast({ ...props }: Toast): {
id: string;
dismiss: () => void;
update: (props: ToasterToastProps) => void;
};
declare function useToast(): {
toast: typeof toast;
dismiss: (toastId?: string) => void;
toasts: ToasterToastProps[];
};
type DialogCarouselType = {
canScrollPrev?: any;
emblaRef?: any;
emblaApi?: any;
nextStep?: any;
prevStep?: any;
};
declare const useDialogCarousel: (options?: any) => DialogCarouselType;
declare const useMultiStepDialog: (initialStep: any, stepIds: any[], setOpenDialog: any) => {
currentStep: any;
dialogHeight: null;
visibleStepRef: React__default.MutableRefObject<any>;
handleNext: () => void;
handleBack: () => void;
};
declare function useClipboard({ timeout }?: {
timeout?: number | undefined;
}): {
copy: (value: any) => void;
reset: () => void;
error: Error | null;
copied: boolean;
};
declare const useBreakpoint: () => any;
interface WindowSize {
width: number | undefined;
height: number | undefined;
}
declare const useWindowSize: () => WindowSize;
interface UseFocusWithinOptions {
onFocus?(event: FocusEvent): void;
onBlur?(event: FocusEvent): void;
}
declare function useFocusWithin<T extends HTMLElement = any>({ onBlur, onFocus, }?: UseFocusWithinOptions): {
ref: React.MutableRefObject<T>;
focused: boolean;
};
interface UseMediaQueryOptions {
getInitialValueInEffect: boolean;
}
declare function useMediaQuery(query: string, initialValue?: boolean, { getInitialValueInEffect }?: UseMediaQueryOptions): boolean | undefined;
declare function useTabs(initialTab?: string): {
activeTab: string;
handleTabChange: (index: any) => void;
};
interface ContentRect {
width: number;
height: number;
top: number;
right: number;
left: number;
bottom: number;
}
declare const useMeasureDirty: (ref: RefObject<HTMLElement>) => ContentRect;
declare function useClickOutside<T extends HTMLElement = any>(handler: () => void, events?: string[] | null, nodes?: (HTMLElement | null)[]): React$1.MutableRefObject<T | undefined>;
type KeyboardModifiers = {
alt: boolean;
ctrl: boolean;
meta: boolean;
mod: boolean;
shift: boolean;
};
type Hotkey = KeyboardModifiers & {
key?: string;
};
type CheckHotkeyMatch = (event: KeyboardEvent) => boolean;
declare function parseHotkey(hotkey: string): Hotkey;
declare function getHotkeyMatcher(hotkey: string): CheckHotkeyMatch;
interface HotkeyItemOptions {
preventDefault?: boolean;
}
declare function getHotkeyHandler(hotkeys: HotkeyItem[]): (event: React.KeyboardEvent<HTMLElement> | KeyboardEvent) => void;
type HotkeyItem = [
string,
(event: KeyboardEvent) => void,
HotkeyItemOptions?
];
declare function useShortcuts(hotkeys: HotkeyItem[], tagsToIgnore?: string[], triggerOnContentEditable?: boolean): void;
declare function useWindowEvent<K extends string>(type: K, listener: K extends keyof WindowEventMap ? (this: Window, ev: WindowEventMap[K]) => void : (this: Window, ev: CustomEvent) => void, options?: boolean | AddEventListenerOptions): void;
declare function useViewportSize(): {
width: number;
height: number;
};
export { type ContentRect, type Hotkey, type HotkeyItem, type HotkeyItemOptions, type KeyboardModifiers, type UseFocusWithinOptions, type UseMediaQueryOptions, getHotkeyHandler, getHotkeyMatcher, parseHotkey, reducer, toast, useBreakpoint, useClickOutside, useClipboard, useDialogCarousel, useFocusWithin, useIsomorphicEffect, useMeasureDirty, useMediaQuery, useMultiStepDialog, useShortcuts, useTabs, useToast, useViewportSize, useWindowEvent, useWindowSize };