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