diff options
author | Matthew Lemon <y@yulqen.org> | 2024-09-16 17:12:15 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-09-16 17:12:15 +0100 |
commit | 86bb29b4d378314bd906248e08198c1952d2f0a4 (patch) | |
tree | 005bb24dfa6a0e5d911d6cfdda9d469828a387a1 /pyblackbird_cc/static/scss/helpers | |
parent | 0d3ae1492e1a88db69437cd277b7cf11c4e6274a (diff) |
Upgrade to bootstrap 5.3
Diffstat (limited to 'pyblackbird_cc/static/scss/helpers')
12 files changed, 185 insertions, 0 deletions
diff --git a/pyblackbird_cc/static/scss/helpers/_clearfix.scss b/pyblackbird_cc/static/scss/helpers/_clearfix.scss new file mode 100644 index 0000000..e92522a --- /dev/null +++ b/pyblackbird_cc/static/scss/helpers/_clearfix.scss @@ -0,0 +1,3 @@ +.clearfix { + @include clearfix(); +} diff --git a/pyblackbird_cc/static/scss/helpers/_color-bg.scss b/pyblackbird_cc/static/scss/helpers/_color-bg.scss new file mode 100644 index 0000000..1a3a4cf --- /dev/null +++ b/pyblackbird_cc/static/scss/helpers/_color-bg.scss @@ -0,0 +1,7 @@ +// All-caps `RGBA()` function used because of this Sass bug: https://github.com/sass/node-sass/issues/2251 +@each $color, $value in $theme-colors { + .text-bg-#{$color} { + color: color-contrast($value) if($enable-important-utilities, !important, null); + background-color: RGBA(var(--#{$prefix}#{$color}-rgb), var(--#{$prefix}bg-opacity, 1)) if($enable-important-utilities, !important, null); + } +} diff --git a/pyblackbird_cc/static/scss/helpers/_colored-links.scss b/pyblackbird_cc/static/scss/helpers/_colored-links.scss new file mode 100644 index 0000000..5f86857 --- /dev/null +++ b/pyblackbird_cc/static/scss/helpers/_colored-links.scss @@ -0,0 +1,30 @@ +// All-caps `RGBA()` function used because of this Sass bug: https://github.com/sass/node-sass/issues/2251 +@each $color, $value in $theme-colors { + .link-#{$color} { + color: RGBA(var(--#{$prefix}#{$color}-rgb), var(--#{$prefix}link-opacity, 1)) if($enable-important-utilities, !important, null); + text-decoration-color: RGBA(var(--#{$prefix}#{$color}-rgb), var(--#{$prefix}link-underline-opacity, 1)) if($enable-important-utilities, !important, null); + + @if $link-shade-percentage != 0 { + &:hover, + &:focus { + $hover-color: if(color-contrast($value) == $color-contrast-light, shade-color($value, $link-shade-percentage), tint-color($value, $link-shade-percentage)); + color: RGBA(#{to-rgb($hover-color)}, var(--#{$prefix}link-opacity, 1)) if($enable-important-utilities, !important, null); + text-decoration-color: RGBA(to-rgb($hover-color), var(--#{$prefix}link-underline-opacity, 1)) if($enable-important-utilities, !important, null); + } + } + } +} + +// One-off special link helper as a bridge until v6 +.link-body-emphasis { + color: RGBA(var(--#{$prefix}emphasis-color-rgb), var(--#{$prefix}link-opacity, 1)) if($enable-important-utilities, !important, null); + text-decoration-color: RGBA(var(--#{$prefix}emphasis-color-rgb), var(--#{$prefix}link-underline-opacity, 1)) if($enable-important-utilities, !important, null); + + @if $link-shade-percentage != 0 { + &:hover, + &:focus { + color: RGBA(var(--#{$prefix}emphasis-color-rgb), var(--#{$prefix}link-opacity, .75)) if($enable-important-utilities, !important, null); + text-decoration-color: RGBA(var(--#{$prefix}emphasis-color-rgb), var(--#{$prefix}link-underline-opacity, .75)) if($enable-important-utilities, !important, null); + } + } +} diff --git a/pyblackbird_cc/static/scss/helpers/_focus-ring.scss b/pyblackbird_cc/static/scss/helpers/_focus-ring.scss new file mode 100644 index 0000000..26508a8 --- /dev/null +++ b/pyblackbird_cc/static/scss/helpers/_focus-ring.scss @@ -0,0 +1,5 @@ +.focus-ring:focus { + outline: 0; + // By default, there is no `--bs-focus-ring-x`, `--bs-focus-ring-y`, or `--bs-focus-ring-blur`, but we provide CSS variables with fallbacks to initial `0` values + box-shadow: var(--#{$prefix}focus-ring-x, 0) var(--#{$prefix}focus-ring-y, 0) var(--#{$prefix}focus-ring-blur, 0) var(--#{$prefix}focus-ring-width) var(--#{$prefix}focus-ring-color); +} diff --git a/pyblackbird_cc/static/scss/helpers/_icon-link.scss b/pyblackbird_cc/static/scss/helpers/_icon-link.scss new file mode 100644 index 0000000..3f8bcb3 --- /dev/null +++ b/pyblackbird_cc/static/scss/helpers/_icon-link.scss @@ -0,0 +1,25 @@ +.icon-link { + display: inline-flex; + gap: $icon-link-gap; + align-items: center; + text-decoration-color: rgba(var(--#{$prefix}link-color-rgb), var(--#{$prefix}link-opacity, .5)); + text-underline-offset: $icon-link-underline-offset; + backface-visibility: hidden; + + > .bi { + flex-shrink: 0; + width: $icon-link-icon-size; + height: $icon-link-icon-size; + fill: currentcolor; + @include transition($icon-link-icon-transition); + } +} + +.icon-link-hover { + &:hover, + &:focus-visible { + > .bi { + transform: var(--#{$prefix}icon-link-transform, $icon-link-icon-transform); + } + } +} diff --git a/pyblackbird_cc/static/scss/helpers/_position.scss b/pyblackbird_cc/static/scss/helpers/_position.scss new file mode 100644 index 0000000..59103d9 --- /dev/null +++ b/pyblackbird_cc/static/scss/helpers/_position.scss @@ -0,0 +1,36 @@ +// Shorthand + +.fixed-top { + position: fixed; + top: 0; + right: 0; + left: 0; + z-index: $zindex-fixed; +} + +.fixed-bottom { + position: fixed; + right: 0; + bottom: 0; + left: 0; + z-index: $zindex-fixed; +} + +// Responsive sticky top and bottom +@each $breakpoint in map-keys($grid-breakpoints) { + @include media-breakpoint-up($breakpoint) { + $infix: breakpoint-infix($breakpoint, $grid-breakpoints); + + .sticky#{$infix}-top { + position: sticky; + top: 0; + z-index: $zindex-sticky; + } + + .sticky#{$infix}-bottom { + position: sticky; + bottom: 0; + z-index: $zindex-sticky; + } + } +} diff --git a/pyblackbird_cc/static/scss/helpers/_ratio.scss b/pyblackbird_cc/static/scss/helpers/_ratio.scss new file mode 100644 index 0000000..b6a7654 --- /dev/null +++ b/pyblackbird_cc/static/scss/helpers/_ratio.scss @@ -0,0 +1,26 @@ +// Credit: Nicolas Gallagher and SUIT CSS. + +.ratio { + position: relative; + width: 100%; + + &::before { + display: block; + padding-top: var(--#{$prefix}aspect-ratio); + content: ""; + } + + > * { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + } +} + +@each $key, $ratio in $aspect-ratios { + .ratio-#{$key} { + --#{$prefix}aspect-ratio: #{$ratio}; + } +} diff --git a/pyblackbird_cc/static/scss/helpers/_stacks.scss b/pyblackbird_cc/static/scss/helpers/_stacks.scss new file mode 100644 index 0000000..6cd237a --- /dev/null +++ b/pyblackbird_cc/static/scss/helpers/_stacks.scss @@ -0,0 +1,15 @@ +// scss-docs-start stacks +.hstack { + display: flex; + flex-direction: row; + align-items: center; + align-self: stretch; +} + +.vstack { + display: flex; + flex: 1 1 auto; + flex-direction: column; + align-self: stretch; +} +// scss-docs-end stacks diff --git a/pyblackbird_cc/static/scss/helpers/_stretched-link.scss b/pyblackbird_cc/static/scss/helpers/_stretched-link.scss new file mode 100644 index 0000000..71a1c75 --- /dev/null +++ b/pyblackbird_cc/static/scss/helpers/_stretched-link.scss @@ -0,0 +1,15 @@ +// +// Stretched link +// + +.stretched-link { + &::#{$stretched-link-pseudo-element} { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: $stretched-link-z-index; + content: ""; + } +} diff --git a/pyblackbird_cc/static/scss/helpers/_text-truncation.scss b/pyblackbird_cc/static/scss/helpers/_text-truncation.scss new file mode 100644 index 0000000..6421dac --- /dev/null +++ b/pyblackbird_cc/static/scss/helpers/_text-truncation.scss @@ -0,0 +1,7 @@ +// +// Text truncation +// + +.text-truncate { + @include text-truncate(); +} diff --git a/pyblackbird_cc/static/scss/helpers/_visually-hidden.scss b/pyblackbird_cc/static/scss/helpers/_visually-hidden.scss new file mode 100644 index 0000000..4760ff0 --- /dev/null +++ b/pyblackbird_cc/static/scss/helpers/_visually-hidden.scss @@ -0,0 +1,8 @@ +// +// Visually hidden +// + +.visually-hidden, +.visually-hidden-focusable:not(:focus):not(:focus-within) { + @include visually-hidden(); +} diff --git a/pyblackbird_cc/static/scss/helpers/_vr.scss b/pyblackbird_cc/static/scss/helpers/_vr.scss new file mode 100644 index 0000000..b6f9d42 --- /dev/null +++ b/pyblackbird_cc/static/scss/helpers/_vr.scss @@ -0,0 +1,8 @@ +.vr { + display: inline-block; + align-self: stretch; + width: $vr-border-width; + min-height: 1em; + background-color: currentcolor; + opacity: $hr-opacity; +} |