From 54e4c57ae578c6c4574a02d0f7400d14c4bfcc80 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Fri, 19 Nov 2021 08:36:59 -0500 Subject: [PATCH] fixes #591 --- docs/resources/changelog.md | 1 + src/components/select/select.styles.ts | 13 +++++++++++++ src/components/select/select.ts | 12 ++++++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/docs/resources/changelog.md b/docs/resources/changelog.md index be262829..285a2f3c 100644 --- a/docs/resources/changelog.md +++ b/docs/resources/changelog.md @@ -32,6 +32,7 @@ Thank you for your help and patience with testing Shoelace. I promise, we're not - 🚨 BREAKING: removed `--sl-focus-ring-color`, and `--sl-focus-ring-alpha` (use `--sl-focus-ring` instead) - 🚨 BREAKING: removed `--sl-surface-base` and `--sl-surface-base-alt` tokens (use the neutral palette instead) - Added experimental `` component +- Added `clear-icon` slot to `` [#591](https://github.com/shoelace-style/shoelace/issues/591) - Fixed a bug in `` where the label would show in the default slot - Improved the dark theme palette so colors are bolder and don't appear washed out - Improved a11y of `` by representing it as an image with an `alt` [#579](https://github.com/shoelace-style/shoelace/issues/579) diff --git a/src/components/select/select.styles.ts b/src/components/select/select.styles.ts index b74f3bb3..6965c06f 100644 --- a/src/components/select/select.styles.ts +++ b/src/components/select/select.styles.ts @@ -118,7 +118,20 @@ export default css` .select__clear { flex: 0 0 auto; + display: inline-flex; + align-items: center; width: 1.25em; + font-size: inherit; + color: var(--sl-input-icon-color); + border: none; + background: none; + padding: 0; + transition: var(--sl-transition-fast) color; + cursor: pointer; + } + + .select__clear:hover { + color: var(--sl-input-icon-color-hover); } .select__suffix { diff --git a/src/components/select/select.ts b/src/components/select/select.ts index 2966e134..e113139d 100644 --- a/src/components/select/select.ts +++ b/src/components/select/select.ts @@ -34,6 +34,7 @@ let id = 0; * @slot - The select's options in the form of menu items. * @slot prefix - Used to prepend an icon or similar element to the select. * @slot suffix - Used to append an icon or similar element to the select. + * @slot clear-icon - An icon to use in lieu of the default clear icon. * @slot label - The select's label. Alternatively, you can use the label prop. * @slot help-text - Help text that describes how to use the select. * @@ -504,14 +505,17 @@ export default class SlSelect extends LitElement { ${this.clearable && hasSelection ? html` - + > + + + + ` : ''}