| 1 | import { ES_APPLE } from "../libclienteweb/ES_APPLE.js" |
| 2 | import { getAttribute } from "../libclienteweb/getAttribute.js" |
| 3 | import { querySelector } from "../libclienteweb/querySelector.js" |
| 4 | |
| 5 | class MdAppBar extends HTMLElement { |
| 6 | |
| 7 | getContent() { |
| 8 | return /* HTML */` |
| 9 | <style> |
| 10 | |
| 11 | :host { |
| 12 | display: flex; |
| 13 | box-sizing: border-box; |
| 14 | align-items: center; |
| 15 | padding: 0 0.25rem; |
| 16 | background-color: var(--md-sys-color-surface); |
| 17 | position: sticky; |
| 18 | z-index: 1; |
| 19 | left: env(titlebar-area-x, 0); |
| 20 | top: env(titlebar-area-y, 0); |
| 21 | height: env(titlebar-area-height, 4rem); |
| 22 | width: env(titlebar-area-width, 100%); |
| 23 | } |
| 24 | |
| 25 | :host(.apple) { |
| 26 | height: env(titlebar-area-height, 3rem); |
| 27 | } |
| 28 | |
| 29 | :host(.scroll) { |
| 30 | background-color: var(--md-sys-color-surface-container-low); |
| 31 | } |
| 32 | |
| 33 | #navigation { |
| 34 | flex: 0 0 auto; |
| 35 | overflow: hidden |
| 36 | } |
| 37 | |
| 38 | #navigation ::slotted(*) { |
| 39 | color: var(--md-sys-color-on-surface); |
| 40 | } |
| 41 | |
| 42 | #acciones { |
| 43 | margin-left: auto; |
| 44 | flex: 0 0 auto; |
| 45 | overflow: hidden |
| 46 | } |
| 47 | |
| 48 | :host(.centered) #navigation, |
| 49 | :host(.centered) #acciones { |
| 50 | flex: 0 0 6rem; |
| 51 | overflow: hidden |
| 52 | } |
| 53 | |
| 54 | #headline::slotted(*) { |
| 55 | -webkit-app-region: drag; |
| 56 | flex: 1 1 auto; |
| 57 | white-space: nowrap; |
| 58 | text-overflow: ellipsis; |
| 59 | overflow: hidden; |
| 60 | font-family: var(--md-sys-typescale-title-large-font); |
| 61 | font-weight: var(--md-sys-typescale-title-large-weight); |
| 62 | font-size: var(--md-sys-typescale-title-large-size); |
| 63 | font-style: var(--md-sys-typescale-title-large-font-style); |
| 64 | letter-spacing: var(--md-sys-typescale-title-large-tracking); |
| 65 | line-height: var(--md-sys-typescale-title-large-line-height); |
| 66 | text-transform: var(--md-sys-typescale-title-large-text-transform); |
| 67 | text-decoration: var(--md-sys-typescale-title-large-text-decoration); |
| 68 | color: var(--md-sys-color-on-surface); |
| 69 | } |
| 70 | |
| 71 | :host(.centered) #headline::slotted(*) { |
| 72 | flex: 1 1 auto; |
| 73 | text-align: center |
| 74 | } |
| 75 | |
| 76 | </style> |
| 77 | |
| 78 | <span id="navigation"> |
| 79 | <slot name="navigation"></slot> |
| 80 | </span> |
| 81 | <slot id="headline"></slot> |
| 82 | <span id="acciones"> |
| 83 | <slot name="action"></slot> |
| 84 | </span>` |
| 85 | } |
| 86 | |
| 87 | constructor() { |
| 88 | super() |
| 89 | if (ES_APPLE) { |
| 90 | document.body.classList.add("apple") |
| 91 | document.body.classList.remove("material") |
| 92 | } else { |
| 93 | document.body.classList.add("material") |
| 94 | document.body.classList.remove("apple") |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * @private |
| 99 | * @readonly |
| 100 | */ |
| 101 | const shadow = this.attachShadow({ mode: "open" }) |
| 102 | shadow.innerHTML = this.getContent() |
| 103 | this._configuraAction = this._configuraAction.bind(this) |
| 104 | /** |
| 105 | * @private |
| 106 | * @type {number} |
| 107 | */ |
| 108 | this._posY = 0 |
| 109 | /** |
| 110 | * @private |
| 111 | * @type {boolean} |
| 112 | */ |
| 113 | this._scrolling = false |
| 114 | /** |
| 115 | * @private |
| 116 | * @type { HTMLSlotElement } |
| 117 | */ |
| 118 | this._navigation = querySelector(shadow, '[name="navigation"]') |
| 119 | /** |
| 120 | * @private |
| 121 | * @type { HTMLSlotElement } |
| 122 | */ |
| 123 | this._action = querySelector(shadow, '[name="action"]') |
| 124 | /** |
| 125 | * @private |
| 126 | * @type { HTMLHeadingElement | null } |
| 127 | */ |
| 128 | this._headline = null |
| 129 | /** |
| 130 | * @private |
| 131 | * @type { HTMLElement | null } |
| 132 | */ |
| 133 | this._adicional = null |
| 134 | this._action.addEventListener("slotchange", this._configuraAction) |
| 135 | addEventListener("scroll", () => this._onScroll()) |
| 136 | addEventListener("load", () => this.configurOtros()) |
| 137 | } |
| 138 | |
| 139 | connectedCallback() { |
| 140 | this.role = "toolbar" |
| 141 | this._configuraAction() |
| 142 | } |
| 143 | |
| 144 | configurOtros() { |
| 145 | const idAdicional = getAttribute(this, "adicional") |
| 146 | if (idAdicional !== "") { |
| 147 | this._adicional = document.getElementById(idAdicional) |
| 148 | if (this._adicional !== null) { |
| 149 | if (this.classList.contains("apple")) { |
| 150 | this._adicional.style.top = "env(titlebar-area-height, 3rem)" |
| 151 | } else { |
| 152 | this._adicional.style.top = "env(titlebar-area-height, 4rem)" |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | _configuraAction() { |
| 159 | const assignedElements = this._action.assignedElements() |
| 160 | if (this.isConnected) { |
| 161 | if (ES_APPLE) { |
| 162 | this.classList.add("apple") |
| 163 | this.classList.remove("material") |
| 164 | } else { |
| 165 | this.classList.add("material") |
| 166 | this.classList.remove("apple") |
| 167 | } |
| 168 | if (this.classList.contains("centered")) { |
| 169 | this.classList.remove("centrado") |
| 170 | this.classList.remove("justificado") |
| 171 | } else { |
| 172 | if (ES_APPLE && assignedElements.length <= 1) { |
| 173 | this.classList.add("centrado") |
| 174 | this.classList.remove("justificado") |
| 175 | } else { |
| 176 | this.classList.add("justificado") |
| 177 | this.classList.remove("centrado") |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | /** @private */ |
| 184 | _onScroll() { |
| 185 | this._posY = scrollY |
| 186 | if (!this._scrolling) { |
| 187 | requestAnimationFrame(() => this._avanza()) |
| 188 | } |
| 189 | this._scrolling = true |
| 190 | } |
| 191 | |
| 192 | /** @private */ |
| 193 | _avanza() { |
| 194 | if (this._posY === 0) { |
| 195 | this.classList.remove("scroll") |
| 196 | if (this._headline !== null) { |
| 197 | if (this._adicional === null) { |
| 198 | this._headline.classList.remove("scroll") |
| 199 | } else { |
| 200 | this._headline.classList.remove("scroll-adicional") |
| 201 | } |
| 202 | } |
| 203 | if (this._adicional !== null) { |
| 204 | this._adicional.classList.remove("scroll") |
| 205 | } |
| 206 | } else { |
| 207 | this.classList.add("scroll") |
| 208 | if (this._headline !== null) { |
| 209 | if (this._adicional === null) { |
| 210 | this._headline.classList.add("scroll") |
| 211 | } else { |
| 212 | this._headline.classList.add("scroll-adicional") |
| 213 | } |
| 214 | } |
| 215 | if (this._adicional !== null) { |
| 216 | this._adicional.classList.add("scroll") |
| 217 | } |
| 218 | } |
| 219 | this._scrolling = false |
| 220 | } |
| 221 | |
| 222 | } |
| 223 | |
| 224 | customElements.define("md-app-bar", MdAppBar) |
| 1 | .md-list { |
| 2 | margin: 0.5rem 0; |
| 3 | padding: 0; |
| 4 | list-style-type: none; |
| 5 | } |
| 6 | |
| 7 | .md-list .md-one-line, |
| 8 | .md-list .md-two-line, |
| 9 | .md-list .md-three-line { |
| 10 | position: relative; |
| 11 | display: flex; |
| 12 | box-sizing: border-box; |
| 13 | } |
| 14 | |
| 15 | /* container */ |
| 16 | .md-list .md-one-line::before, |
| 17 | .md-list .md-two-line::before, |
| 18 | .md-list .md-three-line::before { |
| 19 | content: ""; |
| 20 | position: absolute; |
| 21 | z-index: -2; |
| 22 | top: 0; |
| 23 | right: 0; |
| 24 | left: 0; |
| 25 | bottom: 0; |
| 26 | background-color: var(--md-sys-color-surface); |
| 27 | } |
| 28 | |
| 29 | /* state layer */ |
| 30 | .md-list .md-one-line::after, |
| 31 | .md-list .md-two-line::after, |
| 32 | .md-list .md-three-line::after { |
| 33 | content: ""; |
| 34 | position: absolute; |
| 35 | z-index: -1; |
| 36 | top: 0; |
| 37 | right: 0; |
| 38 | left: 0; |
| 39 | bottom: 0; |
| 40 | background-color: transparent; |
| 41 | } |
| 42 | |
| 43 | .md-list .md-one-line { |
| 44 | align-items: center; |
| 45 | gap: 1rem; |
| 46 | min-height: 3.5rem; |
| 47 | padding: 0.5rem 1.5rem 0.5rem 1rem; |
| 48 | } |
| 49 | |
| 50 | .md-list .md-one-line.video, |
| 51 | .md-list .md-two-line.video { |
| 52 | padding: 0.75rem 1.5rem 0.75rem 0; |
| 53 | } |
| 54 | |
| 55 | .md-list .md-two-line, |
| 56 | .md-list .md-three-line { |
| 57 | flex-flow: column; |
| 58 | } |
| 59 | |
| 60 | .md-list .md-two-line { |
| 61 | justify-content: center; |
| 62 | min-height: 4.5rem; |
| 63 | padding: 0.5rem 1.5rem 0.5rem 1rem; |
| 64 | } |
| 65 | |
| 66 | .md-list .md-two-line.icon, |
| 67 | .md-list .md-two-line.avatar, |
| 68 | .md-list .md-two-line.image, |
| 69 | .md-list .md-two-line.video, |
| 70 | .md-list .md-three-line.icon, |
| 71 | .md-list .md-three-line.avatar, |
| 72 | .md-list .md-three-line.image, |
| 73 | .md-list .md-three-line.video { |
| 74 | display: grid; |
| 75 | column-gap: 1rem; |
| 76 | row-gap: 0; |
| 77 | grid-template-areas: |
| 78 | "img headline" |
| 79 | "img supporting"; |
| 80 | } |
| 81 | |
| 82 | .md-list .md-two-line.icon, |
| 83 | .md-list .md-two-line.avatar, |
| 84 | .md-list .md-two-line.image, |
| 85 | .md-list .md-two-line.video { |
| 86 | align-content: center; |
| 87 | grid-template-rows: 1fr 1fr; |
| 88 | } |
| 89 | |
| 90 | .md-list .md-two-line.icon, |
| 91 | .md-list .md-three-line.icon { |
| 92 | grid-template-columns: var(--iconSize) 1fr; |
| 93 | } |
| 94 | |
| 95 | .md-list .md-two-line.avatar, |
| 96 | .md-list .md-three-line.avatar { |
| 97 | grid-template-columns: var(--avatarSize) 1fr; |
| 98 | } |
| 99 | |
| 100 | .md-list .md-two-line.image, |
| 101 | .md-list .md-three-line.image { |
| 102 | grid-template-columns: var(--imageSize) 1fr; |
| 103 | } |
| 104 | |
| 105 | .md-list .md-two-line.video, |
| 106 | .md-list .md-three-line.video { |
| 107 | grid-template-columns: var(--videoWidth) 1fr; |
| 108 | } |
| 109 | |
| 110 | .md-list .md-three-line { |
| 111 | align-content: flex-start; |
| 112 | min-height: 5.5rem; |
| 113 | padding: 0.75rem 1.5rem 0.75rem 1rem; |
| 114 | } |
| 115 | |
| 116 | .md-list .md-three-line.video { |
| 117 | padding: 0.75rem 1.5rem 0.75rem 0; |
| 118 | } |
| 119 | |
| 120 | .md-list .md-three-line.icon, |
| 121 | .md-list .md-three-line.avatar, |
| 122 | .md-list .md-three-line.image, |
| 123 | .md-list .md-three-line.video { |
| 124 | align-content: start; |
| 125 | grid-template-rows: var(--md-sys-typescale-label-large-line-height) 1fr; |
| 126 | } |
| 127 | |
| 128 | /* state layer */ |
| 129 | .md-list .md-one-line:hover::after, |
| 130 | .md-list .md-two-line:hover::after, |
| 131 | .md-list .md-three-line:hover::after { |
| 132 | background-color: var(--md-sys-color-on-surface); |
| 133 | opacity: var(--md-sys-state-hover-state-layer-opacity); |
| 134 | } |
| 135 | |
| 136 | /* state layer */ |
| 137 | .md-list a.md-one-line:focus::after, |
| 138 | .md-list a.md-two-line:focus::after, |
| 139 | .md-list a.md-three-line:focus::after, |
| 140 | .md-list a.md-one-line:focus-visible::after, |
| 141 | .md-list a.md-two-line:focus-visible::after, |
| 142 | .md-list a.md-three-line:focus-visible::after { |
| 143 | background-color: var(--md-sys-color-on-surface); |
| 144 | opacity: var(--md-sys-state-focus-state-layer-opacity); |
| 145 | } |
| 146 | |
| 147 | .md-list a:focus, |
| 148 | .md-list a:focus-visible { |
| 149 | outline: none; |
| 150 | } |
| 151 | |
| 152 | .md-list a:active { |
| 153 | background-position: center; |
| 154 | background-image: |
| 155 | radial-gradient(circle, var(--md-riple-color) 1%, transparent 1%); |
| 156 | background-size: 100%; |
| 157 | animation-name: md-ripple; |
| 158 | animation-duration: var(--md-sys-motion-duration-500); |
| 159 | box-shadow: var(--md-box_shadow_level0) !important; |
| 160 | } |
| 161 | |
| 162 | /* state layer */ |
| 163 | .md-list a.md-one-line:active::after, |
| 164 | .md-list a.md-two-line:active::after, |
| 165 | .md-list a.md-three-line:active::after { |
| 166 | background-color: var(--md-sys-color-on-surface); |
| 167 | opacity: var(--md-sys-state-pressed-state-layer-opacity); |
| 168 | } |
| 169 | |
| 170 | .md-list a.md-two-line, |
| 171 | .md-list a.md-three-line { |
| 172 | text-decoration: none; |
| 173 | } |
| 174 | |
| 175 | .md-list a.md-two-line .headline, |
| 176 | .md-list a.md-three-line .headline { |
| 177 | text-decoration: underline; |
| 178 | } |
| 179 | |
| 180 | .md-list .headline { |
| 181 | grid-area: headline; |
| 182 | display: block; |
| 183 | box-sizing: border-box; |
| 184 | color: var(--md-sys-color-on-surface); |
| 185 | font-family: var(--md-sys-typescale-body-large-font); |
| 186 | font-weight: var(--md-sys-typescale-body-large-weight); |
| 187 | font-size: var(--md-sys-typescale-body-large-size); |
| 188 | font-style: var(--md-sys-typescale-body-large-font-style); |
| 189 | letter-spacing: var(--md-sys-typescale-body-large-tracking); |
| 190 | line-height: var(--md-sys-typescale-body-large-line-height); |
| 191 | text-transform: var(--md-sys-typescale-body-large-text-transform); |
| 192 | text-decoration: var(--md-sys-typescale-body-large-text-decoration); |
| 193 | max-height: var(--md-sys-typescale-body-large-line-height); |
| 194 | white-space: nowrap; |
| 195 | text-overflow: ellipsis; |
| 196 | overflow: hidden; |
| 197 | } |
| 198 | |
| 199 | .md-list .md-two-line.icon .headline, |
| 200 | .md-list .md-two-line.avatar .headline, |
| 201 | .md-list .md-two-line.image .headline, |
| 202 | .md-list .md-two-line.video .headline, |
| 203 | .md-list .md-three-line.icon .headline, |
| 204 | .md-list .md-three-line.avatar .headline, |
| 205 | .md-list .md-three-line.image .headline, |
| 206 | .md-list .md-three-line.video .headline { |
| 207 | align-self: end; |
| 208 | } |
| 209 | |
| 210 | .md-list .supporting { |
| 211 | grid-area: supporting; |
| 212 | display: -webkit-box; |
| 213 | -webkit-box-orient: vertical; |
| 214 | overflow: hidden; |
| 215 | box-sizing: border-box; |
| 216 | align-self: start; |
| 217 | font-family: var(--md-sys-typescale-body-medium-font); |
| 218 | font-weight: var(--md-sys-typescale-body-medium-weight); |
| 219 | font-size: var(--md-sys-typescale-body-medium-size); |
| 220 | font-style: var(--md-sys-typescale-body-medium-font-style); |
| 221 | letter-spacing: var(--md-sys-typescale-body-medium-tracking); |
| 222 | line-height: var(--md-sys-typescale-body-medium-line-height); |
| 223 | text-transform: var(--md-sys-typescale-body-medium-text-transform); |
| 224 | text-decoration: var(--md-sys-typescale-body-medium-text-decoration); |
| 225 | } |
| 226 | |
| 227 | .md-list .md-two-line .supporting { |
| 228 | max-height: var(--md-sys-typescale-body-medium-line-height); |
| 229 | line-clamp: 1; |
| 230 | -webkit-line-clamp: 1; |
| 231 | } |
| 232 | |
| 233 | .md-list .md-three-line .supporting { |
| 234 | max-height: calc(2 * var(--md-sys-typescale-body-medium-line-height)); |
| 235 | line-clamp: 2; |
| 236 | -webkit-line-clamp: 2; |
| 237 | } |
| 238 | |
| 239 | .md-list .avatar img, |
| 240 | .md-list .avatar label, |
| 241 | .md-list .avatar .material-symbols-outlined:first-child { |
| 242 | flex-shrink: 0; |
| 243 | background-color: var(--md-sys-color-primary-container); |
| 244 | color: var(--md-sys-color-on-primary-container); |
| 245 | border-radius: 50%; |
| 246 | width: var(--avatarSize); |
| 247 | height: var(--avatarSize); |
| 248 | } |
| 249 | |
| 250 | .md-list .avatar label { |
| 251 | display: inline-block; |
| 252 | font-family: var(--md-sys-typescale-title-medium-font); |
| 253 | font-weight: var(--md-sys-typescale-title-medium-weight); |
| 254 | font-size: var(--md-sys-typescale-title-medium-size); |
| 255 | font-style: var(--md-sys-typescale-title-medium-font-style); |
| 256 | letter-spacing: var(--md-sys-typescale-title-medium-tracking); |
| 257 | line-height: var(--md-sys-typescale-title-medium-line-height); |
| 258 | text-transform: var(--md-sys-typescale-title-medium-text-transform); |
| 259 | text-decoration: var(--md-sys-typescale-title-medium-text-decoration); |
| 260 | overflow: hidden; |
| 261 | } |
| 262 | |
| 263 | .md-list .avatar .material-symbols-outlined:first-child { |
| 264 | font-size: var(--avatarSize); |
| 265 | } |
| 266 | |
| 267 | .md-list .avatar.md-two-line img, |
| 268 | .md-list .avatar.md-two-line label, |
| 269 | .md-list .avatar.md-two-line .material-symbols-outlined:first-child { |
| 270 | grid-area: img; |
| 271 | align-self: center; |
| 272 | } |
| 273 | |
| 274 | .md-list .avatar.md-three-line img, |
| 275 | .md-list .avatar.md-three-line label, |
| 276 | .md-list .avatar.md-three-line .material-symbols-outlined:first-child { |
| 277 | grid-area: img; |
| 278 | align-self: start; |
| 279 | } |
| 280 | |
| 281 | .md-list .icon img, |
| 282 | .md-list .icon .material-symbols-outlined:first-child { |
| 283 | flex-shrink: 0; |
| 284 | color: var(--md-sys-color-on-surface-variant); |
| 285 | width: var(--iconSize); |
| 286 | height: var(--iconSize); |
| 287 | } |
| 288 | |
| 289 | .md-list .icon .material-symbols-outlined:first-child { |
| 290 | font-size: var(--iconSize); |
| 291 | } |
| 292 | |
| 293 | .md-list .icon.md-two-line img, |
| 294 | .md-list .icon.md-two-line .material-symbols-outlined:first-child { |
| 295 | grid-area: img; |
| 296 | align-self: center; |
| 297 | } |
| 298 | |
| 299 | .md-list .icon.md-three-line img, |
| 300 | .md-list .icon.md-three-line .material-symbols-outlined:first-child { |
| 301 | grid-area: img; |
| 302 | align-self: start; |
| 303 | } |
| 304 | |
| 305 | .md-list .video img { |
| 306 | flex-shrink: 0; |
| 307 | color: var(--md-sys-color-on-surface-variant); |
| 308 | width: var(--videoWidth); |
| 309 | height: var(--videoHeight); |
| 310 | } |
| 311 | |
| 312 | .md-list .video.md-two-line img { |
| 313 | grid-area: img; |
| 314 | align-self: center; |
| 315 | } |
| 316 | |
| 317 | .md-list .video.md-three-line img { |
| 318 | grid-area: img; |
| 319 | align-self: start; |
| 320 | } |
| 321 | |
| 322 | .md-list .image img, |
| 323 | .md-list .image .material-symbols-outlined:first-child { |
| 324 | flex-shrink: 0; |
| 325 | color: var(--md-sys-color-on-surface-variant); |
| 326 | width: var(--imageSize); |
| 327 | height: var(--imageSize); |
| 328 | } |
| 329 | |
| 330 | .md-list .image .material-symbols-outlined:first-child { |
| 331 | font-size: var(--imageSize); |
| 332 | } |
| 333 | |
| 334 | .md-list .image.md-two-line img, |
| 335 | .md-list .image.md-two-line .material-symbols-outlined:first-child { |
| 336 | grid-area: img; |
| 337 | align-self: center; |
| 338 | } |
| 339 | |
| 340 | .md-list .image.md-three-line img, |
| 341 | .md-list .image.md-three-line .material-symbols-outlined:first-child { |
| 342 | grid-area: img; |
| 343 | align-self: start; |
| 344 | } |
| 1 | .md-tab { |
| 2 | display: flex; |
| 3 | background-color: transparent; |
| 4 | align-items: stretch; |
| 5 | flex-wrap: nowrap; |
| 6 | overflow-x: auto; |
| 7 | position: sticky; |
| 8 | z-index: 1; |
| 9 | } |
| 10 | |
| 11 | .md-tab.fixed { |
| 12 | justify-content: center; |
| 13 | } |
| 14 | |
| 15 | .md-tab.scrollable { |
| 16 | padding-left: 2rem; |
| 17 | gap: 1rem; |
| 18 | } |
| 19 | |
| 20 | .md-tab.scroll { |
| 21 | background-color: var(--md-sys-color-surface-container-low); |
| 22 | } |
| 23 | |
| 24 | .md-tab a { |
| 25 | position: relative; |
| 26 | display: flex; |
| 27 | flex-direction: column; |
| 28 | justify-content: start; |
| 29 | align-items: center; |
| 30 | color: var(--md-sys-color-on-surface-variant); |
| 31 | font-family: var(--md-sys-typescale-title-small-font); |
| 32 | font-weight: var(--md-sys-typescale-title-small-weight); |
| 33 | font-size: var(--md-sys-typescale-title-small-size); |
| 34 | font-style: var(--md-sys-typescale-title-small-font-style); |
| 35 | letter-spacing: var(--md-sys-typescale-title-small-tracking); |
| 36 | line-height: var(--md-sys-typescale-title-small-line-height); |
| 37 | text-transform: var(--md-sys-typescale-title-small-text-transform); |
| 38 | text-decoration: var(--md-sys-typescale-title-small-text-decoration); |
| 39 | text-align: center; |
| 40 | box-sizing: border-box; |
| 41 | border-bottom: 0.1875rem solid var(--md-sys-color-surface); |
| 42 | } |
| 43 | |
| 44 | .md-tab.fixed a { |
| 45 | flex: 0 0 var(--tabWidth); |
| 46 | } |
| 47 | |
| 48 | .md-tab.scrollable a { |
| 49 | flex: 0 0 auto; |
| 50 | } |
| 51 | |
| 52 | .md-tab a.active { |
| 53 | border-bottom-color: var(--md-sys-color-primary); |
| 54 | } |
| 55 | |
| 56 | /* state layer */ |
| 57 | .md-tab a::after { |
| 58 | content: ""; |
| 59 | position: absolute; |
| 60 | z-index: -1; |
| 61 | top: 0; |
| 62 | right: 0; |
| 63 | left: 0; |
| 64 | bottom: 0; |
| 65 | background-color: transparent; |
| 66 | } |
| 67 | |
| 68 | .md-tab span { |
| 69 | font-size: var(--iconSize); |
| 70 | height: var(--iconSize); |
| 71 | width: var(--iconSize); |
| 72 | color: var(--md-sys-color-on-surface-variant); |
| 73 | } |
| 74 | |
| 75 | .md-tab .active span { |
| 76 | color: var(--md-sys-color-primary); |
| 77 | font-variation-settings: 'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 48; |
| 78 | } |
| 79 | |
| 80 | .md-tab a:hover { |
| 81 | color: var(--md-sys-color-on-surface); |
| 82 | } |
| 83 | |
| 84 | /* state layer */ |
| 85 | .md-tab a:hover::after { |
| 86 | background-color: var(--md-sys-color-on-surface); |
| 87 | opacity: var(--md-sys-state-hover-state-layer-opacity); |
| 88 | } |
| 89 | |
| 90 | .md-tab a.active:hover { |
| 91 | color: var(--md-sys-color-primary); |
| 92 | } |
| 93 | |
| 94 | /* state layer */ |
| 95 | .md-tab a.active:hover::after { |
| 96 | background-color: var(--md-sys-color-primary); |
| 97 | opacity: var(--md-sys-state-hover-state-layer-opacity); |
| 98 | } |
| 99 | |
| 100 | .md-tab a:hover span { |
| 101 | color: var(--md-sys-color-on-surface); |
| 102 | } |
| 103 | |
| 104 | .md-tab a.active:hover span { |
| 105 | color: var(--md-sys-color-primary); |
| 106 | } |
| 107 | |
| 108 | .md-tab a:focus { |
| 109 | outline: none; |
| 110 | } |
| 111 | |
| 112 | /* state layer */ |
| 113 | .md-tab a:focus::after { |
| 114 | background-color: var(--md-sys-color-on-surface); |
| 115 | opacity: var(--md-sys-state-focus-state-layer-opacity); |
| 116 | } |
| 117 | |
| 118 | /* state layer */ |
| 119 | .md-tab a.active:focus::after { |
| 120 | background-color: var(--md-sys-color-primary); |
| 121 | opacity: var(--md-sys-state-hover-state-layer-opacity); |
| 122 | } |
| 123 | |
| 124 | .md-tab a:active { |
| 125 | background-position: center; |
| 126 | background-image: |
| 127 | radial-gradient(circle, var(--md-riple-color) 1%, transparent 1%); |
| 128 | background-size: 100%; |
| 129 | animation-name: md-ripple; |
| 130 | animation-duration: var(--md-sys-motion-duration-500); |
| 131 | } |
| 132 | |
| 133 | /* state layer */ |
| 134 | .md-tab a:active::after { |
| 135 | background-color: var(--md-sys-color-on-surface); |
| 136 | opacity: var(--md-sys-state-pressed-state-layer-opacity); |
| 137 | } |
| 138 | |
| 139 | /* state layer */ |
| 140 | .md-tab a.active:active::after { |
| 141 | background-color: var(--md-sys-color-primary); |
| 142 | opacity: var(--md-sys-state-pressed-state-layer-opacity); |
| 143 | } |