@juantroconisf/lib 3.5.7 → 3.5.8

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
@@ -325,6 +325,7 @@ function useForm(initialState, { validations, errorMessages } = {}) {
325
325
  errorMessage: uiErrors.validationProps.errorMessage
326
326
  };
327
327
  };
328
+ const getUXProps = (0, import_react2.useCallback)((id) => ux.current[id], [ux.current]);
328
329
  const onBlur = (id) => {
329
330
  touched.current = handleNestedChange({
330
331
  state: touched.current,
@@ -354,7 +355,8 @@ function useForm(initialState, { validations, errorMessages } = {}) {
354
355
  setState,
355
356
  register: {
356
357
  input: (id) => ({
357
- ...ux.current[id],
358
+ // ...ux.current[id],
359
+ ...getUXProps(id),
358
360
  id,
359
361
  onBlur: () => onBlur(id),
360
362
  onValueChange: (v) => onValueChange(id, v),
@@ -363,7 +365,7 @@ function useForm(initialState, { validations, errorMessages } = {}) {
363
365
  select: (id) => {
364
366
  const isString = typeof state[id] === "string" || state[id] === null;
365
367
  return {
366
- ...ux.current[id],
368
+ ...getUXProps(id),
367
369
  id,
368
370
  onBlur: () => onBlur(id),
369
371
  onSelectionChange: (v) => onSelectionChange(
@@ -374,7 +376,7 @@ function useForm(initialState, { validations, errorMessages } = {}) {
374
376
  };
375
377
  },
376
378
  autocomplete: (id) => ({
377
- ...ux.current[id],
379
+ ...getUXProps(id),
378
380
  id,
379
381
  onBlur: () => onBlur(id),
380
382
  onSelectionChange: (v) => onSelectionChange(id, v),
package/dist/index.mjs CHANGED
@@ -269,7 +269,7 @@ function useFormChange({
269
269
  }
270
270
 
271
271
  // src/hooks/useForm.tsx
272
- import { useState as useState2, useRef as useRef2 } from "react";
272
+ import { useState as useState2, useRef as useRef2, useCallback as useCallback2 } from "react";
273
273
  function useForm(initialState, { validations, errorMessages } = {}) {
274
274
  const [state, setState] = useState2(initialState), falseState = allToValue(state, false), touched = useRef2(falseState), errors2 = useRef2({ ...falseState }), realErrors = useRef2({ ...falseState }), { getValidation } = useValidation(), ux = useRef2(
275
275
  allToValue(state, { isInvalid: false, errorMessage: "" })
@@ -305,6 +305,7 @@ function useForm(initialState, { validations, errorMessages } = {}) {
305
305
  errorMessage: uiErrors.validationProps.errorMessage
306
306
  };
307
307
  };
308
+ const getUXProps = useCallback2((id) => ux.current[id], [ux.current]);
308
309
  const onBlur = (id) => {
309
310
  touched.current = handleNestedChange({
310
311
  state: touched.current,
@@ -334,7 +335,8 @@ function useForm(initialState, { validations, errorMessages } = {}) {
334
335
  setState,
335
336
  register: {
336
337
  input: (id) => ({
337
- ...ux.current[id],
338
+ // ...ux.current[id],
339
+ ...getUXProps(id),
338
340
  id,
339
341
  onBlur: () => onBlur(id),
340
342
  onValueChange: (v) => onValueChange(id, v),
@@ -343,7 +345,7 @@ function useForm(initialState, { validations, errorMessages } = {}) {
343
345
  select: (id) => {
344
346
  const isString = typeof state[id] === "string" || state[id] === null;
345
347
  return {
346
- ...ux.current[id],
348
+ ...getUXProps(id),
347
349
  id,
348
350
  onBlur: () => onBlur(id),
349
351
  onSelectionChange: (v) => onSelectionChange(
@@ -354,7 +356,7 @@ function useForm(initialState, { validations, errorMessages } = {}) {
354
356
  };
355
357
  },
356
358
  autocomplete: (id) => ({
357
- ...ux.current[id],
359
+ ...getUXProps(id),
358
360
  id,
359
361
  onBlur: () => onBlur(id),
360
362
  onSelectionChange: (v) => onSelectionChange(id, v),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juantroconisf/lib",
3
- "version": "3.5.7",
3
+ "version": "3.5.8",
4
4
  "description": "A state and validation library for HeroUI.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",