From f8278c1ab1ffff6318ae37bd8136e12adfa49ebd Mon Sep 17 00:00:00 2001 From: "louismaxime.piton" Date: Wed, 11 Oct 2023 17:05:46 +0200 Subject: [PATCH] Add color mode on form validation --- scss/_root.scss | 3 + scss/_variables-dark.scss | 11 ++- scss/_variables.scss | 1 + scss/mixins/_forms.scss | 1 + site/content/docs/5.3/dark-mode.md | 119 ++++++++++++++++++++++++++++- 5 files changed, 130 insertions(+), 5 deletions(-) diff --git a/scss/_root.scss b/scss/_root.scss index 560de0834f..825bd6ee3d 100644 --- a/scss/_root.scss +++ b/scss/_root.scss @@ -152,6 +152,9 @@ color-scheme: dark; // scss-docs-start root-dark-mode-vars + --#{$prefix}success-icon: #{escape-svg($success-icon-dark)}; + --#{$prefix}error-icon: #{escape-svg($danger-icon-dark)}; + --#{$prefix}body-color: #{$body-color-dark}; --#{$prefix}body-color-rgb: #{to-rgb($body-color-dark)}; --#{$prefix}body-bg: #{$body-bg-dark}; diff --git a/scss/_variables-dark.scss b/scss/_variables-dark.scss index 22a7eeea31..f03cd08eb9 100644 --- a/scss/_variables-dark.scss +++ b/scss/_variables-dark.scss @@ -94,6 +94,9 @@ $disabled-filter-dark: brightness(0) invert(1) brightness(.4) !default; // Boos $focus-visible-inner-color-dark: $black !default; // Boosted mod $focus-visible-outer-color-dark: $white !default; // Boosted mod +$success-icon-dark: url("data:image/svg+xml,") !default; +$danger-icon-dark: url("data:image/svg+xml,") !default; + // // Forms // @@ -105,10 +108,10 @@ $focus-visible-outer-color-dark: $white !default; // Boosted mod // Boosted mod: no $form-switch-bg-image-dark // scss-docs-start form-validation-colors-dark -$form-valid-color-dark: $green-300 !default; -$form-valid-border-color-dark: $green-300 !default; -$form-invalid-color-dark: $red-300 !default; -$form-invalid-border-color-dark: $red-300 !default; +$form-valid-color-dark: var(--#{$prefix}success-text-emphasis) !default; +$form-valid-border-color-dark: var(--#{$prefix}success) !default; +$form-invalid-color-dark: var(--#{$prefix}danger-text-emphasis) !default; +$form-invalid-border-color-dark: var(--#{$prefix}danger) !default; // scss-docs-end form-validation-colors-dark diff --git a/scss/_variables.scss b/scss/_variables.scss index d6a7bb6059..49bbeb88dd 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -1339,6 +1339,7 @@ $form-feedback-icon-valid: var(--#{$prefix}success-icon) !default; $form-feedback-icon-invalid: var(--#{$prefix}error-icon) !default; $form-feedback-icon-size: add($spacer * .25, $spacer * .5) !default; // Boosted mod $form-feedback-line-height: $line-height-sm !default; // Boosted mod +$form-feedback-color: var(--#{$prefix}body-color) !default; // Boosted mod // scss-docs-end form-feedback-variables // scss-docs-start form-validation-colors diff --git a/scss/mixins/_forms.scss b/scss/mixins/_forms.scss index 65a4a85b49..ec13a75197 100644 --- a/scss/mixins/_forms.scss +++ b/scss/mixins/_forms.scss @@ -62,6 +62,7 @@ font-style: $form-feedback-font-style; font-weight: $font-weight-bold; // Boosted mod line-height: $form-feedback-line-height; // Boosted mod + color: $form-feedback-color; // Boosted mod // Boosted mod: status should not rely on color only @if $enable-validation-icons { diff --git a/site/content/docs/5.3/dark-mode.md b/site/content/docs/5.3/dark-mode.md index 160608c2fd..5e418889cf 100644 --- a/site/content/docs/5.3/dark-mode.md +++ b/site/content/docs/5.3/dark-mode.md @@ -1734,7 +1734,7 @@ sitemap_exclude: true -### Labels, required fields & text +### Labels, fields & text

No theme

@@ -2029,3 +2029,120 @@ sitemap_exclude: true + +### Form validation + +

No theme

+ +
+ + + + +
+
+
+
+
+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+
+ +

Dark theme on container

+ +
+ + + + +
+
+
+
+
+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+
+ +

Light theme on container

+ +
+ + + + +
+
+
+
+
+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+
+ +

Dark theme on component

+ +
+ + + + +
+
+
+
+
+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+
+ +

Light theme on component

+ +
+ + + + +
+
+
+
+
+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+

Invalid feedback

+