@redocly/theme 0.45.2 → 0.45.3

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.
@@ -36,6 +36,7 @@ const Sentiment_1 = require("../../components/Feedback/Sentiment");
36
36
  const Comment_1 = require("../../components/Feedback/Comment");
37
37
  const Mood_1 = require("../../components/Feedback/Mood");
38
38
  const Scale_1 = require("../../components/Feedback/Scale");
39
+ const constants_1 = require("../../core/constants");
39
40
  const feedbackComponents = {
40
41
  rating: Rating_1.Rating,
41
42
  sentiment: Sentiment_1.Sentiment,
@@ -50,7 +51,7 @@ function Feedback(props) {
50
51
  const telemetry = useTelemetry();
51
52
  const { pathname } = (0, react_router_dom_1.useLocation)();
52
53
  const { feedback: themeFeedbackConf } = (0, hooks_1.useThemeConfig)();
53
- const feedbackConf = Object.assign(Object.assign({}, themeFeedbackConf), { path: props === null || props === void 0 ? void 0 : props.path, type: (props === null || props === void 0 ? void 0 : props.type) || (themeFeedbackConf === null || themeFeedbackConf === void 0 ? void 0 : themeFeedbackConf.type), settings: (props === null || props === void 0 ? void 0 : props.settings) || (themeFeedbackConf === null || themeFeedbackConf === void 0 ? void 0 : themeFeedbackConf.settings) || {}, hide: (_a = props.hide) !== null && _a !== void 0 ? _a : themeFeedbackConf === null || themeFeedbackConf === void 0 ? void 0 : themeFeedbackConf.hide });
54
+ const feedbackConf = Object.assign(Object.assign({}, themeFeedbackConf), { path: props === null || props === void 0 ? void 0 : props.path, type: (props === null || props === void 0 ? void 0 : props.type) || (themeFeedbackConf === null || themeFeedbackConf === void 0 ? void 0 : themeFeedbackConf.type) || constants_1.DEFAULT_FEEDBACK_TYPE, settings: (props === null || props === void 0 ? void 0 : props.settings) || (themeFeedbackConf === null || themeFeedbackConf === void 0 ? void 0 : themeFeedbackConf.settings) || {}, hide: (_a = props.hide) !== null && _a !== void 0 ? _a : themeFeedbackConf === null || themeFeedbackConf === void 0 ? void 0 : themeFeedbackConf.hide });
54
55
  if (feedbackConf.hide) {
55
56
  return null;
56
57
  }
@@ -58,7 +58,10 @@ function MenuMobile({ className, hideUserProfile }) {
58
58
  return (react_1.default.createElement(MobileMenuWrapper, { "data-component-name": "Menu/MenuMobile", className: className },
59
59
  react_1.default.createElement(ScrollableArea, { isButtonsSectionVisible: !!isButtonsSectionVisible },
60
60
  isButtonsSectionVisible && (react_1.default.createElement(ButtonsSection, { alignRight: !prevLevelName && !!nextLevelName },
61
- prevLevelName && (react_1.default.createElement(ControlButton, { "data-testid": "control-button", onClick: () => setMenuLevel(menuLevel - 1) },
61
+ prevLevelName && (react_1.default.createElement(ControlButton, { "data-testid": "control-button", onClick: () => {
62
+ setMenuLevel(menuLevel - 1);
63
+ popDrilldownState();
64
+ } },
62
65
  react_1.default.createElement(ChevronLeftIcon_1.ChevronLeftIcon, { size: "12px", color: "--tree-content-color-default" }),
63
66
  react_1.default.createElement(ControlButtonLabel, { paddingDirection: "left" }, prevLevelName))),
64
67
  nextLevelName && (react_1.default.createElement(ControlButton, { "data-testid": "control-button", onClick: () => setMenuLevel(menuLevel + 1) },
@@ -8,6 +8,7 @@ export declare enum FEEDBACK_TYPES {
8
8
  PROBLEM = "problem",
9
9
  SCALE = "scale"
10
10
  }
11
+ export declare const DEFAULT_FEEDBACK_TYPE = FEEDBACK_TYPES.SENTIMENT;
11
12
  export declare enum MenuItemType {
12
13
  Separator = "separator",
13
14
  DrillDown = "drilldown",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MobileMenuType = exports.MenuItemType = exports.FEEDBACK_TYPES = exports.DEFAULT_LOCALE_PLACEHOLDER = exports.REDOCLY_TEAMS_RBAC = void 0;
3
+ exports.MobileMenuType = exports.MenuItemType = exports.DEFAULT_FEEDBACK_TYPE = exports.FEEDBACK_TYPES = exports.DEFAULT_LOCALE_PLACEHOLDER = exports.REDOCLY_TEAMS_RBAC = void 0;
4
4
  var config_1 = require("@redocly/config");
5
5
  Object.defineProperty(exports, "REDOCLY_TEAMS_RBAC", { enumerable: true, get: function () { return config_1.REDOCLY_TEAMS_RBAC; } });
6
6
  exports.DEFAULT_LOCALE_PLACEHOLDER = 'default_locale';
@@ -13,6 +13,7 @@ var FEEDBACK_TYPES;
13
13
  FEEDBACK_TYPES["PROBLEM"] = "problem";
14
14
  FEEDBACK_TYPES["SCALE"] = "scale";
15
15
  })(FEEDBACK_TYPES || (exports.FEEDBACK_TYPES = FEEDBACK_TYPES = {}));
16
+ exports.DEFAULT_FEEDBACK_TYPE = FEEDBACK_TYPES.SENTIMENT;
16
17
  var MenuItemType;
17
18
  (function (MenuItemType) {
18
19
  MenuItemType["Separator"] = "separator";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.45.2",
3
+ "version": "0.45.3",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -10,6 +10,7 @@ import { Sentiment } from '@redocly/theme/components/Feedback/Sentiment';
10
10
  import { Comment } from '@redocly/theme/components/Feedback/Comment';
11
11
  import { Mood } from '@redocly/theme/components/Feedback/Mood';
12
12
  import { Scale } from '@redocly/theme/components/Feedback/Scale';
13
+ import { DEFAULT_FEEDBACK_TYPE } from '@redocly/theme/core/constants';
13
14
 
14
15
  const feedbackComponents = {
15
16
  rating: Rating,
@@ -31,7 +32,7 @@ export function Feedback(props: FeedbackProps & { path?: string }) {
31
32
  const feedbackConf = {
32
33
  ...themeFeedbackConf,
33
34
  path: props?.path,
34
- type: props?.type || themeFeedbackConf?.type,
35
+ type: props?.type || themeFeedbackConf?.type || DEFAULT_FEEDBACK_TYPE,
35
36
  settings: props?.settings || themeFeedbackConf?.settings || {},
36
37
  hide: props.hide ?? themeFeedbackConf?.hide,
37
38
  };
@@ -52,7 +52,10 @@ export function MenuMobile({ className, hideUserProfile }: MobileMenuProps): JSX
52
52
  {prevLevelName && (
53
53
  <ControlButton
54
54
  data-testid="control-button"
55
- onClick={() => setMenuLevel(menuLevel - 1)}
55
+ onClick={() => {
56
+ setMenuLevel(menuLevel - 1);
57
+ popDrilldownState();
58
+ }}
56
59
  >
57
60
  <ChevronLeftIcon size="12px" color="--tree-content-color-default" />
58
61
  <ControlButtonLabel paddingDirection="left">{prevLevelName}</ControlButtonLabel>
@@ -10,6 +10,8 @@ export enum FEEDBACK_TYPES {
10
10
  SCALE = 'scale',
11
11
  }
12
12
 
13
+ export const DEFAULT_FEEDBACK_TYPE = FEEDBACK_TYPES.SENTIMENT;
14
+
13
15
  export enum MenuItemType {
14
16
  Separator = 'separator',
15
17
  DrillDown = 'drilldown',