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

Select - Fix clear indicator styles #2649

Merged
merged 3 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 14 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

### Added

- `IconMenu`: Added a `title` prop and pass it to the IconButton ([@driesd](https://https://github.com/driesd) in [#2648](https://github.com/teamleadercrm/ui/pull/2648))

### Changed

- `IconMenu`: Spread all other props instead of only spreading the box props ([@driesd](https://https://github.com/driesd) in [#2648](https://github.com/teamleadercrm/ui/pull/2648))

### Deprecated

### Removed
Expand All @@ -16,6 +12,20 @@

### Dependency updates

## [21.2.0] - 2023-05-11

### Added

- `IconMenu`: Added a `title` prop and pass it to the IconButton ([@driesd](https://https://github.com/driesd) in [#2648](https://github.com/teamleadercrm/ui/pull/2648))

### Changed

- `IconMenu`: Spread all other props instead of only spreading the box props ([@driesd](https://https://github.com/driesd) in [#2648](https://github.com/teamleadercrm/ui/pull/2648))

### Fixed

- `Select`: Fixed clear indicator styles ([@BeirlaenAaron](https://https://github.com/BeirlaenAaron) in [#2649](https://github.com/teamleadercrm/ui/pull/2649))

## [21.1.0] - 2023-05-08

### 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": "21.1.0",
"version": "21.2.0",
"author": "Teamleader <development@teamleader.eu>",
"bugs": {
"url": "https://github.com/teamleadercrm/ui/issues"
Expand Down
17 changes: 1 addition & 16 deletions src/components/select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ const ClearIndicator = <Option extends OptionType, IsMulti extends boolean>(
color={inverse ? 'teal' : 'neutral'}
display="flex"
tint={inverse ? 'lightest' : 'darkest'}
className={cx(theme['clear-indicator'], { [theme['clear-indicator--inverse']]: inverse })}
>
<IconCloseBadgedSmallFilled />
</Icon>
Expand Down Expand Up @@ -160,21 +161,6 @@ function Select<Option extends OptionType, IsMulti extends boolean, IsClearable
};
}, []);

const getClearIndicatorStyles = (base: CSSObjectWithLabel) => {
return {
...base,
color: inverse ? COLOR.TEAL.LIGHTEST : COLOR.TEAL.DARK,
'&:hover': {
color: inverse ? COLOR.NEUTRAL.LIGHTEST : COLOR.TEAL.DARKEST,
},
cursor: 'pointer',
svg: {
height: '14px',
width: '14px',
},
};
};

const getControlStyles = (base: CSSObjectWithLabel, { isDisabled, isFocused }: ControlProps<Option>) => {
const commonStyles: CSSObjectWithLabel = {
...base,
Expand Down Expand Up @@ -457,7 +443,6 @@ function Select<Option extends OptionType, IsMulti extends boolean, IsClearable
};

const getStyles = (): StylesConfig<Option> => ({
clearIndicator: getClearIndicatorStyles,
control: getControlStyles,
group: getGroupStyles,
groupHeading: getGroupHeadingStyles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ exports[`Component - Select renders a clear button when a value is provided 1`]
>
<span
aria-hidden="true"
class="box align-items-center display-flex neutral darkest"
class="box align-items-center display-flex neutral darkest clear-indicator"
data-teamleader-ui="icon"
>
<svg
Expand Down
14 changes: 14 additions & 0 deletions src/components/select/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@
width: 30px;
}

.clear-indicator {
cursor: pointer;

&:hover {
color: var(--color-teal-darkest);
}

&--inverse {
&:hover {
color: var(--color-neutral-lightest);
}
}
}

.is-large .dropdown-indicator {
width: 36px;
}
Expand Down