From e9c4bfa6bda6781b20e3cce12325975ae665d4ac Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Fri, 21 Oct 2022 16:17:44 +0800 Subject: [PATCH 1/4] Fix popover deprecations --- packages/components/src/popover/index.tsx | 26 +---------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/packages/components/src/popover/index.tsx b/packages/components/src/popover/index.tsx index 25bb157247a361..db9104605f26b6 100644 --- a/packages/components/src/popover/index.tsx +++ b/packages/components/src/popover/index.tsx @@ -184,23 +184,14 @@ const UnforwardedPopover = ( // Deprecated props __unstableForcePosition, - __unstableShift, anchorRef, anchorRect, getAnchorRect, - range, // Rest ...contentProps } = props; - if ( range ) { - deprecated( '`range` prop in wp.components.Popover', { - since: '6.1', - version: '6.3', - } ); - } - let computedFlipProp = flip; let computedResizeProp = resize; if ( __unstableForcePosition !== undefined ) { @@ -216,22 +207,9 @@ const UnforwardedPopover = ( computedResizeProp = ! __unstableForcePosition; } - let shouldShift = shift; - if ( __unstableShift !== undefined ) { - deprecated( '`__unstableShift` prop in wp.components.Popover', { - since: '6.1', - version: '6.3', - alternative: '`shift` prop`', - } ); - - // Back-compat. - shouldShift = __unstableShift; - } - if ( anchorRef !== undefined ) { deprecated( '`anchorRef` prop in wp.components.Popover', { since: '6.1', - version: '6.3', alternative: '`anchor` prop', } ); } @@ -239,7 +217,6 @@ const UnforwardedPopover = ( if ( anchorRect !== undefined ) { deprecated( '`anchorRect` prop in wp.components.Popover', { since: '6.1', - version: '6.3', alternative: '`anchor` prop', } ); } @@ -247,7 +224,6 @@ const UnforwardedPopover = ( if ( getAnchorRect !== undefined ) { deprecated( '`getAnchorRect` prop in wp.components.Popover', { since: '6.1', - version: '6.3', alternative: '`anchor` prop', } ); } @@ -325,7 +301,7 @@ const UnforwardedPopover = ( }, } ) : undefined, - shouldShift + shift ? shiftMiddleware( { crossAxis: true, limiter: customLimitShift(), From d280789e6c76728e01e82e7353c01b5d6136c199 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Fri, 21 Oct 2022 16:41:31 +0800 Subject: [PATCH 2/4] Also remove from docs and types --- packages/components/src/popover/README.md | 12 +++--------- packages/components/src/popover/types.ts | 14 -------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/packages/components/src/popover/README.md b/packages/components/src/popover/README.md index 85ae701894616d..2e892cf2d0ea3a 100644 --- a/packages/components/src/popover/README.md +++ b/packages/components/src/popover/README.md @@ -92,7 +92,7 @@ The element should be stored in state rather than a plain ref to ensure reactive ### `anchorRect`: `DomRectWithOwnerDocument` -_Note: this prop is deprecated and will be removed in WordPress 6.3. Please use the `anchor` prop instead._ +_Note: this prop is deprecated. Please use the `anchor` prop instead._ An object extending a `DOMRect` with an additional optional `ownerDocument` property, used to specify a fixed popover position. @@ -100,7 +100,7 @@ An object extending a `DOMRect` with an additional optional `ownerDocument` prop ### `anchorRef`: `Element | PopoverAnchorRefReference | PopoverAnchorRefTopBottom | Range` -_Note: this prop is deprecated and will be removed in WordPress 6.3. Please use the `anchor` prop instead._ +_Note: this prop is deprecated. Please use the `anchor` prop instead._ Used to specify a fixed popover position. It can be an `Element`, a React reference to an `element`, an object with a `top` and a `bottom` properties (both pointing to elements), or a `range`. @@ -157,7 +157,7 @@ When not provided, the `onClose` callback will be called instead. ### `getAnchorRect`: `( fallbackReferenceElement: Element | null ) => DomRectWithOwnerDocument` -_Note: this prop is deprecated and will be removed in WordPress 6.3. Please use the `anchor` prop instead._ +_Note: this prop is deprecated. Please use the `anchor` prop instead._ A function returning the same value as the one expected by the `anchorRect` prop, used to specify a dynamic popover position. @@ -222,9 +222,3 @@ Adjusts the size of the popover to prevent its contents from going out of view w - Required: No - Default: `true` - -### `range`: `unknown` - -_Note: this prop is deprecated and will be removed in WordPress 6.3. It has no effect on the component._ - -- Required: No diff --git a/packages/components/src/popover/types.ts b/packages/components/src/popover/types.ts index 2f738ca76a3a94..6407720f82f257 100644 --- a/packages/components/src/popover/types.ts +++ b/packages/components/src/popover/types.ts @@ -148,14 +148,6 @@ export type PopoverProps = { * @deprecated */ __unstableForcePosition?: boolean; - /** - * Enables the `Popover` to shift in order to stay in view when meeting the - * viewport edges. - * _Note: this prop is deprecated. Use the `shift` prop instead._ - * - * @deprecated - */ - __unstableShift?: boolean; /** * An object extending a `DOMRect` with an additional optional `ownerDocument` * property, used to specify a fixed popover position. @@ -184,10 +176,4 @@ export type PopoverProps = { getAnchorRect?: ( fallbackReferenceElement: Element | null ) => DomRectWithOwnerDocument; - /** - * _Note: this prop is deprecated and has no effect on the component._ - * - * @deprecated - */ - range?: unknown; }; From 1f833618c5be505f15e457bcd9f7fbfa63919182 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Fri, 21 Oct 2022 16:47:05 +0800 Subject: [PATCH 3/4] Update changelog --- packages/components/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 22f479e5a5dcbe..4647f2137e600b 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -2,6 +2,14 @@ ## Unreleased +### Breaking Changes + +- `Popover`: The deprecated `range` and `__unstableShift` props have been removed ([#45195](https://github.com/WordPress/gutenberg/pull/45195)). + +### Deprecations + +- `Popover`: the deprecation messages for anchor-related props (`anchorRef`, `anchorRect`, `getAnchorRect`) has been updated. ([#45195](https://github.com/WordPress/gutenberg/pull/45195)). + ### New Feature - `BoxControl` & `CustomSelectControl`: Add `onMouseOver` and `onMouseOut` callback props to allow handling of these events by parent components ([#44955](https://github.com/WordPress/gutenberg/pull/44955)) From cab69016851b698d25b1171b24affcf99fe0512d Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Tue, 25 Oct 2022 13:53:03 +0200 Subject: [PATCH 4/4] Update packages/components/CHANGELOG.md --- packages/components/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 4647f2137e600b..5dae0ca3ab453a 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -8,7 +8,7 @@ ### Deprecations -- `Popover`: the deprecation messages for anchor-related props (`anchorRef`, `anchorRect`, `getAnchorRect`) has been updated. ([#45195](https://github.com/WordPress/gutenberg/pull/45195)). +- `Popover`: the deprecation messages for anchor-related props (`anchorRef`, `anchorRect`, `getAnchorRect`) have been updated. ([#45195](https://github.com/WordPress/gutenberg/pull/45195)). ### New Feature