@juantroconisf/lib 3.2.0 → 3.2.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.d.mts CHANGED
@@ -107,4 +107,4 @@ interface UseFormChangeResponse<O extends StateType> {
107
107
 
108
108
  declare function useFormChange<O extends StateType>({ state: newState, validations, errorMessages, }: FormChangeState<O>): UseFormChangeResponse<O>;
109
109
 
110
- export { type BlurFunc, type ComponentInputProps, type FormChangeState, type GetNestedValueByKey, type GetValidationFunc, type MapValidator, type NXErrorFunc, type NestedChangeProps, NextUIError, type RegisterFunc, type RegisterHandleFunc, type RequiredValidationFunc, type StateType, type TouchedType, type UseFormChangeResponse, type UseValidationFunc, type Validator, type ValidatorErrorMessage$1 as ValidatorErrorMessage, type ValidatorFunction, type ValidatorParams$1 as ValidatorParams, type ValidatorTypes, type ValueChangeFunc, useFormChange };
110
+ export { type BlurFunc, type ComponentInputProps, type FormChangeState, type GetNestedValueByKey, type GetValidationFunc, type GetValidationResponse, type MapValidator, type NXErrorFunc, type NestedChangeProps, NextUIError, type RegisterFunc, type RegisterHandleFunc, type RequiredValidationFunc, type StateType, type TouchedType, type UseFormChangeResponse, type UseValidationFunc, type Validator, type ValidatorErrorMessage$1 as ValidatorErrorMessage, type ValidatorFunction, type ValidatorParams$1 as ValidatorParams, type ValidatorTypes, type ValueChangeFunc, useFormChange };
package/dist/index.d.ts CHANGED
@@ -107,4 +107,4 @@ interface UseFormChangeResponse<O extends StateType> {
107
107
 
108
108
  declare function useFormChange<O extends StateType>({ state: newState, validations, errorMessages, }: FormChangeState<O>): UseFormChangeResponse<O>;
109
109
 
110
- export { type BlurFunc, type ComponentInputProps, type FormChangeState, type GetNestedValueByKey, type GetValidationFunc, type MapValidator, type NXErrorFunc, type NestedChangeProps, NextUIError, type RegisterFunc, type RegisterHandleFunc, type RequiredValidationFunc, type StateType, type TouchedType, type UseFormChangeResponse, type UseValidationFunc, type Validator, type ValidatorErrorMessage$1 as ValidatorErrorMessage, type ValidatorFunction, type ValidatorParams$1 as ValidatorParams, type ValidatorTypes, type ValueChangeFunc, useFormChange };
110
+ export { type BlurFunc, type ComponentInputProps, type FormChangeState, type GetNestedValueByKey, type GetValidationFunc, type GetValidationResponse, type MapValidator, type NXErrorFunc, type NestedChangeProps, NextUIError, type RegisterFunc, type RegisterHandleFunc, type RequiredValidationFunc, type StateType, type TouchedType, type UseFormChangeResponse, type UseValidationFunc, type Validator, type ValidatorErrorMessage$1 as ValidatorErrorMessage, type ValidatorFunction, type ValidatorParams$1 as ValidatorParams, type ValidatorTypes, type ValueChangeFunc, useFormChange };
package/dist/index.js CHANGED
@@ -200,18 +200,28 @@ function useFormChange({
200
200
  errorMessage: ""
201
201
  };
202
202
  if (requirements === void 0) return props;
203
- const [ui, ux] = [isTouched, true].map(
204
- (bool) => getValidation(value, bool, requirements, errorMessages?.[id])
205
- );
206
- errors2.current = handleNestedChange({
207
- state: errors2.current,
208
- id,
209
- value: !ui.isValid
210
- });
211
- untouchedErrors.current = handleNestedChange({
212
- state: untouchedErrors.current,
213
- id,
214
- value: !ux.isValid
203
+ const [ui] = [
204
+ {
205
+ ref: errors2,
206
+ touched: isTouched
207
+ },
208
+ {
209
+ ref: untouchedErrors,
210
+ touched: true
211
+ }
212
+ ].map((item) => {
213
+ const req = getValidation(
214
+ value,
215
+ item.touched,
216
+ requirements,
217
+ errorMessages?.[id]
218
+ );
219
+ item.ref.current = handleNestedChange({
220
+ state: item.ref.current,
221
+ id,
222
+ value: req.isValid
223
+ });
224
+ return req;
215
225
  });
216
226
  return {
217
227
  ...props,
package/dist/index.mjs CHANGED
@@ -181,18 +181,28 @@ function useFormChange({
181
181
  errorMessage: ""
182
182
  };
183
183
  if (requirements === void 0) return props;
184
- const [ui, ux] = [isTouched, true].map(
185
- (bool) => getValidation(value, bool, requirements, errorMessages?.[id])
186
- );
187
- errors2.current = handleNestedChange({
188
- state: errors2.current,
189
- id,
190
- value: !ui.isValid
191
- });
192
- untouchedErrors.current = handleNestedChange({
193
- state: untouchedErrors.current,
194
- id,
195
- value: !ux.isValid
184
+ const [ui] = [
185
+ {
186
+ ref: errors2,
187
+ touched: isTouched
188
+ },
189
+ {
190
+ ref: untouchedErrors,
191
+ touched: true
192
+ }
193
+ ].map((item) => {
194
+ const req = getValidation(
195
+ value,
196
+ item.touched,
197
+ requirements,
198
+ errorMessages?.[id]
199
+ );
200
+ item.ref.current = handleNestedChange({
201
+ state: item.ref.current,
202
+ id,
203
+ value: req.isValid
204
+ });
205
+ return req;
196
206
  });
197
207
  return {
198
208
  ...props,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juantroconisf/lib",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -18,7 +18,6 @@
18
18
  "homepage": "https://github.com/juandiegotroconis/lib#readme",
19
19
  "devDependencies": {
20
20
  "@heroui/react": "^2.7.5",
21
- "@types/node": "^22.13.10",
22
21
  "@types/react": "^19.0.12",
23
22
  "tsup": "^8.4.0",
24
23
  "typescript": "^5.8.2"