@bigbinary/neeto-themes-frontend 4.0.19 → 4.0.21

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.
Files changed (45) hide show
  1. package/app/javascript/src/translations/ar.json +4 -1
  2. package/app/javascript/src/translations/bg.json +4 -1
  3. package/app/javascript/src/translations/ca.json +4 -1
  4. package/app/javascript/src/translations/cs.json +4 -1
  5. package/app/javascript/src/translations/da.json +4 -1
  6. package/app/javascript/src/translations/de.json +4 -1
  7. package/app/javascript/src/translations/es-MX.json +4 -1
  8. package/app/javascript/src/translations/es.json +4 -1
  9. package/app/javascript/src/translations/et.json +4 -1
  10. package/app/javascript/src/translations/fi.json +4 -1
  11. package/app/javascript/src/translations/fil.json +4 -1
  12. package/app/javascript/src/translations/fr.json +4 -1
  13. package/app/javascript/src/translations/he.json +4 -1
  14. package/app/javascript/src/translations/hi.json +4 -1
  15. package/app/javascript/src/translations/hr.json +4 -1
  16. package/app/javascript/src/translations/hu.json +4 -1
  17. package/app/javascript/src/translations/id.json +4 -1
  18. package/app/javascript/src/translations/it.json +4 -1
  19. package/app/javascript/src/translations/ja.json +4 -1
  20. package/app/javascript/src/translations/ko.json +4 -1
  21. package/app/javascript/src/translations/nl.json +4 -1
  22. package/app/javascript/src/translations/pl.json +4 -1
  23. package/app/javascript/src/translations/pt-BR.json +4 -1
  24. package/app/javascript/src/translations/pt.json +4 -1
  25. package/app/javascript/src/translations/ro.json +4 -1
  26. package/app/javascript/src/translations/ru.json +4 -1
  27. package/app/javascript/src/translations/sk.json +4 -1
  28. package/app/javascript/src/translations/sl.json +4 -1
  29. package/app/javascript/src/translations/sv.json +4 -1
  30. package/app/javascript/src/translations/th.json +4 -1
  31. package/app/javascript/src/translations/tr.json +4 -1
  32. package/app/javascript/src/translations/uk.json +4 -1
  33. package/app/javascript/src/translations/vi.json +4 -1
  34. package/app/javascript/src/translations/zh-CN.json +4 -1
  35. package/app/javascript/src/translations/zh-TW.json +4 -1
  36. package/dist/.ready +1 -1
  37. package/dist/NeetoThemesBuilder.js +53 -19
  38. package/dist/NeetoThemesBuilder.js.map +1 -1
  39. package/dist/cjs/NeetoThemesBuilder.js +52 -18
  40. package/dist/cjs/NeetoThemesBuilder.js.map +1 -1
  41. package/dist/cjs/index.js +1 -0
  42. package/dist/cjs/index.js.map +1 -1
  43. package/dist/index.js +1 -0
  44. package/dist/index.js.map +1 -1
  45. package/package.json +3 -3
@@ -41,6 +41,7 @@ var LeftAlign = require('@bigbinary/neeto-icons/LeftAlign');
41
41
  var ColorPicker = require('@bigbinary/neetoui/ColorPicker');
42
42
  var Select = require('@bigbinary/neetoui/Select');
43
43
  var antd = require('antd');
44
+ var Checkbox = require('@bigbinary/neetoui/Checkbox');
44
45
  var Input = require('@bigbinary/neetoui/Input');
45
46
  var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
46
47
  var _regeneratorRuntime = require('@babel/runtime/regenerator');
@@ -557,6 +558,19 @@ var LogoPosition = function LogoPosition() {
557
558
 
558
559
  function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
559
560
  function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
561
+
562
+ // Capitalizes the first letter of the displayed label while keeping the
563
+ // underlying value untouched (position values like "top left" are used
564
+ // verbatim as CSS background-position, so they must stay lowercase).
565
+ var toCapitalizedOption = function toCapitalizedOption(value) {
566
+ var _toLabelAndValue = neetoCist.toLabelAndValue(value),
567
+ label = _toLabelAndValue.label,
568
+ optionValue = _toLabelAndValue.value;
569
+ return {
570
+ label: label ? neetoCist.capitalize(label) : label,
571
+ value: optionValue
572
+ };
573
+ };
560
574
  var buildInitialValues = function buildInitialValues(theme, themePropertiesSchema) {
561
575
  if (neetoCist.isPresent(theme)) return theme;
562
576
  return {
@@ -871,20 +885,17 @@ var SelectBlock = function SelectBlock(_ref) {
871
885
  options = _ref.options,
872
886
  onChange = _ref.onChange;
873
887
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
874
- className: "flex items-center justify-between",
888
+ className: "neeto-ui-border-gray-200 flex flex-col gap-2 border-t pt-3",
875
889
  "data-testid": "theme-style-".concat(utils$1.joinHyphenCase(label)),
876
890
  children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
877
891
  "data-testid": "logo-field-labels",
878
892
  style: "body2",
879
893
  children: label
880
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
881
- className: "w-40",
882
- children: /*#__PURE__*/jsxRuntime.jsx(Select, {
883
- onChange: onChange,
884
- options: options,
885
- placeholder: placeholder,
886
- value: value
887
- })
894
+ }), /*#__PURE__*/jsxRuntime.jsx(Select, {
895
+ onChange: onChange,
896
+ options: options,
897
+ placeholder: placeholder,
898
+ value: value
888
899
  })]
889
900
  });
890
901
  };
@@ -917,18 +928,35 @@ var SliderBlock = function SliderBlock(_ref) {
917
928
  });
918
929
  };
919
930
 
920
- var _excluded = ["label", "name"];
931
+ var _excluded = ["label", "name", "asCheckbox"];
921
932
  function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
922
933
  function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
923
934
  var SwitchBlock = function SwitchBlock(_ref) {
924
935
  var label = _ref.label,
925
936
  name = _ref.name,
926
- switchProps = _objectWithoutProperties(_ref, _excluded);
937
+ _ref$asCheckbox = _ref.asCheckbox,
938
+ asCheckbox = _ref$asCheckbox === void 0 ? false : _ref$asCheckbox,
939
+ inputProps = _objectWithoutProperties(_ref, _excluded);
927
940
  var _useTranslation = reactI18next.useTranslation(),
928
941
  t = _useTranslation.t,
929
942
  i18n = _useTranslation.i18n;
930
943
  var translationKey = "neetoThemes.properties.boolean.".concat(name, "HelpText");
931
944
  var doesHelpTextExist = i18n.exists(translationKey);
945
+ if (asCheckbox) {
946
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
947
+ className: "flex items-center gap-2",
948
+ "data-testid": "theme-style-content-background",
949
+ children: [/*#__PURE__*/jsxRuntime.jsx(Checkbox, _objectSpread$1(_objectSpread$1({}, _objectSpread$1({
950
+ label: label,
951
+ name: name
952
+ }, inputProps)), {}, {
953
+ "data-testid": "enable-background-color-toggle"
954
+ })), doesHelpTextExist && /*#__PURE__*/jsxRuntime.jsx(HelpPopover, {
955
+ className: "shrink-0",
956
+ description: t(translationKey)
957
+ })]
958
+ });
959
+ }
932
960
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
933
961
  className: "flex items-center justify-between",
934
962
  "data-testid": "theme-style-content-background",
@@ -948,7 +976,7 @@ var SwitchBlock = function SwitchBlock(_ref) {
948
976
  })]
949
977
  }), /*#__PURE__*/jsxRuntime.jsx(Switch, _objectSpread$1(_objectSpread$1({}, _objectSpread$1({
950
978
  name: name
951
- }, switchProps)), {}, {
979
+ }, inputProps)), {}, {
952
980
  "data-testid": "enable-background-color-toggle"
953
981
  }))]
954
982
  });
@@ -1078,15 +1106,16 @@ var Properties = function Properties(_ref) {
1078
1106
  key: key
1079
1107
  }, values.properties);
1080
1108
  var error = errors === null || errors === void 0 || (_errors$properties = errors.properties) === null || _errors$properties === void 0 || (_errors$properties = _errors$properties[index]) === null || _errors$properties === void 0 ? void 0 : _errors$properties.value;
1081
- return /*#__PURE__*/jsxRuntime.jsx(TextBlock, {
1109
+ return /*#__PURE__*/react.createElement(TextBlock, {
1082
1110
  error: error,
1111
+ key: key,
1083
1112
  label: buildLabel(key, kind),
1084
1113
  name: "properties[".concat(index, "].value"),
1085
1114
  value: value || "",
1086
1115
  onChange: function onChange(e) {
1087
1116
  return setFieldValue("properties[".concat(index, "].value"), e.target.value);
1088
1117
  }
1089
- }, key);
1118
+ });
1090
1119
  }
1091
1120
  case "font_family":
1092
1121
  return /*#__PURE__*/jsxRuntime.jsx(FontPickerBlock, {
@@ -1138,12 +1167,12 @@ var Properties = function Properties(_ref) {
1138
1167
  }, values.properties);
1139
1168
  var options = (_findBy4 = neetoCist.findBy({
1140
1169
  key: key
1141
- }, themePropertiesSchema)) === null || _findBy4 === void 0 || (_findBy4 = _findBy4.options) === null || _findBy4 === void 0 ? void 0 : _findBy4.map(neetoCist.toLabelAndValue);
1170
+ }, themePropertiesSchema)) === null || _findBy4 === void 0 || (_findBy4 = _findBy4.options) === null || _findBy4 === void 0 ? void 0 : _findBy4.map(toCapitalizedOption);
1142
1171
  return /*#__PURE__*/jsxRuntime.jsx(SelectBlock, {
1143
1172
  label: buildLabel(key, kind),
1144
1173
  options: options || useExpandedSection.POSITION_OPTIONS,
1145
1174
  placeholder: "left",
1146
- value: neetoCist.toLabelAndValue(value),
1175
+ value: toCapitalizedOption(value),
1147
1176
  onChange: function onChange(option) {
1148
1177
  return setFieldValue("properties[".concat(_index, "].value"), option.value);
1149
1178
  }
@@ -1151,10 +1180,15 @@ var Properties = function Properties(_ref) {
1151
1180
  }
1152
1181
  case "boolean":
1153
1182
  {
1183
+ var _findBy5;
1154
1184
  var _index2 = neetoCist.findIndexBy({
1155
1185
  key: key
1156
1186
  }, values.properties);
1187
+ var renderAsCheckbox = ((_findBy5 = neetoCist.findBy({
1188
+ key: key
1189
+ }, themePropertiesSchema)) === null || _findBy5 === void 0 ? void 0 : _findBy5.renderAsCheckbox) || false;
1157
1190
  return /*#__PURE__*/jsxRuntime.jsx(SwitchBlock, {
1191
+ asCheckbox: renderAsCheckbox,
1158
1192
  checked: value !== "false",
1159
1193
  label: buildLabel(key, kind),
1160
1194
  name: neetoCist.snakeToCamelCase(key),
@@ -1281,9 +1315,9 @@ var ImageBlock = function ImageBlock(_ref) {
1281
1315
  onUploadComplete: handleImageChange
1282
1316
  }), isPositionChangerVisible && /*#__PURE__*/jsxRuntime.jsx(SelectBlock, {
1283
1317
  label: buildLabel("".concat(name, "Position"), "image"),
1284
- options: options || useExpandedSection.POSITION_OPTIONS,
1318
+ options: (options === null || options === void 0 ? void 0 : options.map(toCapitalizedOption)) || useExpandedSection.POSITION_OPTIONS,
1285
1319
  placeholder: t("neetoThemes.common.left"),
1286
- value: neetoCist.toLabelAndValue(((_findBy = neetoCist.findBy({
1320
+ value: toCapitalizedOption(((_findBy = neetoCist.findBy({
1287
1321
  key: "".concat(name, "_position")
1288
1322
  }, values.properties)) === null || _findBy === void 0 ? void 0 : _findBy.value) || (positionKeyInSchema === null || positionKeyInSchema === void 0 ? void 0 : positionKeyInSchema.defaultValue)),
1289
1323
  onChange: function onChange(option) {