@redocly/theme 0.1.7 → 0.1.10

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 (454) hide show
  1. package/Button/index.d.ts +1 -1
  2. package/Button/index.js +1 -1
  3. package/CodeBlock/index.d.ts +1 -1
  4. package/CodeBlock/index.js +1 -1
  5. package/CopyButton/index.d.ts +2 -2
  6. package/CopyButton/index.js +2 -2
  7. package/Footer/Footer.d.ts +3 -0
  8. package/Footer/Footer.js +35 -0
  9. package/Footer/FooterColumn.d.ts +7 -0
  10. package/Footer/FooterColumn.js +39 -0
  11. package/Footer/FooterColumns.d.ts +7 -0
  12. package/Footer/FooterColumns.js +44 -0
  13. package/Footer/FooterCopyright.d.ts +5 -0
  14. package/Footer/FooterCopyright.js +30 -0
  15. package/Footer/index.d.ts +4 -0
  16. package/Footer/index.js +20 -0
  17. package/Headings/index.d.ts +1 -1
  18. package/Headings/index.js +1 -1
  19. package/JsonViewer/JsonViewer.js +1 -1
  20. package/JsonViewer/index.d.ts +2 -1
  21. package/JsonViewer/index.js +2 -1
  22. package/Layout/PageLayout.d.ts +6 -0
  23. package/Layout/PageLayout.js +31 -0
  24. package/Layout/RootLayout.d.ts +7 -0
  25. package/Layout/RootLayout.js +32 -0
  26. package/Layout/index.d.ts +2 -0
  27. package/Layout/index.js +18 -0
  28. package/Markdown/Admonition.d.ts +9 -0
  29. package/Markdown/Admonition.js +39 -0
  30. package/Markdown/CodeSample/CodeSample.d.ts +8 -0
  31. package/Markdown/CodeSample/CodeSample.js +30 -0
  32. package/Markdown/CodeSample/index.d.ts +3 -0
  33. package/Markdown/CodeSample/index.js +19 -0
  34. package/Markdown/CodeSample/styled.d.ts +5 -0
  35. package/Markdown/CodeSample/styled.js +109 -0
  36. package/Markdown/CodeSample/types.d.ts +9 -0
  37. package/Markdown/CodeSample/types.js +2 -0
  38. package/Markdown/ContentWrapper.d.ts +5 -0
  39. package/Markdown/ContentWrapper.js +21 -0
  40. package/Markdown/Heading.d.ts +5 -0
  41. package/Markdown/Heading.js +23 -0
  42. package/Markdown/MarkdownLayout.d.ts +7 -0
  43. package/Markdown/MarkdownLayout.js +23 -0
  44. package/Markdown/Mermaid.d.ts +6 -0
  45. package/Markdown/Mermaid.js +19 -0
  46. package/Markdown/PageWrapper.d.ts +3 -0
  47. package/Markdown/PageWrapper.js +15 -0
  48. package/Markdown/StyledMarkdown.d.ts +8 -0
  49. package/Markdown/StyledMarkdown.js +54 -0
  50. package/Markdown/Tabs/Tab.d.ts +8 -0
  51. package/Markdown/Tabs/Tab.js +35 -0
  52. package/Markdown/Tabs/Tabs.d.ts +10 -0
  53. package/Markdown/Tabs/Tabs.js +43 -0
  54. package/Markdown/Tabs/index.d.ts +2 -0
  55. package/Markdown/Tabs/index.js +18 -0
  56. package/Markdown/index.d.ts +9 -0
  57. package/Markdown/index.js +25 -0
  58. package/Navbar/Navbar.d.ts +1 -1
  59. package/Navbar/Navbar.js +9 -3
  60. package/Navbar/NavbarItem.d.ts +1 -1
  61. package/Navbar/NavbarItem.js +4 -4
  62. package/Navbar/NavbarMenu.d.ts +1 -1
  63. package/Navbar/NavbarMenu.js +8 -4
  64. package/Navbar/index.d.ts +3 -0
  65. package/Navbar/index.js +19 -0
  66. package/NavbarLogo/NavbarLogo.d.ts +6 -0
  67. package/{Logo/Logo.js → NavbarLogo/NavbarLogo.js} +8 -5
  68. package/NavbarLogo/index.d.ts +1 -0
  69. package/NavbarLogo/index.js +17 -0
  70. package/OperationBadge/OperationBadge.d.ts +5 -0
  71. package/OperationBadge/OperationBadge.js +15 -0
  72. package/OperationBadge/index.d.ts +1 -0
  73. package/OperationBadge/index.js +17 -0
  74. package/PageNavigation/NextPageLink.d.ts +2 -0
  75. package/PageNavigation/NextPageLink.js +25 -0
  76. package/PageNavigation/PageNavigation.d.ts +2 -0
  77. package/PageNavigation/PageNavigation.js +31 -0
  78. package/PageNavigation/PreviousPageLink.d.ts +2 -0
  79. package/PageNavigation/PreviousPageLink.js +25 -0
  80. package/PageNavigation/index.d.ts +3 -0
  81. package/PageNavigation/index.js +19 -0
  82. package/Panel/CodePanel.js +6 -6
  83. package/Panel/ContentPanel.js +4 -4
  84. package/Panel/Panel.d.ts +1 -1
  85. package/Panel/Panel.js +3 -3
  86. package/Panel/PanelComponent.d.ts +1 -1
  87. package/Panel/PanelComponent.js +3 -3
  88. package/Panel/index.d.ts +8 -7
  89. package/Panel/index.js +8 -7
  90. package/REAMDE.md +1 -0
  91. package/SamplesPanelControls/index.d.ts +1 -1
  92. package/SamplesPanelControls/index.js +1 -1
  93. package/Search/Autocomplete.d.ts +13 -0
  94. package/Search/Autocomplete.js +79 -0
  95. package/Search/ClearIcon.d.ts +2 -0
  96. package/Search/ClearIcon.js +29 -0
  97. package/Search/Input.d.ts +3 -0
  98. package/Search/Input.js +15 -0
  99. package/Search/Parameters.d.ts +7 -0
  100. package/Search/Parameters.js +42 -0
  101. package/Search/Popover.d.ts +3 -0
  102. package/Search/Popover.js +15 -0
  103. package/Search/Search.d.ts +2 -0
  104. package/Search/Search.js +39 -0
  105. package/Search/SearchIcon.d.ts +2 -0
  106. package/Search/SearchIcon.js +29 -0
  107. package/Search/SearchItem.d.ts +7 -0
  108. package/Search/SearchItem.js +47 -0
  109. package/Search/index.d.ts +9 -0
  110. package/Search/index.js +25 -0
  111. package/Search/utils.d.ts +2 -0
  112. package/Search/utils.js +21 -0
  113. package/Sidebar/ApiCallItem.d.ts +8 -0
  114. package/Sidebar/ApiCallItem.js +35 -0
  115. package/Sidebar/ArrowBack.d.ts +4 -0
  116. package/Sidebar/ArrowBack.js +29 -0
  117. package/Sidebar/BackButton.d.ts +6 -0
  118. package/Sidebar/BackButton.js +31 -0
  119. package/Sidebar/Drilldown.d.ts +8 -0
  120. package/Sidebar/Drilldown.js +46 -0
  121. package/Sidebar/DrilldownMenu.d.ts +3 -0
  122. package/Sidebar/DrilldownMenu.js +55 -0
  123. package/Sidebar/DrilldownMenuItem.d.ts +3 -0
  124. package/Sidebar/DrilldownMenuItem.js +32 -0
  125. package/Sidebar/ExternalIcon.d.ts +4 -0
  126. package/Sidebar/ExternalIcon.js +29 -0
  127. package/Sidebar/Menu.d.ts +3 -0
  128. package/Sidebar/Menu.js +15 -0
  129. package/Sidebar/MenuContainer.d.ts +1 -0
  130. package/Sidebar/MenuContainer.js +13 -0
  131. package/Sidebar/MenuGroup.d.ts +9 -0
  132. package/Sidebar/MenuGroup.js +37 -0
  133. package/Sidebar/MenuItem.d.ts +3 -0
  134. package/Sidebar/MenuItem.js +34 -0
  135. package/Sidebar/MenuItemLabel.d.ts +5 -0
  136. package/Sidebar/MenuItemLabel.js +19 -0
  137. package/Sidebar/MenuLink.d.ts +5 -0
  138. package/Sidebar/MenuLink.js +16 -0
  139. package/Sidebar/MenuLinkItem.d.ts +3 -0
  140. package/Sidebar/MenuLinkItem.js +31 -0
  141. package/Sidebar/MobileSidebarButton.d.ts +5 -0
  142. package/Sidebar/MobileSidebarButton.js +21 -0
  143. package/Sidebar/Separator.d.ts +3 -0
  144. package/Sidebar/Separator.js +32 -0
  145. package/Sidebar/SeparatorItem.d.ts +5 -0
  146. package/Sidebar/SeparatorItem.js +14 -0
  147. package/Sidebar/SeparatorLine.d.ts +3 -0
  148. package/Sidebar/SeparatorLine.js +15 -0
  149. package/Sidebar/Sidebar.d.ts +8 -0
  150. package/Sidebar/Sidebar.js +24 -0
  151. package/Sidebar/SidebarLayout.d.ts +7 -0
  152. package/Sidebar/SidebarLayout.js +36 -0
  153. package/Sidebar/index.d.ts +19 -0
  154. package/Sidebar/index.js +35 -0
  155. package/Sidebar/types/DrilldownMenuProps.d.ts +6 -0
  156. package/Sidebar/types/DrilldownMenuProps.js +2 -0
  157. package/Sidebar/types/ItemState.d.ts +8 -0
  158. package/Sidebar/types/ItemState.js +2 -0
  159. package/Sidebar/types/MenuItemProps.d.ts +5 -0
  160. package/Sidebar/types/MenuItemProps.js +2 -0
  161. package/Sidebar/types/MenuStyle.d.ts +3 -0
  162. package/Sidebar/types/MenuStyle.js +8 -0
  163. package/Sidebar/types/NavItem.d.ts +26 -0
  164. package/Sidebar/types/NavItem.js +2 -0
  165. package/Sidebar/types/index.d.ts +5 -0
  166. package/Sidebar/types/index.js +21 -0
  167. package/SidebarLogo/index.d.ts +1 -1
  168. package/SidebarLogo/index.js +1 -1
  169. package/SourceCode/SourceCode.js +2 -2
  170. package/SourceCode/index.d.ts +1 -1
  171. package/SourceCode/index.js +1 -1
  172. package/TableOfContent/TableOfContent.d.ts +9 -0
  173. package/TableOfContent/TableOfContent.js +65 -0
  174. package/TableOfContent/index.d.ts +1 -0
  175. package/TableOfContent/index.js +17 -0
  176. package/Tooltip/index.d.ts +1 -1
  177. package/Tooltip/index.js +1 -1
  178. package/globalStyle.js +1 -1
  179. package/hooks/index.d.ts +7 -3
  180. package/hooks/index.js +7 -3
  181. package/hooks/useActiveHeading.d.ts +2 -0
  182. package/hooks/useActiveHeading.js +34 -0
  183. package/hooks/useActiveSectionId.d.ts +3 -0
  184. package/hooks/useActiveSectionId.js +49 -0
  185. package/hooks/useFullHeight.d.ts +2 -0
  186. package/hooks/useFullHeight.js +47 -0
  187. package/hooks/useMobileMenu.d.ts +2 -0
  188. package/hooks/useMobileMenu.js +13 -0
  189. package/hooks/useNavbarHeight.d.ts +3 -0
  190. package/hooks/useNavbarHeight.js +20 -0
  191. package/icons/ShelfIcon/ShelfIcon.js +2 -2
  192. package/icons/ShelfIcon/index.d.ts +2 -2
  193. package/icons/ShelfIcon/index.js +1 -1
  194. package/icons/index.d.ts +1 -1
  195. package/icons/index.js +1 -1
  196. package/index.d.ts +2 -0
  197. package/index.js +2 -0
  198. package/mocks/hooks/usePageData.d.ts +5 -0
  199. package/mocks/hooks/usePageData.js +7 -0
  200. package/mocks/models.d.ts +3 -0
  201. package/mocks/models.js +2 -0
  202. package/mocks/search.d.ts +22 -0
  203. package/mocks/search.js +13 -0
  204. package/mocks/types/index.d.ts +1 -0
  205. package/mocks/types/index.js +2 -0
  206. package/mocks/usePreloadHistory.d.ts +3 -0
  207. package/mocks/usePreloadHistory.js +12 -0
  208. package/package.json +5 -2
  209. package/src/Button/Button.stories.tsx +2 -2
  210. package/src/Button/__tests__/Button.test.tsx +1 -1
  211. package/src/Button/index.ts +1 -1
  212. package/src/CodeBlock/__tests__/CodeBlock.test.tsx +1 -1
  213. package/src/CodeBlock/index.ts +1 -1
  214. package/src/CopyButton/CopyButton.stories.tsx +2 -2
  215. package/src/CopyButton/CopyButton.tsx +1 -1
  216. package/src/CopyButton/CopyButtonWrapper.tsx +4 -4
  217. package/src/CopyButton/__tests__/CopyButton.test.tsx +1 -1
  218. package/src/CopyButton/__tests__/CopyButtonWrapper.test.tsx +2 -1
  219. package/src/CopyButton/index.ts +2 -2
  220. package/src/Footer/Footer.stories.tsx +57 -0
  221. package/src/Footer/Footer.tsx +31 -0
  222. package/src/Footer/FooterColumn.tsx +62 -0
  223. package/src/Footer/FooterColumns.tsx +53 -0
  224. package/src/Footer/FooterCopyright.tsx +28 -0
  225. package/src/Footer/__tests__/Footer.test.tsx +55 -0
  226. package/src/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +253 -0
  227. package/src/Footer/index.ts +4 -0
  228. package/src/Headings/Headings.stories.tsx +1 -1
  229. package/src/Headings/Headings.ts +1 -1
  230. package/src/Headings/__tests__/Headings.test.tsx +1 -1
  231. package/src/Headings/index.ts +1 -1
  232. package/src/JsonViewer/JsonViewer.stories.tsx +2 -2
  233. package/src/JsonViewer/JsonViewer.tsx +6 -7
  234. package/src/JsonViewer/__tests__/JsonViewer.test.tsx +2 -1
  235. package/src/JsonViewer/index.ts +2 -1
  236. package/src/Layout/PageLayout.tsx +34 -0
  237. package/src/Layout/RootLayout.tsx +24 -0
  238. package/src/Layout/__tests__/PageLayout.test.tsx +17 -0
  239. package/src/Layout/__tests__/RootLayout.test.tsx +17 -0
  240. package/src/Layout/__tests__/__snapshots__/PageLayout.test.tsx.snap +38 -0
  241. package/src/Layout/__tests__/__snapshots__/RootLayout.test.tsx.snap +18 -0
  242. package/src/Layout/index.ts +2 -0
  243. package/src/Markdown/Admonition.tsx +64 -0
  244. package/src/Markdown/CodeSample/CodeSample.tsx +39 -0
  245. package/src/Markdown/CodeSample/index.ts +3 -0
  246. package/src/Markdown/CodeSample/styled.ts +289 -0
  247. package/src/Markdown/CodeSample/types.ts +40 -0
  248. package/src/Markdown/ContentWrapper.tsx +20 -0
  249. package/src/Markdown/Heading.tsx +38 -0
  250. package/src/Markdown/MarkdownLayout.tsx +25 -0
  251. package/src/Markdown/Mermaid.tsx +23 -0
  252. package/src/Markdown/PageWrapper.tsx +9 -0
  253. package/src/Markdown/StyledMarkdown.tsx +312 -0
  254. package/src/Markdown/Tabs/Tab.tsx +37 -0
  255. package/src/Markdown/Tabs/Tabs.tsx +45 -0
  256. package/src/Markdown/Tabs/index.ts +2 -0
  257. package/src/Markdown/index.ts +9 -0
  258. package/src/Navbar/Navbar.stories.tsx +9 -15
  259. package/src/Navbar/Navbar.tsx +21 -28
  260. package/src/Navbar/NavbarItem.tsx +3 -3
  261. package/src/Navbar/NavbarMenu.tsx +6 -6
  262. package/src/Navbar/index.ts +3 -0
  263. package/src/NavbarLogo/NavbarLogo.stories.tsx +20 -0
  264. package/src/NavbarLogo/NavbarLogo.tsx +24 -0
  265. package/src/NavbarLogo/__tests__/NavbarLogo.test.tsx +47 -0
  266. package/src/NavbarLogo/__tests__/__snapshots__/NavbarLogo.test.tsx.snap +38 -0
  267. package/src/NavbarLogo/index.ts +1 -0
  268. package/src/OperationBadge/OperationBadge.stories.tsx +35 -0
  269. package/src/OperationBadge/OperationBadge.ts +59 -0
  270. package/src/OperationBadge/__tests__/OperationBadge.test.tsx +59 -0
  271. package/src/OperationBadge/__tests__/__snapshots__/OperationBadge.test.tsx.snap +651 -0
  272. package/src/OperationBadge/index.ts +1 -0
  273. package/src/PageNavigation/NextPageLink.tsx +22 -0
  274. package/src/PageNavigation/PageNavigation.tsx +20 -0
  275. package/src/PageNavigation/PreviousPageLink.tsx +22 -0
  276. package/src/PageNavigation/index.ts +3 -0
  277. package/src/Panel/CodePanel.stories.tsx +1 -2
  278. package/src/Panel/CodePanel.ts +8 -7
  279. package/src/Panel/ContentPanel.stories.tsx +1 -2
  280. package/src/Panel/ContentPanel.ts +5 -6
  281. package/src/Panel/Panel.stories.tsx +1 -3
  282. package/src/Panel/Panel.ts +3 -3
  283. package/src/Panel/PanelComponent.tsx +4 -5
  284. package/src/Panel/__tests__/CodePanel.test.tsx +1 -1
  285. package/src/Panel/__tests__/ContentPanel.test.tsx +1 -1
  286. package/src/Panel/__tests__/Panel.test.tsx +1 -2
  287. package/src/Panel/__tests__/__snapshots__/CodePanel.test.tsx.snap +8 -8
  288. package/src/Panel/__tests__/__snapshots__/ContentPanel.test.tsx.snap +22 -22
  289. package/src/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +16 -16
  290. package/src/Panel/index.ts +8 -7
  291. package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +2 -2
  292. package/src/SamplesPanelControls/SamplesPanelControls.ts +1 -1
  293. package/src/SamplesPanelControls/index.ts +1 -1
  294. package/src/Search/Autocomplete.tsx +128 -0
  295. package/src/Search/ClearIcon.tsx +31 -0
  296. package/src/Search/Input.tsx +19 -0
  297. package/src/Search/Parameters.tsx +62 -0
  298. package/src/Search/Popover.tsx +20 -0
  299. package/src/Search/Search.tsx +52 -0
  300. package/src/Search/SearchIcon.tsx +32 -0
  301. package/src/Search/SearchItem.tsx +85 -0
  302. package/src/Search/index.ts +9 -0
  303. package/src/Search/utils.tsx +19 -0
  304. package/src/Sidebar/ApiCallItem.tsx +33 -0
  305. package/src/Sidebar/ArrowBack.tsx +22 -0
  306. package/src/Sidebar/BackButton.tsx +44 -0
  307. package/src/Sidebar/Drilldown.tsx +46 -0
  308. package/src/Sidebar/DrilldownMenu.tsx +58 -0
  309. package/src/Sidebar/DrilldownMenuItem.tsx +40 -0
  310. package/src/Sidebar/ExternalIcon.tsx +37 -0
  311. package/src/Sidebar/Menu.tsx +11 -0
  312. package/src/Sidebar/MenuContainer.tsx +8 -0
  313. package/src/Sidebar/MenuGroup.tsx +55 -0
  314. package/src/Sidebar/MenuItem.tsx +25 -0
  315. package/src/Sidebar/MenuItemLabel.tsx +41 -0
  316. package/src/Sidebar/MenuLink.tsx +14 -0
  317. package/src/Sidebar/MenuLinkItem.tsx +24 -0
  318. package/src/Sidebar/MobileSidebarButton.tsx +44 -0
  319. package/src/Sidebar/Separator.tsx +17 -0
  320. package/src/Sidebar/SeparatorItem.tsx +14 -0
  321. package/src/Sidebar/SeparatorLine.tsx +9 -0
  322. package/src/Sidebar/Sidebar.tsx +54 -0
  323. package/src/Sidebar/SidebarLayout.tsx +30 -0
  324. package/src/Sidebar/index.ts +19 -0
  325. package/src/Sidebar/types/DrilldownMenuProps.ts +7 -0
  326. package/src/Sidebar/types/ItemState.ts +9 -0
  327. package/src/Sidebar/types/MenuItemProps.ts +6 -0
  328. package/src/Sidebar/types/MenuStyle.ts +4 -0
  329. package/src/Sidebar/types/NavItem.ts +27 -0
  330. package/src/Sidebar/types/index.ts +5 -0
  331. package/src/SidebarLogo/SidebarLogo.stories.tsx +2 -2
  332. package/src/SidebarLogo/__tests__/SidebarLogo.test.tsx +1 -1
  333. package/src/SidebarLogo/index.ts +1 -1
  334. package/src/SourceCode/SourceCode.stories.tsx +2 -2
  335. package/src/SourceCode/SourceCode.tsx +7 -3
  336. package/src/SourceCode/__tests__/SourceCode.test.tsx +2 -1
  337. package/src/SourceCode/index.ts +1 -1
  338. package/src/TableOfContent/TableOfContent.stories.tsx +39 -0
  339. package/src/TableOfContent/TableOfContent.tsx +112 -0
  340. package/src/TableOfContent/index.ts +1 -0
  341. package/src/Tooltip/Tooltip.stories.tsx +2 -2
  342. package/src/Tooltip/Tooltip.tsx +1 -1
  343. package/src/Tooltip/__tests__/Tooltip.test.tsx +1 -1
  344. package/src/Tooltip/index.ts +1 -1
  345. package/src/Welcome.stories.mdx +7 -0
  346. package/src/globalStyle.ts +99 -28
  347. package/src/hooks/index.ts +7 -3
  348. package/src/hooks/useActiveHeading.ts +46 -0
  349. package/src/hooks/useActiveSectionId.ts +53 -0
  350. package/src/hooks/useFullHeight.ts +47 -0
  351. package/src/hooks/useMobileMenu.ts +11 -0
  352. package/src/hooks/useNavbarHeight.ts +24 -0
  353. package/src/icons/ShelfIcon/ShelfIcon.stories.tsx +1 -1
  354. package/src/icons/ShelfIcon/ShelfIcon.tsx +1 -1
  355. package/src/icons/ShelfIcon/__tests__/ShelfIcon.test.tsx +1 -1
  356. package/src/icons/ShelfIcon/index.ts +2 -2
  357. package/src/icons/index.ts +1 -1
  358. package/src/index.ts +2 -0
  359. package/src/mocks/hooks/usePageData.ts +8 -0
  360. package/src/mocks/models.ts +3 -0
  361. package/src/mocks/search.ts +31 -0
  362. package/src/mocks/types/index.ts +1 -0
  363. package/src/mocks/usePreloadHistory.ts +9 -0
  364. package/src/types/portal/index.d.ts +5 -0
  365. package/src/types/portal/src/client/app/Sidebar/types.d.ts +41 -0
  366. package/src/types/portal/src/client/app/media-css.d.ts +7 -0
  367. package/src/types/portal/src/client/styling/default.d.ts +601 -0
  368. package/src/types/portal/src/client/styling/index.d.ts +10 -0
  369. package/src/types/portal/src/client/styling/resolve.d.ts +1 -0
  370. package/src/types/portal/src/server/constants.d.ts +7 -0
  371. package/src/types/portal/src/server/plugins/markdown/types.d.ts +23 -0
  372. package/src/types/portal/src/server/plugins/portal-config/types.d.ts +23 -0
  373. package/src/types/portal/src/server/plugins/types.d.ts +55 -0
  374. package/src/types/portal/src/server/store.d.ts +53 -0
  375. package/src/types/portal/src/server/utils/async.d.ts +1 -0
  376. package/src/types/portal/src/server/utils/content-provider.d.ts +51 -0
  377. package/src/types/portal/src/server/utils/crypto.d.ts +3 -0
  378. package/src/types/portal/src/server/utils/fs.d.ts +3 -0
  379. package/src/types/portal/src/server/utils/index.d.ts +6 -0
  380. package/src/types/portal/src/server/utils/paths.d.ts +13 -0
  381. package/src/types/portal/src/server/utils/reporter/formatter.d.ts +11 -0
  382. package/src/types/portal/src/server/utils/reporter/reporter.d.ts +17 -0
  383. package/src/types/portal/src/server/utils/yaml.d.ts +1 -0
  384. package/src/types/portal/src/server/version-store.d.ts +35 -0
  385. package/src/types/portal/src/shared/constants.d.ts +8 -0
  386. package/src/types/portal/src/shared/types.d.ts +116 -0
  387. package/src/types/portal/src/shared/urls.d.ts +8 -0
  388. package/src/types/portal/src/shared/utils.d.ts +10 -0
  389. package/src/ui/AlertIcon.tsx +111 -0
  390. package/src/ui/Arrow.tsx +36 -0
  391. package/src/ui/Background.tsx +16 -0
  392. package/src/ui/Box.tsx +39 -0
  393. package/src/ui/Button.tsx +19 -0
  394. package/src/ui/Dropdown.tsx +132 -0
  395. package/src/ui/Flex.tsx +21 -0
  396. package/src/ui/Jumbotron.tsx +57 -0
  397. package/src/ui/Tiles/ThinTile.tsx +151 -0
  398. package/src/ui/Tiles/TileHeader.ts +13 -0
  399. package/src/ui/Tiles/TileText.tsx +12 -0
  400. package/src/ui/Tiles/WideTile.tsx +138 -0
  401. package/src/ui/Tiles/index.ts +4 -0
  402. package/src/ui/Typography.tsx +167 -0
  403. package/src/ui/UniversalLink.tsx +100 -0
  404. package/src/ui/index.tsx +17 -0
  405. package/src/utils/__tests__/ClipboardService.test.ts +1 -1
  406. package/src/utils/__tests__/css-variables.test.ts +1 -1
  407. package/src/utils/__tests__/highlight.test.ts +1 -1
  408. package/src/utils/__tests__/jsonToHtml.test.ts +1 -1
  409. package/src/utils/__tests__/media-css.test.ts +1 -1
  410. package/src/utils/__tests__/theme-helpers.test.ts +1 -1
  411. package/src/utils/getNavbarElement.ts +10 -0
  412. package/src/utils/isUrl.ts +42 -0
  413. package/src/utils/replaceHashInColor.ts +3 -0
  414. package/ui/AlertIcon.d.ts +10 -0
  415. package/ui/AlertIcon.js +45 -0
  416. package/ui/Arrow.d.ts +7 -0
  417. package/ui/Arrow.js +42 -0
  418. package/ui/Background.d.ts +7 -0
  419. package/ui/Background.js +16 -0
  420. package/ui/Box.d.ts +6 -0
  421. package/ui/Box.js +16 -0
  422. package/ui/Button.d.ts +7 -0
  423. package/ui/Button.js +27 -0
  424. package/ui/Dropdown.d.ts +8 -0
  425. package/ui/Dropdown.js +55 -0
  426. package/ui/Flex.d.ts +10 -0
  427. package/ui/Flex.js +31 -0
  428. package/ui/Jumbotron.d.ts +18 -0
  429. package/ui/Jumbotron.js +44 -0
  430. package/ui/Tiles/ThinTile.d.ts +21 -0
  431. package/ui/Tiles/ThinTile.js +98 -0
  432. package/ui/Tiles/TileHeader.d.ts +5 -0
  433. package/ui/Tiles/TileHeader.js +15 -0
  434. package/ui/Tiles/TileText.d.ts +5 -0
  435. package/ui/Tiles/TileText.js +15 -0
  436. package/ui/Tiles/WideTile.d.ts +7 -0
  437. package/ui/Tiles/WideTile.js +93 -0
  438. package/ui/Tiles/index.d.ts +4 -0
  439. package/ui/Tiles/index.js +20 -0
  440. package/ui/Typography.d.ts +110 -0
  441. package/ui/Typography.js +137 -0
  442. package/ui/UniversalLink.d.ts +17 -0
  443. package/ui/UniversalLink.js +62 -0
  444. package/ui/index.d.ts +14 -0
  445. package/ui/index.js +34 -0
  446. package/utils/getNavbarElement.d.ts +1 -0
  447. package/utils/getNavbarElement.js +14 -0
  448. package/utils/isUrl.d.ts +12 -0
  449. package/utils/isUrl.js +36 -0
  450. package/utils/replaceHashInColor.d.ts +1 -0
  451. package/utils/replaceHashInColor.js +7 -0
  452. package/Logo/Logo.d.ts +0 -10
  453. package/src/Introduction.stories.mdx +0 -7
  454. package/src/Logo/Logo.tsx +0 -23
@@ -0,0 +1,55 @@
1
+ import type { PageProps, ResolvedNavItem } from '../../shared/types.js';
2
+ import type { Template } from '../store';
3
+ import type { ContentProvider } from '../utils/content-provider.js';
4
+ export declare type DataLoaderContext = {
5
+ getRouteByFsPath: (relativePath: string) => RouteDetails;
6
+ getRouteBySlug: (relativePath: string) => RouteDetails;
7
+ };
8
+ export declare type DataLoader<T = any> = (contentProvider: ContentProvider, context: DataLoaderContext) => Promise<T>;
9
+ export interface RouteDetails {
10
+ slug: string;
11
+ fsPath: string;
12
+ templateId: string;
13
+ dataLoaders: {
14
+ props: DataLoader<PageProps>;
15
+ [k: string]: DataLoader;
16
+ };
17
+ getNavText?: () => Promise<string>;
18
+ getSidebar?(): ResolvedNavItem[];
19
+ }
20
+ export interface PathVersionInfo {
21
+ version: string;
22
+ isDefault: boolean;
23
+ versionFolderId: string;
24
+ }
25
+ export interface ProcessContentActions {
26
+ addRoute: (route: RouteDetails) => void;
27
+ createTemplate: (template: Template) => Template;
28
+ createSharedData(id: string, data: any): string;
29
+ addRouteSharedData(slug: string, dataKey: string, dataId: string): void;
30
+ }
31
+ export interface AfterRoutesCreatedActions {
32
+ createSharedData(id: string, data: any): string;
33
+ addRouteSharedData(routeSlug: string, dataKey: string, dataId: string): void;
34
+ getRouteByFsPath: (relativePath: string) => RouteDetails;
35
+ getRouteBySlug: (relativePath: string) => RouteDetails;
36
+ getAllRoutes: () => RouteDetails[];
37
+ setGlobalData: (data: Record<string, unknown>) => void;
38
+ setGlobalConfig: (data: Record<string, unknown>) => void;
39
+ addRedirect: (from: string, to: {
40
+ to: string;
41
+ type: number;
42
+ }) => void;
43
+ contentDir: string;
44
+ }
45
+ export interface PluginInstance {
46
+ watch?: RegExp;
47
+ processContent?: (content: ContentProvider, actions: ProcessContentActions) => Promise<void>;
48
+ afterRoutesCreated?: (content: ContentProvider, actions: AfterRoutesCreatedActions) => Promise<void>;
49
+ }
50
+ export interface PluginOptions {
51
+ contentDir: string;
52
+ outdir: string;
53
+ [k: string]: unknown;
54
+ }
55
+ export declare type Plugin = (opts: PluginOptions) => PluginInstance;
@@ -0,0 +1,53 @@
1
+ import type { RouteDetails } from './plugins/types.js';
2
+ export declare class Template {
3
+ absolutePath: string;
4
+ id: string;
5
+ hash: string;
6
+ constructor(absolutePath: string, id: string);
7
+ }
8
+ export declare class Store {
9
+ contentDir: string;
10
+ outdir: string;
11
+ renderMode: 'thread_worker' | 'main';
12
+ routesBySlug: Map<string, RouteDetails>;
13
+ routesByFsPath: Map<string, RouteDetails>;
14
+ routesSharedData: Map<string, Record<string, string>>;
15
+ sharedData: Map<string, any>;
16
+ templates: Map<string, Template>;
17
+ esbuildPlugins: any[];
18
+ listeners: Map<string, Set<Function>>;
19
+ globalData: Record<string, unknown>;
20
+ cliOptions: Record<string, unknown>;
21
+ globalConfig: {
22
+ scripts: string;
23
+ stylesheets: string;
24
+ redirects: Record<string, {
25
+ to: string;
26
+ type: number;
27
+ }>;
28
+ [k: string]: unknown;
29
+ };
30
+ constructor(contentDir: string, outdir?: string, renderMode?: 'thread_worker' | 'main');
31
+ on(type: 'routes-updated', cb: () => void | any): void;
32
+ on(type: 'template-updated', cb: (template: Template) => void | any): void;
33
+ on(type: 'shared-data-updated', cb: (id: string, data: any) => void): any;
34
+ on(type: 'global-data-updated', cb: (pathname: string, data: Record<string, unknown>) => void | any): void;
35
+ runListeners<T extends Array<unknown>>(type: 'template-updated' | 'global-data-updated' | 'shared-data-updated' | 'routes-updated', ...args: T): void;
36
+ addEsbuildPlugin(plugin: any): void;
37
+ setGlobalData(data: Record<string, unknown>): void;
38
+ setCliOptions(data: Record<string, unknown>): void;
39
+ setGlobalConfig(data: Record<string, unknown>): void;
40
+ addRedirect(from: string, to: {
41
+ to: string;
42
+ type: number;
43
+ }): void;
44
+ createSharedData: (id: string, data: any) => string;
45
+ addRouteSharedData: (routeSlug: string, dataKey: string, dataId: string) => void;
46
+ addRoute: (route: RouteDetails) => void;
47
+ getRouteByFsPath: (relativePath: string) => RouteDetails;
48
+ getRouteBySlug: (slug: string) => RouteDetails;
49
+ getAllRoutes: () => RouteDetails[];
50
+ getTemplate: (id: string) => Template;
51
+ createTemplate: (template: Template) => Template;
52
+ clear: () => void;
53
+ }
@@ -0,0 +1 @@
1
+ export declare function promiseMapLimit<T, P>(array: T[], poolLimit: number, iteratorFn: (arg: T, array: T[]) => Promise<P>): Promise<P[]>;
@@ -0,0 +1,51 @@
1
+ /// <reference types="node" />
2
+ import * as chokidar from 'chokidar';
3
+ import * as fs from 'fs';
4
+ import { VersionStore } from '../version-store.js';
5
+ import { PathVersionInfo } from '../plugins/types.js';
6
+ declare type WatchCb = (event: 'add' | 'change' | 'unlink', path: string, stats?: fs.Stats) => Promise<void>;
7
+ export interface ContentRecord {
8
+ content: string;
9
+ contentHash: string;
10
+ relativePath: string;
11
+ parsed?: any;
12
+ }
13
+ export interface ParsedContentRecord<T = unknown> extends ContentRecord {
14
+ parsed: T;
15
+ }
16
+ export interface ContentProvider {
17
+ cwd: string;
18
+ filesList: Set<string>;
19
+ versions: VersionStore;
20
+ loadContent(relativePath: string, parse?: undefined): ContentRecord;
21
+ loadContent<T = unknown>(relativePath: string, parse: 'yaml'): ParsedContentRecord<T>;
22
+ loadContent(relativePath: string, parse: 'frontmatter'): ParsedContentRecord<{
23
+ content: string;
24
+ data: unknown;
25
+ }>;
26
+ loadContent(relativePath: string, parse: 'yaml' | 'frontmatter' | undefined): ParsedContentRecord;
27
+ getVersionInfoByFsPath: (relativePath: string) => PathVersionInfo;
28
+ has(relativePath: string): boolean;
29
+ }
30
+ export declare class FsContentProvider implements ContentProvider {
31
+ #private;
32
+ cwd: string;
33
+ private initialContentLoaded;
34
+ filesList: Set<string>;
35
+ versions: VersionStore;
36
+ constructor(cwd: string, initialCache?: Map<string, ContentRecord>);
37
+ private emit;
38
+ has(relativePath: string): boolean;
39
+ getVersionInfoByFsPath(relativePath: string): PathVersionInfo;
40
+ loadContent(relativePath: string, parse?: undefined): ContentRecord;
41
+ loadContent(relativePath: string, parse: 'yaml'): ParsedContentRecord<unknown>;
42
+ loadContent(relativePath: string, parse: 'frontmatter'): ParsedContentRecord<{
43
+ content: string;
44
+ data: unknown;
45
+ }>;
46
+ watch(test: RegExp, cb: WatchCb): void;
47
+ stop(): Promise<void>;
48
+ start(): void;
49
+ ready(): Promise<chokidar.FSWatcher>;
50
+ }
51
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare function sha(content: string): string;
2
+ export declare function shaFile(fileName: string): string;
3
+ export declare function shaFileForUrl(fileName: string): string;
@@ -0,0 +1,3 @@
1
+ export declare function readFileAsStringSync(filePath: string): string;
2
+ export declare function readFileNames(dir: string): string[];
3
+ export declare function copyStaticFile(absolutePath: string, outdir: string): string;
@@ -0,0 +1,6 @@
1
+ export * from './async.js';
2
+ export * from './crypto.js';
3
+ export * from './fs.js';
4
+ export * from './reporter/reporter.js';
5
+ export * from './content-provider.js';
6
+ export * from './paths.js';
@@ -0,0 +1,13 @@
1
+ import { ContentProvider } from './index.js';
2
+ export declare function getDataFromRelativePath(relativePath: string): {
3
+ pathVersion: string;
4
+ basePath: string;
5
+ };
6
+ export declare function generatePagePathname(currentVersion?: string | null, defaultVersion?: string | null, ...combineParts: string[]): string;
7
+ export declare function slugFromRelativePath(relativePath: string, contentProvider: ContentProvider): string;
8
+ export declare function slug(str: string): string;
9
+ export declare function fromCurrentDir(moduleUrl: string, path: string): string;
10
+ export declare function excludeVersion<T extends string[] | string>(arg: T): {
11
+ version?: string;
12
+ data: T;
13
+ } | undefined;
@@ -0,0 +1,11 @@
1
+ declare const formatter: {
2
+ success(message: string, ...args: any[]): string;
3
+ info(message: string, ...args: any[]): string;
4
+ warn(message: string, ...args: any[]): string;
5
+ error(message: string, ...args: any[]): string;
6
+ verbose(message: string, ...args: any[]): string;
7
+ formatMs(ms: number): string;
8
+ withTime(message: any, reporter: any): string;
9
+ format(pattern: string, ...args: any[]): string;
10
+ };
11
+ export default formatter;
@@ -0,0 +1,17 @@
1
+ export declare const reporter: {
2
+ now(): number;
3
+ startTiming(): void;
4
+ getTimeSpan(): number;
5
+ success(message: string, ...args: any[]): void;
6
+ successTime(message: string, ...args: any[]): void;
7
+ info(message: string, ...args: any[]): void;
8
+ infoTime(message: string, ...args: any[]): void;
9
+ warn(message: string, ...args: any[]): void;
10
+ warnTime(message: string, ...args: any[]): void;
11
+ error(message: string, ...args: any[]): void;
12
+ verbose(message: string, ...args: any[]): void;
13
+ verboseTime(message: string, ...args: any[]): void;
14
+ panic(message: string, ...args: any[]): never;
15
+ panicOnBuild(message: string, ...args: any[]): void;
16
+ flushErrors(): void;
17
+ };
@@ -0,0 +1 @@
1
+ export declare function parseYaml<T = unknown>(raw: string): T;
@@ -0,0 +1,35 @@
1
+ import type { Version } from '../shared/types';
2
+ import { ContentProvider } from './utils/index.js';
3
+ import { PathVersionInfo } from './plugins/types';
4
+ export declare class VersionStore {
5
+ contentProvider: ContentProvider;
6
+ private config;
7
+ constructor(contentProvider: ContentProvider);
8
+ private parsePath;
9
+ /**
10
+ * Goes through config and makes sure each folder has a default version set
11
+ * By default, versions are sorted alphabetically and last one becomes default
12
+ */
13
+ private setDefaultVersions;
14
+ /**
15
+ * Checks for nested versions and files in the root of versioned folder
16
+ * @param allFiles relative paths of all files
17
+ */
18
+ private validateVersionsStructure;
19
+ /**
20
+ * Read config and store it in the state and mark folder with hasVersionsConfig = true
21
+ * to prevent versions list from being deducted automatically.
22
+ * This means that if file strucutre has 3 versions, but config only specifies 2, the list will only have 2
23
+ * @param versionsFilePath path to versions.yaml
24
+ */
25
+ private parseVersionsFile;
26
+ /**
27
+ * Reads and validates versions config.
28
+ * TODO: takes ~200-400ms on tests/starter. Consider partial updates instead of rebuilding if this is becoming a bottleneck
29
+ * @param allFilePaths
30
+ */
31
+ resolveConfig(allFilePaths: Set<string>): void;
32
+ getPageVersions(pagePath: string, suffix?: string): Version[];
33
+ getDefaultByPath(path: string): string;
34
+ getVersionInfoByFsPath(path: string): PathVersionInfo | null;
35
+ }
@@ -0,0 +1,8 @@
1
+ export declare const RUNTIME_RESOURCES_DIR = "runtime";
2
+ export declare const REDOC_OVERVIEW_ITEM_ID = "overview";
3
+ export declare const PORTAL_CUSTOM_THEMES_FOLDER = "@theme";
4
+ export declare const USER_THEME_ALIAS = "@theme";
5
+ export declare const PUBLIC_STATIC_FOLDER = "/static";
6
+ export declare enum FsErrors {
7
+ NotExist = "ENOENT"
8
+ }
@@ -0,0 +1,116 @@
1
+ /// <reference types="react" />
2
+ export declare type ResolvedNavLinkItem = {
3
+ type: 'link';
4
+ link: string;
5
+ label: string;
6
+ items?: ResolvedNavItem[];
7
+ external?: boolean;
8
+ version?: string;
9
+ isDefault?: boolean;
10
+ versionFolderId?: string;
11
+ httpVerb?: string;
12
+ separatorLine?: boolean;
13
+ routeSlug?: string;
14
+ active?: boolean;
15
+ };
16
+ export declare type ResolvedNavGroupItem = {
17
+ type: 'group';
18
+ link?: string;
19
+ label: string;
20
+ items: ResolvedNavItem[];
21
+ version?: string;
22
+ isDefault?: boolean;
23
+ versionFolderId?: string;
24
+ menuStyle?: MenuStyle;
25
+ separatorLine?: boolean;
26
+ routeSlug?: string;
27
+ active?: boolean;
28
+ };
29
+ export declare type ResolvedNavItem = ResolvedNavLinkItem | ResolvedNavGroupItem | {
30
+ type: 'separator';
31
+ label?: string;
32
+ version?: string;
33
+ isDefault?: boolean;
34
+ versionFolderId?: string;
35
+ separatorLine?: boolean;
36
+ link?: undefined;
37
+ items?: ResolvedNavItem[];
38
+ } | {
39
+ type: 'error';
40
+ version?: string;
41
+ isDefault?: boolean;
42
+ versionFolderId?: string;
43
+ label: string;
44
+ link?: undefined;
45
+ items?: ResolvedNavItem[];
46
+ };
47
+ export declare type ResolvedNavItemWithLink = (ResolvedNavLinkItem | ResolvedNavGroupItem) & {
48
+ link: string;
49
+ };
50
+ export declare type ResolvedSidebar = ResolvedNavItem[];
51
+ export interface PageProps {
52
+ seo: {
53
+ title: string;
54
+ };
55
+ versions?: Version[];
56
+ [k: string]: unknown;
57
+ }
58
+ export interface PageData {
59
+ templateId: string;
60
+ sharedDataIds: Record<string, string>;
61
+ props: PageProps;
62
+ }
63
+ export interface CachedPageData extends PageData {
64
+ Template: React.ComponentType<{
65
+ pageProps: PageProps;
66
+ }>;
67
+ }
68
+ export interface ResolvedPageData extends CachedPageData {
69
+ sharedData: Record<string, unknown>;
70
+ }
71
+ export declare enum MenuStyle {
72
+ Drilldown = "drilldown"
73
+ }
74
+ export declare type NavItem = {
75
+ page?: string;
76
+ directory?: string;
77
+ group?: string;
78
+ label?: string;
79
+ href?: never;
80
+ items?: NavItem[];
81
+ separator?: string;
82
+ separatorLine?: boolean;
83
+ version?: string;
84
+ menuStyle?: MenuStyle;
85
+ external?: boolean;
86
+ };
87
+ export declare type RawNavItem = string | NavItem;
88
+ export interface LogoConfig {
89
+ image?: string;
90
+ altText?: string;
91
+ link?: string;
92
+ favicon?: string;
93
+ }
94
+ export declare type Version = {
95
+ version: string;
96
+ label: string;
97
+ link: string;
98
+ default: boolean;
99
+ active: boolean;
100
+ notExists?: boolean;
101
+ folderId: string;
102
+ };
103
+ export declare type VersionConfigItem = {
104
+ version: string;
105
+ name?: string;
106
+ };
107
+ export declare type VersionsConfigType = {
108
+ versions: VersionConfigItem[];
109
+ default?: string;
110
+ };
111
+ export declare type VersionedFolderConfig = {
112
+ versionedFiles: Map<string, Set<string>>;
113
+ defaultVersion?: string;
114
+ versions: VersionConfigItem[];
115
+ hasVersionsConfig?: boolean;
116
+ };
@@ -0,0 +1,8 @@
1
+ export declare function getPageDataUrl(normalizedRoute: string): string;
2
+ export declare function getClientPageDataUrl(normalizedRoute: string): string;
3
+ export declare function getSidebarUrl(id: string): string;
4
+ export declare function getSharedDataUrl(id: string): string;
5
+ export declare const GLOBAL_DATA_URL = "/app-data.json";
6
+ export declare function combineUrls(baseURL: string, ...relativeURLs: string[]): string;
7
+ export declare function withPathPrefix(url: string): string;
8
+ export declare function withoutHash(url: string): string;
@@ -0,0 +1,10 @@
1
+ export declare const isLocalLink: (path: string) => boolean;
2
+ /**
3
+ *
4
+ * @returns url with leading and without trailing slash or empty string, e.g. '/prefix'
5
+ */
6
+ export declare function getPathPrefix(): string;
7
+ export declare function normalizePathPrefix(prefix: string): string;
8
+ export declare function addLeadingSlash(url: string): string;
9
+ export declare function removeTrailingSlash(url: string): string;
10
+ export declare function getGlobMatcher(glob: string, options?: {}): (file: string) => boolean;
@@ -0,0 +1,111 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ interface IconProps {
5
+ type: 'warning' | 'success' | 'danger' | 'attention' | 'info';
6
+ className?: string;
7
+ }
8
+
9
+ function Icon({ type, className }: IconProps) {
10
+ switch (type) {
11
+ case 'warning':
12
+ return (
13
+ <svg
14
+ className={className}
15
+ xmlns="http://www.w3.org/2000/svg"
16
+ version="1.1"
17
+ id="Layer_1"
18
+ x="0"
19
+ y="0"
20
+ viewBox="0 0 500.6 500.6"
21
+ enableBackground="new 0 0 500.6 500.6"
22
+ >
23
+ <path d="M250.3 15.1c-132.5 0-239.8 107.2-239.8 239.8 0 132.5 107.2 239.8 239.8 239.8 132.5 0 239.8-107.2 239.8-239.8C490.1 122.3 382.8 15.1 250.3 15.1zM250.3 457.1C138.5 457.1 48 366.7 48 254.8 48 143 138.5 52.5 250.3 52.5c111.8 0 202.3 90.5 202.3 202.3C452.6 366.7 362.1 457.1 250.3 457.1z" />
24
+ <path d="M250.3 135.8c-10.3 0-18.7 8.4-18.7 18.7v120.6c0 10.3 8.4 18.7 18.7 18.7s18.7-8.4 18.7-18.7V154.5C269 144.2 260.7 135.8 250.3 135.8z" />
25
+ <circle cx="250.3" cy="342.1" r="25.3" />
26
+ </svg>
27
+ );
28
+ case 'success':
29
+ return (
30
+ <svg
31
+ className={className}
32
+ xmlns="http://www.w3.org/2000/svg"
33
+ version="1.1"
34
+ id="Layer_1"
35
+ x="0"
36
+ y="0"
37
+ viewBox="0 0 500.6 500.6"
38
+ enableBackground="new 0 0 500.6 500.6"
39
+ >
40
+ <path d="M250.3 490.1c132.5 0 239.8-107.2 239.8-239.8 0-132.5-107.2-239.8-239.8-239.8 -132.5 0-239.8 107.2-239.8 239.8C10.6 382.8 117.8 490.1 250.3 490.1zM250.3 48c111.8 0 202.3 90.5 202.3 202.3 0 111.8-90.5 202.3-202.3 202.3C138.5 452.6 48 362.1 48 250.3 48 138.5 138.5 48 250.3 48z" />
41
+ <path d="M224.7 349.6c8.5 5.9 20.2 3.8 26.1-4.6L355 195.7c5.9-8.5 3.8-20.2-4.6-26.1s-20.2-3.8-26.1 4.6L220 323.5C214.1 332 216.2 343.7 224.7 349.6z" />
42
+ <path d="M247.1 346.2c7.3-7.3 7.3-19.2 0-26.5l-55.9-55.9c-7.3-7.3-19.2-7.3-26.5 0s-7.3 19.2 0 26.5l55.9 55.9C228 353.5 239.8 353.5 247.1 346.2z" />
43
+ </svg>
44
+ );
45
+ case 'danger':
46
+ return (
47
+ <svg
48
+ className={className}
49
+ xmlns="http://www.w3.org/2000/svg"
50
+ version="1.1"
51
+ id="Layer_1"
52
+ x="0"
53
+ y="0"
54
+ viewBox="0 0 500.6 500.6"
55
+ enableBackground="new 0 0 500.6 500.6"
56
+ >
57
+ <path d="M250.3 490.1c132.5 0 239.8-107.2 239.8-239.8 0-132.5-107.2-239.8-239.8-239.8 -132.5 0-239.8 107.2-239.8 239.8C10.6 382.8 117.8 490.1 250.3 490.1zM250.3 48c111.8 0 202.3 90.5 202.3 202.3 0 111.8-90.5 202.3-202.3 202.3C138.5 452.6 48 362.1 48 250.3 48 138.5 138.5 48 250.3 48z" />
58
+ <path d="M168.4 332.2c7.3 7.3 19.2 7.3 26.5 0l137.3-137.3c7.3-7.3 7.3-19.2 0-26.5 -7.3-7.3-19.2-7.3-26.5 0L168.4 305.7C161.1 313 161.1 324.9 168.4 332.2z" />
59
+ <path d="M168.4 168.4c-7.3 7.3-7.3 19.2 0 26.5l137.3 137.3c7.3 7.3 19.2 7.3 26.5 0 7.3-7.3 7.3-19.2 0-26.5L194.9 168.4C187.6 161.1 175.7 161.1 168.4 168.4z" />
60
+ </svg>
61
+ );
62
+ case 'attention':
63
+ return (
64
+ <svg
65
+ className={className}
66
+ xmlns="http://www.w3.org/2000/svg"
67
+ version="1.1"
68
+ id="Layer_1"
69
+ x="0"
70
+ y="0"
71
+ viewBox="0 0 500.6 500.6"
72
+ enableBackground="new 0 0 500.6 500.6"
73
+ >
74
+ <path d="M250.3 301.8c-8.3 0-15-6.7-15-15V181.9c0-8.3 6.7-15 15-15 8.3 0 15 6.7 15 15v104.9C265.3 295.1 258.6 301.8 250.3 301.8zM483.7 377L297.2 66.1c-21.2-35.3-72.6-35.4-93.8 0L16.9 377c-17.6 29.4 3.6 67.1 38 67.1h390.8C480.1 444.1 501.4 406.4 483.7 377L483.7 377zM445.7 414.1H54.9c-11.2 0-18-12.2-12.3-21.7L229.1 81.5c9.6-16 32.8-16 42.4 0L458 392.4C463.7 401.9 456.9 414.1 445.7 414.1z" />
75
+ <circle cx="250.3" cy="339.2" r="22.5" />
76
+ </svg>
77
+ );
78
+ default:
79
+ return (
80
+ <svg
81
+ className={className}
82
+ xmlns="http://www.w3.org/2000/svg"
83
+ version="1.1"
84
+ id="Layer_1"
85
+ x="0"
86
+ y="0"
87
+ viewBox="0 0 500.6 500.6"
88
+ enableBackground="new 0 0 500.6 500.6"
89
+ >
90
+ <path d="M250.3 490.7c132.5 0 239.8-107.2 239.8-239.8 0-132.5-107.2-239.8-239.8-239.8 -132.5 0-239.8 107.2-239.8 239.8C10.6 383.5 117.8 490.7 250.3 490.7zM250.3 48.6c111.8 0 202.3 90.5 202.3 202.3 0 111.8-90.5 202.3-202.3 202.3C138.5 453.2 48 362.7 48 250.9 48 139.1 138.5 48.6 250.3 48.6z" />
91
+ <path d="M250.3 370c10.3 0 18.7-8.4 18.7-18.7V230.6c0-10.3-8.4-18.7-18.7-18.7 -10.3 0-18.7 8.4-18.7 18.7v120.6C231.6 361.6 240 370 250.3 370z" />
92
+ <circle cx="250.3" cy="163.7" r="25.3" />
93
+ </svg>
94
+ );
95
+ }
96
+ }
97
+
98
+ export const AlertIcon = styled(Icon).attrs(() => ({
99
+ 'data-component-name': 'ui/AlertIcon',
100
+ }))`
101
+ position: absolute;
102
+ left: var(--admonition-padding-horizontal);
103
+ top: 50%;
104
+ transform: translateY(-50%);
105
+ width: var(--admonition-icon-size);
106
+ height: var(--admonition-icon-size);
107
+ margin-right: var(--admonition-padding-horizontal);
108
+ flex-shrink: 0;
109
+
110
+ fill: ${({ type }) => `var(--admonition-${type}-icon-color)`};
111
+ `;
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ export interface ArrowProps {
5
+ direction?: string;
6
+ }
7
+
8
+ function directionToTransform({ direction }: ArrowProps) {
9
+ switch (direction) {
10
+ case 'up':
11
+ return 180;
12
+ case 'right':
13
+ return -90;
14
+ case 'left':
15
+ return 90;
16
+ default:
17
+ return 0;
18
+ }
19
+ }
20
+
21
+ const Icon = ({ className }: { className?: string }) => (
22
+ <span data-component-name="ui/Arrow/Arrow">
23
+ <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 7 5" className={className}>
24
+ <path d="M3.5 2.51L5.806.205a.7.7 0 01.99.99l-2.8 2.8a.698.698 0 01-.99 0l-2.8-2.8a.7.7 0 11.99-.99L3.5 2.51z" />
25
+ </svg>
26
+ </span>
27
+ );
28
+
29
+ export const Arrow = styled(Icon)`
30
+ width: var(--sidebar-chevron-size);
31
+ height: var(--sidebar-chevron-size);
32
+ fill: var(--sidebar-chevron-color);
33
+ transform: rotate(${directionToTransform}deg);
34
+
35
+ vertical-align: middle;
36
+ `;
@@ -0,0 +1,16 @@
1
+ import styled from 'styled-components';
2
+
3
+ import { Flex } from '@theme/ui/Flex';
4
+
5
+ export const Background = styled(Flex).attrs(() => ({
6
+ 'data-component-name': 'ui/Background',
7
+ }))`
8
+ background: var(--navbar-background-color);
9
+ color: var(--navbar-text-color);
10
+ font-family: var(--h-font-family);
11
+
12
+ a:not([role='button']),
13
+ a:not([role='button']):hover {
14
+ color: var(--navbar-text-color);
15
+ }
16
+ `;
package/src/ui/Box.tsx ADDED
@@ -0,0 +1,39 @@
1
+ import {
2
+ space,
3
+ position,
4
+ flex,
5
+ textAlign,
6
+ color,
7
+ border,
8
+ layout,
9
+ SpaceProps,
10
+ LayoutProps,
11
+ TextAlignProps,
12
+ ColorProps,
13
+ PositionProps,
14
+ FlexProps,
15
+ BordersProps,
16
+ } from 'styled-system';
17
+ import styled from 'styled-components';
18
+
19
+ export interface BoxProps
20
+ extends SpaceProps,
21
+ LayoutProps,
22
+ PositionProps,
23
+ FlexProps,
24
+ TextAlignProps,
25
+ ColorProps,
26
+ BordersProps {}
27
+
28
+ export const Box = styled.div.attrs(() => ({
29
+ 'data-component-name': 'ui/Box',
30
+ }))<BoxProps>`
31
+ max-width: 100%;
32
+ ${space}
33
+ ${layout}
34
+ ${position}
35
+ ${flex}
36
+ ${textAlign}
37
+ ${color}
38
+ ${border}
39
+ `;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { LinkProps } from 'react-router-dom';
3
+
4
+ import { Button as RefDocsButton, ButtonProps } from '@theme/Button';
5
+ import { Link } from '@portal/Link';
6
+
7
+ const StyledButtonAsLink = RefDocsButton.withComponent(Link);
8
+
9
+ export function Button(
10
+ props: ButtonProps & Partial<LinkProps<never>> & { ref?: any; external?: boolean },
11
+ ): JSX.Element {
12
+ if (props.to) {
13
+ return <StyledButtonAsLink {...props} role="button" data-component-name="ui/Button" />;
14
+ } else {
15
+ return (
16
+ <RefDocsButton {...(props as ButtonProps)} role="button" data-component-name="ui/Button" />
17
+ );
18
+ }
19
+ }