@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,278 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Root = Root;
4
+ exports.Loading = Loading;
5
+ exports.LoadingError = LoadingError;
6
+ exports.Error = Error;
7
+ exports.Submitted = Submitted;
8
+ exports.Fields = Fields;
9
+ exports.Field = Field;
10
+ const jsx_runtime_1 = require("react/jsx-runtime");
11
+ const services_manager_react_1 = require("@wix/services-manager-react");
12
+ const services_manager_1 = require("@wix/services-manager");
13
+ const form_service_js_1 = require("../../services/form-service.js");
14
+ const utils_js_1 = require("../utils.js");
15
+ const DEFAULT_SUCCESS_MESSAGE = 'Your form has been submitted successfully.';
16
+ /**
17
+ * Root component that provides the Form service context to its children.
18
+ * This component sets up the necessary services for rendering and managing form data.
19
+ *
20
+ * @order 1
21
+ * @component
22
+ * @param {RootProps} props - Component props
23
+ * @param {React.ReactNode} props.children - Child components that will have access to form context
24
+ * @param {FormServiceConfig} props.formServiceConfig - Configuration object containing form data
25
+ * @example
26
+ * ```tsx
27
+ * import { Form } from '@wix/headless-forms/react';
28
+ * import { loadFormServiceConfig } from '@wix/headless-forms/services';
29
+ *
30
+ * // Pattern 1: Pre-loaded form data (SSR/SSG)
31
+ * function FormPage({ formServiceConfig }) {
32
+ * return (
33
+ * <Form.Root formServiceConfig={formServiceConfig}>
34
+ * <Form.Loading>
35
+ * {({ isLoading }) => isLoading ? <div>Loading form...</div> : null}
36
+ * </Form.Loading>
37
+ * <Form.LoadingError>
38
+ * {({ error, hasError }) => hasError ? <div>{error}</div> : null}
39
+ * </Form.LoadingError>
40
+ * <Form.Fields fieldMap={FIELD_MAP} />
41
+ * </Form.Root>
42
+ * );
43
+ * }
44
+ *
45
+ * // Pattern 2: Lazy loading with formId (Client-side)
46
+ * function DynamicFormPage({ formId }) {
47
+ * return (
48
+ * <Form.Root formServiceConfig={{ formId }}>
49
+ * <Form.Loading>
50
+ * {({ isLoading }) => isLoading ? <div>Loading form...</div> : null}
51
+ * </Form.Loading>
52
+ * <Form.LoadingError>
53
+ * {({ error, hasError }) => hasError ? <div>{error}</div> : null}
54
+ * </Form.LoadingError>
55
+ * <Form.Fields fieldMap={FIELD_MAP} />
56
+ * </Form.Root>
57
+ * );
58
+ * }
59
+ * ```
60
+ */
61
+ function Root({ formServiceConfig, children, }) {
62
+ return ((0, jsx_runtime_1.jsx)(services_manager_react_1.WixServices, { servicesMap: (0, services_manager_1.createServicesMap)().addService(form_service_js_1.FormServiceDefinition, form_service_js_1.FormService, formServiceConfig), children: children }));
63
+ }
64
+ /**
65
+ * Headless component for form loading state access
66
+ *
67
+ * @component
68
+ * @param {FormLoadingProps} props - Component props
69
+ * @param {FormLoadingProps['children']} props.children - Render prop function that receives loading state
70
+ * @example
71
+ * ```tsx
72
+ * import { Form } from '@wix/headless-forms/react';
73
+ *
74
+ * function FormLoadingIndicator() {
75
+ * return (
76
+ * <Form.Loading>
77
+ * {({ isLoading }) => (
78
+ * isLoading ? (
79
+ * <div>Loading form...</div>
80
+ * ) : null
81
+ * )}
82
+ * </Form.Loading>
83
+ * );
84
+ * }
85
+ * ```
86
+ */
87
+ function Loading(props) {
88
+ const { isLoadingSignal } = (0, services_manager_react_1.useService)(form_service_js_1.FormServiceDefinition);
89
+ const isLoading = isLoadingSignal.get();
90
+ return props.children({
91
+ isLoading,
92
+ });
93
+ }
94
+ /**
95
+ * Headless component for form error state access
96
+ *
97
+ * @component
98
+ * @param {FormErrorProps} props - Component props
99
+ * @param {FormErrorProps['children']} props.children - Render prop function that receives error state
100
+ * @example
101
+ * ```tsx
102
+ * import { Form } from '@wix/headless-forms/react';
103
+ *
104
+ * function FormErrorDisplay() {
105
+ * return (
106
+ * <Form.LoadingError>
107
+ * {({ error, hasError }) => (
108
+ * hasError ? (
109
+ * <div className="error-message">
110
+ * {error}
111
+ * </div>
112
+ * ) : null
113
+ * )}
114
+ * </Form.LoadingError>
115
+ * );
116
+ * }
117
+ * ```
118
+ */
119
+ function LoadingError(props) {
120
+ const { errorSignal } = (0, services_manager_react_1.useService)(form_service_js_1.FormServiceDefinition);
121
+ const error = errorSignal.get();
122
+ const hasError = !!error;
123
+ return props.children({
124
+ error,
125
+ hasError,
126
+ });
127
+ }
128
+ /**
129
+ * Headless component for form submit error state access
130
+ *
131
+ * @component
132
+ * @param {FormSubmitErrorProps} props - Component props
133
+ * @param {FormSubmitErrorProps['children']} props.children - Render prop function that receives submit error state
134
+ * @example
135
+ * ```tsx
136
+ * import { Form } from '@wix/headless-forms/react';
137
+ *
138
+ * function FormSubmitErrorDisplay() {
139
+ * return (
140
+ * <Form.Error>
141
+ * {({ error, hasError }) => (
142
+ * hasError ? (
143
+ * <div className="error-message">
144
+ * {error}
145
+ * </div>
146
+ * ) : null
147
+ * )}
148
+ * </Form.Error>
149
+ * );
150
+ * }
151
+ * ```
152
+ */
153
+ function Error(props) {
154
+ const { submitResponseSignal } = (0, services_manager_react_1.useService)(form_service_js_1.FormServiceDefinition);
155
+ const submitResponse = submitResponseSignal.get();
156
+ const error = submitResponse.type === 'error' ? submitResponse.message : null;
157
+ const hasError = submitResponse.type === 'error';
158
+ return props.children({
159
+ error,
160
+ hasError,
161
+ });
162
+ }
163
+ /**
164
+ * Headless component for form submission state access
165
+ *
166
+ * @component
167
+ * @param {FormSubmittedProps} props - Component props
168
+ * @param {FormSubmittedProps['children']} props.children - Render prop function that receives submission state
169
+ * @example
170
+ * ```tsx
171
+ * import { Form } from '@wix/headless-forms/react';
172
+ *
173
+ * function FormSubmittedDisplay() {
174
+ * return (
175
+ * <Form.Submitted>
176
+ * {({ isSubmitted, message }) => (
177
+ * isSubmitted ? (
178
+ * <div className="success-message">
179
+ * <h2>Thank You!</h2>
180
+ * <p>{message}</p>
181
+ * </div>
182
+ * ) : null
183
+ * )}
184
+ * </Form.Submitted>
185
+ * );
186
+ * }
187
+ * ```
188
+ */
189
+ function Submitted(props) {
190
+ const { submitResponseSignal } = (0, services_manager_react_1.useService)(form_service_js_1.FormServiceDefinition);
191
+ const submitResponse = submitResponseSignal.get();
192
+ const isSubmitted = submitResponse.type === 'success';
193
+ const message = submitResponse.type === 'success'
194
+ ? submitResponse.message || DEFAULT_SUCCESS_MESSAGE
195
+ : DEFAULT_SUCCESS_MESSAGE;
196
+ return props.children({
197
+ isSubmitted,
198
+ message,
199
+ });
200
+ }
201
+ /**
202
+ * Fields component that provides form data and actions to its children.
203
+ * This component accesses the form data and submitForm action from the service
204
+ * and passes them to children via render props.
205
+ *
206
+ * @component
207
+ * @param {FieldsProps} props - Component props
208
+ * @param {FieldsProps['children']} props.children - Render prop function that receives form data and actions
209
+ * @example
210
+ * ```tsx
211
+ * import { Form } from '@wix/headless-forms/react';
212
+ *
213
+ * function FormFields() {
214
+ * return (
215
+ * <Form.Fields>
216
+ * {({ form, submitForm }) => (
217
+ * form ? (
218
+ * <div>
219
+ * <h2>{form.name}</h2>
220
+ * <p>{form.description}</p>
221
+ * <button onClick={() => submitForm({ field1: 'value' })}>
222
+ * Submit
223
+ * </button>
224
+ * </div>
225
+ * ) : null
226
+ * )}
227
+ * </Form.Fields>
228
+ * );
229
+ * }
230
+ * ```
231
+ */
232
+ function Fields(props) {
233
+ const { formSignal, submitForm } = (0, services_manager_react_1.useService)(form_service_js_1.FormServiceDefinition);
234
+ const form = formSignal.get();
235
+ return props.children({
236
+ form,
237
+ submitForm,
238
+ });
239
+ }
240
+ /**
241
+ * Headless Field component that provides field layout data and grid styles.
242
+ * This component accesses field configuration and calculates grid positioning.
243
+ *
244
+ * @component
245
+ * @param {FieldProps} props - Component props
246
+ * @param {FieldProps['children']} props.children - Render prop function that receives field layout data
247
+ * @example
248
+ * ```tsx
249
+ * import { Form } from '@wix/headless-forms/react';
250
+ *
251
+ * function CustomField({ id, layout }) {
252
+ * return (
253
+ * <Form.Field id={id} layout={layout}>
254
+ * {({ id, layout, gridStyles }) => (
255
+ * <div data-field-id={id}>
256
+ * <div style={gridStyles.label}>Label</div>
257
+ * <div style={gridStyles.input}>Input</div>
258
+ * </div>
259
+ * )}
260
+ * </Form.Field>
261
+ * );
262
+ * }
263
+ * ```
264
+ */
265
+ function Field(props) {
266
+ const { id, children, layout } = props;
267
+ const { formSignal } = (0, services_manager_react_1.useService)(form_service_js_1.FormServiceDefinition);
268
+ const form = formSignal.get();
269
+ if (!form) {
270
+ return null;
271
+ }
272
+ const gridStyles = (0, utils_js_1.calculateGridStyles)(layout);
273
+ return children({
274
+ id,
275
+ layout,
276
+ gridStyles,
277
+ });
278
+ }
@@ -0,0 +1,3 @@
1
+ export * as Form from './Form.js';
2
+ export * from './types.js';
3
+ export * from './Phone.js';
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.Form = void 0;
40
+ exports.Form = __importStar(require("./Form.js"));
41
+ __exportStar(require("./types.js"), exports);
42
+ __exportStar(require("./Phone.js"), exports);
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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
+ };