@bigbinary/neeto-themes-frontend 3.1.28 → 3.1.30

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,6 +879,34 @@ 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
912
  condition = _ref.condition,
@@ -955,6 +993,20 @@ var Properties = function Properties(_ref) {
955
993
  var isCurrentPropertyVisible = isPropertyVisible(key, values, themePropertiesSchema);
956
994
  if (!isCurrentPropertyVisible) return null;
957
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
+ }
958
1010
  case "font_family":
959
1011
  return /*#__PURE__*/jsxRuntime.jsx(FontPickerBlock, {
960
1012
  label: buildLabel(key, kind),
@@ -1000,7 +1052,7 @@ var Properties = function Properties(_ref) {
1000
1052
  case "position_selector":
1001
1053
  {
1002
1054
  var _findBy4;
1003
- var index = neetoCist.findIndexBy({
1055
+ var _index = neetoCist.findIndexBy({
1004
1056
  key: key
1005
1057
  }, values.properties);
1006
1058
  var options = (_findBy4 = neetoCist.findBy({
@@ -1012,13 +1064,13 @@ var Properties = function Properties(_ref) {
1012
1064
  placeholder: "left",
1013
1065
  value: neetoCist.toLabelAndValue(value),
1014
1066
  onChange: function onChange(option) {
1015
- return setFieldValue("properties[".concat(index, "].value"), option.value);
1067
+ return setFieldValue("properties[".concat(_index, "].value"), option.value);
1016
1068
  }
1017
1069
  }, key);
1018
1070
  }
1019
1071
  case "boolean":
1020
1072
  {
1021
- var _index = neetoCist.findIndexBy({
1073
+ var _index2 = neetoCist.findIndexBy({
1022
1074
  key: key
1023
1075
  }, values.properties);
1024
1076
  return /*#__PURE__*/jsxRuntime.jsx(SwitchBlock, {
@@ -1026,18 +1078,18 @@ var Properties = function Properties(_ref) {
1026
1078
  label: buildLabel(key, kind),
1027
1079
  name: neetoCist.snakeToCamelCase(key),
1028
1080
  onChange: function onChange(e) {
1029
- return setFieldValue("properties[".concat(_index, "].value"), String(e.target.checked));
1081
+ return setFieldValue("properties[".concat(_index2, "].value"), String(e.target.checked));
1030
1082
  }
1031
1083
  }, key);
1032
1084
  }
1033
1085
  case "alignment_block":
1034
1086
  {
1035
- var _index2 = neetoCist.findIndexBy({
1087
+ var _index3 = neetoCist.findIndexBy({
1036
1088
  key: key
1037
1089
  }, values.properties);
1038
1090
  return /*#__PURE__*/jsxRuntime.jsx(AlignmentBlock, {
1039
1091
  label: buildLabel(key, kind),
1040
- name: "properties[".concat(_index2, "].value")
1092
+ name: "properties[".concat(_index3, "].value")
1041
1093
  });
1042
1094
  }
1043
1095
  default:
@@ -1217,7 +1269,7 @@ var ThemeMeta = function ThemeMeta(_ref) {
1217
1269
  helpPopoverProps: nameHelpPopoverProps,
1218
1270
  name: "name",
1219
1271
  title: t("neetoThemes.common.name"),
1220
- children: /*#__PURE__*/jsxRuntime.jsx(Input, {
1272
+ children: /*#__PURE__*/jsxRuntime.jsx(Input$1, {
1221
1273
  autoFocus: true,
1222
1274
  "data-cy": "theme-name-property",
1223
1275
  name: "name"
@@ -1757,10 +1809,12 @@ var Themes = function Themes(_ref) {
1757
1809
  previewingTheme = _useThemeStore.previewingTheme;
1758
1810
  var _useConfigStore = useThemeUtils.useConfigStore(function (store) {
1759
1811
  return {
1760
- entityType: store["entityType"]
1812
+ entityType: store["entityType"],
1813
+ entityId: store["entityId"]
1761
1814
  };
1762
1815
  }, shallow.shallow),
1763
- entityType = _useConfigStore.entityType;
1816
+ entityType = _useConfigStore.entityType,
1817
+ entityId = _useConfigStore.entityId;
1764
1818
  var _useState = react.useState(""),
1765
1819
  _useState2 = _slicedToArray(_useState, 2),
1766
1820
  searchQuery = _useState2[0],
@@ -1805,7 +1859,8 @@ var Themes = function Themes(_ref) {
1805
1859
  };
1806
1860
  var handleApplyGlobalTheme = function handleApplyGlobalTheme(themeId) {
1807
1861
  var payload = {
1808
- entityType: entityType
1862
+ entityType: entityType,
1863
+ entityId: entityId
1809
1864
  };
1810
1865
  applyGlobalTheme({
1811
1866
  themeId: themeId,