@redocly/theme 0.23.1 → 0.24.0

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.
@@ -41,6 +41,7 @@ const Rating = ({ settings, onSubmit, className }) => {
41
41
  submitText: 'theme.feedback.settings.submitText',
42
42
  label: 'theme.feedback.settings.label',
43
43
  };
44
+ const maxRating = max || 5;
44
45
  if (score && (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.enable) && !reasons.length) {
45
46
  const { label: reasonsLabel, items, multi } = reasonsSettings;
46
47
  const buttonText = (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.enable) ? 'Next' : 'Send';
@@ -54,13 +55,14 @@ const Rating = ({ settings, onSubmit, className }) => {
54
55
  score,
55
56
  comment,
56
57
  reasons,
58
+ max: maxRating,
57
59
  });
58
60
  return (React.createElement(Wrapper, null,
59
61
  React.createElement(Label, { "data-translation-key": translationKeys.submitText }, translate(translationKeys.submitText, submitText || 'Thank you for helping improve our documentation!'))));
60
62
  }
61
63
  return (React.createElement(Wrapper, { "data-component-name": "Feedback/Rating", className: className },
62
64
  React.createElement(Label, { "data-translation-key": translationKeys.label }, translate(translationKeys.label, label || 'How helpful was this page?')),
63
- React.createElement(Stars, { max: max || 5, onSubmit: setScore })));
65
+ React.createElement(Stars, { max: maxRating, onSubmit: setScore })));
64
66
  };
65
67
  exports.Rating = Rating;
66
68
  const Stars = ({ max, onSubmit }) => {
@@ -4,6 +4,7 @@ export type RatingProps = {
4
4
  score: number;
5
5
  comment?: string;
6
6
  reasons?: string[];
7
+ max: number;
7
8
  }) => void;
8
9
  settings?: {
9
10
  label?: string;
@@ -7,7 +7,8 @@ export declare enum FEEDBACK_TYPES {
7
7
  RATING = "rating",
8
8
  SENTIMENT = "sentiment",
9
9
  COMMENT = "comment",
10
- MOOD = "mood"
10
+ MOOD = "mood",
11
+ PROBLEM = "problem"
11
12
  }
12
13
  export declare const DEV_LOGIN_SLUG = "/login/";
13
14
  export declare enum ExternalRoutes {
@@ -10,6 +10,7 @@ var FEEDBACK_TYPES;
10
10
  FEEDBACK_TYPES["SENTIMENT"] = "sentiment";
11
11
  FEEDBACK_TYPES["COMMENT"] = "comment";
12
12
  FEEDBACK_TYPES["MOOD"] = "mood";
13
+ FEEDBACK_TYPES["PROBLEM"] = "problem";
13
14
  })(FEEDBACK_TYPES = exports.FEEDBACK_TYPES || (exports.FEEDBACK_TYPES = {}));
14
15
  exports.DEV_LOGIN_SLUG = '/login/';
15
16
  var ExternalRoutes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.23.1",
3
+ "version": "0.24.0",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -26,6 +26,7 @@ export const Rating = ({ settings, onSubmit, className }: RatingProps): JSX.Elem
26
26
  submitText: 'theme.feedback.settings.submitText',
27
27
  label: 'theme.feedback.settings.label',
28
28
  };
29
+ const maxRating = max || 5;
29
30
 
30
31
  if (score && reasonsSettings?.enable && !reasons.length) {
31
32
  const { label: reasonsLabel, items, multi } = reasonsSettings;
@@ -52,6 +53,7 @@ export const Rating = ({ settings, onSubmit, className }: RatingProps): JSX.Elem
52
53
  score,
53
54
  comment,
54
55
  reasons,
56
+ max: maxRating,
55
57
  });
56
58
  return (
57
59
  <Wrapper>
@@ -70,7 +72,7 @@ export const Rating = ({ settings, onSubmit, className }: RatingProps): JSX.Elem
70
72
  <Label data-translation-key={translationKeys.label}>
71
73
  {translate(translationKeys.label, label || 'How helpful was this page?')}
72
74
  </Label>
73
- <Stars max={max || 5} onSubmit={setScore} />
75
+ <Stars max={maxRating} onSubmit={setScore} />
74
76
  </Wrapper>
75
77
  );
76
78
  };
@@ -1,7 +1,7 @@
1
1
  import type { SubmitFeedbackParams } from '@theme/types/portal/src/shared/types/feedback';
2
2
 
3
3
  export type RatingProps = {
4
- onSubmit: (value: { score: number; comment?: string; reasons?: string[] }) => void;
4
+ onSubmit: (value: { score: number; comment?: string; reasons?: string[]; max: number }) => void;
5
5
  settings?: {
6
6
  label?: string;
7
7
  max?: number;
@@ -8,6 +8,7 @@ export enum FEEDBACK_TYPES {
8
8
  SENTIMENT = 'sentiment',
9
9
  COMMENT = 'comment',
10
10
  MOOD = 'mood',
11
+ PROBLEM = 'problem',
11
12
  }
12
13
  export const DEV_LOGIN_SLUG = '/login/';
13
14
  export enum ExternalRoutes {