| // Copyright (C) 2023 The Android Open Source Project |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| @import "theme"; |
| |
| @mixin filled-color-scheme($intent-color, $text-color) { |
| color: $text-color; |
| background: $intent-color; |
| |
| &:hover { |
| background: lighten($intent-color, 5%); |
| } |
| |
| &:active, |
| &.pf-active { |
| background: darken($intent-color, 5%); |
| } |
| |
| &[disabled] { |
| &:hover { |
| background: $intent-color; |
| } |
| |
| &.pf-active { |
| background: darken($intent-color, 5%); |
| } |
| } |
| } |
| |
| .pf-button { |
| font-family: $pf-font; |
| line-height: 1; |
| user-select: none; |
| border-radius: $pf-border-radius; |
| padding: 4px 8px; |
| white-space: nowrap; |
| min-width: max-content; |
| |
| & > .pf-left-icon { |
| margin-right: 6px; // Make some room between the icon and label |
| } |
| |
| & > .pf-right-icon { |
| margin-left: 6px; // Make some room between the icon and label |
| } |
| |
| & > .material-icons, |
| & > .material-icons-filled { |
| font-size: inherit; |
| line-height: inherit; |
| } |
| |
| &:focus-visible { |
| @include focus; |
| } |
| |
| // Reduce padding when compact |
| &.pf-compact { |
| padding: 2px 4px; |
| & > .pf-left-icon { |
| margin-right: 2px; |
| } |
| |
| & > .pf-right-icon { |
| margin-left: 2px; |
| } |
| } |
| |
| // Reduce padding when we are icon-only |
| &.pf-icon-only { |
| & > .pf-left-icon { |
| margin: 0; |
| } |
| |
| padding: 4px; |
| |
| &.pf-compact { |
| padding: 0; |
| } |
| } |
| |
| &[disabled] { |
| filter: opacity(50%); |
| cursor: not-allowed; |
| } |
| |
| // From here on in we just describe the colours |
| &--filled { |
| background: rgba(gray, 20%); |
| |
| &:hover { |
| background: rgba(gray, 30%); |
| } |
| |
| &.pf-active, |
| &:active { |
| background: rgba(gray, 40%); |
| } |
| |
| &[disabled] { |
| &:hover { |
| background: rgba(gray, 20%); // Reset to the default background |
| } |
| |
| &.pf-active { |
| background: rgba(gray, 40%); |
| } |
| } |
| |
| &.pf-intent-primary { |
| @include filled-color-scheme($color-primary, white); |
| } |
| |
| &.pf-intent-success { |
| @include filled-color-scheme($color-success, white); |
| } |
| |
| &.pf-intent-danger { |
| @include filled-color-scheme($color-danger, white); |
| } |
| |
| &.pf-intent-warning { |
| @include filled-color-scheme($color-warning, black); |
| } |
| } |
| |
| &--outlined { |
| border: 1px solid color-mix(in srgb, currentColor 50%, transparent); |
| } |
| |
| &--minimal, |
| &--outlined { |
| &:hover { |
| background: color-mix(in srgb, currentColor 10%, transparent); |
| } |
| |
| &:active, |
| &.pf-active { |
| background: color-mix(in srgb, currentColor 20%, transparent); |
| } |
| |
| &.pf-intent-primary { |
| color: $pf-primary-background; |
| } |
| |
| &.pf-intent-success { |
| color: $color-success; |
| } |
| |
| &.pf-intent-danger { |
| color: $color-danger; |
| } |
| |
| &.pf-intent-warning { |
| color: $color-warning; |
| } |
| |
| &[disabled] { |
| &:hover { |
| background: unset; |
| } |
| |
| &.pf-active { |
| background: color-mix(in srgb, currentColor 20%, transparent); |
| } |
| } |
| } |
| } |
| |
| .pf-button-bar { |
| display: flex; |
| flex-direction: row; |
| gap: 2px; |
| align-items: baseline; |
| } |