Skip to content

Commit

Permalink
Fix #3506: Listbox typescript fixes (#3507)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Oct 25, 2022
1 parent bf78e9c commit 1d27563
Showing 1 changed file with 37 additions and 24 deletions.
61 changes: 37 additions & 24 deletions components/lib/listbox/listbox.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as React from 'react';
import { SelectItemOptionsType } from '../selectitem/selectitem';
import TooltipOptions from '../tooltip/tooltipoptions';
import { VirtualScrollerProps, VirtualScroller } from '../virtualscroller';
import { VirtualScroller, VirtualScrollerProps } from '../virtualscroller';

type ListBoxOptionGroupTemplateType = React.ReactNode | ((option: any, index: number) => React.ReactNode);

type ListBoxItemTemplateType = React.ReactNode | ((option: any) => React.ReactNode);

type ListBoxFilterTemplateType = React.ReactNode | ((options: ListBoxFilterOptions) => React.ReactNode);
type ListBoxFilterTemplateType = React.ReactNode | ((options: ListBoxFilterTemplateOptions) => React.ReactNode);

type ListBoxOptionDisabledType = string | ((option: any) => boolean);

Expand All @@ -30,42 +30,55 @@ interface ListBoxFilterValueChangeParams {
value: any;
}

interface ListBoxFilterTemplateOptions {
className: string;
disabled?: boolean;
element: HTMLDivElement;
filter?: string;
filterIconClassName: string;
filterInputChange?: React.ChangeEvent<HTMLInputElement>;
filterInputProps?: any;
filterOptions?: ListBoxFilterOptions;
filterPlaceholder?: string;
filterTemplate?: ListBoxFilterTemplateType;
}

interface ListBoxFilterOptions {
filter?: (event?: KeyboardEvent) => void;
filter?: (event?: React.ChangeEvent<HTMLInputElement>) => void;
reset?: () => void;
}

export interface ListBoxProps extends Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onChange' | 'ref'> {
value?: any;
options?: SelectItemOptionsType;
optionLabel?: string;
optionValue?: string;
optionDisabled?: ListBoxOptionDisabledType;
optionGroupLabel?: string;
optionGroupChildren?: string;
optionGroupTemplate?: ListBoxOptionGroupTemplateType;
itemTemplate?: ListBoxItemTemplateType;
filterTemplate?: ListBoxFilterTemplateType;
listStyle?: React.CSSProperties;
listClassName?: string;
virtualScrollerOptions?: VirtualScrollerProps;
disabled?: boolean;
ariaLabelledBy?: string;
children?: React.ReactNode;
dataKey?: string;
multiple?: boolean;
metaKeySelection?: boolean;
disabled?: boolean;
filter?: boolean;
filterBy?: string;
filterValue?: string;
filterInputProps?: any;
filterLocale?: string;
filterMatchMode?: string;
filterPlaceholder?: string;
filterLocale?: string;
filterInputProps?: any;
filterTemplate?: ListBoxFilterTemplateType;
filterValue?: string;
itemTemplate?: ListBoxItemTemplateType;
listClassName?: string;
listStyle?: React.CSSProperties;
metaKeySelection?: boolean;
multiple?: boolean;
optionDisabled?: ListBoxOptionDisabledType;
optionGroupChildren?: string;
optionGroupLabel?: string;
optionGroupTemplate?: ListBoxOptionGroupTemplateType;
optionLabel?: string;
optionValue?: string;
options?: SelectItemOptionsType;
tooltip?: string;
tooltipOptions?: TooltipOptions;
ariaLabelledBy?: string;
value?: any;
virtualScrollerOptions?: VirtualScrollerProps;
onChange?(e: ListBoxChangeParams): void;
onFilterValueChange?(e: ListBoxFilterValueChangeParams): void;
children?: React.ReactNode;
}

export declare class ListBox extends React.Component<ListBoxProps, any> {
Expand Down

0 comments on commit 1d27563

Please sign in to comment.