From da52b5fb5d84455a46dcc43a4411afb4df928f95 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Wed, 26 Oct 2022 08:53:20 +0800 Subject: [PATCH] Fix popover deprecations (#45195) * Fix popover deprecations * Also remove from docs and types * Update changelog * Update packages/components/CHANGELOG.md Co-authored-by: Marco Ciampini --- packages/components/CHANGELOG.md | 19 +++++++++++++++++ packages/components/src/popover/README.md | 12 +++-------- packages/components/src/popover/index.tsx | 26 +---------------------- packages/components/src/popover/types.ts | 14 ------------ 4 files changed, 23 insertions(+), 48 deletions(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index bf32aadd73ff5..284dc43cd879e 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -2,6 +2,25 @@ ## Unreleased +<<<<<<< HEAD +======= +### 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`) have 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)) + +## Enhancements + +- `FontSizePicker`: Improved slider design when `withSlider` is set ([#44598](https://github.com/WordPress/gutenberg/pull/44598)). + +>>>>>>> 00e632aff9 (Fix popover deprecations (#45195)) ### Bug Fix - `FontSizePicker`: Ensure that fluid font size presets appear correctly in the UI controls ([#44791](https://github.com/WordPress/gutenberg/pull/44791)) diff --git a/packages/components/src/popover/README.md b/packages/components/src/popover/README.md index 85ae701894616..2e892cf2d0ea3 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/index.tsx b/packages/components/src/popover/index.tsx index 25bb157247a36..db9104605f26b 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(), diff --git a/packages/components/src/popover/types.ts b/packages/components/src/popover/types.ts index b80e266c1fe2c..30ddbf06ca586 100644 --- a/packages/components/src/popover/types.ts +++ b/packages/components/src/popover/types.ts @@ -147,14 +147,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. @@ -183,10 +175,4 @@ export type PopoverProps = { getAnchorRect?: ( fallbackReferenceElement: Element | null ) => DomRectWithOwnerDocument; - /** - * _Note: this prop is deprecated and has no effect on the component._ - * - * @deprecated - */ - range?: unknown; };