@redocly/theme 0.81.2-rc.1 → 0.81.2-rc.2
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/Breadcrumbs/Breadcrumb.d.ts +1 -0
- package/lib/components/Buttons/EditPageButton.d.ts +1 -0
- package/lib/components/Catalog/Catalog.d.ts +1 -0
- package/lib/components/Catalog/CatalogActions.d.ts +1 -0
- package/lib/components/Catalog/CatalogCard.d.ts +1 -0
- package/lib/components/Catalog/CatalogInfoBlock.d.ts +1 -0
- package/lib/components/CodeBlock/CodeBlockTabs.d.ts +1 -0
- package/lib/components/ColorModeSwitcher/ColorModeSwitcher.d.ts +1 -0
- package/lib/components/Feedback/Comment.d.ts +1 -0
- package/lib/components/Feedback/Mood.d.ts +1 -0
- package/lib/components/Feedback/Rating.d.ts +1 -0
- package/lib/components/Feedback/Reasons.d.ts +1 -0
- package/lib/components/Feedback/ReportDialog.d.ts +1 -0
- package/lib/components/Feedback/Scale.d.ts +1 -0
- package/lib/components/Feedback/Sentiment.d.ts +1 -0
- package/lib/components/Feedback/Stars.d.ts +1 -0
- package/lib/components/Filter/Filter.d.ts +1 -0
- package/lib/components/Filter/FilterCheckboxes.d.ts +1 -0
- package/lib/components/Filter/FilterContent.d.ts +1 -0
- package/lib/components/Filter/FilterDateRange.d.ts +1 -0
- package/lib/components/Filter/FilterInput.d.ts +1 -0
- package/lib/components/Filter/FilterPopover.d.ts +1 -0
- package/lib/components/Filter/FilterSelect.d.ts +1 -0
- package/lib/components/Footer/Footer.d.ts +1 -0
- package/lib/components/Footer/FooterColumn.d.ts +1 -0
- package/lib/components/Footer/FooterCopyright.d.ts +1 -0
- package/lib/components/Footer/FooterItem.d.ts +1 -0
- package/lib/components/LanguagePicker/LanguagePicker.d.ts +1 -0
- package/lib/components/LastUpdated/LastUpdated.d.ts +1 -0
- package/lib/components/Loading/Loading.d.ts +1 -0
- package/lib/components/Logo/Logo.d.ts +1 -0
- package/lib/components/Menu/Menu.d.ts +1 -0
- package/lib/components/Menu/MenuMobile.d.ts +1 -0
- package/lib/components/Navbar/Navbar.d.ts +1 -0
- package/lib/components/Navbar/NavbarItem.d.ts +1 -0
- package/lib/components/Navbar/NavbarMenu.d.ts +1 -0
- package/lib/components/PageNavigation/NextButton.d.ts +1 -0
- package/lib/components/PageNavigation/PageNavigation.d.ts +1 -0
- package/lib/components/PageNavigation/PreviousButton.d.ts +1 -0
- package/lib/components/Product/Product.d.ts +1 -0
- package/lib/components/Product/ProductPicker.d.ts +1 -0
- package/lib/components/Search/Search.d.ts +1 -0
- package/lib/components/Search/SearchDialog.d.ts +1 -0
- package/lib/components/Search/SearchHighlight.d.ts +1 -0
- package/lib/components/Search/SearchItem.d.ts +1 -0
- package/lib/components/Search/SearchRecent.d.ts +1 -0
- package/lib/components/Search/SearchShortcut.d.ts +1 -0
- package/lib/components/Search/SearchSuggestedPages.d.ts +1 -0
- package/lib/components/Search/SearchTrigger.d.ts +1 -0
- package/lib/components/SidebarActions/ChangeViewButton.d.ts +1 -0
- package/lib/components/SidebarLogo/SidebarLogo.d.ts +1 -0
- package/lib/components/TableOfContent/TableOfContent.d.ts +1 -0
- package/lib/components/UserMenu/LoginButton.d.ts +1 -0
- package/lib/components/UserMenu/LogoutMenuItem.d.ts +1 -0
- package/lib/components/UserMenu/UserAvatar.d.ts +1 -0
- package/lib/components/UserMenu/UserInfoMenuItem.d.ts +1 -0
- package/lib/components/UserMenu/UserMenuMobile.d.ts +1 -0
- package/lib/core/hooks/__mocks__/index.d.ts +1 -0
- package/lib/core/hooks/__mocks__/index.js +1 -0
- package/lib/core/hooks/__mocks__/use-controlled-state.d.ts +2 -0
- package/lib/core/hooks/__mocks__/use-controlled-state.js +6 -0
- package/lib/core/hooks/menu/use-menu-item-expanded.js +1 -0
- package/lib/core/hooks/use-codeblock-tabs-controls.js +10 -3
- package/lib/core/hooks/use-search.js +1 -0
- package/lib/layouts/Forbidden.d.ts +1 -0
- package/lib/layouts/NotFound.d.ts +1 -0
- package/lib/layouts/OIDCForbidden.d.ts +1 -0
- package/lib/markdoc/components/Mermaid/Mermaid.d.ts +1 -0
- package/package.json +3 -3
- package/src/core/hooks/__mocks__/index.ts +1 -0
- package/src/core/hooks/__mocks__/use-controlled-state.ts +1 -0
- package/src/core/hooks/menu/use-menu-item-expanded.ts +1 -0
- package/src/core/hooks/use-codeblock-tabs-controls.ts +8 -2
- package/src/core/hooks/use-search.ts +1 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from '../../../core/hooks/__mocks__/use-theme-config';
|
|
2
2
|
export * from '../../../core/hooks/__mocks__/use-theme-hooks';
|
|
3
3
|
export * from '../../../core/hooks/__mocks__/use-mobile-menu';
|
|
4
|
+
export * from '../../../core/hooks/__mocks__/use-controlled-state';
|
|
4
5
|
export * from '../../../core/hooks/__mocks__/search/use-recent-searches';
|
|
5
6
|
export * from '../../../core/hooks/__mocks__/search/use-suggested-pages';
|
|
6
7
|
export * from '../../../core/hooks/menu/__mocks__/use-mobile-menu-items';
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("../../../core/hooks/__mocks__/use-theme-config"), exports);
|
|
18
18
|
__exportStar(require("../../../core/hooks/__mocks__/use-theme-hooks"), exports);
|
|
19
19
|
__exportStar(require("../../../core/hooks/__mocks__/use-mobile-menu"), exports);
|
|
20
|
+
__exportStar(require("../../../core/hooks/__mocks__/use-controlled-state"), exports);
|
|
20
21
|
__exportStar(require("../../../core/hooks/__mocks__/search/use-recent-searches"), exports);
|
|
21
22
|
__exportStar(require("../../../core/hooks/__mocks__/search/use-suggested-pages"), exports);
|
|
22
23
|
__exportStar(require("../../../core/hooks/menu/__mocks__/use-mobile-menu-items"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useControlledState = void 0;
|
|
4
|
+
const useControlledState = () => [false, jest.fn()];
|
|
5
|
+
exports.useControlledState = useControlledState;
|
|
6
|
+
//# sourceMappingURL=use-controlled-state.js.map
|
|
@@ -18,6 +18,7 @@ function useMenuItemExpanded(item) {
|
|
|
18
18
|
setIsExpanded(newValue);
|
|
19
19
|
setControlledValue(newValue);
|
|
20
20
|
// we have different sensitivity to changes for items from openapi-docs sidebar and for items from portal sidebar
|
|
21
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
22
|
}, [!item.modified ? item : item.active, item.hasActiveSubItem, item.expanded]);
|
|
22
23
|
return [isExpanded, setControlledValue];
|
|
23
24
|
}
|
|
@@ -10,7 +10,9 @@ function useCodeBlockTabsControls({ tabs, containerRef, tabRefs }) {
|
|
|
10
10
|
return ((_a = tabRefs === null || tabRefs === void 0 ? void 0 : tabRefs.current) === null || _a === void 0 ? void 0 : _a.reduce((acc, tabRef) => {
|
|
11
11
|
return tabRef ? acc + tabRef.offsetWidth : acc;
|
|
12
12
|
}, 0)) || 0;
|
|
13
|
-
},
|
|
13
|
+
},
|
|
14
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15
|
+
[(_a = tabRefs === null || tabRefs === void 0 ? void 0 : tabRefs.current) === null || _a === void 0 ? void 0 : _a.length]);
|
|
14
16
|
const { currentIndex, isFirstTab, isLastTab } = (0, react_1.useMemo)(() => {
|
|
15
17
|
const currentIndex = tabs.files.findIndex((file) => file.name === tabs.activeTabName);
|
|
16
18
|
return {
|
|
@@ -18,30 +20,35 @@ function useCodeBlockTabsControls({ tabs, containerRef, tabRefs }) {
|
|
|
18
20
|
isFirstTab: currentIndex === 0,
|
|
19
21
|
isLastTab: currentIndex === tabs.files.length - 1,
|
|
20
22
|
};
|
|
23
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
24
|
}, [tabs]);
|
|
22
25
|
(0, react_1.useEffect)(() => {
|
|
23
26
|
if (containerRef.current) {
|
|
27
|
+
const container = containerRef.current;
|
|
24
28
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
25
29
|
const containerWidth = entries[0].contentRect.width;
|
|
26
30
|
setShowControls(tabsWidth > containerWidth);
|
|
27
31
|
});
|
|
28
|
-
resizeObserver.observe(
|
|
32
|
+
resizeObserver.observe(container);
|
|
29
33
|
return () => {
|
|
30
|
-
resizeObserver.unobserve(
|
|
34
|
+
resizeObserver.unobserve(container);
|
|
31
35
|
};
|
|
32
36
|
}
|
|
37
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
38
|
}, [containerRef.current]);
|
|
34
39
|
const handlePrevTab = (0, react_1.useCallback)(() => {
|
|
35
40
|
if (!isFirstTab) {
|
|
36
41
|
const prevTab = tabs.files[currentIndex - 1].name;
|
|
37
42
|
tabs.handleTabSwitch(prevTab);
|
|
38
43
|
}
|
|
44
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
45
|
}, [currentIndex]);
|
|
40
46
|
const handleNextTab = (0, react_1.useCallback)(() => {
|
|
41
47
|
if (!isLastTab) {
|
|
42
48
|
const nextTab = tabs.files[currentIndex + 1].name;
|
|
43
49
|
tabs.handleTabSwitch(nextTab);
|
|
44
50
|
}
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
52
|
}, [currentIndex]);
|
|
46
53
|
return { showControls, handlePrevTab, handleNextTab };
|
|
47
54
|
}
|
|
@@ -31,6 +31,7 @@ function useSearch() {
|
|
|
31
31
|
const onOpen = (0, react_1.useCallback)(function () {
|
|
32
32
|
telemetry.send('search_opened', { method: 'click' });
|
|
33
33
|
setIsOpen(true);
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
35
|
}, []);
|
|
35
36
|
const onClose = (0, react_1.useCallback)(() => {
|
|
36
37
|
setIsOpen(false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.81.2-rc.
|
|
3
|
+
"version": "0.81.2-rc.2",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"@types/lodash.throttle": "4.1.9",
|
|
57
57
|
"@types/node": "18.19.3",
|
|
58
58
|
"@types/prismjs": "1.26.3",
|
|
59
|
-
"@types/react": "18.2.
|
|
60
|
-
"@types/react-dom": "18.2.
|
|
59
|
+
"@types/react": "18.2.79",
|
|
60
|
+
"@types/react-dom": "18.2.25",
|
|
61
61
|
"@types/styled-components": "5.1.34",
|
|
62
62
|
"@types/styled-system": "5.1.22",
|
|
63
63
|
"@types/nprogress": "^0.2.0",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from '@redocly/theme/core/hooks/__mocks__/use-theme-config';
|
|
2
2
|
export * from '@redocly/theme/core/hooks/__mocks__/use-theme-hooks';
|
|
3
3
|
export * from '@redocly/theme/core/hooks/__mocks__/use-mobile-menu';
|
|
4
|
+
export * from '@redocly/theme/core/hooks/__mocks__/use-controlled-state';
|
|
4
5
|
export * from '@redocly/theme/core/hooks/__mocks__/search/use-recent-searches';
|
|
5
6
|
export * from '@redocly/theme/core/hooks/__mocks__/search/use-suggested-pages';
|
|
6
7
|
export * from '@redocly/theme/core/hooks/menu/__mocks__/use-mobile-menu-items';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const useControlledState = () => [false, jest.fn()];
|
|
@@ -24,6 +24,7 @@ export function useMenuItemExpanded(item: ItemState): [boolean, Dispatch<SetStat
|
|
|
24
24
|
setIsExpanded(newValue);
|
|
25
25
|
setControlledValue(newValue);
|
|
26
26
|
// we have different sensitivity to changes for items from openapi-docs sidebar and for items from portal sidebar
|
|
27
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
28
|
}, [!item.modified ? item : item.active, item.hasActiveSubItem, item.expanded]);
|
|
28
29
|
|
|
29
30
|
return [isExpanded, setControlledValue];
|
|
@@ -16,6 +16,7 @@ export function useCodeBlockTabsControls({ tabs, containerRef, tabRefs }: CodeBl
|
|
|
16
16
|
tabRefs?.current?.reduce((acc, tabRef) => {
|
|
17
17
|
return tabRef ? acc + tabRef.offsetWidth : acc;
|
|
18
18
|
}, 0) || 0,
|
|
19
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
20
|
[tabRefs?.current?.length],
|
|
20
21
|
);
|
|
21
22
|
|
|
@@ -26,22 +27,25 @@ export function useCodeBlockTabsControls({ tabs, containerRef, tabRefs }: CodeBl
|
|
|
26
27
|
isFirstTab: currentIndex === 0,
|
|
27
28
|
isLastTab: currentIndex === tabs.files.length - 1,
|
|
28
29
|
};
|
|
30
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
31
|
}, [tabs]);
|
|
30
32
|
|
|
31
33
|
useEffect(() => {
|
|
32
34
|
if (containerRef.current) {
|
|
35
|
+
const container = containerRef.current;
|
|
33
36
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
34
37
|
const containerWidth = entries[0].contentRect.width;
|
|
35
38
|
|
|
36
39
|
setShowControls(tabsWidth > containerWidth);
|
|
37
40
|
});
|
|
38
41
|
|
|
39
|
-
resizeObserver.observe(
|
|
42
|
+
resizeObserver.observe(container);
|
|
40
43
|
|
|
41
44
|
return () => {
|
|
42
|
-
resizeObserver.unobserve(
|
|
45
|
+
resizeObserver.unobserve(container as HTMLDivElement);
|
|
43
46
|
};
|
|
44
47
|
}
|
|
48
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
49
|
}, [containerRef.current]);
|
|
46
50
|
|
|
47
51
|
const handlePrevTab = useCallback(() => {
|
|
@@ -49,6 +53,7 @@ export function useCodeBlockTabsControls({ tabs, containerRef, tabRefs }: CodeBl
|
|
|
49
53
|
const prevTab = tabs.files[currentIndex - 1].name;
|
|
50
54
|
tabs.handleTabSwitch(prevTab);
|
|
51
55
|
}
|
|
56
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
57
|
}, [currentIndex]);
|
|
53
58
|
|
|
54
59
|
const handleNextTab = useCallback(() => {
|
|
@@ -56,6 +61,7 @@ export function useCodeBlockTabsControls({ tabs, containerRef, tabRefs }: CodeBl
|
|
|
56
61
|
const nextTab = tabs.files[currentIndex + 1].name;
|
|
57
62
|
tabs.handleTabSwitch(nextTab);
|
|
58
63
|
}
|
|
64
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
65
|
}, [currentIndex]);
|
|
60
66
|
|
|
61
67
|
return { showControls, handlePrevTab, handleNextTab };
|
|
@@ -29,6 +29,7 @@ export function useSearch() {
|
|
|
29
29
|
const onOpen = useCallback(function () {
|
|
30
30
|
telemetry.send('search_opened', { method: 'click' });
|
|
31
31
|
setIsOpen(true);
|
|
32
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
33
|
}, []);
|
|
33
34
|
|
|
34
35
|
const onClose = useCallback(() => {
|