@bigbinary/neeto-themes-frontend 4.2.3 → 4.2.4-beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/javascript/src/translations/en.json +2 -0
- package/dist/.ready +1 -1
- package/dist/NeetoThemesBuilder.js +189 -87
- package/dist/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/NeetoThemesBuilder.js +187 -85
- package/dist/cjs/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/v2/NeetoThemesBuilder.js +186 -82
- package/dist/cjs/v2/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/v2/index.js +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/{useGlobalThemesApi-L0AWdlhf.js → useGlobalThemesApi-D04VWBoL.js} +4 -7
- package/dist/{useGlobalThemesApi-L0AWdlhf.js.map → useGlobalThemesApi-D04VWBoL.js.map} +1 -1
- package/dist/{useGlobalThemesApi-B_qW7yfd.js → useGlobalThemesApi-gt4U6XWZ.js} +3 -7
- package/dist/{useGlobalThemesApi-B_qW7yfd.js.map → useGlobalThemesApi-gt4U6XWZ.js.map} +1 -1
- package/dist/v2/NeetoThemesBuilder.js +189 -85
- package/dist/v2/NeetoThemesBuilder.js.map +1 -1
- package/dist/v2/index.js +1 -1
- package/package.json +13 -13
package/dist/cjs/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var NeetoThemesBuilder = require('./NeetoThemesBuilder.js');
|
|
4
4
|
var useExpandedSection = require('../useExpandedSection-BTBI4UqP.js');
|
|
5
|
-
var useGlobalThemesApi = require('../useGlobalThemesApi-
|
|
5
|
+
var useGlobalThemesApi = require('../useGlobalThemesApi-gt4U6XWZ.js');
|
|
6
6
|
var utils = require('../index-CZdpMMBb.js');
|
|
7
7
|
require('zustand/shallow');
|
|
8
8
|
require('react');
|
|
@@ -55,6 +55,7 @@ require('@bigbinary/neeto-icons/AddImage');
|
|
|
55
55
|
require('@bigbinary/neeto-icons/CodeBlock');
|
|
56
56
|
require('@bigbinary/neeto-icons/ColorPicker');
|
|
57
57
|
require('@bigbinary/neeto-molecules/MoreDropdown');
|
|
58
|
+
require('@bigbinary/neetoui/Tag');
|
|
58
59
|
require('@bigbinary/neeto-icons/LeftArrow');
|
|
59
60
|
require('@bigbinary/neeto-icons/RightArrow');
|
|
60
61
|
require('@bigbinary/neeto-icons/Search');
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -6,7 +6,7 @@ var neetoAtoms = require('@bigbinary/neeto-atoms');
|
|
|
6
6
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
7
7
|
var reactUtils$1 = require('@bigbinary/neeto-commons-frontend/v2/react-utils');
|
|
8
8
|
var reactI18next = require('react-i18next');
|
|
9
|
-
var useGlobalThemesApi = require('../../useGlobalThemesApi-
|
|
9
|
+
var useGlobalThemesApi = require('../../useGlobalThemesApi-gt4U6XWZ.js');
|
|
10
10
|
var useExpandedSection = require('../../useExpandedSection-BTBI4UqP.js');
|
|
11
11
|
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
12
12
|
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
@@ -762,6 +762,15 @@ var buildProperties = function buildProperties(values, condition, themePropertie
|
|
|
762
762
|
return !imageKeys.has(dependsOn);
|
|
763
763
|
});
|
|
764
764
|
};
|
|
765
|
+
var buildSystemThemeCopy = function buildSystemThemeCopy(systemTheme) {
|
|
766
|
+
if (!systemTheme) return null;
|
|
767
|
+
return _objectSpread$2(_objectSpread$2({}, ramda.omit(["id"], systemTheme)), {}, {
|
|
768
|
+
name: i18n.t("neetoThemes.common.cloneName", {
|
|
769
|
+
name: systemTheme.name
|
|
770
|
+
}),
|
|
771
|
+
properties: systemTheme.properties.map(ramda.omit(["id", "themeId"]))
|
|
772
|
+
});
|
|
773
|
+
};
|
|
765
774
|
|
|
766
775
|
var AlignmentBlock = reactUtils.withT(function (_ref) {
|
|
767
776
|
var t = _ref.t,
|
|
@@ -1380,6 +1389,7 @@ var Customize = function Customize(_ref) {
|
|
|
1380
1389
|
var theme = _ref.theme,
|
|
1381
1390
|
onCreateTheme = _ref.onCreateTheme,
|
|
1382
1391
|
onApplyTheme = _ref.onApplyTheme,
|
|
1392
|
+
onApplyThemeSuccess = _ref.onApplyThemeSuccess,
|
|
1383
1393
|
onUpdateTheme = _ref.onUpdateTheme,
|
|
1384
1394
|
isApplyingTheme = _ref.isApplyingTheme,
|
|
1385
1395
|
onPropertiesChange = _ref.onPropertiesChange,
|
|
@@ -1398,6 +1408,7 @@ var Customize = function Customize(_ref) {
|
|
|
1398
1408
|
var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
|
|
1399
1409
|
return {
|
|
1400
1410
|
themePropertiesSchema: store["themePropertiesSchema"],
|
|
1411
|
+
entityId: store["entityId"],
|
|
1401
1412
|
entityType: store["entityType"],
|
|
1402
1413
|
isFetchingSchema: store["isFetchingSchema"],
|
|
1403
1414
|
helpPopoverProps: store["helpPopoverProps"],
|
|
@@ -1406,6 +1417,7 @@ var Customize = function Customize(_ref) {
|
|
|
1406
1417
|
};
|
|
1407
1418
|
}, shallow.shallow),
|
|
1408
1419
|
themePropertiesSchema = _useConfigStore.themePropertiesSchema,
|
|
1420
|
+
entityId = _useConfigStore.entityId,
|
|
1409
1421
|
entityType = _useConfigStore.entityType,
|
|
1410
1422
|
isFetchingSchema = _useConfigStore.isFetchingSchema,
|
|
1411
1423
|
helpPopoverProps = _useConfigStore.helpPopoverProps,
|
|
@@ -1413,6 +1425,9 @@ var Customize = function Customize(_ref) {
|
|
|
1413
1425
|
proFeatures = _useConfigStore.proFeatures;
|
|
1414
1426
|
var _useParams = reactRouterDom.useParams(),
|
|
1415
1427
|
themeId = _useParams.themeId;
|
|
1428
|
+
var _useQueryParams = reactUtils$1.useQueryParams(),
|
|
1429
|
+
sourceThemeId = _useQueryParams.source;
|
|
1430
|
+
var isCustomizingSystemTheme = !themeId && neetoCist.isPresent(sourceThemeId);
|
|
1416
1431
|
var _useThemeStore = useExpandedSection.useThemeStore(function (store) {
|
|
1417
1432
|
return {
|
|
1418
1433
|
currentTheme: store["currentTheme"],
|
|
@@ -1433,22 +1448,79 @@ var Customize = function Customize(_ref) {
|
|
|
1433
1448
|
_useFetchTheme$data = _useFetchTheme.data,
|
|
1434
1449
|
themeData = _useFetchTheme$data === void 0 ? {} : _useFetchTheme$data,
|
|
1435
1450
|
isLoadingTheme = _useFetchTheme.isLoadingTheme;
|
|
1436
|
-
var
|
|
1451
|
+
var _useListThemes = useGlobalThemesApi.useListThemes(entityId),
|
|
1452
|
+
_useListThemes$data = _useListThemes.data,
|
|
1453
|
+
_useListThemes$data2 = _useListThemes$data === void 0 ? {} : _useListThemes$data,
|
|
1454
|
+
_useListThemes$data2$ = _useListThemes$data2.defaultThemes,
|
|
1455
|
+
defaultThemes = _useListThemes$data2$ === void 0 ? [] : _useListThemes$data2$,
|
|
1456
|
+
isLoadingSystemThemes = _useListThemes.isLoading;
|
|
1457
|
+
var sourceTheme = isCustomizingSystemTheme ? neetoCist.findBy({
|
|
1458
|
+
id: sourceThemeId
|
|
1459
|
+
}, defaultThemes) : null;
|
|
1460
|
+
var systemThemeCopy = react.useMemo(function () {
|
|
1461
|
+
return buildSystemThemeCopy(sourceTheme);
|
|
1462
|
+
}, [sourceTheme === null || sourceTheme === void 0 ? void 0 : sourceTheme.id]);
|
|
1463
|
+
var themeToCustomize = isCustomizingSystemTheme ? systemThemeCopy : themeData;
|
|
1464
|
+
var isLoading = isFetchingSchema || isLoadingTheme || isCustomizingSystemTheme && isLoadingSystemThemes;
|
|
1437
1465
|
var isThemeGlobalTheme = themeId && (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === themeId;
|
|
1438
1466
|
var isCurrentThemeAndGlobalThemeSame = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id);
|
|
1439
1467
|
var _helpPopoverProps$sty = helpPopoverProps.style,
|
|
1440
1468
|
styleHelpPopoverProps = _helpPopoverProps$sty === void 0 ? {} : _helpPopoverProps$sty;
|
|
1441
|
-
var isEditingCurrentlyAppliedTheme = themeId === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
|
|
1469
|
+
var isEditingCurrentlyAppliedTheme = (themeId !== null && themeId !== void 0 ? themeId : sourceThemeId) === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
|
|
1442
1470
|
var _useCreateTheme = useGlobalThemesApi.useCreateTheme(),
|
|
1443
1471
|
createTheme = _useCreateTheme.mutateAsync,
|
|
1444
1472
|
isCreating = _useCreateTheme.isPending;
|
|
1445
1473
|
var _useUpdateTheme = useGlobalThemesApi.useUpdateTheme(themeId),
|
|
1446
1474
|
updateTheme = _useUpdateTheme.mutateAsync,
|
|
1447
1475
|
isUpdating = _useUpdateTheme.isPending;
|
|
1448
|
-
var
|
|
1476
|
+
var _useApplyTheme = useGlobalThemesApi.useApplyTheme({}),
|
|
1477
|
+
applyTheme = _useApplyTheme.mutateAsync,
|
|
1478
|
+
isApplyingCreatedTheme = _useApplyTheme.isPending;
|
|
1479
|
+
var isSubmitting = isCreating || isUpdating || isApplyingCreatedTheme;
|
|
1449
1480
|
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
1450
|
-
var
|
|
1451
|
-
var
|
|
1481
|
+
var createAndOpenTheme = /*#__PURE__*/function () {
|
|
1482
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(themeToSave, resetForm) {
|
|
1483
|
+
var _yield$createTheme, theme;
|
|
1484
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1485
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1486
|
+
case 0:
|
|
1487
|
+
_context.next = 2;
|
|
1488
|
+
return createTheme(themeToSave);
|
|
1489
|
+
case 2:
|
|
1490
|
+
_yield$createTheme = _context.sent;
|
|
1491
|
+
theme = _yield$createTheme.theme;
|
|
1492
|
+
resetForm({
|
|
1493
|
+
values: theme
|
|
1494
|
+
});
|
|
1495
|
+
if (!isCustomizingSystemTheme) {
|
|
1496
|
+
_context.next = 9;
|
|
1497
|
+
break;
|
|
1498
|
+
}
|
|
1499
|
+
_context.next = 8;
|
|
1500
|
+
return applyTheme({
|
|
1501
|
+
themeId: theme.id,
|
|
1502
|
+
entityId: entityId,
|
|
1503
|
+
entityType: entityType
|
|
1504
|
+
});
|
|
1505
|
+
case 8:
|
|
1506
|
+
onApplyThemeSuccess === null || onApplyThemeSuccess === void 0 || onApplyThemeSuccess(theme);
|
|
1507
|
+
case 9:
|
|
1508
|
+
onCreateTheme(theme);
|
|
1509
|
+
history.replace(utils$1.buildUrl(buildPathname(useGlobalThemesApi.routes.themes.edit), {
|
|
1510
|
+
themeId: theme.id
|
|
1511
|
+
}));
|
|
1512
|
+
case 11:
|
|
1513
|
+
case "end":
|
|
1514
|
+
return _context.stop();
|
|
1515
|
+
}
|
|
1516
|
+
}, _callee);
|
|
1517
|
+
}));
|
|
1518
|
+
return function createAndOpenTheme(_x, _x2) {
|
|
1519
|
+
return _ref2.apply(this, arguments);
|
|
1520
|
+
};
|
|
1521
|
+
}();
|
|
1522
|
+
var onSubmit = function onSubmit(values, _ref3) {
|
|
1523
|
+
var resetForm = _ref3.resetForm;
|
|
1452
1524
|
var imageData = buildImageData(values, themePropertiesSchema);
|
|
1453
1525
|
var themeToSave = _objectSpread({
|
|
1454
1526
|
propertiesAttributes: values.properties,
|
|
@@ -1456,20 +1528,7 @@ var Customize = function Customize(_ref) {
|
|
|
1456
1528
|
shouldSetAsGlobalTheme: values.shouldSetAsGlobalTheme,
|
|
1457
1529
|
entityType: values.entityType
|
|
1458
1530
|
}, imageData);
|
|
1459
|
-
if (!themeId)
|
|
1460
|
-
return createTheme(themeToSave, {
|
|
1461
|
-
onSuccess: function onSuccess(_ref3) {
|
|
1462
|
-
var theme = _ref3.theme;
|
|
1463
|
-
resetForm({
|
|
1464
|
-
values: theme
|
|
1465
|
-
});
|
|
1466
|
-
onCreateTheme(theme);
|
|
1467
|
-
history.replace(utils$1.buildUrl(buildPathname(useGlobalThemesApi.routes.themes.edit), {
|
|
1468
|
-
themeId: theme.id
|
|
1469
|
-
}));
|
|
1470
|
-
}
|
|
1471
|
-
});
|
|
1472
|
-
}
|
|
1531
|
+
if (!themeId) return createAndOpenTheme(themeToSave, resetForm);
|
|
1473
1532
|
return updateTheme(themeToSave, {
|
|
1474
1533
|
onSuccess: function onSuccess(_ref4) {
|
|
1475
1534
|
var theme = _ref4.theme;
|
|
@@ -1495,7 +1554,7 @@ var Customize = function Customize(_ref) {
|
|
|
1495
1554
|
}
|
|
1496
1555
|
return /*#__PURE__*/jsxRuntime.jsx(formik$1.Form, {
|
|
1497
1556
|
formikProps: {
|
|
1498
|
-
initialValues: _objectSpread(_objectSpread({}, buildInitialValues(
|
|
1557
|
+
initialValues: _objectSpread(_objectSpread({}, buildInitialValues(themeToCustomize, themePropertiesSchema)), {}, {
|
|
1499
1558
|
shouldSetAsGlobalTheme: isThemeGlobalTheme,
|
|
1500
1559
|
entityType: entityType
|
|
1501
1560
|
}),
|
|
@@ -1594,7 +1653,7 @@ var Customize = function Customize(_ref) {
|
|
|
1594
1653
|
label: t("neetoThemes.buttons.save"),
|
|
1595
1654
|
loading: isSubmitting,
|
|
1596
1655
|
type: "submit",
|
|
1597
|
-
disabled: !dirty && (
|
|
1656
|
+
disabled: !dirty && (themeToCustomize === null || themeToCustomize === void 0 ? void 0 : themeToCustomize.id) || isSubmitting || !isValid,
|
|
1598
1657
|
onClick: function onClick() {
|
|
1599
1658
|
if (isNotAppliedCondition) {
|
|
1600
1659
|
setIsNotAppliedPopoverOpen(true);
|
|
@@ -1641,26 +1700,49 @@ var Customize = function Customize(_ref) {
|
|
|
1641
1700
|
});
|
|
1642
1701
|
};
|
|
1643
1702
|
|
|
1644
|
-
var QuickActionRow = function
|
|
1645
|
-
var
|
|
1703
|
+
var QuickActionRow = reactUtils.withT(function (_ref) {
|
|
1704
|
+
var t = _ref.t,
|
|
1705
|
+
Icon = _ref.icon,
|
|
1646
1706
|
label = _ref.label,
|
|
1647
1707
|
onClick = _ref.onClick,
|
|
1648
|
-
testId = _ref.testId
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
children:
|
|
1661
|
-
|
|
1708
|
+
testId = _ref.testId,
|
|
1709
|
+
_ref$disabled = _ref.disabled,
|
|
1710
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
1711
|
+
disabledTooltip = _ref.disabledTooltip,
|
|
1712
|
+
_ref$isProFeature = _ref.isProFeature,
|
|
1713
|
+
isProFeature = _ref$isProFeature === void 0 ? false : _ref$isProFeature;
|
|
1714
|
+
return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Tooltip, {
|
|
1715
|
+
content: disabledTooltip,
|
|
1716
|
+
disabled: !disabled || !disabledTooltip,
|
|
1717
|
+
position: "top",
|
|
1718
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1719
|
+
className: "border-border border-t",
|
|
1720
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("button", {
|
|
1721
|
+
disabled: disabled,
|
|
1722
|
+
onClick: onClick,
|
|
1723
|
+
"data-testid": testId,
|
|
1724
|
+
type: "button",
|
|
1725
|
+
className: classnames("flex w-full items-center gap-2 px-3 py-1.5 text-start transition-colors", {
|
|
1726
|
+
"hover:bg-muted cursor-pointer": !disabled,
|
|
1727
|
+
"cursor-not-allowed opacity-50": disabled
|
|
1728
|
+
}),
|
|
1729
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
1730
|
+
className: "text-muted-foreground",
|
|
1731
|
+
size: 16
|
|
1732
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
1733
|
+
className: "text-sm",
|
|
1734
|
+
variant: "body2",
|
|
1735
|
+
children: label
|
|
1736
|
+
}), isProFeature && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Badge, {
|
|
1737
|
+
"data-testid": "".concat(testId, "-pro-badge"),
|
|
1738
|
+
label: t("neetoThemes.common.pro"),
|
|
1739
|
+
size: "sm",
|
|
1740
|
+
variant: "purple-subtle"
|
|
1741
|
+
})]
|
|
1742
|
+
})
|
|
1743
|
+
})
|
|
1662
1744
|
});
|
|
1663
|
-
};
|
|
1745
|
+
});
|
|
1664
1746
|
|
|
1665
1747
|
var Thumbnail = function Thumbnail(_ref) {
|
|
1666
1748
|
var _theme$snakeToCamelCa, _findBy, _findBy2;
|
|
@@ -1749,7 +1831,7 @@ var Card = function Card(_ref) {
|
|
|
1749
1831
|
onEditTheme = _ref.onEditTheme,
|
|
1750
1832
|
theme = _ref.theme,
|
|
1751
1833
|
isApplyingTheme = _ref.isApplyingTheme,
|
|
1752
|
-
|
|
1834
|
+
onCustomizeSystemTheme = _ref.onCustomizeSystemTheme,
|
|
1753
1835
|
isHighLightedTheme = _ref.isHighLightedTheme,
|
|
1754
1836
|
isGlobalTheme = _ref.isGlobalTheme,
|
|
1755
1837
|
onApplyTheme = _ref.onApplyTheme,
|
|
@@ -1758,22 +1840,32 @@ var Card = function Card(_ref) {
|
|
|
1758
1840
|
t = _useTranslation.t;
|
|
1759
1841
|
var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
|
|
1760
1842
|
return {
|
|
1761
|
-
themePropertiesSchema: store["themePropertiesSchema"]
|
|
1843
|
+
themePropertiesSchema: store["themePropertiesSchema"],
|
|
1844
|
+
enabledFeatures: store["enabledFeatures"],
|
|
1845
|
+
proFeatures: store["proFeatures"]
|
|
1762
1846
|
};
|
|
1763
1847
|
}, shallow.shallow),
|
|
1764
|
-
themePropertiesSchema = _useConfigStore.themePropertiesSchema
|
|
1848
|
+
themePropertiesSchema = _useConfigStore.themePropertiesSchema,
|
|
1849
|
+
enabledFeatures = _useConfigStore.enabledFeatures,
|
|
1850
|
+
proFeatures = _useConfigStore.proFeatures;
|
|
1765
1851
|
var id = theme.id,
|
|
1766
1852
|
name = theme.name;
|
|
1767
1853
|
var imageProperties = neetoCist.filterBy({
|
|
1768
1854
|
kind: "image"
|
|
1769
1855
|
}, themePropertiesSchema);
|
|
1856
|
+
var isCustomCSSInSchema = neetoCist.isPresent(neetoCist.findBy({
|
|
1857
|
+
kind: "custom_css"
|
|
1858
|
+
}, themePropertiesSchema));
|
|
1859
|
+
var isCustomCSSEnabled = Boolean(enabledFeatures.customCSS);
|
|
1860
|
+
var isCustomCSSProFeature = Boolean(proFeatures.customCSS);
|
|
1861
|
+
var showCustomCSSAction = isCustomCSSInSchema && (isCustomCSSEnabled || isCustomCSSProFeature);
|
|
1770
1862
|
var handleDeleteTheme = function handleDeleteTheme() {
|
|
1771
1863
|
return onDeleteTheme(id, name);
|
|
1772
1864
|
};
|
|
1773
1865
|
var handleQuickEdit = function handleQuickEdit(section) {
|
|
1774
1866
|
return function (e) {
|
|
1775
1867
|
e.stopPropagation();
|
|
1776
|
-
if (neetoCist.isPresent(onEditTheme)) onEditTheme(theme, section);else
|
|
1868
|
+
if (neetoCist.isPresent(onEditTheme)) onEditTheme(theme, section);else onCustomizeSystemTheme(theme, section);
|
|
1777
1869
|
};
|
|
1778
1870
|
};
|
|
1779
1871
|
var showMoreDropdown = isFunction(onDeleteTheme);
|
|
@@ -1906,10 +1998,13 @@ var Card = function Card(_ref) {
|
|
|
1906
1998
|
testId: "quick-add-".concat(neetoCist.hyphenate(key)),
|
|
1907
1999
|
onClick: handleQuickEdit(camelKey)
|
|
1908
2000
|
}, key);
|
|
1909
|
-
}), /*#__PURE__*/jsxRuntime.jsx(QuickActionRow, {
|
|
2001
|
+
}), showCustomCSSAction && /*#__PURE__*/jsxRuntime.jsx(QuickActionRow, {
|
|
2002
|
+
disabled: !isCustomCSSEnabled,
|
|
1910
2003
|
icon: lucideReact.Code,
|
|
2004
|
+
isProFeature: isCustomCSSProFeature,
|
|
1911
2005
|
label: t("neetoThemes.build.leftSideBar.themes.customCSS"),
|
|
1912
2006
|
testId: "quick-custom-css",
|
|
2007
|
+
disabledTooltip: t("neetoThemes.common.proFeature.customCSS.description"),
|
|
1913
2008
|
onClick: handleQuickEdit("customcss")
|
|
1914
2009
|
})]
|
|
1915
2010
|
})]
|
|
@@ -1918,8 +2013,21 @@ var Card = function Card(_ref) {
|
|
|
1918
2013
|
};
|
|
1919
2014
|
var Card$1 = /*#__PURE__*/react.memo(Card);
|
|
1920
2015
|
|
|
2016
|
+
var SectionHeading = function SectionHeading(_ref) {
|
|
2017
|
+
var label = _ref.label,
|
|
2018
|
+
testId = _ref.testId;
|
|
2019
|
+
return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
2020
|
+
className: "px-6 text-xs font-semibold uppercase tracking-wide lg:px-5 xl:px-6",
|
|
2021
|
+
color: "muted",
|
|
2022
|
+
"data-testid": testId,
|
|
2023
|
+
variant: "body2",
|
|
2024
|
+
children: label
|
|
2025
|
+
});
|
|
2026
|
+
};
|
|
2027
|
+
|
|
1921
2028
|
var Themes = function Themes(_ref) {
|
|
1922
2029
|
var onEditTheme = _ref.onEditTheme,
|
|
2030
|
+
onCustomizeSystemTheme = _ref.onCustomizeSystemTheme,
|
|
1923
2031
|
_ref$themes = _ref.themes,
|
|
1924
2032
|
themes = _ref$themes === void 0 ? [] : _ref$themes,
|
|
1925
2033
|
_ref$defaultThemes = _ref.defaultThemes,
|
|
@@ -1933,7 +2041,6 @@ var Themes = function Themes(_ref) {
|
|
|
1933
2041
|
thumbnail = _ref.thumbnail,
|
|
1934
2042
|
themeBeingApplied = _ref.themeBeingApplied,
|
|
1935
2043
|
onApplyTheme = _ref.onApplyTheme,
|
|
1936
|
-
onApplyThemeSuccess = _ref.onApplyThemeSuccess,
|
|
1937
2044
|
_ref$isSearchVisible = _ref.isSearchVisible,
|
|
1938
2045
|
isSearchVisible = _ref$isSearchVisible === void 0 ? false : _ref$isSearchVisible;
|
|
1939
2046
|
var _useTranslation = reactI18next.useTranslation(),
|
|
@@ -1950,19 +2057,13 @@ var Themes = function Themes(_ref) {
|
|
|
1950
2057
|
previewingTheme = _useThemeStore.previewingTheme;
|
|
1951
2058
|
var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
|
|
1952
2059
|
return {
|
|
1953
|
-
entityType: store["entityType"]
|
|
1954
|
-
entityId: store["entityId"]
|
|
2060
|
+
entityType: store["entityType"]
|
|
1955
2061
|
};
|
|
1956
2062
|
}, shallow.shallow),
|
|
1957
|
-
entityType = _useConfigStore.entityType
|
|
1958
|
-
entityId = _useConfigStore.entityId;
|
|
2063
|
+
entityType = _useConfigStore.entityType;
|
|
1959
2064
|
var _useQueryParams = reactUtils$1.useQueryParams(),
|
|
1960
2065
|
_useQueryParams$searc = _useQueryParams.searchTerm,
|
|
1961
2066
|
searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
|
|
1962
|
-
var _useCloneTheme = useGlobalThemesApi.useCloneTheme(),
|
|
1963
|
-
cloneTheme = _useCloneTheme.mutate;
|
|
1964
|
-
var _useApplyTheme = useGlobalThemesApi.useApplyTheme({}),
|
|
1965
|
-
applyClonedTheme = _useApplyTheme.mutate;
|
|
1966
2067
|
var _useShowGlobalTheme = useGlobalThemesApi.useShowGlobalTheme(entityType),
|
|
1967
2068
|
_useShowGlobalTheme$d = _useShowGlobalTheme.data,
|
|
1968
2069
|
_useShowGlobalTheme$d2 = _useShowGlobalTheme$d === void 0 ? {} : _useShowGlobalTheme$d,
|
|
@@ -2000,23 +2101,7 @@ var Themes = function Themes(_ref) {
|
|
|
2000
2101
|
return theme.id !== activeThemeId && matchesSearch(theme);
|
|
2001
2102
|
});
|
|
2002
2103
|
var showActiveThemeSection = activeTheme && matchesSearch(activeTheme);
|
|
2003
|
-
var
|
|
2004
|
-
cloneTheme(data.id, {
|
|
2005
|
-
onSuccess: function onSuccess(_ref2) {
|
|
2006
|
-
var clonedTheme = _ref2.theme;
|
|
2007
|
-
applyClonedTheme({
|
|
2008
|
-
themeId: clonedTheme.id,
|
|
2009
|
-
entityId: entityId,
|
|
2010
|
-
entityType: entityType
|
|
2011
|
-
}, {
|
|
2012
|
-
onSuccess: function onSuccess() {
|
|
2013
|
-
onApplyThemeSuccess === null || onApplyThemeSuccess === void 0 || onApplyThemeSuccess(clonedTheme);
|
|
2014
|
-
onEditTheme(clonedTheme, section);
|
|
2015
|
-
}
|
|
2016
|
-
});
|
|
2017
|
-
}
|
|
2018
|
-
});
|
|
2019
|
-
};
|
|
2104
|
+
var hasNoMatchingThemes = !showActiveThemeSection && ramda.isEmpty(filteredThemes) && ramda.isEmpty(filteredDefaultThemes);
|
|
2020
2105
|
if (isLoading || isCurrentThemeLoading || isLoadingGlobalTheme) {
|
|
2021
2106
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2022
2107
|
className: "flex h-full w-full items-center justify-center",
|
|
@@ -2027,6 +2112,7 @@ var Themes = function Themes(_ref) {
|
|
|
2027
2112
|
className: "border-border mb-6 border-b px-6 pb-6 lg:px-5 xl:px-6",
|
|
2028
2113
|
children: /*#__PURE__*/jsxRuntime.jsx(Card$1, {
|
|
2029
2114
|
onApplyTheme: onApplyTheme,
|
|
2115
|
+
onCustomizeSystemTheme: onCustomizeSystemTheme,
|
|
2030
2116
|
thumbnail: thumbnail,
|
|
2031
2117
|
active: true,
|
|
2032
2118
|
isApplyingTheme: (themeBeingApplied === null || themeBeingApplied === void 0 ? void 0 : themeBeingApplied.id) === activeTheme.id,
|
|
@@ -2034,14 +2120,16 @@ var Themes = function Themes(_ref) {
|
|
|
2034
2120
|
isHighLightedTheme: activeTheme.id === themeToHighlight,
|
|
2035
2121
|
isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === activeTheme.id,
|
|
2036
2122
|
theme: activeTheme,
|
|
2037
|
-
onCloneTheme: handleCloneTheme,
|
|
2038
2123
|
onEditTheme: isActiveThemeCustom ? onEditTheme : undefined,
|
|
2039
2124
|
onSetPreviewTheme: setPreviewTheme
|
|
2040
2125
|
})
|
|
2041
2126
|
});
|
|
2042
|
-
var systemThemesSection = neetoCist.isNotEmpty(filteredDefaultThemes) && /*#__PURE__*/jsxRuntime.
|
|
2127
|
+
var systemThemesSection = neetoCist.isNotEmpty(filteredDefaultThemes) && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2043
2128
|
className: "mb-6 space-y-3",
|
|
2044
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
2129
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(SectionHeading, {
|
|
2130
|
+
label: t("neetoThemes.build.leftSideBar.themes.systemThemes"),
|
|
2131
|
+
testId: "system-themes-heading"
|
|
2132
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2045
2133
|
className: "flex flex-col gap-4 px-6 pb-10 lg:px-5 xl:px-6",
|
|
2046
2134
|
"data-testid": "system-themes",
|
|
2047
2135
|
children: filteredDefaultThemes.map(function (theme) {
|
|
@@ -2054,15 +2142,17 @@ var Themes = function Themes(_ref) {
|
|
|
2054
2142
|
isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
|
|
2055
2143
|
isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === theme.id,
|
|
2056
2144
|
key: theme.id,
|
|
2057
|
-
onCloneTheme: handleCloneTheme,
|
|
2058
2145
|
onSetPreviewTheme: setPreviewTheme
|
|
2059
2146
|
});
|
|
2060
2147
|
})
|
|
2061
|
-
})
|
|
2148
|
+
})]
|
|
2062
2149
|
});
|
|
2063
|
-
var customThemesSection = neetoCist.isNotEmpty(filteredThemes) && /*#__PURE__*/jsxRuntime.
|
|
2150
|
+
var customThemesSection = neetoCist.isNotEmpty(filteredThemes) && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2064
2151
|
className: "mb-6 space-y-3",
|
|
2065
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
2152
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(SectionHeading, {
|
|
2153
|
+
label: t("neetoThemes.build.leftSideBar.themes.customThemes"),
|
|
2154
|
+
testId: "custom-themes-heading"
|
|
2155
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2066
2156
|
className: "flex flex-col gap-4 px-6",
|
|
2067
2157
|
"data-testid": "custom-themes",
|
|
2068
2158
|
children: filteredThemes.map(function (theme) {
|
|
@@ -2079,12 +2169,11 @@ var Themes = function Themes(_ref) {
|
|
|
2079
2169
|
isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
|
|
2080
2170
|
isHighLightedTheme: theme.id === themeToHighlight,
|
|
2081
2171
|
key: theme.id,
|
|
2082
|
-
onCloneTheme: handleCloneTheme,
|
|
2083
2172
|
onDeleteTheme: !isActive && onDeleteTheme,
|
|
2084
2173
|
onSetPreviewTheme: setPreviewTheme
|
|
2085
2174
|
});
|
|
2086
2175
|
})
|
|
2087
|
-
})
|
|
2176
|
+
})]
|
|
2088
2177
|
});
|
|
2089
2178
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2090
2179
|
className: "neeto-themes-sidebar__scroll",
|
|
@@ -2098,7 +2187,7 @@ var Themes = function Themes(_ref) {
|
|
|
2098
2187
|
autoComplete: "off",
|
|
2099
2188
|
placeholder: t("neetoThemes.common.searchThemes")
|
|
2100
2189
|
})
|
|
2101
|
-
}),
|
|
2190
|
+
}), hasNoMatchingThemes && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
2102
2191
|
className: "text-center",
|
|
2103
2192
|
color: "muted",
|
|
2104
2193
|
"data-testid": "no-data-title",
|
|
@@ -2130,6 +2219,8 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
2130
2219
|
}, shallow.shallow),
|
|
2131
2220
|
entityType = _useConfigStore.entityType,
|
|
2132
2221
|
helpDocUrl = _useConfigStore.helpDocUrl;
|
|
2222
|
+
var _useQueryParams = reactUtils$1.useQueryParams(),
|
|
2223
|
+
sourceThemeId = _useQueryParams.source;
|
|
2133
2224
|
var isCustomizeScreen = isEditThemeRoute() || isNewThemeRoute();
|
|
2134
2225
|
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
2135
2226
|
var isRTL = i18n.dir() === "rtl";
|
|
@@ -2154,7 +2245,7 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
2154
2245
|
}), /*#__PURE__*/jsxRuntime.jsxs(neetoAtoms.Typography, {
|
|
2155
2246
|
"data-testid": "themes-header",
|
|
2156
2247
|
variant: "h5",
|
|
2157
|
-
children: [isCustomizeScreen && !isCustomCssScreen && (isNewThemeRoute() ? t("neetoThemes.build.leftSideBar.themes.createTheme.title") : t("neetoThemes.build.leftSideBar.themes.editTheme.title")), isCustomCssScreen && t("neetoThemes.build.leftSideBar.themes.customCSS")]
|
|
2248
|
+
children: [isCustomizeScreen && !isCustomCssScreen && (isNewThemeRoute() && !neetoCist.isPresent(sourceThemeId) ? t("neetoThemes.build.leftSideBar.themes.createTheme.title") : t("neetoThemes.build.leftSideBar.themes.editTheme.title")), isCustomCssScreen && t("neetoThemes.build.leftSideBar.themes.customCSS")]
|
|
2158
2249
|
})]
|
|
2159
2250
|
})
|
|
2160
2251
|
});
|
|
@@ -2327,6 +2418,17 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2327
2418
|
search: section ? "?section=".concat(section) : ""
|
|
2328
2419
|
});
|
|
2329
2420
|
};
|
|
2421
|
+
var handleCustomizeSystemTheme = function handleCustomizeSystemTheme(theme, section) {
|
|
2422
|
+
themeToEdit.current = theme;
|
|
2423
|
+
var searchParams = new URLSearchParams({
|
|
2424
|
+
source: theme.id
|
|
2425
|
+
});
|
|
2426
|
+
if (section) searchParams.set("section", section);
|
|
2427
|
+
history.push({
|
|
2428
|
+
pathname: buildPathname(useGlobalThemesApi.routes.themes["new"]),
|
|
2429
|
+
search: "?".concat(searchParams.toString())
|
|
2430
|
+
});
|
|
2431
|
+
};
|
|
2330
2432
|
var onApplyTheme = function onApplyTheme(theme) {
|
|
2331
2433
|
if (themeBeingApplied !== null && themeBeingApplied !== void 0 && themeBeingApplied.id) return;
|
|
2332
2434
|
setThemeBeingApplied(theme);
|
|
@@ -2421,12 +2523,12 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2421
2523
|
isCurrentThemeLoading: isCurrentThemeLoading,
|
|
2422
2524
|
isSearchVisible: isSearchVisible,
|
|
2423
2525
|
onApplyTheme: onApplyTheme,
|
|
2424
|
-
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2425
2526
|
themeBeingApplied: themeBeingApplied,
|
|
2426
2527
|
themeToHighlight: themeToHighlight,
|
|
2427
2528
|
themes: themes,
|
|
2428
2529
|
thumbnail: thumbnail,
|
|
2429
2530
|
isLoading: isLoading || isFetchingSchema,
|
|
2531
|
+
onCustomizeSystemTheme: handleCustomizeSystemTheme,
|
|
2430
2532
|
onDeleteTheme: handleDelete,
|
|
2431
2533
|
onEditTheme: handleEditTheme
|
|
2432
2534
|
});
|
|
@@ -2440,6 +2542,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2440
2542
|
fixedAspectRatio: fixedAspectRatio,
|
|
2441
2543
|
isApplyingTheme: isApplyingTheme,
|
|
2442
2544
|
onApplyTheme: onApplyTheme,
|
|
2545
|
+
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2443
2546
|
onCreateTheme: onCreateTheme,
|
|
2444
2547
|
onPropertiesChange: onPropertiesChange,
|
|
2445
2548
|
onUpdateTheme: onUpdateTheme,
|
|
@@ -2456,6 +2559,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2456
2559
|
fixedAspectRatio: fixedAspectRatio,
|
|
2457
2560
|
isApplyingTheme: isApplyingTheme,
|
|
2458
2561
|
onApplyTheme: onApplyTheme,
|
|
2562
|
+
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2459
2563
|
onCreateTheme: onCreateTheme,
|
|
2460
2564
|
onPropertiesChange: onPropertiesChange,
|
|
2461
2565
|
onUpdateTheme: onUpdateTheme,
|