@featherk/composables 0.9.2 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,7 @@ const fieldsetRef = ref<HTMLFieldSetElement | null>(null);
28
28
  const address = useUSAddress({
29
29
  fieldsetRef,
30
30
  addressId: "shipping-address",
31
+ // required: true, // optional defaults to true
31
32
  });
32
33
 
33
34
  async function onSubmit() {
@@ -80,6 +81,8 @@ Validation:
80
81
 
81
82
  - `addressValidate`
82
83
  - `address1Valid`, `cityValid`, `stateValid`, `zipValid`, `addressValid`
84
+ - `optionalFeedbackActive`, `optionalPartialInvalid`
85
+ - `optionalMissingRequiredFields`, `optionalZipInvalid`
83
86
  - `touched`
84
87
 
85
88
  Handlers:
@@ -98,3 +101,31 @@ Actions:
98
101
  - Invalid submit focuses the first invalid Kendo control in the fieldset.
99
102
  - Reset clears submit/touch state and field values.
100
103
  - ZIP behavior remains delegated to `useZipTextBox`.
104
+
105
+ ## Required Option
106
+
107
+ `useUSAddress` accepts an optional `required` option (`boolean` or ref/getter,
108
+ default `true`).
109
+
110
+ - `required: true` uses standard delayed validation behavior.
111
+ - `required: false` keeps required validation visuals suppressed and invalid-focus behavior disabled.
112
+
113
+ When `required` is `false`, `validateForSubmit()` behaves as follows:
114
+
115
+ - returns valid when address data is empty
116
+ - returns valid when address data is fully valid
117
+ - returns invalid for partial/invalid address data
118
+
119
+ Optional feedback semantics are exposed separately from required validation:
120
+
121
+ - `optionalPartialInvalid`: optional mode has some address input, but the address
122
+ is not fully valid.
123
+ - `optionalFeedbackActive`: optional partial-invalid state is currently eligible
124
+ for UX messaging (after fieldset blur or failed submit attempt).
125
+ - `optionalMissingRequiredFields`: optional mode is missing Address 1, City,
126
+ and/or State while partial input exists.
127
+ - `optionalZipInvalid`: optional mode has address input and ZIP is not exactly
128
+ 5 or 9 digits (including empty ZIP).
129
+
130
+ If required toggles from `false` to `true`, validation remains dormant until the
131
+ next submit or fieldset focusout.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@featherk/composables",
3
- "version": "0.9.2",
3
+ "version": "0.9.5",
4
4
  "main": "dist/featherk-composables.umd.js",
5
5
  "module": "dist/featherk-composables.es.js",
6
6
  "types": "dist/index.d.ts",