@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
74 lines (73 loc) • 3.53 kB
TypeScript
/**
* Web DrawerList Provider
*/
import React from 'react';
import type { DrawerListContextState } from './DrawerListContext';
import type { SpacingProps } from '../../shared/types';
import type { DrawerListProps, DrawerListData, DrawerListInternalData } from './DrawerList';
export type DrawerListProviderChainable = {
setVisible: (args?: Record<string, unknown> | null, onStateComplete?: (() => void) | null) => void;
setHidden: (args?: unknown[] | null, onStateComplete?: (() => void) | null) => void;
toggleVisible: (...args: unknown[]) => void;
setWrapperElement: (wrapperElement?: string | HTMLElement) => DrawerListProviderChainable;
setData: DrawerListProviderProps['setData'];
setState: DrawerListProviderProps['setState'];
selectItem: DrawerListProviderProps['selectItem'];
selectItemAndClose: DrawerListProviderProps['selectItemAndClose'];
scrollToItem: DrawerListProviderProps['scrollToItem'];
setActiveItemAndScrollToIt: DrawerListProviderProps['setActiveItemAndScrollToIt'];
addObservers: () => void;
removeObservers: () => void;
};
export type DrawerListProviderProps = Omit<DrawerListProps, 'children'> & Omit<React.HTMLProps<HTMLElement>, 'data' | 'role' | 'size' | 'value' | 'onChange' | 'onSelect' | 'onResize'> & SpacingProps & {
hasFocusOnElement?: boolean;
setData?: (data: DrawerListData, cb?: (data: DrawerListInternalData) => void, { overwriteOriginalData, }?: {
overwriteOriginalData?: boolean;
}) => void;
setState?: (state: Partial<DrawerListContextState>, cb?: () => void) => void;
setWrapperElement?: (wrapperElement?: string | HTMLElement) => DrawerListProviderChainable;
setHidden?: (args?: unknown[], onStateComplete?: () => void) => void;
selectItemAndClose?: (itemToSelect: string | number, args?: {
fireSelectEvent?: boolean;
event?: React.SyntheticEvent | Event | Record<string, unknown>;
}) => void;
selectedItem?: string | number;
activeItem?: string | number;
showFocusRing?: boolean;
closestToTop?: string;
closestToBottom?: string;
skipPortal?: boolean;
addObservers?: () => void;
removeObservers?: () => void;
setVisible?: (args?: Record<string, unknown>, onStateComplete?: () => void) => void;
toggleVisible?: (...args: unknown[]) => void;
selectItem?: (itemToSelect: string | number, args?: {
fireSelectEvent?: boolean;
event?: React.SyntheticEvent | Event;
closeOnSelection?: boolean;
}) => void;
scrollToItem?: (activeItem: string | number, opt?: {
scrollTo?: boolean;
element?: HTMLElement;
}) => void;
setActiveItemAndScrollToIt?: (activeItem: string | number, args?: {
fireSelectEvent?: boolean;
scrollTo?: boolean;
event?: React.SyntheticEvent | Event;
}) => void;
_refShell?: React.RefObject<HTMLSpanElement>;
_refTriangle?: React.RefObject<HTMLLIElement & HTMLSpanElement>;
_refUl?: React.RefObject<HTMLUListElement>;
_refRoot?: React.RefObject<HTMLSpanElement>;
_rootElem?: Window | Element;
attributes?: Record<string, any>;
children: React.ReactNode;
};
declare function DrawerListProviderComponent(ownProps: DrawerListProviderProps): import("react/jsx-runtime").JSX.Element;
declare namespace DrawerListProviderComponent {
var displayName: string;
}
declare const DrawerListProvider: React.MemoExoticComponent<typeof DrawerListProviderComponent> & {
blurDelay: number;
};
export default DrawerListProvider;