-
Notifications
You must be signed in to change notification settings - Fork 171
/
Copy path_patterns_accordion.scss
115 lines (96 loc) · 2.56 KB
/
_patterns_accordion.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
@import 'settings';
@mixin vf-p-accordion {
$icon-size: map-get($icon-sizes, default);
.p-accordion__list {
list-style-type: none;
margin: 0 0 $spv--x-large 0;
padding: 0;
}
.p-accordion__group {
& + & {
@extend %vf-pseudo-border--top;
}
}
.p-accordion__tab {
@extend %single-border-text-vpadding--scaling;
@include vf-focus-themed;
background-color: inherit;
border: 0;
border-radius: 0;
font-size: inherit;
justify-content: flex-start;
margin-bottom: 0;
padding-right: $sph--large;
position: relative;
text-align: left;
width: 100%;
z-index: 2;
&::before {
@extend %icon;
@include vf-icon-chevron-themed;
@include vf-transition($property: transform, $duration: fast);
content: '';
margin-right: $sph--large;
}
// aria-selected controls the open and closed state for the accordion tab
&[aria-expanded='true'] {
// override base expanded button styles
background-color: inherit;
&:hover {
background-color: $colors--theme--background-hover;
}
@include vf-transition(#{background-color, border-color});
}
&[aria-expanded='false'] {
&::before {
transform: rotate(-90deg);
}
@include vf-transition(#{background-color, border-color});
}
}
.p-accordion__heading {
margin-bottom: 0;
max-width: none;
padding-top: 0;
> .p-accordion__tab {
font-size: inherit;
font-weight: inherit;
line-height: inherit;
}
}
// stylelint-disable selector-max-type
.p-heading--2 > .p-accordion__tab::before,
h2.p-accordion__heading > .p-accordion__tab::before {
@include vf-icon-size($x-height);
vertical-align: 0;
}
.p-heading--3 > .p-accordion__tab::before,
.p-heading--4 > .p-accordion__tab::before,
h3.p-accordion__heading > .p-accordion__tab::before,
h4.p-accordion__heading > .p-accordion__tab::before {
vertical-align: 0;
}
// stylelint-enable selector-max-type
.p-accordion__panel {
margin: 0;
overflow: auto; // include child margins into its height
padding-left: $icon-size + $sph--large * 2;
@include vf-transition(#{transform, opacity}, fast);
// Hides panel content
&[aria-hidden='true'] {
height: 0;
opacity: 0;
transform: translate3d(0, -0.5rem, 0);
visibility: hidden;
}
&[aria-hidden='false'] {
height: auto;
opacity: 1;
transform: translate3d(0, 0, 0);
visibility: visible;
}
&.has-tick-elements {
padding-left: 1em;
}
}
}