@bigbinary/neeto-themes-frontend 3.1.27 → 3.1.29

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.
@@ -37,11 +37,12 @@ import LeftAlign from '@bigbinary/neeto-icons/LeftAlign';
37
37
  import ColorPicker from '@bigbinary/neetoui/ColorPicker';
38
38
  import Select from '@bigbinary/neetoui/Select';
39
39
  import { Slider } from 'antd';
40
+ import Input from '@bigbinary/neetoui/Input';
40
41
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
41
42
  import _regeneratorRuntime from '@babel/runtime/regenerator';
42
43
  import ImageUploader from '@bigbinary/neeto-image-uploader-frontend/ImageUploader';
43
44
  import Toastr from '@bigbinary/neetoui/Toastr';
44
- import Input from '@bigbinary/neetoui/formik/Input';
45
+ import Input$1 from '@bigbinary/neetoui/formik/Input';
45
46
  import Search from '@bigbinary/neeto-molecules/Search';
46
47
  import Rating from '@bigbinary/neeto-icons/Rating';
47
48
  import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
@@ -491,6 +492,15 @@ var buildInitialValues = function buildInitialValues(theme, themePropertiesSchem
491
492
  order = _ref$order === void 0 ? null : _ref$order,
492
493
  dependsOn = _ref.dependsOn;
493
494
  switch (kind) {
495
+ case "text_input":
496
+ return _objectSpread$3({
497
+ value: defaultValue || "",
498
+ kind: "text_input",
499
+ key: key,
500
+ dependsOn: dependsOn
501
+ }, order !== null && {
502
+ order: order
503
+ });
494
504
  case "color":
495
505
  return _objectSpread$3({
496
506
  value: defaultValue,
@@ -867,9 +877,38 @@ var SwitchBlock = function SwitchBlock(_ref) {
867
877
  });
868
878
  };
869
879
 
880
+ var TextBlock = function TextBlock(_ref) {
881
+ var label = _ref.label,
882
+ name = _ref.name,
883
+ _ref$type = _ref.type,
884
+ type = _ref$type === void 0 ? "text" : _ref$type,
885
+ value = _ref.value,
886
+ onChange = _ref.onChange,
887
+ placeholder = _ref.placeholder;
888
+ return /*#__PURE__*/jsxs("div", {
889
+ className: "flex items-center justify-between",
890
+ "data-cy": "theme-style-".concat(joinHyphenCase(label)),
891
+ children: [/*#__PURE__*/jsx(Typography, {
892
+ "data-cy": "style-fields-labels",
893
+ style: "body2",
894
+ children: label
895
+ }), /*#__PURE__*/jsx("div", {
896
+ className: "w-40",
897
+ children: /*#__PURE__*/jsx(Input, {
898
+ name: name,
899
+ onChange: onChange,
900
+ placeholder: placeholder,
901
+ type: type,
902
+ value: value
903
+ })
904
+ })]
905
+ });
906
+ };
907
+
870
908
  var Properties = function Properties(_ref) {
871
909
  var onPropertiesChange = _ref.onPropertiesChange,
872
- condition = _ref.condition;
910
+ condition = _ref.condition,
911
+ themeId = _ref.themeId;
873
912
  var _useConfigStore = useConfigStore(function (store) {
874
913
  return {
875
914
  themePropertiesSchema: store["themePropertiesSchema"]
@@ -928,6 +967,7 @@ var Properties = function Properties(_ref) {
928
967
  }
929
968
  };
930
969
  useEffect(function () {
970
+ if (!((values === null || values === void 0 ? void 0 : values.id) === themeId)) return;
931
971
  onPropertiesChange === null || onPropertiesChange === void 0 || onPropertiesChange(values, handleChange, handleColorChange);
932
972
  setTheme(values);
933
973
  setThemeState({
@@ -951,6 +991,20 @@ var Properties = function Properties(_ref) {
951
991
  var isCurrentPropertyVisible = isPropertyVisible(key, values, themePropertiesSchema);
952
992
  if (!isCurrentPropertyVisible) return null;
953
993
  switch (kind) {
994
+ case "text_input":
995
+ {
996
+ var index = findIndexBy({
997
+ key: key
998
+ }, values.properties);
999
+ return /*#__PURE__*/jsx(TextBlock, {
1000
+ label: buildLabel(key, kind),
1001
+ name: "properties[".concat(index, "].value"),
1002
+ value: value || "",
1003
+ onChange: function onChange(e) {
1004
+ return setFieldValue("properties[".concat(index, "].value"), e.target.value);
1005
+ }
1006
+ }, key);
1007
+ }
954
1008
  case "font_family":
955
1009
  return /*#__PURE__*/jsx(FontPickerBlock, {
956
1010
  label: buildLabel(key, kind),
@@ -996,7 +1050,7 @@ var Properties = function Properties(_ref) {
996
1050
  case "position_selector":
997
1051
  {
998
1052
  var _findBy4;
999
- var index = findIndexBy({
1053
+ var _index = findIndexBy({
1000
1054
  key: key
1001
1055
  }, values.properties);
1002
1056
  var options = (_findBy4 = findBy({
@@ -1008,13 +1062,13 @@ var Properties = function Properties(_ref) {
1008
1062
  placeholder: "left",
1009
1063
  value: toLabelAndValue(value),
1010
1064
  onChange: function onChange(option) {
1011
- return setFieldValue("properties[".concat(index, "].value"), option.value);
1065
+ return setFieldValue("properties[".concat(_index, "].value"), option.value);
1012
1066
  }
1013
1067
  }, key);
1014
1068
  }
1015
1069
  case "boolean":
1016
1070
  {
1017
- var _index = findIndexBy({
1071
+ var _index2 = findIndexBy({
1018
1072
  key: key
1019
1073
  }, values.properties);
1020
1074
  return /*#__PURE__*/jsx(SwitchBlock, {
@@ -1022,18 +1076,18 @@ var Properties = function Properties(_ref) {
1022
1076
  label: buildLabel(key, kind),
1023
1077
  name: snakeToCamelCase(key),
1024
1078
  onChange: function onChange(e) {
1025
- return setFieldValue("properties[".concat(_index, "].value"), String(e.target.checked));
1079
+ return setFieldValue("properties[".concat(_index2, "].value"), String(e.target.checked));
1026
1080
  }
1027
1081
  }, key);
1028
1082
  }
1029
1083
  case "alignment_block":
1030
1084
  {
1031
- var _index2 = findIndexBy({
1085
+ var _index3 = findIndexBy({
1032
1086
  key: key
1033
1087
  }, values.properties);
1034
1088
  return /*#__PURE__*/jsx(AlignmentBlock, {
1035
1089
  label: buildLabel(key, kind),
1036
- name: "properties[".concat(_index2, "].value")
1090
+ name: "properties[".concat(_index3, "].value")
1037
1091
  });
1038
1092
  }
1039
1093
  default:
@@ -1213,7 +1267,7 @@ var ThemeMeta = function ThemeMeta(_ref) {
1213
1267
  helpPopoverProps: nameHelpPopoverProps,
1214
1268
  name: "name",
1215
1269
  title: t("neetoThemes.common.name"),
1216
- children: /*#__PURE__*/jsx(Input, {
1270
+ children: /*#__PURE__*/jsx(Input$1, {
1217
1271
  autoFocus: true,
1218
1272
  "data-cy": "theme-name-property",
1219
1273
  name: "name"
@@ -1368,7 +1422,8 @@ var Customize = function Customize(_ref) {
1368
1422
  name: "style",
1369
1423
  title: t("neetoThemes.common.style"),
1370
1424
  children: /*#__PURE__*/jsx(Properties, {
1371
- onPropertiesChange: onPropertiesChange
1425
+ onPropertiesChange: onPropertiesChange,
1426
+ themeId: themeId
1372
1427
  })
1373
1428
  }), filterBy({
1374
1429
  kind: "image"