@bigbinary/neeto-themes-frontend 3.1.13 → 3.1.15

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 CHANGED
@@ -105,8 +105,8 @@ and `neeto-themes-engine` Rails engine.
105
105
  - `parent_class`: This key needs to be added for custom css feature to work
106
106
  properly. See more on [custom css](#custom-css) feature.
107
107
 
108
- - `use_default_image_size`: Used to apply defaultImageSize prop
109
- passed to ImageUploader component.
108
+ - `use_default_image_size`: Used to apply defaultImageSize prop passed to
109
+ ImageUploader component.
110
110
 
111
111
  3. **Provide a css variable prefix**
112
112
 
@@ -197,17 +197,19 @@ for step-by-step instructions to develop the frontend package.
197
197
  ### Custom CSS
198
198
 
199
199
  `neeto-themes-nano` will inject custom css into your application as part of a
200
- theme. It requires the initializer to be set with the additional property
200
+ theme. You can provide `enabledFeatures={{ customCSS: false }}` in
201
+ `NeetoThemesBuilder` to manually disable the CustomCSS feature. This feature
202
+ requires the initializer to be set with the additional property
201
203
  `{ kind: "custom_css", key: "custom_css", default_value: "", parent_class: "neeto-form-eui" }`.
202
204
  The `parent_class` key will be used as a parent to inject styles and for CSS
203
205
  nesting. This ensures that styles are not injected on pages where you do not
204
206
  want it and also ensures that style rules targeting elements outside this class
205
- will not be applied. Please ensure that the value provided to `parent_class` is
206
- present in your application as a wrapper CSS class. For example:
207
- `neeto-form-eui` in neetoForm is present in all external pages where theme needs
208
- to be applied. It also provides a code editor with syntax highlighting which
209
- depends on [Monaco editor](https://github.com/suren-atoyan/monaco-react) as a
210
- peer dependency. Please install it in the host application for proper working.
207
+ will not be applied. Please ensure that the value provided to`parent_class`is
208
+ present in your application as a wrapper CSS class. For example:`neeto-form-eui`
209
+ in neetoForm is present in all external pages where theme needs to be applied. .
210
+ It also provides a code editor with syntax highlighting which depends on
211
+ [Monaco editor](https://github.com/suren-atoyan/monaco-react) as a peer
212
+ dependency. Please install it in the host application for proper working.
211
213
 
212
214
  ## Instructions for Publishing
213
215
 
@@ -1,13 +1,13 @@
1
1
  import { shallow } from 'zustand/shallow';
2
2
  import { Suspense, lazy, useEffect, createElement, useState, useRef, memo, useCallback } from 'react';
3
- import { hyphenate, findBy, findIndexBy, isPresent, isNot, filterBy, snakeToCamelCase, isNotPresent, toLabelAndValue, humanize, isNotEmpty, noop } from '@bigbinary/neeto-cist';
4
- import { useMutationWithInvalidation, withT, useBreakpoints, PageTitle } from '@bigbinary/neeto-commons-frontend/react-utils';
3
+ import { hyphenate, isPresent, findBy, findIndexBy, isNot, filterBy, snakeToCamelCase, isNotPresent, toLabelAndValue, humanize, isNotEmpty, noop } from '@bigbinary/neeto-cist';
4
+ import { useMutationWithInvalidation, useBreakpoints, PageTitle } from '@bigbinary/neeto-commons-frontend/react-utils';
5
5
  import Spinner from '@bigbinary/neetoui/Spinner';
6
6
  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-Bxlleq-V.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, P as POSITION_OPTIONS, O as OVERLAY_OPACITY_SLIDER_MARKS, H as HUNDRED, F as FONT_OPTIONS, T as THEME_VALIDATION_SCHEMA } from './useThemeUtils-DdkCd9iz.js';
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-Do1vR9LD.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';
@@ -28,14 +28,14 @@ import BlockNavigation from '@bigbinary/neetoui/formik/BlockNavigation';
28
28
  import { isEmpty, negate, isNotNil } from 'ramda';
29
29
  import { useFormikContext, Field } from 'formik';
30
30
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
31
- import Down from '@bigbinary/neeto-icons/Down';
31
+ import Right from '@bigbinary/neeto-icons/Right';
32
+ import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
32
33
  import { t as t$1 } from 'i18next';
33
34
  import CenterAlign from '@bigbinary/neeto-icons/CenterAlign';
34
35
  import LeftAlign from '@bigbinary/neeto-icons/LeftAlign';
35
36
  import ColorPicker from '@bigbinary/neetoui/ColorPicker';
36
37
  import Select from '@bigbinary/neetoui/Select';
37
38
  import { Slider } from 'antd';
38
- import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
39
39
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
40
40
  import _regeneratorRuntime from '@babel/runtime/regenerator';
41
41
  import ImageUploader from '@bigbinary/neeto-image-uploader-frontend/ImageUploader';
@@ -265,7 +265,8 @@ var Card$2 = function Card(_ref) {
265
265
  title = _ref$title === void 0 ? "" : _ref$title,
266
266
  children = _ref.children,
267
267
  name = _ref.name,
268
- className = _ref.className;
268
+ className = _ref.className,
269
+ helpPopoverProps = _ref.helpPopoverProps;
269
270
  var _useConfigStore = useConfigStore(function (store) {
270
271
  return {
271
272
  accordionOpenState: store["accordionOpenState"],
@@ -286,18 +287,18 @@ var Card$2 = function Card(_ref) {
286
287
  onClick: function onClick() {
287
288
  return setAccordionOpenState(_objectSpread$4(_objectSpread$4({}, accordionOpenState), {}, _defineProperty({}, name, !accordionOpenState[name])));
288
289
  },
289
- children: [/*#__PURE__*/jsx(Typography, {
290
- className: "min-w-0 flex-grow text-left",
290
+ children: [/*#__PURE__*/jsxs(Typography, {
291
+ className: "flex min-w-0 flex-grow items-center gap-2 text-left",
291
292
  component: "span",
292
293
  "data-cy": "theme-properties",
293
294
  lineHeight: "normal",
294
295
  style: "h4",
295
296
  weight: "semibold",
296
- children: title
297
- }), /*#__PURE__*/jsx(Down, {
297
+ children: [title, isPresent(helpPopoverProps) && /*#__PURE__*/jsx(HelpPopover, _objectSpread$4({}, helpPopoverProps))]
298
+ }), /*#__PURE__*/jsx(Right, {
298
299
  size: 20,
299
300
  className: classnames("transition-all duration-300", {
300
- "rotate-180": accordionOpenState[name]
301
+ "rotate-90": accordionOpenState[name]
301
302
  })
302
303
  })]
303
304
  }), children && /*#__PURE__*/jsx("div", {
@@ -350,11 +351,15 @@ var CustomCSS = function CustomCSS(_ref) {
350
351
  var _useConfigStore = useConfigStore(function (store) {
351
352
  return {
352
353
  themePropertiesSchema: store["themePropertiesSchema"],
353
- accordionOpenState: store["accordionOpenState"]
354
+ accordionOpenState: store["accordionOpenState"],
355
+ helpPopoverProps: store["helpPopoverProps"]
354
356
  };
355
357
  }, shallow),
356
358
  themePropertiesSchema = _useConfigStore.themePropertiesSchema,
357
- accordionOpenState = _useConfigStore.accordionOpenState;
359
+ accordionOpenState = _useConfigStore.accordionOpenState,
360
+ helpPopoverProps = _useConfigStore.helpPopoverProps;
361
+ var _helpPopoverProps$cus = helpPopoverProps.customCss,
362
+ customCssHelpPopoverProps = _helpPopoverProps$cus === void 0 ? {} : _helpPopoverProps$cus;
358
363
  var customCSS = findBy({
359
364
  kind: "custom_css"
360
365
  }, values.properties);
@@ -387,6 +392,7 @@ var CustomCSS = function CustomCSS(_ref) {
387
392
  className: "neeto-themes-sidebar__custom-css-wrapper",
388
393
  id: "css-editor",
389
394
  children: /*#__PURE__*/jsx(Card$2, {
395
+ helpPopoverProps: customCssHelpPopoverProps,
390
396
  name: "customcss",
391
397
  title: isCustomCssScreen ? "" : t("neetoThemes.build.leftSideBar.themes.customCSS"),
392
398
  children: /*#__PURE__*/jsxs("div", {
@@ -1076,12 +1082,19 @@ var Images = function Images(_ref) {
1076
1082
  useDefaultImageSize = _ref.useDefaultImageSize;
1077
1083
  var _useFormikContext = useFormikContext(),
1078
1084
  values = _useFormikContext.values;
1085
+ var _useConfigStore = useConfigStore(function (store) {
1086
+ return {
1087
+ helpPopoverProps: store["helpPopoverProps"]
1088
+ };
1089
+ }, shallow),
1090
+ helpPopoverProps = _useConfigStore.helpPopoverProps;
1079
1091
  var key = snakeToCamelCase(attribute);
1080
1092
  var title = buildLabel(key, "image");
1081
1093
  var imageData = values[key];
1082
1094
  return /*#__PURE__*/jsxs(Card$2, {
1083
1095
  className: className,
1084
1096
  title: title,
1097
+ helpPopoverProps: helpPopoverProps[key],
1085
1098
  name: key,
1086
1099
  children: [/*#__PURE__*/jsx(ImageBlock, {
1087
1100
  attribute: attribute,
@@ -1096,11 +1109,21 @@ var Images = function Images(_ref) {
1096
1109
  });
1097
1110
  };
1098
1111
 
1099
- var ThemeMeta = withT(function (_ref) {
1100
- var t = _ref.t,
1101
- className = _ref.className;
1112
+ var ThemeMeta = function ThemeMeta(_ref) {
1113
+ var className = _ref.className;
1114
+ var _useTranslation = useTranslation(),
1115
+ t = _useTranslation.t;
1116
+ var _useConfigStore = useConfigStore(function (store) {
1117
+ return {
1118
+ helpPopoverProps: store["helpPopoverProps"]
1119
+ };
1120
+ }, shallow),
1121
+ helpPopoverProps = _useConfigStore.helpPopoverProps;
1122
+ var _helpPopoverProps$nam = helpPopoverProps.name,
1123
+ nameHelpPopoverProps = _helpPopoverProps$nam === void 0 ? {} : _helpPopoverProps$nam;
1102
1124
  return /*#__PURE__*/jsx(Card$2, {
1103
1125
  className: className,
1126
+ helpPopoverProps: nameHelpPopoverProps,
1104
1127
  name: "name",
1105
1128
  title: t("neetoThemes.common.name"),
1106
1129
  children: /*#__PURE__*/jsx(Input, {
@@ -1109,7 +1132,7 @@ var ThemeMeta = withT(function (_ref) {
1109
1132
  name: "name"
1110
1133
  })
1111
1134
  });
1112
- });
1135
+ };
1113
1136
 
1114
1137
  function ownKeys(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; }
1115
1138
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -1134,12 +1157,16 @@ var Customize = function Customize(_ref) {
1134
1157
  return {
1135
1158
  themePropertiesSchema: store["themePropertiesSchema"],
1136
1159
  entityType: store["entityType"],
1137
- isFetchingSchema: store["isFetchingSchema"]
1160
+ isFetchingSchema: store["isFetchingSchema"],
1161
+ helpPopoverProps: store["helpPopoverProps"],
1162
+ enabledFeatures: store["enabledFeatures"]
1138
1163
  };
1139
1164
  }, shallow),
1140
1165
  themePropertiesSchema = _useConfigStore.themePropertiesSchema,
1141
1166
  entityType = _useConfigStore.entityType,
1142
- isFetchingSchema = _useConfigStore.isFetchingSchema;
1167
+ isFetchingSchema = _useConfigStore.isFetchingSchema,
1168
+ helpPopoverProps = _useConfigStore.helpPopoverProps,
1169
+ enabledFeatures = _useConfigStore.enabledFeatures;
1143
1170
  var _useParams = useParams(),
1144
1171
  themeId = _useParams.themeId;
1145
1172
  var _useThemeStore = useThemeStore(function (store) {
@@ -1165,6 +1192,8 @@ var Customize = function Customize(_ref) {
1165
1192
  var isLoading = isFetchingSchema || isLoadingTheme;
1166
1193
  var isThemeGlobalTheme = themeId && (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === themeId;
1167
1194
  var isCurrentThemeAndGlobalThemeSame = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id);
1195
+ var _helpPopoverProps$sty = helpPopoverProps.style,
1196
+ styleHelpPopoverProps = _helpPopoverProps$sty === void 0 ? {} : _helpPopoverProps$sty;
1168
1197
  var isEditingCurrentlyAppliedTheme = themeId === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
1169
1198
  var submitBtnRef = useRef(null);
1170
1199
  var _useCreateTheme = useCreateTheme(),
@@ -1247,6 +1276,7 @@ var Customize = function Customize(_ref) {
1247
1276
  className: classnames({
1248
1277
  hidden: isCustomCssScreen
1249
1278
  }),
1279
+ helpPopoverProps: styleHelpPopoverProps,
1250
1280
  name: "style",
1251
1281
  title: t("neetoThemes.common.style"),
1252
1282
  children: /*#__PURE__*/jsx(Properties, {
@@ -1267,7 +1297,7 @@ var Customize = function Customize(_ref) {
1267
1297
  }),
1268
1298
  key: key
1269
1299
  });
1270
- }), /*#__PURE__*/jsx(CustomCSS, {
1300
+ }), enabledFeatures.customCSS && /*#__PURE__*/jsx(CustomCSS, {
1271
1301
  currentScreen: currentScreen,
1272
1302
  onEditCSSClick: onEditCSSClick
1273
1303
  }), /*#__PURE__*/jsxs("div", {
@@ -2142,7 +2172,13 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
2142
2172
  _ref$onUpdateThemeSuc = _ref.onUpdateThemeSuccess,
2143
2173
  onUpdateThemeSuccess = _ref$onUpdateThemeSuc === void 0 ? noop : _ref$onUpdateThemeSuc,
2144
2174
  _ref$onApplyGlobalThe = _ref.onApplyGlobalThemeSuccess,
2145
- onApplyGlobalThemeSuccess = _ref$onApplyGlobalThe === void 0 ? noop : _ref$onApplyGlobalThe;
2175
+ onApplyGlobalThemeSuccess = _ref$onApplyGlobalThe === void 0 ? noop : _ref$onApplyGlobalThe,
2176
+ _ref$helpPopoverProps = _ref.helpPopoverProps,
2177
+ helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps,
2178
+ _ref$enabledFeatures = _ref.enabledFeatures,
2179
+ enabledFeatures = _ref$enabledFeatures === void 0 ? {
2180
+ customCSS: true
2181
+ } : _ref$enabledFeatures;
2146
2182
  var _useThemeStore = useThemeStore(function (store) {
2147
2183
  return {
2148
2184
  setThemeState: store["setThemeState"]
@@ -2172,7 +2208,9 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
2172
2208
  entityType: entityType,
2173
2209
  entityId: entityId,
2174
2210
  isTemplateThemesEnabled: isTemplateThemesEnabled,
2175
- helpDocUrl: helpDocUrl
2211
+ helpDocUrl: helpDocUrl,
2212
+ helpPopoverProps: helpPopoverProps,
2213
+ enabledFeatures: enabledFeatures
2176
2214
  });
2177
2215
  }, []);
2178
2216
  useEffect(function () {