From f795c58c075289878392511870d230ebb5b09b00 Mon Sep 17 00:00:00 2001 From: Joel Hawksley Date: Fri, 22 Nov 2024 15:37:17 -0700 Subject: [PATCH] wip, but it works! --- README.md | 5 +++++ custom-elements.json | 16 ++++++++++++++++ examples/index.html | 22 ++++++++++++++------- package-lock.json | 6 +++--- src/auto-check-element.ts | 40 +++++++++++++++++++++++++++++++++++++-- test/auto-check.js | 30 +++++++++++++++++++++++++++++ 6 files changed, 107 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 2853987..2ef59b1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# TODO: Should we switch back out of always-on validation once the input passes validation, or stay in always-on? + # <auto-check> element An input element that validates its value against a server endpoint. @@ -158,6 +160,9 @@ npm install npm test ``` +TODO: Add note about uncommenting line at bottom of examples for local development +Input something other than 422 for error response? + ## License Distributed under the MIT license. See LICENSE for details. diff --git a/custom-elements.json b/custom-elements.json index 026d746..1a8455e 100644 --- a/custom-elements.json +++ b/custom-elements.json @@ -198,6 +198,22 @@ "text": "string" }, "readonly": true + }, + { + "kind": "field", + "name": "validateAfterFirstBlur", + "type": { + "text": "boolean" + }, + "readonly": true + }, + { + "kind": "field", + "name": "shouldValidate", + "type": { + "text": "boolean" + }, + "readonly": true } ], "attributes": [ diff --git a/examples/index.html b/examples/index.html index 9a0a48a..a5ae573 100644 --- a/examples/index.html +++ b/examples/index.html @@ -11,12 +11,9 @@

auto-check-element

-

Simple form

-

Input 422 for an error response.

+

old behavior

-

All fields marked with * are required

- @@ -25,7 +22,7 @@

Form that has custom validity messages

+ + +

validate-after-first-blur

+ +
+ + + +

+
+
@@ -96,7 +104,7 @@