This repository was archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy path_button-protected-theme.scss
95 lines (89 loc) · 3.49 KB
/
_button-protected-theme.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
90
91
92
93
94
95
//
// Copyright 2021 Google Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
@use '@material/feature-targeting/feature-targeting';
@use '@material/theme/keys';
@use '@material/theme/theme';
@use '@material/tokens/resolvers';
@use './button-shared-theme';
$custom-property-prefix: 'protected-button';
$light-theme: (
container-color: primary,
container-elevation: 2,
container-height: button-shared-theme.$height,
container-shadow-color: black,
container-shape: button-shared-theme.$shape-radius,
disabled-container-color: button-shared-theme.$disabled-container-color,
disabled-container-elevation: 0,
disabled-label-text-color: button-shared-theme.$disabled-ink-color,
focus-container-elevation: 4,
focus-label-text-color: null,
focus-state-layer-color: on-primary,
focus-state-layer-opacity: 0.24,
hover-container-elevation: 4,
hover-label-text-color: null,
hover-state-layer-color: on-primary,
hover-state-layer-opacity: 0.08,
/// Prevent the increased touch target from being reseted if the
/// container-height differs from the default (36px)
keep-touch-target: false,
label-text-color: on-primary,
label-text-font: button-font-family,
label-text-size: button-font-size,
label-text-tracking: button-letter-spacing,
label-text-transform: button-text-transform,
label-text-weight: button-font-weight,
pressed-container-elevation: 8,
pressed-label-text-color: null,
pressed-state-layer-color: on-primary,
pressed-state-layer-opacity: 0.24,
with-icon-disabled-icon-color: null,
with-icon-focus-icon-color: null,
with-icon-hover-icon-color: null,
with-icon-icon-color: null,
with-icon-icon-size: 18px,
with-icon-pressed-icon-color: null,
focus-ring-color: null,
focus-ring-offset: 0,
);
/// Sets theme based on provided theme configuration.
/// Only emits theme related styles.
/// @param {Map} $theme - Theme configuration to use.
@mixin theme($theme, $resolver: resolvers.$material) {
@include theme.validate-theme($light-theme, $theme);
$theme: button-shared-theme.resolve-theme-elevation-keys(
$theme,
$resolver: $resolver
);
@include keys.declare-custom-properties($theme, $custom-property-prefix);
}
@mixin theme-styles(
$theme,
$resolver: resolvers.$material,
$query: feature-targeting.all()
) {
@include theme.validate-theme($light-theme, $theme);
$theme: keys.create-theme-properties(
$theme,
$prefix: $custom-property-prefix
);
@include button-shared-theme.theme-styles($theme, $resolver, $query: $query);
}