-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path_functions.scss
144 lines (117 loc) · 3.89 KB
/
_functions.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
@use "sass:list";
@use "sass:map";
@use "@pepabo-inhouse/adapter/functions" as adapter;
@use "./variables";
@function get-cursor($states: (enabled)) {
$available-states: adapter.get-states();
@each $state in $states {
@if list.index($available-states, $state) == null {
@error "$statesには #{$available-states} を組み合わせた配列のみ指定できます";
}
}
@if list.index($states, disabled) != null {
@return default;
} @else {
@return pointer;
}
}
@function get-opacity($states: (enabled)) {
$available-states: adapter.get-states();
@each $state in $states {
@if list.index($available-states, $state) == null {
@error "$statesには #{$available-states} を組み合わせた配列のみ指定できます";
}
}
@if list.index($states, disabled) != null {
@return adapter.get-disabled-surface-opacity();
} @else {
@return 1;
}
}
@function compose-child-element-margin($child-element-size) {
@return $child-element-size * 0.5 * -1;
}
@function get-background-box-shadow($states: (enabled)) {
$available-states: adapter.get-states();
@each $state in $states {
@if list.index($available-states, $state) == null {
@error "$statesには #{$available-states} を組み合わせた配列のみ指定できます";
}
}
$border-overlay: -get-border-overlay($states: $states);
$border: -get-border($states: $states);
@if list.index($states, selected) != null or list.index($states, mixed) != null {
@return $border;
} @else {
@return $border-overlay, $border;
}
}
@function get-outline($states: (enabled), $brightness: light) {
$available-states: adapter.get-states();
@each $state in $states {
@if list.index($available-states, $state) == null {
@error "$statesには #{$available-states} を組み合わせた配列のみ指定できます";
}
}
@if list.index($states, focused) != null {
@return adapter.get-focus-ring-outline($brightness: $brightness);
} @else {
@return none;
}
}
@function get-foreground-content($states: (enabled)) {
$available-states: adapter.get-states();
@each $state in $states {
@if list.index($available-states, $state) == null {
@error "$statesには #{$available-states} を組み合わせた配列のみ指定できます";
}
}
@if list.index($states, mixed) != null {
@return "minus";
} @else {
@return "check";
}
}
@function get-foreground-opacity($states: (enabled)) {
$available-states: adapter.get-states();
@each $state in $states {
@if list.index($available-states, $state) == null {
@error "$statesには #{$available-states} を組み合わせた配列のみ指定できます";
}
}
@if list.index($states, selected) != null or list.index($states, mixed) != null {
@return 1;
} @else {
@return 0;
}
}
/// @deprecated この関数は非推奨です
@function -get-focus-ring($states: (enabled)) {
@if list.index($states, selected) != null or list.index($states, mixed) != null {
@return adapter.get-focus-ring-box-shadow($color: informative);
} @else {
@return adapter.get-focus-ring-box-shadow($color: neutral);
}
}
@function -get-border($states: (enabled)) {
$border-width: adapter.get-checkbox-border-size();
$border-color: adapter.get-checkbox-border-color($states: $states);
@return 0 0 0 $border-width $border-color;
}
@function -get-border-overlay-color($states: (enabled)) {
$brightness:
adapter.get-background-brightness(
$background-color: adapter.get-checkbox-surface-color(
$states: $states
)
);
@return adapter.get-background-overlay-color(
$brightness: $brightness,
$state: list.nth($states, 1)
);
}
@function -get-border-overlay($states: (enabled)) {
$border-width: adapter.get-checkbox-border-size();
$border-overlay-color: -get-border-overlay-color($states: $states);
@return 0 0 0 $border-width $border-overlay-color;
}