@bigbinary/neeto-themes-frontend 2.2.0 → 3.0.1
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 +12 -3
- package/dist/NeetoThemesBuilder.js +843 -469
- package/dist/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/NeetoThemesBuilder.js +896 -551
- package/dist/cjs/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/hooks.js +2 -4
- package/dist/cjs/hooks.js.map +1 -1
- package/dist/cjs/index.js +16 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils.js +2 -3
- package/dist/cjs/utils.js.map +1 -1
- package/dist/hooks.js +2 -2
- package/dist/{index-9e15a8b1.js → index-CvV1tFYS.js} +30 -7
- package/dist/index-CvV1tFYS.js.map +1 -0
- package/dist/{index-2666fca8.js → index-D6l2IgrM.js} +32 -14
- package/dist/index-D6l2IgrM.js.map +1 -0
- package/dist/index.js +16 -11
- package/dist/index.js.map +1 -1
- package/dist/{useThemeUtils-36f2ce5a.js → useThemeUtils-BCO-i9ZG.js} +5 -3
- package/dist/useThemeUtils-BCO-i9ZG.js.map +1 -0
- package/dist/{useThemeUtils-38895e4a.js → useThemeUtils-P5tn1h2B.js} +6 -8
- package/dist/useThemeUtils-P5tn1h2B.js.map +1 -0
- package/dist/utils.js +1 -1
- package/package.json +102 -97
- package/dist/index-2666fca8.js.map +0 -1
- package/dist/index-9e15a8b1.js.map +0 -1
- package/dist/useThemeUtils-36f2ce5a.js.map +0 -1
- package/dist/useThemeUtils-38895e4a.js.map +0 -1
|
@@ -1,52 +1,57 @@
|
|
|
1
1
|
import { shallow } from 'zustand/shallow';
|
|
2
|
-
import {
|
|
2
|
+
import { useState, useEffect, createElement, useRef, memo, useCallback } from 'react';
|
|
3
3
|
import { t as t$1 } from 'i18next';
|
|
4
|
-
import {
|
|
5
|
-
import { useMutationWithInvalidation, withT, withTitle } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
4
|
+
import { hyphenate, findBy, findIndexBy, isPresent, isNot, filterBy, snakeToCamelCase, isNotPresent, toLabelAndValue, humanize, isNotEmpty, noop } from '@bigbinary/neeto-cist';
|
|
5
|
+
import { useMutationWithInvalidation, withT, useBreakpoints, withTitle } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
6
6
|
import Spinner from '@bigbinary/neetoui/Spinner';
|
|
7
7
|
import { useQuery } from '@tanstack/react-query';
|
|
8
8
|
import axios from 'axios';
|
|
9
|
-
import { B as BASE_URL,
|
|
10
|
-
import { Q as QUERY_KEYS, a as useConfigStore, b as useThemeStore, u as useThemeUtils } from './useThemeUtils-
|
|
9
|
+
import { B as BASE_URL, b as scrollElementIntoView, c as setCustomCSS, g as getDominantColorFromUrl, i as isFunction } from './index-CvV1tFYS.js';
|
|
10
|
+
import { Q as QUERY_KEYS, a as useConfigStore, b as useThemeStore, u as useThemeUtils } from './useThemeUtils-BCO-i9ZG.js';
|
|
11
11
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
12
|
+
import classnames from 'classnames';
|
|
13
|
+
import Collapse from '@bigbinary/neeto-icons/Collapse';
|
|
12
14
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
15
|
+
import Button from '@bigbinary/neetoui/Button';
|
|
13
16
|
import { useTranslation, Trans } from 'react-i18next';
|
|
14
17
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
15
18
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
16
19
|
import Close from '@bigbinary/neeto-icons/Close';
|
|
17
|
-
import Button from '@bigbinary/neetoui/Button';
|
|
18
20
|
import Popover from '@bigbinary/neetoui/Popover';
|
|
19
21
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
22
|
+
import Switch from '@bigbinary/neetoui/Switch';
|
|
23
|
+
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
20
24
|
import Form from '@bigbinary/neetoui/formik/Form';
|
|
21
25
|
import * as yup from 'yup';
|
|
26
|
+
import Editor from '@monaco-editor/react';
|
|
22
27
|
import { useFormikContext, Field } from 'formik';
|
|
28
|
+
import Down from '@bigbinary/neeto-icons/Down';
|
|
23
29
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
24
|
-
import
|
|
25
|
-
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
26
|
-
import { ImageUploader } from '@bigbinary/neeto-image-uploader-frontend';
|
|
30
|
+
import { negate, isEmpty } from 'ramda';
|
|
27
31
|
import { joinHyphenCase } from '@bigbinary/neeto-commons-frontend/utils';
|
|
28
|
-
import Toastr from '@bigbinary/neetoui/Toastr';
|
|
29
|
-
import { isEmpty, negate } from 'ramda';
|
|
30
|
-
import Select from '@bigbinary/neetoui/Select';
|
|
31
32
|
import CenterAlign from '@bigbinary/neeto-icons/CenterAlign';
|
|
32
33
|
import LeftAlign from '@bigbinary/neeto-icons/LeftAlign';
|
|
33
34
|
import ColorPicker from '@bigbinary/neetoui/ColorPicker';
|
|
35
|
+
import Select from '@bigbinary/neetoui/Select';
|
|
34
36
|
import { Slider } from 'antd';
|
|
35
|
-
import classnames from 'classnames';
|
|
36
37
|
import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
|
|
37
|
-
import
|
|
38
|
+
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
39
|
+
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
40
|
+
import ImageUploader from '@bigbinary/neeto-image-uploader-frontend/ImageUploader';
|
|
41
|
+
import Toastr from '@bigbinary/neetoui/Toastr';
|
|
38
42
|
import Input from '@bigbinary/neetoui/formik/Input';
|
|
39
43
|
import Search from '@bigbinary/neeto-molecules/Search';
|
|
44
|
+
import Rating from '@bigbinary/neeto-icons/Rating';
|
|
40
45
|
import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
41
46
|
import LeftArrow from '@bigbinary/neeto-icons/LeftArrow';
|
|
42
47
|
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
43
48
|
import 'zustand';
|
|
44
49
|
|
|
45
|
-
var show$
|
|
50
|
+
var show$2 = function show(entityId) {
|
|
46
51
|
return axios.get("".concat(BASE_URL, "/api/v1/entities/").concat(entityId));
|
|
47
52
|
};
|
|
48
53
|
var entitiesApi = {
|
|
49
|
-
show: show$
|
|
54
|
+
show: show$2
|
|
50
55
|
};
|
|
51
56
|
|
|
52
57
|
var useShowThemeEntity = function useShowThemeEntity(entityId) {
|
|
@@ -61,7 +66,7 @@ var useShowThemeEntity = function useShowThemeEntity(entityId) {
|
|
|
61
66
|
|
|
62
67
|
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}}
|
|
63
68
|
|
|
64
|
-
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvdGhlbWVzLnNjc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsdUJBRUUsWUFBQSxDQURBLFVBQUYsQ0FHRSw2Q0FHRSwyQ0FBQSxDQURBLHlCQUFBLENBREEsV0FDSixDQUdJLDBCQUxGLDZDQU1JLFdBQUosQ0FDRixDQUNJLDBCQVJGLDZDQVNJLFdBRUosQ0FDRixDQUFJLDJFQUVFLGtCQUFBLENBREEsZ0JBR04sQ0FDSSwyRUFDRSwwQkFBQSxDQUNBLGVBQ04sQ0FFUSw0SUFDRSxZQUFWLENBTUUsc0RBR0UsV0FBQSxDQURBLHlCQUFBLENBREEsaUJBRkosQ0FRQSw4Q0FDRSxvREFBQSxDQUNBLHlEQUxGLENBUUEsc0NBQ0UsdURBQUEsQ0FDQSw0REFMRix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JltkaXNhYmxlZF0ge1xuICAgIG9wYWNpdHk6IDEgIWltcG9ydGFudDtcbiAgfVxufVxuIl19 */";
|
|
69
|
+
var css = ".neeto-themes__wrapper{display:flex;width:100%}.neeto-themes__wrapper .neeto-themes-sidebar{background-color:rgb(var(--neeto-ui-white));height:100%;left:0;padding-top:24px;position:fixed;top:0;transition:none;width:100%;z-index:102}.neeto-themes__wrapper .neeto-themes-sidebar--expanded{max-width:100%;width:520px!important}@media screen and (min-width:576px){.neeto-themes__wrapper .neeto-themes-sidebar{width:280px}}@media screen and (min-width:767px){.neeto-themes__wrapper .neeto-themes-sidebar{height:calc(100vh - 64px);padding-top:0;position:relative}}@media screen and (min-width:1024px){.neeto-themes__wrapper .neeto-themes-sidebar{width:320px}}@media screen and (min-width:1280px){.neeto-themes__wrapper .neeto-themes-sidebar{width:340px}}.neeto-themes__wrapper .neeto-themes-sidebar--collapsed{max-width:0;min-width:0;width:0}.neeto-themes__wrapper .neeto-themes-sidebar--collapsed .neeto-themes-sidebar__toggler{transform:scale(-1)}@media screen and (max-width:767px){.neeto-themes__wrapper .neeto-themes-sidebar--collapsed .neeto-themes-sidebar__toggler{top:109px}}@media screen and (max-width:576px){.neeto-themes__wrapper .neeto-themes-sidebar--collapsed .neeto-themes-sidebar__toggler{left:8px;right:auto}}.neeto-themes__wrapper .neeto-themes-sidebar--collapsed .neeto-themes-sidebar__header{display:none}.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 .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);display:flex}@media screen and (max-width:576px){.neeto-themes-sidebar__custom-css-editor-header{display:none}}.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}.neeto-themes-sidebar__backdrop{background-color:rgba(var(--neeto-ui-black),.4);display:none;height:100%;left:0;position:fixed;top:0;visibility:hidden;width:100%;z-index:101}@media screen and (max-width:767px){.neeto-themes-sidebar__backdrop{display:block;visibility:visible}}.neeto-themes-sidebar__toggler{flex-shrink:0;left:calc(100% + 8px);position:absolute;top:8px;transition:color .3s ease-in-out}@media screen and (min-width:1024px){.neeto-themes-sidebar__toggler{opacity:0;pointer-events:none}}@media screen and (max-width:576px){.neeto-themes-sidebar__toggler{left:auto;right:24px}}.neeto-themes-nano-alignment-block{border-radius:6px}.neeto-themes-nano-alignment-button{--neeto-ui-btn-padding-x:12px!important}.neeto-themes-nano-alignment-button__alignment-left{border-bottom-right-radius:0!important;border-top-right-radius:0!important}.neeto-themes-nano-alignment-button__alignment-center{border-bottom-left-radius:0!important;border-top-left-radius:0!important}.neeto-themes-nano-alignment-button.neeto-ui-btn--style-primary{--neeto-ui-btn-bg-color:rgb(var(--neeto-ui-primary-100))!important;--neeto-ui-btn-hover-bg-color:rgb(var(--neeto-ui-primary-100))!important}.neeto-themes-nano-alignment-divider{background:rgb(var(--neeto-ui-gray-200));height:32px;width:1px}.neeto-themes-nano-section__content--open{max-height:1500px;opacity:1;padding-top:4px;visibility:visible}.neeto-themes-nano-section__content--closed{max-height:0;opacity:0;visibility:hidden}.neeto-themes-nano-section__title:focus-visible{box-shadow:0 0 0 3px rgba(var(--neeto-ui-primary-500),15%)}.neeto-themes-nano-global-theme-icon{fill:rgb(var(--neeto-ui-warning-100));color:rgb(var(--neeto-ui-warning-500))}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvdGhlbWVzLnNjc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsdUJBRUUsWUFBQSxDQURBLFVBQUYsQ0FHRSw2Q0FHRSwyQ0FBQSxDQURBLFdBQUEsQ0FJQSxNQUFBLENBR0EsZ0JBQUEsQ0FMQSxjQUFBLENBQ0EsS0FBQSxDQUVBLGVBQUEsQ0FOQSxVQUFBLENBT0EsV0FBSixDQUdJLHVEQUVFLGNBQUEsQ0FEQSxxQkFBTixDQUlJLG9DQWhCRiw2Q0FpQkksV0FESixDQUNGLENBR0ksb0NBcEJGLDZDQXVCSSx5QkFBQSxDQUZBLGFBQUEsQ0FDQSxpQkFDSixDQUNGLENBRUkscUNBMUJGLDZDQTJCSSxXQUNKLENBQ0YsQ0FDSSxxQ0E5QkYsNkNBK0JJLFdBRUosQ0FDRixDQUFJLHdEQUVFLFdBQUEsQ0FDQSxXQUFBLENBRkEsT0FJTixDQU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HJnYih2YXIoLS1uZWV0by11aS1ncmF5LTIwMCkpO1xufVxuXG4ubmVldG8tdGhlbWVzLW5hbm8tc2VjdGlvbl9fY29udGVudCB7XG4gICYtLW9wZW4ge1xuICAgIG1heC1oZWlnaHQ6IDE1MDBweDtcbiAgICBvcGFjaXR5OiAxO1xuICAgIHZpc2liaWxpdHk6IHZpc2libGU7XG4gICAgcGFkZGluZy10b3A6IDRweDtcbiAgfVxuICAmLS1jbG9zZWQge1xuICAgIG1heC1oZWlnaHQ6IDBweDtcbiAgICBvcGFjaXR5OiAwO1xuICAgIHZpc2liaWxpdHk6IGhpZGRlbjtcbiAgfVxufVxuXG4ubmVldG8tdGhlbWVzLW5hbm8tc2VjdGlvbl9fdGl0bGU6Zm9jdXMtdmlzaWJsZSB7XG4gIGJveC1zaGFkb3c6IDAgMCAwIDNweCByZ2JhKHZhcigtLW5lZXRvLXVpLXByaW1hcnktNTAwKSwgMTUlKTtcbn1cblxuLm5lZXRvLXRoZW1lcy1uYW5vLWdsb2JhbC10aGVtZS1pY29uIHtcbiAgY29sb3I6IHJnYih2YXIoLS1uZWV0by11aS13YXJuaW5nLTUwMCkpO1xuICBmaWxsOiByZ2IodmFyKC0tbmVldG8tdWktd2FybmluZy0xMDApKTtcbn1cbiJdfQ== */";
|
|
65
70
|
n(css,{});
|
|
66
71
|
|
|
67
72
|
var _excluded$1 = ["themeId"];
|
|
@@ -72,7 +77,7 @@ var list = function list(entityId) {
|
|
|
72
77
|
}
|
|
73
78
|
});
|
|
74
79
|
};
|
|
75
|
-
var show = function show(id) {
|
|
80
|
+
var show$1 = function show(id) {
|
|
76
81
|
return axios.get("".concat(BASE_URL, "/api/v1/themes/").concat(id));
|
|
77
82
|
};
|
|
78
83
|
var create = function create(payload) {
|
|
@@ -100,14 +105,22 @@ var apply = function apply(_ref2) {
|
|
|
100
105
|
entity: payload
|
|
101
106
|
});
|
|
102
107
|
};
|
|
108
|
+
var applyGlobalTheme = function applyGlobalTheme(_ref3) {
|
|
109
|
+
var themeId = _ref3.themeId,
|
|
110
|
+
payload = _ref3.payload;
|
|
111
|
+
return axios.post("".concat(BASE_URL, "/api/v1/themes/").concat(themeId, "/apply_global_theme"), {
|
|
112
|
+
theme: payload
|
|
113
|
+
});
|
|
114
|
+
};
|
|
103
115
|
var themesApi = {
|
|
104
116
|
list: list,
|
|
105
|
-
show: show,
|
|
117
|
+
show: show$1,
|
|
106
118
|
create: create,
|
|
107
119
|
update: update,
|
|
108
120
|
destroy: destroy,
|
|
109
121
|
clone: clone,
|
|
110
|
-
apply: apply
|
|
122
|
+
apply: apply,
|
|
123
|
+
applyGlobalTheme: applyGlobalTheme
|
|
111
124
|
};
|
|
112
125
|
|
|
113
126
|
var useListThemes = function useListThemes(entityId) {
|
|
@@ -127,7 +140,7 @@ var useListThemes = function useListThemes(entityId) {
|
|
|
127
140
|
};
|
|
128
141
|
var useCreateTheme = function useCreateTheme() {
|
|
129
142
|
return useMutationWithInvalidation(themesApi.create, {
|
|
130
|
-
keysToInvalidate: [QUERY_KEYS.THEMES_LIST]
|
|
143
|
+
keysToInvalidate: [[QUERY_KEYS.THEMES_LIST], [QUERY_KEYS.GLOBAL_THEME_DETAILS]]
|
|
131
144
|
});
|
|
132
145
|
};
|
|
133
146
|
var useUpdateTheme = function useUpdateTheme(themeId) {
|
|
@@ -137,7 +150,7 @@ var useUpdateTheme = function useUpdateTheme(themeId) {
|
|
|
137
150
|
payload: payload
|
|
138
151
|
});
|
|
139
152
|
}, {
|
|
140
|
-
keysToInvalidate: [[QUERY_KEYS.THEMES_LIST], [QUERY_KEYS.THEME_ENTITY_DETAILS], [QUERY_KEYS.THEME_DETAILS, themeId]]
|
|
153
|
+
keysToInvalidate: [[QUERY_KEYS.THEMES_LIST], [QUERY_KEYS.THEME_ENTITY_DETAILS], [QUERY_KEYS.THEME_DETAILS, themeId], [QUERY_KEYS.GLOBAL_THEME_DETAILS]]
|
|
141
154
|
});
|
|
142
155
|
};
|
|
143
156
|
var useDeleteTheme = function useDeleteTheme() {
|
|
@@ -157,6 +170,32 @@ var useApplyTheme = function useApplyTheme(_ref) {
|
|
|
157
170
|
onSuccess: onSuccess
|
|
158
171
|
});
|
|
159
172
|
};
|
|
173
|
+
var useApplyGlobalTheme = function useApplyGlobalTheme() {
|
|
174
|
+
return useMutationWithInvalidation(themesApi.applyGlobalTheme, {
|
|
175
|
+
keysToInvalidate: [[QUERY_KEYS.GLOBAL_THEME_DETAILS]]
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
var show = function show(entityType) {
|
|
180
|
+
return axios.get("".concat(BASE_URL, "/api/v1/global_theme"), {
|
|
181
|
+
params: {
|
|
182
|
+
entity_type: entityType
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
var globalThemesApi = {
|
|
187
|
+
show: show
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
var useShowGlobalTheme = function useShowGlobalTheme(entityType) {
|
|
191
|
+
return useQuery({
|
|
192
|
+
queryKey: [QUERY_KEYS.GLOBAL_THEME_DETAILS, entityType],
|
|
193
|
+
queryFn: function queryFn() {
|
|
194
|
+
return globalThemesApi.show(entityType);
|
|
195
|
+
},
|
|
196
|
+
enabled: !!entityType
|
|
197
|
+
});
|
|
198
|
+
};
|
|
160
199
|
|
|
161
200
|
var POSITION_OPTIONS = [{
|
|
162
201
|
label: "Left",
|
|
@@ -225,6 +264,12 @@ var FONT_OPTIONS = [{
|
|
|
225
264
|
}, {
|
|
226
265
|
label: "Dancing Script",
|
|
227
266
|
value: "Dancing Script, cursive"
|
|
267
|
+
}, {
|
|
268
|
+
label: "Tw Cent",
|
|
269
|
+
value: "Tw Cen MT, Tahoma, sans-serif"
|
|
270
|
+
}, {
|
|
271
|
+
label: "Comic Sans",
|
|
272
|
+
value: "Comic Sans MS, cursive"
|
|
228
273
|
}];
|
|
229
274
|
var THEME_VALIDATION_SCHEMA = yup.object().shape({
|
|
230
275
|
name: yup.string().required("Name is required")
|
|
@@ -233,7 +278,154 @@ var OVERLAY_OPACITY_SLIDER_MARKS = {
|
|
|
233
278
|
0: " "
|
|
234
279
|
};
|
|
235
280
|
var HUNDRED = 100;
|
|
281
|
+
var ACCORDIAN_OPEN_STATE = {
|
|
282
|
+
name: true,
|
|
283
|
+
style: true,
|
|
284
|
+
images: false,
|
|
285
|
+
customcss: false
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
var DESIGN_SCREENS = {
|
|
289
|
+
THEMES: "Themes",
|
|
290
|
+
Customize: "Customize",
|
|
291
|
+
CustomCSS: "CustomCSS"
|
|
292
|
+
};
|
|
293
|
+
var ONE_MEGABYTE = 1;
|
|
294
|
+
|
|
295
|
+
function ownKeys$5(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; }
|
|
296
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
297
|
+
var Card$2 = function Card(_ref) {
|
|
298
|
+
var _ref$title = _ref.title,
|
|
299
|
+
title = _ref$title === void 0 ? "" : _ref$title,
|
|
300
|
+
children = _ref.children,
|
|
301
|
+
name = _ref.name,
|
|
302
|
+
className = _ref.className;
|
|
303
|
+
var _useState = useState(ACCORDIAN_OPEN_STATE),
|
|
304
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
305
|
+
accordianOpenState = _useState2[0],
|
|
306
|
+
setAccordianOpenState = _useState2[1];
|
|
307
|
+
return /*#__PURE__*/jsxs("div", {
|
|
308
|
+
"data-cy": "theme-".concat(hyphenate(title), "-properties"),
|
|
309
|
+
className: classnames("neeto-themes-nano-section neeto-ui-border-gray-200 border-b pt-2 transition-all duration-300 last:border-none", className, {
|
|
310
|
+
"pb-2": !accordianOpenState[name],
|
|
311
|
+
"pb-3": accordianOpenState[name]
|
|
312
|
+
}),
|
|
313
|
+
children: [title && /*#__PURE__*/jsxs("button", {
|
|
314
|
+
className: "neeto-themes-nano-section__title flex w-full cursor-pointer items-center justify-between px-1 py-2 focus:outline-none",
|
|
315
|
+
type: "button",
|
|
316
|
+
onClick: function onClick() {
|
|
317
|
+
return setAccordianOpenState(_objectSpread$5(_objectSpread$5({}, accordianOpenState), {}, _defineProperty({}, name, !accordianOpenState[name])));
|
|
318
|
+
},
|
|
319
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
320
|
+
className: "min-w-0 flex-grow text-left",
|
|
321
|
+
component: "span",
|
|
322
|
+
"data-cy": "theme-properties",
|
|
323
|
+
lineHeight: "normal",
|
|
324
|
+
style: "h4",
|
|
325
|
+
weight: "semibold",
|
|
326
|
+
children: title
|
|
327
|
+
}), /*#__PURE__*/jsx(Down, {
|
|
328
|
+
size: 20,
|
|
329
|
+
className: classnames("transition-all duration-300", {
|
|
330
|
+
"rotate-180": accordianOpenState[name]
|
|
331
|
+
})
|
|
332
|
+
})]
|
|
333
|
+
}), children && /*#__PURE__*/jsx("div", {
|
|
334
|
+
className: classnames("neeto-themes-nano-section__content w-full space-y-3 overflow-hidden px-1 transition-all duration-300", {
|
|
335
|
+
"neeto-themes-nano-section__content--closed": !accordianOpenState[name],
|
|
336
|
+
"neeto-themes-nano-section__content--open pb-1": accordianOpenState[name]
|
|
337
|
+
}),
|
|
338
|
+
children: children
|
|
339
|
+
})]
|
|
340
|
+
});
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
var isScreenCustomCSS = function isScreenCustomCSS(screen) {
|
|
344
|
+
return screen === DESIGN_SCREENS.CustomCSS;
|
|
345
|
+
};
|
|
236
346
|
|
|
347
|
+
var CustomCSS = function CustomCSS(_ref) {
|
|
348
|
+
var onEditCSSClick = _ref.onEditCSSClick,
|
|
349
|
+
currentScreen = _ref.currentScreen;
|
|
350
|
+
var _useTranslation = useTranslation(),
|
|
351
|
+
t = _useTranslation.t;
|
|
352
|
+
var _useFormikContext = useFormikContext(),
|
|
353
|
+
values = _useFormikContext.values,
|
|
354
|
+
setFieldValue = _useFormikContext.setFieldValue;
|
|
355
|
+
var _useConfigStore = useConfigStore(function (store) {
|
|
356
|
+
return {
|
|
357
|
+
themePropertiesSchema: store["themePropertiesSchema"]
|
|
358
|
+
};
|
|
359
|
+
}, shallow),
|
|
360
|
+
themePropertiesSchema = _useConfigStore.themePropertiesSchema;
|
|
361
|
+
var customCSS = findBy({
|
|
362
|
+
kind: "custom_css"
|
|
363
|
+
}, values.properties);
|
|
364
|
+
if (!customCSS) return null;
|
|
365
|
+
var parentElementClass = findBy({
|
|
366
|
+
kind: "custom_css"
|
|
367
|
+
}, themePropertiesSchema).parentClass;
|
|
368
|
+
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
369
|
+
var handleEditorToggle = function handleEditorToggle() {
|
|
370
|
+
if (!isCustomCssScreen) return onEditCSSClick(DESIGN_SCREENS.CustomCSS);
|
|
371
|
+
onEditCSSClick(DESIGN_SCREENS.Customize);
|
|
372
|
+
return setTimeout(function () {
|
|
373
|
+
scrollElementIntoView("css-editor");
|
|
374
|
+
}, 400);
|
|
375
|
+
};
|
|
376
|
+
var handleChange = function handleChange(value) {
|
|
377
|
+
var index = findIndexBy({
|
|
378
|
+
key: customCSS.key
|
|
379
|
+
}, values.properties);
|
|
380
|
+
if (index !== -1 && values.properties[index].value !== value) {
|
|
381
|
+
setFieldValue("properties[".concat(index, "].value"), value);
|
|
382
|
+
setCustomCSS({
|
|
383
|
+
css: value,
|
|
384
|
+
elementId: customCSS.key,
|
|
385
|
+
parentElementClass: parentElementClass
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
return /*#__PURE__*/jsx("div", {
|
|
390
|
+
className: "neeto-themes-sidebar__custom-css-wrapper",
|
|
391
|
+
id: "css-editor",
|
|
392
|
+
children: /*#__PURE__*/jsx(Card$2, {
|
|
393
|
+
name: "customcss",
|
|
394
|
+
title: isCustomCssScreen ? "" : t("neetoThemes.build.leftSideBar.themes.customCSS"),
|
|
395
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
396
|
+
className: "w-full",
|
|
397
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
398
|
+
className: "neeto-themes-sidebar__custom-css-editor-header w-full justify-end gap-1 rounded-b-none p-2",
|
|
399
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
400
|
+
size: "small",
|
|
401
|
+
style: "secondary",
|
|
402
|
+
label: isCustomCssScreen ? t("neetoThemes.buttons.minimizeEditor") : t("neetoThemes.buttons.expandEditor"),
|
|
403
|
+
onClick: handleEditorToggle
|
|
404
|
+
})
|
|
405
|
+
}), /*#__PURE__*/jsx(Editor, {
|
|
406
|
+
language: "css",
|
|
407
|
+
theme: "vs-dark",
|
|
408
|
+
value: customCSS.value,
|
|
409
|
+
className: classnames({
|
|
410
|
+
rounded: true,
|
|
411
|
+
"css-editor-height__expanded": isCustomCssScreen,
|
|
412
|
+
"css-editor-height__regular": !isCustomCssScreen
|
|
413
|
+
}),
|
|
414
|
+
options: {
|
|
415
|
+
scrollBeyondLastLine: false,
|
|
416
|
+
minimap: {
|
|
417
|
+
enabled: false
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
onChange: handleChange
|
|
421
|
+
})]
|
|
422
|
+
})
|
|
423
|
+
})
|
|
424
|
+
});
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
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; }
|
|
428
|
+
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(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; }
|
|
237
429
|
var buildInitialValues = function buildInitialValues(theme, themePropertiesSchema) {
|
|
238
430
|
if (isPresent(theme)) return theme;
|
|
239
431
|
return {
|
|
@@ -241,56 +433,92 @@ var buildInitialValues = function buildInitialValues(theme, themePropertiesSchem
|
|
|
241
433
|
properties: themePropertiesSchema.map(function (_ref) {
|
|
242
434
|
var key = _ref.key,
|
|
243
435
|
kind = _ref.kind,
|
|
244
|
-
defaultValue = _ref.defaultValue
|
|
436
|
+
defaultValue = _ref.defaultValue,
|
|
437
|
+
_ref$order = _ref.order,
|
|
438
|
+
order = _ref$order === void 0 ? null : _ref$order,
|
|
439
|
+
dependsOn = _ref.dependsOn;
|
|
245
440
|
switch (kind) {
|
|
246
441
|
case "color":
|
|
247
|
-
return {
|
|
442
|
+
return _objectSpread$4({
|
|
248
443
|
value: defaultValue,
|
|
249
444
|
kind: "color",
|
|
250
|
-
key: key
|
|
251
|
-
|
|
445
|
+
key: key,
|
|
446
|
+
dependsOn: dependsOn
|
|
447
|
+
}, order !== null && {
|
|
448
|
+
order: order
|
|
449
|
+
});
|
|
252
450
|
case "font_family":
|
|
253
|
-
return {
|
|
451
|
+
return _objectSpread$4({
|
|
254
452
|
value: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
|
|
255
453
|
kind: "font_family",
|
|
256
|
-
key: key
|
|
257
|
-
|
|
454
|
+
key: key,
|
|
455
|
+
dependsOn: dependsOn
|
|
456
|
+
}, order !== null && {
|
|
457
|
+
order: order
|
|
458
|
+
});
|
|
258
459
|
case "overlay_opacity":
|
|
259
|
-
return {
|
|
460
|
+
return _objectSpread$4({
|
|
260
461
|
value: 0,
|
|
261
462
|
kind: "overlay_opacity",
|
|
262
|
-
key: key
|
|
263
|
-
|
|
463
|
+
key: key,
|
|
464
|
+
dependsOn: dependsOn
|
|
465
|
+
}, order !== null && {
|
|
466
|
+
order: order
|
|
467
|
+
});
|
|
264
468
|
case "slider":
|
|
265
|
-
return {
|
|
469
|
+
return _objectSpread$4({
|
|
266
470
|
value: 0,
|
|
267
471
|
kind: "slider",
|
|
268
|
-
key: key
|
|
269
|
-
|
|
472
|
+
key: key,
|
|
473
|
+
dependsOn: dependsOn
|
|
474
|
+
}, order !== null && {
|
|
475
|
+
order: order
|
|
476
|
+
});
|
|
270
477
|
case "radius":
|
|
271
|
-
return {
|
|
478
|
+
return _objectSpread$4({
|
|
272
479
|
value: defaultValue,
|
|
273
480
|
kind: "radius",
|
|
274
|
-
key: key
|
|
275
|
-
|
|
481
|
+
key: key,
|
|
482
|
+
dependsOn: dependsOn
|
|
483
|
+
}, order !== null && {
|
|
484
|
+
order: order
|
|
485
|
+
});
|
|
276
486
|
case "boolean":
|
|
277
|
-
return {
|
|
487
|
+
return _objectSpread$4({
|
|
278
488
|
value: String(defaultValue),
|
|
279
489
|
kind: "boolean",
|
|
280
|
-
key: key
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
490
|
+
key: key,
|
|
491
|
+
dependsOn: dependsOn
|
|
492
|
+
}, order !== null && {
|
|
493
|
+
order: order
|
|
494
|
+
});
|
|
495
|
+
case "order_selector":
|
|
496
|
+
return _objectSpread$4({
|
|
284
497
|
value: defaultValue,
|
|
285
|
-
kind: "
|
|
286
|
-
key: key
|
|
287
|
-
|
|
498
|
+
kind: "order_selector",
|
|
499
|
+
key: key,
|
|
500
|
+
dependsOn: dependsOn
|
|
501
|
+
}, order !== null && {
|
|
502
|
+
order: order
|
|
503
|
+
});
|
|
288
504
|
case "alignment_block":
|
|
289
|
-
return {
|
|
505
|
+
return _objectSpread$4({
|
|
290
506
|
value: defaultValue,
|
|
291
507
|
kind: "alignment_block",
|
|
292
|
-
key: key
|
|
293
|
-
|
|
508
|
+
key: key,
|
|
509
|
+
dependsOn: dependsOn
|
|
510
|
+
}, order !== null && {
|
|
511
|
+
order: order
|
|
512
|
+
});
|
|
513
|
+
case "custom_css":
|
|
514
|
+
return _objectSpread$4({
|
|
515
|
+
value: defaultValue,
|
|
516
|
+
kind: "custom_css",
|
|
517
|
+
key: key,
|
|
518
|
+
dependsOn: dependsOn
|
|
519
|
+
}, order !== null && {
|
|
520
|
+
order: order
|
|
521
|
+
});
|
|
294
522
|
default:
|
|
295
523
|
return null;
|
|
296
524
|
}
|
|
@@ -330,190 +558,29 @@ var isPropertyVisible = function isPropertyVisible(key, formikValues, themePrope
|
|
|
330
558
|
return isPresent(dependentProperty === null || dependentProperty === void 0 ? void 0 : dependentProperty.value);
|
|
331
559
|
};
|
|
332
560
|
var buildLabel = function buildLabel(key, kind) {
|
|
333
|
-
return t$1("neetoThemes.properties.".concat(snakeToCamelCase(kind), ".").concat(snakeToCamelCase(key)));
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
var Card$2 = function Card(_ref) {
|
|
337
|
-
var _ref$title = _ref.title,
|
|
338
|
-
title = _ref$title === void 0 ? "" : _ref$title,
|
|
339
|
-
children = _ref.children;
|
|
340
|
-
return /*#__PURE__*/jsxs("div", {
|
|
341
|
-
className: "neeto-ui-border-gray-300 neeto-ui-rounded-lg neeto-ui-bg-white space-y-3 border p-4",
|
|
342
|
-
"data-cy": "theme-".concat(hyphenate(title), "-properties"),
|
|
343
|
-
children: [title && /*#__PURE__*/jsx("div", {
|
|
344
|
-
className: "flex items-center justify-between",
|
|
345
|
-
children: /*#__PURE__*/jsx(Typography, {
|
|
346
|
-
"data-cy": "theme-properties",
|
|
347
|
-
lineHeight: "normal",
|
|
348
|
-
style: "h4",
|
|
349
|
-
weight: "semibold",
|
|
350
|
-
children: title
|
|
351
|
-
})
|
|
352
|
-
}), children && /*#__PURE__*/jsx("div", {
|
|
353
|
-
className: "space-y-4",
|
|
354
|
-
children: children
|
|
355
|
-
})]
|
|
356
|
-
});
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
var SelectBlock = function SelectBlock(_ref) {
|
|
360
|
-
var label = _ref.label,
|
|
361
|
-
_ref$placeholder = _ref.placeholder,
|
|
362
|
-
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
363
|
-
value = _ref.value,
|
|
364
|
-
options = _ref.options,
|
|
365
|
-
onChange = _ref.onChange;
|
|
366
|
-
return /*#__PURE__*/jsxs("div", {
|
|
367
|
-
className: "flex items-center justify-between py-3 first:pt-0 last:pb-0",
|
|
368
|
-
"data-cy": "theme-style-".concat(joinHyphenCase(label)),
|
|
369
|
-
children: [/*#__PURE__*/jsx(Typography, {
|
|
370
|
-
"data-cy": "logo-field-labels",
|
|
371
|
-
style: "body2",
|
|
372
|
-
children: label
|
|
373
|
-
}), /*#__PURE__*/jsx("div", {
|
|
374
|
-
className: "w-40",
|
|
375
|
-
children: /*#__PURE__*/jsx(Select, {
|
|
376
|
-
onChange: onChange,
|
|
377
|
-
options: options,
|
|
378
|
-
placeholder: placeholder,
|
|
379
|
-
value: value
|
|
380
|
-
})
|
|
381
|
-
})]
|
|
382
|
-
});
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
var DESIGN_SCREENS = {
|
|
386
|
-
THEMES: "Themes",
|
|
387
|
-
Customize: "Customize"
|
|
388
|
-
};
|
|
389
|
-
var ONE_MEGABYTE = 1;
|
|
390
|
-
|
|
391
|
-
var ImageBlock = function ImageBlock(_ref) {
|
|
392
|
-
var _findBy;
|
|
393
|
-
var label = _ref.label,
|
|
394
|
-
name = _ref.name,
|
|
395
|
-
_ref$imageData = _ref.imageData,
|
|
396
|
-
imageData = _ref$imageData === void 0 ? {} : _ref$imageData,
|
|
397
|
-
_ref$uploadConfig = _ref.uploadConfig,
|
|
398
|
-
uploadConfig = _ref$uploadConfig === void 0 ? {
|
|
399
|
-
maxImageSize: ONE_MEGABYTE
|
|
400
|
-
} : _ref$uploadConfig,
|
|
401
|
-
attribute = _ref.attribute;
|
|
402
|
-
var _useTranslation = useTranslation(),
|
|
403
|
-
t = _useTranslation.t;
|
|
404
|
-
var _useFormikContext = useFormikContext(),
|
|
405
|
-
setFieldValue = _useFormikContext.setFieldValue,
|
|
406
|
-
values = _useFormikContext.values;
|
|
407
|
-
var _useConfigStore = useConfigStore(function (store) {
|
|
408
|
-
return {
|
|
409
|
-
themePropertiesSchema: store["themePropertiesSchema"]
|
|
410
|
-
};
|
|
411
|
-
}, shallow),
|
|
412
|
-
themePropertiesSchema = _useConfigStore.themePropertiesSchema;
|
|
413
|
-
var propertySchema = findBy({
|
|
414
|
-
key: attribute
|
|
415
|
-
}, themePropertiesSchema);
|
|
416
|
-
var enablePositionChanger = (propertySchema === null || propertySchema === void 0 ? void 0 : propertySchema.enablePositionChanger) || false;
|
|
417
|
-
var options = propertySchema === null || propertySchema === void 0 ? void 0 : propertySchema.options;
|
|
418
|
-
var positionKeyInSchema = findBy({
|
|
419
|
-
key: "".concat(name, "_position")
|
|
420
|
-
}, themePropertiesSchema);
|
|
421
|
-
var isPositionChangerVisible = enablePositionChanger && (imageData === null || imageData === void 0 ? void 0 : imageData.url) && isPresent(positionKeyInSchema);
|
|
422
|
-
var positionKeyIndex = findIndexBy({
|
|
423
|
-
key: "".concat(name, "_position")
|
|
424
|
-
}, values.properties);
|
|
425
|
-
var handleImageChange = /*#__PURE__*/function () {
|
|
426
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(image) {
|
|
427
|
-
var dominantColor;
|
|
428
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
429
|
-
while (1) switch (_context.prev = _context.next) {
|
|
430
|
-
case 0:
|
|
431
|
-
_context.prev = 0;
|
|
432
|
-
if (!(isEmpty(image.signedId) || isEmpty(image.url))) {
|
|
433
|
-
_context.next = 4;
|
|
434
|
-
break;
|
|
435
|
-
}
|
|
436
|
-
setFieldValue(name, {
|
|
437
|
-
signedId: null,
|
|
438
|
-
url: image.url
|
|
439
|
-
});
|
|
440
|
-
return _context.abrupt("return");
|
|
441
|
-
case 4:
|
|
442
|
-
_context.next = 6;
|
|
443
|
-
return getDominantColorFromUrl(image.url);
|
|
444
|
-
case 6:
|
|
445
|
-
dominantColor = _context.sent;
|
|
446
|
-
setFieldValue(name, {
|
|
447
|
-
signedId: image.signedId,
|
|
448
|
-
url: image.url,
|
|
449
|
-
dominantColor: dominantColor
|
|
450
|
-
});
|
|
451
|
-
_context.next = 13;
|
|
452
|
-
break;
|
|
453
|
-
case 10:
|
|
454
|
-
_context.prev = 10;
|
|
455
|
-
_context.t0 = _context["catch"](0);
|
|
456
|
-
Toastr.error(_context.t0);
|
|
457
|
-
case 13:
|
|
458
|
-
case "end":
|
|
459
|
-
return _context.stop();
|
|
460
|
-
}
|
|
461
|
-
}, _callee, null, [[0, 10]]);
|
|
462
|
-
}));
|
|
463
|
-
return function handleImageChange(_x) {
|
|
464
|
-
return _ref2.apply(this, arguments);
|
|
465
|
-
};
|
|
466
|
-
}();
|
|
467
|
-
return /*#__PURE__*/jsxs("div", {
|
|
468
|
-
className: "space-y-3 py-3 first:pt-0 last:pb-0",
|
|
469
|
-
"data-cy": "theme-style-".concat(joinHyphenCase(label)),
|
|
470
|
-
children: [label && /*#__PURE__*/jsx("div", {
|
|
471
|
-
className: "flex items-center justify-between",
|
|
472
|
-
children: /*#__PURE__*/jsx(Typography, {
|
|
473
|
-
"data-cy": "style-fields-labels",
|
|
474
|
-
style: "body2",
|
|
475
|
-
children: label
|
|
476
|
-
})
|
|
477
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
478
|
-
className: "space-y-3 divide-y divide-gray-200",
|
|
479
|
-
children: [/*#__PURE__*/createElement(ImageUploader, {
|
|
480
|
-
uploadConfig: uploadConfig,
|
|
481
|
-
className: "h-40 w-full",
|
|
482
|
-
key: imageData === null || imageData === void 0 ? void 0 : imageData.url,
|
|
483
|
-
src: imageData === null || imageData === void 0 ? void 0 : imageData.url,
|
|
484
|
-
onUploadComplete: handleImageChange
|
|
485
|
-
}), isPositionChangerVisible && /*#__PURE__*/jsx(SelectBlock, {
|
|
486
|
-
label: buildLabel("".concat(name, "Position"), "image"),
|
|
487
|
-
options: options || POSITION_OPTIONS,
|
|
488
|
-
placeholder: t("neetoThemes.common.left"),
|
|
489
|
-
value: toLabelAndValue(((_findBy = findBy({
|
|
490
|
-
key: "".concat(name, "_position")
|
|
491
|
-
}, values.properties)) === null || _findBy === void 0 ? void 0 : _findBy.value) || (positionKeyInSchema === null || positionKeyInSchema === void 0 ? void 0 : positionKeyInSchema.defaultValue)),
|
|
492
|
-
onChange: function onChange(option) {
|
|
493
|
-
return setFieldValue("properties[".concat(positionKeyIndex, "].value"), option.value);
|
|
494
|
-
}
|
|
495
|
-
})]
|
|
496
|
-
})]
|
|
497
|
-
});
|
|
561
|
+
return t$1("neetoThemes.properties.".concat(snakeToCamelCase(kind), ".").concat(snakeToCamelCase(key)));
|
|
498
562
|
};
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
563
|
+
var buildProperties = function buildProperties(values, condition, themePropertiesSchema) {
|
|
564
|
+
values.forEach(function (value) {
|
|
565
|
+
themePropertiesSchema.forEach(function (theme) {
|
|
566
|
+
if (!(value.key === theme.key)) return;
|
|
567
|
+
value.dependsOn = theme.dependsOn;
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
if (condition) {
|
|
571
|
+
return filterBy({
|
|
572
|
+
dependsOn: condition
|
|
573
|
+
}, values);
|
|
574
|
+
}
|
|
575
|
+
var imageKeys = new Set();
|
|
576
|
+
filterBy({
|
|
577
|
+
kind: "image"
|
|
578
|
+
}, themePropertiesSchema).forEach(function (ele) {
|
|
579
|
+
return imageKeys.add(ele.key);
|
|
580
|
+
});
|
|
581
|
+
return values === null || values === void 0 ? void 0 : values.filter(function (_ref2) {
|
|
582
|
+
var dependsOn = _ref2.dependsOn;
|
|
583
|
+
return !imageKeys.has(dependsOn);
|
|
517
584
|
});
|
|
518
585
|
};
|
|
519
586
|
|
|
@@ -521,7 +588,7 @@ var AlignmentBlock = function AlignmentBlock(_ref) {
|
|
|
521
588
|
var label = _ref.label,
|
|
522
589
|
name = _ref.name;
|
|
523
590
|
return /*#__PURE__*/jsxs("div", {
|
|
524
|
-
className: "flex items-center justify-between gap-2
|
|
591
|
+
className: "flex items-center justify-between gap-2",
|
|
525
592
|
"data-cy": joinHyphenCase(label),
|
|
526
593
|
children: [/*#__PURE__*/jsx(Typography, {
|
|
527
594
|
"data-cy": "style-fields-labels",
|
|
@@ -533,12 +600,22 @@ var AlignmentBlock = function AlignmentBlock(_ref) {
|
|
|
533
600
|
var value = _ref2.field.value,
|
|
534
601
|
setFieldValue = _ref2.form.setFieldValue;
|
|
535
602
|
return /*#__PURE__*/jsxs("div", {
|
|
536
|
-
className: "flex items-center
|
|
603
|
+
className: "neeto-ui-border-gray-300 neeto-themes-nano-alignment-block flex items-center border",
|
|
537
604
|
children: [/*#__PURE__*/jsx(Button, {
|
|
605
|
+
className: "neeto-themes-nano-alignment-button neeto-themes-nano-alignment-button__alignment-left",
|
|
538
606
|
"data-cy": "alignment-left",
|
|
539
|
-
|
|
540
|
-
size: "large",
|
|
607
|
+
size: "medium",
|
|
541
608
|
style: value === "left" ? "primary" : "text",
|
|
609
|
+
icon: function icon() {
|
|
610
|
+
return /*#__PURE__*/jsx(LeftAlign, {
|
|
611
|
+
size: 20,
|
|
612
|
+
className: classnames({
|
|
613
|
+
rounded: true,
|
|
614
|
+
"neeto-ui-text-primary-800": value === "left",
|
|
615
|
+
"neeto-ui-text-gray-600": value !== "left"
|
|
616
|
+
})
|
|
617
|
+
});
|
|
618
|
+
},
|
|
542
619
|
tooltipProps: {
|
|
543
620
|
content: "Left align",
|
|
544
621
|
position: "bottom"
|
|
@@ -546,11 +623,23 @@ var AlignmentBlock = function AlignmentBlock(_ref) {
|
|
|
546
623
|
onClick: function onClick() {
|
|
547
624
|
return setFieldValue(name, "left");
|
|
548
625
|
}
|
|
626
|
+
}), /*#__PURE__*/jsx("div", {
|
|
627
|
+
className: "neeto-themes-nano-alignment-divider"
|
|
549
628
|
}), /*#__PURE__*/jsx(Button, {
|
|
629
|
+
className: "neeto-themes-nano-alignment-button neeto-themes-nano-alignment-button__alignment-center",
|
|
550
630
|
"data-cy": "alignment-center",
|
|
551
|
-
|
|
552
|
-
size: "large",
|
|
631
|
+
size: "medium",
|
|
553
632
|
style: value === "center" ? "primary" : "text",
|
|
633
|
+
icon: function icon() {
|
|
634
|
+
return /*#__PURE__*/jsx(CenterAlign, {
|
|
635
|
+
size: 20,
|
|
636
|
+
className: classnames({
|
|
637
|
+
rounded: true,
|
|
638
|
+
"neeto-ui-text-primary-800": value === "center",
|
|
639
|
+
"neeto-ui-text-gray-600": value !== "center"
|
|
640
|
+
})
|
|
641
|
+
});
|
|
642
|
+
},
|
|
554
643
|
tooltipProps: {
|
|
555
644
|
content: "Center align",
|
|
556
645
|
position: "bottom"
|
|
@@ -572,7 +661,7 @@ var ColorBlock = function ColorBlock(_ref) {
|
|
|
572
661
|
onChange = _ref.onChange,
|
|
573
662
|
showTransparencyControl = _ref.showTransparencyControl;
|
|
574
663
|
return /*#__PURE__*/jsxs("div", {
|
|
575
|
-
className: "flex items-center justify-between
|
|
664
|
+
className: "flex items-center justify-between",
|
|
576
665
|
"data-cy": "theme-style-".concat(joinHyphenCase(label)),
|
|
577
666
|
children: [/*#__PURE__*/jsx(Typography, {
|
|
578
667
|
"data-cy": "style-fields-labels",
|
|
@@ -582,7 +671,8 @@ var ColorBlock = function ColorBlock(_ref) {
|
|
|
582
671
|
color: color,
|
|
583
672
|
onChange: onChange,
|
|
584
673
|
showTransparencyControl: showTransparencyControl,
|
|
585
|
-
showEyeDropper: true
|
|
674
|
+
showEyeDropper: true,
|
|
675
|
+
size: "medium"
|
|
586
676
|
})]
|
|
587
677
|
});
|
|
588
678
|
};
|
|
@@ -597,7 +687,7 @@ var FontPickerBlock = function FontPickerBlock(_ref) {
|
|
|
597
687
|
options = _ref.options,
|
|
598
688
|
onChange = _ref.onChange;
|
|
599
689
|
return /*#__PURE__*/jsxs("div", {
|
|
600
|
-
className: "flex items-center justify-between
|
|
690
|
+
className: "flex items-center justify-between",
|
|
601
691
|
"data-cy": "theme-style-".concat(joinHyphenCase(label)),
|
|
602
692
|
children: [/*#__PURE__*/jsx(Typography, {
|
|
603
693
|
"data-cy": "style-fields-labels",
|
|
@@ -624,6 +714,32 @@ var FontPickerBlock = function FontPickerBlock(_ref) {
|
|
|
624
714
|
});
|
|
625
715
|
};
|
|
626
716
|
|
|
717
|
+
var SelectBlock = function SelectBlock(_ref) {
|
|
718
|
+
var label = _ref.label,
|
|
719
|
+
_ref$placeholder = _ref.placeholder,
|
|
720
|
+
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
721
|
+
value = _ref.value,
|
|
722
|
+
options = _ref.options,
|
|
723
|
+
onChange = _ref.onChange;
|
|
724
|
+
return /*#__PURE__*/jsxs("div", {
|
|
725
|
+
className: "flex items-center justify-between",
|
|
726
|
+
"data-cy": "theme-style-".concat(joinHyphenCase(label)),
|
|
727
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
728
|
+
"data-cy": "logo-field-labels",
|
|
729
|
+
style: "body2",
|
|
730
|
+
children: label
|
|
731
|
+
}), /*#__PURE__*/jsx("div", {
|
|
732
|
+
className: "w-40",
|
|
733
|
+
children: /*#__PURE__*/jsx(Select, {
|
|
734
|
+
onChange: onChange,
|
|
735
|
+
options: options,
|
|
736
|
+
placeholder: placeholder,
|
|
737
|
+
value: value
|
|
738
|
+
})
|
|
739
|
+
})]
|
|
740
|
+
});
|
|
741
|
+
};
|
|
742
|
+
|
|
627
743
|
var SliderBlock = function SliderBlock(_ref) {
|
|
628
744
|
var label = _ref.label,
|
|
629
745
|
onChange = _ref.onChange,
|
|
@@ -632,7 +748,7 @@ var SliderBlock = function SliderBlock(_ref) {
|
|
|
632
748
|
max = _ref.max,
|
|
633
749
|
marks = _ref.marks;
|
|
634
750
|
return /*#__PURE__*/jsxs("div", {
|
|
635
|
-
className: "flex items-center justify-between gap-3
|
|
751
|
+
className: "flex items-center justify-between gap-3",
|
|
636
752
|
"data-cy": "theme-style-".concat(joinHyphenCase(label)),
|
|
637
753
|
children: [/*#__PURE__*/jsx(Typography, {
|
|
638
754
|
"data-cy": "style-fields-labels",
|
|
@@ -665,7 +781,8 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
665
781
|
var translationKey = "neetoThemes.properties.boolean.".concat(name, "HelpText");
|
|
666
782
|
var doesHelpTextExist = i18n.exists(translationKey);
|
|
667
783
|
return /*#__PURE__*/jsxs("div", {
|
|
668
|
-
className: "flex items-center justify-between
|
|
784
|
+
className: "flex items-center justify-between",
|
|
785
|
+
"data-cy": "theme-style-content-background",
|
|
669
786
|
children: [/*#__PURE__*/jsxs("div", {
|
|
670
787
|
className: "inline-flex items-center gap-4",
|
|
671
788
|
children: [/*#__PURE__*/jsx(Typography, {
|
|
@@ -689,9 +806,8 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
689
806
|
};
|
|
690
807
|
|
|
691
808
|
var Properties = function Properties(_ref) {
|
|
692
|
-
var onPropertiesChange = _ref.onPropertiesChange
|
|
693
|
-
|
|
694
|
-
t = _useTranslation.t;
|
|
809
|
+
var onPropertiesChange = _ref.onPropertiesChange,
|
|
810
|
+
condition = _ref.condition;
|
|
695
811
|
var _useConfigStore = useConfigStore(function (store) {
|
|
696
812
|
return {
|
|
697
813
|
themePropertiesSchema: store["themePropertiesSchema"]
|
|
@@ -740,138 +856,260 @@ var Properties = function Properties(_ref) {
|
|
|
740
856
|
}
|
|
741
857
|
};
|
|
742
858
|
useEffect(function () {
|
|
743
|
-
onPropertiesChange === null || onPropertiesChange === void 0
|
|
859
|
+
onPropertiesChange === null || onPropertiesChange === void 0 ? void 0 : onPropertiesChange(values, handleChange, handleColorChange);
|
|
744
860
|
setTheme(values);
|
|
745
861
|
setThemeState({
|
|
746
862
|
previewingTheme: values
|
|
747
863
|
});
|
|
748
864
|
}, [values]);
|
|
749
|
-
return /*#__PURE__*/jsx(
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
className: "divide-y divide-gray-200",
|
|
753
|
-
children: [filterBy({
|
|
754
|
-
kind: "font_family"
|
|
755
|
-
}, values.properties).map(function (_ref3) {
|
|
756
|
-
var key = _ref3.key,
|
|
757
|
-
value = _ref3.value,
|
|
758
|
-
kind = _ref3.kind;
|
|
759
|
-
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsx(FontPickerBlock, {
|
|
760
|
-
label: buildLabel(key, kind),
|
|
761
|
-
options: FONT_OPTIONS,
|
|
762
|
-
value: findBy({
|
|
763
|
-
value: value || null
|
|
764
|
-
}, FONT_OPTIONS),
|
|
765
|
-
onChange: function onChange(_ref4) {
|
|
766
|
-
var value = _ref4.value;
|
|
767
|
-
handleChange(key, value);
|
|
768
|
-
}
|
|
769
|
-
}, key);
|
|
770
|
-
}), filterBy({
|
|
771
|
-
kind: "color"
|
|
772
|
-
}, values.properties).map(function (_ref5) {
|
|
865
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
866
|
+
children: buildProperties(values === null || values === void 0 ? void 0 : values.properties, condition, themePropertiesSchema).sort(function (a, b) {
|
|
867
|
+
var order = function order(key) {
|
|
773
868
|
var _findBy;
|
|
774
|
-
|
|
775
|
-
value = _ref5.value,
|
|
776
|
-
kind = _ref5.kind;
|
|
777
|
-
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsx(ColorBlock, {
|
|
778
|
-
color: value,
|
|
779
|
-
label: buildLabel(key, kind),
|
|
780
|
-
showTransparencyControl: ((_findBy = findBy({
|
|
781
|
-
key: key
|
|
782
|
-
}, themePropertiesSchema)) === null || _findBy === void 0 ? void 0 : _findBy.showTransparencyControl) || false,
|
|
783
|
-
onChange: handleColorChange(key)
|
|
784
|
-
}, key);
|
|
785
|
-
}), filterBy({
|
|
786
|
-
kind: "radius"
|
|
787
|
-
}, values.properties).map(function (_ref6) {
|
|
788
|
-
var key = _ref6.key,
|
|
789
|
-
value = _ref6.value,
|
|
790
|
-
kind = _ref6.kind;
|
|
791
|
-
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsx(SliderBlock, {
|
|
792
|
-
label: buildLabel(key, kind),
|
|
793
|
-
max: 50,
|
|
794
|
-
min: 0,
|
|
795
|
-
value: Number(value) || 0,
|
|
796
|
-
onChange: function onChange(radius) {
|
|
797
|
-
return handleChange(key, radius, "".concat(radius, "px"));
|
|
798
|
-
}
|
|
799
|
-
}, key);
|
|
800
|
-
}), filterBy({
|
|
801
|
-
kind: "overlay_opacity"
|
|
802
|
-
}, values.properties).map(function (_ref7) {
|
|
803
|
-
var key = _ref7.key,
|
|
804
|
-
value = _ref7.value,
|
|
805
|
-
kind = _ref7.kind;
|
|
806
|
-
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsx(SliderBlock, {
|
|
807
|
-
label: buildLabel(key, kind),
|
|
808
|
-
marks: OVERLAY_OPACITY_SLIDER_MARKS,
|
|
809
|
-
max: HUNDRED,
|
|
810
|
-
min: negate(HUNDRED),
|
|
811
|
-
value: Number(value) || 0,
|
|
812
|
-
onChange: function onChange(opacity) {
|
|
813
|
-
return handleOverlayChange(key, opacity);
|
|
814
|
-
}
|
|
815
|
-
}, key);
|
|
816
|
-
}), filterBy({
|
|
817
|
-
kind: "position_selector"
|
|
818
|
-
}, values.properties).map(function (_ref8) {
|
|
819
|
-
var _findBy2;
|
|
820
|
-
var key = _ref8.key,
|
|
821
|
-
kind = _ref8.kind,
|
|
822
|
-
value = _ref8.value;
|
|
823
|
-
var index = findIndexBy({
|
|
869
|
+
return ((_findBy = findBy({
|
|
824
870
|
key: key
|
|
825
|
-
},
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
871
|
+
}, themePropertiesSchema)) === null || _findBy === void 0 ? void 0 : _findBy.order) || Infinity;
|
|
872
|
+
};
|
|
873
|
+
return order(a.key) - order(b.key);
|
|
874
|
+
}).map(function (_ref3) {
|
|
875
|
+
var _findBy2;
|
|
876
|
+
var key = _ref3.key,
|
|
877
|
+
value = _ref3.value,
|
|
878
|
+
kind = _ref3.kind;
|
|
879
|
+
var isCurrentPropertyVisible = isPropertyVisible(key, values, themePropertiesSchema);
|
|
880
|
+
if (!isCurrentPropertyVisible) return null;
|
|
881
|
+
switch (kind) {
|
|
882
|
+
case "font_family":
|
|
883
|
+
return /*#__PURE__*/jsx(FontPickerBlock, {
|
|
884
|
+
label: buildLabel(key, kind),
|
|
885
|
+
options: FONT_OPTIONS,
|
|
886
|
+
value: findBy({
|
|
887
|
+
value: value || null
|
|
888
|
+
}, FONT_OPTIONS),
|
|
889
|
+
onChange: function onChange(_ref4) {
|
|
890
|
+
var value = _ref4.value;
|
|
891
|
+
return handleChange(key, value);
|
|
892
|
+
}
|
|
893
|
+
}, key);
|
|
894
|
+
case "color":
|
|
895
|
+
return /*#__PURE__*/jsx(ColorBlock, {
|
|
896
|
+
color: value,
|
|
897
|
+
label: buildLabel(key, kind),
|
|
898
|
+
showTransparencyControl: ((_findBy2 = findBy({
|
|
899
|
+
key: key
|
|
900
|
+
}, themePropertiesSchema)) === null || _findBy2 === void 0 ? void 0 : _findBy2.showTransparencyControl) || false,
|
|
901
|
+
onChange: handleColorChange(key)
|
|
902
|
+
}, key);
|
|
903
|
+
case "radius":
|
|
904
|
+
return /*#__PURE__*/jsx(SliderBlock, {
|
|
905
|
+
label: buildLabel(key, kind),
|
|
906
|
+
max: 50,
|
|
907
|
+
min: 0,
|
|
908
|
+
value: Number(value) || 0,
|
|
909
|
+
onChange: function onChange(radius) {
|
|
910
|
+
return handleChange(key, radius, "".concat(radius, "px"));
|
|
911
|
+
}
|
|
912
|
+
}, key);
|
|
913
|
+
case "overlay_opacity":
|
|
914
|
+
return /*#__PURE__*/jsx(SliderBlock, {
|
|
915
|
+
label: buildLabel(key, kind),
|
|
916
|
+
marks: OVERLAY_OPACITY_SLIDER_MARKS,
|
|
917
|
+
max: HUNDRED,
|
|
918
|
+
min: negate(HUNDRED),
|
|
919
|
+
value: Number(value) || 0,
|
|
920
|
+
onChange: function onChange(opacity) {
|
|
921
|
+
return handleOverlayChange(key, opacity);
|
|
922
|
+
}
|
|
923
|
+
}, key);
|
|
924
|
+
case "position_selector":
|
|
925
|
+
{
|
|
926
|
+
var _findBy3, _findBy3$options;
|
|
927
|
+
var index = findIndexBy({
|
|
928
|
+
key: key
|
|
929
|
+
}, values.properties);
|
|
930
|
+
var options = (_findBy3 = findBy({
|
|
931
|
+
key: key
|
|
932
|
+
}, themePropertiesSchema)) === null || _findBy3 === void 0 ? void 0 : (_findBy3$options = _findBy3.options) === null || _findBy3$options === void 0 ? void 0 : _findBy3$options.map(toLabelAndValue);
|
|
933
|
+
return /*#__PURE__*/jsx(SelectBlock, {
|
|
934
|
+
label: buildLabel(key, kind),
|
|
935
|
+
options: options || POSITION_OPTIONS,
|
|
936
|
+
placeholder: "left",
|
|
937
|
+
value: toLabelAndValue(value),
|
|
938
|
+
onChange: function onChange(option) {
|
|
939
|
+
return setFieldValue("properties[".concat(index, "].value"), option.value);
|
|
940
|
+
}
|
|
941
|
+
}, key);
|
|
836
942
|
}
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
name: snakeToCamelCase(key),
|
|
851
|
-
onChange: function onChange(e) {
|
|
852
|
-
return setFieldValue("properties[".concat(index, "].value"), String(e.target.checked));
|
|
943
|
+
case "boolean":
|
|
944
|
+
{
|
|
945
|
+
var _index = findIndexBy({
|
|
946
|
+
key: key
|
|
947
|
+
}, values.properties);
|
|
948
|
+
return /*#__PURE__*/jsx(SwitchBlock, {
|
|
949
|
+
checked: value !== "false",
|
|
950
|
+
label: buildLabel(key, kind),
|
|
951
|
+
name: snakeToCamelCase(key),
|
|
952
|
+
onChange: function onChange(e) {
|
|
953
|
+
return setFieldValue("properties[".concat(_index, "].value"), String(e.target.checked));
|
|
954
|
+
}
|
|
955
|
+
}, key);
|
|
853
956
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
})]
|
|
957
|
+
case "alignment_block":
|
|
958
|
+
{
|
|
959
|
+
var _index2 = findIndexBy({
|
|
960
|
+
key: key
|
|
961
|
+
}, values.properties);
|
|
962
|
+
return /*#__PURE__*/jsx(AlignmentBlock, {
|
|
963
|
+
label: buildLabel(key, kind),
|
|
964
|
+
name: "properties[".concat(_index2, "].value")
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
default:
|
|
968
|
+
return null;
|
|
969
|
+
}
|
|
868
970
|
})
|
|
869
971
|
});
|
|
870
972
|
};
|
|
871
973
|
|
|
974
|
+
var ImageBlock = function ImageBlock(_ref) {
|
|
975
|
+
var _findBy;
|
|
976
|
+
var label = _ref.label,
|
|
977
|
+
name = _ref.name,
|
|
978
|
+
_ref$imageData = _ref.imageData,
|
|
979
|
+
imageData = _ref$imageData === void 0 ? {} : _ref$imageData,
|
|
980
|
+
_ref$uploadConfig = _ref.uploadConfig,
|
|
981
|
+
uploadConfig = _ref$uploadConfig === void 0 ? {
|
|
982
|
+
maxImageSize: ONE_MEGABYTE
|
|
983
|
+
} : _ref$uploadConfig,
|
|
984
|
+
attribute = _ref.attribute;
|
|
985
|
+
var _useTranslation = useTranslation(),
|
|
986
|
+
t = _useTranslation.t;
|
|
987
|
+
var _useFormikContext = useFormikContext(),
|
|
988
|
+
setFieldValue = _useFormikContext.setFieldValue,
|
|
989
|
+
values = _useFormikContext.values;
|
|
990
|
+
var _useConfigStore = useConfigStore(function (store) {
|
|
991
|
+
return {
|
|
992
|
+
themePropertiesSchema: store["themePropertiesSchema"]
|
|
993
|
+
};
|
|
994
|
+
}, shallow),
|
|
995
|
+
themePropertiesSchema = _useConfigStore.themePropertiesSchema;
|
|
996
|
+
var propertySchema = findBy({
|
|
997
|
+
key: attribute
|
|
998
|
+
}, themePropertiesSchema);
|
|
999
|
+
var enablePositionChanger = (propertySchema === null || propertySchema === void 0 ? void 0 : propertySchema.enablePositionChanger) || false;
|
|
1000
|
+
var options = propertySchema === null || propertySchema === void 0 ? void 0 : propertySchema.options;
|
|
1001
|
+
var positionKeyInSchema = findBy({
|
|
1002
|
+
key: "".concat(name, "_position")
|
|
1003
|
+
}, themePropertiesSchema);
|
|
1004
|
+
var isPositionChangerVisible = enablePositionChanger && (imageData === null || imageData === void 0 ? void 0 : imageData.url) && isPresent(positionKeyInSchema);
|
|
1005
|
+
var positionKeyIndex = findIndexBy({
|
|
1006
|
+
key: "".concat(name, "_position")
|
|
1007
|
+
}, values.properties);
|
|
1008
|
+
var handleImageChange = /*#__PURE__*/function () {
|
|
1009
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(image) {
|
|
1010
|
+
var dominantColor;
|
|
1011
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1012
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1013
|
+
case 0:
|
|
1014
|
+
_context.prev = 0;
|
|
1015
|
+
if (!(isEmpty(image.signedId) || isEmpty(image.url))) {
|
|
1016
|
+
_context.next = 4;
|
|
1017
|
+
break;
|
|
1018
|
+
}
|
|
1019
|
+
setFieldValue(name, {
|
|
1020
|
+
signedId: null,
|
|
1021
|
+
url: image.url
|
|
1022
|
+
});
|
|
1023
|
+
return _context.abrupt("return");
|
|
1024
|
+
case 4:
|
|
1025
|
+
_context.next = 6;
|
|
1026
|
+
return getDominantColorFromUrl(image.url);
|
|
1027
|
+
case 6:
|
|
1028
|
+
dominantColor = _context.sent;
|
|
1029
|
+
setFieldValue(name, {
|
|
1030
|
+
signedId: image.signedId,
|
|
1031
|
+
url: image.url,
|
|
1032
|
+
dominantColor: dominantColor
|
|
1033
|
+
});
|
|
1034
|
+
_context.next = 13;
|
|
1035
|
+
break;
|
|
1036
|
+
case 10:
|
|
1037
|
+
_context.prev = 10;
|
|
1038
|
+
_context.t0 = _context["catch"](0);
|
|
1039
|
+
Toastr.error(_context.t0);
|
|
1040
|
+
case 13:
|
|
1041
|
+
case "end":
|
|
1042
|
+
return _context.stop();
|
|
1043
|
+
}
|
|
1044
|
+
}, _callee, null, [[0, 10]]);
|
|
1045
|
+
}));
|
|
1046
|
+
return function handleImageChange(_x) {
|
|
1047
|
+
return _ref2.apply(this, arguments);
|
|
1048
|
+
};
|
|
1049
|
+
}();
|
|
1050
|
+
return /*#__PURE__*/jsxs("div", {
|
|
1051
|
+
className: "space-y-3",
|
|
1052
|
+
"data-cy": "theme-style-".concat(label ? joinHyphenCase(label) : "image-block"),
|
|
1053
|
+
children: [label && /*#__PURE__*/jsx("div", {
|
|
1054
|
+
className: "flex items-center justify-between",
|
|
1055
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
1056
|
+
"data-cy": "style-fields-labels",
|
|
1057
|
+
style: "body2",
|
|
1058
|
+
children: label
|
|
1059
|
+
})
|
|
1060
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
1061
|
+
className: "space-y-3",
|
|
1062
|
+
children: [/*#__PURE__*/createElement(ImageUploader, {
|
|
1063
|
+
uploadConfig: uploadConfig,
|
|
1064
|
+
className: "h-40 w-full",
|
|
1065
|
+
key: imageData === null || imageData === void 0 ? void 0 : imageData.url,
|
|
1066
|
+
src: imageData === null || imageData === void 0 ? void 0 : imageData.url,
|
|
1067
|
+
onUploadComplete: handleImageChange
|
|
1068
|
+
}), isPositionChangerVisible && /*#__PURE__*/jsx(SelectBlock, {
|
|
1069
|
+
label: buildLabel("".concat(name, "Position"), "image"),
|
|
1070
|
+
options: options || POSITION_OPTIONS,
|
|
1071
|
+
placeholder: t("neetoThemes.common.left"),
|
|
1072
|
+
value: toLabelAndValue(((_findBy = findBy({
|
|
1073
|
+
key: "".concat(name, "_position")
|
|
1074
|
+
}, values.properties)) === null || _findBy === void 0 ? void 0 : _findBy.value) || (positionKeyInSchema === null || positionKeyInSchema === void 0 ? void 0 : positionKeyInSchema.defaultValue)),
|
|
1075
|
+
onChange: function onChange(option) {
|
|
1076
|
+
return setFieldValue("properties[".concat(positionKeyIndex, "].value"), option.value);
|
|
1077
|
+
}
|
|
1078
|
+
})]
|
|
1079
|
+
})]
|
|
1080
|
+
});
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
var Images = function Images(_ref) {
|
|
1084
|
+
var attribute = _ref.attribute,
|
|
1085
|
+
className = _ref.className,
|
|
1086
|
+
onPropertiesChange = _ref.onPropertiesChange;
|
|
1087
|
+
var _useFormikContext = useFormikContext(),
|
|
1088
|
+
values = _useFormikContext.values;
|
|
1089
|
+
var key = snakeToCamelCase(attribute);
|
|
1090
|
+
var title = buildLabel(key, "image");
|
|
1091
|
+
var imageData = values[key];
|
|
1092
|
+
return /*#__PURE__*/jsxs(Card$2, {
|
|
1093
|
+
className: className,
|
|
1094
|
+
title: title,
|
|
1095
|
+
name: "images",
|
|
1096
|
+
children: [/*#__PURE__*/jsx(ImageBlock, {
|
|
1097
|
+
attribute: attribute,
|
|
1098
|
+
imageData: imageData,
|
|
1099
|
+
name: key
|
|
1100
|
+
}), /*#__PURE__*/jsx(Properties, {
|
|
1101
|
+
onPropertiesChange: onPropertiesChange,
|
|
1102
|
+
condition: attribute
|
|
1103
|
+
})]
|
|
1104
|
+
});
|
|
1105
|
+
};
|
|
1106
|
+
|
|
872
1107
|
var ThemeMeta = withT(function (_ref) {
|
|
873
|
-
var t = _ref.t
|
|
1108
|
+
var t = _ref.t,
|
|
1109
|
+
className = _ref.className;
|
|
874
1110
|
return /*#__PURE__*/jsx(Card$2, {
|
|
1111
|
+
className: className,
|
|
1112
|
+
name: "name",
|
|
875
1113
|
title: t("neetoThemes.common.name"),
|
|
876
1114
|
children: /*#__PURE__*/jsx(Input, {
|
|
877
1115
|
autoFocus: true,
|
|
@@ -890,7 +1128,9 @@ var Customize = function Customize(_ref) {
|
|
|
890
1128
|
onApplyTheme = _ref.onApplyTheme,
|
|
891
1129
|
isApplyingTheme = _ref.isApplyingTheme,
|
|
892
1130
|
onPropertiesChange = _ref.onPropertiesChange,
|
|
893
|
-
onUpdateThemeSuccess = _ref.onUpdateThemeSuccess
|
|
1131
|
+
onUpdateThemeSuccess = _ref.onUpdateThemeSuccess,
|
|
1132
|
+
onEditCSSClick = _ref.onEditCSSClick,
|
|
1133
|
+
currentScreen = _ref.currentScreen;
|
|
894
1134
|
var _useTranslation = useTranslation(),
|
|
895
1135
|
t = _useTranslation.t;
|
|
896
1136
|
var _useState = useState({}),
|
|
@@ -907,6 +1147,12 @@ var Customize = function Customize(_ref) {
|
|
|
907
1147
|
entityType = _useConfigStore.entityType;
|
|
908
1148
|
var _useThemeUtils = useThemeUtils(),
|
|
909
1149
|
currentTheme = _useThemeUtils.currentTheme;
|
|
1150
|
+
var _useShowGlobalTheme = useShowGlobalTheme(entityType),
|
|
1151
|
+
_useShowGlobalTheme$d = _useShowGlobalTheme.data,
|
|
1152
|
+
_useShowGlobalTheme$d2 = _useShowGlobalTheme$d === void 0 ? {} : _useShowGlobalTheme$d,
|
|
1153
|
+
_useShowGlobalTheme$d3 = _useShowGlobalTheme$d2.globalTheme,
|
|
1154
|
+
globalTheme = _useShowGlobalTheme$d3 === void 0 ? {} : _useShowGlobalTheme$d3;
|
|
1155
|
+
var isThemeGlobalTheme = (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === themeId;
|
|
910
1156
|
var isEditingCurrentlyAppliedTheme = themeId === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
|
|
911
1157
|
var submitBtnRef = useRef(null);
|
|
912
1158
|
var _useCreateTheme = useCreateTheme(),
|
|
@@ -916,12 +1162,18 @@ var Customize = function Customize(_ref) {
|
|
|
916
1162
|
updateTheme = _useUpdateTheme.mutate,
|
|
917
1163
|
isUpdating = _useUpdateTheme.isPending;
|
|
918
1164
|
var isSubmitting = isCreating || isUpdating;
|
|
1165
|
+
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
1166
|
+
var handleGlobalThemeSwitchChange = function handleGlobalThemeSwitchChange(e, setFieldValue) {
|
|
1167
|
+
setFieldValue("shouldSetAsGlobalTheme", e.target.checked);
|
|
1168
|
+
};
|
|
919
1169
|
var onSubmit = function onSubmit(values, _ref2) {
|
|
920
1170
|
var resetForm = _ref2.resetForm;
|
|
921
1171
|
var imageData = buildImageData(values, themePropertiesSchema);
|
|
922
1172
|
var themeToSave = _objectSpread$1({
|
|
923
1173
|
propertiesAttributes: values.properties,
|
|
924
|
-
name: values.name
|
|
1174
|
+
name: values.name,
|
|
1175
|
+
shouldSetAsGlobalTheme: values.shouldSetAsGlobalTheme,
|
|
1176
|
+
entityType: values.entityType
|
|
925
1177
|
}, imageData);
|
|
926
1178
|
if (!themeId) {
|
|
927
1179
|
return createTheme(themeToSave, {
|
|
@@ -939,34 +1191,80 @@ var Customize = function Customize(_ref) {
|
|
|
939
1191
|
resetForm({
|
|
940
1192
|
values: values
|
|
941
1193
|
});
|
|
942
|
-
onUpdateThemeSuccess === null || onUpdateThemeSuccess === void 0
|
|
1194
|
+
onUpdateThemeSuccess === null || onUpdateThemeSuccess === void 0 ? void 0 : onUpdateThemeSuccess(values);
|
|
943
1195
|
}
|
|
944
1196
|
});
|
|
945
1197
|
};
|
|
946
1198
|
return /*#__PURE__*/jsx(Form, {
|
|
947
1199
|
formikProps: {
|
|
948
|
-
initialValues: buildInitialValues(theme, themePropertiesSchema),
|
|
1200
|
+
initialValues: _objectSpread$1(_objectSpread$1({}, buildInitialValues(theme, themePropertiesSchema)), {}, {
|
|
1201
|
+
shouldSetAsGlobalTheme: isThemeGlobalTheme,
|
|
1202
|
+
entityType: entityType
|
|
1203
|
+
}),
|
|
949
1204
|
validationSchema: THEME_VALIDATION_SCHEMA,
|
|
1205
|
+
enableReinitialize: true,
|
|
950
1206
|
onSubmit: onSubmit
|
|
951
1207
|
},
|
|
952
1208
|
children: function children(_ref4) {
|
|
953
|
-
var dirty = _ref4.dirty
|
|
1209
|
+
var dirty = _ref4.dirty,
|
|
1210
|
+
values = _ref4.values,
|
|
1211
|
+
setFieldValue = _ref4.setFieldValue;
|
|
954
1212
|
return /*#__PURE__*/jsxs("div", {
|
|
955
1213
|
className: "neeto-themes-sidebar__scroll",
|
|
956
1214
|
children: [/*#__PURE__*/jsxs("div", {
|
|
957
|
-
className: "flex flex-col
|
|
958
|
-
children: [/*#__PURE__*/jsx(ThemeMeta, {
|
|
959
|
-
|
|
1215
|
+
className: "neeto-themes-sidebar__scroll-content flex flex-grow flex-col px-4 pb-4 lg:px-5",
|
|
1216
|
+
children: [/*#__PURE__*/jsx(ThemeMeta, {
|
|
1217
|
+
className: classnames({
|
|
1218
|
+
hidden: isCustomCssScreen
|
|
1219
|
+
})
|
|
1220
|
+
}), /*#__PURE__*/jsx(Card$2, {
|
|
1221
|
+
className: classnames({
|
|
1222
|
+
hidden: isCustomCssScreen
|
|
1223
|
+
}),
|
|
1224
|
+
name: "style",
|
|
1225
|
+
title: t("neetoThemes.common.style"),
|
|
1226
|
+
children: /*#__PURE__*/jsx(Properties, {
|
|
1227
|
+
onPropertiesChange: onPropertiesChange
|
|
1228
|
+
})
|
|
960
1229
|
}), filterBy({
|
|
961
1230
|
kind: "image"
|
|
962
1231
|
}, themePropertiesSchema).map(function (_ref5) {
|
|
963
1232
|
var key = _ref5.key;
|
|
964
|
-
return /*#__PURE__*/
|
|
965
|
-
|
|
966
|
-
|
|
1233
|
+
return /*#__PURE__*/createElement(Images, {
|
|
1234
|
+
onPropertiesChange: onPropertiesChange,
|
|
1235
|
+
attribute: key,
|
|
1236
|
+
className: classnames({
|
|
1237
|
+
hidden: isCustomCssScreen
|
|
1238
|
+
}),
|
|
1239
|
+
key: key
|
|
1240
|
+
});
|
|
1241
|
+
}), /*#__PURE__*/jsx(CustomCSS, {
|
|
1242
|
+
currentScreen: currentScreen,
|
|
1243
|
+
onEditCSSClick: onEditCSSClick
|
|
1244
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
1245
|
+
className: "neeto-ui-bg-gray-50 neeto-ui-border-gray-200 mt-2 flex flex-col space-y-2 border p-2",
|
|
1246
|
+
children: [/*#__PURE__*/jsx(Tooltip, {
|
|
1247
|
+
disabled: !isThemeGlobalTheme,
|
|
1248
|
+
content: t("neetoThemes.build.leftSideBar.themes.themeOptions.setAsGlobalTheme.tooltipContent"),
|
|
1249
|
+
children: /*#__PURE__*/jsx(Switch, {
|
|
1250
|
+
checked: values.shouldSetAsGlobalTheme,
|
|
1251
|
+
disabled: isThemeGlobalTheme,
|
|
1252
|
+
name: "shouldSetAsGlobalTheme",
|
|
1253
|
+
label: t("neetoThemes.build.leftSideBar.themes.themeOptions.setAsGlobalTheme.label"),
|
|
1254
|
+
onChange: function onChange(e) {
|
|
1255
|
+
return handleGlobalThemeSwitchChange(e, setFieldValue);
|
|
1256
|
+
}
|
|
1257
|
+
})
|
|
1258
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
1259
|
+
className: "text-sm",
|
|
1260
|
+
style: "body2",
|
|
1261
|
+
children: t("neetoThemes.build.leftSideBar.themes.themeOptions.setAsGlobalTheme.helpText", {
|
|
1262
|
+
entityType: entityType
|
|
1263
|
+
})
|
|
1264
|
+
})]
|
|
967
1265
|
})]
|
|
968
1266
|
}), /*#__PURE__*/jsxs("div", {
|
|
969
|
-
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",
|
|
1267
|
+
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 lg:px-5 xl:px-6",
|
|
970
1268
|
children: [/*#__PURE__*/jsx(Button, {
|
|
971
1269
|
"data-cy": "reset-button",
|
|
972
1270
|
disabled: !dirty || isSubmitting,
|
|
@@ -998,7 +1296,7 @@ var Customize = function Customize(_ref) {
|
|
|
998
1296
|
style: "text",
|
|
999
1297
|
onClick: function onClick() {
|
|
1000
1298
|
var _popoverInstance$hide;
|
|
1001
|
-
return popoverInstance === null || popoverInstance === void 0
|
|
1299
|
+
return popoverInstance === null || popoverInstance === void 0 ? void 0 : (_popoverInstance$hide = popoverInstance.hide) === null || _popoverInstance$hide === void 0 ? void 0 : _popoverInstance$hide.call(popoverInstance);
|
|
1002
1300
|
}
|
|
1003
1301
|
}), /*#__PURE__*/jsx(Typography, {
|
|
1004
1302
|
className: "w-72 pr-5",
|
|
@@ -1189,7 +1487,9 @@ var Card = function Card(_ref) {
|
|
|
1189
1487
|
isApplyingTheme = _ref.isApplyingTheme,
|
|
1190
1488
|
onCloneTheme = _ref.onCloneTheme,
|
|
1191
1489
|
isHighLightedTheme = _ref.isHighLightedTheme,
|
|
1490
|
+
isGlobalTheme = _ref.isGlobalTheme,
|
|
1192
1491
|
onApplyTheme = _ref.onApplyTheme,
|
|
1492
|
+
onApplyGlobalTheme = _ref.onApplyGlobalTheme,
|
|
1193
1493
|
Thumbnail$1 = _ref.thumbnail;
|
|
1194
1494
|
var _useTranslation = useTranslation(),
|
|
1195
1495
|
t = _useTranslation.t;
|
|
@@ -1205,6 +1505,9 @@ var Card = function Card(_ref) {
|
|
|
1205
1505
|
var handleDeleteTheme = function handleDeleteTheme() {
|
|
1206
1506
|
return onDeleteTheme(id, name, appliedCount);
|
|
1207
1507
|
};
|
|
1508
|
+
var handleApplyGlobalTheme = function handleApplyGlobalTheme() {
|
|
1509
|
+
return onApplyGlobalTheme(id);
|
|
1510
|
+
};
|
|
1208
1511
|
return /*#__PURE__*/jsx("div", {
|
|
1209
1512
|
className: "group space-y-2 pt-0.5",
|
|
1210
1513
|
"data-cy": active ? "active-theme-card" : "theme-card",
|
|
@@ -1256,13 +1559,19 @@ var Card = function Card(_ref) {
|
|
|
1256
1559
|
theme: theme
|
|
1257
1560
|
})]
|
|
1258
1561
|
}), /*#__PURE__*/jsxs("div", {
|
|
1259
|
-
className: "flex items-start justify-between gap-1 p-
|
|
1260
|
-
children: [/*#__PURE__*/
|
|
1261
|
-
className: "
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1562
|
+
className: "neeto-ui-border-gray-100 flex items-start justify-between gap-1 border-t p-2",
|
|
1563
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
1564
|
+
className: "flex items-center space-x-2",
|
|
1565
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
1566
|
+
className: "line-clamp-2 min-w-0 flex-grow break-words pt-1",
|
|
1567
|
+
"data-cy": "theme-name",
|
|
1568
|
+
lineHeight: "snug",
|
|
1569
|
+
style: "body2",
|
|
1570
|
+
children: name
|
|
1571
|
+
}), isGlobalTheme && /*#__PURE__*/jsx(Rating, {
|
|
1572
|
+
className: "neeto-themes-nano-global-theme-icon",
|
|
1573
|
+
size: 18
|
|
1574
|
+
})]
|
|
1266
1575
|
}), /*#__PURE__*/jsx(MoreDropdown, {
|
|
1267
1576
|
dropdownButtonProps: {
|
|
1268
1577
|
size: "small"
|
|
@@ -1284,6 +1593,12 @@ var Card = function Card(_ref) {
|
|
|
1284
1593
|
"data-cy": "clone-theme-menu-item",
|
|
1285
1594
|
label: t("neetoThemes.build.leftSideBar.themes.themeOptions.clone"),
|
|
1286
1595
|
onClick: handleCloneTheme
|
|
1596
|
+
}, {
|
|
1597
|
+
key: "set-as-global-theme",
|
|
1598
|
+
"data-cy": "set-as-global-theme-menu-item",
|
|
1599
|
+
label: t("neetoThemes.build.leftSideBar.themes.themeOptions.setAsGlobalTheme.label"),
|
|
1600
|
+
isVisible: !isGlobalTheme,
|
|
1601
|
+
onClick: handleApplyGlobalTheme
|
|
1287
1602
|
}, {
|
|
1288
1603
|
key: "divider",
|
|
1289
1604
|
type: "divider",
|
|
@@ -1333,12 +1648,26 @@ var Themes = function Themes(_ref) {
|
|
|
1333
1648
|
}, shallow),
|
|
1334
1649
|
setThemeState = _useThemeStore.setThemeState,
|
|
1335
1650
|
previewingTheme = _useThemeStore.previewingTheme;
|
|
1651
|
+
var _useConfigStore = useConfigStore(function (store) {
|
|
1652
|
+
return {
|
|
1653
|
+
entityType: store["entityType"]
|
|
1654
|
+
};
|
|
1655
|
+
}, shallow),
|
|
1656
|
+
entityType = _useConfigStore.entityType;
|
|
1336
1657
|
var _useState = useState(""),
|
|
1337
1658
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1338
1659
|
searchQuery = _useState2[0],
|
|
1339
1660
|
setSearchQuery = _useState2[1];
|
|
1340
1661
|
var _useCloneTheme = useCloneTheme(),
|
|
1341
1662
|
cloneTheme = _useCloneTheme.mutate;
|
|
1663
|
+
var _useApplyGlobalTheme = useApplyGlobalTheme(),
|
|
1664
|
+
applyGlobalTheme = _useApplyGlobalTheme.mutate;
|
|
1665
|
+
var _useShowGlobalTheme = useShowGlobalTheme(entityType),
|
|
1666
|
+
_useShowGlobalTheme$d = _useShowGlobalTheme.data,
|
|
1667
|
+
_useShowGlobalTheme$d2 = _useShowGlobalTheme$d === void 0 ? {} : _useShowGlobalTheme$d,
|
|
1668
|
+
_useShowGlobalTheme$d3 = _useShowGlobalTheme$d2.globalTheme,
|
|
1669
|
+
globalTheme = _useShowGlobalTheme$d3 === void 0 ? {} : _useShowGlobalTheme$d3,
|
|
1670
|
+
isLoadingGlobalTheme = _useShowGlobalTheme.isLoading;
|
|
1342
1671
|
useEffect(function () {
|
|
1343
1672
|
if (didScrollActiveThemeIntoView.current || !(currentTheme !== null && currentTheme !== void 0 && currentTheme.id)) return;
|
|
1344
1673
|
didScrollActiveThemeIntoView.current = true;
|
|
@@ -1367,7 +1696,16 @@ var Themes = function Themes(_ref) {
|
|
|
1367
1696
|
}
|
|
1368
1697
|
});
|
|
1369
1698
|
};
|
|
1370
|
-
|
|
1699
|
+
var handleApplyGlobalTheme = function handleApplyGlobalTheme(themeId) {
|
|
1700
|
+
var payload = {
|
|
1701
|
+
entityType: entityType
|
|
1702
|
+
};
|
|
1703
|
+
applyGlobalTheme({
|
|
1704
|
+
themeId: themeId,
|
|
1705
|
+
payload: payload
|
|
1706
|
+
});
|
|
1707
|
+
};
|
|
1708
|
+
if (isLoading || isCurrentThemeLoading || isLoadingGlobalTheme) {
|
|
1371
1709
|
return /*#__PURE__*/jsx("div", {
|
|
1372
1710
|
className: "flex h-full w-full items-center justify-center",
|
|
1373
1711
|
children: /*#__PURE__*/jsx(Spinner, {})
|
|
@@ -1389,13 +1727,13 @@ var Themes = function Themes(_ref) {
|
|
|
1389
1727
|
children: t("neetoThemes.common.noResultsFound")
|
|
1390
1728
|
}), isNotEmpty(filteredDefaultThemes) && /*#__PURE__*/jsxs(Fragment, {
|
|
1391
1729
|
children: [/*#__PURE__*/jsx(Typography, {
|
|
1392
|
-
className: "my-4 px-
|
|
1730
|
+
className: "my-4 px-6 uppercase lg:px-5 xl:px-6",
|
|
1393
1731
|
"data-cy": "system-themes-header",
|
|
1394
1732
|
style: "h6",
|
|
1395
1733
|
weight: "semibold",
|
|
1396
1734
|
children: t("neetoThemes.build.leftSideBar.themes.systemThemes")
|
|
1397
1735
|
}), /*#__PURE__*/jsx("div", {
|
|
1398
|
-
className: "flex flex-col gap-4 px-
|
|
1736
|
+
className: "flex flex-col gap-4 px-6 pb-10 lg:px-5 xl:px-6",
|
|
1399
1737
|
"data-cy": "system-themes",
|
|
1400
1738
|
children: filteredDefaultThemes.map(function (theme) {
|
|
1401
1739
|
return /*#__PURE__*/createElement(Card$1, {
|
|
@@ -1403,9 +1741,11 @@ var Themes = function Themes(_ref) {
|
|
|
1403
1741
|
theme: theme,
|
|
1404
1742
|
thumbnail: thumbnail,
|
|
1405
1743
|
active: (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === theme.id,
|
|
1744
|
+
isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
|
|
1406
1745
|
isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === theme.id,
|
|
1407
1746
|
key: theme.id,
|
|
1408
1747
|
isApplyingTheme: isApplyingTheme && (themeBeingApplied === null || themeBeingApplied === void 0 ? void 0 : themeBeingApplied.id) === theme.id,
|
|
1748
|
+
onApplyGlobalTheme: handleApplyGlobalTheme,
|
|
1409
1749
|
onCloneTheme: handleCloneTheme,
|
|
1410
1750
|
onSetPreviewTheme: setPreviewTheme
|
|
1411
1751
|
});
|
|
@@ -1433,9 +1773,11 @@ var Themes = function Themes(_ref) {
|
|
|
1433
1773
|
theme: theme,
|
|
1434
1774
|
thumbnail: thumbnail,
|
|
1435
1775
|
active: isActive,
|
|
1776
|
+
isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
|
|
1436
1777
|
isHighLightedTheme: theme.id === themeToHighlight,
|
|
1437
1778
|
key: theme.id,
|
|
1438
1779
|
isApplyingTheme: isApplyingTheme && (themeBeingApplied === null || themeBeingApplied === void 0 ? void 0 : themeBeingApplied.id) === theme.id,
|
|
1780
|
+
onApplyGlobalTheme: handleApplyGlobalTheme,
|
|
1439
1781
|
onCloneTheme: handleCloneTheme,
|
|
1440
1782
|
onDeleteTheme: !isActive && onDeleteTheme,
|
|
1441
1783
|
onSetPreviewTheme: setPreviewTheme
|
|
@@ -1454,56 +1796,57 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
1454
1796
|
themeToEdit = _ref.themeToEdit;
|
|
1455
1797
|
var _useTranslation = useTranslation(),
|
|
1456
1798
|
t = _useTranslation.t;
|
|
1457
|
-
|
|
1799
|
+
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
1800
|
+
if (currentScreen === DESIGN_SCREENS.THEMES) {
|
|
1458
1801
|
return /*#__PURE__*/jsx("div", {
|
|
1459
|
-
className: "neeto-themes-sidebar__header px-
|
|
1802
|
+
className: "neeto-themes-sidebar__header px-6 lg:px-5 xl:px-6",
|
|
1460
1803
|
children: /*#__PURE__*/jsxs("div", {
|
|
1461
|
-
className: "flex items-center justify-
|
|
1462
|
-
children: [/*#__PURE__*/jsx(
|
|
1463
|
-
"data-cy": "customize-themes-back-button",
|
|
1464
|
-
icon: LeftArrow,
|
|
1465
|
-
iconPosition: "left",
|
|
1466
|
-
style: "text",
|
|
1467
|
-
tooltipProps: {
|
|
1468
|
-
content: t("neetoThemes.buttons.backToThemes"),
|
|
1469
|
-
position: "top"
|
|
1470
|
-
},
|
|
1471
|
-
onClick: function onClick() {
|
|
1472
|
-
return handleBackPress(themeToEdit);
|
|
1473
|
-
}
|
|
1474
|
-
}), /*#__PURE__*/jsx(Typography, {
|
|
1804
|
+
className: "flex items-center justify-between space-x-2",
|
|
1805
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
1475
1806
|
"data-cy": "themes-header",
|
|
1476
1807
|
lineHeight: "normal",
|
|
1477
1808
|
style: "h3",
|
|
1478
1809
|
weight: "semibold",
|
|
1479
|
-
children:
|
|
1810
|
+
children: t("neetoThemes.build.leftSideBar.headerTabs.themes")
|
|
1811
|
+
}), /*#__PURE__*/jsx("div", {
|
|
1812
|
+
className: "self-end",
|
|
1813
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
1814
|
+
"data-cy": "customize-themes-add-theme-button",
|
|
1815
|
+
icon: Plus,
|
|
1816
|
+
iconPosition: "left",
|
|
1817
|
+
style: "text",
|
|
1818
|
+
tooltipProps: {
|
|
1819
|
+
content: t("neetoThemes.buttons.addNewTheme"),
|
|
1820
|
+
position: "top"
|
|
1821
|
+
},
|
|
1822
|
+
onClick: handleCreateNewTheme
|
|
1823
|
+
})
|
|
1480
1824
|
})]
|
|
1481
1825
|
})
|
|
1482
1826
|
});
|
|
1483
1827
|
}
|
|
1484
1828
|
return /*#__PURE__*/jsx("div", {
|
|
1485
|
-
className: "neeto-themes-sidebar__header px-4
|
|
1829
|
+
className: "neeto-themes-sidebar__header px-4",
|
|
1486
1830
|
children: /*#__PURE__*/jsxs("div", {
|
|
1487
|
-
className: "flex items-center justify-
|
|
1488
|
-
children: [/*#__PURE__*/jsx(
|
|
1831
|
+
className: "flex items-center justify-start space-x-2",
|
|
1832
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
1833
|
+
"data-cy": "customize-themes-back-button",
|
|
1834
|
+
icon: LeftArrow,
|
|
1835
|
+
iconPosition: "left",
|
|
1836
|
+
style: "text",
|
|
1837
|
+
tooltipProps: {
|
|
1838
|
+
content: isCustomCssScreen ? t("neetoThemes.buttons.backToEdit") : t("neetoThemes.buttons.backToThemes"),
|
|
1839
|
+
position: "top"
|
|
1840
|
+
},
|
|
1841
|
+
onClick: function onClick() {
|
|
1842
|
+
return handleBackPress(themeToEdit);
|
|
1843
|
+
}
|
|
1844
|
+
}), /*#__PURE__*/jsxs(Typography, {
|
|
1489
1845
|
"data-cy": "themes-header",
|
|
1490
1846
|
lineHeight: "normal",
|
|
1491
1847
|
style: "h3",
|
|
1492
1848
|
weight: "semibold",
|
|
1493
|
-
children: t("neetoThemes.build.leftSideBar.
|
|
1494
|
-
}), /*#__PURE__*/jsx("div", {
|
|
1495
|
-
className: "self-end",
|
|
1496
|
-
children: /*#__PURE__*/jsx(Button, {
|
|
1497
|
-
"data-cy": "customize-themes-add-theme-button",
|
|
1498
|
-
icon: Plus,
|
|
1499
|
-
iconPosition: "left",
|
|
1500
|
-
style: "text",
|
|
1501
|
-
tooltipProps: {
|
|
1502
|
-
content: t("neetoThemes.buttons.addNewTheme"),
|
|
1503
|
-
position: "top"
|
|
1504
|
-
},
|
|
1505
|
-
onClick: handleCreateNewTheme
|
|
1506
|
-
})
|
|
1849
|
+
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")]
|
|
1507
1850
|
})]
|
|
1508
1851
|
})
|
|
1509
1852
|
});
|
|
@@ -1532,6 +1875,16 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1532
1875
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
1533
1876
|
themeBeingApplied = _useState8[0],
|
|
1534
1877
|
setThemeBeingApplied = _useState8[1];
|
|
1878
|
+
var _useBreakpoints = useBreakpoints(),
|
|
1879
|
+
isSize = _useBreakpoints.isSize;
|
|
1880
|
+
var isLargerScreen = !isSize("mobile");
|
|
1881
|
+
var _useState9 = useState(!isLargerScreen),
|
|
1882
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
1883
|
+
isThemesSidebarCollapsed = _useState10[0],
|
|
1884
|
+
setIsThemesSidebarCollapsed = _useState10[1];
|
|
1885
|
+
useEffect(function () {
|
|
1886
|
+
setIsThemesSidebarCollapsed(!isLargerScreen);
|
|
1887
|
+
}, [isLargerScreen]);
|
|
1535
1888
|
var _useConfigStore = useConfigStore(function (store) {
|
|
1536
1889
|
return {
|
|
1537
1890
|
entityType: store["entityType"],
|
|
@@ -1582,13 +1935,14 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1582
1935
|
});
|
|
1583
1936
|
setThemeBeingApplied({});
|
|
1584
1937
|
setCurrentScreen(DESIGN_SCREENS.THEMES);
|
|
1585
|
-
onApplyThemeSuccess === null || onApplyThemeSuccess === void 0
|
|
1938
|
+
onApplyThemeSuccess === null || onApplyThemeSuccess === void 0 ? void 0 : onApplyThemeSuccess(theme);
|
|
1586
1939
|
}
|
|
1587
1940
|
}),
|
|
1588
1941
|
applyTheme = _useApplyTheme.mutate,
|
|
1589
1942
|
isApplyingTheme = _useApplyTheme.isPending;
|
|
1590
1943
|
var themeToDelete = useRef(null);
|
|
1591
1944
|
var themeToEdit = useRef(null);
|
|
1945
|
+
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
1592
1946
|
var handleEditTheme = function handleEditTheme(theme) {
|
|
1593
1947
|
themeToEdit.current = theme;
|
|
1594
1948
|
setCurrentScreen(DESIGN_SCREENS.Customize);
|
|
@@ -1608,7 +1962,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1608
1962
|
setThemeState({
|
|
1609
1963
|
previewingTheme: currentTheme
|
|
1610
1964
|
});
|
|
1611
|
-
setCurrentScreen(DESIGN_SCREENS.THEMES);
|
|
1965
|
+
setCurrentScreen(isCustomCssScreen ? DESIGN_SCREENS.Customize : DESIGN_SCREENS.THEMES);
|
|
1612
1966
|
themeToEdit.current = null;
|
|
1613
1967
|
};
|
|
1614
1968
|
var highlightTheme = function highlightTheme(themeToHighlight) {
|
|
@@ -1648,53 +2002,73 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1648
2002
|
}
|
|
1649
2003
|
});
|
|
1650
2004
|
}, [deleteTheme, themeToDelete]);
|
|
1651
|
-
return /*#__PURE__*/jsxs(
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
currentTheme: currentTheme,
|
|
1663
|
-
defaultThemes: defaultThemes,
|
|
1664
|
-
didScrollActiveThemeIntoView: didScrollActiveThemeIntoView,
|
|
1665
|
-
highlightTheme: highlightTheme,
|
|
1666
|
-
isApplyingTheme: isApplyingTheme,
|
|
1667
|
-
isCurrentThemeLoading: isCurrentThemeLoading,
|
|
1668
|
-
onApplyTheme: onApplyTheme,
|
|
1669
|
-
themeBeingApplied: themeBeingApplied,
|
|
1670
|
-
themeToHighlight: themeToHighlight,
|
|
1671
|
-
themes: themes,
|
|
1672
|
-
thumbnail: thumbnail,
|
|
1673
|
-
isLoading: isLoading || isFetchingSchema,
|
|
1674
|
-
onDeleteTheme: handleDelete,
|
|
1675
|
-
onEditTheme: handleEditTheme
|
|
1676
|
-
}) : /*#__PURE__*/jsx(Customize, {
|
|
1677
|
-
isApplyingTheme: isApplyingTheme,
|
|
1678
|
-
onApplyTheme: onApplyTheme,
|
|
1679
|
-
onCreateTheme: onCreateTheme,
|
|
1680
|
-
onPropertiesChange: onPropertiesChange,
|
|
1681
|
-
onUpdateThemeSuccess: onUpdateThemeSuccess,
|
|
1682
|
-
theme: themeToEdit.current,
|
|
1683
|
-
themeId: (_themeToEdit$current2 = themeToEdit.current) === null || _themeToEdit$current2 === void 0 ? void 0 : _themeToEdit$current2.id
|
|
1684
|
-
}), /*#__PURE__*/jsx(MemoizedAlert, {
|
|
1685
|
-
isOpen: isDeleteAlertOpen,
|
|
1686
|
-
isSubmitting: isDeleting,
|
|
1687
|
-
title: t("neetoThemes.alerts.title.deleteTheme"),
|
|
1688
|
-
message: t("neetoThemes.alerts.message.deleteTheme", {
|
|
1689
|
-
name: (_themeToDelete$curren2 = themeToDelete.current) === null || _themeToDelete$curren2 === void 0 ? void 0 : _themeToDelete$curren2.name,
|
|
1690
|
-
count: (_themeToDelete$curren3 = themeToDelete.current) === null || _themeToDelete$curren3 === void 0 ? void 0 : _themeToDelete$curren3.appliedCount,
|
|
1691
|
-
defaultThemeName: defaultThemeName,
|
|
1692
|
-
entityType: t("neetoThemes.entityType.".concat(entityType.toLowerCase()), {
|
|
1693
|
-
count: (_themeToDelete$curren4 = themeToDelete.current) === null || _themeToDelete$curren4 === void 0 ? void 0 : _themeToDelete$curren4.appliedCount
|
|
1694
|
-
})
|
|
2005
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
2006
|
+
children: [!isThemesSidebarCollapsed && /*#__PURE__*/jsx("div", {
|
|
2007
|
+
className: "neeto-themes-sidebar__backdrop",
|
|
2008
|
+
onClick: function onClick() {
|
|
2009
|
+
setIsThemesSidebarCollapsed(!isThemesSidebarCollapsed);
|
|
2010
|
+
}
|
|
2011
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
2012
|
+
className: classnames("neeto-themes-sidebar neeto-ui-border-gray-200 flex-shrink-0 border-r transition-all duration-300", {
|
|
2013
|
+
"neeto-themes-sidebar--expanded": isCustomCssScreen
|
|
2014
|
+
}, {
|
|
2015
|
+
"neeto-themes-sidebar--collapsed": isThemesSidebarCollapsed
|
|
1695
2016
|
}),
|
|
1696
|
-
|
|
1697
|
-
|
|
2017
|
+
children: [/*#__PURE__*/jsx(TitleBar, {
|
|
2018
|
+
currentScreen: currentScreen,
|
|
2019
|
+
handleBackPress: handleBackPress,
|
|
2020
|
+
handleCreateNewTheme: function handleCreateNewTheme() {
|
|
2021
|
+
return handleEditTheme({});
|
|
2022
|
+
},
|
|
2023
|
+
isNewTheme: !((_themeToEdit$current = themeToEdit.current) !== null && _themeToEdit$current !== void 0 && _themeToEdit$current.id),
|
|
2024
|
+
themeToEdit: themeToEdit.current
|
|
2025
|
+
}), currentScreen === DESIGN_SCREENS.THEMES ? /*#__PURE__*/jsx(Themes, {
|
|
2026
|
+
currentTheme: currentTheme,
|
|
2027
|
+
defaultThemes: defaultThemes,
|
|
2028
|
+
didScrollActiveThemeIntoView: didScrollActiveThemeIntoView,
|
|
2029
|
+
highlightTheme: highlightTheme,
|
|
2030
|
+
isApplyingTheme: isApplyingTheme,
|
|
2031
|
+
isCurrentThemeLoading: isCurrentThemeLoading,
|
|
2032
|
+
onApplyTheme: onApplyTheme,
|
|
2033
|
+
themeBeingApplied: themeBeingApplied,
|
|
2034
|
+
themeToHighlight: themeToHighlight,
|
|
2035
|
+
themes: themes,
|
|
2036
|
+
thumbnail: thumbnail,
|
|
2037
|
+
isLoading: isLoading || isFetchingSchema,
|
|
2038
|
+
onDeleteTheme: handleDelete,
|
|
2039
|
+
onEditTheme: handleEditTheme
|
|
2040
|
+
}) : /*#__PURE__*/jsx(Customize, {
|
|
2041
|
+
currentScreen: currentScreen,
|
|
2042
|
+
isApplyingTheme: isApplyingTheme,
|
|
2043
|
+
onApplyTheme: onApplyTheme,
|
|
2044
|
+
onCreateTheme: onCreateTheme,
|
|
2045
|
+
onPropertiesChange: onPropertiesChange,
|
|
2046
|
+
onUpdateThemeSuccess: onUpdateThemeSuccess,
|
|
2047
|
+
theme: themeToEdit.current,
|
|
2048
|
+
themeId: (_themeToEdit$current2 = themeToEdit.current) === null || _themeToEdit$current2 === void 0 ? void 0 : _themeToEdit$current2.id,
|
|
2049
|
+
onEditCSSClick: setCurrentScreen
|
|
2050
|
+
}), /*#__PURE__*/jsx(MemoizedAlert, {
|
|
2051
|
+
isOpen: isDeleteAlertOpen,
|
|
2052
|
+
isSubmitting: isDeleting,
|
|
2053
|
+
title: t("neetoThemes.alerts.title.deleteTheme"),
|
|
2054
|
+
message: t("neetoThemes.alerts.message.deleteTheme", {
|
|
2055
|
+
name: (_themeToDelete$curren2 = themeToDelete.current) === null || _themeToDelete$curren2 === void 0 ? void 0 : _themeToDelete$curren2.name,
|
|
2056
|
+
count: (_themeToDelete$curren3 = themeToDelete.current) === null || _themeToDelete$curren3 === void 0 ? void 0 : _themeToDelete$curren3.appliedCount,
|
|
2057
|
+
defaultThemeName: defaultThemeName,
|
|
2058
|
+
entityType: t("neetoThemes.entityType.".concat(entityType.toLowerCase()), {
|
|
2059
|
+
count: (_themeToDelete$curren4 = themeToDelete.current) === null || _themeToDelete$curren4 === void 0 ? void 0 : _themeToDelete$curren4.appliedCount
|
|
2060
|
+
})
|
|
2061
|
+
}),
|
|
2062
|
+
onClose: handleCloseDeleteAlert,
|
|
2063
|
+
onSubmit: handleDeleteTheme
|
|
2064
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
2065
|
+
className: "neeto-themes-sidebar__toggler",
|
|
2066
|
+
icon: Collapse,
|
|
2067
|
+
style: "secondary",
|
|
2068
|
+
onClick: function onClick() {
|
|
2069
|
+
setIsThemesSidebarCollapsed(!isThemesSidebarCollapsed);
|
|
2070
|
+
}
|
|
2071
|
+
})]
|
|
1698
2072
|
})]
|
|
1699
2073
|
});
|
|
1700
2074
|
};
|
|
@@ -1770,7 +2144,7 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
1770
2144
|
})]
|
|
1771
2145
|
});
|
|
1772
2146
|
};
|
|
1773
|
-
var index = withTitle(NeetoThemesBuilder, t$1("neetoThemes.common.
|
|
2147
|
+
var index = withTitle(NeetoThemesBuilder, t$1("neetoThemes.common.theme"));
|
|
1774
2148
|
|
|
1775
2149
|
export { index as default };
|
|
1776
2150
|
//# sourceMappingURL=NeetoThemesBuilder.js.map
|