2018-05-25 19:34:35 +00:00
|
|
|
// Rem output with px fallback
|
2020-07-17 00:11:42 +00:00
|
|
|
@mixin font-size( $sizeValue: 16, $lineHeight: false ) {
|
2018-05-25 19:34:35 +00:00
|
|
|
font-size: $sizeValue + px;
|
2021-06-10 09:09:27 +00:00
|
|
|
font-size: math.div($sizeValue, 16) + rem;
|
2020-07-17 00:11:42 +00:00
|
|
|
@if ( $lineHeight ) {
|
2018-05-25 19:34:35 +00:00
|
|
|
line-height: $lineHeight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-25 13:05:44 +00:00
|
|
|
@function url-friendly-colour( $color ) {
|
|
|
|
@return '%23' + str-slice( '#{ $color }', 2, -1 );
|
|
|
|
}
|
|
|
|
|
2018-05-25 19:34:35 +00:00
|
|
|
@mixin hover-state {
|
|
|
|
&:hover,
|
|
|
|
&:active,
|
|
|
|
&:focus {
|
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
2018-07-20 18:41:39 +00:00
|
|
|
|
|
|
|
// Adds animation to placeholder section
|
|
|
|
@mixin placeholder( $lighten-percentage: 30% ) {
|
|
|
|
animation: loading-fade 1.6s ease-in-out infinite;
|
2020-07-17 00:11:42 +00:00
|
|
|
background-color: $gray-100;
|
2018-07-20 18:41:39 +00:00
|
|
|
color: transparent;
|
|
|
|
|
2018-10-30 13:17:17 +00:00
|
|
|
&::after {
|
2018-07-20 18:41:39 +00:00
|
|
|
content: '\00a0';
|
|
|
|
}
|
2019-07-12 15:49:37 +00:00
|
|
|
|
2020-07-17 00:11:42 +00:00
|
|
|
@media screen and ( prefers-reduced-motion: reduce ) {
|
2019-07-12 15:49:37 +00:00
|
|
|
animation: none;
|
|
|
|
}
|
2018-07-20 18:41:39 +00:00
|
|
|
}
|
2018-07-20 03:40:15 +00:00
|
|
|
|
2018-08-23 17:47:27 +00:00
|
|
|
// Adds animation to transforms
|
|
|
|
@mixin animate-transform( $duration: 0.2s ) {
|
|
|
|
transition: transform ease $duration;
|
|
|
|
|
2020-07-17 00:11:42 +00:00
|
|
|
@media screen and ( prefers-reduced-motion: reduce ) {
|
2018-08-23 17:47:27 +00:00
|
|
|
transition: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-23 03:26:46 +00:00
|
|
|
// Gutenberg mixins. These are temporary until Gutenberg's mixins are exposed.
|
2019-08-15 16:51:21 +00:00
|
|
|
/**
|
|
|
|
* Breakpoint mixins
|
|
|
|
*/
|
|
|
|
|
|
|
|
@mixin break-huge() {
|
|
|
|
@media (min-width: #{ ($break-huge) }) {
|
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin break-wide() {
|
|
|
|
@media (min-width: #{ ($break-wide) }) {
|
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin break-xlarge() {
|
|
|
|
@media (min-width: #{ ($break-xlarge) }) {
|
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin break-large() {
|
|
|
|
@media (min-width: #{ ($break-large) }) {
|
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin break-medium() {
|
|
|
|
@media (min-width: #{ ($break-medium) }) {
|
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin break-small() {
|
|
|
|
@media (min-width: #{ ($break-small) }) {
|
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin break-mobile() {
|
|
|
|
@media (min-width: #{ ($break-mobile) }) {
|
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin break-zoomed-in() {
|
|
|
|
@media (min-width: #{ ($break-zoomed-in) }) {
|
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Buttons with rounded corners.
|
|
|
|
@mixin button-style__disabled {
|
|
|
|
opacity: 0.6;
|
|
|
|
cursor: default;
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin button-style__hover {
|
2019-08-29 16:07:56 +00:00
|
|
|
background-color: $studio-white;
|
2020-07-17 00:11:42 +00:00
|
|
|
color: $gray-900;
|
|
|
|
box-shadow: inset 0 0 0 1px $gray-400, inset 0 0 0 2px $studio-white,
|
|
|
|
0 1px 1px rgba($gray-900, 0.2);
|
2019-08-15 16:51:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@mixin button-style__active() {
|
|
|
|
outline: none;
|
2019-08-29 16:07:56 +00:00
|
|
|
background-color: $studio-white;
|
2020-07-17 00:11:42 +00:00
|
|
|
color: $gray-900;
|
|
|
|
box-shadow: inset 0 0 0 1px $gray-400, inset 0 0 0 2px $studio-white;
|
2019-08-15 16:51:21 +00:00
|
|
|
}
|
|
|
|
|
2018-07-20 03:40:15 +00:00
|
|
|
@mixin button-style__focus-active() {
|
2019-08-29 16:07:56 +00:00
|
|
|
background-color: $studio-white;
|
2020-07-17 00:11:42 +00:00
|
|
|
color: $gray-900;
|
|
|
|
box-shadow: inset 0 0 0 1px $gray-700, inset 0 0 0 2px $studio-white;
|
2018-07-20 03:40:15 +00:00
|
|
|
|
2019-08-15 16:51:21 +00:00
|
|
|
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
2018-07-20 03:40:15 +00:00
|
|
|
outline: 2px solid transparent;
|
|
|
|
outline-offset: -2px;
|
|
|
|
}
|
2018-09-06 15:11:34 +00:00
|
|
|
|
2019-08-29 16:07:56 +00:00
|
|
|
/* stylelint-disable block-closing-brace-newline-after */
|
2020-07-17 00:11:42 +00:00
|
|
|
@mixin reduce-motion( $property: '' ) {
|
2019-07-23 03:26:46 +00:00
|
|
|
@if $property == 'transition' {
|
2020-07-17 00:11:42 +00:00
|
|
|
@media ( prefers-reduced-motion: reduce ) {
|
2019-07-23 03:26:46 +00:00
|
|
|
transition-duration: 0s;
|
|
|
|
}
|
2022-03-18 11:45:14 +00:00
|
|
|
} @else if $property == 'animation' {
|
2020-07-17 00:11:42 +00:00
|
|
|
@media ( prefers-reduced-motion: reduce ) {
|
2019-07-23 03:26:46 +00:00
|
|
|
animation-duration: 1ms;
|
|
|
|
}
|
2022-03-18 11:45:14 +00:00
|
|
|
} @else {
|
2020-07-17 00:11:42 +00:00
|
|
|
@media ( prefers-reduced-motion: reduce ) {
|
2019-07-23 03:26:46 +00:00
|
|
|
transition-duration: 0s;
|
|
|
|
animation-duration: 1ms;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-29 16:07:56 +00:00
|
|
|
/* stylelint-enable */
|
2019-07-23 03:26:46 +00:00
|
|
|
|
|
|
|
|
2019-08-15 16:51:21 +00:00
|
|
|
// Gutenberg Switch.
|
|
|
|
@mixin switch-style__focus-active() {
|
2020-07-17 00:11:42 +00:00
|
|
|
box-shadow: 0 0 0 2px $studio-white, 0 0 0 3px $gray-700;
|
2019-08-15 16:51:21 +00:00
|
|
|
|
|
|
|
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
|
|
outline: 2px solid transparent;
|
|
|
|
outline-offset: 2px;
|
|
|
|
}
|
|
|
|
|
2018-09-06 15:11:34 +00:00
|
|
|
// Sets positions for children of grid elements
|
|
|
|
@mixin set-grid-item-position( $wrap-after, $number-of-items ) {
|
|
|
|
@for $i from 1 through $number-of-items {
|
|
|
|
&:nth-child(#{$i}) {
|
|
|
|
grid-column-start: #{($i - 1) % $wrap-after + 1};
|
|
|
|
grid-column-end: #{($i - 1) % $wrap-after + 2};
|
2021-06-10 09:09:27 +00:00
|
|
|
grid-row-start: #{floor(math.div($i - 1, $wrap-after)) + 1};
|
|
|
|
grid-row-end: #{floor(math.div($i - 1, $wrap-after)) + 2};
|
2018-09-06 15:11:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-02-20 20:18:27 +00:00
|
|
|
|
|
|
|
// Hide an element from sighted users, but availble to screen reader users.
|
|
|
|
@mixin visually-hidden() {
|
|
|
|
clip: rect(1px, 1px, 1px, 1px);
|
|
|
|
clip-path: inset(50%);
|
|
|
|
height: 1px;
|
|
|
|
width: 1px;
|
|
|
|
margin: -1px;
|
|
|
|
overflow: hidden;
|
|
|
|
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
|
|
|
|
overflow-wrap: normal !important;
|
|
|
|
word-wrap: normal !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unhide a visually hidden element
|
|
|
|
@mixin visually-shown() {
|
|
|
|
clip: auto;
|
|
|
|
clip-path: none;
|
|
|
|
height: auto;
|
|
|
|
width: auto;
|
|
|
|
margin: unset;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create a string-repeat function
|
2020-07-17 00:11:42 +00:00
|
|
|
@function str-repeat( $character, $n ) {
|
2019-02-20 20:18:27 +00:00
|
|
|
@if $n == 0 {
|
|
|
|
@return '';
|
|
|
|
}
|
|
|
|
$c: '';
|
|
|
|
@for $i from 1 through $n {
|
|
|
|
$c: $c + $character;
|
|
|
|
}
|
|
|
|
@return $c;
|
|
|
|
}
|