2020-05-29 10:16:33 +00:00
|
|
|
$fontSizes: (
|
|
|
|
"smaller": 0.75,
|
|
|
|
"small": 0.875,
|
|
|
|
"regular": 1,
|
|
|
|
"large": 1.25,
|
|
|
|
"larger": 2,
|
|
|
|
);
|
|
|
|
|
|
|
|
// Maps a named font-size to its em equivalent.
|
|
|
|
@mixin font-size($sizeName) {
|
|
|
|
font-size: map-get($fontSizes, $sizeName) * 1em;
|
2018-11-21 16:33:21 +00:00
|
|
|
}
|
|
|
|
|
2019-08-15 14:55:57 +00:00
|
|
|
@keyframes loading-fade {
|
|
|
|
0% {
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
|
|
|
50% {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
100% {
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-21 16:33:21 +00:00
|
|
|
// Adds animation to placeholder section
|
2019-11-01 13:56:14 +00:00
|
|
|
@mixin placeholder() {
|
|
|
|
animation: loading-fade 1.2s ease-in-out infinite;
|
|
|
|
background-color: $core-grey-light-500 !important;
|
2020-02-26 15:49:07 +00:00
|
|
|
border-color: $core-grey-light-500 !important;
|
|
|
|
color: $core-grey-light-500 !important;
|
2019-11-01 13:56:14 +00:00
|
|
|
box-shadow: none;
|
2020-02-26 15:49:07 +00:00
|
|
|
pointer-events: none;
|
2018-11-21 16:33:21 +00:00
|
|
|
|
2020-02-26 15:49:07 +00:00
|
|
|
// Forces direct descendants to keep layout but lose visibility.
|
|
|
|
> * {
|
|
|
|
visibility: hidden;
|
2018-11-21 16:33:21 +00:00
|
|
|
}
|
2019-08-15 14:55:57 +00:00
|
|
|
|
|
|
|
@media screen and (prefers-reduced-motion: reduce) {
|
|
|
|
animation: none;
|
|
|
|
}
|
2018-11-21 16:33:21 +00:00
|
|
|
}
|
|
|
|
|
2020-02-26 15:49:07 +00:00
|
|
|
@mixin force-content() {
|
|
|
|
&::after {
|
|
|
|
content: "\00a0";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 08:48:38 +00:00
|
|
|
// Hide an element from sighted users, but available to screen reader users.
|
2018-11-29 18:10:08 +00:00
|
|
|
@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. */
|
2018-11-30 21:37:58 +00:00
|
|
|
overflow-wrap: normal !important;
|
2018-11-29 18:10:08 +00:00
|
|
|
word-wrap: normal !important;
|
|
|
|
}
|
2018-11-30 21:37:58 +00:00
|
|
|
|
2020-05-14 09:07:21 +00:00
|
|
|
@mixin reset-box() {
|
2020-01-17 13:46:56 +00:00
|
|
|
border: 0;
|
2020-04-14 11:43:10 +00:00
|
|
|
border-radius: 0;
|
2020-05-14 09:07:21 +00:00
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
vertical-align: baseline;
|
|
|
|
}
|
2020-01-17 13:46:56 +00:00
|
|
|
|
2020-05-14 09:07:21 +00:00
|
|
|
@mixin reset-typography() {
|
|
|
|
color: inherit;
|
2020-04-14 11:43:10 +00:00
|
|
|
font-family: inherit;
|
2020-01-17 13:46:56 +00:00
|
|
|
font-size: inherit;
|
2020-06-05 10:00:19 +00:00
|
|
|
font-style: inherit;
|
2020-04-14 11:43:10 +00:00
|
|
|
font-weight: inherit;
|
|
|
|
letter-spacing: inherit;
|
2020-05-14 09:07:21 +00:00
|
|
|
line-height: inherit;
|
|
|
|
text-decoration: inherit;
|
|
|
|
text-transform: inherit;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reset <h1>, <h2>, etc. styles as if they were text. Useful for elements that must be headings for a11y but don't need those styles.
|
|
|
|
@mixin text-heading() {
|
|
|
|
@include reset-box();
|
|
|
|
@include reset-typography();
|
|
|
|
box-shadow: none;
|
|
|
|
display: inline;
|
2020-01-17 13:46:56 +00:00
|
|
|
|
|
|
|
background: transparent;
|
2020-05-14 09:07:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Reset <button> style as if it was text. Useful for elements that must be `<button>` for a11y but don't need those styles.
|
|
|
|
@mixin text-button() {
|
|
|
|
@include reset-box();
|
|
|
|
@include reset-typography();
|
|
|
|
background: transparent;
|
|
|
|
box-shadow: none;
|
|
|
|
display: inline;
|
|
|
|
|
2020-04-14 11:43:10 +00:00
|
|
|
&:hover,
|
|
|
|
&:focus,
|
|
|
|
&:active {
|
2020-01-17 13:46:56 +00:00
|
|
|
background: transparent;
|
|
|
|
}
|
|
|
|
}
|
2020-04-24 12:23:25 +00:00
|
|
|
|
2020-05-14 09:07:21 +00:00
|
|
|
// Reset <button> style so we can use link style for action buttons.
|
|
|
|
@mixin link-button() {
|
|
|
|
@include text-button();
|
|
|
|
text-decoration: underline;
|
|
|
|
}
|
|
|
|
|
2020-04-24 12:23:25 +00:00
|
|
|
// Makes sure long words are broken if they overflow the container.
|
2020-05-07 08:48:38 +00:00
|
|
|
@mixin wrap-break-word() {
|
2020-04-24 12:23:25 +00:00
|
|
|
// This is the current standard, works in most browsers.
|
|
|
|
overflow-wrap: anywhere;
|
|
|
|
// Safari supports word-break.
|
|
|
|
word-break: break-word;
|
|
|
|
// IE11 doesn't support overflow-wrap neither word-break: break-word, so we fallback to -ms-work-break: break-all.
|
|
|
|
-ms-word-break: break-all;
|
|
|
|
}
|
2020-04-30 10:18:12 +00:00
|
|
|
|
2020-05-29 10:16:33 +00:00
|
|
|
// Converts a px unit to em.
|
|
|
|
@function em($size, $base: 16px) {
|
|
|
|
@return $size / $base * 1em;
|
2020-04-30 10:18:12 +00:00
|
|
|
}
|