@juantroconisf/lib 9.3.0 → 9.4.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.
package/dist/index.d.mts CHANGED
@@ -98,26 +98,24 @@ interface ItemAutocompleteProps extends ComponentInputProps {
98
98
  interface OnMethods<O extends StateType> {
99
99
  /** Registers a scalar or nested object field. */
100
100
  input<P extends AllPaths<O>>(id: P): ItemInputProps<NestedFieldValue<O, P & string>>;
101
- /** Registers an array element — adapts to primitive arrays (by index) or object arrays (by ID + field). */
102
- /** Registers an array element — adapts to primitive arrays (by index). */
103
- input<K extends ArrayPaths<O>>(arrayKey: K, index: number): ItemInputProps<any>;
104
101
  /** Registers an object array element's field using composite syntax "array.field". */
105
102
  input<P extends ObjectArrayFieldPaths<O>>(compositePath: P, itemId: string | number): ItemInputProps<any>;
103
+ /** Registers a primitive array element by index. */
104
+ input<K extends ArrayPaths<O>>(arrayKey: K, index: number): ItemInputProps<any>;
106
105
  /** Registers a scalar or nested object field. */
107
106
  select<P extends AllPaths<O>>(id: P): ItemSelectProps;
108
107
  /** Registers a complete array field for multi-selection. */
109
108
  select<K extends ArrayPaths<O>>(arrayKey: K): ItemSelectProps;
110
- /** Registers an array element — adapts to primitive arrays (by index) or object arrays (by ID + field). */
111
- select<K extends ArrayPaths<O>>(arrayKey: K, index: number): ItemSelectProps;
112
109
  /** Registers an object array element's field using composite syntax "array.field". */
113
110
  select<P extends ObjectArrayFieldPaths<O>>(compositePath: P, itemId: string | number): ItemSelectProps;
111
+ /** Registers a primitive array element by index. */
112
+ select<K extends ArrayPaths<O>>(arrayKey: K, index: number): ItemSelectProps;
114
113
  /** Registers a scalar or nested object field. */
115
114
  autocomplete<P extends AllPaths<O>>(id: P): ItemAutocompleteProps;
116
- /** Registers an array element — adapts to primitive arrays (by index) or object arrays (by ID + field). */
117
- /** Registers an array element — adapts to primitive arrays (by index). */
118
- autocomplete<K extends ArrayPaths<O>>(arrayKey: K, index: number): ItemAutocompleteProps;
119
115
  /** Registers an object array element's field using composite syntax "array.field". */
120
116
  autocomplete<P extends ObjectArrayFieldPaths<O>>(compositePath: P, itemId: string | number): ItemAutocompleteProps;
117
+ /** Registers a primitive array element by index. */
118
+ autocomplete<K extends ArrayPaths<O>>(arrayKey: K, index: number): ItemAutocompleteProps;
121
119
  }
122
120
  /**
123
121
  * Recursive type to find all paths to arrays in the state.
@@ -176,10 +174,14 @@ interface HelpersFunc<O extends StateType> {
176
174
  */
177
175
  interface UseFormResponse<O extends StateType> {
178
176
  onFieldBlur: BlurFunc<O>;
179
- /** Updates an object array element's field by ID. */
180
- onFieldChange<K extends ObjectArrayKeys<O>, F extends keyof ArrayElement<O[K]> & string>(arrayKey: K, itemId: ItemIdType<O, K>, field: F, value: ArrayElement<O[K]>[F]): void;
181
177
  /** Updates a scalar or nested object field. */
182
178
  onFieldChange<P extends AllPaths<O>>(id: P, value: NestedFieldValue<O, P & string>): void;
179
+ /** Updates an object array element's field using composite syntax "array.field". */
180
+ onFieldChange<P extends ObjectArrayFieldPaths<O>>(compositePath: P, itemId: string | number, value: any): void;
181
+ /** Updates an object array element's field by ID (explicit array key, field, and value). */
182
+ onFieldChange<K extends ObjectArrayKeys<O>, F extends keyof ArrayElement<O[K]> & string>(arrayKey: K, itemId: ItemIdType<O, K>, field: F, value: ArrayElement<O[K]>[F]): void;
183
+ /** Updates a primitive array element by index. */
184
+ onFieldChange<K extends ArrayPaths<O>>(arrayKey: K, index: number, value: any): void;
183
185
  onSelectionChange: ValueChangeFunc<O, keyof O>;
184
186
  state: O;
185
187
  setState: React.Dispatch<React.SetStateAction<O>>;
package/dist/index.d.ts CHANGED
@@ -98,26 +98,24 @@ interface ItemAutocompleteProps extends ComponentInputProps {
98
98
  interface OnMethods<O extends StateType> {
99
99
  /** Registers a scalar or nested object field. */
100
100
  input<P extends AllPaths<O>>(id: P): ItemInputProps<NestedFieldValue<O, P & string>>;
101
- /** Registers an array element — adapts to primitive arrays (by index) or object arrays (by ID + field). */
102
- /** Registers an array element — adapts to primitive arrays (by index). */
103
- input<K extends ArrayPaths<O>>(arrayKey: K, index: number): ItemInputProps<any>;
104
101
  /** Registers an object array element's field using composite syntax "array.field". */
105
102
  input<P extends ObjectArrayFieldPaths<O>>(compositePath: P, itemId: string | number): ItemInputProps<any>;
103
+ /** Registers a primitive array element by index. */
104
+ input<K extends ArrayPaths<O>>(arrayKey: K, index: number): ItemInputProps<any>;
106
105
  /** Registers a scalar or nested object field. */
107
106
  select<P extends AllPaths<O>>(id: P): ItemSelectProps;
108
107
  /** Registers a complete array field for multi-selection. */
109
108
  select<K extends ArrayPaths<O>>(arrayKey: K): ItemSelectProps;
110
- /** Registers an array element — adapts to primitive arrays (by index) or object arrays (by ID + field). */
111
- select<K extends ArrayPaths<O>>(arrayKey: K, index: number): ItemSelectProps;
112
109
  /** Registers an object array element's field using composite syntax "array.field". */
113
110
  select<P extends ObjectArrayFieldPaths<O>>(compositePath: P, itemId: string | number): ItemSelectProps;
111
+ /** Registers a primitive array element by index. */
112
+ select<K extends ArrayPaths<O>>(arrayKey: K, index: number): ItemSelectProps;
114
113
  /** Registers a scalar or nested object field. */
115
114
  autocomplete<P extends AllPaths<O>>(id: P): ItemAutocompleteProps;
116
- /** Registers an array element — adapts to primitive arrays (by index) or object arrays (by ID + field). */
117
- /** Registers an array element — adapts to primitive arrays (by index). */
118
- autocomplete<K extends ArrayPaths<O>>(arrayKey: K, index: number): ItemAutocompleteProps;
119
115
  /** Registers an object array element's field using composite syntax "array.field". */
120
116
  autocomplete<P extends ObjectArrayFieldPaths<O>>(compositePath: P, itemId: string | number): ItemAutocompleteProps;
117
+ /** Registers a primitive array element by index. */
118
+ autocomplete<K extends ArrayPaths<O>>(arrayKey: K, index: number): ItemAutocompleteProps;
121
119
  }
122
120
  /**
123
121
  * Recursive type to find all paths to arrays in the state.
@@ -176,10 +174,14 @@ interface HelpersFunc<O extends StateType> {
176
174
  */
177
175
  interface UseFormResponse<O extends StateType> {
178
176
  onFieldBlur: BlurFunc<O>;
179
- /** Updates an object array element's field by ID. */
180
- onFieldChange<K extends ObjectArrayKeys<O>, F extends keyof ArrayElement<O[K]> & string>(arrayKey: K, itemId: ItemIdType<O, K>, field: F, value: ArrayElement<O[K]>[F]): void;
181
177
  /** Updates a scalar or nested object field. */
182
178
  onFieldChange<P extends AllPaths<O>>(id: P, value: NestedFieldValue<O, P & string>): void;
179
+ /** Updates an object array element's field using composite syntax "array.field". */
180
+ onFieldChange<P extends ObjectArrayFieldPaths<O>>(compositePath: P, itemId: string | number, value: any): void;
181
+ /** Updates an object array element's field by ID (explicit array key, field, and value). */
182
+ onFieldChange<K extends ObjectArrayKeys<O>, F extends keyof ArrayElement<O[K]> & string>(arrayKey: K, itemId: ItemIdType<O, K>, field: F, value: ArrayElement<O[K]>[F]): void;
183
+ /** Updates a primitive array element by index. */
184
+ onFieldChange<K extends ArrayPaths<O>>(arrayKey: K, index: number, value: any): void;
183
185
  onSelectionChange: ValueChangeFunc<O, keyof O>;
184
186
  state: O;
185
187
  setState: React.Dispatch<React.SetStateAction<O>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juantroconisf/lib",
3
- "version": "9.3.0",
3
+ "version": "9.4.0",
4
4
  "description": "A form validation library for HeroUI.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",