@juantroconisf/lib 4.0.1 → 4.0.2

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.
package/dist/index.js CHANGED
@@ -206,13 +206,17 @@ function useForm(initialState, { validations, errorMessages } = {}) {
206
206
  },
207
207
  [errors2, touched]
208
208
  );
209
- const onBlur = (id) => !touched[id] && setTouched(
210
- (prev) => handleNestedChange({
211
- state: prev,
212
- id,
213
- value: true
214
- })
215
- ), onValueChange = (id, value) => {
209
+ const onBlur = (id) => {
210
+ validateInput(id, state[id]);
211
+ if (touched[id]) return;
212
+ setTouched(
213
+ (prev) => handleNestedChange({
214
+ state: prev,
215
+ id,
216
+ value: true
217
+ })
218
+ );
219
+ }, onValueChange = (id, value) => {
216
220
  setState((prev) => handleNestedChange({ state: prev, id, value }));
217
221
  validateInput(id, value);
218
222
  }, onSelectionChange = (id, value) => {
package/dist/index.mjs CHANGED
@@ -187,13 +187,17 @@ function useForm(initialState, { validations, errorMessages } = {}) {
187
187
  },
188
188
  [errors2, touched]
189
189
  );
190
- const onBlur = (id) => !touched[id] && setTouched(
191
- (prev) => handleNestedChange({
192
- state: prev,
193
- id,
194
- value: true
195
- })
196
- ), onValueChange = (id, value) => {
190
+ const onBlur = (id) => {
191
+ validateInput(id, state[id]);
192
+ if (touched[id]) return;
193
+ setTouched(
194
+ (prev) => handleNestedChange({
195
+ state: prev,
196
+ id,
197
+ value: true
198
+ })
199
+ );
200
+ }, onValueChange = (id, value) => {
197
201
  setState((prev) => handleNestedChange({ state: prev, id, value }));
198
202
  validateInput(id, value);
199
203
  }, onSelectionChange = (id, value) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juantroconisf/lib",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "A form validation library for HeroUI.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",