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

feat(slider, numberinput): add onKeyUp callback prop for input #11230

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const NumberInput = React.forwardRef(function NumberInput(props, forwardRef) {
min,
onChange,
onClick,
onKeyUp,
readOnly,
size = 'md',
step = 1,
Expand Down Expand Up @@ -162,6 +163,7 @@ const NumberInput = React.forwardRef(function NumberInput(props, forwardRef) {
min={min}
onClick={onClick}
onChange={handleOnChange}
onKeyUp={onKeyUp}
pattern="[0-9]*"
readOnly={readOnly}
step={step}
Expand Down Expand Up @@ -329,6 +331,11 @@ NumberInput.propTypes = {
*/
onClick: PropTypes.func,

/**
* Provide an optional function to be called when a key is pressed in the number input
*/
onKeyUp: PropTypes.func,

/**
* Specify if the component should be read-only
*/
Expand Down
6 changes: 6 additions & 0 deletions packages/react/src/components/Slider/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ export default class Slider extends PureComponent {
*/
onChange: PropTypes.func,

/**
* Provide an optional function to be called when a key is pressed in the number input
*/
onInputKeyUp: PropTypes.func,

/**
* The callback to get notified of value on handle release.
*/
Expand Down Expand Up @@ -653,6 +658,7 @@ export default class Slider extends PureComponent {
step={step}
onChange={this.onChange}
onBlur={this.onBlur}
onKeyUp={this.onInputKeyUp}
data-invalid={isValid ? null : true}
aria-invalid={isValid ? null : true}
/>
Expand Down