Skip to content
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
6 changes: 6 additions & 0 deletions .changeset/focus-border-split.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@surfnet/curve-react': patch
'@surfnet/curve-angular': patch
---

Split focus styling: `:focus` now gives the primary (`--ring`) border, and `:focus-visible` adds the 3px ring shadow on top. Mouse-focused controls show the border change only; keyboard focus shows both. Applies to accordion, badge, button, checkbox, input, item, native select, radio group, select, switch, tabs, textarea and toggle.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@
text-decoration-line: underline;
}

.curve-accordion-trigger:focus-visible {
.curve-accordion-trigger:focus {
border-color: var(--ring);
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
}

.curve-accordion-trigger:focus-visible::after {
.curve-accordion-trigger:focus-visible {
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent);
}

.curve-accordion-trigger:focus::after {
content: '';
border-color: var(--ring);
}
Expand Down
7 changes: 5 additions & 2 deletions packages/angular/src/lib/ui/badge/src/lib/hlm-badge.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
transition: all 150ms ease;
}

.curve-badge:focus-visible {
.curve-badge:focus {
border-color: var(--ring);
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.curve-badge:focus-visible {
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 32%, transparent);
}

.curve-badge[aria-invalid='true'] {
Expand Down
12 changes: 9 additions & 3 deletions packages/angular/src/lib/ui/button/src/lib/hlm-button.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@
transform: translateY(1px);
}

.curve-button:focus-visible {
.curve-button:focus {
border-color: var(--ring);
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.curve-button:focus-visible {
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 32%, transparent);
}

.curve-button:disabled,
Expand Down Expand Up @@ -134,8 +137,11 @@
background-color: color-mix(in oklch, var(--destructive) 90%, transparent);
}

.curve-button--variant-destructive:focus-visible {
.curve-button--variant-destructive:focus {
border-color: color-mix(in oklch, var(--destructive) 40%, transparent);
}

.curve-button--variant-destructive:focus-visible {
box-shadow: 0 0 0 3px color-mix(in oklch, var(--destructive) 20%, transparent);
}

Expand Down
9 changes: 6 additions & 3 deletions packages/angular/src/lib/ui/checkbox/src/lib/hlm-checkbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@
background-color: color-mix(in oklab, var(--input) 30%, transparent);
}

.curve-checkbox:focus-visible {
.curve-checkbox:focus {
border-color: var(--ring);
}

.curve-checkbox:focus-visible {
box-shadow:
0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent),
0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent),
var(--shadow-xs, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

Expand Down Expand Up @@ -58,7 +61,7 @@

/* Invalid via the control state (forceInvalid or form validation). */
.curve-checkbox--invalid,
.curve-checkbox--invalid:focus-visible {
.curve-checkbox--invalid:focus {
border-color: var(--destructive);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
.curve-combobox-chips:focus-within {
border-color: var(--ring);
box-shadow:
0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent),
0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent),
var(--shadow-xs, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
.curve-input-group:has([data-slot='input-group-control']:focus-visible) {
border-color: var(--ring);
box-shadow:
0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent),
0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent),
var(--shadow-xs, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
z-index: 10;
border-color: var(--ring);
box-shadow:
0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent),
0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent),
var(--shadow-xs, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

Expand Down
7 changes: 5 additions & 2 deletions packages/angular/src/lib/ui/input/src/lib/hlm-input.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
color: var(--muted-foreground);
}

.curve-input:focus-visible {
.curve-input:focus {
border-color: var(--ring);
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.curve-input:focus-visible {
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 32%, transparent);
}

.curve-input:disabled {
Expand Down
7 changes: 5 additions & 2 deletions packages/angular/src/lib/ui/item/src/lib/hlm-item.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ a.curve-item:hover {
background-color: var(--muted);
}

.curve-item:focus-visible {
.curve-item:focus {
border-color: var(--ring);
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
}

.curve-item:focus-visible {
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent);
}

.curve-item--variant-default {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@
background-color: color-mix(in oklab, var(--input) 50%, transparent);
}

.curve-native-select:focus-visible {
.curve-native-select:focus {
border-color: var(--ring);
}

.curve-native-select:focus-visible {
box-shadow:
0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent),
0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent),
var(--shadow-xs, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
.curve-navigation-menu-trigger:focus-visible {
outline-style: solid;
outline-width: 1px;
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent);
}

.curve-navigation-menu-trigger:disabled {
Expand Down Expand Up @@ -121,7 +121,7 @@
.curve-navigation-menu-link:focus-visible {
outline-style: solid;
outline-width: 1px;
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent);
}

.curve-navigation-menu-link[data-disabled='true'] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@
background-color: color-mix(in oklab, var(--input) 30%, transparent);
}

.curve-radio:has(:focus-visible) .curve-radio-indicator {
.curve-radio:has(:focus) .curve-radio-indicator {
border-color: var(--ring);
}

.curve-radio:has(:focus-visible) .curve-radio-indicator {
box-shadow:
0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent),
0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent),
var(--shadow-xs, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

Expand Down
7 changes: 5 additions & 2 deletions packages/angular/src/lib/ui/select/src/lib/hlm-select.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@
background-color: color-mix(in oklab, var(--input) 50%, transparent);
}

.curve-select-trigger:focus-visible {
.curve-select-trigger:focus {
border-color: var(--ring);
}

.curve-select-trigger:focus-visible {
box-shadow:
0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent),
0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent),
var(--shadow-xs, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
}

.curve-input.curve-sidebar-input:focus-visible {
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent);
}

.curve-input.curve-sidebar-input[data-matches-spartan-invalid='true'] {
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/src/lib/ui/slider/src/lib/hlm-slider.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
.curve-slider-thumb:hover,
.curve-slider-thumb:focus-visible {
box-shadow:
0 0 0 4px color-mix(in oklab, var(--ring) 50%, transparent),
0 0 0 4px color-mix(in oklab, var(--ring) 32%, transparent),
0 1px 3px 0 rgb(0 0 0 / 0.1),
0 1px 2px -1px rgb(0 0 0 / 0.1);
}
Expand Down
7 changes: 5 additions & 2 deletions packages/angular/src/lib/ui/switch/src/lib/hlm-switch.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@
background-color: var(--primary);
}

.curve-switch:focus-visible {
.curve-switch:focus {
border-color: var(--ring);
}

.curve-switch:focus-visible {
box-shadow:
0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent),
0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent),
var(--shadow-xs, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

Expand Down
9 changes: 6 additions & 3 deletions packages/angular/src/lib/ui/tabs/src/lib/hlm-tabs.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@
justify-content: flex-start;
}

.curve-tabs-trigger:focus-visible {
.curve-tabs-trigger:focus {
border-color: var(--ring);
}

.curve-tabs-trigger:focus-visible {
outline: 1px solid var(--ring);
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent);
}

.curve-tabs-trigger:disabled {
Expand Down Expand Up @@ -119,7 +122,7 @@
[data-active]:not([data-active='false'])
):focus-visible {
box-shadow:
0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent),
0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent),
0 1px 3px 0 rgb(0 0 0 / 0.1),
0 1px 2px -1px rgb(0 0 0 / 0.1);
}
Expand Down
7 changes: 5 additions & 2 deletions packages/angular/src/lib/ui/textarea/src/lib/hlm-textarea.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
color: var(--muted-foreground);
}

.curve-textarea:focus-visible {
.curve-textarea:focus {
border-color: var(--ring);
}

.curve-textarea:focus-visible {
box-shadow:
0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent),
0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent),
var(--shadow-xs, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

Expand Down
7 changes: 5 additions & 2 deletions packages/angular/src/lib/ui/toggle/src/lib/hlm-toggle.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@
color: var(--secondary-foreground);
}

.curve-toggle:focus-visible {
.curve-toggle:focus {
border-color: var(--ring);
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
}

.curve-toggle:focus-visible {
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 32%, transparent);
}

.curve-toggle[data-matches-spartan-invalid='true'] {
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/src/styles/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*::before,
*::after {
border-color: var(--border);
outline-color: color-mix(in oklab, var(--ring) 50%, transparent);
outline-color: color-mix(in oklab, var(--ring) 32%, transparent);
}

html {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@
text-decoration: underline;
}

.trigger:focus-visible {
.trigger:focus {
border-color: var(--ring);
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.trigger:focus-visible {
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 32%, transparent);
}

.trigger[aria-disabled='true'] {
Expand Down
7 changes: 5 additions & 2 deletions packages/react/src/components/ui/badge/badge.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
transition: all 150ms ease;
}

.badge:focus-visible {
.badge:focus {
border-color: var(--ring);
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.badge:focus-visible {
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 32%, transparent);
}

.badge[aria-invalid='true'] {
Expand Down
12 changes: 9 additions & 3 deletions packages/react/src/components/ui/button/button.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
-webkit-tap-highlight-color: transparent;
}

.button:focus-visible {
.button:focus {
border-color: var(--ring);
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.button:focus-visible {
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 32%, transparent);
}

.button:active:not([aria-haspopup]) {
Expand Down Expand Up @@ -131,8 +134,11 @@
background-color: color-mix(in oklch, var(--destructive) 90%, transparent);
}

.variantDestructive:focus-visible {
.variantDestructive:focus {
border-color: color-mix(in oklch, var(--destructive) 40%, transparent);
}

.variantDestructive:focus-visible {
box-shadow: 0 0 0 3px color-mix(in oklch, var(--destructive) 20%, transparent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
position: relative;
z-index: 10;
border-color: var(--ring);
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 32%, transparent);
}

.dayButton[data-range-end='true'] {
Expand Down
7 changes: 5 additions & 2 deletions packages/react/src/components/ui/checkbox/checkbox.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
opacity: 0.5;
}

.checkbox:focus-visible {
.checkbox:focus {
border-color: var(--ring);
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.checkbox:focus-visible {
box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 32%, transparent);
}

.checkbox:disabled {
Expand Down
Loading
Loading