@wix/headless-forms 0.0.8 → 0.0.10
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/cjs/dist/react/Form.d.ts +2 -2
- package/cjs/dist/react/Form.js +8 -9
- package/cjs/dist/react/core/Form.d.ts +10 -4
- package/cjs/dist/react/core/Form.js +20 -11
- package/cjs/dist/react/types.d.ts +3 -1251
- package/cjs/dist/services/form-service.d.ts +25 -3
- package/cjs/dist/services/form-service.js +55 -2
- package/dist/react/Form.d.ts +2 -2
- package/dist/react/Form.js +3 -4
- package/dist/react/core/Form.d.ts +10 -4
- package/dist/react/core/Form.js +20 -11
- package/dist/react/types.d.ts +3 -1251
- package/dist/services/form-service.d.ts +25 -3
- package/dist/services/form-service.js +56 -3
- package/package.json +3 -3
package/dist/react/types.d.ts
CHANGED
|
@@ -1,1251 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
minLength: number | undefined;
|
|
5
|
-
maxLength: number | undefined;
|
|
6
|
-
}
|
|
7
|
-
interface ChoiceOption {
|
|
8
|
-
id: string;
|
|
9
|
-
value: string;
|
|
10
|
-
label: string;
|
|
11
|
-
default: boolean;
|
|
12
|
-
}
|
|
13
|
-
interface CustomOption {
|
|
14
|
-
label: string;
|
|
15
|
-
placeholder: string;
|
|
16
|
-
}
|
|
17
|
-
interface BaseFieldProps {
|
|
18
|
-
id: string;
|
|
19
|
-
required: boolean;
|
|
20
|
-
readOnly: boolean;
|
|
21
|
-
error: string | undefined;
|
|
22
|
-
onChange: (value: unknown) => void;
|
|
23
|
-
onBlur: () => void;
|
|
24
|
-
onFocus: () => void;
|
|
25
|
-
}
|
|
26
|
-
interface BaseTextFieldProps extends BaseFieldProps {
|
|
27
|
-
value: string | null | undefined;
|
|
28
|
-
label: string;
|
|
29
|
-
showLabel: boolean;
|
|
30
|
-
placeholder?: string;
|
|
31
|
-
description?: forms.RichContent;
|
|
32
|
-
}
|
|
33
|
-
interface BaseCheckboxProps extends BaseFieldProps {
|
|
34
|
-
value: boolean;
|
|
35
|
-
label: forms.RichContent;
|
|
36
|
-
defaultValue: boolean;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Props for contacts phone field.
|
|
40
|
-
* Used with fieldMap key: CONTACTS_PHONE
|
|
41
|
-
*
|
|
42
|
-
* @interface PhoneInputProps
|
|
43
|
-
*
|
|
44
|
-
* @property {string} id - The unique identifier for the form field
|
|
45
|
-
* @property {string | null | undefined} value - The current value of the form field
|
|
46
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
47
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
48
|
-
* @property {string} label - The display label for the form field
|
|
49
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
50
|
-
* @property {string} [placeholder] - Optional placeholder text to display when the field is empty
|
|
51
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
52
|
-
* @property {CallingCountryCode[]} [allowedCountryCodes] - Optional array of allowed country codes for phone number validation
|
|
53
|
-
* @property {CallingCountryCode} [defaultCountryCode] - Optional default country code to pre-select
|
|
54
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
55
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
56
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
57
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```tsx
|
|
61
|
-
* const phoneField: PhoneInputProps = {
|
|
62
|
-
* id: 'phone',
|
|
63
|
-
* value: '+1-555-123-4567',
|
|
64
|
-
* required: true,
|
|
65
|
-
* readOnly: false,
|
|
66
|
-
* label: 'Phone Number',
|
|
67
|
-
* showLabel: true,
|
|
68
|
-
* placeholder: 'Enter your phone number',
|
|
69
|
-
* description: { nodes: [{ type: 'text', text: 'Include country code' }] },
|
|
70
|
-
* allowedCountryCodes: ['US', 'CA', 'GB'],
|
|
71
|
-
* defaultCountryCode: 'US',
|
|
72
|
-
* onChange: (value) => console.log('Value changed:', value),
|
|
73
|
-
* onBlur: () => console.log('Field blurred'),
|
|
74
|
-
* onFocus: () => console.log('Field focused')
|
|
75
|
-
* };
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
export interface PhoneInputProps extends BaseTextFieldProps {
|
|
79
|
-
allowedCountryCodes: CallingCountryCode[];
|
|
80
|
-
defaultCountryCode?: CallingCountryCode;
|
|
81
|
-
}
|
|
82
|
-
type MultilineAddressValue = {
|
|
83
|
-
country?: CallingCountryCode;
|
|
84
|
-
subdivision?: string;
|
|
85
|
-
city?: string;
|
|
86
|
-
addressLine?: string;
|
|
87
|
-
addressLine2?: string;
|
|
88
|
-
postalCode?: string;
|
|
89
|
-
streetName?: string;
|
|
90
|
-
streetNumber?: string;
|
|
91
|
-
apartment?: string;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Props for multiline address field.
|
|
95
|
-
* Used with fieldMap key: MULTILINE_ADDRESS
|
|
96
|
-
* The field MUST render separate inputs on the UI for these values:
|
|
97
|
-
* 1. Country/Region
|
|
98
|
-
* 2. Address
|
|
99
|
-
* 3. Address - line 2 (if showAddressLine2 is true)
|
|
100
|
-
* 4. City
|
|
101
|
-
* 5. Zip / Postal Code
|
|
102
|
-
*
|
|
103
|
-
* @interface MultilineAddressProps
|
|
104
|
-
*
|
|
105
|
-
* @property {string} id - The unique identifier for the form field
|
|
106
|
-
* @property {MultilineAddressValue | null | undefined} value - The current value of the form field
|
|
107
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
108
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
109
|
-
* @property {string} label - The display label for the form field
|
|
110
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
111
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
112
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
113
|
-
* @property {boolean} showAddressLine2 - Whether to show the address line 2 field
|
|
114
|
-
* @property {boolean} addressLine2Required - Whether the address line 2 field is required
|
|
115
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```tsx
|
|
119
|
-
* const multilineAddressField: MultilineAddressProps = {
|
|
120
|
-
* id: 'multilineAddress',
|
|
121
|
-
* value: '123 Main Street\nApt 4B\nNew York, NY 10001\nUnited States',
|
|
122
|
-
* required: true,
|
|
123
|
-
* readOnly: false,
|
|
124
|
-
* label: 'Full Address',
|
|
125
|
-
* showAddressLine2: true,
|
|
126
|
-
* addressLine2Required: false,
|
|
127
|
-
* onChange: (value) => console.log('Value changed:', value),
|
|
128
|
-
* onBlur: () => console.log('Field blurred'),
|
|
129
|
-
* onFocus: () => console.log('Field focused')
|
|
130
|
-
* };
|
|
131
|
-
* ```
|
|
132
|
-
*/
|
|
133
|
-
export interface MultilineAddressProps extends BaseFieldProps {
|
|
134
|
-
label?: string;
|
|
135
|
-
value: MultilineAddressValue;
|
|
136
|
-
showAddressLine2: boolean;
|
|
137
|
-
addressLine2Required?: boolean;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Props for text area field.
|
|
141
|
-
* Field allows to give a multi-line answer.
|
|
142
|
-
* Used with fieldMap key: TEXT_AREA
|
|
143
|
-
*
|
|
144
|
-
* @interface TextAreaProps
|
|
145
|
-
*
|
|
146
|
-
* @property {string} id - The unique identifier for the form field
|
|
147
|
-
* @property {string | null | undefined} value - The current value of the form field
|
|
148
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
149
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
150
|
-
* @property {string} label - The display label for the form field
|
|
151
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
152
|
-
* @property {string} [placeholder] - Optional placeholder text to display when the field is empty
|
|
153
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
154
|
-
* @property {number} [minLength] - Optional minimum number of characters required
|
|
155
|
-
* @property {number} [maxLength] - Optional maximum number of characters allowed
|
|
156
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
157
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
158
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
159
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* ```tsx
|
|
163
|
-
* const textAreaField: TextAreaProps = {
|
|
164
|
-
* id: 'message',
|
|
165
|
-
* value: 'Hello world!',
|
|
166
|
-
* required: true,
|
|
167
|
-
* readOnly: false,
|
|
168
|
-
* label: 'Your Message',
|
|
169
|
-
* showLabel: true,
|
|
170
|
-
* placeholder: 'Enter your message here...',
|
|
171
|
-
* description: { nodes: [{ type: 'text', text: 'Please provide detailed information' }] },
|
|
172
|
-
* minLength: 10,
|
|
173
|
-
* maxLength: 1000,
|
|
174
|
-
* onChange: (value) => console.log('Value changed:', value),
|
|
175
|
-
* onBlur: () => console.log('Field blurred'),
|
|
176
|
-
* onFocus: () => console.log('Field focused')
|
|
177
|
-
* };
|
|
178
|
-
* ```
|
|
179
|
-
*/
|
|
180
|
-
export interface TextAreaProps extends BaseTextFieldProps, MinMaxLengthProps {
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Props for text input field.
|
|
184
|
-
* Field allows to give a single line for a brief answer.
|
|
185
|
-
* Used with fieldMap key: TEXT_INPUT
|
|
186
|
-
*
|
|
187
|
-
* @interface TextInputProps
|
|
188
|
-
*
|
|
189
|
-
* @property {string} id - The unique identifier for the form field
|
|
190
|
-
* @property {string | null | undefined} value - The current value of the form field
|
|
191
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
192
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
193
|
-
* @property {string} label - The display label for the form field
|
|
194
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
195
|
-
* @property {string} [placeholder] - Optional placeholder text to display when the field is empty
|
|
196
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
197
|
-
* @property {number} [minLength] - Optional minimum number of characters required
|
|
198
|
-
* @property {number} [maxLength] - Optional maximum number of characters allowed
|
|
199
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
200
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
201
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
202
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
203
|
-
*
|
|
204
|
-
* @example
|
|
205
|
-
* ```tsx
|
|
206
|
-
* const textInputField: TextInputProps = {
|
|
207
|
-
* id: 'firstName',
|
|
208
|
-
* value: 'John',
|
|
209
|
-
* required: true,
|
|
210
|
-
* readOnly: false,
|
|
211
|
-
* label: 'First Name',
|
|
212
|
-
* showLabel: true,
|
|
213
|
-
* placeholder: 'Enter your first name',
|
|
214
|
-
* description: { nodes: [{ type: 'text', text: 'Your given name' }] },
|
|
215
|
-
* minLength: 1,
|
|
216
|
-
* maxLength: 50,
|
|
217
|
-
* onChange: (value) => console.log('Value changed:', value),
|
|
218
|
-
* onBlur: () => console.log('Field blurred'),
|
|
219
|
-
* onFocus: () => console.log('Field focused')
|
|
220
|
-
* };
|
|
221
|
-
* ```
|
|
222
|
-
*/
|
|
223
|
-
export interface TextInputProps extends BaseTextFieldProps, MinMaxLengthProps {
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Props for number input field.
|
|
227
|
-
* Field allows to give a numerical answer.
|
|
228
|
-
* Used with fieldMap key: NUMBER_INPUT
|
|
229
|
-
*
|
|
230
|
-
* @interface NumberInputProps
|
|
231
|
-
*
|
|
232
|
-
* @property {string} id - The unique identifier for the form field
|
|
233
|
-
* @property {string | number | null | undefined} value - The current value of the form field
|
|
234
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
235
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
236
|
-
* @property {string} label - The display label for the form field
|
|
237
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
238
|
-
* @property {string} [placeholder] - Optional placeholder text to display when the field is empty
|
|
239
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
240
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
241
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
242
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
243
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
244
|
-
*
|
|
245
|
-
* @example
|
|
246
|
-
* ```tsx
|
|
247
|
-
* const numberInputField: NumberInputProps = {
|
|
248
|
-
* id: 'age',
|
|
249
|
-
* value: 25,
|
|
250
|
-
* required: true,
|
|
251
|
-
* readOnly: false,
|
|
252
|
-
* label: 'Age',
|
|
253
|
-
* showLabel: true,
|
|
254
|
-
* placeholder: 'Enter your age',
|
|
255
|
-
* description: { nodes: [{ type: 'text', text: 'Must be 18 or older' }] },
|
|
256
|
-
* onChange: (value) => console.log('Value changed:', value),
|
|
257
|
-
* onBlur: () => console.log('Field blurred'),
|
|
258
|
-
* onFocus: () => console.log('Field focused')
|
|
259
|
-
* };
|
|
260
|
-
* ```
|
|
261
|
-
*/
|
|
262
|
-
export interface NumberInputProps extends BaseFieldProps {
|
|
263
|
-
value: string | number | null | undefined;
|
|
264
|
-
label: string;
|
|
265
|
-
showLabel: boolean;
|
|
266
|
-
placeholder?: string;
|
|
267
|
-
description?: forms.RichContent;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Props for checkbox field.
|
|
271
|
-
* Field allows to collect a boolean answer.
|
|
272
|
-
* Used with fieldMap key: CHECKBOX
|
|
273
|
-
*
|
|
274
|
-
* @interface CheckboxProps
|
|
275
|
-
*
|
|
276
|
-
* @property {string} id - The unique identifier for the form field
|
|
277
|
-
* @property {boolean} value - The current value of the form field
|
|
278
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
279
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
280
|
-
* @property {forms.RichContent} label - The display label for the form field
|
|
281
|
-
* @property {boolean} defaultValue - The default checked state for the checkbox
|
|
282
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
283
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
284
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
285
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
286
|
-
*
|
|
287
|
-
* @example
|
|
288
|
-
* ```tsx
|
|
289
|
-
* const checkboxField: CheckboxProps = {
|
|
290
|
-
* id: 'agree',
|
|
291
|
-
* value: true,
|
|
292
|
-
* required: true,
|
|
293
|
-
* readOnly: false,
|
|
294
|
-
* label: { nodes: [{ type: 'text', text: 'I agree to the terms and conditions' }] },
|
|
295
|
-
* defaultValue: false,
|
|
296
|
-
* onChange: (value) => console.log('Value changed:', value),
|
|
297
|
-
* onBlur: () => console.log('Field blurred'),
|
|
298
|
-
* onFocus: () => console.log('Field focused')
|
|
299
|
-
* };
|
|
300
|
-
* ```
|
|
301
|
-
*/
|
|
302
|
-
export interface CheckboxProps extends BaseCheckboxProps {
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Data structure for uploaded file information.
|
|
306
|
-
*
|
|
307
|
-
* @interface FileData
|
|
308
|
-
*
|
|
309
|
-
* @property {string} fileId - Unique identifier for the uploaded file
|
|
310
|
-
* @property {string} displayName - Human-readable name for the file
|
|
311
|
-
* @property {string} url - URL where the file can be accessed
|
|
312
|
-
* @property {string} fileType - MIME type or file extension of the uploaded file
|
|
313
|
-
*
|
|
314
|
-
* @example
|
|
315
|
-
* ```tsx
|
|
316
|
-
* const fileData: FileData = {
|
|
317
|
-
* fileId: 'file_123456789',
|
|
318
|
-
* displayName: 'document.pdf',
|
|
319
|
-
* url: 'https://example.com/uploads/document.pdf',
|
|
320
|
-
* fileType: 'application/pdf'
|
|
321
|
-
* };
|
|
322
|
-
* ```
|
|
323
|
-
*/
|
|
324
|
-
interface FileData {
|
|
325
|
-
fileId: string;
|
|
326
|
-
displayName: string;
|
|
327
|
-
url: string;
|
|
328
|
-
fileType: string;
|
|
329
|
-
}
|
|
330
|
-
type FileFormat = 'Video' | 'Image' | 'Audio' | 'Document' | 'Archive';
|
|
331
|
-
/**
|
|
332
|
-
* Props for file upload field.
|
|
333
|
-
* Used with fieldMap key: FILE_UPLOAD
|
|
334
|
-
*
|
|
335
|
-
* @interface FileUploadProps
|
|
336
|
-
*
|
|
337
|
-
* @property {string} id - The unique identifier for the form field
|
|
338
|
-
* @property {FileData[] | null | undefined} value - The current value of the form field (array of uploaded file data)
|
|
339
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
340
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
341
|
-
* @property {string} label - The display label for the form field
|
|
342
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
343
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
344
|
-
* @property {string} [buttonText] - Optional custom text for the upload button
|
|
345
|
-
* @property {number} [maxFiles] - Optional maximum number of files allowed
|
|
346
|
-
* @property {FileFormat[]} [allowedFileFormats] - Optional array of allowed file format extensions (e.g., [".pdf", ".doc", ".docx"])
|
|
347
|
-
* @property {string} [explanationText] - Optional explanatory text to display below the upload area
|
|
348
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
349
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
350
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
351
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
352
|
-
*
|
|
353
|
-
* @example
|
|
354
|
-
* ```tsx
|
|
355
|
-
* const fileUploadField: FileUploadProps = {
|
|
356
|
-
* id: 'documents',
|
|
357
|
-
* value: null,
|
|
358
|
-
* required: true,
|
|
359
|
-
* readOnly: false,
|
|
360
|
-
* label: 'Upload Documents',
|
|
361
|
-
* showLabel: true,
|
|
362
|
-
* description: { nodes: [{ type: 'text', text: 'Upload your documents (PDF, DOC, DOCX)' }] },
|
|
363
|
-
* buttonText: 'Choose Files',
|
|
364
|
-
* allowedFileFormats: ['.pdf', '.doc', '.docx'],
|
|
365
|
-
* explanationText: 'Maximum file size: 10MB',
|
|
366
|
-
* maxFiles: 5,
|
|
367
|
-
* onChange: (files) => console.log('Files changed:', files),
|
|
368
|
-
* onBlur: () => console.log('Field blurred'),
|
|
369
|
-
* onFocus: () => console.log('Field focused')
|
|
370
|
-
* };
|
|
371
|
-
* ```
|
|
372
|
-
*/
|
|
373
|
-
export interface FileUploadProps extends BaseFieldProps {
|
|
374
|
-
value: FileData[] | null | undefined;
|
|
375
|
-
label: string;
|
|
376
|
-
showLabel: boolean;
|
|
377
|
-
description?: forms.RichContent;
|
|
378
|
-
buttonText?: string;
|
|
379
|
-
maxFiles?: number;
|
|
380
|
-
allowedFileFormats?: FileFormat[];
|
|
381
|
-
explanationText?: string;
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Props for signature field.
|
|
385
|
-
* Used with fieldMap key: SIGNATURE
|
|
386
|
-
* The field MUST render a signature pad/canvas for capturing user signatures.
|
|
387
|
-
*
|
|
388
|
-
* @interface SignatureProps
|
|
389
|
-
*
|
|
390
|
-
* @property {string} id - The unique identifier for the form field
|
|
391
|
-
* @property {FileData | null | undefined} value - The current value of the signature field (FileData object containing signature image data)
|
|
392
|
-
* @property {string} label - The display label for the form field
|
|
393
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
394
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
395
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
396
|
-
* @property {boolean} imageUploadEnabled - Whether image upload functionality is enabled for the signature field
|
|
397
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
398
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
399
|
-
* @property {function} onChange - Callback function called when the signature value changes
|
|
400
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
401
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
402
|
-
*/
|
|
403
|
-
export interface SignatureProps extends BaseFieldProps {
|
|
404
|
-
value: FileData | null | undefined;
|
|
405
|
-
label: string;
|
|
406
|
-
showLabel: boolean;
|
|
407
|
-
imageUploadEnabled: boolean;
|
|
408
|
-
description?: forms.RichContent;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Props for rating input field from 1 to 5.
|
|
412
|
-
* Field allows to collect feedback on products, services and etc by choosing a rating from 1 to 5.
|
|
413
|
-
* Used with fieldMap key: RATING_INPUT
|
|
414
|
-
*
|
|
415
|
-
* @interface RatingInputProps
|
|
416
|
-
*
|
|
417
|
-
* @property {string} id - The unique identifier for the form field
|
|
418
|
-
* @property {number | null | undefined} value - The current value of the rating field (number between 1 and 5)
|
|
419
|
-
* @property {number} [defaultValue] - The default value for the rating field (number between 1 and 5)
|
|
420
|
-
* @property {string} label - The display label for the form field
|
|
421
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
422
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
423
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
424
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
425
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
426
|
-
* @property {function} onChange - Callback function called when the rating value changes
|
|
427
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
428
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
429
|
-
*/
|
|
430
|
-
export interface RatingInputProps extends BaseFieldProps {
|
|
431
|
-
value: number | null | undefined;
|
|
432
|
-
defaultValue: number | undefined;
|
|
433
|
-
label: string;
|
|
434
|
-
showLabel: boolean;
|
|
435
|
-
description?: forms.RichContent;
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Props for radio group field.
|
|
439
|
-
* Ask people to choose one option from a list.
|
|
440
|
-
* Used with fieldMap key: RADIO_GROUP
|
|
441
|
-
*
|
|
442
|
-
* @interface RadioGroupProps
|
|
443
|
-
*
|
|
444
|
-
* @property {string} id - The unique identifier for the form field
|
|
445
|
-
* @property {string | null | undefined} value - The current value of the radio group (selected option value)
|
|
446
|
-
* @property {string} label - The display label for the form field
|
|
447
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
448
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
449
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
450
|
-
* @property {ChoiceOption[]} options - Array of radio button options with id, value, label, and default properties
|
|
451
|
-
* @property {1 | 2 | 3} numberOfColumns - Number of columns for layout (1, 2, or 3)
|
|
452
|
-
* @property {Object} customOption - Configuration for custom "Other" option with text input
|
|
453
|
-
* @property {string} customOption.label - Label for the custom option radio button
|
|
454
|
-
* @property {string} customOption.placeholder - Placeholder text for the custom option input
|
|
455
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
456
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
457
|
-
* @property {function} onChange - Callback function called when the radio group value changes
|
|
458
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
459
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
460
|
-
*/
|
|
461
|
-
export interface RadioGroupProps extends BaseFieldProps {
|
|
462
|
-
value: string | null | undefined;
|
|
463
|
-
label: string;
|
|
464
|
-
showLabel: boolean;
|
|
465
|
-
options: ChoiceOption[];
|
|
466
|
-
description?: forms.RichContent;
|
|
467
|
-
numberOfColumns: 1 | 2 | 3;
|
|
468
|
-
customOption: CustomOption;
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Props for checkbox group field.
|
|
472
|
-
* Field allows to choose multiple options from a list.
|
|
473
|
-
* Used with fieldMap key: CHECKBOX_GROUP
|
|
474
|
-
*
|
|
475
|
-
* @interface CheckboxGroupProps
|
|
476
|
-
*
|
|
477
|
-
* @property {string} id - The unique identifier for the form field
|
|
478
|
-
* @property {string[] | null | undefined} value - The current values of the checkbox group (array of selected option values)
|
|
479
|
-
* @property {string} label - The display label for the form field
|
|
480
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
481
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
482
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
483
|
-
* @property {ChoiceOption[]} options - Array of checkbox options with id, value, label, and default properties
|
|
484
|
-
* @property {1 | 2 | 3} numberOfColumns - Number of columns for layout (1, 2, or 3)
|
|
485
|
-
* @property {Object} customOption - Configuration for custom "Other" option with text input
|
|
486
|
-
* @property {string} customOption.label - Label for the custom option checkbox
|
|
487
|
-
* @property {string} customOption.placeholder - Placeholder text for the custom option input
|
|
488
|
-
* @property {number} [minItems] - Minimum number of items that must be selected
|
|
489
|
-
* @property {number} [maxItems] - Maximum number of items that can be selected
|
|
490
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
491
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
492
|
-
* @property {function} onChange - Callback function called when the checkbox group values change
|
|
493
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
494
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
495
|
-
*/
|
|
496
|
-
export interface CheckboxGroupProps extends BaseFieldProps {
|
|
497
|
-
value: string[] | null | undefined;
|
|
498
|
-
label: string;
|
|
499
|
-
showLabel: boolean;
|
|
500
|
-
options: ChoiceOption[];
|
|
501
|
-
description?: forms.RichContent;
|
|
502
|
-
numberOfColumns: 1 | 2 | 3;
|
|
503
|
-
customOption: CustomOption;
|
|
504
|
-
maxItems?: number;
|
|
505
|
-
minItems?: number;
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* Props for dropdown field.
|
|
509
|
-
* Field allows to choose one option from a dropdown list.
|
|
510
|
-
* Used with fieldMap key: DROPDOWN
|
|
511
|
-
*
|
|
512
|
-
* @interface DropdownProps
|
|
513
|
-
*
|
|
514
|
-
* @property {string} id - The unique identifier for the form field
|
|
515
|
-
* @property {string | null | undefined} value - The current value of the dropdown (selected option value)
|
|
516
|
-
* @property {string} label - The display label for the form field
|
|
517
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
518
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
519
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
520
|
-
* @property {ChoiceOption[]} options - Array of dropdown options with id, value, label, and default properties
|
|
521
|
-
* @property {string} [placeholder] - Placeholder text for the dropdown when no option is selected
|
|
522
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
523
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
524
|
-
* @property {function} onChange - Callback function called when the dropdown value changes
|
|
525
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
526
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
527
|
-
*/
|
|
528
|
-
export interface DropdownProps extends BaseFieldProps {
|
|
529
|
-
value: string | null | undefined;
|
|
530
|
-
label: string;
|
|
531
|
-
showLabel: boolean;
|
|
532
|
-
options: ChoiceOption[];
|
|
533
|
-
placeholder?: string;
|
|
534
|
-
description?: forms.RichContent;
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* Props for tags field.
|
|
538
|
-
* Field allows to choose options by selecting tags.
|
|
539
|
-
* Used with fieldMap key: TAGS
|
|
540
|
-
*
|
|
541
|
-
* @interface TagsProps
|
|
542
|
-
*
|
|
543
|
-
* @property {string} id - The unique identifier for the form field
|
|
544
|
-
* @property {string[] | null | undefined} value - The current values of the tags field (array of selected option values)
|
|
545
|
-
* @property {string} label - The display label for the form field
|
|
546
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
547
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
548
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
549
|
-
* @property {ChoiceOption[]} options - Array of tag options with id, value, label, and default properties
|
|
550
|
-
* @property {0 | 1 | 2 | 3} numberOfColumns - Number of columns for layout (0 for auto, 1, 2, or 3)
|
|
551
|
-
* @property {Object} customOption - Configuration for custom "Other" option with text input
|
|
552
|
-
* @property {string} customOption.label - Label for the custom option
|
|
553
|
-
* @property {string} customOption.placeholder - Placeholder text for the custom option input
|
|
554
|
-
* @property {number} [minItems] - Minimum number of tags that must be selected
|
|
555
|
-
* @property {number} [maxItems] - Maximum number of tags that can be selected
|
|
556
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
557
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
558
|
-
* @property {function} onChange - Callback function called when the tags values change
|
|
559
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
560
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
561
|
-
*/
|
|
562
|
-
export interface TagsProps extends BaseFieldProps {
|
|
563
|
-
value: string[] | null | undefined;
|
|
564
|
-
options: ChoiceOption[];
|
|
565
|
-
label: string;
|
|
566
|
-
showLabel: boolean;
|
|
567
|
-
description?: forms.RichContent;
|
|
568
|
-
customOption?: CustomOption;
|
|
569
|
-
numberOfColumns: 0 | 1 | 2 | 3;
|
|
570
|
-
minItems?: number;
|
|
571
|
-
maxItems?: number;
|
|
572
|
-
}
|
|
573
|
-
/**
|
|
574
|
-
* Data structure for image choice option.
|
|
575
|
-
* Extends the base ChoiceOption with image-specific properties.
|
|
576
|
-
*
|
|
577
|
-
* @interface ImageChoiceOption
|
|
578
|
-
*
|
|
579
|
-
* @property {string} id - Unique identifier for the option
|
|
580
|
-
* @property {string} value - The value that will be submitted when this option is selected
|
|
581
|
-
* @property {string} label - Display label for the option
|
|
582
|
-
* @property {boolean} default - Whether this option is selected by default
|
|
583
|
-
* @property {Object} image - Image data for the option
|
|
584
|
-
* @property {string | undefined} image.alt - Alt text for accessibility (can be undefined)
|
|
585
|
-
* @property {string} image.id - Unique identifier for the image
|
|
586
|
-
* @property {string} [image.url] - Optional URL for the image source. If not provided, a placeholder will be shown.
|
|
587
|
-
*
|
|
588
|
-
* @example
|
|
589
|
-
* ```tsx
|
|
590
|
-
* const imageOption: ImageChoiceOption = {
|
|
591
|
-
* id: 'red-color',
|
|
592
|
-
* value: 'red',
|
|
593
|
-
* label: 'Red',
|
|
594
|
-
* default: false,
|
|
595
|
-
* image: {
|
|
596
|
-
* alt: 'Red color swatch',
|
|
597
|
-
* id: 'img_red_001',
|
|
598
|
-
* url: 'https://example.com/images/red-swatch.jpg'
|
|
599
|
-
* }
|
|
600
|
-
* };
|
|
601
|
-
* ```
|
|
602
|
-
*/
|
|
603
|
-
interface ImageChoiceOption extends ChoiceOption {
|
|
604
|
-
image: {
|
|
605
|
-
alt: string | undefined;
|
|
606
|
-
id: string;
|
|
607
|
-
url?: string;
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
/**
|
|
611
|
-
* Props for image choice field.
|
|
612
|
-
* Field allows users to select one or multiple options by clicking on images.
|
|
613
|
-
* Used with fieldMap key: IMAGE_CHOICE
|
|
614
|
-
*
|
|
615
|
-
* @interface ImageChoiceProps
|
|
616
|
-
*
|
|
617
|
-
* @property {string} id - The unique identifier for the form field
|
|
618
|
-
* @property {string | string[] | null | undefined} value - The current value(s) of the image choice field. For single selection, this is a string. For multiple selection, this is an array of strings.
|
|
619
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
620
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
621
|
-
* @property {string} label - The display label for the form field
|
|
622
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
623
|
-
* @property {ImageChoiceOption[]} options - Array of image choice options. Each option must include an image object with alt text, id, and optional URL.
|
|
624
|
-
* @property {1 | 2 | 3} numberOfColumns - Number of columns for the grid layout. Determines how many options are displayed per row.
|
|
625
|
-
* @property {boolean} [multiple=false] - Whether multiple selections are allowed. When true, users can select multiple options. When false, only one option can be selected at a time.
|
|
626
|
-
* @property {number} [minItems] - Minimum number of items that must be selected. Only applicable when multiple is true. Used for validation.
|
|
627
|
-
* @property {number} [maxItems] - Maximum number of items that can be selected. Only applicable when multiple is true. Used for validation.
|
|
628
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field. Can include formatted text, links, etc.
|
|
629
|
-
* @property {string} [error] - Error message to display when validation fails. Undefined when the field is valid.
|
|
630
|
-
* @property {function} onChange - Callback function called when the image choice value(s) change. Receives the new value(s) as parameter.
|
|
631
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
632
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
633
|
-
*
|
|
634
|
-
* @example
|
|
635
|
-
* ```tsx
|
|
636
|
-
* // Single selection example
|
|
637
|
-
* const singleImageChoice: ImageChoiceProps = {
|
|
638
|
-
* id: 'preferred-color',
|
|
639
|
-
* value: 'red',
|
|
640
|
-
* required: true,
|
|
641
|
-
* readOnly: false,
|
|
642
|
-
* label: 'Choose Your Preferred Color',
|
|
643
|
-
* showLabel: true,
|
|
644
|
-
* options: [
|
|
645
|
-
* {
|
|
646
|
-
* id: 'red',
|
|
647
|
-
* value: 'red',
|
|
648
|
-
* label: 'Red',
|
|
649
|
-
* default: false,
|
|
650
|
-
* image: {
|
|
651
|
-
* alt: 'Red color option',
|
|
652
|
-
* id: 'img_red',
|
|
653
|
-
* url: 'https://example.com/red.jpg'
|
|
654
|
-
* }
|
|
655
|
-
* },
|
|
656
|
-
* {
|
|
657
|
-
* id: 'blue',
|
|
658
|
-
* value: 'blue',
|
|
659
|
-
* label: 'Blue',
|
|
660
|
-
* default: false,
|
|
661
|
-
* image: {
|
|
662
|
-
* alt: 'Blue color option',
|
|
663
|
-
* id: 'img_blue',
|
|
664
|
-
* url: 'https://example.com/blue.jpg'
|
|
665
|
-
* }
|
|
666
|
-
* }
|
|
667
|
-
* ],
|
|
668
|
-
* numberOfColumns: 2,
|
|
669
|
-
* multiple: false,
|
|
670
|
-
* description: {
|
|
671
|
-
* nodes: [{ type: 'text', text: 'Select your favorite color from the options below' }]
|
|
672
|
-
* },
|
|
673
|
-
* onChange: (value) => console.log('Color selection changed:', value),
|
|
674
|
-
* onBlur: () => console.log('Field blurred'),
|
|
675
|
-
* onFocus: () => console.log('Field focused')
|
|
676
|
-
* };
|
|
677
|
-
*
|
|
678
|
-
* // Multiple selection example
|
|
679
|
-
* const multipleImageChoice: ImageChoiceProps = {
|
|
680
|
-
* id: 'preferred-features',
|
|
681
|
-
* value: ['feature1', 'feature3'],
|
|
682
|
-
* required: false,
|
|
683
|
-
* readOnly: false,
|
|
684
|
-
* label: 'Select Your Preferred Features',
|
|
685
|
-
* showLabel: true,
|
|
686
|
-
* options: [
|
|
687
|
-
* {
|
|
688
|
-
* id: 'feature1',
|
|
689
|
-
* value: 'feature1',
|
|
690
|
-
* label: 'Fast Loading',
|
|
691
|
-
* default: false,
|
|
692
|
-
* image: {
|
|
693
|
-
* alt: 'Fast loading icon',
|
|
694
|
-
* id: 'img_fast',
|
|
695
|
-
* url: 'https://example.com/fast.jpg'
|
|
696
|
-
* }
|
|
697
|
-
* },
|
|
698
|
-
* {
|
|
699
|
-
* id: 'feature2',
|
|
700
|
-
* value: 'feature2',
|
|
701
|
-
* label: 'Mobile Friendly',
|
|
702
|
-
* default: false,
|
|
703
|
-
* image: {
|
|
704
|
-
* alt: 'Mobile friendly icon',
|
|
705
|
-
* id: 'img_mobile',
|
|
706
|
-
* url: 'https://example.com/mobile.jpg'
|
|
707
|
-
* }
|
|
708
|
-
* },
|
|
709
|
-
* {
|
|
710
|
-
* id: 'feature3',
|
|
711
|
-
* value: 'feature3',
|
|
712
|
-
* label: 'Secure',
|
|
713
|
-
* default: false,
|
|
714
|
-
* image: {
|
|
715
|
-
* alt: 'Security icon',
|
|
716
|
-
* id: 'img_secure',
|
|
717
|
-
* url: 'https://example.com/secure.jpg'
|
|
718
|
-
* }
|
|
719
|
-
* }
|
|
720
|
-
* ],
|
|
721
|
-
* numberOfColumns: 3,
|
|
722
|
-
* multiple: true,
|
|
723
|
-
* minItems: 1,
|
|
724
|
-
* maxItems: 2,
|
|
725
|
-
* description: {
|
|
726
|
-
* nodes: [{ type: 'text', text: 'Choose up to 2 features that matter most to you' }]
|
|
727
|
-
* },
|
|
728
|
-
* onChange: (values) => console.log('Feature selection changed:', values),
|
|
729
|
-
* onBlur: () => console.log('Field blurred'),
|
|
730
|
-
* onFocus: () => console.log('Field focused')
|
|
731
|
-
* };
|
|
732
|
-
* ```
|
|
733
|
-
*/
|
|
734
|
-
export interface ImageChoiceProps extends BaseFieldProps {
|
|
735
|
-
value: string | string[] | null | undefined;
|
|
736
|
-
label: string;
|
|
737
|
-
showLabel: boolean;
|
|
738
|
-
options: ImageChoiceOption[];
|
|
739
|
-
numberOfColumns: 1 | 2 | 3;
|
|
740
|
-
multiple: boolean;
|
|
741
|
-
description?: forms.RichContent;
|
|
742
|
-
imageAspectRatio: 'contain' | 'cover';
|
|
743
|
-
}
|
|
744
|
-
/**
|
|
745
|
-
* Props for date input field.
|
|
746
|
-
* Used with fieldMap key: DATE_INPUT
|
|
747
|
-
* The field MUST render 3 separate number inputs on the UI for day, month and year.
|
|
748
|
-
*
|
|
749
|
-
* @interface DateInputProps
|
|
750
|
-
*
|
|
751
|
-
* @property {string} id - The unique identifier for the form field
|
|
752
|
-
* @property {string | null | undefined} value - The current value of the form field (ISO date string format: YYYY-MM-DD)
|
|
753
|
-
* @property {string} label - The display label for the form field
|
|
754
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
755
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
756
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
757
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
758
|
-
* @property {boolean} showPlaceholder - Whether to show placeholder text for the date inputs
|
|
759
|
-
* @property {'SUNDAY' | 'MONDAY'} [firstDayOfWeek] - The first day of the week for date calculations (defaults to 'SUNDAY')
|
|
760
|
-
* @property {'all' | 'past' | 'future'} [acceptedDates] - Which dates are accepted for selection (defaults to 'all')
|
|
761
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
762
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
763
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
764
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
765
|
-
*
|
|
766
|
-
* @example
|
|
767
|
-
* ```tsx
|
|
768
|
-
* const dateField: DateInputProps = {
|
|
769
|
-
* id: 'event-date',
|
|
770
|
-
* value: '2024-12-25',
|
|
771
|
-
* label: 'Event Date',
|
|
772
|
-
* required: true,
|
|
773
|
-
* readOnly: false,
|
|
774
|
-
* showLabel: true,
|
|
775
|
-
* showPlaceholder: true,
|
|
776
|
-
* firstDayOfWeek: 'MONDAY',
|
|
777
|
-
* acceptedDates: 'future',
|
|
778
|
-
* onChange: (value) => console.log('Value changed:', value),
|
|
779
|
-
* onBlur: () => console.log('Field blurred'),
|
|
780
|
-
* onFocus: () => console.log('Field focused')
|
|
781
|
-
* };
|
|
782
|
-
* ```
|
|
783
|
-
*/
|
|
784
|
-
export interface DateInputProps extends BaseFieldProps {
|
|
785
|
-
value: string | null | undefined;
|
|
786
|
-
label: string;
|
|
787
|
-
showLabel: boolean;
|
|
788
|
-
showPlaceholder: boolean;
|
|
789
|
-
showDateLabels: boolean;
|
|
790
|
-
acceptedDates: 'all' | 'past' | 'future';
|
|
791
|
-
description?: forms.RichContent;
|
|
792
|
-
}
|
|
793
|
-
/**
|
|
794
|
-
* Props for date picker field.
|
|
795
|
-
* Field allows to select a date from a calendar.
|
|
796
|
-
* Used with fieldMap key: DATE_PICKER
|
|
797
|
-
*
|
|
798
|
-
* @interface DatePickerProps
|
|
799
|
-
*
|
|
800
|
-
* @property {string} id - The unique identifier for the form field
|
|
801
|
-
* @property {string | null | undefined} value - The current value of the form field (ISO date string format: YYYY-MM-DD)
|
|
802
|
-
* @property {string} label - The display label for the form field
|
|
803
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
804
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
805
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
806
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
807
|
-
* @property {string} [placeholder] - Placeholder text for the date picker input
|
|
808
|
-
* @property {'SUNDAY' | 'MONDAY'} [firstDayOfWeek] - The first day of the week for the calendar (defaults to 'SUNDAY')
|
|
809
|
-
* @property {'all' | 'past' | 'future'} [acceptedDates] - Which dates are accepted for selection (defaults to 'all')
|
|
810
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
811
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
812
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
813
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
814
|
-
*
|
|
815
|
-
* @example
|
|
816
|
-
* ```tsx
|
|
817
|
-
* const dateField: DatePickerProps = {
|
|
818
|
-
* id: 'appointment-date',
|
|
819
|
-
* value: '2024-12-25',
|
|
820
|
-
* label: 'Appointment Date',
|
|
821
|
-
* required: true,
|
|
822
|
-
* readOnly: false,
|
|
823
|
-
* showLabel: true,
|
|
824
|
-
* placeholder: 'Select a date',
|
|
825
|
-
* firstDayOfWeek: 'MONDAY',
|
|
826
|
-
* acceptedDates: 'future',
|
|
827
|
-
* onChange: (value) => console.log('Value changed:', value),
|
|
828
|
-
* onBlur: () => console.log('Field blurred'),
|
|
829
|
-
* onFocus: () => console.log('Field focused')
|
|
830
|
-
* };
|
|
831
|
-
* ```
|
|
832
|
-
*/
|
|
833
|
-
export interface DatePickerProps extends BaseFieldProps {
|
|
834
|
-
value: string | null | undefined;
|
|
835
|
-
label: string;
|
|
836
|
-
showLabel: boolean;
|
|
837
|
-
placeholder?: string;
|
|
838
|
-
firstDayOfWeek?: 'SUNDAY' | 'MONDAY';
|
|
839
|
-
acceptedDates: 'all' | 'past' | 'future';
|
|
840
|
-
description?: forms.RichContent;
|
|
841
|
-
}
|
|
842
|
-
/**
|
|
843
|
-
* Props for date time input field.
|
|
844
|
-
* Field allows to enter a date and time.
|
|
845
|
-
* Used with fieldMap key: DATE_TIME_INPUT
|
|
846
|
-
*
|
|
847
|
-
* @interface DateTimeInputProps
|
|
848
|
-
*
|
|
849
|
-
* @property {string} id - The unique identifier for the form field
|
|
850
|
-
* @property {string | null | undefined} value - The current value of the form field (ISO datetime string format: YYYY-MM-DDTHH:mm)
|
|
851
|
-
* @property {string} label - The display label for the form field
|
|
852
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
853
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
854
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
855
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
856
|
-
* @property {boolean} showDateLabels - Whether to display individual labels for date and time inputs
|
|
857
|
-
* @property {boolean} showPlaceholder - Whether to show placeholder text in the inputs
|
|
858
|
-
* @property {boolean} use24HourFormat - Whether to use 24-hour format for time input (defaults to true)
|
|
859
|
-
* @property {'all' | 'past' | 'future'} [acceptedDates] - Which dates are accepted for selection (defaults to 'all')
|
|
860
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
861
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
862
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
863
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
864
|
-
*
|
|
865
|
-
* @example
|
|
866
|
-
* ```tsx
|
|
867
|
-
* const dateTimeField: DateTimeInputProps = {
|
|
868
|
-
* id: 'appointment-datetime',
|
|
869
|
-
* value: '2024-12-25T14:30',
|
|
870
|
-
* label: 'Appointment Date & Time',
|
|
871
|
-
* required: true,
|
|
872
|
-
* readOnly: false,
|
|
873
|
-
* showLabel: true,
|
|
874
|
-
* showDateLabels: true,
|
|
875
|
-
* showPlaceholder: true,
|
|
876
|
-
* use24HourFormat: true,
|
|
877
|
-
* acceptedDates: 'future',
|
|
878
|
-
* onChange: (value) => console.log('Value changed:', value),
|
|
879
|
-
* onBlur: () => console.log('Field blurred'),
|
|
880
|
-
* onFocus: () => console.log('Field focused')
|
|
881
|
-
* };
|
|
882
|
-
* ```
|
|
883
|
-
*/
|
|
884
|
-
export interface DateTimeInputProps extends BaseFieldProps {
|
|
885
|
-
value: string | null | undefined;
|
|
886
|
-
label: string;
|
|
887
|
-
showLabel: boolean;
|
|
888
|
-
showDateLabels: boolean;
|
|
889
|
-
showPlaceholder: boolean;
|
|
890
|
-
use24HourFormat: boolean;
|
|
891
|
-
acceptedDates: 'all' | 'past' | 'future';
|
|
892
|
-
description?: forms.RichContent;
|
|
893
|
-
}
|
|
894
|
-
/**
|
|
895
|
-
* Props for time input field.
|
|
896
|
-
* Field allows to enetr a time.
|
|
897
|
-
* Used with fieldMap key: TIME_INPUT
|
|
898
|
-
*
|
|
899
|
-
* @interface TimeInputProps
|
|
900
|
-
*
|
|
901
|
-
* @property {string} id - The unique identifier for the form field
|
|
902
|
-
* @property {string | null | undefined} value - The current value of the form field (time string format: HH:mm or HH:mm:ss)
|
|
903
|
-
* @property {string} label - The display label for the form field
|
|
904
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
905
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
906
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
907
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
908
|
-
* @property {boolean} showPlaceholder - Whether to show placeholder text in the input
|
|
909
|
-
* @property {boolean} use24HourFormat - Whether to use 24-hour format for time input (defaults to true)
|
|
910
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
911
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
912
|
-
* @property {function} onBlur - Callback function callezqd when the field loses focus
|
|
913
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
914
|
-
*
|
|
915
|
-
* @example
|
|
916
|
-
* ```tsx
|
|
917
|
-
* const timeField: TimeInputProps = {
|
|
918
|
-
* id: 'appointment-time',
|
|
919
|
-
* value: '14:30',
|
|
920
|
-
* label: 'Appointment Time',
|
|
921
|
-
* required: true,
|
|
922
|
-
* readOnly: false,
|
|
923
|
-
* showLabel: true,
|
|
924
|
-
* showPlaceholder: true,
|
|
925
|
-
* use24HourFormat: true,
|
|
926
|
-
* onChange: (value) => console.log('Value changed:', value),
|
|
927
|
-
* onBlur: () => console.log('Field blurred'),
|
|
928
|
-
* onFocus: () => console.log('Field focused')
|
|
929
|
-
* };
|
|
930
|
-
* ```
|
|
931
|
-
*/
|
|
932
|
-
export interface TimeInputProps extends BaseFieldProps {
|
|
933
|
-
value: string | null | undefined;
|
|
934
|
-
label: string;
|
|
935
|
-
showLabel: boolean;
|
|
936
|
-
showPlaceholder: boolean;
|
|
937
|
-
use24HourFormat: boolean;
|
|
938
|
-
description?: forms.RichContent;
|
|
939
|
-
}
|
|
940
|
-
/**
|
|
941
|
-
* Props for rich text field.
|
|
942
|
-
* The field is used to display text in the form.
|
|
943
|
-
* Used with fieldMap key: RICH_TEXT
|
|
944
|
-
*
|
|
945
|
-
* @interface RichTextProps
|
|
946
|
-
*
|
|
947
|
-
* @property {forms.RichContent} content - The textrich content to display
|
|
948
|
-
* @property {number} maxShownParagraphs - Maximum number of paragraphs to display before truncating
|
|
949
|
-
*
|
|
950
|
-
* @example
|
|
951
|
-
* ```tsx
|
|
952
|
-
* const richTextField: RichTextProps = {
|
|
953
|
-
* content: {
|
|
954
|
-
* nodes: [
|
|
955
|
-
* {
|
|
956
|
-
* type: 'text',
|
|
957
|
-
* text: 'Please fill out all required fields marked with an asterisk (*).',
|
|
958
|
-
* marks: [{ type: 'bold' }]
|
|
959
|
-
* }
|
|
960
|
-
* ]
|
|
961
|
-
* },
|
|
962
|
-
* maxShownParagraphs: 2
|
|
963
|
-
* };
|
|
964
|
-
* ```
|
|
965
|
-
*/
|
|
966
|
-
export interface RichTextProps {
|
|
967
|
-
content: forms.RichContent;
|
|
968
|
-
maxShownParagraphs: number;
|
|
969
|
-
}
|
|
970
|
-
/**
|
|
971
|
-
* Props for submit button field.
|
|
972
|
-
* The field is used to render a submit button for the form.
|
|
973
|
-
* Used with fieldMap key: SUBMIT_BUTTON
|
|
974
|
-
*
|
|
975
|
-
* @interface SubmitButtonProps
|
|
976
|
-
*
|
|
977
|
-
* @property {string} id - The unique identifier for the submit button
|
|
978
|
-
* @property {string} text - The text to display on the submit button
|
|
979
|
-
*
|
|
980
|
-
* @example
|
|
981
|
-
* ```tsx
|
|
982
|
-
* const submitButton: SubmitButtonProps = {
|
|
983
|
-
* id: 'submit',
|
|
984
|
-
* text: 'Submit Form'
|
|
985
|
-
* };
|
|
986
|
-
* ```
|
|
987
|
-
*/
|
|
988
|
-
export interface SubmitButtonProps {
|
|
989
|
-
id: string;
|
|
990
|
-
text: string;
|
|
991
|
-
}
|
|
992
|
-
/**
|
|
993
|
-
* Props for fixed payment field.
|
|
994
|
-
* Field displays a fixed payment amount with currency.
|
|
995
|
-
* Used with fieldMap key: FIXED_PAYMENT
|
|
996
|
-
*
|
|
997
|
-
* @interface FixedPaymentProps
|
|
998
|
-
*
|
|
999
|
-
* @property {string} label - The display label for the form field
|
|
1000
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
1001
|
-
* @property {number} amount - The fixed payment amount
|
|
1002
|
-
* @property {string} currency - The currency symbol (e.g., '$', '€', '£')
|
|
1003
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
1004
|
-
*
|
|
1005
|
-
* @example
|
|
1006
|
-
* ```tsx
|
|
1007
|
-
* const fixedPaymentField: FixedPaymentProps = {
|
|
1008
|
-
* label: 'Payment Amount',
|
|
1009
|
-
* showLabel: true,
|
|
1010
|
-
* amount: 29.99,
|
|
1011
|
-
* currency: '$',
|
|
1012
|
-
* description: { nodes: [{ type: 'text', text: 'This is a one-time payment' }] }
|
|
1013
|
-
* };
|
|
1014
|
-
* ```
|
|
1015
|
-
*/
|
|
1016
|
-
export interface FixedPaymentProps {
|
|
1017
|
-
label: string;
|
|
1018
|
-
showLabel: boolean;
|
|
1019
|
-
amount: number;
|
|
1020
|
-
currency: string;
|
|
1021
|
-
description?: forms.RichContent;
|
|
1022
|
-
}
|
|
1023
|
-
/**
|
|
1024
|
-
* Props for payment input field.
|
|
1025
|
-
* Field allows users to enter a custom payment amount.
|
|
1026
|
-
* Used with fieldMap key: PAYMENT_INPUT
|
|
1027
|
-
*
|
|
1028
|
-
* @interface PaymentInputProps
|
|
1029
|
-
*
|
|
1030
|
-
* @property {string} id - The unique identifier for the form field
|
|
1031
|
-
* @property {string | null | undefined} value - The current value of the form field
|
|
1032
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
1033
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
1034
|
-
* @property {string} label - The display label for the form field
|
|
1035
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
1036
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
1037
|
-
* @property {string} [placeholder] - Optional placeholder text to display when the field is empty
|
|
1038
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
1039
|
-
* @property {string} currency - The currency symbol (e.g., '$', '€', '£')
|
|
1040
|
-
* @property {string} minValue - Minimum payment amount as string
|
|
1041
|
-
* @property {string} [maxValue] - Optional maximum payment amount as string
|
|
1042
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
1043
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
1044
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
1045
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
1046
|
-
*
|
|
1047
|
-
* @example
|
|
1048
|
-
* ```tsx
|
|
1049
|
-
* const paymentInputField: PaymentInputProps = {
|
|
1050
|
-
* id: 'payment',
|
|
1051
|
-
* value: '25.50',
|
|
1052
|
-
* required: true,
|
|
1053
|
-
* readOnly: false,
|
|
1054
|
-
* label: 'Payment Amount',
|
|
1055
|
-
* showLabel: true,
|
|
1056
|
-
* required: true,
|
|
1057
|
-
* placeholder: 'Enter amount',
|
|
1058
|
-
* description: { nodes: [{ type: 'text', text: 'Enter your payment amount' }] },
|
|
1059
|
-
* currency: '$',
|
|
1060
|
-
* minValue: '1.00',
|
|
1061
|
-
* maxValue: '1000.00',
|
|
1062
|
-
* onChange: (value) => console.log('Payment changed:', value),
|
|
1063
|
-
* onBlur: () => console.log('Field blurred'),
|
|
1064
|
-
* onFocus: () => console.log('Field focused')
|
|
1065
|
-
* };
|
|
1066
|
-
* ```
|
|
1067
|
-
*/
|
|
1068
|
-
export interface PaymentInputProps extends BaseFieldProps {
|
|
1069
|
-
value: string | null | undefined;
|
|
1070
|
-
label: string;
|
|
1071
|
-
showLabel: boolean;
|
|
1072
|
-
required: boolean;
|
|
1073
|
-
placeholder?: string;
|
|
1074
|
-
description?: forms.RichContent;
|
|
1075
|
-
currency: string;
|
|
1076
|
-
minValue: string;
|
|
1077
|
-
maxValue?: string;
|
|
1078
|
-
}
|
|
1079
|
-
/**
|
|
1080
|
-
* Props for donation field.
|
|
1081
|
-
* Field allows users to select a donation amount.
|
|
1082
|
-
* Used with fieldMap key: DONATION
|
|
1083
|
-
*
|
|
1084
|
-
* @interface DonationProps
|
|
1085
|
-
*
|
|
1086
|
-
* @property {string} id - The unique identifier for the form field
|
|
1087
|
-
* @property {string | null | undefined} value - The current value of the form field
|
|
1088
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
1089
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
1090
|
-
* @property {string} label - The display label for the form field
|
|
1091
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
1092
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
1093
|
-
* @property {1 | 2 | 3} numberOfColumns - Number of columns for layout (1, 2, or 3)
|
|
1094
|
-
* @property {string} currency - The currency symbol (e.g., '$', '€', '£')
|
|
1095
|
-
* @property {string[]} options - Array of predefined donation amounts
|
|
1096
|
-
* @property {CustomOption} [customOption] - Optional configuration for custom donation amount input
|
|
1097
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
1098
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
1099
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
1100
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
1101
|
-
*
|
|
1102
|
-
* @example
|
|
1103
|
-
* ```tsx
|
|
1104
|
-
* const donationField: DonationProps = {
|
|
1105
|
-
* id: 'donation',
|
|
1106
|
-
* value: '50.00',
|
|
1107
|
-
* required: false,
|
|
1108
|
-
* readOnly: false,
|
|
1109
|
-
* label: 'Donation Amount',
|
|
1110
|
-
* showLabel: true,
|
|
1111
|
-
* description: { nodes: [{ type: 'text', text: 'Choose a donation amount' }] },
|
|
1112
|
-
* numberOfColumns: 2,
|
|
1113
|
-
* currency: '$',
|
|
1114
|
-
* options: ['25.00', '50.00', '100.00', '250.00'],
|
|
1115
|
-
* customOption: { label: 'Other Amount', placeholder: 'Enter custom amount' },
|
|
1116
|
-
* onChange: (value) => console.log('Donation changed:', value),
|
|
1117
|
-
* onBlur: () => console.log('Field blurred'),
|
|
1118
|
-
* onFocus: () => console.log('Field focused')
|
|
1119
|
-
* };
|
|
1120
|
-
* ```
|
|
1121
|
-
*/
|
|
1122
|
-
export interface DonationProps extends BaseFieldProps {
|
|
1123
|
-
value: string | null | undefined;
|
|
1124
|
-
label: string;
|
|
1125
|
-
showLabel: boolean;
|
|
1126
|
-
description?: forms.RichContent;
|
|
1127
|
-
numberOfColumns: 1 | 2 | 3;
|
|
1128
|
-
currency: string;
|
|
1129
|
-
options: string[];
|
|
1130
|
-
customOption?: CustomOption;
|
|
1131
|
-
}
|
|
1132
|
-
/**
|
|
1133
|
-
* Props for appointment field.
|
|
1134
|
-
* Field allows users to select a date and time for an appointment.
|
|
1135
|
-
* Used with fieldMap key: APPOINTMENT
|
|
1136
|
-
*
|
|
1137
|
-
* @interface AppointmentProps
|
|
1138
|
-
*
|
|
1139
|
-
* @property {string} id - The unique identifier for the form field
|
|
1140
|
-
* @property {string | null | undefined} value - The current value of the form field (ISO datetime string format: YYYY-MM-DDTHH:mm)
|
|
1141
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
1142
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
1143
|
-
* @property {string} label - The display label for the form field
|
|
1144
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
1145
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
1146
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
1147
|
-
* @property {function} onChange - Callback function called when the appointment value changes
|
|
1148
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
1149
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
1150
|
-
*
|
|
1151
|
-
* @example
|
|
1152
|
-
* ```tsx
|
|
1153
|
-
* const appointmentField: AppointmentProps = {
|
|
1154
|
-
* id: 'appointment',
|
|
1155
|
-
* value: '2024-12-25T14:30',
|
|
1156
|
-
* required: true,
|
|
1157
|
-
* readOnly: false,
|
|
1158
|
-
* label: 'Appointment Date & Time',
|
|
1159
|
-
* showLabel: true,
|
|
1160
|
-
* description: { nodes: [{ type: 'text', text: 'Choose your preferred appointment time' }] },
|
|
1161
|
-
* onChange: (value) => console.log('Appointment changed:', value),
|
|
1162
|
-
* onBlur: () => console.log('Field blurred'),
|
|
1163
|
-
* onFocus: () => console.log('Field focused')
|
|
1164
|
-
* };
|
|
1165
|
-
* ```
|
|
1166
|
-
*/
|
|
1167
|
-
export interface AppointmentProps extends BaseFieldProps {
|
|
1168
|
-
value: string | null | undefined;
|
|
1169
|
-
label: string;
|
|
1170
|
-
showLabel: boolean;
|
|
1171
|
-
description?: forms.RichContent;
|
|
1172
|
-
}
|
|
1173
|
-
interface ProductOption extends ChoiceOption {
|
|
1174
|
-
price: string;
|
|
1175
|
-
minAmount: number;
|
|
1176
|
-
maxAmount: number;
|
|
1177
|
-
image: {
|
|
1178
|
-
alt: string | undefined;
|
|
1179
|
-
id: string;
|
|
1180
|
-
};
|
|
1181
|
-
}
|
|
1182
|
-
interface ProductValue {
|
|
1183
|
-
productId: string;
|
|
1184
|
-
price: string | number;
|
|
1185
|
-
quantity: number;
|
|
1186
|
-
}
|
|
1187
|
-
/**
|
|
1188
|
-
* Props for product list field.
|
|
1189
|
-
* Field allows to display and select products from a list.
|
|
1190
|
-
* Used with fieldMap key: PRODUCT_LIST
|
|
1191
|
-
*
|
|
1192
|
-
* @interface ProductListProps
|
|
1193
|
-
*
|
|
1194
|
-
* @property {string} id - The unique identifier for the form field
|
|
1195
|
-
* @property {ProductValue | null | undefined} value - The current value of the form field (selected product data)
|
|
1196
|
-
* @property {boolean} required - Whether the field is required for form submission
|
|
1197
|
-
* @property {boolean} readOnly - Whether the field is read-only and cannot be edited by the user
|
|
1198
|
-
* @property {string} label - The display label for the form field
|
|
1199
|
-
* @property {boolean} showLabel - Whether to display the field label
|
|
1200
|
-
* @property {forms.RichContent} [description] - Optional rich content description for the field
|
|
1201
|
-
* @property {ProductOption[]} options - Array of product options with id, value, label, price, quantity limits, and image
|
|
1202
|
-
* @property {number | undefined} minItems - Optional minimum number of products that must be selected
|
|
1203
|
-
* @property {number | undefined} maxItems - Optional maximum number of products that can be selected
|
|
1204
|
-
* @property {string} currency - The price currency symbol
|
|
1205
|
-
* @property {string} [error] - Error message to display when validation fails (undefined when valid)
|
|
1206
|
-
* @property {function} onChange - Callback function called when the field value changes
|
|
1207
|
-
* @property {function} onBlur - Callback function called when the field loses focus
|
|
1208
|
-
* @property {function} onFocus - Callback function called when the field gains focus
|
|
1209
|
-
*
|
|
1210
|
-
* @example
|
|
1211
|
-
* ```tsx
|
|
1212
|
-
* const productListField: ProductListProps = {
|
|
1213
|
-
* id: 'products',
|
|
1214
|
-
* value: [{ productId: 'prod_123', quantity: 2 }],
|
|
1215
|
-
* required: true,
|
|
1216
|
-
* readOnly: false,
|
|
1217
|
-
* label: 'Select Products',
|
|
1218
|
-
* showLabel: true,
|
|
1219
|
-
* description: { nodes: [{ type: 'text', text: 'Choose your desired products' }] },
|
|
1220
|
-
* options: [
|
|
1221
|
-
* {
|
|
1222
|
-
* id: 'prod_123',
|
|
1223
|
-
* value: 'prod_123',
|
|
1224
|
-
* label: 'Premium Widget',
|
|
1225
|
-
* default: false,
|
|
1226
|
-
* price: '29.99',
|
|
1227
|
-
* minAmount: 1,
|
|
1228
|
-
* maxAmount: 10,
|
|
1229
|
-
* image: { alt: 'Premium Widget', id: 'img_123' }
|
|
1230
|
-
* }
|
|
1231
|
-
* ],
|
|
1232
|
-
* currency: '$',
|
|
1233
|
-
* minItems: 1,
|
|
1234
|
-
* maxItems: 5,
|
|
1235
|
-
* onChange: (value) => console.log('Product selection changed:', value),
|
|
1236
|
-
* onBlur: () => console.log('Field blurred'),
|
|
1237
|
-
* onFocus: () => console.log('Field focused')
|
|
1238
|
-
* };
|
|
1239
|
-
* ```
|
|
1240
|
-
*/
|
|
1241
|
-
export interface ProductListProps extends BaseFieldProps {
|
|
1242
|
-
value: ProductValue | null | undefined;
|
|
1243
|
-
label: string;
|
|
1244
|
-
showLabel: boolean;
|
|
1245
|
-
description?: forms.RichContent;
|
|
1246
|
-
options: ProductOption[];
|
|
1247
|
-
minItems: number | undefined;
|
|
1248
|
-
maxItems: number | undefined;
|
|
1249
|
-
currency: string;
|
|
1250
|
-
}
|
|
1251
|
-
export {};
|
|
1
|
+
import { type CheckboxGroupProps, type CheckboxProps, type PhoneInputProps, type DateInputProps, type DatePickerProps, type DateTimeInputProps, type DropdownProps, type FileUploadProps, type MultilineAddressProps, type NumberInputProps, type RadioGroupProps, type RatingInputProps, type RichTextProps, type SignatureProps, type SubmitButtonProps, type TagsProps, type TextAreaProps, type TextInputProps, type TimeInputProps, type ProductListProps, type FixedPaymentProps, type PaymentInputProps, type DonationProps, type AppointmentProps, type ImageChoiceProps } from '@wix/form-public';
|
|
2
|
+
export type { CheckboxGroupProps, CheckboxProps, PhoneInputProps, DateInputProps, DatePickerProps, DateTimeInputProps, DropdownProps, FileUploadProps, MultilineAddressProps, NumberInputProps, RadioGroupProps, RatingInputProps, RichTextProps, SignatureProps, SubmitButtonProps, TagsProps, TextAreaProps, TextInputProps, TimeInputProps, ProductListProps, FixedPaymentProps, PaymentInputProps, DonationProps, AppointmentProps, ImageChoiceProps, };
|
|
3
|
+
export type FormValues = Record<string, any>;
|