@bigbinary/neeto-themes-frontend 3.1.6 → 3.1.7
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 +3 -0
- package/dist/NeetoThemesBuilder.js +31 -9
- package/dist/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/NeetoThemesBuilder.js +30 -8
- package/dist/cjs/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/index.js +2 -2
- package/package.json +11 -11
- package/types.d.ts +1 -0
package/README.md
CHANGED
|
@@ -105,6 +105,9 @@ and `neeto-themes-engine` Rails engine.
|
|
|
105
105
|
- `parent_class`: This key needs to be added for custom css feature to work
|
|
106
106
|
properly. See more on [custom css](#custom-css) feature.
|
|
107
107
|
|
|
108
|
+
- `use_default_image_size`: Used to apply defaultImageSize prop
|
|
109
|
+
passed to ImageUploader component.
|
|
110
|
+
|
|
108
111
|
3. **Provide a css variable prefix**
|
|
109
112
|
|
|
110
113
|
This value will be used to prefix all CSS variables. Eg:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { shallow } from 'zustand/shallow';
|
|
2
2
|
import { useState, useEffect, createElement, useRef, memo, useCallback } from 'react';
|
|
3
|
-
import { t as t$1 } from 'i18next';
|
|
4
3
|
import { hyphenate, findBy, findIndexBy, isPresent, isNot, filterBy, snakeToCamelCase, isNotPresent, toLabelAndValue, humanize, isNotEmpty, noop } from '@bigbinary/neeto-cist';
|
|
5
|
-
import { useMutationWithInvalidation, withT, useBreakpoints,
|
|
4
|
+
import { useMutationWithInvalidation, withT, useBreakpoints, PageTitle } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
6
5
|
import Spinner from '@bigbinary/neetoui/Spinner';
|
|
6
|
+
import { useTranslation, Trans } from 'react-i18next';
|
|
7
7
|
import { B as BASE_URL, b as scrollElementIntoView, c as setCustomCSS, g as getDominantColorFromUrl, i as isEditThemeRoute, d as isFunction, e as isNewThemeRoute } from './index-i8lxlWVz.js';
|
|
8
8
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
9
9
|
import axios from 'axios';
|
|
@@ -14,7 +14,6 @@ import { joinHyphenCase, buildUrl } from '@bigbinary/neeto-commons-frontend/util
|
|
|
14
14
|
import Collapse from '@bigbinary/neeto-icons/Collapse';
|
|
15
15
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
16
16
|
import Button from '@bigbinary/neetoui/Button';
|
|
17
|
-
import { useTranslation, Trans } from 'react-i18next';
|
|
18
17
|
import { useHistory, useParams, Switch as Switch$1, Route } from 'react-router-dom';
|
|
19
18
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
20
19
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
@@ -32,6 +31,7 @@ import Editor from '@monaco-editor/react';
|
|
|
32
31
|
import { useFormikContext, Field } from 'formik';
|
|
33
32
|
import Down from '@bigbinary/neeto-icons/Down';
|
|
34
33
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
34
|
+
import { t as t$1 } from 'i18next';
|
|
35
35
|
import CenterAlign from '@bigbinary/neeto-icons/CenterAlign';
|
|
36
36
|
import LeftAlign from '@bigbinary/neeto-icons/LeftAlign';
|
|
37
37
|
import ColorPicker from '@bigbinary/neetoui/ColorPicker';
|
|
@@ -1032,7 +1032,9 @@ var ImageBlock = function ImageBlock(_ref) {
|
|
|
1032
1032
|
uploadConfig = _ref$uploadConfig === void 0 ? {
|
|
1033
1033
|
maxImageSize: ONE_MEGABYTE
|
|
1034
1034
|
} : _ref$uploadConfig,
|
|
1035
|
-
attribute = _ref.attribute
|
|
1035
|
+
attribute = _ref.attribute,
|
|
1036
|
+
defaultImageSize = _ref.defaultImageSize,
|
|
1037
|
+
useDefaultImageSize = _ref.useDefaultImageSize;
|
|
1036
1038
|
var _useTranslation = useTranslation(),
|
|
1037
1039
|
t = _useTranslation.t;
|
|
1038
1040
|
var _useFormikContext = useFormikContext(),
|
|
@@ -1113,6 +1115,7 @@ var ImageBlock = function ImageBlock(_ref) {
|
|
|
1113
1115
|
children: [/*#__PURE__*/createElement(ImageUploader, {
|
|
1114
1116
|
uploadConfig: uploadConfig,
|
|
1115
1117
|
className: "h-40 w-full",
|
|
1118
|
+
defaultImageSize: useDefaultImageSize ? defaultImageSize : {},
|
|
1116
1119
|
key: imageData === null || imageData === void 0 ? void 0 : imageData.url,
|
|
1117
1120
|
src: imageData === null || imageData === void 0 ? void 0 : imageData.url,
|
|
1118
1121
|
onUploadComplete: handleImageChange
|
|
@@ -1134,7 +1137,9 @@ var ImageBlock = function ImageBlock(_ref) {
|
|
|
1134
1137
|
var Images = function Images(_ref) {
|
|
1135
1138
|
var attribute = _ref.attribute,
|
|
1136
1139
|
className = _ref.className,
|
|
1137
|
-
onPropertiesChange = _ref.onPropertiesChange
|
|
1140
|
+
onPropertiesChange = _ref.onPropertiesChange,
|
|
1141
|
+
defaultImageSize = _ref.defaultImageSize,
|
|
1142
|
+
useDefaultImageSize = _ref.useDefaultImageSize;
|
|
1138
1143
|
var _useFormikContext = useFormikContext(),
|
|
1139
1144
|
values = _useFormikContext.values;
|
|
1140
1145
|
var key = snakeToCamelCase(attribute);
|
|
@@ -1146,7 +1151,9 @@ var Images = function Images(_ref) {
|
|
|
1146
1151
|
name: "images",
|
|
1147
1152
|
children: [/*#__PURE__*/jsx(ImageBlock, {
|
|
1148
1153
|
attribute: attribute,
|
|
1154
|
+
defaultImageSize: defaultImageSize,
|
|
1149
1155
|
imageData: imageData,
|
|
1156
|
+
useDefaultImageSize: useDefaultImageSize,
|
|
1150
1157
|
name: key
|
|
1151
1158
|
}), /*#__PURE__*/jsx(Properties, {
|
|
1152
1159
|
onPropertiesChange: onPropertiesChange,
|
|
@@ -1179,6 +1186,7 @@ var Customize = function Customize(_ref) {
|
|
|
1179
1186
|
onUpdateTheme = _ref.onUpdateTheme,
|
|
1180
1187
|
isApplyingTheme = _ref.isApplyingTheme,
|
|
1181
1188
|
onPropertiesChange = _ref.onPropertiesChange,
|
|
1189
|
+
defaultImageSize = _ref.defaultImageSize,
|
|
1182
1190
|
onEditCSSClick = _ref.onEditCSSClick,
|
|
1183
1191
|
currentScreen = _ref.currentScreen;
|
|
1184
1192
|
var _useTranslation = useTranslation(),
|
|
@@ -1313,9 +1321,12 @@ var Customize = function Customize(_ref) {
|
|
|
1313
1321
|
}), filterBy({
|
|
1314
1322
|
kind: "image"
|
|
1315
1323
|
}, themePropertiesSchema).map(function (_ref6) {
|
|
1316
|
-
var key = _ref6.key
|
|
1324
|
+
var key = _ref6.key,
|
|
1325
|
+
useDefaultImageSize = _ref6.useDefaultImageSize;
|
|
1317
1326
|
return /*#__PURE__*/createElement(Images, {
|
|
1327
|
+
defaultImageSize: defaultImageSize,
|
|
1318
1328
|
onPropertiesChange: onPropertiesChange,
|
|
1329
|
+
useDefaultImageSize: useDefaultImageSize,
|
|
1319
1330
|
attribute: key,
|
|
1320
1331
|
className: classnames({
|
|
1321
1332
|
hidden: isCustomCssScreen
|
|
@@ -1922,6 +1933,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1922
1933
|
var _themeToDelete$curren2, _themeToDelete$curren3, _themeToDelete$curren4;
|
|
1923
1934
|
var thumbnail = _ref.thumbnail,
|
|
1924
1935
|
onPropertiesChange = _ref.onPropertiesChange,
|
|
1936
|
+
defaultImageSize = _ref.defaultImageSize,
|
|
1925
1937
|
onApplyThemeSuccess = _ref.onApplyThemeSuccess,
|
|
1926
1938
|
onUpdateThemeSuccess = _ref.onUpdateThemeSuccess,
|
|
1927
1939
|
onApplyGlobalThemeSuccess = _ref.onApplyGlobalThemeSuccess;
|
|
@@ -2125,6 +2137,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2125
2137
|
render: function render() {
|
|
2126
2138
|
return /*#__PURE__*/jsx(Customize, {
|
|
2127
2139
|
currentScreen: currentScreen,
|
|
2140
|
+
defaultImageSize: defaultImageSize,
|
|
2128
2141
|
isApplyingTheme: isApplyingTheme,
|
|
2129
2142
|
onApplyTheme: onApplyTheme,
|
|
2130
2143
|
onCreateTheme: onCreateTheme,
|
|
@@ -2139,6 +2152,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2139
2152
|
render: function render() {
|
|
2140
2153
|
return /*#__PURE__*/jsx(Customize, {
|
|
2141
2154
|
currentScreen: currentScreen,
|
|
2155
|
+
defaultImageSize: defaultImageSize,
|
|
2142
2156
|
isApplyingTheme: isApplyingTheme,
|
|
2143
2157
|
onApplyTheme: onApplyTheme,
|
|
2144
2158
|
onCreateTheme: onCreateTheme,
|
|
@@ -2181,10 +2195,14 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
2181
2195
|
entityId = _ref.entityId,
|
|
2182
2196
|
thumbnail = _ref.thumbnail,
|
|
2183
2197
|
onPropertiesChange = _ref.onPropertiesChange,
|
|
2198
|
+
_ref$defaultImageSize = _ref.defaultImageSize,
|
|
2199
|
+
defaultImageSize = _ref$defaultImageSize === void 0 ? {} : _ref$defaultImageSize,
|
|
2184
2200
|
_ref$helpDocUrl = _ref.helpDocUrl,
|
|
2185
2201
|
helpDocUrl = _ref$helpDocUrl === void 0 ? null : _ref$helpDocUrl,
|
|
2186
2202
|
_ref$isTemplateThemes = _ref.isTemplateThemesEnabled,
|
|
2187
2203
|
isTemplateThemesEnabled = _ref$isTemplateThemes === void 0 ? false : _ref$isTemplateThemes,
|
|
2204
|
+
_ref$pageTitle = _ref.pageTitle,
|
|
2205
|
+
pageTitle = _ref$pageTitle === void 0 ? null : _ref$pageTitle,
|
|
2188
2206
|
_ref$onApplyThemeSucc = _ref.onApplyThemeSuccess,
|
|
2189
2207
|
onApplyThemeSuccess = _ref$onApplyThemeSucc === void 0 ? noop : _ref$onApplyThemeSucc,
|
|
2190
2208
|
_ref$onUpdateThemeSuc = _ref.onUpdateThemeSuccess,
|
|
@@ -2205,6 +2223,8 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
2205
2223
|
};
|
|
2206
2224
|
}, shallow),
|
|
2207
2225
|
setConfigState = _useConfigStore.setConfigState;
|
|
2226
|
+
var _useTranslation = useTranslation(),
|
|
2227
|
+
t = _useTranslation.t;
|
|
2208
2228
|
var _useShowThemeEntity = useShowThemeEntity(entityId),
|
|
2209
2229
|
_useShowThemeEntity$d = _useShowThemeEntity.data,
|
|
2210
2230
|
_useShowThemeEntity$d2 = _useShowThemeEntity$d === void 0 ? {} : _useShowThemeEntity$d,
|
|
@@ -2239,7 +2259,10 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
2239
2259
|
}, [currentTheme, isCurrentThemeLoading]);
|
|
2240
2260
|
return /*#__PURE__*/jsxs("div", {
|
|
2241
2261
|
className: "neeto-themes__wrapper",
|
|
2242
|
-
children: [/*#__PURE__*/jsx(
|
|
2262
|
+
children: [/*#__PURE__*/jsx(PageTitle, {
|
|
2263
|
+
title: pageTitle || t("neetoThemes.common.theme")
|
|
2264
|
+
}), /*#__PURE__*/jsx(Sidebar, {
|
|
2265
|
+
defaultImageSize: defaultImageSize,
|
|
2243
2266
|
onApplyGlobalThemeSuccess: onApplyGlobalThemeSuccess,
|
|
2244
2267
|
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2245
2268
|
onPropertiesChange: onPropertiesChange,
|
|
@@ -2254,7 +2277,6 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
2254
2277
|
})]
|
|
2255
2278
|
});
|
|
2256
2279
|
};
|
|
2257
|
-
var index = withTitle(NeetoThemesBuilder, t$1("neetoThemes.common.theme"));
|
|
2258
2280
|
|
|
2259
|
-
export {
|
|
2281
|
+
export { NeetoThemesBuilder as default };
|
|
2260
2282
|
//# sourceMappingURL=NeetoThemesBuilder.js.map
|