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

fix: invalid text color for inputs #3539

Merged
30 changes: 17 additions & 13 deletions packages/components/src/styles/_form-components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ $label-size-height-2xs: calc(
);

$floating-label-size: calc(
#{variables.$db-spacing-fixed-3xs} + #{variables.$db-spacing-fixed-2xs} + #{$label-size-height-2xs}
#{variables.$db-spacing-fixed-3xs} + #{variables.$db-spacing-fixed-2xs} +
#{$label-size-height-2xs}
);

$input-types: "button", "checkbox", "color", "date", "datetime-local", "email",
Expand Down Expand Up @@ -131,7 +132,8 @@ $check-border-size: min(#{variables.$db-border-height-2xs}, 2px);
#{$selector} {
@include placeholder-content() {
@media screen and (prefers-reduced-motion: no-preference) {
transition: opacity #{variables.$db-transition-straight-emotional};
transition: opacity
#{variables.$db-transition-straight-emotional};
}

opacity: component.$placeholder-disabled;
Expand Down Expand Up @@ -163,6 +165,10 @@ $check-border-size: min(#{variables.$db-border-height-2xs}, 2px);
@mixin get-validity-color($selector, $key: "valid") {
$variant: "successful";

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

@include get-validity-message($key);

#{$selector},
Expand All @@ -171,10 +177,6 @@ $check-border-size: min(#{variables.$db-border-height-2xs}, 2px);
caret-color: var(--db-#{$variant}-on-bg-basic-emphasis-100-default);
}

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

@if ($selector != textarea) {
@extend %db-#{$variant}-variables;
/* stylelint-disable-next-line at-rule-empty-line-before */
Expand Down Expand Up @@ -203,8 +205,8 @@ $check-border-size: min(#{variables.$db-border-height-2xs}, 2px);
}

// This doesn't contain text, search and password, because they don't have an auto-validation
$input-valid-types: "color", "date", "datetime-local", "email", "file", "hidden",
"month", "number", "range", "tel", "time", "url", "week";
$input-valid-types: "color", "date", "datetime-local", "email", "file",
"hidden", "month", "number", "range", "tel", "time", "url", "week";

@function get-validations($selector, $key) {
$validations: ":required";
Expand Down Expand Up @@ -369,10 +371,8 @@ $input-valid-types: "color", "date", "datetime-local", "email", "file", "hidden"
// 1px for border
inset-block-start: calc(
#{variables.$db-sizing-md} / 2 - #{variables.$db-spacing-fixed-xs} *
var(--db-label-visible-spacing, 0) + #{$label-size-height-xs} * var(
--db-label-visible-height,
1
) - 1px
var(--db-label-visible-spacing, 0) + #{$label-size-height-xs} *
var(--db-label-visible-height, 1) - 1px
);
color: colors.$db-adaptive-on-bg-basic-emphasis-100-default;
}
Expand Down Expand Up @@ -475,7 +475,11 @@ $input-valid-types: "color", "date", "datetime-local", "email", "file", "hidden"
place-content: center center;
appearance: none;
aspect-ratio: 1;
border: #{$check-border-size} solid var(--db-check-element-border-color, #{colors.$db-adaptive-on-bg-basic-emphasis-100-default});
border: #{$check-border-size} solid
var(
--db-check-element-border-color,
#{colors.$db-adaptive-on-bg-basic-emphasis-100-default}
);
block-size: $font-size-height;
inline-size: $font-size-height;
padding: 0;
Expand Down
Loading