Skip to content

Commit

Permalink
RadioGroup: Mark as deprecated (#45389)
Browse files Browse the repository at this point in the history
* RadioGroup: Mark as deprecated

* Remove separate story for Radio

* Move into subfolders

* Update changelog
  • Loading branch information
mirka authored Nov 1, 2022
1 parent 3e7a5e9 commit 5ff5acd
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 27 deletions.
2 changes: 2 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Deprecations

- `Popover`: the deprecation messages for anchor-related props (`anchorRef`, `anchorRect`, `getAnchorRect`) have been updated ([#45195](https://github.com/WordPress/gutenberg/pull/45195)).
- `RadioGroup`: Mark as deprecated, in favor of `RadioControl` and `ToggleGroupControl` ([#45389](https://github.com/WordPress/gutenberg/pull/45389)).
- `Popover`: the deprecation messages for anchor-related props (`anchorRef`, `anchorRect`, `getAnchorRect`) have been updated. ([#45195](https://github.com/WordPress/gutenberg/pull/45195)).
- `Popover`: The `isAlternate` prop has been replaced with a `variant` prop that can be called with the `'toolbar'` string ([#45137](https://github.com/WordPress/gutenberg/pull/45137)).

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export { default as PanelRow } from './panel/row';
export { default as Placeholder } from './placeholder';
export { default as Popover } from './popover';
export { default as QueryControls } from './query-controls';
export { default as __experimentalRadio } from './radio';
export { default as __experimentalRadio } from './radio-group/radio';
export { default as __experimentalRadioGroup } from './radio-group';
export { default as RadioControl } from './radio-control';
export { default as RangeControl } from './range-control';
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/radio-group/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# RadioGroup

<div class="callout callout-alert">
This component is deprecated. Consider using `RadioControl` or `ToggleGroupControl` instead.
</div>

<div class="callout callout-alert">
This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
</div>
Expand Down
7 changes: 6 additions & 1 deletion packages/components/src/radio-group/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck

/**
* External dependencies
*/
Expand All @@ -12,7 +14,7 @@ import { forwardRef } from '@wordpress/element';
* Internal dependencies
*/
import ButtonGroup from '../button-group';
import RadioContext from '../radio-context';
import RadioContext from './radio-context';

function RadioGroup(
{ label, checked, defaultChecked, disabled, onChange, ...props },
Expand Down Expand Up @@ -43,4 +45,7 @@ function RadioGroup(
);
}

/**
* @deprecated Use `RadioControl` or `ToggleGroupControl` instead.
*/
export default forwardRef( RadioGroup );
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck

/**
* External dependencies
*/
Expand All @@ -11,7 +13,7 @@ import { useContext, forwardRef } from '@wordpress/element';
/**
* Internal dependencies
*/
import Button from '../button';
import Button from '../../button';
import RadioContext from '../radio-context';

function Radio( { children, value, ...props }, ref ) {
Expand All @@ -32,4 +34,7 @@ function Radio( { children, value, ...props }, ref ) {
);
}

/**
* @deprecated Use `RadioControl` or `ToggleGroupControl` instead.
*/
export default forwardRef( Radio );
13 changes: 11 additions & 2 deletions packages/components/src/radio-group/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ import { useState } from '@wordpress/element';
/**
* Internal dependencies
*/
import Radio from '../../radio';
import Radio from '../radio';
import RadioGroup from '../';

export default {
title: 'Components (Experimental)/RadioGroup',
title: 'Components (Deprecated)/RadioGroup',
subcomponents: { Radio },
component: RadioGroup,
parameters: {
docs: {
description: {
component:
'This component is deprecated. Use `RadioControl` or `ToggleGroupControl` instead.',
},
},
},
};

export const _default = () => {
Expand Down
20 changes: 0 additions & 20 deletions packages/components/src/radio/stories/index.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@
"src/palette-edit",
"src/panel",
"src/query-controls",
"src/radio",
"src/radio-group",
"src/responsive-wrapper",
"src/sandbox",
"src/snackbar",
Expand Down

0 comments on commit 5ff5acd

Please sign in to comment.