feat: SearchableSelect (#518)
Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
parent
cb507babaa
commit
d6f9068695
@ -45,6 +45,10 @@ export const Text = waitForComponent<t.Text>("Text", m => {
|
||||
return (s.length < 1500 && s.includes("data-text-variant") && s.includes("always-white"));
|
||||
});
|
||||
export const Select = waitForComponent<t.Select>("Select", filters.byCode("optionClassName", "popoutPosition", "autoFocus", "maxVisibleItems"));
|
||||
const searchableSelectFilter = filters.byCode("autoFocus", ".Messages.SELECT");
|
||||
export const SearchableSelect = waitForComponent<t.SearchableSelect>("SearchableSelect", m =>
|
||||
m.render && searchableSelectFilter(m.render)
|
||||
);
|
||||
export const Slider = waitForComponent<t.Slider>("Slider", filters.byCode("closestMarkerIndex", "stickToMarkers"));
|
||||
export const Flex = waitForComponent<t.Flex>("Flex", ["Justify", "Align", "Wrap"]);
|
||||
|
||||
|
43
src/webpack/common/types/components.d.ts
vendored
43
src/webpack/common/types/components.d.ts
vendored
@ -235,6 +235,49 @@ export type Select = ComponentType<PropsWithChildren<{
|
||||
"aria-labelledby"?: boolean;
|
||||
}>>;
|
||||
|
||||
export type SearchableSelect = ComponentType<PropsWithChildren<{
|
||||
placeholder?: string;
|
||||
options: ReadonlyArray<SelectOption>; // TODO
|
||||
value?: SelectOption;
|
||||
|
||||
/**
|
||||
* - 0 ~ Filled
|
||||
* - 1 ~ Custom
|
||||
*/
|
||||
look?: 0 | 1;
|
||||
className?: string;
|
||||
popoutClassName?: string;
|
||||
wrapperClassName?: string;
|
||||
popoutPosition?: "top" | "left" | "right" | "bottom" | "center" | "window_center";
|
||||
optionClassName?: string;
|
||||
|
||||
autoFocus?: boolean;
|
||||
isDisabled?: boolean;
|
||||
clearable?: boolean;
|
||||
closeOnSelect?: boolean;
|
||||
clearOnSelect?: boolean;
|
||||
multi?: boolean;
|
||||
|
||||
onChange(value: any): void;
|
||||
onSearchChange?(value: string): void;
|
||||
|
||||
onClose?(): void;
|
||||
onOpen?(): void;
|
||||
onBlur?(): void;
|
||||
|
||||
renderOptionPrefix?(option: SelectOption): ReactNode;
|
||||
renderOptionSuffix?(option: SelectOption): ReactNode;
|
||||
|
||||
filter?(option: SelectOption[], query: string): SelectOption[];
|
||||
|
||||
centerCaret?: boolean;
|
||||
debounceTime?: number;
|
||||
maxVisibleItems?: number;
|
||||
popoutWidth?: number;
|
||||
|
||||
"aria-labelledby"?: boolean;
|
||||
}>>;
|
||||
|
||||
export type Slider = ComponentType<PropsWithChildren<{
|
||||
initialValue: number;
|
||||
defaultValue?: number;
|
||||
|
Loading…
Reference in New Issue
Block a user