@bigbinary/neeto-themes-frontend 2.1.0 → 2.1.2
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 +74 -36
- package/app/javascript/src/translations/en.json +5 -1
- package/dist/NeetoThemesBuilder.js +1894 -0
- package/dist/NeetoThemesBuilder.js.map +1 -0
- package/dist/{index.cjs.js → cjs/NeetoThemesBuilder.js} +407 -507
- package/dist/cjs/NeetoThemesBuilder.js.map +1 -0
- package/dist/cjs/hooks.js +22 -0
- package/dist/cjs/hooks.js.map +1 -0
- package/dist/cjs/index.js +56 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/utils.js +17 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/hooks.js +14 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index-09d44807.js +174 -0
- package/dist/index-09d44807.js.map +1 -0
- package/dist/index-383fae09.js +159 -0
- package/dist/index-383fae09.js.map +1 -0
- package/dist/index.js +45 -1990
- package/dist/index.js.map +1 -1
- package/dist/useThemeUtils-148b9f27.js +111 -0
- package/dist/useThemeUtils-148b9f27.js.map +1 -0
- package/dist/useThemeUtils-3875c1d1.js +102 -0
- package/dist/useThemeUtils-3875c1d1.js.map +1 -0
- package/dist/utils.js +6 -0
- package/dist/utils.js.map +1 -0
- package/package.json +24 -11
- package/dist/index.cjs.js.map +0 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var shallow = require('zustand/shallow');
|
|
6
4
|
var react = require('react');
|
|
7
5
|
var i18next = require('i18next');
|
|
@@ -10,12 +8,10 @@ var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
|
10
8
|
var Spinner = require('@bigbinary/neetoui/Spinner');
|
|
11
9
|
var reactQuery = require('@tanstack/react-query');
|
|
12
10
|
var axios = require('axios');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
16
|
-
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
17
|
-
var Toastr = require('@bigbinary/neetoui/Toastr');
|
|
11
|
+
var utils = require('../index-09d44807.js');
|
|
12
|
+
var useThemeUtils = require('../useThemeUtils-148b9f27.js');
|
|
18
13
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
14
|
+
var classNames = require('classnames');
|
|
19
15
|
var Alert = require('@bigbinary/neetoui/Alert');
|
|
20
16
|
var reactI18next = require('react-i18next');
|
|
21
17
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
@@ -26,16 +22,20 @@ var Popover = require('@bigbinary/neetoui/Popover');
|
|
|
26
22
|
var Typography = require('@bigbinary/neetoui/Typography');
|
|
27
23
|
var Form = require('@bigbinary/neetoui/formik/Form');
|
|
28
24
|
var yup = require('yup');
|
|
25
|
+
var Editor = require('@monaco-editor/react');
|
|
29
26
|
var formik = require('formik');
|
|
30
27
|
var jsxRuntime = require('react/jsx-runtime');
|
|
28
|
+
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
29
|
+
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
31
30
|
var neetoImageUploaderFrontend = require('@bigbinary/neeto-image-uploader-frontend');
|
|
32
|
-
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
31
|
+
var utils$1 = require('@bigbinary/neeto-commons-frontend/utils');
|
|
32
|
+
var Toastr = require('@bigbinary/neetoui/Toastr');
|
|
33
|
+
var ramda = require('ramda');
|
|
33
34
|
var Select = require('@bigbinary/neetoui/Select');
|
|
34
35
|
var CenterAlign = require('@bigbinary/neeto-icons/CenterAlign');
|
|
35
36
|
var LeftAlign = require('@bigbinary/neeto-icons/LeftAlign');
|
|
36
37
|
var ColorPicker = require('@bigbinary/neetoui/ColorPicker');
|
|
37
38
|
var antd = require('antd');
|
|
38
|
-
var classnames = require('classnames');
|
|
39
39
|
var HelpPopover = require('@bigbinary/neeto-molecules/HelpPopover');
|
|
40
40
|
var Switch = require('@bigbinary/neetoui/Switch');
|
|
41
41
|
var Input = require('@bigbinary/neetoui/formik/Input');
|
|
@@ -43,6 +43,7 @@ var Search = require('@bigbinary/neeto-molecules/Search');
|
|
|
43
43
|
var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
|
|
44
44
|
var LeftArrow = require('@bigbinary/neeto-icons/LeftArrow');
|
|
45
45
|
var Plus = require('@bigbinary/neeto-icons/Plus');
|
|
46
|
+
require('zustand');
|
|
46
47
|
|
|
47
48
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
48
49
|
|
|
@@ -66,10 +67,8 @@ function _interopNamespace(e) {
|
|
|
66
67
|
|
|
67
68
|
var Spinner__default = /*#__PURE__*/_interopDefaultLegacy(Spinner);
|
|
68
69
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
69
|
-
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
70
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
71
|
-
var Toastr__default = /*#__PURE__*/_interopDefaultLegacy(Toastr);
|
|
72
70
|
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
71
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
73
72
|
var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
|
|
74
73
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
75
74
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
@@ -79,11 +78,14 @@ var Popover__default = /*#__PURE__*/_interopDefaultLegacy(Popover);
|
|
|
79
78
|
var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
|
|
80
79
|
var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form);
|
|
81
80
|
var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
|
|
81
|
+
var Editor__default = /*#__PURE__*/_interopDefaultLegacy(Editor);
|
|
82
|
+
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
83
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
84
|
+
var Toastr__default = /*#__PURE__*/_interopDefaultLegacy(Toastr);
|
|
82
85
|
var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
|
|
83
86
|
var CenterAlign__default = /*#__PURE__*/_interopDefaultLegacy(CenterAlign);
|
|
84
87
|
var LeftAlign__default = /*#__PURE__*/_interopDefaultLegacy(LeftAlign);
|
|
85
88
|
var ColorPicker__default = /*#__PURE__*/_interopDefaultLegacy(ColorPicker);
|
|
86
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
87
89
|
var HelpPopover__default = /*#__PURE__*/_interopDefaultLegacy(HelpPopover);
|
|
88
90
|
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
|
89
91
|
var Input__default = /*#__PURE__*/_interopDefaultLegacy(Input);
|
|
@@ -92,26 +94,16 @@ var MoreDropdown__default = /*#__PURE__*/_interopDefaultLegacy(MoreDropdown);
|
|
|
92
94
|
var LeftArrow__default = /*#__PURE__*/_interopDefaultLegacy(LeftArrow);
|
|
93
95
|
var Plus__default = /*#__PURE__*/_interopDefaultLegacy(Plus);
|
|
94
96
|
|
|
95
|
-
var BASE_URL = "neeto_themes_engine";
|
|
96
|
-
var WHITE = "255, 255, 255";
|
|
97
|
-
var BLACK = "0, 0, 0";
|
|
98
|
-
|
|
99
97
|
var show$1 = function show(entityId) {
|
|
100
|
-
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/entities/").concat(entityId));
|
|
98
|
+
return axios__default["default"].get("".concat(utils.BASE_URL, "/api/v1/entities/").concat(entityId));
|
|
101
99
|
};
|
|
102
100
|
var entitiesApi = {
|
|
103
101
|
show: show$1
|
|
104
102
|
};
|
|
105
103
|
|
|
106
|
-
var QUERY_KEYS = {
|
|
107
|
-
THEMES_LIST: "themes-list",
|
|
108
|
-
THEME_DETAILS: "theme-details",
|
|
109
|
-
SCHEMA_DETAILS: "schema-details"
|
|
110
|
-
};
|
|
111
|
-
|
|
112
104
|
var useShowThemeEntity = function useShowThemeEntity(entityId) {
|
|
113
105
|
return reactQuery.useQuery({
|
|
114
|
-
queryKey: [QUERY_KEYS.THEME_ENTITY_DETAILS, entityId],
|
|
106
|
+
queryKey: [useThemeUtils.QUERY_KEYS.THEME_ENTITY_DETAILS, entityId],
|
|
115
107
|
queryFn: function queryFn() {
|
|
116
108
|
return entitiesApi.show(entityId);
|
|
117
109
|
},
|
|
@@ -119,246 +111,44 @@ var useShowThemeEntity = function useShowThemeEntity(entityId) {
|
|
|
119
111
|
});
|
|
120
112
|
};
|
|
121
113
|
|
|
122
|
-
|
|
123
|
-
var useConfigStore = zustand.create(reactUtils.withImmutableActions(function (set) {
|
|
124
|
-
return {
|
|
125
|
-
themePropertiesSchema: [],
|
|
126
|
-
entityType: "",
|
|
127
|
-
entityId: "",
|
|
128
|
-
variableNamesMap: {},
|
|
129
|
-
defaultThemeName: "Plain blue",
|
|
130
|
-
isFetchingSchema: true,
|
|
131
|
-
isTemplateThemesEnabled: false,
|
|
132
|
-
setConfigState: set
|
|
133
|
-
};
|
|
134
|
-
}));
|
|
135
|
-
|
|
136
|
-
/** @type {import("neetocommons/react-utils").ZustandStoreHook} */
|
|
137
|
-
var useThemeStore = zustand.create(reactUtils.withImmutableActions(function (set) {
|
|
138
|
-
return {
|
|
139
|
-
currentTheme: {},
|
|
140
|
-
isCurrentThemeLoading: true,
|
|
141
|
-
previewingTheme: {},
|
|
142
|
-
setThemeState: set
|
|
143
|
-
};
|
|
144
|
-
}));
|
|
145
|
-
|
|
146
|
-
var getImageFromUrl = function getImageFromUrl(source) {
|
|
147
|
-
var image = new Image();
|
|
148
|
-
image.crossOrigin = "anonymous";
|
|
149
|
-
image.src = source;
|
|
150
|
-
return new Promise(function (resolve) {
|
|
151
|
-
image.onload = function () {
|
|
152
|
-
resolve(image);
|
|
153
|
-
};
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
var getDominantColorFromUrl = /*#__PURE__*/function () {
|
|
157
|
-
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(imageUrl) {
|
|
158
|
-
var image, context, c;
|
|
159
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
160
|
-
while (1) switch (_context.prev = _context.next) {
|
|
161
|
-
case 0:
|
|
162
|
-
_context.prev = 0;
|
|
163
|
-
_context.next = 3;
|
|
164
|
-
return getImageFromUrl(imageUrl);
|
|
165
|
-
case 3:
|
|
166
|
-
image = _context.sent;
|
|
167
|
-
context = document.createElement("canvas").getContext("2d");
|
|
168
|
-
context === null || context === void 0 || context.drawImage(image, 0, 0, 1, 1);
|
|
169
|
-
c = context === null || context === void 0 ? void 0 : context.getImageData(0, 0, 1, 1).data;
|
|
170
|
-
if (!c) {
|
|
171
|
-
_context.next = 9;
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
return _context.abrupt("return", "#".concat(((1 << 24) + (c[0] << 16) + (c[1] << 8) + c[2]).toString(16).slice(1)));
|
|
175
|
-
case 9:
|
|
176
|
-
return _context.abrupt("return", null);
|
|
177
|
-
case 12:
|
|
178
|
-
_context.prev = 12;
|
|
179
|
-
_context.t0 = _context["catch"](0);
|
|
180
|
-
Toastr__default["default"].error(_context.t0);
|
|
181
|
-
return _context.abrupt("return", null);
|
|
182
|
-
case 16:
|
|
183
|
-
case "end":
|
|
184
|
-
return _context.stop();
|
|
185
|
-
}
|
|
186
|
-
}, _callee, null, [[0, 12]]);
|
|
187
|
-
}));
|
|
188
|
-
return function getDominantColorFromUrl(_x) {
|
|
189
|
-
return _ref.apply(this, arguments);
|
|
190
|
-
};
|
|
191
|
-
}();
|
|
192
|
-
var scrollElementIntoView = function scrollElementIntoView(elementId) {
|
|
193
|
-
var elementToScroll = document.getElementById(elementId);
|
|
194
|
-
elementToScroll === null || elementToScroll === void 0 || elementToScroll.scrollIntoView({
|
|
195
|
-
behavior: "smooth"
|
|
196
|
-
});
|
|
197
|
-
};
|
|
198
|
-
var isFunction = function isFunction(obj) {
|
|
199
|
-
return typeof obj === "function";
|
|
200
|
-
};
|
|
201
|
-
var hexToRgba = function hexToRgba(hex) {
|
|
202
|
-
var result = /^#?(?:([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?|([a-f\d]{2})([a-f\d]{2})([a-f\d]{2}))$/i.exec(hex);
|
|
203
|
-
if (!result) return null;
|
|
204
|
-
var r = parseInt(result[1] || result[5], 16);
|
|
205
|
-
var g = parseInt(result[2] || result[6], 16);
|
|
206
|
-
var b = parseInt(result[3] || result[7], 16);
|
|
207
|
-
var a = result[4] ? Math.round(parseInt(result[4], 16) / 2.55) / 100 : undefined;
|
|
208
|
-
return "".concat(r, ", ").concat(g, ", ").concat(b).concat(a !== undefined ? ", ".concat(a) : "");
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
var root = document.querySelector(":root");
|
|
212
|
-
var setVariable = function setVariable(name, value, variableNamesMap) {
|
|
213
|
-
var variableName = variableNamesMap[name];
|
|
214
|
-
if (!variableName) return;
|
|
215
|
-
root.style.setProperty(variableName, value);
|
|
216
|
-
};
|
|
217
|
-
var isPropertyIndependent = function isPropertyIndependent(key, theme, schema) {
|
|
218
|
-
var property = neetoCist.findBy({
|
|
219
|
-
key: key
|
|
220
|
-
}, schema);
|
|
221
|
-
if (neetoCist.isNotPresent(property)) return false;
|
|
222
|
-
var conditionalKey = property === null || property === void 0 ? void 0 : property.dependsOn;
|
|
223
|
-
if (neetoCist.isNotPresent(conditionalKey)) return true;
|
|
224
|
-
var dependentPropertySchema = neetoCist.findBy({
|
|
225
|
-
key: conditionalKey
|
|
226
|
-
}, schema);
|
|
227
|
-
var dependentProperty = neetoCist.findBy({
|
|
228
|
-
key: conditionalKey
|
|
229
|
-
}, theme.properties);
|
|
230
|
-
if (dependentPropertySchema.kind === "image") {
|
|
231
|
-
var _theme$snakeToCamelCa;
|
|
232
|
-
return neetoCist.isPresent((_theme$snakeToCamelCa = theme[neetoCist.snakeToCamelCase(conditionalKey)]) === null || _theme$snakeToCamelCa === void 0 ? void 0 : _theme$snakeToCamelCa.url);
|
|
233
|
-
} else if (dependentPropertySchema.kind === "boolean") {
|
|
234
|
-
return (dependentProperty === null || dependentProperty === void 0 ? void 0 : dependentProperty.value) !== "false";
|
|
235
|
-
}
|
|
236
|
-
return neetoCist.isPresent(dependentProperty === null || dependentProperty === void 0 ? void 0 : dependentProperty.value);
|
|
237
|
-
};
|
|
238
|
-
var setTheme = function setTheme(theme, variableNamesMap, themeConfig) {
|
|
239
|
-
if (neetoCist.isNotPresent(theme === null || theme === void 0 ? void 0 : theme.properties)) return;
|
|
240
|
-
theme.properties.forEach(function (property) {
|
|
241
|
-
var attribute = neetoCist.snakeToCamelCase(property.key);
|
|
242
|
-
if (!isPropertyIndependent(property.key, theme, themeConfig)) {
|
|
243
|
-
setVariable(attribute, "", variableNamesMap);
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
if (property.kind === "color") {
|
|
247
|
-
setVariable(attribute, hexToRgba(property.value), variableNamesMap);
|
|
248
|
-
} else if (property.kind === "overlay_opacity") {
|
|
249
|
-
var overlayOpacity = Number(property.value);
|
|
250
|
-
setVariable(neetoCist.snakeToCamelCase("".concat(property.key, "_overlay_opacity")), Math.abs(overlayOpacity / 100), variableNamesMap);
|
|
251
|
-
setVariable(neetoCist.snakeToCamelCase("".concat(property.key, "_overlay_color")), overlayOpacity < 0 ? BLACK : WHITE, variableNamesMap);
|
|
252
|
-
} else if (property.kind === "radius") {
|
|
253
|
-
setVariable(attribute, "".concat(property.value, "px"), variableNamesMap);
|
|
254
|
-
} else {
|
|
255
|
-
setVariable(attribute, property.value, variableNamesMap);
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
neetoCist.filterBy({
|
|
259
|
-
kind: "image"
|
|
260
|
-
}, themeConfig).forEach(function (_ref) {
|
|
261
|
-
var _theme$attribute;
|
|
262
|
-
var key = _ref.key;
|
|
263
|
-
var attribute = neetoCist.snakeToCamelCase(key);
|
|
264
|
-
setVariable(attribute, "url(".concat((_theme$attribute = theme[attribute]) === null || _theme$attribute === void 0 ? void 0 : _theme$attribute.url, ")"), variableNamesMap);
|
|
265
|
-
});
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
var list$1 = function list() {
|
|
269
|
-
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/schema"));
|
|
270
|
-
};
|
|
271
|
-
var schemasApi = {
|
|
272
|
-
list: list$1
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
var useListSchema = function useListSchema() {
|
|
276
|
-
return reactQuery.useQuery({
|
|
277
|
-
queryKey: [QUERY_KEYS.SCHEMA_DETAILS],
|
|
278
|
-
queryFn: schemasApi.list
|
|
279
|
-
});
|
|
280
|
-
};
|
|
114
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
281
115
|
|
|
282
|
-
var
|
|
283
|
-
|
|
284
|
-
var _useThemeStore = useThemeStore(function (store) {
|
|
285
|
-
return {
|
|
286
|
-
previewingTheme: store["previewingTheme"],
|
|
287
|
-
currentTheme: store["currentTheme"]
|
|
288
|
-
};
|
|
289
|
-
}, shallow.shallow),
|
|
290
|
-
previewingTheme = _useThemeStore.previewingTheme,
|
|
291
|
-
currentTheme = _useThemeStore.currentTheme;
|
|
292
|
-
var _useListSchema = useListSchema(),
|
|
293
|
-
isFetchingSchema = _useListSchema.isLoading,
|
|
294
|
-
data = _useListSchema.data;
|
|
295
|
-
var _ref = data || {},
|
|
296
|
-
_ref$schema = _ref.schema,
|
|
297
|
-
themePropertiesSchema = _ref$schema === void 0 ? [] : _ref$schema,
|
|
298
|
-
_ref$variableNamesMap = _ref.variableNamesMap,
|
|
299
|
-
variableNamesMap = _ref$variableNamesMap === void 0 ? {} : _ref$variableNamesMap;
|
|
300
|
-
react.useEffect(function () {
|
|
301
|
-
if (data) {
|
|
302
|
-
setConfigState({
|
|
303
|
-
themePropertiesSchema: data === null || data === void 0 ? void 0 : data.schema,
|
|
304
|
-
variableNamesMap: data === null || data === void 0 ? void 0 : data.variableNamesMap,
|
|
305
|
-
defaultThemeName: data === null || data === void 0 ? void 0 : data.defaultThemeName
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
}, [data]);
|
|
309
|
-
react.useEffect(function () {
|
|
310
|
-
return setConfigState({
|
|
311
|
-
isFetchingSchema: isFetchingSchema
|
|
312
|
-
});
|
|
313
|
-
}, [isFetchingSchema]);
|
|
314
|
-
var setVariable$1 = function setVariable$1(name, value) {
|
|
315
|
-
return setVariable(name, value, variableNamesMap);
|
|
316
|
-
};
|
|
317
|
-
var setTheme$1 = function setTheme$1(theme) {
|
|
318
|
-
return setTheme(theme, variableNamesMap, themePropertiesSchema);
|
|
319
|
-
};
|
|
320
|
-
return {
|
|
321
|
-
setTheme: setTheme$1,
|
|
322
|
-
setVariable: setVariable$1,
|
|
323
|
-
previewingTheme: previewingTheme,
|
|
324
|
-
currentTheme: currentTheme,
|
|
325
|
-
isFetchingSchema: isFetchingSchema
|
|
326
|
-
};
|
|
327
|
-
};
|
|
116
|
+
var css = ".neeto-themes__wrapper{display:flex;width:100%}.neeto-themes__wrapper .neeto-themes-sidebar{background-color:rgb(var(--neeto-ui-white));height:calc(100vh - 64px);width:280px}@media (min-width:1024px){.neeto-themes__wrapper .neeto-themes-sidebar{width:320px}}@media (min-width:1280px){.neeto-themes__wrapper .neeto-themes-sidebar{width:340px}.neeto-themes__wrapper .neeto-themes-sidebar--expanded{max-width:50%;width:520px}}.neeto-themes__wrapper .neeto-themes-sidebar .neeto-themes-sidebar__header{padding-bottom:8px;padding-top:16px}.neeto-themes__wrapper .neeto-themes-sidebar .neeto-themes-sidebar__scroll{display:flex;flex-direction:column;height:calc(100vh - 120px);overflow-y:auto}.neeto-themes__wrapper .neeto-themes-sidebar .neeto-themes-sidebar__scroll .neeto-ui-colorpicker__target .neeto-ui-colorpicker-target__code{display:none}.neeto-themes__wrapper .neeto-themes-sidebar .neeto-ui-colorpicker__target-size--medium{--neeto-ui-colorpicker-target-padding:6px}.neeto-themes__wrapper .neeto-themes-sidebar .neeto-ui-colorpicker__target-size--medium .neeto-ui-colorpicker-target__color{border-radius:0!important;height:20px;width:20px}.neeto-themes__wrapper .css-editor-height__expanded{height:calc(100vh - 300px)}.neeto-themes__wrapper .css-editor-height__regular{height:384px}.neeto-themes__wrapper .neeto-themes-preview__wrapper{flex-grow:1;height:calc(100vh - 64px);position:relative}.neeto-themes-theme-thumbnail--preview-active{border-color:rgb(var(--neeto-ui-gray-600))!important;outline:1px solid rgb(var(--neeto-ui-gray-600))!important}.neeto-themes-theme-thumbnail--active{border-color:rgb(var(--neeto-ui-primary-500))!important;outline:2px solid rgb(var(--neeto-ui-primary-500))!important}.neeto-themes-theme-thumbnail--highlight-active{border-color:rgb(var(--neeto-ui-gray-400))!important;outline:2px solid rgb(var(--neeto-ui-gray-400))!important}.neeto-themes-theme-thumbnail__apply-btn{--neeto-ui-btn-padding-x:12px;--neeto-ui-btn-border-radius:100px}.neeto-themes-theme-thumbnail__apply-btn:disabled,.neeto-themes-theme-thumbnail__apply-btn[disabled]{opacity:1!important}.neeto-themes-sidebar__custom-css-editor-header{background-color:#1e1e1e;border-top-left-radius:var(--neeto-ui-rounded-lg);border-top-right-radius:var(--neeto-ui-rounded-lg)}.neeto-themes-sidebar .monaco-editor,.neeto-themes-sidebar .overflow-guard{border-bottom-left-radius:var(--neeto-ui-rounded-lg);border-bottom-right-radius:var(--neeto-ui-rounded-lg)}.neeto-themes-sidebar__custom-css-wrapper .neeto-themes-nano-section{border-bottom:0!important}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvdGhlbWVzLnNjc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsdUJBRUUsWUFBQSxDQURBLFVBQUYsQ0FHRSw2Q0FHRSwyQ0FBQSxDQURBLHlCQUFBLENBREEsV0FDSixDQUdJLDBCQUxGLDZDQU1JLFdBQUosQ0FDRixDQUNJLDBCQVJGLDZDQVNJLFdBRUosQ0FBSSx1REFFRSxhQUFBLENBREEsV0FHTixDQUNGLENBQ0ksMkVBRUUsa0JBQUEsQ0FEQSxnQkFFTixDQUVJLDJFQUdFLFlBQUEsQ0FDQSxxQkFBQSxDQUhBLDBCQUFBLENBQ0EsZUFFTixDQUdRLDRJQUNFLFlBRFYsQ0FLSSx3RkFDRSx5Q0FITixDQUlNLDRIQUdFLHlCQUFBLENBRkEsV0FBQSxDQUNBLFVBRFIsQ0FPRSxvREFDRSwwQkFMSixDQVFFLG1EQUNFLFlBTkosQ0FTRSxzREFHRSxXQUFBLENBREEseUJBQUEsQ0FEQSxpQkFMSixDQ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W5lZXRvLXVpLXJvdW5kZWQtbGcpO1xuICBib3JkZXItdG9wLXJpZ2h0LXJhZGl1czogdmFyKC0tbmVldG8tdWktcm91bmRlZC1sZyk7XG59XG5cbi5uZWV0by10aGVtZXMtc2lkZWJhciB7XG4gIC5vdmVyZmxvdy1ndWFyZCxcbiAgLm1vbmFjby1lZGl0b3Ige1xuICAgIGJvcmRlci1ib3R0b20tbGVmdC1yYWRpdXM6IHZhcigtLW5lZXRvLXVpLXJvdW5kZWQtbGcpO1xuICAgIGJvcmRlci1ib3R0b20tcmlnaHQtcmFkaXVzOiB2YXIoLS1uZWV0by11aS1yb3VuZGVkLWxnKTtcbiAgfVxufVxuXG4ubmVldG8tdGhlbWVzLXNpZGViYXJfX2N1c3RvbS1jc3Mtd3JhcHBlciB7XG4gIC5uZWV0by10aGVtZXMtbmFuby1zZWN0aW9uIHtcbiAgICBib3JkZXItYm90dG9tOiAwICFpbXBvcnRhbnQ7XG4gIH1cbn1cbiJdfQ== */";
|
|
117
|
+
n(css,{});
|
|
328
118
|
|
|
329
119
|
var _excluded$1 = ["themeId"];
|
|
330
120
|
var list = function list(entityId) {
|
|
331
|
-
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/themes"), {
|
|
121
|
+
return axios__default["default"].get("".concat(utils.BASE_URL, "/api/v1/themes"), {
|
|
332
122
|
params: {
|
|
333
123
|
entity_id: entityId
|
|
334
124
|
}
|
|
335
125
|
});
|
|
336
126
|
};
|
|
337
127
|
var show = function show(id) {
|
|
338
|
-
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/themes/").concat(id));
|
|
128
|
+
return axios__default["default"].get("".concat(utils.BASE_URL, "/api/v1/themes/").concat(id));
|
|
339
129
|
};
|
|
340
130
|
var create = function create(payload) {
|
|
341
|
-
return axios__default["default"].post("".concat(BASE_URL, "/api/v1/themes"), {
|
|
131
|
+
return axios__default["default"].post("".concat(utils.BASE_URL, "/api/v1/themes"), {
|
|
342
132
|
theme: payload
|
|
343
133
|
});
|
|
344
134
|
};
|
|
345
135
|
var update = function update(_ref) {
|
|
346
136
|
var id = _ref.id,
|
|
347
137
|
payload = _ref.payload;
|
|
348
|
-
return axios__default["default"].put("".concat(BASE_URL, "/api/v1/themes/").concat(id), {
|
|
138
|
+
return axios__default["default"].put("".concat(utils.BASE_URL, "/api/v1/themes/").concat(id), {
|
|
349
139
|
theme: payload
|
|
350
140
|
});
|
|
351
141
|
};
|
|
352
142
|
var destroy = function destroy(id) {
|
|
353
|
-
return axios__default["default"]["delete"]("".concat(BASE_URL, "/api/v1/themes/").concat(id));
|
|
143
|
+
return axios__default["default"]["delete"]("".concat(utils.BASE_URL, "/api/v1/themes/").concat(id));
|
|
354
144
|
};
|
|
355
145
|
var clone = function clone(id) {
|
|
356
|
-
return axios__default["default"].post("".concat(BASE_URL, "/api/v1/themes/").concat(id, "/clone"));
|
|
146
|
+
return axios__default["default"].post("".concat(utils.BASE_URL, "/api/v1/themes/").concat(id, "/clone"));
|
|
357
147
|
};
|
|
358
148
|
var apply = function apply(_ref2) {
|
|
359
149
|
var themeId = _ref2.themeId,
|
|
360
150
|
payload = _objectWithoutProperties__default["default"](_ref2, _excluded$1);
|
|
361
|
-
return axios__default["default"].post("".concat(BASE_URL, "/api/v1/themes/").concat(themeId, "/apply"), {
|
|
151
|
+
return axios__default["default"].post("".concat(utils.BASE_URL, "/api/v1/themes/").concat(themeId, "/apply"), {
|
|
362
152
|
entity: payload
|
|
363
153
|
});
|
|
364
154
|
};
|
|
@@ -373,13 +163,13 @@ var themesApi = {
|
|
|
373
163
|
};
|
|
374
164
|
|
|
375
165
|
var useListThemes = function useListThemes(entityId) {
|
|
376
|
-
var _useConfigStore = useConfigStore(function (store) {
|
|
166
|
+
var _useConfigStore = useThemeUtils.useConfigStore(function (store) {
|
|
377
167
|
return {
|
|
378
168
|
isTemplateThemesEnabled: store["isTemplateThemesEnabled"]
|
|
379
169
|
};
|
|
380
170
|
}, shallow.shallow),
|
|
381
171
|
isTemplateThemesEnabled = _useConfigStore.isTemplateThemesEnabled;
|
|
382
|
-
var queryKey = isTemplateThemesEnabled ? [QUERY_KEYS.THEMES_LIST, entityId] : [QUERY_KEYS.THEMES_LIST];
|
|
172
|
+
var queryKey = isTemplateThemesEnabled ? [useThemeUtils.QUERY_KEYS.THEMES_LIST, entityId] : [useThemeUtils.QUERY_KEYS.THEMES_LIST];
|
|
383
173
|
return reactQuery.useQuery({
|
|
384
174
|
queryKey: queryKey,
|
|
385
175
|
queryFn: function queryFn() {
|
|
@@ -389,7 +179,7 @@ var useListThemes = function useListThemes(entityId) {
|
|
|
389
179
|
};
|
|
390
180
|
var useCreateTheme = function useCreateTheme() {
|
|
391
181
|
return reactUtils.useMutationWithInvalidation(themesApi.create, {
|
|
392
|
-
keysToInvalidate: [QUERY_KEYS.THEMES_LIST]
|
|
182
|
+
keysToInvalidate: [useThemeUtils.QUERY_KEYS.THEMES_LIST]
|
|
393
183
|
});
|
|
394
184
|
};
|
|
395
185
|
var useUpdateTheme = function useUpdateTheme(themeId) {
|
|
@@ -399,23 +189,23 @@ var useUpdateTheme = function useUpdateTheme(themeId) {
|
|
|
399
189
|
payload: payload
|
|
400
190
|
});
|
|
401
191
|
}, {
|
|
402
|
-
keysToInvalidate: [[QUERY_KEYS.THEMES_LIST], [QUERY_KEYS.THEME_ENTITY_DETAILS], [QUERY_KEYS.THEME_DETAILS, themeId]]
|
|
192
|
+
keysToInvalidate: [[useThemeUtils.QUERY_KEYS.THEMES_LIST], [useThemeUtils.QUERY_KEYS.THEME_ENTITY_DETAILS], [useThemeUtils.QUERY_KEYS.THEME_DETAILS, themeId]]
|
|
403
193
|
});
|
|
404
194
|
};
|
|
405
195
|
var useDeleteTheme = function useDeleteTheme() {
|
|
406
196
|
return reactUtils.useMutationWithInvalidation(themesApi.destroy, {
|
|
407
|
-
keysToInvalidate: [[QUERY_KEYS.THEMES_LIST], [QUERY_KEYS.THEME_ENTITY_DETAILS]]
|
|
197
|
+
keysToInvalidate: [[useThemeUtils.QUERY_KEYS.THEMES_LIST], [useThemeUtils.QUERY_KEYS.THEME_ENTITY_DETAILS]]
|
|
408
198
|
});
|
|
409
199
|
};
|
|
410
200
|
var useCloneTheme = function useCloneTheme() {
|
|
411
201
|
return reactUtils.useMutationWithInvalidation(themesApi.clone, {
|
|
412
|
-
keysToInvalidate: [QUERY_KEYS.THEMES_LIST]
|
|
202
|
+
keysToInvalidate: [useThemeUtils.QUERY_KEYS.THEMES_LIST]
|
|
413
203
|
});
|
|
414
204
|
};
|
|
415
205
|
var useApplyTheme = function useApplyTheme(_ref) {
|
|
416
206
|
var onSuccess = _ref.onSuccess;
|
|
417
207
|
return reactUtils.useMutationWithInvalidation(themesApi.apply, {
|
|
418
|
-
keysToInvalidate: [[QUERY_KEYS.THEMES_LIST], [QUERY_KEYS.THEME_ENTITY_DETAILS]],
|
|
208
|
+
keysToInvalidate: [[useThemeUtils.QUERY_KEYS.THEMES_LIST], [useThemeUtils.QUERY_KEYS.THEME_ENTITY_DETAILS]],
|
|
419
209
|
onSuccess: onSuccess
|
|
420
210
|
});
|
|
421
211
|
};
|
|
@@ -496,6 +286,119 @@ var OVERLAY_OPACITY_SLIDER_MARKS = {
|
|
|
496
286
|
};
|
|
497
287
|
var HUNDRED = 100;
|
|
498
288
|
|
|
289
|
+
var DESIGN_SCREENS = {
|
|
290
|
+
THEMES: "Themes",
|
|
291
|
+
Customize: "Customize",
|
|
292
|
+
CustomCSS: "CustomCSS"
|
|
293
|
+
};
|
|
294
|
+
var ONE_MEGABYTE = 1;
|
|
295
|
+
|
|
296
|
+
var Card$2 = function Card(_ref) {
|
|
297
|
+
var _ref$title = _ref.title,
|
|
298
|
+
title = _ref$title === void 0 ? "" : _ref$title,
|
|
299
|
+
children = _ref.children;
|
|
300
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
301
|
+
className: "neeto-themes-nano-section neeto-ui-border-gray-200 mb-4 space-y-3 border-b pb-4",
|
|
302
|
+
"data-cy": "theme-".concat(neetoCist.hyphenate(title), "-properties"),
|
|
303
|
+
children: [title && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
304
|
+
className: "neeto-themes-nano-section__title flex items-center justify-between",
|
|
305
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
306
|
+
className: "min-w-0 flex-grow",
|
|
307
|
+
"data-cy": "theme-properties",
|
|
308
|
+
lineHeight: "normal",
|
|
309
|
+
style: "h4",
|
|
310
|
+
weight: "semibold",
|
|
311
|
+
children: title
|
|
312
|
+
})
|
|
313
|
+
}), children && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
314
|
+
className: "neeto-themes-nano-section__content w-full",
|
|
315
|
+
children: children
|
|
316
|
+
})]
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
var isScreenCustomCSS = function isScreenCustomCSS(screen) {
|
|
321
|
+
return screen === DESIGN_SCREENS.CustomCSS;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
var CustomCSS = function CustomCSS(_ref) {
|
|
325
|
+
var onEditCSSClick = _ref.onEditCSSClick,
|
|
326
|
+
currentScreen = _ref.currentScreen;
|
|
327
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
328
|
+
t = _useTranslation.t;
|
|
329
|
+
var _useFormikContext = formik.useFormikContext(),
|
|
330
|
+
values = _useFormikContext.values,
|
|
331
|
+
setFieldValue = _useFormikContext.setFieldValue;
|
|
332
|
+
var _useConfigStore = useThemeUtils.useConfigStore(function (store) {
|
|
333
|
+
return {
|
|
334
|
+
themePropertiesSchema: store["themePropertiesSchema"]
|
|
335
|
+
};
|
|
336
|
+
}, shallow.shallow),
|
|
337
|
+
themePropertiesSchema = _useConfigStore.themePropertiesSchema;
|
|
338
|
+
var customCSS = neetoCist.findBy({
|
|
339
|
+
kind: "custom_css"
|
|
340
|
+
}, values.properties);
|
|
341
|
+
if (!customCSS) return null;
|
|
342
|
+
var parentElementClass = neetoCist.findBy({
|
|
343
|
+
kind: "custom_css"
|
|
344
|
+
}, themePropertiesSchema).parentClass;
|
|
345
|
+
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
346
|
+
var handleEditorToggle = function handleEditorToggle() {
|
|
347
|
+
if (!isCustomCssScreen) return onEditCSSClick(DESIGN_SCREENS.CustomCSS);
|
|
348
|
+
onEditCSSClick(DESIGN_SCREENS.Customize);
|
|
349
|
+
return setTimeout(function () {
|
|
350
|
+
utils.scrollElementIntoView("css-editor");
|
|
351
|
+
}, 400);
|
|
352
|
+
};
|
|
353
|
+
var handleChange = function handleChange(value) {
|
|
354
|
+
var index = neetoCist.findIndexBy({
|
|
355
|
+
key: customCSS.key
|
|
356
|
+
}, values.properties);
|
|
357
|
+
if (index !== -1 && values.properties[index].value !== value) {
|
|
358
|
+
setFieldValue("properties[".concat(index, "].value"), value);
|
|
359
|
+
utils.setCustomCSS({
|
|
360
|
+
css: value,
|
|
361
|
+
elementId: customCSS.key,
|
|
362
|
+
parentElementClass: parentElementClass
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
367
|
+
className: "neeto-themes-sidebar__custom-css-wrapper",
|
|
368
|
+
id: "css-editor",
|
|
369
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(Card$2, {
|
|
370
|
+
title: isCustomCssScreen ? "" : t("neetoThemes.build.leftSideBar.themes.customCSS"),
|
|
371
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
372
|
+
className: "neeto-themes-sidebar__custom-css-editor-header flex w-full justify-end gap-1 rounded-b-none p-2",
|
|
373
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
374
|
+
size: "small",
|
|
375
|
+
style: "secondary",
|
|
376
|
+
label: isCustomCssScreen ? t("neetoThemes.buttons.minimizeEditor") : t("neetoThemes.buttons.expandEditor"),
|
|
377
|
+
onClick: handleEditorToggle
|
|
378
|
+
})
|
|
379
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Editor__default["default"], {
|
|
380
|
+
language: "css",
|
|
381
|
+
options: {
|
|
382
|
+
scrollBeyondLastLine: false,
|
|
383
|
+
minimap: {
|
|
384
|
+
enabled: false
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
theme: "vs-dark",
|
|
388
|
+
value: customCSS.value,
|
|
389
|
+
className: classNames__default["default"]({
|
|
390
|
+
rounded: true,
|
|
391
|
+
"css-editor-height__expanded": isCustomCssScreen,
|
|
392
|
+
"css-editor-height__regular": !isCustomCssScreen
|
|
393
|
+
}),
|
|
394
|
+
onChange: handleChange
|
|
395
|
+
})]
|
|
396
|
+
})
|
|
397
|
+
});
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
function ownKeys$4(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; }
|
|
401
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
499
402
|
var buildInitialValues = function buildInitialValues(theme, themePropertiesSchema) {
|
|
500
403
|
if (neetoCist.isPresent(theme)) return theme;
|
|
501
404
|
return {
|
|
@@ -503,56 +406,82 @@ var buildInitialValues = function buildInitialValues(theme, themePropertiesSchem
|
|
|
503
406
|
properties: themePropertiesSchema.map(function (_ref) {
|
|
504
407
|
var key = _ref.key,
|
|
505
408
|
kind = _ref.kind,
|
|
506
|
-
defaultValue = _ref.defaultValue
|
|
409
|
+
defaultValue = _ref.defaultValue,
|
|
410
|
+
_ref$order = _ref.order,
|
|
411
|
+
order = _ref$order === void 0 ? null : _ref$order;
|
|
507
412
|
switch (kind) {
|
|
508
413
|
case "color":
|
|
509
|
-
return {
|
|
414
|
+
return _objectSpread$4({
|
|
510
415
|
value: defaultValue,
|
|
511
416
|
kind: "color",
|
|
512
417
|
key: key
|
|
513
|
-
}
|
|
418
|
+
}, order !== null && {
|
|
419
|
+
order: order
|
|
420
|
+
});
|
|
514
421
|
case "font_family":
|
|
515
|
-
return {
|
|
422
|
+
return _objectSpread$4({
|
|
516
423
|
value: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
|
|
517
424
|
kind: "font_family",
|
|
518
425
|
key: key
|
|
519
|
-
}
|
|
426
|
+
}, order !== null && {
|
|
427
|
+
order: order
|
|
428
|
+
});
|
|
520
429
|
case "overlay_opacity":
|
|
521
|
-
return {
|
|
430
|
+
return _objectSpread$4({
|
|
522
431
|
value: 0,
|
|
523
432
|
kind: "overlay_opacity",
|
|
524
433
|
key: key
|
|
525
|
-
}
|
|
434
|
+
}, order !== null && {
|
|
435
|
+
order: order
|
|
436
|
+
});
|
|
526
437
|
case "slider":
|
|
527
|
-
return {
|
|
438
|
+
return _objectSpread$4({
|
|
528
439
|
value: 0,
|
|
529
440
|
kind: "slider",
|
|
530
441
|
key: key
|
|
531
|
-
}
|
|
442
|
+
}, order !== null && {
|
|
443
|
+
order: order
|
|
444
|
+
});
|
|
532
445
|
case "radius":
|
|
533
|
-
return {
|
|
446
|
+
return _objectSpread$4({
|
|
534
447
|
value: defaultValue,
|
|
535
448
|
kind: "radius",
|
|
536
449
|
key: key
|
|
537
|
-
}
|
|
450
|
+
}, order !== null && {
|
|
451
|
+
order: order
|
|
452
|
+
});
|
|
538
453
|
case "boolean":
|
|
539
|
-
return {
|
|
454
|
+
return _objectSpread$4({
|
|
540
455
|
value: String(defaultValue),
|
|
541
456
|
kind: "boolean",
|
|
542
457
|
key: key
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
|
|
458
|
+
}, order !== null && {
|
|
459
|
+
order: order
|
|
460
|
+
});
|
|
461
|
+
case "order_selector":
|
|
462
|
+
return _objectSpread$4({
|
|
546
463
|
value: defaultValue,
|
|
547
|
-
kind: "
|
|
464
|
+
kind: "order_selector",
|
|
548
465
|
key: key
|
|
549
|
-
}
|
|
466
|
+
}, order !== null && {
|
|
467
|
+
order: order
|
|
468
|
+
});
|
|
550
469
|
case "alignment_block":
|
|
551
|
-
return {
|
|
470
|
+
return _objectSpread$4({
|
|
552
471
|
value: defaultValue,
|
|
553
472
|
kind: "alignment_block",
|
|
554
473
|
key: key
|
|
555
|
-
}
|
|
474
|
+
}, order !== null && {
|
|
475
|
+
order: order
|
|
476
|
+
});
|
|
477
|
+
case "custom_css":
|
|
478
|
+
return _objectSpread$4({
|
|
479
|
+
value: defaultValue,
|
|
480
|
+
kind: "custom_css",
|
|
481
|
+
key: key
|
|
482
|
+
}, order !== null && {
|
|
483
|
+
order: order
|
|
484
|
+
});
|
|
556
485
|
default:
|
|
557
486
|
return null;
|
|
558
487
|
}
|
|
@@ -595,29 +524,6 @@ var buildLabel = function buildLabel(key, kind) {
|
|
|
595
524
|
return i18next.t("neetoThemes.properties.".concat(neetoCist.snakeToCamelCase(kind), ".").concat(neetoCist.snakeToCamelCase(key)));
|
|
596
525
|
};
|
|
597
526
|
|
|
598
|
-
var Card$2 = function Card(_ref) {
|
|
599
|
-
var _ref$title = _ref.title,
|
|
600
|
-
title = _ref$title === void 0 ? "" : _ref$title,
|
|
601
|
-
children = _ref.children;
|
|
602
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
603
|
-
className: "neeto-ui-border-gray-300 neeto-ui-rounded-lg neeto-ui-bg-white space-y-3 border p-4",
|
|
604
|
-
"data-cy": "theme-".concat(neetoCist.hyphenate(title), "-properties"),
|
|
605
|
-
children: [title && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
606
|
-
className: "flex items-center justify-between",
|
|
607
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
608
|
-
"data-cy": "theme-properties",
|
|
609
|
-
lineHeight: "normal",
|
|
610
|
-
style: "h4",
|
|
611
|
-
weight: "semibold",
|
|
612
|
-
children: title
|
|
613
|
-
})
|
|
614
|
-
}), children && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
615
|
-
className: "space-y-4",
|
|
616
|
-
children: children
|
|
617
|
-
})]
|
|
618
|
-
});
|
|
619
|
-
};
|
|
620
|
-
|
|
621
527
|
var SelectBlock = function SelectBlock(_ref) {
|
|
622
528
|
var label = _ref.label,
|
|
623
529
|
_ref$placeholder = _ref.placeholder,
|
|
@@ -626,8 +532,8 @@ var SelectBlock = function SelectBlock(_ref) {
|
|
|
626
532
|
options = _ref.options,
|
|
627
533
|
onChange = _ref.onChange;
|
|
628
534
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
629
|
-
className: "flex items-center justify-between py-
|
|
630
|
-
"data-cy": "theme-style-".concat(utils.joinHyphenCase(label)),
|
|
535
|
+
className: "flex items-center justify-between py-2 first:pt-0 last:pb-0",
|
|
536
|
+
"data-cy": "theme-style-".concat(utils$1.joinHyphenCase(label)),
|
|
631
537
|
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
632
538
|
"data-cy": "logo-field-labels",
|
|
633
539
|
style: "body2",
|
|
@@ -644,12 +550,6 @@ var SelectBlock = function SelectBlock(_ref) {
|
|
|
644
550
|
});
|
|
645
551
|
};
|
|
646
552
|
|
|
647
|
-
var DESIGN_SCREENS = {
|
|
648
|
-
THEMES: "Themes",
|
|
649
|
-
Customize: "Customize"
|
|
650
|
-
};
|
|
651
|
-
var ONE_MEGABYTE = 1;
|
|
652
|
-
|
|
653
553
|
var ImageBlock = function ImageBlock(_ref) {
|
|
654
554
|
var _findBy;
|
|
655
555
|
var label = _ref.label,
|
|
@@ -666,7 +566,7 @@ var ImageBlock = function ImageBlock(_ref) {
|
|
|
666
566
|
var _useFormikContext = formik.useFormikContext(),
|
|
667
567
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
668
568
|
values = _useFormikContext.values;
|
|
669
|
-
var _useConfigStore = useConfigStore(function (store) {
|
|
569
|
+
var _useConfigStore = useThemeUtils.useConfigStore(function (store) {
|
|
670
570
|
return {
|
|
671
571
|
themePropertiesSchema: store["themePropertiesSchema"]
|
|
672
572
|
};
|
|
@@ -702,7 +602,7 @@ var ImageBlock = function ImageBlock(_ref) {
|
|
|
702
602
|
return _context.abrupt("return");
|
|
703
603
|
case 4:
|
|
704
604
|
_context.next = 6;
|
|
705
|
-
return getDominantColorFromUrl(image.url);
|
|
605
|
+
return utils.getDominantColorFromUrl(image.url);
|
|
706
606
|
case 6:
|
|
707
607
|
dominantColor = _context.sent;
|
|
708
608
|
setFieldValue(name, {
|
|
@@ -728,7 +628,7 @@ var ImageBlock = function ImageBlock(_ref) {
|
|
|
728
628
|
}();
|
|
729
629
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
730
630
|
className: "space-y-3 py-3 first:pt-0 last:pb-0",
|
|
731
|
-
"data-cy": "theme-style-".concat(utils.joinHyphenCase(label)),
|
|
631
|
+
"data-cy": "theme-style-".concat(utils$1.joinHyphenCase(label)),
|
|
732
632
|
children: [label && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
733
633
|
className: "flex items-center justify-between",
|
|
734
634
|
children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
@@ -737,7 +637,7 @@ var ImageBlock = function ImageBlock(_ref) {
|
|
|
737
637
|
children: label
|
|
738
638
|
})
|
|
739
639
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
740
|
-
className: "space-y-3
|
|
640
|
+
className: "space-y-3",
|
|
741
641
|
children: [/*#__PURE__*/react.createElement(neetoImageUploaderFrontend.ImageUploader, {
|
|
742
642
|
uploadConfig: uploadConfig,
|
|
743
643
|
className: "h-40 w-full",
|
|
@@ -768,13 +668,10 @@ var Images = function Images(_ref) {
|
|
|
768
668
|
var imageData = values[key];
|
|
769
669
|
return /*#__PURE__*/jsxRuntime.jsx(Card$2, {
|
|
770
670
|
title: title,
|
|
771
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
imageData: imageData,
|
|
776
|
-
name: key
|
|
777
|
-
})
|
|
671
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ImageBlock, {
|
|
672
|
+
attribute: attribute,
|
|
673
|
+
imageData: imageData,
|
|
674
|
+
name: key
|
|
778
675
|
})
|
|
779
676
|
});
|
|
780
677
|
};
|
|
@@ -784,7 +681,7 @@ var AlignmentBlock = function AlignmentBlock(_ref) {
|
|
|
784
681
|
name = _ref.name;
|
|
785
682
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
786
683
|
className: "flex items-center justify-between gap-2 py-3 first:pt-0 last:pb-0",
|
|
787
|
-
"data-cy": utils.joinHyphenCase(label),
|
|
684
|
+
"data-cy": utils$1.joinHyphenCase(label),
|
|
788
685
|
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
789
686
|
"data-cy": "style-fields-labels",
|
|
790
687
|
style: "body2",
|
|
@@ -834,8 +731,8 @@ var ColorBlock = function ColorBlock(_ref) {
|
|
|
834
731
|
onChange = _ref.onChange,
|
|
835
732
|
showTransparencyControl = _ref.showTransparencyControl;
|
|
836
733
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
837
|
-
className: "flex items-center justify-between py-
|
|
838
|
-
"data-cy": "theme-style-".concat(utils.joinHyphenCase(label)),
|
|
734
|
+
className: "flex items-center justify-between py-2 first:pt-0 last:pb-0",
|
|
735
|
+
"data-cy": "theme-style-".concat(utils$1.joinHyphenCase(label)),
|
|
839
736
|
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
840
737
|
"data-cy": "style-fields-labels",
|
|
841
738
|
style: "body2",
|
|
@@ -844,7 +741,8 @@ var ColorBlock = function ColorBlock(_ref) {
|
|
|
844
741
|
color: color,
|
|
845
742
|
onChange: onChange,
|
|
846
743
|
showTransparencyControl: showTransparencyControl,
|
|
847
|
-
showEyeDropper: true
|
|
744
|
+
showEyeDropper: true,
|
|
745
|
+
size: "large"
|
|
848
746
|
})]
|
|
849
747
|
});
|
|
850
748
|
};
|
|
@@ -859,8 +757,8 @@ var FontPickerBlock = function FontPickerBlock(_ref) {
|
|
|
859
757
|
options = _ref.options,
|
|
860
758
|
onChange = _ref.onChange;
|
|
861
759
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
862
|
-
className: "flex items-center justify-between py-
|
|
863
|
-
"data-cy": "theme-style-".concat(utils.joinHyphenCase(label)),
|
|
760
|
+
className: "flex items-center justify-between py-2 first:pt-0 last:pb-0",
|
|
761
|
+
"data-cy": "theme-style-".concat(utils$1.joinHyphenCase(label)),
|
|
864
762
|
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
865
763
|
"data-cy": "style-fields-labels",
|
|
866
764
|
style: "body2",
|
|
@@ -895,7 +793,7 @@ var SliderBlock = function SliderBlock(_ref) {
|
|
|
895
793
|
marks = _ref.marks;
|
|
896
794
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
897
795
|
className: "flex items-center justify-between gap-3 py-3 first:pt-0 last:pb-0",
|
|
898
|
-
"data-cy": "theme-style-".concat(utils.joinHyphenCase(label)),
|
|
796
|
+
"data-cy": "theme-style-".concat(utils$1.joinHyphenCase(label)),
|
|
899
797
|
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
900
798
|
"data-cy": "style-fields-labels",
|
|
901
799
|
style: "body2",
|
|
@@ -927,13 +825,13 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
927
825
|
var translationKey = "neetoThemes.properties.boolean.".concat(name, "HelpText");
|
|
928
826
|
var doesHelpTextExist = i18n.exists(translationKey);
|
|
929
827
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
930
|
-
className: "flex items-center justify-between py-
|
|
828
|
+
className: "flex items-center justify-between py-2 first:pt-0 last:pb-0",
|
|
931
829
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
932
830
|
className: "inline-flex items-center gap-4",
|
|
933
831
|
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
934
832
|
"data-cy": "style-fields-labels",
|
|
935
833
|
style: "body2",
|
|
936
|
-
className:
|
|
834
|
+
className: classNames__default["default"]({
|
|
937
835
|
"w-32": doesHelpTextExist,
|
|
938
836
|
"w-auto": !doesHelpTextExist
|
|
939
837
|
}),
|
|
@@ -954,13 +852,13 @@ var Properties = function Properties(_ref) {
|
|
|
954
852
|
var onPropertiesChange = _ref.onPropertiesChange;
|
|
955
853
|
var _useTranslation = reactI18next.useTranslation(),
|
|
956
854
|
t = _useTranslation.t;
|
|
957
|
-
var _useConfigStore = useConfigStore(function (store) {
|
|
855
|
+
var _useConfigStore = useThemeUtils.useConfigStore(function (store) {
|
|
958
856
|
return {
|
|
959
857
|
themePropertiesSchema: store["themePropertiesSchema"]
|
|
960
858
|
};
|
|
961
859
|
}, shallow.shallow),
|
|
962
860
|
themePropertiesSchema = _useConfigStore.themePropertiesSchema;
|
|
963
|
-
var _useThemeStore = useThemeStore(function (store) {
|
|
861
|
+
var _useThemeStore = useThemeUtils.useThemeStore(function (store) {
|
|
964
862
|
return {
|
|
965
863
|
setThemeState: store["setThemeState"]
|
|
966
864
|
};
|
|
@@ -969,7 +867,7 @@ var Properties = function Properties(_ref) {
|
|
|
969
867
|
var _useFormikContext = formik.useFormikContext(),
|
|
970
868
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
971
869
|
values = _useFormikContext.values;
|
|
972
|
-
var _useThemeUtils = useThemeUtils(),
|
|
870
|
+
var _useThemeUtils = useThemeUtils.useThemeUtils(),
|
|
973
871
|
setVariable = _useThemeUtils.setVariable,
|
|
974
872
|
setTheme = _useThemeUtils.setTheme;
|
|
975
873
|
var handleColorChange = function handleColorChange(name) {
|
|
@@ -1010,123 +908,105 @@ var Properties = function Properties(_ref) {
|
|
|
1010
908
|
}, [values]);
|
|
1011
909
|
return /*#__PURE__*/jsxRuntime.jsx(Card$2, {
|
|
1012
910
|
title: t("neetoThemes.common.style"),
|
|
1013
|
-
children:
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
},
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
return
|
|
911
|
+
children: values.properties.sort(function (a, b) {
|
|
912
|
+
var _a$order, _b$order;
|
|
913
|
+
return ((_a$order = a.order) !== null && _a$order !== void 0 ? _a$order : Infinity) - ((_b$order = b.order) !== null && _b$order !== void 0 ? _b$order : Infinity);
|
|
914
|
+
}).map(function (_ref3) {
|
|
915
|
+
var _findBy;
|
|
916
|
+
var key = _ref3.key,
|
|
917
|
+
value = _ref3.value,
|
|
918
|
+
kind = _ref3.kind;
|
|
919
|
+
var isCurrentPropertyVisible = isPropertyVisible(key, values, themePropertiesSchema);
|
|
920
|
+
if (!isCurrentPropertyVisible) return null;
|
|
921
|
+
switch (kind) {
|
|
922
|
+
case "font_family":
|
|
923
|
+
return /*#__PURE__*/jsxRuntime.jsx(FontPickerBlock, {
|
|
924
|
+
label: buildLabel(key, kind),
|
|
925
|
+
options: FONT_OPTIONS,
|
|
926
|
+
value: neetoCist.findBy({
|
|
927
|
+
value: value || null
|
|
928
|
+
}, FONT_OPTIONS),
|
|
929
|
+
onChange: function onChange(_ref4) {
|
|
930
|
+
var value = _ref4.value;
|
|
931
|
+
return handleChange(key, value);
|
|
932
|
+
}
|
|
933
|
+
}, key);
|
|
934
|
+
case "color":
|
|
935
|
+
return /*#__PURE__*/jsxRuntime.jsx(ColorBlock, {
|
|
936
|
+
color: value,
|
|
937
|
+
label: buildLabel(key, kind),
|
|
938
|
+
showTransparencyControl: ((_findBy = neetoCist.findBy({
|
|
939
|
+
key: key
|
|
940
|
+
}, themePropertiesSchema)) === null || _findBy === void 0 ? void 0 : _findBy.showTransparencyControl) || false,
|
|
941
|
+
onChange: handleColorChange(key)
|
|
942
|
+
}, key);
|
|
943
|
+
case "radius":
|
|
944
|
+
return /*#__PURE__*/jsxRuntime.jsx(SliderBlock, {
|
|
945
|
+
label: buildLabel(key, kind),
|
|
946
|
+
max: 50,
|
|
947
|
+
min: 0,
|
|
948
|
+
value: Number(value) || 0,
|
|
949
|
+
onChange: function onChange(radius) {
|
|
950
|
+
return handleChange(key, radius, "".concat(radius, "px"));
|
|
951
|
+
}
|
|
952
|
+
}, key);
|
|
953
|
+
case "overlay_opacity":
|
|
954
|
+
return /*#__PURE__*/jsxRuntime.jsx(SliderBlock, {
|
|
955
|
+
label: buildLabel(key, kind),
|
|
956
|
+
marks: OVERLAY_OPACITY_SLIDER_MARKS,
|
|
957
|
+
max: HUNDRED,
|
|
958
|
+
min: ramda.negate(HUNDRED),
|
|
959
|
+
value: Number(value) || 0,
|
|
960
|
+
onChange: function onChange(opacity) {
|
|
961
|
+
return handleOverlayChange(key, opacity);
|
|
962
|
+
}
|
|
963
|
+
}, key);
|
|
964
|
+
case "position_selector":
|
|
965
|
+
{
|
|
966
|
+
var _findBy2;
|
|
967
|
+
var index = neetoCist.findIndexBy({
|
|
968
|
+
key: key
|
|
969
|
+
}, values.properties);
|
|
970
|
+
var options = (_findBy2 = neetoCist.findBy({
|
|
971
|
+
key: key
|
|
972
|
+
}, themePropertiesSchema)) === null || _findBy2 === void 0 || (_findBy2 = _findBy2.options) === null || _findBy2 === void 0 ? void 0 : _findBy2.map(neetoCist.toLabelAndValue);
|
|
973
|
+
return /*#__PURE__*/jsxRuntime.jsx(SelectBlock, {
|
|
974
|
+
label: buildLabel(key, kind),
|
|
975
|
+
options: options || POSITION_OPTIONS,
|
|
976
|
+
placeholder: "left",
|
|
977
|
+
value: neetoCist.toLabelAndValue(value),
|
|
978
|
+
onChange: function onChange(option) {
|
|
979
|
+
return setFieldValue("properties[".concat(index, "].value"), option.value);
|
|
980
|
+
}
|
|
981
|
+
}, key);
|
|
1076
982
|
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
}, themePropertiesSchema)) === null || _findBy2 === void 0 || (_findBy2 = _findBy2.options) === null || _findBy2 === void 0 ? void 0 : _findBy2.map(neetoCist.toLabelAndValue);
|
|
1091
|
-
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsxRuntime.jsx(SelectBlock, {
|
|
1092
|
-
label: buildLabel(key, kind),
|
|
1093
|
-
options: options || POSITION_OPTIONS,
|
|
1094
|
-
placeholder: "left",
|
|
1095
|
-
value: neetoCist.toLabelAndValue(value),
|
|
1096
|
-
onChange: function onChange(option) {
|
|
1097
|
-
return setFieldValue("properties[".concat(index, "].value"), option.value);
|
|
983
|
+
case "boolean":
|
|
984
|
+
{
|
|
985
|
+
var _index = neetoCist.findIndexBy({
|
|
986
|
+
key: key
|
|
987
|
+
}, values.properties);
|
|
988
|
+
return /*#__PURE__*/jsxRuntime.jsx(SwitchBlock, {
|
|
989
|
+
checked: value !== "false",
|
|
990
|
+
label: buildLabel(key, kind),
|
|
991
|
+
name: neetoCist.snakeToCamelCase(key),
|
|
992
|
+
onChange: function onChange(e) {
|
|
993
|
+
return setFieldValue("properties[".concat(_index, "].value"), String(e.target.checked));
|
|
994
|
+
}
|
|
995
|
+
}, key);
|
|
1098
996
|
}
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
}, values.properties);
|
|
1109
|
-
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsxRuntime.jsx(SwitchBlock, {
|
|
1110
|
-
checked: value !== "false",
|
|
1111
|
-
label: buildLabel(key, kind),
|
|
1112
|
-
name: neetoCist.snakeToCamelCase(key),
|
|
1113
|
-
onChange: function onChange(e) {
|
|
1114
|
-
return setFieldValue("properties[".concat(index, "].value"), String(e.target.checked));
|
|
997
|
+
case "alignment_block":
|
|
998
|
+
{
|
|
999
|
+
var _index2 = neetoCist.findIndexBy({
|
|
1000
|
+
key: key
|
|
1001
|
+
}, values.properties);
|
|
1002
|
+
return /*#__PURE__*/jsxRuntime.jsx(AlignmentBlock, {
|
|
1003
|
+
label: buildLabel(key, kind),
|
|
1004
|
+
name: "properties[".concat(_index2, "].value")
|
|
1005
|
+
});
|
|
1115
1006
|
}
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
}, values.properties).map(function (_ref10) {
|
|
1120
|
-
var key = _ref10.key,
|
|
1121
|
-
kind = _ref10.kind;
|
|
1122
|
-
var index = neetoCist.findIndexBy({
|
|
1123
|
-
key: key
|
|
1124
|
-
}, values.properties);
|
|
1125
|
-
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsxRuntime.jsx(AlignmentBlock, {
|
|
1126
|
-
label: buildLabel(key, kind),
|
|
1127
|
-
name: "properties[".concat(index, "].value")
|
|
1128
|
-
});
|
|
1129
|
-
})]
|
|
1007
|
+
default:
|
|
1008
|
+
return null;
|
|
1009
|
+
}
|
|
1130
1010
|
})
|
|
1131
1011
|
});
|
|
1132
1012
|
};
|
|
@@ -1152,14 +1032,16 @@ var Customize = function Customize(_ref) {
|
|
|
1152
1032
|
onApplyTheme = _ref.onApplyTheme,
|
|
1153
1033
|
isApplyingTheme = _ref.isApplyingTheme,
|
|
1154
1034
|
onPropertiesChange = _ref.onPropertiesChange,
|
|
1155
|
-
onUpdateThemeSuccess = _ref.onUpdateThemeSuccess
|
|
1035
|
+
onUpdateThemeSuccess = _ref.onUpdateThemeSuccess,
|
|
1036
|
+
onEditCSSClick = _ref.onEditCSSClick,
|
|
1037
|
+
currentScreen = _ref.currentScreen;
|
|
1156
1038
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1157
1039
|
t = _useTranslation.t;
|
|
1158
1040
|
var _useState = react.useState({}),
|
|
1159
1041
|
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
1160
1042
|
popoverInstance = _useState2[0],
|
|
1161
1043
|
setPopoverInstance = _useState2[1];
|
|
1162
|
-
var _useConfigStore = useConfigStore(function (store) {
|
|
1044
|
+
var _useConfigStore = useThemeUtils.useConfigStore(function (store) {
|
|
1163
1045
|
return {
|
|
1164
1046
|
themePropertiesSchema: store["themePropertiesSchema"],
|
|
1165
1047
|
entityType: store["entityType"]
|
|
@@ -1167,7 +1049,7 @@ var Customize = function Customize(_ref) {
|
|
|
1167
1049
|
}, shallow.shallow),
|
|
1168
1050
|
themePropertiesSchema = _useConfigStore.themePropertiesSchema,
|
|
1169
1051
|
entityType = _useConfigStore.entityType;
|
|
1170
|
-
var _useThemeUtils = useThemeUtils(),
|
|
1052
|
+
var _useThemeUtils = useThemeUtils.useThemeUtils(),
|
|
1171
1053
|
currentTheme = _useThemeUtils.currentTheme;
|
|
1172
1054
|
var isEditingCurrentlyAppliedTheme = themeId === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
|
|
1173
1055
|
var submitBtnRef = react.useRef(null);
|
|
@@ -1178,6 +1060,7 @@ var Customize = function Customize(_ref) {
|
|
|
1178
1060
|
updateTheme = _useUpdateTheme.mutate,
|
|
1179
1061
|
isUpdating = _useUpdateTheme.isPending;
|
|
1180
1062
|
var isSubmitting = isCreating || isUpdating;
|
|
1063
|
+
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
1181
1064
|
var onSubmit = function onSubmit(values, _ref2) {
|
|
1182
1065
|
var resetForm = _ref2.resetForm;
|
|
1183
1066
|
var imageData = buildImageData(values, themePropertiesSchema);
|
|
@@ -1216,16 +1099,34 @@ var Customize = function Customize(_ref) {
|
|
|
1216
1099
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1217
1100
|
className: "neeto-themes-sidebar__scroll",
|
|
1218
1101
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1219
|
-
className: "flex flex-col
|
|
1220
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
},
|
|
1102
|
+
className: "neeto-themes-sidebar__scroll-content flex flex-grow flex-col px-4 py-2 lg:px-5 xl:px-6",
|
|
1103
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1104
|
+
className: classNames__default["default"]({
|
|
1105
|
+
hidden: isCustomCssScreen
|
|
1106
|
+
}),
|
|
1107
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ThemeMeta, {})
|
|
1108
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1109
|
+
className: classNames__default["default"]({
|
|
1110
|
+
hidden: isCustomCssScreen
|
|
1111
|
+
}),
|
|
1112
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Properties, {
|
|
1113
|
+
onPropertiesChange: onPropertiesChange
|
|
1114
|
+
})
|
|
1115
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1116
|
+
className: classNames__default["default"]("flex flex-col gap-6", {
|
|
1117
|
+
hidden: isCustomCssScreen
|
|
1118
|
+
}),
|
|
1119
|
+
children: neetoCist.filterBy({
|
|
1120
|
+
kind: "image"
|
|
1121
|
+
}, themePropertiesSchema).map(function (_ref5) {
|
|
1122
|
+
var key = _ref5.key;
|
|
1123
|
+
return /*#__PURE__*/jsxRuntime.jsx(Images, {
|
|
1124
|
+
attribute: key
|
|
1125
|
+
}, key);
|
|
1126
|
+
})
|
|
1127
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CustomCSS, {
|
|
1128
|
+
currentScreen: currentScreen,
|
|
1129
|
+
onEditCSSClick: onEditCSSClick
|
|
1229
1130
|
})]
|
|
1230
1131
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1231
1132
|
className: "neeto-ui-bg-white neeto-ui-shadow-s sticky bottom-0 left-0 right-0 flex justify-end gap-x-2 px-4 py-6",
|
|
@@ -1367,7 +1268,7 @@ var Thumbnail = function Thumbnail(_ref) {
|
|
|
1367
1268
|
isPreviewing = _ref.isPreviewing,
|
|
1368
1269
|
isHighLightedTheme = _ref.isHighLightedTheme,
|
|
1369
1270
|
theme = _ref.theme;
|
|
1370
|
-
var _useConfigStore = useConfigStore(function (store) {
|
|
1271
|
+
var _useConfigStore = useThemeUtils.useConfigStore(function (store) {
|
|
1371
1272
|
return {
|
|
1372
1273
|
themePropertiesSchema: store["themePropertiesSchema"]
|
|
1373
1274
|
};
|
|
@@ -1394,7 +1295,7 @@ var Thumbnail = function Thumbnail(_ref) {
|
|
|
1394
1295
|
}, themePropertiesSchema)) === null || _findBy2 === void 0 ? void 0 : _findBy2.key
|
|
1395
1296
|
}, theme.properties)) === null || _findBy === void 0 ? void 0 : _findBy.value;
|
|
1396
1297
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1397
|
-
className:
|
|
1298
|
+
className: classNames__default["default"]("neeto-themes-theme-thumbnail neeto-ui-rounded-lg border transition-all duration-300 ease-in-out", {
|
|
1398
1299
|
"neeto-ui-border-gray-400": !active,
|
|
1399
1300
|
"neeto-ui-border-gray-800 neeto-themes-theme-thumbnail--active": active,
|
|
1400
1301
|
"neeto-themes-theme-thumbnail--preview-active": isPreviewing,
|
|
@@ -1472,7 +1373,7 @@ var Card = function Card(_ref) {
|
|
|
1472
1373
|
"data-cy": active ? "active-theme-card" : "theme-card",
|
|
1473
1374
|
id: theme.id,
|
|
1474
1375
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1475
|
-
className:
|
|
1376
|
+
className: classNames__default["default"]("neeto-themes-theme-thumbnail neeto-ui-rounded-lg cursor-pointer border transition-all duration-300 ease-in-out", {
|
|
1476
1377
|
"neeto-ui-border-gray-200": !active,
|
|
1477
1378
|
"neeto-themes-theme-thumbnail--active": active,
|
|
1478
1379
|
"neeto-themes-theme-thumbnail--preview-active": isPreviewing,
|
|
@@ -1489,7 +1390,7 @@ var Card = function Card(_ref) {
|
|
|
1489
1390
|
className: "flex-shrink-0",
|
|
1490
1391
|
"data-cy": "active-theme-label"
|
|
1491
1392
|
}) : /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1492
|
-
className:
|
|
1393
|
+
className: classNames__default["default"]({
|
|
1493
1394
|
hidden: !isPreviewing,
|
|
1494
1395
|
"group-hover:block": true
|
|
1495
1396
|
}),
|
|
@@ -1518,7 +1419,7 @@ var Card = function Card(_ref) {
|
|
|
1518
1419
|
theme: theme
|
|
1519
1420
|
})]
|
|
1520
1421
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1521
|
-
className: "flex items-start justify-between gap-1 p-
|
|
1422
|
+
className: "neeto-ui-border-gray-100 flex items-start justify-between gap-1 border-t p-2",
|
|
1522
1423
|
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1523
1424
|
className: "line-clamp-2 min-w-0 flex-grow break-words pt-1",
|
|
1524
1425
|
"data-cy": "theme-name",
|
|
@@ -1549,12 +1450,12 @@ var Card = function Card(_ref) {
|
|
|
1549
1450
|
}, {
|
|
1550
1451
|
key: "divider",
|
|
1551
1452
|
type: "divider",
|
|
1552
|
-
isVisible: isFunction(onDeleteTheme)
|
|
1453
|
+
isVisible: utils.isFunction(onDeleteTheme)
|
|
1553
1454
|
}, {
|
|
1554
1455
|
key: "delete",
|
|
1555
1456
|
"data-cy": "delete-theme-menu-item",
|
|
1556
1457
|
label: t("neetoThemes.build.leftSideBar.themes.themeOptions.delete"),
|
|
1557
|
-
isVisible: isFunction(onDeleteTheme),
|
|
1458
|
+
isVisible: utils.isFunction(onDeleteTheme),
|
|
1558
1459
|
onClick: function onClick(e) {
|
|
1559
1460
|
e.stopPropagation();
|
|
1560
1461
|
handleDeleteTheme();
|
|
@@ -1585,9 +1486,9 @@ var Themes = function Themes(_ref) {
|
|
|
1585
1486
|
isApplyingTheme = _ref.isApplyingTheme;
|
|
1586
1487
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1587
1488
|
t = _useTranslation.t;
|
|
1588
|
-
var _useThemeUtils = useThemeUtils(),
|
|
1489
|
+
var _useThemeUtils = useThemeUtils.useThemeUtils(),
|
|
1589
1490
|
setTheme = _useThemeUtils.setTheme;
|
|
1590
|
-
var _useThemeStore = useThemeStore(function (store) {
|
|
1491
|
+
var _useThemeStore = useThemeUtils.useThemeStore(function (store) {
|
|
1591
1492
|
return {
|
|
1592
1493
|
setThemeState: store["setThemeState"],
|
|
1593
1494
|
previewingTheme: store["previewingTheme"]
|
|
@@ -1605,7 +1506,7 @@ var Themes = function Themes(_ref) {
|
|
|
1605
1506
|
if (didScrollActiveThemeIntoView.current || !(currentTheme !== null && currentTheme !== void 0 && currentTheme.id)) return;
|
|
1606
1507
|
didScrollActiveThemeIntoView.current = true;
|
|
1607
1508
|
setTimeout(function () {
|
|
1608
|
-
scrollElementIntoView(currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
|
|
1509
|
+
utils.scrollElementIntoView(currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
|
|
1609
1510
|
}, 100);
|
|
1610
1511
|
}, [didScrollActiveThemeIntoView, currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id]);
|
|
1611
1512
|
var setPreviewTheme = function setPreviewTheme(theme) {
|
|
@@ -1716,56 +1617,57 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
1716
1617
|
themeToEdit = _ref.themeToEdit;
|
|
1717
1618
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1718
1619
|
t = _useTranslation.t;
|
|
1719
|
-
|
|
1620
|
+
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
1621
|
+
if (currentScreen === DESIGN_SCREENS.THEMES) {
|
|
1720
1622
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1721
|
-
className: "neeto-themes-sidebar__header px-4",
|
|
1623
|
+
className: "neeto-themes-sidebar__header px-4 lg:px-5 xl:px-6",
|
|
1722
1624
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1723
|
-
className: "flex items-center justify-
|
|
1724
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
1725
|
-
"data-cy": "customize-themes-back-button",
|
|
1726
|
-
icon: LeftArrow__default["default"],
|
|
1727
|
-
iconPosition: "left",
|
|
1728
|
-
style: "text",
|
|
1729
|
-
tooltipProps: {
|
|
1730
|
-
content: t("neetoThemes.buttons.backToThemes"),
|
|
1731
|
-
position: "top"
|
|
1732
|
-
},
|
|
1733
|
-
onClick: function onClick() {
|
|
1734
|
-
return handleBackPress(themeToEdit);
|
|
1735
|
-
}
|
|
1736
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1625
|
+
className: "flex items-center justify-between space-x-2",
|
|
1626
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1737
1627
|
"data-cy": "themes-header",
|
|
1738
1628
|
lineHeight: "normal",
|
|
1739
1629
|
style: "h3",
|
|
1740
1630
|
weight: "semibold",
|
|
1741
|
-
children:
|
|
1631
|
+
children: t("neetoThemes.build.leftSideBar.headerTabs.themes")
|
|
1632
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1633
|
+
className: "self-end",
|
|
1634
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
1635
|
+
"data-cy": "customize-themes-add-theme-button",
|
|
1636
|
+
icon: Plus__default["default"],
|
|
1637
|
+
iconPosition: "left",
|
|
1638
|
+
style: "text",
|
|
1639
|
+
tooltipProps: {
|
|
1640
|
+
content: t("neetoThemes.buttons.addNewTheme"),
|
|
1641
|
+
position: "top"
|
|
1642
|
+
},
|
|
1643
|
+
onClick: handleCreateNewTheme
|
|
1644
|
+
})
|
|
1742
1645
|
})]
|
|
1743
1646
|
})
|
|
1744
1647
|
});
|
|
1745
1648
|
}
|
|
1746
1649
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1747
|
-
className: "neeto-themes-sidebar__header px-4
|
|
1650
|
+
className: "neeto-themes-sidebar__header px-4",
|
|
1748
1651
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1749
|
-
className: "flex items-center justify-
|
|
1750
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
1652
|
+
className: "flex items-center justify-start space-x-2",
|
|
1653
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
1654
|
+
"data-cy": "customize-themes-back-button",
|
|
1655
|
+
icon: LeftArrow__default["default"],
|
|
1656
|
+
iconPosition: "left",
|
|
1657
|
+
style: "text",
|
|
1658
|
+
tooltipProps: {
|
|
1659
|
+
content: isCustomCssScreen ? t("neetoThemes.buttons.backToEdit") : t("neetoThemes.buttons.backToThemes"),
|
|
1660
|
+
position: "top"
|
|
1661
|
+
},
|
|
1662
|
+
onClick: function onClick() {
|
|
1663
|
+
return handleBackPress(themeToEdit);
|
|
1664
|
+
}
|
|
1665
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(Typography__default["default"], {
|
|
1751
1666
|
"data-cy": "themes-header",
|
|
1752
1667
|
lineHeight: "normal",
|
|
1753
1668
|
style: "h3",
|
|
1754
1669
|
weight: "semibold",
|
|
1755
|
-
children: t("neetoThemes.build.leftSideBar.
|
|
1756
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1757
|
-
className: "self-end",
|
|
1758
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
1759
|
-
"data-cy": "customize-themes-add-theme-button",
|
|
1760
|
-
icon: Plus__default["default"],
|
|
1761
|
-
iconPosition: "left",
|
|
1762
|
-
style: "text",
|
|
1763
|
-
tooltipProps: {
|
|
1764
|
-
content: t("neetoThemes.buttons.addNewTheme"),
|
|
1765
|
-
position: "top"
|
|
1766
|
-
},
|
|
1767
|
-
onClick: handleCreateNewTheme
|
|
1768
|
-
})
|
|
1670
|
+
children: [currentScreen === DESIGN_SCREENS.Customize && (isNewTheme ? t("neetoThemes.build.leftSideBar.themes.createTheme.title") : t("neetoThemes.build.leftSideBar.themes.editTheme.title")), isCustomCssScreen && t("neetoThemes.build.leftSideBar.themes.customCSS")]
|
|
1769
1671
|
})]
|
|
1770
1672
|
})
|
|
1771
1673
|
});
|
|
@@ -1794,7 +1696,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1794
1696
|
_useState8 = _slicedToArray__default["default"](_useState7, 2),
|
|
1795
1697
|
themeBeingApplied = _useState8[0],
|
|
1796
1698
|
setThemeBeingApplied = _useState8[1];
|
|
1797
|
-
var _useConfigStore = useConfigStore(function (store) {
|
|
1699
|
+
var _useConfigStore = useThemeUtils.useConfigStore(function (store) {
|
|
1798
1700
|
return {
|
|
1799
1701
|
entityType: store["entityType"],
|
|
1800
1702
|
entityId: store["entityId"],
|
|
@@ -1806,7 +1708,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1806
1708
|
entityId = _useConfigStore.entityId,
|
|
1807
1709
|
isFetchingSchema = _useConfigStore.isFetchingSchema,
|
|
1808
1710
|
defaultThemeName = _useConfigStore.defaultThemeName;
|
|
1809
|
-
var _useThemeStore = useThemeStore(function (store) {
|
|
1711
|
+
var _useThemeStore = useThemeUtils.useThemeStore(function (store) {
|
|
1810
1712
|
return {
|
|
1811
1713
|
setThemeState: store["setThemeState"]
|
|
1812
1714
|
};
|
|
@@ -1815,7 +1717,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1815
1717
|
var didScrollActiveThemeIntoView = react.useRef(null);
|
|
1816
1718
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1817
1719
|
t = _useTranslation.t;
|
|
1818
|
-
var _useThemeUtils = useThemeUtils(),
|
|
1720
|
+
var _useThemeUtils = useThemeUtils.useThemeUtils(),
|
|
1819
1721
|
setTheme = _useThemeUtils.setTheme;
|
|
1820
1722
|
var _useListThemes = useListThemes(entityId),
|
|
1821
1723
|
_useListThemes$data = _useListThemes.data,
|
|
@@ -1851,6 +1753,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1851
1753
|
isApplyingTheme = _useApplyTheme.isPending;
|
|
1852
1754
|
var themeToDelete = react.useRef(null);
|
|
1853
1755
|
var themeToEdit = react.useRef(null);
|
|
1756
|
+
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
1854
1757
|
var handleEditTheme = function handleEditTheme(theme) {
|
|
1855
1758
|
themeToEdit.current = theme;
|
|
1856
1759
|
setCurrentScreen(DESIGN_SCREENS.Customize);
|
|
@@ -1870,12 +1773,12 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1870
1773
|
setThemeState({
|
|
1871
1774
|
previewingTheme: currentTheme
|
|
1872
1775
|
});
|
|
1873
|
-
setCurrentScreen(DESIGN_SCREENS.THEMES);
|
|
1776
|
+
setCurrentScreen(isCustomCssScreen ? DESIGN_SCREENS.Customize : DESIGN_SCREENS.THEMES);
|
|
1874
1777
|
themeToEdit.current = null;
|
|
1875
1778
|
};
|
|
1876
1779
|
var highlightTheme = function highlightTheme(themeToHighlight) {
|
|
1877
1780
|
setTimeout(function () {
|
|
1878
|
-
scrollElementIntoView(themeToHighlight.id);
|
|
1781
|
+
utils.scrollElementIntoView(themeToHighlight.id);
|
|
1879
1782
|
}, 1500);
|
|
1880
1783
|
setTimeout(function () {
|
|
1881
1784
|
setThemeToHighlight(null);
|
|
@@ -1911,7 +1814,9 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1911
1814
|
});
|
|
1912
1815
|
}, [deleteTheme, themeToDelete]);
|
|
1913
1816
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1914
|
-
className: "neeto-themes-sidebar neeto-ui-border-gray-200 flex-shrink-0 border-r",
|
|
1817
|
+
className: classNames__default["default"]("neeto-themes-sidebar neeto-ui-border-gray-200 flex-shrink-0 border-r transition-all duration-300", {
|
|
1818
|
+
"neeto-themes-sidebar--expanded": isCustomCssScreen
|
|
1819
|
+
}),
|
|
1915
1820
|
children: [/*#__PURE__*/jsxRuntime.jsx(TitleBar, {
|
|
1916
1821
|
currentScreen: currentScreen,
|
|
1917
1822
|
handleBackPress: handleBackPress,
|
|
@@ -1936,13 +1841,15 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1936
1841
|
onDeleteTheme: handleDelete,
|
|
1937
1842
|
onEditTheme: handleEditTheme
|
|
1938
1843
|
}) : /*#__PURE__*/jsxRuntime.jsx(Customize, {
|
|
1844
|
+
currentScreen: currentScreen,
|
|
1939
1845
|
isApplyingTheme: isApplyingTheme,
|
|
1940
1846
|
onApplyTheme: onApplyTheme,
|
|
1941
1847
|
onCreateTheme: onCreateTheme,
|
|
1942
1848
|
onPropertiesChange: onPropertiesChange,
|
|
1943
1849
|
onUpdateThemeSuccess: onUpdateThemeSuccess,
|
|
1944
1850
|
theme: themeToEdit.current,
|
|
1945
|
-
themeId: (_themeToEdit$current2 = themeToEdit.current) === null || _themeToEdit$current2 === void 0 ? void 0 : _themeToEdit$current2.id
|
|
1851
|
+
themeId: (_themeToEdit$current2 = themeToEdit.current) === null || _themeToEdit$current2 === void 0 ? void 0 : _themeToEdit$current2.id,
|
|
1852
|
+
onEditCSSClick: setCurrentScreen
|
|
1946
1853
|
}), /*#__PURE__*/jsxRuntime.jsx(MemoizedAlert, {
|
|
1947
1854
|
isOpen: isDeleteAlertOpen,
|
|
1948
1855
|
isSubmitting: isDeleting,
|
|
@@ -1973,15 +1880,15 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
1973
1880
|
onApplyThemeSuccess = _ref$onApplyThemeSucc === void 0 ? neetoCist.noop : _ref$onApplyThemeSucc,
|
|
1974
1881
|
_ref$onUpdateThemeSuc = _ref.onUpdateThemeSuccess,
|
|
1975
1882
|
onUpdateThemeSuccess = _ref$onUpdateThemeSuc === void 0 ? neetoCist.noop : _ref$onUpdateThemeSuc;
|
|
1976
|
-
var _useThemeStore = useThemeStore(function (store) {
|
|
1883
|
+
var _useThemeStore = useThemeUtils.useThemeStore(function (store) {
|
|
1977
1884
|
return {
|
|
1978
1885
|
setThemeState: store["setThemeState"]
|
|
1979
1886
|
};
|
|
1980
1887
|
}, shallow.shallow),
|
|
1981
1888
|
setThemeState = _useThemeStore.setThemeState;
|
|
1982
|
-
var _useThemeUtils = useThemeUtils(),
|
|
1889
|
+
var _useThemeUtils = useThemeUtils.useThemeUtils(),
|
|
1983
1890
|
setTheme = _useThemeUtils.setTheme;
|
|
1984
|
-
var _useConfigStore = useConfigStore(function (store) {
|
|
1891
|
+
var _useConfigStore = useThemeUtils.useConfigStore(function (store) {
|
|
1985
1892
|
return {
|
|
1986
1893
|
setConfigState: store["setConfigState"]
|
|
1987
1894
|
};
|
|
@@ -2034,12 +1941,5 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
2034
1941
|
};
|
|
2035
1942
|
var index = reactUtils.withTitle(NeetoThemesBuilder, i18next.t("neetoThemes.common.design"));
|
|
2036
1943
|
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
var css = ".neeto-themes__wrapper{display:flex;width:100%}.neeto-themes__wrapper .neeto-themes-sidebar{background-color:rgb(var(--neeto-ui-white));height:calc(100vh - 64px);width:240px}@media (min-width:1024px){.neeto-themes__wrapper .neeto-themes-sidebar{width:280px}}@media (min-width:1280px){.neeto-themes__wrapper .neeto-themes-sidebar{width:320px}}.neeto-themes__wrapper .neeto-themes-sidebar .neeto-themes-sidebar__header{padding-bottom:8px;padding-top:16px}.neeto-themes__wrapper .neeto-themes-sidebar .neeto-themes-sidebar__scroll{height:calc(100vh - 120px);overflow-y:auto}.neeto-themes__wrapper .neeto-themes-sidebar .neeto-themes-sidebar__scroll .neeto-ui-colorpicker__target .neeto-ui-colorpicker-target__code{display:none}.neeto-themes__wrapper .neeto-themes-preview__wrapper{flex-grow:1;height:calc(100vh - 64px);position:relative}.neeto-themes-theme-thumbnail--preview-active{border-color:rgb(var(--neeto-ui-gray-600))!important;outline:1px solid rgb(var(--neeto-ui-gray-600))!important}.neeto-themes-theme-thumbnail--active{border-color:rgb(var(--neeto-ui-primary-500))!important;outline:2px solid rgb(var(--neeto-ui-primary-500))!important}.neeto-themes-theme-thumbnail--highlight-active{border-color:rgb(var(--neeto-ui-gray-400))!important;outline:2px solid rgb(var(--neeto-ui-gray-400))!important}.neeto-themes-theme-thumbnail__apply-btn{--neeto-ui-btn-padding-x:12px;--neeto-ui-btn-border-radius:100px}.neeto-themes-theme-thumbnail__apply-btn:disabled,.neeto-themes-theme-thumbnail__apply-btn[disabled]{opacity:1!important}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX3RoZW1lcy5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3R5bGVzaGVldHMvYXBwbGljYXRpb24uc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSx1QkFFRSxZQUFBLENBREEsVUNFRixDRENFLDZDQUdFLDJDQUFBLENBREEseUJBQUEsQ0FEQSxXQ0dKLENEQ0ksMEJBTEYsNkNBTUksV0NFSixDQUNGLENEREksMEJBUkYsNkNBU0ksV0NJSixDQUNGLENERkksMkVBRUUsa0JBQUEsQ0FEQSxnQkNLTixDRERJLDJFQUNFLDBCQUFBLENBQ0EsZUNHTixDREFRLDRJQUNFLFlDRVYsQ0RJRSxzREFHRSxXQUFBLENBREEseUJBQUEsQ0FEQSxpQkNBSixDRE1BLDhDQUNFLG9EQUFBLENBQ0EseURDSEYsQ0RNQSxzQ0FDRSx1REFBQSxDQUNBLDREQ0hGLENETUEsZ0RBQ0Usb0RBQUEsQ0FDQSx5RENIRixDRE1BLHlDQUNFLDZCQUFBLENBQ0Esa0NDSEYsQ0RJRSxxR0FFRSxtQkNISiIsInNvdXJjZXNDb250ZW50IjpbIi5uZWV0by10aGVtZXNfX3dyYXBwZXIge1xuICB3aWR0aDogMTAwJTtcbiAgZGlzcGxheTogZmxleDtcblxuICAubmVldG8tdGhlbWVzLXNpZGViYXIge1xuICAgIHdpZHRoOiAkdGhlbWVzLXNpZGViYXItd2lkdGgtc207XG4gICAgaGVpZ2h0OiBjYWxjKDEwMHZoIC0gI3skYnVpbGRlci1oZWFkZXItaGVpZ2h0fSk7XG4gICAgYmFja2dyb3VuZC1jb2xvcjogcmdiKHZhcigtLW5lZXRvL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tdGhlbWVzLXRoZW1lLXRodW1ibmFpbC0tYWN0aXZlIHtcbiAgYm9yZGVyLWNvbG9yOiByZ2IodmFyKC0tbmVldG8tdWktcHJpbWFyeS01MDApKSAhaW1wb3J0YW50O1xuICBvdXRsaW5lOiAycHggc29saWQgcmdiKHZhcigtLW5lZXRvLXVpLXByaW1hcnktNTAwKSkgIWltcG9ydGFudDtcbn1cblxuLm5lZXRvLXRoZW1lcy10aGVtZS10aHVtYm5haWwtLWhpZ2hsaWdodC1hY3RpdmUge1xuICBib3JkZXItY29sb3I6IHJnYih2YXIoLS1uZWV0by11aS1ncmF5LTQwMCkpICFpbXBvcnRhbnQ7XG4gIG91dGxpbmU6IDJweCBzb2xpZCByZ2IodmFyKC0tbmVldG8tdWktZ3JheS00MDApKSAhaW1wb3J0YW50O1xufVxuXG4ubmVldG8tdGhlbWVzLXRoZW1lLXRodW1ibmFpbF9fYXBwbHktYnRuIHtcbiAgLS1uZWV0by11aS1idG4tcGFkZGluZy14OiAxMnB4O1xuICAtLW5lZXRvLXVpLWJ0bi1ib3JkZXItcmFkaXVzOiAxMDBweDtcbn1cbi5uZWV0by10aGVtZXMtdGhlbWUtdGh1bWJuYWlsX19hcHBseS1idG46ZGlzYWJsZWQsIC5uZWV0by10aGVtZXMtdGhlbWUtdGh1bWJuYWlsX19hcHBseS1idG5bZGlzYWJsZWRdIHtcbiAgb3BhY2l0eTogMSAhaW1wb3J0YW50O1xufSJdfQ== */";
|
|
2040
|
-
n(css,{});
|
|
2041
|
-
|
|
2042
|
-
exports.NeetoThemesBuilder = index;
|
|
2043
|
-
exports.setTheme = setTheme;
|
|
2044
|
-
exports.useThemeUtils = useThemeUtils;
|
|
2045
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
1944
|
+
module.exports = index;
|
|
1945
|
+
//# sourceMappingURL=NeetoThemesBuilder.js.map
|