diff --git a/packages/block-editor/src/components/background-image-control/index.js b/packages/block-editor/src/components/background-image-control/index.js index 20cdd4d02cb44a..3b765302100ecc 100644 --- a/packages/block-editor/src/components/background-image-control/index.js +++ b/packages/block-editor/src/components/background-image-control/index.js @@ -9,7 +9,6 @@ import clsx from 'clsx'; import { ToggleControl, __experimentalToggleGroupControl as ToggleGroupControl, - __experimentalToggleGroupControlOption as ToggleGroupControlOption, __experimentalUnitControl as UnitControl, __experimentalVStack as VStack, DropZone, @@ -580,7 +579,7 @@ function BackgroundSizeControls( { sizeValue || defaultValues?.backgroundSize ) } > - - - { variations.map( ( variation ) => ( - diff --git a/packages/block-editor/src/components/child-layout-control/index.js b/packages/block-editor/src/components/child-layout-control/index.js index 7f3c7c16188ede..6a166a963a5f62 100644 --- a/packages/block-editor/src/components/child-layout-control/index.js +++ b/packages/block-editor/src/components/child-layout-control/index.js @@ -3,7 +3,6 @@ */ import { __experimentalToggleGroupControl as ToggleGroupControl, - __experimentalToggleGroupControlOption as ToggleGroupControlOption, __experimentalUnitControl as UnitControl, __experimentalInputControl as InputControl, __experimentalHStack as HStack, @@ -152,7 +151,7 @@ function FlexControls( { } } isBlock > - - - { options.map( ( option ) => ( - diff --git a/packages/block-editor/src/components/image-size-control/index.js b/packages/block-editor/src/components/image-size-control/index.js index 1cd2b51054e7ee..d62bbe17532959 100644 --- a/packages/block-editor/src/components/image-size-control/index.js +++ b/packages/block-editor/src/components/image-size-control/index.js @@ -6,7 +6,6 @@ import { __experimentalNumberControl as NumberControl, __experimentalHStack as HStack, __experimentalToggleGroupControl as ToggleGroupControl, - __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; @@ -134,7 +133,7 @@ export default function ImageSizeControl( { > { IMAGE_SIZE_PRESETS.map( ( scale ) => { return ( - { validOptions.map( ( option ) => { return ( - { TEXT_DECORATIONS.map( ( option ) => { return ( - { TEXT_TRANSFORMS.map( ( option ) => { return ( - { WRITING_MODES.map( ( option ) => { return ( - { getLayoutTypes().map( ( { name, label } ) => { return ( - { return ( - { justificationOptions.map( ( { value, icon, label } ) => { return ( - - - - - { [ 25, 50, 75, 100 ].map( ( widthValue ) => { return ( - - - - { return ( - - - - diff --git a/packages/block-library/src/navigation/edit/overlay-menu-preview.js b/packages/block-library/src/navigation/edit/overlay-menu-preview.js index cdd4d6e3263c98..7bf84a0e1592c8 100644 --- a/packages/block-library/src/navigation/edit/overlay-menu-preview.js +++ b/packages/block-library/src/navigation/edit/overlay-menu-preview.js @@ -4,7 +4,6 @@ import { ToggleControl, __experimentalToggleGroupControl as ToggleGroupControl, - __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; @@ -35,12 +34,12 @@ export default function OverlayMenuPreview( { setAttributes, hasIcon, icon } ) { onChange={ ( value ) => setAttributes( { icon: value } ) } isBlock > - } /> - } diff --git a/packages/block-library/src/post-featured-image/dimension-controls.js b/packages/block-library/src/post-featured-image/dimension-controls.js index 4bc343635f2f93..acf1cca32224b8 100644 --- a/packages/block-library/src/post-featured-image/dimension-controls.js +++ b/packages/block-library/src/post-featured-image/dimension-controls.js @@ -6,7 +6,6 @@ import { SelectControl, __experimentalUnitControl as UnitControl, __experimentalToggleGroupControl as ToggleGroupControl, - __experimentalToggleGroupControlOption as ToggleGroupControlOption, __experimentalUseCustomUnits as useCustomUnits, __experimentalToolsPanelItem as ToolsPanelItem, } from '@wordpress/components'; @@ -14,18 +13,18 @@ import { useSettings } from '@wordpress/block-editor'; const SCALE_OPTIONS = ( <> - - - diff --git a/packages/block-library/src/post-navigation-link/edit.js b/packages/block-library/src/post-navigation-link/edit.js index bbdacfeb773978..5a6ef1fbda153e 100644 --- a/packages/block-library/src/post-navigation-link/edit.js +++ b/packages/block-library/src/post-navigation-link/edit.js @@ -8,7 +8,6 @@ import clsx from 'clsx'; */ import { __experimentalToggleGroupControl as ToggleGroupControl, - __experimentalToggleGroupControlOption as ToggleGroupControlOption, ToggleControl, SelectControl, PanelBody, @@ -135,21 +134,21 @@ export default function PostNavigationLinkEdit( { ) } isBlock > - - - - - - - - @@ -276,7 +275,7 @@ export default function QueryInspectorControls( props ) { > { postTypesSelectOptions.map( ( option ) => ( - { PERCENTAGE_WIDTHS.map( ( widthValue ) => { return ( - { BORDER_STYLES.map( ( borderStyle ) => ( - - - diff --git a/packages/components/src/font-size-picker/font-size-picker-toggle-group.tsx b/packages/components/src/font-size-picker/font-size-picker-toggle-group.tsx index 1b3619c800e453..5b4eef33c12539 100644 --- a/packages/components/src/font-size-picker/font-size-picker-toggle-group.tsx +++ b/packages/components/src/font-size-picker/font-size-picker-toggle-group.tsx @@ -6,10 +6,7 @@ import { __ } from '@wordpress/i18n'; /** * Internal dependencies */ -import { - ToggleGroupControl, - ToggleGroupControlOption, -} from '../toggle-group-control'; +import { ToggleGroupControl } from '../toggle-group-control'; import { T_SHIRT_ABBREVIATIONS, T_SHIRT_NAMES } from './constants'; import type { FontSizePickerToggleGroupProps } from './types'; @@ -28,7 +25,7 @@ const FontSizePickerToggleGroup = ( props: FontSizePickerToggleGroupProps ) => { size={ size } > { fontSizes.map( ( fontSize, index ) => ( - + ); diff --git a/packages/components/src/index.ts b/packages/components/src/index.ts index 2acd609992d6ad..bd85b61ae6ece7 100644 --- a/packages/components/src/index.ts +++ b/packages/components/src/index.ts @@ -175,11 +175,7 @@ export { default as TextareaControl } from './textarea-control'; export { default as TextHighlight } from './text-highlight'; export { default as Tip } from './tip'; export { default as ToggleControl } from './toggle-control'; -export { - ToggleGroupControl as __experimentalToggleGroupControl, - ToggleGroupControlOption as __experimentalToggleGroupControlOption, - ToggleGroupControlOptionIcon as __experimentalToggleGroupControlOptionIcon, -} from './toggle-group-control'; +export { ToggleGroupControl as __experimentalToggleGroupControl } from './toggle-group-control'; export { Toolbar, ToolbarButton, diff --git a/packages/components/src/toggle-group-control/README.md b/packages/components/src/toggle-group-control/README.md new file mode 100644 index 00000000000000..e3fea28bd36191 --- /dev/null +++ b/packages/components/src/toggle-group-control/README.md @@ -0,0 +1,158 @@ +# ToggleGroupControl + + + +

See the WordPress Storybook for more detailed, interactive documentation.

+ +ToggleGroupControl is a form component that lets users choose options +from a group of toggle buttons. It provides a single-selection interface +with a consistent visual design. + +## Props + +### `__nextHasNoMarginBottom` + + - Type: `boolean` + - Required: No + - Default: `false` + +Start opting into the new margin-free styles that will become the default in a future version. + +### `__next40pxDefaultSize` + + - Type: `boolean` + - Required: No + - Default: `false` + +Start opting into the larger default height that will become the default size in a future version. + +### `children` + + - Type: `ReactNode` + - Required: Yes + +The options to render in the `ToggleGroupControl`, using either the `ToggleGroupControlOption` or +`ToggleGroupControlOptionIcon` components. + +### `help` + + - Type: `ReactNode` + - Required: No + +Additional description for the control. + +Only use for meaningful description or instructions for the control. An element containing the description will be programmatically associated to the BaseControl by the means of an `aria-describedby` attribute. + +### `hideLabelFromVision` + + - Type: `boolean` + - Required: No + - Default: `false` + +If true, the label will only be visible to screen readers. + +### `isAdaptiveWidth` + + - Type: `boolean` + - Required: No + - Default: `false` + +Determines if segments should be rendered with equal widths. + +### `isBlock` + + - Type: `boolean` + - Required: No + - Default: `false` + +Renders `ToggleGroupControl` as a (CSS) block element, spanning the entire width of +the available space. This is the recommended style when the options are text-based and not icons. + +### `isDeselectable` + + - Type: `boolean` + - Required: No + - Default: `false` + +Whether an option can be deselected by clicking it again. + +### `label` + + - Type: `string` + - Required: Yes + +Label for the control. + +### `onChange` + + - Type: `(value: string | number) => void` + - Required: No + +Callback when a segment is selected. + +### `size` + + - Type: `"default" | "__unstable-large"` + - Required: No + - Default: `'default'` + +The size variant of the control. + +### `value` + + - Type: `string | number` + - Required: No + +The selected value. + +## Subcomponents + +### ToggleGroupControl.Option + +#### Props + +##### `label` + + - Type: `string` + - Required: Yes + +Label for the option. If needed, the `aria-label` prop can be used in addition +to specify a different label for assistive technologies. + +##### `showTooltip` + + - Type: `boolean` + - Required: No + - Default: `false` + +Whether to display a Tooltip for the control option. If set to `true`, the tooltip will +show the aria-label or the label prop text. + +##### `value` + + - Type: `string | number` + - Required: Yes + +### ToggleGroupControl.OptionIcon + +#### Props + +##### `icon` + + - Type: `Element` + - Required: Yes + +Icon displayed as the content of the option. Usually one of the icons from +the `@wordpress/icons` package, or a custom React `` icon. + +##### `label` + + - Type: `string` + - Required: Yes + +The text to accessibly label the icon option. Will also be shown in a tooltip. + +##### `value` + + - Type: `string | number` + - Required: Yes diff --git a/packages/components/src/toggle-group-control/docs-manifest.json b/packages/components/src/toggle-group-control/docs-manifest.json new file mode 100644 index 00000000000000..c9ddf10ccca309 --- /dev/null +++ b/packages/components/src/toggle-group-control/docs-manifest.json @@ -0,0 +1,17 @@ +{ + "$schema": "../../schemas/docs-manifest.json", + "displayName": "ToggleGroupControl", + "filePath": "./index.ts", + "subcomponents": [ + { + "displayName": "ToggleGroupControlOption", + "preferredDisplayName": "ToggleGroupControl.Option", + "filePath": "./toggle-group-control-option/index.ts" + }, + { + "displayName": "ToggleGroupControlOptionIcon", + "preferredDisplayName": "ToggleGroupControl.OptionIcon", + "filePath": "./toggle-group-control-option-icon/index.ts" + } + ] +} diff --git a/packages/components/src/toggle-group-control/index.ts b/packages/components/src/toggle-group-control/index.ts index e5e40497d9220e..85cd8696d157f4 100644 --- a/packages/components/src/toggle-group-control/index.ts +++ b/packages/components/src/toggle-group-control/index.ts @@ -1,3 +1,30 @@ -export { ToggleGroupControl } from './toggle-group-control'; -export { ToggleGroupControlOption } from './toggle-group-control-option'; -export { ToggleGroupControlOptionIcon } from './toggle-group-control-option-icon'; +/** + * Internal dependencies + */ +import { ToggleGroupControl as BaseToggleGroupControl } from './toggle-group-control'; +import { ToggleGroupControlOption } from './toggle-group-control-option'; +import { ToggleGroupControlOptionIcon } from './toggle-group-control-option-icon'; + +/** + * ToggleGroupControl is a form component that lets users choose options + * from a group of toggle buttons. It provides a single-selection interface + * with a consistent visual design. + */ +export const ToggleGroupControl = Object.assign( BaseToggleGroupControl, { + /** + * Renders a standard toggle option button within a ToggleGroupControl. + * Used for text-based toggle options. + */ + Option: Object.assign( ToggleGroupControlOption, { + displayName: 'ToggleGroupControl.Option', + } ), + /** + * Renders an icon toggle option button within a ToggleGroupControl. + * Used for icon-based toggle options. + */ + OptionIcon: Object.assign( ToggleGroupControlOptionIcon, { + displayName: 'ToggleGroupControl.OptionIcon', + } ), +} ); + +export default ToggleGroupControl; diff --git a/packages/components/src/toggle-group-control/stories/best-practices.mdx b/packages/components/src/toggle-group-control/stories/best-practices.mdx new file mode 100644 index 00000000000000..18b715a25ccbc3 --- /dev/null +++ b/packages/components/src/toggle-group-control/stories/best-practices.mdx @@ -0,0 +1,33 @@ +# `ToggleGroupControl` + +
+ This feature is still experimental. “Experimental” means this is an early + implementation subject to drastic and breaking changes. +
+ +`ToggleGroupControl` is a form component that lets users choose options represented in horizontal segments. To render options for this control use [`ToggleGroupControlOption`](/packages/components/src/toggle-group-control/toggle-group-control-option/README.md) component. + +This component is intended for selecting a single persistent value from a set of options, similar to a how a radio button group would work. If you simply want a toggle to switch between views, use a [`TabPanel`](/packages/components/src/tab-panel/README.md) instead. + +Only use this control when you know for sure the labels of items inside won't wrap. For items with longer labels, you can consider a [`SelectControl`](/packages/components/src/select-control/README.md) or a [`CustomSelectControl`](/packages/components/src/custom-select-control/README.md) component instead. + +## Usage + +```js +import { __experimentalToggleGroupControl as ToggleGroupControl } from '@wordpress/components'; + +function Example() { + return ( + + + + + ); +} +``` diff --git a/packages/components/src/toggle-group-control/stories/index.story.tsx b/packages/components/src/toggle-group-control/stories/index.story.tsx index 0f3c0a299617af..457a2453ff0646 100644 --- a/packages/components/src/toggle-group-control/stories/index.story.tsx +++ b/packages/components/src/toggle-group-control/stories/index.story.tsx @@ -12,11 +12,7 @@ import { formatLowercase, formatUppercase } from '@wordpress/icons'; /** * Internal dependencies */ -import { - ToggleGroupControl, - ToggleGroupControlOption, - ToggleGroupControlOptionIcon, -} from '../index'; +import { ToggleGroupControl } from '../index'; import type { ToggleGroupControlOptionProps, ToggleGroupControlOptionIconProps, @@ -25,8 +21,12 @@ import type { const meta: Meta< typeof ToggleGroupControl > = { component: ToggleGroupControl, - // @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170 - subcomponents: { ToggleGroupControlOption, ToggleGroupControlOptionIcon }, + subcomponents: { + // @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170 + Option: ToggleGroupControl.Option, + // @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170 + OptionIcon: ToggleGroupControl.OptionIcon, + }, title: 'Components (Experimental)/Selection & Input/ToggleGroupControl', id: 'components-experimental-togglegroupcontrol', argTypes: { @@ -66,14 +66,14 @@ const mapPropsToOptionComponent = ( { value, ...props }: ToggleGroupControlOptionProps ) => ( - + ); const mapPropsToOptionIconComponent = ( { value, ...props }: ToggleGroupControlOptionIconProps ) => ( - + ); export const Default: StoryFn< typeof ToggleGroupControl > = Template.bind( diff --git a/packages/components/src/toggle-group-control/test/index.tsx b/packages/components/src/toggle-group-control/test/index.tsx index 28928a9735a378..7d2bcb11c9e14e 100644 --- a/packages/components/src/toggle-group-control/test/index.tsx +++ b/packages/components/src/toggle-group-control/test/index.tsx @@ -14,11 +14,7 @@ import { formatLowercase, formatUppercase } from '@wordpress/icons'; * Internal dependencies */ import Button from '../../button'; -import { - ToggleGroupControl as _ToggleGroupControl, - ToggleGroupControlOption, - ToggleGroupControlOptionIcon, -} from '../index'; +import { ToggleGroupControl as _ToggleGroupControl } from '../index'; import { TOOLTIP_DELAY } from '../../tooltip'; import type { ToggleGroupControlProps } from '../types'; @@ -77,19 +73,19 @@ const ControlledToggleGroupControl = ( { }; const options = ( <> - - + <_ToggleGroupControl.Option value="rigas" label="R" /> + <_ToggleGroupControl.Option value="jack" label="J" /> ); const optionsWithTooltip = ( <> - - - - - + <_ToggleGroupControl.Option value="pizza" label="Pizza" /> + <_ToggleGroupControl.Option value="rice" label="Rice" disabled /> + <_ToggleGroupControl.Option value="pasta" label="Pasta" /> ); @@ -124,12 +120,12 @@ describe.each( [ it( 'with icons', () => { const { container } = render( - - - * - * + * + * * * ); * } diff --git a/packages/components/src/toggle-group-control/toggle-group-control-option-icon/README.md b/packages/components/src/toggle-group-control/toggle-group-control-option-icon/README.md index 1ee82b26a91998..6114d64a3fd35b 100644 --- a/packages/components/src/toggle-group-control/toggle-group-control-option-icon/README.md +++ b/packages/components/src/toggle-group-control/toggle-group-control-option-icon/README.md @@ -4,26 +4,23 @@ This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes. -`ToggleGroupControlOptionIcon` is a form component which is meant to be used as a child of [`ToggleGroupControl`](/packages/components/src/toggle-group-control/toggle-group-control/README.md) and displays an icon. +`ToggleGroupControl.OptionIcon` is a form component which is meant to be used as a child of [`ToggleGroupControl`](/packages/components/src/toggle-group-control/toggle-group-control/README.md) and displays an icon. ## Usage ```js -import { - __experimentalToggleGroupControl as ToggleGroupControl, - __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, -} from '@wordpress/components'; +import { __experimentalToggleGroupControl as ToggleGroupControl } from '@wordpress/components'; import { formatLowercase, formatUppercase } from '@wordpress/icons'; function Example() { return ( - - - * - * -`ToggleGroupControlOption` is a form component and is meant to be used as a child of [`ToggleGroupControl`](/packages/components/src/toggle-group-control/toggle-group-control/README.md). +`ToggleGroupControl.Option` is a form component and is meant to be used as a child of [`ToggleGroupControl`](/packages/components/src/toggle-group-control/toggle-group-control/README.md). ## Usage ```js -import { - __experimentalToggleGroupControl as ToggleGroupControl, - __experimentalToggleGroupControlOption as ToggleGroupControlOption, -} from '@wordpress/components'; +import { __experimentalToggleGroupControl as ToggleGroupControl } from '@wordpress/components'; function Example() { return ( @@ -23,12 +20,12 @@ function Example() { __nextHasNoMarginBottom __next40pxDefaultSize > - - + ); } diff --git a/packages/components/src/toggle-group-control/toggle-group-control-option/component.tsx b/packages/components/src/toggle-group-control/toggle-group-control-option/component.tsx index 8632d92fc00578..74238e15657f89 100644 --- a/packages/components/src/toggle-group-control/toggle-group-control-option/component.tsx +++ b/packages/components/src/toggle-group-control/toggle-group-control-option/component.tsx @@ -37,13 +37,12 @@ function UnforwardedToggleGroupControlOption( } /** - * `ToggleGroupControlOption` is a form component and is meant to be used as a + * `ToggleGroupControl.Option` is a form component and is meant to be used as a * child of `ToggleGroupControl`. * * ```jsx * import { * __experimentalToggleGroupControl as ToggleGroupControl, - * __experimentalToggleGroupControlOption as ToggleGroupControlOption, * } from '@wordpress/components'; * * function Example() { @@ -55,8 +54,8 @@ function UnforwardedToggleGroupControlOption( * __nextHasNoMarginBottom * __next40pxDefaultSize * > - * - * + * + * * * ); * } diff --git a/packages/components/src/toggle-group-control/toggle-group-control/README.md b/packages/components/src/toggle-group-control/toggle-group-control/README.md deleted file mode 100644 index 841d474c148d45..00000000000000 --- a/packages/components/src/toggle-group-control/toggle-group-control/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# `ToggleGroupControl` - -
-This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes. -
- -`ToggleGroupControl` is a form component that lets users choose options represented in horizontal segments. To render options for this control use [`ToggleGroupControlOption`](/packages/components/src/toggle-group-control/toggle-group-control-option/README.md) component. - -This component is intended for selecting a single persistent value from a set of options, similar to a how a radio button group would work. If you simply want a toggle to switch between views, use a [`TabPanel`](/packages/components/src/tab-panel/README.md) instead. - -Only use this control when you know for sure the labels of items inside won't wrap. For items with longer labels, you can consider a [`SelectControl`](/packages/components/src/select-control/README.md) or a [`CustomSelectControl`](/packages/components/src/custom-select-control/README.md) component instead. - -## Usage - -```js -import { - __experimentalToggleGroupControl as ToggleGroupControl, - __experimentalToggleGroupControlOption as ToggleGroupControlOption, -} from '@wordpress/components'; - -function Example() { - return ( - - - - - ); -} -``` - -## Props - -### `help`: `ReactNode` - -If this property is added, a help text will be generated using help property as the content. - -- Required: No - -### `hideLabelFromVision`: `boolean` - -If true, the label will only be visible to screen readers. - -- Required: No -- Default: `false` - -### `isAdaptiveWidth`: `boolean` - -Determines if segments should be rendered with equal widths. - -- Required: No -- Default: `false` - -### `isDeselectable`: `boolean` - -Whether an option can be deselected by clicking it again. - -- Required: No -- Default: `false` - -### `isBlock`: `boolean` - -Renders `ToggleGroupControl` as a (CSS) block element, spanning the entire width of the available space. This is the recommended style when the options are text-based and not icons. - -- Required: No -- Default: `false` - -### `label`: `string` - -Label for the form element. - -- Required: Yes - -### `onChange`: `( value?: string | number ) => void` - -Callback when a segment is selected. - -- Required: No -- Default: `() => {}` - -### `value`: `string | number` - -The value of the `ToggleGroupControl`. - -- Required: No - -### `__next40pxDefaultSize`: `boolean` - -Start opting into the larger default height that will become the default size in a future version. - -- Required: No -- Default: `false` - -### `__nextHasNoMarginBottom`: `boolean` - -Start opting into the new margin-free styles that will become the default in a future version. - -- Required: No -- Default: `false` diff --git a/packages/components/src/toggle-group-control/toggle-group-control/component.tsx b/packages/components/src/toggle-group-control/toggle-group-control/component.tsx index 9f3427e95a6017..ae90e8cd5224a3 100644 --- a/packages/components/src/toggle-group-control/toggle-group-control/component.tsx +++ b/packages/components/src/toggle-group-control/toggle-group-control/component.tsx @@ -121,7 +121,7 @@ function UnconnectedToggleGroupControl( /** * `ToggleGroupControl` is a form component that lets users choose options * represented in horizontal segments. To render options for this control use - * `ToggleGroupControlOption` component. + * `ToggleGroupControl.Option` component. * * This component is intended for selecting a single persistent value from a set of options, * similar to a how a radio button group would work. If you simply want a toggle to switch between views, @@ -134,7 +134,6 @@ function UnconnectedToggleGroupControl( * ```jsx * import { * __experimentalToggleGroupControl as ToggleGroupControl, - * __experimentalToggleGroupControlOption as ToggleGroupControlOption, * } from '@wordpress/components'; * * function Example() { @@ -146,8 +145,8 @@ function UnconnectedToggleGroupControl( * __nextHasNoMarginBottom * __next40pxDefaultSize * > - * - * + * + * * * ); * } diff --git a/packages/components/src/toggle-group-control/types.ts b/packages/components/src/toggle-group-control/types.ts index cfa9d00080467c..e6f926ba3c6ee3 100644 --- a/packages/components/src/toggle-group-control/types.ts +++ b/packages/components/src/toggle-group-control/types.ts @@ -112,8 +112,8 @@ export type ToggleGroupControlProps = Pick< */ value?: string | number; /** - * The options to render in the `ToggleGroupControl`, using either the `ToggleGroupControlOption` or - * `ToggleGroupControlOptionIcon` components. + * The options to render in the `ToggleGroupControl`, using either the `ToggleGroupControl.Option` or + * `ToggleGroupControl.OptionIcon` components. */ children: ReactNode; /** diff --git a/packages/components/src/tools-panel/stories/index.story.tsx b/packages/components/src/tools-panel/stories/index.story.tsx index 76735c845c3ea6..0a30feb1695027 100644 --- a/packages/components/src/tools-panel/stories/index.story.tsx +++ b/packages/components/src/tools-panel/stories/index.story.tsx @@ -12,10 +12,7 @@ import { useState } from '@wordpress/element'; /** * Internal dependencies */ -import { - ToggleGroupControl, - ToggleGroupControlOption, -} from '../../toggle-group-control'; +import { ToggleGroupControl } from '../../toggle-group-control'; /** * Internal dependencies @@ -119,15 +116,15 @@ export const Default: StoryFn< typeof ToolsPanel > = ( { onChange={ ( next ) => setScale( next ) } isBlock > - - - @@ -477,12 +474,15 @@ export const WithConditionalDefaultControl: StoryFn< typeof ToolsPanel > = ( { } isBlock > - - + - + @@ -581,15 +581,15 @@ export const WithConditionallyRenderedControl: StoryFn< } isBlock > - - - diff --git a/packages/dataviews/src/components/dataviews-view-config/index.tsx b/packages/dataviews/src/components/dataviews-view-config/index.tsx index c80591caee255e..786a50616fa46b 100644 --- a/packages/dataviews/src/components/dataviews-view-config/index.tsx +++ b/packages/dataviews/src/components/dataviews-view-config/index.tsx @@ -12,8 +12,6 @@ import { __experimentalDropdownContentWrapper as DropdownContentWrapper, Dropdown, __experimentalToggleGroupControl as ToggleGroupControl, - __experimentalToggleGroupControlOption as ToggleGroupControlOption, - __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, SelectControl, __experimentalItemGroup as ItemGroup, __experimentalItem as Item, @@ -206,7 +204,7 @@ function SortDirectionControl() { > { SORTING_DIRECTIONS.map( ( direction ) => { return ( - { PAGE_SIZE_VALUES.map( ( value ) => { return ( - - - - - - - - - - - - -