Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextControl: Add opt-in prop for 40px default size #55471

Merged
merged 5 commits into from Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Expand Up @@ -9,6 +9,7 @@
### Enhancements

- `ToggleGroupControl`: Add opt-in prop for 40px default size ([#55789](https://github.com/WordPress/gutenberg/pull/55789)).
- `TextControl`: Add opt-in prop for 40px default size ([#55471](https://github.com/WordPress/gutenberg/pull/55471)).

## 25.11.0 (2023-11-02)

Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/text-control/index.tsx
Expand Up @@ -2,6 +2,7 @@
* External dependencies
*/
import type { ChangeEvent, ForwardedRef } from 'react';
import classnames from 'classnames';

/**
* WordPress dependencies
Expand All @@ -22,6 +23,7 @@ function UnforwardedTextControl(
) {
const {
__nextHasNoMarginBottom,
__next40pxDefaultSize = false,
label,
hideLabelFromVision,
value,
Expand All @@ -46,7 +48,9 @@ function UnforwardedTextControl(
className={ className }
>
<input
className="components-text-control__input"
className={ classnames( 'components-text-control__input', {
'is-next-40px-default-size': __next40pxDefaultSize,
} ) }
type={ type }
id={ id }
value={ value }
Expand Down
5 changes: 5 additions & 0 deletions packages/components/src/text-control/style.scss
Expand Up @@ -13,5 +13,10 @@
.components-text-control__input[type="month"],
.components-text-control__input[type="number"] {
width: 100%;
height: $grid-unit-40;
@include input-control;

&.is-next-40px-default-size {
height: $grid-unit-50;
}
}
6 changes: 6 additions & 0 deletions packages/components/src/text-control/types.ts
Expand Up @@ -25,4 +25,10 @@ export type TextControlProps = Pick<
* @default 'text'
*/
type?: 'email' | 'number' | 'password' | 'tel' | 'text' | 'search' | 'url';
/**
* Start opting into the larger default height that will become the default size in a future version.
*
* @default false
*/
__next40pxDefaultSize?: boolean;
};