diff --git a/.changeset/small-otters-itch.md b/.changeset/small-otters-itch.md new file mode 100644 index 00000000000..4c5df908558 --- /dev/null +++ b/.changeset/small-otters-itch.md @@ -0,0 +1,5 @@ +--- +'@itwin/itwinui-css': minor +--- + +`.iui-field` handles icon fill, used within button and select. diff --git a/packages/itwinui-css/src/button/base.scss b/packages/itwinui-css/src/button/base.scss index 6402db769c2..e6e9ea17d8c 100644 --- a/packages/itwinui-css/src/button/base.scss +++ b/packages/itwinui-css/src/button/base.scss @@ -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; @@ -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); @@ -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); } } diff --git a/packages/itwinui-css/src/button/variant.scss b/packages/itwinui-css/src/button/variant.scss index 8dc674212e9..a11c711d540 100644 --- a/packages/itwinui-css/src/button/variant.scss +++ b/packages/itwinui-css/src/button/variant.scss @@ -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']) { diff --git a/packages/itwinui-css/src/field.scss b/packages/itwinui-css/src/field.scss index f973acea8ed..df93863a71e 100644 --- a/packages/itwinui-css/src/field.scss +++ b/packages/itwinui-css/src/field.scss @@ -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); @@ -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); diff --git a/packages/itwinui-css/src/select/select.scss b/packages/itwinui-css/src/select/select.scss index d5e33691b52..06ec5ad8bda 100644 --- a/packages/itwinui-css/src/select/select.scss +++ b/packages/itwinui-css/src/select/select.scss @@ -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; + } } .iui-content { diff --git a/packages/itwinui-css/src/tile/tile.scss b/packages/itwinui-css/src/tile/tile.scss index 928ca694141..cd16201f45c 100644 --- a/packages/itwinui-css/src/tile/tile.scss +++ b/packages/itwinui-css/src/tile/tile.scss @@ -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)));