|
1 | 1 | /* stylelint-disable selector-max-specificity */
|
2 | 2 | .AvatarStack {
|
3 | 3 | --avatar-border-width: 1px;
|
4 |
| - --overlap-size: calc(var(--avatar-stack-size) * 0.55); |
5 |
| - --overlap-size-avatar-three-plus: calc(var(--avatar-stack-size) * 0.85); |
6 | 4 | --mask-size: calc(100% + (var(--avatar-border-width) * 2));
|
7 | 5 | --mask-start: -1;
|
8 | 6 | --opacity-step: 15%;
|
|
13 | 11 | height: var(--avatar-stack-size);
|
14 | 12 | isolation: isolate;
|
15 | 13 |
|
| 14 | + &:where([data-variant='cascade']) { |
| 15 | + --overlap-size: calc(var(--avatar-stack-size) * 0.55); |
| 16 | + --overlap-size-avatar-three-plus: calc(var(--avatar-stack-size) * 0.85); |
| 17 | + } |
| 18 | + |
| 19 | + &:where([data-variant='stack']) { |
| 20 | + --overlap-size: calc(var(--avatar-stack-size) * 0.55); |
| 21 | + --overlap-size-avatar-three-plus: calc(var(--avatar-stack-size) * 0.55); |
| 22 | + } |
| 23 | + |
16 | 24 | &:where([data-responsive]) {
|
17 | 25 | @media screen and (--viewportRange-narrow) {
|
18 | 26 | --avatar-stack-size: var(--stackSize-narrow);
|
|
27 | 35 | }
|
28 | 36 | }
|
29 | 37 |
|
30 |
| - &:where([data-avatar-count='1']) { |
| 38 | + &:where([data-avatar-count='1'][data-shape='circle']) { |
31 | 39 | .AvatarItem {
|
32 | 40 | /* stylelint-disable-next-line primer/box-shadow */
|
33 | 41 | box-shadow: 0 0 0 var(--avatar-border-width) var(--avatar-borderColor);
|
34 | 42 | }
|
35 | 43 | }
|
36 | 44 |
|
| 45 | + &:where([data-avatar-count='1'][data-shape='square']) .AvatarItem { |
| 46 | + /* stylelint-disable-next-line primer/box-shadow */ |
| 47 | + box-shadow: 1px 0 rgba(0, 0, 0, 1); |
| 48 | + } |
| 49 | + |
| 50 | + &:where([data-avatar-count='1'][data-shape='square'][data-align-right]) .AvatarItem { |
| 51 | + /* stylelint-disable-next-line primer/box-shadow */ |
| 52 | + box-shadow: -1px 0 rgba(0, 0, 0, 1); |
| 53 | + } |
| 54 | + |
37 | 55 | &:where([data-avatar-count='2']) {
|
38 | 56 | /*
|
39 | 57 | MIN-WIDTH CALC FORMULA EXPLAINED:
|
|
43 | 61 | min-width: calc(var(--avatar-stack-size) + (var(--avatar-stack-size) - var(--overlap-size)));
|
44 | 62 | }
|
45 | 63 |
|
46 |
| - &:where([data-avatar-count='3']) { |
| 64 | + &:where([data-avatar-count='3'][data-variant='cascade']) { |
47 | 65 | /*
|
48 | 66 | MIN-WIDTH CALC FORMULA EXPLAINED:
|
49 | 67 | avatar size ➡️ var(--avatar-stack-size)
|
|
56 | 74 | );
|
57 | 75 | }
|
58 | 76 |
|
59 |
| - &:where([data-avatar-count='3+']) { |
| 77 | + &:where([data-avatar-count='3'][data-variant='stack']) { |
| 78 | + /* |
| 79 | + MIN-WIDTH CALC FORMULA EXPLAINED: |
| 80 | + avatar size ➡️ var(--avatar-stack-size) |
| 81 | + plus the visible part of the 2nd avatar & 3rd avatar ➡️ var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus) * 2 |
| 82 | + */ |
| 83 | + min-width: calc(var(--avatar-stack-size) + (var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus)) * 2); |
| 84 | + } |
| 85 | + |
| 86 | + &:where([data-avatar-count='3+'][data-variant='cascade']) { |
60 | 87 | /*
|
61 | 88 | MIN-WIDTH CALC FORMULA EXPLAINED:
|
62 | 89 | avatar size ➡️ var(--avatar-stack-size)
|
|
69 | 96 | );
|
70 | 97 | }
|
71 | 98 |
|
| 99 | + &:where([data-avatar-count='3+'][data-variant='stack']) { |
| 100 | + /* |
| 101 | + MIN-WIDTH CALC FORMULA EXPLAINED: |
| 102 | + avatar size ➡️ var(--avatar-stack-size) |
| 103 | + plus the visible part of the 2nd to 4th avatars ➡️ var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus) * 3 |
| 104 | + */ |
| 105 | + min-width: calc(var(--avatar-stack-size) + (var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus)) * 3); |
| 106 | + |
| 107 | + --overlap-size: var(--overlap-size-avatar-three-plus); |
| 108 | + } |
| 109 | + |
72 | 110 | &:where([data-align-right]) {
|
73 | 111 | --mask-start: 1;
|
74 | 112 |
|
|
100 | 138 | mask-position 0.2s ease-in-out,
|
101 | 139 | mask-size 0.2s ease-in-out;
|
102 | 140 |
|
103 |
| - &:is(img) { |
| 141 | + .AvatarStack:where([data-shape='circle']) &:is(img) { |
104 | 142 | /* stylelint-disable-next-line primer/box-shadow */
|
105 | 143 | box-shadow: 0 0 0 var(--avatar-border-width) transparent;
|
106 | 144 | }
|
107 | 145 |
|
| 146 | + .AvatarStack:where([data-shape='square']) &:is(img) { |
| 147 | + /* stylelint-disable-next-line primer/box-shadow */ |
| 148 | + box-shadow: 1px 0 rgba(255, 255, 255, 1); |
| 149 | + } |
| 150 | + |
| 151 | + .AvatarStack:where([data-shape='square'][data-align-right]) &:is(img) { |
| 152 | + /* stylelint-disable-next-line primer/box-shadow */ |
| 153 | + box-shadow: -1px 0 rgba(255, 255, 255, 1); |
| 154 | + } |
| 155 | + |
108 | 156 | &:first-child {
|
109 | 157 | margin-inline-start: 0;
|
110 | 158 | }
|
111 | 159 |
|
112 | 160 | &:nth-child(n + 2) {
|
113 | 161 | /* stylelint-disable-next-line primer/spacing */
|
114 | 162 | margin-inline-start: calc(var(--overlap-size) * -1);
|
115 |
| - /* stylelint-disable-next-line declaration-property-value-no-unknown */ |
116 |
| - mask-image: radial-gradient(at 50% 50%, rgb(0, 0, 0) 70%, rgba(0, 0, 0, 0) 71%), linear-gradient(rgb(0, 0, 0) 0 0); |
117 | 163 | mask-repeat: no-repeat, no-repeat;
|
118 | 164 | mask-size:
|
119 | 165 | var(--mask-size) var(--mask-size),
|
|
135 | 181 | padding: 0.1px;
|
136 | 182 | }
|
137 | 183 |
|
138 |
| - &:nth-child(n + 3) { |
| 184 | + /* Circular mask */ |
| 185 | + .AvatarStack:where([data-shape='circle']) &:nth-child(n + 2) { |
| 186 | + /* stylelint-disable-next-line declaration-property-value-no-unknown */ |
| 187 | + mask-image: radial-gradient(at 50% 50%, rgb(0, 0, 0) 70%, rgba(0, 0, 0, 0) 71%), linear-gradient(rgb(0, 0, 0) 0 0); |
| 188 | + } |
| 189 | + |
| 190 | + /* Square mask */ |
| 191 | + .AvatarStack:where([data-shape='square']) &:nth-child(n + 2) { |
| 192 | + /* stylelint-disable-next-line declaration-property-value-no-unknown */ |
| 193 | + mask-image: linear-gradient(at 50% 50%, rgb(0, 0, 0) 70%, rgba(0, 0, 0, 0) 71%), linear-gradient(rgb(0, 0, 0) 0 0); |
| 194 | + } |
| 195 | + |
| 196 | + /* Cascade variant override for nth-child(n + 3) */ |
| 197 | + .AvatarStack:where([data-variant='cascade']) &:nth-child(n + 3) { |
139 | 198 | --overlap-size: var(--overlap-size-avatar-three-plus);
|
140 | 199 |
|
141 | 200 | /* stylelint-disable-next-line alpha-value-notation */
|
142 | 201 | opacity: calc(100% - 2 * var(--opacity-step));
|
143 | 202 | }
|
144 | 203 |
|
145 |
| - &:nth-child(n + 4) { |
| 204 | + /* Cascade variant override for nth-child(n + 4) */ |
| 205 | + .AvatarStack:where([data-variant='cascade']) &:nth-child(n + 4) { |
146 | 206 | /* stylelint-disable-next-line alpha-value-notation */
|
147 | 207 | opacity: calc(100% - 3 * var(--opacity-step));
|
148 | 208 | }
|
149 | 209 |
|
150 |
| - &:nth-child(n + 5) { |
| 210 | + /* Cascade variant override for nth-child(n + 5) */ |
| 211 | + .AvatarStack:where([data-variant='cascade']) &:nth-child(n + 5) { |
151 | 212 | /* stylelint-disable-next-line alpha-value-notation */
|
152 | 213 | opacity: calc(100% - 4 * var(--opacity-step));
|
153 | 214 | }
|
154 | 215 |
|
| 216 | + .AvatarStack:where([data-shape='square']) &:nth-child(1) { |
| 217 | + z-index: 5; |
| 218 | + } |
| 219 | + |
| 220 | + .AvatarStack:where([data-shape='square']) &:nth-child(2) { |
| 221 | + z-index: 4; |
| 222 | + } |
| 223 | + |
| 224 | + .AvatarStack:where([data-shape='square']) &:nth-child(3) { |
| 225 | + z-index: 3; |
| 226 | + } |
| 227 | + |
| 228 | + .AvatarStack:where([data-shape='square']) &:nth-child(4) { |
| 229 | + z-index: 2; |
| 230 | + } |
| 231 | + |
| 232 | + .AvatarStack:where([data-shape='square']) &:nth-child(5) { |
| 233 | + z-index: 1; |
| 234 | + } |
| 235 | + |
155 | 236 | &:nth-child(n + 6) {
|
156 | 237 | visibility: hidden;
|
157 | 238 | opacity: 0;
|
|
0 commit comments