@redocly/theme 0.68.0-next.6 → 0.68.0-next.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.
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +6 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +2 -2
- package/lib/components/Catalog/CatalogSelector.js +2 -2
- package/lib/components/Feedback/ReportDialog.js +2 -2
- package/lib/components/Link/Link.js +2 -2
- package/lib/components/Menu/MenuMobile.js +2 -2
- package/lib/components/Navbar/NavbarItem.js +2 -2
- package/lib/components/Search/SearchDialog.js +3 -16
- package/lib/components/Search/should-show-load-more.d.ts +9 -0
- package/lib/components/Search/should-show-load-more.js +15 -0
- package/lib/core/constants/search.js +4 -0
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +3 -3
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +3 -3
- package/lib/core/hooks/menu/use-mobile-menu-items.js +2 -2
- package/lib/core/hooks/menu/use-mobile-menu-levels.js +2 -2
- package/lib/core/hooks/menu/use-nested-menu.js +3 -3
- package/lib/core/hooks/search/use-search-dialog.js +2 -2
- package/lib/core/hooks/use-active-heading.js +2 -2
- package/lib/core/hooks/use-active-section-id.d.ts +1 -1
- package/lib/core/hooks/use-language-picker.js +3 -3
- package/lib/core/hooks/use-mobile-menu.js +2 -2
- package/lib/core/hooks/use-navbar-height.d.ts +1 -1
- package/lib/core/hooks/use-product-picker.js +2 -2
- package/lib/core/hooks/use-tabs.js +3 -3
- package/lib/core/templates/Markdown.js +2 -2
- package/lib/core/types/hooks.d.ts +2 -1
- package/lib/core/types/link.d.ts +1 -1
- package/lib/core/types/search.d.ts +3 -1
- package/lib/core/types/search.js +1 -0
- package/lib/core/utils/load-and-navigate.d.ts +1 -1
- package/lib/core/utils/menu.d.ts +1 -1
- package/lib/layouts/OIDCForbidden.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +2 -2
- package/lib/markdoc/components/Heading/Heading.js +2 -2
- package/lib/markdoc/components/Tabs/Tabs.js +2 -2
- package/package.json +10 -5
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +1 -1
- package/src/components/Catalog/CatalogSelector.tsx +1 -1
- package/src/components/Feedback/ReportDialog.tsx +1 -1
- package/src/components/Link/Link.tsx +1 -1
- package/src/components/Menu/MenuMobile.tsx +1 -1
- package/src/components/Navbar/NavbarItem.tsx +1 -1
- package/src/components/Search/SearchDialog.tsx +6 -15
- package/src/components/Search/should-show-load-more.ts +30 -0
- package/src/core/constants/search.ts +4 -0
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +1 -1
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +1 -1
- package/src/core/hooks/menu/use-mobile-menu-items.ts +1 -1
- package/src/core/hooks/menu/use-mobile-menu-levels.ts +1 -1
- package/src/core/hooks/menu/use-nested-menu.ts +1 -1
- package/src/core/hooks/search/use-search-dialog.ts +1 -1
- package/src/core/hooks/use-active-heading.ts +1 -1
- package/src/core/hooks/use-active-section-id.ts +1 -1
- package/src/core/hooks/use-language-picker.ts +1 -1
- package/src/core/hooks/use-mobile-menu.ts +1 -1
- package/src/core/hooks/use-navbar-height.ts +1 -1
- package/src/core/hooks/use-product-picker.ts +1 -1
- package/src/core/hooks/use-tabs.ts +1 -1
- package/src/core/templates/Markdown.tsx +1 -1
- package/src/core/types/hooks.ts +2 -1
- package/src/core/types/link.ts +1 -1
- package/src/core/types/search.ts +2 -0
- package/src/core/utils/load-and-navigate.ts +1 -1
- package/src/core/utils/menu.ts +1 -1
- package/src/layouts/OIDCForbidden.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +1 -1
- package/src/markdoc/components/Heading/Heading.tsx +1 -1
- package/src/markdoc/components/Tabs/Tabs.tsx +1 -1
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CatalogEntity = CatalogEntity;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
-
const
|
|
9
|
+
const react_router_1 = require("react-router");
|
|
10
10
|
const utils_1 = require("../../../core/utils");
|
|
11
11
|
const CatalogPageDescription_1 = require("../../../components/Catalog/CatalogPageDescription");
|
|
12
12
|
const CatalogEntityProperties_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties");
|
|
@@ -38,7 +38,7 @@ function CatalogEntity({ RedocSchema, StoreProvider, GraphqlTypeRenderer, }) {
|
|
|
38
38
|
const { useTranslate, useCatalog, usePageProps } = (0, hooks_1.useThemeHooks)();
|
|
39
39
|
const { translate } = useTranslate();
|
|
40
40
|
const { entity, relations, catalogConfig, entitiesCatalogConfig, relatedEntity } = usePageProps();
|
|
41
|
-
const [searchParams] = (0,
|
|
41
|
+
const [searchParams] = (0, react_router_1.useSearchParams)();
|
|
42
42
|
const revision = searchParams.get('revision') || undefined;
|
|
43
43
|
const version = searchParams.get('version') || undefined;
|
|
44
44
|
const linkToMainCatalog = `catalogs/${catalogConfig.slug}`;
|
|
@@ -52,9 +52,9 @@ function CatalogEntity({ RedocSchema, StoreProvider, GraphqlTypeRenderer, }) {
|
|
|
52
52
|
{ label: entity.title },
|
|
53
53
|
] }),
|
|
54
54
|
react_1.default.createElement(CatalogEntityPageWrapper, null,
|
|
55
|
-
react_1.default.createElement(
|
|
56
|
-
react_1.default.createElement(
|
|
57
|
-
react_1.default.createElement(
|
|
55
|
+
react_1.default.createElement(react_router_1.Routes, null,
|
|
56
|
+
react_1.default.createElement(react_router_1.Route, { path: `${catalogConfig.slug}/entities/${entity.key}` },
|
|
57
|
+
react_1.default.createElement(react_router_1.Route, { index: true, element: react_1.default.createElement(react_1.default.Fragment, null,
|
|
58
58
|
react_1.default.createElement(CatalogPageDescription_1.CatalogPageDescription, { title: entity.title, description: (_a = entity.summary) !== null && _a !== void 0 ? _a : '', tag: entity.key }),
|
|
59
59
|
react_1.default.createElement(CatalogEntityProperties_1.CatalogEntityProperties, { entity: entity }),
|
|
60
60
|
renderDataSchemaSection({
|
|
@@ -69,7 +69,7 @@ function CatalogEntity({ RedocSchema, StoreProvider, GraphqlTypeRenderer, }) {
|
|
|
69
69
|
renderFirstColumnEntitySection(entity),
|
|
70
70
|
react_1.default.createElement(CatalogEntityLinks_1.CatalogEntityLinks, { entity: entity })),
|
|
71
71
|
react_1.default.createElement(CatalogEntityRelations_1.CatalogEntityRelations, { entity: entity, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, initialRelations: relations, searchQuery: searchQuery, setSearchQuery: setSearchQuery })) }),
|
|
72
|
-
react_1.default.createElement(
|
|
72
|
+
react_1.default.createElement(react_router_1.Route, { path: "relations-graph", element: react_1.default.createElement(CatalogEntityRelationsGraph_lazy_1.CatalogEntityRelationsGraph, { entity: entity }) })))))));
|
|
73
73
|
}
|
|
74
74
|
const CatalogPageWrapper = styled_components_1.default.div `
|
|
75
75
|
max-width: var(--catalog-entity-max-width);
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js
CHANGED
|
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.CatalogEntityHistorySidebar = CatalogEntityHistorySidebar;
|
|
40
40
|
const react_1 = __importStar(require("react"));
|
|
41
41
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
42
|
-
const
|
|
42
|
+
const react_router_1 = require("react-router");
|
|
43
43
|
const CloseIcon_1 = require("../../../../icons/CloseIcon/CloseIcon");
|
|
44
44
|
const hooks_1 = require("../../../../core/hooks");
|
|
45
45
|
const MenuContainer_1 = require("../../../../components/Menu/MenuContainer");
|
|
@@ -49,7 +49,7 @@ const CatalogEntityVersionItem_1 = require("../../../../components/Catalog/Catal
|
|
|
49
49
|
const RecentlyViewedIcon_1 = require("../../../../icons/RecentlyViewedIcon/RecentlyViewedIcon");
|
|
50
50
|
function CatalogEntityHistorySidebar({ entityKey, revision, version, className, }) {
|
|
51
51
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
52
|
-
const location = (0,
|
|
52
|
+
const location = (0, react_router_1.useLocation)();
|
|
53
53
|
const basePath = location.pathname;
|
|
54
54
|
const { useTranslate, useFetchCatalogEntityRevisions, useL10nConfig } = (0, hooks_1.useThemeHooks)();
|
|
55
55
|
const { translate } = useTranslate();
|
|
@@ -40,7 +40,7 @@ exports.CatalogSelect = exports.CatalogSelectWrapper = void 0;
|
|
|
40
40
|
exports.CatalogSelector = CatalogSelector;
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
42
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
43
|
-
const
|
|
43
|
+
const react_router_1 = require("react-router");
|
|
44
44
|
const Accordion_1 = require("../../components/Accordion/Accordion");
|
|
45
45
|
const Select_1 = require("../../components/Select/Select");
|
|
46
46
|
const utils_1 = require("../../core/utils");
|
|
@@ -50,7 +50,7 @@ function CatalogSelector({ catalogSwitcherItems, onChange, }) {
|
|
|
50
50
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
51
51
|
const { translate } = useTranslate();
|
|
52
52
|
const [isExpanded, setIsExpanded] = (0, react_1.useState)(true);
|
|
53
|
-
const navigate = (0,
|
|
53
|
+
const navigate = (0, react_router_1.useNavigate)();
|
|
54
54
|
const pathPrefix = (0, utils_1.getPathPrefix)();
|
|
55
55
|
const options = catalogSwitcherItems.map((item) => ({
|
|
56
56
|
value: item.slug,
|
|
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.ReportDialog = ReportDialog;
|
|
16
16
|
const react_1 = __importDefault(require("react"));
|
|
17
17
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
18
|
-
const
|
|
18
|
+
const react_router_1 = require("react-router");
|
|
19
19
|
const hooks_1 = require("../../core/hooks");
|
|
20
20
|
const Comment_1 = require("../../components/Feedback/Comment");
|
|
21
21
|
const Portal_1 = require("../../components/Portal/Portal");
|
|
@@ -23,7 +23,7 @@ const utils_1 = require("../../core/utils");
|
|
|
23
23
|
function ReportDialog({ location, settings, onSubmit, onCancel, submitFeedback, lang, }) {
|
|
24
24
|
const { label } = settings;
|
|
25
25
|
const { useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
26
|
-
const { pathname } = (0,
|
|
26
|
+
const { pathname } = (0, react_router_1.useLocation)();
|
|
27
27
|
const telemetry = useTelemetry();
|
|
28
28
|
return (react_1.default.createElement(Portal_1.Portal, null,
|
|
29
29
|
react_1.default.createElement(ReportDialogWrapper, { className: "scroll-lock", "data-component-name": "Feedback/ReportDialog" },
|
|
@@ -47,7 +47,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
47
47
|
exports.Link = Link;
|
|
48
48
|
const React = __importStar(require("react"));
|
|
49
49
|
const react_1 = require("react");
|
|
50
|
-
const
|
|
50
|
+
const react_router_1 = require("react-router");
|
|
51
51
|
const ThemeDataContext_1 = require("../../core/contexts/ThemeDataContext");
|
|
52
52
|
function Link(props) {
|
|
53
53
|
const context = (0, react_1.useContext)(ThemeDataContext_1.ThemeDataContext);
|
|
@@ -56,6 +56,6 @@ function Link(props) {
|
|
|
56
56
|
return React.createElement(LinkComponent, Object.assign({}, props));
|
|
57
57
|
}
|
|
58
58
|
const { external: _1, languageInsensitive: _2, innerRef } = props, filteredProps = __rest(props, ["external", "languageInsensitive", "innerRef"]);
|
|
59
|
-
return React.createElement(
|
|
59
|
+
return React.createElement(react_router_1.Link, Object.assign({ ref: innerRef }, filteredProps));
|
|
60
60
|
}
|
|
61
61
|
//# sourceMappingURL=Link.js.map
|
|
@@ -38,7 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.MenuMobile = MenuMobile;
|
|
40
40
|
const react_1 = __importStar(require("react"));
|
|
41
|
-
const
|
|
41
|
+
const react_router_1 = require("react-router");
|
|
42
42
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
43
43
|
const utils_1 = require("../../core/utils");
|
|
44
44
|
const hooks_1 = require("../../core/hooks");
|
|
@@ -52,7 +52,7 @@ const UserMenuMobile_1 = require("../../components/UserMenu/UserMenuMobile");
|
|
|
52
52
|
const Product_1 = require("../../components/Product/Product");
|
|
53
53
|
function MenuMobile({ className, hideUserProfile }) {
|
|
54
54
|
var _a, _b, _c;
|
|
55
|
-
const location = (0,
|
|
55
|
+
const location = (0, react_router_1.useLocation)();
|
|
56
56
|
const { useCurrentProduct } = (0, hooks_1.useThemeHooks)();
|
|
57
57
|
const product = useCurrentProduct();
|
|
58
58
|
const menuLevels = (0, hooks_1.useMobileMenuLevels)();
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.NavbarItem = NavbarItem;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
-
const
|
|
9
|
+
const react_router_1 = require("react-router");
|
|
10
10
|
const DropdownMenu_1 = require("../../components/Dropdown/DropdownMenu");
|
|
11
11
|
const DropdownMenuItem_1 = require("../../components/Dropdown/DropdownMenuItem");
|
|
12
12
|
const utils_1 = require("../../core/utils");
|
|
@@ -16,7 +16,7 @@ const Link_1 = require("../../components/Link/Link");
|
|
|
16
16
|
const Dropdown_1 = require("../../components/Dropdown/Dropdown");
|
|
17
17
|
const GenericIcon_1 = require("../../icons/GenericIcon/GenericIcon");
|
|
18
18
|
function NavbarItem({ navItem, className }) {
|
|
19
|
-
const { pathname } = (0,
|
|
19
|
+
const { pathname } = (0, react_router_1.useLocation)();
|
|
20
20
|
const { useTranslate, useL10nConfig, useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
21
21
|
const { translate } = useTranslate();
|
|
22
22
|
const { defaultLocale, currentLocale, locales } = useL10nConfig();
|
|
@@ -41,6 +41,7 @@ const react_1 = __importStar(require("react"));
|
|
|
41
41
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
42
42
|
const SearchInput_1 = require("../../components/Search/SearchInput");
|
|
43
43
|
const SearchShortcut_1 = require("../../components/Search/SearchShortcut");
|
|
44
|
+
const should_show_load_more_1 = require("../../components/Search/should-show-load-more");
|
|
44
45
|
const Button_1 = require("../../components/Button/Button");
|
|
45
46
|
const utils_1 = require("../../core/utils");
|
|
46
47
|
const Portal_1 = require("../../components/Portal/Portal");
|
|
@@ -73,7 +74,7 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
|
|
|
73
74
|
const [product, setProduct] = (0, react_1.useState)(currentProduct);
|
|
74
75
|
const [mode, setMode] = (0, react_1.useState)(initialMode);
|
|
75
76
|
const autoSearchDisabled = mode !== 'search';
|
|
76
|
-
const { query, setQuery, filter, setFilter, items, isSearchLoading, facets, setLoadMore, advancedSearch, askAi, groupField, searchError, retrySearch, } = useSearch(product === null || product === void 0 ? void 0 : product.name, autoSearchDisabled);
|
|
77
|
+
const { query, setQuery, filter, setFilter, items, isSearchLoading, facets, groupCounts, setLoadMore, advancedSearch, askAi, groupField, searchError, retrySearch, } = useSearch(product === null || product === void 0 ? void 0 : product.name, autoSearchDisabled);
|
|
77
78
|
const { isFilterOpen, onFilterToggle, onFilterChange, onFilterReset, onFacetReset, onQuickFilterReset, } = (0, hooks_1.useSearchFilter)(filter, setFilter);
|
|
78
79
|
const { addSearchHistoryItem } = (0, hooks_1.useRecentSearches)();
|
|
79
80
|
const aiSearch = useAiSearch({ filter: filter, product: product === null || product === void 0 ? void 0 : product.name });
|
|
@@ -146,21 +147,7 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
|
|
|
146
147
|
onClose();
|
|
147
148
|
} }));
|
|
148
149
|
}, [onClose, product, products, addSearchHistoryItem, query, telemetry, mode, searchSessionId]);
|
|
149
|
-
const showLoadMore = (0, react_1.useCallback)((groupKey, currentCount = 0) => {
|
|
150
|
-
const groupFacet = facets.find((facet) => facet.field === groupField);
|
|
151
|
-
let needLoadMore = false;
|
|
152
|
-
if (groupFacet) {
|
|
153
|
-
const groupValue = groupFacet.values.find((value) => {
|
|
154
|
-
if (typeof value === 'object') {
|
|
155
|
-
return value.value === groupKey;
|
|
156
|
-
}
|
|
157
|
-
else
|
|
158
|
-
return false;
|
|
159
|
-
});
|
|
160
|
-
needLoadMore = groupValue ? groupValue.count > currentCount : false;
|
|
161
|
-
}
|
|
162
|
-
return needLoadMore;
|
|
163
|
-
}, [facets, groupField]);
|
|
150
|
+
const showLoadMore = (0, react_1.useCallback)((groupKey, currentCount = 0) => (0, should_show_load_more_1.shouldShowLoadMore)({ groupKey, currentCount, groupCounts, facets, groupField }), [groupCounts, facets, groupField]);
|
|
164
151
|
const showResults = !!((filter && filter.length) || query);
|
|
165
152
|
const showSearchFilterButton = advancedSearch && mode === 'search';
|
|
166
153
|
const showAiSearchButton = askAi && mode === 'search';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SearchFacet } from '../../core/types';
|
|
2
|
+
export type ShouldShowLoadMoreParams = {
|
|
3
|
+
groupKey: string;
|
|
4
|
+
currentCount: number;
|
|
5
|
+
groupCounts?: Record<string, number>;
|
|
6
|
+
facets: SearchFacet[];
|
|
7
|
+
groupField: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function shouldShowLoadMore({ groupKey, currentCount, groupCounts, facets, groupField, }: ShouldShowLoadMoreParams): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldShowLoadMore = shouldShowLoadMore;
|
|
4
|
+
function shouldShowLoadMore({ groupKey, currentCount, groupCounts, facets, groupField, }) {
|
|
5
|
+
if (groupCounts && groupKey in groupCounts) {
|
|
6
|
+
return groupCounts[groupKey] > currentCount;
|
|
7
|
+
}
|
|
8
|
+
const groupFacet = facets.find((facet) => facet.field === groupField);
|
|
9
|
+
if (!groupFacet) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const groupValue = groupFacet.values.find((value) => typeof value === 'object' && value.value === groupKey);
|
|
13
|
+
return groupValue ? groupValue.count > currentCount : false;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=should-show-load-more.js.map
|
|
@@ -69,5 +69,9 @@ exports.TOOL_CALL_DISPLAY_TEXT = {
|
|
|
69
69
|
inProgressText: 'Discovering available tools...',
|
|
70
70
|
completedText: 'Discovered available tools',
|
|
71
71
|
},
|
|
72
|
+
[search_1.ToolCallName.ContactSupport]: {
|
|
73
|
+
inProgressText: 'Opening the contact support option...',
|
|
74
|
+
completedText: 'Offered to contact support',
|
|
75
|
+
},
|
|
72
76
|
};
|
|
73
77
|
//# sourceMappingURL=search.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useCodeWalkthroughControls = useCodeWalkthroughControls;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const react_router_1 = require("react-router");
|
|
6
6
|
const download_code_walkthrough_1 = require("../../utils/download-code-walkthrough");
|
|
7
7
|
const match_code_walkthrough_conditions_1 = require("../../utils/match-code-walkthrough-conditions");
|
|
8
8
|
const get_code_walkthrough_file_text_1 = require("../../utils/get-code-walkthrough-file-text");
|
|
@@ -13,8 +13,8 @@ const defaultControlsValues = {
|
|
|
13
13
|
filter: '',
|
|
14
14
|
};
|
|
15
15
|
function useCodeWalkthroughControls(filters, inputs, toggles, enableDeepLink) {
|
|
16
|
-
const location = (0,
|
|
17
|
-
const navigate = (0,
|
|
16
|
+
const location = (0, react_router_1.useLocation)();
|
|
17
|
+
const navigate = (0, react_router_1.useNavigate)();
|
|
18
18
|
const searchParams = (0, react_1.useMemo)(() => new URLSearchParams(location.search), [location.search]);
|
|
19
19
|
const filtersRef = (0, react_1.useRef)(filters);
|
|
20
20
|
const inputsRef = (0, react_1.useRef)(inputs);
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useCodeWalkthroughSteps = useCodeWalkthroughSteps;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const react_router_1 = require("react-router");
|
|
6
6
|
const js_utils_1 = require("../../utils/js-utils");
|
|
7
7
|
const code_walkthrough_1 = require("../../constants/code-walkthrough");
|
|
8
8
|
function useCodeWalkthroughSteps({ steps, enableDeepLink, root, }) {
|
|
9
|
-
const location = (0,
|
|
10
|
-
const navigate = (0,
|
|
9
|
+
const location = (0, react_router_1.useLocation)();
|
|
10
|
+
const navigate = (0, react_router_1.useNavigate)();
|
|
11
11
|
const searchParams = (0, react_1.useMemo)(() => new URLSearchParams(location.search), [location.search]);
|
|
12
12
|
const observerRef = (0, react_1.useRef)(null);
|
|
13
13
|
const filtersElementRef = (0, react_1.useRef)(null);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMobileMenuItems = void 0;
|
|
4
|
-
const
|
|
4
|
+
const react_router_1 = require("react-router");
|
|
5
5
|
const use_theme_hooks_1 = require("../use-theme-hooks");
|
|
6
6
|
const use_theme_config_1 = require("../use-theme-config");
|
|
7
7
|
const common_1 = require("../../constants/common");
|
|
@@ -18,7 +18,7 @@ const useMobileMenuItems = (menuType) => {
|
|
|
18
18
|
const { translate } = useTranslate();
|
|
19
19
|
const activeVersion = versions.find((version) => version.active);
|
|
20
20
|
const { currentItems: sidebarItems, pushDrilldownState, popDrilldownState, backLink, } = useSidebarItems(activeVersion);
|
|
21
|
-
const location = (0,
|
|
21
|
+
const location = (0, react_router_1.useLocation)();
|
|
22
22
|
const currentProduct = useCurrentProduct();
|
|
23
23
|
const hasProductNavbarOverride = (_a = currentProduct === null || currentProduct === void 0 ? void 0 : currentProduct.configOverride) === null || _a === void 0 ? void 0 : _a.navbar;
|
|
24
24
|
const productThemeConfig = (0, use_theme_config_1.useThemeConfig)();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMobileMenuLevels = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const react_router_1 = require("react-router");
|
|
6
6
|
const use_theme_hooks_1 = require("../use-theme-hooks");
|
|
7
7
|
const use_theme_config_1 = require("../use-theme-config");
|
|
8
8
|
const common_1 = require("../../constants/common");
|
|
@@ -15,7 +15,7 @@ const useMobileMenuLevels = () => {
|
|
|
15
15
|
const { translate } = useTranslate();
|
|
16
16
|
const currentProduct = useCurrentProduct();
|
|
17
17
|
const productThemeConfig = (0, use_theme_config_1.useThemeConfig)();
|
|
18
|
-
const location = (0,
|
|
18
|
+
const location = (0, react_router_1.useLocation)();
|
|
19
19
|
const hasProductNavbarOverride = (_a = currentProduct === null || currentProduct === void 0 ? void 0 : currentProduct.configOverride) === null || _a === void 0 ? void 0 : _a.navbar;
|
|
20
20
|
const productNavItems = (hasProductNavbarOverride ? ((_b = productThemeConfig.navbar) === null || _b === void 0 ? void 0 : _b.items) || [] : []);
|
|
21
21
|
const menuLevels = (0, react_1.useMemo)(() => {
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.useNestedMenu = useNestedMenu;
|
|
13
|
-
const
|
|
13
|
+
const react_router_1 = require("react-router");
|
|
14
14
|
const react_1 = require("react");
|
|
15
15
|
const use_menu_item_expanded_1 = require("./use-menu-item-expanded");
|
|
16
16
|
const use_collapse_1 = require("./use-collapse");
|
|
@@ -20,8 +20,8 @@ function useNestedMenu({ item, labelRef, nestedMenuRef }) {
|
|
|
20
20
|
const [isExpanded, setIsExpanded] = (0, use_menu_item_expanded_1.useMenuItemExpanded)(item);
|
|
21
21
|
// we need to know when the item is collapsed after transition to remove children from DOM
|
|
22
22
|
const [canUnmount, setCanUnmount] = (0, react_1.useState)(!isExpanded);
|
|
23
|
-
const navigate = (0,
|
|
24
|
-
const location = (0,
|
|
23
|
+
const navigate = (0, react_router_1.useNavigate)();
|
|
24
|
+
const location = (0, react_router_1.useLocation)();
|
|
25
25
|
const { style } = (0, use_collapse_1.useCollapse)({
|
|
26
26
|
isExpanded,
|
|
27
27
|
collapseElRef: nestedMenuRef || { current: null },
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useSearchDialog = useSearchDialog;
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
-
const
|
|
8
|
+
const react_router_1 = require("react-router");
|
|
9
9
|
const hotkeys_js_1 = __importDefault(require("hotkeys-js"));
|
|
10
10
|
const use_theme_hooks_1 = require("../use-theme-hooks");
|
|
11
11
|
const use_theme_config_1 = require("../use-theme-config");
|
|
@@ -17,7 +17,7 @@ function useSearchDialog() {
|
|
|
17
17
|
var _b;
|
|
18
18
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
19
19
|
const themeSettings = (0, use_theme_config_1.useThemeConfig)();
|
|
20
|
-
const location = (0,
|
|
20
|
+
const location = (0, react_router_1.useLocation)();
|
|
21
21
|
const { useTelemetry } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
22
22
|
const telemetry = useTelemetry();
|
|
23
23
|
const { refreshSearchSessionId } = (0, contexts_1.useSearchSession)();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useActiveHeading = useActiveHeading;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const react_router_1 = require("react-router");
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
const constants_1 = require("../constants");
|
|
8
8
|
function useActiveHeading(contentElement, displayedHeadings) {
|
|
@@ -11,7 +11,7 @@ function useActiveHeading(contentElement, displayedHeadings) {
|
|
|
11
11
|
const headingElementsRef = (0, react_1.useRef)({});
|
|
12
12
|
const displayedHeadingsRef = (0, react_1.useRef)(displayedHeadings);
|
|
13
13
|
const lockObserver = (0, react_1.useRef)(false);
|
|
14
|
-
const location = (0,
|
|
14
|
+
const location = (0, react_router_1.useLocation)();
|
|
15
15
|
(0, react_1.useEffect)(() => {
|
|
16
16
|
setHeading(undefined);
|
|
17
17
|
headingElementsRef.current = {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Location } from 'react-router
|
|
1
|
+
import type { Location } from 'react-router';
|
|
2
2
|
export type UseActiveSectionIdReturnType = string;
|
|
3
3
|
/** Px below the top where the active section is read (accounts for next-section visibility). */
|
|
4
4
|
export declare const SECTION_READING_LINE_OFFSET = 150;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useLanguagePicker = useLanguagePicker;
|
|
4
|
-
const
|
|
4
|
+
const react_router_1 = require("react-router");
|
|
5
5
|
const use_theme_hooks_1 = require("./use-theme-hooks");
|
|
6
6
|
const urls_1 = require("../utils/urls");
|
|
7
7
|
function useLanguagePicker() {
|
|
8
8
|
const { useL10nConfig, useLoadAndNavigate } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
9
|
-
const navigate = (0,
|
|
9
|
+
const navigate = (0, react_router_1.useNavigate)();
|
|
10
10
|
const loadAndNavigate = useLoadAndNavigate();
|
|
11
11
|
const { currentLocale, locales, defaultLocale } = useL10nConfig();
|
|
12
|
-
const location = (0,
|
|
12
|
+
const location = (0, react_router_1.useLocation)();
|
|
13
13
|
const locale = locales.find((l) => l.code === currentLocale);
|
|
14
14
|
function getLocaleUrl(value) {
|
|
15
15
|
let newLangPathname = (0, urls_1.getPathnameForLocale)((0, urls_1.withoutPathPrefix)(location.pathname), defaultLocale, value, locales);
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMobileMenu = useMobileMenu;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const react_router_1 = require("react-router");
|
|
6
6
|
const use_modal_scroll_lock_1 = require("./use-modal-scroll-lock");
|
|
7
7
|
function useMobileMenu(initialState = false) {
|
|
8
|
-
const location = (0,
|
|
8
|
+
const location = (0, react_router_1.useLocation)();
|
|
9
9
|
const [isOpen, setIsOpen] = (0, react_1.useState)(initialState);
|
|
10
10
|
(0, react_1.useEffect)(() => setIsOpen(false), [location.pathname, location.hash]);
|
|
11
11
|
(0, use_modal_scroll_lock_1.useModalScrollLock)(isOpen);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useProductPicker = useProductPicker;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const react_router_1 = require("react-router");
|
|
6
6
|
const utils_1 = require("../../components/Product/utils");
|
|
7
7
|
const use_theme_hooks_1 = require("./use-theme-hooks");
|
|
8
8
|
const utils_2 = require("../utils");
|
|
@@ -11,7 +11,7 @@ function useProductPicker() {
|
|
|
11
11
|
const currentProduct = useCurrentProduct();
|
|
12
12
|
const products = useProducts();
|
|
13
13
|
const telemetry = useTelemetry();
|
|
14
|
-
const navigate = (0,
|
|
14
|
+
const navigate = (0, react_router_1.useNavigate)();
|
|
15
15
|
const loadAndNavigate = useLoadAndNavigate();
|
|
16
16
|
// An open dropdown can fire a menu item's onAction from an earlier render, so `product.link`
|
|
17
17
|
// may be stale (e.g. after a locale switch); resolve the live product via a ref.
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useActiveTab = void 0;
|
|
4
4
|
exports.useTabs = useTabs;
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const react_router_1 = require("react-router");
|
|
7
7
|
const MORE_BUTTON_WIDTH = 80;
|
|
8
8
|
const TABS_GAP = 8;
|
|
9
9
|
function useTabs({ activeTab, onTabChange, totalTabs, containerRef, }) {
|
|
@@ -215,8 +215,8 @@ function useTabs({ activeTab, onTabChange, totalTabs, containerRef, }) {
|
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
217
|
const useActiveTab = ({ initialTab, tabsId }) => {
|
|
218
|
-
const location = (0,
|
|
219
|
-
const navigate = (0,
|
|
218
|
+
const location = (0, react_router_1.useLocation)();
|
|
219
|
+
const navigate = (0, react_router_1.useNavigate)();
|
|
220
220
|
const [activeTab, setActiveTab] = (0, react_1.useState)(undefined);
|
|
221
221
|
const resolvedActiveTab = activeTab !== null && activeTab !== void 0 ? activeTab : initialTab;
|
|
222
222
|
const prevActiveTabRef = (0, react_1.useRef)(resolvedActiveTab);
|
|
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.default = default_1;
|
|
37
37
|
const React = __importStar(require("react"));
|
|
38
|
-
const
|
|
38
|
+
const react_router_1 = require("react-router");
|
|
39
39
|
const DocumentationLayout_1 = require("../../layouts/DocumentationLayout");
|
|
40
40
|
const Markdown_1 = require("../../components/Markdown/Markdown");
|
|
41
41
|
const TableOfContent_1 = require("../../components/TableOfContent/TableOfContent");
|
|
@@ -50,7 +50,7 @@ function default_1({ pageProps, children }) {
|
|
|
50
50
|
const { useSidebarSiblingsData } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
51
51
|
const { markdown } = (0, use_theme_config_1.useThemeConfig)();
|
|
52
52
|
const { nextPage, prevPage } = useSidebarSiblingsData() || {};
|
|
53
|
-
const { pathname } = (0,
|
|
53
|
+
const { pathname } = (0, react_router_1.useLocation)();
|
|
54
54
|
const wrapperRefCb = React.useCallback((node) => {
|
|
55
55
|
if (!node) {
|
|
56
56
|
return;
|
|
@@ -3,7 +3,7 @@ import type { AsyncApiRealmUI } from '@redocly/realm-asyncapi-sdk';
|
|
|
3
3
|
import type { PageData, PageProps, ResolvedNavItemWithLink, Version } from '@redocly/config';
|
|
4
4
|
import type { ShikiTransformer } from '@shikijs/types';
|
|
5
5
|
import type { Callback, TFunction as TFunc } from 'i18next';
|
|
6
|
-
import type { To, Location, NavigateFunction } from 'react-router
|
|
6
|
+
import type { To, Location, NavigateFunction } from 'react-router';
|
|
7
7
|
import type { UseQueryResult } from '@tanstack/react-query';
|
|
8
8
|
import type { CatalogConfig, ProductUiConfig } from '../../config';
|
|
9
9
|
import type { UseCatalogResponse, FilteredCatalog, UseCatalogSortResponse, UseCatalogSearchResponse, UseCatalogProps, CatalogApiParams, CatalogApiResults } from './catalog';
|
|
@@ -79,6 +79,7 @@ export type ThemeHooks = {
|
|
|
79
79
|
isSearchLoading: boolean;
|
|
80
80
|
searchError: string | null;
|
|
81
81
|
facets: SearchFacet[];
|
|
82
|
+
groupCounts?: Record<string, number>;
|
|
82
83
|
groupField: string;
|
|
83
84
|
setLoadMore: React.Dispatch<React.SetStateAction<{
|
|
84
85
|
groupKey: string;
|
package/lib/core/types/link.d.ts
CHANGED
|
@@ -112,6 +112,7 @@ export type ContentSegment = {
|
|
|
112
112
|
export type AiSearchConversationItem = {
|
|
113
113
|
role: AiSearchConversationRole;
|
|
114
114
|
content: string;
|
|
115
|
+
sentAt?: string;
|
|
115
116
|
resources?: SearchAiMessageResource[];
|
|
116
117
|
messageId?: string;
|
|
117
118
|
feedback?: FeedbackType;
|
|
@@ -126,5 +127,6 @@ export declare enum ToolCallName {
|
|
|
126
127
|
GetSecuritySchemes = "get-security-schemes",
|
|
127
128
|
GetFullApiDescription = "get-full-api-description",
|
|
128
129
|
Execute = "execute",
|
|
129
|
-
DescribeTools = "describe-tools"
|
|
130
|
+
DescribeTools = "describe-tools",
|
|
131
|
+
ContactSupport = "contact-support"
|
|
130
132
|
}
|
package/lib/core/types/search.js
CHANGED
|
@@ -16,5 +16,6 @@ var ToolCallName;
|
|
|
16
16
|
ToolCallName["GetFullApiDescription"] = "get-full-api-description";
|
|
17
17
|
ToolCallName["Execute"] = "execute";
|
|
18
18
|
ToolCallName["DescribeTools"] = "describe-tools";
|
|
19
|
+
ToolCallName["ContactSupport"] = "contact-support";
|
|
19
20
|
})(ToolCallName || (exports.ToolCallName = ToolCallName = {}));
|
|
20
21
|
//# sourceMappingURL=search.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NavigateFunction, NavigateOptions } from 'react-router
|
|
1
|
+
import type { NavigateFunction, NavigateOptions } from 'react-router';
|
|
2
2
|
export type HistoryOrigin = 'pm' | 'browser';
|
|
3
3
|
export declare function loadAndNavigate({ navigate, to, origin, options, }: {
|
|
4
4
|
navigate: NavigateFunction;
|
package/lib/core/utils/menu.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResolvedNavItem, Version } from '@redocly/config';
|
|
2
|
-
import type { Location } from 'react-router
|
|
2
|
+
import type { Location } from 'react-router';
|
|
3
3
|
import { type Locale, type TFunction } from '../types/l10n';
|
|
4
4
|
import { type ItemState } from '../types/sidebar';
|
|
5
5
|
import { MenuItemType } from '../constants/common';
|
|
@@ -39,12 +39,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.OIDCForbidden = OIDCForbidden;
|
|
40
40
|
const react_1 = __importStar(require("react"));
|
|
41
41
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
42
|
-
const
|
|
42
|
+
const react_router_1 = require("react-router");
|
|
43
43
|
const hooks_1 = require("../core/hooks");
|
|
44
44
|
function OIDCForbidden() {
|
|
45
45
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
46
46
|
const { translate } = useTranslate();
|
|
47
|
-
const [searchParams, setSearchParams] = (0,
|
|
47
|
+
const [searchParams, setSearchParams] = (0, react_router_1.useSearchParams)();
|
|
48
48
|
const [errorDescription, setErrorDescription] = (0, react_1.useState)('');
|
|
49
49
|
// use whatever you want here
|
|
50
50
|
const URL_REGEX = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/;
|
|
@@ -40,11 +40,11 @@ exports.StepWrapper = void 0;
|
|
|
40
40
|
exports.CodeStep = CodeStep;
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
42
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
43
|
-
const
|
|
43
|
+
const react_router_1 = require("react-router");
|
|
44
44
|
const Marker_1 = require("../../../components/Marker/Marker");
|
|
45
45
|
const contexts_1 = require("../../../core/contexts");
|
|
46
46
|
function CodeStep({ id, heading, when, unless, children, }) {
|
|
47
|
-
const location = (0,
|
|
47
|
+
const location = (0, react_router_1.useLocation)();
|
|
48
48
|
const compRef = (0, react_1.useRef)(null);
|
|
49
49
|
const markerRef = (0, react_1.useRef)(null);
|
|
50
50
|
const { areConditionsMet } = (0, react_1.useContext)(contexts_1.CodeWalkthroughControlsStateContext);
|
|
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.Heading = Heading;
|
|
40
40
|
const react_1 = __importStar(require("react"));
|
|
41
41
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
42
|
-
const
|
|
42
|
+
const react_router_1 = require("react-router");
|
|
43
43
|
const Image_1 = require("../../../markdoc/components/Image/Image");
|
|
44
44
|
const utils_1 = require("../../../core/utils");
|
|
45
45
|
const LinkIcon_1 = require("../../../icons/LinkIcon/LinkIcon");
|
|
@@ -68,7 +68,7 @@ function renderWithSpanWrapper(children) {
|
|
|
68
68
|
}
|
|
69
69
|
function Heading({ level, id, children, 'data-source': dataSource, 'data-hash': dataHash, className, __idx, }) {
|
|
70
70
|
var _a, _b;
|
|
71
|
-
const { pathname } = (0,
|
|
71
|
+
const { pathname } = (0, react_router_1.useLocation)();
|
|
72
72
|
const { usePageProps } = (0, hooks_1.useThemeHooks)();
|
|
73
73
|
const pageProps = usePageProps();
|
|
74
74
|
const isMarkdownPage = ((_a = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _a === void 0 ? void 0 : _a.type) === 'markdown' || ((_b = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _b === void 0 ? void 0 : _b.type) === 'asciidoc';
|
|
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.TabContent = exports.TabsSize = void 0;
|
|
40
40
|
exports.Tabs = Tabs;
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
|
-
const
|
|
42
|
+
const react_router_1 = require("react-router");
|
|
43
43
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
44
44
|
const hooks_1 = require("../../../core/hooks");
|
|
45
45
|
const TabItemFragment_1 = require("../../../markdoc/components/Tabs/TabItemFragment");
|
|
@@ -51,7 +51,7 @@ var TabsSize;
|
|
|
51
51
|
TabsSize["MEDIUM"] = "medium";
|
|
52
52
|
})(TabsSize || (exports.TabsSize = TabsSize = {}));
|
|
53
53
|
function Tabs({ id, children, className, size, initialTab: propInitialTab, activeTab: controlledActiveTab, }) {
|
|
54
|
-
const inRouter = (0,
|
|
54
|
+
const inRouter = (0, react_router_1.useInRouterContext)();
|
|
55
55
|
const childrenArray = react_1.default.Children.toArray(children).filter(isTabItemFragment);
|
|
56
56
|
const containerRef = (0, react_1.useRef)(null);
|
|
57
57
|
if (childrenArray.length === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.68.0-next.
|
|
3
|
+
"version": "0.68.0-next.8",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -17,8 +17,13 @@
|
|
|
17
17
|
"./config": "./lib/config.js",
|
|
18
18
|
".": "./lib/index.js",
|
|
19
19
|
"./src/": "./src/",
|
|
20
|
+
"./core": "./lib/core/index.js",
|
|
20
21
|
"./core/*": "./lib/core/*/index.js",
|
|
21
22
|
"./core/templates/*": "./lib/core/templates/*.js",
|
|
23
|
+
"./core/contexts/*": "./lib/core/contexts/*.js",
|
|
24
|
+
"./core/hooks/*": "./lib/core/hooks/*.js",
|
|
25
|
+
"./core/hoc/*": "./lib/core/hoc/*.js",
|
|
26
|
+
"./core/constants/*": "./lib/core/constants/*.js",
|
|
22
27
|
"./ext/*": "./lib/ext/*.js",
|
|
23
28
|
"./components/*": "./lib/components/*.js",
|
|
24
29
|
"./layouts/*": "./lib/layouts/*.js",
|
|
@@ -29,9 +34,9 @@
|
|
|
29
34
|
"@markdoc/markdoc": "0.5.2",
|
|
30
35
|
"lodash.debounce": "^4.0.8",
|
|
31
36
|
"lodash.throttle": "^4.1.1",
|
|
32
|
-
"react": "^19.2.
|
|
33
|
-
"react-dom": "^19.2.
|
|
34
|
-
"react-router
|
|
37
|
+
"react": "^19.2.7",
|
|
38
|
+
"react-dom": "^19.2.7",
|
|
39
|
+
"react-router": "^8.3.0",
|
|
35
40
|
"styled-components": "^4.1.1 || ^5.3.11 || ^6.0.0"
|
|
36
41
|
},
|
|
37
42
|
"devDependencies": {
|
|
@@ -51,7 +56,7 @@
|
|
|
51
56
|
"@vitest/coverage-v8": "4.1.10",
|
|
52
57
|
"@vitest/ui": "4.1.10",
|
|
53
58
|
"concurrently": "7.6.0",
|
|
54
|
-
"react-router
|
|
59
|
+
"react-router": "^8.3.0",
|
|
55
60
|
"resize-observer-polyfill": "1.5.1",
|
|
56
61
|
"rimraf": "5.0.7",
|
|
57
62
|
"styled-components": "^6.4.2",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { Route, Routes, useSearchParams } from 'react-router
|
|
3
|
+
import { Route, Routes, useSearchParams } from 'react-router';
|
|
4
4
|
|
|
5
5
|
import type { CatalogEntityConfig } from '@redocly/config';
|
|
6
6
|
import type { BffCatalogEntity, BffCatalogRelatedEntity } from '@redocly/theme/core/types';
|
package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { useLocation } from 'react-router
|
|
3
|
+
import { useLocation } from 'react-router';
|
|
4
4
|
|
|
5
5
|
import { CloseIcon } from '@redocly/theme/icons/CloseIcon/CloseIcon';
|
|
6
6
|
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, JSX } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { useNavigate } from 'react-router
|
|
3
|
+
import { useNavigate } from 'react-router';
|
|
4
4
|
|
|
5
5
|
import { Accordion } from '@redocly/theme/components/Accordion/Accordion';
|
|
6
6
|
import { Select } from '@redocly/theme/components/Select/Select';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { useLocation } from 'react-router
|
|
3
|
+
import { useLocation } from 'react-router';
|
|
4
4
|
|
|
5
5
|
import type { JSX } from 'react';
|
|
6
6
|
import type { SubmitFeedbackParams } from '@redocly/theme/core/types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useContext } from 'react';
|
|
3
|
-
import { Link as ReactLink } from 'react-router
|
|
3
|
+
import { Link as ReactLink } from 'react-router';
|
|
4
4
|
|
|
5
5
|
import type { JSX } from 'react';
|
|
6
6
|
import type { LinkProps } from '@redocly/theme/core/types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { useLocation } from 'react-router
|
|
3
|
+
import { useLocation } from 'react-router';
|
|
4
4
|
|
|
5
5
|
import type { JSX } from 'react';
|
|
6
6
|
import type { ResolvedNavItem, ResolvedNavLinkItem, ResolvedNavGroupItem } from '@redocly/config';
|
|
@@ -2,10 +2,11 @@ import React, { Fragment, useRef, useState, useEffect, useCallback } from 'react
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { JSX, PointerEvent } from 'react';
|
|
5
|
-
import type {
|
|
5
|
+
import type { SearchItemData } from '@redocly/theme/core/types';
|
|
6
6
|
|
|
7
7
|
import { SearchInput } from '@redocly/theme/components/Search/SearchInput';
|
|
8
8
|
import { SearchShortcut } from '@redocly/theme/components/Search/SearchShortcut';
|
|
9
|
+
import { shouldShowLoadMore } from '@redocly/theme/components/Search/should-show-load-more';
|
|
9
10
|
import { Button } from '@redocly/theme/components/Button/Button';
|
|
10
11
|
import { breakpoints, concatClassNames, getBaseDataAttributes } from '@redocly/theme/core/utils';
|
|
11
12
|
import { Portal } from '@redocly/theme/components/Portal/Portal';
|
|
@@ -64,6 +65,7 @@ export function SearchDialog({
|
|
|
64
65
|
items,
|
|
65
66
|
isSearchLoading,
|
|
66
67
|
facets,
|
|
68
|
+
groupCounts,
|
|
67
69
|
setLoadMore,
|
|
68
70
|
advancedSearch,
|
|
69
71
|
askAi,
|
|
@@ -189,20 +191,9 @@ export function SearchDialog({
|
|
|
189
191
|
);
|
|
190
192
|
|
|
191
193
|
const showLoadMore = useCallback(
|
|
192
|
-
(groupKey: string, currentCount: number = 0) =>
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (groupFacet) {
|
|
196
|
-
const groupValue = groupFacet.values.find((value) => {
|
|
197
|
-
if (typeof value === 'object') {
|
|
198
|
-
return value.value === groupKey;
|
|
199
|
-
} else return false;
|
|
200
|
-
}) as SearchFacetCount;
|
|
201
|
-
needLoadMore = groupValue ? groupValue.count > currentCount : false;
|
|
202
|
-
}
|
|
203
|
-
return needLoadMore;
|
|
204
|
-
},
|
|
205
|
-
[facets, groupField],
|
|
194
|
+
(groupKey: string, currentCount: number = 0) =>
|
|
195
|
+
shouldShowLoadMore({ groupKey, currentCount, groupCounts, facets, groupField }),
|
|
196
|
+
[groupCounts, facets, groupField],
|
|
206
197
|
);
|
|
207
198
|
|
|
208
199
|
const showResults = !!((filter && filter.length) || query);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SearchFacet, SearchFacetCount } from '@redocly/theme/core/types';
|
|
2
|
+
|
|
3
|
+
export type ShouldShowLoadMoreParams = {
|
|
4
|
+
groupKey: string;
|
|
5
|
+
currentCount: number;
|
|
6
|
+
// Per-group result totals reported by Typesense
|
|
7
|
+
groupCounts?: Record<string, number>;
|
|
8
|
+
facets: SearchFacet[];
|
|
9
|
+
groupField: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function shouldShowLoadMore({
|
|
13
|
+
groupKey,
|
|
14
|
+
currentCount,
|
|
15
|
+
groupCounts,
|
|
16
|
+
facets,
|
|
17
|
+
groupField,
|
|
18
|
+
}: ShouldShowLoadMoreParams): boolean {
|
|
19
|
+
if (groupCounts && groupKey in groupCounts) {
|
|
20
|
+
return groupCounts[groupKey] > currentCount;
|
|
21
|
+
}
|
|
22
|
+
const groupFacet = facets.find((facet) => facet.field === groupField);
|
|
23
|
+
if (!groupFacet) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const groupValue = groupFacet.values.find(
|
|
27
|
+
(value): value is SearchFacetCount => typeof value === 'object' && value.value === groupKey,
|
|
28
|
+
);
|
|
29
|
+
return groupValue ? groupValue.count > currentCount : false;
|
|
30
|
+
}
|
|
@@ -79,4 +79,8 @@ export const TOOL_CALL_DISPLAY_TEXT: Partial<
|
|
|
79
79
|
inProgressText: 'Discovering available tools...',
|
|
80
80
|
completedText: 'Discovered available tools',
|
|
81
81
|
},
|
|
82
|
+
[ToolCallName.ContactSupport]: {
|
|
83
|
+
inProgressText: 'Opening the contact support option...',
|
|
84
|
+
completedText: 'Offered to contact support',
|
|
85
|
+
},
|
|
82
86
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState, useMemo } from 'react';
|
|
2
|
-
import { useLocation, useNavigate } from 'react-router
|
|
2
|
+
import { useLocation, useNavigate } from 'react-router';
|
|
3
3
|
|
|
4
4
|
import type { CodeWalkthroughStepAttr } from '@redocly/config';
|
|
5
5
|
import type { ActiveStep, WalkthroughStepsState } from '../../types/code-walkthrough';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState, useMemo } from 'react';
|
|
2
2
|
import throttle from 'lodash.throttle';
|
|
3
3
|
|
|
4
|
-
import type { Location } from 'react-router
|
|
4
|
+
import type { Location } from 'react-router';
|
|
5
5
|
|
|
6
6
|
import { useNavbarHeight } from './use-navbar-height';
|
|
7
7
|
import { IS_BROWSER } from '../utils/dom';
|
package/src/core/types/hooks.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { AsyncApiRealmUI } from '@redocly/realm-asyncapi-sdk';
|
|
|
3
3
|
import type { PageData, PageProps, ResolvedNavItemWithLink, Version } from '@redocly/config';
|
|
4
4
|
import type { ShikiTransformer } from '@shikijs/types';
|
|
5
5
|
import type { Callback, TFunction as TFunc } from 'i18next';
|
|
6
|
-
import type { To, Location, NavigateFunction } from 'react-router
|
|
6
|
+
import type { To, Location, NavigateFunction } from 'react-router';
|
|
7
7
|
import type { UseQueryResult } from '@tanstack/react-query';
|
|
8
8
|
import type { CatalogConfig, ProductUiConfig } from '@redocly/theme/config';
|
|
9
9
|
import type {
|
|
@@ -101,6 +101,7 @@ export type ThemeHooks = {
|
|
|
101
101
|
isSearchLoading: boolean;
|
|
102
102
|
searchError: string | null;
|
|
103
103
|
facets: SearchFacet[];
|
|
104
|
+
groupCounts?: Record<string, number>;
|
|
104
105
|
groupField: string;
|
|
105
106
|
setLoadMore: React.Dispatch<
|
|
106
107
|
React.SetStateAction<
|
package/src/core/types/link.ts
CHANGED
package/src/core/types/search.ts
CHANGED
|
@@ -118,6 +118,7 @@ export type ContentSegment = { type: 'text'; text: string } | { type: 'tool'; to
|
|
|
118
118
|
export type AiSearchConversationItem = {
|
|
119
119
|
role: AiSearchConversationRole;
|
|
120
120
|
content: string;
|
|
121
|
+
sentAt?: string;
|
|
121
122
|
resources?: SearchAiMessageResource[];
|
|
122
123
|
messageId?: string;
|
|
123
124
|
feedback?: FeedbackType;
|
|
@@ -134,4 +135,5 @@ export enum ToolCallName {
|
|
|
134
135
|
GetFullApiDescription = 'get-full-api-description',
|
|
135
136
|
Execute = 'execute',
|
|
136
137
|
DescribeTools = 'describe-tools',
|
|
138
|
+
ContactSupport = 'contact-support',
|
|
137
139
|
}
|
package/src/core/utils/menu.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResolvedNavItem, Version } from '@redocly/config';
|
|
2
|
-
import type { Location } from 'react-router
|
|
2
|
+
import type { Location } from 'react-router';
|
|
3
3
|
|
|
4
4
|
import { type Locale, type TFunction } from '../types/l10n';
|
|
5
5
|
import { type ItemState } from '../types/sidebar';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { createElement, isValidElement } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { useLocation } from 'react-router
|
|
3
|
+
import { useLocation } from 'react-router';
|
|
4
4
|
|
|
5
5
|
import type { JSX, PropsWithChildren, ReactElement, ReactNode } from 'react';
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { isValidElement, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { useInRouterContext } from 'react-router
|
|
2
|
+
import { useInRouterContext } from 'react-router';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
|
|
5
5
|
import type { JSX, ReactElement, ReactNode } from 'react';
|