profile-avatar-selector.css (4900B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 :host { 6 /* These z-indexes are used to correctly layer elements in the profiles 7 * avatar selection ui */ 8 --profiles-low-layer: 1; 9 --profiles-high-layer: 2; 10 11 --mover-size: 24px; 12 --mover-offset: -8px; 13 14 --avatar-selection-width: 100%; 15 } 16 17 .button-group { 18 display: flex; 19 justify-content: center; 20 21 moz-button::part(button) { 22 border-radius: 0; 23 } 24 25 moz-button:first-child::part(button) { 26 border-end-end-radius: 0; 27 border-start-end-radius: 0; 28 border-start-start-radius: var(--button-border-radius); 29 border-end-start-radius: var(--button-border-radius); 30 } 31 32 moz-button:last-child::part(button) { 33 border-end-start-radius: 0; 34 border-start-start-radius: 0; 35 border-end-end-radius: var(--button-border-radius); 36 border-start-end-radius: var(--button-border-radius); 37 } 38 } 39 40 #avatars::part(inputs) { 41 flex-direction: row; 42 flex-wrap: wrap; 43 gap: var(--space-xxsmall); 44 width: 100%; 45 justify-content: center; 46 } 47 48 .avatar-button::part(button) { 49 --button-icon-fill: transparent; 50 --button-icon-stroke: currentColor; 51 52 /* Scale up 16x16 icon (12x12 + 4x4 padding) to 24px for normal display size */ 53 --icon-size: 24px; 54 } 55 56 #avatar-selector { 57 width: 317px; 58 } 59 60 #upload-text { 61 color: var(--link-color); 62 text-decoration: underline; 63 } 64 65 #content { 66 display: flex; 67 flex-direction: column; 68 gap: var(--space-large); 69 } 70 71 .custom-avatar-add-image-header, 72 .custom-avatar-crop-header { 73 display: flex; 74 justify-content: center; 75 align-items: center; 76 padding-bottom: var(--space-large); 77 border-bottom: var(--card-border); 78 font-weight: var(--heading-font-weight); 79 80 #back-button { 81 margin-inline-end: auto; 82 } 83 84 #spacer { 85 margin-inline-start: auto; 86 width: var(--button-size-icon); 87 } 88 } 89 90 .custom-avatar-upload-area, 91 .custom-avatar-crop-area { 92 position: relative; 93 width: var(--avatar-selection-width); 94 aspect-ratio: 1 / 1; 95 } 96 97 .custom-avatar-upload-area { 98 display: flex; 99 flex-direction: column; 100 justify-content: space-between; 101 102 &:focus-within { 103 outline: 1px auto; 104 } 105 } 106 107 .custom-avatar-crop-area { 108 overflow: scroll; 109 } 110 111 #custom-image-input { 112 width: 100%; 113 height: 100%; 114 position: absolute; 115 z-index: var(--profiles-low-layer); 116 opacity: 0; 117 cursor: pointer; 118 } 119 120 #file-messages { 121 width: 100%; 122 height: 100%; 123 position: absolute; 124 display: flex; 125 flex-direction: column; 126 justify-content: center; 127 align-items: center; 128 gap: var(--space-small); 129 130 > img { 131 -moz-context-properties: fill; 132 fill: currentColor; 133 } 134 } 135 136 #upload-text { 137 color: var(--link-color); 138 text-decoration: underline; 139 } 140 141 #drag-text { 142 font-size: var(--font-size-small); 143 } 144 145 #avatar-selection-container { 146 position: sticky; 147 inset: 0; 148 width: 100%; 149 height: 100%; 150 z-index: var(--profiles-low-layer); 151 overflow: clip; 152 } 153 154 #highlight { 155 box-sizing: border-box; 156 cursor: move; 157 position: relative; 158 pointer-events: auto; 159 z-index: var(--profiles-high-layer); 160 inset: 0; 161 162 border-radius: var(--border-radius-circle); 163 outline-offset: var(--focus-outline-offset); 164 } 165 166 #highlight-background { 167 width: 100%; 168 height: 100%; 169 outline: 355px solid rgba(0, 0, 0, 0.7); 170 border-radius: var(--border-radius-circle); 171 172 border: 2px dashed rgba(255, 255, 255, 0.8); 173 box-sizing: border-box; 174 175 position: relative; 176 z-index: -1; 177 178 pointer-events: none; 179 } 180 181 .mover-target { 182 display: flex; 183 align-items: center; 184 justify-content: center; 185 position: absolute; 186 width: var(--mover-size); 187 height: var(--mover-size); 188 z-index: var(--profiles-high-layer); 189 190 &.direction-topLeft { 191 cursor: nwse-resize; 192 top: var(--mover-offset); 193 left: var(--mover-offset); 194 } 195 196 &.direction-topRight { 197 cursor: nesw-resize; 198 top: var(--mover-offset); 199 right: var(--mover-offset); 200 } 201 202 &.direction-bottomLeft { 203 cursor: nesw-resize; 204 bottom: var(--mover-offset); 205 left: var(--mover-offset); 206 } 207 208 &.direction-bottomRight { 209 cursor: nwse-resize; 210 bottom: var(--mover-offset); 211 right: var(--mover-offset); 212 } 213 214 &:hover .mover { 215 transform: scale(1.05); 216 } 217 218 .mover { 219 background-color: white; 220 border-radius: var(--border-radius-circle); 221 box-shadow: 0 0 4px rgba(0, 0, 0, 0.5); 222 transition: transform 125ms cubic-bezier(0.07, 0.95, 0, 1); 223 position: relative; 224 height: 8px; 225 width: 8px; 226 pointer-events: none; 227 228 @media (forced-colors) { 229 background-color: ButtonText; 230 } 231 } 232 } 233 234 #custom-avatar-image { 235 position: absolute; 236 inset: 0; 237 238 &.width-full { 239 width: 100%; 240 } 241 242 &.height-full { 243 height: 100%; 244 } 245 } 246 247 .custom-avatar-actions { 248 justify-content: center; 249 } 250 251 moz-visual-picker-item { 252 --visual-picker-item-border-color: transparent; 253 }