From 8a0aa6f2a17500f7613052c8cab81e7eaf917c5a Mon Sep 17 00:00:00 2001 From: Rafa Gares Date: Mon, 7 Oct 2024 17:42:21 +0200 Subject: [PATCH 1/3] refactor: improve types --- .../src/async-select-input.tsx | 181 +++++++++++++----- .../src/search-select-input.tsx | 169 ++++++++++++---- .../custom-styled-select-options.tsx | 48 +++-- .../search-icon-dropdown-indicator.tsx | 22 ++- .../inputs/select-utils/src/types.ts | 52 ++--- 5 files changed, 340 insertions(+), 132 deletions(-) diff --git a/packages/components/inputs/async-select-input/src/async-select-input.tsx b/packages/components/inputs/async-select-input/src/async-select-input.tsx index c10c796222..f650d94714 100644 --- a/packages/components/inputs/async-select-input/src/async-select-input.tsx +++ b/packages/components/inputs/async-select-input/src/async-select-input.tsx @@ -1,8 +1,11 @@ -import type { ReactNode, FocusEvent } from 'react'; +import type { ReactNode } from 'react'; import { useIntl } from 'react-intl'; import isEmpty from 'lodash/isEmpty'; import { components as defaultComponents, + InputProps, + OnChangeValue, + SelectComponentsConfig, type ActionMeta, type GroupBase, type OptionsOrGroups, @@ -31,18 +34,30 @@ const customizedComponents = { MultiValueRemove: TagRemove, }; -type TCustomEvent = { +type TCustomEvent< + Option, + isMulti extends boolean, + Group extends GroupBase