@wix/headless-forms 0.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.
Files changed (49) hide show
  1. package/README.md +46 -0
  2. package/cjs/dist/react/Form.d.ts +802 -0
  3. package/cjs/dist/react/Form.js +776 -0
  4. package/cjs/dist/react/Phone.d.ts +47 -0
  5. package/cjs/dist/react/Phone.js +56 -0
  6. package/cjs/dist/react/constants/calling-country-codes.d.ts +242 -0
  7. package/cjs/dist/react/constants/calling-country-codes.js +242 -0
  8. package/cjs/dist/react/context/FieldContext.d.ts +12 -0
  9. package/cjs/dist/react/context/FieldContext.js +16 -0
  10. package/cjs/dist/react/context/FieldLayoutContext.d.ts +12 -0
  11. package/cjs/dist/react/context/FieldLayoutContext.js +21 -0
  12. package/cjs/dist/react/core/Form.d.ts +342 -0
  13. package/cjs/dist/react/core/Form.js +278 -0
  14. package/cjs/dist/react/index.d.ts +3 -0
  15. package/cjs/dist/react/index.js +42 -0
  16. package/cjs/dist/react/types.d.ts +3 -0
  17. package/cjs/dist/react/types.js +2 -0
  18. package/cjs/dist/react/utils.d.ts +13 -0
  19. package/cjs/dist/react/utils.js +20 -0
  20. package/cjs/dist/services/form-service.d.ts +114 -0
  21. package/cjs/dist/services/form-service.js +152 -0
  22. package/cjs/dist/services/index.d.ts +1 -0
  23. package/cjs/dist/services/index.js +17 -0
  24. package/cjs/package.json +3 -0
  25. package/dist/react/Form.d.ts +802 -0
  26. package/dist/react/Form.js +740 -0
  27. package/dist/react/Phone.d.ts +47 -0
  28. package/dist/react/Phone.js +50 -0
  29. package/dist/react/constants/calling-country-codes.d.ts +242 -0
  30. package/dist/react/constants/calling-country-codes.js +241 -0
  31. package/dist/react/context/FieldContext.d.ts +12 -0
  32. package/dist/react/context/FieldContext.js +9 -0
  33. package/dist/react/context/FieldLayoutContext.d.ts +12 -0
  34. package/dist/react/context/FieldLayoutContext.js +13 -0
  35. package/dist/react/core/Form.d.ts +342 -0
  36. package/dist/react/core/Form.js +269 -0
  37. package/dist/react/index.d.ts +3 -0
  38. package/dist/react/index.js +3 -0
  39. package/dist/react/types.d.ts +3 -0
  40. package/dist/react/types.js +1 -0
  41. package/dist/react/utils.d.ts +13 -0
  42. package/dist/react/utils.js +17 -0
  43. package/dist/services/form-service.d.ts +114 -0
  44. package/dist/services/form-service.js +148 -0
  45. package/dist/services/index.d.ts +1 -0
  46. package/dist/services/index.js +1 -0
  47. package/package.json +62 -0
  48. package/react/package.json +4 -0
  49. package/services/package.json +4 -0
@@ -0,0 +1,342 @@
1
+ import { forms } from '@wix/forms';
2
+ import { FormServiceConfig } from '../../services/form-service.js';
3
+ import { FormValues } from '../types.js';
4
+ /**
5
+ * Props for Root headless component
6
+ */
7
+ export interface RootProps {
8
+ children: React.ReactNode;
9
+ formServiceConfig: FormServiceConfig;
10
+ }
11
+ /**
12
+ * Root component that provides the Form service context to its children.
13
+ * This component sets up the necessary services for rendering and managing form data.
14
+ *
15
+ * @order 1
16
+ * @component
17
+ * @param {RootProps} props - Component props
18
+ * @param {React.ReactNode} props.children - Child components that will have access to form context
19
+ * @param {FormServiceConfig} props.formServiceConfig - Configuration object containing form data
20
+ * @example
21
+ * ```tsx
22
+ * import { Form } from '@wix/headless-forms/react';
23
+ * import { loadFormServiceConfig } from '@wix/headless-forms/services';
24
+ *
25
+ * // Pattern 1: Pre-loaded form data (SSR/SSG)
26
+ * function FormPage({ formServiceConfig }) {
27
+ * return (
28
+ * <Form.Root formServiceConfig={formServiceConfig}>
29
+ * <Form.Loading>
30
+ * {({ isLoading }) => isLoading ? <div>Loading form...</div> : null}
31
+ * </Form.Loading>
32
+ * <Form.LoadingError>
33
+ * {({ error, hasError }) => hasError ? <div>{error}</div> : null}
34
+ * </Form.LoadingError>
35
+ * <Form.Fields fieldMap={FIELD_MAP} />
36
+ * </Form.Root>
37
+ * );
38
+ * }
39
+ *
40
+ * // Pattern 2: Lazy loading with formId (Client-side)
41
+ * function DynamicFormPage({ formId }) {
42
+ * return (
43
+ * <Form.Root formServiceConfig={{ formId }}>
44
+ * <Form.Loading>
45
+ * {({ isLoading }) => isLoading ? <div>Loading form...</div> : null}
46
+ * </Form.Loading>
47
+ * <Form.LoadingError>
48
+ * {({ error, hasError }) => hasError ? <div>{error}</div> : null}
49
+ * </Form.LoadingError>
50
+ * <Form.Fields fieldMap={FIELD_MAP} />
51
+ * </Form.Root>
52
+ * );
53
+ * }
54
+ * ```
55
+ */
56
+ export declare function Root({ formServiceConfig, children, }: RootProps): React.ReactNode;
57
+ /**
58
+ * Props for FormLoading headless component
59
+ */
60
+ export interface FormLoadingProps {
61
+ /** Render prop function that receives loading state data */
62
+ children: (props: FormLoadingRenderProps) => React.ReactNode;
63
+ }
64
+ /**
65
+ * Render props for FormLoading component
66
+ */
67
+ export interface FormLoadingRenderProps {
68
+ /** Whether the form is currently loading */
69
+ isLoading: boolean;
70
+ }
71
+ /**
72
+ * Headless component for form loading state access
73
+ *
74
+ * @component
75
+ * @param {FormLoadingProps} props - Component props
76
+ * @param {FormLoadingProps['children']} props.children - Render prop function that receives loading state
77
+ * @example
78
+ * ```tsx
79
+ * import { Form } from '@wix/headless-forms/react';
80
+ *
81
+ * function FormLoadingIndicator() {
82
+ * return (
83
+ * <Form.Loading>
84
+ * {({ isLoading }) => (
85
+ * isLoading ? (
86
+ * <div>Loading form...</div>
87
+ * ) : null
88
+ * )}
89
+ * </Form.Loading>
90
+ * );
91
+ * }
92
+ * ```
93
+ */
94
+ export declare function Loading(props: FormLoadingProps): import("react").ReactNode;
95
+ /**
96
+ * Props for FormError headless component
97
+ */
98
+ export interface FormErrorProps {
99
+ /** Render prop function that receives error state data */
100
+ children: (props: FormErrorRenderProps) => React.ReactNode;
101
+ }
102
+ /**
103
+ * Render props for FormError component
104
+ */
105
+ export interface FormErrorRenderProps {
106
+ /** Error message if there's an error */
107
+ error: string | null;
108
+ /** Whether there's an error */
109
+ hasError: boolean;
110
+ }
111
+ /**
112
+ * Headless component for form error state access
113
+ *
114
+ * @component
115
+ * @param {FormErrorProps} props - Component props
116
+ * @param {FormErrorProps['children']} props.children - Render prop function that receives error state
117
+ * @example
118
+ * ```tsx
119
+ * import { Form } from '@wix/headless-forms/react';
120
+ *
121
+ * function FormErrorDisplay() {
122
+ * return (
123
+ * <Form.LoadingError>
124
+ * {({ error, hasError }) => (
125
+ * hasError ? (
126
+ * <div className="error-message">
127
+ * {error}
128
+ * </div>
129
+ * ) : null
130
+ * )}
131
+ * </Form.LoadingError>
132
+ * );
133
+ * }
134
+ * ```
135
+ */
136
+ export declare function LoadingError(props: FormErrorProps): import("react").ReactNode;
137
+ /**
138
+ * Props for Form Submit Error headless component
139
+ */
140
+ export interface FormSubmitErrorProps {
141
+ /** Render prop function that receives submit error state data */
142
+ children: (props: FormSubmitErrorRenderProps) => React.ReactNode;
143
+ }
144
+ /**
145
+ * Render props for Form Submit Error component
146
+ */
147
+ export interface FormSubmitErrorRenderProps {
148
+ /** Submit error message */
149
+ error: string | null;
150
+ /** Whether there's a submit error */
151
+ hasError: boolean;
152
+ }
153
+ /**
154
+ * Headless component for form submit error state access
155
+ *
156
+ * @component
157
+ * @param {FormSubmitErrorProps} props - Component props
158
+ * @param {FormSubmitErrorProps['children']} props.children - Render prop function that receives submit error state
159
+ * @example
160
+ * ```tsx
161
+ * import { Form } from '@wix/headless-forms/react';
162
+ *
163
+ * function FormSubmitErrorDisplay() {
164
+ * return (
165
+ * <Form.Error>
166
+ * {({ error, hasError }) => (
167
+ * hasError ? (
168
+ * <div className="error-message">
169
+ * {error}
170
+ * </div>
171
+ * ) : null
172
+ * )}
173
+ * </Form.Error>
174
+ * );
175
+ * }
176
+ * ```
177
+ */
178
+ export declare function Error(props: FormSubmitErrorProps): import("react").ReactNode;
179
+ /**
180
+ * Props for Form Submitted headless component
181
+ */
182
+ export interface FormSubmittedProps {
183
+ /** Render prop function that receives submission state data */
184
+ children: (props: FormSubmittedRenderProps) => React.ReactNode;
185
+ }
186
+ /**
187
+ * Render props for Form Submitted component
188
+ */
189
+ export interface FormSubmittedRenderProps {
190
+ /** Whether the form has been submitted */
191
+ isSubmitted: boolean;
192
+ /** Success message */
193
+ message: string;
194
+ }
195
+ /**
196
+ * Headless component for form submission state access
197
+ *
198
+ * @component
199
+ * @param {FormSubmittedProps} props - Component props
200
+ * @param {FormSubmittedProps['children']} props.children - Render prop function that receives submission state
201
+ * @example
202
+ * ```tsx
203
+ * import { Form } from '@wix/headless-forms/react';
204
+ *
205
+ * function FormSubmittedDisplay() {
206
+ * return (
207
+ * <Form.Submitted>
208
+ * {({ isSubmitted, message }) => (
209
+ * isSubmitted ? (
210
+ * <div className="success-message">
211
+ * <h2>Thank You!</h2>
212
+ * <p>{message}</p>
213
+ * </div>
214
+ * ) : null
215
+ * )}
216
+ * </Form.Submitted>
217
+ * );
218
+ * }
219
+ * ```
220
+ */
221
+ export declare function Submitted(props: FormSubmittedProps): import("react").ReactNode;
222
+ /**
223
+ * Render props for Fields component
224
+ */
225
+ export interface FieldsRenderProps {
226
+ /** The form data, or null if not loaded */
227
+ form: forms.Form | null;
228
+ /** Function to submit the form with values */
229
+ submitForm: (formValues: FormValues) => Promise<void>;
230
+ }
231
+ /**
232
+ * Props for Fields headless component
233
+ */
234
+ export interface FieldsProps {
235
+ /** Render prop function that receives form data and submit handler */
236
+ children: (props: FieldsRenderProps) => React.ReactNode;
237
+ }
238
+ /**
239
+ * Fields component that provides form data and actions to its children.
240
+ * This component accesses the form data and submitForm action from the service
241
+ * and passes them to children via render props.
242
+ *
243
+ * @component
244
+ * @param {FieldsProps} props - Component props
245
+ * @param {FieldsProps['children']} props.children - Render prop function that receives form data and actions
246
+ * @example
247
+ * ```tsx
248
+ * import { Form } from '@wix/headless-forms/react';
249
+ *
250
+ * function FormFields() {
251
+ * return (
252
+ * <Form.Fields>
253
+ * {({ form, submitForm }) => (
254
+ * form ? (
255
+ * <div>
256
+ * <h2>{form.name}</h2>
257
+ * <p>{form.description}</p>
258
+ * <button onClick={() => submitForm({ field1: 'value' })}>
259
+ * Submit
260
+ * </button>
261
+ * </div>
262
+ * ) : null
263
+ * )}
264
+ * </Form.Fields>
265
+ * );
266
+ * }
267
+ * ```
268
+ */
269
+ export declare function Fields(props: FieldsProps): import("react").ReactNode;
270
+ /**
271
+ * Form view interface containing field definitions
272
+ */
273
+ export interface FormView {
274
+ fields: FieldDefinition[];
275
+ }
276
+ /**
277
+ * Field layout configuration
278
+ */
279
+ export interface Layout {
280
+ column: number;
281
+ row: number;
282
+ height: number;
283
+ width: number;
284
+ }
285
+ /**
286
+ * Field definition including layout information
287
+ */
288
+ export interface FieldDefinition {
289
+ id: string;
290
+ layout: Layout;
291
+ }
292
+ /**
293
+ * Render props for Field component
294
+ */
295
+ export interface FieldRenderProps {
296
+ /** The field ID */
297
+ id: string;
298
+ /** The field layout configuration */
299
+ layout: Layout;
300
+ /** Grid styles for container */
301
+ gridStyles: {
302
+ label: React.CSSProperties;
303
+ input: React.CSSProperties;
304
+ };
305
+ }
306
+ /**
307
+ * Props for Field headless component
308
+ */
309
+ export interface FieldProps {
310
+ /** The unique identifier for this field */
311
+ id: string;
312
+ /** The field layout configuration */
313
+ layout: Layout;
314
+ /** Render prop function that receives field layout data */
315
+ children: (props: FieldRenderProps) => React.ReactNode;
316
+ }
317
+ /**
318
+ * Headless Field component that provides field layout data and grid styles.
319
+ * This component accesses field configuration and calculates grid positioning.
320
+ *
321
+ * @component
322
+ * @param {FieldProps} props - Component props
323
+ * @param {FieldProps['children']} props.children - Render prop function that receives field layout data
324
+ * @example
325
+ * ```tsx
326
+ * import { Form } from '@wix/headless-forms/react';
327
+ *
328
+ * function CustomField({ id, layout }) {
329
+ * return (
330
+ * <Form.Field id={id} layout={layout}>
331
+ * {({ id, layout, gridStyles }) => (
332
+ * <div data-field-id={id}>
333
+ * <div style={gridStyles.label}>Label</div>
334
+ * <div style={gridStyles.input}>Input</div>
335
+ * </div>
336
+ * )}
337
+ * </Form.Field>
338
+ * );
339
+ * }
340
+ * ```
341
+ */
342
+ export declare function Field(props: FieldProps): import("react").ReactNode;
@@ -0,0 +1,269 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useService, WixServices } from '@wix/services-manager-react';
3
+ import { createServicesMap } from '@wix/services-manager';
4
+ import { FormServiceDefinition, FormService, } from '../../services/form-service.js';
5
+ import { calculateGridStyles } from '../utils.js';
6
+ const DEFAULT_SUCCESS_MESSAGE = 'Your form has been submitted successfully.';
7
+ /**
8
+ * Root component that provides the Form service context to its children.
9
+ * This component sets up the necessary services for rendering and managing form data.
10
+ *
11
+ * @order 1
12
+ * @component
13
+ * @param {RootProps} props - Component props
14
+ * @param {React.ReactNode} props.children - Child components that will have access to form context
15
+ * @param {FormServiceConfig} props.formServiceConfig - Configuration object containing form data
16
+ * @example
17
+ * ```tsx
18
+ * import { Form } from '@wix/headless-forms/react';
19
+ * import { loadFormServiceConfig } from '@wix/headless-forms/services';
20
+ *
21
+ * // Pattern 1: Pre-loaded form data (SSR/SSG)
22
+ * function FormPage({ formServiceConfig }) {
23
+ * return (
24
+ * <Form.Root formServiceConfig={formServiceConfig}>
25
+ * <Form.Loading>
26
+ * {({ isLoading }) => isLoading ? <div>Loading form...</div> : null}
27
+ * </Form.Loading>
28
+ * <Form.LoadingError>
29
+ * {({ error, hasError }) => hasError ? <div>{error}</div> : null}
30
+ * </Form.LoadingError>
31
+ * <Form.Fields fieldMap={FIELD_MAP} />
32
+ * </Form.Root>
33
+ * );
34
+ * }
35
+ *
36
+ * // Pattern 2: Lazy loading with formId (Client-side)
37
+ * function DynamicFormPage({ formId }) {
38
+ * return (
39
+ * <Form.Root formServiceConfig={{ formId }}>
40
+ * <Form.Loading>
41
+ * {({ isLoading }) => isLoading ? <div>Loading form...</div> : null}
42
+ * </Form.Loading>
43
+ * <Form.LoadingError>
44
+ * {({ error, hasError }) => hasError ? <div>{error}</div> : null}
45
+ * </Form.LoadingError>
46
+ * <Form.Fields fieldMap={FIELD_MAP} />
47
+ * </Form.Root>
48
+ * );
49
+ * }
50
+ * ```
51
+ */
52
+ export function Root({ formServiceConfig, children, }) {
53
+ return (_jsx(WixServices, { servicesMap: createServicesMap().addService(FormServiceDefinition, FormService, formServiceConfig), children: children }));
54
+ }
55
+ /**
56
+ * Headless component for form loading state access
57
+ *
58
+ * @component
59
+ * @param {FormLoadingProps} props - Component props
60
+ * @param {FormLoadingProps['children']} props.children - Render prop function that receives loading state
61
+ * @example
62
+ * ```tsx
63
+ * import { Form } from '@wix/headless-forms/react';
64
+ *
65
+ * function FormLoadingIndicator() {
66
+ * return (
67
+ * <Form.Loading>
68
+ * {({ isLoading }) => (
69
+ * isLoading ? (
70
+ * <div>Loading form...</div>
71
+ * ) : null
72
+ * )}
73
+ * </Form.Loading>
74
+ * );
75
+ * }
76
+ * ```
77
+ */
78
+ export function Loading(props) {
79
+ const { isLoadingSignal } = useService(FormServiceDefinition);
80
+ const isLoading = isLoadingSignal.get();
81
+ return props.children({
82
+ isLoading,
83
+ });
84
+ }
85
+ /**
86
+ * Headless component for form error state access
87
+ *
88
+ * @component
89
+ * @param {FormErrorProps} props - Component props
90
+ * @param {FormErrorProps['children']} props.children - Render prop function that receives error state
91
+ * @example
92
+ * ```tsx
93
+ * import { Form } from '@wix/headless-forms/react';
94
+ *
95
+ * function FormErrorDisplay() {
96
+ * return (
97
+ * <Form.LoadingError>
98
+ * {({ error, hasError }) => (
99
+ * hasError ? (
100
+ * <div className="error-message">
101
+ * {error}
102
+ * </div>
103
+ * ) : null
104
+ * )}
105
+ * </Form.LoadingError>
106
+ * );
107
+ * }
108
+ * ```
109
+ */
110
+ export function LoadingError(props) {
111
+ const { errorSignal } = useService(FormServiceDefinition);
112
+ const error = errorSignal.get();
113
+ const hasError = !!error;
114
+ return props.children({
115
+ error,
116
+ hasError,
117
+ });
118
+ }
119
+ /**
120
+ * Headless component for form submit error state access
121
+ *
122
+ * @component
123
+ * @param {FormSubmitErrorProps} props - Component props
124
+ * @param {FormSubmitErrorProps['children']} props.children - Render prop function that receives submit error state
125
+ * @example
126
+ * ```tsx
127
+ * import { Form } from '@wix/headless-forms/react';
128
+ *
129
+ * function FormSubmitErrorDisplay() {
130
+ * return (
131
+ * <Form.Error>
132
+ * {({ error, hasError }) => (
133
+ * hasError ? (
134
+ * <div className="error-message">
135
+ * {error}
136
+ * </div>
137
+ * ) : null
138
+ * )}
139
+ * </Form.Error>
140
+ * );
141
+ * }
142
+ * ```
143
+ */
144
+ export function Error(props) {
145
+ const { submitResponseSignal } = useService(FormServiceDefinition);
146
+ const submitResponse = submitResponseSignal.get();
147
+ const error = submitResponse.type === 'error' ? submitResponse.message : null;
148
+ const hasError = submitResponse.type === 'error';
149
+ return props.children({
150
+ error,
151
+ hasError,
152
+ });
153
+ }
154
+ /**
155
+ * Headless component for form submission state access
156
+ *
157
+ * @component
158
+ * @param {FormSubmittedProps} props - Component props
159
+ * @param {FormSubmittedProps['children']} props.children - Render prop function that receives submission state
160
+ * @example
161
+ * ```tsx
162
+ * import { Form } from '@wix/headless-forms/react';
163
+ *
164
+ * function FormSubmittedDisplay() {
165
+ * return (
166
+ * <Form.Submitted>
167
+ * {({ isSubmitted, message }) => (
168
+ * isSubmitted ? (
169
+ * <div className="success-message">
170
+ * <h2>Thank You!</h2>
171
+ * <p>{message}</p>
172
+ * </div>
173
+ * ) : null
174
+ * )}
175
+ * </Form.Submitted>
176
+ * );
177
+ * }
178
+ * ```
179
+ */
180
+ export function Submitted(props) {
181
+ const { submitResponseSignal } = useService(FormServiceDefinition);
182
+ const submitResponse = submitResponseSignal.get();
183
+ const isSubmitted = submitResponse.type === 'success';
184
+ const message = submitResponse.type === 'success'
185
+ ? submitResponse.message || DEFAULT_SUCCESS_MESSAGE
186
+ : DEFAULT_SUCCESS_MESSAGE;
187
+ return props.children({
188
+ isSubmitted,
189
+ message,
190
+ });
191
+ }
192
+ /**
193
+ * Fields component that provides form data and actions to its children.
194
+ * This component accesses the form data and submitForm action from the service
195
+ * and passes them to children via render props.
196
+ *
197
+ * @component
198
+ * @param {FieldsProps} props - Component props
199
+ * @param {FieldsProps['children']} props.children - Render prop function that receives form data and actions
200
+ * @example
201
+ * ```tsx
202
+ * import { Form } from '@wix/headless-forms/react';
203
+ *
204
+ * function FormFields() {
205
+ * return (
206
+ * <Form.Fields>
207
+ * {({ form, submitForm }) => (
208
+ * form ? (
209
+ * <div>
210
+ * <h2>{form.name}</h2>
211
+ * <p>{form.description}</p>
212
+ * <button onClick={() => submitForm({ field1: 'value' })}>
213
+ * Submit
214
+ * </button>
215
+ * </div>
216
+ * ) : null
217
+ * )}
218
+ * </Form.Fields>
219
+ * );
220
+ * }
221
+ * ```
222
+ */
223
+ export function Fields(props) {
224
+ const { formSignal, submitForm } = useService(FormServiceDefinition);
225
+ const form = formSignal.get();
226
+ return props.children({
227
+ form,
228
+ submitForm,
229
+ });
230
+ }
231
+ /**
232
+ * Headless Field component that provides field layout data and grid styles.
233
+ * This component accesses field configuration and calculates grid positioning.
234
+ *
235
+ * @component
236
+ * @param {FieldProps} props - Component props
237
+ * @param {FieldProps['children']} props.children - Render prop function that receives field layout data
238
+ * @example
239
+ * ```tsx
240
+ * import { Form } from '@wix/headless-forms/react';
241
+ *
242
+ * function CustomField({ id, layout }) {
243
+ * return (
244
+ * <Form.Field id={id} layout={layout}>
245
+ * {({ id, layout, gridStyles }) => (
246
+ * <div data-field-id={id}>
247
+ * <div style={gridStyles.label}>Label</div>
248
+ * <div style={gridStyles.input}>Input</div>
249
+ * </div>
250
+ * )}
251
+ * </Form.Field>
252
+ * );
253
+ * }
254
+ * ```
255
+ */
256
+ export function Field(props) {
257
+ const { id, children, layout } = props;
258
+ const { formSignal } = useService(FormServiceDefinition);
259
+ const form = formSignal.get();
260
+ if (!form) {
261
+ return null;
262
+ }
263
+ const gridStyles = calculateGridStyles(layout);
264
+ return children({
265
+ id,
266
+ layout,
267
+ gridStyles,
268
+ });
269
+ }
@@ -0,0 +1,3 @@
1
+ export * as Form from './Form.js';
2
+ export * from './types.js';
3
+ export * from './Phone.js';
@@ -0,0 +1,3 @@
1
+ export * as Form from './Form.js';
2
+ export * from './types.js';
3
+ export * from './Phone.js';
@@ -0,0 +1,3 @@
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>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import { Layout } from './core/Form';
2
+ export declare function calculateGridStyles(layout: Layout): {
3
+ label: {
4
+ gridRow: string;
5
+ gridColumn: string;
6
+ display: string;
7
+ alignItems: string;
8
+ };
9
+ input: {
10
+ gridRow: string;
11
+ gridColumn: string;
12
+ };
13
+ };
@@ -0,0 +1,17 @@
1
+ export function calculateGridStyles(layout) {
2
+ const labelRow = 1;
3
+ const inputRow = 2;
4
+ const gridColumn = `${layout.column + 1} / span ${layout.width}`;
5
+ return {
6
+ label: {
7
+ gridRow: `${labelRow} / span 1`,
8
+ gridColumn,
9
+ display: 'flex',
10
+ alignItems: 'flex-end',
11
+ },
12
+ input: {
13
+ gridRow: `${inputRow} / span 1`,
14
+ gridColumn,
15
+ },
16
+ };
17
+ }