Skip to content

fix(component-library): fix focus colors #2143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
}

&[data-focus-visible] {
outline: 1px auto currentcolor;
outline: 1px solid currentcolor;
outline-offset: theme.spacing(1);
}

Expand Down
9 changes: 5 additions & 4 deletions packages/component-library/src/Button/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
cursor: pointer;
white-space: nowrap;
font-weight: theme.font-weight("medium");
outline: none;
transition-property: background-color, color, border-color, box-shadow;
transition-property: background-color, color, border-color, outline-color;
transition-duration: 100ms;
transition-timing-function: linear;
border: 1px solid transparent;
text-decoration: none;
outline-offset: 0;
outline: theme.spacing(1) solid transparent;

.iconWrapper {
display: inline-grid;
Expand Down Expand Up @@ -127,7 +128,7 @@
}

&[data-focus-visible] {
border-color: theme.color("forms", "input", "focus", "border");
box-shadow: 0 0 0 4px theme.color("forms", "focus-color");
border-color: theme.color("focus");
outline-color: theme.color("focus-dim");
}
}
11 changes: 6 additions & 5 deletions packages/component-library/src/SearchInput/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
height: 100%;
border: 1px solid theme.color("border");
background-color: theme.color("background", "primary");
outline: none;
transition-property: border-color, box-shadow, background-color, color;
transition-property: border-color, outline-color, background-color, color;
transition-duration: 100ms;
transition-timing-function: linear;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
caret-color: theme.color("forms", "input", "focus", "border");
caret-color: theme.color("focus");
outline: theme.spacing(1) solid transparent;
outline-offset: 0;

&::-webkit-search-cancel-button {
display: none;
Expand All @@ -33,8 +34,8 @@
}

&[data-focused] {
border-color: theme.color("forms", "input", "focus", "border");
box-shadow: 0 0 0 4px theme.color("forms", "focus-color");
border-color: theme.color("focus");
outline-color: theme.color("focus-dim");
}

&::placeholder {
Expand Down
8 changes: 6 additions & 2 deletions packages/component-library/src/Select/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@
align-items: center;
justify-content: space-between;
gap: theme.spacing(4);
transition-property: background-color;
transition-property: background-color, outline-color, border-color;
transition-duration: 100ms;
transition-timing-function: linear;
border: 1px solid transparent;
outline: theme.spacing(0.5) solid transparent;
outline-offset: 0;

.check {
width: theme.spacing(3);
Expand All @@ -73,7 +76,8 @@
}

&[data-focus-visible] {
box-shadow: 0 0 0 4px theme.color("forms", "focus-color");
border-color: theme.color("focus");
outline-color: theme.color("focus-dim");
}

&[data-selected] .check {
Expand Down
6 changes: 3 additions & 3 deletions packages/component-library/src/Table/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
.loader {
width: 100%;
height: 100%;
background-color: theme.color("forms", "input", "focus", "border");
background-color: theme.color("focus");
transform-origin: left;
animation: progress 1s infinite linear;

Expand Down Expand Up @@ -71,7 +71,7 @@
}

&[data-focus-visible] {
outline: theme.color("forms", "input", "focus", "border") auto 1px;
outline: theme.spacing(0.5) solid theme.color("focus");
}
}

Expand Down Expand Up @@ -117,7 +117,7 @@
}

&[data-focus-visible] {
outline: theme.color("forms", "input", "focus", "border") auto 1px;
outline: theme.spacing(0.5) solid theme.color("focus");
}

&[data-href] {
Expand Down
38 changes: 25 additions & 13 deletions packages/component-library/src/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
}
}

@function spacing($increment) {
@return $increment * 0.25rem;
}

$font-weight: (
"thin": 100,
"extralight": 200,
Expand Down Expand Up @@ -43,14 +47,14 @@ $font-size: (
"9xl": 8rem,
);

@function font-size($size) {
@function font-size($size: "$base") {
@return map-get-strict($font-size, $size);
}

$border-radius: (
"none": 0px,
"sm": 0.125rem,
"DEFAULT": 0.25rem,
"base": 0.25rem,
"md": 0.375rem,
"lg": 0.5rem,
"xl": 0.75rem,
Expand All @@ -59,14 +63,10 @@ $border-radius: (
"full": 9999px,
);

@function border-radius($radius: "DEFAULT") {
@function border-radius($radius: "base") {
@return map-get-strict($border-radius, $radius);
}

@function spacing($increment) {
@return $increment * 0.25rem;
}

$color-pallette: (
"black": #000,
"white": #fff,
Expand Down Expand Up @@ -389,6 +389,7 @@ $color-pallette: (
}

$color: (
"transparent": transparent,
"background": (
"primary": light-dark(pallette-color("white"), pallette-color("steel", 950)),
"modal": light-dark(pallette-color("white"), pallette-color("steel", 950)),
Expand Down Expand Up @@ -427,15 +428,18 @@ $color: (
light-dark(pallette-color("steel", 900), pallette-color("steel", 50)),
),
),
"focus":
light-dark(pallette-color("violet", 700), pallette-color("violet", 500)),
"focus-dim":
light-dark(
rgba(pallette-color("violet", 700), 0.3),
rgba(pallette-color("violet", 500), 0.3)
),
"forms": (
"focus-color": light-dark(rgba(#7142cf, 0.2), rgba(#7b4cd9, 0.2)),
"input": (
"hover": (
"border": pallette-color("stone", 400),
),
"focus": (
"border": pallette-color("steel", 500),
),
),
),
"button": (
Expand Down Expand Up @@ -485,8 +489,16 @@ $color: (
"foreground":
light-dark(pallette-color("stone", 900), pallette-color("steel", 50)),
"background": (
"hover": light-dark(rgba(#715858, 0.05), rgba(#e9ecff, 0.05)),
"active": light-dark(rgba(#715858, 0.1), rgba(#e9ecff, 0.1)),
"hover":
light-dark(
rgba(pallette-color("beige", 950), 0.05),
rgba(pallette-color("steel", 50), 0.05)
),
"active":
light-dark(
rgba(pallette-color("beige", 950), 0.1),
rgba(pallette-color("steel", 50), 0.1)
),
),
),
"disabled": (
Expand Down
Loading