@syncfusion/ej2-react-form-builder 0.1.0-beta → 35.1.37

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 (160) hide show
  1. package/README.md +81 -36
  2. package/diConfig.json +148 -0
  3. package/dist/ej2-react-form-builder.min.js +10 -0
  4. package/dist/ej2-react-form-builder.umd.min.js +11 -0
  5. package/dist/ej2-react-form-builder.umd.min.js.map +1 -0
  6. package/dist/es6/ej2-react-form-builder.es2015.js +60 -0
  7. package/dist/es6/ej2-react-form-builder.es2015.js.map +1 -0
  8. package/form-builder.d.ts +4 -0
  9. package/form-builder.js +4 -0
  10. package/index.d.ts +2 -4
  11. package/index.js +2 -4
  12. package/license +6 -13
  13. package/package.json +19 -43
  14. package/src/form-builder/formbuilder.component.d.ts +37 -0
  15. package/src/form-builder/formbuilder.component.js +50 -0
  16. package/src/form-builder/index.d.ts +2 -0
  17. package/src/form-builder/index.js +2 -0
  18. package/src/form-builder/toolboxitems-directive.d.ts +28 -0
  19. package/src/form-builder/toolboxitems-directive.js +47 -0
  20. package/src/global.js +1 -0
  21. package/src/index.d.ts +2 -16
  22. package/src/index.js +2 -6
  23. package/Common/CheckboxGroup.d.ts +0 -13
  24. package/Common/CheckboxGroup.js +0 -50
  25. package/Common/ConditionalRuleEngine.d.ts +0 -296
  26. package/Common/ConditionalRuleEngine.js +0 -566
  27. package/Common/CustomTabComponent.d.ts +0 -17
  28. package/Common/CustomTabComponent.js +0 -30
  29. package/Common/CustomValidationEngine.d.ts +0 -58
  30. package/Common/CustomValidationEngine.js +0 -146
  31. package/Common/DataGridComponent.d.ts +0 -20
  32. package/Common/DataGridComponent.js +0 -273
  33. package/Common/FormValidator.d.ts +0 -485
  34. package/Common/FormValidator.js +0 -575
  35. package/Common/MinMaxRuleEngine.d.ts +0 -105
  36. package/Common/MinMaxRuleEngine.js +0 -365
  37. package/Common/StaticHtmlRenderer.d.ts +0 -14
  38. package/Common/StaticHtmlRenderer.js +0 -24
  39. package/Common/expressions/DependencyTracker.d.ts +0 -30
  40. package/Common/expressions/DependencyTracker.js +0 -128
  41. package/Common/expressions/ExpressionEngine.d.ts +0 -95
  42. package/Common/expressions/ExpressionEngine.js +0 -506
  43. package/Common/expressions/ExpressionParser.d.ts +0 -41
  44. package/Common/expressions/ExpressionParser.js +0 -269
  45. package/Common/expressions/useGridExpressions.d.ts +0 -12
  46. package/Common/expressions/useGridExpressions.js +0 -71
  47. package/Common/globalFormId.d.ts +0 -26
  48. package/Common/globalFormId.js +0 -45
  49. package/Common/json-converter.d.ts +0 -444
  50. package/Common/json-converter.js +0 -1184
  51. package/Common/parser.d.ts +0 -98
  52. package/Common/parser.js +0 -753
  53. package/Common/utils.d.ts +0 -130
  54. package/Common/utils.js +0 -574
  55. package/src/FormBuilder.d.ts +0 -211
  56. package/src/FormBuilder.js +0 -1299
  57. package/src/components/Database/ConnectionForm.d.ts +0 -8
  58. package/src/components/Database/ConnectionForm.js +0 -28
  59. package/src/components/TopBar.d.ts +0 -10
  60. package/src/components/TopBar.js +0 -7
  61. package/src/components/icons/ComponentIcons.d.ts +0 -44
  62. package/src/components/icons/ComponentIcons.js +0 -40
  63. package/src/components/layout/FormFieldWrapper.d.ts +0 -41
  64. package/src/components/layout/FormFieldWrapper.js +0 -112
  65. package/src/components/layout/LeftPane.d.ts +0 -23
  66. package/src/components/layout/LeftPane.js +0 -310
  67. package/src/components/layout/ListBoxPane.d.ts +0 -24
  68. package/src/components/layout/ListBoxPane.js +0 -94
  69. package/src/components/layout/MainSection.d.ts +0 -39
  70. package/src/components/layout/MainSection.js +0 -1766
  71. package/src/components/layout/Preview.d.ts +0 -12
  72. package/src/components/layout/Preview.js +0 -337
  73. package/src/components/layout/RightPane.d.ts +0 -22
  74. package/src/components/layout/RightPane.js +0 -370
  75. package/src/components/theme/ThemeSwitcher.d.ts +0 -14
  76. package/src/components/theme/ThemeSwitcher.js +0 -24
  77. package/src/components/theme/theme-constant.d.ts +0 -37
  78. package/src/components/theme/theme-constant.js +0 -23
  79. package/src/config/component-properties.json +0 -4929
  80. package/src/config/form-setting.json +0 -56
  81. package/src/config/locale.d.ts +0 -449
  82. package/src/config/locale.js +0 -449
  83. package/src/context/FormSchemaContext.d.ts +0 -32
  84. package/src/context/FormSchemaContext.js +0 -155
  85. package/src/context/LocalizationContext.d.ts +0 -27
  86. package/src/context/LocalizationContext.js +0 -43
  87. package/src/context/ThemeContext.d.ts +0 -23
  88. package/src/context/ThemeContext.js +0 -161
  89. package/src/context/contexts.d.ts +0 -6
  90. package/src/context/contexts.js +0 -6
  91. package/src/context/defaultFormSchema.d.ts +0 -6
  92. package/src/context/defaultFormSchema.js +0 -20
  93. package/src/defaultPalette.d.ts +0 -9
  94. package/src/defaultPalette.js +0 -45
  95. package/src/defaultTemplate.d.ts +0 -3
  96. package/src/defaultTemplate.js +0 -185
  97. package/src/import/schemaImportUtils.d.ts +0 -24
  98. package/src/import/schemaImportUtils.js +0 -121
  99. package/src/types/ActionButtons.d.ts +0 -44
  100. package/src/types/ActionButtons.js +0 -27
  101. package/src/types/ComponentProperties.d.ts +0 -33
  102. package/src/types/ComponentProperties.js +0 -2
  103. package/src/types/FormSchema.d.ts +0 -585
  104. package/src/types/FormSchema.js +0 -147
  105. package/src/types/connection.d.ts +0 -19
  106. package/src/types/connection.js +0 -9
  107. package/src/utils/AttributesEditor.d.ts +0 -13
  108. package/src/utils/AttributesEditor.js +0 -117
  109. package/src/utils/ButtonGroupEditor.d.ts +0 -15
  110. package/src/utils/ButtonGroupEditor.js +0 -141
  111. package/src/utils/ChoiceBasedFieldEditor.d.ts +0 -16
  112. package/src/utils/ChoiceBasedFieldEditor.js +0 -87
  113. package/src/utils/ClipboardHelper.d.ts +0 -26
  114. package/src/utils/ClipboardHelper.js +0 -83
  115. package/src/utils/ColumnBuilder.d.ts +0 -11
  116. package/src/utils/ColumnBuilder.js +0 -153
  117. package/src/utils/ColumnSpanEditor.d.ts +0 -8
  118. package/src/utils/ColumnSpanEditor.js +0 -98
  119. package/src/utils/ConditionDataEditor.d.ts +0 -29
  120. package/src/utils/ConditionDataEditor.js +0 -177
  121. package/src/utils/ConditionalEditorUtils.d.ts +0 -27
  122. package/src/utils/ConditionalEditorUtils.js +0 -310
  123. package/src/utils/ConditionsEditor.d.ts +0 -20
  124. package/src/utils/ConditionsEditor.js +0 -571
  125. package/src/utils/CustomAccordion.d.ts +0 -13
  126. package/src/utils/CustomAccordion.js +0 -38
  127. package/src/utils/CustomValidationEditor.d.ts +0 -11
  128. package/src/utils/CustomValidationEditor.js +0 -208
  129. package/src/utils/DataSourceCollector.d.ts +0 -3
  130. package/src/utils/DataSourceCollector.js +0 -252
  131. package/src/utils/ExpressionEditor.d.ts +0 -13
  132. package/src/utils/ExpressionEditor.js +0 -99
  133. package/src/utils/FormSettingsPanel.d.ts +0 -9
  134. package/src/utils/FormSettingsPanel.js +0 -60
  135. package/src/utils/LookupConfig.d.ts +0 -11
  136. package/src/utils/LookupConfig.js +0 -159
  137. package/src/utils/MinMaxValueEditor.d.ts +0 -25
  138. package/src/utils/MinMaxValueEditor.js +0 -188
  139. package/src/utils/OptionsEditor.d.ts +0 -8
  140. package/src/utils/OptionsEditor.js +0 -79
  141. package/src/utils/PropertyRenderer.d.ts +0 -22
  142. package/src/utils/PropertyRenderer.js +0 -210
  143. package/src/utils/ValueRenderer.d.ts +0 -2
  144. package/src/utils/ValueRenderer.js +0 -91
  145. package/src/utils/ej2DbAdaptor.d.ts +0 -6
  146. package/src/utils/ej2DbAdaptor.js +0 -38
  147. package/src/utils/mappingHeuristics.d.ts +0 -10
  148. package/src/utils/mappingHeuristics.js +0 -33
  149. package/src/utils/renderComponent.d.ts +0 -18
  150. package/src/utils/renderComponent.js +0 -300
  151. package/styles/tailwind3.css +0 -67
  152. package/styles/themes/action-buttons.css +0 -110
  153. package/styles/themes/datagrid.css +0 -380
  154. package/styles/themes/drag-reorder.css +0 -248
  155. package/styles/themes/import-dialog.css +0 -292
  156. package/styles/themes/index.css +0 -658
  157. package/styles/themes/left-pane.css +0 -253
  158. package/styles/themes/options-editor.css +0 -63
  159. package/styles/themes/preview.css +0 -702
  160. package/styles/themes/property-dialog.css +0 -371
@@ -1,485 +0,0 @@
1
- import * as React from 'react';
2
- import { type FormHTMLAttributes } from 'react';
3
- /**
4
- * @private
5
- */
6
- export type FormValueType = string | number | boolean | Date | File | FileList | string[] | number[] | React.ReactNode | null | undefined;
7
- /**
8
- * Defines the structure for a validation rule in the form system.
9
- *
10
- * A ValidationRule is a two-part array containing:
11
- * - A validation condition (as boolean, RegExp, number, function, etc.)
12
- * - An optional custom error message to show when validation fails
13
- *
14
- * The first element's type depends on the specific rule:
15
- * - For boolean rules (like 'required'): true/false
16
- * - For pattern rules (like 'email', 'regex'): RegExp object
17
- * - For range rules: number or number[] (min/max values)
18
- * - For equality checks: string (field name to compare with)
19
- * - For custom validation: () => boolean function
20
- *
21
- * ```tsx
22
- * const requiredRule: ValidationRule = [true, 'This field is required'];
23
- * ```
24
- * @private
25
- */
26
- export type ValidationRule = [boolean | RegExp | number | number[] | string | Date | (() => boolean), string?];
27
- /**
28
- * Defines the comprehensive set of validation rules that can be applied to form fields.
29
- * @private
30
- * This interface outlines all available validation types that can be configured for
31
- * each field in the form. Each validation type accepts a ValidationRule containing
32
- * both the validation criteria and an optional custom error message.
33
- */
34
- export interface FieldValidationRules {
35
- /**
36
- * Validates that the field has a non-empty value. When configured with [true], the field cannot be empty, null, or undefined.
37
- *
38
- * ```tsx
39
- * required: [true, 'This field must be filled in']
40
- * ```
41
- */
42
- required?: ValidationRule;
43
- /**
44
- * Validates that the input conforms to a standard email address format. Checks for proper formatting with @ symbol and domain structure.
45
- *
46
- * ```tsx
47
- * email: [true, 'Please enter a valid email address']
48
- * ```
49
- */
50
- email?: ValidationRule;
51
- /**
52
- * Validates that the input is a properly formatted URL. Checks for proper protocol, domain structure, and path format.
53
- *
54
- * ```tsx
55
- * url: [true, 'Please enter a valid website URL']
56
- * ```
57
- */
58
- url?: ValidationRule;
59
- /**
60
- * Validates that the input can be parsed as a valid date. Uses Date.parse() to validate the string can be converted to a date.
61
- *
62
- * ```tsx
63
- * date: [true, 'Please enter a valid date']
64
- * ```
65
- */
66
- date?: ValidationRule;
67
- /**
68
- * Validates that the input follows ISO date format (YYYY-MM-DD). Ensures strict compliance with the ISO date standard.
69
- *
70
- * ```tsx
71
- * dateIso: [true, 'Date must be in YYYY-MM-DD format']
72
- * ```
73
- */
74
- dateIso?: ValidationRule;
75
- /**
76
- * Validates that the input contains a valid numeric value. Ensures the field can be converted to a number without errors.
77
- *
78
- * ```tsx
79
- * number: [true, 'Please enter a number']
80
- * ```
81
- */
82
- number?: ValidationRule;
83
- /**
84
- * Validates that the input contains only numeric digits (0-9). Rejects inputs containing decimal points, signs, letter characters or spaces.
85
- *
86
- * ```tsx
87
- * digits: [true, 'Please enter only numeric digits']
88
- * ```
89
- */
90
- digits?: ValidationRule;
91
- /**
92
- * Validates that the input is a valid credit card number. Checks length (13-16 digits) and applies Luhn algorithm validation.
93
- *
94
- * ```tsx
95
- * creditCard: [true, 'Invalid credit card number']
96
- * ```
97
- */
98
- creditCard?: ValidationRule;
99
- /**
100
- * Validates that a string has at least the specified minimum length. Takes a number as the first parameter in the validation rule.
101
- *
102
- * ```tsx
103
- * minLength: [6, 'Must be at least 6 characters long']
104
- * ```
105
- */
106
- minLength?: ValidationRule;
107
- /**
108
- * Validates that a string doesn't exceed the specified maximum length. Takes a number as the first parameter in the validation rule.
109
- *
110
- * ```tsx
111
- * maxLength: [100, 'Cannot exceed 100 characters']
112
- * ```
113
- */
114
- maxLength?: ValidationRule;
115
- /**
116
- * Validates that a string's length falls within the specified range. Takes an array of two numbers [min, max] as the first parameter.
117
- *
118
- * ```tsx
119
- * rangeLength: [[8, 16], 'Must be between 8 and 16 characters']
120
- * ```
121
- */
122
- rangeLength?: ValidationRule;
123
- /**
124
- * Validates that a numeric value is at least the specified minimum. Takes a number as the first parameter in the validation rule.
125
- *
126
- * ```tsx
127
- * min: [18, 'Value must be at least 18']
128
- * ```
129
- */
130
- min?: ValidationRule;
131
- /**
132
- * Validates that a numeric value doesn't exceed the specified maximum. Takes a number as the first parameter in the validation rule.
133
- *
134
- * ```tsx
135
- * max: [100, 'Value cannot exceed 100']
136
- * ```
137
- */
138
- max?: ValidationRule;
139
- /**
140
- * Validates that a numeric value falls within the specified range. Takes an array of two numbers [min, max] as the first parameter.
141
- *
142
- * ```tsx
143
- * range: [[1, 10], 'Value must be between 1 and 10']
144
- * ```
145
- */
146
- range?: ValidationRule;
147
- /**
148
- * Validates that the input matches the specified regular expression pattern. Takes a RegExp object or a string pattern as the first parameter.
149
- *
150
- * ```tsx
151
- * regex: [/^[A-Z][a-z]+$/, 'Must start with capital letter followed by lowercase letters']
152
- * ```
153
- */
154
- regex?: ValidationRule;
155
- /**
156
- * Validates that the input conforms to a standard telephone number format. Checks for proper formatting of phone numbers with optional country code.
157
- *
158
- * ```tsx
159
- * tel: [true, 'Please enter a valid phone number']
160
- * ```
161
- */
162
- tel?: ValidationRule;
163
- /**
164
- * Validates that the field's value exactly matches another field's value. Takes the name of another field as the first parameter.
165
- *
166
- * ```tsx
167
- * equalTo: ['password', 'Passwords must match']
168
- * ```
169
- */
170
- equalTo?: ValidationRule;
171
- /**
172
- * Allows for completely custom validation logic as a function.
173
- *
174
- * This function receives the field value and should return either:
175
- * - A string containing an error message if validation fails
176
- * - null if validation passes
177
- *
178
- * ```tsx
179
- * customValidator: (value) => {
180
- * if (typeof value === 'string' && !value.includes('@company.com')) {
181
- * return 'Email must be a company email';
182
- * }
183
- * return null;
184
- * }
185
- * ```
186
- */
187
- customValidator?: (value: FormValueType) => string | null;
188
- }
189
- /**
190
- * Defines the complete validation schema for a form by mapping field names to their validation rules.
191
- * @private
192
- * This interface creates a dictionary where each key is a field name and each value
193
- * is an object containing all validation rules that apply to that field. The ValidationRules
194
- * object is passed to the Form component to establish the validation criteria for the entire form.
195
- *
196
- * ```tsx
197
- * const validationSchema: ValidationRules = {
198
- * username: {
199
- * required: [true, 'Username is required'],
200
- * minLength: [3, 'Username must be at least 3 characters']
201
- * },
202
- *
203
- * email: {
204
- * required: [true, 'Email is required'],
205
- * email: [true, 'Please enter a valid email address']
206
- * }
207
- * };
208
- * ```
209
- */
210
- export interface ValidationRules {
211
- [fieldName: string]: FieldValidationRules;
212
- }
213
- /**
214
- * Specifies the state and callback properties provided by the Form component.
215
- * @private
216
- * The FormState interface provides comprehensive access to the form's state
217
- * and behavior through the onFormStateChange callback. It allows parent components
218
- * to build custom form UIs with full access to validation state, field values, and form event handlers.
219
- */
220
- export interface FormState {
221
- /**
222
- * Specifies the current values for all form fields indexed by field name.
223
- * Access individual values using: values.fieldName
224
- * @private
225
- * ```tsx
226
- * const username = formState.values.username;
227
- * ```
228
- */
229
- values: Record<string, FormValueType>;
230
- /**
231
- * Specifies the current validation errors for all fields indexed by field name.
232
- * Fields without errors won't appear in this object.
233
- *
234
- */
235
- errors: Record<string, string>;
236
- /**
237
- * Specifies which fields in the form are valid (have no validation errors).
238
- *
239
- */
240
- valid: Record<string, boolean>;
241
- /**
242
- * Specifies if the form can be submitted. True when all fields are valid;
243
- * otherwise, all fields are marked as touched when attempted to submit.
244
- */
245
- allowSubmit: boolean;
246
- /**
247
- * Specifies if the form has been submitted at least once.
248
- * True after a submission attempt regardless of validation result.
249
- */
250
- submitted: boolean;
251
- /**
252
- * Specifies which fields in the form have been modified from their initial values.
253
- *
254
- */
255
- modified: Record<string, boolean>;
256
- /**
257
- * Specifies which fields have been touched (blurred after interaction).
258
- * Useful for determining when to display validation messages.
259
- *
260
- */
261
- touched: Record<string, boolean>;
262
- /**
263
- * Specifies which fields have been visited (received focus).
264
- *
265
- */
266
- visited: Record<string, boolean>;
267
- /**
268
- * Specifies a dictionary of field names for easy access to form fields.
269
- *
270
- */
271
- fieldNames: Record<string, string>;
272
- /**
273
- * Specifies the callback function to handle field value changes.
274
- * Use this instead of directly modifying input elements.
275
- *
276
- * @param name - The name of the field to update
277
- * @param options - Object containing the new value for the field.
278
- * @event onChange
279
- */
280
- onChange(name: string, options: {
281
- value: FormValueType;
282
- }): void;
283
- /**
284
- * Specifies the callback function for when a field loses focus.
285
- *
286
- * @param fieldName - The name of the field that lost focus.
287
- * @event onBlur
288
- */
289
- onBlur(fieldName: string): void;
290
- /**
291
- * Specifies the callback function for when a field receives focus.
292
- * Records the field as visited.
293
- *
294
- * @param fieldName - The name of the field that received focus.
295
- * @event onFocus
296
- */
297
- onFocus(fieldName: string): void;
298
- /**
299
- * Specifies the callback function to reset the form to its initial state.
300
- * Clears all values, errors, and interaction states.
301
- *
302
- * @event onFormReset
303
- */
304
- onFormReset(): void;
305
- /**
306
- * Specifies the callback function to submit the form.
307
- * Can be used with a submit button's onClick event.
308
- *
309
- * @param event - The synthetic event from the form submission.
310
- * @event onSubmit
311
- */
312
- onSubmit(event: React.SyntheticEvent): void;
313
- }
314
- /**
315
- * Specifies initial values for form fields. Maps field names to their default values when the form loads.
316
- * @private
317
- * ```tsx
318
- * const initialValues: FormInitialValues = {
319
- * username: 'john_doe'
320
- * };
321
- * ```
322
- */
323
- export interface FormInitialValues {
324
- [fieldName: string]: FormValueType;
325
- }
326
- /**
327
- * Specifies the props interface for the Form component.
328
- * @private
329
- */
330
- export interface FormProps {
331
- /**
332
- * Specifies the validation rules for each form field. This object defines constraints that form fields must satisfy.
333
- */
334
- rules: ValidationRules;
335
- /**
336
- * Specifies the callback fired when form is submitted and all validation rules pass.
337
- *
338
- * @param {Record<string, FormValueType>} data - Specifies the form data containing all field values
339
- * @event onSubmit
340
- */
341
- onSubmit?: (data: Record<string, FormValueType>) => void;
342
- /**
343
- * Specifies the callback fired when form state changes.
344
- * This can be used to access form state from parent components for custom UI rendering.
345
- *
346
- * @param {FormState} formState - The current state of the form
347
- * @event onFormStateChange
348
- */
349
- onFormStateChange?: (formState: FormState) => void;
350
- /**
351
- * Specifies the initial values for form fields. These values populate the form.
352
- *
353
- * @default -
354
- */
355
- initialValues?: FormInitialValues;
356
- /**
357
- * Specifies whether to trigger validation on every input change. When true, validation occurs on each keystroke, providing immediate feedback.
358
- *
359
- * @default false
360
- */
361
- validateOnChange?: boolean;
362
- }
363
- /**
364
- * Specifies the FormValidator interface for imperative methods.
365
- * @private
366
- */
367
- export interface IFormValidator extends FormProps {
368
- /**
369
- * Validates the entire form against all defined rules.
370
- *
371
- * @returns {boolean} - Returns true if the form is valid, false otherwise.
372
- */
373
- validate(): boolean;
374
- /**
375
- * Resets the form to its initial state, clearing all values, errors, and interaction states.
376
- *
377
- * @returns {void}
378
- */
379
- reset(): void;
380
- /**
381
- * Validates a specific field against its defined rules.
382
- *
383
- * @param {string} fieldName - Specifies the name of the field to validate
384
- * @returns {boolean} - Returns true if the field is valid, false otherwise
385
- */
386
- validateField(fieldName: string): boolean;
387
- /**
388
- * Provides access to the underlying HTML form element.
389
- *
390
- * @private
391
- */
392
- element?: HTMLFormElement;
393
- }
394
- /**
395
- * @private
396
- */
397
- type FormComponentProps = FormProps & Omit<FormHTMLAttributes<HTMLFormElement>, 'onSubmit'>;
398
- /**
399
- * Provides a form component with built-in validation functionality. Manages form state tracking,
400
- * field validation, and submission handling.
401
- *
402
- * ```typescript
403
- * import { Form, FormField, FormState } from '@syncfusion/react-inputs';
404
- *
405
- * const [formState, setFormState] = useState<FormState>();
406
- *
407
- * <Form
408
- * rules={{ username: { required: [true, 'Username is required'] } }}
409
- * onSubmit={data => console.log(data)}
410
- * onFormStateChange={setFormState} >
411
- * <FormField name="username">
412
- * <input
413
- * name="username"
414
- * value={(formState?.values.username || '') as string}
415
- * onChange={(e) => formState?.onChange('username', { value: e.target.value })}
416
- * onBlur={() => formState?.onBlur('username')}
417
- * onFocus={() => formState?.onFocus('username')}
418
- * />
419
- * {formState?.errors?.username && (<div className="error">{formState.errors.username}</div>)}
420
- * </FormField>
421
- * <button type="submit">Submit</button>
422
- * </Form>
423
- * ```
424
- * @private
425
- */
426
- export declare const Form: React.ForwardRefExoticComponent<FormComponentProps & React.RefAttributes<IFormValidator>>;
427
- /**
428
- * Specifies the properties for the FormField component.
429
- * @private
430
- */
431
- export interface FormFieldProps {
432
- /**
433
- * Specifies the name of the field that must match a key in the rules object. This is required for proper validation.
434
- */
435
- name: string;
436
- /**
437
- * Specifies the children content for the form field. Children should include the actual form control elements like inputs, textarea, etc.
438
- */
439
- children: React.ReactNode;
440
- /**
441
- * Specifies field-level validation rules that apply only to this specific field. These rules override any form-level rules
442
- * with the same name defined in the Form component's rules. This allows for field-specific validation that takes
443
- * precedence over form-wide defaults.
444
- *
445
- * @default undefined
446
- */
447
- rules?: FieldValidationRules;
448
- }
449
- /**
450
- * Specifies a component that connects form inputs with validation rules. The FormField component provides
451
- * an easy way to integrate form controls with the Form validation system, handling state management and
452
- * validation automatically.
453
- *
454
- * ```typescript
455
- * const [formState, setFormState] = useState<FormState>();
456
- *
457
- * <Form
458
- * rules={{
459
- * username: { required: [true, 'Username is required'] }
460
- * }}
461
- * onSubmit={data => console.log(data)}
462
- * onFormStateChange={setFormState}
463
- * >
464
- * <FormField name="username">
465
- * <input
466
- * name="username"
467
- * value={formState?.values.username || ''}
468
- * onChange={(e) => formState?.onChange('username', { value: e.target.value })}
469
- * onBlur={() => formState?.onBlur('username')}
470
- * onFocus={() => formState?.onFocus('username')}
471
- * />
472
- * {formState?.touched?.username && formState?.errors?.username && (
473
- * <div className="error">{formState.errors.username}</div>
474
- * )}
475
- * </FormField>
476
- * <button type="submit">Submit</button>
477
- * </Form>
478
- * ```
479
- *
480
- * @param {IFormFieldProps} props - Specifies the form field configuration properties
481
- * @returns {React.ReactNode} - Returns the children with access to form validation context
482
- * @private
483
- */
484
- export declare const FormField: React.FC<FormFieldProps>;
485
- export {};