Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(combobox): ensure icon scales are consistent #8075

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@

.icon-end,
.icon-start {
@apply flex
w-4 cursor-pointer
items-center;
@apply flex cursor-pointer items-center;
}

.icon-end {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,21 +497,45 @@ export const clearDisabled_TestOnly = (): string => html`
`;

export const openInAllScales_TestOnly = (): string => html`
<calcite-combobox open scale="s">
<calcite-combobox-item value="one" text-label="one"></calcite-combobox-item>
<calcite-combobox-item value="two" text-label="two"></calcite-combobox-item>
<calcite-combobox-item value="three" text-label="three"></calcite-combobox-item>
</calcite-combobox>
<br />
<calcite-combobox open scale="m">
<calcite-combobox-item value="one" text-label="one"></calcite-combobox-item>
<calcite-combobox-item value="two" text-label="two"></calcite-combobox-item>
<calcite-combobox-item value="three" text-label="three"></calcite-combobox-item>
</calcite-combobox>
<br />
<calcite-combobox open scale="l">
<calcite-combobox-item value="one" text-label="one"></calcite-combobox-item>
<calcite-combobox-item value="two" text-label="two"></calcite-combobox-item>
<calcite-combobox-item value="three" text-label="three"></calcite-combobox-item>
</calcite-combobox>
<div style="display: flex">
<calcite-combobox open placeholder="choose a number" scale="s">
<calcite-combobox-item value="one" text-label="one"></calcite-combobox-item>
<calcite-combobox-item value="two" text-label="two"></calcite-combobox-item>
<calcite-combobox-item value="three" text-label="three"></calcite-combobox-item>
</calcite-combobox>
<br />
<calcite-combobox open placeholder="choose a number" scale="m">
<calcite-combobox-item value="one" text-label="one"></calcite-combobox-item>
<calcite-combobox-item value="two" text-label="two"></calcite-combobox-item>
<calcite-combobox-item value="three" text-label="three"></calcite-combobox-item>
</calcite-combobox>
<br />
<calcite-combobox open placeholder="choose a number" scale="l">
<calcite-combobox-item value="one" text-label="one"></calcite-combobox-item>
<calcite-combobox-item value="two" text-label="two"></calcite-combobox-item>
<calcite-combobox-item value="three" text-label="three"></calcite-combobox-item>
</calcite-combobox>
</div>
`;

export const openWithPlaceholderIconInAllScales_TestOnly = (): string => html`
<div style="display: flex">
<calcite-combobox open placeholder="choose a number" placeholder-icon="number" scale="s">
<calcite-combobox-item value="one" text-label="one"></calcite-combobox-item>
<calcite-combobox-item value="two" text-label="two"></calcite-combobox-item>
<calcite-combobox-item value="three" text-label="three"></calcite-combobox-item>
</calcite-combobox>
<br />
<calcite-combobox open placeholder="choose a number" placeholder-icon="number" scale="m">
<calcite-combobox-item value="one" text-label="one"></calcite-combobox-item>
<calcite-combobox-item value="two" text-label="two"></calcite-combobox-item>
<calcite-combobox-item value="three" text-label="three"></calcite-combobox-item>
</calcite-combobox>
<br />
<calcite-combobox open placeholder="choose a number" placeholder-icon="number" scale="l">
<calcite-combobox-item value="one" text-label="one"></calcite-combobox-item>
<calcite-combobox-item value="two" text-label="two"></calcite-combobox-item>
<calcite-combobox-item value="three" text-label="three"></calcite-combobox-item>
</calcite-combobox>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import { ComboboxChildElement } from "./interfaces";
import { ComboboxChildSelector, ComboboxItem, ComboboxItemGroup, CSS } from "./resources";
import { getItemAncestors, getItemChildren, hasActiveChildren, isSingleLike } from "./utils";
import { XButton, CSS as XButtonCSS } from "../functional/XButton";
import { getIconScale } from "../../utils/component";

interface ItemData {
label: string;
Expand Down Expand Up @@ -1294,7 +1295,7 @@ export class Combobox
class="selected-icon"
flipRtl={this.open && selectedItem ? selectedItem.iconFlipRtl : placeholderIconFlipRtl}
icon={!this.open && selectedItem ? selectedIcon : placeholderIcon}
scale="s"
scale={getIconScale(this.scale)}
/>
</span>
)
Expand All @@ -1305,7 +1306,10 @@ export class Combobox
const { open } = this;
return (
<span class="icon-end">
<calcite-icon icon={open ? "chevron-up" : "chevron-down"} scale="s" />
<calcite-icon
icon={open ? "chevron-up" : "chevron-down"}
scale={getIconScale(this.scale)}
/>
</span>
);
}
Expand Down
Loading