| 1 |
details.sd-dropdown { |
| 2 |
|
| 3 |
position: relative; |
| 4 |
font-size: var(--sd-fontsize-dropdown); |
| 5 |
|
| 6 |
&:hover { |
| 7 |
cursor: pointer; |
| 8 |
} |
| 9 |
|
| 10 |
.sd-summary-content { |
| 11 |
cursor: default; |
| 12 |
} |
| 13 |
|
| 14 |
summary.sd-summary-title { |
| 15 |
padding: 0.5em 0.6em 0.5em 1em; |
| 16 |
font-size: var(--sd-fontsize-dropdown-title); |
| 17 |
font-weight: var(--sd-fontweight-dropdown-title); |
| 18 |
|
| 19 |
// make the text un-selectable |
| 20 |
user-select: none; |
| 21 |
-moz-user-select: none; |
| 22 |
-ms-user-select: none; |
| 23 |
-webkit-user-select: none; |
| 24 |
|
| 25 |
// hide the default triangle marker |
| 26 |
list-style: none; |
| 27 |
// chrome doesn't yet support list-style |
| 28 |
&::-webkit-details-marker { |
| 29 |
display: none; |
| 30 |
} |
| 31 |
|
| 32 |
&:focus { |
| 33 |
outline: none; |
| 34 |
} |
| 35 |
|
| 36 |
// The title is split into three parts: |
| 37 |
// 1. The icon (optional), which should be on the left |
| 38 |
// 2. The text, which should be in the middle, and take all available space |
| 39 |
// 3. The state marker, which should be on the right |
| 40 |
|
| 41 |
display: inline-flex; |
| 42 |
justify-content: space-between; |
| 43 |
|
| 44 |
.sd-summary-icon { |
| 45 |
margin-right: 0.6em; |
| 46 |
// align the icon vertically within its container |
| 47 |
display: inline-flex; |
| 48 |
align-items: center; |
| 49 |
} |
| 50 |
|
| 51 |
.sd-summary-icon svg { |
| 52 |
opacity: 0.8; |
| 53 |
} |
| 54 |
|
| 55 |
.sd-summary-text { |
| 56 |
flex-grow: 1; |
| 57 |
line-height: 1.5; |
| 58 |
// note, we add right padding to the text, rather than a left margin to the state marker, |
| 59 |
// because when you rotate the state marker, left is no longer left |
| 60 |
padding-right: 0.5rem; |
| 61 |
} |
| 62 |
|
| 63 |
.sd-summary-state-marker { |
| 64 |
pointer-events: none; |
| 65 |
// align the icon vertically within its container |
| 66 |
display: inline-flex; |
| 67 |
align-items: center; |
| 68 |
} |
| 69 |
|
| 70 |
// make the state marker a bit more prominent when hovered |
| 71 |
.sd-summary-state-marker svg { |
| 72 |
opacity: 0.6; |
| 73 |
} |
| 74 |
&:hover .sd-summary-state-marker svg { |
| 75 |
opacity: 1; |
| 76 |
transform: scale(1.1); |
| 77 |
} |
| 78 |
|
| 79 |
} |
| 80 |
|
| 81 |
// Hide the octicon added as a placeholder for when no title is provided, |
| 82 |
// but only when the summary is open |
| 83 |
&[open] summary .sd-octicon.no-title { |
| 84 |
visibility: hidden; |
| 85 |
} |
| 86 |
|
| 87 |
// setup how state marker changes on open/close of the dropdown |
| 88 |
.sd-summary-chevron-right { |
| 89 |
transition: 0.25s; |
| 90 |
} |
| 91 |
&[open] > .sd-summary-title .sd-summary-chevron-right { |
| 92 |
transform: rotate(90deg); |
| 93 |
} |
| 94 |
&[open] > .sd-summary-title .sd-summary-chevron-down { |
| 95 |
transform: rotate(180deg); |
| 96 |
} |
| 97 |
|
| 98 |
// Hide the card body border when not open |
| 99 |
&:not([open]).sd-card { |
| 100 |
border: none; |
| 101 |
} |
| 102 |
&:not([open]) > .sd-card-header { |
| 103 |
border: 1px solid var(--sd-color-card-border); |
| 104 |
border-radius: 0.25rem; |
| 105 |
} |
| 106 |
|
| 107 |
// Transition animation |
| 108 |
&.sd-fade-in[open] summary ~ * { |
| 109 |
-moz-animation: sd-fade-in 0.5s ease-in-out; |
| 110 |
-webkit-animation: sd-fade-in 0.5s ease-in-out; |
| 111 |
animation: sd-fade-in 0.5s ease-in-out; |
| 112 |
} |
| 113 |
|
| 114 |
&.sd-fade-in-slide-down[open] summary ~ * { |
| 115 |
-moz-animation: sd-fade-in 0.5s ease-in-out, sd-slide-down 0.5s ease-in-out; |
| 116 |
-webkit-animation: sd-fade-in 0.5s ease-in-out, |
| 117 |
sd-slide-down 0.5s ease-in-out; |
| 118 |
animation: sd-fade-in 0.5s ease-in-out, sd-slide-down 0.5s ease-in-out; |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
.sd-col > .sd-dropdown { |
| 123 |
width: 100%; |
| 124 |
} |
| 125 |
|
| 126 |
.sd-summary-content > .sd-tab-set:first-child { |
| 127 |
margin-top: 0; |
| 128 |
} |
| 129 |
|
| 130 |
@keyframes sd-fade-in { |
| 131 |
0% { |
| 132 |
opacity: 0; |
| 133 |
} |
| 134 |
|
| 135 |
100% { |
| 136 |
opacity: 1; |
| 137 |
} |
| 138 |
} |
| 139 |
|
| 140 |
@keyframes sd-slide-down { |
| 141 |
0% { |
| 142 |
transform: translate(0, -10px); |
| 143 |
} |
| 144 |
|
| 145 |
100% { |
| 146 |
transform: translate(0, 0); |
| 147 |
} |
| 148 |
} |