@redocly/theme 0.62.0-custom.0 → 0.62.0-custom.1

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 (50) hide show
  1. package/lib/components/Buttons/EditPageButton.js +4 -26
  2. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +2 -2
  3. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +6 -13
  4. package/lib/components/Dropdown/Dropdown.js +1 -1
  5. package/lib/components/Dropdown/variables.js +1 -0
  6. package/lib/components/Feedback/Comment.js +17 -4
  7. package/lib/components/Feedback/Mood.js +6 -3
  8. package/lib/components/Feedback/Rating.js +6 -3
  9. package/lib/components/Feedback/Scale.js +6 -3
  10. package/lib/components/Feedback/Sentiment.js +6 -3
  11. package/lib/components/Menu/variables.js +3 -3
  12. package/lib/components/PageActions/PageActions.js +1 -1
  13. package/lib/core/constants/feedback.d.ts +2 -0
  14. package/lib/core/constants/feedback.js +6 -0
  15. package/lib/core/constants/index.d.ts +1 -0
  16. package/lib/core/constants/index.js +1 -0
  17. package/lib/core/hooks/use-page-actions.js +7 -4
  18. package/lib/core/openapi/index.d.ts +1 -0
  19. package/lib/core/openapi/index.js +3 -1
  20. package/lib/core/styles/dark.js +11 -0
  21. package/lib/core/styles/global.js +7 -0
  22. package/lib/core/types/l10n.d.ts +1 -1
  23. package/lib/core/utils/transform-revisions-to-version-history.js +13 -20
  24. package/lib/ext/process-scorecard.d.ts +45 -1
  25. package/lib/ext/process-scorecard.js +1 -0
  26. package/lib/icons/DirectionRightIcon/DirectionRightIcon.d.ts +5 -0
  27. package/lib/icons/DirectionRightIcon/DirectionRightIcon.js +24 -0
  28. package/package.json +5 -5
  29. package/src/components/Buttons/EditPageButton.tsx +13 -34
  30. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +2 -2
  31. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +5 -21
  32. package/src/components/Dropdown/Dropdown.tsx +1 -1
  33. package/src/components/Dropdown/variables.ts +1 -0
  34. package/src/components/Feedback/Comment.tsx +22 -4
  35. package/src/components/Feedback/Mood.tsx +6 -2
  36. package/src/components/Feedback/Rating.tsx +6 -2
  37. package/src/components/Feedback/Scale.tsx +6 -2
  38. package/src/components/Feedback/Sentiment.tsx +6 -2
  39. package/src/components/Menu/variables.ts +3 -3
  40. package/src/components/PageActions/PageActions.tsx +1 -1
  41. package/src/core/constants/feedback.ts +2 -0
  42. package/src/core/constants/index.ts +1 -0
  43. package/src/core/hooks/use-page-actions.ts +12 -6
  44. package/src/core/openapi/index.ts +1 -0
  45. package/src/core/styles/dark.ts +12 -0
  46. package/src/core/styles/global.ts +7 -0
  47. package/src/core/types/l10n.ts +1 -0
  48. package/src/core/utils/transform-revisions-to-version-history.ts +13 -21
  49. package/src/ext/process-scorecard.ts +46 -1
  50. package/src/icons/DirectionRightIcon/DirectionRightIcon.tsx +35 -0
@@ -1,14 +1,59 @@
1
1
  import { useCallback } from 'react';
2
2
 
3
- import type { CatalogItem } from '@redocly/theme';
3
+ import type { CatalogItem } from '@redocly/theme/core/types';
4
+ import type { ReactNode } from 'react';
5
+
6
+ export type ScorecardApiTableRow<TScorecard = unknown> = {
7
+ api: CatalogItem;
8
+ scorecard?: TScorecard;
9
+ };
10
+
11
+ export type ScorecardApiTableColumnStatus = 'error' | 'warning' | 'success';
12
+
13
+ export type ScorecardApiTableColumnDetails<TScorecard = unknown> = {
14
+ hidden?: boolean;
15
+ tabLabel?: string;
16
+ description?: ReactNode | ((row: ScorecardApiTableRow<TScorecard>) => ReactNode);
17
+ render?: (params: { row: ScorecardApiTableRow<TScorecard>; value: unknown }) => ReactNode;
18
+ status?:
19
+ | ScorecardApiTableColumnStatus
20
+ | ((params: {
21
+ row: ScorecardApiTableRow<TScorecard>;
22
+ value: unknown;
23
+ }) => ScorecardApiTableColumnStatus);
24
+ statusRule?: 'problem-if-truthy' | 'problem-if-falsy';
25
+ };
26
+
27
+ export type ScorecardApiTableColumn<TScorecard = unknown> = {
28
+ id: string;
29
+ header: string;
30
+ placement?: 'beforeLevels' | 'afterLevels';
31
+ size?: number;
32
+ minSize?: number;
33
+ maxSize?: number;
34
+ sortRule?: 'string' | 'number' | 'date';
35
+ sortDescFirst?: boolean;
36
+ getValue?: (row: ScorecardApiTableRow<TScorecard>) => unknown;
37
+ getSortValue?: (row: ScorecardApiTableRow<TScorecard>) => unknown;
38
+ render?: (params: { row: ScorecardApiTableRow<TScorecard>; value: unknown }) => ReactNode;
39
+ details?: ScorecardApiTableColumnDetails<TScorecard>;
40
+ sortingFn?: (params: {
41
+ rowA: ScorecardApiTableRow<TScorecard>;
42
+ rowB: ScorecardApiTableRow<TScorecard>;
43
+ valueA: unknown;
44
+ valueB: unknown;
45
+ }) => number;
46
+ };
4
47
 
5
48
  export function useProcessScorecard(): {
6
49
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
50
  processScorecard: <T = any>(scorecard: T, api: CatalogItem) => T;
8
51
  processInfo: <T>(info: T) => T;
52
+ getApiTableColumns: () => ScorecardApiTableColumn[];
9
53
  } {
10
54
  return {
11
55
  processScorecard: useCallback((scorecard) => scorecard, []),
12
56
  processInfo: useCallback((info) => info, []),
57
+ getApiTableColumns: useCallback(() => [], []),
13
58
  };
14
59
  }
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import type { IconProps } from '@redocly/theme/icons/types';
5
+
6
+ import { getCssColorVariable } from '@redocly/theme/core/utils';
7
+
8
+ const Icon = (props: IconProps) => (
9
+ <svg
10
+ width="16"
11
+ height="16"
12
+ viewBox="0 0 16 16"
13
+ fill="none"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ {...props}
16
+ >
17
+ <path
18
+ d="M9.5 4L8.79295 4.70705L11.0859 7H5C4.73478 7 4.48043 7.10536 4.29289 7.29289C4.10536 7.48043 4 7.73478 4 8V14H5V8H11.0859L8.79295 10.2929L9.5 11L13 7.5L9.5 4Z"
19
+ fill="#1A1C21"
20
+ />
21
+ <path d="M5 2H4V6H5V2Z" fill="#1A1C21" />
22
+ </svg>
23
+ );
24
+
25
+ export const DirectionRightIcon = styled(Icon).attrs(() => ({
26
+ 'data-component-name': 'icons/DirectionRightIcon/DirectionRightIcon',
27
+ }))`
28
+ path {
29
+ fill: ${({ color }) => getCssColorVariable(color)};
30
+ }
31
+
32
+ height: ${({ size }) => size || '16px'};
33
+ width: ${({ size }) => size || '16px'};
34
+ vertical-align: middle;
35
+ `;