import { default as React } from 'react'; import { TooltipProps } from '../Tooltip/Tooltip'; import { ButtonProps } from '../Button/Button.models'; export default function Picker, StateGeneric>({ options, state, callout, stateName, customClass, valuesAreBooleans, disabled, exposedFilterVariant, }: StateAndStateNameProps): React.JSX.Element; export default function Picker, StateGeneric>({ options, selected, callout, customClass, valuesAreBooleans, disabled, exposedFilterVariant, }: SelectedProps): React.JSX.Element; /** * pass in an array of options to select that will be mapped out and styled for you * - then pass in what value is currently selected in state or pass in a state object * w/ fieldName and the component will show that option as selected - state needs to * be managed outside of this component and in the file you are consuming it in. **/ interface RequiredOptionKeys { id?: number; text?: string; value: ValueTypeGeneric; /** Tooltip to display on hover for each option button (only available when exposedFilterVariant is true) */ tooltip?: Omit; } type Selected = string | number | boolean; type OptionsWithoutTooltip = T extends { tooltip?: unknown; } ? Omit : T; type PickerBaseProps> = { customClass?: string; valuesAreBooleans?: boolean; disabled?: boolean; labelText?: string; rightLabel?: React.ReactNode; labelTooltip?: Omit; required?: boolean; error?: boolean; /** Optional prop to add a test id to the Picker for QA testing */ qaTestId?: string; } & ({ /** Use the exposed filter variant styling - when true, options can include tooltip */ exposedFilterVariant: true; options: OptionGeneric[]; } | { /** Use the exposed filter variant styling - when false/undefined, options cannot have tooltip */ exposedFilterVariant?: false; options: Array>; }); type StateAndStateNameCallout = (param1: string, param2: Param2Generic) => void; type StateAndStateNameProps, StateGeneric> = PickerBaseProps & { state: StateGeneric; stateName: string; selected?: Selected; callout: StateAndStateNameCallout; tooltip?: ButtonProps['tooltip']; }; type SelectedPropsCallout = (param1: Param1Generic) => void; type SelectedProps, StateGeneric> = PickerBaseProps & { state?: StateGeneric; stateName?: string; selected?: Selected; callout: SelectedPropsCallout; tooltip?: ButtonProps['tooltip']; }; export type PickerProps, StateGeneric> = SelectedProps | StateAndStateNameProps; export {};