@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
33 lines (32 loc) • 2.07 kB
TypeScript
/**
* Web DrawerList Helpers
*/
import type { DrawerListDataArrayItem, DrawerListData, DrawerListDataAll, DrawerListInternalData, DrawerListProps } from './DrawerList';
import type { DrawerListProviderProps } from './DrawerListProvider';
import type { DrawerListContextState } from './DrawerListContext';
export declare const drawerListDefaultProps: Partial<DrawerListProps>;
export declare const drawerListProviderDefaultProps: Partial<DrawerListProviderProps>;
export declare function parseContentTitle(dataItem: DrawerListDataArrayItem, { separator, removeNumericOnlyValues, preferSelectedValue, }?: {
separator?: string;
removeNumericOnlyValues?: boolean;
preferSelectedValue?: boolean;
}): string | null;
export declare const hasObjectKeyAsValue: (data: any) => boolean;
export declare function preSelectData(data: DrawerListData): DrawerListDataAll;
/**
* Takes any of the forms data can have and returns a normalized array representation of it.
* If the data is a single React.ReactNode, it will return an empty list.
* @param {*} props object containing the data in props.data or props.children, or the data itself
* @returns an array representation of the data
*/
export declare function normalizeData(props: any): DrawerListInternalData;
export declare const getData: (props: any) => DrawerListInternalData;
export declare const getCurrentIndex: (value: any, data: any) => any;
export declare const getSelectedItemValue: (value: any, state: any) => any;
export declare const parseCurrentValue: (current: any) => any;
export declare const getEventData: (itemIndex: any, data: any) => any;
export declare const getCurrentData: (itemIndex: any, data: any) => any;
export declare function prepareStartupState(props: DrawerListProviderProps): DrawerListContextState;
export declare const prepareDerivedState: (props: DrawerListProviderProps, state: DrawerListContextState) => DrawerListContextState;
export declare const getCurrentDataTitle: (selectedItem: any, data: any) => string;
export declare const findClosest: (arr: any, val: any) => number;