@wix/form-public 0.14.0 → 0.15.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 +24 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -1
- 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;
|
|
@@ -29975,6 +29979,24 @@ var FIELD_TYPE_MAP = {
|
|
|
29975
29979
|
RICH_TEXT: "TEXT",
|
|
29976
29980
|
SUBMIT_BUTTON: "SUBMIT_BUTTON"
|
|
29977
29981
|
};
|
|
29982
|
+
function convertKeysToCamelCase(obj) {
|
|
29983
|
+
if (Array.isArray(obj)) {
|
|
29984
|
+
return obj.map(convertKeysToCamelCase);
|
|
29985
|
+
}
|
|
29986
|
+
if (obj !== null && typeof obj === "object") {
|
|
29987
|
+
const converted = mapKeys__default.default(
|
|
29988
|
+
obj,
|
|
29989
|
+
(_23, key) => camelCase__default.default(key)
|
|
29990
|
+
);
|
|
29991
|
+
return Object.fromEntries(
|
|
29992
|
+
Object.entries(converted).map(([key, value]) => [
|
|
29993
|
+
key,
|
|
29994
|
+
convertKeysToCamelCase(value)
|
|
29995
|
+
])
|
|
29996
|
+
);
|
|
29997
|
+
}
|
|
29998
|
+
return obj;
|
|
29999
|
+
}
|
|
29978
30000
|
var mapFieldProps = (fields, mappers) => Object.fromEntries(
|
|
29979
30001
|
Object.entries(fields).map(([fieldType, Component]) => [
|
|
29980
30002
|
fieldType,
|
|
@@ -29988,13 +30010,14 @@ var mapFieldTypes = (fields, typeMap) => ({
|
|
|
29988
30010
|
)
|
|
29989
30011
|
});
|
|
29990
30012
|
var Form2 = ({
|
|
29991
|
-
form,
|
|
30013
|
+
form: unformattedForm,
|
|
29992
30014
|
fields,
|
|
29993
30015
|
values,
|
|
29994
30016
|
onChange,
|
|
29995
30017
|
errors,
|
|
29996
30018
|
onValidate
|
|
29997
30019
|
}) => {
|
|
30020
|
+
const form = convertKeysToCamelCase(unformattedForm);
|
|
29998
30021
|
const siteConfig = {
|
|
29999
30022
|
locale: {
|
|
30000
30023
|
languageCode: "en"
|