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

InputControl: Allow inline styles to be applied to wrapper instead of inner input #45340

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- `FontSizePicker`: Fallback to font size `slug` if `name` is undefined ([#45041](https://github.com/WordPress/gutenberg/pull/45041)).
- `AutocompleterUI`: fix issue where autocompleter UI would appear on top of other UI elements ([#44795](https://github.com/WordPress/gutenberg/pull/44795/))
- `ExternalLink`: Fix to re-enable support for `onClick` event handler ([#45214](https://github.com/WordPress/gutenberg/pull/45214)).
- `InputControl`: Allow inline styles to be applied to the wrapper not inner input ([#45340](https://github.com/WordPress/gutenberg/pull/45340/))

### Internal

Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/input-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export function UnforwardedInputControl(
onKeyDown = noop,
prefix,
size = 'default',
style,
suffix,
value,
...props
Expand Down Expand Up @@ -77,6 +78,7 @@ export function UnforwardedInputControl(
labelPosition={ labelPosition }
prefix={ prefix }
size={ size }
style={ style }
suffix={ suffix }
>
<InputField
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/input-control/input-base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
getSizeConfig,
} from './styles/input-control-styles';
import type { InputBaseProps, LabelPosition } from './types';
import { ContextSystemProvider } from '../ui/context';
import { ContextSystemProvider, WordPressComponentProps } from '../ui/context';

function useUniqueId( idProp?: string ) {
const instanceId = useInstanceId( InputBase );
Expand All @@ -31,7 +31,7 @@ function useUniqueId( idProp?: string ) {
return idProp || id;
}

// Adapter to map props for the new ui/flex compopnent.
// Adapter to map props for the new ui/flex component.
function getUIFlexProps( labelPosition?: LabelPosition ) {
const props: { direction?: string; gap?: number; justify?: string } = {};
switch ( labelPosition ) {
Expand Down Expand Up @@ -67,7 +67,7 @@ export function InputBase(
size = 'default',
suffix,
...props
}: InputBaseProps,
}: WordPressComponentProps< InputBaseProps, 'div' >,
ref: ForwardedRef< HTMLDivElement >
) {
const id = useUniqueId( idProp );
Expand Down
5 changes: 0 additions & 5 deletions packages/components/src/input-control/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ export interface InputBaseProps extends BaseProps, FlexProps {
* @default false
*/
disabled?: boolean;
/**
* The class name to be added to the wrapper element.
*/
className?: string;
id?: string;
/**
* If this property is added, a label will be generated using label property as the content.
*/
Expand Down