From ae4e861b5a721aa031cdbff9dd4832beb54c7a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Sch=C3=A4r?= <59233938+schaertim@users.noreply.github.com> Date: Wed, 25 Sep 2024 15:45:38 +0200 Subject: [PATCH] feat(styles): extended focus-style mixin --- .changeset/cuddly-panthers-tickle.md | 5 +++++ packages/styles/src/mixins/_utilities.scss | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 .changeset/cuddly-panthers-tickle.md diff --git a/.changeset/cuddly-panthers-tickle.md b/.changeset/cuddly-panthers-tickle.md new file mode 100644 index 0000000000..8db5e9c392 --- /dev/null +++ b/.changeset/cuddly-panthers-tickle.md @@ -0,0 +1,5 @@ +--- +'@swisspost/design-system-styles': patch +--- + +Extended the `focus-style` mixin by optional parameters to use it together with tokens. diff --git a/packages/styles/src/mixins/_utilities.scss b/packages/styles/src/mixins/_utilities.scss index c84992cd65..b894c0cae0 100644 --- a/packages/styles/src/mixins/_utilities.scss +++ b/packages/styles/src/mixins/_utilities.scss @@ -94,12 +94,17 @@ outline: none; } -@mixin focus-style($additional-selector: '') { +@mixin focus-style( + $additional-selector: '', + $offset: spacing.$size-line, + $width: spacing.$size-line, + $color: var(--post-focus-color) +) { &#{$additional-selector} { outline-style: none !important; // !important is needed to override bootstrap .form-control:focus - outline-offset: spacing.$size-line !important; - outline-width: spacing.$size-line !important; - outline-color: var(--post-focus-color) !important; + outline-offset: $offset !important; + outline-width: $width !important; + outline-color: $color !important; } // :has(:focus-visible) mimic a focus-visible-within pseudo-class