@redocly/theme 0.82.2-rc.2 → 0.82.4-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/lib/components/Badge/Badge.d.ts +8 -5
  2. package/lib/components/Badge/Badge.js +9 -3
  3. package/lib/components/Breadcrumbs/Breadcrumb.d.ts +1 -1
  4. package/lib/components/Breadcrumbs/Breadcrumb.js +2 -2
  5. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +3 -3
  6. package/lib/components/Breadcrumbs/Breadcrumbs.js +2 -2
  7. package/lib/components/Button/Button.js +1 -1
  8. package/lib/components/Buttons/CopyButton.d.ts +2 -2
  9. package/lib/components/Buttons/CopyButton.js +3 -3
  10. package/lib/components/Buttons/EditPageButton.d.ts +2 -3
  11. package/lib/components/Buttons/EditPageButton.js +2 -2
  12. package/lib/components/Buttons/EmailButton.d.ts +4 -5
  13. package/lib/components/Buttons/EmailButton.js +2 -2
  14. package/lib/components/Buttons/NewTabButton.d.ts +4 -5
  15. package/lib/components/Buttons/NewTabButton.js +2 -2
  16. package/lib/components/Catalog/Catalog.d.ts +3 -2
  17. package/lib/components/Catalog/Catalog.js +1 -5
  18. package/lib/components/Catalog/CatalogActions.d.ts +1 -2
  19. package/lib/components/Catalog/CatalogCard.d.ts +1 -2
  20. package/lib/components/Catalog/CatalogCard.js +4 -5
  21. package/lib/components/Catalog/CatalogHighlight.d.ts +1 -2
  22. package/lib/components/Catalog/CatalogInfoBlock.d.ts +1 -2
  23. package/lib/components/CodeBlock/CodeBlock.js +1 -1
  24. package/lib/components/CodeBlock/CodeBlockContainer.d.ts +14 -5
  25. package/lib/components/CodeBlock/CodeBlockContainer.js +9 -4
  26. package/lib/components/CodeBlock/CodeBlockControls.js +2 -0
  27. package/lib/components/CodeBlock/CodeBlockTabs.d.ts +1 -2
  28. package/lib/components/CodeBlock/variables.js +2 -2
  29. package/lib/components/ColorModeSwitcher/ColorModeIcon.d.ts +4 -8
  30. package/lib/components/ColorModeSwitcher/ColorModeIcon.js +5 -3
  31. package/lib/components/ColorModeSwitcher/ColorModeSwitcher.d.ts +1 -2
  32. package/lib/components/DatePicker/DatePicker.d.ts +2 -3
  33. package/lib/components/Dropdown/Dropdown.d.ts +2 -3
  34. package/lib/components/Dropdown/Dropdown.js +10 -5
  35. package/lib/components/Dropdown/DropdownMenu.d.ts +1 -2
  36. package/lib/components/Dropdown/DropdownMenuItem.d.ts +1 -2
  37. package/lib/components/Dropdown/DropdownMenuItem.js +22 -5
  38. package/lib/components/Dropdown/variables.js +5 -1
  39. package/lib/components/Feedback/Comment.d.ts +2 -1
  40. package/lib/components/Feedback/Comment.js +3 -3
  41. package/lib/components/Feedback/Mood.js +4 -4
  42. package/lib/components/Feedback/Rating.js +1 -1
  43. package/lib/components/Feedback/ReportDialog.js +1 -1
  44. package/lib/components/Feedback/Scale.js +1 -1
  45. package/lib/components/Feedback/Sentiment.js +3 -3
  46. package/lib/components/Filter/FilterContent.d.ts +1 -3
  47. package/lib/components/Filter/FilterContent.js +4 -4
  48. package/lib/components/Filter/FilterInput.d.ts +1 -2
  49. package/lib/components/Filter/FilterOption.d.ts +8 -4
  50. package/lib/components/Filter/FilterOption.js +7 -4
  51. package/lib/components/Filter/FilterOptionLabel.d.ts +5 -3
  52. package/lib/components/Filter/FilterOptionLabel.js +6 -3
  53. package/lib/components/Filter/FilterOptions.d.ts +5 -3
  54. package/lib/components/Filter/FilterOptions.js +6 -3
  55. package/lib/components/Filter/FilterPopover.d.ts +1 -2
  56. package/lib/components/Filter/FilterSelect.js +1 -4
  57. package/lib/components/Filter/FilterTitle.d.ts +5 -3
  58. package/lib/components/Filter/FilterTitle.js +6 -3
  59. package/lib/components/Filter/variables.js +2 -1
  60. package/lib/components/Footer/Footer.d.ts +1 -2
  61. package/lib/components/Footer/FooterColumn.d.ts +1 -2
  62. package/lib/components/Footer/FooterCopyright.d.ts +1 -2
  63. package/lib/components/Footer/FooterItem.d.ts +1 -2
  64. package/lib/components/Footer/FooterLogo.d.ts +3 -4
  65. package/lib/components/Footer/FooterLogo.js +6 -1
  66. package/lib/components/Image/Image.d.ts +2 -2
  67. package/lib/components/JsonViewer/JsonViewer.d.ts +2 -2
  68. package/lib/components/LanguagePicker/LanguagePicker.d.ts +1 -2
  69. package/lib/components/LanguagePicker/LanguagePicker.js +5 -2
  70. package/lib/components/LanguagePicker/variables.js +4 -1
  71. package/lib/components/LastUpdated/LastUpdated.d.ts +1 -1
  72. package/lib/components/Link/Link.d.ts +1 -1
  73. package/lib/components/Loading/Loading.d.ts +2 -2
  74. package/lib/components/Logo/Logo.d.ts +1 -2
  75. package/lib/components/Markdown/Markdown.d.ts +12 -0
  76. package/lib/components/Markdown/Markdown.js +12 -13
  77. package/lib/components/Markdown/variables.js +10 -5
  78. package/lib/components/Menu/Menu.d.ts +1 -2
  79. package/lib/components/Menu/MenuContainer.d.ts +4 -4
  80. package/lib/components/Menu/MenuContainer.js +10 -3
  81. package/lib/components/Menu/MenuMobile.d.ts +1 -2
  82. package/lib/components/Menu/variables.js +2 -0
  83. package/lib/components/Navbar/NavbarItem.d.ts +1 -2
  84. package/lib/components/Navbar/NavbarItem.js +1 -1
  85. package/lib/components/Navbar/NavbarLogo.d.ts +3 -4
  86. package/lib/components/Navbar/NavbarLogo.js +6 -3
  87. package/lib/components/Navbar/NavbarMenu.d.ts +1 -2
  88. package/lib/components/PageNavigation/NextButton.d.ts +1 -2
  89. package/lib/components/PageNavigation/PageNavigation.d.ts +1 -2
  90. package/lib/components/PageNavigation/PreviousButton.d.ts +1 -2
  91. package/lib/components/Panel/Panel.d.ts +1 -2
  92. package/lib/components/Panel/PanelBody.d.ts +2 -3
  93. package/lib/components/Portal/Portal.d.ts +2 -3
  94. package/lib/components/Portal/Portal.js +2 -2
  95. package/lib/components/Product/Product.d.ts +1 -2
  96. package/lib/components/Product/ProductPicker.js +4 -1
  97. package/lib/components/Product/variables.js +4 -1
  98. package/lib/components/Search/Search.d.ts +1 -2
  99. package/lib/components/Search/SearchDialog.d.ts +1 -2
  100. package/lib/components/Search/SearchInput.d.ts +1 -2
  101. package/lib/components/Search/SearchItem.d.ts +1 -1
  102. package/lib/components/Search/SearchRecent.d.ts +1 -2
  103. package/lib/components/Search/SearchShortcut.d.ts +1 -2
  104. package/lib/components/Search/SearchSuggestedPages.d.ts +1 -2
  105. package/lib/components/Search/SearchTrigger.d.ts +1 -2
  106. package/lib/components/Search/variables.js +2 -2
  107. package/lib/components/Segmented/Segmented.d.ts +1 -1
  108. package/lib/components/Select/Select.d.ts +3 -3
  109. package/lib/components/Sidebar/Sidebar.d.ts +1 -2
  110. package/lib/components/SidebarActions/ChangeViewButton.d.ts +2 -3
  111. package/lib/components/SidebarActions/SidebarActions.d.ts +2 -2
  112. package/lib/components/SidebarLogo/SidebarLogo.d.ts +3 -3
  113. package/lib/components/TableOfContent/TableOfContent.d.ts +1 -2
  114. package/lib/components/Tag/Tag.d.ts +1 -1
  115. package/lib/components/Tooltip/Tooltip.js +2 -2
  116. package/lib/components/Tooltip/variables.js +4 -0
  117. package/lib/components/Typography/H1.js +1 -1
  118. package/lib/components/Typography/H2.js +1 -1
  119. package/lib/components/Typography/H3.js +1 -1
  120. package/lib/components/Typography/H4.js +1 -1
  121. package/lib/components/UserMenu/UserAvatar.d.ts +1 -2
  122. package/lib/components/UserMenu/UserInfoMenuItem.d.ts +1 -2
  123. package/lib/components/UserMenu/UserMenu.d.ts +1 -2
  124. package/lib/components/UserMenu/UserMenu.js +4 -1
  125. package/lib/components/UserMenu/UserMenuMobile.d.ts +1 -2
  126. package/lib/components/UserMenu/variables.js +4 -1
  127. package/lib/components/VersionPicker/VersionPicker.d.ts +1 -1
  128. package/lib/core/types/catalog.d.ts +3 -0
  129. package/lib/core/types/hooks.d.ts +3 -1
  130. package/lib/layouts/DocumentationLayout.js +7 -0
  131. package/lib/layouts/NotFound.js +2 -2
  132. package/lib/layouts/RootLayout.d.ts +2 -3
  133. package/lib/markdoc/components/InlineSvg/InlineSvg.d.ts +2 -1
  134. package/lib/markdoc/components/InlineSvg/InlineSvg.js +2 -2
  135. package/lib/markdoc/components/Tabs/variables.js +5 -5
  136. package/package.json +4 -4
  137. package/src/components/Badge/Badge.tsx +13 -3
  138. package/src/components/Breadcrumbs/Breadcrumb.tsx +2 -2
  139. package/src/components/Breadcrumbs/Breadcrumbs.tsx +2 -2
  140. package/src/components/Button/Button.tsx +5 -1
  141. package/src/components/Buttons/CopyButton.tsx +7 -5
  142. package/src/components/Buttons/EditPageButton.tsx +3 -3
  143. package/src/components/Buttons/EmailButton.tsx +4 -4
  144. package/src/components/Buttons/NewTabButton.tsx +7 -4
  145. package/src/components/Catalog/Catalog.tsx +5 -7
  146. package/src/components/Catalog/CatalogActions.tsx +1 -1
  147. package/src/components/Catalog/CatalogCard.tsx +23 -24
  148. package/src/components/Catalog/CatalogHighlight.tsx +1 -1
  149. package/src/components/Catalog/CatalogInfoBlock.tsx +1 -1
  150. package/src/components/CodeBlock/CodeBlock.tsx +1 -1
  151. package/src/components/CodeBlock/CodeBlockContainer.tsx +19 -6
  152. package/src/components/CodeBlock/CodeBlockControls.tsx +2 -0
  153. package/src/components/CodeBlock/CodeBlockTabs.tsx +1 -1
  154. package/src/components/CodeBlock/variables.ts +2 -2
  155. package/src/components/ColorModeSwitcher/ColorModeIcon.tsx +8 -4
  156. package/src/components/ColorModeSwitcher/ColorModeSwitcher.tsx +1 -1
  157. package/src/components/DatePicker/DatePicker.tsx +2 -2
  158. package/src/components/Dropdown/Dropdown.tsx +14 -8
  159. package/src/components/Dropdown/DropdownMenu.tsx +1 -1
  160. package/src/components/Dropdown/DropdownMenuItem.tsx +25 -6
  161. package/src/components/Dropdown/variables.ts +5 -1
  162. package/src/components/Feedback/Comment.tsx +4 -2
  163. package/src/components/Feedback/Mood.tsx +5 -4
  164. package/src/components/Feedback/Rating.tsx +1 -1
  165. package/src/components/Feedback/ReportDialog.tsx +1 -0
  166. package/src/components/Feedback/Scale.tsx +1 -1
  167. package/src/components/Feedback/Sentiment.tsx +4 -3
  168. package/src/components/Filter/FilterContent.tsx +3 -3
  169. package/src/components/Filter/FilterInput.tsx +1 -1
  170. package/src/components/Filter/FilterOption.tsx +20 -4
  171. package/src/components/Filter/FilterOptionLabel.tsx +10 -3
  172. package/src/components/Filter/FilterOptions.tsx +10 -3
  173. package/src/components/Filter/FilterPopover.tsx +1 -1
  174. package/src/components/Filter/FilterSelect.tsx +1 -4
  175. package/src/components/Filter/FilterTitle.tsx +10 -3
  176. package/src/components/Filter/variables.ts +2 -1
  177. package/src/components/Footer/Footer.tsx +1 -1
  178. package/src/components/Footer/FooterColumn.tsx +1 -1
  179. package/src/components/Footer/FooterCopyright.tsx +1 -1
  180. package/src/components/Footer/FooterItem.tsx +1 -1
  181. package/src/components/Footer/FooterLogo.tsx +8 -1
  182. package/src/components/Image/Image.tsx +1 -1
  183. package/src/components/JsonViewer/JsonViewer.tsx +2 -2
  184. package/src/components/LanguagePicker/LanguagePicker.tsx +6 -3
  185. package/src/components/LanguagePicker/variables.ts +4 -1
  186. package/src/components/LastUpdated/LastUpdated.tsx +1 -1
  187. package/src/components/Link/Link.tsx +1 -1
  188. package/src/components/Loading/Loading.tsx +2 -2
  189. package/src/components/Logo/Logo.tsx +1 -1
  190. package/src/components/Markdown/Markdown.tsx +23 -14
  191. package/src/components/Markdown/variables.ts +10 -5
  192. package/src/components/Menu/Menu.tsx +1 -1
  193. package/src/components/Menu/MenuContainer.tsx +9 -5
  194. package/src/components/Menu/MenuMobile.tsx +1 -1
  195. package/src/components/Menu/variables.ts +2 -0
  196. package/src/components/Navbar/Navbar.tsx +1 -0
  197. package/src/components/Navbar/NavbarItem.tsx +2 -2
  198. package/src/components/Navbar/NavbarLogo.tsx +8 -3
  199. package/src/components/Navbar/NavbarMenu.tsx +1 -1
  200. package/src/components/PageNavigation/NextButton.tsx +1 -1
  201. package/src/components/PageNavigation/PageNavigation.tsx +1 -1
  202. package/src/components/PageNavigation/PreviousButton.tsx +1 -1
  203. package/src/components/Panel/Panel.tsx +1 -1
  204. package/src/components/Panel/PanelBody.ts +2 -2
  205. package/src/components/Portal/Portal.tsx +6 -3
  206. package/src/components/Product/Product.tsx +1 -1
  207. package/src/components/Product/ProductPicker.tsx +4 -1
  208. package/src/components/Product/variables.ts +4 -1
  209. package/src/components/Search/Search.tsx +1 -1
  210. package/src/components/Search/SearchDialog.tsx +1 -1
  211. package/src/components/Search/SearchInput.tsx +1 -1
  212. package/src/components/Search/SearchItem.tsx +1 -1
  213. package/src/components/Search/SearchRecent.tsx +1 -1
  214. package/src/components/Search/SearchShortcut.tsx +1 -1
  215. package/src/components/Search/SearchSuggestedPages.tsx +1 -1
  216. package/src/components/Search/SearchTrigger.tsx +1 -1
  217. package/src/components/Search/variables.ts +2 -2
  218. package/src/components/Segmented/Segmented.tsx +1 -1
  219. package/src/components/Select/Select.tsx +3 -3
  220. package/src/components/Sidebar/Sidebar.tsx +1 -1
  221. package/src/components/SidebarActions/ChangeViewButton.tsx +2 -2
  222. package/src/components/SidebarActions/SidebarActions.tsx +2 -2
  223. package/src/components/SidebarLogo/SidebarLogo.tsx +3 -3
  224. package/src/components/TableOfContent/TableOfContent.tsx +1 -1
  225. package/src/components/Tag/Tag.tsx +1 -1
  226. package/src/components/Tooltip/Tooltip.tsx +2 -2
  227. package/src/components/Tooltip/variables.ts +4 -0
  228. package/src/components/Typography/H1.ts +1 -1
  229. package/src/components/Typography/H2.ts +1 -1
  230. package/src/components/Typography/H3.ts +1 -1
  231. package/src/components/Typography/H4.ts +1 -1
  232. package/src/components/UserMenu/UserAvatar.tsx +1 -1
  233. package/src/components/UserMenu/UserInfoMenuItem.tsx +1 -1
  234. package/src/components/UserMenu/UserMenu.tsx +5 -2
  235. package/src/components/UserMenu/UserMenuMobile.tsx +1 -1
  236. package/src/components/UserMenu/variables.ts +4 -1
  237. package/src/core/types/catalog.ts +3 -1
  238. package/src/core/types/hooks.ts +3 -1
  239. package/src/layouts/DocumentationLayout.tsx +7 -0
  240. package/src/layouts/NotFound.tsx +3 -3
  241. package/src/layouts/RootLayout.tsx +2 -2
  242. package/src/markdoc/components/InlineSvg/InlineSvg.tsx +8 -1
  243. package/src/markdoc/components/Tabs/variables.ts +5 -5
@@ -1,15 +1,28 @@
1
+ import React, { type PropsWithChildren } from 'react';
1
2
  import styled, { css } from 'styled-components';
2
3
 
3
4
  import { generateCodeBlockTokens } from '@redocly/theme/core/utils';
4
5
 
5
- export const CodeBlockContainer = styled.pre.attrs<{ className?: string }>(({ className }) => ({
6
- 'data-component-name': 'CodeBlock/CodeBlockContainer',
7
- className,
8
- }))<{
9
- maxHeight?: string;
6
+ export type CodeBlockContainerProps = PropsWithChildren<{
10
7
  hideCodeColors?: boolean;
8
+ maxHeight?: string;
11
9
  wrapContents?: boolean;
12
- }>`
10
+ ref?: (instance: HTMLPreElement | null) => void;
11
+ className?: string;
12
+ dangerouslySetInnerHTML?: {
13
+ __html: string;
14
+ };
15
+ suppressHydrationWarning?: boolean;
16
+ tabIndex?: number;
17
+ }>;
18
+
19
+ export function CodeBlockContainer(props: CodeBlockContainerProps): JSX.Element {
20
+ return (
21
+ <CodeBlockContainerComponent {...props} data-component-name="CodeBlock/CodeBlockContainer" />
22
+ );
23
+ }
24
+
25
+ const CodeBlockContainerComponent = styled.pre<CodeBlockContainerProps>`
13
26
  && {
14
27
  overflow-x: auto;
15
28
  font-family: var(--code-block-font-family);
@@ -164,6 +164,8 @@ export function CodeBlockControls({
164
164
  const ContainerWrapper = styled.div`
165
165
  display: grid;
166
166
  justify-content: end;
167
+ font-size: var(--code-block-controls-font-size);
168
+ font-family: var(--code-block-controls-font-family);
167
169
  background-color: var(--code-block-controls-bg-color);
168
170
  padding: var(--code-block-controls-padding);
169
171
  border-bottom: var(--code-block-controls-border);
@@ -9,7 +9,7 @@ import { DocumentBlankIcon } from '@redocly/theme/icons/DocumentBlankIcon/Docume
9
9
  import { ChevronLeftIcon } from '@redocly/theme/icons/ChevronLeftIcon/ChevronLeftIcon';
10
10
  import { ChevronRightIcon } from '@redocly/theme/icons/ChevronRightIcon/ChevronRightIcon';
11
11
 
12
- type CodeBlockTabsProps = {
12
+ export type CodeBlockTabsProps = {
13
13
  tabs: FileTabs;
14
14
  };
15
15
 
@@ -47,8 +47,8 @@ export const code = css`
47
47
  --code-block-controls-font-weight: var(--font-weight-medium); // @presenter Color
48
48
  --code-block-controls-bg-color: transparent; // @presenter Color
49
49
  --code-block-controls-border: 1px solid var(--border-color-secondary); // @presenter Border
50
- --code-block-icon-controls-background-color: var(--code-block-controls-background-color);
51
- --code-block-text-controls-background-color: var(--code-block-controls-background-color);
50
+ --code-block-icon-controls-bg-color: var(--code-block-controls-bg-color);
51
+ --code-block-text-controls-bg-color: var(--code-block-controls-bg-color);
52
52
  --code-block-controls-padding: var(--spacing-unit) var(--spacing-unit) var(--spacing-unit) var(--spacing-base);
53
53
  --code-block-controls-height: 20px;
54
54
  --code-block-controls-width: 20px;
@@ -5,9 +5,15 @@ import { ContrastIcon } from '@redocly/theme/icons/ContrastIcon/ContrastIcon';
5
5
  import { MoonIcon } from '@redocly/theme/icons/MoonIcon/MoonIcon';
6
6
  import { SunIcon } from '@redocly/theme/icons/SunIcon/SunIcon';
7
7
 
8
- export interface ColorModeIconProps {
8
+ export type ColorModeIconProps = {
9
9
  mode?: 'dark' | 'light' | string;
10
10
  className?: string;
11
+ };
12
+
13
+ export function ColorModeIcon(props: ColorModeIconProps): JSX.Element {
14
+ return (
15
+ <ColorModeIconComponent {...props} data-component-name="ColorModeSwitcher/ColorModeIcon" />
16
+ );
11
17
  }
12
18
 
13
19
  function Icon({ mode, className }: ColorModeIconProps) {
@@ -21,8 +27,6 @@ function Icon({ mode, className }: ColorModeIconProps) {
21
27
  }
22
28
  }
23
29
 
24
- export const ColorModeIcon = styled(Icon).attrs(() => ({
25
- 'data-component-name': 'ColorModeSwitcher/ColorModeIcon',
26
- }))`
30
+ const ColorModeIconComponent = styled(Icon)`
27
31
  box-sizing: border-box;
28
32
  `;
@@ -4,7 +4,7 @@ import { useMount, useColorSwitcher } from '@redocly/theme/core/hooks';
4
4
  import { ColorModeIcon } from '@redocly/theme/components/ColorModeSwitcher/ColorModeIcon';
5
5
  import { Button } from '@redocly/theme/components/Button/Button';
6
6
 
7
- type ColorModeSwitcherProps = {
7
+ export type ColorModeSwitcherProps = {
8
8
  className?: string;
9
9
  };
10
10
 
@@ -2,9 +2,9 @@ import React from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { DatePicker as DatePickerComponent } from 'react-date-picker';
4
4
 
5
- type Props = React.ComponentProps<typeof DatePickerComponent>;
5
+ export type DatePickerProps = React.ComponentProps<typeof DatePickerComponent>;
6
6
 
7
- export const DatePicker = (props: Props) => {
7
+ export const DatePicker = (props: DatePickerProps) => {
8
8
  return (
9
9
  <DatePickerWrapper data-component-name="DatePicker/DatePicker">
10
10
  <DatePickerComponent {...props} />
@@ -7,7 +7,7 @@ import { useOutsideClick, useControlledState } from '@redocly/theme/core/hooks';
7
7
  import { ChevronDownIcon } from '@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon';
8
8
  import { ChevronUpIcon } from '@redocly/theme/icons/ChevronUpIcon/ChevronUpIcon';
9
9
 
10
- type DropdownProps = PropsWithChildren<{
10
+ export type DropdownProps = PropsWithChildren<{
11
11
  trigger: React.ReactNode;
12
12
  triggerEvent?: 'click' | 'hover';
13
13
  placement?: 'top' | 'bottom';
@@ -32,7 +32,7 @@ export function Dropdown({
32
32
  dataAttributes,
33
33
  placement,
34
34
  alignment,
35
- }: DropdownProps) {
35
+ }: DropdownProps): JSX.Element {
36
36
  const dropdownRef = useRef<HTMLDivElement | null>(null);
37
37
  const [isOpen, setIsOpen] = useControlledState<boolean>(false, active);
38
38
 
@@ -44,15 +44,21 @@ export function Dropdown({
44
44
  setIsOpen(false);
45
45
  };
46
46
 
47
- const handleToggle = () => {
47
+ const handleChildClick = (event: React.UIEvent) => {
48
+ event.stopPropagation();
49
+ event.preventDefault();
50
+ handleClose();
51
+ };
52
+
53
+ const handleToggle = (event: React.UIEvent) => {
54
+ event.stopPropagation();
55
+ event.preventDefault();
48
56
  setIsOpen(!isOpen);
49
57
  };
50
58
 
51
- const handleKeyDown = (event: KeyboardEvent) => {
59
+ const handleKeyDown = (event: React.KeyboardEvent) => {
52
60
  if (event.key === 'Enter' || event.key === ' ') {
53
- handleToggle();
54
- event.stopPropagation();
55
- event.preventDefault();
61
+ handleToggle(event);
56
62
  }
57
63
  };
58
64
 
@@ -85,7 +91,7 @@ export function Dropdown({
85
91
  <ChildrenWrapper
86
92
  placement={placement}
87
93
  alignment={alignment}
88
- onClick={closeOnClick ? handleClose : undefined}
94
+ onClick={closeOnClick ? handleChildClick : undefined}
89
95
  >
90
96
  {children}
91
97
  </ChildrenWrapper>
@@ -14,7 +14,7 @@ export type DropdownMenuProps =
14
14
  | { children?: ReactNode }
15
15
  );
16
16
 
17
- export function DropdownMenu(props: DropdownMenuProps) {
17
+ export function DropdownMenu(props: DropdownMenuProps): JSX.Element {
18
18
  let content: React.ReactNode = null;
19
19
 
20
20
  if ('children' in props) {
@@ -42,7 +42,7 @@ export function DropdownMenuItem({
42
42
  style,
43
43
  role = 'menuitem',
44
44
  ...otherProps
45
- }: PropsWithChildren<DropdownMenuItemProps>) {
45
+ }: PropsWithChildren<DropdownMenuItemProps>): JSX.Element {
46
46
  const handleClick = () => {
47
47
  onAction?.();
48
48
  };
@@ -53,6 +53,8 @@ export function DropdownMenuItem({
53
53
  }
54
54
  };
55
55
 
56
+ className = className || '' + (active ? ' active' : '');
57
+
56
58
  if (to) {
57
59
  return (
58
60
  <DropdownMenuItemWrapper
@@ -139,8 +141,21 @@ const DropdownMenuItemWrapper = styled.li<{
139
141
  `}
140
142
 
141
143
  background-color: var(--dropdown-menu-item-bg-color);
144
+ color: var(--dropdown-menu-item-color);
145
+
146
+ ${({ active }) =>
147
+ active &&
148
+ css`
149
+ background-color: var(--dropdown-menu-item-bg-color-active);
150
+ color: var(--dropdown-menu-item-color-active);
151
+ svg {
152
+ fill: var(--dropdown-menu-item-color-active);
153
+ }
154
+ `}
155
+
142
156
  &:hover {
143
157
  background-color: var(--dropdown-menu-item-bg-color-hover);
158
+ color: var(--dropdown-menu-item-color-hover);
144
159
  }
145
160
 
146
161
  ${({ disabled }) =>
@@ -148,9 +163,10 @@ const DropdownMenuItemWrapper = styled.li<{
148
163
  css`
149
164
  cursor: default;
150
165
  pointer-events: none;
151
- color: var(--dropdown-menu-color-disabled);
166
+ background-color: var(--dropdown-menu-item-bg-color-disabled);
167
+ color: var(--dropdown-menu-item-color-disabled);
152
168
  svg {
153
- fill: var(--dropdown-menu-color-disabled);
169
+ fill: var(--dropdown-menu-item-color-disabled);
154
170
  }
155
171
  `}
156
172
 
@@ -171,9 +187,12 @@ const DropdownMenuItemWrapper = styled.li<{
171
187
  ${({ dangerous }) =>
172
188
  dangerous &&
173
189
  css`
174
- color: var(--dropdown-menu-item-color-dangerous);
175
- svg {
176
- fill: var(--dropdown-menu-item-color-dangerous);
190
+ &:hover,
191
+ & {
192
+ color: var(--dropdown-menu-item-color-dangerous);
193
+ svg {
194
+ fill: var(--dropdown-menu-item-color-dangerous);
195
+ }
177
196
  }
178
197
  `}
179
198
  `;
@@ -15,7 +15,6 @@ export const dropdown = css`
15
15
  --dropdown-menu-padding: var(--spacing-xxs); // @presenter Spacing
16
16
  --dropdown-menu-border-radius: var(--border-radius-lg); // @presenter BorderRadius
17
17
  --dropdown-menu-box-shadow: var(--bg-raised-shadow); // @presenter Shadow
18
- --dropdown-menu-color-disabled: var(--text-color-disabled); // @presenter Color
19
18
  --dropdown-menu-border-color: var(--border-color-secondary); // @presenter Color
20
19
  --dropdown-menu-bg-color: var(--bg-color-raised); // @presenter Color
21
20
 
@@ -28,11 +27,16 @@ export const dropdown = css`
28
27
  --dropdown-menu-item-bg-color: transparent;
29
28
  --dropdown-menu-item-bg-color-active: var(--bg-color-hover); // @presenter Color
30
29
  --dropdown-menu-item-bg-color-hover: var(--bg-color-hover); // @presenter Color
30
+ --dropdown-menu-item-bg-color-disabled: var(--dropdown-menu-item-bg-color); // @presenter Color
31
31
  --dropdown-menu-item-separator-border-color: var(--border-color-primary); // @presenter Color
32
32
  --dropdown-menu-item-separator-font-size: var(--font-size-sm); // @presenter FontSize
33
33
  --dropdown-menu-item-separator-line-height: var(--line-height-sm); // @presenter LineHeight
34
34
  --dropdown-menu-item-separator-text-color: var(--text-color-disabled); // @presenter Color
35
35
  --dropdown-menu-item-justify-content: flex-start;
36
+ --dropdown-menu-item-color: var(--dropdown-menu-text-color); // @presenter Color
37
+ --dropdown-menu-item-color-hover: var(--dropdown-menu-item-color); // @presenter Color
38
+ --dropdown-menu-item-color-active: var(--dropdown-menu-item-color); // @presenter Color
39
+ --dropdown-menu-item-color-disabled: var(--text-color-disabled); // @presenter Color
36
40
 
37
41
  --dropdown-menu-item-color-dangerous: var(--color-error-base);
38
42
 
@@ -13,6 +13,7 @@ export type CommentProps = {
13
13
  submitText?: string;
14
14
  };
15
15
  standAlone?: boolean;
16
+ isDialog?: boolean;
16
17
  className?: string;
17
18
  };
18
19
 
@@ -22,6 +23,7 @@ export function Comment({
22
23
  onCancel,
23
24
  className,
24
25
  standAlone = true,
26
+ isDialog = false,
25
27
  }: CommentProps): JSX.Element {
26
28
  const { useTranslate } = useThemeHooks();
27
29
  const { translate } = useTranslate();
@@ -93,7 +95,7 @@ export function Comment({
93
95
  <Button
94
96
  data-translation-key="theme.feedback.settings.comment.send"
95
97
  onClick={send}
96
- variant="primary"
98
+ variant={isDialog ? 'primary' : 'secondary'}
97
99
  size="small"
98
100
  >
99
101
  {translate('theme.feedback.settings.comment.send', 'Send')}
@@ -121,7 +123,7 @@ const CommentWrapper = styled.div`
121
123
  flex-direction: column;
122
124
  justify-content: space-between;
123
125
  border-radius: var(--border-radius-lg);
124
- background: var(--feedback-background-color);
126
+ background: var(--feedback-bg-color);
125
127
  gap: var(--spacing-xxs);
126
128
 
127
129
  max-width: var(--feedback-report-dialog-max-width);
@@ -125,8 +125,9 @@ export function Mood({ settings, onSubmit, className }: MoodProps): JSX.Element
125
125
  <>
126
126
  <Button
127
127
  type="button"
128
- disabled={score === MOOD_STATES.DISSATISFIED}
129
128
  size="medium"
129
+ variant={score === MOOD_STATES.DISSATISFIED ? 'primary' : 'secondary'}
130
+ tone={score === MOOD_STATES.DISSATISFIED ? 'danger' : 'default'}
130
131
  onClick={() => {
131
132
  setScore(MOOD_STATES.DISSATISFIED);
132
133
  }}
@@ -134,7 +135,7 @@ export function Mood({ settings, onSubmit, className }: MoodProps): JSX.Element
134
135
  />
135
136
  <Button
136
137
  type="button"
137
- disabled={score === MOOD_STATES.NEUTRAL}
138
+ variant={score === MOOD_STATES.NEUTRAL ? 'primary' : 'secondary'}
138
139
  size="medium"
139
140
  onClick={() => {
140
141
  setScore(MOOD_STATES.NEUTRAL);
@@ -143,7 +144,7 @@ export function Mood({ settings, onSubmit, className }: MoodProps): JSX.Element
143
144
  />
144
145
  <Button
145
146
  type="button"
146
- disabled={score === MOOD_STATES.SATISFIED}
147
+ variant={score === MOOD_STATES.SATISFIED ? 'primary' : 'secondary'}
147
148
  size="medium"
148
149
  onClick={() => {
149
150
  setScore(MOOD_STATES.SATISFIED);
@@ -180,7 +181,7 @@ export function Mood({ settings, onSubmit, className }: MoodProps): JSX.Element
180
181
  <Button onClick={onCancelMoodForm} variant="text" size="small">
181
182
  Cancel
182
183
  </Button>
183
- <Button onClick={onCancelMoodForm} variant="primary" size="small">
184
+ <Button onClick={onSubmitMoodForm} variant="secondary" size="small">
184
185
  Submit
185
186
  </Button>
186
187
  </ButtonsContainer>
@@ -123,7 +123,7 @@ export function Rating({ settings, onSubmit, className }: RatingProps): JSX.Elem
123
123
  <Button onClick={onCancelRatingForm} variant="text" size="small">
124
124
  Cancel
125
125
  </Button>
126
- <Button onClick={onCancelRatingForm} variant="primary" size="small">
126
+ <Button onClick={onCancelRatingForm} variant="secondary" size="small">
127
127
  Submit
128
128
  </Button>
129
129
  </ButtonsContainer>
@@ -49,6 +49,7 @@ export function ReportDialog({
49
49
  telemetry.send('code_snippet_reported', {});
50
50
  onSubmit();
51
51
  }}
52
+ isDialog={true}
52
53
  onCancel={onCancel}
53
54
  />
54
55
  </ReportDialogWrapper>
@@ -163,7 +163,7 @@ export function Scale({ settings, onSubmit, className }: ScaleProps): JSX.Elemen
163
163
  <Button
164
164
  data-translation-key="theme.feedback.settings.scale.send"
165
165
  onClick={onSubmitScaleForm}
166
- variant="primary"
166
+ variant="secondary"
167
167
  size="small"
168
168
  >
169
169
  {translate('theme.feedback.settings.scale.send', 'Submit')}
@@ -101,7 +101,7 @@ export function Sentiment({ settings, onSubmit, className }: SentimentProps): JS
101
101
  <Button
102
102
  type="button"
103
103
  size="medium"
104
- disabled={score === 1}
104
+ variant={score === 1 ? 'primary' : 'secondary'}
105
105
  onClick={() => {
106
106
  setScore(1);
107
107
  }}
@@ -111,7 +111,8 @@ export function Sentiment({ settings, onSubmit, className }: SentimentProps): JS
111
111
  <Button
112
112
  size="medium"
113
113
  type="button"
114
- disabled={score === -1}
114
+ variant={score === -1 ? 'primary' : 'secondary'}
115
+ tone={score === -1 ? 'danger' : 'default'}
115
116
  onClick={() => {
116
117
  setScore(-1);
117
118
  }}
@@ -147,7 +148,7 @@ export function Sentiment({ settings, onSubmit, className }: SentimentProps): JS
147
148
  <Button onClick={onCancelSentimentForm} variant="text" size="small">
148
149
  Cancel
149
150
  </Button>
150
- <Button onClick={onSubmitSentimentForm} variant="primary" size="small">
151
+ <Button onClick={onSubmitSentimentForm} variant="secondary" size="small">
151
152
  Submit
152
153
  </Button>
153
154
  </ButtonsContainer>
@@ -9,7 +9,7 @@ import { useThemeHooks } from '@redocly/theme/core/hooks';
9
9
  import { Button } from '@redocly/theme/components/Button/Button';
10
10
  import { Filter } from '@redocly/theme/components/Filter/Filter';
11
11
 
12
- type FilterContentProps = {
12
+ export type FilterContentProps = {
13
13
  setFilterTerm: (value: string) => void;
14
14
  filters: ResolvedFilter[];
15
15
  filterTerm: string;
@@ -46,7 +46,7 @@ export function FilterContent({
46
46
  {translate('theme.catalog.filters.title', 'Filters')}
47
47
  </FiltersTitle>
48
48
  {hasActiveFilters ? (
49
- <Button size="medium" variant="ghost" onClick={handleClearAll}>
49
+ <Button size="medium" tone="danger" variant="ghost" onClick={handleClearAll}>
50
50
  {translate('theme.catalog.filters.clearAll', 'Clear filters')}
51
51
  </Button>
52
52
  ) : null}
@@ -85,7 +85,7 @@ const FiltersTitle = styled.div`
85
85
  line-height: var(--filter-content-title-line-height);
86
86
  `;
87
87
 
88
- export const FilterItems = styled.div`
88
+ const FilterItems = styled.div`
89
89
  padding: var(--filter-content-items-padding);
90
90
  height: 100%;
91
91
  display: flex;
@@ -4,7 +4,7 @@ import styled from 'styled-components';
4
4
  import { useThemeHooks } from '@redocly/theme/core/hooks';
5
5
  import { SearchIcon } from '@redocly/theme/icons/SearchIcon/SearchIcon';
6
6
 
7
- type FilterInputProps = {
7
+ export type FilterInputProps = {
8
8
  value: string;
9
9
  onChange: (newValue: string) => void;
10
10
  };
@@ -1,9 +1,24 @@
1
+ import React, { type PropsWithChildren } from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
- export const FilterOption = styled.label.attrs({
4
- 'data-testid': 'Filter/FilterOption',
5
- 'data-component-name': 'Filter/FilterOption',
6
- })`
4
+ export type FilterOptionProps = PropsWithChildren<{
5
+ role?: string;
6
+ key?: string;
7
+ onClick?: () => void;
8
+ className?: string;
9
+ }>;
10
+
11
+ export function FilterOption(props: FilterOptionProps): JSX.Element {
12
+ return (
13
+ <FilterOptionComponent
14
+ {...props}
15
+ data-component-name="Filter/FilterOption"
16
+ data-testid="Filter/FilterOption"
17
+ />
18
+ );
19
+ }
20
+
21
+ const FilterOptionComponent = styled.label`
7
22
  display: flex;
8
23
  gap: var(--filter-option-gap);
9
24
  align-items: center;
@@ -13,4 +28,5 @@ export const FilterOption = styled.label.attrs({
13
28
  input {
14
29
  cursor: pointer;
15
30
  }
31
+ margin: var(--filter-option-margin);
16
32
  `;
@@ -1,8 +1,15 @@
1
+ import React, { type PropsWithChildren } from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
- export const FilterOptionLabel = styled.label.attrs({
4
- 'data-component-name': 'Filter/FilterOptionLabel',
5
- })`
4
+ export type FilterOptionLabelProps = PropsWithChildren<{
5
+ className?: string;
6
+ }>;
7
+
8
+ export function FilterOptionLabel(props: FilterOptionLabelProps): JSX.Element {
9
+ return <FilterOptionLabelComponent {...props} data-component-name="Filter/FilterOptionLabel" />;
10
+ }
11
+
12
+ const FilterOptionLabelComponent = styled.label`
6
13
  cursor: pointer;
7
14
  font-size: var(--filter-option-label-font-size);
8
15
  color: var(--filter-option-label-color);
@@ -1,8 +1,15 @@
1
+ import React, { type PropsWithChildren } from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
- export const FilterOptions = styled.div.attrs({
4
- 'data-component-name': 'Filter/FilterOptions',
5
- })`
4
+ export type FilterOptionsProps = PropsWithChildren<{
5
+ className?: string;
6
+ }>;
7
+
8
+ export function FilterOptions(props: FilterOptionsProps): JSX.Element {
9
+ return <FilterOptionsComponent {...props} data-component-name="Filter/FilterOptions" />;
10
+ }
11
+
12
+ const FilterOptionsComponent = styled.div`
6
13
  padding: var(--filter-options-padding-vertical) var(--filter-options-padding-horizontal);
7
14
  display: flex;
8
15
  flex-direction: column;
@@ -8,7 +8,7 @@ import { breakpoints } from '@redocly/theme/core/utils';
8
8
  import { useThemeHooks } from '@redocly/theme/core/hooks';
9
9
  import { FilterContent } from '@redocly/theme/components/Filter/FilterContent';
10
10
 
11
- type FilterPopoverProps = {
11
+ export type FilterPopoverProps = {
12
12
  onClose: () => void;
13
13
  filters: ResolvedFilter[];
14
14
  filterValuesCasing?: NonNullable<ThemeConfig['catalog']>[string]['filterValuesCasing'];
@@ -76,8 +76,5 @@ const StyledSelect = styled(Select)`
76
76
  :hover {
77
77
  border-color: var(--filter-select-border-color-hover);
78
78
  }
79
-
80
- ${FilterOption} {
81
- margin: var(--filter-select-option-margin);
82
- }
79
+ --filter-option-margin: var(--filter-select-option-margin);
83
80
  `;
@@ -1,8 +1,15 @@
1
+ import React, { type PropsWithChildren } from 'react';
1
2
  import styled from 'styled-components';
2
3
 
3
- export const FilterTitle = styled.div.attrs({
4
- 'data-component-name': 'Filter/FilterTitle',
5
- })`
4
+ export type FilterTitleProps = PropsWithChildren<{
5
+ className?: string;
6
+ }>;
7
+
8
+ export function FilterTitle(props: FilterTitleProps): JSX.Element {
9
+ return <FilterTitleComponent {...props} data-component-name="Filter/FilterTitle" />;
10
+ }
11
+
12
+ const FilterTitleComponent = styled.div`
6
13
  font-weight: var(--filter-title-font-weight);
7
14
  font-size: var(--filter-title-font-size);
8
15
  line-height: var(--filter-title-line-height);
@@ -17,7 +17,8 @@ export const filter = css`
17
17
  --filter-options-gap: var(--spacing-sm);
18
18
 
19
19
  --filter-option-font-size: var(--font-size-base);
20
- --filter-option-gap: var(--spacing-xs);)
20
+ --filter-option-gap: var(--spacing-xs);
21
+ --filter-option-margin: 0;
21
22
 
22
23
  --filter-option-label-font-size: var(--font-size-base);
23
24
  --filter-option-label-color: var(--text-color-secondary);
@@ -10,7 +10,7 @@ import { FooterCopyright } from '@redocly/theme/components/Footer/FooterCopyrigh
10
10
  import { FooterLogo } from '@redocly/theme/components/Footer/FooterLogo';
11
11
  import { FooterColumn } from '@redocly/theme/components/Footer/FooterColumn';
12
12
 
13
- type FooterProps = {
13
+ export type FooterProps = {
14
14
  className?: string;
15
15
  };
16
16
 
@@ -8,7 +8,7 @@ import { breakpoints } from '@redocly/theme/core/utils';
8
8
  import { useThemeHooks } from '@redocly/theme/core/hooks';
9
9
  import { Link } from '@redocly/theme/components/Link/Link';
10
10
 
11
- type FooterColumnProps = {
11
+ export type FooterColumnProps = {
12
12
  column: ResolvedNavItem;
13
13
  className?: string;
14
14
  };
@@ -4,7 +4,7 @@ import styled from 'styled-components';
4
4
  import { useThemeHooks } from '@redocly/theme/core/hooks';
5
5
  import { LanguagePicker } from '@redocly/theme/components/LanguagePicker/LanguagePicker';
6
6
 
7
- type FooterCopyrightProps = {
7
+ export type FooterCopyrightProps = {
8
8
  copyrightText: string;
9
9
  className?: string;
10
10
  };
@@ -9,7 +9,7 @@ import { Link } from '@redocly/theme/components/Link/Link';
9
9
  import { Image } from '@redocly/theme/components/Image/Image';
10
10
  import { breakpoints } from '@redocly/theme/core/utils';
11
11
 
12
- type FooterItemProps = {
12
+ export type FooterItemProps = {
13
13
  item: ResolvedNavItem;
14
14
  iconsOnly?: boolean;
15
15
  };
@@ -1,8 +1,15 @@
1
+ import React from 'react';
1
2
  import styled from 'styled-components';
2
3
 
4
+ import type { LogoProps } from '@redocly/theme/components/Logo/Logo';
5
+
3
6
  import { Logo } from '@redocly/theme/components/Logo/Logo';
4
7
 
5
- export const FooterLogo = styled(Logo).attrs({ 'data-component-name': 'Footer/FooterLogo' })`
8
+ export function FooterLogo(props: LogoProps) {
9
+ return <FooterLogoComponent {...props} data-component-name="Footer/FooterLogo" />;
10
+ }
11
+
12
+ const FooterLogoComponent = styled(Logo)<LogoProps>`
6
13
  --logo-height: var(--footer-logo-height);
7
14
  --logo-width: var(--footer-logo-width);
8
15
  --logo-max-width: var(--footer-logo-max-width);
@@ -10,7 +10,7 @@ export type ImageProps = {
10
10
  className?: string;
11
11
  };
12
12
 
13
- export function Image(props: ImageProps) {
13
+ export function Image(props: ImageProps): JSX.Element {
14
14
  const { src, srcSet, alt, className } = props;
15
15
 
16
16
  const parsedSourceSetMap = React.useMemo(() => {