From 389062193b62704044fa05b8c66c2352b62280f3 Mon Sep 17 00:00:00 2001 From: Ashish Dhama <16203333+AshishDhama@users.noreply.github.com> Date: Thu, 4 May 2023 13:43:33 +0530 Subject: [PATCH] [WebApp][MM-51266]: Add compass (MUI wrapper components) in common components package (#22942) * wrap all the components using compass-components with compass-components theme provider Co-authored-by: @michelengelen Co-authored-by: Mattermost Build --- webapp/channels/package.json | 7 +- .../delete_workspace_modal.tsx | 6 +- .../index.tsx | 6 +- .../delete_draft_modal.test.tsx.snap | 8 +- .../send_draft_modal.test.tsx.snap | 8 +- .../components/feedback_modal/feedback.tsx | 6 +- .../channels/src/components/generic_modal.tsx | 4 +- .../new_channel_modal.test.tsx.snap | 96 ----- .../new_channel_modal.test.tsx | 376 +++++++++--------- .../product_notices.test.tsx.snap | 12 +- .../purchase_in_progress_modal/index.tsx | 8 +- .../screening_in_progress_modal/index.tsx | 6 +- .../mark_all_threads_as_read_modal.tsx | 6 +- .../widgets/inputs/url_input/url_input.tsx | 6 +- webapp/package-lock.json | 366 +++++++++++------ webapp/platform/components/package.json | 9 +- .../components/src/common/constants/theme.ts | 139 +++++++ .../components/base_modal/base_modal.tsx | 59 +++ .../components/base_modal/modal_title.tsx | 71 ++++ .../components/button/button.overrides.ts | 173 ++++++++ .../src/compass/components/button/button.tsx | 39 ++ .../generic_modal/generic_modal.tsx | 80 ++++ .../icon_button/icon_button.overrides.ts | 206 ++++++++++ .../components/icon_button/icon_button.tsx | 51 +++ .../src/compass/components/index.ts | 16 + .../typography/typography.overrides.ts | 285 +++++++++++++ .../components/typography/typography.tsx | 44 ++ .../platform/components/src/compass/index.ts | 10 + .../src/compass/theme_provider/overrides.ts | 23 ++ .../compass/theme_provider/theme_provider.tsx | 31 ++ .../src/compass/theme_provider/themes.ts | 47 +++ .../components/src/compass/utils/color.ts | 32 ++ .../components/src/compass/utils/font.ts | 5 + webapp/platform/components/src/index.tsx | 7 +- .../footer_pagination.test.tsx.snap | 0 .../footer_content/footer_pagination.scss | 0 .../footer_content/footer_pagination.test.tsx | 0 .../footer_content/footer_pagination.tsx | 0 .../footer_content/index.ts | 0 .../legacy_generic_modal.tsx} | 2 +- webapp/platform/types/src/theme.ts | 33 ++ 41 files changed, 1826 insertions(+), 457 deletions(-) delete mode 100644 webapp/channels/src/components/new_channel_modal/__snapshots__/new_channel_modal.test.tsx.snap create mode 100644 webapp/platform/components/src/common/constants/theme.ts create mode 100644 webapp/platform/components/src/compass/components/base_modal/base_modal.tsx create mode 100644 webapp/platform/components/src/compass/components/base_modal/modal_title.tsx create mode 100644 webapp/platform/components/src/compass/components/button/button.overrides.ts create mode 100644 webapp/platform/components/src/compass/components/button/button.tsx create mode 100644 webapp/platform/components/src/compass/components/generic_modal/generic_modal.tsx create mode 100644 webapp/platform/components/src/compass/components/icon_button/icon_button.overrides.ts create mode 100644 webapp/platform/components/src/compass/components/icon_button/icon_button.tsx create mode 100644 webapp/platform/components/src/compass/components/index.ts create mode 100644 webapp/platform/components/src/compass/components/typography/typography.overrides.ts create mode 100644 webapp/platform/components/src/compass/components/typography/typography.tsx create mode 100644 webapp/platform/components/src/compass/index.ts create mode 100644 webapp/platform/components/src/compass/theme_provider/overrides.ts create mode 100644 webapp/platform/components/src/compass/theme_provider/theme_provider.tsx create mode 100644 webapp/platform/components/src/compass/theme_provider/themes.ts create mode 100644 webapp/platform/components/src/compass/utils/color.ts create mode 100644 webapp/platform/components/src/compass/utils/font.ts rename webapp/platform/components/src/{generic_modal => legacy_generic_modal}/footer_content/__snapshots__/footer_pagination.test.tsx.snap (100%) rename webapp/platform/components/src/{generic_modal => legacy_generic_modal}/footer_content/footer_pagination.scss (100%) rename webapp/platform/components/src/{generic_modal => legacy_generic_modal}/footer_content/footer_pagination.test.tsx (100%) rename webapp/platform/components/src/{generic_modal => legacy_generic_modal}/footer_content/footer_pagination.tsx (100%) rename webapp/platform/components/src/{generic_modal => legacy_generic_modal}/footer_content/index.ts (100%) rename webapp/platform/components/src/{generic_modal/generic_modal.tsx => legacy_generic_modal/legacy_generic_modal.tsx} (99%) create mode 100644 webapp/platform/types/src/theme.ts diff --git a/webapp/channels/package.json b/webapp/channels/package.json index 2f4eb18a22..f63b532c8f 100644 --- a/webapp/channels/package.json +++ b/webapp/channels/package.json @@ -13,9 +13,10 @@ "@mattermost/compass-components": "^0.2.12", "@mattermost/compass-icons": "0.1.34", "@mattermost/types": "*", - "@mui/base": "5.0.0-alpha.116", - "@mui/material": "5.11.7", - "@mui/styled-engine-sc": "5.11.0", + "@mui/base": "5.0.0-alpha.127", + "@mui/material": "5.11.16", + "@mui/system": "5.11.16", + "@mui/styled-engine-sc": "5.11.11", "@stripe/react-stripe-js": "1.13.0", "@stripe/stripe-js": "1.41.0", "@tippyjs/react": "4.2.6", diff --git a/webapp/channels/src/components/admin_console/billing/delete_workspace/delete_workspace_modal.tsx b/webapp/channels/src/components/admin_console/billing/delete_workspace/delete_workspace_modal.tsx index 485dfad01d..1b57ecfc79 100644 --- a/webapp/channels/src/components/admin_console/billing/delete_workspace/delete_workspace_modal.tsx +++ b/webapp/channels/src/components/admin_console/billing/delete_workspace/delete_workspace_modal.tsx @@ -7,7 +7,7 @@ import {FormattedMessage} from 'react-intl'; import {useDispatch, useSelector} from 'react-redux'; -import {GenericModal} from '@mattermost/components'; +import {LegacyGenericModal} from '@mattermost/components'; import LaptopAlertSVG from 'components/common/svg_images_components/laptop_alert_svg'; import {closeModal, openModal} from 'actions/views/modals'; @@ -180,7 +180,7 @@ export default function DeleteWorkspaceModal(props: Props) { } return ( - @@ -249,6 +249,6 @@ export default function DeleteWorkspaceModal(props: Props) { /> - + ); } diff --git a/webapp/channels/src/components/air_gapped_self_hosted_purchase_modal/index.tsx b/webapp/channels/src/components/air_gapped_self_hosted_purchase_modal/index.tsx index 530902c3bb..97b6d9222c 100644 --- a/webapp/channels/src/components/air_gapped_self_hosted_purchase_modal/index.tsx +++ b/webapp/channels/src/components/air_gapped_self_hosted_purchase_modal/index.tsx @@ -4,7 +4,7 @@ import React from 'react'; import {FormattedMessage} from 'react-intl'; -import {GenericModal} from '@mattermost/components'; +import {LegacyGenericModal} from '@mattermost/components'; import {CloudLinks} from 'utils/constants'; import CreditCardSvg from 'components/common/svg_images_components/credit_card_svg'; import {useControlAirGappedSelfHostedPurchaseModal} from 'components/common/hooks/useControlModal'; @@ -15,7 +15,7 @@ export default function AirGappedSelfHostedPurhcaseModal() { const {close} = useControlAirGappedSelfHostedPurchaseModal(); return ( - {CloudLinks.SELF_HOSTED_PRICING} - + ); } diff --git a/webapp/channels/src/components/drafts/draft_actions/__snapshots__/delete_draft_modal.test.tsx.snap b/webapp/channels/src/components/drafts/draft_actions/__snapshots__/delete_draft_modal.test.tsx.snap index bcffa0da8f..26ffba2022 100644 --- a/webapp/channels/src/components/drafts/draft_actions/__snapshots__/delete_draft_modal.test.tsx.snap +++ b/webapp/channels/src/components/drafts/draft_actions/__snapshots__/delete_draft_modal.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/drafts/draft_actions/delete_draft_modal should have called onConfirm 1`] = ` - - + `; exports[`components/drafts/draft_actions/delete_draft_modal should have called onExited 1`] = ` - - + `; exports[`components/drafts/draft_actions/delete_draft_modal should match snapshot 1`] = ` diff --git a/webapp/channels/src/components/drafts/draft_actions/__snapshots__/send_draft_modal.test.tsx.snap b/webapp/channels/src/components/drafts/draft_actions/__snapshots__/send_draft_modal.test.tsx.snap index 548c04c4c5..cf89abf778 100644 --- a/webapp/channels/src/components/drafts/draft_actions/__snapshots__/send_draft_modal.test.tsx.snap +++ b/webapp/channels/src/components/drafts/draft_actions/__snapshots__/send_draft_modal.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/drafts/draft_actions/send_draft_modal should have called onConfirm 1`] = ` - - + `; exports[`components/drafts/draft_actions/send_draft_modal should have called onExited 1`] = ` - - + `; exports[`components/drafts/draft_actions/send_draft_modal should match snapshot 1`] = ` diff --git a/webapp/channels/src/components/feedback_modal/feedback.tsx b/webapp/channels/src/components/feedback_modal/feedback.tsx index 3f612017be..8b6c64aebe 100644 --- a/webapp/channels/src/components/feedback_modal/feedback.tsx +++ b/webapp/channels/src/components/feedback_modal/feedback.tsx @@ -6,7 +6,7 @@ import React, {useState} from 'react'; import {injectIntl, WrappedComponentProps} from 'react-intl'; import {useDispatch} from 'react-redux'; -import {GenericModal} from '@mattermost/components'; +import {LegacyGenericModal} from '@mattermost/components'; import {Feedback} from '@mattermost/types/cloud'; import {closeModal} from 'actions/views/modals'; import RadioButtonGroup from 'components/common/radio_group'; @@ -59,7 +59,7 @@ function FeedbackModal(props: Props) { }; return ( - } - + ); } diff --git a/webapp/channels/src/components/generic_modal.tsx b/webapp/channels/src/components/generic_modal.tsx index 2e43ab311a..5ea190f2f5 100644 --- a/webapp/channels/src/components/generic_modal.tsx +++ b/webapp/channels/src/components/generic_modal.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import {GenericModal} from '@mattermost/components'; +import {LegacyGenericModal} from '@mattermost/components'; import {t} from 'utils/i18n'; @@ -15,4 +15,4 @@ t('footer_pagination.count'); t('footer_pagination.prev'); t('footer_pagination.next'); -export default GenericModal; +export default LegacyGenericModal; diff --git a/webapp/channels/src/components/new_channel_modal/__snapshots__/new_channel_modal.test.tsx.snap b/webapp/channels/src/components/new_channel_modal/__snapshots__/new_channel_modal.test.tsx.snap deleted file mode 100644 index a681256d49..0000000000 --- a/webapp/channels/src/components/new_channel_modal/__snapshots__/new_channel_modal.test.tsx.snap +++ /dev/null @@ -1,96 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`components/new_channel_modal should match snapshot 1`] = ` - -
- - - -
-