@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.
Files changed (74) hide show
  1. package/lib/components/Breadcrumbs/Breadcrumb.d.ts +1 -0
  2. package/lib/components/Buttons/EditPageButton.d.ts +1 -0
  3. package/lib/components/Catalog/Catalog.d.ts +1 -0
  4. package/lib/components/Catalog/CatalogActions.d.ts +1 -0
  5. package/lib/components/Catalog/CatalogCard.d.ts +1 -0
  6. package/lib/components/Catalog/CatalogInfoBlock.d.ts +1 -0
  7. package/lib/components/CodeBlock/CodeBlockTabs.d.ts +1 -0
  8. package/lib/components/ColorModeSwitcher/ColorModeSwitcher.d.ts +1 -0
  9. package/lib/components/Feedback/Comment.d.ts +1 -0
  10. package/lib/components/Feedback/Mood.d.ts +1 -0
  11. package/lib/components/Feedback/Rating.d.ts +1 -0
  12. package/lib/components/Feedback/Reasons.d.ts +1 -0
  13. package/lib/components/Feedback/ReportDialog.d.ts +1 -0
  14. package/lib/components/Feedback/Scale.d.ts +1 -0
  15. package/lib/components/Feedback/Sentiment.d.ts +1 -0
  16. package/lib/components/Feedback/Stars.d.ts +1 -0
  17. package/lib/components/Filter/Filter.d.ts +1 -0
  18. package/lib/components/Filter/FilterCheckboxes.d.ts +1 -0
  19. package/lib/components/Filter/FilterContent.d.ts +1 -0
  20. package/lib/components/Filter/FilterDateRange.d.ts +1 -0
  21. package/lib/components/Filter/FilterInput.d.ts +1 -0
  22. package/lib/components/Filter/FilterPopover.d.ts +1 -0
  23. package/lib/components/Filter/FilterSelect.d.ts +1 -0
  24. package/lib/components/Footer/Footer.d.ts +1 -0
  25. package/lib/components/Footer/FooterColumn.d.ts +1 -0
  26. package/lib/components/Footer/FooterCopyright.d.ts +1 -0
  27. package/lib/components/Footer/FooterItem.d.ts +1 -0
  28. package/lib/components/LanguagePicker/LanguagePicker.d.ts +1 -0
  29. package/lib/components/LastUpdated/LastUpdated.d.ts +1 -0
  30. package/lib/components/Loading/Loading.d.ts +1 -0
  31. package/lib/components/Logo/Logo.d.ts +1 -0
  32. package/lib/components/Menu/Menu.d.ts +1 -0
  33. package/lib/components/Menu/MenuMobile.d.ts +1 -0
  34. package/lib/components/Navbar/Navbar.d.ts +1 -0
  35. package/lib/components/Navbar/NavbarItem.d.ts +1 -0
  36. package/lib/components/Navbar/NavbarMenu.d.ts +1 -0
  37. package/lib/components/PageNavigation/NextButton.d.ts +1 -0
  38. package/lib/components/PageNavigation/PageNavigation.d.ts +1 -0
  39. package/lib/components/PageNavigation/PreviousButton.d.ts +1 -0
  40. package/lib/components/Product/Product.d.ts +1 -0
  41. package/lib/components/Product/ProductPicker.d.ts +1 -0
  42. package/lib/components/Search/Search.d.ts +1 -0
  43. package/lib/components/Search/SearchDialog.d.ts +1 -0
  44. package/lib/components/Search/SearchHighlight.d.ts +1 -0
  45. package/lib/components/Search/SearchItem.d.ts +1 -0
  46. package/lib/components/Search/SearchRecent.d.ts +1 -0
  47. package/lib/components/Search/SearchShortcut.d.ts +1 -0
  48. package/lib/components/Search/SearchSuggestedPages.d.ts +1 -0
  49. package/lib/components/Search/SearchTrigger.d.ts +1 -0
  50. package/lib/components/SidebarActions/ChangeViewButton.d.ts +1 -0
  51. package/lib/components/SidebarLogo/SidebarLogo.d.ts +1 -0
  52. package/lib/components/TableOfContent/TableOfContent.d.ts +1 -0
  53. package/lib/components/UserMenu/LoginButton.d.ts +1 -0
  54. package/lib/components/UserMenu/LogoutMenuItem.d.ts +1 -0
  55. package/lib/components/UserMenu/UserAvatar.d.ts +1 -0
  56. package/lib/components/UserMenu/UserInfoMenuItem.d.ts +1 -0
  57. package/lib/components/UserMenu/UserMenuMobile.d.ts +1 -0
  58. package/lib/core/hooks/__mocks__/index.d.ts +1 -0
  59. package/lib/core/hooks/__mocks__/index.js +1 -0
  60. package/lib/core/hooks/__mocks__/use-controlled-state.d.ts +2 -0
  61. package/lib/core/hooks/__mocks__/use-controlled-state.js +6 -0
  62. package/lib/core/hooks/menu/use-menu-item-expanded.js +1 -0
  63. package/lib/core/hooks/use-codeblock-tabs-controls.js +10 -3
  64. package/lib/core/hooks/use-search.js +1 -0
  65. package/lib/layouts/Forbidden.d.ts +1 -0
  66. package/lib/layouts/NotFound.d.ts +1 -0
  67. package/lib/layouts/OIDCForbidden.d.ts +1 -0
  68. package/lib/markdoc/components/Mermaid/Mermaid.d.ts +1 -0
  69. package/package.json +3 -3
  70. package/src/core/hooks/__mocks__/index.ts +1 -0
  71. package/src/core/hooks/__mocks__/use-controlled-state.ts +1 -0
  72. package/src/core/hooks/menu/use-menu-item-expanded.ts +1 -0
  73. package/src/core/hooks/use-codeblock-tabs-controls.ts +8 -2
  74. package/src/core/hooks/use-search.ts +1 -0
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type BreadcrumbProps = {
2
3
  label: string;
3
4
  link?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type EditPageButtonProps = {
2
3
  to: string;
3
4
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { CatalogConfig } from '../../config';
2
3
  export default function Catalog(props: {
3
4
  pageProps: {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedFilter } from '../../core/types';
2
3
  type CatalogActionsProps = {
3
4
  onOpenFilter: () => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { CatalogItem } from '../../core/types';
2
3
  type CatalogCardProps = {
3
4
  item: CatalogItem;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type CatalogInfoBlockProps = {
2
3
  metadata?: {
3
4
  scorecardLevel?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { FileTabs } from '../../components/CodeBlock/CodeBlock';
2
3
  type CodeBlockTabsProps = {
3
4
  tabs: FileTabs;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type ColorModeSwitcherProps = {
2
3
  className?: string;
3
4
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type CommentProps = {
2
3
  onSubmit: (value: {
3
4
  comment: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare enum MOOD_STATES {
2
3
  SATISFIED = "satisfied",
3
4
  NEUTRAL = "neutral",
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const FEEDBACK_MAX_RATING = 5;
2
3
  export type RatingProps = {
3
4
  onSubmit: (value: {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type ReasonsProps = {
2
3
  onChange: (value: string[]) => void;
3
4
  settings: {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { SubmitFeedbackParams } from '../../core/types';
2
3
  export type ReportDialogProps = {
3
4
  location: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const MAX_SCALE = 10;
2
3
  export type ScaleProps = {
3
4
  onSubmit: (value: {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type SentimentProps = {
2
3
  onSubmit: (value: {
3
4
  score: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type StarsProps = {
2
3
  max?: number;
3
4
  name?: string;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import type { FilterProps } from '../../core/types';
2
3
  export declare function Filter({ filter, filterValuesCasing }: FilterProps): JSX.Element | null;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import type { FilterProps } from '../../core/types';
2
3
  export declare function FilterCheckboxes({ filter, filterValuesCasing }: FilterProps): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedFilter } from '../../core/types';
2
3
  import type { ThemeConfig } from '../../config';
3
4
  type FilterContentProps = {
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import type { FilterProps } from '../../core/types';
2
3
  export declare function FilterDateRange({ filter }: FilterProps): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type FilterInputProps = {
2
3
  value: string;
3
4
  onChange: (newValue: string) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedFilter } from '../../core/types';
2
3
  import type { ThemeConfig } from '../../config';
3
4
  type FilterPopoverProps = {
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import type { FilterProps } from '../../core/types';
2
3
  export declare function FilterSelect({ filter, filterValuesCasing }: FilterProps): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type FooterProps = {
2
3
  className?: string;
3
4
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedNavItem } from '@redocly/config';
2
3
  type FooterColumnProps = {
3
4
  column: ResolvedNavItem;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type FooterCopyrightProps = {
2
3
  copyrightText: string;
3
4
  className?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedNavItem } from '@redocly/config';
2
3
  type FooterItemProps = {
3
4
  item: ResolvedNavItem;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type LanguagePickerProps = {
2
3
  onChangeLanguage: (newLang: string) => void;
3
4
  onlyIcon?: boolean;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const FORMATS: {
2
3
  timeago: (date: Date, locale: string) => string;
3
4
  iso: (date: Date) => string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface LoadingProps {
2
3
  color: string;
3
4
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { LogoConfig } from '../../core/types';
2
3
  type LogoProps = {
3
4
  config: LogoConfig;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { DrilldownMenuItemDetails, ItemState } from '../../core/types';
2
3
  type MenuListProps = {
3
4
  items: ItemState[];
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type MobileMenuProps = {
2
3
  className?: string;
3
4
  hideUserProfile?: boolean;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type NavbarProps = {
2
3
  className?: string;
3
4
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedNavItem } from '@redocly/config';
2
3
  type NavbarItemProps = {
3
4
  navItem: ResolvedNavItem;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedConfigLinks } from '@redocly/config';
2
3
  type NavbarMenuProps = {
3
4
  menuItems: ResolvedConfigLinks;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedNavItemWithLink } from '@redocly/config';
2
3
  type NextPageType = {
3
4
  nextPage?: ResolvedNavItemWithLink | null;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedNavItemWithLink } from '@redocly/config';
2
3
  type PageNavigationType = {
3
4
  nextPage?: ResolvedNavItemWithLink | null;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedNavItemWithLink } from '@redocly/config';
2
3
  type PreviousPageType = {
3
4
  prevPage?: ResolvedNavItemWithLink | null;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ProductConfig } from '../../config';
2
3
  type ProductProps = {
3
4
  product: ProductConfig;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare function ProductPicker(): JSX.Element | null;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type SearchProps = {
2
3
  className?: string;
3
4
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type SearchDialogProps = {
2
3
  onClose: () => void;
3
4
  className?: string;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare function highlight(text: string | string[]): JSX.Element | string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { SearchDocument } from '../../core/types';
2
3
  type ActiveItem<T> = T & {
3
4
  active?: boolean;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type SearchRecentProps = {
2
3
  onSelect: (value: string) => void;
3
4
  className?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type SearchShortcutProps = {
2
3
  combination: string;
3
4
  text: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type SearchSuggestedPagesProps = {
2
3
  className?: string;
3
4
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type SearchTriggerProps = {
2
3
  onClick: () => void;
3
4
  className?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { LayoutVariant } from '../../components/SidebarActions/SidebarActions';
2
3
  interface ChangeViewButtonProps {
3
4
  layout: LayoutVariant;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface LogoProps {
2
3
  imageUrl?: string;
3
4
  href?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { MdHeading } from '../../core/types';
2
3
  type TableOfContentProps = {
3
4
  headings?: Array<MdHeading | null> | null | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type LoginButtonProps = {
2
3
  href: string;
3
4
  className?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type LogoutMenuItemProps = {
2
3
  iconOnly?: boolean;
3
4
  className?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type UserAvatarProps = {
2
3
  picture?: string;
3
4
  className?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type UserInfoMenuItemProps = {
2
3
  name: string;
3
4
  email?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type UserMenuMobileProps = {
2
3
  className?: string;
3
4
  };
@@ -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,2 @@
1
+ /// <reference types="jest" />
2
+ export declare const useControlledState: () => (boolean | jest.Mock<any, any, any>)[];
@@ -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
- }, [(_a = tabRefs === null || tabRefs === void 0 ? void 0 : tabRefs.current) === null || _a === void 0 ? void 0 : _a.length]);
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(containerRef.current);
32
+ resizeObserver.observe(container);
29
33
  return () => {
30
- resizeObserver.unobserve(containerRef.current);
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);
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare function Forbidden(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare function NotFound(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare function OIDCForbidden(): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type MermaidProps = {
2
3
  diagramHtml: string;
3
4
  'data-source'?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.81.2-rc.1",
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.45",
60
- "@types/react-dom": "18.2.17",
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(containerRef.current);
42
+ resizeObserver.observe(container);
40
43
 
41
44
  return () => {
42
- resizeObserver.unobserve(containerRef.current as HTMLDivElement);
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(() => {