@wix/headless-forms 0.0.9 → 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 +7 -7
- package/dist/react/Form.d.ts +2 -2
- package/dist/react/Form.js +1 -1
- package/package.json +1 -1
package/cjs/dist/react/Form.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
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 './types';
|
|
3
|
-
import { type FormServiceConfig } from '../services/form-service';
|
|
2
|
+
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 './types.js';
|
|
3
|
+
import { type FormServiceConfig } from '../services/form-service.js';
|
|
4
4
|
/**
|
|
5
5
|
* Props for the Form root component following the documented API
|
|
6
6
|
*/
|
package/cjs/dist/react/Form.js
CHANGED
|
@@ -38,7 +38,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
39
|
const react_2 = require("@wix/headless-utils/react");
|
|
40
40
|
const form_public_1 = require("@wix/form-public");
|
|
41
|
-
const
|
|
41
|
+
const Form_js_1 = require("./core/Form.js");
|
|
42
42
|
var TestIds;
|
|
43
43
|
(function (TestIds) {
|
|
44
44
|
TestIds["formRoot"] = "form-root";
|
|
@@ -100,7 +100,7 @@ var TestIds;
|
|
|
100
100
|
*/
|
|
101
101
|
exports.Root = react_1.default.forwardRef((props, ref) => {
|
|
102
102
|
const { children, formServiceConfig, asChild, ...otherProps } = props;
|
|
103
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
103
|
+
return ((0, jsx_runtime_1.jsx)(Form_js_1.Root, { formServiceConfig: formServiceConfig, children: (0, jsx_runtime_1.jsx)(RootContent, { asChild: asChild, ref: ref, ...otherProps, children: children }) }));
|
|
104
104
|
});
|
|
105
105
|
/**
|
|
106
106
|
* Internal component to handle the Root content with service access.
|
|
@@ -164,7 +164,7 @@ const RootContent = react_1.default.forwardRef((props, ref) => {
|
|
|
164
164
|
*/
|
|
165
165
|
exports.Loading = react_1.default.forwardRef((props, ref) => {
|
|
166
166
|
const { asChild, children, className, ...otherProps } = props;
|
|
167
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
167
|
+
return ((0, jsx_runtime_1.jsx)(Form_js_1.Loading, { children: ({ isLoading }) => {
|
|
168
168
|
if (!isLoading)
|
|
169
169
|
return null;
|
|
170
170
|
return ((0, jsx_runtime_1.jsx)(react_2.AsChildSlot, { "data-testid": TestIds.formLoading, ref: ref, asChild: asChild, className: className, customElement: children, content: "Loading form...", ...otherProps, children: (0, jsx_runtime_1.jsx)("div", { children: "Loading form..." }) }));
|
|
@@ -221,7 +221,7 @@ exports.Loading = react_1.default.forwardRef((props, ref) => {
|
|
|
221
221
|
*/
|
|
222
222
|
exports.LoadingError = react_1.default.forwardRef((props, ref) => {
|
|
223
223
|
const { asChild, children, className, ...otherProps } = props;
|
|
224
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
224
|
+
return ((0, jsx_runtime_1.jsx)(Form_js_1.LoadingError, { children: ({ error, hasError }) => {
|
|
225
225
|
if (!hasError)
|
|
226
226
|
return null;
|
|
227
227
|
const errorData = { error, hasError };
|
|
@@ -277,7 +277,7 @@ exports.LoadingError = react_1.default.forwardRef((props, ref) => {
|
|
|
277
277
|
*/
|
|
278
278
|
exports.Error = react_1.default.forwardRef((props, ref) => {
|
|
279
279
|
const { asChild, children, className, ...otherProps } = props;
|
|
280
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
280
|
+
return ((0, jsx_runtime_1.jsx)(Form_js_1.Error, { children: ({ error, hasError }) => {
|
|
281
281
|
if (!hasError)
|
|
282
282
|
return null;
|
|
283
283
|
const errorData = { error, hasError };
|
|
@@ -333,7 +333,7 @@ exports.Error = react_1.default.forwardRef((props, ref) => {
|
|
|
333
333
|
*/
|
|
334
334
|
exports.Submitted = react_1.default.forwardRef((props, ref) => {
|
|
335
335
|
const { asChild, children, className, ...otherProps } = props;
|
|
336
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
336
|
+
return ((0, jsx_runtime_1.jsx)(Form_js_1.Submitted, { children: ({ isSubmitted, message }) => {
|
|
337
337
|
if (!isSubmitted)
|
|
338
338
|
return null;
|
|
339
339
|
const submittedData = { isSubmitted, message };
|
|
@@ -493,7 +493,7 @@ exports.Fields = react_1.default.forwardRef((props, ref) => {
|
|
|
493
493
|
const handleFormValidate = (0, react_1.useCallback)((errors) => {
|
|
494
494
|
setFormErrors(errors);
|
|
495
495
|
}, []);
|
|
496
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
496
|
+
return ((0, jsx_runtime_1.jsx)(Form_js_1.Fields, { children: ({ form, submitForm }) => {
|
|
497
497
|
if (!form)
|
|
498
498
|
return null;
|
|
499
499
|
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, children: (0, jsx_runtime_1.jsx)(form_public_1.Form, { form: form, values: formValues, onChange: handleFormChange, errors: formErrors, onValidate: handleFormValidate, fields: props.fieldMap, submitForm: () => submitForm(formValues) }) }));
|
package/dist/react/Form.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
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 './types';
|
|
3
|
-
import { type FormServiceConfig } from '../services/form-service';
|
|
2
|
+
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 './types.js';
|
|
3
|
+
import { type FormServiceConfig } from '../services/form-service.js';
|
|
4
4
|
/**
|
|
5
5
|
* Props for the Form root component following the documented API
|
|
6
6
|
*/
|
package/dist/react/Form.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React, { useState, useCallback } from 'react';
|
|
3
3
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
4
4
|
import { Form as FormViewer, } from '@wix/form-public';
|
|
5
|
-
import { Root as CoreRoot, Loading as CoreLoading, LoadingError as CoreLoadingError, Error as CoreError, Submitted as CoreSubmitted, Fields as CoreFields, } from './core/Form';
|
|
5
|
+
import { Root as CoreRoot, Loading as CoreLoading, LoadingError as CoreLoadingError, Error as CoreError, Submitted as CoreSubmitted, Fields as CoreFields, } from './core/Form.js';
|
|
6
6
|
var TestIds;
|
|
7
7
|
(function (TestIds) {
|
|
8
8
|
TestIds["formRoot"] = "form-root";
|