dynamic-formik-form 1.0.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/README.md +810 -0
- package/dist/index.d.mts +952 -0
- package/dist/index.d.ts +952 -0
- package/dist/index.js +3666 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3611 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +72 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,952 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { FormikProps, FormikValues } from 'formik';
|
|
3
|
+
import { ObjectSchema } from 'yup';
|
|
4
|
+
import React$1, { ComponentType, ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Icon component interface
|
|
8
|
+
* Allows any icon library to be used
|
|
9
|
+
*/
|
|
10
|
+
type IconComponent = ComponentType<{
|
|
11
|
+
className?: string;
|
|
12
|
+
size?: string | number;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Icon library configuration
|
|
17
|
+
*/
|
|
18
|
+
interface IconLibrary {
|
|
19
|
+
Info: IconComponent;
|
|
20
|
+
Visibility: IconComponent;
|
|
21
|
+
VisibilityOff: IconComponent;
|
|
22
|
+
Copy: IconComponent;
|
|
23
|
+
Add: IconComponent;
|
|
24
|
+
Delete: IconComponent;
|
|
25
|
+
[key: string]: IconComponent;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Base UI component props that all UI libraries must support
|
|
29
|
+
*/
|
|
30
|
+
interface BaseUIComponentProps {
|
|
31
|
+
className?: string;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
required?: boolean;
|
|
34
|
+
error?: boolean;
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* UI Library Adapter Interface
|
|
39
|
+
* Each UI library (MUI, Bootstrap, etc.) must implement this interface
|
|
40
|
+
*/
|
|
41
|
+
interface UILibraryAdapter {
|
|
42
|
+
Input: ComponentType<BaseUIComponentProps & {
|
|
43
|
+
type?: string;
|
|
44
|
+
name: string;
|
|
45
|
+
value: string | number;
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
48
|
+
onBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
49
|
+
autoComplete?: string;
|
|
50
|
+
readOnly?: boolean;
|
|
51
|
+
}>;
|
|
52
|
+
Textarea: ComponentType<BaseUIComponentProps & {
|
|
53
|
+
name: string;
|
|
54
|
+
value: string;
|
|
55
|
+
placeholder?: string;
|
|
56
|
+
rows?: number;
|
|
57
|
+
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
58
|
+
onBlur: (e: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
59
|
+
}>;
|
|
60
|
+
Select: ComponentType<BaseUIComponentProps & {
|
|
61
|
+
name: string;
|
|
62
|
+
value: string | number;
|
|
63
|
+
onChange: (e: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
64
|
+
onBlur: (e: React.FocusEvent<HTMLSelectElement>) => void;
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
}>;
|
|
67
|
+
Checkbox: ComponentType<BaseUIComponentProps & {
|
|
68
|
+
name: string;
|
|
69
|
+
checked: boolean;
|
|
70
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
71
|
+
label?: ReactNode;
|
|
72
|
+
}>;
|
|
73
|
+
Radio: ComponentType<BaseUIComponentProps & {
|
|
74
|
+
name: string;
|
|
75
|
+
value: string | number;
|
|
76
|
+
checked: boolean;
|
|
77
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
78
|
+
label?: ReactNode;
|
|
79
|
+
}>;
|
|
80
|
+
Switch: ComponentType<BaseUIComponentProps & {
|
|
81
|
+
name: string;
|
|
82
|
+
checked: boolean;
|
|
83
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
84
|
+
}>;
|
|
85
|
+
Button: ComponentType<BaseUIComponentProps & {
|
|
86
|
+
type?: 'button' | 'submit' | 'reset';
|
|
87
|
+
onClick?: () => void;
|
|
88
|
+
children: ReactNode;
|
|
89
|
+
variant?: string;
|
|
90
|
+
}>;
|
|
91
|
+
FormControl: ComponentType<{
|
|
92
|
+
className?: string;
|
|
93
|
+
required?: boolean;
|
|
94
|
+
error?: boolean;
|
|
95
|
+
children: ReactNode;
|
|
96
|
+
}>;
|
|
97
|
+
FormHelperText: ComponentType<{
|
|
98
|
+
className?: string;
|
|
99
|
+
children: ReactNode;
|
|
100
|
+
}>;
|
|
101
|
+
Label: ComponentType<{
|
|
102
|
+
htmlFor?: string;
|
|
103
|
+
className?: string;
|
|
104
|
+
children: ReactNode;
|
|
105
|
+
}>;
|
|
106
|
+
Box: ComponentType<{
|
|
107
|
+
className?: string;
|
|
108
|
+
sx?: Record<string, unknown>;
|
|
109
|
+
children?: ReactNode;
|
|
110
|
+
[key: string]: unknown;
|
|
111
|
+
}>;
|
|
112
|
+
Paper: ComponentType<{
|
|
113
|
+
className?: string;
|
|
114
|
+
elevation?: number;
|
|
115
|
+
children: ReactNode;
|
|
116
|
+
}>;
|
|
117
|
+
Popover: ComponentType<{
|
|
118
|
+
open: boolean;
|
|
119
|
+
anchorEl: HTMLElement | null;
|
|
120
|
+
onClose: () => void;
|
|
121
|
+
anchorOrigin?: {
|
|
122
|
+
vertical: string;
|
|
123
|
+
horizontal: string;
|
|
124
|
+
};
|
|
125
|
+
children: ReactNode;
|
|
126
|
+
}>;
|
|
127
|
+
MenuItem: ComponentType<{
|
|
128
|
+
className?: string;
|
|
129
|
+
onClick: () => void;
|
|
130
|
+
children: ReactNode;
|
|
131
|
+
}>;
|
|
132
|
+
Typography: ComponentType<{
|
|
133
|
+
className?: string;
|
|
134
|
+
variant?: string;
|
|
135
|
+
color?: string;
|
|
136
|
+
children: ReactNode;
|
|
137
|
+
}>;
|
|
138
|
+
IconButton: ComponentType<{
|
|
139
|
+
className?: string;
|
|
140
|
+
size?: 'small' | 'medium' | 'large';
|
|
141
|
+
onClick?: () => void;
|
|
142
|
+
children: ReactNode;
|
|
143
|
+
[key: string]: unknown;
|
|
144
|
+
}>;
|
|
145
|
+
DatePicker?: ComponentType<{
|
|
146
|
+
value: unknown;
|
|
147
|
+
onChange: (value: unknown) => void;
|
|
148
|
+
format?: string;
|
|
149
|
+
disabled?: boolean;
|
|
150
|
+
[key: string]: unknown;
|
|
151
|
+
}>;
|
|
152
|
+
DateTimePicker?: ComponentType<{
|
|
153
|
+
value: unknown;
|
|
154
|
+
onChange: (value: unknown) => void;
|
|
155
|
+
format?: string;
|
|
156
|
+
disabled?: boolean;
|
|
157
|
+
views?: string[];
|
|
158
|
+
[key: string]: unknown;
|
|
159
|
+
}>;
|
|
160
|
+
TextField?: ComponentType<{
|
|
161
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
162
|
+
inputProps?: Record<string, unknown>;
|
|
163
|
+
label?: string;
|
|
164
|
+
id?: string;
|
|
165
|
+
error?: boolean;
|
|
166
|
+
helperText?: string;
|
|
167
|
+
[key: string]: unknown;
|
|
168
|
+
}>;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* UI Library configuration
|
|
172
|
+
*/
|
|
173
|
+
interface UILibraryConfig {
|
|
174
|
+
adapter: UILibraryAdapter;
|
|
175
|
+
icons?: IconLibrary;
|
|
176
|
+
name: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Field type definitions matching production code
|
|
181
|
+
*/
|
|
182
|
+
type FieldType = 'inputfield' | 'editablediv' | 'multiSelect' | 'singleSelect' | 'asyncSelect' | 'fieldArray' | 'emptyField' | 'attribute' | 'toggle' | 'component' | 'link' | 'radiobtn' | 'textarea' | 'checkbox' | 'text' | 'fileupload' | 'dropdown' | 'delete' | 'dateTimePicker' | 'counter' | 'custom' | 'datePicker';
|
|
183
|
+
/**
|
|
184
|
+
* Base field configuration shared by all field types
|
|
185
|
+
*/
|
|
186
|
+
interface BaseFieldConfig {
|
|
187
|
+
name: string;
|
|
188
|
+
type: FieldType;
|
|
189
|
+
label?: string;
|
|
190
|
+
placeholder?: string;
|
|
191
|
+
desc?: string;
|
|
192
|
+
info?: string;
|
|
193
|
+
required?: boolean;
|
|
194
|
+
disabled?: boolean;
|
|
195
|
+
hidden?: boolean;
|
|
196
|
+
readonly?: boolean;
|
|
197
|
+
customClass?: string;
|
|
198
|
+
customLabelClass?: string;
|
|
199
|
+
customComponentClass?: string;
|
|
200
|
+
customDescClass?: string;
|
|
201
|
+
customAttrClass?: string;
|
|
202
|
+
dataTestId?: string;
|
|
203
|
+
noIndent?: boolean;
|
|
204
|
+
showOptional?: boolean;
|
|
205
|
+
isButtonVisible?: boolean;
|
|
206
|
+
showCustomError?: boolean;
|
|
207
|
+
shouldHide?: (params: {
|
|
208
|
+
formik: FormikProps<Record<string, unknown>>;
|
|
209
|
+
name: string;
|
|
210
|
+
index?: number;
|
|
211
|
+
}) => boolean;
|
|
212
|
+
child?: FieldConfig[];
|
|
213
|
+
hiddenlabel?: string;
|
|
214
|
+
targetType?: string;
|
|
215
|
+
component?: ReactNode;
|
|
216
|
+
blockComponent?: ReactNode;
|
|
217
|
+
customHandleChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>, type: string, index?: number) => void;
|
|
218
|
+
customFormChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>, type: string) => void;
|
|
219
|
+
onBlur?: (e: React.FocusEvent) => void;
|
|
220
|
+
onClickLink?: () => void;
|
|
221
|
+
isVisibleEnable?: boolean;
|
|
222
|
+
isCopyEnable?: boolean;
|
|
223
|
+
customIcon?: ReactNode;
|
|
224
|
+
ref?: React.Ref<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>;
|
|
225
|
+
formik?: FormikProps<Record<string, unknown>>;
|
|
226
|
+
index?: number | string;
|
|
227
|
+
isChild?: boolean;
|
|
228
|
+
setFieldValuesRecursive?: (child: FieldConfig[], parentValue?: string) => void;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Input field specific configuration
|
|
232
|
+
*/
|
|
233
|
+
interface InputFieldConfig extends BaseFieldConfig {
|
|
234
|
+
type: 'inputfield';
|
|
235
|
+
fieldType?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url';
|
|
236
|
+
autocomplete?: string;
|
|
237
|
+
min?: number;
|
|
238
|
+
max?: number;
|
|
239
|
+
suffix?: string;
|
|
240
|
+
ignoreChar?: boolean;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Select field specific configuration
|
|
244
|
+
*/
|
|
245
|
+
interface SelectFieldConfig extends BaseFieldConfig {
|
|
246
|
+
type: 'singleSelect' | 'multiSelect' | 'asyncSelect' | 'dropdown';
|
|
247
|
+
values?: Array<{
|
|
248
|
+
value: string | number;
|
|
249
|
+
label: string;
|
|
250
|
+
desc?: string;
|
|
251
|
+
}> | Record<string, string>;
|
|
252
|
+
isSearchable?: boolean;
|
|
253
|
+
isMulti?: boolean;
|
|
254
|
+
loaderCall?: (inputValue: string) => Promise<{
|
|
255
|
+
apps: unknown[];
|
|
256
|
+
error?: string;
|
|
257
|
+
}>;
|
|
258
|
+
headerKey?: string;
|
|
259
|
+
optionsLabel?: boolean;
|
|
260
|
+
disabledDropdownOption?: boolean;
|
|
261
|
+
disabledOptionText?: string;
|
|
262
|
+
searchField?: string;
|
|
263
|
+
resetChild?: boolean;
|
|
264
|
+
ignoreChar?: boolean;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Checkbox field configuration
|
|
268
|
+
*/
|
|
269
|
+
interface CheckboxFieldConfig extends BaseFieldConfig {
|
|
270
|
+
type: 'checkbox';
|
|
271
|
+
values?: Record<string, string>;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Radio field configuration
|
|
275
|
+
*/
|
|
276
|
+
interface RadioFieldConfig extends BaseFieldConfig {
|
|
277
|
+
type: 'radiobtn';
|
|
278
|
+
values?: Record<string, string>;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Textarea field configuration
|
|
282
|
+
*/
|
|
283
|
+
interface TextareaFieldConfig extends BaseFieldConfig {
|
|
284
|
+
type: 'textarea';
|
|
285
|
+
rows?: number;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* File upload field configuration
|
|
289
|
+
*/
|
|
290
|
+
interface FileUploadFieldConfig extends BaseFieldConfig {
|
|
291
|
+
type: 'fileupload';
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Date picker field configuration
|
|
295
|
+
*/
|
|
296
|
+
interface DatePickerFieldConfig extends BaseFieldConfig {
|
|
297
|
+
type: 'datePicker' | 'dateTimePicker';
|
|
298
|
+
dateFormat?: string;
|
|
299
|
+
disablePast?: boolean;
|
|
300
|
+
views?: string[];
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Field array configuration
|
|
304
|
+
*/
|
|
305
|
+
interface FieldArrayConfig extends BaseFieldConfig {
|
|
306
|
+
type: 'fieldArray';
|
|
307
|
+
properties?: {
|
|
308
|
+
isKeyValue?: boolean;
|
|
309
|
+
keyPlaceholder?: string;
|
|
310
|
+
valuePlaceholder?: string;
|
|
311
|
+
};
|
|
312
|
+
buttonLabel?: string;
|
|
313
|
+
addNewFieldBtnLabel?: string;
|
|
314
|
+
minimumValuePresent?: boolean;
|
|
315
|
+
showAddNewFieldBtn?: boolean;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Attribute field configuration
|
|
319
|
+
*/
|
|
320
|
+
interface AttributeFieldConfig extends BaseFieldConfig {
|
|
321
|
+
type: 'attribute';
|
|
322
|
+
properties?: FieldConfig[];
|
|
323
|
+
addNewField?: Record<string, unknown>;
|
|
324
|
+
showIllustration?: boolean;
|
|
325
|
+
showAddNewFieldBtn?: boolean;
|
|
326
|
+
addNewFieldBtnLabel?: string;
|
|
327
|
+
minimumValuePresent?: boolean;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Editable div field configuration
|
|
331
|
+
*/
|
|
332
|
+
interface EditableDivFieldConfig extends BaseFieldConfig {
|
|
333
|
+
type: 'editablediv';
|
|
334
|
+
availableFields?: Array<{
|
|
335
|
+
key: string;
|
|
336
|
+
label: string;
|
|
337
|
+
}>;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Counter field configuration
|
|
341
|
+
*/
|
|
342
|
+
interface CounterFieldConfig extends BaseFieldConfig {
|
|
343
|
+
type: 'counter';
|
|
344
|
+
min?: number;
|
|
345
|
+
max?: number;
|
|
346
|
+
suffix?: string;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Union type for all field configurations
|
|
350
|
+
*/
|
|
351
|
+
type FieldConfig = InputFieldConfig | SelectFieldConfig | CheckboxFieldConfig | RadioFieldConfig | TextareaFieldConfig | FileUploadFieldConfig | DatePickerFieldConfig | FieldArrayConfig | AttributeFieldConfig | EditableDivFieldConfig | CounterFieldConfig | BaseFieldConfig;
|
|
352
|
+
/**
|
|
353
|
+
* Props for the DynamicForm component
|
|
354
|
+
*
|
|
355
|
+
* NOTE: This component expects Formik to be passed as a prop (not wrapped internally)
|
|
356
|
+
* This matches the production usage pattern where Formik is managed externally
|
|
357
|
+
*/
|
|
358
|
+
interface DynamicFormProps<T extends FormikValues = FormikValues> {
|
|
359
|
+
fields: (FieldConfig | false)[];
|
|
360
|
+
formik: FormikProps<T>;
|
|
361
|
+
firstInitialValues?: T;
|
|
362
|
+
onUpdateFormFields?: (fields: FieldConfig[]) => void;
|
|
363
|
+
fieldCount?: number;
|
|
364
|
+
attributeFields?: FieldConfig[];
|
|
365
|
+
handleDeleteChange?: (count: number) => void;
|
|
366
|
+
customFormChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>, type: string) => void;
|
|
367
|
+
RadiusTab?: boolean;
|
|
368
|
+
value?: number;
|
|
369
|
+
uiLibrary?: {
|
|
370
|
+
adapter: any;
|
|
371
|
+
icons?: IconLibrary;
|
|
372
|
+
name: string;
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
interface DynamicFormPropsWithFormik<T extends FormikValues = FormikValues> {
|
|
376
|
+
fields: FieldConfig[];
|
|
377
|
+
initialValues?: T;
|
|
378
|
+
validationSchema?: ObjectSchema<T>;
|
|
379
|
+
onSubmit: (values: T) => void | Promise<void>;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Default HTML adapter - uses native HTML elements
|
|
384
|
+
* This is a fallback when no UI library is provided
|
|
385
|
+
*/
|
|
386
|
+
declare const defaultAdapter: UILibraryAdapter;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Material-UI Adapter Example
|
|
390
|
+
*
|
|
391
|
+
* This is an example adapter showing how to integrate Material-UI components.
|
|
392
|
+
* Users need to install @mui/material and @mui/x-date-pickers as peer dependencies.
|
|
393
|
+
*
|
|
394
|
+
* Usage:
|
|
395
|
+
* import { muiAdapter } from 'dynamic-formik-form/adapters/mui';
|
|
396
|
+
* import { muiIcons } from 'dynamic-formik-form/icons/mui';
|
|
397
|
+
*
|
|
398
|
+
* <DynamicForm
|
|
399
|
+
* uiLibrary={{ adapter: muiAdapter, icons: muiIcons, name: 'mui' }}
|
|
400
|
+
* ...
|
|
401
|
+
* />
|
|
402
|
+
*/
|
|
403
|
+
|
|
404
|
+
type MUIComponent = ComponentType<any>;
|
|
405
|
+
/**
|
|
406
|
+
* Material-UI Adapter
|
|
407
|
+
*
|
|
408
|
+
* NOTE: This is a template. In actual usage, you would:
|
|
409
|
+
* 1. Install @mui/material, @mui/x-date-pickers as peer dependencies
|
|
410
|
+
* 2. Import actual MUI components
|
|
411
|
+
* 3. Map them to the adapter interface
|
|
412
|
+
*/
|
|
413
|
+
declare const createMUIAdapter: (Box: MUIComponent, Button: MUIComponent, Checkbox: MUIComponent, FormControl: MUIComponent, FormControlLabel: MUIComponent, FormHelperText: MUIComponent, IconButton: MUIComponent, MenuItem: MUIComponent, Paper: MUIComponent, Popover: MUIComponent, Radio: MUIComponent, RadioGroup: MUIComponent, Switch: MUIComponent, TextField: MUIComponent, Typography: MUIComponent, DatePicker?: MUIComponent, DateTimePicker?: MUIComponent) => UILibraryAdapter;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Bootstrap React Adapter Example
|
|
417
|
+
*
|
|
418
|
+
* This is an example adapter showing how to integrate Bootstrap React components.
|
|
419
|
+
* Users need to install react-bootstrap or reactstrap as peer dependencies.
|
|
420
|
+
*
|
|
421
|
+
* Usage:
|
|
422
|
+
* import { bootstrapAdapter } from 'dynamic-formik-form/adapters/bootstrap';
|
|
423
|
+
* import { bootstrapIcons } from 'dynamic-formik-form/icons/bootstrap';
|
|
424
|
+
*
|
|
425
|
+
* <DynamicForm
|
|
426
|
+
* uiLibrary={{ adapter: bootstrapAdapter, icons: bootstrapIcons, name: 'bootstrap' }}
|
|
427
|
+
* ...
|
|
428
|
+
* />
|
|
429
|
+
*/
|
|
430
|
+
|
|
431
|
+
type BootstrapComponent = ComponentType<any>;
|
|
432
|
+
/**
|
|
433
|
+
* Bootstrap Adapter
|
|
434
|
+
*
|
|
435
|
+
* NOTE: This is a template. In actual usage, you would:
|
|
436
|
+
* 1. Install react-bootstrap or reactstrap as peer dependencies
|
|
437
|
+
* 2. Import actual Bootstrap components
|
|
438
|
+
* 3. Map them to the adapter interface
|
|
439
|
+
*/
|
|
440
|
+
declare const createBootstrapAdapter: (Form: BootstrapComponent, FormControl: BootstrapComponent, FormLabel: BootstrapComponent, FormText: BootstrapComponent, FormCheck: BootstrapComponent, FormSelect: BootstrapComponent, ButtonComponent: BootstrapComponent, InputGroup: BootstrapComponent, OverlayTrigger: BootstrapComponent, Popover: BootstrapComponent, ListGroup: BootstrapComponent, ListGroupItem: BootstrapComponent) => UILibraryAdapter;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Ant Design Adapter
|
|
444
|
+
*
|
|
445
|
+
* This adapter integrates Ant Design components with dynamic-formik-form.
|
|
446
|
+
* Users need to install antd as a peer dependency.
|
|
447
|
+
*
|
|
448
|
+
* Usage:
|
|
449
|
+
* import { createAntDesignAdapter } from 'dynamic-formik-form';
|
|
450
|
+
* import { Input, Button, Form, ... } from 'antd';
|
|
451
|
+
*
|
|
452
|
+
* const antdAdapter = createAntDesignAdapter(
|
|
453
|
+
* Input, Button, Checkbox, Radio, Switch, Select, Form, Typography, Popover, DatePicker
|
|
454
|
+
* );
|
|
455
|
+
*
|
|
456
|
+
* <DynamicForm
|
|
457
|
+
* uiLibrary={{ adapter: antdAdapter, icons: antdIcons, name: 'antd' }}
|
|
458
|
+
* ...
|
|
459
|
+
* />
|
|
460
|
+
*/
|
|
461
|
+
|
|
462
|
+
type AntDComponent = ComponentType<any>;
|
|
463
|
+
/**
|
|
464
|
+
* Ant Design Adapter Factory
|
|
465
|
+
*
|
|
466
|
+
* Creates an adapter for Ant Design components.
|
|
467
|
+
* Users pass their Ant Design component imports to this factory function.
|
|
468
|
+
*/
|
|
469
|
+
declare const createAntDesignAdapter: (Input: AntDComponent, Button: AntDComponent, Checkbox: AntDComponent, Radio: AntDComponent, Switch: AntDComponent, Select: AntDComponent, Form: AntDComponent, Typography: AntDComponent, Popover: AntDComponent, DatePicker?: AntDComponent, DateTimePicker?: AntDComponent, Space?: AntDComponent, Card?: AntDComponent) => UILibraryAdapter;
|
|
470
|
+
|
|
471
|
+
declare const defaultIcons: IconLibrary;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* DynamicForm Component
|
|
475
|
+
*
|
|
476
|
+
* Orchestrator component that renders fields dynamically based on configuration.
|
|
477
|
+
* Supports conditional field rendering, child fields, and all production features.
|
|
478
|
+
*/
|
|
479
|
+
declare const DynamicForm: <T extends Record<string, unknown>>({ fields, formik, firstInitialValues, fieldCount, attributeFields, customFormChange, RadiusTab, uiLibrary, }: DynamicFormProps<T> & {
|
|
480
|
+
formik: FormikProps<T>;
|
|
481
|
+
uiLibrary?: {
|
|
482
|
+
adapter: typeof defaultAdapter;
|
|
483
|
+
icons?: typeof defaultIcons;
|
|
484
|
+
name: string;
|
|
485
|
+
};
|
|
486
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Material-UI Icons Example
|
|
490
|
+
*
|
|
491
|
+
* This shows how to use Material-UI icons with the library.
|
|
492
|
+
* Users need to install @mui/icons-material as a peer dependency.
|
|
493
|
+
*
|
|
494
|
+
* Usage:
|
|
495
|
+
* import { muiIcons } from 'dynamic-formik-form/icons/mui';
|
|
496
|
+
*
|
|
497
|
+
* <DynamicForm
|
|
498
|
+
* uiLibrary={{ adapter: muiAdapter, icons: muiIcons, name: 'mui' }}
|
|
499
|
+
* ...
|
|
500
|
+
* />
|
|
501
|
+
*/
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Material-UI Icons
|
|
505
|
+
*
|
|
506
|
+
* NOTE: This is a template. In actual usage, you would:
|
|
507
|
+
* 1. Install @mui/icons-material as a peer dependency
|
|
508
|
+
* 2. Import actual MUI icons
|
|
509
|
+
* 3. Export them as IconLibrary
|
|
510
|
+
*
|
|
511
|
+
* Example:
|
|
512
|
+
* import {
|
|
513
|
+
* Info as InfoIcon,
|
|
514
|
+
* Visibility as VisibilityIcon,
|
|
515
|
+
* VisibilityOff as VisibilityOffIcon,
|
|
516
|
+
* ContentCopy as CopyIcon,
|
|
517
|
+
* AddCircleOutline as AddIcon,
|
|
518
|
+
* DeleteOutline as DeleteIcon,
|
|
519
|
+
* } from '@mui/icons-material';
|
|
520
|
+
*
|
|
521
|
+
* export const muiIcons: IconLibrary = {
|
|
522
|
+
* Info: InfoIcon,
|
|
523
|
+
* Visibility: VisibilityIcon,
|
|
524
|
+
* VisibilityOff: VisibilityOffIcon,
|
|
525
|
+
* Copy: CopyIcon,
|
|
526
|
+
* Add: AddIcon,
|
|
527
|
+
* Delete: DeleteIcon,
|
|
528
|
+
* };
|
|
529
|
+
*/
|
|
530
|
+
declare const createMUIIcons: (Info: React.ComponentType<any>, Visibility: React.ComponentType<any>, VisibilityOff: React.ComponentType<any>, Copy: React.ComponentType<any>, Add: React.ComponentType<any>, Delete: React.ComponentType<any>) => IconLibrary;
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Bootstrap Icons Example
|
|
534
|
+
*
|
|
535
|
+
* This shows how to use Bootstrap Icons with the library.
|
|
536
|
+
* Users can use react-bootstrap-icons or bootstrap-icons package.
|
|
537
|
+
*
|
|
538
|
+
* Usage:
|
|
539
|
+
* import { bootstrapIcons } from 'dynamic-formik-form/icons/bootstrap';
|
|
540
|
+
*
|
|
541
|
+
* <DynamicForm
|
|
542
|
+
* uiLibrary={{ adapter: bootstrapAdapter, icons: bootstrapIcons, name: 'bootstrap' }}
|
|
543
|
+
* ...
|
|
544
|
+
* />
|
|
545
|
+
*/
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Bootstrap Icons
|
|
549
|
+
*
|
|
550
|
+
* NOTE: This is a template. In actual usage, you would:
|
|
551
|
+
* 1. Install react-bootstrap-icons or bootstrap-icons as a peer dependency
|
|
552
|
+
* 2. Import actual Bootstrap icons
|
|
553
|
+
* 3. Export them as IconLibrary
|
|
554
|
+
*
|
|
555
|
+
* Example with react-bootstrap-icons:
|
|
556
|
+
* import {
|
|
557
|
+
* InfoCircle as InfoIcon,
|
|
558
|
+
* Eye as VisibilityIcon,
|
|
559
|
+
* EyeSlash as VisibilityOffIcon,
|
|
560
|
+
* Clipboard as CopyIcon,
|
|
561
|
+
* PlusCircle as AddIcon,
|
|
562
|
+
* Trash as DeleteIcon,
|
|
563
|
+
* } from 'react-bootstrap-icons';
|
|
564
|
+
*
|
|
565
|
+
* export const bootstrapIcons: IconLibrary = {
|
|
566
|
+
* Info: InfoIcon,
|
|
567
|
+
* Visibility: VisibilityIcon,
|
|
568
|
+
* VisibilityOff: VisibilityOffIcon,
|
|
569
|
+
* Copy: CopyIcon,
|
|
570
|
+
* Add: AddIcon,
|
|
571
|
+
* Delete: DeleteIcon,
|
|
572
|
+
* };
|
|
573
|
+
*/
|
|
574
|
+
declare const createBootstrapIcons: (Info: React.ComponentType<any>, Visibility: React.ComponentType<any>, VisibilityOff: React.ComponentType<any>, Copy: React.ComponentType<any>, Add: React.ComponentType<any>, Delete: React.ComponentType<any>) => IconLibrary;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Ant Design Icons
|
|
578
|
+
*
|
|
579
|
+
* This shows how to use Ant Design Icons with the library.
|
|
580
|
+
* Users can use @ant-design/icons package.
|
|
581
|
+
*
|
|
582
|
+
* Usage:
|
|
583
|
+
* import { createAntDesignIcons } from 'dynamic-formik-form';
|
|
584
|
+
* import {
|
|
585
|
+
* InfoCircleOutlined as InfoIcon,
|
|
586
|
+
* EyeOutlined as VisibilityIcon,
|
|
587
|
+
* EyeInvisibleOutlined as VisibilityOffIcon,
|
|
588
|
+
* CopyOutlined as CopyIcon,
|
|
589
|
+
* PlusCircleOutlined as AddIcon,
|
|
590
|
+
* DeleteOutlined as DeleteIcon,
|
|
591
|
+
* } from '@ant-design/icons';
|
|
592
|
+
*
|
|
593
|
+
* const antdIcons = createAntDesignIcons(
|
|
594
|
+
* InfoIcon,
|
|
595
|
+
* VisibilityIcon,
|
|
596
|
+
* VisibilityOffIcon,
|
|
597
|
+
* CopyIcon,
|
|
598
|
+
* AddIcon,
|
|
599
|
+
* DeleteIcon
|
|
600
|
+
* );
|
|
601
|
+
*/
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Ant Design Icons Factory
|
|
605
|
+
*
|
|
606
|
+
* Creates an icon library configuration for Ant Design icons.
|
|
607
|
+
* Users pass their @ant-design/icons imports to this factory function.
|
|
608
|
+
*/
|
|
609
|
+
declare const createAntDesignIcons: (Info: React$1.ComponentType<any>, Visibility: React$1.ComponentType<any>, VisibilityOff: React$1.ComponentType<any>, Copy: React$1.ComponentType<any>, Add: React$1.ComponentType<any>, Delete: React$1.ComponentType<any>) => IconLibrary;
|
|
610
|
+
|
|
611
|
+
interface FieldLabelProps {
|
|
612
|
+
name: string;
|
|
613
|
+
label?: string;
|
|
614
|
+
required?: boolean;
|
|
615
|
+
showOptional?: boolean;
|
|
616
|
+
info?: string;
|
|
617
|
+
htmlFor?: string;
|
|
618
|
+
className?: string;
|
|
619
|
+
customLabelClass?: string;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* FieldLabel component
|
|
623
|
+
* Renders label with required indicator, optional text, and info tooltip
|
|
624
|
+
*/
|
|
625
|
+
declare const FieldLabel: React$1.FC<FieldLabelProps>;
|
|
626
|
+
|
|
627
|
+
interface FieldDescriptionProps {
|
|
628
|
+
desc?: string;
|
|
629
|
+
className?: string;
|
|
630
|
+
customDescClass?: string;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* FieldDescription component
|
|
634
|
+
* Renders field description/helper text
|
|
635
|
+
*/
|
|
636
|
+
declare const FieldDescription: React$1.FC<FieldDescriptionProps>;
|
|
637
|
+
|
|
638
|
+
interface FieldErrorProps {
|
|
639
|
+
name: string;
|
|
640
|
+
error?: string;
|
|
641
|
+
touched?: boolean;
|
|
642
|
+
showCustomError?: boolean;
|
|
643
|
+
dataTestId?: string;
|
|
644
|
+
className?: string;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* FieldError component
|
|
648
|
+
* Displays validation error messages
|
|
649
|
+
*/
|
|
650
|
+
declare const FieldError: React$1.FC<FieldErrorProps>;
|
|
651
|
+
|
|
652
|
+
interface FieldWrapperProps {
|
|
653
|
+
children: ReactNode;
|
|
654
|
+
className?: string;
|
|
655
|
+
customClass?: string;
|
|
656
|
+
isChild?: boolean;
|
|
657
|
+
noIndent?: boolean;
|
|
658
|
+
hidden?: boolean;
|
|
659
|
+
index?: number | string;
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* FieldWrapper component
|
|
663
|
+
* Provides consistent styling and layout for field components
|
|
664
|
+
*/
|
|
665
|
+
declare const FieldWrapper: React$1.FC<FieldWrapperProps>;
|
|
666
|
+
|
|
667
|
+
interface EmptyFieldProps extends BaseFieldConfig {
|
|
668
|
+
type: 'emptyField';
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* EmptyField Component
|
|
672
|
+
* Renders a hidden input field (useful for form state management)
|
|
673
|
+
*/
|
|
674
|
+
declare const EmptyField: React$1.FC<EmptyFieldProps>;
|
|
675
|
+
|
|
676
|
+
interface TextFieldProps extends BaseFieldConfig {
|
|
677
|
+
type: 'text';
|
|
678
|
+
error?: string;
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* TextField Component
|
|
682
|
+
* Displays read-only text (not an input field)
|
|
683
|
+
*/
|
|
684
|
+
declare const TextField: React$1.FC<TextFieldProps>;
|
|
685
|
+
|
|
686
|
+
interface LinkFieldProps extends BaseFieldConfig {
|
|
687
|
+
type: 'link';
|
|
688
|
+
onClickLink?: () => void;
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* LinkField Component
|
|
692
|
+
* Renders a clickable link/button field
|
|
693
|
+
*/
|
|
694
|
+
declare const LinkField: React$1.FC<LinkFieldProps>;
|
|
695
|
+
|
|
696
|
+
interface ComponentFieldProps extends BaseFieldConfig {
|
|
697
|
+
type: 'component';
|
|
698
|
+
component?: React$1.ReactNode;
|
|
699
|
+
blockComponent?: React$1.ReactNode;
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* ComponentField Component
|
|
703
|
+
* Wrapper for custom components
|
|
704
|
+
*/
|
|
705
|
+
declare const ComponentField: React$1.FC<ComponentFieldProps>;
|
|
706
|
+
|
|
707
|
+
interface CustomFieldProps extends BaseFieldConfig {
|
|
708
|
+
type: 'custom';
|
|
709
|
+
component?: React$1.ReactNode;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* CustomField Component
|
|
713
|
+
* Custom field wrapper with label and description
|
|
714
|
+
*/
|
|
715
|
+
declare const CustomField: React$1.FC<CustomFieldProps>;
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* InputField Component
|
|
719
|
+
* Renders text input fields with various types (text, email, password, etc.)
|
|
720
|
+
*/
|
|
721
|
+
declare const InputField: React$1.FC<InputFieldConfig>;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* TextareaField Component
|
|
725
|
+
* Renders a textarea input field
|
|
726
|
+
*/
|
|
727
|
+
declare const TextareaField: React$1.FC<TextareaFieldConfig>;
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* CheckboxField Component
|
|
731
|
+
* Renders a checkbox input field
|
|
732
|
+
*/
|
|
733
|
+
declare const CheckboxField: React$1.FC<CheckboxFieldConfig>;
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* RadioField Component
|
|
737
|
+
* Renders a radio button group
|
|
738
|
+
*/
|
|
739
|
+
declare const RadioField: React$1.FC<RadioFieldConfig>;
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* DropdownField Component
|
|
743
|
+
* Renders a native HTML select dropdown
|
|
744
|
+
*/
|
|
745
|
+
declare const DropdownField: React$1.FC<SelectFieldConfig & {
|
|
746
|
+
type: 'dropdown';
|
|
747
|
+
}>;
|
|
748
|
+
|
|
749
|
+
interface ToggleFieldProps extends BaseFieldConfig {
|
|
750
|
+
type: 'toggle';
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* ToggleField Component
|
|
754
|
+
* Renders a switch/toggle component
|
|
755
|
+
*/
|
|
756
|
+
declare const ToggleField: React$1.FC<ToggleFieldProps>;
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* FileUploadField Component
|
|
760
|
+
* Renders a file upload input field
|
|
761
|
+
*/
|
|
762
|
+
declare const FileUploadField: React$1.FC<FileUploadFieldConfig>;
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* SingleSelectField Component
|
|
766
|
+
* Renders a single-select dropdown using react-select
|
|
767
|
+
*
|
|
768
|
+
* NOTE: This requires react-select as a peer dependency
|
|
769
|
+
* Users must install: npm install react-select
|
|
770
|
+
*/
|
|
771
|
+
declare const SingleSelectField: React$1.FC<SelectFieldConfig & {
|
|
772
|
+
type: 'singleSelect';
|
|
773
|
+
}>;
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* MultiSelectField Component
|
|
777
|
+
* Renders a multi-select dropdown using react-select
|
|
778
|
+
*
|
|
779
|
+
* NOTE: This requires react-select as a peer dependency
|
|
780
|
+
*/
|
|
781
|
+
declare const MultiSelectField: React$1.FC<SelectFieldConfig & {
|
|
782
|
+
type: 'multiSelect';
|
|
783
|
+
}>;
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* AsyncSelectField Component
|
|
787
|
+
* Renders an async-loading select dropdown using react-select/async
|
|
788
|
+
*
|
|
789
|
+
* NOTE: This requires react-select as a peer dependency
|
|
790
|
+
*/
|
|
791
|
+
declare const AsyncSelectField: React$1.FC<SelectFieldConfig & {
|
|
792
|
+
type: 'asyncSelect';
|
|
793
|
+
}>;
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* DatePickerField Component
|
|
797
|
+
* Renders a date picker component
|
|
798
|
+
*
|
|
799
|
+
* NOTE: This requires a date picker library (e.g., @mui/x-date-pickers, react-datepicker)
|
|
800
|
+
* Users must provide a DatePicker component in their UI adapter
|
|
801
|
+
*/
|
|
802
|
+
declare const DatePickerField: React$1.FC<DatePickerFieldConfig & {
|
|
803
|
+
type: 'datePicker';
|
|
804
|
+
}>;
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* DateTimePickerField Component
|
|
808
|
+
* Renders a date-time picker component
|
|
809
|
+
*
|
|
810
|
+
* NOTE: This requires a date-time picker library (e.g., @mui/x-date-pickers)
|
|
811
|
+
* Users must provide a DateTimePicker component in their UI adapter
|
|
812
|
+
*/
|
|
813
|
+
declare const DateTimePickerField: React$1.FC<DatePickerFieldConfig & {
|
|
814
|
+
type: 'dateTimePicker';
|
|
815
|
+
}>;
|
|
816
|
+
|
|
817
|
+
interface DeleteFieldProps extends BaseFieldConfig {
|
|
818
|
+
type: 'delete';
|
|
819
|
+
handleDeleteAttribute?: (name: string) => void;
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* DeleteField Component
|
|
823
|
+
* Renders a delete button/icon
|
|
824
|
+
*/
|
|
825
|
+
declare const DeleteField: React$1.FC<DeleteFieldProps>;
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* CounterField Component
|
|
829
|
+
* Renders a counter component with increment/decrement buttons
|
|
830
|
+
*
|
|
831
|
+
* NOTE: This is a simplified version. Users can provide a custom Counter component
|
|
832
|
+
* via the component prop or extend the adapter
|
|
833
|
+
*/
|
|
834
|
+
declare const CounterField: React$1.FC<CounterFieldConfig>;
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* FieldArrayField Component
|
|
838
|
+
* Renders dynamic array fields (key-value pairs or simple arrays)
|
|
839
|
+
*/
|
|
840
|
+
declare const FieldArrayField: React$1.FC<FieldArrayConfig>;
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* AttributeField Component
|
|
844
|
+
* Renders complex nested attribute mapping fields
|
|
845
|
+
*/
|
|
846
|
+
declare const AttributeField: React$1.FC<AttributeFieldConfig & {
|
|
847
|
+
setFieldValuesRecursive?: (child: FieldConfig[], parentValue?: string) => void;
|
|
848
|
+
customFormChange?: (event: any, type: string) => void;
|
|
849
|
+
}>;
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* EditableDivField Component
|
|
853
|
+
* Renders a contentEditable div with field insertion capabilities
|
|
854
|
+
*
|
|
855
|
+
* This is a complex component that allows users to insert field references
|
|
856
|
+
* (like {{fieldName}}) into editable text content
|
|
857
|
+
*/
|
|
858
|
+
declare const EditableDivField: React$1.FC<EditableDivFieldConfig>;
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* Formik utility functions extracted from production code
|
|
862
|
+
* These handle nested property access, error extraction, etc.
|
|
863
|
+
*/
|
|
864
|
+
/**
|
|
865
|
+
* Get nested property from object using dot notation or bracket notation
|
|
866
|
+
* Supports paths like "user.name" or "users[0].name"
|
|
867
|
+
*/
|
|
868
|
+
declare const getNestedProperty: (obj: Record<string, unknown> | undefined | null, path: string | undefined | null) => unknown;
|
|
869
|
+
/**
|
|
870
|
+
* Alternative nested property getter (simpler version)
|
|
871
|
+
* Only supports dot notation
|
|
872
|
+
*/
|
|
873
|
+
declare const getNestedValueNew: (obj: Record<string, unknown> | undefined | null, path: string) => unknown;
|
|
874
|
+
/**
|
|
875
|
+
* Extract field value from Formik values using nested path
|
|
876
|
+
*/
|
|
877
|
+
declare const getFieldValue: (formik: {
|
|
878
|
+
values: Record<string, unknown>;
|
|
879
|
+
}, name: string) => unknown;
|
|
880
|
+
/**
|
|
881
|
+
* Extract field error from Formik errors using nested path
|
|
882
|
+
*/
|
|
883
|
+
declare const getFieldError: (formik: {
|
|
884
|
+
errors: Record<string, unknown>;
|
|
885
|
+
}, name: string) => string | undefined;
|
|
886
|
+
/**
|
|
887
|
+
* Extract field touched state from Formik touched using nested path
|
|
888
|
+
*/
|
|
889
|
+
declare const getFieldTouched: (formik: {
|
|
890
|
+
touched: Record<string, unknown>;
|
|
891
|
+
}, name: string) => boolean;
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Field utility functions
|
|
895
|
+
*/
|
|
896
|
+
/**
|
|
897
|
+
* Format string for use in data-testid attributes
|
|
898
|
+
* Converts camelCase, snake_case, and spaces to kebab-case
|
|
899
|
+
*/
|
|
900
|
+
declare const formatString: (inputStr: string | undefined | null, ignoreChar?: boolean) => string;
|
|
901
|
+
/**
|
|
902
|
+
* Convert camelCase to kebab-case
|
|
903
|
+
*/
|
|
904
|
+
declare const camelToKebabCase: (str: string) => string;
|
|
905
|
+
/**
|
|
906
|
+
* Sanitize label for CSS class names
|
|
907
|
+
*/
|
|
908
|
+
declare const sanitizeLabelForCSS: (label: string | undefined | null) => string;
|
|
909
|
+
/**
|
|
910
|
+
* Check if value is blank (null, undefined, or empty string)
|
|
911
|
+
*/
|
|
912
|
+
declare const isBlank: (value: unknown) => boolean;
|
|
913
|
+
/**
|
|
914
|
+
* Check if value is not blank
|
|
915
|
+
*/
|
|
916
|
+
declare const isNotBlank: (value: unknown) => boolean;
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Validation utility functions
|
|
920
|
+
*/
|
|
921
|
+
/**
|
|
922
|
+
* Validate email address
|
|
923
|
+
*/
|
|
924
|
+
declare const validateEmail: (email: string | undefined | null) => boolean;
|
|
925
|
+
/**
|
|
926
|
+
* Validate URL
|
|
927
|
+
*/
|
|
928
|
+
declare const isValidUrl: (url: string | undefined | null) => boolean;
|
|
929
|
+
/**
|
|
930
|
+
* Check if username is valid
|
|
931
|
+
*/
|
|
932
|
+
declare const checkValidUsername: (username: string, minLength: number, maxLength: number) => boolean;
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* Form context that provides:
|
|
936
|
+
* - UI library adapter
|
|
937
|
+
* - Icon library
|
|
938
|
+
* - Formik instance
|
|
939
|
+
*/
|
|
940
|
+
interface FormContextValue {
|
|
941
|
+
uiLibrary: UILibraryConfig;
|
|
942
|
+
formik: FormikProps<Record<string, unknown>>;
|
|
943
|
+
}
|
|
944
|
+
interface FormProviderProps {
|
|
945
|
+
children: ReactNode;
|
|
946
|
+
uiLibrary: UILibraryConfig;
|
|
947
|
+
formik: FormikProps<Record<string, unknown>>;
|
|
948
|
+
}
|
|
949
|
+
declare const FormProvider: React$1.FC<FormProviderProps>;
|
|
950
|
+
declare const useFormContext: () => FormContextValue;
|
|
951
|
+
|
|
952
|
+
export { AsyncSelectField, AttributeField, type AttributeFieldConfig, type BaseFieldConfig, CheckboxField, type CheckboxFieldConfig, ComponentField, CounterField, type CounterFieldConfig, CustomField, DatePickerField, type DatePickerFieldConfig, DateTimePickerField, DeleteField, DropdownField, DynamicForm, type DynamicFormProps, type DynamicFormPropsWithFormik, EditableDivField, type EditableDivFieldConfig, EmptyField, type FieldArrayConfig, FieldArrayField, type FieldConfig, FieldDescription, FieldError, FieldLabel, type FieldType, FieldWrapper, FileUploadField, type FileUploadFieldConfig, FormProvider, type IconLibrary, InputField, type InputFieldConfig, LinkField, MultiSelectField, RadioField, type RadioFieldConfig, type SelectFieldConfig, SingleSelectField, TextField, TextareaField, type TextareaFieldConfig, ToggleField, type UILibraryAdapter, type UILibraryConfig, camelToKebabCase, checkValidUsername, createAntDesignAdapter, createAntDesignIcons, createBootstrapAdapter, createBootstrapIcons, createMUIAdapter, createMUIIcons, defaultAdapter, defaultIcons, formatString, getFieldError, getFieldTouched, getFieldValue, getNestedProperty, getNestedValueNew, isBlank, isNotBlank, isValidUrl, sanitizeLabelForCSS, useFormContext, validateEmail };
|