@redocly/theme 0.1.7 → 0.1.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.
Files changed (375) hide show
  1. package/Footer/Footer.d.ts +3 -0
  2. package/Footer/Footer.js +34 -0
  3. package/Footer/FooterColumn.d.ts +7 -0
  4. package/Footer/FooterColumn.js +38 -0
  5. package/Footer/FooterColumns.d.ts +7 -0
  6. package/Footer/FooterColumns.js +44 -0
  7. package/Footer/FooterCopyright.d.ts +5 -0
  8. package/Footer/FooterCopyright.js +29 -0
  9. package/Footer/index.d.ts +4 -0
  10. package/Footer/index.js +14 -0
  11. package/JsonViewer/JsonViewer.js +1 -1
  12. package/JsonViewer/index.d.ts +1 -0
  13. package/JsonViewer/index.js +1 -0
  14. package/Layout/PageLayout.d.ts +6 -0
  15. package/Layout/PageLayout.js +30 -0
  16. package/Layout/RootLayout.d.ts +7 -0
  17. package/Layout/RootLayout.js +31 -0
  18. package/Layout/index.d.ts +2 -0
  19. package/Layout/index.js +10 -0
  20. package/Logo/Logo.d.ts +1 -6
  21. package/Markdown/Admonition/Admonition.d.ts +9 -0
  22. package/Markdown/Admonition/Admonition.js +39 -0
  23. package/Markdown/CodeSample/CodeSample.d.ts +8 -0
  24. package/Markdown/CodeSample/CodeSample.js +30 -0
  25. package/Markdown/CodeSample/styled.d.ts +5 -0
  26. package/Markdown/CodeSample/styled.js +109 -0
  27. package/Markdown/CodeSample/types.d.ts +9 -0
  28. package/Markdown/CodeSample/types.js +2 -0
  29. package/Markdown/ContentWrapper.d.ts +5 -0
  30. package/Markdown/ContentWrapper.js +21 -0
  31. package/Markdown/Heading/Heading.d.ts +5 -0
  32. package/Markdown/Heading/Heading.js +23 -0
  33. package/Markdown/MarkdownLayout.d.ts +7 -0
  34. package/Markdown/MarkdownLayout.js +23 -0
  35. package/Markdown/Mermaid/Mermaid.d.ts +6 -0
  36. package/Markdown/Mermaid/Mermaid.js +19 -0
  37. package/Markdown/PageWrapper.d.ts +3 -0
  38. package/Markdown/PageWrapper.js +15 -0
  39. package/Markdown/StyledMarkdown.d.ts +8 -0
  40. package/Markdown/StyledMarkdown.js +54 -0
  41. package/Markdown/Tabs/Tab.d.ts +8 -0
  42. package/Markdown/Tabs/Tab.js +35 -0
  43. package/Markdown/Tabs/Tabs.d.ts +10 -0
  44. package/Markdown/Tabs/Tabs.js +43 -0
  45. package/Navbar/Navbar.d.ts +1 -0
  46. package/Navbar/Navbar.js +7 -1
  47. package/Navbar/NavbarItem.js +1 -1
  48. package/Navbar/NavbarMenu.js +4 -1
  49. package/OperationBadge/OperationBadge.d.ts +5 -0
  50. package/OperationBadge/OperationBadge.js +15 -0
  51. package/OperationBadge/index.d.ts +1 -0
  52. package/OperationBadge/index.js +17 -0
  53. package/PageNavigation/NextPageLink.d.ts +2 -0
  54. package/PageNavigation/NextPageLink.js +25 -0
  55. package/PageNavigation/PageNavigation.d.ts +2 -0
  56. package/PageNavigation/PageNavigation.js +31 -0
  57. package/PageNavigation/PreviousPageLink.d.ts +2 -0
  58. package/PageNavigation/PreviousPageLink.js +25 -0
  59. package/Panel/CodePanel.js +6 -6
  60. package/Panel/ContentPanel.js +4 -4
  61. package/Panel/Panel.d.ts +1 -1
  62. package/Panel/Panel.js +3 -3
  63. package/Panel/PanelComponent.d.ts +1 -1
  64. package/Panel/PanelComponent.js +3 -3
  65. package/Panel/index.d.ts +1 -0
  66. package/Panel/index.js +1 -0
  67. package/Search/Autocomplete.d.ts +13 -0
  68. package/Search/Autocomplete.js +79 -0
  69. package/Search/ClearIcon.d.ts +2 -0
  70. package/Search/ClearIcon.js +29 -0
  71. package/Search/Input.d.ts +3 -0
  72. package/Search/Input.js +15 -0
  73. package/Search/Parameters.d.ts +7 -0
  74. package/Search/Parameters.js +42 -0
  75. package/Search/Popover.d.ts +3 -0
  76. package/Search/Popover.js +15 -0
  77. package/Search/Search.d.ts +2 -0
  78. package/Search/Search.js +39 -0
  79. package/Search/SearchIcon.d.ts +2 -0
  80. package/Search/SearchIcon.js +29 -0
  81. package/Search/SearchItem.d.ts +7 -0
  82. package/Search/SearchItem.js +47 -0
  83. package/Search/utils.d.ts +2 -0
  84. package/Search/utils.js +21 -0
  85. package/Sidebar/ApiCallItem.d.ts +8 -0
  86. package/Sidebar/ApiCallItem.js +35 -0
  87. package/Sidebar/ArrowBack.d.ts +5 -0
  88. package/Sidebar/ArrowBack.js +28 -0
  89. package/Sidebar/BackButton.d.ts +6 -0
  90. package/Sidebar/BackButton.js +30 -0
  91. package/Sidebar/Drilldown.d.ts +8 -0
  92. package/Sidebar/Drilldown.js +45 -0
  93. package/Sidebar/DrilldownMenu.d.ts +3 -0
  94. package/Sidebar/DrilldownMenu.js +57 -0
  95. package/Sidebar/DrilldownMenuItem.d.ts +3 -0
  96. package/Sidebar/DrilldownMenuItem.js +31 -0
  97. package/Sidebar/ExternalIcon.d.ts +5 -0
  98. package/Sidebar/ExternalIcon.js +28 -0
  99. package/Sidebar/Menu.d.ts +4 -0
  100. package/Sidebar/Menu.js +14 -0
  101. package/Sidebar/MenuContainer.d.ts +2 -0
  102. package/Sidebar/MenuContainer.js +12 -0
  103. package/Sidebar/MenuGroup.d.ts +9 -0
  104. package/Sidebar/MenuGroup.js +37 -0
  105. package/Sidebar/MenuItem.d.ts +3 -0
  106. package/Sidebar/MenuItem.js +33 -0
  107. package/Sidebar/MenuItemLabel.d.ts +6 -0
  108. package/Sidebar/MenuItemLabel.js +18 -0
  109. package/Sidebar/MenuLink.d.ts +6 -0
  110. package/Sidebar/MenuLink.js +15 -0
  111. package/Sidebar/MenuLinkItem.d.ts +3 -0
  112. package/Sidebar/MenuLinkItem.js +30 -0
  113. package/Sidebar/MobileSidebarButton.d.ts +6 -0
  114. package/Sidebar/MobileSidebarButton.js +20 -0
  115. package/Sidebar/Separator.d.ts +3 -0
  116. package/Sidebar/Separator.js +31 -0
  117. package/Sidebar/SeparatorItem.d.ts +6 -0
  118. package/Sidebar/SeparatorItem.js +13 -0
  119. package/Sidebar/SeparatorLine.d.ts +4 -0
  120. package/Sidebar/SeparatorLine.js +14 -0
  121. package/Sidebar/Sidebar.d.ts +8 -0
  122. package/Sidebar/Sidebar.js +23 -0
  123. package/Sidebar/SidebarLayout.d.ts +7 -0
  124. package/Sidebar/SidebarLayout.js +35 -0
  125. package/Sidebar/types/DrilldownMenuProps.d.ts +6 -0
  126. package/Sidebar/types/DrilldownMenuProps.js +2 -0
  127. package/Sidebar/types/ItemState.d.ts +9 -0
  128. package/Sidebar/types/ItemState.js +2 -0
  129. package/Sidebar/types/MenuItemProps.d.ts +5 -0
  130. package/Sidebar/types/MenuItemProps.js +2 -0
  131. package/Sidebar/types/MenuStyle.d.ts +3 -0
  132. package/Sidebar/types/MenuStyle.js +8 -0
  133. package/Sidebar/types/NavItem.d.ts +26 -0
  134. package/Sidebar/types/NavItem.js +2 -0
  135. package/SourceCode/SourceCode.js +2 -2
  136. package/TableOfContent/TableOfContent.d.ts +9 -0
  137. package/TableOfContent/TableOfContent.js +64 -0
  138. package/globalStyle.js +1 -1
  139. package/hooks/index.d.ts +4 -0
  140. package/hooks/index.js +4 -0
  141. package/hooks/useActiveHeading.d.ts +2 -0
  142. package/hooks/useActiveHeading.js +34 -0
  143. package/hooks/useActiveSectionId.d.ts +3 -0
  144. package/hooks/useActiveSectionId.js +48 -0
  145. package/hooks/useFullHeight.d.ts +2 -0
  146. package/hooks/useFullHeight.js +47 -0
  147. package/hooks/useMobileMenu.d.ts +2 -0
  148. package/hooks/useMobileMenu.js +13 -0
  149. package/hooks/useNavbarHeight.d.ts +3 -0
  150. package/hooks/useNavbarHeight.js +20 -0
  151. package/icons/ShelfIcon/ShelfIcon.js +2 -2
  152. package/index.d.ts +1 -0
  153. package/index.js +1 -0
  154. package/mocks/hooks/usePageData.d.ts +5 -0
  155. package/mocks/hooks/usePageData.js +7 -0
  156. package/mocks/models.d.ts +3 -0
  157. package/mocks/models.js +2 -0
  158. package/mocks/search.d.ts +22 -0
  159. package/mocks/search.js +13 -0
  160. package/mocks/types/index.d.ts +1 -0
  161. package/mocks/types/index.js +2 -0
  162. package/mocks/usePreloadHistory.d.ts +3 -0
  163. package/mocks/usePreloadHistory.js +12 -0
  164. package/package.json +5 -2
  165. package/src/Button/Button.stories.tsx +1 -1
  166. package/src/Button/__tests__/Button.test.tsx +1 -1
  167. package/src/CodeBlock/__tests__/CodeBlock.test.tsx +1 -1
  168. package/src/CopyButton/CopyButton.stories.tsx +1 -1
  169. package/src/CopyButton/CopyButton.tsx +1 -1
  170. package/src/CopyButton/CopyButtonWrapper.tsx +4 -4
  171. package/src/CopyButton/__tests__/CopyButton.test.tsx +1 -1
  172. package/src/CopyButton/__tests__/CopyButtonWrapper.test.tsx +2 -1
  173. package/src/Footer/Footer.tsx +34 -0
  174. package/src/Footer/FooterColumn.tsx +62 -0
  175. package/src/Footer/FooterColumns.tsx +51 -0
  176. package/src/Footer/FooterCopyright.tsx +26 -0
  177. package/src/Footer/index.tsx +4 -0
  178. package/src/Headings/Headings.stories.tsx +1 -1
  179. package/src/Headings/Headings.ts +1 -1
  180. package/src/Headings/__tests__/Headings.test.tsx +1 -1
  181. package/src/JsonViewer/JsonViewer.stories.tsx +1 -1
  182. package/src/JsonViewer/JsonViewer.tsx +6 -7
  183. package/src/JsonViewer/__tests__/JsonViewer.test.tsx +2 -1
  184. package/src/JsonViewer/index.ts +1 -0
  185. package/src/Layout/PageLayout.tsx +34 -0
  186. package/src/Layout/RootLayout.tsx +24 -0
  187. package/src/Layout/index.tsx +2 -0
  188. package/src/Logo/Logo.tsx +1 -7
  189. package/src/Markdown/Admonition/Admonition.tsx +64 -0
  190. package/src/Markdown/CodeSample/CodeSample.tsx +39 -0
  191. package/src/Markdown/CodeSample/styled.ts +289 -0
  192. package/src/Markdown/CodeSample/types.ts +40 -0
  193. package/src/Markdown/ContentWrapper.tsx +20 -0
  194. package/src/Markdown/Heading/Heading.tsx +35 -0
  195. package/src/Markdown/MarkdownLayout.tsx +25 -0
  196. package/src/Markdown/Mermaid/Mermaid.tsx +23 -0
  197. package/src/Markdown/PageWrapper.tsx +9 -0
  198. package/src/Markdown/StyledMarkdown.tsx +312 -0
  199. package/src/Markdown/Tabs/Tab.tsx +37 -0
  200. package/src/Markdown/Tabs/Tabs.tsx +45 -0
  201. package/src/Navbar/Navbar.stories.tsx +0 -10
  202. package/src/Navbar/Navbar.tsx +19 -25
  203. package/src/Navbar/NavbarItem.tsx +1 -1
  204. package/src/Navbar/NavbarMenu.tsx +4 -4
  205. package/src/OperationBadge/OperationBadge.stories.tsx +35 -0
  206. package/src/OperationBadge/OperationBadge.ts +59 -0
  207. package/src/OperationBadge/__tests__/OperationBadge.test.tsx +59 -0
  208. package/src/OperationBadge/__tests__/__snapshots__/OperationBadge.test.tsx.snap +651 -0
  209. package/src/OperationBadge/index.ts +1 -0
  210. package/src/PageNavigation/NextPageLink.tsx +22 -0
  211. package/src/PageNavigation/PageNavigation.tsx +20 -0
  212. package/src/PageNavigation/PreviousPageLink.tsx +22 -0
  213. package/src/Panel/CodePanel.stories.tsx +1 -2
  214. package/src/Panel/CodePanel.ts +8 -7
  215. package/src/Panel/ContentPanel.stories.tsx +1 -2
  216. package/src/Panel/ContentPanel.ts +5 -6
  217. package/src/Panel/Panel.stories.tsx +1 -3
  218. package/src/Panel/Panel.ts +3 -3
  219. package/src/Panel/PanelComponent.tsx +4 -5
  220. package/src/Panel/__tests__/CodePanel.test.tsx +1 -1
  221. package/src/Panel/__tests__/ContentPanel.test.tsx +1 -1
  222. package/src/Panel/__tests__/Panel.test.tsx +1 -2
  223. package/src/Panel/__tests__/__snapshots__/CodePanel.test.tsx.snap +8 -8
  224. package/src/Panel/__tests__/__snapshots__/ContentPanel.test.tsx.snap +22 -22
  225. package/src/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +16 -16
  226. package/src/Panel/index.ts +1 -0
  227. package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +1 -1
  228. package/src/SamplesPanelControls/SamplesPanelControls.ts +1 -1
  229. package/src/Search/Autocomplete.tsx +128 -0
  230. package/src/Search/ClearIcon.tsx +31 -0
  231. package/src/Search/Input.tsx +19 -0
  232. package/src/Search/Parameters.tsx +62 -0
  233. package/src/Search/Popover.tsx +20 -0
  234. package/src/Search/Search.tsx +52 -0
  235. package/src/Search/SearchIcon.tsx +32 -0
  236. package/src/Search/SearchItem.tsx +85 -0
  237. package/src/Search/utils.tsx +19 -0
  238. package/src/Sidebar/ApiCallItem.tsx +33 -0
  239. package/src/Sidebar/ArrowBack.tsx +22 -0
  240. package/src/Sidebar/BackButton.tsx +44 -0
  241. package/src/Sidebar/Drilldown.tsx +46 -0
  242. package/src/Sidebar/DrilldownMenu.tsx +58 -0
  243. package/src/Sidebar/DrilldownMenuItem.tsx +40 -0
  244. package/src/Sidebar/ExternalIcon.tsx +37 -0
  245. package/src/Sidebar/Menu.tsx +11 -0
  246. package/src/Sidebar/MenuContainer.tsx +8 -0
  247. package/src/Sidebar/MenuGroup.tsx +55 -0
  248. package/src/Sidebar/MenuItem.tsx +25 -0
  249. package/src/Sidebar/MenuItemLabel.tsx +41 -0
  250. package/src/Sidebar/MenuLink.tsx +14 -0
  251. package/src/Sidebar/MenuLinkItem.tsx +24 -0
  252. package/src/Sidebar/MobileSidebarButton.tsx +44 -0
  253. package/src/Sidebar/Separator.tsx +17 -0
  254. package/src/Sidebar/SeparatorItem.tsx +14 -0
  255. package/src/Sidebar/SeparatorLine.tsx +9 -0
  256. package/src/Sidebar/Sidebar.tsx +54 -0
  257. package/src/Sidebar/SidebarLayout.tsx +30 -0
  258. package/src/Sidebar/types/DrilldownMenuProps.ts +7 -0
  259. package/src/Sidebar/types/ItemState.ts +11 -0
  260. package/src/Sidebar/types/MenuItemProps.ts +6 -0
  261. package/src/Sidebar/types/MenuStyle.ts +4 -0
  262. package/src/Sidebar/types/NavItem.ts +27 -0
  263. package/src/SidebarLogo/SidebarLogo.stories.tsx +1 -1
  264. package/src/SidebarLogo/__tests__/SidebarLogo.test.tsx +1 -1
  265. package/src/SourceCode/SourceCode.stories.tsx +1 -1
  266. package/src/SourceCode/SourceCode.tsx +7 -3
  267. package/src/SourceCode/__tests__/SourceCode.test.tsx +2 -1
  268. package/src/TableOfContent/TableOfContent.tsx +112 -0
  269. package/src/Tooltip/Tooltip.stories.tsx +1 -1
  270. package/src/Tooltip/Tooltip.tsx +1 -1
  271. package/src/Tooltip/__tests__/Tooltip.test.tsx +1 -1
  272. package/src/globalStyle.ts +10 -34
  273. package/src/hooks/index.ts +4 -0
  274. package/src/hooks/useActiveHeading.ts +46 -0
  275. package/src/hooks/useActiveSectionId.ts +53 -0
  276. package/src/hooks/useFullHeight.ts +47 -0
  277. package/src/hooks/useMobileMenu.ts +11 -0
  278. package/src/hooks/useNavbarHeight.ts +24 -0
  279. package/src/icons/ShelfIcon/ShelfIcon.stories.tsx +1 -1
  280. package/src/icons/ShelfIcon/ShelfIcon.tsx +1 -1
  281. package/src/icons/ShelfIcon/__tests__/ShelfIcon.test.tsx +1 -1
  282. package/src/index.ts +1 -0
  283. package/src/mocks/hooks/usePageData.ts +8 -0
  284. package/src/mocks/models.ts +3 -0
  285. package/src/mocks/search.ts +31 -0
  286. package/src/mocks/types/index.ts +1 -0
  287. package/src/mocks/usePreloadHistory.ts +9 -0
  288. package/src/types/portal/index.d.ts +6 -0
  289. package/src/types/portal/src/client/app/Sidebar/types.d.ts +50 -0
  290. package/src/types/portal/src/client/app/media-css.d.ts +7 -0
  291. package/src/types/portal/src/client/styling/default.d.ts +407 -0
  292. package/src/types/portal/src/client/styling/index.d.ts +14 -0
  293. package/src/types/portal/src/client/styling/resolve.d.ts +1 -0
  294. package/src/types/portal/src/server/constants.d.ts +11 -0
  295. package/src/types/portal/src/server/plugins/markdown/types.d.ts +28 -0
  296. package/src/types/portal/src/server/plugins/nav-utils.d.ts +19 -0
  297. package/src/types/portal/src/server/plugins/portal-config/types.d.ts +23 -0
  298. package/src/types/portal/src/server/plugins/sidebars/index.d.ts +16 -0
  299. package/src/types/portal/src/server/plugins/versions/index.d.ts +15 -0
  300. package/src/types/portal/src/server/plugins/versions/types.d.ts +23 -0
  301. package/src/types/portal/src/server/plugins/versions/utils.d.ts +10 -0
  302. package/src/types/portal/src/server/store.d.ts +101 -0
  303. package/src/types/portal/src/server/utils/async.d.ts +5 -0
  304. package/src/types/portal/src/server/utils/crypto.d.ts +3 -0
  305. package/src/types/portal/src/server/utils/fs.d.ts +3 -0
  306. package/src/types/portal/src/server/utils/index.d.ts +6 -0
  307. package/src/types/portal/src/server/utils/paths.d.ts +16 -0
  308. package/src/types/portal/src/server/utils/reporter/formatter.d.ts +11 -0
  309. package/src/types/portal/src/server/utils/reporter/reporter.d.ts +17 -0
  310. package/src/types/portal/src/server/utils/watcher.d.ts +16 -0
  311. package/src/types/portal/src/server/utils/yaml.d.ts +1 -0
  312. package/src/types/portal/src/shared/constants.d.ts +8 -0
  313. package/src/types/portal/src/shared/types.d.ts +77 -0
  314. package/src/types/portal/src/shared/urls.d.ts +7 -0
  315. package/src/types/portal/src/shared/utils.d.ts +10 -0
  316. package/src/ui/AlertIcon.tsx +110 -0
  317. package/src/ui/Arrow/Arrow.tsx +36 -0
  318. package/src/ui/Background.tsx +16 -0
  319. package/src/ui/Box.tsx +39 -0
  320. package/src/ui/Button.tsx +19 -0
  321. package/src/ui/Dropdown.tsx +132 -0
  322. package/src/ui/Flex.tsx +21 -0
  323. package/src/ui/Jumbotron.tsx +57 -0
  324. package/src/ui/Tiles/ThinTile.tsx +151 -0
  325. package/src/ui/Tiles/TileHeader.ts +13 -0
  326. package/src/ui/Tiles/TileText.tsx +12 -0
  327. package/src/ui/Tiles/WideTile.tsx +138 -0
  328. package/src/ui/Typography.tsx +167 -0
  329. package/src/ui/UniversalLink.tsx +100 -0
  330. package/src/ui/index.tsx +12 -0
  331. package/src/utils/__tests__/ClipboardService.test.ts +1 -1
  332. package/src/utils/__tests__/css-variables.test.ts +1 -1
  333. package/src/utils/__tests__/highlight.test.ts +1 -1
  334. package/src/utils/__tests__/jsonToHtml.test.ts +1 -1
  335. package/src/utils/__tests__/media-css.test.ts +1 -1
  336. package/src/utils/__tests__/theme-helpers.test.ts +1 -1
  337. package/src/utils/getNavbarElement.ts +10 -0
  338. package/src/utils/isUrl.ts +42 -0
  339. package/src/utils/replaceHashInColor.ts +3 -0
  340. package/ui/AlertIcon.d.ts +9 -0
  341. package/ui/AlertIcon.js +45 -0
  342. package/ui/Arrow/Arrow.d.ts +7 -0
  343. package/ui/Arrow/Arrow.js +42 -0
  344. package/ui/Background.d.ts +7 -0
  345. package/ui/Background.js +16 -0
  346. package/ui/Box.d.ts +6 -0
  347. package/ui/Box.js +16 -0
  348. package/ui/Button.d.ts +7 -0
  349. package/ui/Button.js +27 -0
  350. package/ui/Dropdown.d.ts +8 -0
  351. package/ui/Dropdown.js +54 -0
  352. package/ui/Flex.d.ts +10 -0
  353. package/ui/Flex.js +31 -0
  354. package/ui/Jumbotron.d.ts +18 -0
  355. package/ui/Jumbotron.js +44 -0
  356. package/ui/Tiles/ThinTile.d.ts +21 -0
  357. package/ui/Tiles/ThinTile.js +98 -0
  358. package/ui/Tiles/TileHeader.d.ts +5 -0
  359. package/ui/Tiles/TileHeader.js +15 -0
  360. package/ui/Tiles/TileText.d.ts +5 -0
  361. package/ui/Tiles/TileText.js +15 -0
  362. package/ui/Tiles/WideTile.d.ts +7 -0
  363. package/ui/Tiles/WideTile.js +93 -0
  364. package/ui/Typography.d.ts +110 -0
  365. package/ui/Typography.js +137 -0
  366. package/ui/UniversalLink.d.ts +17 -0
  367. package/ui/UniversalLink.js +62 -0
  368. package/ui/index.d.ts +10 -0
  369. package/ui/index.js +30 -0
  370. package/utils/getNavbarElement.d.ts +1 -0
  371. package/utils/getNavbarElement.js +14 -0
  372. package/utils/isUrl.d.ts +12 -0
  373. package/utils/isUrl.js +35 -0
  374. package/utils/replaceHashInColor.d.ts +1 -0
  375. package/utils/replaceHashInColor.js +6 -0
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
 
3
- import { Button } from '../Button';
3
+ import { Button } from '@theme/Button';
4
4
 
5
5
  export interface CopyButtonProps {
6
6
  text: string;
@@ -1,9 +1,9 @@
1
1
  import React, { memo } from 'react';
2
2
 
3
- import { SamplesControlButton } from '../SamplesPanelControls';
4
- import { Tooltip } from '../Tooltip';
5
- import { useControl } from '../hooks';
6
- import { ClipboardService } from '../utils';
3
+ import { SamplesControlButton } from '@theme/SamplesPanelControls';
4
+ import { Tooltip } from '@theme/Tooltip';
5
+ import { useControl } from '@theme/hooks';
6
+ import { ClipboardService } from '@theme/utils';
7
7
 
8
8
  export interface CopyButtonWrapperProps {
9
9
  data: unknown;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { fireEvent, getByText, render } from '@testing-library/react';
3
3
 
4
- import { CopyButton } from '../CopyButton';
4
+ import { CopyButton } from '@theme/CopyButton';
5
5
 
6
6
  const mockSetState = jest.fn();
7
7
 
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
 
3
3
  import { renderWithTheme } from '../../../tests/utils';
4
- import { CopyButtonWrapper } from '../CopyButtonWrapper';
4
+
5
+ import { CopyButtonWrapper } from '@theme/CopyButton';
5
6
 
6
7
  describe('CopyButtonWrapper', () => {
7
8
  it('renders', () => {
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import FooterColumns from '@theme/Footer/FooterColumns';
5
+ import FooterCopyright from '@theme/Footer/FooterCopyright';
6
+ import type { FooterConfig } from '@theme/types/portal';
7
+
8
+ export default function Footer({
9
+ columns,
10
+ copyrightText,
11
+ }: React.PropsWithChildren<FooterConfig>): JSX.Element | null {
12
+ if (!(columns?.length || copyrightText)) {
13
+ return null;
14
+ }
15
+
16
+ return (
17
+ <FooterContainer data-component-name="Footer/Footer">
18
+ <FooterColumns columns={columns} />
19
+ <FooterCopyright copyrightText={copyrightText} />
20
+ </FooterContainer>
21
+ );
22
+ }
23
+
24
+ const FooterContainer = styled.footer`
25
+ font-size: 1rem;
26
+ flex-shrink: 0;
27
+ background-color: var(--footer-color-background);
28
+ color: var(--footer-color-text);
29
+ font-family: var(--font-family-primary);
30
+ a,
31
+ a:hover {
32
+ color: var(--footer-color-text);
33
+ }
34
+ `;
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { Link } from '@portal/Link';
5
+ import type { FooterColumn as Column } from '@theme/types/portal';
6
+
7
+ interface FooterColumnProps {
8
+ column: Column;
9
+ }
10
+
11
+ export default function FooterColumn({ column }: FooterColumnProps): JSX.Element {
12
+ return (
13
+ <FooterColumnContainer data-component-name="Footer/FooterColumn">
14
+ <FooterColumnTitle>{column.group || column.label}</FooterColumnTitle>
15
+ {column.items.map((columnItem, columnItemInex) => {
16
+ if (columnItem.type === 'error') {
17
+ return null;
18
+ }
19
+
20
+ return columnItem.type === 'separator' ? (
21
+ <FooterSeparator key={columnItem.label + '_' + columnItemInex}>
22
+ {columnItem.label}
23
+ </FooterSeparator>
24
+ ) : (
25
+ <FooterLink key={columnItemInex} to={columnItem.link} data-cy={columnItem.label}>
26
+ {columnItem.label}
27
+ </FooterLink>
28
+ );
29
+ })}
30
+ </FooterColumnContainer>
31
+ );
32
+ }
33
+
34
+ const FooterColumnTitle = styled.p`
35
+ display: inline-block;
36
+ font-weight: var(--font-weight-regular);
37
+ font-size: 24px;
38
+ margin-bottom: 1.5em;
39
+ font-family: var(--font-family-h);
40
+ `;
41
+
42
+ const FooterSeparator = styled.div`
43
+ opacity: 0.75;
44
+ margin: 10px 0 5px 0;
45
+ font-size: 0.75em;
46
+ text-transform: uppercase;
47
+ font-family: var(--font-family-h);
48
+ `;
49
+
50
+ const FooterColumnContainer = styled.div`
51
+ display: flex;
52
+ flex-direction: column;
53
+ text-align: left;
54
+ margin: 0px 30px;
55
+ `;
56
+
57
+ const FooterLink = styled(Link)`
58
+ font-weight: var(--font-weight-bold);
59
+ padding-bottom: 0.75em;
60
+ color: var(--footer-color-text);
61
+ text-decoration: none;
62
+ `;
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import FooterColumn from '@theme/Footer/FooterColumn';
5
+ import type { FooterConfig } from '@theme/types/portal';
6
+
7
+ export default function FooterColumns({
8
+ columns = [],
9
+ }: React.PropsWithChildren<{ columns?: FooterConfig['columns'] }>): JSX.Element | null {
10
+ if (!columns?.length) {
11
+ return null;
12
+ }
13
+
14
+ return (
15
+ <FooterColumnsContainer data-component-name="Footer/FooterColumns">
16
+ <FooterRow>
17
+ {columns.map((column, index) => (
18
+ <FooterColumn key={index} column={column} />
19
+ ))}
20
+ </FooterRow>
21
+ </FooterColumnsContainer>
22
+ );
23
+ }
24
+
25
+ export const FooterColumnsContainer = styled.div`
26
+ padding: 3em 20px 1em 20px;
27
+ display: flex;
28
+ flex-direction: column;
29
+ justify-content: center;
30
+ max-width: 1200px;
31
+ margin: 0 auto;
32
+
33
+ ${({ theme }) => theme.mediaQueries.small} {
34
+ padding: 5.625em 20px 3.9375em 20px;
35
+ }
36
+
37
+ ${({ theme }) => theme.mediaQueries.print} {
38
+ color: black;
39
+ display: none;
40
+ }
41
+ `;
42
+
43
+ export const FooterRow = styled.div`
44
+ display: flex;
45
+ flex-wrap: wrap;
46
+ justify-content: flex-start;
47
+
48
+ ${({ theme }) => theme.mediaQueries.small} {
49
+ justify-content: space-evenly;
50
+ }
51
+ `;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import type { FooterConfig } from '@theme/types/portal';
5
+
6
+ export default function FooterCopyright({
7
+ copyrightText = '',
8
+ }: React.PropsWithChildren<{ copyrightText?: FooterConfig['copyrightText'] }>): JSX.Element | null {
9
+ return copyrightText ? (
10
+ <Wrapper data-component-name="Footer/FooterCopyright">{copyrightText}</Wrapper>
11
+ ) : null;
12
+ }
13
+
14
+ const Wrapper = styled.section`
15
+ display: flex;
16
+ justify-content: center;
17
+ font-size: 0.875em;
18
+ padding: 1.5em 3em;
19
+ font-weight: var(--font-weight-bold);
20
+ background-color: var(--footer-color-background);
21
+ color: var(--footer-color-text);
22
+ text-align: center;
23
+ span {
24
+ max-width: 1200px;
25
+ }
26
+ `;
@@ -0,0 +1,4 @@
1
+ export { default as Footer } from './Footer';
2
+ export { default as FooterColumn } from './FooterColumn';
3
+ export { default as FooterColumns } from './FooterColumns';
4
+ export { default as FooterCopyright } from './FooterCopyright';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import { H1, H2, H3 } from './Headings';
3
+ import { H1, H2, H3 } from '@theme/Headings';
4
4
 
5
5
  export default {
6
6
  title: 'Typography/Headings',
@@ -1,6 +1,6 @@
1
1
  import styled from 'styled-components';
2
2
 
3
- import { typography } from '../utils';
3
+ import { typography } from '@theme/utils';
4
4
 
5
5
  export const H1 = styled.h1`
6
6
  color: var(--color-content);
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { render } from '@testing-library/react';
3
3
 
4
- import { H1, H2, H3 } from '../Headings';
4
+ import { H1, H2, H3 } from '@theme/Headings';
5
5
 
6
6
  describe('Headings', () => {
7
7
  it('renders H1', () => {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ComponentStory, ComponentMeta } from '@storybook/react';
3
3
 
4
- import { JsonViewer } from './JsonViewer';
4
+ import { JsonViewer } from '@theme/JsonViewer';
5
5
 
6
6
  export default {
7
7
  title: 'JsonViewer',
@@ -1,13 +1,12 @@
1
1
  import React, { memo, useRef, ReactElement } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
- import { CopyButtonWrapper } from '../CopyButton';
5
- import { SampleControls, SamplesControlButton } from '../SamplesPanelControls';
6
- import { jsonToHTML } from '../utils';
7
- import { useMount, useUnmount } from '../hooks';
8
- import { CodeBlock } from '../CodeBlock';
9
-
10
- import { jsonStyles } from './styled';
4
+ import { CopyButtonWrapper } from '@theme/CopyButton';
5
+ import { SampleControls, SamplesControlButton } from '@theme/SamplesPanelControls';
6
+ import { jsonToHTML } from '@theme/utils';
7
+ import { useMount, useUnmount } from '@theme/hooks';
8
+ import { CodeBlock } from '@theme/CodeBlock';
9
+ import { jsonStyles } from '@theme/JsonViewer/styled';
11
10
 
12
11
  export interface JsonProps {
13
12
  data: any;
@@ -2,7 +2,8 @@ import { fireEvent, screen } from '@testing-library/react';
2
2
  import React from 'react';
3
3
 
4
4
  import { renderWithTheme } from '../../../tests/utils';
5
- import { JsonViewer } from '../JsonViewer';
5
+
6
+ import { JsonViewer } from '@theme/JsonViewer';
6
7
 
7
8
  const data = {
8
9
  id: '600dc3b5d617e547a0e74cb9',
@@ -1 +1,2 @@
1
1
  export * from './JsonViewer';
2
+ export * from './styled';
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ interface PageLayoutProps {
5
+ sidebar?: React.ReactNode;
6
+ }
7
+
8
+ export default function PageLayout({
9
+ sidebar,
10
+ children,
11
+ }: React.PropsWithChildren<PageLayoutProps>): JSX.Element {
12
+ return (
13
+ <Container data-component-name="Layout/PageLayout">
14
+ {sidebar}
15
+ <ContentContainer>{children}</ContentContainer>
16
+ </Container>
17
+ );
18
+ }
19
+
20
+ const Container = styled.div`
21
+ display: flex;
22
+ flex-direction: row;
23
+ min-height: calc(100vh - var(--navbar-height));
24
+ `;
25
+
26
+ const ContentContainer = styled.div`
27
+ flex: 1 0 0;
28
+ /*
29
+ flex-basis is ignored for nested flex in Chrome, need to set width
30
+ See more here: https://stackoverflow.com/a/34355447
31
+ */
32
+ width: 0;
33
+ max-width: 100%;
34
+ `;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ interface LayoutConfig {
5
+ navbar: React.ReactNode;
6
+ footer: React.ReactNode;
7
+ }
8
+
9
+ const Wrapper = styled.div``;
10
+
11
+ export default function RootLayout({
12
+ navbar,
13
+ footer,
14
+ children,
15
+ }: React.PropsWithChildren<LayoutConfig>): JSX.Element {
16
+ return (
17
+ // TODO: rewrite it to avoid passing components as props
18
+ <Wrapper data-component-name="Layout/RootLayout">
19
+ {navbar}
20
+ {children}
21
+ {footer}
22
+ </Wrapper>
23
+ );
24
+ }
@@ -0,0 +1,2 @@
1
+ export { default as RootLayout } from './RootLayout';
2
+ export { default as PageLayout } from './PageLayout';
package/src/Logo/Logo.tsx CHANGED
@@ -2,13 +2,7 @@ import React from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  import { Link } from '@portal/Link';
5
-
6
- export interface LogoConfig {
7
- image?: string;
8
- altText?: string;
9
- link?: string;
10
- favicon?: string;
11
- }
5
+ import { LogoConfig } from '@theme/types/portal';
12
6
 
13
7
  export function Logo({ logo }: { logo: LogoConfig }): JSX.Element | null {
14
8
  const img = <NavLogo src={logo.image} alt={logo.altText} data-component-name="Logo/Logo" />;
@@ -0,0 +1,64 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { AlertIcon } from '@theme/ui/AlertIcon';
5
+
6
+ interface AdmonitionTypeProps {
7
+ type: 'warning' | 'success' | 'danger' | 'attention' | 'info';
8
+ }
9
+
10
+ interface AdmonitionProps extends Partial<AdmonitionTypeProps> {
11
+ name?: string;
12
+ }
13
+
14
+ export function Admonition({
15
+ type = 'info',
16
+ name,
17
+ children,
18
+ }: React.PropsWithChildren<AdmonitionProps>): JSX.Element {
19
+ return (
20
+ <Wrapper type={type} data-component-name="Markdown/Admonition/Admonition">
21
+ <AlertIcon type={type} />
22
+ {name ? <Heading type={type}>{name}</Heading> : null}
23
+ <Content>{children}</Content>
24
+ </Wrapper>
25
+ );
26
+ }
27
+
28
+ const Wrapper = styled.div<AdmonitionTypeProps>`
29
+ position: relative;
30
+ align-items: center;
31
+ margin: var(--alert-margin-vertical) var(--alert-margin-horizontal);
32
+ padding: var(--alert-padding-vertical) var(--alert-padding-horizontal);
33
+ padding-left: calc(var(--alert-padding-horizontal) * 2 + var(--alert-icon-size));
34
+ border-radius: var(--alert-border-radius);
35
+ font-size: var(--alert-font-size);
36
+ font-weight: var(--alert-font-weight);
37
+ line-height: var(--alert-line-height);
38
+
39
+ ${({ type }) => `
40
+ background-color: var(--alert-${type}-background-color);
41
+ color: var(--alert-${type}-text-color);
42
+ `}
43
+ `;
44
+
45
+ const Heading = styled.h5<AdmonitionTypeProps>`
46
+ display: block;
47
+ margin: 0 0 10px;
48
+
49
+ letter-spacing: var(--alert-heading-letter-spacing);
50
+ color: ${({ type }) => `var(--alert-${type}-heading-color)`};
51
+
52
+ && {
53
+ font-size: var(--alert-heading-font-size);
54
+ font-weight: var(--alert-heading-font-weight);
55
+ line-height: var(--alert-line-height);
56
+ transform: var(--alert-heading-transform);
57
+ }
58
+ `;
59
+
60
+ const Content = styled.div`
61
+ & > p:first-child {
62
+ margin-top: 0;
63
+ }
64
+ `;
@@ -0,0 +1,39 @@
1
+ import React, { useState } from 'react';
2
+
3
+ import { ClipboardService } from '@theme/utils/ClipboardService';
4
+ import {
5
+ Wrapper,
6
+ DoneIndicator,
7
+ CopyCodeButton,
8
+ CodeSampleButtonContainer,
9
+ } from '@theme/Markdown/CodeSample/styled';
10
+
11
+ type CodeSampleProps = {
12
+ language: string;
13
+ highlighted: string;
14
+ rawContent: string;
15
+ };
16
+
17
+ export function CodeSample({ rawContent, highlighted, language }: CodeSampleProps): JSX.Element {
18
+ const langClassName = language ? `language-${language}` : '';
19
+
20
+ const [isCopied, setIsCopied] = useState(false);
21
+
22
+ const copyCode = (code: string) => {
23
+ ClipboardService.copyCustom(code);
24
+ setIsCopied(true);
25
+ setTimeout(() => setIsCopied(false), 1500);
26
+ };
27
+
28
+ return (
29
+ <Wrapper className="code-sample" data-component-name="Markdown/CodeSample/CodeSample">
30
+ <CodeSampleButtonContainer onClick={() => copyCode(rawContent)}>
31
+ {!isCopied && <CopyCodeButton title="Copy the code snippet">Copy</CopyCodeButton>}
32
+ {isCopied && <DoneIndicator>Copied</DoneIndicator>}
33
+ </CodeSampleButtonContainer>
34
+ <pre className={langClassName}>
35
+ <code className={langClassName} dangerouslySetInnerHTML={{ __html: highlighted }} />
36
+ </pre>
37
+ </Wrapper>
38
+ );
39
+ }