@redocly/theme 0.38.6 → 0.38.8

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.
@@ -70,7 +70,7 @@ function Mood({ settings, onSubmit, className }) {
70
70
  }
71
71
  };
72
72
  const displayReasons = !!(score && reasonsSettings && !reasonsSettings.hide);
73
- const displayComment = !!(score && commentSettings && !commentSettings.hide);
73
+ const displayComment = !!(score && !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide));
74
74
  const displaySubmitBnt = !!(score && (displayReasons || displayComment));
75
75
  const onSubmitMoodForm = () => {
76
76
  onSubmit({
@@ -58,7 +58,7 @@ function Rating({ settings, onSubmit, className }) {
58
58
  setScore(0);
59
59
  };
60
60
  const displayReasons = !!(score && reasonsSettings && !reasonsSettings.hide);
61
- const displayComment = !!(score && commentSettings && !commentSettings.hide);
61
+ const displayComment = !!(score && !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide));
62
62
  const displaySubmitBnt = !!(score && (displayReasons || displayComment));
63
63
  (0, react_1.useEffect)(() => {
64
64
  if (score && !displayComment && !displayReasons) {
@@ -85,10 +85,13 @@ function Rating({ settings, onSubmit, className }) {
85
85
  items: (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.items) || [],
86
86
  component: reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.component,
87
87
  }, onChange: setReasons })),
88
- displayComment && (React.createElement(Comment_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: { label: commentSettings.label } })))),
88
+ displayComment && (React.createElement(Comment_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: {
89
+ label: (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.label) ||
90
+ translate('theme.feedback.settings.comment.label', 'Please share your feedback with us.'),
91
+ } })))),
89
92
  displaySubmitBnt && (React.createElement(ButtonsContainer, null,
90
93
  React.createElement(Button_1.Button, { onClick: onCancelRatingForm, variant: "text", size: "small" }, "Cancel"),
91
- React.createElement(Button_1.Button, { onClick: onCancelRatingForm, variant: "secondary", size: "small" }, "Submit"))))));
94
+ React.createElement(Button_1.Button, { onClick: onSubmitRatingForm, variant: "secondary", size: "small" }, "Submit"))))));
92
95
  }
93
96
  exports.Rating = Rating;
94
97
  const StyledForm = styled_components_1.default.form `
@@ -50,7 +50,7 @@ function Scale({ settings, onSubmit, className }) {
50
50
  scaleOptions.push(React.createElement(Button_1.Button, { id: `scale-option-${i}`, key: `scale-option-${i}`, type: "button", onClick: () => setScore(i), className: `${score === i ? 'active' : ''}` }, i));
51
51
  }
52
52
  const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
53
- const displayComment = !!score && commentSettings && !commentSettings.hide;
53
+ const displayComment = !!(score && !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide));
54
54
  const displaySubmitBnt = !!score && (displayReasons || displayComment);
55
55
  const handleCancel = () => {
56
56
  setScore(0);
@@ -94,7 +94,10 @@ function Scale({ settings, onSubmit, className }) {
94
94
  items: (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.items) || [],
95
95
  component: reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.component,
96
96
  }, onChange: setReasons })),
97
- displayComment && (React.createElement(Comment_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: { label: commentSettings.label } }))),
97
+ displayComment && (React.createElement(Comment_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: {
98
+ label: (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.label) ||
99
+ translate('theme.feedback.settings.comment.label', 'Please share your feedback with us.'),
100
+ } }))),
98
101
  displaySubmitBnt && (React.createElement(ButtonsContainer, null,
99
102
  React.createElement(Button_1.Button, { "data-translation-key": "theme.feedback.settings.comment.cancel", onClick: handleCancel, variant: "text", size: "small" }, translate('theme.feedback.settings.comment.cancel', 'Cancel')),
100
103
  React.createElement(Button_1.Button, { "data-translation-key": "theme.feedback.settings.scale.send", onClick: onSubmitScaleForm, variant: "secondary", size: "small" }, translate('theme.feedback.settings.scale.send', 'Submit')))))));
@@ -46,7 +46,7 @@ function Sentiment({ settings, onSubmit, className }) {
46
46
  const { useTranslate } = (0, hooks_1.useThemeHooks)();
47
47
  const { translate } = useTranslate();
48
48
  const displayReasons = !!(score && reasonsSettings && !reasonsSettings.hide);
49
- const displayComment = !!(score && commentSettings && !commentSettings.hide);
49
+ const displayComment = !!(score && !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide));
50
50
  const displaySubmitBnt = !!(score && (displayReasons || displayComment));
51
51
  const commentLabel = score === 1
52
52
  ? (commentSettings && commentSettings.likeLabel) ||
@@ -317,7 +317,7 @@ const typography = (0, styled_components_1.css) `
317
317
  --font-family-base: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
318
318
  'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif; // Font family of the entire system.
319
319
  --font-family-monospaced: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono',
320
- 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro', 'Fira Mono',
320
+ 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Mono', 'Fira Mono',
321
321
  'Droid Sans Mono', 'Courier New', monospace;
322
322
 
323
323
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.38.6",
3
+ "version": "0.38.8",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -98,7 +98,7 @@
98
98
  "timeago.js": "^4.0.2",
99
99
  "i18next": "^22.4.12",
100
100
  "nprogress": "^0.2.0",
101
- "@redocly/config": "0.7.0"
101
+ "@redocly/config": "0.8.1"
102
102
  },
103
103
  "scripts": {
104
104
  "start": "npm-run-all --parallel storybook storybook:tokens:watch",
@@ -74,7 +74,7 @@ export function Mood({ settings, onSubmit, className }: MoodProps): JSX.Element
74
74
  };
75
75
 
76
76
  const displayReasons = !!(score && reasonsSettings && !reasonsSettings.hide);
77
- const displayComment = !!(score && commentSettings && !commentSettings.hide);
77
+ const displayComment = !!(score && !commentSettings?.hide);
78
78
  const displaySubmitBnt = !!(score && (displayReasons || displayComment));
79
79
 
80
80
  const onSubmitMoodForm = () => {
@@ -56,7 +56,7 @@ export function Rating({ settings, onSubmit, className }: RatingProps): JSX.Elem
56
56
  };
57
57
 
58
58
  const displayReasons = !!(score && reasonsSettings && !reasonsSettings.hide);
59
- const displayComment = !!(score && commentSettings && !commentSettings.hide);
59
+ const displayComment = !!(score && !commentSettings?.hide);
60
60
  const displaySubmitBnt = !!(score && (displayReasons || displayComment));
61
61
 
62
62
  useEffect(() => {
@@ -113,7 +113,14 @@ export function Rating({ settings, onSubmit, className }: RatingProps): JSX.Elem
113
113
  <Comment
114
114
  standAlone={false}
115
115
  onSubmit={({ comment }) => setComment(comment)}
116
- settings={{ label: commentSettings.label }}
116
+ settings={{
117
+ label:
118
+ commentSettings?.label ||
119
+ translate(
120
+ 'theme.feedback.settings.comment.label',
121
+ 'Please share your feedback with us.',
122
+ ),
123
+ }}
117
124
  />
118
125
  )}
119
126
  </StyledFormOptionalFields>
@@ -123,7 +130,7 @@ export function Rating({ settings, onSubmit, className }: RatingProps): JSX.Elem
123
130
  <Button onClick={onCancelRatingForm} variant="text" size="small">
124
131
  Cancel
125
132
  </Button>
126
- <Button onClick={onCancelRatingForm} variant="secondary" size="small">
133
+ <Button onClick={onSubmitRatingForm} variant="secondary" size="small">
127
134
  Submit
128
135
  </Button>
129
136
  </ButtonsContainer>
@@ -67,7 +67,7 @@ export function Scale({ settings, onSubmit, className }: ScaleProps): JSX.Elemen
67
67
  }
68
68
 
69
69
  const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
70
- const displayComment = !!score && commentSettings && !commentSettings.hide;
70
+ const displayComment = !!(score && !commentSettings?.hide);
71
71
  const displaySubmitBnt = !!score && (displayReasons || displayComment);
72
72
 
73
73
  const handleCancel = () => {
@@ -145,7 +145,14 @@ export function Scale({ settings, onSubmit, className }: ScaleProps): JSX.Elemen
145
145
  <Comment
146
146
  standAlone={false}
147
147
  onSubmit={({ comment }) => setComment(comment)}
148
- settings={{ label: commentSettings.label }}
148
+ settings={{
149
+ label:
150
+ commentSettings?.label ||
151
+ translate(
152
+ 'theme.feedback.settings.comment.label',
153
+ 'Please share your feedback with us.',
154
+ ),
155
+ }}
149
156
  />
150
157
  )}
151
158
  </StyledFormOptionalFields>
@@ -42,7 +42,7 @@ export function Sentiment({ settings, onSubmit, className }: SentimentProps): JS
42
42
  const { translate } = useTranslate();
43
43
 
44
44
  const displayReasons = !!(score && reasonsSettings && !reasonsSettings.hide);
45
- const displayComment = !!(score && commentSettings && !commentSettings.hide);
45
+ const displayComment = !!(score && !commentSettings?.hide);
46
46
  const displaySubmitBnt = !!(score && (displayReasons || displayComment));
47
47
 
48
48
  const commentLabel =
@@ -318,7 +318,7 @@ const typography = css`
318
318
  --font-family-base: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
319
319
  'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif; // Font family of the entire system.
320
320
  --font-family-monospaced: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono',
321
- 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro', 'Fira Mono',
321
+ 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Mono', 'Fira Mono',
322
322
  'Droid Sans Mono', 'Courier New', monospace;
323
323
 
324
324
  /**