@bigbinary/neeto-themes-frontend 3.1.9 → 3.1.11
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/dist/NeetoThemesBuilder.js +54 -120
- package/dist/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/NeetoThemesBuilder.js +61 -146
- package/dist/cjs/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/hooks.js +2 -1
- package/dist/cjs/hooks.js.map +1 -1
- package/dist/cjs/index.js +3 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/hooks.js +2 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/{useThemeUtils-B_bPCE4d.js → useThemeUtils-7t8QA7GV.js} +121 -2
- package/dist/useThemeUtils-7t8QA7GV.js.map +1 -0
- package/dist/{useThemeUtils-CMF6rI88.js → useThemeUtils-fDozYz5F.js} +99 -4
- package/dist/useThemeUtils-fDozYz5F.js.map +1 -0
- package/package.json +12 -12
- package/dist/useThemeUtils-B_bPCE4d.js.map +0 -1
- package/dist/useThemeUtils-CMF6rI88.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallow } from 'zustand/shallow';
|
|
2
|
-
import {
|
|
2
|
+
import { Suspense, lazy, useEffect, createElement, useState, useRef, memo, useCallback } from 'react';
|
|
3
3
|
import { hyphenate, findBy, findIndexBy, isPresent, isNot, filterBy, snakeToCamelCase, isNotPresent, toLabelAndValue, humanize, isNotEmpty, noop } from '@bigbinary/neeto-cist';
|
|
4
4
|
import { useMutationWithInvalidation, withT, useBreakpoints, PageTitle } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
5
5
|
import Spinner from '@bigbinary/neetoui/Spinner';
|
|
@@ -7,7 +7,7 @@ import { useTranslation, Trans } from 'react-i18next';
|
|
|
7
7
|
import { B as BASE_URL, b as scrollElementIntoView, c as setCustomCSS, g as getDominantColorFromUrl, i as isEditThemeRoute, d as isFunction, e as isNewThemeRoute } from './index-i8lxlWVz.js';
|
|
8
8
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
9
9
|
import axios from 'axios';
|
|
10
|
-
import { Q as QUERY_KEYS, a as useConfigStore, b as useThemeStore, u as useThemeUtils } from './useThemeUtils-
|
|
10
|
+
import { Q as QUERY_KEYS, a as useConfigStore, b as useThemeStore, u as useThemeUtils, P as POSITION_OPTIONS, O as OVERLAY_OPACITY_SLIDER_MARKS, H as HUNDRED, F as FONT_OPTIONS, T as THEME_VALIDATION_SCHEMA } from './useThemeUtils-fDozYz5F.js';
|
|
11
11
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
12
12
|
import classnames from 'classnames';
|
|
13
13
|
import { joinHyphenCase, buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
@@ -26,11 +26,9 @@ import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
|
26
26
|
import Form from '@bigbinary/neetoui/formik/Form';
|
|
27
27
|
import BlockNavigation from '@bigbinary/neetoui/formik/BlockNavigation';
|
|
28
28
|
import { isEmpty, negate, isNotNil } from 'ramda';
|
|
29
|
-
import * as yup from 'yup';
|
|
30
|
-
import Editor from '@monaco-editor/react';
|
|
31
29
|
import { useFormikContext, Field } from 'formik';
|
|
30
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
32
31
|
import Down from '@bigbinary/neeto-icons/Down';
|
|
33
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
34
32
|
import { t as t$1 } from 'i18next';
|
|
35
33
|
import CenterAlign from '@bigbinary/neeto-icons/CenterAlign';
|
|
36
34
|
import LeftAlign from '@bigbinary/neeto-icons/LeftAlign';
|
|
@@ -49,6 +47,7 @@ import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
|
49
47
|
import LeftArrow from '@bigbinary/neeto-icons/LeftArrow';
|
|
50
48
|
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
51
49
|
import 'zustand';
|
|
50
|
+
import 'yup';
|
|
52
51
|
|
|
53
52
|
var show$2 = function show(entityId) {
|
|
54
53
|
return axios.get("".concat(BASE_URL, "/api/v1/entities/").concat(entityId));
|
|
@@ -223,94 +222,6 @@ var useShowGlobalTheme = function useShowGlobalTheme(entityType) {
|
|
|
223
222
|
});
|
|
224
223
|
};
|
|
225
224
|
|
|
226
|
-
var POSITION_OPTIONS = [{
|
|
227
|
-
label: "Left",
|
|
228
|
-
value: "left"
|
|
229
|
-
}, {
|
|
230
|
-
label: "Right",
|
|
231
|
-
value: "right"
|
|
232
|
-
}];
|
|
233
|
-
var FONT_OPTIONS = [{
|
|
234
|
-
label: "System UI",
|
|
235
|
-
value: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'
|
|
236
|
-
}, {
|
|
237
|
-
label: "Cedarville Cursive",
|
|
238
|
-
value: "'Cedarville Cursive', cursive"
|
|
239
|
-
}, {
|
|
240
|
-
label: "Poppins",
|
|
241
|
-
value: "Poppins, sans-serif"
|
|
242
|
-
}, {
|
|
243
|
-
label: "Roboto",
|
|
244
|
-
value: "Roboto, sans-serif"
|
|
245
|
-
}, {
|
|
246
|
-
label: "Open Sans",
|
|
247
|
-
value: "Open Sans, sans-serif"
|
|
248
|
-
}, {
|
|
249
|
-
label: "Montserrat",
|
|
250
|
-
value: "Montserrat, sans-serif"
|
|
251
|
-
}, {
|
|
252
|
-
label: "Raleway",
|
|
253
|
-
value: "Raleway, sans-serif"
|
|
254
|
-
}, {
|
|
255
|
-
label: "Quicksand",
|
|
256
|
-
value: "Quicksand, sans-serif"
|
|
257
|
-
}, {
|
|
258
|
-
label: "Inter",
|
|
259
|
-
value: "Inter, sans-serif"
|
|
260
|
-
}, {
|
|
261
|
-
label: "Satoshi",
|
|
262
|
-
value: "Satoshi, sans-serif"
|
|
263
|
-
}, {
|
|
264
|
-
label: "Chillax",
|
|
265
|
-
value: "Chillax, sans-serif"
|
|
266
|
-
}, {
|
|
267
|
-
label: "Clash Display",
|
|
268
|
-
value: "Clash Display, sans-serif"
|
|
269
|
-
}, {
|
|
270
|
-
label: "General Sans",
|
|
271
|
-
value: "General Sans, sans-serif"
|
|
272
|
-
}, {
|
|
273
|
-
label: "Cabinet Grotesk",
|
|
274
|
-
value: "Cabinet Grotesk, sans-serif"
|
|
275
|
-
}, {
|
|
276
|
-
label: "Lora",
|
|
277
|
-
value: "Lora, serif"
|
|
278
|
-
}, {
|
|
279
|
-
label: "Merriweather",
|
|
280
|
-
value: "Merriweather, serif"
|
|
281
|
-
}, {
|
|
282
|
-
label: "Boska",
|
|
283
|
-
value: "Boska, serif"
|
|
284
|
-
}, {
|
|
285
|
-
label: "Playfair Display",
|
|
286
|
-
value: "Playfair Display, serif"
|
|
287
|
-
}, {
|
|
288
|
-
label: "Roboto Slab",
|
|
289
|
-
value: "Roboto Slab, serif"
|
|
290
|
-
}, {
|
|
291
|
-
label: "Dancing Script",
|
|
292
|
-
value: "Dancing Script, cursive"
|
|
293
|
-
}, {
|
|
294
|
-
label: "Tw Cent",
|
|
295
|
-
value: "Tw Cen MT, Tahoma, sans-serif"
|
|
296
|
-
}, {
|
|
297
|
-
label: "Comic Sans",
|
|
298
|
-
value: "Comic Sans MS, cursive"
|
|
299
|
-
}];
|
|
300
|
-
var THEME_VALIDATION_SCHEMA = yup.object().shape({
|
|
301
|
-
name: yup.string().required("Name is required")
|
|
302
|
-
});
|
|
303
|
-
var OVERLAY_OPACITY_SLIDER_MARKS = {
|
|
304
|
-
0: " "
|
|
305
|
-
};
|
|
306
|
-
var HUNDRED = 100;
|
|
307
|
-
var ACCORDIAN_OPEN_STATE = {
|
|
308
|
-
name: true,
|
|
309
|
-
style: true,
|
|
310
|
-
images: false,
|
|
311
|
-
customcss: false
|
|
312
|
-
};
|
|
313
|
-
|
|
314
225
|
var DESIGN_SCREENS = {
|
|
315
226
|
THEMES: "Themes",
|
|
316
227
|
Customize: "Customize",
|
|
@@ -318,6 +229,35 @@ var DESIGN_SCREENS = {
|
|
|
318
229
|
};
|
|
319
230
|
var ONE_MEGABYTE = 1;
|
|
320
231
|
|
|
232
|
+
var MonacoEditor = /*#__PURE__*/lazy(function () {
|
|
233
|
+
return import('@monaco-editor/react');
|
|
234
|
+
});
|
|
235
|
+
var Editor = function Editor(_ref) {
|
|
236
|
+
var value = _ref.value,
|
|
237
|
+
isCustomCssScreen = _ref.isCustomCssScreen,
|
|
238
|
+
onChange = _ref.onChange;
|
|
239
|
+
return /*#__PURE__*/jsx(Suspense, {
|
|
240
|
+
fallback: /*#__PURE__*/jsx(Spinner, {}),
|
|
241
|
+
children: /*#__PURE__*/jsx(MonacoEditor, {
|
|
242
|
+
onChange: onChange,
|
|
243
|
+
value: value,
|
|
244
|
+
language: "css",
|
|
245
|
+
theme: "vs-dark",
|
|
246
|
+
className: classnames({
|
|
247
|
+
rounded: true,
|
|
248
|
+
"css-editor-height__expanded": isCustomCssScreen,
|
|
249
|
+
"css-editor-height__regular": !isCustomCssScreen
|
|
250
|
+
}),
|
|
251
|
+
options: {
|
|
252
|
+
scrollBeyondLastLine: false,
|
|
253
|
+
minimap: {
|
|
254
|
+
enabled: false
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
})
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
|
|
321
261
|
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; }
|
|
322
262
|
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; }
|
|
323
263
|
var Card$2 = function Card(_ref) {
|
|
@@ -326,21 +266,25 @@ var Card$2 = function Card(_ref) {
|
|
|
326
266
|
children = _ref.children,
|
|
327
267
|
name = _ref.name,
|
|
328
268
|
className = _ref.className;
|
|
329
|
-
var
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
269
|
+
var _useConfigStore = useConfigStore(function (store) {
|
|
270
|
+
return {
|
|
271
|
+
accordionOpenState: store["accordionOpenState"],
|
|
272
|
+
setAccordionOpenState: store["setAccordionOpenState"]
|
|
273
|
+
};
|
|
274
|
+
}, shallow),
|
|
275
|
+
accordionOpenState = _useConfigStore.accordionOpenState,
|
|
276
|
+
setAccordionOpenState = _useConfigStore.setAccordionOpenState;
|
|
333
277
|
return /*#__PURE__*/jsxs("div", {
|
|
334
278
|
"data-cy": "theme-".concat(hyphenate(title), "-properties"),
|
|
335
279
|
className: classnames("neeto-themes-nano-section neeto-ui-border-gray-200 border-b pt-2 transition-all duration-300 last:border-none", className, {
|
|
336
|
-
"pb-2": !
|
|
337
|
-
"pb-3":
|
|
280
|
+
"pb-2": !accordionOpenState[name],
|
|
281
|
+
"pb-3": accordionOpenState[name]
|
|
338
282
|
}),
|
|
339
283
|
children: [title && /*#__PURE__*/jsxs("button", {
|
|
340
284
|
className: "neeto-themes-nano-section__title flex w-full cursor-pointer items-center justify-between px-1 py-2 focus:outline-none",
|
|
341
285
|
type: "button",
|
|
342
286
|
onClick: function onClick() {
|
|
343
|
-
return
|
|
287
|
+
return setAccordionOpenState(_objectSpread$4(_objectSpread$4({}, accordionOpenState), {}, _defineProperty({}, name, !accordionOpenState[name])));
|
|
344
288
|
},
|
|
345
289
|
children: [/*#__PURE__*/jsx(Typography, {
|
|
346
290
|
className: "min-w-0 flex-grow text-left",
|
|
@@ -353,13 +297,13 @@ var Card$2 = function Card(_ref) {
|
|
|
353
297
|
}), /*#__PURE__*/jsx(Down, {
|
|
354
298
|
size: 20,
|
|
355
299
|
className: classnames("transition-all duration-300", {
|
|
356
|
-
"rotate-180":
|
|
300
|
+
"rotate-180": accordionOpenState[name]
|
|
357
301
|
})
|
|
358
302
|
})]
|
|
359
303
|
}), children && /*#__PURE__*/jsx("div", {
|
|
360
304
|
className: classnames("neeto-themes-nano-section__content w-full space-y-3 overflow-hidden px-1 transition-all duration-300", {
|
|
361
|
-
"neeto-themes-nano-section__content--closed": !
|
|
362
|
-
"neeto-themes-nano-section__content--open pb-1":
|
|
305
|
+
"neeto-themes-nano-section__content--closed": !accordionOpenState[name],
|
|
306
|
+
"neeto-themes-nano-section__content--open pb-1": accordionOpenState[name]
|
|
363
307
|
}),
|
|
364
308
|
children: children
|
|
365
309
|
})]
|
|
@@ -405,10 +349,12 @@ var CustomCSS = function CustomCSS(_ref) {
|
|
|
405
349
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
406
350
|
var _useConfigStore = useConfigStore(function (store) {
|
|
407
351
|
return {
|
|
408
|
-
themePropertiesSchema: store["themePropertiesSchema"]
|
|
352
|
+
themePropertiesSchema: store["themePropertiesSchema"],
|
|
353
|
+
accordionOpenState: store["accordionOpenState"]
|
|
409
354
|
};
|
|
410
355
|
}, shallow),
|
|
411
|
-
themePropertiesSchema = _useConfigStore.themePropertiesSchema
|
|
356
|
+
themePropertiesSchema = _useConfigStore.themePropertiesSchema,
|
|
357
|
+
accordionOpenState = _useConfigStore.accordionOpenState;
|
|
412
358
|
var customCSS = findBy({
|
|
413
359
|
kind: "custom_css"
|
|
414
360
|
}, values.properties);
|
|
@@ -453,21 +399,9 @@ var CustomCSS = function CustomCSS(_ref) {
|
|
|
453
399
|
label: isCustomCssScreen ? t("neetoThemes.buttons.minimizeEditor") : t("neetoThemes.buttons.expandEditor"),
|
|
454
400
|
onClick: handleEditorToggle
|
|
455
401
|
})
|
|
456
|
-
}), /*#__PURE__*/jsx(Editor, {
|
|
457
|
-
|
|
458
|
-
theme: "vs-dark",
|
|
402
|
+
}), accordionOpenState.customcss && /*#__PURE__*/jsx(Editor, {
|
|
403
|
+
isCustomCssScreen: isCustomCssScreen,
|
|
459
404
|
value: customCSS.value,
|
|
460
|
-
className: classnames({
|
|
461
|
-
rounded: true,
|
|
462
|
-
"css-editor-height__expanded": isCustomCssScreen,
|
|
463
|
-
"css-editor-height__regular": !isCustomCssScreen
|
|
464
|
-
}),
|
|
465
|
-
options: {
|
|
466
|
-
scrollBeyondLastLine: false,
|
|
467
|
-
minimap: {
|
|
468
|
-
enabled: false
|
|
469
|
-
}
|
|
470
|
-
},
|
|
471
405
|
onChange: handleChange
|
|
472
406
|
})]
|
|
473
407
|
})
|
|
@@ -1148,7 +1082,7 @@ var Images = function Images(_ref) {
|
|
|
1148
1082
|
return /*#__PURE__*/jsxs(Card$2, {
|
|
1149
1083
|
className: className,
|
|
1150
1084
|
title: title,
|
|
1151
|
-
name:
|
|
1085
|
+
name: key,
|
|
1152
1086
|
children: [/*#__PURE__*/jsx(ImageBlock, {
|
|
1153
1087
|
attribute: attribute,
|
|
1154
1088
|
defaultImageSize: defaultImageSize,
|