@@ -5,10 +5,35 @@ details.sd-dropdown {
55 font-weight : 700 ;
66 // don't overlap the chevron
77 padding-right : 3em !important ;
8- -moz-user-select : none ;
9- -ms-user-select : none ;
10- -webkit-user-select : none ;
118 user-select : none ;
9+ display : inline-flex ;
10+ justify-content : space-between ;
11+ align-items : center ;
12+ width : 100% ;
13+
14+ .sd-summary-text {
15+ flex-grow : 1 ;
16+ line-height : 1.5 ;
17+ padding-right : 0.5rem ;
18+ }
19+
20+ .sd-summary-state-marker {
21+ position : absolute ;
22+ right : 1em ;
23+ top : 50% ;
24+ transform : translateY (-50% );
25+ pointer-events : none ;
26+ display : inline-flex ;
27+ align-items : center ;
28+ justify-content : center ;
29+ width : 0.75em ;
30+ }
31+
32+ // The hover effect should only change opacity, not transform.
33+ // We are transforming the chevron elements instead, see below.
34+ & :hover .sd-summary-state-marker svg {
35+ opacity : 1 ;
36+ }
1237 }
1338
1439 & :hover {
@@ -54,7 +79,6 @@ details.sd-dropdown {
5479 summary :hover .sd-summary-up svg ,
5580 summary :hover .sd-summary-down svg {
5681 opacity : 1 ;
57- transform : scale (1.1 );
5882 }
5983
6084 .sd-summary-up svg ,
@@ -79,6 +103,61 @@ details.sd-dropdown {
79103 visibility : hidden ;
80104 }
81105
106+ // Chevron transitions
107+ .sd-summary-chevron-right i ,
108+ .sd-summary-chevron-down i {
109+ display : inline-block ;
110+ transform-origin : center ;
111+ opacity : 0.6 ;
112+ }
113+
114+ // The chevron rotation animations are applied to
115+ // the icon inside the dropdown title div
116+ & [open ] > .sd-summary-title .sd-summary-chevron-right i {
117+ transform : rotate (90deg );
118+ animation : rotate- to- 90 0.25s ease-in-out ;
119+ }
120+
121+ & [open ] > .sd-summary-title .sd-summary-chevron-down i {
122+ transform : rotate (-180deg );
123+ animation : rotate- to- negative- 180 0.25s ease-in-out ;
124+ }
125+
126+ & :not ([open ]) > .sd-summary-title .sd-summary-chevron-right i {
127+ transform : rotate (0deg );
128+ animation : rotate- to- 0- from- 90 0.25s ease-in-out ;
129+ }
130+
131+ & :not ([open ]) > .sd-summary-title .sd-summary-chevron-down i {
132+ transform : rotate (0deg );
133+ animation : rotate- to- 0- from- negative- 180 0.25s ease-in-out ;
134+ }
135+
136+ > .sd-summary-title :hover .sd-summary-chevron-right i ,
137+ > .sd-summary-title :hover .sd-summary-chevron-down i {
138+ opacity : 1 ;
139+ }
140+
141+ // Combined transforms for each state with hover. These cover
142+ // the cases where the chevron is rotated, say, when the dropdown
143+ // is open or if the chevron starts rotated (e.g. in the down-up
144+ // state).
145+ & :not ([open ]) > .sd-summary-title :hover .sd-summary-chevron-right i {
146+ transform : scale (1.1 );
147+ }
148+
149+ & :not ([open ]) > .sd-summary-title :hover .sd-summary-chevron-down i {
150+ transform : scale (1.1 );
151+ }
152+
153+ & [open ] > .sd-summary-title :hover .sd-summary-chevron-right i {
154+ transform : rotate (90deg ) scale (1.1 );
155+ }
156+
157+ & [open ] > .sd-summary-title :hover .sd-summary-chevron-down i {
158+ transform : rotate (-180deg ) scale (1.1 );
159+ }
160+
82161 // Hide the card body border when not open
83162 & :not ([open ]).sd-card {
84163 border : none ;
@@ -90,18 +169,10 @@ details.sd-dropdown {
90169
91170 // Transition animation
92171 & .sd-fade-in [open ] summary ~ * {
93- -moz-animation : sd- fade- in 0.5s ease-in-out ;
94- -webkit-animation : sd- fade- in 0.5s ease-in-out ;
95172 animation : sd- fade- in 0.5s ease-in-out ;
96173 }
97174
98175 & .sd-fade-in-slide-down [open ] summary ~ * {
99- -moz-animation :
100- sd- fade- in 0.5s ease-in-out ,
101- sd- slide- down 0.5s ease-in-out ;
102- -webkit-animation :
103- sd- fade- in 0.5s ease-in-out ,
104- sd- slide- down 0.5s ease-in-out ;
105176 animation :
106177 sd- fade- in 0.5s ease-in-out ,
107178 sd- slide- down 0.5s ease-in-out ;
@@ -135,3 +206,43 @@ details.sd-dropdown {
135206 transform : translate (0 , 0 );
136207 }
137208}
209+
210+ @keyframes rotate-to-90 {
211+ from {
212+ transform : rotate (0deg ) scale (1.1 );
213+ }
214+ to {
215+ transform : rotate (90deg ) scale (1.1 );
216+ }
217+ }
218+
219+ @keyframes rotate-to-0-from-90 {
220+ from {
221+ transform : rotate (90deg ) scale (1.1 );
222+ }
223+ to {
224+ transform : rotate (0deg ) scale (1.1 );
225+ }
226+ }
227+
228+ // TODO: These keyframes are disabled for now to maintain
229+ // parity with Sphinx Design upstream, which does not implement
230+ // the down-up chevron animation.
231+
232+ // @keyframes rotate-to-negative-180 {
233+ // from {
234+ // transform: rotate(0deg) scale(1.1);
235+ // }
236+ // to {
237+ // transform: rotate(-180deg) scale(1.1);
238+ // }
239+ // }
240+
241+ // @keyframes rotate-to-0-from-negative-180 {
242+ // from {
243+ // transform: rotate(-180deg) scale(1.1);
244+ // }
245+ // to {
246+ // transform: rotate(0deg) scale(1.1);
247+ // }
248+ // }
0 commit comments