@progress/kendo-react-form 13.3.0-develop.9 → 13.4.0-develop.1

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/index.d.ts CHANGED
@@ -5,1037 +5,25 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { default as default_2 } from 'prop-types';
9
- import { FieldRenderPropsBase } from '@progress/kendo-react-common';
10
- import { FormClassStructure } from '@progress/kendo-react-common';
11
- import { ForwardRefExoticComponent } from 'react';
12
- import { JSX } from 'react/jsx-runtime';
13
- import * as React_2 from 'react';
14
- import { RefAttributes } from 'react';
15
-
16
- /**
17
- * Represents the Field component that is used inside the KendoReact Form component.
18
- * It uses `name` property to access field value and meta information from Form state.
19
- */
20
- export declare const Field: {
21
- (props: FieldProps & {
22
- [customProp: string]: any;
23
- }): React_2.ReactElement<any, string | React_2.JSXElementConstructor<any>> | null;
24
- displayName: string;
25
- };
26
-
27
- /**
28
- * Represents the FieldArray component that is used inside the KendoReact Form component.
29
- * It provides methods via render props for common array manipulations.
30
- */
31
- export declare const FieldArray: React_2.FunctionComponent<FieldArrayProps>;
32
-
33
- /**
34
- * Contains the props for the FieldArray component that you use inside forms.
35
- */
36
- export declare interface FieldArrayProps {
37
- /**
38
- * Sets the field name in the form state.
39
- */
40
- name: string;
41
- /**
42
- * Can be set to a React component.
43
- * [`FieldArrayRenderProps`](https://www.telerik.com/kendo-react-ui/components/form/api/fieldarrayrenderprops).
44
- */
45
- component: React.ComponentType<any>;
46
- /**
47
- * Validates the field array and returns error messages.
48
- * Only synchronous functions are supported.
49
- */
50
- validator?: FieldValidatorType | FieldValidatorType[];
51
- /**
52
- * Provides child elements that are passed to the rendered component.
53
- */
54
- children?: any;
55
- /**
56
- * @hidden
57
- */
58
- [customProp: string]: any;
59
- }
60
-
61
- /**
62
- * Contains props that are passed to components rendered inside FieldArray components.
63
- */
64
- export declare interface FieldArrayRenderProps {
65
- /**
66
- * Represents the current value of the FieldArray
67
- * ([see example](https://www.telerik.com/kendo-react-ui/components/form/custom-components#toc-using-basic-properties)).
68
- */
69
- value: any;
70
- /**
71
- * Contains the error message from validation.
72
- * The field is valid when this is empty.
73
- */
74
- validationMessage: string | null;
75
- /**
76
- * Shows whether the user has interacted with the field.
77
- * Becomes true when the field loses focus.
78
- */
79
- touched: boolean;
80
- /**
81
- * Shows whether the field value has changed from its initial value.
82
- * Becomes true when the field value changes for the first time.
83
- */
84
- modified: boolean;
85
- /**
86
- * Shows whether the user has focused on the field.
87
- * Becomes true when the field receives focus.
88
- */
89
- visited: boolean;
90
- /**
91
- * Shows whether the field passes validation and has been touched.
92
- */
93
- valid: boolean;
94
- /**
95
- * Contains child elements that are passed to the FieldArray.
96
- */
97
- children: any;
98
- /**
99
- * Contains the field name in the form state.
100
- */
101
- name: string;
102
- /**
103
- * Adds a value to the beginning of the array.
104
- */
105
- onUnshift: (options: {
106
- value: any;
107
- }) => number;
108
- /**
109
- * Adds a value to the end of the array.
110
- */
111
- onPush: (options: {
112
- value: any;
113
- }) => void;
114
- /**
115
- * Inserts a value at a specific position in the array.
116
- */
117
- onInsert: (options: {
118
- value: any;
119
- index: number;
120
- }) => void;
121
- /**
122
- * Removes and returns the last value from the array.
123
- */
124
- onPop: () => any;
125
- /**
126
- * Removes a value at a specific position in the array.
127
- */
128
- onRemove: (options: {
129
- index: number;
130
- }) => any;
131
- /**
132
- * Replaces a value at a specific position in the array.
133
- */
134
- onReplace: (options: {
135
- value: any;
136
- index: number;
137
- }) => void;
138
- /**
139
- * Moves a value from one position to another in the array.
140
- */
141
- onMove: (options: {
142
- prevIndex: number;
143
- nextIndex: number;
144
- }) => void;
145
- /**
146
- * @hidden
147
- */
148
- [customProp: string]: any;
149
- }
150
-
151
- /**
152
- * Contains the props for the Field component that you use inside forms.
153
- */
154
- export declare interface FieldProps {
155
- /**
156
- * Sets the field name in the form state.
157
- * You can use nested fields like `user.age` and `users[0].name`.
158
- *
159
- * @example
160
- * ```jsx
161
- * <Field name="user.age" component="input" />
162
- * ```
163
- */
164
- name: string;
165
- /**
166
- * Can be set to a React component or to the name of an HTML element,
167
- * for example, `input`, `select`, and `textarea`.
168
- * The props that are passed to the component are the
169
- * [`FieldRenderProps`](https://www.telerik.com/kendo-react-ui/components/form/api/fieldrenderprops).
170
- *
171
- * @example
172
- * ```jsx
173
- * <Field name="user.name" component="input" />
174
- * ```
175
- */
176
- component: string | React.ComponentType<any>;
177
- /**
178
- * Validates the field value and returns error messages.
179
- *
180
- * Only synchronous functions are supported.
181
- * Use `useMemo` to avoid infinite loops when using an array of validators.
182
- *
183
- * @example
184
- * ```jsx
185
- * const validator = value => value ? "" : "This field is required.";
186
- * <Field name="user.email" component="input" validator={validator} />
187
- * ```
188
- */
189
- validator?: FieldValidatorType | FieldValidatorType[];
190
- /**
191
- * Provides child elements that are passed to the rendered component.
192
- *
193
- * @example
194
- * ```jsx
195
- * <Field name="user.name" component="input">
196
- * <span>Additional content</span>
197
- * </Field>
198
- * ```
199
- */
200
- children?: any;
201
- /**
202
- * Sets how many columns the field spans in the form layout.
203
- */
204
- colSpan?: number | ResponsiveFormBreakPoint[];
205
- /**
206
- * Handles changes to the field value.
207
- *
208
- * Use this to update related fields. The Form automatically updates its state when this fires.
209
- *
210
- * @example
211
- * ```jsx
212
- * const handleChange = event => console.log(event);
213
- * <Field name="user.name" component="input" onChange={handleChange} />
214
- * ```
215
- */
216
- onChange?: (event: any) => void;
217
- }
218
-
219
- /**
220
- * Contains props that are passed to components rendered inside Field components.
221
- */
222
- export declare interface FieldRenderProps extends FieldRenderPropsBase {
223
- }
224
-
225
- /**
226
- * Validates a single field and returns an error message or success.
227
- *
228
- * * value - Contains the current field value
229
- * * valueGetter - Gets values from other fields using field paths like 'user.name'
230
- * * fieldProps - Contains the field's props, including the field name
231
- *
232
- * Returns a string for validation errors or undefined for successful validation.
233
- */
234
- export declare type FieldValidatorType = (value: any, valueGetter: (name: string) => any, fieldProps: {
235
- name: string;
236
- }) => string | undefined;
237
-
238
- /**
239
- * Represents the KendoReact FieldWrapper component.
240
- * It's designed to wrap the field editor, Label, Hint and Error components.
241
- * The FieldWrapper supports only single editor inside it.
242
- */
243
- export declare const FieldWrapper: React_2.FunctionComponent<FieldWrapperProps>;
244
-
245
- /**
246
- * Represents the props of the KendoReact FieldWrapper component.
247
- */
248
- export declare interface FieldWrapperProps {
249
- /**
250
- * @hidden
251
- */
252
- children: any;
253
- /**
254
- * The styles that are applied to the FieldWrapper.
255
- */
256
- style?: React_2.CSSProperties;
257
- /**
258
- * Sets a class for the FieldWrapper DOM element.
259
- */
260
- className?: string;
261
- /**
262
- * Specifies the direction of the content.
263
- */
264
- dir?: string;
265
- /**
266
- * Defines the colspan for the form field element related to the parent Form component columns. Can be a number or an array of responsive breakpoints.
267
- */
268
- colSpan?: number | ResponsiveFormBreakPoint[];
269
- /**
270
- * @hidden
271
- */
272
- unstyled?: FormClassStructure;
273
- }
274
-
275
- /** @hidden */
276
- export declare const Form: ForwardRefExoticComponent<FormProps & RefAttributes<any>>;
277
-
278
- /**
279
- * Represents the [KendoReact Form component](https://www.telerik.com/kendo-react-ui/components/form).
280
- *
281
- * @example
282
- * ```jsx
283
- * export const FormInput = (fieldRenderProps) => {
284
- * const onValueChange = React.useCallback(
285
- * (event) => fieldRenderProps.onChange(event.target.value),
286
- * [fieldRenderProps.onChange]
287
- * );
288
- * return (
289
- * <input
290
- * className={'k-input'}
291
- * value={fieldRenderProps.value}
292
- * onChange={onValueChange}
293
- * />
294
- * );
295
- * };
296
- *
297
- * export const App = () => {
298
- * const handleSubmit = (dataItem) => alert(JSON.stringify(dataItem));
299
- * return (
300
- * <Form
301
- * initialValues={{title: ''}}
302
- * onSubmit={handleSubmit}
303
- * render={(formRenderProps) => (
304
- * <div>
305
- * <Field name={'title'} component={FormInput} />
306
- * <Button
307
- * disabled={!formRenderProps.allowSubmit}
308
- * onClick={formRenderProps.onSubmit}
309
- * >
310
- * Submit
311
- * </Button>
312
- * </div>
313
- * )}
314
- * />
315
- * );
316
- * };
317
- * ```
318
- */
319
- export declare class FormClassComponent extends React_2.Component<FormProps, {}> {
320
- /**
321
- * @hidden
322
- */
323
- static displayName: string;
324
- /**
325
- * @hidden
326
- */
327
- static propTypes: {
328
- initialValues: default_2.Requireable<any>;
329
- onSubmit: default_2.Requireable<(...args: any[]) => any>;
330
- onSubmitClick: default_2.Requireable<(...args: any[]) => any>;
331
- render: default_2.Validator<(...args: any[]) => any>;
332
- id: default_2.Requireable<string>;
333
- };
334
- private _key?;
335
- private _touched;
336
- private _visited;
337
- private _modified;
338
- private _validatorsByField;
339
- private _values;
340
- private _fields;
341
- private _unmounted;
342
- private _submitted;
343
- private readonly showLicenseWatermark;
344
- private readonly licenseMessage?;
345
- /**
346
- * @hidden
347
- */
348
- private _accumulatorTimeout;
349
- /**
350
- * @hidden
351
- */
352
- get touched(): KeyValue<boolean>;
353
- /**
354
- * @hidden
355
- */
356
- set touched(value: KeyValue<boolean>);
357
- /**
358
- * @hidden
359
- */
360
- get visited(): KeyValue<boolean>;
361
- /**
362
- * @hidden
363
- */
364
- set visited(value: KeyValue<boolean>);
365
- /**
366
- * @hidden
367
- */
368
- get modified(): KeyValue<boolean>;
369
- /**
370
- * @hidden
371
- */
372
- set modified(value: KeyValue<boolean>);
373
- /**
374
- * @hidden
375
- */
376
- get validatorsByField(): KeyValue<(FieldValidatorType | FieldValidatorType[] | undefined)[]>;
377
- /**
378
- * @hidden
379
- */
380
- set validatorsByField(value: KeyValue<(FieldValidatorType | FieldValidatorType[] | undefined)[]>);
381
- /**
382
- * @hidden
383
- */
384
- get values(): KeyValue<any>;
385
- /**
386
- * @hidden
387
- */
388
- set values(value: KeyValue<any>);
389
- /**
390
- * @hidden
391
- */
392
- get fields(): string[];
393
- /**
394
- * @hidden
395
- */
396
- get formErrors(): KeyValue<string> | undefined;
397
- /**
398
- * @hidden
399
- */
400
- get errors(): KeyValue<string>;
401
- /**
402
- * @hidden
403
- */
404
- constructor(props: FormProps);
405
- /**
406
- * @hidden
407
- */
408
- componentWillUnmount(): void;
409
- /**
410
- * @hidden
411
- */
412
- isValid: () => boolean;
413
- /**
414
- * @hidden
415
- */
416
- accumulatedForceUpdate: () => void;
417
- /**
418
- * @hidden
419
- */
420
- resetForm: () => void;
421
- /**
422
- * Method for resetting the form state outside the form component.
423
- *
424
- * > Use `onReset` only if you cannot achieve the desired behavior through the Field component or by FormRenderProps.
425
- */
426
- onReset: () => void;
427
- /**
428
- * @hidden
429
- */
430
- addField: (field: string) => void;
431
- /**
432
- * @hidden
433
- */
434
- onSubmit: (event: React_2.SyntheticEvent<any>) => void;
435
- /**
436
- * Method for emiting changes to a specific field outside the form component.
437
- *
438
- * > Use `onChange` only if you cannot achieve the desired behavior through the Field component by FormRenderProps.
439
- */
440
- onChange: (name: string, options: {
441
- value: any;
442
- }) => void;
443
- /**
444
- * @hidden
445
- */
446
- onFocus: (name: string, skipForceUpdate?: boolean) => void;
447
- /**
448
- * @hidden
449
- */
450
- onBlur: (name: string, skipForceUpdate?: boolean) => void;
451
- /**
452
- * @hidden
453
- */
454
- onFieldRegister: (name: string, validator: FieldValidatorType | FieldValidatorType[] | undefined) => () => void;
455
- /**
456
- * @hidden
457
- */
458
- isFormValid: (errors: KeyValue<any>) => boolean;
459
- /**
460
- * @hidden
461
- */
462
- isFormModified: (modified: KeyValue<boolean>, fields: string[]) => boolean;
463
- /**
464
- * @hidden
465
- */
466
- isFormHasNotTouched: (touched: KeyValue<boolean>, fields: string[]) => boolean;
467
- /**
468
- * @hidden
469
- */
470
- isFormTouched: (touched: KeyValue<boolean>, fields: string[]) => boolean;
471
- /**
472
- * @hidden
473
- */
474
- isFormVisited: (visited: KeyValue<boolean>, fields: string[]) => boolean;
475
- /**
476
- * @hidden
477
- */
478
- valueGetter: (fieldName: string) => any;
479
- /**
480
- * @hidden
481
- */
482
- valueSetter: (fieldName: string, value: any) => any;
483
- /**
484
- * @hidden
485
- */
486
- onArrayAction: (name: string) => void;
487
- /**
488
- * @hidden
489
- */
490
- onInsert: (name: string, options: {
491
- value: any;
492
- index: number;
493
- }) => void;
494
- /**
495
- * @hidden
496
- */
497
- onUnshift: (name: string, options: {
498
- value: any;
499
- }) => void;
500
- /**
501
- * @hidden
502
- */
503
- onPush: (name: string, options: {
504
- value: any;
505
- }) => void;
506
- /**
507
- * @hidden
508
- */
509
- onPop: (name: string) => any;
510
- /**
511
- * @hidden
512
- */
513
- onRemove: (name: string, options: {
514
- index: number;
515
- }) => any;
516
- /**
517
- * @hidden
518
- */
519
- onReplace: (name: string, options: {
520
- value: any;
521
- index: number;
522
- }) => void;
523
- /**
524
- * @hidden
525
- */
526
- onMove: (name: string, options: {
527
- prevIndex: number;
528
- nextIndex: number;
529
- }) => void;
530
- /**
531
- * @hidden
532
- */
533
- render(): JSX.Element;
534
- }
535
-
536
- /**
537
- * Represents the KendoReact FormElement component.
538
- * It's small wrapper around HTML form element which automatically attach the
539
- * Form component's `onSubmit` render prop and Kendo CSS classes.
540
- * Other props are passed to the DOM node.
541
- */
542
- export declare const FormElement: React_2.FunctionComponent<FormElementProps>;
543
-
544
- /**
545
- * Represent the `ref` of the FormElement component.
546
- */
547
- export declare interface FormElementHandle {
548
- /**
549
- * Represents the props of the FormElement component.
550
- */
551
- props: FormElementProps;
552
- /**
553
- * Represents the element of the FormElement component.
554
- */
555
- element: HTMLFormElement | null;
556
- }
557
-
558
- /**
559
- * Represents the props of the KendoReact FormElement component.
560
- */
561
- export declare interface FormElementProps {
562
- /**
563
- * @hidden
564
- */
565
- children?: any;
566
- /**
567
- * The styles that are applied to the form DOM element.
568
- */
569
- style?: React_2.CSSProperties;
570
- /**
571
- * Sets a class for the form DOM element.
572
- */
573
- className?: string;
574
- /**
575
- * If set to `true` enable the horizontal layout of the form editors.
576
- */
577
- horizontal?: boolean;
578
- /**
579
- * Sets the id of the form DOM element. Takes priority over the Form's id.
580
- */
581
- id?: string;
582
- /**
583
- * Defines the number of columns in the form. Can be a number or an array of responsive breakpoints.
584
- */
585
- cols?: number | ResponsiveFormBreakPoint[];
586
- /**
587
- * Defines the gutters for the form. You can specify gutters for rows and columns. Number is equivalent to px.
588
- */
589
- gutters?: string | number | Gutters | ResponsiveFormBreakPoint[];
590
- /**
591
- * @hidden
592
- */
593
- [customProp: string]: any;
594
- /**
595
- * Configures the `size` of the Form.
596
- *
597
- * The available options are:
598
- * - small
599
- * - medium
600
- * - large
601
- * - null&mdash;Does not set a size `className`.
602
- *
603
- * @default `medium`
604
- */
605
- size?: null | 'small' | 'medium' | 'large';
606
- /**
607
- * @hidden
608
- */
609
- unstyled?: FormClassStructure;
610
- }
611
-
612
- /**
613
- * Represents the KendoReact FormFieldSet component.
614
- */
615
- export declare const FormFieldSet: React_2.FunctionComponent<FormFieldSetProps>;
616
-
617
- /**
618
- * Represent the `ref` of the FormFieldSet component.
619
- */
620
- export declare interface FormFieldSetHandle {
621
- /**
622
- * Represents the props of the FormFieldSet component.
623
- */
624
- props: FormFieldSetProps;
625
- /**
626
- * Represents the element of the FormFieldSet component.
627
- */
628
- element: HTMLFieldSetElement | null;
629
- }
630
-
631
- /**
632
- * Represents the props of the KendoReact FormFieldSet component.
633
- */
634
- export declare interface FormFieldSetProps {
635
- /**
636
- * Defines the number of columns of the fieldset. Can be a number or an array of responsive breakpoints.
637
- */
638
- cols?: number | ResponsiveFormBreakPoint[];
639
- /**
640
- * Defines the colspan for the fieldset related to the parent Form component columns. Can be a number or an array of responsive breakpoints.
641
- */
642
- colSpan?: number | ResponsiveFormBreakPoint[];
643
- /**
644
- * Defines the gutters for the fieldset. You can specify gutters for rows and columns. Number is equivalent to px.
645
- */
646
- gutters?: string | number | Gutters | ResponsiveFormBreakPoint[];
647
- /**
648
- * Defines the legend for the fieldset.
649
- */
650
- legend?: string;
651
- /**
652
- * @hidden
653
- */
654
- children?: any;
655
- /**
656
- * The styles that are applied to the form DOM element.
657
- */
658
- style?: React_2.CSSProperties;
659
- /**
660
- * Sets a class for the form DOM element.
661
- */
662
- className?: string;
663
- }
664
-
665
- /**
666
- * Represent the `ref` of the Form component.
667
- */
668
- export declare interface FormHandle extends Pick<FormClassComponent, keyof FormClassComponent> {
669
- }
670
-
671
- /**
672
- * Contains the props for the KendoReact Form component.
673
- */
674
- export declare interface FormProps {
675
- /**
676
- * Sets the starting values for form fields.
677
- *
678
- * Set initial values to prevent errors when switching from uncontrolled to controlled mode.
679
- *
680
- * @example
681
- * ```jsx
682
- * const initialValues = { user: { name: '', age: 0 } };
683
- * <Form initialValues={initialValues} render={props => <form>form content</form>} />
684
- * ```
685
- */
686
- initialValues?: {
687
- [name: string]: any;
688
- };
689
- /**
690
- * Validation errors that override field and form validators.
691
- *
692
- * Provides validation errors directly as an object, unlike the validator prop which expects a callback.
693
- * When both validator and errors exist for a field, the errors prop takes precedence.
694
- *
695
- * @example
696
- * ```jsx
697
- * const [errors, setErrors] = useState({});
698
- * const handleSubmit = async (data) => {
699
- * const response = await submitToServer(data);
700
- * if (response.errors) {
701
- * setErrors(response.errors);
702
- * }
703
- * };
704
- * <Form errors={errors} onSubmit={handleSubmit} render={props => <FormElement>form content</FormElement>} />
705
- * ```
706
- */
707
- errors?: {
708
- [name: string]: string;
709
- };
710
- /**
711
- * Fires each time any field value changes.
712
- *
713
- * The third parameter `valueGetter` allows accessing other field values, useful for cross-field validation or clearing related errors.
714
- *
715
- * @example
716
- * ```jsx
717
- * const handleChange = (fieldName, value, valueGetter) => {
718
- * // For nested fields like 'user.name', access related fields like 'user.email'
719
- * if (fieldName === 'user.name') {
720
- * const email = valueGetter('user.email');
721
- * console.log('Name changed:', value, 'Email is:', email);
722
- * }
723
- * // Clear error for the changed field
724
- * if (formErrors[fieldName]) {
725
- * setFormErrors(prev => ({ ...prev, [fieldName]: '' }));
726
- * }
727
- * };
728
- * <Form errors={formErrors} onChange={handleChange} render={props => <FormElement>form content</FormElement>} />
729
- * ```
730
- */
731
- onChange?: (fieldName: string, value: any, valueGetter: (name: string) => any) => void;
732
- /**
733
- * Validates the entire form and returns error messages.
734
- *
735
- * Return a key-value pair where the key is the field path and the value is the error message.
736
- * You can validate nested fields like 'users[0].name'.
737
- * Only synchronous functions are supported.
738
- *
739
- * @example
740
- * ```jsx
741
- * const validator = values => ({ user: { name: values.user.name ? "" : "Name is required." } });
742
- * <Form validator={validator} render={props => <form> form content </form>} />
743
- * ```
744
- */
745
- validator?: FormValidatorType;
746
- /**
747
- * Handles form submission when validation passes and fields are modified.
748
- *
749
- * Fires when at least one field is modified, the user clicks Submit, and validation passes.
750
- *
751
- * @example
752
- * ```jsx
753
- * const handleSubmit = (values, event) => console.log(values);
754
- * <Form onSubmit={handleSubmit} render={props => <form> form content </form>} />
755
- * ```
756
- */
757
- onSubmit?: (values: {
758
- [name: string]: any;
759
- }, event?: React.SyntheticEvent<any>) => void;
760
- /**
761
- * Handles every submit button click, even when the form is invalid or unchanged.
762
- *
763
- * Use this for advanced scenarios where you need to handle all submit events.
764
- *
765
- * @example
766
- * ```jsx
767
- * const handleSubmitClick = event => console.log(event);
768
- * <Form onSubmitClick={handleSubmitClick} render={props => <form> form content </form>} />
769
- * ```
770
- */
771
- onSubmitClick?: (event: FormSubmitClickEvent) => void;
772
- /**
773
- * Renders the form content using the provided render function.
774
- *
775
- * @example
776
- * ```jsx
777
- * const renderForm = props => <form> form content </form>;
778
- * <Form render={renderForm} />
779
- * ```
780
- */
781
- render: (props: FormRenderProps) => any;
782
- /**
783
- * Allows the form to submit even when no fields have been modified.
784
- *
785
- * @example
786
- * ```jsx
787
- * <Form ignoreModified={true} render={props => <form>form content </form>} />
788
- * ```
789
- */
790
- ignoreModified?: boolean;
791
- /**
792
- * @hidden
793
- * This prop comes from the `withId` HOC and is used internally by the Form.
794
- * It replaces the previously used guid() function and generates an `id` of the Form.
795
- */
796
- id?: string;
797
- }
798
-
799
- /**
800
- * Contains props that are passed to the form's render function.
801
- */
802
- export declare interface FormRenderProps {
803
- /**
804
- * Submits the form when called.
805
- * Use this with the onClick property of Submit buttons.
806
- *
807
- * @example
808
- * ```jsx
809
- * const handleSubmit = event => console.log("Form submitted");
810
- * <Button onClick={props.onSubmit}>Submit</Button>
811
- * ```
812
- */
813
- onSubmit: (event: React.SyntheticEvent<any>) => void;
814
- /**
815
- * A callback for emitting changes to a specific field without using the Field component
816
- * ([see example](https://www.telerik.com/kendo-react-ui/components/form/advanced-scenarios#toc-changing-the-field-value)).
817
- *
818
- * > Use `onChange` only if you cannot achieve the desired behavior through the Field component.
819
- *
820
- * @example
821
- * ```jsx
822
- * props.onChange("user.name", { value: "John Doe" });
823
- * ```
824
- */
825
- onChange: (name: string, options: {
826
- value: any;
827
- }) => void;
828
- /**
829
- * Resets the form to its initial state.
830
- *
831
- * @example
832
- * ```jsx
833
- * <Button onClick={props.onFormReset}>Reset</Button>
834
- * ```
835
- */
836
- onFormReset: () => void;
837
- /**
838
- * Contains current validation errors organized by field path.
839
- *
840
- * @example
841
- * ```jsx
842
- * console.log(props.errors);
843
- * ```
844
- */
845
- errors: KeyValue<string>;
846
- /**
847
- * Shows whether the form passes all validation rules.
848
- * Becomes false if any field fails validation.
849
- *
850
- * @example
851
- * ```jsx
852
- * console.log(props.valid);
853
- * ```
854
- */
855
- valid: boolean;
856
- /**
857
- * Shows whether the user has interacted with any field.
858
- * Becomes true when any field loses focus or the user tries to submit.
859
- *
860
- * @example
861
- * ```jsx
862
- * console.log(props.touched);
863
- * ```
864
- */
865
- touched: boolean;
866
- /**
867
- * Shows whether the user has focused on any field.
868
- * Becomes true when any field receives focus or the user tries to submit.
869
- *
870
- * @example
871
- * ```jsx
872
- * console.log(props.visited);
873
- * ```
874
- */
875
- visited: boolean;
876
- /**
877
- * Shows whether any field value has changed from its initial value.
878
- * Becomes true when any field value changes for the first time.
879
- *
880
- * @example
881
- * ```jsx
882
- * console.log(props.modified);
883
- * ```
884
- */
885
- modified: boolean;
886
- /**
887
- * Shows whether the form has been successfully submitted.
888
- * Use this to detect if the user is leaving before saving changes.
889
- *
890
- * @example
891
- * ```jsx
892
- * console.log(props.submitted);
893
- * ```
894
- */
895
- submitted: boolean;
896
- /**
897
- * Shows whether the form can be submitted.
898
- * When true and form is valid, you can submit. When true and form is invalid, you can show all validation errors.
899
- *
900
- * Use this to control the disabled state of Submit buttons.
901
- *
902
- * @example
903
- * ```jsx
904
- * console.log(props.allowSubmit);
905
- * ```
906
- */
907
- allowSubmit: boolean;
908
- /**
909
- * A callback for getting the value of a field without using the Field component
910
- * ([see example](https://www.telerik.com/kendo-react-ui/components/form/advanced-scenarios#toc-reading-the-field-state)).
911
- * Useful for creating and modifying the UI based on the field values.
912
- *
913
- * @example
914
- * ```jsx
915
- * const value = props.valueGetter("user.name");
916
- * console.log(value);
917
- * ```
918
- */
919
- valueGetter: (name: string) => any;
920
- }
921
-
922
- /**
923
- * Represents the KendoReact FormSeparator component.
924
- */
925
- export declare const FormSeparator: React_2.FunctionComponent<FormSeparatorProps>;
926
-
927
- /**
928
- * Represent the `ref` of the FormSeparator component.
929
- */
930
- export declare interface FormSeparatorHandle {
931
- /**
932
- * Represents the props of the FormSeparator component.
933
- */
934
- props: FormSeparatorProps;
935
- /**
936
- * Represents the element of the FormSeparator component.
937
- */
938
- element: HTMLSpanElement | null;
939
- }
940
-
941
- /**
942
- * Represents the props of the KendoReact FormSeparator component.
943
- */
944
- export declare interface FormSeparatorProps {
945
- /**
946
- * Defines the colspan for the separator element related to the parent Form component columns. Can be a number or an array of responsive breakpoints.
947
- */
948
- colSpan?: number | ResponsiveFormBreakPoint[];
949
- /**
950
- * @hidden
951
- */
952
- children?: any;
953
- /**
954
- * The styles that are applied to the form DOM element.
955
- */
956
- style?: React_2.CSSProperties;
957
- /**
958
- * Sets a class for the form DOM element.
959
- */
960
- className?: string;
961
- }
962
-
963
- /**
964
- * Contains data for the form submit click event.
965
- */
966
- export declare interface FormSubmitClickEvent {
967
- /**
968
- * Provides the current values from all form fields.
969
- */
970
- values: {
971
- [name: string]: any;
972
- };
973
- /**
974
- * Contains the original browser event that triggered the submit.
975
- */
976
- event?: React.SyntheticEvent<any>;
977
- /**
978
- * Shows whether the form passes all validation rules.
979
- */
980
- isValid: boolean;
981
- /**
982
- * Shows whether any form fields have been changed from their initial values.
983
- */
984
- isModified: boolean;
985
- }
986
-
987
- /**
988
- * Validates an entire form and returns error messages.
989
- *
990
- * * values - Contains the current values from all form fields
991
- * * valueGetter - Gets field values using field paths like 'user.name'
992
- *
993
- * Returns a key-value pair where the key is the field path and the value is the error message.
994
- */
995
- export declare type FormValidatorType = (values: any, valueGetter: (name: string) => any) => KeyValue<string> | undefined;
996
-
997
- /**
998
- * Represents the [gutters](https://developer.mozilla.org/en-US/docs/Web/CSS/gap) configuration for a form layout.
999
- * It allows defining the spacing between the columns and rows of the form.
1000
- * Each property can be a number or an array of responsive breakpoints.
1001
- */
1002
- export declare interface Gutters {
1003
- /**
1004
- * Defines the gutters for the columns in the form.
1005
- * Can be a number or an array of responsive breakpoints.
1006
- */
1007
- cols?: string | number | ResponsiveFormBreakPoint[];
1008
- /**
1009
- * Defines the gutters for the rows in the form.
1010
- * Can be a number or an array of responsive breakpoints.
1011
- */
1012
- rows?: string | number | ResponsiveFormBreakPoint[];
1013
- }
1014
-
1015
- /**
1016
- * Represents a key-value pair collection where keys are strings.
1017
- */
1018
- export declare interface KeyValue<ValueType> {
1019
- [name: string]: ValueType;
1020
- }
1021
-
1022
- /**
1023
- * Defines responsive breakpoints for form layouts.
1024
- * Each breakpoint sets minimum and maximum widths and values for columns or spacing at different screen sizes.
1025
- */
1026
- export declare interface ResponsiveFormBreakPoint {
1027
- /**
1028
- * Sets the minimum screen width in pixels for this breakpoint.
1029
- */
1030
- minWidth?: number;
1031
- /**
1032
- * Sets the maximum screen width in pixels for this breakpoint.
1033
- */
1034
- maxWidth?: number;
1035
- /**
1036
- * Sets the number of columns or spacing for form controls at this screen size.
1037
- */
1038
- value: number | string;
1039
- }
1040
-
1041
- export { }
8
+ import { FieldProps } from './interfaces/FieldProps.js';
9
+ import { FieldRenderProps } from './interfaces/FieldRenderProps.js';
10
+ import { FormProps } from './interfaces/FormProps.js';
11
+ import { FormRenderProps } from './interfaces/FormRenderProps.js';
12
+ import { Field } from './Field.js';
13
+ import { Form as FormClassComponent, FormHandle } from './Form.js';
14
+ import { FormValidatorType } from './interfaces/FormValidator.js';
15
+ import { FieldValidatorType } from './interfaces/FieldValidator.js';
16
+ import { FieldArray } from './FieldArray.js';
17
+ import { FieldArrayProps } from './interfaces/FieldArrayProps.js';
18
+ import { FieldArrayRenderProps } from './interfaces/FieldArrayRenderProps.js';
19
+ import { KeyValue } from './interfaces/KeyValue.js';
20
+ import { FieldWrapper, FieldWrapperProps } from './FieldWrapper.js';
21
+ import { FormElement, FormElementProps, FormElementHandle } from './FormElement.js';
22
+ import { FormSubmitClickEvent } from './interfaces/FormSubmitClickEvent.js';
23
+ import { FormSeparator, FormSeparatorProps, FormSeparatorHandle } from './FormSeparator.js';
24
+ import { FormFieldSet, FormFieldSetProps, FormFieldSetHandle } from './FormFieldSet.js';
25
+ import { ResponsiveFormBreakPoint } from './interfaces/ResponsiveFormBreakPoint.js';
26
+ import { Gutters } from './interfaces/Gutters.js';
27
+ /** @hidden */
28
+ declare const Form: import('react').ForwardRefExoticComponent<FormProps & import('react').RefAttributes<any>>;
29
+ export { FieldArray, FieldArrayProps, FieldArrayRenderProps, Field, FieldProps, FieldRenderProps, Form, FormClassComponent, FormHandle, FormProps, FormRenderProps, FormValidatorType, FieldValidatorType, KeyValue, FieldWrapper, FieldWrapperProps, FormElement, FormElementHandle, FormElementProps, FormSubmitClickEvent, FormSeparator, FormSeparatorProps, FormSeparatorHandle, FormFieldSet, FormFieldSetProps, FormFieldSetHandle, ResponsiveFormBreakPoint, Gutters };