Skip to content
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

feat: add border-width/border-color tokens for textbox hover/focus-vi… #2510

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions .changeset/large-pigs-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@utrecht/textbox-css": minor
---

Add `hover`, `focus-visible` and `invalid` tokens for `border-width` and `border-color` for Textbox.
31 changes: 31 additions & 0 deletions components/textbox/src/_mixin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ $utrecht-support-prince-xml: false !default;
var(--utrecht-textbox-background-color, var(--utrecht-form-control-background-color))
)
);
box-shadow: inset 0 0 0
calc(var(--utrecht-textbox-invalid-border-width, 0px) - var(--utrecht-textbox-border-width, 0px))
var(--utrecht-textbox-invalid-border-color, var(--utrecht-textbox-border-color));
border-width: var(--_utrecht-textbox-border-width);
border-block-end-width: var(
--utrecht-textbox-invalid-border-bottom-width,
Expand Down Expand Up @@ -148,6 +151,19 @@ $utrecht-support-prince-xml: false !default;
cursor: var(--utrecht-action-disabled-cursor, not-allowed);
}

@mixin utrecht-textbox--hover {
border-color: var(
--utrecht-textbox-hover-border-color,
var(
--utrecht-form-control-hover-border-color,
var(--utrecht-textbox-border-color, var(--utrecht-form-control-border-color))
)
);
box-shadow: inset 0 0 0
calc(var(--utrecht-textbox-hover-border-width, 0px) - var(--utrecht-textbox-border-width, 0px))
var(--utrecht-textbox-hover-border-color, var(--utrecht-textbox-border-color));
}

@mixin utrecht-textbox--focus {
@include utrecht-focus;

Expand All @@ -173,6 +189,18 @@ $utrecht-support-prince-xml: false !default;

@mixin utrecht-textbox--focus-visible {
@include utrecht-focus-visible;

border-color: var(
--utrecht-textbox-focus-visible-border-color,
var(
--utrecht-form-control-focus-visible-border-color,
var(--utrecht-textbox-border-color, var(--utrecht-form-control-border-color))
)
);
box-shadow: inset 0 0 0
calc(var(--utrecht-textbox-focus-visible-border-width, 0px) - var(--utrecht-textbox-border-width, 0px))
var(--utrecht-textbox-focus-visible-border-color, var(--utrecht-textbox-border-color)),
var(--_utrecht-focus-ring-box-shadow);
}

@mixin utrecht-textbox--read-only {
Expand Down Expand Up @@ -240,6 +268,9 @@ $utrecht-support-prince-xml: false !default;
@mixin utrecht-textbox--html-input {
// The workaround for missing `:focus-visible` support makes the code quite complex,
// keep the ideal version around to restore it easily when browser support improves.
&:hover {
@include utrecht-textbox--hover;
}

@if $utrecht-focus-visible-fallback {
&:focus {
Expand Down
Loading