@wix/form-public 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_tsup-dts-rollup.d.cts +8 -1
- package/dist/_tsup-dts-rollup.d.ts +8 -1
- package/dist/index.cjs +30 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -4
- package/dist/index.js.map +1 -1
- package/package.json +8 -2
|
@@ -12,6 +12,13 @@ export declare const CheckboxGroupMapper: PropsMapper;
|
|
|
12
12
|
|
|
13
13
|
export declare const CheckboxMapper: PropsMapper;
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Deeply converts all object keys from snake_case to camelCase
|
|
17
|
+
* @param obj - The object to convert
|
|
18
|
+
* @returns The object with all nested keys converted to camelCase
|
|
19
|
+
*/
|
|
20
|
+
export declare function convertKeysToCamelCase<T = unknown>(obj: T): T;
|
|
21
|
+
|
|
15
22
|
export declare type Currency = {
|
|
16
23
|
sign?: string;
|
|
17
24
|
code?: string;
|
|
@@ -39,7 +46,7 @@ export declare const FileUploadMapper: PropsMapper;
|
|
|
39
46
|
|
|
40
47
|
export declare const FixedPaymentMapper: PropsMapper;
|
|
41
48
|
|
|
42
|
-
declare const Form: ({ form, fields, values, onChange, errors, onValidate, }: FormProps) => JSX_2.Element;
|
|
49
|
+
declare const Form: ({ form: unformattedForm, fields, values, onChange, errors, onValidate, }: FormProps) => JSX_2.Element;
|
|
43
50
|
export { Form }
|
|
44
51
|
export { Form as Form_alias_1 }
|
|
45
52
|
|
|
@@ -12,6 +12,13 @@ export declare const CheckboxGroupMapper: PropsMapper;
|
|
|
12
12
|
|
|
13
13
|
export declare const CheckboxMapper: PropsMapper;
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Deeply converts all object keys from snake_case to camelCase
|
|
17
|
+
* @param obj - The object to convert
|
|
18
|
+
* @returns The object with all nested keys converted to camelCase
|
|
19
|
+
*/
|
|
20
|
+
export declare function convertKeysToCamelCase<T = unknown>(obj: T): T;
|
|
21
|
+
|
|
15
22
|
export declare type Currency = {
|
|
16
23
|
sign?: string;
|
|
17
24
|
code?: string;
|
|
@@ -39,7 +46,7 @@ export declare const FileUploadMapper: PropsMapper;
|
|
|
39
46
|
|
|
40
47
|
export declare const FixedPaymentMapper: PropsMapper;
|
|
41
48
|
|
|
42
|
-
declare const Form: ({ form, fields, values, onChange, errors, onValidate, }: FormProps) => JSX_2.Element;
|
|
49
|
+
declare const Form: ({ form: unformattedForm, fields, values, onChange, errors, onValidate, }: FormProps) => JSX_2.Element;
|
|
43
50
|
export { Form }
|
|
44
51
|
export { Form as Form_alias_1 }
|
|
45
52
|
|
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var React30 = require('react');
|
|
4
4
|
var ReactDOM = require('react-dom');
|
|
5
|
+
var camelCase = require('lodash.camelcase');
|
|
6
|
+
var mapKeys = require('lodash.mapkeys');
|
|
5
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
8
|
|
|
7
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -26,6 +28,8 @@ function _interopNamespace(e) {
|
|
|
26
28
|
|
|
27
29
|
var React30__namespace = /*#__PURE__*/_interopNamespace(React30);
|
|
28
30
|
var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
|
|
31
|
+
var camelCase__default = /*#__PURE__*/_interopDefault(camelCase);
|
|
32
|
+
var mapKeys__default = /*#__PURE__*/_interopDefault(mapKeys);
|
|
29
33
|
|
|
30
34
|
var __create = Object.create;
|
|
31
35
|
var __defProp = Object.defineProperty;
|
|
@@ -20483,7 +20487,8 @@ var COMMON_FIELD_TYPES = {
|
|
|
20483
20487
|
};
|
|
20484
20488
|
var SHEDULING_FIELD_TYPES = {
|
|
20485
20489
|
APPOINTMENT: "APPOINTMENT",
|
|
20486
|
-
SERVICES_DROPDOWN: "SERVICES_DROPDOWN"
|
|
20490
|
+
SERVICES_DROPDOWN: "SERVICES_DROPDOWN",
|
|
20491
|
+
SERVICES_MULTI_CHOICE: "SERVICES_MULTI_CHOICE"
|
|
20487
20492
|
};
|
|
20488
20493
|
var PAYMENTS_FIELD_TYPES = {
|
|
20489
20494
|
PRODUCT_LIST: "PRODUCT_LIST",
|
|
@@ -28292,7 +28297,8 @@ var ADDITIONAL_FIELD_VALIDATION = {
|
|
|
28292
28297
|
[FIELD_TYPES.BOOKINGS_ADDRESS]: null,
|
|
28293
28298
|
[FIELD_TYPES.APPOINTMENT]: null,
|
|
28294
28299
|
[FIELD_TYPES.IDENTITY_PASSWORD]: null,
|
|
28295
|
-
[FIELD_TYPES.SERVICES_DROPDOWN]: null
|
|
28300
|
+
[FIELD_TYPES.SERVICES_DROPDOWN]: null,
|
|
28301
|
+
[FIELD_TYPES.SERVICES_MULTI_CHOICE]: null
|
|
28296
28302
|
};
|
|
28297
28303
|
|
|
28298
28304
|
// ../form-viewer/dist/esm/services/get-field-errors.js
|
|
@@ -28679,7 +28685,8 @@ var NORMALIZED_VALUE = {
|
|
|
28679
28685
|
[FIELD_TYPES.BOOKINGS_ADDRESS]: normalizeMultilineAddress,
|
|
28680
28686
|
[FIELD_TYPES.APPOINTMENT]: acceptObjectValue,
|
|
28681
28687
|
[FIELD_TYPES.IDENTITY_PASSWORD]: acceptStringValue,
|
|
28682
|
-
[FIELD_TYPES.SERVICES_DROPDOWN]: acceptStringValue
|
|
28688
|
+
[FIELD_TYPES.SERVICES_DROPDOWN]: acceptStringValue,
|
|
28689
|
+
[FIELD_TYPES.SERVICES_MULTI_CHOICE]: removeInvalidOptions
|
|
28683
28690
|
};
|
|
28684
28691
|
function keepValueUnchanged({ fieldValue }) {
|
|
28685
28692
|
return fieldValue;
|
|
@@ -29975,6 +29982,24 @@ var FIELD_TYPE_MAP = {
|
|
|
29975
29982
|
RICH_TEXT: "TEXT",
|
|
29976
29983
|
SUBMIT_BUTTON: "SUBMIT_BUTTON"
|
|
29977
29984
|
};
|
|
29985
|
+
function convertKeysToCamelCase(obj) {
|
|
29986
|
+
if (Array.isArray(obj)) {
|
|
29987
|
+
return obj.map(convertKeysToCamelCase);
|
|
29988
|
+
}
|
|
29989
|
+
if (obj !== null && typeof obj === "object") {
|
|
29990
|
+
const converted = mapKeys__default.default(
|
|
29991
|
+
obj,
|
|
29992
|
+
(_23, key) => camelCase__default.default(key)
|
|
29993
|
+
);
|
|
29994
|
+
return Object.fromEntries(
|
|
29995
|
+
Object.entries(converted).map(([key, value]) => [
|
|
29996
|
+
key,
|
|
29997
|
+
convertKeysToCamelCase(value)
|
|
29998
|
+
])
|
|
29999
|
+
);
|
|
30000
|
+
}
|
|
30001
|
+
return obj;
|
|
30002
|
+
}
|
|
29978
30003
|
var mapFieldProps = (fields, mappers) => Object.fromEntries(
|
|
29979
30004
|
Object.entries(fields).map(([fieldType, Component]) => [
|
|
29980
30005
|
fieldType,
|
|
@@ -29988,13 +30013,14 @@ var mapFieldTypes = (fields, typeMap) => ({
|
|
|
29988
30013
|
)
|
|
29989
30014
|
});
|
|
29990
30015
|
var Form2 = ({
|
|
29991
|
-
form,
|
|
30016
|
+
form: unformattedForm,
|
|
29992
30017
|
fields,
|
|
29993
30018
|
values,
|
|
29994
30019
|
onChange,
|
|
29995
30020
|
errors,
|
|
29996
30021
|
onValidate
|
|
29997
30022
|
}) => {
|
|
30023
|
+
const form = convertKeysToCamelCase(unformattedForm);
|
|
29998
30024
|
const siteConfig = {
|
|
29999
30025
|
locale: {
|
|
30000
30026
|
languageCode: "en"
|