mirror of
https://github.com/material-components/material-web.git
synced 2024-11-09 16:19:39 +03:00
48d84f86ee
Why? We don't use https://getbem.com/ styles anymore now that we have shadow dom. Just cleanup to help with child changes. PiperOrigin-RevId: 579980984
166 lines
4.2 KiB
SCSS
166 lines
4.2 KiB
SCSS
//
|
|
// Copyright 2021 Google LLC
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
// go/keep-sorted start
|
|
@use 'sass:map';
|
|
// go/keep-sorted end
|
|
// go/keep-sorted start
|
|
@use '../../focus/focus-ring';
|
|
@use '../../ripple/ripple';
|
|
// go/keep-sorted end
|
|
|
|
@mixin styles() {
|
|
:host {
|
|
cursor: pointer;
|
|
display: inline-flex;
|
|
height: var(--_container-height);
|
|
outline: none;
|
|
font-family: var(--_label-text-font);
|
|
font-size: var(--_label-text-size);
|
|
line-height: var(--_label-text-line-height);
|
|
font-weight: var(--_label-text-weight);
|
|
-webkit-tap-highlight-color: transparent;
|
|
// Override vertical-align with shortest value "top". Vertical-align's
|
|
// default "baseline" value causes buttons to be misaligned next to each
|
|
// other if one button has an icon and the other does not.
|
|
vertical-align: top;
|
|
|
|
@include ripple.theme(
|
|
(
|
|
hover-color: var(--_hover-state-layer-color),
|
|
pressed-color: var(--_pressed-state-layer-color),
|
|
hover-opacity: var(--_hover-state-layer-opacity),
|
|
pressed-opacity: var(--_pressed-state-layer-opacity),
|
|
)
|
|
);
|
|
}
|
|
|
|
md-focus-ring {
|
|
@include focus-ring.theme(
|
|
(
|
|
'shape-start-start': var(--_container-shape-start-start),
|
|
'shape-start-end': var(--_container-shape-start-end),
|
|
'shape-end-end': var(--_container-shape-end-end),
|
|
'shape-end-start': var(--_container-shape-end-start),
|
|
)
|
|
);
|
|
}
|
|
|
|
:host([disabled]) {
|
|
cursor: default;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.button {
|
|
cursor: inherit;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
box-sizing: border-box;
|
|
min-inline-size: 64px;
|
|
border: none;
|
|
outline: none;
|
|
user-select: none;
|
|
-webkit-appearance: none;
|
|
vertical-align: middle;
|
|
background: transparent;
|
|
text-decoration: none;
|
|
inline-size: 100%;
|
|
position: relative;
|
|
z-index: 0; // Place content on top of elevation and ripple
|
|
height: 100%;
|
|
font: inherit;
|
|
color: var(--_label-text-color);
|
|
// TODO(b/181413732): Verify token below are named correctly
|
|
padding-inline-start: var(--_leading-space);
|
|
padding-inline-end: var(--_trailing-space);
|
|
gap: 8px;
|
|
|
|
&::-moz-focus-inner {
|
|
padding: 0;
|
|
border: 0;
|
|
}
|
|
}
|
|
|
|
:host(:hover) .button {
|
|
color: var(--_hover-label-text-color);
|
|
}
|
|
|
|
:host(:focus-within) .button {
|
|
color: var(--_focus-label-text-color);
|
|
}
|
|
|
|
:host(:active) .button {
|
|
color: var(--_pressed-label-text-color);
|
|
}
|
|
|
|
.button::before {
|
|
// Background color. Separate node for disabled opacity styles.
|
|
background-color: var(--_container-color);
|
|
border-radius: inherit;
|
|
content: '';
|
|
inset: 0;
|
|
position: absolute;
|
|
}
|
|
|
|
:host([disabled]) .label {
|
|
color: var(--_disabled-label-text-color);
|
|
opacity: var(--_disabled-label-text-opacity);
|
|
}
|
|
|
|
:host([disabled]) .button::before {
|
|
background-color: var(--_disabled-container-color);
|
|
opacity: var(--_disabled-container-opacity);
|
|
}
|
|
|
|
@media (forced-colors: active) {
|
|
.button::before {
|
|
content: '';
|
|
box-sizing: border-box;
|
|
border: 1px solid CanvasText;
|
|
border-radius: inherit;
|
|
inset: 0;
|
|
pointer-events: none;
|
|
position: absolute;
|
|
}
|
|
|
|
:host([disabled]) .button {
|
|
--_disabled-icon-opacity: 1;
|
|
--_disabled-container-opacity: 1;
|
|
--_disabled-label-text-opacity: 1;
|
|
}
|
|
}
|
|
|
|
.button,
|
|
md-ripple {
|
|
border-start-start-radius: var(--_container-shape-start-start);
|
|
border-start-end-radius: var(--_container-shape-start-end);
|
|
border-end-start-radius: var(--_container-shape-end-start);
|
|
border-end-end-radius: var(--_container-shape-end-end);
|
|
}
|
|
|
|
.button::after,
|
|
.button::before,
|
|
md-elevation,
|
|
md-ripple {
|
|
z-index: -1; // Place behind content
|
|
}
|
|
|
|
// TODO(b/181413732): Verify token below are named correctly
|
|
.icon-leading {
|
|
padding-inline-start: var(--_with-leading-icon-leading-space);
|
|
padding-inline-end: var(--_with-leading-icon-trailing-space);
|
|
}
|
|
|
|
.icon-trailing {
|
|
padding-inline-start: var(--_with-trailing-icon-leading-space);
|
|
padding-inline-end: var(--_with-trailing-icon-trailing-space);
|
|
}
|
|
|
|
.link-button-wrapper {
|
|
inline-size: 100%;
|
|
}
|
|
}
|