@types/react-bootstrap-typeahead
Advanced tools
@@ -13,3 +13,3 @@ // Type definitions for react-bootstrap-typeahead 5.1 | ||
import * as React from 'react'; | ||
import * as React from "react"; | ||
export type EventHandler<T> = (e: React.SyntheticEvent<T>) => void; | ||
@@ -26,4 +26,4 @@ export type Option = string | { [key: string]: any }; | ||
export type TypeaheadModel = string | object; | ||
export type TypeaheadBsSizes = 'large' | 'lg' | 'small' | 'sm'; | ||
export type TypeaheadAlign = 'justify' | 'left' | 'right'; | ||
export type TypeaheadBsSizes = "large" | "lg" | "small" | "sm"; | ||
export type TypeaheadAlign = "justify" | "left" | "right"; | ||
// if options is an object, only let labelKey be a key of that object, whose value is a string | ||
@@ -36,6 +36,8 @@ // or a custom label function that takes a single option and returns a string for the label | ||
// those props should be supplied directly to <Typeahead /> or <AsyncTypeahead /> | ||
export interface InputProps extends Omit< | ||
React.InputHTMLAttributes<HTMLInputElement>, | ||
'onBlur' | 'onChange' | 'onFocus' | 'onKeyDown' | ||
> { | ||
export interface InputProps extends | ||
Omit< | ||
React.InputHTMLAttributes<HTMLInputElement>, | ||
"onBlur" | "onChange" | "onFocus" | "onKeyDown" | ||
> | ||
{ | ||
/* Callback function that determines whether the hint should be selected. */ | ||
@@ -72,7 +74,7 @@ shouldSelectHint?: ShouldSelect | undefined; | ||
export interface InputContainerPropsSingle<T extends TypeaheadModel> extends InputProps { | ||
'aria-activedescendant': string; | ||
'aria-autocomplete': 'list' | 'both'; | ||
'aria-expanded': boolean | 'true' | 'false'; | ||
'aria-haspopup': 'listbox'; | ||
'aria-owns': string; | ||
"aria-activedescendant": string; | ||
"aria-autocomplete": "list" | "both"; | ||
"aria-expanded": boolean | "true" | "false"; | ||
"aria-haspopup": "listbox"; | ||
"aria-owns": string; | ||
autoComplete: string; | ||
@@ -88,3 +90,3 @@ disabled: boolean; | ||
placeholder?: string | undefined; | ||
role: 'combobox'; | ||
role: "combobox"; | ||
value: string; | ||
@@ -94,19 +96,20 @@ } | ||
export interface InputContainerPropsMultiple<T extends TypeaheadModel> | ||
extends Omit<InputContainerPropsSingle<T>, 'role'> { | ||
extends Omit<InputContainerPropsSingle<T>, "role"> | ||
{ | ||
labelKey: TypeaheadLabelKey<T>; | ||
onRemove: (e: Event) => void; | ||
renderToken: (selectedItem: T, props: TypeaheadMenuProps<T>, index: number) => React.ReactNode; | ||
role: ''; | ||
role: ""; | ||
selected: T[]; | ||
} | ||
export type HintedInputContextKeys = 'hintText' | 'initialItem' | 'onAdd' | 'selectHintOnEnter'; | ||
export type HintedInputContextKeys = "hintText" | "initialItem" | "onAdd" | "selectHintOnEnter"; | ||
export type HintedInputContext<T extends TypeaheadModel> = Pick<TypeaheadContext<T>, HintedInputContextKeys>; | ||
export type MenuItemContextKeys = | ||
| 'activeIndex' | ||
| 'isOnlyResult' | ||
| 'onActiveItemChange' | ||
| 'onInitialItemChange' | ||
| 'onMenuItemClick'; | ||
| "activeIndex" | ||
| "isOnlyResult" | ||
| "onActiveItemChange" | ||
| "onInitialItemChange" | ||
| "onMenuItemClick"; | ||
export type MenuItemContext<T extends TypeaheadModel> = Pick<TypeaheadContext<T>, MenuItemContextKeys>; | ||
@@ -224,3 +227,3 @@ | ||
/* Override default new selection text. */ | ||
/* Override default new selection text. */ | ||
newSelectionPrefix?: JSX.Element | string; | ||
@@ -272,14 +275,18 @@ | ||
/* Callback for custom menu rendering. */ | ||
renderMenu?: (( | ||
results: Array<TypeaheadResult<T>>, | ||
menuProps: TypeaheadMenuProps<T>, | ||
state: TypeaheadState<T>, | ||
) => React.ReactNode) | undefined; | ||
renderMenu?: | ||
| (( | ||
results: Array<TypeaheadResult<T>>, | ||
menuProps: TypeaheadMenuProps<T>, | ||
state: TypeaheadState<T>, | ||
) => React.ReactNode) | ||
| undefined; | ||
/* Provides a hook for customized rendering of menu item contents. */ | ||
renderMenuItemChildren?: (( | ||
option: TypeaheadResult<T>, | ||
props: TypeaheadMenuProps<T>, | ||
index: number, | ||
) => React.ReactNode) | undefined; | ||
renderMenuItemChildren?: | ||
| (( | ||
option: TypeaheadResult<T>, | ||
props: TypeaheadMenuProps<T>, | ||
index: number, | ||
) => React.ReactNode) | ||
| undefined; | ||
@@ -345,26 +352,28 @@ /* Provides a hook for customized rendering of tokens when multiple selections are enabled. */ | ||
export interface BaseTypeaheadInputProps extends React.InputHTMLAttributes<HTMLInputElement> { | ||
type: 'text'; | ||
type: "text"; | ||
} | ||
export interface TypeaheadSingleInputWithHocProps<T extends TypeaheadModel> | ||
extends Omit<BaseTypeaheadInputProps, keyof InputContainerPropsSingle<T>>, | ||
InputContainerPropsSingle<T> {} | ||
extends Omit<BaseTypeaheadInputProps, keyof InputContainerPropsSingle<T>>, InputContainerPropsSingle<T> | ||
{} | ||
export interface TypeaheadMulitInputWithHocProps<T extends TypeaheadModel> | ||
extends Omit<BaseTypeaheadInputProps, keyof InputContainerPropsMultiple<T>>, | ||
extends | ||
Omit<BaseTypeaheadInputProps, keyof InputContainerPropsMultiple<T>>, | ||
HintedInputContext<T>, | ||
InputContainerPropsMultiple<T> {} | ||
InputContainerPropsMultiple<T> | ||
{} | ||
export type TypeaheadInputPropKeys = | ||
| 'disabled' | ||
| 'inputProps' | ||
| 'labelKey' | ||
| 'multiple' | ||
| 'onBlur' | ||
| 'onChange' | ||
| 'onFocus' | ||
| 'onKeyDown' | ||
| 'placeholder' | ||
| 'renderToken' | ||
| 'selected'; | ||
| "disabled" | ||
| "inputProps" | ||
| "labelKey" | ||
| "multiple" | ||
| "onBlur" | ||
| "onChange" | ||
| "onFocus" | ||
| "onKeyDown" | ||
| "placeholder" | ||
| "renderToken" | ||
| "selected"; | ||
@@ -417,6 +426,6 @@ export type TypeaheadInputProps<T extends TypeaheadModel> = Pick<TypeaheadProps<T>, TypeaheadInputPropKeys>; | ||
--------------------------------------------------------------------------- */ | ||
export interface ClearButtonProps extends React.HTMLAttributes<'button'> { | ||
export interface ClearButtonProps extends React.HTMLAttributes<"button"> { | ||
size?: TypeaheadBsSizes | undefined; | ||
label?: string | undefined; | ||
onClick: React.HTMLAttributes<'button'>['onClick']; // make onClick requried | ||
onClick: React.HTMLAttributes<"button">["onClick"]; // make onClick requried | ||
} | ||
@@ -438,3 +447,3 @@ | ||
--------------------------------------------------------------------------- */ | ||
export interface AutosizeInputProps extends Pick<React.InputHTMLAttributes<HTMLInputElement>, 'className' | 'style'> { | ||
export interface AutosizeInputProps extends Pick<React.InputHTMLAttributes<HTMLInputElement>, "className" | "style"> { | ||
inputClassName?: string | undefined; | ||
@@ -452,3 +461,3 @@ inputRef?: React.LegacyRef<HTMLInputElement> | undefined; | ||
export interface MenuProps { | ||
'aria-label'?: string | undefined; | ||
"aria-label"?: string | undefined; | ||
children?: React.ReactNode | undefined; | ||
@@ -465,3 +474,3 @@ className?: string | undefined; | ||
export type MenuHeaderProps = Omit<React.HTMLProps<'li'>, 'className'>; | ||
export type MenuHeaderProps = Omit<React.HTMLProps<"li">, "className">; | ||
@@ -477,6 +486,6 @@ export class Menu extends React.Component<MenuProps> { | ||
// prop names that Typeahead provides to TypeaheadMenu | ||
export type TypeaheadMenuPropsPick = 'labelKey' | 'options' | 'renderMenuItemChildren' | 'paginationText'; | ||
export type TypeaheadMenuPropsPick = "labelKey" | "options" | "renderMenuItemChildren" | "paginationText"; | ||
export interface TypeaheadMenuProps<T extends TypeaheadModel> | ||
extends MenuProps, | ||
Pick<AllTypeaheadOwnAndInjectedProps<T>, TypeaheadMenuPropsPick> { | ||
extends MenuProps, Pick<AllTypeaheadOwnAndInjectedProps<T>, TypeaheadMenuPropsPick> | ||
{ | ||
newSelectionPrefix?: React.ReactNode | undefined; | ||
@@ -489,3 +498,3 @@ } | ||
--------------------------------------------------------------------------- */ | ||
export interface BaseMenuItemProps extends React.HTMLProps<'li'> { | ||
export interface BaseMenuItemProps extends React.HTMLProps<"li"> { | ||
active?: boolean | undefined; | ||
@@ -507,3 +516,3 @@ disabled?: boolean | undefined; | ||
--------------------------------------------------------------------------- */ | ||
export type OverlayTypeaheadProps = Pick<TypeaheadProps<any>, 'align' | 'dropup' | 'flip' | 'onMenuToggle'>; | ||
export type OverlayTypeaheadProps = Pick<TypeaheadProps<any>, "align" | "dropup" | "flip" | "onMenuToggle">; | ||
@@ -510,0 +519,0 @@ export interface OverlayProps extends OverlayTypeaheadProps { |
{ | ||
"name": "@types/react-bootstrap-typeahead", | ||
"version": "5.1.9", | ||
"version": "5.1.10", | ||
"description": "TypeScript definitions for react-bootstrap-typeahead", | ||
@@ -55,4 +55,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-bootstrap-typeahead", | ||
}, | ||
"typesPublisherContentHash": "e5cad5f5046f57f9ae30ee20c1ce1c00c2fba1557ef2a9991af70e0f0617ab7f", | ||
"typeScriptVersion": "4.3" | ||
"typesPublisherContentHash": "a361afdebe39fa251a2ab616720fe7e9000dac680a05417bbd7a8974a9878365", | ||
"typeScriptVersion": "4.5" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Thu, 25 May 2023 20:34:37 GMT | ||
* Last updated: Wed, 27 Sep 2023 07:12:04 GMT | ||
* Dependencies: [@types/react](https://npmjs.com/package/@types/react) | ||
@@ -14,0 +14,0 @@ * Global values: none |
26515
0.3%445
2.06%