From 1f728aa0e9c9decd6a3b47a305968eb99a9c9000 Mon Sep 17 00:00:00 2001 From: Noah Allen Date: Wed, 19 Jul 2023 14:17:26 -0700 Subject: [PATCH] Update wordpress packages to a recent version (#78711) * Add script which updates package.json resolutions field * Update @wordpress packages to latest versions in package.json resolutions * Update all @wordpress packages to the latest version * Update internal @wordpress/data peer dependency versions * Resolve most peer dependency issues * Use ComponentProps for some WP component type imports * Rework submenu popover to remove legacy offset props * Fix all Button variant type issues * Remove uneeded button wrapper component in info-tooltip * Fix type for close modal event in page pattern modal * Add ts expect error for ExternalLink required children prop * Add onChange type definition for CustomSelectControl for language-picker * Remove unused @types/wordpress__ packages * Remove uneeded entries in yarnrc.yml * Change another case of isPrimary to variant * Fix global styles package for new WordPress package versions (#78715) * @automattic/global-styles: Replace @wordpress/edit-site apis with new ones * Use fixed version of private-apis package to make __private symbol consistent * Use ExperimentalBlockEditorProvider to initialize Iframe * Fix unable to get fontFamilies * Fix styles * Fix style variation preview * Fix types * Replace mergeWith with deepmerge * Get rid of isEmpty and mapValues in global-stypes pkg * Add comments * Revert some changes * cleanEmptyObject: Fix type * transformStyles: Fix type * WP components: Fix types * Move EditorStyles into the children of the Iframe --------- Co-authored-by: arthur * Delete several @wordpress module declarations that duplicate bundled types * Remove uneeded HTMLElement override * Remove Global Styles wp components type declaration override * Remove manage purchases renew toggle wp components type override * Add back html element hotfix * Remove imports of deleted type patch files * Fix type errors related to re-declaring Button prop types * Fix type errors related to ExternalLink requiring children * Fix type errors related to Modal isOpen prop * Remove registerPlugin override * Remove target blank from ExternalLink, because it isn't used by the component internally * Fix several prop issues related to ExternalLink (remove target, include children) * Add missing @types/wordpress__block-library package * Fix type errors related to Modal open prop * Remove size prop in a couple cases because it doesn't do anything * Fix type errors related to importing component prop types * Fix useState types for date time picker example * yarn dedupe * Fix type issue with NavigatorButton wrapper class name * Remove another wp components type override file * Update onNavigatorPathChange argument which is sometimes undefined * Fix a type issue with global styles context * Fix eslint issues with hooks in modified files * Remove unused translate import * Fix type issue where reader button couldn't be disabled * Remove disabled from a Button instance which is a link * Fix state type related to FontSizePicker * Fix odd issue with query control types * Fix issue with SlotFill not being typed * Remove broken types from ToolbarGroup as it's just an example * Fix issue with arr.includes undefined * Fix issue with combobox onchange arg type * Remove disabled from another button link * Cast translateresult to string for input to label * Cast string to more specific type for log tab * Fix onChange type for another combobox * Add missing onhover prop to component * Fix issue with Token value types * Add missing labels to notification toggles * Remove useless wrapper component * Add types to callback args * Remove uneeded ts expect err and update component props for combobox control * fix color type definition for global styles * Remove uneeded types in callback * Remove useless component wrapper * Utilize useLocalizeUrl() where necessary * Fix some test snapshots * Fix composite checkout tests by introducing field reset * dedupe * Fix most of the remaining TS errors * Remove uneeded wrapper components * Add expect-error to incorrect .then error * Assembler: Fix the main layout is broken (#79275) * Comment out wrapperClassName which causes a type error * Change a few HStack props from alignItems to alignment * Assembler: Fix the styles of the navigator button (#79338) * Lock file update * Make Button variants more consistent with trunk * Use better approach for picking anchor button types --------- Co-authored-by: arthur Co-authored-by: Marin Atanasov --- .yarnrc.yml | 22 +- apps/blaze-dashboard/package.json | 2 +- .../src/attach-sidebar.tsx | 5 +- .../src/components/create-page/index.tsx | 11 +- .../src/components/nav-sidebar/index.tsx | 13 +- .../toggle-sidebar-button/index.tsx | 9 +- .../src/first-post-published-modal/index.tsx | 4 +- .../src/nux-modal/index.tsx | 1 - .../src/sharing-modal/index.tsx | 3 +- .../src/welcome-tour/tour-steps.tsx | 5 +- apps/editing-toolkit/package.json | 63 +- apps/happy-blocks/package.json | 14 +- apps/o2-blocks/package.json | 28 +- apps/odyssey-stats/package.json | 8 +- apps/wpcom-block-editor/package.json | 40 +- bin/update-package-resolutions.mjs | 50 + .../use-cookie-banner-content.tsx | 7 +- client/blocks/data-center-picker/index.tsx | 4 +- .../use-do-not-sell-content.tsx | 4 +- client/blocks/editor-checkout-modal/index.tsx | 1 - .../import-light/capture/capture-input.tsx | 4 +- .../blocks/import/capture/capture-input.tsx | 4 +- .../importer/components/done-button/index.tsx | 5 +- client/blocks/reader-export-button/index.tsx | 12 +- client/blocks/reader-import-button/index.tsx | 7 +- .../reader-unsubscribed-feed-item.tsx | 2 +- .../index.tsx | 9 +- .../jetpack/threat-description/index.tsx | 2 +- client/components/language-picker/modal.tsx | 4 +- .../educational-content-step.tsx | 21 +- .../step-components/upsell-step.tsx | 5 +- .../components/theme-type-badge/tooltip.tsx | 2 +- .../button-group.tsx | 4 +- .../wordpress-components-gallery/button.tsx | 30 +- .../wordpress-components-gallery/card.tsx | 4 +- .../clipboard-button.tsx | 3 +- .../color-palette.tsx | 2 +- .../date-time-picker.tsx | 2 +- .../dropdown-menu.tsx | 1 + .../font-size-picker.tsx | 2 +- .../form-file-upload.tsx | 3 +- .../form-token-field.tsx | 5 +- .../wordpress-components-gallery/guide.tsx | 2 +- .../query-controls.tsx | 8 +- .../slot-fill.tsx | 2 + .../wordpress-components-gallery/toolbar.tsx | 5 - .../dashboard-modal/index.tsx | 1 - .../form-content/email-notification.tsx | 5 + .../form-content/mobile-push-notification.tsx | 5 + .../form-content/sms-notification.tsx | 10 +- .../toggle-activate-monitoring/index.tsx | 8 +- .../searchable-dropdown/index.tsx | 10 +- .../sensei-step-container/index.tsx | 2 +- .../design-setup/unified-design-picker.tsx | 7 +- .../design-setup/upgrade-modal.tsx | 2 +- .../launchpad/task-helper.tsx | 1 + .../pattern-assembler/notices/notices.tsx | 14 +- .../pattern-large-preview.tsx | 10 +- .../pattern-assembler/screen-main.tsx | 6 +- .../steps-repository/store-address/index.tsx | 2 +- .../components/icons/search-icon.tsx | 5 +- .../email-me-new-comments-toggle.tsx | 10 +- .../email-me-new-posts-toggle.tsx | 10 +- .../notify-me-of-new-posts-toggle.tsx | 10 +- .../site-subscription-details.tsx | 3 +- .../site-subscriptions-list/site-row.tsx | 2 +- .../site-subscriptions-list.tsx | 2 +- .../sort-controls/sort-controls.tsx | 4 + .../account/toggle-sites-as-landing-page.tsx | 8 +- .../auto-renew-toggle/index.tsx | 30 +- .../payment-method-backup-toggle.tsx | 38 +- .../backup/backup-contents-page/index.tsx | 2 +- .../akismet-checkout-thank-you.tsx | 2 +- .../masterbar-styled/default-contact.tsx | 6 +- .../marketplace/use-thank-you-footer.tsx | 14 +- .../masterbar-styled/default-contact.tsx | 2 +- .../use-cached-domain-contact-details.ts | 1 + .../assign-to-all-payment-methods.tsx | 30 +- .../payment-methods/credit-card/store.ts | 6 + .../payment-methods/credit-card/types.ts | 3 +- .../payment-methods/netbanking.tsx | 6 + .../composite-checkout/test/credit-card.tsx | 12 + .../composite-checkout/test/netbanking.tsx | 12 + client/my-sites/checkout/modal/index.tsx | 1 - .../deployment-status-explanation.tsx | 4 +- .../deployment-card/empty-deployments.tsx | 2 +- .../github/github-connect-card/index.tsx | 2 +- .../marketing/do-it-for-me/difm-landing.tsx | 4 +- .../submission-success/signup-success.tsx | 9 +- client/my-sites/pages/virtual-page/index.tsx | 2 +- .../jetpack-plans/plans-filter-bar/index.tsx | 1 + .../components/campaign-item/index.tsx | 8 +- .../components/post-item/index.tsx | 4 +- client/my-sites/promote-post-i2/main.tsx | 2 +- .../components/campaign-item/index.tsx | 10 +- .../components/post-item/index.tsx | 2 +- .../components/site-logs-tab-panel/index.tsx | 6 +- .../components/site-logs-toolbar/index.tsx | 2 +- .../FeaturedImageEmailSetting.tsx | 10 +- .../SubscribeModalSetting.tsx | 10 +- .../reading-newsletter-settings/index.tsx | 2 +- .../site-settings/settings-reading/main.tsx | 2 +- .../stats-purchase-personal.tsx | 5 +- client/package.json | 34 +- client/reader/list-manage/index.jsx | 2 +- .../recommended-sites/recommended-site.tsx | 2 +- client/reader/tags/alphabetic-tags.tsx | 2 +- .../steps/design-picker/let-us-choose.tsx | 2 +- .../signup/steps/difm-site-picker/index.tsx | 2 +- .../step-store-address/index.tsx | 4 +- .../components/sites-ellipsis-menu.tsx | 4 +- .../components/sites-sorting-dropdown.tsx | 4 + .../__snapshots__/sites-grid-item.tsx.snap | 6 +- client/wp-components-types.d.ts | 35 - package.json | 197 +- packages/block-renderer/package.json | 8 +- .../components/block-renderer-container.tsx | 2 +- .../components/block-renderer-provider.tsx | 8 +- packages/block-renderer/src/global.d.ts | 2 - packages/calypso-babel-config/package.json | 2 +- packages/calypso-build/package.json | 4 +- packages/calypso-e2e/package.json | 2 +- packages/components/package.json | 10 +- .../responsive-toolbar-group/swipe-group.tsx | 3 +- .../components/src/submenu-popover/index.tsx | 19 +- packages/composite-checkout/package.json | 4 +- packages/data-stores/package.json | 10 +- packages/design-carousel/package.json | 2 +- packages/design-carousel/src/index.tsx | 2 +- packages/design-picker/package.json | 8 +- .../featured-picks-buttons/index.tsx | 2 +- .../design-picker/src/components/index.tsx | 4 +- .../src/patch-component-types.d.ts | 5 - packages/design-preview/package.json | 10 +- .../design-preview/src/components/index.tsx | 4 +- .../design-preview/src/components/sidebar.tsx | 2 +- packages/domain-picker/package.json | 12 +- .../suggestion-item.tsx | 2 +- .../domain-picker/src/components/index.tsx | 4 +- .../src/components/info-tooltip/index.tsx | 6 +- .../eslint-plugin-package-json/package.json | 2 +- packages/global-styles/package.json | 17 +- .../color-palette-variations/index.tsx | 10 +- .../color-palette-variations/preview.tsx | 28 +- .../font-pairing-variations/index.tsx | 14 +- .../font-pairing-variations/preview.tsx | 26 +- .../global-styles-provider/index.tsx | 40 +- .../index.tsx | 9 +- .../global-styles-variations/index.tsx | 12 +- .../global-styles-variations/preview.tsx | 31 +- packages/global-styles/src/global.d.ts | 27 +- .../src/gutenberg-bridge/index.tsx | 60 + .../use-get-global-styles-base-config.ts | 2 +- .../use-sync-global-styles-user-config.ts | 9 +- packages/global-styles/src/index.tsx | 5 +- packages/help-center/package.json | 12 +- .../components/help-center-contact-form.tsx | 15 +- .../components/help-center-more-resources.tsx | 6 +- .../src/components/help-center-notice.tsx | 2 + packages/i18n-calypso/package.json | 2 +- packages/i18n-utils/package.json | 4 +- packages/language-picker/package.json | 10 +- .../language-picker/src/language-picker.tsx | 8 +- packages/launchpad/package.json | 2 +- packages/mini-cart/package.json | 4 +- packages/onboarding/package.json | 10 +- .../onboarding/src/action-buttons/index.tsx | 25 +- .../src/navigator/navigator-buttons/index.tsx | 3 +- .../navigator/navigator-item-group/index.tsx | 6 +- .../navigator/navigator-item-group/style.scss | 10 +- .../navigator/navigator-listener/index.tsx | 3 +- .../navigator-screens/navigator-screens.tsx | 2 +- .../onboarding/src/wp-components-types.d.ts | 29 - packages/page-pattern-modal/package.json | 14 +- .../src/components/page-pattern-modal.tsx | 11 +- .../src/patch-component-types.d.ts | 5 - packages/plans-grid/package.json | 12 +- .../src/plans-feature-list/index.tsx | 4 +- .../plans-grid/src/plans-table/plan-item.tsx | 13 +- packages/plans-grid/src/types-patch.ts | 7 - packages/search/package.json | 14 +- packages/search/src/types.d.ts | 6 - packages/site-picker/package.json | 8 +- packages/sites/package.json | 2 +- packages/social-previews/package.json | 7 +- packages/state-utils/package.json | 4 +- packages/subscriber/package.json | 18 +- .../src/components/add-form/index.tsx | 39 +- packages/tour-kit/package.json | 18 +- .../wpcom-tour-kit-step-card-navigation.tsx | 8 +- ...om-tour-kit-step-card-overlay-controls.tsx | 4 +- .../components/wpcom-tour-kit-step-card.tsx | 2 +- packages/viewport-react/package.json | 2 +- packages/whats-new/package.json | 12 +- packages/whats-new/src/components/guide.tsx | 4 +- packages/whats-new/src/whats-new-page.tsx | 8 +- packages/whats-new/types.d.ts | 26 +- packages/wpcom-checkout/package.json | 8 +- packages/wpcom-template-parts/package.json | 4 +- yarn.lock | 3262 ++++++++++------- 200 files changed, 2962 insertions(+), 2269 deletions(-) create mode 100644 bin/update-package-resolutions.mjs delete mode 100644 client/wp-components-types.d.ts delete mode 100644 packages/design-picker/src/patch-component-types.d.ts create mode 100644 packages/global-styles/src/gutenberg-bridge/index.tsx delete mode 100644 packages/onboarding/src/wp-components-types.d.ts delete mode 100644 packages/page-pattern-modal/src/patch-component-types.d.ts delete mode 100644 packages/plans-grid/src/types-patch.ts diff --git a/.yarnrc.yml b/.yarnrc.yml index 27d0c79980634..e0d1f195be0f0 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -43,7 +43,7 @@ logFilters: - level: discard pattern: "calypso@workspace:client provides +(react|react-dom) (*) with version 18.2.0, which doesn't satisfy what reakit and some of its descendants request" -# TODO: Remove this once the react-easy-crop transitive dependency can be removed. (Likely after updating @wordpress/block-editor to a newer version.) +# TODO: Remove this once the react-autosize-textarea transitive dependency has been fixed/updated to a version with React 18 support. - level: discard pattern: "calypso@workspace:client provides +(react|react-dom) (*) with version 18.2.0, which doesn't satisfy what @automattic/block-renderer and some of its descendants request" @@ -62,21 +62,27 @@ packageExtensions: "@signal-noise/stylelint-scales@2.0.3": peerDependencies: postcss: "*" - "@types/wordpress__components@23.0.1": + "@wordpress/commands@0.6.2": peerDependencies: - react: "*" - "@types/wordpress__plugins@3.0.0": + react-dom: "*" + "@wordpress/core-commands@0.4.2": peerDependencies: - react: "*" - "@wordpress/data-controls@2.23.0": + react-dom: "*" + "@wordpress/data-controls@3.4.0": peerDependencies: react: "*" - "@wordpress/notices@3.23.0": + "@wordpress/notices@4.3.0": peerDependencies: react: "*" - "@wordpress/stylelint-config@21.6.0": + "@wordpress/plugins@6.3.0": + peerDependencies: + react-dom: "*" + "@wordpress/stylelint-config@21.19.0": peerDependencies: postcss: "*" + "deepsignal@1.3.3": + peerDependencies: + react: "*" fake-indexeddb@3.1.7: peerDependencies: core-js-bundle: "*" diff --git a/apps/blaze-dashboard/package.json b/apps/blaze-dashboard/package.json index 8572d689a51f5..6f7ba6b082133 100644 --- a/apps/blaze-dashboard/package.json +++ b/apps/blaze-dashboard/package.json @@ -53,7 +53,7 @@ "@automattic/webpack-extensive-lodash-replacement-plugin": "workspace:^", "@automattic/webpack-inline-constant-exports-plugin": "workspace:^", "@automattic/wp-babel-makepot": "workspace:^", - "@wordpress/dependency-extraction-webpack-plugin": "^4.5.0", + "@wordpress/dependency-extraction-webpack-plugin": "^4.19.0", "autoprefixer": "^10.2.5", "gettext-parser": "^6.0.0", "html-webpack-plugin": "^5.0.0-beta.4", diff --git a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/attach-sidebar.tsx b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/attach-sidebar.tsx index 4a752e19bcccb..418f3674c763b 100644 --- a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/attach-sidebar.tsx +++ b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/attach-sidebar.tsx @@ -2,7 +2,7 @@ import { START_WRITING_FLOW, DESIGN_FIRST_FLOW } from '@automattic/onboarding'; import { useDispatch, useSelect } from '@wordpress/data'; import { __experimentalMainDashboardButton as MainDashboardButton } from '@wordpress/edit-post'; import { useEffect, createPortal, useState } from '@wordpress/element'; -import { registerPlugin as originalRegisterPlugin, PluginSettings } from '@wordpress/plugins'; +import { registerPlugin } from '@wordpress/plugins'; import useSiteIntent from '../../dotcom-fse/lib/site-intent/use-site-intent'; import WpcomBlockEditorNavSidebar from './components/nav-sidebar'; import ToggleSidebarButton from './components/toggle-sidebar-button'; @@ -11,9 +11,6 @@ type CoreEditPostPlaceholder = { isFeatureActive: ( ...args: unknown[] ) => boolean; }; -const registerPlugin = ( name: string, settings: Omit< PluginSettings, 'icon' > ) => - originalRegisterPlugin( name, settings as PluginSettings ); - if ( typeof MainDashboardButton !== 'undefined' ) { registerPlugin( 'a8c-full-site-editing-nav-sidebar', { render: function NavSidebar() { diff --git a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/create-page/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/create-page/index.tsx index 19e16d1526082..4b2eaf15c3cf1 100644 --- a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/create-page/index.tsx +++ b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/create-page/index.tsx @@ -1,5 +1,5 @@ import { recordTracksEvent } from '@automattic/calypso-analytics'; -import { Button as OriginalButton } from '@wordpress/components'; +import { Button } from '@wordpress/components'; import { applyFilters } from '@wordpress/hooks'; import { __ } from '@wordpress/i18n'; import { plus } from '@wordpress/icons'; @@ -8,13 +8,6 @@ import { get } from 'lodash'; import './style.scss'; -const Button = ( { - children, - ...rest -}: OriginalButton.Props & { icon?: unknown; iconSize?: number } ) => ( - { children } -); - interface Props { postType: { slug: string }; } @@ -47,7 +40,7 @@ export default function CreatePage( { postType }: Props ) { target={ applyFilters( 'a8c.WpcomBlockEditorNavSidebar.linkTarget', undefined ) as string | undefined } - isPrimary + variant="primary" className="wpcom-block-editor-nav-sidebar-create-page" href={ url } icon={ plus } diff --git a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/nav-sidebar/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/nav-sidebar/index.tsx index c914b08904137..5e2dee7a9dde4 100644 --- a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/nav-sidebar/index.tsx +++ b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/nav-sidebar/index.tsx @@ -35,17 +35,8 @@ type CorePlaceholder = { }; const Button = forwardRef( - ( - { - children, - ...rest - }: OriginalButton.Props & { icon?: unknown; iconSize?: number; showTooltip?: boolean }, - ref - ) => ( - void ) } - { ...rest } - > + ( { children, ...rest }: React.ComponentProps< typeof OriginalButton >, ref ) => ( + { children } ) diff --git a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/toggle-sidebar-button/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/toggle-sidebar-button/index.tsx index 1572a1e44567e..7847cf72f7c2e 100644 --- a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/toggle-sidebar-button/index.tsx +++ b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/toggle-sidebar-button/index.tsx @@ -1,5 +1,5 @@ import { recordTracksEvent } from '@automattic/calypso-analytics'; -import { Button as OriginalButton } from '@wordpress/components'; +import { Button } from '@wordpress/components'; import { useDispatch, useSelect } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; import classnames from 'classnames'; @@ -7,13 +7,6 @@ import { store } from '../../store'; import SiteIcon from '../site-icon'; import './style.scss'; -const Button = ( { - children, - ...rest -}: OriginalButton.Props & { icon?: unknown; iconSize?: number; showTooltip?: boolean } ) => ( - { children } -); - export default function ToggleSidebarButton() { const { toggleSidebar } = useDispatch( store ); const isSidebarOpen = useSelect( ( select ) => select( store ).isSidebarOpened(), [] ); diff --git a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/first-post-published-modal/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/first-post-published-modal/index.tsx index 1aa3a57d7d74f..c2ab12abfd23b 100644 --- a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/first-post-published-modal/index.tsx +++ b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/first-post-published-modal/index.tsx @@ -90,11 +90,11 @@ const FirstPostPublishedModal: React.FC = () => { imageSrc={ postPublishedImage } actionButtons={ <> - { launchpadScreenOption === 'full' && siteIntentOption === 'write' && ( - ) } diff --git a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/nux-modal/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/nux-modal/index.tsx index 1099fe7d6ddca..aeb1ccf384123 100644 --- a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/nux-modal/index.tsx +++ b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/nux-modal/index.tsx @@ -42,7 +42,6 @@ const NuxModal: React.FC< Props > = ( { return ( diff --git a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/sharing-modal/index.tsx b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/sharing-modal/index.tsx index 4c3e7dacefa2d..c0608e9d7466f 100644 --- a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/sharing-modal/index.tsx +++ b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/sharing-modal/index.tsx @@ -178,7 +178,6 @@ const SharingModal: React.FC = () => { return ( @@ -195,9 +194,9 @@ const SharingModal: React.FC = () => { { a: ( ), } diff --git a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/welcome-tour/tour-steps.tsx b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/welcome-tour/tour-steps.tsx index 752c452dc1a3c..2ef221677ca0a 100644 --- a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/welcome-tour/tour-steps.tsx +++ b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/welcome-tour/tour-steps.tsx @@ -99,6 +99,7 @@ function getTourSteps( ), } @@ -322,7 +323,6 @@ function getTourSteps( 'https://wordpress.com/support/video-tutorials-add-payments-features-to-your-site-with-our-guides/#how-to-use-the-payments-block-video', localeSlug ) } - target="_blank" rel="noopener noreferrer" > { __( 'Learn more', 'full-site-editing' ) } @@ -359,6 +359,7 @@ function getTourSteps( 'https://wordpress.com/support/full-site-editing/', localeSlug ) } + children={ null } /> ), } @@ -396,6 +397,7 @@ function getTourSteps( 'https://wordpress.com/support/settings/privacy-settings/#launch-your-site', localeSlug ) } + children={ null } /> ), link_to_editor_docs: ( @@ -404,6 +406,7 @@ function getTourSteps( 'https://wordpress.com/support/wordpress-editor/', localeSlug ) } + children={ null } /> ), } diff --git a/apps/editing-toolkit/package.json b/apps/editing-toolkit/package.json index c538502f42528..04e77702a5b68 100644 --- a/apps/editing-toolkit/package.json +++ b/apps/editing-toolkit/package.json @@ -68,37 +68,37 @@ "@popperjs/core": "^2.10.2", "@sentry/browser": "^7.54.0", "@tanstack/react-query": "^4.29.1", - "@wordpress/a11y": "^3.23.0", - "@wordpress/api-fetch": "^6.20.0", - "@wordpress/base-styles": "^4.14.0", - "@wordpress/block-editor": "^11.0.0", - "@wordpress/blocks": "^12.0.0", - "@wordpress/components": "^23.0.0", - "@wordpress/compose": "^6.0.0", - "@wordpress/data": "^8.0.0", - "@wordpress/data-controls": "^2.23.0", - "@wordpress/date": "^4.23.0", - "@wordpress/dependency-extraction-webpack-plugin": "^4.6.0", - "@wordpress/dom-ready": "^3.23.0", - "@wordpress/edit-post": "^7.0.0", - "@wordpress/element": "^5.0.0", + "@wordpress/a11y": "^3.36.0", + "@wordpress/api-fetch": "^6.33.0", + "@wordpress/base-styles": "^4.27.0", + "@wordpress/block-editor": "^12.3.0", + "@wordpress/blocks": "^12.12.0", + "@wordpress/components": "^25.1.0", + "@wordpress/compose": "^6.12.0", + "@wordpress/data": "^9.5.0", + "@wordpress/data-controls": "^3.4.0", + "@wordpress/date": "^4.36.0", + "@wordpress/dependency-extraction-webpack-plugin": "^4.19.0", + "@wordpress/dom-ready": "^3.36.0", + "@wordpress/edit-post": "^7.12.0", + "@wordpress/element": "^5.13.0", "@wordpress/env": "^8.3.0", - "@wordpress/escape-html": "^2.23.0", - "@wordpress/hooks": "^3.23.0", - "@wordpress/html-entities": "^3.23.0", - "@wordpress/i18n": "^4.23.0", - "@wordpress/icons": "^9.14.0", - "@wordpress/interface": "^5.0.0", - "@wordpress/is-shallow-equal": "^4.23.0", - "@wordpress/keycodes": "^3.23.0", - "@wordpress/notices": "^3.23.0", + "@wordpress/escape-html": "^2.36.0", + "@wordpress/hooks": "^3.36.0", + "@wordpress/html-entities": "^3.36.0", + "@wordpress/i18n": "^4.36.0", + "@wordpress/icons": "^9.26.0", + "@wordpress/interface": "^5.12.0", + "@wordpress/is-shallow-equal": "^4.36.0", + "@wordpress/keycodes": "^3.36.0", + "@wordpress/notices": "^4.3.0", "@wordpress/nux": "^6.0.0", - "@wordpress/plugins": "^5.0.0", - "@wordpress/primitives": "^3.21.0", - "@wordpress/private-apis": "^0.9.0", - "@wordpress/rich-text": "^6.0.0", - "@wordpress/server-side-render": "^4.0.0", - "@wordpress/url": "^3.24.0", + "@wordpress/plugins": "^6.3.0", + "@wordpress/primitives": "^3.34.0", + "@wordpress/private-apis": "^0.18.0", + "@wordpress/rich-text": "^6.12.0", + "@wordpress/server-side-render": "^4.12.0", + "@wordpress/url": "^3.37.0", "calypso": "workspace:^", "classnames": "^2.3.1", "eslint": "^8.34.0", @@ -124,9 +124,8 @@ "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^14.0.0", "@types/node": "^18.11.18", - "@types/wordpress__plugins": "^3.0.0", - "@wordpress/eslint-plugin": "^13.7.0", - "@wordpress/readable-js-assets-webpack-plugin": "^2.6.0", + "@wordpress/eslint-plugin": "^14.8.0", + "@wordpress/readable-js-assets-webpack-plugin": "^2.19.0", "babel-jest": "^29.6.1", "eslint-filtered-fix": "^0.3.0", "eslint-nibble": "^8.1.0", diff --git a/apps/happy-blocks/package.json b/apps/happy-blocks/package.json index 0c8f8cc4c27fa..4f6ecf96ae12f 100644 --- a/apps/happy-blocks/package.json +++ b/apps/happy-blocks/package.json @@ -33,12 +33,12 @@ "@automattic/wp-babel-makepot": "workspace:^", "@automattic/wpcom-template-parts": "workspace:^", "@emotion/styled": "^11.3.0", - "@wordpress/base-styles": "^4.14.0", - "@wordpress/block-editor": "^11.0.0", - "@wordpress/blocks": "^12.0.0", - "@wordpress/components": "^23.0.0", - "@wordpress/element": "^5.0.0", - "@wordpress/i18n": "^4.23.0", + "@wordpress/base-styles": "^4.27.0", + "@wordpress/block-editor": "^12.3.0", + "@wordpress/blocks": "^12.12.0", + "@wordpress/components": "^25.1.0", + "@wordpress/element": "^5.13.0", + "@wordpress/i18n": "^4.36.0", "classnames": "^2.3.2", "glob": "^7.1.6", "i18n-calypso": "workspace:^", @@ -49,7 +49,7 @@ "@automattic/calypso-apps-builder": "workspace:^", "@emotion/react": "^11.4.1", "@testing-library/react": "^14.0.0", - "@wordpress/readable-js-assets-webpack-plugin": "^2.6.0", + "@wordpress/readable-js-assets-webpack-plugin": "^2.19.0", "copy-webpack-plugin": "^10.1.0", "glob": "^7.1.6", "postcss": "^8.4.5", diff --git a/apps/o2-blocks/package.json b/apps/o2-blocks/package.json index a7fdeb0427dab..ad754b6b2c799 100644 --- a/apps/o2-blocks/package.json +++ b/apps/o2-blocks/package.json @@ -22,19 +22,19 @@ }, "dependencies": { "@automattic/calypso-build": "workspace:^", - "@wordpress/api-fetch": "^6.20.0", - "@wordpress/base-styles": "^4.14.0", - "@wordpress/block-editor": "^11.0.0", - "@wordpress/blocks": "^12.0.0", - "@wordpress/components": "^23.0.0", - "@wordpress/data": "^8.0.0", - "@wordpress/editor": "^13.0.0", - "@wordpress/element": "^5.0.0", - "@wordpress/hooks": "^3.23.0", - "@wordpress/i18n": "^4.23.0", - "@wordpress/icons": "^9.14.0", - "@wordpress/is-shallow-equal": "^4.23.0", - "@wordpress/primitives": "^3.21.0", + "@wordpress/api-fetch": "^6.33.0", + "@wordpress/base-styles": "^4.27.0", + "@wordpress/block-editor": "^12.3.0", + "@wordpress/blocks": "^12.12.0", + "@wordpress/components": "^25.1.0", + "@wordpress/data": "^9.5.0", + "@wordpress/editor": "^13.12.0", + "@wordpress/element": "^5.13.0", + "@wordpress/hooks": "^3.36.0", + "@wordpress/i18n": "^4.36.0", + "@wordpress/icons": "^9.26.0", + "@wordpress/is-shallow-equal": "^4.36.0", + "@wordpress/primitives": "^3.34.0", "classnames": "^2.3.1", "lodash": "^4.17.21", "moment": "^2.26.0", @@ -46,7 +46,7 @@ "devDependencies": { "@automattic/calypso-apps-builder": "workspace:^", "@automattic/calypso-eslint-overrides": "workspace:^", - "@wordpress/readable-js-assets-webpack-plugin": "^2.6.0", + "@wordpress/readable-js-assets-webpack-plugin": "^2.19.0", "postcss": "^8.4.5", "webpack": "^5.68.0" } diff --git a/apps/odyssey-stats/package.json b/apps/odyssey-stats/package.json index faea2036479ab..cbd30bad42404 100644 --- a/apps/odyssey-stats/package.json +++ b/apps/odyssey-stats/package.json @@ -33,9 +33,9 @@ "@automattic/calypso-url": "workspace:^", "@automattic/components": "workspace:^", "@tanstack/react-query": "4.29.1", - "@wordpress/base-styles": "^4.14.0", - "@wordpress/data": "^8.0.0", - "@wordpress/icons": "^9.14.0", + "@wordpress/base-styles": "^4.27.0", + "@wordpress/data": "^9.5.0", + "@wordpress/icons": "^9.26.0", "calypso": "workspace:^", "classnames": "^2.3.1", "debug": "^4.3.4", @@ -61,7 +61,7 @@ "@automattic/wp-babel-makepot": "workspace:^", "@babel/core": "^7.17.5", "@size-limit/file": "^8.2.4", - "@wordpress/dependency-extraction-webpack-plugin": "^4.6.0", + "@wordpress/dependency-extraction-webpack-plugin": "^4.19.0", "autoprefixer": "^10.2.5", "babel-jest": "^29.6.1", "gettext-parser": "^6.0.0", diff --git a/apps/wpcom-block-editor/package.json b/apps/wpcom-block-editor/package.json index ce4133ce97287..de719a356f194 100644 --- a/apps/wpcom-block-editor/package.json +++ b/apps/wpcom-block-editor/package.json @@ -24,25 +24,25 @@ "@automattic/calypso-url": "workspace:^", "@automattic/typography": "workspace:^", "@babel/runtime": "^7.17.2", - "@wordpress/api-fetch": "^6.20.0", - "@wordpress/base-styles": "^4.14.0", - "@wordpress/block-editor": "^11.0.0", - "@wordpress/blocks": "^12.0.0", - "@wordpress/components": "^23.0.0", - "@wordpress/compose": "^6.0.0", - "@wordpress/data": "^8.0.0", - "@wordpress/dom-ready": "^3.23.0", - "@wordpress/edit-post": "^7.0.0", - "@wordpress/edit-site": "^5.0.0", - "@wordpress/editor": "^13.0.0", - "@wordpress/element": "^5.0.0", - "@wordpress/hooks": "^3.23.0", - "@wordpress/i18n": "^4.23.0", - "@wordpress/icons": "^9.14.0", - "@wordpress/is-shallow-equal": "^4.23.0", - "@wordpress/plugins": "^5.0.0", - "@wordpress/rich-text": "^6.0.0", - "@wordpress/url": "^3.24.0", + "@wordpress/api-fetch": "^6.33.0", + "@wordpress/base-styles": "^4.27.0", + "@wordpress/block-editor": "^12.3.0", + "@wordpress/blocks": "^12.12.0", + "@wordpress/components": "^25.1.0", + "@wordpress/compose": "^6.12.0", + "@wordpress/data": "^9.5.0", + "@wordpress/dom-ready": "^3.36.0", + "@wordpress/edit-post": "^7.12.0", + "@wordpress/edit-site": "^5.12.0", + "@wordpress/editor": "^13.12.0", + "@wordpress/element": "^5.13.0", + "@wordpress/hooks": "^3.36.0", + "@wordpress/i18n": "^4.36.0", + "@wordpress/icons": "^9.26.0", + "@wordpress/is-shallow-equal": "^4.36.0", + "@wordpress/plugins": "^6.3.0", + "@wordpress/rich-text": "^6.12.0", + "@wordpress/url": "^3.37.0", "debug": "^4.3.3", "lodash": "^4.17.21", "react": "^18.2.0", @@ -54,7 +54,7 @@ "@automattic/calypso-apps-builder": "workspace:^", "@automattic/calypso-build": "workspace:^", "@automattic/calypso-eslint-overrides": "workspace:^", - "@wordpress/dependency-extraction-webpack-plugin": "^4.6.0", + "@wordpress/dependency-extraction-webpack-plugin": "^4.19.0", "npm-run-all": "^4.1.5", "postcss": "^8.4.5", "webpack": "^5.68.0" diff --git a/bin/update-package-resolutions.mjs b/bin/update-package-resolutions.mjs new file mode 100644 index 0000000000000..a49a122a2afe3 --- /dev/null +++ b/bin/update-package-resolutions.mjs @@ -0,0 +1,50 @@ +import fs from 'node:fs'; +import path from 'node:path'; + +const packageJSONPath = path.resolve( process.cwd(), 'package.json' ); +const packageFile = fs.readFileSync( packageJSONPath, 'utf-8' ); +const packageJSON = JSON.parse( packageFile ); + +if ( ! packageJSON.resolutions ) { + console.error( 'No resolutions found in package.json -- try running from the root directory.' ); + process.exit( 1 ); +} + +const toUpdate = process.argv[ 2 ] ?? '@wordpress'; +let didUpdate = false; + +await Promise.all( + Object.entries( packageJSON.resolutions ).map( async ( [ pkg, version ] ) => { + if ( ! pkg.startsWith( toUpdate ) ) { + return; + } + const latestVersion = await getLatestVersion( pkg ); + + // Handle ^ and ~ prefixes for very basic semver support. + let currentVersion = version; + const startingChar = version.startsWith( '^' ) || version.startsWith( '~' ) ? version[ 0 ] : ''; + if ( startingChar ) { + currentVersion = currentVersion.slice( 1 ); + } + + if ( latestVersion && latestVersion !== currentVersion ) { + console.log( `Updating ${ pkg } from ${ version } to ${ startingChar }${ latestVersion }` ); + packageJSON.resolutions[ pkg ] = startingChar + latestVersion; + didUpdate = true; + } + } ) +); + +if ( didUpdate ) { + // Use tab for spacing and append a new line after the JSON content to match our prettier format. + fs.writeFileSync( packageJSONPath, JSON.stringify( packageJSON, null, '\t' ) + '\n' ); + console.log( 'Updated package.json resolutions.' ); +} else { + console.log( 'No updates were found.' ); +} + +async function getLatestVersion( pkg ) { + const res = await fetch( `https://registry.npmjs.org/${ pkg }` ); + const pkgInfo = await res.json(); + return pkgInfo[ 'dist-tags' ].latest; +} diff --git a/client/blocks/cookie-banner/use-cookie-banner-content.tsx b/client/blocks/cookie-banner/use-cookie-banner-content.tsx index 3b5d60ddbe33c..7a8ce0f7d5796 100644 --- a/client/blocks/cookie-banner/use-cookie-banner-content.tsx +++ b/client/blocks/cookie-banner/use-cookie-banner-content.tsx @@ -15,12 +15,13 @@ const LocalizedLink = ( { href, children }: LinkProps ) => { const Link = ( props: LinkProps ) => { // useLocalizeUrl() does not support SSR yet, so we cannot use it on the server. if ( isServer ) { - return ; + return ; } return ; }; export const useCookieBannerContent = (): CookieBannerProps[ 'content' ] => { + const localizeUrl = useLocalizeUrl(); const translate = useTranslate(); return { @@ -37,8 +38,8 @@ export const useCookieBannerContent = (): CookieBannerProps[ 'content' ] => { { components: { strong: , - privacyPolicyLink: , - cookiePolicyLink: , + privacyPolicyLink: , + cookiePolicyLink: , }, } ), diff --git a/client/blocks/data-center-picker/index.tsx b/client/blocks/data-center-picker/index.tsx index f3218bcfbe284..70a6b61b74d0e 100644 --- a/client/blocks/data-center-picker/index.tsx +++ b/client/blocks/data-center-picker/index.tsx @@ -241,7 +241,7 @@ const DataCenterPicker = ( {   diff --git a/client/blocks/do-not-sell-dialog/use-do-not-sell-content.tsx b/client/blocks/do-not-sell-dialog/use-do-not-sell-content.tsx index ddff1c4cdf001..a86b57b4dbcb1 100644 --- a/client/blocks/do-not-sell-dialog/use-do-not-sell-content.tsx +++ b/client/blocks/do-not-sell-dialog/use-do-not-sell-content.tsx @@ -7,10 +7,10 @@ export const useDoNotSellContent = () => { const localizeUrl = useLocalizeUrl(); const cookiePolicyLink = ( - + ); const privacyPolicyLink = ( - + ); const contactLink = ( contact@automattic.com diff --git a/client/blocks/editor-checkout-modal/index.tsx b/client/blocks/editor-checkout-modal/index.tsx index 131c2fedc33af..2aca4b98e3bab 100644 --- a/client/blocks/editor-checkout-modal/index.tsx +++ b/client/blocks/editor-checkout-modal/index.tsx @@ -59,7 +59,6 @@ const EditorCheckoutModal: React.FunctionComponent< Props > = ( props ) => { return isOpen ? ( = ( props ) => { - - { translate( 'Continue' ) } - + { translate( 'Continue' ) } ); }; diff --git a/client/blocks/import/capture/capture-input.tsx b/client/blocks/import/capture/capture-input.tsx index 236c29557310f..7f6c7143024ce 100644 --- a/client/blocks/import/capture/capture-input.tsx +++ b/client/blocks/import/capture/capture-input.tsx @@ -119,9 +119,7 @@ const CaptureInput: FunctionComponent< Props > = ( props ) => { - - { translate( 'Continue' ) } - + { translate( 'Continue' ) } ); }; diff --git a/client/blocks/importer/components/done-button/index.tsx b/client/blocks/importer/components/done-button/index.tsx index bd7ba785f922c..2c821b79e41a2 100644 --- a/client/blocks/importer/components/done-button/index.tsx +++ b/client/blocks/importer/components/done-button/index.tsx @@ -27,8 +27,6 @@ const DoneButton: React.FunctionComponent< Props > = ( props ) => { isPrimary = true, } = props; - const isSecondary = isPrimary ? false : true; - function onButtonClick() { onSiteViewClick?.(); job && siteId && resetImport && resetImport( siteId, job?.importerId ); @@ -36,8 +34,7 @@ const DoneButton: React.FunctionComponent< Props > = ( props ) => { return ( diff --git a/client/blocks/reader-export-button/index.tsx b/client/blocks/reader-export-button/index.tsx index f4f3fb8b2f489..09cb19ed77b50 100644 --- a/client/blocks/reader-export-button/index.tsx +++ b/client/blocks/reader-export-button/index.tsx @@ -3,7 +3,7 @@ import { Button } from '@wordpress/components'; import { useI18n } from '@wordpress/react-i18n'; import { saveAs } from 'browser-filesaver'; import { useTranslate } from 'i18n-calypso'; -import { useState, useEffect, useRef, useCallback } from 'react'; +import { useState, useEffect, useRef, useCallback, ComponentPropsWithoutRef } from 'react'; import { READER_EXPORT_TYPE_SUBSCRIPTIONS, READER_EXPORT_TYPE_LIST, @@ -21,24 +21,28 @@ type ExportResponse = { opml: string; }; -type ReaderExportButtonProps = Button.ButtonProps & { +type ReaderExportButtonProps = { exportType?: ExportType; filename?: string; listId?: number; }; +// Note: since the Button must be disableable, it must not be a link. So we need to remove the link type variant from the accepted props. +type RemoveAnchorButtonProps< T > = T extends { href: string } ? never : T; +type AcceptedButtonProps = RemoveAnchorButtonProps< ComponentPropsWithoutRef< typeof Button > >; + const ReaderExportButton = ( { filename = 'reader-export.opml', exportType = READER_EXPORT_TYPE_SUBSCRIPTIONS, disabled, listId, ...props -}: ReaderExportButtonProps ) => { +}: ReaderExportButtonProps & AcceptedButtonProps ) => { const dispatch = useDispatch(); const translate = useTranslate(); const { hasTranslation } = useI18n(); const isMounted = useRef( false ); - const [ isExportInProgress, setExportInProgress ] = useState( false ); + const [ isExportInProgress, setExportInProgress ] = useState< boolean >( false ); useEffect( () => { isMounted.current = true; diff --git a/client/blocks/reader-import-button/index.tsx b/client/blocks/reader-import-button/index.tsx index be858af8acbbb..059f67199365e 100644 --- a/client/blocks/reader-import-button/index.tsx +++ b/client/blocks/reader-import-button/index.tsx @@ -2,7 +2,7 @@ import { Gridicon } from '@automattic/components'; import { Button } from '@wordpress/components'; import { useI18n } from '@wordpress/react-i18n'; import { useTranslate } from 'i18n-calypso'; -import { useState } from 'react'; +import { ComponentProps, useState } from 'react'; import FilePicker from 'calypso/components/file-picker'; import wpcom from 'calypso/lib/wp'; import { useDispatch } from 'calypso/state'; @@ -12,10 +12,11 @@ import './style.scss'; const noop = () => undefined; +type ButtonProps = ComponentProps< typeof Button >; type ReaderImportButtonProps = { onProgress?: () => void; - icon?: Button.ButtonProps[ 'icon' ]; - iconSize?: Button.ButtonProps[ 'iconSize' ]; + icon?: ButtonProps[ 'icon' ]; + iconSize?: ButtonProps[ 'iconSize' ]; }; const ReaderImportButton: React.FC< ReaderImportButtonProps > = ( { diff --git a/client/blocks/reader-unsubscribed-feeds-search-list/reader-unsubscribed-feed-item.tsx b/client/blocks/reader-unsubscribed-feeds-search-list/reader-unsubscribed-feed-item.tsx index d9c35537525a1..17c7fd39ef208 100644 --- a/client/blocks/reader-unsubscribed-feeds-search-list/reader-unsubscribed-feed-item.tsx +++ b/client/blocks/reader-unsubscribed-feeds-search-list/reader-unsubscribed-feed-item.tsx @@ -44,7 +44,7 @@ const ReaderUnsubscribedFeedItem = ( { const translate = useTranslate(); const filteredDisplayUrl = filterURLForDisplay( displayUrl ); return ( - + { isExternalLink ? ( { ); - const StagingToggleControl = ToggleControl as React.ComponentType< - ToggleControl.Props & { - disabled?: boolean; - } - >; - return ( <> @@ -85,7 +79,8 @@ const JetpackStagingSitesManagement: FunctionComponent = () => {
- { { source && this.renderTextOrNode(

- + { translate( 'Learn more about this vulnerability' ) }

diff --git a/client/components/language-picker/modal.tsx b/client/components/language-picker/modal.tsx index 6c99630f983a4..d677b8a06c508 100644 --- a/client/components/language-picker/modal.tsx +++ b/client/components/language-picker/modal.tsx @@ -165,11 +165,11 @@ const LanguagePickerModal: React.FC< Props > = ( { const buttons = [ <>{ checkboxes },
- - diff --git a/client/devdocs/design/wordpress-components-gallery/button.tsx b/client/devdocs/design/wordpress-components-gallery/button.tsx index b96c9294616cf..99da560bc5c72 100644 --- a/client/devdocs/design/wordpress-components-gallery/button.tsx +++ b/client/devdocs/design/wordpress-components-gallery/button.tsx @@ -1,7 +1,7 @@ import { Button as InnerButton, Flex, FlexItem } from '@wordpress/components'; import { more } from '@wordpress/icons'; -const Button = ( props: InnerButton.Props ) => ( +const Button = ( props: React.ComponentProps< typeof InnerButton > ) => ( @@ -13,20 +13,20 @@ const ButtonExample = () => {

Small Buttons

- - - @@ -34,14 +34,14 @@ const ButtonExample = () => {

Regular Buttons

- - - + + + diff --git a/client/devdocs/design/wordpress-components-gallery/card.tsx b/client/devdocs/design/wordpress-components-gallery/card.tsx index 4dc264e216df1..cdfa4779ad072 100644 --- a/client/devdocs/design/wordpress-components-gallery/card.tsx +++ b/client/devdocs/design/wordpress-components-gallery/card.tsx @@ -14,7 +14,7 @@ const CardExample = () => ( Header: Code is Poetry - + @@ -25,7 +25,7 @@ const CardExample = () => ( Footer: Code is Poetry - + diff --git a/client/devdocs/design/wordpress-components-gallery/clipboard-button.tsx b/client/devdocs/design/wordpress-components-gallery/clipboard-button.tsx index 51748cdf53c5d..9c1e0ff5138a6 100644 --- a/client/devdocs/design/wordpress-components-gallery/clipboard-button.tsx +++ b/client/devdocs/design/wordpress-components-gallery/clipboard-button.tsx @@ -7,8 +7,9 @@ const ClipboardButtonExample = () => { const text = 'Code is Poetry'; return ( setCopied( true ) } onFinishCopy={ () => setCopied( false ) } > diff --git a/client/devdocs/design/wordpress-components-gallery/color-palette.tsx b/client/devdocs/design/wordpress-components-gallery/color-palette.tsx index 0e027111e3ddb..8e9cdc94c7c7b 100644 --- a/client/devdocs/design/wordpress-components-gallery/color-palette.tsx +++ b/client/devdocs/design/wordpress-components-gallery/color-palette.tsx @@ -2,7 +2,7 @@ import { ColorPalette } from '@wordpress/components'; import { useState } from 'react'; const ColorPaletteExample = () => { - const colors: ColorPalette.Color[] = [ + const colors = [ { name: 'red', color: '#f00' }, { name: 'white', color: '#fff' }, { name: 'blue', color: '#00f' }, diff --git a/client/devdocs/design/wordpress-components-gallery/date-time-picker.tsx b/client/devdocs/design/wordpress-components-gallery/date-time-picker.tsx index eb1586be5a7d5..f837145e02e7c 100644 --- a/client/devdocs/design/wordpress-components-gallery/date-time-picker.tsx +++ b/client/devdocs/design/wordpress-components-gallery/date-time-picker.tsx @@ -2,7 +2,7 @@ import { DateTimePicker } from '@wordpress/components'; import { useState } from 'react'; const DateTimePickerExample = () => { - const [ dateTime, setDateTime ] = useState( '' ); + const [ dateTime, setDateTime ] = useState< string | null >( '' ); return ; }; diff --git a/client/devdocs/design/wordpress-components-gallery/dropdown-menu.tsx b/client/devdocs/design/wordpress-components-gallery/dropdown-menu.tsx index 1c3ab4dbec010..4192261f1b2d8 100644 --- a/client/devdocs/design/wordpress-components-gallery/dropdown-menu.tsx +++ b/client/devdocs/design/wordpress-components-gallery/dropdown-menu.tsx @@ -36,6 +36,7 @@ const DropdownMenuExample = () => { ] } value={ mode } onSelect={ setMode } + onHover={ () => undefined } /> diff --git a/client/devdocs/design/wordpress-components-gallery/font-size-picker.tsx b/client/devdocs/design/wordpress-components-gallery/font-size-picker.tsx index e8313b874a1e6..5310adef61c29 100644 --- a/client/devdocs/design/wordpress-components-gallery/font-size-picker.tsx +++ b/client/devdocs/design/wordpress-components-gallery/font-size-picker.tsx @@ -2,7 +2,7 @@ import { FontSizePicker } from '@wordpress/components'; import { useState } from 'react'; const FontSizePickerExample = () => { - const [ fontSize, setFontSize ] = useState< number | undefined >( 16 ); + const [ fontSize, setFontSize ] = useState< string | number | undefined >( 16 ); return ( ( window.alert( `${ event?.target?.files?.length ?? 0 } files uploaded!` ) diff --git a/client/devdocs/design/wordpress-components-gallery/form-token-field.tsx b/client/devdocs/design/wordpress-components-gallery/form-token-field.tsx index 371c2372e9a10..e779af06cbf90 100644 --- a/client/devdocs/design/wordpress-components-gallery/form-token-field.tsx +++ b/client/devdocs/design/wordpress-components-gallery/form-token-field.tsx @@ -1,6 +1,7 @@ import { FormTokenField } from '@wordpress/components'; import { withState } from '@wordpress/compose'; -import type { FormTokenField as FormTokenFieldType } from '@wordpress/components'; + +type TokenValue = React.ComponentProps< typeof FormTokenField >[ 'value' ]; const FormTokenFieldExample = withState( { tokens: [], @@ -21,7 +22,7 @@ const FormTokenFieldExample = withState( { }: { tokens: string[]; suggestions: string[]; - setState: ( { tokens }: { tokens: readonly FormTokenFieldType.Value[] } ) => void; + setState: ( { tokens }: { tokens: TokenValue } ) => void; } ) => ( { return ( <> - { isOpen && ( diff --git a/client/devdocs/design/wordpress-components-gallery/query-controls.tsx b/client/devdocs/design/wordpress-components-gallery/query-controls.tsx index a245230cff3d4..8087d6d5c6826 100644 --- a/client/devdocs/design/wordpress-components-gallery/query-controls.tsx +++ b/client/devdocs/design/wordpress-components-gallery/query-controls.tsx @@ -3,8 +3,8 @@ import { withState } from '@wordpress/compose'; interface StateProps { category: number; - order: string; - orderBy: string; + order: 'asc' | 'desc'; + orderBy: 'date' | 'title'; numberOfItems: number; } @@ -48,7 +48,9 @@ const QueryControlsExample = withState( { onOrderChange={ ( nextOrder ) => setState( { order: nextOrder } ) } categoriesList={ categories } selectedCategoryId={ category } - onCategoryChange={ ( nextCategory ) => setState( { category: nextCategory } ) } + onCategoryChange={ ( nextCategory: string ) => + setState( { category: Number( nextCategory ) } ) + } onNumberOfItemsChange={ ( nextNumberOfItems ) => setState( { numberOfItems: nextNumberOfItems } ) } diff --git a/client/devdocs/design/wordpress-components-gallery/slot-fill.tsx b/client/devdocs/design/wordpress-components-gallery/slot-fill.tsx index 21b0bb403d88b..544afe579446b 100644 --- a/client/devdocs/design/wordpress-components-gallery/slot-fill.tsx +++ b/client/devdocs/design/wordpress-components-gallery/slot-fill.tsx @@ -4,9 +4,11 @@ const SlotFillExample = () => (

Profile

+ { /* @ts-expect-error Slot is not typed correctly. */ } Name:

+ { /* @ts-expect-error Slot is not typed correctly. */ } Age:

Grace diff --git a/client/devdocs/design/wordpress-components-gallery/toolbar.tsx b/client/devdocs/design/wordpress-components-gallery/toolbar.tsx index 577a2c8cb9cdf..d34a4a5edd5f3 100644 --- a/client/devdocs/design/wordpress-components-gallery/toolbar.tsx +++ b/client/devdocs/design/wordpress-components-gallery/toolbar.tsx @@ -8,7 +8,6 @@ import { formatItalic, formatStrikethrough, link, - more, paragraph, } from '@wordpress/icons'; @@ -33,8 +32,6 @@ const ToolbarExample = () => ( , title: 'Inline image' }, @@ -46,8 +43,6 @@ const ToolbarExample = () => ( />
{ recordEvent( isEnabled ? 'email_notification_enable' : 'email_notification_disable' ); setEnableEmailNotification( isEnabled ); diff --git a/client/jetpack-cloud/sections/agency-dashboard/downtime-monitoring/notification-settings/form-content/mobile-push-notification.tsx b/client/jetpack-cloud/sections/agency-dashboard/downtime-monitoring/notification-settings/form-content/mobile-push-notification.tsx index 07cf7e683cd54..08e9c3ee5c6d8 100644 --- a/client/jetpack-cloud/sections/agency-dashboard/downtime-monitoring/notification-settings/form-content/mobile-push-notification.tsx +++ b/client/jetpack-cloud/sections/agency-dashboard/downtime-monitoring/notification-settings/form-content/mobile-push-notification.tsx @@ -19,6 +19,11 @@ export default function MobilePushNotification( {
{ recordEvent( isEnabled ? 'mobile_notification_enable' : 'mobile_notification_disable' ); setEnableMobileNotification( isEnabled ); diff --git a/client/jetpack-cloud/sections/agency-dashboard/downtime-monitoring/notification-settings/form-content/sms-notification.tsx b/client/jetpack-cloud/sections/agency-dashboard/downtime-monitoring/notification-settings/form-content/sms-notification.tsx index 154d1f17a0baf..e31a157f153c1 100644 --- a/client/jetpack-cloud/sections/agency-dashboard/downtime-monitoring/notification-settings/form-content/sms-notification.tsx +++ b/client/jetpack-cloud/sections/agency-dashboard/downtime-monitoring/notification-settings/form-content/sms-notification.tsx @@ -31,7 +31,15 @@ export default function SMSNotification( { <>
- +
diff --git a/client/jetpack-cloud/sections/agency-dashboard/downtime-monitoring/toggle-activate-monitoring/index.tsx b/client/jetpack-cloud/sections/agency-dashboard/downtime-monitoring/toggle-activate-monitoring/index.tsx index 1b2768a851205..7d2063d4eb596 100644 --- a/client/jetpack-cloud/sections/agency-dashboard/downtime-monitoring/toggle-activate-monitoring/index.tsx +++ b/client/jetpack-cloud/sections/agency-dashboard/downtime-monitoring/toggle-activate-monitoring/index.tsx @@ -1,5 +1,5 @@ import { Button } from '@automattic/components'; -import { ToggleControl as OriginalToggleControl } from '@wordpress/components'; +import { ToggleControl } from '@wordpress/components'; import { useTranslate } from 'i18n-calypso'; import { ReactNode, useState, useRef } from 'react'; import clockIcon from 'calypso/assets/images/jetpack/clock-icon.svg'; @@ -48,12 +48,6 @@ export default function ToggleActivateMonitoring( { setShowTooltip( false ); }; - const ToggleControl = OriginalToggleControl as React.ComponentType< - OriginalToggleControl.Props & { - disabled?: boolean; - } - >; - function handleToggleActivateMonitoring( checked: boolean ) { recordEvent( checked ? 'enable_monitor_click' : 'disable_monitor_click' ); toggleActivateMonitor( checked ); diff --git a/client/jetpack-cloud/sections/partner-portal/searchable-dropdown/index.tsx b/client/jetpack-cloud/sections/partner-portal/searchable-dropdown/index.tsx index ca8cbbac5509e..bf9212580afef 100644 --- a/client/jetpack-cloud/sections/partner-portal/searchable-dropdown/index.tsx +++ b/client/jetpack-cloud/sections/partner-portal/searchable-dropdown/index.tsx @@ -3,7 +3,7 @@ import classNames from 'classnames'; import './style.scss'; -type Props = ComboboxControl.Props & { +type Props = React.ComponentProps< typeof ComboboxControl > & { disabled?: boolean; }; @@ -16,13 +16,7 @@ export default function SearchableDropdown( props: Props ) { 'is-disabled': disabled, } ) } > - +
diff --git a/client/landing/stepper/declarative-flow/internals/steps-repository/components/sensei-step-container/index.tsx b/client/landing/stepper/declarative-flow/internals/steps-repository/components/sensei-step-container/index.tsx index b3f861e2b1066..98e2f64ae2b4f 100644 --- a/client/landing/stepper/declarative-flow/internals/steps-repository/components/sensei-step-container/index.tsx +++ b/client/landing/stepper/declarative-flow/internals/steps-repository/components/sensei-step-container/index.tsx @@ -44,7 +44,7 @@ export const SenseiStepContainer: React.FC< SenseiStepContainerProps > = ( {
{ createInterpolateElement( __( 'Hosted by WordPress.com' ), { - a: , + a: , } ) } diff --git a/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/unified-design-picker.tsx b/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/unified-design-picker.tsx index 577c21c198827..0aa7053f69f23 100644 --- a/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/unified-design-picker.tsx +++ b/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/unified-design-picker.tsx @@ -19,7 +19,7 @@ import { useLocale } from '@automattic/i18n-utils'; import { StepContainer } from '@automattic/onboarding'; import { useSelect, useDispatch } from '@wordpress/data'; import { useTranslate } from 'i18n-calypso'; -import { useRef, useState, useEffect } from 'react'; +import { useRef, useState, useEffect, useMemo } from 'react'; import AsyncLoad from 'calypso/components/async-load'; import { useQuerySiteFeatures } from 'calypso/components/data/query-site-features'; import { useQuerySitePurchases } from 'calypso/components/data/query-site-purchases'; @@ -100,6 +100,7 @@ const UnifiedDesignPickerStep: Step = ( { navigation, flow, stepName } ) => { if ( isAtomic ) { exitFlow?.( `/site-editor/${ siteSlugOrId }` ); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ isAtomic ] ); const isPremiumThemeAvailable = Boolean( @@ -153,7 +154,7 @@ const UnifiedDesignPickerStep: Step = ( { navigation, flow, stepName } ) => { } ); - const designs = allDesigns?.designs || []; + const designs = useMemo( () => allDesigns?.designs ?? [], [ allDesigns?.designs ] ); const hasTrackedView = useRef( false ); useEffect( () => { if ( ! hasTrackedView.current && designs.length > 0 ) { @@ -614,7 +615,7 @@ const UnifiedDesignPickerStep: Step = ( { navigation, flow, stepName } ) => { selectedFontVariation={ selectedFontVariation } onSelectFontVariation={ setSelectedFontVariation } onGlobalStylesChange={ setGlobalStyles } - onNavigatorPathChange={ ( path: string ) => setShouldHideActionButtons( path !== '/' ) } + onNavigatorPathChange={ ( path?: string ) => setShouldHideActionButtons( path !== '/' ) } /> ); diff --git a/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/upgrade-modal.tsx b/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/upgrade-modal.tsx index 7ae574fa83bc8..c4fcf2f649890 100644 --- a/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/upgrade-modal.tsx +++ b/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/upgrade-modal.tsx @@ -112,7 +112,7 @@ const UpgradeModal = ( { slug, isOpen, closeModal, checkout }: UpgradeModalProps 'This theme comes bundled with {{link}}WooCommerce{{/link}} plugin. Upgrade to a Business plan to select this theme and unlock all its features. It’s %s per year with a 14-day money-back guarantee.', { components: { - link: , + link: , }, args: businessPlanPrice, } diff --git a/client/landing/stepper/declarative-flow/internals/steps-repository/launchpad/task-helper.tsx b/client/landing/stepper/declarative-flow/internals/steps-repository/launchpad/task-helper.tsx index 5984b26bb3fdf..f1d6478ece894 100644 --- a/client/landing/stepper/declarative-flow/internals/steps-repository/launchpad/task-helper.tsx +++ b/client/landing/stepper/declarative-flow/internals/steps-repository/launchpad/task-helper.tsx @@ -177,6 +177,7 @@ export function getEnhancedTasks( components: { a: ( , 'children' > & { timer?: ReturnType< typeof setTimeout >; + id: string; + content: string; }; interface NoticeOperationsProps { @@ -45,10 +47,10 @@ const withNotices = createHigherOrderComponent( }, NOTICE_TIMEOUT ), }; - setNoticeList( ( current ) => [ - ...current.filter( ( notice ) => notice.id !== id ), - newNotice, - ] ); + setNoticeList( + ( current ) => + [ ...current.filter( ( notice ) => notice.id !== id ), newNotice ] as Notice[] + ); }; const noticeOperations: NoticeOperationsProps = { diff --git a/client/landing/stepper/declarative-flow/internals/steps-repository/pattern-assembler/pattern-large-preview.tsx b/client/landing/stepper/declarative-flow/internals/steps-repository/pattern-assembler/pattern-large-preview.tsx index 2e97f8f2d3b41..b1e3e889d1859 100644 --- a/client/landing/stepper/declarative-flow/internals/steps-repository/pattern-assembler/pattern-large-preview.tsx +++ b/client/landing/stepper/declarative-flow/internals/steps-repository/pattern-assembler/pattern-large-preview.tsx @@ -1,6 +1,6 @@ import { PatternRenderer } from '@automattic/block-renderer'; import { Button, DeviceSwitcher } from '@automattic/components'; -import { useStyle } from '@automattic/global-styles'; +import { useGlobalStyle } from '@automattic/global-styles'; import { __experimentalUseNavigator as useNavigator } from '@wordpress/components'; import classnames from 'classnames'; import { useTranslate } from 'i18n-calypso'; @@ -45,13 +45,15 @@ const PatternLargePreview = ( { const navigator = useNavigator(); const hasSelectedPattern = header || sections.length || footer; const shouldShowSelectPatternHint = - ! hasSelectedPattern && STYLES_PATHS.includes( navigator.location.path ); + ! hasSelectedPattern && + navigator.location.path && + STYLES_PATHS.includes( navigator.location.path ); const frameRef = useRef< HTMLDivElement | null >( null ); const listRef = useRef< HTMLUListElement | null >( null ); const [ viewportHeight, setViewportHeight ] = useState< number | undefined >( 0 ); const [ device, setDevice ] = useState< string >( 'computer' ); - const [ blockGap ] = useStyle( 'spacing.blockGap' ); - const [ backgroundColor ] = useStyle( 'color.background' ); + const [ blockGap ] = useGlobalStyle( 'spacing.blockGap' ); + const [ backgroundColor ] = useGlobalStyle( 'color.background' ); const [ patternLargePreviewStyle, setPatternLargePreviewStyle ] = useState( { '--pattern-large-preview-block-gap': blockGap, '--pattern-large-preview-background': backgroundColor, diff --git a/client/landing/stepper/declarative-flow/internals/steps-repository/pattern-assembler/screen-main.tsx b/client/landing/stepper/declarative-flow/internals/steps-repository/pattern-assembler/screen-main.tsx index 73098b1ff4041..c5e7c393f3d02 100644 --- a/client/landing/stepper/declarative-flow/internals/steps-repository/pattern-assembler/screen-main.tsx +++ b/client/landing/stepper/declarative-flow/internals/steps-repository/pattern-assembler/screen-main.tsx @@ -5,7 +5,7 @@ import { NavigatorItemGroup, } from '@automattic/onboarding'; import { - __experimentalHStack as HStack, + __experimentalVStack as VStack, __experimentalUseNavigator as useNavigator, } from '@wordpress/components'; import { focus } from '@wordpress/dom'; @@ -97,7 +97,7 @@ const ScreenMain = ( { hideBack />
- + - + { ! surveyDismissed && }
diff --git a/client/landing/stepper/declarative-flow/internals/steps-repository/store-address/index.tsx b/client/landing/stepper/declarative-flow/internals/steps-repository/store-address/index.tsx index 0de64c869fbe4..64e25220a43af 100644 --- a/client/landing/stepper/declarative-flow/internals/steps-repository/store-address/index.tsx +++ b/client/landing/stepper/declarative-flow/internals/steps-repository/store-address/index.tsx @@ -260,7 +260,7 @@ const StoreAddress: Step = function StoreAddress( { navigation } ) { { __( 'Country / State' ) } { + onChange={ ( value?: string | null ) => { onChange( 'store_country', value || '' ); } } options={ countriesAsOptions } diff --git a/client/landing/subscriptions/components/icons/search-icon.tsx b/client/landing/subscriptions/components/icons/search-icon.tsx index 9d30d54ad3ab4..b1640c2b463c6 100644 --- a/client/landing/subscriptions/components/icons/search-icon.tsx +++ b/client/landing/subscriptions/components/icons/search-icon.tsx @@ -1,4 +1,5 @@ import { Icon } from '@wordpress/components'; +import type { ComponentProps } from 'react'; const SearchSVG = ( ); -const SearchIcon = ( props: Icon.Props< never > ) => ; +const SearchIcon = ( props: ComponentProps< typeof Icon > ) => ( + +); export default SearchIcon; diff --git a/client/landing/subscriptions/components/settings/site-settings/email-me-new-comments-toggle.tsx b/client/landing/subscriptions/components/settings/site-settings/email-me-new-comments-toggle.tsx index cb39b9e84284a..d9cdb93fbf5b6 100644 --- a/client/landing/subscriptions/components/settings/site-settings/email-me-new-comments-toggle.tsx +++ b/client/landing/subscriptions/components/settings/site-settings/email-me-new-comments-toggle.tsx @@ -1,14 +1,6 @@ -import { ToggleControl as OriginalToggleControl } from '@wordpress/components'; +import { ToggleControl } from '@wordpress/components'; import { useTranslate } from 'i18n-calypso'; -// This is a fix to get around the fact that the original ToggleControl component doesn't support the disabled prop. -// TODO: Remove this when the original ToggleControl component supports the disabled prop. -const ToggleControl = OriginalToggleControl as React.ComponentType< - OriginalToggleControl.Props & { - disabled?: boolean; - } ->; - type EmailMeNewCommentsToggleProps = { value: boolean; isUpdating: boolean; diff --git a/client/landing/subscriptions/components/settings/site-settings/email-me-new-posts-toggle.tsx b/client/landing/subscriptions/components/settings/site-settings/email-me-new-posts-toggle.tsx index 3ec5e2ddd5cf4..1c9cbcfb5baf6 100644 --- a/client/landing/subscriptions/components/settings/site-settings/email-me-new-posts-toggle.tsx +++ b/client/landing/subscriptions/components/settings/site-settings/email-me-new-posts-toggle.tsx @@ -1,14 +1,6 @@ -import { ToggleControl as OriginalToggleControl } from '@wordpress/components'; +import { ToggleControl } from '@wordpress/components'; import { useTranslate } from 'i18n-calypso'; -// This is a fix to get around the fact that the original ToggleControl component doesn't support the disabled prop. -// TODO: Remove this when the original ToggleControl component supports the disabled prop. -const ToggleControl = OriginalToggleControl as React.ComponentType< - OriginalToggleControl.Props & { - disabled?: boolean; - } ->; - type EmailMeNewPostsToggleProps = { value: boolean; isUpdating: boolean; diff --git a/client/landing/subscriptions/components/settings/site-settings/notify-me-of-new-posts-toggle.tsx b/client/landing/subscriptions/components/settings/site-settings/notify-me-of-new-posts-toggle.tsx index d6037d36e2a5a..d740a1c459e7f 100644 --- a/client/landing/subscriptions/components/settings/site-settings/notify-me-of-new-posts-toggle.tsx +++ b/client/landing/subscriptions/components/settings/site-settings/notify-me-of-new-posts-toggle.tsx @@ -1,14 +1,6 @@ -import { ToggleControl as OriginalToggleControl } from '@wordpress/components'; +import { ToggleControl } from '@wordpress/components'; import { useTranslate } from 'i18n-calypso'; -// This is a fix to get around the fact that the original ToggleControl component doesn't support the disabled prop. -// TODO: Remove this when the original ToggleControl component supports the disabled prop. -const ToggleControl = OriginalToggleControl as React.ComponentType< - OriginalToggleControl.Props & { - disabled?: boolean; - } ->; - type NotifyMeOfNewPostsToggleProps = { value: boolean; isUpdating: boolean; diff --git a/client/landing/subscriptions/components/site-subscription-page/site-subscription-details.tsx b/client/landing/subscriptions/components/site-subscription-page/site-subscription-details.tsx index f1bf988f11fb0..d0dd30833dd02 100644 --- a/client/landing/subscriptions/components/site-subscription-page/site-subscription-details.tsx +++ b/client/landing/subscriptions/components/site-subscription-page/site-subscription-details.tsx @@ -256,9 +256,8 @@ const SiteSubscriptionDetails = ( { { paymentPlans && !! paymentPlans.length && ( diff --git a/client/landing/subscriptions/components/site-subscriptions-list/site-row.tsx b/client/landing/subscriptions/components/site-subscriptions-list/site-row.tsx index b3b54f0dcc1e4..1680126a52477 100644 --- a/client/landing/subscriptions/components/site-subscriptions-list/site-row.tsx +++ b/client/landing/subscriptions/components/site-subscriptions-list/site-row.tsx @@ -195,7 +195,7 @@ const SiteRow = ( { }; return ! isDeleted ? ( - + = ( { return (
    - + { translate( 'Subscribed site' ) } diff --git a/client/landing/subscriptions/components/sort-controls/sort-controls.tsx b/client/landing/subscriptions/components/sort-controls/sort-controls.tsx index 6a14885a99020..70c9f4ad235d6 100644 --- a/client/landing/subscriptions/components/sort-controls/sort-controls.tsx +++ b/client/landing/subscriptions/components/sort-controls/sort-controls.tsx @@ -4,6 +4,9 @@ import { useTranslate } from 'i18n-calypso'; import { ReactElement, useMemo } from 'react'; import './styles.scss'; +// eslint-disable-next-line @typescript-eslint/no-empty-function +const noop = () => {}; + export type Option< T > = { label: string; value: T; @@ -63,6 +66,7 @@ const SortControls: < T extends string >( props: SortControlsProps< T > ) => Rea onClose(); } } choices={ options } + onHover={ noop } /> ) } diff --git a/client/me/account/toggle-sites-as-landing-page.tsx b/client/me/account/toggle-sites-as-landing-page.tsx index 51e2488c5f9c1..607c3825094a5 100644 --- a/client/me/account/toggle-sites-as-landing-page.tsx +++ b/client/me/account/toggle-sites-as-landing-page.tsx @@ -1,4 +1,4 @@ -import { ToggleControl as OriginalToggleControl } from '@wordpress/components'; +import { ToggleControl } from '@wordpress/components'; import { useTranslate } from 'i18n-calypso'; import { useDispatch, useSelector } from 'calypso/state'; import { recordTracksEvent } from 'calypso/state/analytics/actions'; @@ -6,12 +6,6 @@ import { successNotice } from 'calypso/state/notices/actions'; import { savePreference } from 'calypso/state/preferences/actions'; import { getPreference, isSavingPreference } from 'calypso/state/preferences/selectors'; -const ToggleControl = OriginalToggleControl as React.ComponentType< - OriginalToggleControl.Props & { - disabled?: boolean; - } ->; - function ToggleSitesAsLandingPage() { const translate = useTranslate(); const dispatch = useDispatch(); diff --git a/client/me/purchases/manage-purchase/auto-renew-toggle/index.tsx b/client/me/purchases/manage-purchase/auto-renew-toggle/index.tsx index 8180f0fc0bb32..00164a01a18fd 100644 --- a/client/me/purchases/manage-purchase/auto-renew-toggle/index.tsx +++ b/client/me/purchases/manage-purchase/auto-renew-toggle/index.tsx @@ -1,4 +1,4 @@ -import { Button, ToggleControl, BaseControl } from '@wordpress/components'; +import { Button, ToggleControl } from '@wordpress/components'; import { localize, LocalizeProps } from 'i18n-calypso'; import page from 'page'; import { Component } from 'react'; @@ -19,32 +19,6 @@ import AutoRenewPaymentMethodDialog from './auto-renew-payment-method-dialog'; import type { GetChangePaymentMethodUrlFor, Purchase } from 'calypso/lib/purchases/types'; import type { NoticeStatus, NoticeText, NoticeOptions } from 'calypso/state/notices/types'; -// The ToggleControl type is missing the `disabled` prop, but it is an allowed -// prop so we override it here until the definition can be fixed. -declare module '@wordpress/components' { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace ToggleControl { - interface Props extends BaseControl.ControlProps { - /** - * If checked is `true` the toggle will be checked. If checked is - * `false` the toggle will be unchecked. If no value is passed the - * toggle will be unchecked. - */ - checked?: boolean | undefined; - /** - * A function that receives the checked state as input. - */ - onChange?( isChecked: boolean ): void; - /** - * Will disable the input if set. - * - * NOTE: this is missing from the actual ToggleControl props so we override it here. - */ - disabled?: boolean; - } - } -} - export interface AutoRenewToggleProps { purchase: Purchase; siteDomain: string; @@ -266,7 +240,7 @@ class AutoRenewToggle extends Component< '…' ) : (
); diff --git a/client/my-sites/backup/backup-contents-page/index.tsx b/client/my-sites/backup/backup-contents-page/index.tsx index a438eab5147f9..1333d40fd5085 100644 --- a/client/my-sites/backup/backup-contents-page/index.tsx +++ b/client/my-sites/backup/backup-contents-page/index.tsx @@ -44,7 +44,7 @@ const BackupContentsPage: FunctionComponent< OwnProps > = ( { rewindId, siteId } { isJetpackCloud() && } diff --git a/client/my-sites/checkout/checkout-thank-you/marketplace/use-thank-you-footer.tsx b/client/my-sites/checkout/checkout-thank-you/marketplace/use-thank-you-footer.tsx index c3f7f61e54e01..7da559f658b80 100644 --- a/client/my-sites/checkout/checkout-thank-you/marketplace/use-thank-you-footer.tsx +++ b/client/my-sites/checkout/checkout-thank-you/marketplace/use-thank-you-footer.tsx @@ -1,5 +1,5 @@ import { recordTracksEvent } from '@automattic/calypso-analytics'; -import { useLocale } from '@automattic/i18n-utils'; +import { useLocale, useLocalizeUrl } from '@automattic/i18n-utils'; import { Button } from '@wordpress/components'; import { useI18n } from '@wordpress/react-i18n'; import { useTranslate } from 'i18n-calypso'; @@ -48,6 +48,7 @@ export function useThankYouFoooter( } function usePluginSteps(): FooterStep[] { + const localizeUrl = useLocalizeUrl(); const translate = useTranslate(); const { hasTranslation } = useI18n(); const locale = useLocale(); @@ -68,7 +69,7 @@ function usePluginSteps(): FooterStep[] { key: 'thank_you_footer_explore', title: translate( 'Need help setting your plugin up?' ), description: descriptionText, - link: `https://wordpress.com/support/plugins/use-your-plugins/`, + link: localizeUrl( 'https://wordpress.com/support/plugins/use-your-plugins/' ), linkText: translate( 'Plugin setup guide' ), eventKey: 'calypso_plugin_thank_you_explore_plugins_click', blankTarget: false, @@ -79,7 +80,7 @@ function usePluginSteps(): FooterStep[] { description: translate( `Unlock your plugin's potential with our comprehensive support documentation.` ), - link: 'https://wordpress.com/support/category/plugins-and-integrations/', + link: localizeUrl( 'https://wordpress.com/support/category/plugins-and-integrations/' ), linkText: translate( 'Plugin documentation' ), eventKey: 'calypso_plugin_thank_you_plugin_support_click', }, @@ -87,6 +88,7 @@ function usePluginSteps(): FooterStep[] { } function useThemeSteps(): FooterStep[] { + const localizeUrl = useLocalizeUrl(); const translate = useTranslate(); return [ @@ -96,7 +98,7 @@ function useThemeSteps(): FooterStep[] { description: translate( 'Check out our support documentation for step-by-step instructions and expert guidance on your theme set up.' ), - link: 'https://wordpress.com/support/themes/set-up-your-theme/', + link: localizeUrl( 'https://wordpress.com/support/themes/set-up-your-theme/' ), linkText: translate( 'Get set up support' ), eventKey: 'calypso_plugin_thank_you_theme_setup_guide_click', }, @@ -106,7 +108,7 @@ function useThemeSteps(): FooterStep[] { description: translate( 'Take a look at our comprehensive support documentation and learn more about themes.' ), - link: 'https://wordpress.com/support/themes/', + link: localizeUrl( 'https://wordpress.com/support/themes/' ), linkText: translate( 'Learn more about themes' ), eventKey: 'calypso_plugin_thank_you_theme_support_click', }, @@ -138,7 +140,7 @@ function useNextSteps( stepDescription: step.description, stepCta: ( diff --git a/client/my-sites/checkout/composite-checkout/hooks/use-cached-domain-contact-details.ts b/client/my-sites/checkout/composite-checkout/hooks/use-cached-domain-contact-details.ts index bb978ad4782ac..e350a21158096 100644 --- a/client/my-sites/checkout/composite-checkout/hooks/use-cached-domain-contact-details.ts +++ b/client/my-sites/checkout/composite-checkout/hooks/use-cached-domain-contact-details.ts @@ -91,6 +91,7 @@ function useCachedContactDetailsForCheckoutForm( ...cachedContactDetails, postalCode: arePostalCodesSupported ? cachedContactDetails.postalCode : '', } ) + // @ts-expect-error Action creator return types are incorrect. This can be removed after https://github.com/WordPress/gutenberg/pull/52530 is available in @wordpress/data. .then( () => { if ( ! isMounted.current ) { return false; diff --git a/client/my-sites/checkout/composite-checkout/payment-methods/credit-card/assign-to-all-payment-methods.tsx b/client/my-sites/checkout/composite-checkout/payment-methods/credit-card/assign-to-all-payment-methods.tsx index ea771cf6cee8e..e1b4a07e2b0f9 100644 --- a/client/my-sites/checkout/composite-checkout/payment-methods/credit-card/assign-to-all-payment-methods.tsx +++ b/client/my-sites/checkout/composite-checkout/payment-methods/credit-card/assign-to-all-payment-methods.tsx @@ -37,19 +37,23 @@ export default function AssignToAllPaymentMethods( { disabled={ isDisabled } checked={ isChecked } onChange={ handleChangeEvent } - label={ translate( - 'Use this payment method for all subscriptions on my account. {{link}}Learn more.{{/link}}', - { - components: { - link: ( - - ), - }, - } - ) } + label={ + translate( + 'Use this payment method for all subscriptions on my account. {{link}}Learn more.{{/link}}', + { + components: { + link: ( + + ), + }, + } + // As far as I can tell, label will correctly render the + // component, so we cast to string to make the types work. + ) as string + } /> ); diff --git a/client/my-sites/checkout/composite-checkout/payment-methods/credit-card/store.ts b/client/my-sites/checkout/composite-checkout/payment-methods/credit-card/store.ts index a43902b4fb183..af426276bd583 100644 --- a/client/my-sites/checkout/composite-checkout/payment-methods/credit-card/store.ts +++ b/client/my-sites/checkout/composite-checkout/payment-methods/credit-card/store.ts @@ -36,6 +36,9 @@ export const actions = { touchAllFields(): CardStoreAction { return { type: 'TOUCH_ALL_FIELDS' }; }, + resetFields(): CardStoreAction { + return { type: 'RESET_FIELDS' }; + }, }; export const selectors = { @@ -105,6 +108,9 @@ export function createCreditCardPaymentMethodStore( { {} ); } + case 'RESET_FIELDS': { + return {}; + } default: return state; } diff --git a/client/my-sites/checkout/composite-checkout/payment-methods/credit-card/types.ts b/client/my-sites/checkout/composite-checkout/payment-methods/credit-card/types.ts index c47797e37a94f..44d70394110fe 100644 --- a/client/my-sites/checkout/composite-checkout/payment-methods/credit-card/types.ts +++ b/client/my-sites/checkout/composite-checkout/payment-methods/credit-card/types.ts @@ -39,7 +39,8 @@ export type CardStoreAction = | { type: 'FIELD_VALUE_SET'; payload: { key: string; value: string } } | { type: 'FIELD_ERROR_SET'; payload: { key: string; message: string } } | { type: 'USE_FOR_ALL_SUBSCRIPTIONS_SET'; payload: boolean } - | { type: 'TOUCH_ALL_FIELDS' }; + | { type: 'TOUCH_ALL_FIELDS' } + | { type: 'RESET_FIELDS' }; export type StripeFieldChangeInput = | { diff --git a/client/my-sites/checkout/composite-checkout/payment-methods/netbanking.tsx b/client/my-sites/checkout/composite-checkout/payment-methods/netbanking.tsx index fb04ee132f1a2..63c0d568189c4 100644 --- a/client/my-sites/checkout/composite-checkout/payment-methods/netbanking.tsx +++ b/client/my-sites/checkout/composite-checkout/payment-methods/netbanking.tsx @@ -58,6 +58,9 @@ const actions = { touchAllFields() { return { type: 'TOUCH_ALL_FIELDS' }; }, + resetFields() { + return { type: 'RESET_FIELDS' }; + }, }; const selectors: StoreSelectorsWithState< NounsInStore > & { @@ -125,6 +128,9 @@ export function createNetBankingPaymentMethodStore(): NetBankingStore { {} ), }; + case 'RESET_FIELDS': { + return { ...state, fields: {} }; + } } return state; }, diff --git a/client/my-sites/checkout/composite-checkout/test/credit-card.tsx b/client/my-sites/checkout/composite-checkout/test/credit-card.tsx index cdb27d8f5f55e..6f25e0b8e581f 100644 --- a/client/my-sites/checkout/composite-checkout/test/credit-card.tsx +++ b/client/my-sites/checkout/composite-checkout/test/credit-card.tsx @@ -12,6 +12,8 @@ import { import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { useDispatch } from '@wordpress/data'; +import { useEffect } from 'react'; import { Provider as ReduxProvider } from 'react-redux'; import { createCreditCardPaymentMethodStore, @@ -57,6 +59,13 @@ function getPaymentMethod( store: CardStoreType, additionalArgs = {} ) { } ); } +function ResetCreditCardStoreFields() { + const { resetFields } = useDispatch( 'wpcom-credit-card' ); + useEffect( () => { + resetFields(); + } ); +} + describe( 'Credit card payment method', () => { it( 'renders a credit card option', async () => { const store = createCreditCardPaymentMethodStore( {} ); @@ -113,6 +122,9 @@ describe( 'Credit card payment method', () => { useForAllSubscriptions: false, } ); } ); + + // Manually reset the `wpcom-credit-card` store fields. + render( ); } ); it( 'does not submit the data to the processor when the submit button is pressed if fields are missing', async () => { diff --git a/client/my-sites/checkout/composite-checkout/test/netbanking.tsx b/client/my-sites/checkout/composite-checkout/test/netbanking.tsx index 5779b803b9fa1..5eccde387c4ca 100644 --- a/client/my-sites/checkout/composite-checkout/test/netbanking.tsx +++ b/client/my-sites/checkout/composite-checkout/test/netbanking.tsx @@ -11,6 +11,8 @@ import { import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { useDispatch } from '@wordpress/data'; +import { useEffect } from 'react'; import { Provider as ReduxProvider } from 'react-redux'; import { createNetBankingMethod, @@ -56,6 +58,13 @@ function getPaymentMethod( additionalArgs = {} ) { } ); } +function ResetNetbankingStoreFields() { + const { resetFields } = useDispatch( 'netbanking' ); + useEffect( () => { + resetFields(); + } ); +} + describe( 'Netbanking payment method', () => { it( 'renders a netbanking option', async () => { const paymentMethod = getPaymentMethod(); @@ -108,6 +117,9 @@ describe( 'Netbanking payment method', () => { gstin, } ); } ); + + // Manually reset the `netbanking` store fields. + render( ); } ); it( 'does not submit the data to the processor when the submit button is pressed if fields are missing', async () => { diff --git a/client/my-sites/checkout/modal/index.tsx b/client/my-sites/checkout/modal/index.tsx index acf6280701d77..b73a676bf23c6 100644 --- a/client/my-sites/checkout/modal/index.tsx +++ b/client/my-sites/checkout/modal/index.tsx @@ -94,7 +94,6 @@ const CheckoutModal: FunctionComponent< Props > = ( { return ( , + a: , }, } ); @@ -47,7 +47,7 @@ export const DeploymentStatusExplanation = ( { totalFailures, }, components: { - a: , + a: , }, } ); diff --git a/client/my-sites/hosting/github/deployment-card/empty-deployments.tsx b/client/my-sites/hosting/github/deployment-card/empty-deployments.tsx index 7c0c6db2cf362..5d1d020b54119 100644 --- a/client/my-sites/hosting/github/deployment-card/empty-deployments.tsx +++ b/client/my-sites/hosting/github/deployment-card/empty-deployments.tsx @@ -10,7 +10,7 @@ export const EmptyDeployments = () => { 'Push to the connected branch to trigger a deployment. {{a}}Learn more{{/a}}', { components: { - a: , + a: , }, } ) } diff --git a/client/my-sites/hosting/github/github-connect-card/index.tsx b/client/my-sites/hosting/github/github-connect-card/index.tsx index 8d63b98c585e0..a8ccdf025a360 100644 --- a/client/my-sites/hosting/github/github-connect-card/index.tsx +++ b/client/my-sites/hosting/github/github-connect-card/index.tsx @@ -78,7 +78,7 @@ export const GithubConnectCard = ( { connection }: GithubConnectCardProps ) => {

{ __( 'Changes pushed to the selected branch will be automatically deployed. ' ) } - + { __( 'Learn more' ) }

diff --git a/client/my-sites/marketing/do-it-for-me/difm-landing.tsx b/client/my-sites/marketing/do-it-for-me/difm-landing.tsx index 7d8b253f9ff53..adf5968975761 100644 --- a/client/my-sites/marketing/do-it-for-me/difm-landing.tsx +++ b/client/my-sites/marketing/do-it-for-me/difm-landing.tsx @@ -366,9 +366,7 @@ export default function DIFMLanding( { ) }

- - { translate( 'Get started' ) } - + { translate( 'Get started' ) } diff --git a/client/my-sites/marketplace/pages/submission-success/signup-success.tsx b/client/my-sites/marketplace/pages/submission-success/signup-success.tsx index 6f59d1a569460..86d1fca16b5eb 100644 --- a/client/my-sites/marketplace/pages/submission-success/signup-success.tsx +++ b/client/my-sites/marketplace/pages/submission-success/signup-success.tsx @@ -66,7 +66,10 @@ const SignupSuccess = () => {

{ translate( 'Learn More' ) }

{ translate( 'Read more about selling on the WordPress.com marketplace.' ) }

-
@@ -79,7 +82,7 @@ const SignupSuccess = () => {

{ translate( 'View the marketplace' ) }

{ translate( 'Sign in to see what the marketplace has to offer.' ) }

-
@@ -92,7 +95,7 @@ const SignupSuccess = () => {

{ translate( 'Developer Page' ) }

{ translate( 'Learn more about building a WordPress.com integration.' ) }

-
diff --git a/client/my-sites/pages/virtual-page/index.tsx b/client/my-sites/pages/virtual-page/index.tsx index b797e5dadea15..c8fc61ae9f197 100644 --- a/client/my-sites/pages/virtual-page/index.tsx +++ b/client/my-sites/pages/virtual-page/index.tsx @@ -34,8 +34,8 @@ const HomepagePopover = ( { isAdmin, template }: HomepagePopoverProps ) => { const learnMoreLink = ( ); diff --git a/client/my-sites/plans/jetpack-plans/plans-filter-bar/index.tsx b/client/my-sites/plans/jetpack-plans/plans-filter-bar/index.tsx index 9461beef0de65..c08d390962743 100644 --- a/client/my-sites/plans/jetpack-plans/plans-filter-bar/index.tsx +++ b/client/my-sites/plans/jetpack-plans/plans-filter-bar/index.tsx @@ -100,6 +100,7 @@ const PlansFilterBar: React.FC< FilterBarProps > = ( { className="plans-filter-bar__toggle-control" checked={ durationChecked } onChange={ () => setDurationChecked( ( prevState ) => ! prevState ) } + label={ undefined } /> { translate( 'Bill yearly' ) } diff --git a/client/my-sites/promote-post-i2/components/campaign-item/index.tsx b/client/my-sites/promote-post-i2/components/campaign-item/index.tsx index 2a75ef0821331..aa65637faa79c 100644 --- a/client/my-sites/promote-post-i2/components/campaign-item/index.tsx +++ b/client/my-sites/promote-post-i2/components/campaign-item/index.tsx @@ -139,7 +139,11 @@ export default function CampaignItem( props: Props ) {
{ getMobileStats() }
-
@@ -164,7 +168,7 @@ export default function CampaignItem( props: Props ) {
{ formatNumber( clicks_total ) }
-
diff --git a/client/my-sites/promote-post/components/campaign-item/index.tsx b/client/my-sites/promote-post/components/campaign-item/index.tsx index a5654f598a578..a1144984d31b4 100644 --- a/client/my-sites/promote-post/components/campaign-item/index.tsx +++ b/client/my-sites/promote-post/components/campaign-item/index.tsx @@ -1,6 +1,7 @@ import './style.scss'; import { safeImageUrl } from '@automattic/calypso-url'; import { Badge, Dialog, Gridicon } from '@automattic/components'; +import { useLocalizeUrl } from '@automattic/i18n-utils'; import { Button, Notice } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { useTranslate } from 'i18n-calypso'; @@ -37,6 +38,7 @@ export default function CampaignItem( { campaign, expanded, onClickCampaign }: P const [ showDeleteDialog, setShowDeleteDialog ] = useState( false ); const [ showErrorDialog, setShowErrorDialog ] = useState( false ); const siteId = useSelector( getSelectedSiteId ); + const localizeUrl = useLocalizeUrl(); const translate = useTranslate(); const { cancelCampaign } = useCancelCampaignMutation( () => setShowErrorDialog( true ) ); @@ -146,8 +148,7 @@ export default function CampaignItem( { campaign, expanded, onClickCampaign }: P label: __( 'Contact support' ), onClick: async () => { setShowErrorDialog( false ); - // eslint-disable-next-line wpcalypso/i18n-unlocalized-url - window.open( 'https://wordpress.com/support/', '_blank' ); + window.open( localizeUrl( 'https://wordpress.com/support/' ), '_blank' ); }, }, { @@ -301,7 +302,7 @@ export default function CampaignItem( { campaign, expanded, onClickCampaign }: P
{ canCancelCampaign( campaignStatus ) && ( - ) } @@ -316,8 +317,7 @@ export default function CampaignItem( { campaign, expanded, onClickCampaign }: P components: { wpcomTos: ( diff --git a/client/my-sites/promote-post/components/post-item/index.tsx b/client/my-sites/promote-post/components/post-item/index.tsx index 6343a1eec9676..2c0d6793b988a 100644 --- a/client/my-sites/promote-post/components/post-item/index.tsx +++ b/client/my-sites/promote-post/components/post-item/index.tsx @@ -83,7 +83,7 @@ export default function PostItem( { post }: Props ) {
- + { translate( 'Let us choose' ) } diff --git a/client/signup/steps/difm-site-picker/index.tsx b/client/signup/steps/difm-site-picker/index.tsx index 161515a6ffad6..c922f7fd72530 100644 --- a/client/signup/steps/difm-site-picker/index.tsx +++ b/client/signup/steps/difm-site-picker/index.tsx @@ -59,7 +59,7 @@ export default function DIFMSitePickerStep( props: Props ) { components: { SupportLink:
, NewSiteLink: ( -