From 1ecbb972cb032e84d47f9f09ce3d3ccf3e97b85f Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Tue, 9 Jul 2024 21:22:14 -0400 Subject: [PATCH] refactor(forms)!: move `:user-valid, :user-invalid` into a new package `@form-validation` (#41) --- app/mod.html | 4 ++++ app/sections/custom-build.html | 6 +++++- styles/@form-validation/mod.css | 11 +++++++++++ styles/@form-validation/mod.html | 17 +++++++++++++++++ styles/forms/input.html | 9 ++++++--- styles/forms/mod.css | 12 ------------ styles/forms/select.html | 2 -- styles/forms/textarea.html | 2 -- 8 files changed, 43 insertions(+), 20 deletions(-) create mode 100644 styles/@form-validation/mod.css create mode 100644 styles/@form-validation/mod.html diff --git a/app/mod.html b/app/mod.html index af6c02d..910bbb0 100644 --- a/app/mod.html +++ b/app/mod.html @@ -254,6 +254,10 @@

Layouts

Utilities

+
+

Form validation

+ +

Syntax highlighting

diff --git a/app/sections/custom-build.html b/app/sections/custom-build.html index 745be39..fa6157f 100644 --- a/app/sections/custom-build.html +++ b/app/sections/custom-build.html @@ -121,6 +121,11 @@

🛠️ Create a custom build

Istanbul coverage reports
Additional classes intended to be used with the istanbul.js coverage reports. +
\ No newline at end of file + +
+

+ matcha.css provides rules that automatically colors the borders of inputs based on their validation status. +

+
\ No newline at end of file diff --git a/styles/forms/mod.css b/styles/forms/mod.css index 53395c9..a26f7a5 100644 --- a/styles/forms/mod.css +++ b/styles/forms/mod.css @@ -103,18 +103,6 @@ textarea { cursor: not-allowed; } -textarea:user-invalid, -select:user-invalid, -input:not([type="radio"],[type="checkbox"],[type="range"],[type="submit"],[type="image"]):user-invalid { - border: 1px solid var(--danger); -} - -textarea:user-valid, -select:user-valid, -input:not([type="radio"],[type="checkbox"],[type="range"],[type="submit"],[type="image"]):user-valid { - border: 1px solid var(--success); -} - /* Select */ select { width: 100%; diff --git a/styles/forms/select.html b/styles/forms/select.html index 64faa8c..ccc9a10 100644 --- a/styles/forms/select.html +++ b/styles/forms/select.html @@ -7,8 +7,6 @@

diff --git a/styles/forms/textarea.html b/styles/forms/textarea.html index cdaca3d..f458721 100644 --- a/styles/forms/textarea.html +++ b/styles/forms/textarea.html @@ -7,8 +7,6 @@

  • :disabled has a muted background and a not-allowed cursor.
  • -
  • :user-valid has --success borders.
  • -
  • :user-invalid has --danger borders.