@redocly/theme 0.61.0-next.1 → 0.61.0-next.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.
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +5 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +9 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.js +144 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.d.ts +8 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +161 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.d.ts +8 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.js +67 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.d.ts +9 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +212 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +2 -25
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +12 -1
- package/lib/components/Catalog/CatalogEntity/ShowMoreButton.d.ts +8 -0
- package/lib/components/Catalog/CatalogEntity/ShowMoreButton.js +35 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +2 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +4 -1
- package/lib/components/Catalog/variables.js +112 -0
- package/lib/components/ColorModeSwitcher/ColorModeIcon.d.ts +2 -1
- package/lib/components/ColorModeSwitcher/ColorModeIcon.js +3 -2
- package/lib/components/ColorModeSwitcher/ColorModeSwitcher.js +1 -4
- package/lib/components/Menu/variables.js +1 -0
- package/lib/components/Product/utils.d.ts +1 -0
- package/lib/components/Product/utils.js +10 -0
- package/lib/components/Tooltip/Tooltip.js +2 -0
- package/lib/core/constants/catalog.d.ts +1 -0
- package/lib/core/constants/catalog.js +2 -1
- package/lib/core/constants/common.d.ts +4 -0
- package/lib/core/constants/common.js +5 -1
- package/lib/core/hooks/catalog/use-catalog-entity-details.d.ts +3 -1
- package/lib/core/hooks/catalog/use-catalog-entity-details.js +12 -5
- package/lib/core/hooks/index.d.ts +1 -0
- package/lib/core/hooks/index.js +1 -0
- package/lib/core/hooks/search/use-recent-searches.js +14 -41
- package/lib/core/hooks/use-color-switcher.d.ts +0 -1
- package/lib/core/hooks/use-color-switcher.js +19 -13
- package/lib/core/hooks/use-page-actions.js +37 -6
- package/lib/core/hooks/use-product-picker.js +12 -2
- package/lib/core/hooks/use-store.d.ts +17 -0
- package/lib/core/hooks/use-store.js +64 -0
- package/lib/core/hooks/use-telemetry-fallback.d.ts +2 -0
- package/lib/core/hooks/use-telemetry-fallback.js +2 -0
- package/lib/core/types/catalog.d.ts +33 -4
- package/lib/core/types/common.d.ts +2 -0
- package/lib/core/types/hooks.d.ts +14 -3
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/utils/build-revision-url.d.ts +1 -0
- package/lib/core/utils/build-revision-url.js +15 -0
- package/lib/core/utils/date.d.ts +14 -0
- package/lib/core/utils/date.js +39 -0
- package/lib/core/utils/index.d.ts +2 -0
- package/lib/core/utils/index.js +2 -0
- package/lib/core/utils/load-and-navigate.js +7 -2
- package/lib/core/utils/transform-revisions-to-version-history.d.ts +8 -0
- package/lib/core/utils/transform-revisions-to-version-history.js +110 -0
- package/lib/icons/NavaidMilitaryIcon/NavaidMilitaryIcon.d.ts +9 -0
- package/lib/icons/NavaidMilitaryIcon/NavaidMilitaryIcon.js +26 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/package.json +5 -5
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +7 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.tsx +12 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.tsx +147 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +180 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.tsx +93 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +284 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +3 -25
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +15 -2
- package/src/components/Catalog/CatalogEntity/ShowMoreButton.tsx +47 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +6 -1
- package/src/components/Catalog/variables.ts +112 -0
- package/src/components/ColorModeSwitcher/ColorModeIcon.tsx +5 -3
- package/src/components/ColorModeSwitcher/ColorModeSwitcher.tsx +2 -7
- package/src/components/Menu/variables.ts +1 -0
- package/src/components/Product/utils.ts +6 -0
- package/src/components/Tooltip/Tooltip.tsx +2 -0
- package/src/core/constants/catalog.ts +2 -0
- package/src/core/constants/common.ts +5 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
- package/src/core/hooks/catalog/use-catalog-entity-details.ts +22 -6
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/search/use-recent-searches.ts +38 -65
- package/src/core/hooks/use-color-switcher.ts +29 -15
- package/src/core/hooks/use-page-actions.ts +63 -6
- package/src/core/hooks/use-product-picker.ts +12 -0
- package/src/core/hooks/use-store.ts +95 -0
- package/src/core/hooks/use-telemetry-fallback.ts +2 -0
- package/src/core/types/catalog.ts +38 -10
- package/src/core/types/common.ts +4 -0
- package/src/core/types/hooks.ts +23 -4
- package/src/core/types/l10n.ts +10 -0
- package/src/core/utils/build-revision-url.ts +16 -0
- package/src/core/utils/date.ts +33 -0
- package/src/core/utils/index.ts +2 -0
- package/src/core/utils/load-and-navigate.ts +6 -1
- package/src/core/utils/transform-revisions-to-version-history.ts +163 -0
- package/src/icons/NavaidMilitaryIcon/NavaidMilitaryIcon.tsx +43 -0
- package/src/index.ts +2 -0
|
@@ -50,11 +50,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
50
50
|
exports.CatalogEntityMetadata = CatalogEntityMetadata;
|
|
51
51
|
const react_1 = __importStar(require("react"));
|
|
52
52
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
53
|
-
const ChevronDownIcon_1 = require("../../../icons/ChevronDownIcon/ChevronDownIcon");
|
|
54
53
|
const JsonViewer_1 = require("../../../components/JsonViewer/JsonViewer");
|
|
55
54
|
const utils_1 = require("../../../core/utils");
|
|
56
55
|
const hooks_1 = require("../../../core/hooks");
|
|
57
56
|
const CatalogEntityInfoBar_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntityInfoBar");
|
|
57
|
+
const ShowMoreButton_1 = require("../../../components/Catalog/CatalogEntity/ShowMoreButton");
|
|
58
58
|
const MAX_INITIAL_ITEMS = 4;
|
|
59
59
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
60
60
|
function renderMetadataValue(value) {
|
|
@@ -82,10 +82,7 @@ function CatalogEntityMetadata({ entity }) {
|
|
|
82
82
|
visibleMetadata.map(([key, value]) => (react_1.default.createElement(CatalogEntityInfoBar_1.CatalogEntityInfoBar, { key: key, leftContent: react_1.default.createElement(Label, null,
|
|
83
83
|
(0, utils_1.capitalize)(key),
|
|
84
84
|
":"), rightContent: react_1.default.createElement(Value, null, renderMetadataValue(value)), hoverEffect: false, isCodeBlock: (0, utils_1.isPlainObject)(value) || Array.isArray(value) }))),
|
|
85
|
-
hasMoreItems && (react_1.default.createElement(ShowMoreButton, { onClick: () => setIsOn(!isOn) },
|
|
86
|
-
isOn ? 'Show less' : 'Show more',
|
|
87
|
-
" ",
|
|
88
|
-
react_1.default.createElement(ChevronIcon, { "$isExpanded": isOn })))));
|
|
85
|
+
hasMoreItems && (react_1.default.createElement(ShowMoreButton_1.ShowMoreButton, { onClick: () => setIsOn(!isOn), isExpanded: isOn }, isOn ? 'Show less' : 'Show more'))));
|
|
89
86
|
}
|
|
90
87
|
const JsonViewerWrapper = (0, styled_components_1.default)(JsonViewer_1.JsonViewer) `
|
|
91
88
|
text-align: left;
|
|
@@ -115,24 +112,4 @@ const Heading = styled_components_1.default.h2 `
|
|
|
115
112
|
margin-top: 0;
|
|
116
113
|
font-size: var(--catalog-metadata-heading-size);
|
|
117
114
|
`;
|
|
118
|
-
const ChevronIcon = (0, styled_components_1.default)(ChevronDownIcon_1.ChevronDownIcon) `
|
|
119
|
-
transform: ${({ $isExpanded }) => ($isExpanded ? 'rotate(180deg)' : 'rotate(0)')};
|
|
120
|
-
transition: transform 0.2s ease;
|
|
121
|
-
`;
|
|
122
|
-
const ShowMoreButton = styled_components_1.default.button `
|
|
123
|
-
background: none;
|
|
124
|
-
border: none;
|
|
125
|
-
display: flex;
|
|
126
|
-
align-items: center;
|
|
127
|
-
gap: var(--catalog-metadata-button-gap, 0.5rem);
|
|
128
|
-
cursor: pointer;
|
|
129
|
-
color: var(--catalog-metadata-button-color);
|
|
130
|
-
padding: 0;
|
|
131
|
-
font-weight: var(--font-weight-medium);
|
|
132
|
-
margin-top: var(--spacing-unit);
|
|
133
|
-
|
|
134
|
-
&:hover {
|
|
135
|
-
color: var(--catalog-metadata-button-color-hover);
|
|
136
|
-
}
|
|
137
|
-
`;
|
|
138
115
|
//# sourceMappingURL=CatalogEntityMetadata.js.map
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js
CHANGED
|
@@ -51,11 +51,22 @@ function CatalogEntityRelations({ entity, entitiesCatalogConfig, initialRelation
|
|
|
51
51
|
(0, react_1.useEffect)(() => {
|
|
52
52
|
setFilter(ENTITY_DEFAULT_FILTERS[entity.key]);
|
|
53
53
|
}, [entity.key]);
|
|
54
|
+
const combinedFilter = (0, react_1.useMemo)(() => {
|
|
55
|
+
const baseFilter = filter !== null && filter !== void 0 ? filter : ENTITY_DEFAULT_FILTERS[entity.type];
|
|
56
|
+
if (entity.version && entity.revision) {
|
|
57
|
+
const versionFilter = `version:"${entity.version}"`;
|
|
58
|
+
const revisionFilter = `revision:"${entity.revision}"`;
|
|
59
|
+
return baseFilter
|
|
60
|
+
? `${baseFilter} AND ${versionFilter} AND ${revisionFilter}`
|
|
61
|
+
: `${versionFilter} AND ${revisionFilter}`;
|
|
62
|
+
}
|
|
63
|
+
return baseFilter;
|
|
64
|
+
}, [filter, entity.version, entity.type, entity.revision]);
|
|
54
65
|
const { items: relations, query } = useFetchCatalogEntitiesRelations({
|
|
55
66
|
entityKey: entity.key,
|
|
56
67
|
search: searchQuery,
|
|
57
68
|
sort: sortOption !== null && sortOption !== void 0 ? sortOption : undefined,
|
|
58
|
-
filter:
|
|
69
|
+
filter: combinedFilter,
|
|
59
70
|
limit: 10,
|
|
60
71
|
}, initialRelations);
|
|
61
72
|
const shouldShowLoadMore = query.hasNextPage ||
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ShowMoreButtonProps = {
|
|
3
|
+
onClick: () => void;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
isExpanded?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function ShowMoreButton({ onClick, children, className, isExpanded, }: ShowMoreButtonProps): React.ReactElement;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ShowMoreButton = ShowMoreButton;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const ChevronDownIcon_1 = require("../../../icons/ChevronDownIcon/ChevronDownIcon");
|
|
10
|
+
function ShowMoreButton({ onClick, children, className, isExpanded = false, }) {
|
|
11
|
+
return (react_1.default.createElement(BaseShowMoreButton, { type: "button", onClick: onClick, className: className },
|
|
12
|
+
children,
|
|
13
|
+
react_1.default.createElement(ChevronIcon, { "$isExpanded": isExpanded })));
|
|
14
|
+
}
|
|
15
|
+
const BaseShowMoreButton = styled_components_1.default.button `
|
|
16
|
+
all: unset;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
background: none;
|
|
21
|
+
border: none;
|
|
22
|
+
gap: var(--catalog-show-more-button-gap);
|
|
23
|
+
color: var(--catalog-show-more-button-color);
|
|
24
|
+
padding: 0;
|
|
25
|
+
margin-top: var(--spacing-unit);
|
|
26
|
+
|
|
27
|
+
&:hover {
|
|
28
|
+
color: var(--catalog-show-more-button-color-hover);
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
const ChevronIcon = (0, styled_components_1.default)(ChevronDownIcon_1.ChevronDownIcon) `
|
|
32
|
+
transform: ${({ $isExpanded }) => ($isExpanded ? 'rotate(180deg)' : 'rotate(0)')};
|
|
33
|
+
transition: transform 0.2s ease;
|
|
34
|
+
`;
|
|
35
|
+
//# sourceMappingURL=ShowMoreButton.js.map
|
|
@@ -64,8 +64,11 @@ const CatalogTableViewRow = ({ entity, entitiesCatalogConfig, catalogConfig, col
|
|
|
64
64
|
const { getEntityDetailsLink } = (0, hooks_1.useCatalogEntityDetails)({
|
|
65
65
|
catalogConfig,
|
|
66
66
|
entitiesCatalogConfig,
|
|
67
|
+
revision: entity.revision,
|
|
68
|
+
version: entity.version,
|
|
67
69
|
});
|
|
68
|
-
|
|
70
|
+
const link = getEntityDetailsLink({ key: entity.key, type: entity.type });
|
|
71
|
+
return (react_1.default.createElement(TableRow, { key: entity.id, "$columnsWidths": columns.map((column) => column.width || '1fr'), "$columnsMinWidths": columns.map((column) => column.minWidth || 'auto'), to: link, onClick: () => onRowClick(entity), style: { color: 'var(--catalog-page-wrapper-text-color)' }, "data-component-name": "Catalog/CatalogTableView/CatalogTableViewRow" }, columns.map((column) => (react_1.default.createElement(TableCell, { key: column.key, className: column.key === 'entity' ? '' : 'tooltip-cell-container' }, column.render(entity))))));
|
|
69
72
|
};
|
|
70
73
|
exports.CatalogTableViewRow = CatalogTableViewRow;
|
|
71
74
|
const TableRow = (0, styled_components_1.default)(Link_1.Link) `
|
|
@@ -237,6 +237,13 @@ exports.catalog = (0, styled_components_1.css) `
|
|
|
237
237
|
--catalog-metadata-column-half-gap: var(--spacing-sm);
|
|
238
238
|
--catalog-metadata-heading-size: var(--font-size-md);
|
|
239
239
|
|
|
240
|
+
/**
|
|
241
|
+
* @tokens Catalog show more button
|
|
242
|
+
*/
|
|
243
|
+
--catalog-show-more-button-gap: 0.5rem;
|
|
244
|
+
--catalog-show-more-button-color: var(--text-color-primary);
|
|
245
|
+
--catalog-show-more-button-color-hover: var(--text-color-secondary);
|
|
246
|
+
|
|
240
247
|
/**
|
|
241
248
|
* @tokens Catalog arrow circle
|
|
242
249
|
*/
|
|
@@ -429,6 +436,111 @@ exports.catalog = (0, styled_components_1.css) `
|
|
|
429
436
|
--catalog-entity-relations-edge-label-font-size: 12px;
|
|
430
437
|
--catalog-entity-relations-edge-label-line-height: 1.2;
|
|
431
438
|
// @tokens End
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* @tokens Catalog history button
|
|
442
|
+
*/
|
|
443
|
+
--catalog-history-separator-border-color: var(--border-color-secondary);
|
|
444
|
+
--catalog-history-separator-margin-bottom: var(--spacing-sm);
|
|
445
|
+
--catalog-history-item-padding: var(--spacing-xxs);
|
|
446
|
+
--catalog-history-item-margin-bottom: calc(var(--spacing-xxs) * -1);
|
|
447
|
+
--catalog-history-item-gap: var(--spacing-xxs);
|
|
448
|
+
--catalog-history-item-border-radius: var(--menu-item-label-border-radius);
|
|
449
|
+
--catalog-history-item-bg-color-hover: var(--menu-item-bg-color-hover);
|
|
450
|
+
--catalog-history-icon-size: 16px;
|
|
451
|
+
--catalog-history-text-font-family: var(--font-family-base);
|
|
452
|
+
--catalog-history-text-font-size: var(--font-size-base);
|
|
453
|
+
--catalog-history-text-font-weight: var(--font-weight-regular);
|
|
454
|
+
--catalog-history-text-line-height: var(--line-height-base);
|
|
455
|
+
--catalog-history-text-color: var(--text-color-primary);
|
|
456
|
+
--catalog-history-pill-gap: var(--spacing-xxs);
|
|
457
|
+
--catalog-history-pill-padding-vertical: 1px;
|
|
458
|
+
--catalog-history-pill-padding-horizontal: var(--spacing-xs);
|
|
459
|
+
--catalog-history-pill-border-color: var(--border-color-primary);
|
|
460
|
+
--catalog-history-pill-border-radius: 12px;
|
|
461
|
+
--catalog-history-pill-icon-size: 14px;
|
|
462
|
+
--catalog-history-pill-icon-color: var(--color-green-8);
|
|
463
|
+
--catalog-history-pill-font-family: var(--font-family-base);
|
|
464
|
+
--catalog-history-pill-font-size: var(--font-size-base);
|
|
465
|
+
--catalog-history-pill-line-height: var(--line-height-base);
|
|
466
|
+
--catalog-history-pill-text-color: var(--text-color-primary);
|
|
467
|
+
// @tokens End
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* @tokens Catalog history sidebar
|
|
471
|
+
*/
|
|
472
|
+
--catalog-history-sidebar-width: 320px;
|
|
473
|
+
--catalog-history-sidebar-bg-color: var(--sidebar-bg-color);
|
|
474
|
+
--catalog-history-sidebar-border-color: var(--border-color-secondary);
|
|
475
|
+
|
|
476
|
+
--catalog-history-sidebar-header-padding: var(--spacing-base) var(--spacing-sm) var(--spacing-base);
|
|
477
|
+
--catalog-history-sidebar-header-font-family: var(--font-family-base);
|
|
478
|
+
--catalog-history-sidebar-header-font-size: var(--font-size-base);
|
|
479
|
+
--catalog-history-sidebar-header-font-weight: var(--font-weight-semibold);
|
|
480
|
+
--catalog-history-sidebar-header-line-height: var(--line-height-base);
|
|
481
|
+
--catalog-history-sidebar-header-letter-spacing: 0;
|
|
482
|
+
--catalog-history-sidebar-header-color: var(--text-color-primary);
|
|
483
|
+
|
|
484
|
+
--catalog-history-sidebar-close-button-size: 32px;
|
|
485
|
+
--catalog-history-sidebar-close-button-border-radius: var(--border-radius-md);
|
|
486
|
+
--catalog-history-sidebar-close-button-bg-color-hover: var(--color-hover-base);
|
|
487
|
+
--catalog-history-sidebar-close-icon-color: var(--text-color-primary);
|
|
488
|
+
|
|
489
|
+
--catalog-history-sidebar-content-padding: 0 var(--spacing-sm);
|
|
490
|
+
--catalog-history-sidebar-content-margin-top: calc(var(--spacing-xxs) * -1);
|
|
491
|
+
|
|
492
|
+
--catalog-history-sidebar-version-header-padding: var(--spacing-xs) var(--spacing-xxs);
|
|
493
|
+
--catalog-history-sidebar-version-header-border-radius: var(--border-radius-md);
|
|
494
|
+
--catalog-history-sidebar-version-header-bg-color-hover: var(--color-hover-base);
|
|
495
|
+
|
|
496
|
+
--catalog-history-sidebar-version-icon-size: 32px;
|
|
497
|
+
--catalog-history-sidebar-version-icon-color: var(--text-color-secondary);
|
|
498
|
+
--catalog-history-sidebar-version-icon-color-current: var(--color-static-white);
|
|
499
|
+
--catalog-history-sidebar-version-icon-margin-right: var(--spacing-xs);
|
|
500
|
+
--catalog-history-sidebar-chevron-icon-color: var(--text-color-secondary);
|
|
501
|
+
--catalog-history-sidebar-version-info-gap: 2px;
|
|
502
|
+
|
|
503
|
+
--catalog-history-sidebar-version-title-font-family: var(--font-family-base);
|
|
504
|
+
--catalog-history-sidebar-version-title-font-size: var(--font-size-base);
|
|
505
|
+
--catalog-history-sidebar-version-title-font-weight: var(--font-weight-medium);
|
|
506
|
+
--catalog-history-sidebar-version-title-line-height: var(--line-height-base);
|
|
507
|
+
--catalog-history-sidebar-version-title-color: var(--color-warm-grey-7);
|
|
508
|
+
|
|
509
|
+
--catalog-history-sidebar-version-date-font-family: var(--font-family-base);
|
|
510
|
+
--catalog-history-sidebar-version-date-font-size: var(--font-size-sm);
|
|
511
|
+
--catalog-history-sidebar-version-date-font-weight: var(--font-weight-regular);
|
|
512
|
+
--catalog-history-sidebar-version-date-line-height: var(--line-height-sm);
|
|
513
|
+
--catalog-history-sidebar-version-date-color: var(--color-warm-grey-7);
|
|
514
|
+
|
|
515
|
+
--catalog-history-sidebar-revisions-padding-left: 40px;
|
|
516
|
+
|
|
517
|
+
--catalog-history-sidebar-revision-item-padding: var(--spacing-xs) var(--spacing-sm);
|
|
518
|
+
--catalog-history-sidebar-revision-item-border-radius: var(--border-radius-md);
|
|
519
|
+
--catalog-history-sidebar-revision-item-bg-color-hover: var(--bg-color-hover);
|
|
520
|
+
|
|
521
|
+
--catalog-history-sidebar-revision-name-font-family: var(--font-family-base);
|
|
522
|
+
--catalog-history-sidebar-revision-name-font-size: var(--font-size-base);
|
|
523
|
+
--catalog-history-sidebar-revision-name-font-weight: var(--font-weight-regular);
|
|
524
|
+
--catalog-history-sidebar-revision-name-line-height: var(--line-height-base);
|
|
525
|
+
--catalog-history-sidebar-revision-name-color: var(--text-color-primary);
|
|
526
|
+
|
|
527
|
+
--catalog-history-sidebar-revision-date-font-family: var(--font-family-base);
|
|
528
|
+
--catalog-history-sidebar-revision-date-font-size: var(--font-size-sm);
|
|
529
|
+
--catalog-history-sidebar-revision-date-font-weight: var(--font-weight-regular);
|
|
530
|
+
--catalog-history-sidebar-revision-date-line-height: var(--line-height-sm);
|
|
531
|
+
--catalog-history-sidebar-revision-date-color: var(--color-warm-grey-7);
|
|
532
|
+
|
|
533
|
+
--catalog-history-sidebar-revision-line-color: var(--border-color-secondary);
|
|
534
|
+
--catalog-history-sidebar-revision-item-bg-color-active: var(--bg-color-active);
|
|
535
|
+
|
|
536
|
+
--catalog-history-sidebar-revisions-limit-message-color: var(--color-warm-grey-6);
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* @tokens Catalog history tag border radius
|
|
540
|
+
*/
|
|
541
|
+
--catalog-history-sidebar-version-tag-border-radius: var(--border-radius-xl);
|
|
542
|
+
--catalog-history-sidebar-revision-tag-border-radius: var(--border-radius-xl);
|
|
543
|
+
// @tokens End
|
|
432
544
|
`;
|
|
433
545
|
/* eslint-enable theme/no-raw-colors-in-styles */
|
|
434
546
|
//# sourceMappingURL=variables.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { JSX } from 'react';
|
|
2
|
+
import type { ColorMode } from '../../core/types';
|
|
2
3
|
export type ColorModeIconProps = {
|
|
3
|
-
mode?:
|
|
4
|
+
mode?: ColorMode | string;
|
|
4
5
|
className?: string;
|
|
5
6
|
};
|
|
6
7
|
export declare function ColorModeIcon(props: ColorModeIconProps): JSX.Element;
|
|
@@ -9,14 +9,15 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
9
9
|
const ContrastIcon_1 = require("../../icons/ContrastIcon/ContrastIcon");
|
|
10
10
|
const MoonIcon_1 = require("../../icons/MoonIcon/MoonIcon");
|
|
11
11
|
const SunIcon_1 = require("../../icons/SunIcon/SunIcon");
|
|
12
|
+
const constants_1 = require("../../core/constants");
|
|
12
13
|
function ColorModeIcon(props) {
|
|
13
14
|
return (react_1.default.createElement(ColorModeIconComponent, Object.assign({}, props, { "data-component-name": "ColorModeSwitcher/ColorModeIcon" })));
|
|
14
15
|
}
|
|
15
16
|
function Icon({ mode, className }) {
|
|
16
17
|
switch (mode) {
|
|
17
|
-
case
|
|
18
|
+
case constants_1.DEFAULT_COLOR_MODES.DARK:
|
|
18
19
|
return react_1.default.createElement(SunIcon_1.SunIcon, { "data-testid": "dark" });
|
|
19
|
-
case
|
|
20
|
+
case constants_1.DEFAULT_COLOR_MODES.LIGHT:
|
|
20
21
|
return react_1.default.createElement(MoonIcon_1.MoonIcon, { "data-testid": "light" });
|
|
21
22
|
default:
|
|
22
23
|
return react_1.default.createElement(ContrastIcon_1.ContrastIcon, { "data-testid": "custom", className: className + (mode ? ' ' + mode : '') });
|
|
@@ -9,10 +9,7 @@ const hooks_1 = require("../../core/hooks");
|
|
|
9
9
|
const ColorModeIcon_1 = require("../../components/ColorModeSwitcher/ColorModeIcon");
|
|
10
10
|
const Button_1 = require("../../components/Button/Button");
|
|
11
11
|
function ColorModeSwitcher({ className }) {
|
|
12
|
-
const { isSwitcherHidden,
|
|
13
|
-
(0, hooks_1.useMount)(() => {
|
|
14
|
-
initActiveColorMode();
|
|
15
|
-
});
|
|
12
|
+
const { isSwitcherHidden, switchColorMode, activeColorMode } = (0, hooks_1.useColorSwitcher)();
|
|
16
13
|
if (isSwitcherHidden) {
|
|
17
14
|
return null;
|
|
18
15
|
}
|
|
@@ -42,6 +42,7 @@ exports.menu = (0, styled_components_1.css) `
|
|
|
42
42
|
--menu-item-padding-vertical: var(--spacing-unit); // @presenter Spacing
|
|
43
43
|
--menu-item-padding-horizontal: var(--spacing-xxs); // @presenter Spacing
|
|
44
44
|
--menu-item-nested-offset: var(--spacing-sm); // @presenter Spacing
|
|
45
|
+
--menu-header-container-gap: var(--spacing-sm); // @presenter Spacing
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
48
|
* @tokens Menu item label
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getProductClassName(productName: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProductClassName = getProductClassName;
|
|
4
|
+
function getProductClassName(productName) {
|
|
5
|
+
return `product-${productName
|
|
6
|
+
.toLowerCase()
|
|
7
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
8
|
+
.replace(/^-+|-+$/g, '')}`;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -113,6 +113,8 @@ function TooltipComponent({ children, isOpen, tip, withArrow = true, placement =
|
|
|
113
113
|
onMouseEnter: handleOpen,
|
|
114
114
|
onMouseLeave: handleClose,
|
|
115
115
|
onClick: handleClose,
|
|
116
|
+
onFocus: handleOpen,
|
|
117
|
+
onBlur: handleClose,
|
|
116
118
|
};
|
|
117
119
|
return (react_1.default.createElement(TooltipWrapper, Object.assign({ ref: ref }, controllers, { className: `tooltip-${className}`, "data-component-name": "Tooltip/Tooltip" }),
|
|
118
120
|
children,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GraphCustomEdgeType = exports.GraphCustomNodeType = exports.GraphHandleType = exports.relationTypeMap = exports.reverseRelationMap = exports.PREDEFINED_ENTITY_TYPES = exports.CATALOG_TAG_MAX_LENGTH = void 0;
|
|
3
|
+
exports.VERSION_NOT_SPECIFIED = exports.GraphCustomEdgeType = exports.GraphCustomNodeType = exports.GraphHandleType = exports.relationTypeMap = exports.reverseRelationMap = exports.PREDEFINED_ENTITY_TYPES = exports.CATALOG_TAG_MAX_LENGTH = void 0;
|
|
4
4
|
exports.CATALOG_TAG_MAX_LENGTH = 15;
|
|
5
5
|
exports.PREDEFINED_ENTITY_TYPES = [
|
|
6
6
|
'service',
|
|
@@ -82,4 +82,5 @@ var GraphCustomEdgeType;
|
|
|
82
82
|
(function (GraphCustomEdgeType) {
|
|
83
83
|
GraphCustomEdgeType["CatalogEdge"] = "catalogEdge";
|
|
84
84
|
})(GraphCustomEdgeType || (exports.GraphCustomEdgeType = GraphCustomEdgeType = {}));
|
|
85
|
+
exports.VERSION_NOT_SPECIFIED = 'not_specified_version';
|
|
85
86
|
//# sourceMappingURL=catalog.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MobileMenuType = exports.MenuItemType = exports.DEFAULT_FEEDBACK_TYPE = exports.FEEDBACK_TYPES = exports.ICONS_CDN_URL = exports.CONTENT_ID = exports.DEFAULT_LOCALE_PLACEHOLDER = exports.REDOCLY_TEAMS_RBAC = void 0;
|
|
3
|
+
exports.DEFAULT_COLOR_MODES = exports.MobileMenuType = exports.MenuItemType = exports.DEFAULT_FEEDBACK_TYPE = exports.FEEDBACK_TYPES = exports.ICONS_CDN_URL = exports.CONTENT_ID = 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';
|
|
@@ -33,4 +33,8 @@ var MobileMenuType;
|
|
|
33
33
|
MobileMenuType["PRODUCT"] = "PRODUCT";
|
|
34
34
|
MobileMenuType["PAGE"] = "PAGE";
|
|
35
35
|
})(MobileMenuType || (exports.MobileMenuType = MobileMenuType = {}));
|
|
36
|
+
exports.DEFAULT_COLOR_MODES = {
|
|
37
|
+
LIGHT: 'light',
|
|
38
|
+
DARK: 'dark',
|
|
39
|
+
};
|
|
36
40
|
//# sourceMappingURL=common.js.map
|
|
@@ -3,9 +3,11 @@ import type { BffCatalogEntity } from '../../../core/types';
|
|
|
3
3
|
type Props = {
|
|
4
4
|
catalogConfig: CatalogEntityConfig;
|
|
5
5
|
entitiesCatalogConfig?: EntitiesCatalogConfig;
|
|
6
|
+
revision?: string | null;
|
|
7
|
+
version?: string | null;
|
|
6
8
|
};
|
|
7
9
|
type BaseEntity = Pick<BffCatalogEntity, 'key' | 'type'>;
|
|
8
|
-
export declare function useCatalogEntityDetails({ catalogConfig, entitiesCatalogConfig }: Props): {
|
|
10
|
+
export declare function useCatalogEntityDetails({ catalogConfig, entitiesCatalogConfig, revision, version, }: Props): {
|
|
9
11
|
getEntityDetailsLink: (entity: BaseEntity) => string;
|
|
10
12
|
};
|
|
11
13
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useCatalogEntityDetails = useCatalogEntityDetails;
|
|
4
4
|
const urls_1 = require("../../utils/urls");
|
|
5
|
-
function useCatalogEntityDetails({ catalogConfig, entitiesCatalogConfig }) {
|
|
5
|
+
function useCatalogEntityDetails({ catalogConfig, entitiesCatalogConfig, revision, version, }) {
|
|
6
6
|
const getCatalogSpecificConfigByEntityTypeIncluded = (entity) => {
|
|
7
7
|
var _a;
|
|
8
8
|
if (!entitiesCatalogConfig) {
|
|
@@ -14,12 +14,19 @@ function useCatalogEntityDetails({ catalogConfig, entitiesCatalogConfig }) {
|
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
const getEntityDetailsLink = (entity) => {
|
|
17
|
-
const pathPrefix = (0, urls_1.getPathPrefix)();
|
|
18
17
|
const catalogSpecificConfig = getCatalogSpecificConfigByEntityTypeIncluded(entity);
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const basePath = !catalogSpecificConfig || !entitiesCatalogConfig
|
|
19
|
+
? (0, urls_1.withPathPrefix)(`/catalogs/${catalogConfig.slug}/entities/${entity.key}`)
|
|
20
|
+
: (0, urls_1.withPathPrefix)(`/catalogs/${catalogSpecificConfig.slug}/entities/${entity.key}`);
|
|
21
|
+
const params = new URLSearchParams();
|
|
22
|
+
if (revision) {
|
|
23
|
+
params.set('revision', revision);
|
|
21
24
|
}
|
|
22
|
-
|
|
25
|
+
if (version !== undefined) {
|
|
26
|
+
params.set('version', version !== null && version !== void 0 ? version : '');
|
|
27
|
+
}
|
|
28
|
+
params.set('search', '');
|
|
29
|
+
return `${basePath}?${params.toString()}`;
|
|
23
30
|
};
|
|
24
31
|
return { getEntityDetailsLink };
|
|
25
32
|
}
|
package/lib/core/hooks/index.js
CHANGED
|
@@ -64,4 +64,5 @@ __exportStar(require("./use-connect-mcp-button"), exports);
|
|
|
64
64
|
__exportStar(require("./catalog/use-catalog-entity-details"), exports);
|
|
65
65
|
__exportStar(require("./catalog/use-catalog-entity-schema"), exports);
|
|
66
66
|
__exportStar(require("./catalog/use-catalog-table-header-cell-actions"), exports);
|
|
67
|
+
__exportStar(require("./use-store"), exports);
|
|
67
68
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,31 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useRecentSearches = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const use_store_1 = require("../use-store");
|
|
5
6
|
const js_utils_1 = require("../../utils/js-utils");
|
|
6
7
|
const RECENT_SEARCHES_KEY = 'recentSearches';
|
|
7
8
|
const RECENT_SEARCHES_LIMIT = 5;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (cachedSnapshot)
|
|
15
|
-
return cachedSnapshot;
|
|
16
|
-
try {
|
|
17
|
-
const stored = localStorage.getItem(RECENT_SEARCHES_KEY);
|
|
18
|
-
cachedSnapshot = stored ? JSON.parse(stored) : [];
|
|
19
|
-
return cachedSnapshot;
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
cachedSnapshot = [];
|
|
23
|
-
return cachedSnapshot;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const updateItems = (value, isAdd) => {
|
|
9
|
+
const recentSearchesStore = (0, use_store_1.createStore)({
|
|
10
|
+
storageKey: RECENT_SEARCHES_KEY,
|
|
11
|
+
});
|
|
12
|
+
const useRecentSearches = () => {
|
|
13
|
+
const [items, setItems] = (0, use_store_1.useStore)(recentSearchesStore, []);
|
|
14
|
+
const updateItems = (0, react_1.useCallback)((value, isAdd) => {
|
|
27
15
|
if (!(0, js_utils_1.isBrowser)())
|
|
28
16
|
return;
|
|
29
|
-
const currentItems =
|
|
17
|
+
const currentItems = [...items];
|
|
30
18
|
const valueIndex = currentItems.indexOf(value);
|
|
31
19
|
if (valueIndex !== -1) {
|
|
32
20
|
currentItems.splice(valueIndex, 1);
|
|
@@ -35,29 +23,14 @@ const createRecentSearchesStore = () => {
|
|
|
35
23
|
currentItems.unshift(value);
|
|
36
24
|
}
|
|
37
25
|
const limitedItems = currentItems.slice(0, RECENT_SEARCHES_LIMIT);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
subscribers.forEach((callback) => callback());
|
|
41
|
-
};
|
|
42
|
-
const subscribe = (callback) => {
|
|
43
|
-
subscribers.add(callback);
|
|
44
|
-
return () => subscribers.delete(callback);
|
|
45
|
-
};
|
|
46
|
-
return {
|
|
47
|
-
getSnapshot,
|
|
48
|
-
subscribe,
|
|
49
|
-
updateItems,
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
const recentSearchesStore = createRecentSearchesStore();
|
|
53
|
-
const useRecentSearches = () => {
|
|
54
|
-
const items = (0, react_1.useSyncExternalStore)(recentSearchesStore.subscribe, recentSearchesStore.getSnapshot, () => []);
|
|
26
|
+
setItems(limitedItems);
|
|
27
|
+
}, [items, setItems]);
|
|
55
28
|
const addSearchHistoryItem = (0, react_1.useCallback)((value) => {
|
|
56
|
-
|
|
57
|
-
}, []);
|
|
29
|
+
updateItems(value, true);
|
|
30
|
+
}, [updateItems]);
|
|
58
31
|
const removeSearchHistoryItem = (0, react_1.useCallback)((value) => {
|
|
59
|
-
|
|
60
|
-
}, []);
|
|
32
|
+
updateItems(value, false);
|
|
33
|
+
}, [updateItems]);
|
|
61
34
|
return { items, addSearchHistoryItem, removeSearchHistoryItem };
|
|
62
35
|
};
|
|
63
36
|
exports.useRecentSearches = useRecentSearches;
|
|
@@ -2,38 +2,44 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useColorSwitcher = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const hooks_1 = require("../../core/hooks");
|
|
5
6
|
const use_theme_config_1 = require("./use-theme-config");
|
|
6
7
|
const use_theme_hooks_1 = require("./use-theme-hooks");
|
|
8
|
+
const use_store_1 = require("./use-store");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
10
|
+
const COLOR_MODE_KEY = 'colorSchema';
|
|
11
|
+
const colorModeStore = (0, use_store_1.createStore)({
|
|
12
|
+
storageKey: COLOR_MODE_KEY,
|
|
13
|
+
});
|
|
7
14
|
const useColorSwitcher = () => {
|
|
8
15
|
const themeSettings = (0, use_theme_config_1.useThemeConfig)();
|
|
9
16
|
const { useTelemetry } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
10
17
|
const telemetry = useTelemetry();
|
|
11
|
-
const
|
|
12
|
-
const modes = (
|
|
13
|
-
const
|
|
14
|
-
const [activeColorMode, setActiveColorMode] = (0,
|
|
15
|
-
|
|
18
|
+
const themeColorMode = themeSettings.colorMode;
|
|
19
|
+
const modes = (0, react_1.useMemo)(() => (themeColorMode === null || themeColorMode === void 0 ? void 0 : themeColorMode.modes) || [constants_1.DEFAULT_COLOR_MODES.LIGHT, constants_1.DEFAULT_COLOR_MODES.DARK], [themeColorMode]);
|
|
20
|
+
const defaultMode = modes[0] || constants_1.DEFAULT_COLOR_MODES.LIGHT;
|
|
21
|
+
const [activeColorMode, setActiveColorMode] = (0, use_store_1.useStore)(colorModeStore, defaultMode);
|
|
22
|
+
(0, hooks_1.useMount)(() => {
|
|
16
23
|
const activeMode = Array.from(document.documentElement.classList).find((c) => modes.includes(c));
|
|
17
|
-
setActiveColorMode(activeMode ||
|
|
18
|
-
};
|
|
24
|
+
setActiveColorMode(activeMode || defaultMode);
|
|
25
|
+
});
|
|
19
26
|
const switchColorMode = (mode) => {
|
|
20
27
|
if (mode && !modes.includes(mode)) {
|
|
21
28
|
return;
|
|
22
29
|
}
|
|
23
30
|
const activeIndex = modes.indexOf(activeColorMode);
|
|
24
|
-
// If specific mode is provided, use it, otherwise cycle through modes
|
|
25
31
|
const newMode = mode || (activeIndex < modes.length - 1 ? modes[activeIndex + 1] : modes[0]);
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
const root = document.documentElement;
|
|
33
|
+
modes.forEach((mode) => root.classList.remove(mode));
|
|
34
|
+
root.classList.add(newMode, 'notransition');
|
|
28
35
|
window.requestAnimationFrame(() => {
|
|
29
|
-
|
|
36
|
+
root.classList.remove('notransition');
|
|
30
37
|
});
|
|
31
38
|
telemetry.sendColorModeSwitchedMessage({ from: activeColorMode, to: newMode });
|
|
32
39
|
setActiveColorMode(newMode);
|
|
33
40
|
};
|
|
34
41
|
return {
|
|
35
|
-
isSwitcherHidden:
|
|
36
|
-
initActiveColorMode,
|
|
42
|
+
isSwitcherHidden: themeColorMode === null || themeColorMode === void 0 ? void 0 : themeColorMode.hide,
|
|
37
43
|
switchColorMode,
|
|
38
44
|
activeColorMode,
|
|
39
45
|
};
|