Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2552 from teamleadercrm/numeric-input-stepper-blu…
Browse files Browse the repository at this point in the history
…rring

`NumericInput` - stepper blurring
  • Loading branch information
BeirlaenAaron authored Feb 3, 2023
2 parents 37fda00 + e3e81d9 commit 6bd5d72
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@

### Dependency updates

## [19.1.1] - 2023-02-03

### Fixed

- `NumericInput`: Fix input blurring when using the stepper buttons ([@BeirlaenAaron](https://github.com/BeirlaenAaron)) in([#2552](https://github.com/teamleadercrm/ui/pull/2552))

## [19.1.0] - 2023-02-01

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@teamleader/ui",
"description": "Teamleader UI library",
"version": "19.1.0",
"version": "19.1.1",
"author": "Teamleader <development@teamleader.eu>",
"bugs": {
"url": "https://github.com/teamleadercrm/ui/issues"
Expand Down
21 changes: 17 additions & 4 deletions src/components/input/NumericInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import React, { ChangeEvent, FocusEvent, forwardRef, KeyboardEvent, ReactElement, useEffect, useRef } from 'react';
import React, {
ChangeEvent,
FocusEvent,
forwardRef,
KeyboardEvent,
MouseEvent,
ReactElement,
useEffect,
useRef,
} from 'react';
import Icon from '../icon';
import {
IconAddSmallOutline,
Expand All @@ -16,7 +25,7 @@ import { GenericComponent } from '../../@types/types';
interface StepperProps {
disabled: boolean;
onBlur: (event: FocusEvent<HTMLInputElement>) => void;
onMouseDown: () => void;
onMouseDown: (event: MouseEvent<HTMLButtonElement>) => void;
onMouseUp: () => void;
onMouseLeave: () => void;
}
Expand Down Expand Up @@ -202,7 +211,9 @@ const NumericInput: GenericComponent<NumericInputProps> = forwardRef<HTMLElement
handleClearStepperDecreaseTimer();
}, [decreaseDisabled]);

const handleDecreaseMouseDown = () => {
const handleDecreaseMouseDown = (event: MouseEvent<HTMLButtonElement>) => {
event.preventDefault();

if (onDecreaseMouseDown) {
onDecreaseMouseDown();

Expand All @@ -228,7 +239,9 @@ const NumericInput: GenericComponent<NumericInputProps> = forwardRef<HTMLElement
}, 300);
};

const handleIncreaseMouseDown = () => {
const handleIncreaseMouseDown = (event: MouseEvent<HTMLButtonElement>) => {
event.preventDefault();

if (onIncreaseMouseDown) {
onIncreaseMouseDown();

Expand Down

0 comments on commit 6bd5d72

Please sign in to comment.