@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/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import * as React30 from 'react';
2
2
  import React30__default, { createContext, forwardRef, useState, useMemo, useRef, useEffect, useCallback, useImperativeHandle, useContext } from 'react';
3
3
  import ReactDOM from 'react-dom';
4
+ import camelCase from 'lodash.camelcase';
5
+ import mapKeys from 'lodash.mapkeys';
4
6
  import { jsx } from 'react/jsx-runtime';
5
7
 
6
8
  var __create = Object.create;
@@ -29951,6 +29953,24 @@ var FIELD_TYPE_MAP = {
29951
29953
  RICH_TEXT: "TEXT",
29952
29954
  SUBMIT_BUTTON: "SUBMIT_BUTTON"
29953
29955
  };
29956
+ function convertKeysToCamelCase(obj) {
29957
+ if (Array.isArray(obj)) {
29958
+ return obj.map(convertKeysToCamelCase);
29959
+ }
29960
+ if (obj !== null && typeof obj === "object") {
29961
+ const converted = mapKeys(
29962
+ obj,
29963
+ (_23, key) => camelCase(key)
29964
+ );
29965
+ return Object.fromEntries(
29966
+ Object.entries(converted).map(([key, value]) => [
29967
+ key,
29968
+ convertKeysToCamelCase(value)
29969
+ ])
29970
+ );
29971
+ }
29972
+ return obj;
29973
+ }
29954
29974
  var mapFieldProps = (fields, mappers) => Object.fromEntries(
29955
29975
  Object.entries(fields).map(([fieldType, Component]) => [
29956
29976
  fieldType,
@@ -29964,13 +29984,14 @@ var mapFieldTypes = (fields, typeMap) => ({
29964
29984
  )
29965
29985
  });
29966
29986
  var Form2 = ({
29967
- form,
29987
+ form: unformattedForm,
29968
29988
  fields,
29969
29989
  values,
29970
29990
  onChange,
29971
29991
  errors,
29972
29992
  onValidate
29973
29993
  }) => {
29994
+ const form = convertKeysToCamelCase(unformattedForm);
29974
29995
  const siteConfig = {
29975
29996
  locale: {
29976
29997
  languageCode: "en"