@apify/ui-library 1.138.0 → 1.138.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/README.md +3 -3
  2. package/dist/src/components/action_link.d.ts.map +1 -1
  3. package/dist/src/components/action_link.js +3 -3
  4. package/dist/src/components/action_link.js.map +1 -1
  5. package/dist/src/components/actor_template_card.d.ts.map +1 -1
  6. package/dist/src/components/actor_template_card.js +3 -3
  7. package/dist/src/components/actor_template_card.js.map +1 -1
  8. package/dist/src/components/avatar/actor_avatar.d.ts.map +1 -1
  9. package/dist/src/components/avatar/actor_avatar.js +3 -3
  10. package/dist/src/components/avatar/actor_avatar.js.map +1 -1
  11. package/dist/src/components/avatar/boring_avatar.d.ts.map +1 -1
  12. package/dist/src/components/avatar/boring_avatar.js +8 -7
  13. package/dist/src/components/avatar/boring_avatar.js.map +1 -1
  14. package/dist/src/components/avatar/user_avatar.d.ts.map +1 -1
  15. package/dist/src/components/avatar/user_avatar.js +1 -1
  16. package/dist/src/components/avatar/user_avatar.js.map +1 -1
  17. package/dist/src/components/badge.d.ts.map +1 -1
  18. package/dist/src/components/badge.js +10 -3
  19. package/dist/src/components/badge.js.map +1 -1
  20. package/dist/src/components/banner.d.ts.map +1 -1
  21. package/dist/src/components/banner.js +4 -3
  22. package/dist/src/components/banner.js.map +1 -1
  23. package/dist/src/components/blog_article.d.ts.map +1 -1
  24. package/dist/src/components/blog_article.js +2 -3
  25. package/dist/src/components/blog_article.js.map +1 -1
  26. package/dist/src/components/box.d.ts.map +1 -1
  27. package/dist/src/components/box.js +32 -24
  28. package/dist/src/components/box.js.map +1 -1
  29. package/dist/src/components/breadcrumb/breadcrumb.d.ts.map +1 -1
  30. package/dist/src/components/breadcrumb/breadcrumb.js +1 -1
  31. package/dist/src/components/breadcrumb/breadcrumb.js.map +1 -1
  32. package/dist/src/components/button.d.ts.map +1 -1
  33. package/dist/src/components/button.js +12 -9
  34. package/dist/src/components/button.js.map +1 -1
  35. package/dist/src/components/card_container.d.ts.map +1 -1
  36. package/dist/src/components/card_container.js +5 -3
  37. package/dist/src/components/card_container.js.map +1 -1
  38. package/dist/src/components/checkbox/checkbox.d.ts.map +1 -1
  39. package/dist/src/components/checkbox/checkbox.js +1 -1
  40. package/dist/src/components/checkbox/checkbox.js.map +1 -1
  41. package/dist/src/components/checkbox/checkbox.style.d.ts.map +1 -1
  42. package/dist/src/components/checkbox/checkbox.style.js +7 -4
  43. package/dist/src/components/checkbox/checkbox.style.js.map +1 -1
  44. package/dist/src/components/chip.d.ts.map +1 -1
  45. package/dist/src/components/chip.js +1 -1
  46. package/dist/src/components/chip.js.map +1 -1
  47. package/dist/src/components/code/action_button.d.ts.map +1 -1
  48. package/dist/src/components/code/action_button.js +5 -5
  49. package/dist/src/components/code/action_button.js.map +1 -1
  50. package/dist/src/components/code/code_block/code_block.d.ts.map +1 -1
  51. package/dist/src/components/code/code_block/code_block.js +19 -8
  52. package/dist/src/components/code/code_block/code_block.js.map +1 -1
  53. package/dist/src/components/code/code_block/code_block.styled.d.ts.map +1 -1
  54. package/dist/src/components/code/code_block/code_block.styled.js +18 -15
  55. package/dist/src/components/code/code_block/code_block.styled.js.map +1 -1
  56. package/dist/src/components/code/code_block/code_block_with_tabs.d.ts.map +1 -1
  57. package/dist/src/components/code/code_block/code_block_with_tabs.js +10 -8
  58. package/dist/src/components/code/code_block/code_block_with_tabs.js.map +1 -1
  59. package/dist/src/components/code/code_block/utils.d.ts.map +1 -1
  60. package/dist/src/components/code/code_block/utils.js.map +1 -1
  61. package/dist/src/components/code/inline_code/inline_code.d.ts.map +1 -1
  62. package/dist/src/components/code/inline_code/inline_code.js +2 -2
  63. package/dist/src/components/code/inline_code/inline_code.js.map +1 -1
  64. package/dist/src/components/code/one_light_theme.d.ts.map +1 -1
  65. package/dist/src/components/code/one_light_theme.js +2 -17
  66. package/dist/src/components/code/one_light_theme.js.map +1 -1
  67. package/dist/src/components/code/one_line_code/one_line_code.d.ts.map +1 -1
  68. package/dist/src/components/code/one_line_code/one_line_code.js +11 -14
  69. package/dist/src/components/code/one_line_code/one_line_code.js.map +1 -1
  70. package/dist/src/components/code/prism_highlighter.d.ts.map +1 -1
  71. package/dist/src/components/code/prism_highlighter.js +35 -27
  72. package/dist/src/components/code/prism_highlighter.js.map +1 -1
  73. package/dist/src/components/code/prism_python.js.map +1 -1
  74. package/dist/src/components/collapsible_card/collapsible_card.d.ts.map +1 -1
  75. package/dist/src/components/collapsible_card/collapsible_card.js +7 -6
  76. package/dist/src/components/collapsible_card/collapsible_card.js.map +1 -1
  77. package/dist/src/components/color_wheel_gradient.d.ts.map +1 -1
  78. package/dist/src/components/color_wheel_gradient.js +4 -2
  79. package/dist/src/components/color_wheel_gradient.js.map +1 -1
  80. package/dist/src/components/floating/floating_component_base.d.ts +1 -1
  81. package/dist/src/components/floating/floating_component_base.d.ts.map +1 -1
  82. package/dist/src/components/floating/floating_component_base.js +3 -5
  83. package/dist/src/components/floating/floating_component_base.js.map +1 -1
  84. package/dist/src/components/floating/menu.d.ts.map +1 -1
  85. package/dist/src/components/floating/menu.js +11 -5
  86. package/dist/src/components/floating/menu.js.map +1 -1
  87. package/dist/src/components/floating/menu_common.d.ts +4 -4
  88. package/dist/src/components/floating/menu_common.d.ts.map +1 -1
  89. package/dist/src/components/floating/menu_common.js +1 -1
  90. package/dist/src/components/floating/menu_common.js.map +1 -1
  91. package/dist/src/components/floating/menu_components.d.ts.map +1 -1
  92. package/dist/src/components/floating/menu_components.js +9 -7
  93. package/dist/src/components/floating/menu_components.js.map +1 -1
  94. package/dist/src/components/floating/tooltip.d.ts +2 -2
  95. package/dist/src/components/floating/tooltip.d.ts.map +1 -1
  96. package/dist/src/components/floating/tooltip.js +10 -9
  97. package/dist/src/components/floating/tooltip.js.map +1 -1
  98. package/dist/src/components/floating/tooltip_content.d.ts.map +1 -1
  99. package/dist/src/components/floating/tooltip_content.js +3 -3
  100. package/dist/src/components/floating/tooltip_content.js.map +1 -1
  101. package/dist/src/components/icon_button.d.ts.map +1 -1
  102. package/dist/src/components/icon_button.js +10 -8
  103. package/dist/src/components/icon_button.js.map +1 -1
  104. package/dist/src/components/image.d.ts.map +1 -1
  105. package/dist/src/components/image.js +1 -1
  106. package/dist/src/components/image.js.map +1 -1
  107. package/dist/src/components/link.d.ts.map +1 -1
  108. package/dist/src/components/link.js +5 -5
  109. package/dist/src/components/link.js.map +1 -1
  110. package/dist/src/components/message.d.ts.map +1 -1
  111. package/dist/src/components/message.js +21 -21
  112. package/dist/src/components/message.js.map +1 -1
  113. package/dist/src/components/rating.d.ts.map +1 -1
  114. package/dist/src/components/rating.js +5 -6
  115. package/dist/src/components/rating.js.map +1 -1
  116. package/dist/src/components/readme_renderer/pythonize_value.d.ts.map +1 -1
  117. package/dist/src/components/readme_renderer/pythonize_value.js +10 -6
  118. package/dist/src/components/readme_renderer/pythonize_value.js.map +1 -1
  119. package/dist/src/components/readme_renderer/table_of_contents.d.ts.map +1 -1
  120. package/dist/src/components/readme_renderer/table_of_contents.js +16 -15
  121. package/dist/src/components/readme_renderer/table_of_contents.js.map +1 -1
  122. package/dist/src/components/readme_renderer/utils.d.ts.map +1 -1
  123. package/dist/src/components/readme_renderer/utils.js +6 -6
  124. package/dist/src/components/readme_renderer/utils.js.map +1 -1
  125. package/dist/src/components/select/select.d.ts.map +1 -1
  126. package/dist/src/components/select/select.js +14 -13
  127. package/dist/src/components/select/select.js.map +1 -1
  128. package/dist/src/components/shortcut.d.ts +1 -1
  129. package/dist/src/components/shortcut.d.ts.map +1 -1
  130. package/dist/src/components/shortcut.js +2 -2
  131. package/dist/src/components/shortcut.js.map +1 -1
  132. package/dist/src/components/simple_markdown/simple_markdown.d.ts.map +1 -1
  133. package/dist/src/components/simple_markdown/simple_markdown.js +32 -35
  134. package/dist/src/components/simple_markdown/simple_markdown.js.map +1 -1
  135. package/dist/src/components/simple_markdown/simple_markdown_components.d.ts.map +1 -1
  136. package/dist/src/components/simple_markdown/simple_markdown_components.js +26 -12
  137. package/dist/src/components/simple_markdown/simple_markdown_components.js.map +1 -1
  138. package/dist/src/components/spinner.d.ts.map +1 -1
  139. package/dist/src/components/spinner.js +3 -1
  140. package/dist/src/components/spinner.js.map +1 -1
  141. package/dist/src/components/store/store_actor_header.d.ts.map +1 -1
  142. package/dist/src/components/store/store_actor_header.js +1 -1
  143. package/dist/src/components/store/store_actor_header.js.map +1 -1
  144. package/dist/src/components/switch/switch.d.ts.map +1 -1
  145. package/dist/src/components/switch/switch.js +1 -1
  146. package/dist/src/components/switch/switch.js.map +1 -1
  147. package/dist/src/components/switch/switch.style.d.ts.map +1 -1
  148. package/dist/src/components/switch/switch.style.js +5 -3
  149. package/dist/src/components/switch/switch.style.js.map +1 -1
  150. package/dist/src/components/table/table.styled.js +3 -3
  151. package/dist/src/components/table/table.styled.js.map +1 -1
  152. package/dist/src/components/table/table_error_row.d.ts.map +1 -1
  153. package/dist/src/components/table/table_error_row.js +1 -1
  154. package/dist/src/components/table/table_error_row.js.map +1 -1
  155. package/dist/src/components/table/table_row.d.ts.map +1 -1
  156. package/dist/src/components/table/table_row.js +1 -1
  157. package/dist/src/components/table/table_row.js.map +1 -1
  158. package/dist/src/components/table/table_wrapper.d.ts.map +1 -1
  159. package/dist/src/components/table/table_wrapper.js +3 -3
  160. package/dist/src/components/table/table_wrapper.js.map +1 -1
  161. package/dist/src/components/tabs/tab.d.ts.map +1 -1
  162. package/dist/src/components/tabs/tab.js +7 -5
  163. package/dist/src/components/tabs/tab.js.map +1 -1
  164. package/dist/src/components/tabs/tabs.d.ts.map +1 -1
  165. package/dist/src/components/tabs/tabs.js +3 -3
  166. package/dist/src/components/tabs/tabs.js.map +1 -1
  167. package/dist/src/components/tag.d.ts +1 -1
  168. package/dist/src/components/tag.d.ts.map +1 -1
  169. package/dist/src/components/tag.js +1 -1
  170. package/dist/src/components/tag.js.map +1 -1
  171. package/dist/src/components/text/heading_content.d.ts.map +1 -1
  172. package/dist/src/components/text/heading_content.js +1 -1
  173. package/dist/src/components/text/heading_content.js.map +1 -1
  174. package/dist/src/components/text/heading_marketing.d.ts.map +1 -1
  175. package/dist/src/components/text/heading_marketing.js +1 -1
  176. package/dist/src/components/text/heading_marketing.js.map +1 -1
  177. package/dist/src/components/text/heading_shared.d.ts.map +1 -1
  178. package/dist/src/components/text/heading_shared.js +1 -1
  179. package/dist/src/components/text/heading_shared.js.map +1 -1
  180. package/dist/src/components/text/index.d.ts +1 -1
  181. package/dist/src/components/text/index.d.ts.map +1 -1
  182. package/dist/src/components/text/text_base.d.ts.map +1 -1
  183. package/dist/src/components/text/text_base.js +16 -12
  184. package/dist/src/components/text/text_base.js.map +1 -1
  185. package/dist/src/components/text/text_content.d.ts.map +1 -1
  186. package/dist/src/components/text/text_content.js +1 -1
  187. package/dist/src/components/text/text_content.js.map +1 -1
  188. package/dist/src/components/text/text_marketing.d.ts.map +1 -1
  189. package/dist/src/components/text/text_marketing.js +1 -1
  190. package/dist/src/components/text/text_marketing.js.map +1 -1
  191. package/dist/src/components/text/text_shared.d.ts +1 -1
  192. package/dist/src/components/text/text_shared.d.ts.map +1 -1
  193. package/dist/src/components/text/text_shared.js +1 -1
  194. package/dist/src/components/text/text_shared.js.map +1 -1
  195. package/dist/src/components/tile/horizontal_tile.d.ts.map +1 -1
  196. package/dist/src/components/tile/horizontal_tile.js +3 -2
  197. package/dist/src/components/tile/horizontal_tile.js.map +1 -1
  198. package/dist/src/components/tile/shared.d.ts +1 -1
  199. package/dist/src/components/tile/shared.d.ts.map +1 -1
  200. package/dist/src/components/tile/vertical_tile.d.ts.map +1 -1
  201. package/dist/src/components/tile/vertical_tile.js +3 -2
  202. package/dist/src/components/tile/vertical_tile.js.map +1 -1
  203. package/dist/src/components/to_consolidate/card.d.ts.map +1 -1
  204. package/dist/src/components/to_consolidate/card.js +20 -15
  205. package/dist/src/components/to_consolidate/card.js.map +1 -1
  206. package/dist/src/components/to_consolidate/markdown.d.ts.map +1 -1
  207. package/dist/src/components/to_consolidate/markdown.js +36 -20
  208. package/dist/src/components/to_consolidate/markdown.js.map +1 -1
  209. package/dist/src/components/to_consolidate/pagination.d.ts.map +1 -1
  210. package/dist/src/components/to_consolidate/pagination.js +6 -6
  211. package/dist/src/components/to_consolidate/pagination.js.map +1 -1
  212. package/dist/src/components/to_consolidate/tab_number_chip.d.ts.map +1 -1
  213. package/dist/src/components/to_consolidate/tab_number_chip.js +1 -1
  214. package/dist/src/components/to_consolidate/tab_number_chip.js.map +1 -1
  215. package/dist/src/design_system/theme.d.ts.map +1 -1
  216. package/dist/src/design_system/theme.js +1 -1
  217. package/dist/src/design_system/theme.js.map +1 -1
  218. package/dist/src/design_system/typography_theme.d.ts.map +1 -1
  219. package/dist/src/design_system/typography_theme.js.map +1 -1
  220. package/dist/src/ui_dependency_provider.d.ts.map +1 -1
  221. package/dist/src/ui_dependency_provider.js +2 -2
  222. package/dist/src/ui_dependency_provider.js.map +1 -1
  223. package/dist/tsconfig.build.tsbuildinfo +1 -1
  224. package/package.json +8 -6
  225. package/src/codemods/generate_typograpy_tokens_files.mjs +23 -28
  226. package/src/components/action_link.tsx +13 -23
  227. package/src/components/actor_template_card.stories.tsx +20 -14
  228. package/src/components/actor_template_card.tsx +4 -21
  229. package/src/components/avatar/actor_avatar.tsx +3 -4
  230. package/src/components/avatar/boring_avatar.tsx +134 -167
  231. package/src/components/avatar/user_avatar.stories.tsx +1 -5
  232. package/src/components/avatar/user_avatar.tsx +6 -20
  233. package/src/components/badge.stories.jsx +26 -40
  234. package/src/components/badge.tsx +37 -26
  235. package/src/components/banner.stories.tsx +10 -28
  236. package/src/components/banner.tsx +11 -14
  237. package/src/components/blog_article.tsx +6 -4
  238. package/src/components/box.tsx +90 -89
  239. package/src/components/breadcrumb/breadcrumb.stories.tsx +2 -8
  240. package/src/components/breadcrumb/breadcrumb.tsx +7 -5
  241. package/src/components/button.stories.tsx +70 -66
  242. package/src/components/button.tsx +33 -39
  243. package/src/components/card_container.stories.tsx +28 -29
  244. package/src/components/card_container.tsx +15 -10
  245. package/src/components/checkbox/checkbox.stories.tsx +52 -17
  246. package/src/components/checkbox/checkbox.style.ts +7 -4
  247. package/src/components/checkbox/checkbox.tsx +6 -9
  248. package/src/components/chip.stories.tsx +15 -5
  249. package/src/components/chip.tsx +26 -16
  250. package/src/components/code/action_button.tsx +10 -12
  251. package/src/components/code/code_block/code_block.stories.jsx +7 -25
  252. package/src/components/code/code_block/code_block.styled.tsx +26 -19
  253. package/src/components/code/code_block/code_block.tsx +26 -24
  254. package/src/components/code/code_block/code_block_with_tabs.stories.tsx +12 -18
  255. package/src/components/code/code_block/code_block_with_tabs.tsx +30 -16
  256. package/src/components/code/code_block/utils.tsx +23 -15
  257. package/src/components/code/inline_code/inline_code.stories.tsx +18 -10
  258. package/src/components/code/inline_code/inline_code.tsx +16 -21
  259. package/src/components/code/one_light_theme.ts +2 -17
  260. package/src/components/code/one_line_code/one_line_code.stories.tsx +31 -19
  261. package/src/components/code/one_line_code/one_line_code.tsx +19 -30
  262. package/src/components/code/prism_highlighter.tsx +117 -109
  263. package/src/components/code/prism_python.ts +4 -2
  264. package/src/components/collapsible_card/collapsible_card.stories.tsx +2 -1
  265. package/src/components/collapsible_card/collapsible_card.tsx +30 -15
  266. package/src/components/color_wheel_gradient.tsx +9 -7
  267. package/src/components/floating/floating_component_base.tsx +16 -9
  268. package/src/components/floating/menu.tsx +37 -46
  269. package/src/components/floating/menu_common.tsx +24 -30
  270. package/src/components/floating/menu_components.tsx +24 -24
  271. package/src/components/floating/tooltip.stories.jsx +85 -68
  272. package/src/components/floating/tooltip.tsx +32 -39
  273. package/src/components/floating/tooltip_content.tsx +8 -16
  274. package/src/components/icon_button.stories.tsx +176 -188
  275. package/src/components/icon_button.tsx +72 -58
  276. package/src/components/image.tsx +5 -11
  277. package/src/components/link.stories.tsx +4 -2
  278. package/src/components/link.tsx +70 -70
  279. package/src/components/message.stories.jsx +35 -33
  280. package/src/components/message.tsx +45 -45
  281. package/src/components/rating.tsx +37 -44
  282. package/src/components/readme_renderer/pythonize_value.ts +19 -7
  283. package/src/components/readme_renderer/table_of_contents.stories.tsx +40 -15
  284. package/src/components/readme_renderer/table_of_contents.tsx +87 -85
  285. package/src/components/readme_renderer/utils.tsx +17 -13
  286. package/src/components/select/select.stories.tsx +19 -46
  287. package/src/components/select/select.tsx +103 -101
  288. package/src/components/shortcut.stories.jsx +23 -14
  289. package/src/components/shortcut.tsx +2 -13
  290. package/src/components/simple_markdown/simple_markdown.stories.tsx +5 -10
  291. package/src/components/simple_markdown/simple_markdown.tsx +152 -55
  292. package/src/components/simple_markdown/simple_markdown_components.tsx +49 -59
  293. package/src/components/spinner.stories.tsx +14 -8
  294. package/src/components/spinner.tsx +5 -3
  295. package/src/components/store/store_actor_header.stories.tsx +2 -11
  296. package/src/components/store/store_actor_header.tsx +20 -16
  297. package/src/components/switch/switch.stories.jsx +4 -12
  298. package/src/components/switch/switch.style.ts +5 -3
  299. package/src/components/switch/switch.tsx +3 -13
  300. package/src/components/table/table.stories.tsx +5 -2
  301. package/src/components/table/table.styled.ts +3 -3
  302. package/src/components/table/table_error_row.tsx +5 -1
  303. package/src/components/table/table_row.tsx +1 -5
  304. package/src/components/table/table_wrapper.tsx +12 -12
  305. package/src/components/tabs/tab.stories.tsx +1 -5
  306. package/src/components/tabs/tab.tsx +33 -13
  307. package/src/components/tabs/tabs.tsx +14 -18
  308. package/src/components/tag.stories.jsx +35 -45
  309. package/src/components/tag.tsx +18 -22
  310. package/src/components/text/heading_content.stories.tsx +13 -24
  311. package/src/components/text/heading_content.tsx +3 -7
  312. package/src/components/text/heading_marketing.stories.tsx +4 -3
  313. package/src/components/text/heading_marketing.tsx +12 -8
  314. package/src/components/text/heading_shared.stories.tsx +3 -2
  315. package/src/components/text/heading_shared.tsx +3 -7
  316. package/src/components/text/index.ts +1 -3
  317. package/src/components/text/text_base.tsx +29 -35
  318. package/src/components/text/text_content.stories.tsx +17 -13
  319. package/src/components/text/text_content.tsx +20 -23
  320. package/src/components/text/text_marketing.stories.tsx +4 -3
  321. package/src/components/text/text_marketing.tsx +20 -23
  322. package/src/components/text/text_shared.stories.tsx +4 -3
  323. package/src/components/text/text_shared.tsx +23 -27
  324. package/src/components/tile/horizontal_tile.stories.tsx +6 -2
  325. package/src/components/tile/horizontal_tile.tsx +5 -15
  326. package/src/components/tile/shared.ts +5 -5
  327. package/src/components/tile/vertical_tile.stories.tsx +10 -18
  328. package/src/components/tile/vertical_tile.tsx +4 -9
  329. package/src/components/to_consolidate/card.stories.tsx +3 -1
  330. package/src/components/to_consolidate/card.tsx +67 -58
  331. package/src/components/to_consolidate/markdown.tsx +76 -62
  332. package/src/components/to_consolidate/pagination.tsx +11 -15
  333. package/src/components/to_consolidate/tab_number_chip.tsx +5 -6
  334. package/src/design_system/colors/build_color_tokens.js +7 -15
  335. package/src/design_system/theme.ts +1 -8
  336. package/src/design_system/tokens/radiuses.stories.tsx +9 -1
  337. package/src/design_system/tokens/shadows.stories.tsx +3 -1
  338. package/src/design_system/typography_theme.ts +78 -39
  339. package/src/ui_dependency_provider.tsx +16 -23
@@ -34,7 +34,9 @@ const StoryWrapper = styled.div`
34
34
  const ContentArea = styled.div`
35
35
  padding: 2rem;
36
36
 
37
- h1, h2, h3 {
37
+ h1,
38
+ h2,
39
+ h3 {
38
40
  margin-top: 3rem;
39
41
  margin-bottom: 1rem;
40
42
  }
@@ -285,7 +287,9 @@ export const Default: Story = {
285
287
  <TOCContainer>
286
288
  <TableOfContents {...args} />
287
289
  </TOCContainer>
288
- <ContentArea dangerouslySetInnerHTML={{ __html: `
290
+ <ContentArea
291
+ dangerouslySetInnerHTML={{
292
+ __html: `
289
293
  <h1 id="getting-started">Getting Started</h1>
290
294
  <p>This is the introduction section with some content.</p>
291
295
 
@@ -312,7 +316,9 @@ export const Default: Story = {
312
316
 
313
317
  <h2 id="api-reference">API Reference</h2>
314
318
  <p>Details about the API.</p>
315
- ` }} />
319
+ `,
320
+ }}
321
+ />
316
322
  </StoryWrapper>
317
323
  ),
318
324
  };
@@ -329,7 +335,9 @@ export const WithoutH1Heading: Story = {
329
335
  <TOCContainer>
330
336
  <TableOfContents {...args} />
331
337
  </TOCContainer>
332
- <ContentArea dangerouslySetInnerHTML={{ __html: `
338
+ <ContentArea
339
+ dangerouslySetInnerHTML={{
340
+ __html: `
333
341
  <h2 id="overview">Overview</h2>
334
342
  <p>This document starts with H2 headings.</p>
335
343
 
@@ -350,7 +358,9 @@ export const WithoutH1Heading: Story = {
350
358
 
351
359
  <h3 id="steps">Steps</h3>
352
360
  <p>Installation steps.</p>
353
- ` }} />
361
+ `,
362
+ }}
363
+ />
354
364
  </StoryWrapper>
355
365
  ),
356
366
  };
@@ -369,8 +379,8 @@ export const ManySection: Story = {
369
379
  </TOCContainer>
370
380
  <ContentArea>
371
381
  <p style={{ marginBottom: '2rem' }}>
372
- Scroll down to see the table of contents highlighting different sections.
373
- The TOC stays sticky while scrolling through content.
382
+ Scroll down to see the table of contents highlighting different sections. The TOC stays sticky while
383
+ scrolling through content.
374
384
  </p>
375
385
  {Array.from({ length: 7 }, (_, i) => (
376
386
  <div key={i}>
@@ -378,10 +388,17 @@ export const ManySection: Story = {
378
388
  <p>Content for section {i + 1}.</p>
379
389
  {Array.from({ length: 3 }, (__, j) => (
380
390
  <div key={j}>
381
- <h3 id={`subsection-${i + 1}-${j + 1}`}>Subsection {i + 1}.{j + 1}</h3>
382
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
383
- Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
384
- <p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
391
+ <h3 id={`subsection-${i + 1}-${j + 1}`}>
392
+ Subsection {i + 1}.{j + 1}
393
+ </h3>
394
+ <p>
395
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor
396
+ incididunt ut labore et dolore magna aliqua.
397
+ </p>
398
+ <p>
399
+ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
400
+ ex ea commodo consequat.
401
+ </p>
385
402
  </div>
386
403
  ))}
387
404
  </div>
@@ -403,7 +420,9 @@ export const WithCodeInHeadings: Story = {
403
420
  <TOCContainer>
404
421
  <TableOfContents {...args} />
405
422
  </TOCContainer>
406
- <ContentArea dangerouslySetInnerHTML={{ __html: `
423
+ <ContentArea
424
+ dangerouslySetInnerHTML={{
425
+ __html: `
407
426
  <h1 id="api-documentation">API Documentation</h1>
408
427
  <p>Documentation with code examples in headings.</p>
409
428
 
@@ -427,7 +446,9 @@ export const WithCodeInHeadings: Story = {
427
446
 
428
447
  <h2 id="usage-examples">Usage Examples</h2>
429
448
  <p>How to use the API.</p>
430
- ` }} />
449
+ `,
450
+ }}
451
+ />
431
452
  </StoryWrapper>
432
453
  ),
433
454
  };
@@ -444,7 +465,9 @@ export const SimpleFlat: Story = {
444
465
  <TOCContainer>
445
466
  <TableOfContents {...args} />
446
467
  </TOCContainer>
447
- <ContentArea dangerouslySetInnerHTML={{ __html: `
468
+ <ContentArea
469
+ dangerouslySetInnerHTML={{
470
+ __html: `
448
471
  <h1 id="quick-start">Quick Start</h1>
449
472
  <p>A simple document.</p>
450
473
 
@@ -456,7 +479,9 @@ export const SimpleFlat: Story = {
456
479
 
457
480
  <h2 id="step-3">Step 3</h2>
458
481
  <p>Third step.</p>
459
- ` }} />
482
+ `,
483
+ }}
484
+ />
460
485
  </StoryWrapper>
461
486
  ),
462
487
  };
@@ -1,8 +1,5 @@
1
1
  import _ from 'lodash';
2
- import React, {
3
- useCallback,
4
- useMemo,
5
- } from 'react';
2
+ import React, { useCallback, useMemo } from 'react';
6
3
  import ReactMarkdown, { type AllowElement } from 'react-markdown';
7
4
  import remarkToc from 'remark-toc';
8
5
  import styled from 'styled-components';
@@ -13,7 +10,8 @@ import { Link } from '../link.js';
13
10
  import { Text } from '../text/index.js';
14
11
  import { cleanMarkdown, slugifyHeadingChildren } from './utils.js';
15
12
 
16
- export const useShowTableOfContents = (markdown: string | null | undefined) => useMemo(() => markdown && !!markdown.match(/^(#{1,3})\s.+$/m), [markdown]);
13
+ export const useShowTableOfContents = (markdown: string | null | undefined) =>
14
+ useMemo(() => markdown && !!markdown.match(/^(#{1,3})\s.+$/m), [markdown]);
17
15
 
18
16
  const TOC_HEADING_ID = 'Contents';
19
17
 
@@ -29,12 +27,13 @@ const StyledTOCLink = styled(Text)`
29
27
  font-weight: inherit !important;
30
28
  }
31
29
 
32
- &:hover, &.selected {
30
+ &:hover,
31
+ &.selected {
33
32
  color: ${theme.color.primary.text} !important;
34
33
  }
35
34
 
36
35
  &:before {
37
- content: " ";
36
+ content: ' ';
38
37
  display: inline-block;
39
38
  height: 100%;
40
39
  left: 0;
@@ -71,7 +70,7 @@ const StyledTableOfContents = styled.div`
71
70
  padding-left: ${theme.space.space16} !important;
72
71
  max-height: 0;
73
72
  overflow: hidden;
74
- transition: all .3s ease-in-out;
73
+ transition: all 0.3s ease-in-out;
75
74
 
76
75
  &.expanded {
77
76
  max-height: 1000px;
@@ -92,7 +91,12 @@ interface CustomHTMLAnchorElement extends Omit<HTMLAnchorElement, 'children' | '
92
91
  parentNode: any;
93
92
  }
94
93
 
95
- const handleScroll = (anchors: CustomHTMLAnchorElement[], headlines: HTMLElement[], anchorLists: HTMLUListElement[] | null, headingOffsetPx: number) => {
94
+ const handleScroll = (
95
+ anchors: CustomHTMLAnchorElement[],
96
+ headlines: HTMLElement[],
97
+ anchorLists: HTMLUListElement[] | null,
98
+ headingOffsetPx: number,
99
+ ) => {
96
100
  if (!anchors || !headlines) return;
97
101
 
98
102
  // Items that are past scroll
@@ -101,7 +105,8 @@ const handleScroll = (anchors: CustomHTMLAnchorElement[], headlines: HTMLElement
101
105
  });
102
106
 
103
107
  // Last item that is past the scroll is current in view. If no headline is past the scroll, let's select the first one
104
- const currentHeadlineId = headlinesPastScrollPosition[headlinesPastScrollPosition.length - 1]?.id || headlines[0]?.id;
108
+ const currentHeadlineId =
109
+ headlinesPastScrollPosition[headlinesPastScrollPosition.length - 1]?.id || headlines[0]?.id;
105
110
 
106
111
  // Highlighting anchor of current headline
107
112
  if (currentHeadlineId) {
@@ -121,7 +126,11 @@ const handleScroll = (anchors: CustomHTMLAnchorElement[], headlines: HTMLElement
121
126
  // by tag and className of neighboring nodes. There are two cases:
122
127
 
123
128
  // 1) If h2 is selected, we want to expand its section with h3 headings
124
- if (grandparent?.tagName === 'LI' && grandparent.children[1]?.tagName === 'UL' && grandparent.children[1]?.classList.contains('level-3')) {
129
+ if (
130
+ grandparent?.tagName === 'LI' &&
131
+ grandparent.children[1]?.tagName === 'UL' &&
132
+ grandparent.children[1]?.classList.contains('level-3')
133
+ ) {
125
134
  grandparent.children[1].classList.add('expanded');
126
135
  }
127
136
 
@@ -141,9 +150,9 @@ const assignHeadingLevelsRecursively = (
141
150
  properties,
142
151
  }: {
143
152
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
144
- children: any[],
145
- tagName: string,
146
- properties: { className: string }
153
+ children: any[];
154
+ tagName: string;
155
+ properties: { className: string };
147
156
  },
148
157
  level: number,
149
158
  ) => {
@@ -170,12 +179,7 @@ export interface TableOfContentsProps {
170
179
  allowElement?: AllowElement;
171
180
  }
172
181
 
173
- const TableOfContentsComponent = ({
174
- markdown,
175
- headingOffsetPx = 10,
176
- allowElement,
177
- ...rest
178
- }: TableOfContentsProps) => {
182
+ const TableOfContentsComponent = ({ markdown, headingOffsetPx = 10, allowElement, ...rest }: TableOfContentsProps) => {
179
183
  const cleanedMarkdown = useMemo(() => {
180
184
  const cleanedMarkdownString = cleanMarkdown(markdown);
181
185
  return `### ${TOC_HEADING_ID}\n${cleanedMarkdownString}`;
@@ -183,23 +187,26 @@ const TableOfContentsComponent = ({
183
187
 
184
188
  const hasTopLevelHeading = useMemo(() => !!cleanedMarkdown.match(/^#\s.+$/m), [cleanedMarkdown]);
185
189
 
186
- const tocRef = useCallback((node: HTMLElement | null) => {
187
- const anchors = node ? Array.from(node.querySelectorAll('a')) : [];
188
- const anchorLists = node ? Array.from(node.querySelectorAll('ul')) : null;
189
- const headlines = (anchors)
190
- .map((anchor) => document.getElementById(anchor.hash.substr(1)))
191
- .filter((headline) => headline !== undefined && headline !== null) as HTMLElement[];
192
-
193
- const scrollHandler = () => handleScroll(anchors, headlines, anchorLists, headingOffsetPx);
194
-
195
- // Callback refs cannot return cleanup functions - but they are called again with null on unmount
196
- if (node) {
197
- window.addEventListener('scroll', scrollHandler);
198
- } else {
199
- window.removeEventListener('scroll', scrollHandler);
200
- }
201
- scrollHandler(); // call for the first time so we select the first heading without scrolling
202
- }, [headingOffsetPx]);
190
+ const tocRef = useCallback(
191
+ (node: HTMLElement | null) => {
192
+ const anchors = node ? Array.from(node.querySelectorAll('a')) : [];
193
+ const anchorLists = node ? Array.from(node.querySelectorAll('ul')) : null;
194
+ const headlines = anchors
195
+ .map((anchor) => document.getElementById(anchor.hash.substr(1)))
196
+ .filter((headline) => headline !== undefined && headline !== null) as HTMLElement[];
197
+
198
+ const scrollHandler = () => handleScroll(anchors, headlines, anchorLists, headingOffsetPx);
199
+
200
+ // Callback refs cannot return cleanup functions - but they are called again with null on unmount
201
+ if (node) {
202
+ window.addEventListener('scroll', scrollHandler);
203
+ } else {
204
+ window.removeEventListener('scroll', scrollHandler);
205
+ }
206
+ scrollHandler(); // call for the first time so we select the first heading without scrolling
207
+ },
208
+ [headingOffsetPx],
209
+ );
203
210
 
204
211
  return (
205
212
  <StyledTableOfContents ref={tocRef} {...rest}>
@@ -207,65 +214,58 @@ const TableOfContentsComponent = ({
207
214
  allowElement={allowElement}
208
215
  remarkPlugins={[
209
216
  [remarkToc, { heading: TOC_HEADING_ID, maxDepth: 3 }],
210
- () => ({ children, ...nodeRest }) => {
211
- // TOC plug-ins only inject content table to existing markdown documents - only generating it is not a common use-case
212
- // To make is happen, we can just take the generated node where toc is located and throw away the rest.
213
- // children[0] is the heading where toc is placed (that's plug-in's requirement)
214
- // children[1] is the generated table of contents we can simply pick
215
-
216
- let tocContentNode = children[1];
217
-
218
- // If there is no H1 heading in the readme then assignHeadingLevelsRecursively does not work correctly.
219
- // We need to 'normalize' the final node to have all the levels we expect
220
- // - solution is to wrap the content in extra node that mimic this H1 group that remarkToc would normally create
221
- if (!hasTopLevelHeading) {
222
- tocContentNode = {
223
- type: 'list',
224
- ordered: false,
225
- spread: false,
226
- children: [
227
- {
228
- type: 'listItem',
229
- spread: true,
230
- children: [
231
- tocContentNode,
232
- ],
233
- },
234
- ],
217
+ () =>
218
+ ({ children, ...nodeRest }) => {
219
+ // TOC plug-ins only inject content table to existing markdown documents - only generating it is not a common use-case
220
+ // To make is happen, we can just take the generated node where toc is located and throw away the rest.
221
+ // children[0] is the heading where toc is placed (that's plug-in's requirement)
222
+ // children[1] is the generated table of contents we can simply pick
223
+
224
+ let tocContentNode = children[1];
225
+
226
+ // If there is no H1 heading in the readme then assignHeadingLevelsRecursively does not work correctly.
227
+ // We need to 'normalize' the final node to have all the levels we expect
228
+ // - solution is to wrap the content in extra node that mimic this H1 group that remarkToc would normally create
229
+ if (!hasTopLevelHeading) {
230
+ tocContentNode = {
231
+ type: 'list',
232
+ ordered: false,
233
+ spread: false,
234
+ children: [
235
+ {
236
+ type: 'listItem',
237
+ spread: true,
238
+ children: [tocContentNode],
239
+ },
240
+ ],
241
+ };
242
+ }
243
+
244
+ return {
245
+ ...nodeRest,
246
+ children: [tocContentNode],
235
247
  };
236
- }
237
-
238
- return {
239
- ...nodeRest,
240
- children: [
241
- tocContentNode,
242
- ],
243
- };
248
+ },
249
+ ]}
250
+ rehypePlugins={[
251
+ () => (input) => {
252
+ // this plug-in already works with html node representation so we can assign classNames that we need
253
+ // in order to allow hiding blocks with h3 headings that are out of the viewport
254
+ assignHeadingLevelsRecursively(input.children[0], 1);
255
+ return input;
244
256
  },
245
257
  ]}
246
- rehypePlugins={[() => (input) => {
247
- // this plug-in already works with html node representation so we can assign classNames that we need
248
- // in order to allow hiding blocks with h3 headings that are out of the viewport
249
- assignHeadingLevelsRecursively(input.children[0], 1);
250
- return input;
251
- }]}
252
258
  components={{
253
259
  a: ({ children }) => {
254
260
  const { search } = window.location;
255
261
  const hash = `#${slugifyHeadingChildren(children)}`;
256
262
  return (
257
- <StyledTOCLink
258
- forwardedAs={Link}
259
- to={`${search}${hash}`}
260
- py={'space4'}
261
- >
263
+ <StyledTOCLink forwardedAs={Link} to={`${search}${hash}`} py={'space4'}>
262
264
  {children}
263
265
  </StyledTOCLink>
264
266
  );
265
267
  },
266
- code: ({ children }) => (
267
- <code className="inline-code">{children}</code>
268
- ),
268
+ code: ({ children }) => <code className="inline-code">{children}</code>,
269
269
  }}
270
270
  >
271
271
  {cleanedMarkdown}
@@ -274,4 +274,6 @@ const TableOfContentsComponent = ({
274
274
  );
275
275
  };
276
276
 
277
- export const TableOfContents = React.memo(TableOfContentsComponent, (prevProps, nextProps) => _.isEqual(prevProps, nextProps));
277
+ export const TableOfContents = React.memo(TableOfContentsComponent, (prevProps, nextProps) =>
278
+ _.isEqual(prevProps, nextProps),
279
+ );
@@ -2,9 +2,7 @@ import React, { type ReactElement, type ReactNode, useCallback } from 'react';
2
2
  import type { AllowElement } from 'react-markdown';
3
3
  import slugify from 'slugify';
4
4
 
5
- export const slugifyHeadingChildren = (
6
- headingChildren: React.ReactNode,
7
- ): string | undefined => {
5
+ export const slugifyHeadingChildren = (headingChildren: React.ReactNode): string | undefined => {
8
6
  if (!headingChildren) return undefined;
9
7
 
10
8
  const slugs: string[] = [];
@@ -38,14 +36,20 @@ export const cleanMarkdown = (markdown: string, removeFirstH1?: boolean): string
38
36
  // This removes the first element if it's a `h1` containing exactly the Actor title
39
37
  // Allows undefined `actorTitle` for ease of use.
40
38
  export const useActorTitleHeadingFilter = (actorTitle: string | undefined): AllowElement => {
41
- return useCallback((element, index, parent) => {
42
- if (!actorTitle) return true;
43
- if (parent?.type === 'root'
44
- && index === 0
45
- && element.tagName === 'h1'
46
- && element.children.length === 1
47
- && element.children[0].type === 'text'
48
- && element.children[0].value?.toLowerCase() === actorTitle.toLowerCase()) return false;
49
- return true;
50
- }, [actorTitle]);
39
+ return useCallback(
40
+ (element, index, parent) => {
41
+ if (!actorTitle) return true;
42
+ if (
43
+ parent?.type === 'root' &&
44
+ index === 0 &&
45
+ element.tagName === 'h1' &&
46
+ element.children.length === 1 &&
47
+ element.children[0].type === 'text' &&
48
+ element.children[0].value?.toLowerCase() === actorTitle.toLowerCase()
49
+ )
50
+ return false;
51
+ return true;
52
+ },
53
+ [actorTitle],
54
+ );
51
55
  };
@@ -15,62 +15,35 @@ const Grid = styled.div`
15
15
  grid-template-columns: repeat(2, auto);
16
16
  gap: 1rem 5rem;
17
17
 
18
- input{
18
+ input {
19
19
  width: 100%;
20
20
  }
21
21
  `;
22
22
 
23
- const options = [{ label: 'Ahoj', value: 1 }, { label: 'Ondro!', value: 2 }, { label: '🚲', value: 3 }];
23
+ const options = [
24
+ { label: 'Ahoj', value: 1 },
25
+ { label: 'Ondro!', value: 2 },
26
+ { label: '🚲', value: 3 },
27
+ ];
24
28
 
25
29
  export const SelectPrimitive = () => {
26
30
  const [multiValue, setMultiValue] = useState([1, 2]);
27
31
  const [value, setValue] = useState(1);
28
32
  return (
29
33
  <Grid>
30
- <Select options={options} value={value} setValue={setValue}/> <p>singleValue</p>
31
- <Select isMulti
32
- options={options}
33
- value={multiValue}
34
- setValue={setMultiValue}
35
- /> <p>multiValue</p>
36
- <Select isMulti
37
- error='test Error'
38
- options={options}
39
- value={multiValue}
40
- setValue={setMultiValue}
41
- /> <p>multiValue error</p>
42
- <Select isMulti
43
- disabled
44
- options={options}
45
- value={multiValue}
46
- setValue={setMultiValue}
47
- /> <p>multiValue disabled</p>
48
- <Select options={options}
49
- value={value}
50
- setValue={setValue}
51
- indicatorsSlot={<EyeIcon size="16" />}
52
- /> <p>withIcons</p>
53
- <Select options={options}
54
- value={value}
55
- setValue={setValue}
56
- disabled={true}
57
- /> <p>disabled</p>
58
- <Select options={options}
59
- value={value}
60
- setValue={setValue}
61
- placeholder="Placeholder"
62
- /> <p>placeholder</p>
63
- <Select options={options}
64
- value={value}
65
- setValue={setValue}
66
- error={true}
67
- placeholder='Error select'
68
- /> <p>error</p>
69
- <Select options={options}
70
- value={null}
71
- setValue={setValue}
72
- placeholder='Placeholder'
73
- /> <p>placeholder</p>
34
+ <Select options={options} value={value} setValue={setValue} /> <p>singleValue</p>
35
+ <Select isMulti options={options} value={multiValue} setValue={setMultiValue} /> <p>multiValue</p>
36
+ <Select isMulti error="test Error" options={options} value={multiValue} setValue={setMultiValue} />{' '}
37
+ <p>multiValue error</p>
38
+ <Select isMulti disabled options={options} value={multiValue} setValue={setMultiValue} />{' '}
39
+ <p>multiValue disabled</p>
40
+ <Select options={options} value={value} setValue={setValue} indicatorsSlot={<EyeIcon size="16" />} />{' '}
41
+ <p>withIcons</p>
42
+ <Select options={options} value={value} setValue={setValue} disabled={true} /> <p>disabled</p>
43
+ <Select options={options} value={value} setValue={setValue} placeholder="Placeholder" /> <p>placeholder</p>
44
+ <Select options={options} value={value} setValue={setValue} error={true} placeholder="Error select" />{' '}
45
+ <p>error</p>
46
+ <Select options={options} value={null} setValue={setValue} placeholder="Placeholder" /> <p>placeholder</p>
74
47
  </Grid>
75
48
  );
76
49
  };