@fuf-stack/uniform 1.28.0 → 1.29.0

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.
Files changed (148) hide show
  1. package/README.md +6 -35
  2. package/dist/Checkboxes/index.d.mts +11 -13
  3. package/dist/Checkboxes/index.d.mts.map +1 -1
  4. package/dist/Checkboxes/index.mjs +2 -4
  5. package/dist/Checkboxes/index.mjs.map +1 -1
  6. package/dist/DatePicker/index.d.mts +21 -23
  7. package/dist/DatePicker/index.d.mts.map +1 -1
  8. package/dist/DatePicker/index.mjs +3 -6
  9. package/dist/DatePicker/index.mjs.map +1 -1
  10. package/dist/FieldArray/index.d.mts +2 -8
  11. package/dist/FieldArray/index.d.mts.map +1 -1
  12. package/dist/FieldArray/index.mjs +13 -23
  13. package/dist/FieldArray/index.mjs.map +1 -1
  14. package/dist/FieldCard/index.d.mts +0 -2
  15. package/dist/FieldCard/index.d.mts.map +1 -1
  16. package/dist/FieldCard/index.mjs +5 -8
  17. package/dist/FieldCard/index.mjs.map +1 -1
  18. package/dist/{FieldCopyTestIdButton-9xTF-DBW.mjs → FieldCopyTestIdButton-Y9SfvaM9.mjs} +3 -5
  19. package/dist/{FieldCopyTestIdButton-9xTF-DBW.mjs.map → FieldCopyTestIdButton-Y9SfvaM9.mjs.map} +1 -1
  20. package/dist/FieldReset/index.d.mts +415 -0
  21. package/dist/FieldReset/index.d.mts.map +1 -0
  22. package/dist/FieldReset/index.mjs +241 -0
  23. package/dist/FieldReset/index.mjs.map +1 -0
  24. package/dist/{FieldValidationError-ByRoIxaM.mjs → FieldValidationError-BcUV0r1I.mjs} +3 -5
  25. package/dist/{FieldValidationError-ByRoIxaM.mjs.map → FieldValidationError-BcUV0r1I.mjs.map} +1 -1
  26. package/dist/Form/index.d.mts +12 -14
  27. package/dist/Form/index.d.mts.map +1 -1
  28. package/dist/Form/index.mjs +7 -10
  29. package/dist/Form/index.mjs.map +1 -1
  30. package/dist/{FormContext-CB7Glm02.mjs → FormContext-B8G_Xxd6.mjs} +49 -14
  31. package/dist/FormContext-B8G_Xxd6.mjs.map +1 -0
  32. package/dist/FormContext-BnNJYZOo.d.mts +124 -0
  33. package/dist/FormContext-BnNJYZOo.d.mts.map +1 -0
  34. package/dist/Grid/index.d.mts +0 -2
  35. package/dist/Grid/index.d.mts.map +1 -1
  36. package/dist/Grid/index.mjs +1 -2
  37. package/dist/{Grid-CTs-Rb9G.mjs → Grid-Us2JFczS.mjs} +3 -5
  38. package/dist/{Grid-CTs-Rb9G.mjs.map → Grid-Us2JFczS.mjs.map} +1 -1
  39. package/dist/Input/index.d.mts +14 -16
  40. package/dist/Input/index.d.mts.map +1 -1
  41. package/dist/Input/index.mjs +4 -7
  42. package/dist/Input/index.mjs.map +1 -1
  43. package/dist/RadioBoxes/index.d.mts +13 -17
  44. package/dist/RadioBoxes/index.d.mts.map +1 -1
  45. package/dist/RadioBoxes/index.mjs +3 -6
  46. package/dist/RadioBoxes/index.mjs.map +1 -1
  47. package/dist/RadioTabs/index.d.mts +46 -48
  48. package/dist/RadioTabs/index.d.mts.map +1 -1
  49. package/dist/RadioTabs/index.mjs +2 -4
  50. package/dist/RadioTabs/index.mjs.map +1 -1
  51. package/dist/Radios/index.d.mts +5 -7
  52. package/dist/Radios/index.d.mts.map +1 -1
  53. package/dist/Radios/index.mjs +2 -4
  54. package/dist/Radios/index.mjs.map +1 -1
  55. package/dist/Select/index.d.mts +28 -30
  56. package/dist/Select/index.d.mts.map +1 -1
  57. package/dist/Select/index.mjs +4 -7
  58. package/dist/Select/index.mjs.map +1 -1
  59. package/dist/Slider/index.d.mts +44 -46
  60. package/dist/Slider/index.d.mts.map +1 -1
  61. package/dist/Slider/index.mjs +2 -4
  62. package/dist/Slider/index.mjs.map +1 -1
  63. package/dist/SubmitButton/index.d.mts +0 -2
  64. package/dist/SubmitButton/index.d.mts.map +1 -1
  65. package/dist/SubmitButton/index.mjs +2 -4
  66. package/dist/SubmitButton/index.mjs.map +1 -1
  67. package/dist/Switch/index.d.mts +23 -25
  68. package/dist/Switch/index.d.mts.map +1 -1
  69. package/dist/Switch/index.mjs +2 -4
  70. package/dist/Switch/index.mjs.map +1 -1
  71. package/dist/SwitchBox/index.d.mts +39 -41
  72. package/dist/SwitchBox/index.d.mts.map +1 -1
  73. package/dist/SwitchBox/index.mjs +2 -4
  74. package/dist/SwitchBox/index.mjs.map +1 -1
  75. package/dist/TextArea/index.d.mts +11 -13
  76. package/dist/TextArea/index.d.mts.map +1 -1
  77. package/dist/TextArea/index.mjs +3 -5
  78. package/dist/TextArea/index.mjs.map +1 -1
  79. package/dist/Time/index.d.mts +11 -13
  80. package/dist/Time/index.d.mts.map +1 -1
  81. package/dist/Time/index.mjs +3 -6
  82. package/dist/Time/index.mjs.map +1 -1
  83. package/dist/helpers/index.d.mts +0 -6
  84. package/dist/helpers/index.d.mts.map +1 -1
  85. package/dist/helpers/index.mjs +3 -6
  86. package/dist/helpers/index.mjs.map +1 -1
  87. package/dist/hooks/useClientValidation/index.d.mts +0 -2
  88. package/dist/hooks/useClientValidation/index.d.mts.map +1 -1
  89. package/dist/hooks/useClientValidation/index.mjs +3 -5
  90. package/dist/hooks/useController/index.d.mts +1 -2
  91. package/dist/hooks/useController/index.mjs +2 -4
  92. package/dist/hooks/useFormContext/index.d.mts +2 -3
  93. package/dist/hooks/useFormContext/index.mjs +2 -4
  94. package/dist/hooks/useInput/index.mjs +2 -4
  95. package/dist/hooks/useInputValueDebounce/index.d.mts +2 -4
  96. package/dist/hooks/useInputValueDebounce/index.d.mts.map +1 -1
  97. package/dist/hooks/useInputValueDebounce/index.mjs +3 -5
  98. package/dist/hooks/useInputValueDebounce/index.mjs.map +1 -1
  99. package/dist/hooks/useInputValueTransform/index.d.mts +1 -1
  100. package/dist/hooks/useInputValueTransform/index.mjs +2 -4
  101. package/dist/hooks/useUniformField/index.d.mts +2 -100
  102. package/dist/hooks/useUniformField/index.mjs +9 -11
  103. package/dist/hooks/useUniformField/index.mjs.map +1 -1
  104. package/dist/hooks/useUniformFieldArray/index.d.mts +23 -49
  105. package/dist/hooks/useUniformFieldArray/index.d.mts.map +1 -1
  106. package/dist/hooks/useUniformFieldArray/index.mjs +3 -5
  107. package/dist/hooks/useUniformFieldArray/index.mjs.map +1 -1
  108. package/dist/hooks/useWatchFormReset/index.d.mts +0 -2
  109. package/dist/hooks/useWatchFormReset/index.d.mts.map +1 -1
  110. package/dist/hooks/useWatchFormReset/index.mjs +3 -5
  111. package/dist/hooks/useWatchUserChange/index.d.mts +2 -4
  112. package/dist/hooks/useWatchUserChange/index.d.mts.map +1 -1
  113. package/dist/hooks/useWatchUserChange/index.mjs +3 -5
  114. package/dist/hooks/useWatchUserChange/index.mjs.map +1 -1
  115. package/dist/index-DaiTW5Bl.d.mts +99 -0
  116. package/dist/index-DaiTW5Bl.d.mts.map +1 -0
  117. package/dist/partials/FieldCopyTestIdButton/index.d.mts +0 -2
  118. package/dist/partials/FieldCopyTestIdButton/index.d.mts.map +1 -1
  119. package/dist/partials/FieldCopyTestIdButton/index.mjs +1 -2
  120. package/dist/partials/FieldValidationError/index.d.mts +0 -2
  121. package/dist/partials/FieldValidationError/index.d.mts.map +1 -1
  122. package/dist/partials/FieldValidationError/index.mjs +1 -2
  123. package/dist/{useController-BBSbeKbn.mjs → useController-CJjMqXU5.mjs} +3 -4
  124. package/dist/{useController-BBSbeKbn.mjs.map → useController-CJjMqXU5.mjs.map} +1 -1
  125. package/dist/{useController-DcK2YHbw.d.mts → useController-CdFEp-Wa.d.mts} +2 -4
  126. package/dist/useController-CdFEp-Wa.d.mts.map +1 -0
  127. package/dist/{useFormContext-DNb_B8LQ.mjs → useFormContext-BEjPBdzb.mjs} +3 -4
  128. package/dist/useFormContext-BEjPBdzb.mjs.map +1 -0
  129. package/dist/useFormContext-BhPzFXwF.d.mts +45 -0
  130. package/dist/useFormContext-BhPzFXwF.d.mts.map +1 -0
  131. package/dist/useInput-NPbS4w_n.mjs +1 -0
  132. package/dist/{useInputValueTransform-DJ5zkqSy.mjs → useInputValueTransform-D44BLp1Z.mjs} +2 -3
  133. package/dist/{useInputValueTransform-DJ5zkqSy.mjs.map → useInputValueTransform-D44BLp1Z.mjs.map} +1 -1
  134. package/dist/{useInputValueTransform-LOaEim7k.d.mts → useInputValueTransform-cevZBrIN.d.mts} +3 -5
  135. package/dist/useInputValueTransform-cevZBrIN.d.mts.map +1 -0
  136. package/package.json +11 -10
  137. package/dist/FormContext-CB7Glm02.mjs.map +0 -1
  138. package/dist/FormContext-CsFiNvuJ.d.mts +0 -19
  139. package/dist/FormContext-CsFiNvuJ.d.mts.map +0 -1
  140. package/dist/hooks/useUniformField/index.d.mts.map +0 -1
  141. package/dist/index-CAdGtKE_.d.mts +0 -1
  142. package/dist/index-CwJo1b4Z.d.mts +0 -1
  143. package/dist/useController-DcK2YHbw.d.mts.map +0 -1
  144. package/dist/useFormContext-BegmYvGA.d.mts +0 -66
  145. package/dist/useFormContext-BegmYvGA.d.mts.map +0 -1
  146. package/dist/useFormContext-DNb_B8LQ.mjs.map +0 -1
  147. package/dist/useInput-C0aJaAGe.mjs +0 -2
  148. package/dist/useInputValueTransform-LOaEim7k.d.mts.map +0 -1
@@ -1,26 +1,34 @@
1
- import { r as useController$1 } from "../../useController-DcK2YHbw.mjs";
2
- import "../../index-CAdGtKE_.mjs";
3
- import { n as useFormContext$1 } from "../../useFormContext-BegmYvGA.mjs";
4
- import "../../index-CwJo1b4Z.mjs";
1
+ import { n as UseUniformFieldReturn } from "../../index-DaiTW5Bl.mjs";
5
2
  import { ReactNode } from "react";
6
- import { ArrayPath, FieldValues } from "react-hook-form";
7
- //#region src/hooks/useUniformFieldArray/useUniformFieldArray.d.ts
3
+ import { ArrayPath, FieldValues, UseFieldArrayReturn } from "react-hook-form";
8
4
  export interface UseUniformFieldArrayProps<TFieldValues extends FieldValues = FieldValues> {
9
- /** Field name for the array */
10
- name: ArrayPath<TFieldValues>;
11
- /** Whether this is a flat array (array of primitives) */
12
- flat?: boolean;
5
+ /** Disable the field */
6
+ disabled?: boolean;
13
7
  /** Initial value for new array elements */
14
8
  elementInitialValue?: unknown;
9
+ /** Whether this is a flat array (array of primitives) */
10
+ flat?: boolean;
11
+ /** Optional label content */
12
+ label?: ReactNode;
15
13
  /** Whether the last element cannot be removed (always maintain at least one element) */
16
14
  lastElementNotRemovable?: boolean;
17
- /** Disable the field */
18
- disabled?: boolean;
15
+ /** Field name for the array */
16
+ name: ArrayPath<TFieldValues>;
19
17
  /** Optional explicit test id used to build stable test ids */
20
18
  testId?: string;
21
- /** Optional label content */
22
- label?: ReactNode;
23
19
  }
20
+ /**
21
+ * Return type of `useUniformFieldArray`.
22
+ *
23
+ * Declared explicitly so the published declarations only reference types that
24
+ * react-hook-form exports from its package root.
25
+ */
26
+ export type UseUniformFieldArrayReturn<TFieldValues extends FieldValues = FieldValues> = Pick<UseFieldArrayReturn<TFieldValues, ArrayPath<TFieldValues>>, 'append' | 'fields' | 'insert' | 'move' | 'remove'> & UseUniformFieldReturn<TFieldValues> & {
27
+ /** Disables element animations during initialization, reset and reduced motion */
28
+ disableAnimation: boolean;
29
+ /** Value used for newly added array elements */
30
+ elementInitialValue: NonNullable<unknown>;
31
+ };
24
32
  /**
25
33
  * Enhanced useFieldArray hook with initialization and animation logic.
26
34
  * Based on React Hook Form's useFieldArray with additional features:
@@ -35,39 +43,5 @@ export interface UseUniformFieldArrayProps<TFieldValues extends FieldValues = Fi
35
43
  *
36
44
  * @see https://react-hook-form.com/docs/usefieldarray
37
45
  */
38
- export declare const useUniformFieldArray: <TFieldValues extends FieldValues = FieldValues>({ name, flat, elementInitialValue: _elementInitialValue, lastElementNotRemovable, disabled, testId: explicitTestId, label }: UseUniformFieldArrayProps<TFieldValues>) => {
39
- ariaLabel: string | undefined;
40
- control: import("react-hook-form").Control<TFieldValues, any, TFieldValues>;
41
- debugMode: ReturnType<typeof useFormContext$1<TFieldValues_1>>["debugMode"];
42
- defaultValue: unknown;
43
- disabled: boolean | undefined;
44
- error: import("react-hook-form").FieldError[] | undefined;
45
- errorMessage: ReactNode | null;
46
- field: Omit<import("react-hook-form").ControllerRenderProps<TFieldValues>, "onChange" | "value"> & {
47
- onChange: (...event: any[]) => void;
48
- value: string;
49
- };
50
- getErrorMessageProps: ReturnType<typeof import("@heroui/input").useInput>["getErrorMessageProps"];
51
- getHelperWrapperProps: ReturnType<typeof import("@heroui/input").useInput>["getHelperWrapperProps"];
52
- getLabelProps: ReturnType<typeof import("@heroui/input").useInput>["getLabelProps"];
53
- getValues: import("react-hook-form").UseFormGetValues<TFieldValues>;
54
- invalid: boolean;
55
- label: ReactNode | null;
56
- onBlur: ReturnType<typeof useController$1>["field"]["onBlur"];
57
- onChange: ReturnType<typeof useController$1>["field"]["onChange"];
58
- ref: ReturnType<typeof useController$1>["field"]["ref"];
59
- required: boolean;
60
- resetField: import("react-hook-form").UseFormResetField<TFieldValues>;
61
- testId: string;
62
- fields: (import("react-hook-form").FieldArray<TFieldValues, ArrayPath<TFieldValues>> & Record<"id", string> & {
63
- disabled?: boolean;
64
- })[];
65
- append: import("react-hook-form").UseFieldArrayAppend<TFieldValues, ArrayPath<TFieldValues>>;
66
- remove: import("react-hook-form").UseFieldArrayRemove;
67
- insert: import("react-hook-form").UseFieldArrayInsert<TFieldValues, ArrayPath<TFieldValues>>;
68
- move: import("react-hook-form").UseFieldArrayMove;
69
- disableAnimation: boolean;
70
- elementInitialValue: {};
71
- };
72
- //#endregion
46
+ export declare const useUniformFieldArray: <TFieldValues extends FieldValues = FieldValues>({ name, flat, elementInitialValue: _elementInitialValue, lastElementNotRemovable, disabled, testId: explicitTestId, label }: UseUniformFieldArrayProps<TFieldValues>) => UseUniformFieldArrayReturn<TFieldValues>;
73
47
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/hooks/useUniformFieldArray/useUniformFieldArray.ts"],"mappings":";;;;;;;iBAaiB,0BACf,qBAAqB,cAAc;;EAGnC,MAAM,UAAU;;EAEhB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,QAAQ;;;;;;;;;;;;;;;;qBAiBG,uBACX,qBAAqB,cAAc,eACnC,MAAA,MAAA,qBAAA,sBAAA,yBAAA,UAAA,QAAA,gBAAA,SAQC,0BAA0B;;;;;;;;;IAnCX,cAAG;;;;;;;;;EA0ES,QAAA;EAE5B,UAAA,kBAF4B;EAQzB,KAAA,kBANH"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/hooks/useUniformFieldArray/useUniformFieldArray.ts"],"mappings":";;;iBAmBiB,0BACf,qBAAqB,cAAc;;EAGnC;;EAEA;;EAEA;;EAEA,QAAQ;;EAER;;EAEA,MAAM,UAAU;;EAEhB;;;;;;;;YASU,2BACV,qBAAqB,cAAc,eACjC,KACF,oBAAoB,cAAc,UAAU,sEAG5C,sBAAsB;;EAEpB;;EAEA,qBAAqB;;;;;;;;;;;;;;;;qBAiBZ,uBACX,qBAAqB,cAAc,eACnC,MAAA,MAAA,qBAAA,sBAAA,yBAAA,UAAA,QAAA,gBAAA,SAQC,0BAA0B,kBAAgB,2BAA2B"}
@@ -1,11 +1,11 @@
1
1
  import { flatArrayKey, isValueEmpty } from "../../helpers/index.mjs";
2
- import { n as useFormContext$1 } from "../../useFormContext-DNb_B8LQ.mjs";
2
+ import { n as useFormContext$1 } from "../../useFormContext-BEjPBdzb.mjs";
3
3
  import { useUniformField } from "../useUniformField/index.mjs";
4
4
  import { useWatchFormReset } from "../useWatchFormReset/index.mjs";
5
5
  import { useEffect, useMemo, useRef, useState } from "react";
6
6
  import { useReducedMotion } from "@fuf-stack/pixel-motion";
7
7
  import { useFieldArray } from "react-hook-form";
8
- //#region src/hooks/useUniformFieldArray/useUniformFieldArray.ts
8
+ // src/hooks/useUniformFieldArray/useUniformFieldArray.ts
9
9
  /**
10
10
  * Enhanced useFieldArray hook with initialization and animation logic.
11
11
  * Based on React Hook Form's useFieldArray with additional features:
@@ -92,10 +92,8 @@ const useUniformFieldArray = ({ name, flat = false, elementInitialValue: _elemen
92
92
  ...uniformField
93
93
  };
94
94
  };
95
- //#endregion
96
- //#region src/hooks/useUniformFieldArray/index.ts
95
+ // src/hooks/useUniformFieldArray/index.ts
97
96
  /* v8 ignore stop */
98
- //#endregion
99
97
  export { useUniformFieldArray };
100
98
 
101
99
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["useRHFFieldArray","useFormContext"],"sources":["../../../src/hooks/useUniformFieldArray/useUniformFieldArray.ts","../../../src/hooks/useUniformFieldArray/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ArrayPath, FieldValues, Path } from 'react-hook-form';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { useFieldArray as useRHFFieldArray } from 'react-hook-form';\n\nimport { useReducedMotion } from '@fuf-stack/pixel-motion';\n\nimport { flatArrayKey, isValueEmpty } from '../../helpers';\nimport { useFormContext } from '../useFormContext';\nimport { useUniformField } from '../useUniformField';\nimport { useWatchFormReset } from '../useWatchFormReset';\n\nexport interface UseUniformFieldArrayProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Field name for the array */\n name: ArrayPath<TFieldValues>;\n /** Whether this is a flat array (array of primitives) */\n flat?: boolean;\n /** Initial value for new array elements */\n elementInitialValue?: unknown;\n /** Whether the last element cannot be removed (always maintain at least one element) */\n lastElementNotRemovable?: boolean;\n /** Disable the field */\n disabled?: boolean;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional label content */\n label?: ReactNode;\n}\n\n/**\n * Enhanced useFieldArray hook with initialization and animation logic.\n * Based on React Hook Form's useFieldArray with additional features:\n * - Automatic initialization when lastElementNotRemovable is set\n * - Reset-only normalization for stale empty placeholder rows (via useWatchFormReset)\n * - Animation control (disabled during initialization)\n * - Temporary animation disable during reset normalization collapse\n * - Support for flat arrays (arrays of primitives)\n *\n * Note: Automatic validation triggering on length change is disabled to prevent\n * triggering form-wide validation. Array validation still runs on form submission.\n *\n * @see https://react-hook-form.com/docs/usefieldarray\n */\nexport const useUniformFieldArray = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n name,\n flat = false,\n elementInitialValue: _elementInitialValue = null,\n lastElementNotRemovable = false,\n disabled,\n testId: explicitTestId,\n label,\n}: UseUniformFieldArrayProps<TFieldValues>) => {\n // Get uniform field state and utilities\n const uniformField = useUniformField<TFieldValues>({\n name: name as Path<TFieldValues> & string,\n disabled,\n testId: explicitTestId,\n label,\n });\n\n const { control } = uniformField;\n\n const { fields, append, remove, insert, move, replace } = useRHFFieldArray({\n control,\n name,\n });\n\n const { trigger, setValue, getValues } = useFormContext<TFieldValues>();\n\n // Determine if initialization is needed (initially or after reset).\n // lastElementNotRemovable is purely a minimum-count guarantee: when there are\n // no rows, add one. This handles both:\n // - Initial mount: fields.length starts at 0\n // - Form reset to an empty array: fields.length becomes 0 again\n // It intentionally does NOT inspect row contents, so manually added empty rows\n // are never collapsed.\n const needsInitialize = useMemo(() => {\n return lastElementNotRemovable && fields.length === 0;\n }, [lastElementNotRemovable, fields.length]);\n\n // Track whether initialization has completed. Initialized contextually:\n // - If initialization IS needed (needsInitialize = true): starts as false, set to true after init\n // - If initialization is NOT needed (needsInitialize = false): starts as true (already initialized)\n // This ref is used to:\n // 1. Skip validation during initialization/re-initialization\n // 2. Gate animation enabling until after initialization\n // 3. Gate motion preference effect until after initialization\n const hasInitialized = useRef(!needsInitialize);\n\n // Reset initialization flag when needsInitialize changes to true.\n // This handles form reset: when fields become empty (needsInitialize becomes true),\n // hasInitialized is reset to false, triggering re-initialization in the effect below.\n useEffect(() => {\n if (needsInitialize) {\n hasInitialized.current = false;\n }\n }, [needsInitialize]);\n\n // Validate array-level constraints (min/max items) when length changes.\n // This ensures min/max errors appear instantly when user adds/removes items.\n // Note: Child field validation also runs, but new empty fields won't show as invalid\n // because useFormContext only sets invalid=true for touched fields or after form submission.\n // Skip validation during initialization/re-initialization to avoid showing errors prematurely.\n useEffect(() => {\n if (hasInitialized.current) {\n setTimeout(() => {\n trigger(name as Path<TFieldValues>);\n }, 200);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields.length]);\n\n // Animation control: Start with animations disabled to prevent animating in initial elements.\n // Will be enabled after initialization completes (unless user prefers reduced motion).\n const [disableAnimation, setDisableAnimation] = useState(true);\n\n // Respond to user's motion preference changes (after initialization).\n // During initialization, animations stay disabled regardless of preference.\n const prefersReducedMotion = useReducedMotion();\n useEffect(() => {\n if (hasInitialized.current) {\n setDisableAnimation(!!prefersReducedMotion);\n }\n }, [prefersReducedMotion]);\n\n // Prepare initial element value based on mode\n // - flat=true: arrays of primitives → object with flatArrayKey and null value by default\n // - flat=false: arrays of objects → empty object by default\n const elementInitialValue = useMemo(() => {\n return flat\n ? { [flatArrayKey]: _elementInitialValue ?? null }\n : (_elementInitialValue ?? {});\n }, [flat, _elementInitialValue]);\n\n // Reset normalization:\n // Run ONLY when an actual form reset is emitted (via useWatchFormReset), not\n // on regular field edits. This does not collapse rows users add manually.\n //\n // Why this exists:\n // RHF can keep stale field-array rows after reset when array defaults are\n // missing (e.g. value becomes undefined or [null, null] while UI still has\n // multiple rows). We normalize this reset-only state to:\n // - one row when lastElementNotRemovable is enabled\n // - zero rows otherwise\n useWatchFormReset({\n onReset: () => {\n const currentValue = getValues(name as Path<TFieldValues>) as unknown;\n const valueIsArray = Array.isArray(currentValue);\n const arrayValue = valueIsArray ? (currentValue as unknown[]) : [];\n const normalizedLength = lastElementNotRemovable ? 1 : 0;\n const alreadyNormalized =\n valueIsArray && arrayValue.length === normalizedLength;\n\n // Treat these as \"effectively empty after reset\":\n // - value missing/not-array\n // - empty array\n // - array where all entries are empty placeholders\n const isEffectivelyEmptyAfterReset =\n !valueIsArray ||\n arrayValue.length === 0 ||\n arrayValue.every((entry) => {\n return isValueEmpty(entry);\n });\n\n // Nothing to fix when the reset restored real values (e.g. from defaults).\n if (!isEffectivelyEmptyAfterReset) {\n return;\n }\n\n // Already normalized to the target row count.\n if (alreadyNormalized) {\n return;\n }\n\n // Avoid collapse animation flicker during reset normalization.\n setDisableAnimation(true);\n\n // use replace so the RHF field-array length actually matches the target.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n replace((lastElementNotRemovable ? [elementInitialValue] : []) as any);\n\n // Restore normal animation state right after normalization.\n if (!prefersReducedMotion) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n },\n });\n\n // Initialization/Re-initialization: add one element only when array length is 0.\n // This is the min-count behavior for lastElementNotRemovable and is intentionally\n // separate from reset normalization above.\n //\n // Reset behavior in this hook is split into two phases:\n // 1) Reset normalization (useWatchFormReset): collapse stale placeholder rows\n // left by reset edge cases.\n // 2) Length-based initialization (this effect): ensure a min-one array when\n // the field array is truly empty.\n // CRITICAL: This effect MUST be the LAST hook in this component.\n // It sets hasInitialized.current = true, which acts as a gate for other effects.\n // If this runs before other effects, hasInitialized will be true during their first run,\n // causing them to execute logic meant only for post-initialization (e.g., validation,\n // animation enabling). By placing this last, all other effects run first with\n // hasInitialized = false, allowing them to skip initialization-phase logic.\n useEffect(\n () => {\n if (needsInitialize) {\n // use setValue instead of append to avoid focusing the added element\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setValue(name as Path<TFieldValues>, [elementInitialValue] as any, {\n shouldDirty: false,\n shouldTouch: false,\n });\n\n // Mark initialization as complete\n hasInitialized.current = true;\n\n // Enable animations after a brief delay (unless user prefers reduced motion or animations are already enabled).\n // This only runs on initial mount when animations start disabled.\n // On reset, disableAnimation is typically false, so this setTimeout won't run and animations stay enabled.\n if (!prefersReducedMotion && disableAnimation) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n }\n },\n // Run when needsInitialize changes (initial mount or reset)\n // needsInitialize is memoized based on fields.length and lastElementNotRemovable\n // Other dependencies are intentionally omitted:\n // - append, setValue, trigger, setDisableAnimation are stable refs/functions\n // - elementInitialValue, name, flat, prefersReducedMotion, disableAnimation are props/stable values\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [needsInitialize],\n );\n\n return {\n // Field array methods and state\n fields,\n append,\n remove,\n insert,\n move,\n disableAnimation,\n elementInitialValue,\n // Uniform field state and utilities (spread all)\n ...uniformField,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformFieldArray';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAa,wBAEX,EACA,MACA,OAAO,OACP,qBAAqB,uBAAuB,MAC5C,0BAA0B,OAC1B,UACA,QAAQ,gBACR,YAC6C;CAE7C,MAAM,eAAe,gBAA8B;EAC3C;EACN;EACA,QAAQ;EACR;CACF,CAAC;CAED,MAAM,EAAE,YAAY;CAEpB,MAAM,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,YAAYA,cAAiB;EACzE;EACA;CACF,CAAC;CAED,MAAM,EAAE,SAAS,UAAU,cAAcC,iBAA6B;CAStE,MAAM,kBAAkB,cAAc;EACpC,OAAO,2BAA2B,OAAO,WAAW;CACtD,GAAG,CAAC,yBAAyB,OAAO,MAAM,CAAC;CAS3C,MAAM,iBAAiB,OAAO,CAAC,eAAe;CAK9C,gBAAgB;EACd,IAAI,iBACF,eAAe,UAAU;CAE7B,GAAG,CAAC,eAAe,CAAC;CAOpB,gBAAgB;EACd,IAAI,eAAe,SACjB,iBAAiB;GACf,QAAQ,IAA0B;EACpC,GAAG,GAAG;CAGV,GAAG,CAAC,OAAO,MAAM,CAAC;CAIlB,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,IAAI;CAI7D,MAAM,uBAAuB,iBAAiB;CAC9C,gBAAgB;EACd,IAAI,eAAe,SACjB,oBAAoB,CAAC,CAAC,oBAAoB;CAE9C,GAAG,CAAC,oBAAoB,CAAC;CAKzB,MAAM,sBAAsB,cAAc;EACxC,OAAO,OACH,GAAG,eAAe,wBAAwB,KAAK,IAC9C,wBAAwB,CAAC;CAChC,GAAG,CAAC,MAAM,oBAAoB,CAAC;CAY/B,kBAAkB,EAChB,eAAe;EACb,MAAM,eAAe,UAAU,IAA0B;EACzD,MAAM,eAAe,MAAM,QAAQ,YAAY;EAC/C,MAAM,aAAa,eAAgB,eAA6B,CAAC;EACjE,MAAM,mBAAmB,0BAA0B,IAAI;EACvD,MAAM,oBACJ,gBAAgB,WAAW,WAAW;EAcxC,IAAI,EAPF,CAAC,gBACD,WAAW,WAAW,KACtB,WAAW,OAAO,UAAU;GAC1B,OAAO,aAAa,KAAK;EAC3B,CAAC,IAID;EAIF,IAAI,mBACF;EAIF,oBAAoB,IAAI;EAIxB,QAAS,0BAA0B,CAAC,mBAAmB,IAAI,CAAC,CAAS;EAGrE,IAAI,CAAC,sBACH,iBAAiB;GACf,oBAAoB,KAAK;EAC3B,GAAG,CAAC;CAER,EACF,CAAC;CAiBD,gBACQ;EACJ,IAAI,iBAAiB;GAGnB,SAAS,MAA4B,CAAC,mBAAmB,GAAU;IACjE,aAAa;IACb,aAAa;GACf,CAAC;GAGD,eAAe,UAAU;GAKzB,IAAI,CAAC,wBAAwB,kBAC3B,iBAAiB;IACf,oBAAoB,KAAK;GAC3B,GAAG,CAAC;EAER;CACF,GAOA,CAAC,eAAe,CAClB;CAEA,OAAO;EAEL;EACA;EACA;EACA;EACA;EACA;EACA;EAEA,GAAG;CACL;AACF"}
1
+ {"version":3,"file":"index.mjs","names":["useRHFFieldArray","useFormContext"],"sources":["../../../src/hooks/useUniformFieldArray/useUniformFieldArray.ts","../../../src/hooks/useUniformFieldArray/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type {\n ArrayPath,\n FieldValues,\n Path,\n UseFieldArrayReturn,\n} from 'react-hook-form';\nimport type { UseUniformFieldReturn } from '../useUniformField';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { useFieldArray as useRHFFieldArray } from 'react-hook-form';\n\nimport { useReducedMotion } from '@fuf-stack/pixel-motion';\n\nimport { flatArrayKey, isValueEmpty } from '../../helpers';\nimport { useFormContext } from '../useFormContext';\nimport { useUniformField } from '../useUniformField';\nimport { useWatchFormReset } from '../useWatchFormReset';\n\nexport interface UseUniformFieldArrayProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Disable the field */\n disabled?: boolean;\n /** Initial value for new array elements */\n elementInitialValue?: unknown;\n /** Whether this is a flat array (array of primitives) */\n flat?: boolean;\n /** Optional label content */\n label?: ReactNode;\n /** Whether the last element cannot be removed (always maintain at least one element) */\n lastElementNotRemovable?: boolean;\n /** Field name for the array */\n name: ArrayPath<TFieldValues>;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n}\n\n/**\n * Return type of `useUniformFieldArray`.\n *\n * Declared explicitly so the published declarations only reference types that\n * react-hook-form exports from its package root.\n */\nexport type UseUniformFieldArrayReturn<\n TFieldValues extends FieldValues = FieldValues,\n> = Pick<\n UseFieldArrayReturn<TFieldValues, ArrayPath<TFieldValues>>,\n 'append' | 'fields' | 'insert' | 'move' | 'remove'\n> &\n UseUniformFieldReturn<TFieldValues> & {\n /** Disables element animations during initialization, reset and reduced motion */\n disableAnimation: boolean;\n /** Value used for newly added array elements */\n elementInitialValue: NonNullable<unknown>;\n };\n\n/**\n * Enhanced useFieldArray hook with initialization and animation logic.\n * Based on React Hook Form's useFieldArray with additional features:\n * - Automatic initialization when lastElementNotRemovable is set\n * - Reset-only normalization for stale empty placeholder rows (via useWatchFormReset)\n * - Animation control (disabled during initialization)\n * - Temporary animation disable during reset normalization collapse\n * - Support for flat arrays (arrays of primitives)\n *\n * Note: Automatic validation triggering on length change is disabled to prevent\n * triggering form-wide validation. Array validation still runs on form submission.\n *\n * @see https://react-hook-form.com/docs/usefieldarray\n */\nexport const useUniformFieldArray = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n name,\n flat = false,\n elementInitialValue: _elementInitialValue = null,\n lastElementNotRemovable = false,\n disabled,\n testId: explicitTestId,\n label,\n}: UseUniformFieldArrayProps<TFieldValues>): UseUniformFieldArrayReturn<TFieldValues> => {\n // Get uniform field state and utilities\n const uniformField = useUniformField<TFieldValues>({\n name: name as Path<TFieldValues> & string,\n disabled,\n testId: explicitTestId,\n label,\n });\n\n const { control } = uniformField;\n\n const { fields, append, remove, insert, move, replace } = useRHFFieldArray({\n control,\n name,\n });\n\n const { trigger, setValue, getValues } = useFormContext<TFieldValues>();\n\n // Determine if initialization is needed (initially or after reset).\n // lastElementNotRemovable is purely a minimum-count guarantee: when there are\n // no rows, add one. This handles both:\n // - Initial mount: fields.length starts at 0\n // - Form reset to an empty array: fields.length becomes 0 again\n // It intentionally does NOT inspect row contents, so manually added empty rows\n // are never collapsed.\n const needsInitialize = useMemo(() => {\n return lastElementNotRemovable && fields.length === 0;\n }, [lastElementNotRemovable, fields.length]);\n\n // Track whether initialization has completed. Initialized contextually:\n // - If initialization IS needed (needsInitialize = true): starts as false, set to true after init\n // - If initialization is NOT needed (needsInitialize = false): starts as true (already initialized)\n // This ref is used to:\n // 1. Skip validation during initialization/re-initialization\n // 2. Gate animation enabling until after initialization\n // 3. Gate motion preference effect until after initialization\n const hasInitialized = useRef(!needsInitialize);\n\n // Reset initialization flag when needsInitialize changes to true.\n // This handles form reset: when fields become empty (needsInitialize becomes true),\n // hasInitialized is reset to false, triggering re-initialization in the effect below.\n useEffect(() => {\n if (needsInitialize) {\n hasInitialized.current = false;\n }\n }, [needsInitialize]);\n\n // Validate array-level constraints (min/max items) when length changes.\n // This ensures min/max errors appear instantly when user adds/removes items.\n // Note: Child field validation also runs, but new empty fields won't show as invalid\n // because useFormContext only sets invalid=true for touched fields or after form submission.\n // Skip validation during initialization/re-initialization to avoid showing errors prematurely.\n useEffect(() => {\n if (hasInitialized.current) {\n setTimeout(() => {\n trigger(name as Path<TFieldValues>);\n }, 200);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields.length]);\n\n // Animation control: Start with animations disabled to prevent animating in initial elements.\n // Will be enabled after initialization completes (unless user prefers reduced motion).\n const [disableAnimation, setDisableAnimation] = useState(true);\n\n // Respond to user's motion preference changes (after initialization).\n // During initialization, animations stay disabled regardless of preference.\n const prefersReducedMotion = useReducedMotion();\n useEffect(() => {\n if (hasInitialized.current) {\n setDisableAnimation(!!prefersReducedMotion);\n }\n }, [prefersReducedMotion]);\n\n // Prepare initial element value based on mode\n // - flat=true: arrays of primitives → object with flatArrayKey and null value by default\n // - flat=false: arrays of objects → empty object by default\n const elementInitialValue = useMemo(() => {\n return flat\n ? { [flatArrayKey]: _elementInitialValue ?? null }\n : (_elementInitialValue ?? {});\n }, [flat, _elementInitialValue]);\n\n // Reset normalization:\n // Run ONLY when an actual form reset is emitted (via useWatchFormReset), not\n // on regular field edits. This does not collapse rows users add manually.\n //\n // Why this exists:\n // RHF can keep stale field-array rows after reset when array defaults are\n // missing (e.g. value becomes undefined or [null, null] while UI still has\n // multiple rows). We normalize this reset-only state to:\n // - one row when lastElementNotRemovable is enabled\n // - zero rows otherwise\n useWatchFormReset({\n onReset: () => {\n const currentValue = getValues(name as Path<TFieldValues>) as unknown;\n const valueIsArray = Array.isArray(currentValue);\n const arrayValue = valueIsArray ? (currentValue as unknown[]) : [];\n const normalizedLength = lastElementNotRemovable ? 1 : 0;\n const alreadyNormalized =\n valueIsArray && arrayValue.length === normalizedLength;\n\n // Treat these as \"effectively empty after reset\":\n // - value missing/not-array\n // - empty array\n // - array where all entries are empty placeholders\n const isEffectivelyEmptyAfterReset =\n !valueIsArray ||\n arrayValue.length === 0 ||\n arrayValue.every((entry) => {\n return isValueEmpty(entry);\n });\n\n // Nothing to fix when the reset restored real values (e.g. from defaults).\n if (!isEffectivelyEmptyAfterReset) {\n return;\n }\n\n // Already normalized to the target row count.\n if (alreadyNormalized) {\n return;\n }\n\n // Avoid collapse animation flicker during reset normalization.\n setDisableAnimation(true);\n\n // use replace so the RHF field-array length actually matches the target.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n replace((lastElementNotRemovable ? [elementInitialValue] : []) as any);\n\n // Restore normal animation state right after normalization.\n if (!prefersReducedMotion) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n },\n });\n\n // Initialization/Re-initialization: add one element only when array length is 0.\n // This is the min-count behavior for lastElementNotRemovable and is intentionally\n // separate from reset normalization above.\n //\n // Reset behavior in this hook is split into two phases:\n // 1) Reset normalization (useWatchFormReset): collapse stale placeholder rows\n // left by reset edge cases.\n // 2) Length-based initialization (this effect): ensure a min-one array when\n // the field array is truly empty.\n // CRITICAL: This effect MUST be the LAST hook in this component.\n // It sets hasInitialized.current = true, which acts as a gate for other effects.\n // If this runs before other effects, hasInitialized will be true during their first run,\n // causing them to execute logic meant only for post-initialization (e.g., validation,\n // animation enabling). By placing this last, all other effects run first with\n // hasInitialized = false, allowing them to skip initialization-phase logic.\n useEffect(\n () => {\n if (needsInitialize) {\n // use setValue instead of append to avoid focusing the added element\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setValue(name as Path<TFieldValues>, [elementInitialValue] as any, {\n shouldDirty: false,\n shouldTouch: false,\n });\n\n // Mark initialization as complete\n hasInitialized.current = true;\n\n // Enable animations after a brief delay (unless user prefers reduced motion or animations are already enabled).\n // This only runs on initial mount when animations start disabled.\n // On reset, disableAnimation is typically false, so this setTimeout won't run and animations stay enabled.\n if (!prefersReducedMotion && disableAnimation) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n }\n },\n // Run when needsInitialize changes (initial mount or reset)\n // needsInitialize is memoized based on fields.length and lastElementNotRemovable\n // Other dependencies are intentionally omitted:\n // - append, setValue, trigger, setDisableAnimation are stable refs/functions\n // - elementInitialValue, name, flat, prefersReducedMotion, disableAnimation are props/stable values\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [needsInitialize],\n );\n\n return {\n // Field array methods and state\n fields,\n append,\n remove,\n insert,\n move,\n disableAnimation,\n elementInitialValue,\n // Uniform field state and utilities (spread all)\n ...uniformField,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformFieldArray';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuEA,MAAa,wBAEX,EACA,MACA,OAAO,OACP,qBAAqB,uBAAuB,MAC5C,0BAA0B,OAC1B,UACA,QAAQ,gBACR,YACuF;CAEvF,MAAM,eAAe,gBAA8B;EAC3C;EACN;EACA,QAAQ;EACR;CACF,CAAC;CAED,MAAM,EAAE,YAAY;CAEpB,MAAM,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,YAAYA,cAAiB;EACzE;EACA;CACF,CAAC;CAED,MAAM,EAAE,SAAS,UAAU,cAAcC,iBAA6B;CAStE,MAAM,kBAAkB,cAAc;EACpC,OAAO,2BAA2B,OAAO,WAAW;CACtD,GAAG,CAAC,yBAAyB,OAAO,MAAM,CAAC;CAS3C,MAAM,iBAAiB,OAAO,CAAC,eAAe;CAK9C,gBAAgB;EACd,IAAI,iBACF,eAAe,UAAU;CAE7B,GAAG,CAAC,eAAe,CAAC;CAOpB,gBAAgB;EACd,IAAI,eAAe,SACjB,iBAAiB;GACf,QAAQ,IAA0B;EACpC,GAAG,GAAG;CAGV,GAAG,CAAC,OAAO,MAAM,CAAC;CAIlB,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,IAAI;CAI7D,MAAM,uBAAuB,iBAAiB;CAC9C,gBAAgB;EACd,IAAI,eAAe,SACjB,oBAAoB,CAAC,CAAC,oBAAoB;CAE9C,GAAG,CAAC,oBAAoB,CAAC;CAKzB,MAAM,sBAAsB,cAAc;EACxC,OAAO,OACH,GAAG,eAAe,wBAAwB,KAAK,IAC9C,wBAAwB,CAAC;CAChC,GAAG,CAAC,MAAM,oBAAoB,CAAC;CAY/B,kBAAkB,EAChB,eAAe;EACb,MAAM,eAAe,UAAU,IAA0B;EACzD,MAAM,eAAe,MAAM,QAAQ,YAAY;EAC/C,MAAM,aAAa,eAAgB,eAA6B,CAAC;EACjE,MAAM,mBAAmB,0BAA0B,IAAI;EACvD,MAAM,oBACJ,gBAAgB,WAAW,WAAW;EAcxC,IAAI,EAPF,CAAC,gBACD,WAAW,WAAW,KACtB,WAAW,OAAO,UAAU;GAC1B,OAAO,aAAa,KAAK;EAC3B,CAAC,IAID;EAIF,IAAI,mBACF;EAIF,oBAAoB,IAAI;EAIxB,QAAS,0BAA0B,CAAC,mBAAmB,IAAI,CAAC,CAAS;EAGrE,IAAI,CAAC,sBACH,iBAAiB;GACf,oBAAoB,KAAK;EAC3B,GAAG,CAAC;CAER,EACF,CAAC;CAiBD,gBACQ;EACJ,IAAI,iBAAiB;GAGnB,SAAS,MAA4B,CAAC,mBAAmB,GAAU;IACjE,aAAa;IACb,aAAa;GACf,CAAC;GAGD,eAAe,UAAU;GAKzB,IAAI,CAAC,wBAAwB,kBAC3B,iBAAiB;IACf,oBAAoB,KAAK;GAC3B,GAAG,CAAC;EAER;CACF,GAOA,CAAC,eAAe,CAClB;CAEA,OAAO;EAEL;EACA;EACA;EACA;EACA;EACA;EACA;EAEA,GAAG;CACL;AACF"}
@@ -1,4 +1,3 @@
1
- //#region src/hooks/useWatchFormReset/useWatchFormReset.d.ts
2
1
  export interface UseWatchFormResetOptions {
3
2
  /**
4
3
  * Callback that runs whenever a programmatic form reset is observed.
@@ -31,5 +30,4 @@ export interface UseWatchFormResetOptions {
31
30
  * during normal editing.
32
31
  */
33
32
  export declare const useWatchFormReset: ({ onReset }: UseWatchFormResetOptions) => void;
34
- //#endregion
35
33
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/hooks/useWatchFormReset/useWatchFormReset.ts"],"mappings":";iBAIiB;;;;;;;;;;;EAWf;;;;;;;;;;;;;;;;;;;;qBAqBW,sBAAqB,WAAa"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/hooks/useWatchFormReset/useWatchFormReset.ts"],"mappings":"A,iBAIiB;;;;;;;;;;;EAWf;;;;;;;;;;;;;;;;;;;;qBAqBW,sBAAqB,WAAa"}
@@ -1,6 +1,6 @@
1
- import { n as useFormContext } from "../../useFormContext-DNb_B8LQ.mjs";
1
+ import { n as useFormContext } from "../../useFormContext-BEjPBdzb.mjs";
2
2
  import { useEffect } from "react";
3
- //#region src/hooks/useWatchFormReset/useWatchFormReset.ts
3
+ // src/hooks/useWatchFormReset/useWatchFormReset.ts
4
4
  /**
5
5
  * Hook that watches for programmatic form reset events.
6
6
  *
@@ -28,10 +28,8 @@ const useWatchFormReset = ({ onReset }) => {
28
28
  return formReset.subscribe(listener);
29
29
  }, [formReset, onReset]);
30
30
  };
31
- //#endregion
32
- //#region src/hooks/useWatchFormReset/index.ts
31
+ // src/hooks/useWatchFormReset/index.ts
33
32
  /* v8 ignore stop */
34
- //#endregion
35
33
  export { useWatchFormReset };
36
34
 
37
35
  //# sourceMappingURL=index.mjs.map
@@ -1,8 +1,5 @@
1
1
  import { FieldValues, Path, UseFormReset, UseFormResetField, UseFormSetValue } from "react-hook-form";
2
- //#region src/hooks/useWatchUserChange/useWatchUserChange.d.ts
3
2
  export interface UseWatchUserChangeOptions<TFieldValues extends FieldValues> {
4
- /** Field name to watch for user changes */
5
- watch: Path<TFieldValues>;
6
3
  /**
7
4
  * Callback when watched field is changed by user input.
8
5
  * Receives the new value and form helpers (setValue, resetField, reset).
@@ -12,6 +9,8 @@ export interface UseWatchUserChangeOptions<TFieldValues extends FieldValues> {
12
9
  resetField: UseFormResetField<TFieldValues>;
13
10
  reset: UseFormReset<TFieldValues>;
14
11
  }) => void;
12
+ /** Field name to watch for user changes */
13
+ watch: Path<TFieldValues>;
15
14
  }
16
15
  /**
17
16
  * Hook that watches for user changes on a specific form field.
@@ -71,5 +70,4 @@ export interface UseWatchUserChangeOptions<TFieldValues extends FieldValues> {
71
70
  * ```
72
71
  */
73
72
  export declare const useWatchUserChange: <TFieldValues extends FieldValues = FieldValues>({ watch: watchField, onChange }: UseWatchUserChangeOptions<TFieldValues>) => void;
74
- //#endregion
75
73
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"mappings":";;iBAYiB,0BAA0B,qBAAqB;;EAE9D,OAAO,KAAK;;;;;EAKZ,WACE,gBACA;IACE,UAAU,gBAAgB;IAC1B,YAAY,kBAAkB;IAC9B,OAAO,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA8Db,qBACX,qBAAqB,cAAc,eACnC,OAAA,YAAA,YAGC,0BAA0B"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/hooks/useWatchUserChange/useWatchUserChange.ts"],"mappings":";iBAYiB,0BAA0B,qBAAqB;;;;;EAK9D,WACE,gBACA;IACE,UAAU,gBAAgB;IAC1B,YAAY,kBAAkB;IAC9B,OAAO,aAAa;;;EAIxB,OAAO,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA4DD,qBACX,qBAAqB,cAAc,eACnC,OAAA,YAAA,YAGC,0BAA0B"}
@@ -1,6 +1,6 @@
1
- import { n as useFormContext } from "../../useFormContext-DNb_B8LQ.mjs";
1
+ import { n as useFormContext } from "../../useFormContext-BEjPBdzb.mjs";
2
2
  import { useEffect, useRef } from "react";
3
- //#region src/hooks/useWatchUserChange/useWatchUserChange.ts
3
+ // src/hooks/useWatchUserChange/useWatchUserChange.ts
4
4
  /**
5
5
  * Hook that watches for user changes on a specific form field.
6
6
  *
@@ -90,10 +90,8 @@ const useWatchUserChange = ({ watch: watchField, onChange }) => {
90
90
  return subscribe(listener);
91
91
  }, [subscribe, watchField]);
92
92
  };
93
- //#endregion
94
- //#region src/hooks/useWatchUserChange/index.ts
93
+ // src/hooks/useWatchUserChange/index.ts
95
94
  /* v8 ignore stop */
96
- //#endregion
97
95
  export { useWatchUserChange };
98
96
 
99
97
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/hooks/useWatchUserChange/useWatchUserChange.ts","../../../src/hooks/useWatchUserChange/index.ts"],"sourcesContent":["import type {\n FieldValues,\n Path,\n UseFormReset,\n UseFormResetField,\n UseFormSetValue,\n} from 'react-hook-form';\n\nimport { useEffect, useRef } from 'react';\n\nimport { useFormContext } from '../useFormContext/useFormContext';\n\nexport interface UseWatchUserChangeOptions<TFieldValues extends FieldValues> {\n /** Field name to watch for user changes */\n watch: Path<TFieldValues>;\n /**\n * Callback when watched field is changed by user input.\n * Receives the new value and form helpers (setValue, resetField, reset).\n */\n onChange: (\n value: unknown,\n helpers: {\n setValue: UseFormSetValue<TFieldValues>;\n resetField: UseFormResetField<TFieldValues>;\n reset: UseFormReset<TFieldValues>;\n },\n ) => void;\n}\n\n/**\n * Hook that watches for user changes on a specific form field.\n *\n * Only triggers on manual user input (typing, clicking, selecting),\n * NOT on programmatic changes like form.reset() or form.setValue().\n * Also does NOT trigger when selecting the same value (e.g., clicking\n * an already-selected option in a Select).\n *\n * This hook subscribes to field changes at the source (useController),\n * ensuring immediate and accurate detection of user interactions.\n *\n * Use cases:\n * - Reset dependent fields when parent field changes\n * - Set mode-specific default values when a toggle changes\n * - Clear form sections based on user selections\n * - Trigger side effects only on user interaction\n *\n * Note: To watch multiple fields, call this hook multiple times.\n *\n * @example\n * ```tsx\n * // Reset city and address when user changes country\n * useWatchUserChange({\n * watch: 'country',\n * onChange: (value, { resetField }) => {\n * resetField('city');\n * resetField('address');\n * },\n * });\n *\n * // Set defaults when user changes payment method\n * useWatchUserChange({\n * watch: 'paymentMethod',\n * onChange: (value, { setValue }) => {\n * if (value === 'credit') {\n * setValue('installments', 3);\n * } else {\n * setValue('installments', 1);\n * }\n * },\n * });\n *\n * // Watch multiple fields by calling the hook multiple times\n * useWatchUserChange({\n * watch: 'category',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * useWatchUserChange({\n * watch: 'brand',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * ```\n */\nexport const useWatchUserChange = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n watch: watchField,\n onChange,\n}: UseWatchUserChangeOptions<TFieldValues>) => {\n const { setValue, resetField, reset, userChange } =\n useFormContext<TFieldValues>();\n\n // Callers commonly pass an inline callback, and useFormContext may return new\n // helper wrappers after a form render. Keep their latest values in a ref so\n // those identity changes do not tear down and recreate the subscription.\n const callbackRef = useRef({ onChange, reset, resetField, setValue });\n\n useEffect(() => {\n callbackRef.current = { onChange, reset, resetField, setValue };\n }, [onChange, reset, resetField, setValue]);\n\n // The subscribe function is stable even when the surrounding userChange\n // object is reconstructed. Depending on it directly keeps one active listener.\n const { subscribe } = userChange;\n\n useEffect(() => {\n // Create listener that checks if changed field is the one we're watching\n const listener = (fieldName: Path<TFieldValues>, value: unknown) => {\n // Check if this is the field we're watching\n if (fieldName === watchField) {\n // Read at notification time so the stable listener never closes over a\n // stale callback or stale form helpers.\n const { onChange: callback, ...helpers } = callbackRef.current;\n callback(value, helpers);\n }\n };\n\n // Subscribe to user changes\n const unsubscribe = subscribe(listener);\n\n // Cleanup on unmount\n return unsubscribe;\n }, [subscribe, watchField]);\n};\n","/* v8 ignore start */\n\nexport * from './useWatchUserChange';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,MAAa,sBAEX,EACA,OAAO,YACP,eAC6C;CAC7C,MAAM,EAAE,UAAU,YAAY,OAAO,eACnC,eAA6B;CAK/B,MAAM,cAAc,OAAO;EAAE;EAAU;EAAO;EAAY;CAAS,CAAC;CAEpE,gBAAgB;EACd,YAAY,UAAU;GAAE;GAAU;GAAO;GAAY;EAAS;CAChE,GAAG;EAAC;EAAU;EAAO;EAAY;CAAQ,CAAC;CAI1C,MAAM,EAAE,cAAc;CAEtB,gBAAgB;EAEd,MAAM,YAAY,WAA+B,UAAmB;GAElE,IAAI,cAAc,YAAY;IAG5B,MAAM,EAAE,UAAU,UAAU,GAAG,YAAY,YAAY;IACvD,SAAS,OAAO,OAAO;GACzB;EACF;EAMA,OAHoB,UAAU,QAGb;CACnB,GAAG,CAAC,WAAW,UAAU,CAAC;AAC5B"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/hooks/useWatchUserChange/useWatchUserChange.ts","../../../src/hooks/useWatchUserChange/index.ts"],"sourcesContent":["import type {\n FieldValues,\n Path,\n UseFormReset,\n UseFormResetField,\n UseFormSetValue,\n} from 'react-hook-form';\n\nimport { useEffect, useRef } from 'react';\n\nimport { useFormContext } from '../useFormContext/useFormContext';\n\nexport interface UseWatchUserChangeOptions<TFieldValues extends FieldValues> {\n /**\n * Callback when watched field is changed by user input.\n * Receives the new value and form helpers (setValue, resetField, reset).\n */\n onChange: (\n value: unknown,\n helpers: {\n setValue: UseFormSetValue<TFieldValues>;\n resetField: UseFormResetField<TFieldValues>;\n reset: UseFormReset<TFieldValues>;\n },\n ) => void;\n /** Field name to watch for user changes */\n watch: Path<TFieldValues>;\n}\n\n/**\n * Hook that watches for user changes on a specific form field.\n *\n * Only triggers on manual user input (typing, clicking, selecting),\n * NOT on programmatic changes like form.reset() or form.setValue().\n * Also does NOT trigger when selecting the same value (e.g., clicking\n * an already-selected option in a Select).\n *\n * This hook subscribes to field changes at the source (useController),\n * ensuring immediate and accurate detection of user interactions.\n *\n * Use cases:\n * - Reset dependent fields when parent field changes\n * - Set mode-specific default values when a toggle changes\n * - Clear form sections based on user selections\n * - Trigger side effects only on user interaction\n *\n * Note: To watch multiple fields, call this hook multiple times.\n *\n * @example\n * ```tsx\n * // Reset city and address when user changes country\n * useWatchUserChange({\n * watch: 'country',\n * onChange: (value, { resetField }) => {\n * resetField('city');\n * resetField('address');\n * },\n * });\n *\n * // Set defaults when user changes payment method\n * useWatchUserChange({\n * watch: 'paymentMethod',\n * onChange: (value, { setValue }) => {\n * if (value === 'credit') {\n * setValue('installments', 3);\n * } else {\n * setValue('installments', 1);\n * }\n * },\n * });\n *\n * // Watch multiple fields by calling the hook multiple times\n * useWatchUserChange({\n * watch: 'category',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * useWatchUserChange({\n * watch: 'brand',\n * onChange: (value, { resetField }) => {\n * resetField('productId');\n * },\n * });\n * ```\n */\nexport const useWatchUserChange = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n watch: watchField,\n onChange,\n}: UseWatchUserChangeOptions<TFieldValues>) => {\n const { setValue, resetField, reset, userChange } =\n useFormContext<TFieldValues>();\n\n // Callers commonly pass an inline callback, and useFormContext may return new\n // helper wrappers after a form render. Keep their latest values in a ref so\n // those identity changes do not tear down and recreate the subscription.\n const callbackRef = useRef({ onChange, reset, resetField, setValue });\n\n useEffect(() => {\n callbackRef.current = { onChange, reset, resetField, setValue };\n }, [onChange, reset, resetField, setValue]);\n\n // The subscribe function is stable even when the surrounding userChange\n // object is reconstructed. Depending on it directly keeps one active listener.\n const { subscribe } = userChange;\n\n useEffect(() => {\n // Create listener that checks if changed field is the one we're watching\n const listener = (fieldName: Path<TFieldValues>, value: unknown) => {\n // Check if this is the field we're watching\n if (fieldName === watchField) {\n // Read at notification time so the stable listener never closes over a\n // stale callback or stale form helpers.\n const { onChange: callback, ...helpers } = callbackRef.current;\n callback(value, helpers);\n }\n };\n\n // Subscribe to user changes\n const unsubscribe = subscribe(listener);\n\n // Cleanup on unmount\n return unsubscribe;\n }, [subscribe, watchField]);\n};\n","/* v8 ignore start */\n\nexport * from './useWatchUserChange';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,MAAa,sBAEX,EACA,OAAO,YACP,eAC6C;CAC7C,MAAM,EAAE,UAAU,YAAY,OAAO,eACnC,eAA6B;CAK/B,MAAM,cAAc,OAAO;EAAE;EAAU;EAAO;EAAY;CAAS,CAAC;CAEpE,gBAAgB;EACd,YAAY,UAAU;GAAE;GAAU;GAAO;GAAY;EAAS;CAChE,GAAG;EAAC;EAAU;EAAO;EAAY;CAAQ,CAAC;CAI1C,MAAM,EAAE,cAAc;CAEtB,gBAAgB;EAEd,MAAM,YAAY,WAA+B,UAAmB;GAElE,IAAI,cAAc,YAAY;IAG5B,MAAM,EAAE,UAAU,UAAU,GAAG,YAAY,YAAY;IACvD,SAAS,OAAO,OAAO;GACzB;EACF;EAMA,OAHoB,UAAU,QAGb;CACnB,GAAG,CAAC,WAAW,UAAU,CAAC;AAC5B"}
@@ -0,0 +1,99 @@
1
+ import { t as InputValueTransform } from "./useInputValueTransform-cevZBrIN.mjs";
2
+ import { r as useController$1 } from "./useController-CdFEp-Wa.mjs";
3
+ import { i as useFormContext$1 } from "./useFormContext-BhPzFXwF.mjs";
4
+ import { t as useInput } from "./useInput-ClpHDPdr.mjs";
5
+ import { ReactNode } from "react";
6
+ import { FieldError, FieldValues, Path } from "react-hook-form";
7
+ interface UseUniformFieldParams<TFieldValues extends FieldValues = FieldValues, TDisplay = unknown> {
8
+ /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */
9
+ ariaLabel?: string;
10
+ /** Disables the field and omits its value from validation data and submission */
11
+ disabled?: boolean;
12
+ /** Normalize nested RHF errors into a flat array for array-like fields */
13
+ isArrayValue?: boolean;
14
+ /** Optional label content */
15
+ label?: ReactNode;
16
+ /** Form field name */
17
+ name: Path<TFieldValues> & string;
18
+ /** Redacts the field value from Uniform debug output */
19
+ sensitive?: boolean;
20
+ /** Optional explicit test id used to build stable test ids */
21
+ testId?: string;
22
+ /** Optional value transformation between form and display values */
23
+ transform?: InputValueTransform<TDisplay>;
24
+ /** Input type for special number handling */
25
+ type?: 'text' | 'number' | 'password';
26
+ }
27
+ interface UseUniformFieldReturn<TFieldValues extends FieldValues = FieldValues> {
28
+ /** Computed aria-label fallback (field name) when no visible label exists. Components can override based on their accessibility needs (e.g., if placeholder provides sufficient context) */
29
+ ariaLabel: string | undefined;
30
+ /** react-hook-form control instance for advanced integrations */
31
+ control: ReturnType<typeof useFormContext$1<TFieldValues>>['control'];
32
+ /** Debug mode from Uniform provider */
33
+ debugMode: ReturnType<typeof useFormContext$1<TFieldValues>>['debugMode'];
34
+ /** Current value used to initialize uncontrolled components */
35
+ defaultValue: unknown;
36
+ /** Whether the field is currently disabled (from RHF) */
37
+ disabled: boolean | undefined;
38
+ /** Validation errors from form state; flattened only when `isArrayValue` is enabled */
39
+ error: FieldError[] | undefined;
40
+ /** Pre-built errorMessage node to plug into components */
41
+ errorMessage: ReactNode | null;
42
+ /** RHF controller field with transformed value/onChange (use this for simple components) */
43
+ field: ReturnType<typeof useController$1<TFieldValues>>['field'];
44
+ /** Helper to spread standardized error message props to underlying components */
45
+ getErrorMessageProps: ReturnType<typeof useInput>['getErrorMessageProps'];
46
+ /** Helper to spread standardized helper wrapper props (for spacing/animation) */
47
+ getHelperWrapperProps: ReturnType<typeof useInput>['getHelperWrapperProps'];
48
+ /** Helper to spread standardized label props to underlying components */
49
+ getLabelProps: ReturnType<typeof useInput>['getLabelProps'];
50
+ /** Access current form values (converted to validation-friendly format) */
51
+ getValues: ReturnType<typeof useFormContext$1<TFieldValues>>['getValues'];
52
+ /** Whether the field should show invalid state (debounced for smooth animations). True when field is invalid AND (dirty OR touched OR submitted) */
53
+ invalid: boolean;
54
+ /** Computed label node including optional test id copy button */
55
+ label: ReactNode | null;
56
+ /** onBlur handler from controller */
57
+ onBlur: ReturnType<typeof useController$1<TFieldValues>>['field']['onBlur'];
58
+ /** onChange handler from controller (with transform applied) */
59
+ onChange: ReturnType<typeof useController$1<TFieldValues>>['field']['onChange'];
60
+ /** Ref to forward to underlying control */
61
+ ref: ReturnType<typeof useController$1<TFieldValues>>['field']['ref'];
62
+ /** Whether the field is required according to validation schema */
63
+ required: boolean;
64
+ /** Reset a specific field in the form */
65
+ resetField: ReturnType<typeof useFormContext$1<TFieldValues>>['resetField'];
66
+ /** Generated HTML data-testid for the field */
67
+ testId: string;
68
+ }
69
+ /**
70
+ * Combines frequently used form field logic into a single hook.
71
+ *
72
+ * Provides:
73
+ * - Enhanced form context (validation-aware state, `testId`, value transforms)
74
+ * - Controller field with nullish conversion handling
75
+ * - Value transformation via `transform` prop:
76
+ * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)
77
+ * • Automatically applies `toDisplayValue` to field value for components
78
+ * • Automatically applies `toFormValue` to display value when onChange is called
79
+ * • Works with `type` prop for automatic number/string conversion
80
+ * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata
81
+ * - Debounced `invalid` state with smart timing:
82
+ * • `true` (field becomes invalid): applies immediately so errors show right away
83
+ * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations
84
+ * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion
85
+ * - Smart `invalid` visibility (via `showInvalid`):
86
+ * • Shows errors when field is dirty OR touched OR form has been submitted
87
+ * • Prevents showing errors on pristine/untouched fields for better UX
88
+ * • Works well for all field types (text inputs, checkboxes, radios, arrays)
89
+ * - Prebuilt `errorMessage` React node (with optional array-error normalization via `isArrayValue`)
90
+ * - Computed `label` node which appends a `FieldCopyTestIdButton` in
91
+ * `debug-testids` mode
92
+ * - `defaultValue` for uncontrolled defaults and all usual field handlers
93
+ * - Access to form utilities: `control`, `getValues`, `resetField`
94
+ * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,
95
+ * `getHelperWrapperProps` for consistent wiring to underlying UI components
96
+ */
97
+ declare const useUniformField: <TFieldValues extends FieldValues = FieldValues, TDisplay = unknown>(params: UseUniformFieldParams<TFieldValues, TDisplay>) => UseUniformFieldReturn<TFieldValues>;
98
+ export { UseUniformFieldReturn as n, useUniformField as r, UseUniformFieldParams as t };
99
+ //# sourceMappingURL=index-DaiTW5Bl.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DaiTW5Bl.d.mts","names":["useFormContext","useController"],"sources":["../src/hooks/useUniformField/useUniformField.tsx"],"mappings":";;;;;;UAiBiB,sBACf,qBAAqB,cAAc,aACnC;;EAGA;;EAEA;;EAEA;;EAEA,QAAQ;;EAER,MAAM,KAAK;;EAEX;;EAEA;;EAEA,YAAY,oBAAoB;;EAEhC;;UAGe,sBACf,qBAAqB,cAAc;;EAGnC;;EAEA,SAAS,kBAAkBA,iBAAe;;EAE1C,WAAW,kBAAkBA,iBAAe;;EAE5C;;EAEA;;EAEA,OAAO;;EAEP,cAAc;;EAEd,OAAO,kBAAkBC,gBAAc;;EAEvC,sBAAsB,kBAAkB;;EAExC,uBAAuB,kBAAkB;;EAEzC,eAAe,kBAAkB;;EAEjC,WAAW,kBAAkBD,iBAAe;;EAE5C;;EAEA,OAAO;;EAEP,QAAQ,kBAAkBC,gBAAc;;EAExC,UAAU,kBAAkBA,gBAAc;;EAE1C,KAAK,kBAAkBA,gBAAc;;EAErC;;EAEA,YAAY,kBAAkBD,iBAAe;;EAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BW,kBACX,qBAAqB,cAAc,aACnC,oBAEA,QAAQ,sBAAsB,cAAc,cAC3C,sBAAsB"}
@@ -1,4 +1,3 @@
1
- //#region src/partials/FieldCopyTestIdButton/FieldCopyTestIdButton.d.ts
2
1
  interface FieldCopyTestIdButtonProps {
3
2
  /** CSS class name */
4
3
  className?: string;
@@ -6,6 +5,5 @@ interface FieldCopyTestIdButtonProps {
6
5
  testId: string;
7
6
  }
8
7
  declare const FieldCopyTestIdButton: ({ className, testId }: FieldCopyTestIdButtonProps) => import("react").JSX.Element;
9
- //#endregion
10
8
  export { type FieldCopyTestIdButtonProps, FieldCopyTestIdButton as default };
11
9
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/partials/FieldCopyTestIdButton/FieldCopyTestIdButton.tsx"],"mappings":";UAKiB;;EAEf;;EAEA;;cAGI,0BAAyB,WAAA,UAG5B,+CAA0B,IAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/partials/FieldCopyTestIdButton/FieldCopyTestIdButton.tsx"],"mappings":"A,UAKiB;;EAEf;;EAEA;;cAGI,0BAAyB,WAAA,UAG5B,+CAA0B,IAAA"}
@@ -1,2 +1 @@
1
- import { t as FieldCopyTestIdButton_default } from "../../FieldCopyTestIdButton-9xTF-DBW.mjs";
2
- export { FieldCopyTestIdButton_default as default };
1
+ export { t as default } from "../../FieldCopyTestIdButton-Y9SfvaM9.mjs";
@@ -1,5 +1,4 @@
1
1
  import { FieldError } from "react-hook-form";
2
- //#region src/partials/FieldValidationError/FieldValidationError.d.ts
3
2
  interface FieldValidationErrorProps {
4
3
  /** CSS class name */
5
4
  className?: string;
@@ -12,6 +11,5 @@ interface FieldValidationErrorProps {
12
11
  * Renders a validation error of a field
13
12
  */
14
13
  declare const FieldValidationError: ({ className, error, testId }: FieldValidationErrorProps) => import("react").JSX.Element;
15
- //#endregion
16
14
  export { type FieldValidationErrorProps, FieldValidationError as default };
17
15
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/partials/FieldValidationError/FieldValidationError.tsx"],"mappings":";;UASiB;;EAEf;;EAEA,QAAQ;;EAER;;;;;cAMI,yBAAwB,WAAA,OAAA,UAI3B,8CAAyB,IAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/partials/FieldValidationError/FieldValidationError.tsx"],"mappings":";UASiB;;EAEf;;EAEA,QAAQ;;EAER;;;;;cAMI,yBAAwB,WAAA,OAAA,UAI3B,8CAAyB,IAAA"}
@@ -1,2 +1 @@
1
- import { t as FieldValidationError_default } from "../../FieldValidationError-ByRoIxaM.mjs";
2
- export { FieldValidationError_default as default };
1
+ export { t as default } from "../../FieldValidationError-BcUV0r1I.mjs";
@@ -1,8 +1,8 @@
1
- import { n as UniformContext } from "./FormContext-CB7Glm02.mjs";
1
+ import { n as UniformContext } from "./FormContext-B8G_Xxd6.mjs";
2
2
  import { fromNullishString, toNullishString } from "./helpers/index.mjs";
3
3
  import { useContext } from "react";
4
4
  import { useController } from "react-hook-form";
5
- //#region src/hooks/useController/useController.ts
5
+ // src/hooks/useController/useController.ts
6
6
  /**
7
7
  * A wrapper around react-hook-form's useController that transparently handles nullish string conversions.
8
8
  *
@@ -39,7 +39,6 @@ const useController$1 = (props) => {
39
39
  fieldState
40
40
  };
41
41
  };
42
- //#endregion
43
42
  export { useController$1 as t };
44
43
 
45
- //# sourceMappingURL=useController-BBSbeKbn.mjs.map
44
+ //# sourceMappingURL=useController-CJjMqXU5.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useController-BBSbeKbn.mjs","names":["useController","useRHFController"],"sources":["../src/hooks/useController/useController.ts"],"sourcesContent":["import type {\n ControllerFieldState,\n ControllerRenderProps,\n UseControllerProps as RHFUseControllerProps,\n UseFormStateReturn,\n} from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useController as useRHFController } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { fromNullishString, toNullishString } from '../../helpers';\n\nexport type UseControllerProps<TFieldValues extends object = object> =\n RHFUseControllerProps<TFieldValues>;\n\nexport interface UseControllerReturn<TFieldValues extends object = object> {\n field: Omit<ControllerRenderProps<TFieldValues>, 'onChange' | 'value'> & {\n // Using any[] to support both direct value changes and React synthetic events\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => void;\n value: string;\n };\n formState: UseFormStateReturn<TFieldValues>;\n fieldState: ControllerFieldState;\n}\n\n/**\n * A wrapper around react-hook-form's useController that transparently handles nullish string conversions.\n *\n * Key features:\n * 1. Empty strings ('') in the UI are stored as null in form state\n * 2. Null/undefined values in form state are displayed as empty strings in the UI\n * 3. Handles both direct value changes and React synthetic events\n * 4. Maintains the same API as react-hook-form's useController\n * 5. Notifies UniformContext's userChange listeners on field changes (enables useWatchUserChange hook)\n * 6. No-op when value unchanged: onChange is ignored if the new value equals the current value\n * (prevents unnecessary re-renders and spurious useWatchUserChange triggers)\n *\n * This enables consistent handling of empty/null values while keeping a clean API\n * for form inputs that expect string values.\n *\n * @see https://react-hook-form.com/docs/usecontroller\n */\nexport const useController = <TFieldValues extends object = object>(\n props: UseControllerProps<TFieldValues>,\n): UseControllerReturn<TFieldValues> => {\n const { field, formState, fieldState } = useRHFController(props);\n const { userChange } = useContext(UniformContext);\n\n return {\n field: {\n ...field,\n // Handles both direct values (onChange(\"value\")) and events (onChange(event))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => {\n const value = event[0]?.target?.value ?? event[0];\n const formattedValue = value === '' ? '' : toNullishString(value);\n\n // Skip if value hasn't changed (e.g., user re-selects same option)\n // We compare formattedValue (the new value after nullish conversion) with\n // field.value (the current stored value, also in nullish format)\n if (formattedValue === field.value) {\n return;\n }\n\n // Update form state first\n field.onChange(formattedValue);\n\n // Then notify userChange listeners (for useWatchUserChange hook)\n // This ensures getValues() in listeners returns the updated value\n // Guard against undefined userChange (when used outside FormProvider)\n // NOTE: We notify with the original value (not formattedValue) so that\n // listeners receive the actual value (false, 0, null) instead of marker\n // strings like '__FALSE__', '__ZERO__', '__NULL__'\n userChange?.notify(field.name, value);\n },\n // Convert null/undefined to empty string for UI display\n value: fromNullishString(field.value) as string,\n },\n formState,\n fieldState,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAaA,mBACX,UACsC;CACtC,MAAM,EAAE,OAAO,WAAW,eAAeC,cAAiB,KAAK;CAC/D,MAAM,EAAE,eAAe,WAAW,cAAc;CAEhD,OAAO;EACL,OAAO;GACL,GAAG;GAGH,WAAW,GAAG,UAAiB;IAC7B,MAAM,QAAQ,MAAM,EAAE,EAAE,QAAQ,SAAS,MAAM;IAC/C,MAAM,iBAAiB,UAAU,KAAK,KAAK,gBAAgB,KAAK;IAKhE,IAAI,mBAAmB,MAAM,OAC3B;IAIF,MAAM,SAAS,cAAc;IAQ7B,YAAY,OAAO,MAAM,MAAM,KAAK;GACtC;GAEA,OAAO,kBAAkB,MAAM,KAAK;EACtC;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"useController-CJjMqXU5.mjs","names":["useController","useRHFController"],"sources":["../src/hooks/useController/useController.ts"],"sourcesContent":["import type {\n ControllerFieldState,\n ControllerRenderProps,\n UseControllerProps as RHFUseControllerProps,\n UseFormStateReturn,\n} from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useController as useRHFController } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { fromNullishString, toNullishString } from '../../helpers';\n\nexport type UseControllerProps<TFieldValues extends object = object> =\n RHFUseControllerProps<TFieldValues>;\n\nexport interface UseControllerReturn<TFieldValues extends object = object> {\n field: Omit<ControllerRenderProps<TFieldValues>, 'onChange' | 'value'> & {\n // Using any[] to support both direct value changes and React synthetic events\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => void;\n value: string;\n };\n fieldState: ControllerFieldState;\n formState: UseFormStateReturn<TFieldValues>;\n}\n\n/**\n * A wrapper around react-hook-form's useController that transparently handles nullish string conversions.\n *\n * Key features:\n * 1. Empty strings ('') in the UI are stored as null in form state\n * 2. Null/undefined values in form state are displayed as empty strings in the UI\n * 3. Handles both direct value changes and React synthetic events\n * 4. Maintains the same API as react-hook-form's useController\n * 5. Notifies UniformContext's userChange listeners on field changes (enables useWatchUserChange hook)\n * 6. No-op when value unchanged: onChange is ignored if the new value equals the current value\n * (prevents unnecessary re-renders and spurious useWatchUserChange triggers)\n *\n * This enables consistent handling of empty/null values while keeping a clean API\n * for form inputs that expect string values.\n *\n * @see https://react-hook-form.com/docs/usecontroller\n */\nexport const useController = <TFieldValues extends object = object>(\n props: UseControllerProps<TFieldValues>,\n): UseControllerReturn<TFieldValues> => {\n const { field, formState, fieldState } = useRHFController(props);\n const { userChange } = useContext(UniformContext);\n\n return {\n field: {\n ...field,\n // Handles both direct values (onChange(\"value\")) and events (onChange(event))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => {\n const value = event[0]?.target?.value ?? event[0];\n const formattedValue = value === '' ? '' : toNullishString(value);\n\n // Skip if value hasn't changed (e.g., user re-selects same option)\n // We compare formattedValue (the new value after nullish conversion) with\n // field.value (the current stored value, also in nullish format)\n if (formattedValue === field.value) {\n return;\n }\n\n // Update form state first\n field.onChange(formattedValue);\n\n // Then notify userChange listeners (for useWatchUserChange hook)\n // This ensures getValues() in listeners returns the updated value\n // Guard against undefined userChange (when used outside FormProvider)\n // NOTE: We notify with the original value (not formattedValue) so that\n // listeners receive the actual value (false, 0, null) instead of marker\n // strings like '__FALSE__', '__ZERO__', '__NULL__'\n userChange?.notify(field.name, value);\n },\n // Convert null/undefined to empty string for UI display\n value: fromNullishString(field.value) as string,\n },\n formState,\n fieldState,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAaA,mBACX,UACsC;CACtC,MAAM,EAAE,OAAO,WAAW,eAAeC,cAAiB,KAAK;CAC/D,MAAM,EAAE,eAAe,WAAW,cAAc;CAEhD,OAAO;EACL,OAAO;GACL,GAAG;GAGH,WAAW,GAAG,UAAiB;IAC7B,MAAM,QAAQ,MAAM,EAAE,EAAE,QAAQ,SAAS,MAAM;IAC/C,MAAM,iBAAiB,UAAU,KAAK,KAAK,gBAAgB,KAAK;IAKhE,IAAI,mBAAmB,MAAM,OAC3B;IAIF,MAAM,SAAS,cAAc;IAQ7B,YAAY,OAAO,MAAM,MAAM,KAAK;GACtC;GAEA,OAAO,kBAAkB,MAAM,KAAK;EACtC;EACA;EACA;CACF;AACF"}
@@ -1,13 +1,12 @@
1
1
  import { ControllerFieldState, ControllerRenderProps, UseControllerProps, UseFormStateReturn } from "react-hook-form";
2
- //#region src/hooks/useController/useController.d.ts
3
2
  type UseControllerProps$1<TFieldValues extends object = object> = UseControllerProps<TFieldValues>;
4
3
  interface UseControllerReturn<TFieldValues extends object = object> {
5
4
  field: Omit<ControllerRenderProps<TFieldValues>, 'onChange' | 'value'> & {
6
5
  onChange: (...event: any[]) => void;
7
6
  value: string;
8
7
  };
9
- formState: UseFormStateReturn<TFieldValues>;
10
8
  fieldState: ControllerFieldState;
9
+ formState: UseFormStateReturn<TFieldValues>;
11
10
  }
12
11
  /**
13
12
  * A wrapper around react-hook-form's useController that transparently handles nullish string conversions.
@@ -27,6 +26,5 @@ interface UseControllerReturn<TFieldValues extends object = object> {
27
26
  * @see https://react-hook-form.com/docs/usecontroller
28
27
  */
29
28
  declare const useController$1: <TFieldValues extends object = object>(props: UseControllerProps$1<TFieldValues>) => UseControllerReturn<TFieldValues>;
30
- //#endregion
31
29
  export { UseControllerReturn as n, useController$1 as r, UseControllerProps$1 as t };
32
- //# sourceMappingURL=useController-DcK2YHbw.d.mts.map
30
+ //# sourceMappingURL=useController-CdFEp-Wa.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useController-CdFEp-Wa.d.mts","names":["UseControllerProps","RHFUseControllerProps","useController"],"sources":["../src/hooks/useController/useController.ts"],"mappings":";KAaYA,qBAAmB,wCAC7BC,mBAAsB;UAEP,oBAAoB;EACnC,OAAO,KAAK,sBAAsB;IAGhC,cAAc;IACd;;EAEF,YAAY;EACZ,WAAW,mBAAmB;;;;;;;;;;;;;;;;;;;cAoBnBC,kBAAiB,sCAC5B,OAAOF,qBAAmB,kBACzB,oBAAoB"}
@@ -1,8 +1,8 @@
1
- import { n as UniformContext } from "./FormContext-CB7Glm02.mjs";
1
+ import { n as UniformContext } from "./FormContext-B8G_Xxd6.mjs";
2
2
  import { flatArrayKey, nameToTestId, toValidationFormat } from "./helpers/index.mjs";
3
3
  import { useContext } from "react";
4
4
  import { useFormContext } from "react-hook-form";
5
- //#region src/hooks/useFormContext/useFormContext.ts
5
+ // src/hooks/useFormContext/useFormContext.ts
6
6
  /** Schema check whether a field is required or optional */
7
7
  const checkFieldIsRequired = (validation, path) => {
8
8
  const checkPath = path[path.length - 1] === "__FLAT__" ? path.slice(0, -1) : path;
@@ -131,7 +131,6 @@ const useFormContext$1 = () => {
131
131
  watch
132
132
  };
133
133
  };
134
- //#endregion
135
134
  export { useFormContext$1 as n, checkFieldIsRequired as t };
136
135
 
137
- //# sourceMappingURL=useFormContext-DNb_B8LQ.mjs.map
136
+ //# sourceMappingURL=useFormContext-BEjPBdzb.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormContext-BEjPBdzb.mjs","names":["useFormContext","useHookFormContext"],"sources":["../src/hooks/useFormContext/useFormContext.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { VetoFormattedError, VetoInstance } from '@fuf-stack/veto';\nimport type { ContextType } from 'react';\nimport type {\n FieldError,\n FieldValues,\n Path,\n UseFormReturn,\n} from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useFormContext as useHookFormContext } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { flatArrayKey, nameToTestId, toValidationFormat } from '../../helpers';\n\n/** Schema check whether a field is required or optional */\nexport const checkFieldIsRequired = (\n validation: VetoInstance,\n path: string[],\n): boolean => {\n // Handle flat array paths: strip the flatArrayKey to check the array element schema\n // e.g., ['arrayField', '0', '__FLAT__'] -> check schema at ['arrayField', '0']\n const checkPath =\n path[path.length - 1] === flatArrayKey ? path.slice(0, -1) : path;\n\n const checkRequired = (schema: any) => {\n // arrays ...\n if (schema.type === 'array') {\n // ... if array is optional or nullable it is not required\n if (schema.isOptional || schema.isNullable) {\n return false;\n }\n // ... otherwise arrays are required (display logic wise -> no asterisk in the label)\n return true;\n }\n\n // all other fields are required if they are\n // not optional and not nullable\n return !schema.isOptional && !schema.isNullable;\n };\n\n return validation.checkSchemaPath(checkRequired, checkPath);\n};\n\n/**\n * Resolve validation errors for a given field path.\n *\n * Traverses a nested `VetoFormattedError` structure using a dotted path\n * (for example: \"user.address.0.street\") and returns the matching\n * `FieldError[]` if present. If no error exists at the path, returns\n * `undefined`.\n *\n * @param errors - The formatted validation errors from Uniform's context\n * @param name - The dotted field path to resolve\n * @returns An array of `FieldError` entries for the field, or `undefined`\n */\nconst getValidationErrorsByName = (\n errors: VetoFormattedError,\n name: string,\n) => {\n // Traverse nested error structure; ignore flat array wrapper key\n const keys = name.split('.').filter((k) => {\n return k !== flatArrayKey;\n });\n let current: unknown = errors;\n keys.forEach((key) => {\n if (current && typeof current === 'object') {\n current = (current as Record<string, unknown>)[key];\n } else {\n current = undefined;\n }\n });\n return current as FieldError[] | undefined;\n};\n\n/** Field state returned by the enhanced `getFieldState` */\nexport interface UniformFieldState {\n /** Validation errors for the field from the Uniform validation schema */\n error: FieldError[] | undefined;\n /** Whether the field has validation errors */\n invalid: boolean;\n /** Whether the field value differs from its default value */\n isDirty: boolean;\n /** Whether the field has been touched */\n isTouched: boolean;\n /** Whether the field is currently being validated */\n isValidating: boolean;\n /** Whether the validation schema requires the field */\n required: boolean;\n /** Generated HTML data-testid for the field */\n testId: string;\n}\n\n/**\n * Return type of `useFormContext`.\n *\n * Declared explicitly so the published declarations only reference types that\n * react-hook-form exports from its package root.\n */\nexport type UseFormContextReturn<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues = TFieldValues,\n> = Omit<\n UseFormReturn<TFieldValues, TContext, TTransformedValues>,\n 'getFieldState'\n> &\n ContextType<typeof UniformContext> & {\n getFieldState: (\n name: Path<TFieldValues>,\n testId?: string,\n ) => UniformFieldState;\n };\n\n/**\n * Custom hook that extends react-hook-form's useFormContext to add validation and state management.\n *\n * Key features:\n * - Enhanced `getFieldState` that includes validation schema-based \"required\" status and testId generation\n * - Automatic conversion of form values via `getValues`, `watch`, and `subscribe`:\n * - Unwraps flat array wrappers (`{ __FLAT__: value }` → `value`)\n * - Converts nullish string markers (`__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`)\n * - Filters out empty/null values\n */\nexport const useFormContext = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues = TFieldValues,\n>(): UseFormContextReturn<TFieldValues, TContext, TTransformedValues> => {\n const {\n formState,\n // some methods that will be enhanced below\n getFieldState: getFieldStateOrig,\n getValues: getValuesOrig,\n watch: watchOrig,\n subscribe: subscribeOrig,\n reset: resetOrig,\n // the rest of the methods pass through unchanged\n ...otherMethods\n } = useHookFormContext<TFieldValues, TContext, TTransformedValues>();\n\n const uniformContext = useContext(UniformContext);\n\n /**\n * Wrap react-hook-form's `reset` so the uniform context is notified about\n * programmatic resets. Field components (e.g. FieldArray) use this signal to\n * normalize their state on reset instead of inferring it from field contents.\n */\n const notifyReset = uniformContext?.formReset?.notify;\n const reset = ((...args: Parameters<typeof resetOrig>) => {\n resetOrig(...args);\n notifyReset?.();\n }) as typeof resetOrig;\n\n /**\n * Updated getFieldState method which returns:\n * - Whether the field is required by checking the validation schema\n * - Existing field state information (errors, etc.)\n * - A testId generated from the field name (with flat array keys removed and slugified)\n *\n * @param name - The field path (string or array)\n * @param testId - Optional explicit testId. If provided, will be slugified. If not provided, generated from name.\n */\n const getFieldState = (\n name: Path<TFieldValues>,\n testId?: string,\n ): UniformFieldState => {\n const fieldPath =\n typeof name === 'string' ? name.replace(/\\[\\d+\\]/g, '').split('.') : name;\n\n // Use base validation instance for checking \"required\" status\n // Client validation often uses .nullish() which would incorrectly mark fields as optional\n const validationInstance =\n uniformContext?.validation.baseInstance ??\n uniformContext?.validation.instance;\n\n // Check if the field is required using the validation schema\n const required = validationInstance\n ? checkFieldIsRequired(validationInstance, fieldPath)\n : false;\n\n const error = getValidationErrorsByName(\n uniformContext?.validation.errors ?? {},\n name,\n );\n\n // Get everything but the error from the original field state\n const fieldState = getFieldStateOrig(name, formState);\n\n return {\n ...fieldState,\n error,\n invalid: !!error,\n required,\n testId: nameToTestId(testId ?? name),\n };\n };\n\n /**\n * Wrap form value accessor methods to automatically convert from internal storage format\n * to component-friendly format:\n *\n * - Unwrap flat array wrappers: `{ __FLAT__: value }` → `value`\n * - Convert nullish string markers: `__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`\n * - Filter out empty/null values: fields with converted null/empty values are removed entirely\n *\n * This ensures components receive clean, predictable data without needing to handle\n * the internal nullish string conversion system or flat array wrapping manually.\n */\n const getValues = ((...args: any[]) => {\n const result = (getValuesOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof getValuesOrig;\n\n const watch = ((...args: any[]) => {\n const result = (watchOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof watchOrig;\n\n const subscribe = ((...args: any[]) => {\n // For subscribe, we need to wrap the callback to convert the values property\n const [options] = args;\n if (options?.callback) {\n const originalCallback = options.callback;\n const wrappedOptions = {\n ...options,\n callback: (subscribeFormState: any) => {\n // Convert the values property if it exists\n const convertedFormState = {\n ...subscribeFormState,\n ...(subscribeFormState.values && {\n values: toValidationFormat(subscribeFormState.values),\n }),\n };\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return originalCallback(convertedFormState);\n },\n };\n return subscribeOrig(wrappedOptions);\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (subscribeOrig as any)(...args);\n }) as typeof subscribeOrig;\n\n return {\n ...otherMethods,\n ...uniformContext,\n formState,\n getFieldState,\n getValues,\n reset,\n subscribe,\n watch,\n };\n};\n"],"mappings":";;;;;;AAkBA,MAAa,wBACX,YACA,SACY;CAGZ,MAAM,YACJ,KAAK,KAAK,SAAS,OAAA,aAAsB,KAAK,MAAM,GAAG,EAAE,IAAI;CAE/D,MAAM,iBAAiB,WAAgB;EAErC,IAAI,OAAO,SAAS,SAAS;GAE3B,IAAI,OAAO,cAAc,OAAO,YAC9B,OAAO;GAGT,OAAO;EACT;EAIA,OAAO,CAAC,OAAO,cAAc,CAAC,OAAO;CACvC;CAEA,OAAO,WAAW,gBAAgB,eAAe,SAAS;AAC5D;;;;;;;;;;;;;AAcA,MAAM,6BACJ,QACA,SACG;CAEH,MAAM,OAAO,KAAK,MAAM,GAAG,CAAC,CAAC,QAAQ,MAAM;EACzC,OAAO,MAAM;CACf,CAAC;CACD,IAAI,UAAmB;CACvB,KAAK,SAAS,QAAQ;EACpB,IAAI,WAAW,OAAO,YAAY,UAChC,UAAW,QAAoC;OAE/C,UAAU,KAAA;CAEd,CAAC;CACD,OAAO;AACT;;;;;;;;;;;AAmDA,MAAaA,yBAI4D;CACvE,MAAM,EACJ,WAEA,eAAe,mBACf,WAAW,eACX,OAAO,WACP,WAAW,eACX,OAAO,WAEP,GAAG,iBACDC,eAA+D;CAEnE,MAAM,iBAAiB,WAAW,cAAc;;;;;;CAOhD,MAAM,cAAc,gBAAgB,WAAW;CAC/C,MAAM,UAAU,GAAG,SAAuC;EACxD,UAAU,GAAG,IAAI;EACjB,cAAc;CAChB;;;;;;;;;;CAWA,MAAM,iBACJ,MACA,WACsB;EACtB,MAAM,YACJ,OAAO,SAAS,WAAW,KAAK,QAAQ,YAAY,EAAE,CAAC,CAAC,MAAM,GAAG,IAAI;EAIvE,MAAM,qBACJ,gBAAgB,WAAW,gBAC3B,gBAAgB,WAAW;EAG7B,MAAM,WAAW,qBACb,qBAAqB,oBAAoB,SAAS,IAClD;EAEJ,MAAM,QAAQ,0BACZ,gBAAgB,WAAW,UAAU,CAAC,GACtC,IACF;EAKA,OAAO;GACL,GAHiB,kBAAkB,MAAM,SAG7B;GACZ;GACA,SAAS,CAAC,CAAC;GACX;GACA,QAAQ,aAAa,UAAU,IAAI;EACrC;CACF;;;;;;;;;;;;CAaA,MAAM,cAAc,GAAG,SAAgB;EACrC,MAAM,SAAU,cAAsB,GAAG,IAAI;EAC7C,OAAO,mBAAmB,MAAM;CAClC;CAEA,MAAM,UAAU,GAAG,SAAgB;EACjC,MAAM,SAAU,UAAkB,GAAG,IAAI;EACzC,OAAO,mBAAmB,MAAM;CAClC;CAEA,MAAM,cAAc,GAAG,SAAgB;EAErC,MAAM,CAAC,WAAW;EAClB,IAAI,SAAS,UAAU;GACrB,MAAM,mBAAmB,QAAQ;GACjC,MAAM,iBAAiB;IACrB,GAAG;IACH,WAAW,uBAA4B;KAErC,MAAM,qBAAqB;MACzB,GAAG;MACH,GAAI,mBAAmB,UAAU,EAC/B,QAAQ,mBAAmB,mBAAmB,MAAM,EACtD;KACF;KAEA,OAAO,iBAAiB,kBAAkB;IAC5C;GACF;GACA,OAAO,cAAc,cAAc;EACrC;EAEA,OAAQ,cAAsB,GAAG,IAAI;CACvC;CAEA,OAAO;EACL,GAAG;EACH,GAAG;EACH;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}