form-hook-kit 1.2.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/LICENSE +21 -0
- package/README.md +753 -0
- package/dist/FormContext.d.ts +8 -0
- package/dist/FormContext.d.ts.map +1 -0
- package/dist/FormProvider.d.ts +33 -0
- package/dist/FormProvider.d.ts.map +1 -0
- package/dist/devtools/FormDevTools.d.ts +86 -0
- package/dist/devtools/FormDevTools.d.ts.map +1 -0
- package/dist/devtools/index.d.ts +3 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useForm.d.ts +30 -0
- package/dist/hooks/useForm.d.ts.map +1 -0
- package/dist/hooks/useFormField.d.ts +40 -0
- package/dist/hooks/useFormField.d.ts.map +1 -0
- package/dist/hooks/useFormPerformance.d.ts +57 -0
- package/dist/hooks/useFormPerformance.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +394 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +408 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +94 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/debounce.d.ts +6 -0
- package/dist/utils/debounce.d.ts.map +1 -0
- package/dist/utils/errors.d.ts +11 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/formActions.d.ts +57 -0
- package/dist/utils/formActions.d.ts.map +1 -0
- package/dist/utils/formReducer.d.ts +7 -0
- package/dist/utils/formReducer.d.ts.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/performance.d.ts +7 -0
- package/dist/utils/performance.d.ts.map +1 -0
- package/dist/utils/validation.d.ts +25 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/package.json +91 -0
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import React, { createContext, useRef, useReducer, useMemo, useContext, useCallback } from 'react';
|
|
2
|
+
import { ValidationError } from 'yup';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Form context
|
|
6
|
+
* Provides form state and methods to child components
|
|
7
|
+
*/
|
|
8
|
+
const FormContext = createContext(null);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Get validation error for a specific field
|
|
12
|
+
* @param name - Field name
|
|
13
|
+
* @param schema - Yup schema
|
|
14
|
+
* @param values - Current form values
|
|
15
|
+
* @returns Error message or null if valid
|
|
16
|
+
*/
|
|
17
|
+
function getFieldError({ name, schema, values, }) {
|
|
18
|
+
try {
|
|
19
|
+
schema.validateSyncAt(name, values);
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
if (error instanceof ValidationError) {
|
|
24
|
+
return error.message;
|
|
25
|
+
}
|
|
26
|
+
return 'Validation error';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get validation errors for entire form
|
|
31
|
+
* @param schema - Yup schema
|
|
32
|
+
* @param values - Current form values
|
|
33
|
+
* @returns Object with errors by field name
|
|
34
|
+
*/
|
|
35
|
+
function getFormErrors({ schema, values, }) {
|
|
36
|
+
// Type guard to check if schema is an ObjectSchema with fields
|
|
37
|
+
const objectSchema = schema;
|
|
38
|
+
const fields = objectSchema.fields
|
|
39
|
+
? Object.keys(objectSchema.fields)
|
|
40
|
+
: Object.keys(values);
|
|
41
|
+
return fields.reduce((acc, field) => {
|
|
42
|
+
acc[field] = getFieldError({ name: field, schema, values });
|
|
43
|
+
return acc;
|
|
44
|
+
}, {});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Form actions
|
|
49
|
+
*/
|
|
50
|
+
var FormActions;
|
|
51
|
+
(function (FormActions) {
|
|
52
|
+
FormActions["UPDATE_ERRORS"] = "UPDATE_ERRORS";
|
|
53
|
+
FormActions["UPDATE_VALUES"] = "UPDATE_VALUES";
|
|
54
|
+
})(FormActions || (FormActions = {}));
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Form state reducer
|
|
58
|
+
* Manages form state updates for values and errors
|
|
59
|
+
*/
|
|
60
|
+
function formReducer(state, action) {
|
|
61
|
+
switch (action.type) {
|
|
62
|
+
case FormActions.UPDATE_ERRORS:
|
|
63
|
+
return {
|
|
64
|
+
...state,
|
|
65
|
+
errors: {
|
|
66
|
+
...state.errors,
|
|
67
|
+
...action.payload,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
case FormActions.UPDATE_VALUES:
|
|
71
|
+
return {
|
|
72
|
+
...state,
|
|
73
|
+
values: action.payload,
|
|
74
|
+
};
|
|
75
|
+
default:
|
|
76
|
+
return state;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Generate changeValue function
|
|
82
|
+
* Updates a single field value
|
|
83
|
+
*/
|
|
84
|
+
function generateChangeValue({ dispatch, values, }) {
|
|
85
|
+
return ({ name, value }) => {
|
|
86
|
+
const payload = { ...values };
|
|
87
|
+
payload[name] = value;
|
|
88
|
+
dispatch({
|
|
89
|
+
payload,
|
|
90
|
+
type: FormActions.UPDATE_VALUES,
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Generate changeValues function
|
|
96
|
+
* Updates multiple field values at once
|
|
97
|
+
*/
|
|
98
|
+
function generateChangeValues({ dispatch, }) {
|
|
99
|
+
return (values) => {
|
|
100
|
+
dispatch({
|
|
101
|
+
payload: values,
|
|
102
|
+
type: FormActions.UPDATE_VALUES,
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Generate clearError function
|
|
108
|
+
* Clears error for a specific field
|
|
109
|
+
*/
|
|
110
|
+
function generateClearError({ dispatch, }) {
|
|
111
|
+
return (name) => {
|
|
112
|
+
dispatch({
|
|
113
|
+
payload: { [name]: null },
|
|
114
|
+
type: FormActions.UPDATE_ERRORS,
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Generate setError function
|
|
120
|
+
* Sets error for a specific field
|
|
121
|
+
*/
|
|
122
|
+
function generateSetError({ dispatch, }) {
|
|
123
|
+
return ({ error, name }) => {
|
|
124
|
+
dispatch({
|
|
125
|
+
payload: { [name]: error },
|
|
126
|
+
type: FormActions.UPDATE_ERRORS,
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Generate validateField function
|
|
132
|
+
* Validates a single field against the schema
|
|
133
|
+
*/
|
|
134
|
+
function generateValidateField({ dispatch, schema, values, }) {
|
|
135
|
+
return (name, value) => {
|
|
136
|
+
const newErrors = {};
|
|
137
|
+
newErrors[name] = getFieldError({
|
|
138
|
+
name,
|
|
139
|
+
schema,
|
|
140
|
+
values: value === undefined ? values : { ...values, [name]: value },
|
|
141
|
+
});
|
|
142
|
+
dispatch({
|
|
143
|
+
payload: newErrors,
|
|
144
|
+
type: FormActions.UPDATE_ERRORS,
|
|
145
|
+
});
|
|
146
|
+
return newErrors[name];
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Generate validateForm function
|
|
151
|
+
* Validates entire form against the schema
|
|
152
|
+
*/
|
|
153
|
+
function generateValidateForm({ dispatch, schema, values, }) {
|
|
154
|
+
return () => {
|
|
155
|
+
const newErrors = getFormErrors({ schema, values });
|
|
156
|
+
dispatch({
|
|
157
|
+
payload: newErrors,
|
|
158
|
+
type: FormActions.UPDATE_ERRORS,
|
|
159
|
+
});
|
|
160
|
+
return newErrors;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Creates a debounced function that delays invoking func until after wait milliseconds
|
|
166
|
+
* have elapsed since the last time the debounced function was invoked.
|
|
167
|
+
*/
|
|
168
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
169
|
+
function debounce(func, wait) {
|
|
170
|
+
let timeoutId;
|
|
171
|
+
return function debounced(...args) {
|
|
172
|
+
if (timeoutId !== undefined) {
|
|
173
|
+
clearTimeout(timeoutId);
|
|
174
|
+
}
|
|
175
|
+
timeoutId = setTimeout(() => {
|
|
176
|
+
func(...args);
|
|
177
|
+
}, wait);
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Enhanced error messages with helpful suggestions
|
|
183
|
+
*/
|
|
184
|
+
class FormHookKitError extends Error {
|
|
185
|
+
constructor(message, suggestion) {
|
|
186
|
+
super(message);
|
|
187
|
+
this.suggestion = suggestion;
|
|
188
|
+
this.name = 'FormHookKitError';
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function createContextError() {
|
|
192
|
+
return new FormHookKitError('useForm must be used within a FormProvider', 'Wrap your component tree with <FormProvider> to use form hooks. Example:\n\n' +
|
|
193
|
+
'<FormProvider schema={schema} initialValues={{}}>\n' +
|
|
194
|
+
' <YourComponent />\n' +
|
|
195
|
+
'</FormProvider>');
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Form Provider Component
|
|
200
|
+
*
|
|
201
|
+
* Wraps your form and provides form state management using React Context.
|
|
202
|
+
* Integrates with Yup for validation.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```tsx
|
|
206
|
+
* import * as yup from 'yup';
|
|
207
|
+
* import {FormProvider} from 'form-hook-kit';
|
|
208
|
+
*
|
|
209
|
+
* const schema = yup.object({
|
|
210
|
+
* email: yup.string().email().required(),
|
|
211
|
+
* password: yup.string().min(8).required(),
|
|
212
|
+
* });
|
|
213
|
+
*
|
|
214
|
+
* function MyForm() {
|
|
215
|
+
* return (
|
|
216
|
+
* <FormProvider
|
|
217
|
+
* schema={schema}
|
|
218
|
+
* initialValues={{ email: '', password: '' }}
|
|
219
|
+
* >
|
|
220
|
+
* <MyFormFields />
|
|
221
|
+
* </FormProvider>
|
|
222
|
+
* );
|
|
223
|
+
* }
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
function FormProvider({ children, initialErrors = {}, initialValues = {}, schema, validationDebounce = 0, }) {
|
|
227
|
+
const fieldRefs = useRef({});
|
|
228
|
+
const [state, dispatch] = useReducer(formReducer, {
|
|
229
|
+
errors: initialErrors,
|
|
230
|
+
values: initialValues,
|
|
231
|
+
});
|
|
232
|
+
// Memoize action generators to prevent unnecessary re-renders
|
|
233
|
+
const changeValue = useMemo(() => generateChangeValue({ dispatch, values: state.values }), [state.values]);
|
|
234
|
+
const changeValues = useMemo(() => generateChangeValues({ dispatch }), []);
|
|
235
|
+
const clearError = useMemo(() => generateClearError({ dispatch }), []);
|
|
236
|
+
const setError = useMemo(() => generateSetError({ dispatch }), []);
|
|
237
|
+
// Create validation functions with optional debouncing
|
|
238
|
+
const validateField = useMemo(() => {
|
|
239
|
+
const validator = generateValidateField({
|
|
240
|
+
dispatch,
|
|
241
|
+
schema,
|
|
242
|
+
values: state.values,
|
|
243
|
+
});
|
|
244
|
+
if (validationDebounce > 0) {
|
|
245
|
+
const debouncedValidator = debounce(validator, validationDebounce);
|
|
246
|
+
// Return a wrapper that calls debounced but still returns the result synchronously
|
|
247
|
+
return (name, value) => {
|
|
248
|
+
debouncedValidator(name, value);
|
|
249
|
+
return validator(name, value);
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
return validator;
|
|
253
|
+
}, [schema, state.values, validationDebounce]);
|
|
254
|
+
const validateForm = useMemo(() => {
|
|
255
|
+
const validator = generateValidateForm({
|
|
256
|
+
dispatch,
|
|
257
|
+
schema,
|
|
258
|
+
values: state.values,
|
|
259
|
+
});
|
|
260
|
+
if (validationDebounce > 0) {
|
|
261
|
+
const debouncedValidator = debounce(validator, validationDebounce);
|
|
262
|
+
// Return a wrapper that calls debounced but still returns the result synchronously
|
|
263
|
+
return () => {
|
|
264
|
+
debouncedValidator();
|
|
265
|
+
return validator();
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
return validator;
|
|
269
|
+
}, [schema, state.values, validationDebounce]);
|
|
270
|
+
// Memoize context value to prevent unnecessary re-renders of consumers
|
|
271
|
+
const contextValue = useMemo(() => ({
|
|
272
|
+
fieldRefs,
|
|
273
|
+
errors: state.errors,
|
|
274
|
+
values: state.values,
|
|
275
|
+
changeValue,
|
|
276
|
+
changeValues,
|
|
277
|
+
clearError,
|
|
278
|
+
setError,
|
|
279
|
+
validateField,
|
|
280
|
+
validateForm,
|
|
281
|
+
}), [
|
|
282
|
+
state.errors,
|
|
283
|
+
state.values,
|
|
284
|
+
changeValue,
|
|
285
|
+
changeValues,
|
|
286
|
+
clearError,
|
|
287
|
+
setError,
|
|
288
|
+
validateField,
|
|
289
|
+
validateForm,
|
|
290
|
+
]);
|
|
291
|
+
return (React.createElement(FormContext.Provider, { value: contextValue }, children));
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Hook to access form context
|
|
296
|
+
*
|
|
297
|
+
* Must be used within a FormProvider component.
|
|
298
|
+
* Provides access to form state, values, errors, and methods.
|
|
299
|
+
*
|
|
300
|
+
* @returns Form context value with state and methods
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```tsx
|
|
304
|
+
* function MyFormField() {
|
|
305
|
+
* const {values, errors, changeValue, validateField} = useForm();
|
|
306
|
+
*
|
|
307
|
+
* return (
|
|
308
|
+
* <div>
|
|
309
|
+
* <input
|
|
310
|
+
* value={values.email || ''}
|
|
311
|
+
* onChange={(e) => changeValue({name: 'email', value: e.target.value})}
|
|
312
|
+
* onBlur={() => validateField('email')}
|
|
313
|
+
* />
|
|
314
|
+
* {errors.email && <span>{errors.email}</span>}
|
|
315
|
+
* </div>
|
|
316
|
+
* );
|
|
317
|
+
* }
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
function useForm() {
|
|
321
|
+
const context = useContext(FormContext);
|
|
322
|
+
if (!context) {
|
|
323
|
+
const error = createContextError();
|
|
324
|
+
// Log suggestion to console for better DX
|
|
325
|
+
if (error.suggestion) {
|
|
326
|
+
console.error(error.suggestion);
|
|
327
|
+
}
|
|
328
|
+
throw error;
|
|
329
|
+
}
|
|
330
|
+
return context;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Hook for managing a single form field
|
|
335
|
+
*
|
|
336
|
+
* Provides field-specific state and handlers for common field operations.
|
|
337
|
+
*
|
|
338
|
+
* @param name - Field name
|
|
339
|
+
* @returns Field state and handlers
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```tsx
|
|
343
|
+
* function EmailField() {
|
|
344
|
+
* const {value, error, onChange, onBlur} = useFormField('email');
|
|
345
|
+
*
|
|
346
|
+
* return (
|
|
347
|
+
* <div>
|
|
348
|
+
* <input
|
|
349
|
+
* type="email"
|
|
350
|
+
* value={value || ''}
|
|
351
|
+
* onChange={onChange}
|
|
352
|
+
* onBlur={onBlur}
|
|
353
|
+
* />
|
|
354
|
+
* {error && <span className="error">{error}</span>}
|
|
355
|
+
* </div>
|
|
356
|
+
* );
|
|
357
|
+
* }
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
function useFormField(name) {
|
|
361
|
+
const { values, errors, changeValue, validateField, clearError, fieldRefs } = useForm();
|
|
362
|
+
const value = values[name];
|
|
363
|
+
const error = errors[name];
|
|
364
|
+
const onChange = useCallback((e) => {
|
|
365
|
+
changeValue({ name, value: e.target.value });
|
|
366
|
+
}, [name, changeValue]);
|
|
367
|
+
const onChangeValue = useCallback((newValue) => {
|
|
368
|
+
changeValue({ name, value: newValue });
|
|
369
|
+
}, [name, changeValue]);
|
|
370
|
+
const onBlur = useCallback(() => {
|
|
371
|
+
validateField(name);
|
|
372
|
+
}, [name, validateField]);
|
|
373
|
+
const onFocus = useCallback(() => {
|
|
374
|
+
clearError(name);
|
|
375
|
+
}, [name, clearError]);
|
|
376
|
+
const setRef = useCallback((ref) => {
|
|
377
|
+
if (ref) {
|
|
378
|
+
fieldRefs.current[name] = ref;
|
|
379
|
+
}
|
|
380
|
+
}, [name, fieldRefs]);
|
|
381
|
+
return {
|
|
382
|
+
value,
|
|
383
|
+
error,
|
|
384
|
+
onChange,
|
|
385
|
+
onChangeValue,
|
|
386
|
+
onBlur,
|
|
387
|
+
onFocus,
|
|
388
|
+
setRef,
|
|
389
|
+
name,
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export { FormContext, FormProvider, formReducer, generateChangeValue, generateChangeValues, generateClearError, generateSetError, generateValidateField, generateValidateForm, getFieldError, getFormErrors, useForm, useFormField };
|
|
394
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/FormContext.tsx","../src/utils/validation.ts","../src/types/index.ts","../src/utils/formReducer.ts","../src/utils/formActions.ts","../src/utils/debounce.ts","../src/utils/errors.ts","../src/FormProvider.tsx","../src/hooks/useForm.ts","../src/hooks/useFormField.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;AAGA;;;AAGG;MACU,WAAW,GAAG,aAAa,CAA0B,IAAI;;ACJtE;;;;;;AAMG;AACG,SAAU,aAAa,CAAC,EAC5B,IAAI,EACJ,MAAM,EACN,MAAM,GAKP,EAAA;AACC,IAAA,IAAI;AACF,QAAA,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC;AACnC,QAAA,OAAO,IAAI;IACb;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,IAAI,KAAK,YAAY,eAAe,EAAE;YACpC,OAAO,KAAK,CAAC,OAAO;QACtB;AACA,QAAA,OAAO,kBAAkB;IAC3B;AACF;AAEA;;;;;AAKG;SACa,aAAa,CAAC,EAC5B,MAAM,EAC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