@redocly/theme 0.1.6 → 0.1.9

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 (405) hide show
  1. package/Footer/Footer.d.ts +3 -0
  2. package/Footer/Footer.js +35 -0
  3. package/Footer/FooterColumn.d.ts +7 -0
  4. package/Footer/FooterColumn.js +39 -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 +30 -0
  9. package/Footer/index.d.ts +4 -0
  10. package/Footer/index.js +20 -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 +31 -0
  16. package/Layout/RootLayout.d.ts +7 -0
  17. package/Layout/RootLayout.js +32 -0
  18. package/Layout/index.d.ts +2 -0
  19. package/Layout/index.js +18 -0
  20. package/Logo/Logo.d.ts +1 -6
  21. package/Logo/index.d.ts +1 -0
  22. package/Logo/index.js +17 -0
  23. package/Markdown/Admonition.d.ts +9 -0
  24. package/Markdown/Admonition.js +39 -0
  25. package/Markdown/CodeSample/CodeSample.d.ts +8 -0
  26. package/Markdown/CodeSample/CodeSample.js +30 -0
  27. package/Markdown/CodeSample/index.d.ts +3 -0
  28. package/Markdown/CodeSample/index.js +19 -0
  29. package/Markdown/CodeSample/styled.d.ts +5 -0
  30. package/Markdown/CodeSample/styled.js +109 -0
  31. package/Markdown/CodeSample/types.d.ts +9 -0
  32. package/Markdown/CodeSample/types.js +2 -0
  33. package/Markdown/ContentWrapper.d.ts +5 -0
  34. package/Markdown/ContentWrapper.js +21 -0
  35. package/Markdown/Heading.d.ts +5 -0
  36. package/Markdown/Heading.js +23 -0
  37. package/Markdown/MarkdownLayout.d.ts +7 -0
  38. package/Markdown/MarkdownLayout.js +23 -0
  39. package/Markdown/Mermaid.d.ts +6 -0
  40. package/Markdown/Mermaid.js +19 -0
  41. package/Markdown/PageWrapper.d.ts +3 -0
  42. package/Markdown/PageWrapper.js +15 -0
  43. package/Markdown/StyledMarkdown.d.ts +8 -0
  44. package/Markdown/StyledMarkdown.js +54 -0
  45. package/Markdown/Tabs/Tab.d.ts +8 -0
  46. package/Markdown/Tabs/Tab.js +35 -0
  47. package/Markdown/Tabs/Tabs.d.ts +10 -0
  48. package/Markdown/Tabs/Tabs.js +43 -0
  49. package/Markdown/Tabs/index.d.ts +2 -0
  50. package/Markdown/Tabs/index.js +18 -0
  51. package/Markdown/index.d.ts +9 -0
  52. package/Markdown/index.js +25 -0
  53. package/Navbar/Navbar.d.ts +2 -1
  54. package/Navbar/Navbar.js +9 -3
  55. package/Navbar/NavbarItem.d.ts +1 -1
  56. package/Navbar/NavbarItem.js +3 -3
  57. package/Navbar/NavbarMenu.d.ts +1 -1
  58. package/Navbar/NavbarMenu.js +8 -4
  59. package/OperationBadge/OperationBadge.d.ts +5 -0
  60. package/OperationBadge/OperationBadge.js +15 -0
  61. package/OperationBadge/index.d.ts +1 -0
  62. package/OperationBadge/index.js +17 -0
  63. package/PageNavigation/NextPageLink.d.ts +2 -0
  64. package/PageNavigation/NextPageLink.js +25 -0
  65. package/PageNavigation/PageNavigation.d.ts +2 -0
  66. package/PageNavigation/PageNavigation.js +31 -0
  67. package/PageNavigation/PreviousPageLink.d.ts +2 -0
  68. package/PageNavigation/PreviousPageLink.js +25 -0
  69. package/Panel/CodePanel.js +6 -6
  70. package/Panel/ContentPanel.js +4 -4
  71. package/Panel/Panel.d.ts +1 -1
  72. package/Panel/Panel.js +3 -3
  73. package/Panel/PanelComponent.d.ts +1 -1
  74. package/Panel/PanelComponent.js +3 -3
  75. package/Panel/index.d.ts +1 -0
  76. package/Panel/index.js +1 -0
  77. package/Search/Autocomplete.d.ts +13 -0
  78. package/Search/Autocomplete.js +79 -0
  79. package/Search/ClearIcon.d.ts +2 -0
  80. package/Search/ClearIcon.js +29 -0
  81. package/Search/Input.d.ts +3 -0
  82. package/Search/Input.js +15 -0
  83. package/Search/Parameters.d.ts +7 -0
  84. package/Search/Parameters.js +42 -0
  85. package/Search/Popover.d.ts +3 -0
  86. package/Search/Popover.js +15 -0
  87. package/Search/Search.d.ts +2 -0
  88. package/Search/Search.js +39 -0
  89. package/Search/SearchIcon.d.ts +2 -0
  90. package/Search/SearchIcon.js +29 -0
  91. package/Search/SearchItem.d.ts +7 -0
  92. package/Search/SearchItem.js +47 -0
  93. package/Search/index.d.ts +9 -0
  94. package/Search/index.js +25 -0
  95. package/Search/utils.d.ts +2 -0
  96. package/Search/utils.js +21 -0
  97. package/Sidebar/ApiCallItem.d.ts +8 -0
  98. package/Sidebar/ApiCallItem.js +35 -0
  99. package/Sidebar/ArrowBack.d.ts +4 -0
  100. package/Sidebar/ArrowBack.js +29 -0
  101. package/Sidebar/BackButton.d.ts +6 -0
  102. package/Sidebar/BackButton.js +31 -0
  103. package/Sidebar/Drilldown.d.ts +8 -0
  104. package/Sidebar/Drilldown.js +46 -0
  105. package/Sidebar/DrilldownMenu.d.ts +3 -0
  106. package/Sidebar/DrilldownMenu.js +55 -0
  107. package/Sidebar/DrilldownMenuItem.d.ts +3 -0
  108. package/Sidebar/DrilldownMenuItem.js +32 -0
  109. package/Sidebar/ExternalIcon.d.ts +4 -0
  110. package/Sidebar/ExternalIcon.js +29 -0
  111. package/Sidebar/Menu.d.ts +3 -0
  112. package/Sidebar/Menu.js +15 -0
  113. package/Sidebar/MenuContainer.d.ts +1 -0
  114. package/Sidebar/MenuContainer.js +13 -0
  115. package/Sidebar/MenuGroup.d.ts +9 -0
  116. package/Sidebar/MenuGroup.js +37 -0
  117. package/Sidebar/MenuItem.d.ts +3 -0
  118. package/Sidebar/MenuItem.js +34 -0
  119. package/Sidebar/MenuItemLabel.d.ts +5 -0
  120. package/Sidebar/MenuItemLabel.js +19 -0
  121. package/Sidebar/MenuLink.d.ts +5 -0
  122. package/Sidebar/MenuLink.js +16 -0
  123. package/Sidebar/MenuLinkItem.d.ts +3 -0
  124. package/Sidebar/MenuLinkItem.js +31 -0
  125. package/Sidebar/MobileSidebarButton.d.ts +5 -0
  126. package/Sidebar/MobileSidebarButton.js +21 -0
  127. package/Sidebar/Separator.d.ts +3 -0
  128. package/Sidebar/Separator.js +32 -0
  129. package/Sidebar/SeparatorItem.d.ts +5 -0
  130. package/Sidebar/SeparatorItem.js +14 -0
  131. package/Sidebar/SeparatorLine.d.ts +3 -0
  132. package/Sidebar/SeparatorLine.js +15 -0
  133. package/Sidebar/Sidebar.d.ts +8 -0
  134. package/Sidebar/Sidebar.js +24 -0
  135. package/Sidebar/SidebarLayout.d.ts +7 -0
  136. package/Sidebar/SidebarLayout.js +36 -0
  137. package/Sidebar/index.d.ts +19 -0
  138. package/Sidebar/index.js +35 -0
  139. package/Sidebar/types/DrilldownMenuProps.d.ts +6 -0
  140. package/Sidebar/types/DrilldownMenuProps.js +2 -0
  141. package/Sidebar/types/ItemState.d.ts +8 -0
  142. package/Sidebar/types/ItemState.js +2 -0
  143. package/Sidebar/types/MenuItemProps.d.ts +5 -0
  144. package/Sidebar/types/MenuItemProps.js +2 -0
  145. package/Sidebar/types/MenuStyle.d.ts +3 -0
  146. package/Sidebar/types/MenuStyle.js +8 -0
  147. package/Sidebar/types/NavItem.d.ts +26 -0
  148. package/Sidebar/types/NavItem.js +2 -0
  149. package/Sidebar/types/index.d.ts +5 -0
  150. package/Sidebar/types/index.js +21 -0
  151. package/SourceCode/SourceCode.js +2 -2
  152. package/TableOfContent/TableOfContent.d.ts +9 -0
  153. package/TableOfContent/TableOfContent.js +65 -0
  154. package/TableOfContent/index.d.ts +1 -0
  155. package/TableOfContent/index.js +17 -0
  156. package/globalStyle.js +1 -1
  157. package/hooks/index.d.ts +4 -0
  158. package/hooks/index.js +4 -0
  159. package/hooks/useActiveHeading.d.ts +2 -0
  160. package/hooks/useActiveHeading.js +34 -0
  161. package/hooks/useActiveSectionId.d.ts +3 -0
  162. package/hooks/useActiveSectionId.js +48 -0
  163. package/hooks/useFullHeight.d.ts +2 -0
  164. package/hooks/useFullHeight.js +47 -0
  165. package/hooks/useMobileMenu.d.ts +2 -0
  166. package/hooks/useMobileMenu.js +13 -0
  167. package/hooks/useNavbarHeight.d.ts +3 -0
  168. package/hooks/useNavbarHeight.js +20 -0
  169. package/icons/ShelfIcon/ShelfIcon.js +2 -2
  170. package/index.d.ts +2 -0
  171. package/index.js +2 -0
  172. package/mocks/hooks/usePageData.d.ts +5 -0
  173. package/mocks/hooks/usePageData.js +7 -0
  174. package/mocks/models.d.ts +3 -0
  175. package/mocks/models.js +2 -0
  176. package/mocks/search.d.ts +22 -0
  177. package/mocks/search.js +13 -0
  178. package/mocks/types/index.d.ts +1 -0
  179. package/mocks/types/index.js +2 -0
  180. package/mocks/usePreloadHistory.d.ts +3 -0
  181. package/mocks/usePreloadHistory.js +12 -0
  182. package/package.json +5 -2
  183. package/src/Button/Button.stories.tsx +1 -1
  184. package/src/Button/__tests__/Button.test.tsx +1 -1
  185. package/src/CodeBlock/__tests__/CodeBlock.test.tsx +1 -1
  186. package/src/CopyButton/CopyButton.stories.tsx +1 -1
  187. package/src/CopyButton/CopyButton.tsx +1 -1
  188. package/src/CopyButton/CopyButtonWrapper.tsx +4 -4
  189. package/src/CopyButton/__tests__/CopyButton.test.tsx +1 -1
  190. package/src/CopyButton/__tests__/CopyButtonWrapper.test.tsx +2 -1
  191. package/src/Footer/Footer.tsx +34 -0
  192. package/src/Footer/FooterColumn.tsx +62 -0
  193. package/src/Footer/FooterColumns.tsx +51 -0
  194. package/src/Footer/FooterCopyright.tsx +26 -0
  195. package/src/Footer/index.ts +4 -0
  196. package/src/Headings/Headings.stories.tsx +1 -1
  197. package/src/Headings/Headings.ts +1 -1
  198. package/src/Headings/__tests__/Headings.test.tsx +1 -1
  199. package/src/JsonViewer/JsonViewer.stories.tsx +1 -1
  200. package/src/JsonViewer/JsonViewer.tsx +6 -7
  201. package/src/JsonViewer/__tests__/JsonViewer.test.tsx +2 -1
  202. package/src/JsonViewer/index.ts +1 -0
  203. package/src/Layout/PageLayout.tsx +34 -0
  204. package/src/Layout/RootLayout.tsx +24 -0
  205. package/src/Layout/index.ts +2 -0
  206. package/src/Logo/Logo.tsx +1 -7
  207. package/src/Logo/index.ts +1 -0
  208. package/src/Markdown/Admonition.tsx +64 -0
  209. package/src/Markdown/CodeSample/CodeSample.tsx +39 -0
  210. package/src/Markdown/CodeSample/index.ts +3 -0
  211. package/src/Markdown/CodeSample/styled.ts +289 -0
  212. package/src/Markdown/CodeSample/types.ts +40 -0
  213. package/src/Markdown/ContentWrapper.tsx +20 -0
  214. package/src/Markdown/Heading.tsx +35 -0
  215. package/src/Markdown/MarkdownLayout.tsx +25 -0
  216. package/src/Markdown/Mermaid.tsx +23 -0
  217. package/src/Markdown/PageWrapper.tsx +9 -0
  218. package/src/Markdown/StyledMarkdown.tsx +312 -0
  219. package/src/Markdown/Tabs/Tab.tsx +37 -0
  220. package/src/Markdown/Tabs/Tabs.tsx +45 -0
  221. package/src/Markdown/Tabs/index.ts +2 -0
  222. package/src/Markdown/index.ts +9 -0
  223. package/src/Navbar/Navbar.stories.tsx +3 -13
  224. package/src/Navbar/Navbar.tsx +20 -26
  225. package/src/Navbar/NavbarItem.tsx +2 -2
  226. package/src/Navbar/NavbarMenu.tsx +6 -6
  227. package/src/OperationBadge/OperationBadge.stories.tsx +35 -0
  228. package/src/OperationBadge/OperationBadge.ts +59 -0
  229. package/src/OperationBadge/__tests__/OperationBadge.test.tsx +59 -0
  230. package/src/OperationBadge/__tests__/__snapshots__/OperationBadge.test.tsx.snap +651 -0
  231. package/src/OperationBadge/index.ts +1 -0
  232. package/src/PageNavigation/NextPageLink.tsx +22 -0
  233. package/src/PageNavigation/PageNavigation.tsx +20 -0
  234. package/src/PageNavigation/PreviousPageLink.tsx +22 -0
  235. package/src/Panel/CodePanel.stories.tsx +1 -2
  236. package/src/Panel/CodePanel.ts +8 -7
  237. package/src/Panel/ContentPanel.stories.tsx +1 -2
  238. package/src/Panel/ContentPanel.ts +5 -6
  239. package/src/Panel/Panel.stories.tsx +1 -3
  240. package/src/Panel/Panel.ts +3 -3
  241. package/src/Panel/PanelComponent.tsx +4 -5
  242. package/src/Panel/__tests__/CodePanel.test.tsx +1 -1
  243. package/src/Panel/__tests__/ContentPanel.test.tsx +1 -1
  244. package/src/Panel/__tests__/Panel.test.tsx +1 -2
  245. package/src/Panel/__tests__/__snapshots__/CodePanel.test.tsx.snap +8 -8
  246. package/src/Panel/__tests__/__snapshots__/ContentPanel.test.tsx.snap +22 -22
  247. package/src/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +16 -16
  248. package/src/Panel/index.ts +1 -0
  249. package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +1 -1
  250. package/src/SamplesPanelControls/SamplesPanelControls.ts +1 -1
  251. package/src/Search/Autocomplete.tsx +128 -0
  252. package/src/Search/ClearIcon.tsx +31 -0
  253. package/src/Search/Input.tsx +19 -0
  254. package/src/Search/Parameters.tsx +62 -0
  255. package/src/Search/Popover.tsx +20 -0
  256. package/src/Search/Search.tsx +52 -0
  257. package/src/Search/SearchIcon.tsx +32 -0
  258. package/src/Search/SearchItem.tsx +85 -0
  259. package/src/Search/index.ts +9 -0
  260. package/src/Search/utils.tsx +19 -0
  261. package/src/Sidebar/ApiCallItem.tsx +33 -0
  262. package/src/Sidebar/ArrowBack.tsx +22 -0
  263. package/src/Sidebar/BackButton.tsx +44 -0
  264. package/src/Sidebar/Drilldown.tsx +46 -0
  265. package/src/Sidebar/DrilldownMenu.tsx +58 -0
  266. package/src/Sidebar/DrilldownMenuItem.tsx +40 -0
  267. package/src/Sidebar/ExternalIcon.tsx +37 -0
  268. package/src/Sidebar/Menu.tsx +11 -0
  269. package/src/Sidebar/MenuContainer.tsx +8 -0
  270. package/src/Sidebar/MenuGroup.tsx +55 -0
  271. package/src/Sidebar/MenuItem.tsx +25 -0
  272. package/src/Sidebar/MenuItemLabel.tsx +41 -0
  273. package/src/Sidebar/MenuLink.tsx +14 -0
  274. package/src/Sidebar/MenuLinkItem.tsx +24 -0
  275. package/src/Sidebar/MobileSidebarButton.tsx +44 -0
  276. package/src/Sidebar/Separator.tsx +17 -0
  277. package/src/Sidebar/SeparatorItem.tsx +14 -0
  278. package/src/Sidebar/SeparatorLine.tsx +9 -0
  279. package/src/Sidebar/Sidebar.tsx +54 -0
  280. package/src/Sidebar/SidebarLayout.tsx +30 -0
  281. package/src/Sidebar/index.ts +19 -0
  282. package/src/Sidebar/types/DrilldownMenuProps.ts +7 -0
  283. package/src/Sidebar/types/ItemState.ts +9 -0
  284. package/src/Sidebar/types/MenuItemProps.ts +6 -0
  285. package/src/Sidebar/types/MenuStyle.ts +4 -0
  286. package/src/Sidebar/types/NavItem.ts +27 -0
  287. package/src/Sidebar/types/index.ts +5 -0
  288. package/src/SidebarLogo/SidebarLogo.stories.tsx +1 -1
  289. package/src/SidebarLogo/__tests__/SidebarLogo.test.tsx +1 -1
  290. package/src/SourceCode/SourceCode.stories.tsx +1 -1
  291. package/src/SourceCode/SourceCode.tsx +7 -3
  292. package/src/SourceCode/__tests__/SourceCode.test.tsx +2 -1
  293. package/src/TableOfContent/TableOfContent.stories.tsx +39 -0
  294. package/src/TableOfContent/TableOfContent.tsx +112 -0
  295. package/src/TableOfContent/index.ts +1 -0
  296. package/src/Tooltip/Tooltip.stories.tsx +1 -1
  297. package/src/Tooltip/Tooltip.tsx +1 -1
  298. package/src/Tooltip/__tests__/Tooltip.test.tsx +1 -1
  299. package/src/globalStyle.ts +10 -73
  300. package/src/hooks/index.ts +4 -0
  301. package/src/hooks/useActiveHeading.ts +46 -0
  302. package/src/hooks/useActiveSectionId.ts +53 -0
  303. package/src/hooks/useFullHeight.ts +47 -0
  304. package/src/hooks/useMobileMenu.ts +11 -0
  305. package/src/hooks/useNavbarHeight.ts +24 -0
  306. package/src/icons/ShelfIcon/ShelfIcon.stories.tsx +1 -1
  307. package/src/icons/ShelfIcon/ShelfIcon.tsx +1 -1
  308. package/src/icons/ShelfIcon/__tests__/ShelfIcon.test.tsx +1 -1
  309. package/src/index.ts +2 -0
  310. package/src/mocks/hooks/usePageData.ts +8 -0
  311. package/src/mocks/models.ts +3 -0
  312. package/src/mocks/search.ts +31 -0
  313. package/src/mocks/types/index.ts +1 -0
  314. package/src/mocks/usePreloadHistory.ts +9 -0
  315. package/src/types/portal/index.d.ts +6 -0
  316. package/src/types/portal/src/client/app/Sidebar/types.d.ts +50 -0
  317. package/src/types/portal/src/client/app/media-css.d.ts +7 -0
  318. package/src/types/portal/src/client/styling/default.d.ts +407 -0
  319. package/src/types/portal/src/client/styling/index.d.ts +14 -0
  320. package/src/types/portal/src/client/styling/resolve.d.ts +1 -0
  321. package/src/types/portal/src/server/constants.d.ts +11 -0
  322. package/src/types/portal/src/server/plugins/markdown/types.d.ts +28 -0
  323. package/src/types/portal/src/server/plugins/nav-utils.d.ts +19 -0
  324. package/src/types/portal/src/server/plugins/portal-config/types.d.ts +23 -0
  325. package/src/types/portal/src/server/plugins/sidebars/index.d.ts +16 -0
  326. package/src/types/portal/src/server/plugins/versions/index.d.ts +15 -0
  327. package/src/types/portal/src/server/plugins/versions/types.d.ts +23 -0
  328. package/src/types/portal/src/server/plugins/versions/utils.d.ts +10 -0
  329. package/src/types/portal/src/server/store.d.ts +101 -0
  330. package/src/types/portal/src/server/utils/async.d.ts +5 -0
  331. package/src/types/portal/src/server/utils/crypto.d.ts +3 -0
  332. package/src/types/portal/src/server/utils/fs.d.ts +3 -0
  333. package/src/types/portal/src/server/utils/index.d.ts +6 -0
  334. package/src/types/portal/src/server/utils/paths.d.ts +16 -0
  335. package/src/types/portal/src/server/utils/reporter/formatter.d.ts +11 -0
  336. package/src/types/portal/src/server/utils/reporter/reporter.d.ts +17 -0
  337. package/src/types/portal/src/server/utils/watcher.d.ts +16 -0
  338. package/src/types/portal/src/server/utils/yaml.d.ts +1 -0
  339. package/src/types/portal/src/shared/constants.d.ts +8 -0
  340. package/src/types/portal/src/shared/types.d.ts +77 -0
  341. package/src/types/portal/src/shared/urls.d.ts +7 -0
  342. package/src/types/portal/src/shared/utils.d.ts +10 -0
  343. package/src/ui/AlertIcon.tsx +110 -0
  344. package/src/ui/Arrow.tsx +36 -0
  345. package/src/ui/Background.tsx +16 -0
  346. package/src/ui/Box.tsx +39 -0
  347. package/src/ui/Button.tsx +19 -0
  348. package/src/ui/Dropdown.tsx +132 -0
  349. package/src/ui/Flex.tsx +21 -0
  350. package/src/ui/Jumbotron.tsx +57 -0
  351. package/src/ui/Tiles/ThinTile.tsx +151 -0
  352. package/src/ui/Tiles/TileHeader.ts +13 -0
  353. package/src/ui/Tiles/TileText.tsx +12 -0
  354. package/src/ui/Tiles/WideTile.tsx +138 -0
  355. package/src/ui/Tiles/index.ts +4 -0
  356. package/src/ui/Typography.tsx +167 -0
  357. package/src/ui/UniversalLink.tsx +100 -0
  358. package/src/ui/index.tsx +17 -0
  359. package/src/utils/__tests__/ClipboardService.test.ts +1 -1
  360. package/src/utils/__tests__/css-variables.test.ts +1 -1
  361. package/src/utils/__tests__/highlight.test.ts +1 -1
  362. package/src/utils/__tests__/jsonToHtml.test.ts +1 -1
  363. package/src/utils/__tests__/media-css.test.ts +1 -1
  364. package/src/utils/__tests__/theme-helpers.test.ts +1 -1
  365. package/src/utils/getNavbarElement.ts +10 -0
  366. package/src/utils/isUrl.ts +42 -0
  367. package/src/utils/replaceHashInColor.ts +3 -0
  368. package/ui/AlertIcon.d.ts +9 -0
  369. package/ui/AlertIcon.js +45 -0
  370. package/ui/Arrow.d.ts +7 -0
  371. package/ui/Arrow.js +42 -0
  372. package/ui/Background.d.ts +7 -0
  373. package/ui/Background.js +16 -0
  374. package/ui/Box.d.ts +6 -0
  375. package/ui/Box.js +16 -0
  376. package/ui/Button.d.ts +7 -0
  377. package/ui/Button.js +27 -0
  378. package/ui/Dropdown.d.ts +8 -0
  379. package/ui/Dropdown.js +55 -0
  380. package/ui/Flex.d.ts +10 -0
  381. package/ui/Flex.js +31 -0
  382. package/ui/Jumbotron.d.ts +18 -0
  383. package/ui/Jumbotron.js +44 -0
  384. package/ui/Tiles/ThinTile.d.ts +21 -0
  385. package/ui/Tiles/ThinTile.js +98 -0
  386. package/ui/Tiles/TileHeader.d.ts +5 -0
  387. package/ui/Tiles/TileHeader.js +15 -0
  388. package/ui/Tiles/TileText.d.ts +5 -0
  389. package/ui/Tiles/TileText.js +15 -0
  390. package/ui/Tiles/WideTile.d.ts +7 -0
  391. package/ui/Tiles/WideTile.js +93 -0
  392. package/ui/Tiles/index.d.ts +4 -0
  393. package/ui/Tiles/index.js +20 -0
  394. package/ui/Typography.d.ts +110 -0
  395. package/ui/Typography.js +137 -0
  396. package/ui/UniversalLink.d.ts +17 -0
  397. package/ui/UniversalLink.js +62 -0
  398. package/ui/index.d.ts +14 -0
  399. package/ui/index.js +34 -0
  400. package/utils/getNavbarElement.d.ts +1 -0
  401. package/utils/getNavbarElement.js +14 -0
  402. package/utils/isUrl.d.ts +12 -0
  403. package/utils/isUrl.js +36 -0
  404. package/utils/replaceHashInColor.d.ts +1 -0
  405. package/utils/replaceHashInColor.js +7 -0
@@ -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 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 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 * from './RootLayout';
2
+ export * 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 @@
1
+ export * from './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
+ }
@@ -0,0 +1,3 @@
1
+ export * from './CodeSample';
2
+ export * from './styled';
3
+ export * from './types';
@@ -0,0 +1,289 @@
1
+ import { getLuminance } from 'polished';
2
+ import styled, { css } from 'styled-components';
3
+
4
+ import { typography } from '@theme/ui/Typography';
5
+ import type { Tokens, Token } from '@theme/Markdown/CodeSample/types';
6
+ import { AppTheme } from '@theme/types/portal';
7
+
8
+ function genTokens(tokens?: Tokens | null) {
9
+ if (!tokens) {
10
+ return '';
11
+ }
12
+
13
+ let res = '';
14
+
15
+ for (const token of Object.keys(tokens)) {
16
+ if (token !== 'default') {
17
+ res += `.token.${token} { color: ${tokens[token as Token]?.color}; }\n`;
18
+ }
19
+ }
20
+
21
+ if (tokens.default) {
22
+ return css`
23
+ pre& {
24
+ ${typography(tokens.default)}
25
+ }
26
+ ${res}
27
+ `;
28
+ }
29
+
30
+ return res;
31
+ }
32
+
33
+ const getCodeBlockBackgroundColor = (theme: AppTheme) =>
34
+ Array.isArray(theme.codeBlock.backgroundColor)
35
+ ? theme.codeBlock.backgroundColor[0]
36
+ : theme.codeBlock.backgroundColor;
37
+
38
+ export const CodeButton = css`
39
+ padding: 0 5px;
40
+ border-radius: 4px;
41
+ `;
42
+
43
+ export const CodeSampleButtonContainer = styled.div`
44
+ position: absolute;
45
+ top: 12px;
46
+ right: 5px;
47
+ `;
48
+
49
+ export const CopyCodeButton = styled.div`
50
+ ${CodeButton}
51
+ display: none;
52
+
53
+ &:hover {
54
+ cursor: pointer;
55
+ }
56
+ `;
57
+
58
+ export const DoneIndicator = styled.div`
59
+ ${CodeButton}
60
+ cursor: default;
61
+ `;
62
+
63
+ const lightStyleCodeButton = css`
64
+ ${CopyCodeButton},
65
+ ${DoneIndicator} {
66
+ color: ${({ theme }) => theme.codeBlock.copyButton.visibleText};
67
+ }
68
+
69
+ ${CopyCodeButton}:hover {
70
+ color: ${({ theme }) => theme.codeBlock.copyButton.visibleText};
71
+ outline: 1px solid ${({ theme }) => theme.codeBlock.copyButton.visibleText};
72
+ }
73
+ `;
74
+
75
+ const darkStyleCodeButton = css`
76
+ ${CopyCodeButton},
77
+ ${DoneIndicator} {
78
+ color: ${({ theme }) => theme.codeBlock.copyButton.visibleText};
79
+ }
80
+
81
+ ${CopyCodeButton}:hover {
82
+ color: white;
83
+ color: ${({ theme }) => theme.codeBlock.copyButton.contrastText};
84
+ background-color: ${({ theme }) => theme.codeBlock.copyButton.background};
85
+ }
86
+ `;
87
+
88
+ const lightStyleTokens = css`
89
+ .token.comment,
90
+ .token.prolog,
91
+ .token.doctype,
92
+ .token.cdata {
93
+ color: #999988;
94
+ font-style: italic;
95
+ }
96
+
97
+ .token.namespace {
98
+ opacity: 0.7;
99
+ }
100
+
101
+ .token.string,
102
+ .token.attr-value {
103
+ color: #e3116c;
104
+ }
105
+ .token.punctuation,
106
+ .token.operator {
107
+ color: #393a34; /* no highlight */
108
+ }
109
+
110
+ .token.entity,
111
+ .token.url,
112
+ .token.symbol,
113
+ .token.number,
114
+ .token.boolean,
115
+ .token.variable,
116
+ .token.constant,
117
+ .token.property,
118
+ .token.regex,
119
+ .token.inserted {
120
+ color: #36acaa;
121
+ }
122
+
123
+ .token.atrule,
124
+ .token.keyword,
125
+ .token.attr-name,
126
+ .language-autohotkey .token.selector {
127
+ color: #00a4db;
128
+ }
129
+
130
+ .token.function,
131
+ .token.deleted,
132
+ .language-autohotkey .token.tag {
133
+ color: #9a050f;
134
+ }
135
+
136
+ .token.tag,
137
+ .token.selector,
138
+ .language-autohotkey .token.keyword {
139
+ color: #00009f;
140
+ }
141
+ `;
142
+
143
+ const darkStyleTokens = css`
144
+ .token.comment,
145
+ .token.prolog,
146
+ .token.doctype,
147
+ .token.cdata {
148
+ color: hsl(30, 20%, 50%);
149
+ }
150
+
151
+ .token.property,
152
+ .token.tag,
153
+ .token.number,
154
+ .token.constant,
155
+ .token.symbol {
156
+ color: #62bff9;
157
+ }
158
+ .token.boolean {
159
+ color: firebrick;
160
+ }
161
+ .token.selector,
162
+ .token.attr-name,
163
+ .token.string,
164
+ .token.char,
165
+ .token.builtin,
166
+ .token.inserted {
167
+ color: #a0fbaa;
168
+ & + a,
169
+ & + a:visited {
170
+ color: #4ed2ba;
171
+ text-decoration: underline;
172
+ }
173
+ }
174
+ .token.operator,
175
+ .token.entity,
176
+ .token.url,
177
+ .token.variable {
178
+ color: hsl(40, 90%, 60%);
179
+ }
180
+ .token.atrule,
181
+ .token.attr-value,
182
+ .token.keyword {
183
+ color: hsl(350, 40%, 70%);
184
+ }
185
+ .token.regex,
186
+ .token.important {
187
+ color: #e90;
188
+ }
189
+
190
+ .token.deleted {
191
+ color: red;
192
+ }
193
+ `;
194
+
195
+ export const Wrapper = styled.div`
196
+ overflow: auto;
197
+ border-radius: 4px;
198
+ position: relative;
199
+
200
+ ${({ theme }) =>
201
+ getLuminance(getCodeBlockBackgroundColor(theme)) < 0.25
202
+ ? darkStyleCodeButton
203
+ : lightStyleCodeButton}
204
+
205
+ &:hover {
206
+ ${CodeSampleButtonContainer} ${CopyCodeButton} {
207
+ display: block;
208
+ }
209
+ }
210
+
211
+ pre {
212
+ white-space: ${({ theme }) => (theme.typography.code.wrap ? 'pre-wrap' : 'pre')};
213
+ color: white;
214
+ padding: 12px 14px 15px 14px;
215
+ overflow-x: auto;
216
+ line-height: normal;
217
+ border-radius: 4px;
218
+
219
+ font-family: ${({ theme }) => theme.typography.code.fontFamily};
220
+ background-color: ${({ theme }) => theme.codeBlock.backgroundColor};
221
+
222
+ code {
223
+ background-color: transparent;
224
+ border: 0;
225
+ padding: 0;
226
+
227
+ color: ${({ theme }) =>
228
+ getLuminance(theme.codeBlock.backgroundColor) < 0.5 ? 'white' : '#393A34'};
229
+
230
+ &:before,
231
+ &:after {
232
+ content: none;
233
+ }
234
+ }
235
+ }
236
+
237
+ pre[class*='language-'] {
238
+ padding: 1em;
239
+ margin: 0.5em 0;
240
+ overflow: auto;
241
+ border: 0;
242
+ border-radius: ${({ theme }) => theme.shape.borderRadius};
243
+ }
244
+
245
+ code[class='language-text'] {
246
+ line-height: 1.2em;
247
+ display: inline-flex;
248
+ white-space: pre-wrap;
249
+ overflow-wrap: anywhere;
250
+ }
251
+
252
+ code[class*='language-'],
253
+ pre[class*='language-'] {
254
+ text-align: left;
255
+ white-space: pre;
256
+ word-spacing: normal;
257
+ word-break: normal;
258
+ word-wrap: normal;
259
+ line-height: 1.5;
260
+ -moz-tab-size: 4;
261
+ -o-tab-size: 4;
262
+ tab-size: 4;
263
+ -webkit-hyphens: none;
264
+ -moz-hyphens: none;
265
+ -ms-hyphens: none;
266
+ hyphens: none;
267
+
268
+ .token.important,
269
+ .token.bold {
270
+ font-weight: bold;
271
+ }
272
+ .token.italic {
273
+ font-style: italic;
274
+ }
275
+ .token.entity {
276
+ cursor: help;
277
+ }
278
+ .token.punctuation {
279
+ opacity: 0.7;
280
+ }
281
+ .namespace {
282
+ opacity: 0.7;
283
+ }
284
+
285
+ ${({ theme }) =>
286
+ getLuminance(getCodeBlockBackgroundColor(theme)) < 0.5 ? darkStyleTokens : lightStyleTokens}
287
+ ${({ theme }) => genTokens(theme.codeBlock.tokens)}
288
+ }
289
+ `;
@@ -0,0 +1,40 @@
1
+ import { ITypography } from '@theme/ui/Typography';
2
+
3
+ export type Token =
4
+ | 'comment'
5
+ | 'prolog'
6
+ | 'doctype'
7
+ | 'cdata'
8
+ | 'punctuation'
9
+ | 'property'
10
+ | 'tag'
11
+ | 'number'
12
+ | 'constant'
13
+ | 'symbol'
14
+ | 'boolean'
15
+ | 'selector'
16
+ | 'string'
17
+ | 'char'
18
+ | 'builtin'
19
+ | 'inserted'
20
+ | 'operator'
21
+ | 'entity'
22
+ | 'url'
23
+ | 'variable'
24
+ | 'atrule'
25
+ | 'keyword'
26
+ | 'regex'
27
+ | 'important'
28
+ | 'important'
29
+ | 'bold'
30
+ | 'italic'
31
+ | 'entity'
32
+ | 'deleted';
33
+
34
+ export type Tokens = {
35
+ [P in Token]?: {
36
+ color: string;
37
+ };
38
+ } & {
39
+ default?: ITypography;
40
+ };
@@ -0,0 +1,20 @@
1
+ import styled from 'styled-components';
2
+
3
+ export const ContentWrapper = styled.section.attrs(() => ({
4
+ 'data-component-name': 'Markdown/ContentWrapper',
5
+ }))<{ withToc: boolean }>`
6
+ max-width: var(--content-wrapper-max-width);
7
+ width: 90%;
8
+ margin: 0 auto;
9
+
10
+ padding: var(--content-wrapper-padding-vertical) var(--content-wrapper-padding-horizontal);
11
+
12
+ & > article:first-child > h1:first-child {
13
+ // disable margin top for h1 on the title heading if there is no "Last updated at" block
14
+ /* margin-top: 0; */
15
+ }
16
+
17
+ ${({ theme }) => theme.mediaQueries.medium} {
18
+ width: ${({ withToc }) => (withToc ? `calc(90% - var(--toc-width))` : '90%')};
19
+ }
20
+ `;
@@ -0,0 +1,35 @@
1
+ import React, { createElement, PropsWithChildren } from 'react';
2
+
3
+ const SvgIcon = (
4
+ <svg
5
+ aria-hidden="true"
6
+ focusable="false"
7
+ height="16"
8
+ version="1.1"
9
+ viewBox="0 0 16 16"
10
+ width="16"
11
+ >
12
+ <path
13
+ fillRule="evenodd"
14
+ d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"
15
+ ></path>
16
+ </svg>
17
+ );
18
+
19
+ export function Heading({
20
+ level,
21
+ id,
22
+ children,
23
+ }: PropsWithChildren<{ level: number; id: string }>): JSX.Element {
24
+ const linkEl = (
25
+ <a href={`#${id}`} className="anchor before">
26
+ {SvgIcon}
27
+ </a>
28
+ );
29
+
30
+ return createElement(
31
+ `h${level}`,
32
+ { id, className: 'heading-anchor', 'data-component-name': 'Markdown/Heading/Heading' },
33
+ [linkEl, children],
34
+ );
35
+ }
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+
3
+ import { PageWrapper } from '@theme/Markdown/PageWrapper';
4
+ import { ContentWrapper } from '@theme/Markdown/ContentWrapper';
5
+ import { PageNavigation } from '@theme/PageNavigation/PageNavigation';
6
+
7
+ type MarkdownLayoutProps = {
8
+ tableOfContent: React.Component;
9
+ markdownWrapper: React.Component;
10
+ };
11
+
12
+ export function MarkdownLayout({
13
+ tableOfContent,
14
+ markdownWrapper,
15
+ }: MarkdownLayoutProps): JSX.Element {
16
+ return (
17
+ <PageWrapper data-component-name="Markdown/MarkdownLayout">
18
+ <ContentWrapper withToc={true}>
19
+ {markdownWrapper}
20
+ <PageNavigation />
21
+ </ContentWrapper>
22
+ {tableOfContent}
23
+ </PageWrapper>
24
+ );
25
+ }
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ type MermaidProps = {
5
+ diagramHtml: string;
6
+ };
7
+
8
+ export function Mermaid({ diagramHtml }: MermaidProps): JSX.Element {
9
+ return (
10
+ <Wrapper
11
+ className="mermaid-wrapper"
12
+ dangerouslySetInnerHTML={{ __html: diagramHtml }}
13
+ data-component-name="Markdown/Mermaid/Mermaid"
14
+ />
15
+ );
16
+ }
17
+
18
+ const Wrapper = styled.div`
19
+ .mermaid > svg {
20
+ font-size: 14px !important;
21
+ max-width: 100%;
22
+ }
23
+ `;
@@ -0,0 +1,9 @@
1
+ import styled from 'styled-components';
2
+
3
+ export const PageWrapper = styled.div.attrs(() => ({
4
+ 'data-component-name': 'Markdown/PageWrapper',
5
+ }))`
6
+ display: flex;
7
+ flex: 1;
8
+ width: 100%;
9
+ `;