@kwiz/fluentui
Version:
KWIZ common controls for FluentUI
38 lines (37 loc) • 1.48 kB
TypeScript
import { DropdownProps } from '@fluentui/react-components';
import React from 'react';
type ForwardProps = Omit<DropdownProps, "onSelect" | "selectedOptions" | "clearable" | "defaultSelectedOptions">;
interface iProps<keyType, dataType> extends ForwardProps {
required?: boolean;
items: {
key: keyType;
value: string;
data?: dataType;
/** display complex controls in the drop down */
option?: JSX.Element;
}[];
onSelect: (
/** the specific option that was selected/unselected */
option: {
key: keyType;
value: string;
data?: dataType;
},
/** only sent for multi select - all selected options, in case of multi select */
options?: {
key: keyType;
value: string;
data?: dataType;
}[]) => void;
}
type tProps<keyType, dataType> = iProps<keyType, dataType> & ({
selected: keyType | keyType[];
defaultSelected?: never;
} | {
selected?: never;
defaultSelected: keyType | keyType[];
});
export declare const DropdownEX: <keyType extends string = string, dataType = never>(props: tProps<keyType, dataType> & React.RefAttributes<HTMLButtonElement>) => React.JSX.Element | null;
/** @deprecated use normal DropdownEX it is now generic */
export declare function getDropdownEX<keyType extends string = string, dataType = never>(): (props: tProps<keyType, dataType> & React.RefAttributes<HTMLButtonElement>) => React.JSX.Element | null;
export {};