Skip to content

Commit 1f38bdc

Browse files
authored
Merge pull request #2143 from cprussin/fix-colors
fix(component-library): fix focus colors
2 parents 95ed716 + a9b5c04 commit 1f38bdc

File tree

6 files changed

+46
-28
lines changed

6 files changed

+46
-28
lines changed

apps/insights/src/components/CopyButton/index.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
}
5151

5252
&[data-focus-visible] {
53-
outline: 1px auto currentcolor;
53+
outline: 1px solid currentcolor;
5454
outline-offset: theme.spacing(1);
5555
}
5656

packages/component-library/src/Button/index.module.scss

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
cursor: pointer;
66
white-space: nowrap;
77
font-weight: theme.font-weight("medium");
8-
outline: none;
9-
transition-property: background-color, color, border-color, box-shadow;
8+
transition-property: background-color, color, border-color, outline-color;
109
transition-duration: 100ms;
1110
transition-timing-function: linear;
1211
border: 1px solid transparent;
1312
text-decoration: none;
13+
outline-offset: 0;
14+
outline: theme.spacing(1) solid transparent;
1415

1516
.iconWrapper {
1617
display: inline-grid;
@@ -127,7 +128,7 @@
127128
}
128129

129130
&[data-focus-visible] {
130-
border-color: theme.color("forms", "input", "focus", "border");
131-
box-shadow: 0 0 0 4px theme.color("forms", "focus-color");
131+
border-color: theme.color("focus");
132+
outline-color: theme.color("focus-dim");
132133
}
133134
}

packages/component-library/src/SearchInput/index.module.scss

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
height: 100%;
1616
border: 1px solid theme.color("border");
1717
background-color: theme.color("background", "primary");
18-
outline: none;
19-
transition-property: border-color, box-shadow, background-color, color;
18+
transition-property: border-color, outline-color, background-color, color;
2019
transition-duration: 100ms;
2120
transition-timing-function: linear;
2221
overflow: hidden;
2322
text-overflow: ellipsis;
2423
white-space: nowrap;
25-
caret-color: theme.color("forms", "input", "focus", "border");
24+
caret-color: theme.color("focus");
25+
outline: theme.spacing(1) solid transparent;
26+
outline-offset: 0;
2627

2728
&::-webkit-search-cancel-button {
2829
display: none;
@@ -33,8 +34,8 @@
3334
}
3435

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

4041
&::placeholder {

packages/component-library/src/Select/index.module.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@
4949
align-items: center;
5050
justify-content: space-between;
5151
gap: theme.spacing(4);
52-
transition-property: background-color;
52+
transition-property: background-color, outline-color, border-color;
5353
transition-duration: 100ms;
5454
transition-timing-function: linear;
55+
border: 1px solid transparent;
56+
outline: theme.spacing(0.5) solid transparent;
57+
outline-offset: 0;
5558

5659
.check {
5760
width: theme.spacing(3);
@@ -73,7 +76,8 @@
7376
}
7477

7578
&[data-focus-visible] {
76-
box-shadow: 0 0 0 4px theme.color("forms", "focus-color");
79+
border-color: theme.color("focus");
80+
outline-color: theme.color("focus-dim");
7781
}
7882

7983
&[data-selected] .check {

packages/component-library/src/Table/index.module.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
.loader {
1717
width: 100%;
1818
height: 100%;
19-
background-color: theme.color("forms", "input", "focus", "border");
19+
background-color: theme.color("focus");
2020
transform-origin: left;
2121
animation: progress 1s infinite linear;
2222

@@ -71,7 +71,7 @@
7171
}
7272

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

@@ -117,7 +117,7 @@
117117
}
118118

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

123123
&[data-href] {

packages/component-library/src/theme.scss

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
}
1111
}
1212

13+
@function spacing($increment) {
14+
@return $increment * 0.25rem;
15+
}
16+
1317
$font-weight: (
1418
"thin": 100,
1519
"extralight": 200,
@@ -43,14 +47,14 @@ $font-size: (
4347
"9xl": 8rem,
4448
);
4549

46-
@function font-size($size) {
50+
@function font-size($size: "$base") {
4751
@return map-get-strict($font-size, $size);
4852
}
4953

5054
$border-radius: (
5155
"none": 0px,
5256
"sm": 0.125rem,
53-
"DEFAULT": 0.25rem,
57+
"base": 0.25rem,
5458
"md": 0.375rem,
5559
"lg": 0.5rem,
5660
"xl": 0.75rem,
@@ -59,14 +63,10 @@ $border-radius: (
5963
"full": 9999px,
6064
);
6165

62-
@function border-radius($radius: "DEFAULT") {
66+
@function border-radius($radius: "base") {
6367
@return map-get-strict($border-radius, $radius);
6468
}
6569

66-
@function spacing($increment) {
67-
@return $increment * 0.25rem;
68-
}
69-
7070
$color-pallette: (
7171
"black": #000,
7272
"white": #fff,
@@ -389,6 +389,7 @@ $color-pallette: (
389389
}
390390

391391
$color: (
392+
"transparent": transparent,
392393
"background": (
393394
"primary": light-dark(pallette-color("white"), pallette-color("steel", 950)),
394395
"modal": light-dark(pallette-color("white"), pallette-color("steel", 950)),
@@ -427,15 +428,18 @@ $color: (
427428
light-dark(pallette-color("steel", 900), pallette-color("steel", 50)),
428429
),
429430
),
431+
"focus":
432+
light-dark(pallette-color("violet", 700), pallette-color("violet", 500)),
433+
"focus-dim":
434+
light-dark(
435+
rgba(pallette-color("violet", 700), 0.3),
436+
rgba(pallette-color("violet", 500), 0.3)
437+
),
430438
"forms": (
431-
"focus-color": light-dark(rgba(#7142cf, 0.2), rgba(#7b4cd9, 0.2)),
432439
"input": (
433440
"hover": (
434441
"border": pallette-color("stone", 400),
435442
),
436-
"focus": (
437-
"border": pallette-color("steel", 500),
438-
),
439443
),
440444
),
441445
"button": (
@@ -485,8 +489,16 @@ $color: (
485489
"foreground":
486490
light-dark(pallette-color("stone", 900), pallette-color("steel", 50)),
487491
"background": (
488-
"hover": light-dark(rgba(#715858, 0.05), rgba(#e9ecff, 0.05)),
489-
"active": light-dark(rgba(#715858, 0.1), rgba(#e9ecff, 0.1)),
492+
"hover":
493+
light-dark(
494+
rgba(pallette-color("beige", 950), 0.05),
495+
rgba(pallette-color("steel", 50), 0.05)
496+
),
497+
"active":
498+
light-dark(
499+
rgba(pallette-color("beige", 950), 0.1),
500+
rgba(pallette-color("steel", 50), 0.1)
501+
),
490502
),
491503
),
492504
"disabled": (

0 commit comments

Comments
 (0)