UNPKG

lucid-ui

Version:

A UI component library from AppNexus.

215 lines (214 loc) 6.77 kB
import React from 'react'; import { StandardProps } from '../../util/component-types'; import * as reducers from './SingleSelect.reducers'; import { IDropMenuProps, IDropMenuState, IDropMenuOptionProps, IDropMenuOptionGroupProps, IOptionsData } from '../DropMenu/DropMenu'; /** Placeholder Child Component */ interface ISingleSelectPlaceholderProps extends StandardProps { description?: string; } /** Option Child Component */ export interface ISingleSelectOptionProps extends IDropMenuOptionProps { description?: string; name?: string; /** Custom Option component (alias for `SingleSelect.Option.Selected`) */ Selected?: React.ReactNode; } declare type ISingleSelectDropMenuProps = Partial<IDropMenuProps>; /** Single Select Component */ export interface ISingleSelectProps extends StandardProps { /** Custom Placeholder component (alias for `SingleSelect.Placeholder`) */ Placeholder?: React.ReactNode; /** Custom Option component (alias for `SingleSelect.Option`) */ Option?: React.ReactNode; /** Custom Option component (alias for `SingleSelect.Option.Selected`) */ Selected?: React.ReactNode; /** Custom OptionGroup component (alias for `SingleSelect.OptionGroup`) */ OptionGroup?: IDropMenuOptionGroupProps; hasReset: boolean; isSelectionHighlighted: boolean; isDisabled: boolean; isInvisible: boolean; selectedIndex: number | null; DropMenu: ISingleSelectDropMenuProps; maxMenuHeight?: number | string; showIcon?: boolean; onSelect?: (optionIndex: number | null, { props, event, }: { props: ISingleSelectOptionProps | undefined; event: React.MouseEvent | React.KeyboardEvent; }) => void; } export interface ISingleSelectState { selectedIndex: number | null; optionGroups: IDropMenuOptionGroupProps[]; flattenedOptionsData: IOptionsData[]; ungroupedOptionData: IOptionsData[]; optionGroupDataLookup: { [key: number]: IOptionsData[]; }; DropMenu: IDropMenuState; } declare class SingleSelect extends React.Component<ISingleSelectProps, ISingleSelectState> { static displayName: string; static peek: { description: string; notes: { overview: string; intendedUse: string; technicalRecommendations: string; }; categories: string[]; madeFrom: string[]; }; static defaultProps: { hasReset: boolean; isSelectionHighlighted: boolean; isDisabled: boolean; isInvisible: boolean; selectedIndex: null; showIcon: boolean; DropMenu: { isDisabled: boolean; isExpanded: boolean; direction: "down"; alignment: "start"; selectedIndices: never[]; focusedIndex: null; flyOutStyle: { maxHeight: string; }; onExpand: (...args: any[]) => void; onCollapse: (...args: any[]) => void; onSelect: (...args: any[]) => void; onFocusNext: (...args: any[]) => void; onFocusPrev: (...args: any[]) => void; onFocusOption: (...args: any[]) => void; portalId: string; optionContainerStyle: {}; ContextMenu: { direction: string; directonOffset: number; minWidthOffset: number; alignment: string; getAlignmentOffset: () => number; isExpanded: boolean; onClickOut: null; portalId: null; }; }; }; static reducers: typeof reducers; static Placeholder: { (_props: ISingleSelectPlaceholderProps): null; displayName: string; peek: { description: string; }; propName: string; }; static Option: { (_props: ISingleSelectOptionProps): null; displayName: string; peek: { description: string; }; Selected: { (_props: { children?: React.ReactNode; }): null; displayName: string; peek: { description: string; }; propName: string; propTypes: {}; }; propName: string; propTypes: { isDisabled: any; isHidden: any; /** Custom OptionGroup component (alias for `SingleSelect.OptionGroup`) */ isWrapped: any; Selected: any; }; defaultProps: { isDisabled: boolean; isHidden: boolean; isWrapped: boolean; }; }; static Selected: { (_props: { children?: React.ReactNode; }): null; displayName: string; peek: { description: string; }; propName: string; propTypes: {}; }; static OptionGroup: { (_props: IDropMenuOptionGroupProps): null; displayName: string; peek: { description: string; }; propName: string; propTypes: { isHidden: any; }; defaultProps: { isHidden: boolean; }; }; static NullOption: { (_props: import("../DropMenu/DropMenu").IDropMenuNullOptionProps): null; displayName: string; peek: { description: string; }; propName: string; propTypes: {}; }; static FixedOption: { (_props: import("../DropMenu/DropMenu").IDropMenuFixedOptionProps): null; displayName: string; peek: { description: string; }; propName: string; propTypes: { isDisabled: any; isHidden: any; isWrapped: any; }; defaultProps: { isDisabled: boolean; isHidden: boolean; isWrapped: boolean; }; }; static propTypes: { children: any; className: any; style: any; isSelectionHighlighted: any; hasReset: any; isDisabled: any; isInvisible: any; selectedIndex: any; maxMenuHeight: any; showIcon: any; DropMenu: any; onSelect: any; Placeholder: any; Option: any; OptionGroup: any; }; UNSAFE_componentWillMount(): void; UNSAFE_componentWillReceiveProps(nextProps: ISingleSelectProps): void; render(): React.ReactNode; } declare const _default: typeof SingleSelect & import("../../util/state-management").IHybridComponent<ISingleSelectProps, ISingleSelectState>; export default _default; export { SingleSelect as SingleSelectDumb };