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 #2464 from teamleadercrm/FRAF-1154-v6
Browse files Browse the repository at this point in the history
DatePickerInput: fixed clearing logic
  • Loading branch information
qubis741 authored Nov 23, 2022
2 parents 10a2587 + b0e9e3c commit b54ede7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -15,6 +12,17 @@

### Dependency updates

## [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))

## [17.1.0] - 2022-11-22

### Changed
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": "17.1.0",
"version": "17.1.1",
"author": "Teamleader <[email protected]>",
"bugs": {
"url": "https://github.com/teamleadercrm/ui/issues"
Expand Down
5 changes: 3 additions & 2 deletions src/components/datepicker/DatePickerInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function DatePickerInput<IsTypeable extends boolean = true>({
}
// 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);
Expand Down Expand Up @@ -228,10 +228,11 @@ function DatePickerInput<IsTypeable extends boolean = true>({
event.preventDefault();
closePopover(undefined);
handleInputValueChange('');
setSelectedDate(undefined);
};

const renderClearIcon = () => {
return clearable && selectedDate ? (
return clearable && inputValue.length > 0 ? (
<Icon
color={inverse ? 'teal' : 'neutral'}
tint={inverse ? 'light' : 'darkest'}
Expand Down

0 comments on commit b54ede7

Please sign in to comment.