forked from carbon-design-system/carbon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_mixins.scss
111 lines (99 loc) · 2.64 KB
/
_mixins.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
//
// Copyright IBM Corp. 2016, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//
@use 'vars' as *;
@use '../../config' as *;
@use '../../motion' as *;
@use '../../spacing' as *;
@use '../../theme' as *;
@use '../../type' as *;
@use '../../utilities/component-reset';
@use '../../utilities/convert' as *;
@use '../../utilities/custom-property';
@use 'tokens' as *;
$button-focus-color: custom-property.get-var('button-focus-color', $focus);
@mixin button-base {
@include component-reset.reset;
@include type-style('body-compact-01');
position: relative;
display: inline-flex;
width: max-content;
max-width: rem(320px);
min-height: $button-height;
flex-shrink: 0;
align-items: center;
justify-content: space-between;
padding: $button-padding;
// Fix to remove added margins on buttons in safari (see #5155)
margin: 0;
border-radius: $button-border-radius;
cursor: pointer;
outline: none;
text-align: left;
text-decoration: none;
transition: background $duration-fast-01 motion(entrance, productive),
box-shadow $duration-fast-01 motion(entrance, productive),
border-color $duration-fast-01 motion(entrance, productive),
outline $duration-fast-01 motion(entrance, productive);
vertical-align: top;
&:disabled,
&:hover:disabled,
&:focus:disabled,
&.#{$prefix}--btn--disabled,
&.#{$prefix}--btn--disabled:hover,
&.#{$prefix}--btn--disabled:focus {
border-color: $button-disabled;
background: $button-disabled;
box-shadow: none;
color: $text-on-color-disabled;
cursor: not-allowed;
}
.#{$prefix}--btn__icon {
position: absolute;
right: rem(16px);
width: rem(16px);
height: rem(16px);
flex-shrink: 0;
}
}
/// Button variant styles
/// @access private
/// @group button
@mixin button-theme(
$bg-color,
$border-color,
$font-color,
$hover-bg-color,
$icon-color,
$active-color
) {
border-width: $button-outline-width;
border-style: solid;
border-color: $border-color;
background-color: $bg-color;
color: $font-color;
&:hover {
background-color: $hover-bg-color;
}
&:focus {
border-color: $button-focus-color;
box-shadow: inset 0 0 0 $button-outline-width $button-focus-color,
inset 0 0 0 $button-border-width $background;
}
&:active {
background-color: $active-color;
}
.#{$prefix}--btn__icon,
.#{$prefix}--btn__icon path:not([data-icon-path]):not([fill='none']) {
fill: $icon-color;
}
}
@mixin button-padding-large {
align-items: baseline;
padding-top: $spacing-05;
padding-right: $spacing-10;
padding-left: $spacing-05;
}