Skip to content

feat: change color of label on hovered and active state #4077

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 20 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
54c5c63
feat: change color of label on hovered and active state
michaelmkraus Apr 17, 2025
d961d48
Merge branch 'main' into feat-optimize-hover-data-inputs
mfranzke Apr 17, 2025
f7a60b2
test: updated snapshots
michaelmkraus Apr 17, 2025
2105f1e
Merge remote-tracking branch 'origin/feat-optimize-hover-data-inputs'…
michaelmkraus Apr 17, 2025
1f6876b
refactor: corrected snapshot
mfranzke Apr 17, 2025
0b032f8
Merge remote-tracking branch 'origin/main' into feat-optimize-hover-d…
michaelmkraus Apr 22, 2025
24c864a
test: updated that snapshot
mfranzke Apr 22, 2025
48d07a0
Merge branch 'main' into feat-optimize-hover-data-inputs
michaelmkraus Apr 22, 2025
6031b62
Merge branch 'main' into feat-optimize-hover-data-inputs
michaelmkraus Apr 22, 2025
5d2a028
Merge branch 'main' into feat-optimize-hover-data-inputs
michaelmkraus Apr 23, 2025
7013447
chore: update styles for radio,checkbox and switch
nmerget May 6, 2025
8b99798
chore: update from main
nmerget May 6, 2025
4e57765
refactor: reverted unrelated changes
mfranzke May 6, 2025
b319459
chore: update snapshots
nmerget May 6, 2025
56ae3a3
Merge remote-tracking branch 'origin/feat-optimize-hover-data-inputs'…
nmerget May 6, 2025
b90a80b
Merge remote-tracking branch 'origin/main' into feat-optimize-hover-d…
nmerget May 6, 2025
6c172dc
Merge branch 'main' into feat-optimize-hover-data-inputs
nmerget May 6, 2025
965ae34
Merge branch 'main' into feat-optimize-hover-data-inputs
nmerget May 7, 2025
67618b4
Merge branch 'main' into feat-optimize-hover-data-inputs
nmerget May 7, 2025
edd6148
Merge branch 'main' into feat-optimize-hover-data-inputs
nmerget May 7, 2025
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions packages/components/src/styles/internal/_form-components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,21 @@ $input-valid-types:
}
}

@mixin get-validity-color-check-label-color($state, $key: "valid") {
$variant: successful;

@if ($key != "valid") {
$variant: critical;
}

&:has(input:not([role="switch"])) {
&:is(label),
> label {
color: var(--db-#{$variant}-on-bg-basic-emphasis-100-#{$state});
}
}
}

// CHECKBOX & RADIO

@mixin get-validity-color-check($key: "valid") {
Expand Down Expand Up @@ -495,6 +510,42 @@ $input-valid-types:
@include get-validity-color-check("invalid");
}

@include helpers.hover {
color: colors.$db-adaptive-on-bg-basic-emphasis-100-hovered;

@include get-validity($selector, "valid") {
@include get-validity-color-check-label-color(hovered, "valid");
}

@include get-validity($selector, "invalid") {
@include get-validity-color-check-label-color(hovered, "invalid");
}

@if ($selector == radio) {
input {
/* stylelint-disable-next-line db-ux/use-border-width */
border: #{$check-border-size}
solid
var(
--db-check-element-border-color,
#{colors.$db-adaptive-on-bg-basic-emphasis-100-default}
);
}
}
}

@include helpers.active {
color: colors.$db-adaptive-on-bg-basic-emphasis-100-pressed;

@include get-validity($selector, "valid") {
@include get-validity-color-check-label-color(pressed, "valid");
}

@include get-validity($selector, "invalid") {
@include get-validity-color-check-label-color(pressed, "invalid");
}
}

&:has(input:disabled) {
opacity: component.$default-disabled;
}
Expand Down
Loading