From 422081485bf8e9646921f48d7b1f8d54b9854bd7 Mon Sep 17 00:00:00 2001 From: stanislavh Date: Thu, 2 May 2024 17:29:48 +0200 Subject: [PATCH] SONAR-22168 Align InputSelect --- .../DatePickerCustomCalendarNavigation.tsx | 2 +- .../src/components/input/DiscreetSelect.tsx | 46 +++---- .../src/components/input/SearchSelect.tsx | 26 ++-- .../components/input/SearchSelectDropdown.tsx | 8 +- .../input/__tests__/DiscreetSelect-test.tsx | 33 +++-- .../__tests__/SearchSelectDropdown-test.tsx | 2 +- .../src/components/input/index.ts | 1 - .../src/sonar-aligned/components/index.ts | 1 + .../components/input/InputSelect.tsx | 110 +++++++++++++++ .../components/input/SelectCommon.tsx} | 126 ++++++------------ .../input/__tests__/InputSelect-test.tsx | 16 ++- .../sonar-aligned/components/input/index.ts | 22 +++ .../components/StatusFilter.tsx | 4 +- .../components/TypesFilter.tsx | 4 +- .../components/CustomRuleFormModal.tsx | 2 +- .../project/Azure/AzureProjectCreate.tsx | 4 +- .../BitbucketCloudProjectCreate.tsx | 5 +- .../project/Github/GitHubProjectCreate.tsx | 2 +- .../project/Gitlab/GitlabProjectCreate.tsx | 2 +- .../apps/issues/components/AssigneeSelect.tsx | 4 +- .../issues/components/BulkChangeModal.tsx | 4 +- .../project/components/ApplyTemplate.tsx | 2 +- .../components/ProjectActivityPageFilters.tsx | 4 +- .../projects/components/PerspectiveSelect.tsx | 2 +- .../BulkApplyTemplateModal.tsx | 2 +- ...QualityGatePermissionsAddModalRenderer.tsx | 4 +- 26 files changed, 254 insertions(+), 184 deletions(-) create mode 100644 server/sonar-web/design-system/src/sonar-aligned/components/input/InputSelect.tsx rename server/sonar-web/design-system/src/{components/input/InputSelect.tsx => sonar-aligned/components/input/SelectCommon.tsx} (61%) rename server/sonar-web/design-system/src/{ => sonar-aligned}/components/input/__tests__/InputSelect-test.tsx (85%) create mode 100644 server/sonar-web/design-system/src/sonar-aligned/components/input/index.ts diff --git a/server/sonar-web/design-system/src/components/input/DatePickerCustomCalendarNavigation.tsx b/server/sonar-web/design-system/src/components/input/DatePickerCustomCalendarNavigation.tsx index ac651e16c34..467fdab81a4 100644 --- a/server/sonar-web/design-system/src/components/input/DatePickerCustomCalendarNavigation.tsx +++ b/server/sonar-web/design-system/src/components/input/DatePickerCustomCalendarNavigation.tsx @@ -33,9 +33,9 @@ import { useDayPicker, } from 'react-day-picker'; import { useIntl } from 'react-intl'; +import { InputSelect } from '../../sonar-aligned/components/input'; import { InteractiveIcon } from '../InteractiveIcon'; import { ChevronLeftIcon, ChevronRightIcon } from '../icons'; -import { InputSelect } from './InputSelect'; const YEARS_TO_DISPLAY = 10; const MONTHS_IN_A_YEAR = 12; diff --git a/server/sonar-web/design-system/src/components/input/DiscreetSelect.tsx b/server/sonar-web/design-system/src/components/input/DiscreetSelect.tsx index 13b6068c3fa..6981cefffc5 100644 --- a/server/sonar-web/design-system/src/components/input/DiscreetSelect.tsx +++ b/server/sonar-web/design-system/src/components/input/DiscreetSelect.tsx @@ -18,44 +18,30 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import styled from '@emotion/styled'; +import { GroupBase, OnChangeValue } from 'react-select'; import tw from 'twin.macro'; import { themeBorder, themeColor, themeContrast } from '../../helpers/theme'; -import { InputSizeKeys } from '../../types/theme'; -import { InputSelect, LabelValueSelectOption } from './InputSelect'; +import { InputSelect, SelectProps } from '../../sonar-aligned/components/input'; -interface Props { - className?: string; - components?: Parameters[0]['components']; +type DiscreetProps< + Option, + IsMulti extends boolean = false, + Group extends GroupBase