Repository navigation
Expand file tree
/
Copy path_menu-button.scss
More file actions
85 lines (73 loc) · 2.8 KB
/
Copy path_menu-button.scss
File metadata and controls
85 lines (73 loc) · 2.8 KB
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
@import "carbon-components/scss/globals/scss/vars";
@import "carbon-components/scss/globals/scss/helper-mixins";
@import "carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/import-once/import-once";
/// MenuButton trigger (v10 has no `.bx--menu-button` styles to vendor).
/// Rotates the trigger's chevron icon while the menu is open.
/// @access private
/// @group components
@mixin menu-button {
.#{$prefix}--menu-button__trigger .#{$prefix}--btn__icon {
transition: transform $duration--fast-01 motion(standard, productive);
}
.#{$prefix}--menu-button__trigger--open .#{$prefix}--btn__icon {
transform: rotate(180deg);
}
// Extra-small (Carbon React size="xs", 24px). Neither Button's "small"
// class (32px) nor any other Button size lands on 24px, so shrink further
// on top of the "small" size already passed to the trigger.
.#{$prefix}--menu-button__trigger--xs {
min-height: to-rem(24px);
padding-top: 0;
padding-bottom: 0;
}
/// Icon-only MenuButton uses Menu (box-shadow) with an overflow-style
/// trigger. OverflowMenu hides the seam with a ::after bridge on the
/// options list; Menu has no equivalent, so the menu shadow paints onto
/// the open trigger. Mirror that bridge for the attached icon-only case.
/// Widths match the overflow-menu trigger sizes (sm/md/xl + our xs).
.#{$prefix}--menu[data-carbon-menu-button-icon-only] {
&::after {
position: absolute;
display: block;
background-color: $layer;
content: "";
}
&[data-floating-menu-direction="bottom"]::after {
top: to-rem(-3px);
left: 0;
width: to-rem(32px);
height: to-rem(3px);
}
&[data-floating-menu-direction="top"]::after {
bottom: to-rem(-3px);
left: 0;
width: to-rem(32px);
height: to-rem(3px);
}
&.#{$prefix}--menu--xs[data-floating-menu-direction="bottom"]::after,
&.#{$prefix}--menu--xs[data-floating-menu-direction="top"]::after {
width: to-rem(24px);
}
&.#{$prefix}--menu--md[data-floating-menu-direction="bottom"]::after,
&.#{$prefix}--menu--md[data-floating-menu-direction="top"]::after {
width: to-rem(40px);
}
&.#{$prefix}--menu--lg[data-floating-menu-direction="bottom"]::after,
&.#{$prefix}--menu--lg[data-floating-menu-direction="top"]::after {
width: to-rem(48px);
}
&[data-carbon-align="end"][data-floating-menu-direction="bottom"]::after,
&[data-carbon-align="end"][data-floating-menu-direction="top"]::after {
right: 0;
left: auto;
}
&[data-carbon-align="center"][data-floating-menu-direction="bottom"]::after,
&[data-carbon-align="center"][data-floating-menu-direction="top"]::after {
left: 50%;
transform: translateX(-50%);
}
}
}
@include exports("menu-button") {
@include menu-button;
}