Skip to content

Commit

Permalink
[PickerInput]: fix selected value styles in toggler in case of single…
Browse files Browse the repository at this point in the history
… mode, searchPosition !== input and minCharsToSearch > 0 and for case with readonly=true and searchPosition !== input.
  • Loading branch information
AlekseyManetov committed Jan 28, 2025
1 parent 16bc8ed commit 38c9765
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* [MainMenuButton]: removed unnecessary `role` and `aria-haspopup` attributes ([#2733](https://github.com/epam/UUI/pull/2733))
* [MainMenuButton]: Add `aria-current` attribute with value `page` for active links ([#2734](https://github.com/epam/UUI/pull/2734))
* [DataTableRow]: fixed `ref` prop
* [PickerInput]: fixed toggler selected value styles in case of single mode, searchPosition !== input and minCharsToSearch > 0 and for case with readonly=true and searchPosition !== input.


# 5.12.1 - 17.12.2024
Expand Down
9 changes: 4 additions & 5 deletions uui-components/src/pickers/PickerToggler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,10 @@ function PickerTogglerComponent<TItem, TId>(props: PickerTogglerProps<TItem, TId
}, [inFocus, handleClick]);

const isActivePlaceholder = (): Boolean => {
if (props.isReadonly) return false;
else if (props.isOpen && props.searchPosition === 'input') return false;
else if (props.minCharsToSearch && inFocus) return false;
else if (props.pickerMode === 'single' && props.selection && props.selection.length > 0) return true;
else return false;
if (props.pickerMode === 'single' && props.searchPosition !== 'input') {
return true;
}
return false;
};

const blur = (e?: React.FocusEvent<HTMLElement>) => {
Expand Down
8 changes: 8 additions & 0 deletions uui/components/pickers/PickerToggler.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@
&:global(.uui-readonly) {
@include readonly-input();

:global(.uui-placeholder) {
&:global(.uui-input) {
&::placeholder {
color: var(--uui-picker_toggler-text); // we store selected value in placeholder, so it should have the same style as input value if .uui-placeholder is set
}
}
}

:global(.uui-icon-dropdown), :global(.uui-icon-cancel) {
visibility: hidden;
}
Expand Down

0 comments on commit 38c9765

Please sign in to comment.