@bigbinary/neeto-themes-frontend 1.1.17 → 1.1.19

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.
@@ -28,12 +28,12 @@
28
28
  },
29
29
  "alerts": {
30
30
  "title": {
31
- "deleteTheme": "Confirm delete theme"
31
+ "deleteTheme": "Confirm theme deletion"
32
32
  },
33
33
  "message": {
34
- "deleteTheme_zero": "You are permanently deleting the \"{{name, anyCase}}\" theme. Are you sure you want to proceed?",
35
- "deleteTheme_one": "You are permanently deleting the \"{{name, anyCase}}\" theme. This theme is being used in one {{entityType, anyCase}}. {{entityType, anyCase}} using this theme would fall back to using the default \"Plain blue\" theme. Are you sure you want to proceed?",
36
- "deleteTheme_other": "You are permanently deleting the \"{{name, anyCase}}\" theme. This theme is being used in {{count}} {{entityType, anyCase}}. {{entityType, anyCase}}s using this theme would fall back to using the default \"Plain blue\" theme. Are you sure you want to proceed?"
34
+ "deleteTheme_zero": "You are permanently deleting the theme \"{{name, anyCase}}\". Are you sure you want to proceed?",
35
+ "deleteTheme_one": "You are permanently deleting the theme \"{{name, anyCase}}\". This theme is being used in one {{entityType, anyCase}}. {{entityType, anyCase}} using this theme would fall back to using the default theme \"Plain blue\". Are you sure you want to proceed?",
36
+ "deleteTheme_other": "You are permanently deleting the theme \"{{name, anyCase}}\". This theme is being used in {{count}} {{entityType, anyCase}}. {{entityType, anyCase}}s using this theme would fall back to using the default theme \"Plain blue\". Are you sure you want to proceed?"
37
37
  }
38
38
  },
39
39
  "build": {
package/dist/index.cjs.js CHANGED
@@ -811,6 +811,84 @@ var OVERLAY_OPACITY_SLIDER_MARKS = {
811
811
  };
812
812
  var HUNDRED = 100;
813
813
 
814
+ var buildInitialValues = function buildInitialValues(theme, themeConfig) {
815
+ if (neetoCist.isPresent(theme)) return theme;
816
+ return {
817
+ name: i18next.t("neetoThemes.build.leftSideBar.themes.createTheme.newThemeName"),
818
+ properties: themeConfig.map(function (_ref) {
819
+ var key = _ref.key,
820
+ kind = _ref.kind,
821
+ defaultValue = _ref.defaultValue;
822
+ switch (kind) {
823
+ case "color":
824
+ return {
825
+ value: defaultValue,
826
+ kind: "color",
827
+ key: key
828
+ };
829
+ case "font_family":
830
+ return {
831
+ value: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
832
+ kind: "font_family",
833
+ key: key
834
+ };
835
+ case "overlay_opacity":
836
+ return {
837
+ value: 0,
838
+ kind: "overlay_opacity",
839
+ key: key
840
+ };
841
+ case "slider":
842
+ return {
843
+ value: 0,
844
+ kind: "slider",
845
+ key: key
846
+ };
847
+ case "boolean":
848
+ return {
849
+ value: false,
850
+ kind: "boolean",
851
+ key: key
852
+ };
853
+ default:
854
+ return null;
855
+ }
856
+ }).filter(neetoCist.isNot(null))
857
+ };
858
+ };
859
+ var buildImageData = function buildImageData(values, themeConfig) {
860
+ return neetoCist.filterBy({
861
+ kind: "image"
862
+ }, themeConfig).reduce(function (acc, item) {
863
+ var _values$snakeToCamelC;
864
+ var signedId = (_values$snakeToCamelC = values[neetoCist.snakeToCamelCase(item.key)]) === null || _values$snakeToCamelC === void 0 ? void 0 : _values$snakeToCamelC.signedId;
865
+ acc[item.key] = signedId;
866
+ return acc;
867
+ }, {});
868
+ };
869
+ var isPropertyVisible = function isPropertyVisible(key, formikValues, themeConfig) {
870
+ var _findBy;
871
+ var property = neetoCist.findBy({
872
+ key: key
873
+ }, themeConfig);
874
+ if (neetoCist.isNotPresent(property)) return false;
875
+ var conditionalKey = property === null || property === void 0 ? void 0 : property.dependsOn;
876
+ if (neetoCist.isNotPresent(conditionalKey)) return true;
877
+ var dependentProperty = neetoCist.findBy({
878
+ key: conditionalKey
879
+ }, themeConfig);
880
+ if (dependentProperty.kind === "image") {
881
+ var _formikValues$snakeTo;
882
+ return neetoCist.isPresent((_formikValues$snakeTo = formikValues[neetoCist.snakeToCamelCase(conditionalKey)]) === null || _formikValues$snakeTo === void 0 ? void 0 : _formikValues$snakeTo.url);
883
+ }
884
+ return neetoCist.isPresent((_findBy = neetoCist.findBy({
885
+ key: conditionalKey
886
+ }, formikValues.properties)) === null || _findBy === void 0 ? void 0 : _findBy.value);
887
+ };
888
+ var buildLabel = function buildLabel(key, kind) {
889
+ return i18next.t("neetoThemes.properties.".concat(neetoCist.snakeToCamelCase(kind), ".").concat(neetoCist.snakeToCamelCase(key)));
890
+ };
891
+
814
892
  var Card$2 = function Card(_ref) {
815
893
  var _ref$title = _ref.title,
816
894
  title = _ref$title === void 0 ? "" : _ref$title,
@@ -6997,7 +7075,7 @@ var Images = function Images(_ref) {
6997
7075
  var _useFormikContext = formik.useFormikContext(),
6998
7076
  values = _useFormikContext.values;
6999
7077
  var key = neetoCist.snakeToCamelCase(attribute);
7000
- var title = neetoCist.humanize(key);
7078
+ var title = buildLabel(key, "image");
7001
7079
  var imageData = values[key];
7002
7080
  return /*#__PURE__*/jsxRuntime.jsx(Card$2, {
7003
7081
  title: title,
@@ -7011,84 +7089,6 @@ var Images = function Images(_ref) {
7011
7089
  });
7012
7090
  };
7013
7091
 
7014
- var buildInitialValues = function buildInitialValues(theme, themeConfig) {
7015
- if (neetoCist.isPresent(theme)) return theme;
7016
- return {
7017
- name: i18next.t("neetoThemes.build.leftSideBar.themes.createTheme.newThemeName"),
7018
- properties: themeConfig.map(function (_ref) {
7019
- var key = _ref.key,
7020
- kind = _ref.kind,
7021
- defaultValue = _ref.defaultValue;
7022
- switch (kind) {
7023
- case "color":
7024
- return {
7025
- value: defaultValue,
7026
- kind: "color",
7027
- key: key
7028
- };
7029
- case "font_family":
7030
- return {
7031
- value: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
7032
- kind: "font_family",
7033
- key: key
7034
- };
7035
- case "overlay_opacity":
7036
- return {
7037
- value: 0,
7038
- kind: "overlay_opacity",
7039
- key: key
7040
- };
7041
- case "slider":
7042
- return {
7043
- value: 0,
7044
- kind: "slider",
7045
- key: key
7046
- };
7047
- case "boolean":
7048
- return {
7049
- value: false,
7050
- kind: "boolean",
7051
- key: key
7052
- };
7053
- default:
7054
- return null;
7055
- }
7056
- }).filter(neetoCist.isNot(null))
7057
- };
7058
- };
7059
- var buildImageData = function buildImageData(values, themeConfig) {
7060
- return neetoCist.filterBy({
7061
- kind: "image"
7062
- }, themeConfig).reduce(function (acc, item) {
7063
- var _values$snakeToCamelC;
7064
- var signedId = (_values$snakeToCamelC = values[neetoCist.snakeToCamelCase(item.key)]) === null || _values$snakeToCamelC === void 0 ? void 0 : _values$snakeToCamelC.signedId;
7065
- acc[item.key] = signedId;
7066
- return acc;
7067
- }, {});
7068
- };
7069
- var isPropertyVisible = function isPropertyVisible(key, formikValues, themeConfig) {
7070
- var _findBy;
7071
- var property = neetoCist.findBy({
7072
- key: key
7073
- }, themeConfig);
7074
- if (neetoCist.isNotPresent(property)) return false;
7075
- var conditionalKey = property === null || property === void 0 ? void 0 : property.dependsOn;
7076
- if (neetoCist.isNotPresent(conditionalKey)) return true;
7077
- var dependentProperty = neetoCist.findBy({
7078
- key: conditionalKey
7079
- }, themeConfig);
7080
- if (dependentProperty.kind === "image") {
7081
- var _formikValues$snakeTo;
7082
- return neetoCist.isPresent((_formikValues$snakeTo = formikValues[neetoCist.snakeToCamelCase(conditionalKey)]) === null || _formikValues$snakeTo === void 0 ? void 0 : _formikValues$snakeTo.url);
7083
- }
7084
- return neetoCist.isPresent((_findBy = neetoCist.findBy({
7085
- key: conditionalKey
7086
- }, formikValues.properties)) === null || _findBy === void 0 ? void 0 : _findBy.value);
7087
- };
7088
- var buildLabel = function buildLabel(key, kind) {
7089
- return i18next.t("neetoThemes.properties.".concat(neetoCist.snakeToCamelCase(kind), ".").concat(neetoCist.snakeToCamelCase(key)));
7090
- };
7091
-
7092
7092
  var ColorBlock = function ColorBlock(_ref) {
7093
7093
  var label = _ref.label,
7094
7094
  _ref$color = _ref.color,