@bigbinary/neeto-themes-frontend 1.3.0-beta2 → 2.0.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/app/javascript/src/translations/en.json +12 -2
- package/dist/index.cjs.js +374 -103
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +361 -99
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/types.d.ts +1 -0
package/dist/index.cjs.js
CHANGED
|
@@ -12,15 +12,15 @@ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
|
12
12
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
13
13
|
var Alert = require('@bigbinary/neetoui/Alert');
|
|
14
14
|
var reactI18next = require('react-i18next');
|
|
15
|
-
require('@babel/runtime/helpers/asyncToGenerator');
|
|
16
|
-
require('@babel/runtime/regenerator');
|
|
17
|
-
require('@bigbinary/neetoui/Toastr');
|
|
15
|
+
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
16
|
+
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
17
|
+
var Toastr = require('@bigbinary/neetoui/Toastr');
|
|
18
18
|
var reactQuery = require('@tanstack/react-query');
|
|
19
19
|
var axios = require('axios');
|
|
20
20
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
21
21
|
var ramda = require('ramda');
|
|
22
22
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
23
|
-
var
|
|
23
|
+
var Close = require('@bigbinary/neeto-icons/Close');
|
|
24
24
|
var Button = require('@bigbinary/neetoui/Button');
|
|
25
25
|
var Popover = require('@bigbinary/neetoui/Popover');
|
|
26
26
|
var Typography = require('@bigbinary/neetoui/Typography');
|
|
@@ -30,14 +30,19 @@ var formik = require('formik');
|
|
|
30
30
|
var jsxRuntime = require('react/jsx-runtime');
|
|
31
31
|
var neetoImageUploaderFrontend = require('@bigbinary/neeto-image-uploader-frontend');
|
|
32
32
|
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
33
|
-
var ColorPicker = require('@bigbinary/neetoui/ColorPicker');
|
|
34
33
|
var Select = require('@bigbinary/neetoui/Select');
|
|
34
|
+
var CenterAlign = require('@bigbinary/neeto-icons/CenterAlign');
|
|
35
|
+
var LeftAlign = require('@bigbinary/neeto-icons/LeftAlign');
|
|
36
|
+
var ColorPicker = require('@bigbinary/neetoui/ColorPicker');
|
|
35
37
|
var antd = require('antd');
|
|
38
|
+
var classnames = require('classnames');
|
|
39
|
+
var HelpPopover = require('@bigbinary/neeto-molecules/HelpPopover');
|
|
36
40
|
var Switch = require('@bigbinary/neetoui/Switch');
|
|
37
41
|
var Input = require('@bigbinary/neetoui/formik/Input');
|
|
38
42
|
var Search = require('@bigbinary/neeto-molecules/Search');
|
|
39
|
-
var classnames = require('classnames');
|
|
40
43
|
var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
|
|
44
|
+
var LeftArrow = require('@bigbinary/neeto-icons/LeftArrow');
|
|
45
|
+
var Plus = require('@bigbinary/neeto-icons/Plus');
|
|
41
46
|
|
|
42
47
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
43
48
|
|
|
@@ -62,21 +67,30 @@ function _interopNamespace(e) {
|
|
|
62
67
|
var Spinner__default = /*#__PURE__*/_interopDefaultLegacy(Spinner);
|
|
63
68
|
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
64
69
|
var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
|
|
70
|
+
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
71
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
72
|
+
var Toastr__default = /*#__PURE__*/_interopDefaultLegacy(Toastr);
|
|
65
73
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
66
74
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
67
75
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
76
|
+
var Close__default = /*#__PURE__*/_interopDefaultLegacy(Close);
|
|
68
77
|
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
69
78
|
var Popover__default = /*#__PURE__*/_interopDefaultLegacy(Popover);
|
|
70
79
|
var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
|
|
71
80
|
var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form);
|
|
72
81
|
var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
|
|
73
|
-
var ColorPicker__default = /*#__PURE__*/_interopDefaultLegacy(ColorPicker);
|
|
74
82
|
var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
|
|
83
|
+
var CenterAlign__default = /*#__PURE__*/_interopDefaultLegacy(CenterAlign);
|
|
84
|
+
var LeftAlign__default = /*#__PURE__*/_interopDefaultLegacy(LeftAlign);
|
|
85
|
+
var ColorPicker__default = /*#__PURE__*/_interopDefaultLegacy(ColorPicker);
|
|
86
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
87
|
+
var HelpPopover__default = /*#__PURE__*/_interopDefaultLegacy(HelpPopover);
|
|
75
88
|
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
|
76
89
|
var Input__default = /*#__PURE__*/_interopDefaultLegacy(Input);
|
|
77
90
|
var Search__default = /*#__PURE__*/_interopDefaultLegacy(Search);
|
|
78
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
79
91
|
var MoreDropdown__default = /*#__PURE__*/_interopDefaultLegacy(MoreDropdown);
|
|
92
|
+
var LeftArrow__default = /*#__PURE__*/_interopDefaultLegacy(LeftArrow);
|
|
93
|
+
var Plus__default = /*#__PURE__*/_interopDefaultLegacy(Plus);
|
|
80
94
|
|
|
81
95
|
/** @type {import("neetocommons/react-utils").ZustandStoreHook} */
|
|
82
96
|
var useConfigStore = zustand.create(reactUtils.withImmutableActions(function (set) {
|
|
@@ -85,7 +99,9 @@ var useConfigStore = zustand.create(reactUtils.withImmutableActions(function (se
|
|
|
85
99
|
entityType: "",
|
|
86
100
|
entityId: "",
|
|
87
101
|
variableNamesMap: {},
|
|
102
|
+
defaultThemeName: "Plain blue",
|
|
88
103
|
isFetchingSchema: true,
|
|
104
|
+
isTemplateThemesEnabled: false,
|
|
89
105
|
setConfigState: set
|
|
90
106
|
};
|
|
91
107
|
}));
|
|
@@ -100,6 +116,52 @@ var useThemeStore = zustand.create(reactUtils.withImmutableActions(function (set
|
|
|
100
116
|
};
|
|
101
117
|
}));
|
|
102
118
|
|
|
119
|
+
var getImageFromUrl = function getImageFromUrl(source) {
|
|
120
|
+
var image = new Image();
|
|
121
|
+
image.crossOrigin = "anonymous";
|
|
122
|
+
image.src = source;
|
|
123
|
+
return new Promise(function (resolve) {
|
|
124
|
+
image.onload = function () {
|
|
125
|
+
resolve(image);
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
var getDominantColorFromUrl = /*#__PURE__*/function () {
|
|
130
|
+
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(imageUrl) {
|
|
131
|
+
var image, context, c;
|
|
132
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
133
|
+
while (1) switch (_context.prev = _context.next) {
|
|
134
|
+
case 0:
|
|
135
|
+
_context.prev = 0;
|
|
136
|
+
_context.next = 3;
|
|
137
|
+
return getImageFromUrl(imageUrl);
|
|
138
|
+
case 3:
|
|
139
|
+
image = _context.sent;
|
|
140
|
+
context = document.createElement("canvas").getContext("2d");
|
|
141
|
+
context === null || context === void 0 || context.drawImage(image, 0, 0, 1, 1);
|
|
142
|
+
c = context === null || context === void 0 ? void 0 : context.getImageData(0, 0, 1, 1).data;
|
|
143
|
+
if (!c) {
|
|
144
|
+
_context.next = 9;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
return _context.abrupt("return", "#".concat(((1 << 24) + (c[0] << 16) + (c[1] << 8) + c[2]).toString(16).slice(1)));
|
|
148
|
+
case 9:
|
|
149
|
+
return _context.abrupt("return", null);
|
|
150
|
+
case 12:
|
|
151
|
+
_context.prev = 12;
|
|
152
|
+
_context.t0 = _context["catch"](0);
|
|
153
|
+
Toastr__default["default"].error(_context.t0);
|
|
154
|
+
return _context.abrupt("return", null);
|
|
155
|
+
case 16:
|
|
156
|
+
case "end":
|
|
157
|
+
return _context.stop();
|
|
158
|
+
}
|
|
159
|
+
}, _callee, null, [[0, 12]]);
|
|
160
|
+
}));
|
|
161
|
+
return function getDominantColorFromUrl(_x) {
|
|
162
|
+
return _ref.apply(this, arguments);
|
|
163
|
+
};
|
|
164
|
+
}();
|
|
103
165
|
var scrollElementIntoView = function scrollElementIntoView(elementId) {
|
|
104
166
|
var elementToScroll = document.getElementById(elementId);
|
|
105
167
|
elementToScroll === null || elementToScroll === void 0 || elementToScroll.scrollIntoView({
|
|
@@ -147,8 +209,12 @@ var useShowThemeEntity = function useShowThemeEntity(entityId) {
|
|
|
147
209
|
};
|
|
148
210
|
|
|
149
211
|
var _excluded$1 = ["themeId"];
|
|
150
|
-
var list$1 = function list() {
|
|
151
|
-
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/themes")
|
|
212
|
+
var list$1 = function list(entityId) {
|
|
213
|
+
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/themes"), {
|
|
214
|
+
params: {
|
|
215
|
+
entity_id: entityId
|
|
216
|
+
}
|
|
217
|
+
});
|
|
152
218
|
};
|
|
153
219
|
var show = function show(id) {
|
|
154
220
|
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/themes/").concat(id));
|
|
@@ -188,10 +254,19 @@ var themesApi = {
|
|
|
188
254
|
apply: apply
|
|
189
255
|
};
|
|
190
256
|
|
|
191
|
-
var useListThemes = function useListThemes() {
|
|
257
|
+
var useListThemes = function useListThemes(entityId) {
|
|
258
|
+
var _useConfigStore = useConfigStore(function (store) {
|
|
259
|
+
return {
|
|
260
|
+
isTemplateThemesEnabled: store["isTemplateThemesEnabled"]
|
|
261
|
+
};
|
|
262
|
+
}, shallow.shallow),
|
|
263
|
+
isTemplateThemesEnabled = _useConfigStore.isTemplateThemesEnabled;
|
|
264
|
+
var queryKey = isTemplateThemesEnabled ? [QUERY_KEYS.THEMES_LIST, entityId] : [QUERY_KEYS.THEMES_LIST];
|
|
192
265
|
return reactQuery.useQuery({
|
|
193
|
-
queryKey:
|
|
194
|
-
queryFn:
|
|
266
|
+
queryKey: queryKey,
|
|
267
|
+
queryFn: function queryFn() {
|
|
268
|
+
return themesApi.list(entityId);
|
|
269
|
+
}
|
|
195
270
|
});
|
|
196
271
|
};
|
|
197
272
|
var useCreateTheme = function useCreateTheme() {
|
|
@@ -243,6 +318,8 @@ var setTheme = function setTheme(theme, variableNamesMap, themeConfig) {
|
|
|
243
318
|
var overlayOpacity = Number(property.value);
|
|
244
319
|
setVariable(neetoCist.snakeToCamelCase("".concat(property.key, "_overlay_opacity")), Math.abs(overlayOpacity / 100), variableNamesMap);
|
|
245
320
|
setVariable(neetoCist.snakeToCamelCase("".concat(property.key, "_overlay_color")), overlayOpacity < 0 ? BLACK : WHITE, variableNamesMap);
|
|
321
|
+
} else if (property.kind === "radius") {
|
|
322
|
+
setVariable(attribute, "".concat(property.value, "px"), variableNamesMap);
|
|
246
323
|
} else {
|
|
247
324
|
setVariable(attribute, property.value, variableNamesMap);
|
|
248
325
|
}
|
|
@@ -293,7 +370,8 @@ var useThemeUtils = function useThemeUtils() {
|
|
|
293
370
|
if (data) {
|
|
294
371
|
setConfigState({
|
|
295
372
|
themePropertiesSchema: data === null || data === void 0 ? void 0 : data.schema,
|
|
296
|
-
variableNamesMap: data === null || data === void 0 ? void 0 : data.variableNamesMap
|
|
373
|
+
variableNamesMap: data === null || data === void 0 ? void 0 : data.variableNamesMap,
|
|
374
|
+
defaultThemeName: data === null || data === void 0 ? void 0 : data.defaultThemeName
|
|
297
375
|
});
|
|
298
376
|
}
|
|
299
377
|
}, [data]);
|
|
@@ -426,6 +504,12 @@ var buildInitialValues = function buildInitialValues(theme, themePropertiesSchem
|
|
|
426
504
|
kind: "slider",
|
|
427
505
|
key: key
|
|
428
506
|
};
|
|
507
|
+
case "radius":
|
|
508
|
+
return {
|
|
509
|
+
value: defaultValue,
|
|
510
|
+
kind: "radius",
|
|
511
|
+
key: key
|
|
512
|
+
};
|
|
429
513
|
case "boolean":
|
|
430
514
|
return {
|
|
431
515
|
value: String(defaultValue),
|
|
@@ -438,6 +522,12 @@ var buildInitialValues = function buildInitialValues(theme, themePropertiesSchem
|
|
|
438
522
|
kind: "position_selector",
|
|
439
523
|
key: key
|
|
440
524
|
};
|
|
525
|
+
case "alignment_block":
|
|
526
|
+
return {
|
|
527
|
+
value: defaultValue,
|
|
528
|
+
kind: "alignment_block",
|
|
529
|
+
key: key
|
|
530
|
+
};
|
|
441
531
|
default:
|
|
442
532
|
return null;
|
|
443
533
|
}
|
|
@@ -455,23 +545,26 @@ var buildImageData = function buildImageData(values, themePropertiesSchema) {
|
|
|
455
545
|
}, {});
|
|
456
546
|
};
|
|
457
547
|
var isPropertyVisible = function isPropertyVisible(key, formikValues, themePropertiesSchema) {
|
|
458
|
-
var _findBy;
|
|
459
548
|
var property = neetoCist.findBy({
|
|
460
549
|
key: key
|
|
461
550
|
}, themePropertiesSchema);
|
|
462
551
|
if (neetoCist.isNotPresent(property)) return false;
|
|
552
|
+
if (property !== null && property !== void 0 && property.hidden) return false;
|
|
463
553
|
var conditionalKey = property === null || property === void 0 ? void 0 : property.dependsOn;
|
|
464
554
|
if (neetoCist.isNotPresent(conditionalKey)) return true;
|
|
465
|
-
var
|
|
555
|
+
var dependentPropertySchema = neetoCist.findBy({
|
|
466
556
|
key: conditionalKey
|
|
467
557
|
}, themePropertiesSchema);
|
|
468
|
-
|
|
558
|
+
var dependentProperty = neetoCist.findBy({
|
|
559
|
+
key: conditionalKey
|
|
560
|
+
}, formikValues.properties);
|
|
561
|
+
if (dependentPropertySchema.kind === "image") {
|
|
469
562
|
var _formikValues$snakeTo;
|
|
470
563
|
return neetoCist.isPresent((_formikValues$snakeTo = formikValues[neetoCist.snakeToCamelCase(conditionalKey)]) === null || _formikValues$snakeTo === void 0 ? void 0 : _formikValues$snakeTo.url);
|
|
564
|
+
} else if (dependentPropertySchema.kind === "boolean") {
|
|
565
|
+
return (dependentProperty === null || dependentProperty === void 0 ? void 0 : dependentProperty.value) !== "false";
|
|
471
566
|
}
|
|
472
|
-
return neetoCist.isPresent(
|
|
473
|
-
key: conditionalKey
|
|
474
|
-
}, formikValues.properties)) === null || _findBy === void 0 ? void 0 : _findBy.value);
|
|
567
|
+
return neetoCist.isPresent(dependentProperty === null || dependentProperty === void 0 ? void 0 : dependentProperty.value);
|
|
475
568
|
};
|
|
476
569
|
var buildLabel = function buildLabel(key, kind) {
|
|
477
570
|
return i18next.t("neetoThemes.properties.".concat(neetoCist.snakeToCamelCase(kind), ".").concat(neetoCist.snakeToCamelCase(key)));
|
|
@@ -499,6 +592,32 @@ var Card$2 = function Card(_ref) {
|
|
|
499
592
|
});
|
|
500
593
|
};
|
|
501
594
|
|
|
595
|
+
var SelectBlock = function SelectBlock(_ref) {
|
|
596
|
+
var label = _ref.label,
|
|
597
|
+
_ref$placeholder = _ref.placeholder,
|
|
598
|
+
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
599
|
+
value = _ref.value,
|
|
600
|
+
options = _ref.options,
|
|
601
|
+
onChange = _ref.onChange;
|
|
602
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
603
|
+
className: "flex items-center justify-between py-3 first:pt-0 last:pb-0",
|
|
604
|
+
"data-cy": "theme-style-".concat(utils.joinHyphenCase(label)),
|
|
605
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
606
|
+
"data-cy": "logo-field-labels",
|
|
607
|
+
style: "body2",
|
|
608
|
+
children: label
|
|
609
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
610
|
+
className: "w-40",
|
|
611
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Select__default["default"], {
|
|
612
|
+
onChange: onChange,
|
|
613
|
+
options: options,
|
|
614
|
+
placeholder: placeholder,
|
|
615
|
+
value: value
|
|
616
|
+
})
|
|
617
|
+
})]
|
|
618
|
+
});
|
|
619
|
+
};
|
|
620
|
+
|
|
502
621
|
var DESIGN_SCREENS = {
|
|
503
622
|
THEMES: "Themes",
|
|
504
623
|
Customize: "Customize"
|
|
@@ -506,6 +625,7 @@ var DESIGN_SCREENS = {
|
|
|
506
625
|
var ONE_MEGABYTE = 1;
|
|
507
626
|
|
|
508
627
|
var ImageBlock = function ImageBlock(_ref) {
|
|
628
|
+
var _findBy;
|
|
509
629
|
var label = _ref.label,
|
|
510
630
|
name = _ref.name,
|
|
511
631
|
_ref$imageData = _ref.imageData,
|
|
@@ -513,22 +633,73 @@ var ImageBlock = function ImageBlock(_ref) {
|
|
|
513
633
|
_ref$uploadConfig = _ref.uploadConfig,
|
|
514
634
|
uploadConfig = _ref$uploadConfig === void 0 ? {
|
|
515
635
|
maxImageSize: ONE_MEGABYTE
|
|
516
|
-
} : _ref$uploadConfig
|
|
636
|
+
} : _ref$uploadConfig,
|
|
637
|
+
attribute = _ref.attribute;
|
|
638
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
639
|
+
t = _useTranslation.t;
|
|
517
640
|
var _useFormikContext = formik.useFormikContext(),
|
|
518
|
-
setFieldValue = _useFormikContext.setFieldValue
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
641
|
+
setFieldValue = _useFormikContext.setFieldValue,
|
|
642
|
+
values = _useFormikContext.values;
|
|
643
|
+
var _useConfigStore = useConfigStore(function (store) {
|
|
644
|
+
return {
|
|
645
|
+
themePropertiesSchema: store["themePropertiesSchema"]
|
|
646
|
+
};
|
|
647
|
+
}, shallow.shallow),
|
|
648
|
+
themePropertiesSchema = _useConfigStore.themePropertiesSchema;
|
|
649
|
+
var propertySchema = neetoCist.findBy({
|
|
650
|
+
key: attribute
|
|
651
|
+
}, themePropertiesSchema);
|
|
652
|
+
var enablePositionChanger = (propertySchema === null || propertySchema === void 0 ? void 0 : propertySchema.enablePositionChanger) || false;
|
|
653
|
+
var options = propertySchema === null || propertySchema === void 0 ? void 0 : propertySchema.options;
|
|
654
|
+
var positionKeyInSchema = neetoCist.findBy({
|
|
655
|
+
key: "".concat(name, "_position")
|
|
656
|
+
}, themePropertiesSchema);
|
|
657
|
+
var isPositionChangerVisible = enablePositionChanger && (imageData === null || imageData === void 0 ? void 0 : imageData.url) && neetoCist.isPresent(positionKeyInSchema);
|
|
658
|
+
var positionKeyIndex = neetoCist.findIndexBy({
|
|
659
|
+
key: "".concat(name, "_position")
|
|
660
|
+
}, values.properties);
|
|
661
|
+
var handleImageChange = /*#__PURE__*/function () {
|
|
662
|
+
var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(image) {
|
|
663
|
+
var dominantColor;
|
|
664
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
665
|
+
while (1) switch (_context.prev = _context.next) {
|
|
666
|
+
case 0:
|
|
667
|
+
_context.prev = 0;
|
|
668
|
+
if (!(ramda.isEmpty(image.signedId) || ramda.isEmpty(image.url))) {
|
|
669
|
+
_context.next = 4;
|
|
670
|
+
break;
|
|
671
|
+
}
|
|
672
|
+
setFieldValue(name, {
|
|
673
|
+
signedId: null,
|
|
674
|
+
url: image.url
|
|
675
|
+
});
|
|
676
|
+
return _context.abrupt("return");
|
|
677
|
+
case 4:
|
|
678
|
+
_context.next = 6;
|
|
679
|
+
return getDominantColorFromUrl(image.url);
|
|
680
|
+
case 6:
|
|
681
|
+
dominantColor = _context.sent;
|
|
682
|
+
setFieldValue(name, {
|
|
683
|
+
signedId: image.signedId,
|
|
684
|
+
url: image.url,
|
|
685
|
+
dominantColor: dominantColor
|
|
686
|
+
});
|
|
687
|
+
_context.next = 13;
|
|
688
|
+
break;
|
|
689
|
+
case 10:
|
|
690
|
+
_context.prev = 10;
|
|
691
|
+
_context.t0 = _context["catch"](0);
|
|
692
|
+
Toastr__default["default"].error(_context.t0);
|
|
693
|
+
case 13:
|
|
694
|
+
case "end":
|
|
695
|
+
return _context.stop();
|
|
696
|
+
}
|
|
697
|
+
}, _callee, null, [[0, 10]]);
|
|
698
|
+
}));
|
|
699
|
+
return function handleImageChange(_x) {
|
|
700
|
+
return _ref2.apply(this, arguments);
|
|
701
|
+
};
|
|
702
|
+
}();
|
|
532
703
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
533
704
|
className: "space-y-3 py-3 first:pt-0 last:pb-0",
|
|
534
705
|
"data-cy": "theme-style-".concat(utils.joinHyphenCase(label)),
|
|
@@ -539,12 +710,25 @@ var ImageBlock = function ImageBlock(_ref) {
|
|
|
539
710
|
style: "body2",
|
|
540
711
|
children: label
|
|
541
712
|
})
|
|
542
|
-
}), /*#__PURE__*/
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
713
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
714
|
+
className: "space-y-3 divide-y divide-gray-200",
|
|
715
|
+
children: [/*#__PURE__*/react.createElement(neetoImageUploaderFrontend.ImageUploader, {
|
|
716
|
+
uploadConfig: uploadConfig,
|
|
717
|
+
className: "h-40 w-full",
|
|
718
|
+
key: imageData === null || imageData === void 0 ? void 0 : imageData.url,
|
|
719
|
+
src: imageData === null || imageData === void 0 ? void 0 : imageData.url,
|
|
720
|
+
onUploadComplete: handleImageChange
|
|
721
|
+
}), isPositionChangerVisible && /*#__PURE__*/jsxRuntime.jsx(SelectBlock, {
|
|
722
|
+
label: buildLabel("".concat(name, "Position"), "image"),
|
|
723
|
+
options: options || POSITION_OPTIONS,
|
|
724
|
+
placeholder: t("neetoThemes.common.left"),
|
|
725
|
+
value: neetoCist.toLabelAndValue((_findBy = neetoCist.findBy({
|
|
726
|
+
key: "".concat(name, "_position")
|
|
727
|
+
}, values.properties)) === null || _findBy === void 0 ? void 0 : _findBy.value),
|
|
728
|
+
onChange: function onChange(option) {
|
|
729
|
+
return setFieldValue("properties[".concat(positionKeyIndex, "].value"), option.value);
|
|
730
|
+
}
|
|
731
|
+
})]
|
|
548
732
|
})]
|
|
549
733
|
});
|
|
550
734
|
};
|
|
@@ -561,6 +745,7 @@ var Images = function Images(_ref) {
|
|
|
561
745
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
562
746
|
className: "divide-y divide-gray-200",
|
|
563
747
|
children: /*#__PURE__*/jsxRuntime.jsx(ImageBlock, {
|
|
748
|
+
attribute: attribute,
|
|
564
749
|
imageData: imageData,
|
|
565
750
|
name: key
|
|
566
751
|
})
|
|
@@ -568,6 +753,54 @@ var Images = function Images(_ref) {
|
|
|
568
753
|
});
|
|
569
754
|
};
|
|
570
755
|
|
|
756
|
+
var AlignmentBlock = function AlignmentBlock(_ref) {
|
|
757
|
+
var label = _ref.label,
|
|
758
|
+
name = _ref.name;
|
|
759
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
760
|
+
className: "flex items-center justify-between gap-2 py-3 first:pt-0 last:pb-0",
|
|
761
|
+
"data-cy": utils.joinHyphenCase(label),
|
|
762
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
763
|
+
"data-cy": "style-fields-labels",
|
|
764
|
+
style: "body2",
|
|
765
|
+
children: label
|
|
766
|
+
}), /*#__PURE__*/jsxRuntime.jsx(formik.Field, {
|
|
767
|
+
name: name,
|
|
768
|
+
children: function children(_ref2) {
|
|
769
|
+
var value = _ref2.field.value,
|
|
770
|
+
setFieldValue = _ref2.form.setFieldValue;
|
|
771
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
772
|
+
className: "flex items-center gap-3",
|
|
773
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
774
|
+
"data-cy": "alignment-left",
|
|
775
|
+
icon: LeftAlign__default["default"],
|
|
776
|
+
size: "large",
|
|
777
|
+
style: value === "left" ? "primary" : "text",
|
|
778
|
+
tooltipProps: {
|
|
779
|
+
content: "Left align",
|
|
780
|
+
position: "bottom"
|
|
781
|
+
},
|
|
782
|
+
onClick: function onClick() {
|
|
783
|
+
return setFieldValue(name, "left");
|
|
784
|
+
}
|
|
785
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
786
|
+
"data-cy": "alignment-center",
|
|
787
|
+
icon: CenterAlign__default["default"],
|
|
788
|
+
size: "large",
|
|
789
|
+
style: value === "center" ? "primary" : "text",
|
|
790
|
+
tooltipProps: {
|
|
791
|
+
content: "Center align",
|
|
792
|
+
position: "bottom"
|
|
793
|
+
},
|
|
794
|
+
onClick: function onClick() {
|
|
795
|
+
return setFieldValue(name, "center");
|
|
796
|
+
}
|
|
797
|
+
})]
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
})]
|
|
801
|
+
});
|
|
802
|
+
};
|
|
803
|
+
|
|
571
804
|
var ColorBlock = function ColorBlock(_ref) {
|
|
572
805
|
var label = _ref.label,
|
|
573
806
|
_ref$color = _ref.color,
|
|
@@ -627,32 +860,6 @@ var FontPickerBlock = function FontPickerBlock(_ref) {
|
|
|
627
860
|
});
|
|
628
861
|
};
|
|
629
862
|
|
|
630
|
-
var SelectBlock = function SelectBlock(_ref) {
|
|
631
|
-
var label = _ref.label,
|
|
632
|
-
_ref$placeholder = _ref.placeholder,
|
|
633
|
-
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
634
|
-
value = _ref.value,
|
|
635
|
-
options = _ref.options,
|
|
636
|
-
onChange = _ref.onChange;
|
|
637
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
638
|
-
className: "flex items-center justify-between py-3 first:pt-0 last:pb-0",
|
|
639
|
-
"data-cy": "theme-style-".concat(utils.joinHyphenCase(label)),
|
|
640
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
641
|
-
"data-cy": "logo-field-labels",
|
|
642
|
-
style: "body2",
|
|
643
|
-
children: label
|
|
644
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
645
|
-
className: "w-40",
|
|
646
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Select__default["default"], {
|
|
647
|
-
onChange: onChange,
|
|
648
|
-
options: options,
|
|
649
|
-
placeholder: placeholder,
|
|
650
|
-
value: value
|
|
651
|
-
})
|
|
652
|
-
})]
|
|
653
|
-
});
|
|
654
|
-
};
|
|
655
|
-
|
|
656
863
|
var SliderBlock = function SliderBlock(_ref) {
|
|
657
864
|
var label = _ref.label,
|
|
658
865
|
onChange = _ref.onChange,
|
|
@@ -688,14 +895,32 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
688
895
|
var label = _ref.label,
|
|
689
896
|
name = _ref.name,
|
|
690
897
|
switchProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
898
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
899
|
+
t = _useTranslation.t,
|
|
900
|
+
i18n = _useTranslation.i18n;
|
|
901
|
+
var translationKey = "neetoThemes.properties.boolean.".concat(name, "HelpText");
|
|
902
|
+
var doesHelpTextExist = i18n.exists(translationKey);
|
|
691
903
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
692
904
|
className: "flex items-center justify-between py-3 first:pt-0 last:pb-0",
|
|
693
|
-
children: [/*#__PURE__*/jsxRuntime.
|
|
694
|
-
|
|
695
|
-
children:
|
|
696
|
-
|
|
905
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
906
|
+
className: "inline-flex items-center gap-4",
|
|
907
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
908
|
+
"data-cy": "style-fields-labels",
|
|
909
|
+
style: "body2",
|
|
910
|
+
className: classnames__default["default"]({
|
|
911
|
+
"w-32": doesHelpTextExist,
|
|
912
|
+
"w-auto": !doesHelpTextExist
|
|
913
|
+
}),
|
|
914
|
+
children: label
|
|
915
|
+
}), doesHelpTextExist && /*#__PURE__*/jsxRuntime.jsx(HelpPopover__default["default"], {
|
|
916
|
+
className: "flex-shrink-0",
|
|
917
|
+
description: t(translationKey)
|
|
918
|
+
})]
|
|
919
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Switch__default["default"], _objectSpread$2(_objectSpread$2({}, _objectSpread$2({
|
|
697
920
|
name: name
|
|
698
|
-
}, switchProps))
|
|
921
|
+
}, switchProps)), {}, {
|
|
922
|
+
"data-cy": "enable-background-color-toggle"
|
|
923
|
+
}))]
|
|
699
924
|
});
|
|
700
925
|
};
|
|
701
926
|
|
|
@@ -749,7 +974,7 @@ var Properties = function Properties(_ref) {
|
|
|
749
974
|
}
|
|
750
975
|
};
|
|
751
976
|
react.useEffect(function () {
|
|
752
|
-
onPropertiesChange === null || onPropertiesChange === void 0 || onPropertiesChange(values,
|
|
977
|
+
onPropertiesChange === null || onPropertiesChange === void 0 || onPropertiesChange(values, handleChange, handleColorChange);
|
|
753
978
|
setTheme(values);
|
|
754
979
|
setThemeState({
|
|
755
980
|
previewingTheme: values
|
|
@@ -779,20 +1004,39 @@ var Properties = function Properties(_ref) {
|
|
|
779
1004
|
}), neetoCist.filterBy({
|
|
780
1005
|
kind: "color"
|
|
781
1006
|
}, values.properties).map(function (_ref5) {
|
|
1007
|
+
var _findBy;
|
|
782
1008
|
var key = _ref5.key,
|
|
783
1009
|
value = _ref5.value,
|
|
784
1010
|
kind = _ref5.kind;
|
|
785
1011
|
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsxRuntime.jsx(ColorBlock, {
|
|
786
1012
|
color: value,
|
|
787
1013
|
label: buildLabel(key, kind),
|
|
1014
|
+
showTransparencyControl: ((_findBy = neetoCist.findBy({
|
|
1015
|
+
key: key
|
|
1016
|
+
}, themePropertiesSchema)) === null || _findBy === void 0 ? void 0 : _findBy.showTransparencyControl) || false,
|
|
788
1017
|
onChange: handleColorChange(key)
|
|
789
1018
|
}, key);
|
|
790
1019
|
}), neetoCist.filterBy({
|
|
791
|
-
kind: "
|
|
1020
|
+
kind: "radius"
|
|
792
1021
|
}, values.properties).map(function (_ref6) {
|
|
793
1022
|
var key = _ref6.key,
|
|
794
1023
|
value = _ref6.value,
|
|
795
1024
|
kind = _ref6.kind;
|
|
1025
|
+
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsxRuntime.jsx(SliderBlock, {
|
|
1026
|
+
label: buildLabel(key, kind),
|
|
1027
|
+
max: 50,
|
|
1028
|
+
min: 0,
|
|
1029
|
+
value: Number(value) || 0,
|
|
1030
|
+
onChange: function onChange(radius) {
|
|
1031
|
+
return handleChange(key, radius, "".concat(radius, "px"));
|
|
1032
|
+
}
|
|
1033
|
+
}, key);
|
|
1034
|
+
}), neetoCist.filterBy({
|
|
1035
|
+
kind: "overlay_opacity"
|
|
1036
|
+
}, values.properties).map(function (_ref7) {
|
|
1037
|
+
var key = _ref7.key,
|
|
1038
|
+
value = _ref7.value,
|
|
1039
|
+
kind = _ref7.kind;
|
|
796
1040
|
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsxRuntime.jsx(SliderBlock, {
|
|
797
1041
|
label: buildLabel(key, kind),
|
|
798
1042
|
marks: OVERLAY_OPACITY_SLIDER_MARKS,
|
|
@@ -805,17 +1049,17 @@ var Properties = function Properties(_ref) {
|
|
|
805
1049
|
}, key);
|
|
806
1050
|
}), neetoCist.filterBy({
|
|
807
1051
|
kind: "position_selector"
|
|
808
|
-
}, values.properties).map(function (
|
|
809
|
-
var
|
|
810
|
-
var key =
|
|
811
|
-
kind =
|
|
812
|
-
value =
|
|
1052
|
+
}, values.properties).map(function (_ref8) {
|
|
1053
|
+
var _findBy2;
|
|
1054
|
+
var key = _ref8.key,
|
|
1055
|
+
kind = _ref8.kind,
|
|
1056
|
+
value = _ref8.value;
|
|
813
1057
|
var index = neetoCist.findIndexBy({
|
|
814
1058
|
key: key
|
|
815
1059
|
}, values.properties);
|
|
816
|
-
var options = (
|
|
1060
|
+
var options = (_findBy2 = neetoCist.findBy({
|
|
817
1061
|
key: key
|
|
818
|
-
}, themePropertiesSchema)) === null ||
|
|
1062
|
+
}, themePropertiesSchema)) === null || _findBy2 === void 0 || (_findBy2 = _findBy2.options) === null || _findBy2 === void 0 ? void 0 : _findBy2.map(neetoCist.toLabelAndValue);
|
|
819
1063
|
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsxRuntime.jsx(SelectBlock, {
|
|
820
1064
|
label: buildLabel(key, kind),
|
|
821
1065
|
options: options || POSITION_OPTIONS,
|
|
@@ -827,20 +1071,33 @@ var Properties = function Properties(_ref) {
|
|
|
827
1071
|
}, key);
|
|
828
1072
|
}), neetoCist.filterBy({
|
|
829
1073
|
kind: "boolean"
|
|
830
|
-
}, values.properties).map(function (
|
|
831
|
-
var key =
|
|
832
|
-
kind =
|
|
833
|
-
value =
|
|
1074
|
+
}, values.properties).map(function (_ref9) {
|
|
1075
|
+
var key = _ref9.key,
|
|
1076
|
+
kind = _ref9.kind,
|
|
1077
|
+
value = _ref9.value;
|
|
834
1078
|
var index = neetoCist.findIndexBy({
|
|
835
1079
|
key: key
|
|
836
1080
|
}, values.properties);
|
|
837
1081
|
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsxRuntime.jsx(SwitchBlock, {
|
|
838
1082
|
checked: value !== "false",
|
|
839
1083
|
label: buildLabel(key, kind),
|
|
1084
|
+
name: neetoCist.snakeToCamelCase(key),
|
|
840
1085
|
onChange: function onChange(e) {
|
|
841
1086
|
return setFieldValue("properties[".concat(index, "].value"), String(e.target.checked));
|
|
842
1087
|
}
|
|
843
1088
|
}, key);
|
|
1089
|
+
}), neetoCist.filterBy({
|
|
1090
|
+
kind: "alignment_block"
|
|
1091
|
+
}, values.properties).map(function (_ref10) {
|
|
1092
|
+
var key = _ref10.key,
|
|
1093
|
+
kind = _ref10.kind;
|
|
1094
|
+
var index = neetoCist.findIndexBy({
|
|
1095
|
+
key: key
|
|
1096
|
+
}, values.properties);
|
|
1097
|
+
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsxRuntime.jsx(AlignmentBlock, {
|
|
1098
|
+
label: buildLabel(key, kind),
|
|
1099
|
+
name: "properties[".concat(index, "].value")
|
|
1100
|
+
});
|
|
844
1101
|
})]
|
|
845
1102
|
})
|
|
846
1103
|
});
|
|
@@ -968,7 +1225,7 @@ var Customize = function Customize(_ref) {
|
|
|
968
1225
|
className: "flex flex-col items-start gap-2",
|
|
969
1226
|
children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
970
1227
|
className: "absolute right-1 top-1 z-0",
|
|
971
|
-
icon:
|
|
1228
|
+
icon: Close__default["default"],
|
|
972
1229
|
size: "small",
|
|
973
1230
|
style: "text",
|
|
974
1231
|
onClick: function onClick() {
|
|
@@ -1017,7 +1274,7 @@ var Check = function Check(props) {
|
|
|
1017
1274
|
children: [/*#__PURE__*/jsxRuntime.jsxs("g", {
|
|
1018
1275
|
filter: "url(#filter0_d_9519_161)",
|
|
1019
1276
|
children: [/*#__PURE__*/jsxRuntime.jsx("rect", {
|
|
1020
|
-
fill: "#
|
|
1277
|
+
fill: "#008068",
|
|
1021
1278
|
height: "20",
|
|
1022
1279
|
rx: "10",
|
|
1023
1280
|
width: "20",
|
|
@@ -1418,7 +1675,8 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
1418
1675
|
var currentScreen = _ref.currentScreen,
|
|
1419
1676
|
handleBackPress = _ref.handleBackPress,
|
|
1420
1677
|
handleCreateNewTheme = _ref.handleCreateNewTheme,
|
|
1421
|
-
isNewTheme = _ref.isNewTheme
|
|
1678
|
+
isNewTheme = _ref.isNewTheme,
|
|
1679
|
+
themeToEdit = _ref.themeToEdit;
|
|
1422
1680
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1423
1681
|
t = _useTranslation.t;
|
|
1424
1682
|
if (currentScreen === DESIGN_SCREENS.Customize) {
|
|
@@ -1428,14 +1686,16 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
1428
1686
|
className: "flex items-center justify-start space-x-2",
|
|
1429
1687
|
children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
1430
1688
|
"data-cy": "customize-themes-back-button",
|
|
1431
|
-
icon:
|
|
1689
|
+
icon: LeftArrow__default["default"],
|
|
1432
1690
|
iconPosition: "left",
|
|
1433
1691
|
style: "text",
|
|
1434
1692
|
tooltipProps: {
|
|
1435
1693
|
content: t("neetoThemes.buttons.backToThemes"),
|
|
1436
1694
|
position: "top"
|
|
1437
1695
|
},
|
|
1438
|
-
onClick:
|
|
1696
|
+
onClick: function onClick() {
|
|
1697
|
+
return handleBackPress(themeToEdit);
|
|
1698
|
+
}
|
|
1439
1699
|
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1440
1700
|
"data-cy": "themes-header",
|
|
1441
1701
|
lineHeight: "normal",
|
|
@@ -1460,7 +1720,7 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
1460
1720
|
className: "self-end",
|
|
1461
1721
|
children: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
1462
1722
|
"data-cy": "customize-themes-add-theme-button",
|
|
1463
|
-
icon:
|
|
1723
|
+
icon: Plus__default["default"],
|
|
1464
1724
|
iconPosition: "left",
|
|
1465
1725
|
style: "text",
|
|
1466
1726
|
tooltipProps: {
|
|
@@ -1476,7 +1736,7 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
1476
1736
|
|
|
1477
1737
|
var MemoizedAlert = /*#__PURE__*/react.memo(Alert__default["default"]);
|
|
1478
1738
|
var Sidebar = function Sidebar(_ref) {
|
|
1479
|
-
var _themeToEdit$current, _themeToEdit$current2, _themeToDelete$curren2, _themeToDelete$curren3;
|
|
1739
|
+
var _themeToEdit$current, _themeToEdit$current2, _themeToDelete$curren2, _themeToDelete$curren3, _themeToDelete$curren4;
|
|
1480
1740
|
var thumbnail = _ref.thumbnail,
|
|
1481
1741
|
onPropertiesChange = _ref.onPropertiesChange;
|
|
1482
1742
|
var _useState = react.useState(DESIGN_SCREENS.THEMES),
|
|
@@ -1499,12 +1759,14 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1499
1759
|
return {
|
|
1500
1760
|
entityType: store["entityType"],
|
|
1501
1761
|
entityId: store["entityId"],
|
|
1502
|
-
isFetchingSchema: store["isFetchingSchema"]
|
|
1762
|
+
isFetchingSchema: store["isFetchingSchema"],
|
|
1763
|
+
defaultThemeName: store["defaultThemeName"]
|
|
1503
1764
|
};
|
|
1504
1765
|
}, shallow.shallow),
|
|
1505
1766
|
entityType = _useConfigStore.entityType,
|
|
1506
1767
|
entityId = _useConfigStore.entityId,
|
|
1507
|
-
isFetchingSchema = _useConfigStore.isFetchingSchema
|
|
1768
|
+
isFetchingSchema = _useConfigStore.isFetchingSchema,
|
|
1769
|
+
defaultThemeName = _useConfigStore.defaultThemeName;
|
|
1508
1770
|
var _useThemeStore = useThemeStore(function (store) {
|
|
1509
1771
|
return {
|
|
1510
1772
|
setThemeState: store["setThemeState"]
|
|
@@ -1516,7 +1778,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1516
1778
|
t = _useTranslation.t;
|
|
1517
1779
|
var _useThemeUtils = useThemeUtils(),
|
|
1518
1780
|
setTheme = _useThemeUtils.setTheme;
|
|
1519
|
-
var _useListThemes = useListThemes(),
|
|
1781
|
+
var _useListThemes = useListThemes(entityId),
|
|
1520
1782
|
_useListThemes$data = _useListThemes.data,
|
|
1521
1783
|
_useListThemes$data2 = _useListThemes$data === void 0 ? {} : _useListThemes$data,
|
|
1522
1784
|
_useListThemes$data2$ = _useListThemes$data2.themes,
|
|
@@ -1537,6 +1799,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1537
1799
|
onSuccess: function onSuccess(_ref2) {
|
|
1538
1800
|
var theme = _ref2.theme;
|
|
1539
1801
|
setTheme(theme);
|
|
1802
|
+
highlightTheme(theme);
|
|
1540
1803
|
setThemeState({
|
|
1541
1804
|
previewingTheme: theme
|
|
1542
1805
|
});
|
|
@@ -1561,8 +1824,9 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1561
1824
|
entityType: entityType
|
|
1562
1825
|
});
|
|
1563
1826
|
};
|
|
1564
|
-
var handleBackPress = function handleBackPress() {
|
|
1827
|
+
var handleBackPress = function handleBackPress(theme) {
|
|
1565
1828
|
setTheme(currentTheme);
|
|
1829
|
+
highlightTheme(neetoCist.isPresent(theme) ? theme : currentTheme);
|
|
1566
1830
|
setThemeState({
|
|
1567
1831
|
previewingTheme: currentTheme
|
|
1568
1832
|
});
|
|
@@ -1572,10 +1836,10 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1572
1836
|
var highlightTheme = function highlightTheme(themeToHighlight) {
|
|
1573
1837
|
setTimeout(function () {
|
|
1574
1838
|
scrollElementIntoView(themeToHighlight.id);
|
|
1575
|
-
},
|
|
1839
|
+
}, 1000);
|
|
1576
1840
|
setTimeout(function () {
|
|
1577
1841
|
setThemeToHighlight(null);
|
|
1578
|
-
},
|
|
1842
|
+
}, 3500);
|
|
1579
1843
|
setThemeToHighlight(themeToHighlight.id);
|
|
1580
1844
|
};
|
|
1581
1845
|
var onCreateTheme = function onCreateTheme(createdTheme) {
|
|
@@ -1626,7 +1890,8 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1626
1890
|
handleCreateNewTheme: function handleCreateNewTheme() {
|
|
1627
1891
|
return handleEditTheme({});
|
|
1628
1892
|
},
|
|
1629
|
-
isNewTheme: !((_themeToEdit$current = themeToEdit.current) !== null && _themeToEdit$current !== void 0 && _themeToEdit$current.id)
|
|
1893
|
+
isNewTheme: !((_themeToEdit$current = themeToEdit.current) !== null && _themeToEdit$current !== void 0 && _themeToEdit$current.id),
|
|
1894
|
+
themeToEdit: themeToEdit.current
|
|
1630
1895
|
}), currentScreen === DESIGN_SCREENS.THEMES ? /*#__PURE__*/jsxRuntime.jsx(Themes, {
|
|
1631
1896
|
currentTheme: currentTheme,
|
|
1632
1897
|
defaultThemes: defaultThemes,
|
|
@@ -1656,7 +1921,10 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1656
1921
|
message: t("neetoThemes.alerts.message.deleteTheme", {
|
|
1657
1922
|
name: (_themeToDelete$curren2 = themeToDelete.current) === null || _themeToDelete$curren2 === void 0 ? void 0 : _themeToDelete$curren2.name,
|
|
1658
1923
|
count: (_themeToDelete$curren3 = themeToDelete.current) === null || _themeToDelete$curren3 === void 0 ? void 0 : _themeToDelete$curren3.appliedCount,
|
|
1659
|
-
|
|
1924
|
+
defaultThemeName: defaultThemeName,
|
|
1925
|
+
entityType: t("neetoThemes.entityType.".concat(entityType.toLowerCase()), {
|
|
1926
|
+
count: (_themeToDelete$curren4 = themeToDelete.current) === null || _themeToDelete$curren4 === void 0 ? void 0 : _themeToDelete$curren4.appliedCount
|
|
1927
|
+
})
|
|
1660
1928
|
}),
|
|
1661
1929
|
onClose: handleCloseDeleteAlert,
|
|
1662
1930
|
onSubmit: handleDeleteTheme
|
|
@@ -1669,7 +1937,9 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
1669
1937
|
entityType = _ref.entityType,
|
|
1670
1938
|
entityId = _ref.entityId,
|
|
1671
1939
|
thumbnail = _ref.thumbnail,
|
|
1672
|
-
onPropertiesChange = _ref.onPropertiesChange
|
|
1940
|
+
onPropertiesChange = _ref.onPropertiesChange,
|
|
1941
|
+
_ref$isTemplateThemes = _ref.isTemplateThemesEnabled,
|
|
1942
|
+
isTemplateThemesEnabled = _ref$isTemplateThemes === void 0 ? false : _ref$isTemplateThemes;
|
|
1673
1943
|
var _useThemeStore = useThemeStore(function (store) {
|
|
1674
1944
|
return {
|
|
1675
1945
|
isCurrentThemeLoading: store["isCurrentThemeLoading"]
|
|
@@ -1685,7 +1955,8 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
1685
1955
|
react.useEffect(function () {
|
|
1686
1956
|
setConfigState({
|
|
1687
1957
|
entityType: entityType,
|
|
1688
|
-
entityId: entityId
|
|
1958
|
+
entityId: entityId,
|
|
1959
|
+
isTemplateThemesEnabled: isTemplateThemesEnabled
|
|
1689
1960
|
});
|
|
1690
1961
|
}, []);
|
|
1691
1962
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -1706,7 +1977,7 @@ var index = reactUtils.withTitle(NeetoThemesBuilder, i18next.t("neetoThemes.comm
|
|
|
1706
1977
|
|
|
1707
1978
|
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}}
|
|
1708
1979
|
|
|
1709
|
-
var css = ".neeto-themes__wrapper{display:flex;width:100%}.neeto-themes__wrapper .neeto-themes-sidebar{background-color:rgb(var(--neeto-ui-white));
|
|
1980
|
+
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX3RoZW1lcy5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3R5bGVzaGVldHMvYXBwbGljYXRpb24uc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSx1QkFFRSxZQUFBLENBREEsVUNFRixDRENFLDZDQUdFLDJDQUFBLEN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bnQ7XG4gIG91dGxpbmU6IDJweCBzb2xpZCByZ2IodmFyKC0tbmVldG8tdWktZ3JheS00MDApKSAhaW1wb3J0YW50O1xufVxuXG4ubmVldG8tdGhlbWVzLXRoZW1lLXRodW1ibmFpbF9fYXBwbHktYnRuIHtcbiAgLS1uZWV0by11aS1idG4tcGFkZGluZy14OiAxMnB4O1xuICAtLW5lZXRvLXVpLWJ0bi1ib3JkZXItcmFkaXVzOiAxMDBweDtcbn1cbi5uZWV0by10aGVtZXMtdGhlbWUtdGh1bWJuYWlsX19hcHBseS1idG46ZGlzYWJsZWQsIC5uZWV0by10aGVtZXMtdGhlbWUtdGh1bWJuYWlsX19hcHBseS1idG5bZGlzYWJsZWRdIHtcbiAgb3BhY2l0eTogMSAhaW1wb3J0YW50O1xufSJdfQ== */";
|
|
1710
1981
|
n(css,{});
|
|
1711
1982
|
|
|
1712
1983
|
exports.NeetoThemesBuilder = index;
|