-
Notifications
You must be signed in to change notification settings - Fork 6
/
_buttono.scss
196 lines (170 loc) · 5.56 KB
/
_buttono.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
//
// Buttono
// --------------------------------------------------
$buttono-function-factor: -20% !default;
$buttono-background-color-lightness-threshold: 70% !default;
$buttono-font-family: null !default;
$buttono-background-color: #e0e0e0 !default;
$buttono-background-color-hover: auto !default;
$buttono-border-radius: 3px !default;
$buttono-font-size: 16px !default;
$buttono-line-height: 1.5 !default;
$buttono-color: #fff !default;
$buttono-color-alt: #333 !default;
$buttono-padding: 10px 20px !default;
$buttono-border-width: 0 !default;
$buttono-transition-duration: 0.4s !default;
$buttono-transition-property: background-color, color, border-color !default;
$buttono-include-disabled-styles: true !default;
$buttono-opacity-disabled: 0.7 !default;
$buttono-include-focus-styles: true !default;
$buttono-outline-width-focus: 2px !default;
$buttono-outline-style-focus: dotted !default;
$buttono-outline-color-focus: auto !default;
$buttono-outline-offset-focus: 1px !default;
@mixin buttono-block(
$transition-duration: $buttono-transition-duration,
$transition-property: $buttono-transition-property,
$border-width: $buttono-border-width,
$cursor: pointer,
$font-family: $buttono-font-family,
$font-size: $buttono-font-size,
$line-height: $buttono-line-height,
$padding: $buttono-padding,
$text-align: center,
$vertical-align: middle,
$display: inline-block,
$include-disabled-styles: $buttono-include-disabled-styles
) {
display: $display;
padding: $padding;
border: $border-width solid transparent;
font-family: $font-family;
font-size: $font-size;
line-height: $line-height;
text-align: $text-align;
transition-duration: $transition-duration;
user-select: none;
vertical-align: $vertical-align;
&:not(:disabled):not([aria-disabled='true']) {
cursor: $cursor;
}
@if not($transition-duration == null) {
transition-property: $transition-property;
}
&:hover,
&:focus {
text-decoration: none;
}
@if $include-disabled-styles {
&:disabled,
&[aria-disabled='true'] {
box-shadow: none;
}
}
}
@mixin buttono-style-modifier(
$background-color: $buttono-background-color,
$background-color-hover: $buttono-background-color-hover,
$color: auto,
$color-hover: auto,
$border-width: $buttono-border-width,
$border-color: undefined,
$border-color-hover: undefined,
$border-radius: $buttono-border-radius,
$background-color-lightness-threshold: $buttono-background-color-lightness-threshold,
$opacity-disabled: $buttono-opacity-disabled,
$include-disabled-styles: $buttono-include-disabled-styles,
$background-color-disabled: undefined,
$border-color-disabled: undefined,
$color-disabled: undefined,
$include-focus-styles: $buttono-include-focus-styles,
$outline-width-focus: $buttono-outline-width-focus,
$outline-style-focus: $buttono-outline-style-focus,
$outline-color-focus: $buttono-outline-color-focus,
$outline-offset-focus: $buttono-outline-offset-focus
) {
@if $background-color-hover == auto {
$background-color-hover: scale-color($background-color, $lightness: $buttono-function-factor);
}
@if ($border-color == auto) and not($background-color == null) {
$border-color: scale-color($background-color, $lightness: $buttono-function-factor);
}
@if ($border-color-hover == auto) and not($background-color-hover == null) {
$border-color-hover: scale-color($background-color-hover, $lightness: $buttono-function-factor);
}
@if $border-color == undefined {
$border-color: $background-color;
}
@if $border-color-hover == undefined {
$border-color-hover: $background-color-hover;
}
$background-color-lightness: 0;
$background-color-hover-lightness: 0;
@if not($background-color == null) {
$background-color-lightness: lightness($background-color);
}
@if $background-color == transparent {
$background-color-lightness: $background-color-lightness-threshold + 1%;
}
@if not($background-color-hover == null) {
$background-color-hover-lightness: lightness($background-color-hover);
}
@if $color == auto {
$color: if(
$background-color-lightness > $background-color-lightness-threshold,
$buttono-color-alt,
$buttono-color
);
}
@if $color-hover == auto {
$color-hover: if(
$background-color-hover-lightness > $background-color-lightness-threshold,
$buttono-color-alt,
$buttono-color
);
}
background-color: $background-color;
border-color: $border-color;
border-radius: $border-radius;
color: $color;
@if not($border-width == $buttono-border-width) {
border-width: $border-width;
}
&:hover {
background-color: $background-color-hover;
border-color: $border-color-hover;
color: $color-hover;
}
@if $outline-color-focus == auto {
$outline-color-focus: if(
$background-color-lightness > $background-color-lightness-threshold,
$color,
$background-color
);
}
@if $include-focus-styles {
&:focus {
outline: $outline-width-focus $outline-style-focus $outline-color-focus;
outline-offset: $outline-offset-focus;
}
}
@if $background-color-disabled == undefined {
$background-color-disabled: $background-color;
}
@if $border-color-disabled == undefined {
$border-color-disabled: $background-color;
}
@if $color-disabled == undefined {
$color-disabled: $color;
}
@if $include-disabled-styles {
&:disabled,
&[aria-disabled='true'] {
background-color: $background-color-disabled;
border-color: $border-color-disabled;
color: $color-disabled;
opacity: $opacity-disabled;
}
}
}