Skip to content

Commit

Permalink
both => all
Browse files Browse the repository at this point in the history
  • Loading branch information
ciampo committed Jul 2, 2024
1 parent 99495e4 commit 79175aa
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions packages/components/src/font-size-picker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ If onChange is called without any parameter, it should reset the value, attendin

- Required: Yes

### `pickerMode`: `'predefined' | 'custom' | 'both`
### `pickerMode`: `'predefined' | 'custom' | 'all`

When set to `predefined`, the user will be only able to pick a font size from the predefined list passed via the `fontSizes` prop. When set to `custom`, the user will be only able to choose a custom font size. When set to `both`, the user will be able to access both UIs through a toggle.
When set to `predefined`, the user will be only able to pick a font size from the predefined list passed via the `fontSizes` prop. When set to `custom`, the user will be only able to choose a custom font size. When set to `all`, the user will be able to access all UIs through a toggle.

- Required: No
- Default: `'both'`
- Default: `'all'`

### `size`: `'default' | '__unstable-large'`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const FontSizePickerSelect = ( props: FontSizePickerSelectProps ) => {
__experimentalHint: hint,
};
} ),
...( pickerMode === 'both' ? [ CUSTOM_OPTION ] : [] ),
...( pickerMode === 'all' ? [ CUSTOM_OPTION ] : [] ),
];

const selectedOption = value
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/font-size-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const UnforwardedFontSizePicker = (
fallbackFontSize,
fontSizes = [],
onChange,
pickerMode = 'both',
pickerMode = 'all',
size = 'default',
units: unitsProp = DEFAULT_UNITS,
value,
Expand All @@ -112,7 +112,7 @@ const UnforwardedFontSizePicker = (

let computedPickerMode = pickerMode;
if ( disableCustomFontSizes !== undefined ) {
computedPickerMode = disableCustomFontSizes ? 'predefined' : 'both';
computedPickerMode = disableCustomFontSizes ? 'predefined' : 'all';
}

const selectedFontSize = fontSizes.find(
Expand Down Expand Up @@ -173,8 +173,8 @@ const UnforwardedFontSizePicker = (
</HeaderHint>
) }
</HeaderLabel>
{ /* Show toggle button only when both picker modes are enabled */ }
{ computedPickerMode === 'both' && (
{ /* Show toggle button only when all picker modes are enabled */ }
{ computedPickerMode === 'all' && (
<HeaderToggle
label={
currentPickerType === 'custom'
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/font-size-picker/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ describe( 'FontSizePicker', () => {
expect( onChange ).toHaveBeenCalledWith( '80px' );
} );

it( 'does not allow custom values when the pickerMode mode is not "both"', () => {
it( 'does not allow custom values when the pickerMode mode is not "all"', () => {
const { rerender } = render(
<FontSizePicker
fontSizes={ fontSizes }
Expand All @@ -558,7 +558,7 @@ describe( 'FontSizePicker', () => {
).not.toBeInTheDocument();

rerender(
<FontSizePicker fontSizes={ fontSizes } pickerMode="both" />
<FontSizePicker fontSizes={ fontSizes } pickerMode="all" />
);
expect(
screen.getByRole( 'button', { name: 'Set custom size' } )
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/font-size-picker/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type FontSizePickerMode = 'predefined' | 'custom' | 'both';
export type FontSizePickerMode = 'predefined' | 'custom' | 'all';

export type FontSizePickerType = 'select' | 'togglegroup' | 'custom';

Expand All @@ -7,9 +7,9 @@ export type FontSizePickerProps = {
* When set to `predefined`, the user will be only able to pick a font size
* from the predefined list passed via the `fontSizes` prop. When set to
* `custom`, the user will be only able to choose a custom font size. When
* set to `both`, the user will be able to access both UIs through a toggle.
* set to `all`, the user will be able to access all UIs through a toggle.
*
* @default 'both'
* @default 'all'
*/
pickerMode?: FontSizePickerMode;
/**
Expand Down

0 comments on commit 79175aa

Please sign in to comment.