Skip to content

Commit

Permalink
InputControl: Allow inline styles to be applied to wrapper instead of…
Browse files Browse the repository at this point in the history
… inner input (#45340)
  • Loading branch information
aaronrobertshaw committed Nov 1, 2022
1 parent 18bca71 commit 9448204
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,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

0 comments on commit 9448204

Please sign in to comment.