From a74f4d9475ab3548821fe9f6380c204d56f886d6 Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 1 Jun 2023 17:58:15 +0200 Subject: [PATCH] SONAR-19345 new UI for the issue Bulk Change Modal --- .../src/components/InputMultiSelect.tsx | 70 ++++ .../src/components/InputSelect.tsx | 9 +- .../{MultiSelect.tsx => MultiSelectMenu.tsx} | 13 +- ...ctOption.tsx => MultiSelectMenuOption.tsx} | 2 +- .../src/components/RadioButton.tsx | 2 +- .../src/components/SearchSelectDropdown.tsx | 12 +- .../SearchSelectDropdownControl.tsx | 18 +- .../src/components/TagsSelector.tsx | 13 +- .../__tests__/InputMultiSelect-test.tsx | 40 ++ ...lect-test.tsx => MultiSelectMenu-test.tsx} | 6 +- .../src/components/__tests__/Tags-test.tsx | 1 - .../design-system/src/components/buttons.tsx | 2 +- .../src/components/icons/index.ts | 1 + .../design-system/src/components/index.ts | 3 + .../src/components/modal/ModalBody.tsx | 3 +- .../__snapshots__/ModalBody-test.tsx.snap | 3 + .../js/apps/account/components/UserCard.tsx | 4 +- .../apps/issues/components/AssigneeSelect.tsx | 162 ++++---- .../issues/components/BulkChangeModal.tsx | 356 ++++++++---------- .../js/apps/issues/components/IssuesApp.tsx | 4 +- .../js/apps/issues/components/TagsSelect.tsx | 112 ++++++ .../__tests__/AssigneeSelect-test.tsx | 61 +-- .../__tests__/BulkChangeModal-it.tsx | 68 ++-- .../js/apps/issues/sidebar/AssigneeFacet.tsx | 3 +- .../components/PermissionItem.tsx | 4 +- ...QualityGatePermissionsAddModalRenderer.tsx | 4 +- .../details/ProfilePermissionsFormSelect.tsx | 8 +- .../details/ProfilePermissionsUser.tsx | 11 +- .../ProfilePermissionsUser-test.tsx.snap | 2 +- .../security-hotspots/components/Assignee.tsx | 3 +- .../components/HotspotReviewHistory.tsx | 4 +- .../js/apps/users/components/UserListItem.tsx | 9 +- .../icon-mappers/IssueSeverityIcon.tsx | 51 +++ .../components/icon-mappers/IssueTypeIcon.tsx | 2 +- .../issue/components/IssueAssign.tsx | 11 +- .../issue/components/IssueCommentLine.tsx | 6 +- .../issue/popups/ChangelogPopup.tsx | 4 +- .../components/issue/popups/CommentTile.tsx | 4 +- .../issue/popups/SetAssigneePopup.tsx | 9 +- .../issue/popups/SimilarIssuesPopup.tsx | 4 +- .../js/components/permissions/UserHolder.tsx | 4 +- .../src/main/js/components/ui/Avatar.tsx | 52 +-- .../main/js/components/ui/LegacyAvatar.tsx | 74 ++++ .../components/ui/__tests__/Avatar-test.tsx | 47 +-- .../ui/__tests__/LegacyAvatar-test.tsx | 57 +++ ...st.tsx.snap => LegacyAvatar-test.tsx.snap} | 0 .../resources/org/sonar/l10n/core.properties | 5 +- 47 files changed, 837 insertions(+), 506 deletions(-) create mode 100644 server/sonar-web/design-system/src/components/InputMultiSelect.tsx rename server/sonar-web/design-system/src/components/{MultiSelect.tsx => MultiSelectMenu.tsx} (97%) rename server/sonar-web/design-system/src/components/{MultiSelectOption.tsx => MultiSelectMenuOption.tsx} (96%) create mode 100644 server/sonar-web/design-system/src/components/__tests__/InputMultiSelect-test.tsx rename server/sonar-web/design-system/src/components/__tests__/{MultiSelect-test.tsx => MultiSelectMenu-test.tsx} (96%) create mode 100644 server/sonar-web/src/main/js/apps/issues/components/TagsSelect.tsx create mode 100644 server/sonar-web/src/main/js/components/icon-mappers/IssueSeverityIcon.tsx create mode 100644 server/sonar-web/src/main/js/components/ui/LegacyAvatar.tsx create mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/LegacyAvatar-test.tsx rename server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/{Avatar-test.tsx.snap => LegacyAvatar-test.tsx.snap} (100%) diff --git a/server/sonar-web/design-system/src/components/InputMultiSelect.tsx b/server/sonar-web/design-system/src/components/InputMultiSelect.tsx new file mode 100644 index 00000000000..6a7eca741bf --- /dev/null +++ b/server/sonar-web/design-system/src/components/InputMultiSelect.tsx @@ -0,0 +1,70 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import styled from '@emotion/styled'; +import classNames from 'classnames'; +import { themeBorder } from '../helpers'; +import { Badge } from './Badge'; +import { LightLabel } from './Text'; +import { ButtonProps, WrapperButton } from './buttons'; +import { ChevronDownIcon } from './icons'; + +interface Props extends Pick { + className?: string; + count?: number; + id?: string; + placeholder: string; + selectedLabel: string; +} + +export function InputMultiSelect(props: Props) { + const { className, count, id, placeholder, selectedLabel } = props; + + return ( + + {count ? selectedLabel : {placeholder}} + +
+ {count !== undefined && count > 0 && {count}} + +
+
+ ); +} + +const StyledWrapper = styled(WrapperButton)` + border: ${themeBorder('default', 'inputBorder')}; + + &:hover { + border: ${themeBorder('default', 'inputFocus')}; + } + + &:active, + &:focus, + &:focus-within, + &:focus-visible { + border: ${themeBorder('default', 'inputFocus')}; + outline: ${themeBorder('focus', 'inputFocus')}; + } +`; diff --git a/server/sonar-web/design-system/src/components/InputSelect.tsx b/server/sonar-web/design-system/src/components/InputSelect.tsx index 3b51e2a9a4f..1498b2edca8 100644 --- a/server/sonar-web/design-system/src/components/InputSelect.tsx +++ b/server/sonar-web/design-system/src/components/InputSelect.tsx @@ -111,11 +111,11 @@ export function InputSelect< Option extends LabelValueSelectOption, IsMulti extends boolean = false, Group extends GroupBase