@bigbinary/neeto-themes-frontend 3.1.20 → 3.1.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.
package/README.md CHANGED
@@ -108,6 +108,14 @@ and `neeto-themes-engine` Rails engine.
108
108
  - `use_default_image_size`: Used to apply defaultImageSize prop passed to
109
109
  ImageUploader component.
110
110
 
111
+ - `default_image_size`: Used to pass defaultImageSize prop passed to
112
+ ImageUploader component. Should be an object with `width` and `height`
113
+ properties.
114
+
115
+ - `fixed_aspect_ratio`: Used to pass fixedAspectRatio prop passed to
116
+ ImageUploader component. Should be an object with `width` and `height`
117
+ properties.
118
+
111
119
  3. **Provide a css variable prefix**
112
120
 
113
121
  This value will be used to prefix all CSS variables. Eg:
@@ -984,7 +984,8 @@ var ImageBlock = function ImageBlock(_ref) {
984
984
  } : _ref$uploadConfig,
985
985
  attribute = _ref.attribute,
986
986
  defaultImageSize = _ref.defaultImageSize,
987
- useDefaultImageSize = _ref.useDefaultImageSize;
987
+ useDefaultImageSize = _ref.useDefaultImageSize,
988
+ fixedAspectRatio = _ref.fixedAspectRatio;
988
989
  var _useTranslation = useTranslation(),
989
990
  t = _useTranslation.t;
990
991
  var _useFormikContext = useFormikContext(),
@@ -1063,6 +1064,7 @@ var ImageBlock = function ImageBlock(_ref) {
1063
1064
  }), /*#__PURE__*/jsxs("div", {
1064
1065
  className: "space-y-3",
1065
1066
  children: [/*#__PURE__*/createElement(ImageUploader, {
1067
+ fixedAspectRatio: fixedAspectRatio,
1066
1068
  uploadConfig: uploadConfig,
1067
1069
  className: "h-40 w-full",
1068
1070
  defaultImageSize: useDefaultImageSize ? defaultImageSize : {},
@@ -1089,7 +1091,8 @@ var Images = function Images(_ref) {
1089
1091
  className = _ref.className,
1090
1092
  onPropertiesChange = _ref.onPropertiesChange,
1091
1093
  defaultImageSize = _ref.defaultImageSize,
1092
- useDefaultImageSize = _ref.useDefaultImageSize;
1094
+ useDefaultImageSize = _ref.useDefaultImageSize,
1095
+ fixedAspectRatio = _ref.fixedAspectRatio;
1093
1096
  var _useFormikContext = useFormikContext(),
1094
1097
  values = _useFormikContext.values;
1095
1098
  var _useConfigStore = useConfigStore(function (store) {
@@ -1109,6 +1112,7 @@ var Images = function Images(_ref) {
1109
1112
  children: [/*#__PURE__*/jsx(ImageBlock, {
1110
1113
  attribute: attribute,
1111
1114
  defaultImageSize: defaultImageSize,
1115
+ fixedAspectRatio: fixedAspectRatio,
1112
1116
  imageData: imageData,
1113
1117
  useDefaultImageSize: useDefaultImageSize,
1114
1118
  name: key
@@ -1154,6 +1158,7 @@ var Customize = function Customize(_ref) {
1154
1158
  isApplyingTheme = _ref.isApplyingTheme,
1155
1159
  onPropertiesChange = _ref.onPropertiesChange,
1156
1160
  defaultImageSize = _ref.defaultImageSize,
1161
+ fixedAspectRatio = _ref.fixedAspectRatio,
1157
1162
  onEditCSSClick = _ref.onEditCSSClick,
1158
1163
  currentScreen = _ref.currentScreen;
1159
1164
  var _useTranslation = useTranslation(),
@@ -1296,17 +1301,20 @@ var Customize = function Customize(_ref) {
1296
1301
  kind: "image"
1297
1302
  }, themePropertiesSchema).map(function (_ref6) {
1298
1303
  var key = _ref6.key,
1299
- useDefaultImageSize = _ref6.useDefaultImageSize;
1300
- return /*#__PURE__*/createElement(Images, {
1301
- defaultImageSize: defaultImageSize,
1304
+ useDefaultImageSize = _ref6.useDefaultImageSize,
1305
+ propertyDefaultSize = _ref6.defaultImageSize,
1306
+ propertyFixedAspectRatio = _ref6.fixedAspectRatio;
1307
+ return /*#__PURE__*/createElement(Images, _defineProperty({
1308
+ fixedAspectRatio: fixedAspectRatio,
1302
1309
  onPropertiesChange: onPropertiesChange,
1303
1310
  useDefaultImageSize: useDefaultImageSize,
1304
1311
  attribute: key,
1305
1312
  className: classnames({
1306
1313
  hidden: isCustomCssScreen
1307
1314
  }),
1315
+ defaultImageSize: propertyDefaultSize || defaultImageSize,
1308
1316
  key: key
1309
- });
1317
+ }, "fixedAspectRatio", propertyFixedAspectRatio || fixedAspectRatio));
1310
1318
  }), enabledFeatures.customCSS && /*#__PURE__*/jsx(CustomCSS, {
1311
1319
  currentScreen: currentScreen,
1312
1320
  onEditCSSClick: onEditCSSClick
@@ -1908,6 +1916,7 @@ var Sidebar = function Sidebar(_ref) {
1908
1916
  var thumbnail = _ref.thumbnail,
1909
1917
  onPropertiesChange = _ref.onPropertiesChange,
1910
1918
  defaultImageSize = _ref.defaultImageSize,
1919
+ fixedAspectRatio = _ref.fixedAspectRatio,
1911
1920
  onApplyThemeSuccess = _ref.onApplyThemeSuccess,
1912
1921
  onUpdateThemeSuccess = _ref.onUpdateThemeSuccess,
1913
1922
  onApplyGlobalThemeSuccess = _ref.onApplyGlobalThemeSuccess;
@@ -1997,7 +2006,7 @@ var Sidebar = function Sidebar(_ref) {
1997
2006
  var themeToEdit = useRef(null);
1998
2007
  var isCustomCssScreen = isScreenCustomCSS(currentScreen);
1999
2008
  var handleCreateNewTheme = function handleCreateNewTheme() {
2000
- history.push(buildUrl(buildPathname(routes.themes["new"])));
2009
+ history.push(buildPathname(routes.themes["new"]));
2001
2010
  };
2002
2011
  var handleEditTheme = function handleEditTheme(theme) {
2003
2012
  themeToEdit.current = theme;
@@ -2016,7 +2025,7 @@ var Sidebar = function Sidebar(_ref) {
2016
2025
  };
2017
2026
  var navigateToThemesScreen = function navigateToThemesScreen(themeId) {
2018
2027
  highlightTheme(isPresent(themeId) ? themeId : currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
2019
- history.push(buildUrl(buildPathname(routes.themes.index)));
2028
+ history.push(buildPathname(routes.themes.index));
2020
2029
  themeToEdit.current = null;
2021
2030
  };
2022
2031
  var handleBackPress = function handleBackPress(themeId) {
@@ -2112,6 +2121,7 @@ var Sidebar = function Sidebar(_ref) {
2112
2121
  return /*#__PURE__*/jsx(Customize, {
2113
2122
  currentScreen: currentScreen,
2114
2123
  defaultImageSize: defaultImageSize,
2124
+ fixedAspectRatio: fixedAspectRatio,
2115
2125
  isApplyingTheme: isApplyingTheme,
2116
2126
  onApplyTheme: onApplyTheme,
2117
2127
  onCreateTheme: onCreateTheme,
@@ -2127,6 +2137,7 @@ var Sidebar = function Sidebar(_ref) {
2127
2137
  return /*#__PURE__*/jsx(Customize, {
2128
2138
  currentScreen: currentScreen,
2129
2139
  defaultImageSize: defaultImageSize,
2140
+ fixedAspectRatio: fixedAspectRatio,
2130
2141
  isApplyingTheme: isApplyingTheme,
2131
2142
  onApplyTheme: onApplyTheme,
2132
2143
  onCreateTheme: onCreateTheme,
@@ -2171,6 +2182,8 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
2171
2182
  onPropertiesChange = _ref.onPropertiesChange,
2172
2183
  _ref$defaultImageSize = _ref.defaultImageSize,
2173
2184
  defaultImageSize = _ref$defaultImageSize === void 0 ? {} : _ref$defaultImageSize,
2185
+ _ref$fixedAspectRatio = _ref.fixedAspectRatio,
2186
+ fixedAspectRatio = _ref$fixedAspectRatio === void 0 ? {} : _ref$fixedAspectRatio,
2174
2187
  _ref$helpDocUrl = _ref.helpDocUrl,
2175
2188
  helpDocUrl = _ref$helpDocUrl === void 0 ? null : _ref$helpDocUrl,
2176
2189
  _ref$isTemplateThemes = _ref.isTemplateThemesEnabled,
@@ -2261,6 +2274,7 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
2261
2274
  title: pageTitle || t("neetoThemes.common.theme")
2262
2275
  }), /*#__PURE__*/jsx(Sidebar, {
2263
2276
  defaultImageSize: defaultImageSize,
2277
+ fixedAspectRatio: fixedAspectRatio,
2264
2278
  onApplyGlobalThemeSuccess: onApplyGlobalThemeSuccess,
2265
2279
  onApplyThemeSuccess: onApplyThemeSuccess,
2266
2280
  onPropertiesChange: onPropertiesChange,