diff options
-rw-r--r-- | src/webpack/common/components.ts | 4 | ||||
-rw-r--r-- | src/webpack/common/types/components.d.ts | 43 |
2 files changed, 47 insertions, 0 deletions
diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index 0b229ed..63511a7 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -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"]); diff --git a/src/webpack/common/types/components.d.ts b/src/webpack/common/types/components.d.ts index 127b7c6..4dfa7dc 100644 --- a/src/webpack/common/types/components.d.ts +++ b/src/webpack/common/types/components.d.ts @@ -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; |