@redocly/theme 0.29.0 → 0.30.1-beta.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.
Files changed (40) hide show
  1. package/lib/components/Catalog/useCatalog.js +4 -3
  2. package/lib/components/CodeBlock/CodeBlock.js +1 -1
  3. package/lib/components/Feedback/Comment.js +7 -5
  4. package/lib/components/Feedback/Mood.js +0 -1
  5. package/lib/components/Feedback/Rating.js +0 -1
  6. package/lib/components/Feedback/ReportDialog.d.ts +1 -1
  7. package/lib/components/Feedback/ReportDialog.js +3 -3
  8. package/lib/components/Feedback/Scale.js +0 -1
  9. package/lib/components/Feedback/Sentiment.js +0 -1
  10. package/lib/components/Feedback/types.d.ts +1 -5
  11. package/lib/components/Filter/Filter.js +1 -5
  12. package/lib/components/Markdown/styledVariables.js +6 -6
  13. package/lib/components/Scorecard/Card.d.ts +3 -1
  14. package/lib/components/Scorecard/Card.js +4 -2
  15. package/lib/components/Scorecard/Gauge.d.ts +5 -2
  16. package/lib/components/Scorecard/Gauge.js +6 -2
  17. package/lib/components/Scorecard/StatusByLevelWidget.d.ts +1 -0
  18. package/lib/components/Scorecard/StatusByLevelWidget.js +5 -2
  19. package/lib/config.d.ts +6 -0
  20. package/lib/config.js +1 -0
  21. package/lib/globalStyle.js +1 -1
  22. package/lib/types/portal/src/shared/types/feedback.d.ts +1 -0
  23. package/package.json +1 -1
  24. package/src/components/Catalog/useCatalog.ts +6 -3
  25. package/src/components/CodeBlock/CodeBlock.tsx +5 -1
  26. package/src/components/Feedback/Comment.tsx +7 -5
  27. package/src/components/Feedback/Mood.tsx +0 -1
  28. package/src/components/Feedback/Rating.tsx +0 -1
  29. package/src/components/Feedback/ReportDialog.tsx +3 -2
  30. package/src/components/Feedback/Scale.tsx +0 -1
  31. package/src/components/Feedback/Sentiment.tsx +0 -1
  32. package/src/components/Feedback/types.ts +6 -17
  33. package/src/components/Filter/Filter.tsx +1 -6
  34. package/src/components/Markdown/styledVariables.ts +6 -6
  35. package/src/components/Scorecard/Card.tsx +4 -2
  36. package/src/components/Scorecard/Gauge.tsx +16 -7
  37. package/src/components/Scorecard/StatusByLevelWidget.tsx +6 -2
  38. package/src/config.ts +1 -0
  39. package/src/globalStyle.ts +1 -1
  40. package/src/types/portal/src/shared/types/feedback.ts +9 -2
@@ -256,9 +256,10 @@ function collectFilterOptions(items, filters) {
256
256
  }
257
257
  }
258
258
  }
259
- const options = Object.entries(usedOptions)
260
- .map(([value, count]) => ({ value, count }))
261
- .sort((a, b) => b.value.localeCompare(a.value));
259
+ const options = Object.entries(usedOptions).map(([value, count]) => ({ value, count }));
260
+ if (!staticOptions) {
261
+ options.sort((a, b) => b.value.localeCompare(a.value));
262
+ }
262
263
  if (othersCount) {
263
264
  options.push({
264
265
  value: filter.missingCategoryNameTranslationKey || filter.missingCategoryName || 'Others',
@@ -59,7 +59,7 @@ function CodeBlock({ lang, source, externalSource, header, dataTestId = 'source-
59
59
  ? (0, utils_1.addLineNumbers)(highlightedCode, startLineNumber)
60
60
  : highlightedCode,
61
61
  }, "data-cy": dataTestId, withControls: true }),
62
- reportDialog.visible && (react_1.default.createElement(Feedback_1.ReportDialog, Object.assign({}, reportDialog.props, { location: sourceCode })))));
62
+ reportDialog.visible && (react_1.default.createElement(Feedback_1.ReportDialog, Object.assign({}, reportDialog.props, { location: sourceCode, lang: lang })))));
63
63
  }
64
64
  exports.CodeBlock = CodeBlock;
65
65
  const Wrapper = styled_components_1.default.div ``;
@@ -42,13 +42,13 @@ const Comment = ({ settings, onSubmit, onCancel, className, standAlone = true, }
42
42
  if (!text)
43
43
  return;
44
44
  setSubmitValue(text);
45
- onSubmit({ comment: text, path: window.location.href });
45
+ onSubmit({ comment: text });
46
46
  };
47
47
  const handleTextAreaChange = (e) => {
48
48
  const commentValue = e.target.value;
49
49
  setText(commentValue);
50
50
  if (!standAlone) {
51
- onSubmit({ comment: commentValue, path: window.location.href });
51
+ onSubmit({ comment: commentValue });
52
52
  }
53
53
  };
54
54
  if (submitValue) {
@@ -93,10 +93,12 @@ const Label = styled_components_1.default.h4 `
93
93
  margin-right: 15px;
94
94
  `;
95
95
  const TextArea = styled_components_1.default.textarea `
96
+ background-color: var(--bg-base);
97
+ border-radius: var(--border-radius-lg);
98
+ border: var(--input-border);
99
+ outline: none;
100
+ color: var(--text-primary);
96
101
  font-family: var(--font-family-base);
97
- border: 1px solid #ccc;
98
- border-radius: 5px;
99
- color: black;
100
102
  margin: 0 0 10px 0;
101
103
  padding: 10px;
102
104
  `;
@@ -74,7 +74,6 @@ const Mood = ({ settings, onSubmit, className }) => {
74
74
  score: remapScore(score),
75
75
  comment,
76
76
  reasons,
77
- path: window.location.href,
78
77
  });
79
78
  setIsSubmitted(true);
80
79
  };
@@ -50,7 +50,6 @@ const Rating = ({ settings, onSubmit, className }) => {
50
50
  comment,
51
51
  reasons,
52
52
  max: exports.FEEDBACK_MAX_RATING,
53
- path: window.location.href,
54
53
  });
55
54
  setIsSubmitted(true);
56
55
  };
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import type { ReportDialogProps } from '../../components/Feedback';
3
- export declare const ReportDialog: ({ location, settings, onSubmit, onCancel, submitFeedback, }: ReportDialogProps) => JSX.Element;
3
+ export declare const ReportDialog: ({ location, settings, onSubmit, onCancel, submitFeedback, lang, }: ReportDialogProps) => JSX.Element;
@@ -41,12 +41,12 @@ const styled_components_1 = __importDefault(require("styled-components"));
41
41
  const react_router_dom_1 = require("react-router-dom");
42
42
  const telemetry_1 = require("../../mocks/telemetry");
43
43
  const Comment_1 = require("../../components/Feedback/Comment");
44
- const ReportDialog = ({ location, settings, onSubmit, onCancel, submitFeedback, }) => {
44
+ const ReportDialog = ({ location, settings, onSubmit, onCancel, submitFeedback, lang, }) => {
45
45
  const { label } = settings;
46
46
  const { pathname } = (0, react_router_dom_1.useLocation)();
47
- return (React.createElement(Wrapper, { className: "modal" },
47
+ return (React.createElement(Wrapper, { className: "modal scroll-lock" },
48
48
  React.createElement(Comment_1.Comment, { settings: { label }, onSubmit: (value) => __awaiter(void 0, void 0, void 0, function* () {
49
- yield submitFeedback({ type: 'problem', values: value, location, path: pathname });
49
+ yield submitFeedback({ type: 'problem', values: value, location, path: pathname, lang });
50
50
  telemetry_1.telemetry.send('code_snippet_reported', {});
51
51
  onSubmit();
52
52
  }), onCancel: onCancel })));
@@ -56,7 +56,6 @@ const Scale = ({ settings, onSubmit, className }) => {
56
56
  comment,
57
57
  reasons,
58
58
  max: exports.MAX_SCALE,
59
- path: window.location.href,
60
59
  });
61
60
  setIsSubmitted(true);
62
61
  };
@@ -56,7 +56,6 @@ const Sentiment = ({ settings, onSubmit, className }) => {
56
56
  score,
57
57
  comment,
58
58
  reasons,
59
- path: window.location.href,
60
59
  });
61
60
  setIsSubmitted(true);
62
61
  };
@@ -5,7 +5,6 @@ export type RatingProps = {
5
5
  comment?: string;
6
6
  reasons?: string[];
7
7
  max: number;
8
- path?: string;
9
8
  }) => void;
10
9
  settings?: {
11
10
  label?: string;
@@ -29,7 +28,6 @@ export type ScaleProps = {
29
28
  comment?: string;
30
29
  reasons?: string[];
31
30
  max?: number;
32
- path?: string;
33
31
  }) => void;
34
32
  settings?: {
35
33
  label?: string;
@@ -54,7 +52,6 @@ export type MoodProps = {
54
52
  score: number;
55
53
  comment?: string;
56
54
  reasons?: string[];
57
- path?: string;
58
55
  }) => void;
59
56
  settings?: {
60
57
  label?: string;
@@ -79,7 +76,6 @@ export type SentimentProps = {
79
76
  score: number;
80
77
  comment?: string;
81
78
  reasons?: string[];
82
- path?: string;
83
79
  }) => void;
84
80
  settings?: {
85
81
  label?: string;
@@ -101,7 +97,6 @@ export type SentimentProps = {
101
97
  export type CommentProps = {
102
98
  onSubmit: (value: {
103
99
  comment: string;
104
- path?: string;
105
100
  }) => void;
106
101
  onCancel?: () => unknown;
107
102
  settings?: {
@@ -122,6 +117,7 @@ export type ReasonsProps = {
122
117
  };
123
118
  export type ReportDialogProps = {
124
119
  location: string;
120
+ lang?: string;
125
121
  onSubmit: () => void;
126
122
  onCancel: () => void;
127
123
  settings: {
@@ -52,7 +52,7 @@ function Filter({ filter, filterValuesCasing, }) {
52
52
  return;
53
53
  filter.selectOption(Object.assign(Object.assign({}, filter.selectedOptions), { to: formatDateWithNoTimeZone(to) }));
54
54
  } })))) : (filter.filteredOptions.map((value) => {
55
- const id = 'filter--' + filter.property + '--' + slug(value.value);
55
+ const id = 'filter--' + filter.property + '--' + value.value;
56
56
  return (react_1.default.createElement(FilterOption, { key: id, role: "link", onClick: () => filter.toggleOption(value.value) },
57
57
  react_1.default.createElement(icons_1.CheckboxIcon, { checked: filter.selectedOptions.has(value.value) }),
58
58
  react_1.default.createElement(FilterOptionLabel, null, changeCasing(translate(value.value), filterValuesCasing)),
@@ -133,10 +133,6 @@ const StyledSelect = (0, styled_components_1.default)(Select_1.Select) `
133
133
  margin: var(--filter-select-option-margin);
134
134
  }
135
135
  `;
136
- // TODO: import from portal
137
- function slug(str) {
138
- return str.replace(/\s/g, '-').toLowerCase();
139
- }
140
136
  const DatePickerWrapper = styled_components_1.default.div `
141
137
  color: var(--filter-date-picker-color);
142
138
  display: flex;
@@ -236,11 +236,11 @@ exports.markdown = (0, styled_components_1.css) `
236
236
  --md-tabs-content-padding: var(--spacing-base) 0; // @presenter Spacing
237
237
  --md-tabs-content-border: none; // @presenter Border
238
238
 
239
- --md-tabs-tab-text-color: var(--text-secondary); // @presenter Color
240
- --md-tabs-tab-font-size: var(--font-size-base); // @presenter FontSize
239
+ --md-tabs-tab-text-color: var(--text-primary); // @presenter Color
240
+ --md-tabs-tab-font-size: var(--font-size-lg); // @presenter FontSize
241
241
  --md-tabs-tab-font-family: var(--font-size-base); // @presenter FontFamily
242
242
  --md-tabs-tab-font-style: normal; // @presenter FontStyle
243
- --md-tabs-tab-font-weight: var(--font-weight-regular); // @presenter FontWeight
243
+ --md-tabs-tab-font-weight: var(--font-weight-bold); // @presenter FontWeight
244
244
  --md-tabs-tab-background-color: none; // @presenter Color
245
245
  --md-tabs-tab-margin: 0 0 -1px 0; // @presenter Spacing
246
246
  --md-tabs-tab-padding: var(--spacing-sm) var(--spacing-base); // @presenter Spacing
@@ -255,8 +255,8 @@ exports.markdown = (0, styled_components_1.css) `
255
255
  --md-tabs-active-tab-font-weight: var(--md-tabs-tab-font-weight); // @presenter FontWeight
256
256
  --md-tabs-active-tab-background-color: var(--background-color); // @presenter Color
257
257
  --md-tabs-active-tab-padding: var(--md-tabs-tab-padding); // @presenter Spacing
258
- --md-tabs-active-tab-border-color: var(--border-primary); // @presenter Color
259
- --md-tabs-active-tab-border-width: 0 0 1px 0; // @presenter Spacing
258
+ --md-tabs-active-tab-border-color: var(--text-base); // @presenter Color
259
+ --md-tabs-active-tab-border-width: 0 0 2px 0; // @presenter Spacing
260
260
  --md-tabs-active-tab-border-radius: var(--md-tabs-tab-border-radius); // @presenter BorderRadius
261
261
 
262
262
  --md-tabs-hover-tab-text-color: var(--md-tabs-tab-text-color); // @presenter Color
@@ -267,7 +267,7 @@ exports.markdown = (0, styled_components_1.css) `
267
267
  --md-tabs-hover-tab-background-color: var(--md-tabs-tab-background-color); // @presenter Color
268
268
  --md-tabs-hover-tab-padding: var(--md-tabs-tab-padding); // @presenter Spacing
269
269
  --md-tabs-hover-tab-border-color: var(--border-secondary); // @presenter Color
270
- --md-tabs-hover-tab-border-width: 0 0 1px 0; // @presenter Spacing
270
+ --md-tabs-hover-tab-border-width: 0 0 1.5px 0; // @presenter Spacing
271
271
  --md-tabs-hover-tab-border-radius: var(--md-tabs-tab-border-radius); // @presenter BorderRadius
272
272
 
273
273
  // @tokens End
@@ -1,2 +1,4 @@
1
- export declare const ScorecardCard: import("styled-components").StyledComponent<"div", any, {}, never>;
1
+ export declare const ScorecardCard: import("styled-components").StyledComponent<"div", any, {
2
+ 'data-component-name': string;
3
+ }, "data-component-name">;
2
4
  export declare const ScorecardCardTitle: import("styled-components").StyledComponent<"h3", any, {}, never>;
@@ -5,9 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ScorecardCardTitle = exports.ScorecardCard = void 0;
7
7
  const styled_components_1 = __importDefault(require("styled-components"));
8
- exports.ScorecardCard = styled_components_1.default.div `
8
+ exports.ScorecardCard = styled_components_1.default.div.attrs({
9
+ 'data-component-name': 'Scorecard/ScorecardCard',
10
+ }) `
9
11
  color: var(--text-primary);
10
- background-color: var(--thin-tile-background-color);
12
+ background-color: var(--bg-raised);
11
13
  border-radius: 4px;
12
14
 
13
15
  border: 1px solid var(--border-primary);
@@ -1,8 +1,11 @@
1
1
  /// <reference types="react" />
2
- export declare function Gauge({ chunks, }: {
2
+ export interface GaugeProps {
3
3
  chunks: {
4
4
  share: number;
5
5
  color: string;
6
+ title?: string;
6
7
  }[];
7
- }): JSX.Element;
8
+ className?: string;
9
+ }
10
+ export declare function Gauge({ chunks, className }: GaugeProps): JSX.Element;
8
11
  export declare const GaugeValue: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -29,8 +29,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.GaugeValue = exports.Gauge = void 0;
30
30
  const React = __importStar(require("react"));
31
31
  const styled_components_1 = __importDefault(require("styled-components"));
32
- function Gauge({ chunks, }) {
33
- return (React.createElement(GaugeWrapper, null, chunks.map((chunk, i) => (React.createElement(GaugeChunk, Object.assign({ key: i }, chunk))))));
32
+ function Gauge({ chunks, className }) {
33
+ const title = chunks
34
+ .map((chunk) => chunk.title)
35
+ .filter(Boolean)
36
+ .join(', ');
37
+ return (React.createElement(GaugeWrapper, { "data-component-name": "Scorecard/StatusByLevelWidget", className: className, title: title }, chunks.map((chunk, i) => (React.createElement(GaugeChunk, { key: i, share: chunk.share, color: chunk.color })))));
34
38
  }
35
39
  exports.Gauge = Gauge;
36
40
  exports.GaugeValue = styled_components_1.default.span `
@@ -7,5 +7,6 @@ export interface StatusByLevelWidgetProps {
7
7
  warnings: number;
8
8
  total: number;
9
9
  }[];
10
+ className?: string;
10
11
  }
11
12
  export declare function StatusByLevelWidget(props: StatusByLevelWidgetProps): JSX.Element;
@@ -32,8 +32,8 @@ const styled_components_1 = __importDefault(require("styled-components"));
32
32
  const Gauge_1 = require("../../components/Scorecard/Gauge");
33
33
  const Card_1 = require("../../components/Scorecard/Card");
34
34
  function StatusByLevelWidget(props) {
35
- const { levels, title } = props;
36
- return (React.createElement(Card_1.ScorecardCard, null,
35
+ const { levels, title, className } = props;
36
+ return (React.createElement(Card_1.ScorecardCard, { "data-component-name": "Scorecard/StatusByLevelWidget", className: className },
37
37
  React.createElement(Card_1.ScorecardCardTitle, null, title),
38
38
  React.createElement(CardBody, null, levels.map((level) => {
39
39
  const success = level.total - level.errors - level.warnings;
@@ -43,14 +43,17 @@ function StatusByLevelWidget(props) {
43
43
  {
44
44
  share: (success / level.total) * 100,
45
45
  color: 'var(--scorecard-color-success)',
46
+ title: `${success} passed`,
46
47
  },
47
48
  {
48
49
  share: (level.warnings / level.total) * 100,
49
50
  color: 'var(--scorecard-color-warning)',
51
+ title: `${level.warnings} ${level.warnings === 1 ? 'warning' : 'warnings'}`,
50
52
  },
51
53
  {
52
54
  share: (level.errors / level.total) * 100,
53
55
  color: 'var(--scorecard-color-error)',
56
+ title: `${level.errors} ${level.errors === 1 ? 'error' : 'errors'}`,
54
57
  },
55
58
  ] }),
56
59
  React.createElement(Gauge_1.GaugeValue, null,
package/lib/config.d.ts CHANGED
@@ -309,6 +309,9 @@ declare const scorecardConfigSchema: {
309
309
  readonly name: {
310
310
  readonly type: "string";
311
311
  };
312
+ readonly color: {
313
+ readonly type: "string";
314
+ };
312
315
  readonly extends: {
313
316
  readonly type: "array";
314
317
  readonly items: {
@@ -1878,6 +1881,9 @@ export declare const themeConfigSchema: {
1878
1881
  readonly name: {
1879
1882
  readonly type: "string";
1880
1883
  };
1884
+ readonly color: {
1885
+ readonly type: "string";
1886
+ };
1881
1887
  readonly extends: {
1882
1888
  readonly type: "array";
1883
1889
  readonly items: {
package/lib/config.js CHANGED
@@ -280,6 +280,7 @@ const scorecardConfigSchema = {
280
280
  required: ['name'],
281
281
  properties: {
282
282
  name: { type: 'string' },
283
+ color: { type: 'string' },
283
284
  extends: { type: 'array', items: { type: 'string' } },
284
285
  rules: {
285
286
  type: 'object',
@@ -899,7 +899,7 @@ const error = (0, styled_components_1.css) `
899
899
  --detailed-error-message-font-family: var(--code-block-controls-font-family);
900
900
  `;
901
901
  const modal = (0, styled_components_1.css) `
902
- body:has(.modal) {
902
+ body:has(.scroll-lock) {
903
903
  overflow: hidden;
904
904
  }
905
905
 
@@ -5,6 +5,7 @@ export type SubmitFeedbackParams = {
5
5
  values: Record<string, unknown>;
6
6
  path?: string;
7
7
  location?: string;
8
+ lang?: string;
8
9
  };
9
10
  export type FeedbackProps = {
10
11
  type: FEEDBACK_TYPES;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.29.0",
3
+ "version": "0.30.1-beta.0",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -299,9 +299,12 @@ function collectFilterOptions(
299
299
  }
300
300
  }
301
301
 
302
- const options = Object.entries(usedOptions)
303
- .map(([value, count]) => ({ value, count }))
304
- .sort((a, b) => b.value.localeCompare(a.value));
302
+ const options = Object.entries(usedOptions).map(([value, count]) => ({ value, count }));
303
+
304
+ if (!staticOptions) {
305
+ options.sort((a, b) => b.value.localeCompare(a.value));
306
+ }
307
+
305
308
  if (othersCount) {
306
309
  options.push({
307
310
  value: filter.missingCategoryNameTranslationKey || filter.missingCategoryName || 'Others',
@@ -91,7 +91,11 @@ export function CodeBlock({
91
91
  withControls={true}
92
92
  />
93
93
  {reportDialog.visible && (
94
- <ReportDialog {...(reportDialog.props as ReportDialogProps)} location={sourceCode} />
94
+ <ReportDialog
95
+ {...(reportDialog.props as ReportDialogProps)}
96
+ location={sourceCode}
97
+ lang={lang}
98
+ />
95
99
  )}
96
100
  </Wrapper>
97
101
  );
@@ -22,14 +22,14 @@ export const Comment = ({
22
22
  const send = () => {
23
23
  if (!text) return;
24
24
  setSubmitValue(text);
25
- onSubmit({ comment: text, path: window.location.href });
25
+ onSubmit({ comment: text });
26
26
  };
27
27
  const handleTextAreaChange = (e: any) => {
28
28
  const commentValue = e.target.value;
29
29
  setText(commentValue);
30
30
 
31
31
  if (!standAlone) {
32
- onSubmit({ comment: commentValue, path: window.location.href });
32
+ onSubmit({ comment: commentValue });
33
33
  }
34
34
  };
35
35
 
@@ -108,10 +108,12 @@ const Label = styled.h4`
108
108
  `;
109
109
 
110
110
  const TextArea = styled.textarea`
111
+ background-color: var(--bg-base);
112
+ border-radius: var(--border-radius-lg);
113
+ border: var(--input-border);
114
+ outline: none;
115
+ color: var(--text-primary);
111
116
  font-family: var(--font-family-base);
112
- border: 1px solid #ccc;
113
- border-radius: 5px;
114
- color: black;
115
117
  margin: 0 0 10px 0;
116
118
  padding: 10px;
117
119
  `;
@@ -57,7 +57,6 @@ export const Mood = ({ settings, onSubmit, className }: MoodProps): JSX.Element
57
57
  score: remapScore(score),
58
58
  comment,
59
59
  reasons,
60
- path: window.location.href,
61
60
  });
62
61
  setIsSubmitted(true);
63
62
  };
@@ -27,7 +27,6 @@ export const Rating = ({ settings, onSubmit, className }: RatingProps): JSX.Elem
27
27
  comment,
28
28
  reasons,
29
29
  max: FEEDBACK_MAX_RATING,
30
- path: window.location.href,
31
30
  });
32
31
  setIsSubmitted(true);
33
32
  };
@@ -12,16 +12,17 @@ export const ReportDialog = ({
12
12
  onSubmit,
13
13
  onCancel,
14
14
  submitFeedback,
15
+ lang,
15
16
  }: ReportDialogProps): JSX.Element => {
16
17
  const { label } = settings;
17
18
  const { pathname } = useLocation();
18
19
 
19
20
  return (
20
- <Wrapper className="modal">
21
+ <Wrapper className="modal scroll-lock">
21
22
  <Comment
22
23
  settings={{ label }}
23
24
  onSubmit={async (value) => {
24
- await submitFeedback({ type: 'problem', values: value, location, path: pathname });
25
+ await submitFeedback({ type: 'problem', values: value, location, path: pathname, lang });
25
26
  telemetry.send('code_snippet_reported', {});
26
27
  onSubmit();
27
28
  }}
@@ -51,7 +51,6 @@ export const Scale = ({ settings, onSubmit, className }: ScaleProps): JSX.Elemen
51
51
  comment,
52
52
  reasons,
53
53
  max: MAX_SCALE,
54
- path: window.location.href,
55
54
  });
56
55
  setIsSubmitted(true);
57
56
  };
@@ -34,7 +34,6 @@ export const Sentiment = ({ settings, onSubmit, className }: SentimentProps): JS
34
34
  score,
35
35
  comment,
36
36
  reasons,
37
- path: window.location.href,
38
37
  });
39
38
  setIsSubmitted(true);
40
39
  };
@@ -1,13 +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: {
5
- score: number;
6
- comment?: string;
7
- reasons?: string[];
8
- max: number;
9
- path?: string;
10
- }) => void;
4
+ onSubmit: (value: { score: number; comment?: string; reasons?: string[]; max: number }) => void;
11
5
  settings?: {
12
6
  label?: string;
13
7
  submitText?: string;
@@ -26,13 +20,7 @@ export type RatingProps = {
26
20
  };
27
21
 
28
22
  export type ScaleProps = {
29
- onSubmit: (value: {
30
- score: number;
31
- comment?: string;
32
- reasons?: string[];
33
- max?: number;
34
- path?: string;
35
- }) => void;
23
+ onSubmit: (value: { score: number; comment?: string; reasons?: string[]; max?: number }) => void;
36
24
  settings?: {
37
25
  label?: string;
38
26
  submitText?: string;
@@ -53,7 +41,7 @@ export type ScaleProps = {
53
41
  };
54
42
 
55
43
  export type MoodProps = {
56
- onSubmit: (value: { score: number; comment?: string; reasons?: string[]; path?: string }) => void;
44
+ onSubmit: (value: { score: number; comment?: string; reasons?: string[] }) => void;
57
45
  settings?: {
58
46
  label?: string;
59
47
  submitText?: string;
@@ -74,7 +62,7 @@ export type MoodProps = {
74
62
  };
75
63
 
76
64
  export type SentimentProps = {
77
- onSubmit: (value: { score: number; comment?: string; reasons?: string[]; path?: string }) => void;
65
+ onSubmit: (value: { score: number; comment?: string; reasons?: string[] }) => void;
78
66
  settings?: {
79
67
  label?: string;
80
68
  submitText?: string;
@@ -94,7 +82,7 @@ export type SentimentProps = {
94
82
  };
95
83
 
96
84
  export type CommentProps = {
97
- onSubmit: (value: { comment: string; path?: string }) => void;
85
+ onSubmit: (value: { comment: string }) => void;
98
86
  onCancel?: () => unknown;
99
87
  settings?: {
100
88
  label?: string;
@@ -116,6 +104,7 @@ export type ReasonsProps = {
116
104
 
117
105
  export type ReportDialogProps = {
118
106
  location: string;
107
+ lang?: string;
119
108
  onSubmit: () => void;
120
109
  onCancel: () => void;
121
110
  settings: {
@@ -109,7 +109,7 @@ export function Filter({
109
109
  </>
110
110
  ) : (
111
111
  filter.filteredOptions.map((value: any) => {
112
- const id = 'filter--' + filter.property + '--' + slug(value.value);
112
+ const id = 'filter--' + filter.property + '--' + value.value;
113
113
  return (
114
114
  <FilterOption key={id} role="link" onClick={() => filter.toggleOption(value.value)}>
115
115
  <CheckboxIcon checked={filter.selectedOptions.has(value.value)} />
@@ -210,11 +210,6 @@ const StyledSelect = styled(Select)`
210
210
  }
211
211
  `;
212
212
 
213
- // TODO: import from portal
214
- function slug(str: string): string {
215
- return str.replace(/\s/g, '-').toLowerCase();
216
- }
217
-
218
213
  const DatePickerWrapper = styled.div`
219
214
  color: var(--filter-date-picker-color);
220
215
  display: flex;
@@ -235,11 +235,11 @@ export const markdown = css`
235
235
  --md-tabs-content-padding: var(--spacing-base) 0; // @presenter Spacing
236
236
  --md-tabs-content-border: none; // @presenter Border
237
237
 
238
- --md-tabs-tab-text-color: var(--text-secondary); // @presenter Color
239
- --md-tabs-tab-font-size: var(--font-size-base); // @presenter FontSize
238
+ --md-tabs-tab-text-color: var(--text-primary); // @presenter Color
239
+ --md-tabs-tab-font-size: var(--font-size-lg); // @presenter FontSize
240
240
  --md-tabs-tab-font-family: var(--font-size-base); // @presenter FontFamily
241
241
  --md-tabs-tab-font-style: normal; // @presenter FontStyle
242
- --md-tabs-tab-font-weight: var(--font-weight-regular); // @presenter FontWeight
242
+ --md-tabs-tab-font-weight: var(--font-weight-bold); // @presenter FontWeight
243
243
  --md-tabs-tab-background-color: none; // @presenter Color
244
244
  --md-tabs-tab-margin: 0 0 -1px 0; // @presenter Spacing
245
245
  --md-tabs-tab-padding: var(--spacing-sm) var(--spacing-base); // @presenter Spacing
@@ -254,8 +254,8 @@ export const markdown = css`
254
254
  --md-tabs-active-tab-font-weight: var(--md-tabs-tab-font-weight); // @presenter FontWeight
255
255
  --md-tabs-active-tab-background-color: var(--background-color); // @presenter Color
256
256
  --md-tabs-active-tab-padding: var(--md-tabs-tab-padding); // @presenter Spacing
257
- --md-tabs-active-tab-border-color: var(--border-primary); // @presenter Color
258
- --md-tabs-active-tab-border-width: 0 0 1px 0; // @presenter Spacing
257
+ --md-tabs-active-tab-border-color: var(--text-base); // @presenter Color
258
+ --md-tabs-active-tab-border-width: 0 0 2px 0; // @presenter Spacing
259
259
  --md-tabs-active-tab-border-radius: var(--md-tabs-tab-border-radius); // @presenter BorderRadius
260
260
 
261
261
  --md-tabs-hover-tab-text-color: var(--md-tabs-tab-text-color); // @presenter Color
@@ -266,7 +266,7 @@ export const markdown = css`
266
266
  --md-tabs-hover-tab-background-color: var(--md-tabs-tab-background-color); // @presenter Color
267
267
  --md-tabs-hover-tab-padding: var(--md-tabs-tab-padding); // @presenter Spacing
268
268
  --md-tabs-hover-tab-border-color: var(--border-secondary); // @presenter Color
269
- --md-tabs-hover-tab-border-width: 0 0 1px 0; // @presenter Spacing
269
+ --md-tabs-hover-tab-border-width: 0 0 1.5px 0; // @presenter Spacing
270
270
  --md-tabs-hover-tab-border-radius: var(--md-tabs-tab-border-radius); // @presenter BorderRadius
271
271
 
272
272
  // @tokens End
@@ -1,8 +1,10 @@
1
1
  import styled from 'styled-components';
2
2
 
3
- export const ScorecardCard = styled.div`
3
+ export const ScorecardCard = styled.div.attrs({
4
+ 'data-component-name': 'Scorecard/ScorecardCard',
5
+ })`
4
6
  color: var(--text-primary);
5
- background-color: var(--thin-tile-background-color);
7
+ background-color: var(--bg-raised);
6
8
  border-radius: 4px;
7
9
 
8
10
  border: 1px solid var(--border-primary);
@@ -1,18 +1,27 @@
1
1
  import * as React from 'react';
2
2
  import styled from 'styled-components';
3
-
4
- export function Gauge({
5
- chunks,
6
- }: {
3
+ export interface GaugeProps {
7
4
  chunks: {
8
5
  share: number;
9
6
  color: string;
7
+ title?: string;
10
8
  }[];
11
- }) {
9
+ className?: string;
10
+ }
11
+
12
+ export function Gauge({ chunks, className }: GaugeProps) {
13
+ const title = chunks
14
+ .map((chunk) => chunk.title)
15
+ .filter(Boolean)
16
+ .join(', ');
12
17
  return (
13
- <GaugeWrapper>
18
+ <GaugeWrapper
19
+ data-component-name="Scorecard/StatusByLevelWidget"
20
+ className={className}
21
+ title={title}
22
+ >
14
23
  {chunks.map((chunk, i) => (
15
- <GaugeChunk key={i} {...chunk} />
24
+ <GaugeChunk key={i} share={chunk.share} color={chunk.color} />
16
25
  ))}
17
26
  </GaugeWrapper>
18
27
  );
@@ -7,12 +7,13 @@ import { ScorecardCard, ScorecardCardTitle } from '@theme/components/Scorecard/C
7
7
  export interface StatusByLevelWidgetProps {
8
8
  title: string;
9
9
  levels: { name: string; errors: number; warnings: number; total: number }[];
10
+ className?: string;
10
11
  }
11
12
 
12
13
  export function StatusByLevelWidget(props: StatusByLevelWidgetProps) {
13
- const { levels, title } = props;
14
+ const { levels, title, className } = props;
14
15
  return (
15
- <ScorecardCard>
16
+ <ScorecardCard data-component-name="Scorecard/StatusByLevelWidget" className={className}>
16
17
  <ScorecardCardTitle>{title}</ScorecardCardTitle>
17
18
  <CardBody>
18
19
  {levels.map((level) => {
@@ -25,14 +26,17 @@ export function StatusByLevelWidget(props: StatusByLevelWidgetProps) {
25
26
  {
26
27
  share: (success / level.total) * 100,
27
28
  color: 'var(--scorecard-color-success)',
29
+ title: `${success} passed`,
28
30
  },
29
31
  {
30
32
  share: (level.warnings / level.total) * 100,
31
33
  color: 'var(--scorecard-color-warning)',
34
+ title: `${level.warnings} ${level.warnings === 1 ? 'warning' : 'warnings'}`,
32
35
  },
33
36
  {
34
37
  share: (level.errors / level.total) * 100,
35
38
  color: 'var(--scorecard-color-error)',
39
+ title: `${level.errors} ${level.errors === 1 ? 'error' : 'errors'}`,
36
40
  },
37
41
  ]}
38
42
  />
package/src/config.ts CHANGED
@@ -319,6 +319,7 @@ const scorecardConfigSchema = {
319
319
  required: ['name'],
320
320
  properties: {
321
321
  name: { type: 'string' },
322
+ color: { type: 'string' },
322
323
  extends: { type: 'array', items: { type: 'string' } },
323
324
  rules: {
324
325
  type: 'object',
@@ -912,7 +912,7 @@ const error = css`
912
912
  `;
913
913
 
914
914
  const modal = css`
915
- body:has(.modal) {
915
+ body:has(.scroll-lock) {
916
916
  overflow: hidden;
917
917
  }
918
918
 
@@ -1,15 +1,22 @@
1
1
  import type { FEEDBACK_TYPES } from '../constants';
2
2
 
3
- import type {RatingProps, SentimentProps, CommentProps, MoodProps, ScaleProps} from '@theme/components/Feedback';
3
+ import type {
4
+ RatingProps,
5
+ SentimentProps,
6
+ CommentProps,
7
+ MoodProps,
8
+ ScaleProps,
9
+ } from '@theme/components/Feedback';
4
10
 
5
11
  export type SubmitFeedbackParams = {
6
12
  type: string;
7
13
  values: Record<string, unknown>;
8
14
  path?: string;
9
15
  location?: string;
16
+ lang?: string;
10
17
  };
11
18
 
12
19
  export type FeedbackProps = {
13
20
  type: FEEDBACK_TYPES;
14
21
  settings: (RatingProps | SentimentProps | CommentProps | MoodProps | ScaleProps)['settings'];
15
- }
22
+ };