From fdd630c8936269a323ec99e3081dd348ba37ff22 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 13 Dec 2024 04:58:21 +0900 Subject: [PATCH 1/6] Icons: Deprecate `warning` and rename to `cautionFilled` --- packages/icons/src/icon/stories/index.story.js | 9 ++++++++- packages/icons/src/icon/stories/keywords.ts | 2 +- packages/icons/src/index.js | 6 +++++- .../icons/src/library/{warning.js => caution-filled.js} | 0 4 files changed, 14 insertions(+), 3 deletions(-) rename packages/icons/src/library/{warning.js => caution-filled.js} (100%) diff --git a/packages/icons/src/icon/stories/index.story.js b/packages/icons/src/icon/stories/index.story.js index 8cbf65d9f259e9..406f986e6ef5dc 100644 --- a/packages/icons/src/icon/stories/index.story.js +++ b/packages/icons/src/icon/stories/index.story.js @@ -11,7 +11,14 @@ import check from '../../library/check'; import * as icons from '../../'; import keywords from './keywords'; -const { Icon: _Icon, ...availableIcons } = icons; +const { + Icon: _Icon, + + // Deprecated aliases + warning: _warning, + + ...availableIcons +} = icons; const meta = { component: Icon, diff --git a/packages/icons/src/icon/stories/keywords.ts b/packages/icons/src/icon/stories/keywords.ts index 3fd962e047bc1d..4965bc38c3451c 100644 --- a/packages/icons/src/icon/stories/keywords.ts +++ b/packages/icons/src/icon/stories/keywords.ts @@ -1,5 +1,6 @@ const keywords: Partial< Record< keyof typeof import('../../'), string[] > > = { cancelCircleFilled: [ 'close' ], + cautionFilled: [ 'alert', 'caution', 'warning' ], create: [ 'add' ], file: [ 'folder' ], seen: [ 'show' ], @@ -7,7 +8,6 @@ const keywords: Partial< Record< keyof typeof import('../../'), string[] > > = { thumbsUp: [ 'like' ], trash: [ 'delete' ], unseen: [ 'hide' ], - warning: [ 'alert', 'caution' ], }; export default keywords; diff --git a/packages/icons/src/index.js b/packages/icons/src/index.js index 14eaec92b78c4d..ab7edf65e496b9 100644 --- a/packages/icons/src/index.js +++ b/packages/icons/src/index.js @@ -37,6 +37,11 @@ export { default as caption } from './library/caption'; export { default as capturePhoto } from './library/capture-photo'; export { default as captureVideo } from './library/capture-video'; export { default as category } from './library/category'; +export { + /** @deprecated Import `cautionFilled` instead. */ + default as warning, + default as cautionFilled, +} from './library/caution-filled'; export { default as chartBar } from './library/chart-bar'; export { default as check } from './library/check'; export { default as chevronDown } from './library/chevron-down'; @@ -301,6 +306,5 @@ export { default as update } from './library/update'; export { default as upload } from './library/upload'; export { default as verse } from './library/verse'; export { default as video } from './library/video'; -export { default as warning } from './library/warning'; export { default as widget } from './library/widget'; export { default as wordpress } from './library/wordpress'; diff --git a/packages/icons/src/library/warning.js b/packages/icons/src/library/caution-filled.js similarity index 100% rename from packages/icons/src/library/warning.js rename to packages/icons/src/library/caution-filled.js From 9435f37fc3a252409868a23d96d966e80d2748eb Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 13 Dec 2024 05:10:02 +0900 Subject: [PATCH 2/6] Update changelog --- packages/icons/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/icons/CHANGELOG.md b/packages/icons/CHANGELOG.md index d622019f1ee783..952e3164d45072 100644 --- a/packages/icons/CHANGELOG.md +++ b/packages/icons/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Deprecate `warning` icon and rename to `cautionFilled` ([#67895](https://github.com/WordPress/gutenberg/pull/67895)). + ## 10.14.0 (2024-12-11) ## 10.13.0 (2024-11-27) From 968437a0d25064e32b184510d8e5065b5436f6f4 Mon Sep 17 00:00:00 2001 From: James Koster Date: Fri, 13 Dec 2024 11:56:26 +0000 Subject: [PATCH 3/6] Update icon --- packages/icons/src/library/caution-filled.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/icons/src/library/caution-filled.js b/packages/icons/src/library/caution-filled.js index 97086c5c9292bd..5bb214411bcfb8 100644 --- a/packages/icons/src/library/caution-filled.js +++ b/packages/icons/src/library/caution-filled.js @@ -4,8 +4,8 @@ import { SVG, Path } from '@wordpress/primitives'; const warning = ( - - + + ); From 1ffaca1809ad513890c87575758a7152241565a9 Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:47:07 +0200 Subject: [PATCH 4/6] Update mobile snapshots --- .../src/audio/test/__snapshots__/edit.native.js.snap | 2 +- .../src/file/test/__snapshots__/edit.native.js.snap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/audio/test/__snapshots__/edit.native.js.snap b/packages/block-library/src/audio/test/__snapshots__/edit.native.js.snap index 4cf28f7063ad31..9cf88d804068af 100644 --- a/packages/block-library/src/audio/test/__snapshots__/edit.native.js.snap +++ b/packages/block-library/src/audio/test/__snapshots__/edit.native.js.snap @@ -89,7 +89,7 @@ exports[`Audio block renders audio block error state without crashing 1`] = ` diff --git a/packages/block-library/src/file/test/__snapshots__/edit.native.js.snap b/packages/block-library/src/file/test/__snapshots__/edit.native.js.snap index 5ce876137ade00..0c9d88a2074019 100644 --- a/packages/block-library/src/file/test/__snapshots__/edit.native.js.snap +++ b/packages/block-library/src/file/test/__snapshots__/edit.native.js.snap @@ -132,7 +132,7 @@ exports[`File block renders file error state without crashing 1`] = ` From 2457a6d99e3a7fcf28e96a650848e5d5d0771771 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 13 Dec 2024 23:17:11 +0900 Subject: [PATCH 5/6] Rename original variable --- packages/icons/src/library/caution-filled.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/icons/src/library/caution-filled.js b/packages/icons/src/library/caution-filled.js index 5bb214411bcfb8..5e7779db85f862 100644 --- a/packages/icons/src/library/caution-filled.js +++ b/packages/icons/src/library/caution-filled.js @@ -3,10 +3,10 @@ */ import { SVG, Path } from '@wordpress/primitives'; -const warning = ( +const cautionFilled = ( ); -export default warning; +export default cautionFilled; From 7f1d0ac4ee8e4fc2d6d2e3fa5cb15ac5ccd04145 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 13 Dec 2024 23:25:04 +0900 Subject: [PATCH 6/6] Update existing usage in native files --- .../src/components/audio-player/index.native.js | 4 ++-- .../src/components/contrast-checker/index.native.js | 4 ++-- packages/block-library/src/cover/edit.native.js | 7 +++++-- .../editor/src/components/error-boundary/index.native.js | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/block-editor/src/components/audio-player/index.native.js b/packages/block-editor/src/components/audio-player/index.native.js index bee31ea5872ef5..734226408cb923 100644 --- a/packages/block-editor/src/components/audio-player/index.native.js +++ b/packages/block-editor/src/components/audio-player/index.native.js @@ -17,7 +17,7 @@ import { View } from '@wordpress/primitives'; import { Icon } from '@wordpress/components'; import { withPreferredColorScheme } from '@wordpress/compose'; import { __ } from '@wordpress/i18n'; -import { audio, warning } from '@wordpress/icons'; +import { audio, cautionFilled } from '@wordpress/icons'; import { requestImageFailedRetryDialog, requestImageUploadCancelDialog, @@ -167,7 +167,7 @@ function Player( { { isUploadFailed && ( - + { msg } ); diff --git a/packages/block-library/src/cover/edit.native.js b/packages/block-library/src/cover/edit.native.js index 99324545bf798e..7f73ec85a798e6 100644 --- a/packages/block-library/src/cover/edit.native.js +++ b/packages/block-library/src/cover/edit.native.js @@ -58,7 +58,7 @@ import { useCallback, useMemo, } from '@wordpress/element'; -import { cover as icon, replace, image, warning } from '@wordpress/icons'; +import { cover as icon, replace, image, cautionFilled } from '@wordpress/icons'; import { getProtocol } from '@wordpress/url'; // eslint-disable-next-line no-restricted-imports import { store as editPostStore } from '@wordpress/edit-post'; @@ -665,7 +665,10 @@ const Cover = ( { style={ styles.uploadFailedContainer } > - + ) } diff --git a/packages/editor/src/components/error-boundary/index.native.js b/packages/editor/src/components/error-boundary/index.native.js index 0de048e8114451..4c05ceb3fc150b 100644 --- a/packages/editor/src/components/error-boundary/index.native.js +++ b/packages/editor/src/components/error-boundary/index.native.js @@ -16,7 +16,7 @@ import { usePreferredColorSchemeStyle, withPreferredColorScheme, } from '@wordpress/compose'; -import { warning } from '@wordpress/icons'; +import { cautionFilled } from '@wordpress/icons'; import { Icon } from '@wordpress/components'; /** @@ -141,7 +141,7 @@ class ErrorBoundary extends Component {