forked from carbon-design-system/carbon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_copy-button.scss
94 lines (77 loc) · 2.25 KB
/
_copy-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
90
91
92
93
94
//
// Copyright IBM Corp. 2016, 2023
//
// 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 '../button';
@use '../../config' as *;
@use '../../spacing' as *;
@use '../../motion' as *;
@use '../../theme' as *;
@use '../../type' as *;
@use '../../utilities/box-shadow' as *;
@use '../../utilities/focus-outline' as *;
@use '../../utilities/keyframes' as *;
@use '../../utilities/tooltip' as *;
@use '../../utilities/visually-hidden' as *;
@mixin copy-button {
.#{$prefix}--copy-btn {
@include reset;
position: relative;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
border: none;
background-color: $layer;
cursor: pointer;
&:hover {
background-color: $layer-hover;
}
&:active {
background-color: $layer-active;
}
&::before {
@include tooltip--caret;
display: none;
}
.#{$prefix}--copy-btn__feedback {
@include tooltip--content('icon');
display: none;
overflow: visible;
box-sizing: content-box;
margin: auto;
clip: auto;
}
&:focus {
@include focus-outline('outline');
outline-color: $focus;
}
&.#{$prefix}--copy-btn--animating::before,
&.#{$prefix}--copy-btn--animating .#{$prefix}--copy-btn__feedback {
display: block;
}
&.#{$prefix}--copy-btn--animating::before {
border: none;
}
&.#{$prefix}--copy-btn--animating.#{$prefix}--copy-btn--fade-out::before,
&.#{$prefix}--copy-btn--animating.#{$prefix}--copy-btn--fade-out
.#{$prefix}--copy-btn__feedback {
// https://github.com/stylelint/stylelint/issues/2363
animation: $duration-fast-02 motion(standard, productive) #{$prefix}--hide-feedback;
}
&.#{$prefix}--copy-btn--animating.#{$prefix}--copy-btn--fade-in::before,
&.#{$prefix}--copy-btn--animating.#{$prefix}--copy-btn--fade-in
.#{$prefix}--copy-btn__feedback {
animation: $duration-fast-02 motion(standard, productive) #{$prefix}--show-feedback;
}
}
.#{$prefix}--copy-btn svg {
fill: $icon-primary;
}
// Needs to come after reset so hidden text is not set to font-size: 100%
.#{$prefix}--copy {
font-size: 0;
}
}