Skip to content

Commit

Permalink
NumberControl: Add TypeScript prop types (#43791)
Browse files Browse the repository at this point in the history
* NumberControl: Improve types

* Add description to InputControl classname

* RangeControl: Add ts-expect-errors

* ColorPicker: Add ts-expect-errors

* UnitControl: Get types from NumberControl

* UnitControl: Remove redundant aria-label

* NumberControl: Simplify controls in story

* Simplify `stepOverride` type

* Add string number utils

Co-authored-by: Marco Ciampini <[email protected]>

* Replace `parseFloat` with `ensureNumber`

* Simplify `numberControlStateReducer` type

* Cast keyboard event

* Disable `value` control in story

* UnitControl: Remove `children` from types

Fixup of https://github.com/WordPress/gutenberg/pull/43474/files#diff-b21e5b36bcbb96cd162206795bc262d1ecb0b2ccb1bac9f0096d13c4a1c9c03a

* Make the `step` prop visible in Docs view

* UnitControl: Remove irrelevant props

* UnitControl: Fixup controls

* Use InputControlProps where possible

* Improve TODO comments

* Add changelog

* Fix e2e test

Co-authored-by: Marco Ciampini <[email protected]>
  • Loading branch information
mirka and ciampo authored Sep 8, 2022
1 parent 57f9b54 commit 91e624a
Show file tree
Hide file tree
Showing 13 changed files with 355 additions and 275 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- Remove unused `normalizeArrowKey` utility function ([#43640](https://github.com/WordPress/gutenberg/pull/43640/)).
- `SearchControl`: Convert to TypeScript ([#43871](https://github.com/WordPress/gutenberg/pull/43871)).
- `ToggleGroupControl`: Rename `__experimentalIsIconGroup` prop to `__experimentalIsBorderless` ([#43771](https://github.com/WordPress/gutenberg/pull/43771/)).
- `NumberControl`: Add TypeScript types ([#43791](https://github.com/WordPress/gutenberg/pull/43791/)).
- Refactor `FocalPointPicker` to function component ([#39168](https://github.com/WordPress/gutenberg/pull/39168)).
- `Guide`: use `code` instead of `keyCode` for keyboard events ([#43604](https://github.com/WordPress/gutenberg/pull/43604/)).
- `ToggleControl`: Convert to TypeScript and streamline CSS ([#43717](https://github.com/WordPress/gutenberg/pull/43717)).
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/color-picker/input-with-slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const InputWithSlider = ( {
label={ label }
hideLabelFromVision
value={ value }
// @ts-expect-error TODO: Resolve discrepancy in NumberControl
onChange={ onChange }
prefix={
<Spacer
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/input-control/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ export interface InputBaseProps extends BaseProps, FlexProps {
* @default false
*/
disabled?: boolean;
/**
* The class name to be added to the wrapper element.
*/
className?: string;
id?: string;
/**
Expand Down
192 changes: 0 additions & 192 deletions packages/components/src/number-control/index.js

This file was deleted.

Loading

0 comments on commit 91e624a

Please sign in to comment.