@node-core/ui-components 1.0.1-ab0ba1dcb1d91392c44e91b1e74e9f565e460543 → 1.0.1-b2d4fae0fc29bf3aeebacb37572f47a0a81dd8ed

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 (328) hide show
  1. package/Common/AlertBox/index.js +5 -0
  2. package/Common/AlertBox/index.module.css +2 -0
  3. package/Common/AvatarGroup/Avatar/index.js +11 -0
  4. package/Common/AvatarGroup/Avatar/index.module.css +2 -0
  5. package/Common/AvatarGroup/Overlay/index.js +6 -0
  6. package/Common/AvatarGroup/Overlay/index.module.css +2 -0
  7. package/Common/AvatarGroup/index.js +21 -0
  8. package/Common/AvatarGroup/index.module.css +2 -0
  9. package/Common/Badge/index.js +5 -0
  10. package/Common/Badge/index.module.css +2 -0
  11. package/Common/BadgeGroup/index.js +6 -0
  12. package/Common/BadgeGroup/index.module.css +2 -0
  13. package/Common/Banner/index.js +4 -0
  14. package/Common/Banner/index.module.css +2 -0
  15. package/Common/BaseActiveLink/index.js +14 -0
  16. package/Common/BaseButton/index.js +10 -0
  17. package/Common/BaseButton/index.module.css +2 -0
  18. package/Common/BaseCodeBox/index.js +50 -0
  19. package/Common/BaseCodeBox/index.module.css +2 -0
  20. package/Common/BaseCrossLink/index.js +12 -0
  21. package/Common/BaseCrossLink/index.module.css +2 -0
  22. package/Common/BaseLinkTabs/index.js +5 -0
  23. package/Common/BaseLinkTabs/index.module.css +2 -0
  24. package/Common/BasePagination/Ellipsis/index.js +4 -0
  25. package/Common/BasePagination/Ellipsis/index.module.css +2 -0
  26. package/Common/BasePagination/PaginationListItem/index.js +6 -0
  27. package/Common/BasePagination/PaginationListItem/index.module.css +2 -0
  28. package/Common/BasePagination/PrevNextArrow.js +7 -0
  29. package/Common/BasePagination/index.js +10 -0
  30. package/Common/BasePagination/index.module.css +2 -0
  31. package/Common/BasePagination/useGetPageElements.js +77 -0
  32. package/Common/Blockquote/index.js +4 -0
  33. package/Common/Blockquote/index.module.css +2 -0
  34. package/Common/Breadcrumbs/BreadcrumbHomeLink/index.js +9 -0
  35. package/Common/Breadcrumbs/BreadcrumbHomeLink/index.module.css +2 -0
  36. package/Common/Breadcrumbs/BreadcrumbItem/index.js +6 -0
  37. package/Common/Breadcrumbs/BreadcrumbItem/index.module.css +2 -0
  38. package/Common/Breadcrumbs/BreadcrumbLink/index.js +5 -0
  39. package/Common/Breadcrumbs/BreadcrumbLink/index.module.css +2 -0
  40. package/Common/Breadcrumbs/BreadcrumbRoot/index.js +4 -0
  41. package/Common/Breadcrumbs/BreadcrumbRoot/index.module.css +2 -0
  42. package/Common/Breadcrumbs/BreadcrumbTruncatedItem/index.js +4 -0
  43. package/Common/Breadcrumbs/index.js +22 -0
  44. package/Common/ChangeHistory/index.js +9 -0
  45. package/Common/ChangeHistory/index.module.css +2 -0
  46. package/Common/CodeTabs/index.js +5 -0
  47. package/Common/CodeTabs/index.module.css +2 -0
  48. package/Common/DataTag/index.js +18 -0
  49. package/Common/DataTag/index.module.css +2 -0
  50. package/Common/GlowingBackdrop/index.js +5 -0
  51. package/Common/GlowingBackdrop/index.module.css +2 -0
  52. package/Common/LanguageDropDown/index.js +11 -0
  53. package/Common/LanguageDropDown/index.module.css +2 -0
  54. package/Common/Modal/index.js +10 -0
  55. package/Common/Modal/index.module.css +2 -0
  56. package/Common/NodejsLogo/index.js +7 -0
  57. package/Common/NodejsLogo/index.module.css +2 -0
  58. package/Common/Notification/index.js +6 -0
  59. package/Common/Notification/index.module.css +2 -0
  60. package/Common/Preview/index.js +7 -0
  61. package/Common/Preview/index.module.css +2 -0
  62. package/Common/Select/index.js +47 -0
  63. package/Common/Select/index.module.css +2 -0
  64. package/Common/Separator/index.js +7 -0
  65. package/Common/Separator/index.module.css +2 -0
  66. package/Common/Skeleton/index.js +18 -0
  67. package/Common/Skeleton/index.module.css +2 -0
  68. package/Common/Tabs/index.js +6 -0
  69. package/Common/Tabs/index.module.css +2 -0
  70. package/Common/ThemeToggle/index.js +7 -0
  71. package/Common/ThemeToggle/index.module.css +2 -0
  72. package/Common/Tooltip/index.js +8 -0
  73. package/Common/Tooltip/index.module.css +2 -0
  74. package/Containers/Article/index.js +4 -0
  75. package/Containers/Article/index.module.css +2 -0
  76. package/Containers/Footer/index.js +21 -0
  77. package/Containers/Footer/index.module.css +2 -0
  78. package/Containers/MetaBar/index.js +12 -0
  79. package/Containers/MetaBar/index.module.css +2 -0
  80. package/Containers/NavBar/NavItem/index.js +7 -0
  81. package/Containers/NavBar/NavItem/index.module.css +2 -0
  82. package/Containers/NavBar/index.js +18 -0
  83. package/Containers/NavBar/index.module.css +2 -0
  84. package/Containers/Sidebar/ProgressionIcon/index.js +3 -0
  85. package/Containers/Sidebar/SidebarGroup/index.js +9 -0
  86. package/Containers/Sidebar/SidebarGroup/index.module.css +2 -0
  87. package/Containers/Sidebar/SidebarItem/index.js +11 -0
  88. package/Containers/Sidebar/SidebarItem/index.module.css +2 -0
  89. package/Containers/Sidebar/index.js +15 -0
  90. package/Containers/Sidebar/index.module.css +2 -0
  91. package/Icons/HexagonGrid.js +3 -0
  92. package/Icons/InstallationMethod/Choco.js +3 -0
  93. package/Icons/InstallationMethod/Devbox.js +3 -0
  94. package/Icons/InstallationMethod/Docker.js +3 -0
  95. package/Icons/InstallationMethod/FNM.js +3 -0
  96. package/Icons/InstallationMethod/Homebrew.js +3 -0
  97. package/Icons/InstallationMethod/N.js +5 -0
  98. package/Icons/InstallationMethod/NVM.js +3 -0
  99. package/Icons/InstallationMethod/Volta.js +3 -0
  100. package/{src/Icons/InstallationMethod/index.ts → Icons/InstallationMethod/index.js} +0 -1
  101. package/Icons/Logos/JsWhite.js +3 -0
  102. package/Icons/Logos/Nodejs.js +12 -0
  103. package/Icons/Logos/index.js +3 -0
  104. package/Icons/OperatingSystem/AIX.js +3 -0
  105. package/Icons/OperatingSystem/Apple.js +3 -0
  106. package/Icons/OperatingSystem/Linux.js +3 -0
  107. package/Icons/OperatingSystem/Microsoft.js +3 -0
  108. package/{src/Icons/OperatingSystem/index.ts → Icons/OperatingSystem/index.js} +0 -1
  109. package/Icons/PackageManager/Npm.js +3 -0
  110. package/Icons/PackageManager/Pnpm.js +3 -0
  111. package/Icons/PackageManager/Yarn.js +3 -0
  112. package/{src/Icons/PackageManager/index.ts → Icons/PackageManager/index.js} +0 -1
  113. package/Icons/Social/Bluesky.js +3 -0
  114. package/Icons/Social/Discord.js +3 -0
  115. package/Icons/Social/GitHub.js +3 -0
  116. package/Icons/Social/LinkedIn.js +3 -0
  117. package/Icons/Social/Mastodon.js +3 -0
  118. package/Icons/Social/Slack.js +3 -0
  119. package/Icons/Social/X.js +3 -0
  120. package/{src/Icons/Social/index.ts → Icons/Social/index.js} +0 -1
  121. package/MDX/CodeTabs.js +25 -0
  122. package/Providers/NotificationProvider/index.js +16 -0
  123. package/Providers/NotificationProvider/index.module.css +2 -0
  124. package/package.json +5 -41
  125. package/stylelint/one-utility-class-per-line.mjs +48 -0
  126. package/{src/stylelint → stylelint}/utils.mjs +19 -25
  127. package/styles/index.css +2 -0
  128. package/types.js +1 -0
  129. package/.lintstagedrc.json +0 -5
  130. package/.postcssrc.json +0 -6
  131. package/.storybook/constants.ts +0 -28
  132. package/.storybook/main.ts +0 -38
  133. package/.storybook/preview-head.html +0 -20
  134. package/.storybook/preview.tsx +0 -32
  135. package/.stylelintignore +0 -1
  136. package/.stylelintrc.mjs +0 -56
  137. package/__design__/colors.stories.tsx +0 -82
  138. package/__design__/effects.stories.tsx +0 -7
  139. package/__design__/font-family.stories.tsx +0 -76
  140. package/__design__/list.stories.tsx +0 -27
  141. package/__design__/node-logos.stories.tsx +0 -61
  142. package/__design__/platform-logos.stories.tsx +0 -31
  143. package/__design__/social-logos.stories.tsx +0 -33
  144. package/__design__/table.stories.tsx +0 -56
  145. package/__design__/text.stories.tsx +0 -100
  146. package/eslint.config.js +0 -61
  147. package/src/Common/AlertBox/index.module.css +0 -83
  148. package/src/Common/AlertBox/index.stories.tsx +0 -96
  149. package/src/Common/AlertBox/index.tsx +0 -24
  150. package/src/Common/AvatarGroup/Avatar/index.module.css +0 -40
  151. package/src/Common/AvatarGroup/Avatar/index.stories.tsx +0 -22
  152. package/src/Common/AvatarGroup/Avatar/index.tsx +0 -67
  153. package/src/Common/AvatarGroup/Overlay/index.module.css +0 -31
  154. package/src/Common/AvatarGroup/Overlay/index.stories.tsx +0 -33
  155. package/src/Common/AvatarGroup/Overlay/index.tsx +0 -37
  156. package/src/Common/AvatarGroup/__tests__/index.test.jsx +0 -55
  157. package/src/Common/AvatarGroup/index.module.css +0 -21
  158. package/src/Common/AvatarGroup/index.stories.tsx +0 -56
  159. package/src/Common/AvatarGroup/index.tsx +0 -83
  160. package/src/Common/Badge/index.module.css +0 -38
  161. package/src/Common/Badge/index.stories.tsx +0 -38
  162. package/src/Common/Badge/index.tsx +0 -35
  163. package/src/Common/BadgeGroup/index.module.css +0 -77
  164. package/src/Common/BadgeGroup/index.stories.tsx +0 -35
  165. package/src/Common/BadgeGroup/index.tsx +0 -35
  166. package/src/Common/Banner/index.module.css +0 -42
  167. package/src/Common/Banner/index.stories.tsx +0 -29
  168. package/src/Common/Banner/index.tsx +0 -18
  169. package/src/Common/BaseActiveLink/__tests__/index.test.jsx +0 -52
  170. package/src/Common/BaseActiveLink/index.tsx +0 -34
  171. package/src/Common/BaseButton/index.module.css +0 -145
  172. package/src/Common/BaseButton/index.stories.tsx +0 -67
  173. package/src/Common/BaseButton/index.tsx +0 -59
  174. package/src/Common/BaseCodeBox/index.module.css +0 -78
  175. package/src/Common/BaseCodeBox/index.stories.tsx +0 -39
  176. package/src/Common/BaseCodeBox/index.tsx +0 -122
  177. package/src/Common/BaseCrossLink/index.module.css +0 -51
  178. package/src/Common/BaseCrossLink/index.stories.tsx +0 -38
  179. package/src/Common/BaseCrossLink/index.tsx +0 -46
  180. package/src/Common/BaseLinkTabs/index.module.css +0 -43
  181. package/src/Common/BaseLinkTabs/index.stories.tsx +0 -34
  182. package/src/Common/BaseLinkTabs/index.tsx +0 -53
  183. package/src/Common/BasePagination/Ellipsis/index.module.css +0 -10
  184. package/src/Common/BasePagination/Ellipsis/index.stories.tsx +0 -10
  185. package/src/Common/BasePagination/Ellipsis/index.tsx +0 -11
  186. package/src/Common/BasePagination/PaginationListItem/__tests__/index.test.jsx +0 -58
  187. package/src/Common/BasePagination/PaginationListItem/index.module.css +0 -27
  188. package/src/Common/BasePagination/PaginationListItem/index.stories.tsx +0 -40
  189. package/src/Common/BasePagination/PaginationListItem/index.tsx +0 -39
  190. package/src/Common/BasePagination/PrevNextArrow.tsx +0 -15
  191. package/src/Common/BasePagination/__tests__/index.test.jsx +0 -180
  192. package/src/Common/BasePagination/index.module.css +0 -39
  193. package/src/Common/BasePagination/index.stories.tsx +0 -67
  194. package/src/Common/BasePagination/index.tsx +0 -77
  195. package/src/Common/BasePagination/useGetPageElements.tsx +0 -132
  196. package/src/Common/Blockquote/index.module.css +0 -29
  197. package/src/Common/Blockquote/index.stories.tsx +0 -45
  198. package/src/Common/Blockquote/index.tsx +0 -11
  199. package/src/Common/Breadcrumbs/BreadcrumbHomeLink/index.module.css +0 -5
  200. package/src/Common/Breadcrumbs/BreadcrumbHomeLink/index.tsx +0 -30
  201. package/src/Common/Breadcrumbs/BreadcrumbItem/index.module.css +0 -41
  202. package/src/Common/Breadcrumbs/BreadcrumbItem/index.tsx +0 -42
  203. package/src/Common/Breadcrumbs/BreadcrumbLink/index.module.css +0 -22
  204. package/src/Common/Breadcrumbs/BreadcrumbLink/index.tsx +0 -37
  205. package/src/Common/Breadcrumbs/BreadcrumbRoot/index.module.css +0 -9
  206. package/src/Common/Breadcrumbs/BreadcrumbRoot/index.tsx +0 -20
  207. package/src/Common/Breadcrumbs/BreadcrumbTruncatedItem/index.tsx +0 -9
  208. package/src/Common/Breadcrumbs/index.stories.tsx +0 -94
  209. package/src/Common/Breadcrumbs/index.tsx +0 -81
  210. package/src/Common/ChangeHistory/index.module.css +0 -83
  211. package/src/Common/ChangeHistory/index.stories.tsx +0 -130
  212. package/src/Common/ChangeHistory/index.tsx +0 -67
  213. package/src/Common/CodeTabs/index.module.css +0 -56
  214. package/src/Common/CodeTabs/index.stories.tsx +0 -73
  215. package/src/Common/CodeTabs/index.tsx +0 -16
  216. package/src/Common/DataTag/index.module.css +0 -56
  217. package/src/Common/DataTag/index.stories.tsx +0 -40
  218. package/src/Common/DataTag/index.tsx +0 -39
  219. package/src/Common/GlowingBackdrop/index.module.css +0 -32
  220. package/src/Common/GlowingBackdrop/index.stories.tsx +0 -10
  221. package/src/Common/GlowingBackdrop/index.tsx +0 -13
  222. package/src/Common/LanguageDropDown/index.module.css +0 -53
  223. package/src/Common/LanguageDropDown/index.stories.tsx +0 -19
  224. package/src/Common/LanguageDropDown/index.tsx +0 -56
  225. package/src/Common/Modal/index.module.css +0 -79
  226. package/src/Common/Modal/index.stories.tsx +0 -34
  227. package/src/Common/Modal/index.tsx +0 -50
  228. package/src/Common/NodejsLogo/index.module.css +0 -6
  229. package/src/Common/NodejsLogo/index.stories.tsx +0 -14
  230. package/src/Common/NodejsLogo/index.tsx +0 -26
  231. package/src/Common/Notification/index.module.css +0 -20
  232. package/src/Common/Notification/index.stories.tsx +0 -36
  233. package/src/Common/Notification/index.tsx +0 -34
  234. package/src/Common/Preview/index.module.css +0 -79
  235. package/src/Common/Preview/index.stories.tsx +0 -44
  236. package/src/Common/Preview/index.tsx +0 -25
  237. package/src/Common/Select/__tests__/index.test.jsx +0 -67
  238. package/src/Common/Select/index.module.css +0 -161
  239. package/src/Common/Select/index.stories.tsx +0 -111
  240. package/src/Common/Select/index.tsx +0 -187
  241. package/src/Common/Separator/index.module.css +0 -16
  242. package/src/Common/Separator/index.stories.tsx +0 -32
  243. package/src/Common/Separator/index.tsx +0 -27
  244. package/src/Common/Skeleton/index.module.css +0 -30
  245. package/src/Common/Skeleton/index.tsx +0 -39
  246. package/src/Common/Tabs/__tests__/index.test.jsx +0 -52
  247. package/src/Common/Tabs/index.module.css +0 -54
  248. package/src/Common/Tabs/index.stories.tsx +0 -50
  249. package/src/Common/Tabs/index.tsx +0 -54
  250. package/src/Common/ThemeToggle/__tests__/index.test.jsx +0 -35
  251. package/src/Common/ThemeToggle/index.module.css +0 -15
  252. package/src/Common/ThemeToggle/index.stories.tsx +0 -10
  253. package/src/Common/ThemeToggle/index.tsx +0 -15
  254. package/src/Common/Tooltip/index.module.css +0 -43
  255. package/src/Common/Tooltip/index.stories.tsx +0 -73
  256. package/src/Common/Tooltip/index.tsx +0 -48
  257. package/src/Containers/Article/index.module.css +0 -70
  258. package/src/Containers/Article/index.stories.tsx +0 -39
  259. package/src/Containers/Article/index.tsx +0 -9
  260. package/src/Containers/DocSideBar/index.tsx +0 -0
  261. package/src/Containers/Footer/index.module.css +0 -46
  262. package/src/Containers/Footer/index.stories.tsx +0 -27
  263. package/src/Containers/Footer/index.tsx +0 -95
  264. package/src/Containers/MetaBar/__tests__/index.test.jsx +0 -63
  265. package/src/Containers/MetaBar/index.module.css +0 -91
  266. package/src/Containers/MetaBar/index.stories.tsx +0 -80
  267. package/src/Containers/MetaBar/index.tsx +0 -72
  268. package/src/Containers/NavBar/NavItem/index.module.css +0 -60
  269. package/src/Containers/NavBar/NavItem/index.stories.tsx +0 -38
  270. package/src/Containers/NavBar/NavItem/index.tsx +0 -44
  271. package/src/Containers/NavBar/index.module.css +0 -125
  272. package/src/Containers/NavBar/index.stories.tsx +0 -45
  273. package/src/Containers/NavBar/index.tsx +0 -94
  274. package/src/Containers/Sidebar/ProgressionIcon/index.tsx +0 -16
  275. package/src/Containers/Sidebar/SidebarGroup/index.module.css +0 -64
  276. package/src/Containers/Sidebar/SidebarGroup/index.stories.tsx +0 -36
  277. package/src/Containers/Sidebar/SidebarGroup/index.tsx +0 -49
  278. package/src/Containers/Sidebar/SidebarItem/index.module.css +0 -56
  279. package/src/Containers/Sidebar/SidebarItem/index.stories.tsx +0 -15
  280. package/src/Containers/Sidebar/SidebarItem/index.tsx +0 -43
  281. package/src/Containers/Sidebar/index.module.css +0 -30
  282. package/src/Containers/Sidebar/index.stories.tsx +0 -88
  283. package/src/Containers/Sidebar/index.tsx +0 -70
  284. package/src/Icons/HexagonGrid.stories.tsx +0 -10
  285. package/src/Icons/HexagonGrid.tsx +0 -1434
  286. package/src/Icons/InstallationMethod/Choco.tsx +0 -78
  287. package/src/Icons/InstallationMethod/Devbox.tsx +0 -21
  288. package/src/Icons/InstallationMethod/Docker.tsx +0 -20
  289. package/src/Icons/InstallationMethod/FNM.tsx +0 -132
  290. package/src/Icons/InstallationMethod/Homebrew.tsx +0 -69
  291. package/src/Icons/InstallationMethod/N.tsx +0 -32
  292. package/src/Icons/InstallationMethod/NVM.tsx +0 -63
  293. package/src/Icons/InstallationMethod/Volta.tsx +0 -34
  294. package/src/Icons/Logos/JsGreen.tsx +0 -24
  295. package/src/Icons/Logos/JsWhite.tsx +0 -37
  296. package/src/Icons/Logos/Nodejs.tsx +0 -372
  297. package/src/Icons/Logos/NodejsStackedBlack.tsx +0 -98
  298. package/src/Icons/Logos/NodejsStackedDark.tsx +0 -124
  299. package/src/Icons/Logos/NodejsStackedLight.tsx +0 -123
  300. package/src/Icons/Logos/NodejsStackedWhite.tsx +0 -98
  301. package/src/Icons/Logos/index.ts +0 -17
  302. package/src/Icons/OperatingSystem/AIX.tsx +0 -46
  303. package/src/Icons/OperatingSystem/Apple.tsx +0 -23
  304. package/src/Icons/OperatingSystem/Linux.tsx +0 -969
  305. package/src/Icons/OperatingSystem/Microsoft.tsx +0 -19
  306. package/src/Icons/PackageManager/Npm.tsx +0 -21
  307. package/src/Icons/PackageManager/Pnpm.tsx +0 -22
  308. package/src/Icons/PackageManager/Yarn.tsx +0 -22
  309. package/src/Icons/Social/Bluesky.tsx +0 -19
  310. package/src/Icons/Social/Discord.tsx +0 -20
  311. package/src/Icons/Social/GitHub.tsx +0 -16
  312. package/src/Icons/Social/LinkedIn.tsx +0 -16
  313. package/src/Icons/Social/Mastodon.tsx +0 -36
  314. package/src/Icons/Social/Slack.tsx +0 -31
  315. package/src/Icons/Social/X.tsx +0 -16
  316. package/src/MDX/CodeTabs.tsx +0 -47
  317. package/src/global.d.ts +0 -4
  318. package/src/stylelint/__tests__/index.test.mjs +0 -80
  319. package/src/stylelint/one-utility-class-per-line.mjs +0 -64
  320. package/src/styles/animations.css +0 -47
  321. package/src/styles/base.css +0 -17
  322. package/src/styles/effects.css +0 -12
  323. package/src/styles/index.css +0 -38
  324. package/src/styles/markdown.css +0 -173
  325. package/src/styles/theme.css +0 -175
  326. package/src/types.ts +0 -25
  327. package/tsconfig.json +0 -20
  328. package/turbo.json +0 -31
@@ -1,29 +0,0 @@
1
- import type { Meta as MetaObj, StoryObj } from '@storybook/react';
2
-
3
- import Banner from '#ui/Common/Banner';
4
-
5
- type Story = StoryObj<typeof Banner>;
6
- type Meta = MetaObj<typeof Banner>;
7
-
8
- export const Default: Story = {
9
- args: {
10
- children: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
11
- type: 'default',
12
- },
13
- };
14
-
15
- export const Error: Story = {
16
- args: {
17
- children: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
18
- type: 'error',
19
- },
20
- };
21
-
22
- export const Warning: Story = {
23
- args: {
24
- children: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
25
- type: 'warning',
26
- },
27
- };
28
-
29
- export default { component: Banner } as Meta;
@@ -1,18 +0,0 @@
1
- import type { FC, PropsWithChildren } from 'react';
2
-
3
- import styles from './index.module.css';
4
-
5
- export type BannerProps = {
6
- type?: 'default' | 'warning' | 'error';
7
- };
8
-
9
- const Banner: FC<PropsWithChildren<BannerProps>> = ({
10
- type = 'default',
11
- children,
12
- }) => (
13
- <div className={`${styles.banner} ${styles[type] || styles.default}`}>
14
- {children}
15
- </div>
16
- );
17
-
18
- export default Banner;
@@ -1,52 +0,0 @@
1
- import { describe, it } from 'node:test';
2
- import assert from 'node:assert/strict';
3
-
4
- import { render, screen } from '@testing-library/react';
5
-
6
- import ActiveLink from '..';
7
-
8
- describe('ActiveLink', () => {
9
- it('renders as localized link', async () => {
10
- render(
11
- <ActiveLink className="link" activeClassName="active" href="/link">
12
- Link
13
- </ActiveLink>
14
- );
15
-
16
- assert.equal(
17
- (await screen.findByText('Link')).getAttribute('href'),
18
- '/link'
19
- );
20
- });
21
-
22
- it('ignores active class when href not matches location.href', async () => {
23
- render(
24
- <ActiveLink className="link" activeClassName="active" href="/not-link">
25
- Link
26
- </ActiveLink>
27
- );
28
-
29
- assert.equal(
30
- (await screen.findByText('Link')).getAttribute('class'),
31
- 'link'
32
- );
33
- });
34
-
35
- it('sets active class when href matches location.href', async () => {
36
- render(
37
- <ActiveLink
38
- className="link"
39
- activeClassName="active"
40
- href="/link"
41
- pathname="/link"
42
- >
43
- Link
44
- </ActiveLink>
45
- );
46
-
47
- assert.equal(
48
- (await screen.findByText('Link')).getAttribute('class'),
49
- 'link active'
50
- );
51
- });
52
- });
@@ -1,34 +0,0 @@
1
- import classNames from 'classnames';
2
- import type { ComponentProps, FC } from 'react';
3
-
4
- import type { LinkLike } from '#ui/types';
5
-
6
- export type ActiveLocalizedLinkProps = ComponentProps<LinkLike> & {
7
- activeClassName?: string;
8
- allowSubPath?: boolean;
9
- pathname?: string;
10
- as?: LinkLike;
11
- };
12
-
13
- const BaseActiveLink: FC<ActiveLocalizedLinkProps> = ({
14
- activeClassName = 'active',
15
- allowSubPath = false,
16
- className,
17
- href = '',
18
- pathname = '/',
19
- as: Component = 'a',
20
- ...props
21
- }) => {
22
- const finalClassName = classNames(className, {
23
- [activeClassName]: allowSubPath
24
- ? // When using allowSubPath we want only to check if
25
- // the current pathname starts with the utmost upper level
26
- // of an href (e.g. /docs/...)
27
- pathname.startsWith(`/${href.toString().split('/')[1]}`)
28
- : href.toString() === pathname,
29
- });
30
-
31
- return <Component className={finalClassName} href={href} {...props} />;
32
- };
33
-
34
- export default BaseActiveLink;
@@ -1,145 +0,0 @@
1
- @reference "../../styles/index.css";
2
-
3
- .button {
4
- @apply px-4.5
5
- relative
6
- inline-flex
7
- items-center
8
- justify-center
9
- gap-2
10
- py-2.5
11
- text-center
12
- font-semibold
13
- motion-safe:transition-colors;
14
-
15
- svg {
16
- @apply size-5;
17
- }
18
-
19
- &[aria-disabled='true'] {
20
- @apply cursor-not-allowed;
21
- }
22
-
23
- &.small {
24
- @apply px-3
25
- py-2
26
- text-sm;
27
- }
28
-
29
- &.neutral {
30
- @apply rounded-sm
31
- bg-neutral-900
32
- text-white
33
- dark:text-neutral-200;
34
-
35
- &:hover:not([aria-disabled='true']) {
36
- @apply bg-neutral-800;
37
- }
38
-
39
- &[aria-disabled='true'] {
40
- @apply bg-neutral-900
41
- opacity-50;
42
- }
43
-
44
- &:focus {
45
- @apply bg-neutral-800;
46
- }
47
- }
48
-
49
- &.primary {
50
- @apply shadow-xs
51
- rounded-sm
52
- border
53
- border-green-600
54
- bg-green-600
55
- text-white;
56
-
57
- &:hover:not([aria-disabled='true']) {
58
- @apply border-green-700
59
- bg-green-700
60
- text-white;
61
- }
62
-
63
- &:focus {
64
- @apply border-green-700
65
- bg-green-700;
66
- }
67
-
68
- &[aria-disabled='true'] {
69
- @apply bg-green-600
70
- opacity-50;
71
- }
72
- }
73
-
74
- &.secondary {
75
- @apply rounded-lg
76
- border
77
- border-neutral-200
78
- text-neutral-800
79
- dark:border-neutral-900
80
- dark:text-neutral-200;
81
-
82
- &:hover:not([aria-disabled='true']) {
83
- @apply bg-neutral-200
84
- text-neutral-800
85
- dark:bg-neutral-900
86
- dark:text-neutral-200;
87
- }
88
-
89
- &[aria-disabled='true'] {
90
- @apply bg-transparent
91
- opacity-50;
92
- }
93
-
94
- &:focus {
95
- @apply bg-neutral-100
96
- text-neutral-800
97
- dark:bg-neutral-900
98
- dark:text-neutral-200;
99
- }
100
- }
101
-
102
- &.special {
103
- @apply before:bg-gradient-glow-backdrop
104
- shadow-xs
105
- rounded-lg
106
- border
107
- border-green-600/30
108
- bg-green-600/10
109
- text-white
110
- before:absolute
111
- before:left-0
112
- before:right-0
113
- before:top-0
114
- before:-z-10
115
- before:mx-auto
116
- before:h-full
117
- before:w-full
118
- before:opacity-30
119
- before:content-['']
120
- after:absolute
121
- after:-top-px
122
- after:left-0
123
- after:right-0
124
- after:mx-auto
125
- after:h-px
126
- after:w-2/5
127
- after:bg-gradient-to-r
128
- after:from-green-600/0
129
- after:via-green-600
130
- after:to-green-600/0
131
- after:content-[''];
132
-
133
- &[aria-disabled='true'] {
134
- @apply opacity-50;
135
- }
136
-
137
- &:hover:not([aria-disabled='true']) {
138
- @apply bg-green-600/20;
139
- }
140
-
141
- &:focus {
142
- @apply bg-green-600/20;
143
- }
144
- }
145
- }
@@ -1,67 +0,0 @@
1
- import { ArrowRightIcon } from '@heroicons/react/24/solid';
2
- import type { Meta as MetaObj, StoryObj } from '@storybook/react';
3
-
4
- import BaseButton from '#ui/Common/BaseButton';
5
-
6
- type Story = StoryObj<typeof BaseButton>;
7
- type Meta = MetaObj<typeof BaseButton>;
8
-
9
- export const Neutral: Story = {
10
- args: {
11
- kind: 'neutral',
12
- children: 'Download Node (LTS)',
13
- disabled: false,
14
- size: 'default',
15
- },
16
- };
17
-
18
- export const Primary: Story = {
19
- args: {
20
- kind: 'primary',
21
- children: 'Download Node (LTS)',
22
- disabled: false,
23
- size: 'default',
24
- },
25
- };
26
-
27
- export const Secondary: Story = {
28
- args: {
29
- kind: 'secondary',
30
- children: 'Download Node (LTS)',
31
- disabled: false,
32
- size: 'default',
33
- },
34
- };
35
-
36
- export const Special: Story = {
37
- args: {
38
- kind: 'special',
39
- children: 'Download Node (LTS)',
40
- disabled: false,
41
- size: 'default',
42
- },
43
- };
44
-
45
- export const WithIcon: Story = {
46
- args: {
47
- kind: 'primary',
48
- children: (
49
- <>
50
- Back to Home
51
- <ArrowRightIcon />
52
- </>
53
- ),
54
- disabled: false,
55
- size: 'default',
56
- },
57
- };
58
-
59
- export default {
60
- component: BaseButton,
61
- argTypes: {
62
- size: {
63
- options: ['default', 'small'],
64
- control: { type: 'radio' },
65
- },
66
- },
67
- } as Meta;
@@ -1,59 +0,0 @@
1
- import classNames from 'classnames';
2
- import type { FC, AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react';
3
-
4
- import type { LinkLike } from '#ui/types';
5
-
6
- import styles from './index.module.css';
7
-
8
- export type ButtonProps = (
9
- | AnchorHTMLAttributes<HTMLAnchorElement>
10
- | ButtonHTMLAttributes<HTMLButtonElement>
11
- ) & {
12
- kind?: 'neutral' | 'primary' | 'secondary' | 'special';
13
- size?: 'default' | 'small';
14
- disabled?: boolean;
15
- as?: LinkLike;
16
- };
17
-
18
- const BaseButton: FC<ButtonProps> = ({
19
- kind = 'primary',
20
- size = 'default',
21
- disabled = false,
22
- className,
23
- as: Component = 'a',
24
- ...props
25
- }) => {
26
- if ('href' in props && Component) {
27
- return (
28
- <Component
29
- role="button"
30
- href={disabled ? undefined : props.href}
31
- aria-disabled={disabled}
32
- className={classNames(
33
- styles.button,
34
- styles[kind],
35
- styles[size],
36
- className
37
- )}
38
- tabIndex={disabled ? -1 : 0}
39
- {...props}
40
- />
41
- );
42
- }
43
-
44
- return (
45
- <button
46
- disabled={disabled}
47
- className={classNames(
48
- styles.button,
49
- styles[kind],
50
- styles[size],
51
- className
52
- )}
53
- type="button"
54
- {...(props as ButtonHTMLAttributes<HTMLButtonElement>)}
55
- />
56
- );
57
- };
58
-
59
- export default BaseButton;
@@ -1,78 +0,0 @@
1
- @reference "../../styles/index.css";
2
-
3
- .root {
4
- @apply w-full
5
- rounded-sm
6
- border
7
- border-neutral-900
8
- bg-neutral-950;
9
-
10
- .content {
11
- @apply m-0
12
- p-4;
13
-
14
- & > code {
15
- @apply font-ibm-plex-mono
16
- font-regular
17
- scrollbar-thin
18
- grid
19
- overflow-x-auto
20
- bg-transparent
21
- p-0
22
- text-sm
23
- leading-snug
24
- text-neutral-400
25
- [counter-reset:line];
26
-
27
- & > [class='line'] {
28
- @apply relative
29
- min-w-0
30
- pl-8;
31
-
32
- &:not(:empty:last-child)::before {
33
- @apply inline-block
34
- content-[''];
35
- }
36
-
37
- &:not(:empty:last-child)::after {
38
- @apply font-ibm-plex-mono
39
- w-4.5
40
- absolute
41
- left-0
42
- top-0
43
- mr-4
44
- text-right
45
- text-neutral-600
46
- [content:counter(line)]
47
- [counter-increment:line];
48
- }
49
- }
50
- }
51
- }
52
-
53
- & > .footer {
54
- @apply flex
55
- items-center
56
- justify-between
57
- border-t
58
- border-t-neutral-900
59
- px-4
60
- py-3
61
- text-sm
62
- font-medium;
63
-
64
- & > .language {
65
- @apply text-neutral-400;
66
- }
67
-
68
- & > .action {
69
- @apply px-3
70
- py-1.5
71
- font-medium;
72
- }
73
- }
74
- }
75
-
76
- .icon {
77
- @apply size-4;
78
- }
@@ -1,39 +0,0 @@
1
- import type { Meta as MetaObj, StoryObj } from '@storybook/react';
2
-
3
- import BaseCodeBox from '#ui/Common/BaseCodeBox';
4
-
5
- type Story = StoryObj<typeof BaseCodeBox>;
6
- type Meta = MetaObj<typeof BaseCodeBox>;
7
-
8
- const content = `const http = require('http');
9
-
10
- const hostname = '127.0.0.1';
11
- const port = 3000;
12
-
13
- const server = http.createServer((req, res) => {
14
- res.statusCode = 200;
15
- res.setHeader('Content-Type', 'text/plain');
16
- res.end('Hello World');
17
- });
18
-
19
- server.listen(port, hostname, () => {
20
- console.log(\`Server running at http://\${hostname}:\${port}/\`);
21
- });`;
22
-
23
- const args = {
24
- language: 'JavaScript (CJS)',
25
- children: <code>{content}</code>,
26
- };
27
-
28
- export const Default: Story = {
29
- args,
30
- };
31
-
32
- export const WithCopyButton: Story = {
33
- args: {
34
- ...args,
35
- showCopyButton: true,
36
- },
37
- };
38
-
39
- export default { component: BaseCodeBox } as Meta;
@@ -1,122 +0,0 @@
1
- 'use client';
2
-
3
- import { DocumentDuplicateIcon } from '@heroicons/react/24/outline';
4
- import classNames from 'classnames';
5
- import type { FC, PropsWithChildren, ReactElement } from 'react';
6
- import { Fragment, isValidElement, useRef } from 'react';
7
-
8
- import BaseButton from '#ui/Common/BaseButton';
9
- import type { LinkLike } from '#ui/types';
10
-
11
- import styles from './index.module.css';
12
-
13
- // Transforms a code element with plain text content into a more structured
14
- // format for rendering with line numbers
15
- const transformCode = <T extends ReactElement<PropsWithChildren>>(
16
- code: T,
17
- language: string
18
- ): ReactElement<HTMLElement> | T => {
19
- if (!isValidElement(code)) {
20
- // Early return when the `CodeBox` child is not a valid element since the
21
- // type is a ReactNode, and can assume any value
22
- return code;
23
- }
24
-
25
- const content = code.props?.children;
26
-
27
- if (code.type !== 'code' || typeof content !== 'string') {
28
- // There is no need to transform an element that is not a code element or
29
- // a content that is not a string
30
- return code;
31
- }
32
-
33
- // Note that since we use `.split` we will have an extra entry
34
- // being an empty string, so we need to remove it
35
- const lines = content.split('\n');
36
-
37
- const extraStyle = language.length === 0 ? { fontFamily: 'monospace' } : {};
38
-
39
- return (
40
- <code style={extraStyle}>
41
- {lines
42
- .flatMap((line, lineIndex) => {
43
- const columns = line.split(' ');
44
-
45
- return [
46
- <span key={lineIndex} className="line">
47
- {columns.map((column, columnIndex) => (
48
- <Fragment key={columnIndex}>
49
- <span>{column}</span>
50
- {columnIndex < columns.length - 1 && <span> </span>}
51
- </Fragment>
52
- ))}
53
- </span>,
54
- // Add a break line so the text content is formatted correctly
55
- // when copying to clipboard
56
- '\n',
57
- ];
58
- })
59
- // Here we remove that empty line from before and
60
- // the last flatMap entry which is an `\n`
61
- .slice(0, -2)}
62
- </code>
63
- );
64
- };
65
-
66
- interface CodeBoxProps {
67
- language: string;
68
- className?: string;
69
- onCopy: (text: string) => void;
70
- as?: LinkLike;
71
- buttonText: string;
72
- showCopyButton?: boolean;
73
- }
74
-
75
- const BaseCodeBox: FC<PropsWithChildren<CodeBoxProps>> = ({
76
- children,
77
- language,
78
- className,
79
- onCopy,
80
- buttonText,
81
- as = 'a',
82
- showCopyButton = true,
83
- }: PropsWithChildren<CodeBoxProps>) => {
84
- const containerRef = useRef<HTMLPreElement>(null);
85
-
86
- const handleCopy = (): void => {
87
- const text = containerRef.current?.textContent;
88
- if (text) {
89
- onCopy(text);
90
- }
91
- };
92
-
93
- return (
94
- <div className={styles.root}>
95
- <pre
96
- ref={containerRef}
97
- className={classNames(styles.content, className)}
98
- tabIndex={0}
99
- >
100
- {transformCode(children as ReactElement<PropsWithChildren>, language)}
101
- </pre>
102
- {language && (
103
- <div className={styles.footer}>
104
- <span className={styles.language}>{language}</span>
105
- {showCopyButton && (
106
- <BaseButton
107
- as={as}
108
- className={styles.action}
109
- kind="neutral"
110
- onClick={handleCopy}
111
- >
112
- <DocumentDuplicateIcon className={styles.icon} />
113
- {buttonText}
114
- </BaseButton>
115
- )}
116
- </div>
117
- )}
118
- </div>
119
- );
120
- };
121
-
122
- export default BaseCodeBox;
@@ -1,51 +0,0 @@
1
- @reference "../../styles/index.css";
2
-
3
- .crossLink {
4
- @apply flex
5
- flex-col
6
- items-start
7
- gap-2
8
- truncate
9
- rounded-sm
10
- border
11
- border-solid
12
- border-neutral-300
13
- bg-white
14
- p-3
15
- no-underline
16
- dark:border-neutral-900
17
- dark:bg-neutral-950;
18
-
19
- .header {
20
- @apply flex
21
- items-center
22
- gap-2
23
- self-stretch
24
- text-xs
25
- text-neutral-800
26
- dark:text-neutral-100;
27
-
28
- &.reverse {
29
- @apply flex-row-reverse
30
- justify-start;
31
- }
32
-
33
- .icon {
34
- @apply size-4
35
- text-neutral-600
36
- dark:text-neutral-400;
37
- }
38
- }
39
-
40
- .content {
41
- @apply self-stretch
42
- truncate
43
- text-sm
44
- text-neutral-900
45
- dark:text-white;
46
-
47
- &.reverse {
48
- @apply text-right;
49
- }
50
- }
51
- }