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

.iui-field handles icon fill #2088

Merged
merged 13 commits into from
Jun 12, 2024
5 changes: 5 additions & 0 deletions .changeset/small-otters-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@itwin/itwinui-css': minor
---

`.iui-field` handles icon fill, used within button and select.
14 changes: 3 additions & 11 deletions packages/itwinui-css/src/button/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ $disabledButtonSelectors: '[disabled], :disabled, [aria-disabled="true"], [data-
cursor: not-allowed;
}

&:where(:hover, :active) {
--_iui-button-icon-fill: var(--iui-color-icon-hover);
}

&:is(#{$disabledButtonSelectors}) {
--_iui-button-icon-fill: var(--iui-color-icon-disabled);
}

&:is([data-iui-loading='true']) {
> :where(:not(.iui-button-spinner)) {
opacity: 0;
Expand All @@ -52,12 +44,13 @@ $disabledButtonSelectors: '[disabled], :disabled, [aria-disabled="true"], [data-
svg {
@include mixins.iui-icon-style('m');
transition: fill var(--iui-duration-1) ease-out;
fill: var(--_iui-button-icon-fill, var(--iui-color-icon));
fill: inherit;
}
}

@mixin iui-button-active {
--_iui-button-icon-fill: var(--iui-color-icon-accent);
--_iui-field-color-icon: var(--iui-color-icon-accent);
--_iui-field-color-icon-hover: var(--iui-color-icon-accent);
--_iui-field-color-background: var(--iui-color-background-accent-muted);
--_iui-field-color-background-hover: var(--iui-color-background-accent-muted);
--_iui-field-color-background-disabled: var(--iui-color-background-disabled);
Expand All @@ -74,7 +67,6 @@ $disabledButtonSelectors: '[disabled], :disabled, [aria-disabled="true"], [data-

&:is(#{$disabledButtonSelectors}) {
--_iui-button-active-stripe-background: var(--iui-color-icon-disabled);
--_iui-button-icon-fill: var(--iui-color-icon-disabled);
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/itwinui-css/src/button/variant.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
--_iui-field-color-focus-outline: var(--iui-color-white);
--_iui-field-focus-outline-offset: -3px;
--_iui-field-focus-outline-width: 1px;
--_iui-button-icon-fill: var(--iui-color-white);
--_iui-field-color-icon: var(--iui-color-white);
--_iui-field-color-icon-hover: var(--iui-color-white);
}

&:where([data-iui-variant='high-visibility']) {
Expand Down
6 changes: 6 additions & 0 deletions packages/itwinui-css/src/field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
--_iui-field-color-text: var(--iui-color-text);
--_iui-field-color-text-hover: var(--iui-color-text-hover);
--_iui-field-color-text-disabled: var(--iui-color-text-disabled);
--_iui-field-color-icon: var(--iui-color-icon);
--_iui-field-color-icon-hover: var(--iui-color-icon-hover);
--_iui-field-color-icon-disabled: var(--iui-color-icon-disabled);
--_iui-field-color-background: var(--iui-color-background);
--_iui-field-color-background-hover: var(--iui-color-background-hover);
--_iui-field-color-background-disabled: var(--iui-color-background-disabled);
Expand Down Expand Up @@ -33,6 +36,9 @@
color: var(--_iui-field-state--default, var(--_iui-field-color-text))
var(--_iui-field-state--hover, var(--_iui-field-color-text-hover))
var(--_iui-field-state--disabled, var(--_iui-field-color-text-disabled));
fill: var(--_iui-field-state--default, var(--_iui-field-color-icon))
var(--_iui-field-state--hover, var(--_iui-field-color-icon-hover))
var(--_iui-field-state--disabled, var(--_iui-field-color-icon-disabled));
font: inherit;
font-size: var(--_iui-field-font-size);
font-weight: var(--iui-font-weight-normal);
Expand Down
10 changes: 7 additions & 3 deletions packages/itwinui-css/src/select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@
}

&:where([disabled], :disabled, [aria-disabled='true'], [data-iui-disabled='true']) {
--_iui-list-item-icon-fill: var(--iui-color-icon-disabled);
opacity: 1;
cursor: not-allowed;
}

.iui-icon svg {
@include menu.iui-menu-icon;
.iui-icon {
flex: 0 0 auto;

svg {
@include mixins.iui-icon-style('m');
fill: inherit;
}
r100-stack marked this conversation as resolved.
Show resolved Hide resolved
}

.iui-content {
Expand Down
7 changes: 6 additions & 1 deletion packages/itwinui-css/src/tile/tile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,14 @@ $thumbnail-selector: ':is(.iui-thumbnail-icon, .iui-tile-thumbnail-picture)';
justify-self: end;
}

.iui-tile-thumbnail-picture ~ &,
.iui-tile-thumbnail-picture ~ & > .iui-button {
--_iui-field-color-icon: var(--iui-color-white);
--_iui-field-color-icon-hover: var(--iui-color-white);
}

.iui-tile-thumbnail-picture ~ & {
@include mixins.iui-blur($opacity: 5);
--_iui-button-icon-fill: var(--iui-color-white);

> .iui-button-icon {
filter: drop-shadow(0 2px 1px rgba(0, 0, 0, var(--iui-opacity-5)));
Expand Down
Loading