// // Copyright 2018 Google Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // @import "@material/animation/variables"; @import "@material/tab/mixins"; @import "@material/feature-targeting/functions"; @import "@material/feature-targeting/mixins"; @import "./variables"; /// /// Sets the CSS transition for the tab scrolling animation. /// /// @param {Number | String} $duration-ms - Duration (in ms) of the animation. /// @param {String} $timing-function - Optionally overrides the default animation timing function. /// @mixin mdc-tab-scroller-transition( $duration-ms, $timing-function: $mdc-animation-standard-curve-timing-function, $query: mdc-feature-all() ) { $feat-animation: mdc-feature-create-target($query, animation); &.mdc-tab-scroller--animating .mdc-tab-scroller__scroll-content { @include mdc-feature-targets($feat-animation) { transition: $duration-ms transform $timing-function; } } } @mixin mdc-tab-scroller-core-styles($query: mdc-feature-all()) { $feat-structure: mdc-feature-create-target($query, structure); $feat-animation: mdc-feature-create-target($query, animation); // postcss-bem-linter: define tab-scroller .mdc-tab-scroller { @include mdc-tab-scroller-transition( $duration-ms: $mdc-tab-scroller-transition-duration, $query: $query); @include mdc-feature-targets($feat-structure) { overflow-y: hidden; } } // Selector for test element used to feature-detect horizontal scrollbar height .mdc-tab-scroller__test { @include mdc-feature-targets($feat-structure) { position: absolute; top: -9999px; width: 100px; height: 100px; overflow-x: scroll; } } .mdc-tab-scroller__scroll-area { @include mdc-feature-targets($feat-structure) { -webkit-overflow-scrolling: touch; display: flex; overflow-x: hidden; } } .mdc-tab-scroller__scroll-area, .mdc-tab-scroller__test { @include mdc-feature-targets($feat-structure) { &::-webkit-scrollbar { display: none; } } } // This modifier class will be added in JS after computing the OS scrollbar size in order to hide the scrollbar. .mdc-tab-scroller__scroll-area--scroll { @include mdc-feature-targets($feat-structure) { overflow-x: scroll; } } .mdc-tab-scroller__scroll-content { @include mdc-tab-scroller__scroll-content_($query); } .mdc-tab-scroller--align-start .mdc-tab-scroller__scroll-content { @include mdc-feature-targets($feat-structure) { justify-content: flex-start; } } .mdc-tab-scroller--align-end .mdc-tab-scroller__scroll-content { @include mdc-feature-targets($feat-structure) { justify-content: flex-end; } } .mdc-tab-scroller--align-center .mdc-tab-scroller__scroll-content { @include mdc-feature-targets($feat-structure) { justify-content: center; } } .mdc-tab-scroller--animating { .mdc-tab-scroller__scroll-area { @include mdc-feature-targets($feat-animation) { -webkit-overflow-scrolling: auto; } } } // postcss-bem-linter: end } // // Private // @mixin mdc-tab-scroller__scroll-content_($query: mdc-feature-all()) { $feat-structure: mdc-feature-create-target($query, structure); $feat-animation: mdc-feature-create-target($query, animation); @include mdc-tab-parent-positioning($query); @include mdc-feature-targets($feat-structure) { display: flex; flex: 1 0 auto; transform: none; } @include mdc-feature-targets($feat-animation) { will-change: transform; } }