-
Notifications
You must be signed in to change notification settings - Fork 937
/
Copy path_outlined-button.scss
89 lines (76 loc) · 2.13 KB
/
_outlined-button.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//
// Copyright 2021 Google LLC
// SPDX-License-Identifier: Apache-2.0
//
// go/keep-sorted start
@use 'sass:list';
@use 'sass:map';
// go/keep-sorted end
// go/keep-sorted start
@use '../../tokens';
// go/keep-sorted end
@mixin theme($tokens) {
$supported-tokens: tokens.$md-comp-outlined-button-supported-tokens;
@each $token, $value in $tokens {
@if list.index($supported-tokens, $token) == null {
@error 'Token `#{$token}` is not a supported token.';
}
@if $value {
--md-outlined-button-#{$token}: #{$value};
}
}
}
@mixin styles() {
$tokens: tokens.md-comp-outlined-button-values(
$exclude-custom-properties: false,
);
:host {
// Only use the logical properties.
$tokens: map.remove($tokens, 'container-shape');
@each $token, $value in $tokens {
--_#{$token}: #{$value};
}
--_container-color: none;
--_disabled-container-color: none;
--_disabled-container-opacity: 0;
}
.outline {
inset: 0;
border-style: solid;
position: absolute;
box-sizing: border-box;
border-color: var(--_outline-color);
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);
}
:host(:active) .outline {
border-color: var(--_pressed-outline-color);
}
:host(:disabled) .outline {
border-color: var(--_disabled-outline-color);
opacity: var(--_disabled-outline-opacity);
}
@media (forced-colors: active) {
:host(:disabled) .background {
// Only outlined buttons change their border when disabled to distinguish
// them from other buttons that add a border for increased visibility in
// HCM.
border-color: GrayText;
}
:host(:disabled) .outline {
opacity: 1;
}
}
.outline,
md-ripple {
border-width: var(--_outline-width);
}
md-ripple {
inline-size: calc(100% - 2 * var(--_outline-width));
block-size: calc(100% - 2 * var(--_outline-width));
border-style: solid;
border-color: transparent;
}
}