Skip to content

Commit

Permalink
fix(combobox): update placeholder-icon color (#9956)
Browse files Browse the repository at this point in the history
**Related Issue:** #9935

## Summary

This updates the placeholder's icon color to be consistent with other
components.
  • Loading branch information
jcfranco committed Aug 5, 2024
1 parent 5e7f7d3 commit d916ca4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@
padding-inline: var(--calcite-combobox-item-spacing-unit-l);
}

.placeholder-icon {
color: var(--calcite-color-text-3);
}

.input-wrap {
@apply flex flex-grow items-center;
}
Expand Down
12 changes: 8 additions & 4 deletions packages/calcite-components/src/components/combobox/combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1702,17 +1702,21 @@ export class Combobox
}

renderSelectedOrPlaceholderIcon(): VNode {
const { selectedItems, placeholderIcon, placeholderIconFlipRtl } = this;
const { open, placeholderIcon, placeholderIconFlipRtl, selectedItems } = this;
const selectedItem = selectedItems[0];
const selectedIcon = selectedItem?.icon;
const showPlaceholder = placeholderIcon && (open || !selectedItem);

return (
this.showingInlineIcon && (
<span class="icon-start" key="selected-placeholder-icon">
<calcite-icon
class="selected-icon"
flipRtl={this.open && selectedItem ? selectedItem.iconFlipRtl : placeholderIconFlipRtl}
icon={!this.open && selectedItem ? selectedIcon : placeholderIcon}
class={{
[CSS.selectedIcon]: !showPlaceholder,
[CSS.placeholderIcon]: showPlaceholder,
}}
flipRtl={showPlaceholder ? placeholderIconFlipRtl : selectedItem.iconFlipRtl}
icon={showPlaceholder ? placeholderIcon : selectedIcon}
scale={getIconScale(this.scale)}
/>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ export const CSS = {
selectionDisplaySingle: "selection-display-single",
listContainer: "list-container",
icon: "icon",
placeholderIcon: "placeholder-icon",
selectedIcon: "selected-icon",
};

0 comments on commit d916ca4

Please sign in to comment.