From 018b2cd606707de5b201b610cc0a07708029bd96 Mon Sep 17 00:00:00 2001 From: qubis741 Date: Wed, 23 Nov 2022 10:45:11 +0100 Subject: [PATCH 1/5] pass empty string to onChange if input is empty --- src/components/datepicker/DatePickerInput.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/datepicker/DatePickerInput.tsx b/src/components/datepicker/DatePickerInput.tsx index 8073ea492..3803ec3d8 100644 --- a/src/components/datepicker/DatePickerInput.tsx +++ b/src/components/datepicker/DatePickerInput.tsx @@ -129,7 +129,7 @@ function DatePickerInput({ } // Blurred from input, not focused on datepicker if (value === false) { - if (typeable && !customFormatDate && inputValue) { + if (typeable && !customFormatDate) { const date = parseMultiFormatsDate(inputValue, ALLOWED_DATE_FORMATS, locale); if (date && isAllowedDate(date, dayPickerProps?.disabledDays)) { onChange && onChange(date); From 4a3b444b20ea69f9cd65dbbd4b1e295b6fec3879 Mon Sep 17 00:00:00 2001 From: qubis741 Date: Wed, 23 Nov 2022 12:07:13 +0100 Subject: [PATCH 2/5] improve clearing logic of DatePickerInput to take inputValue into account instead of selected date --- src/components/datepicker/DatePickerInput.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/datepicker/DatePickerInput.tsx b/src/components/datepicker/DatePickerInput.tsx index 3803ec3d8..f56c66aab 100644 --- a/src/components/datepicker/DatePickerInput.tsx +++ b/src/components/datepicker/DatePickerInput.tsx @@ -228,10 +228,11 @@ function DatePickerInput({ event.preventDefault(); closePopover(undefined); handleInputValueChange(''); + setSelectedDate(undefined); }; const renderClearIcon = () => { - return clearable && selectedDate ? ( + return clearable && inputValue.length > 0 ? ( Date: Wed, 23 Nov 2022 12:11:19 +0100 Subject: [PATCH 3/5] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 70152cf97..0949ff584 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@teamleader/ui", "description": "Teamleader UI library", - "version": "17.1.0", + "version": "17.1.1", "author": "Teamleader ", "bugs": { "url": "https://github.com/teamleadercrm/ui/issues" From 04be06aa3422a255223afed74776b6647ba7849d Mon Sep 17 00:00:00 2001 From: qubis741 Date: Wed, 23 Nov 2022 12:22:24 +0100 Subject: [PATCH 4/5] updated changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 252d5a248..120aece78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,12 @@ ### Dependency updates +## [17.1.1] - 2022-11-23 + +### Fixed + +- `DatePickerInput`: clearing logic ([@qubis741](https://github.com/qubis741)) in ([#2464](https://github.com/teamleadercrm/ui/pull/2464)) + ## [17.1.0] - 2022-11-22 ### Changed From b0e9e3c35e22d8f4a93dd7fa5ef13d17a681ad93 Mon Sep 17 00:00:00 2001 From: qubis741 Date: Wed, 23 Nov 2022 15:33:00 +0100 Subject: [PATCH 5/5] updated changelog --- CHANGELOG.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dde9a7aac..47bf432fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,6 @@ ### Changed -- `Message`: Make `MessageProps` extend the `BoxProps` and make `title` property optional ([@kristofcolpaert](https://github.com/kristofcolpaert)) in [#2465](https://github.com/teamleadercrm/ui/pull/2465)) -- `Dialog`: Added z-index to scroll shadow to make sure it appears above inner elements ([@BeirlaenAaron](https://github.com/BeirlaenAaron)) in ([#2463](https://github.com/teamleadercrm/ui/pull/2463)) - ### Deprecated ### Removed @@ -17,6 +14,11 @@ ## [17.1.1] - 2022-11-23 +### Changed + +- `Message`: Make `MessageProps` extend the `BoxProps` and make `title` property optional ([@kristofcolpaert](https://github.com/kristofcolpaert)) in [#2465](https://github.com/teamleadercrm/ui/pull/2465)) +- `Dialog`: Added z-index to scroll shadow to make sure it appears above inner elements ([@BeirlaenAaron](https://github.com/BeirlaenAaron)) in ([#2463](https://github.com/teamleadercrm/ui/pull/2463)) + ### Fixed - `DatePickerInput`: clearing logic ([@qubis741](https://github.com/qubis741)) in ([#2464](https://github.com/teamleadercrm/ui/pull/2464))