@node-core/ui-components 1.0.1-345c7d19144bec7138956e6ae7f5b20cfa2e2450 → 1.0.1-4ebead0c76b580d1bf722ebcd0f644e82dc06c0d

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 (32) hide show
  1. package/Common/AlertBox/index.module.css +7 -0
  2. package/Common/AlertBox/index.stories.tsx +23 -0
  3. package/Common/AvatarGroup/index.module.css +4 -8
  4. package/Common/AvatarGroup/index.tsx +1 -5
  5. package/Common/BaseButton/index.module.css +4 -1
  6. package/Common/ChangeHistory/index.module.css +83 -0
  7. package/Common/ChangeHistory/index.stories.tsx +130 -0
  8. package/Common/ChangeHistory/index.tsx +67 -0
  9. package/Common/DataTag/index.module.css +56 -0
  10. package/Common/DataTag/index.stories.tsx +40 -0
  11. package/Common/DataTag/index.tsx +39 -0
  12. package/Common/Modal/index.module.css +3 -3
  13. package/Common/Modal/index.stories.tsx +7 -5
  14. package/Common/Modal/index.tsx +16 -14
  15. package/{Common/ProgressionSidebar/ProgressionSidebarIcon → Containers/Sidebar/ProgressionIcon}/index.tsx +2 -2
  16. package/Containers/Sidebar/SidebarGroup/index.module.css +54 -16
  17. package/Containers/Sidebar/SidebarGroup/index.tsx +21 -2
  18. package/Containers/Sidebar/SidebarItem/index.module.css +39 -18
  19. package/Containers/Sidebar/SidebarItem/index.tsx +25 -8
  20. package/Containers/Sidebar/index.module.css +5 -6
  21. package/Containers/Sidebar/index.stories.tsx +78 -74
  22. package/Containers/Sidebar/index.tsx +17 -5
  23. package/Icons/Logos/Nodejs.tsx +201 -17
  24. package/package.json +28 -31
  25. package/styles/markdown.css +1 -1
  26. package/Common/ProgressionSidebar/ProgressionSidebarGroup/index.module.css +0 -47
  27. package/Common/ProgressionSidebar/ProgressionSidebarGroup/index.tsx +0 -35
  28. package/Common/ProgressionSidebar/ProgressionSidebarItem/index.module.css +0 -39
  29. package/Common/ProgressionSidebar/ProgressionSidebarItem/index.tsx +0 -32
  30. package/Common/ProgressionSidebar/index.module.css +0 -30
  31. package/Common/ProgressionSidebar/index.stories.tsx +0 -79
  32. package/Common/ProgressionSidebar/index.tsx +0 -59
@@ -5,22 +5,60 @@
5
5
  w-full
6
6
  flex-col
7
7
  gap-2;
8
- }
9
8
 
10
- .groupName {
11
- @apply px-2
12
- py-1
13
- text-xs
14
- font-semibold
15
- text-neutral-800
16
- dark:text-neutral-600;
17
- }
9
+ &:not(.progression) {
10
+ .groupName {
11
+ @apply px-2
12
+ py-1
13
+ text-xs
14
+ font-semibold
15
+ text-neutral-800
16
+ dark:text-neutral-600;
17
+ }
18
+ }
18
19
 
19
- .itemList {
20
- @apply m-0
21
- flex
22
- flex-col
23
- items-start
24
- gap-0.5
25
- p-0;
20
+ &.progression {
21
+ @apply flex
22
+ flex-col
23
+ gap-4
24
+ text-sm
25
+ font-medium
26
+ text-neutral-800
27
+ dark:text-neutral-200;
28
+
29
+ .itemList {
30
+ @apply relative
31
+ -left-1
32
+ flex
33
+ flex-col
34
+ after:absolute
35
+ after:left-[0.45rem]
36
+ after:top-0
37
+ after:z-10
38
+ after:h-full
39
+ after:w-px
40
+ after:bg-neutral-200
41
+ after:content-['']
42
+ dark:after:bg-neutral-800;
43
+
44
+ a {
45
+ @apply first:before:absolute
46
+ first:before:bottom-[calc(50%+0.25rem)]
47
+ first:before:left-0
48
+ first:before:h-20
49
+ first:before:w-4
50
+ first:before:bg-white
51
+ first:before:content-['']
52
+ last:after:absolute
53
+ last:after:left-0
54
+ last:after:top-[calc(50%+0.25rem)]
55
+ last:after:h-20
56
+ last:after:w-4
57
+ last:after:bg-white
58
+ last:after:content-['']
59
+ first:dark:before:bg-neutral-950
60
+ last:dark:after:bg-neutral-950;
61
+ }
62
+ }
63
+ }
26
64
  }
@@ -1,3 +1,4 @@
1
+ import classNames from 'classnames';
1
2
  import type { ComponentProps, FC } from 'react';
2
3
 
3
4
  import SidebarItem from '#ui/Containers/Sidebar/SidebarItem';
@@ -10,18 +11,36 @@ type SidebarGroupProps = {
10
11
  items: Array<Omit<ComponentProps<typeof SidebarItem>, 'as' | 'pathname'>>;
11
12
  as?: LinkLike;
12
13
  pathname?: string;
14
+ className: string;
15
+ showProgressionIcons?: boolean;
13
16
  };
14
17
 
15
18
  const SidebarGroup: FC<SidebarGroupProps> = ({
16
19
  groupName,
17
20
  items,
21
+ showProgressionIcons,
22
+ className,
18
23
  ...props
19
24
  }) => (
20
- <section className={styles.group}>
25
+ <section
26
+ className={classNames(
27
+ {
28
+ [styles.group]: true,
29
+ [styles.progression]: showProgressionIcons,
30
+ },
31
+ className
32
+ )}
33
+ >
21
34
  <label className={styles.groupName}>{groupName}</label>
22
35
  <ul className={styles.itemList}>
23
36
  {items.map(({ label, link }) => (
24
- <SidebarItem key={link} label={label} link={link} {...props} />
37
+ <SidebarItem
38
+ key={link}
39
+ label={label}
40
+ link={link}
41
+ showProgressionIcons={showProgressionIcons}
42
+ {...props}
43
+ />
25
44
  ))}
26
45
  </ul>
27
46
  </section>
@@ -1,35 +1,56 @@
1
- @reference "../../../styles/index.css";
1
+ @reference '../../../styles/index.css';
2
2
 
3
- .sideBarItem {
4
- @apply flex
3
+ .item {
4
+ @apply font-regular
5
+ relative
6
+ z-20
7
+ flex
5
8
  w-full
6
- list-none
9
+ items-center
10
+ overflow-hidden
11
+ text-sm
7
12
  text-neutral-800
8
13
  dark:text-neutral-200;
9
14
 
10
- a {
11
- @apply inline-flex
12
- items-center
13
- gap-2
14
- p-2;
15
- }
16
-
17
15
  .label {
18
16
  @apply font-regular
19
- w-full
17
+ p-2
20
18
  text-sm;
21
19
  }
22
20
 
21
+ .progressionIcon {
22
+ @apply shrink-0
23
+ fill-neutral-200
24
+ stroke-white
25
+ stroke-[4]
26
+ dark:fill-neutral-800
27
+ dark:stroke-neutral-950;
28
+ }
29
+
23
30
  .icon {
24
31
  @apply size-3
25
32
  text-neutral-500
26
33
  dark:text-neutral-200;
27
34
  }
28
- }
29
35
 
30
- .active {
31
- @apply rounded-sm
32
- bg-green-600
33
- text-white
34
- dark:text-white;
36
+ &.progression {
37
+ .label {
38
+ @apply p-1;
39
+ }
40
+ }
41
+
42
+ &.active {
43
+ @apply text-neutral-900
44
+ dark:text-white;
45
+
46
+ .progressionIcon {
47
+ @apply fill-green-500;
48
+ }
49
+
50
+ &:not(.progression) .label {
51
+ @apply rounded-sm
52
+ bg-green-600
53
+ text-white;
54
+ }
55
+ }
35
56
  }
@@ -1,26 +1,43 @@
1
1
  import { ArrowUpRightIcon } from '@heroicons/react/24/solid';
2
+ import classNames from 'classnames';
2
3
  import type { FC } from 'react';
3
4
 
4
- import ActiveLink from '#ui/Common/BaseActiveLink';
5
+ import BaseActiveLink from '#ui/Common/BaseActiveLink';
5
6
  import type { FormattedMessage, LinkLike } from '#ui/types';
6
7
 
7
8
  import styles from './index.module.css';
9
+ import ProgressionIcon from '../ProgressionIcon';
8
10
 
9
11
  type SidebarItemProps = {
10
12
  label: FormattedMessage;
11
13
  link: string;
12
14
  as?: LinkLike;
13
15
  pathname?: string;
16
+ showProgressionIcons?: boolean;
14
17
  };
15
18
 
16
- const SidebarItem: FC<SidebarItemProps> = ({ label, link, ...props }) => (
17
- <li className={styles.sideBarItem}>
18
- <ActiveLink href={link} activeClassName={styles.active} {...props}>
19
- <span className={styles.label}>{label}</span>
19
+ const SidebarItem: FC<SidebarItemProps> = ({
20
+ label,
21
+ link,
22
+ showProgressionIcons = false,
23
+ ...props
24
+ }) => (
25
+ <BaseActiveLink
26
+ className={classNames({
27
+ [styles.item]: true,
28
+ [styles.progression]: showProgressionIcons,
29
+ })}
30
+ href={link}
31
+ activeClassName={styles.active}
32
+ {...props}
33
+ >
34
+ {showProgressionIcons && (
35
+ <ProgressionIcon className={styles.progressionIcon} />
36
+ )}
37
+ <span className={styles.label}>{label}</span>
20
38
 
21
- {link.startsWith('http') && <ArrowUpRightIcon className={styles.icon} />}
22
- </ActiveLink>
23
- </li>
39
+ {/^https?:/.test(link) && <ArrowUpRightIcon className={styles.icon} />}
40
+ </BaseActiveLink>
24
41
  );
25
42
 
26
43
  export default SidebarItem;
@@ -4,26 +4,25 @@
4
4
  @apply flex
5
5
  w-full
6
6
  flex-col
7
- items-start
8
7
  gap-8
9
8
  overflow-auto
10
- overflow-x-hidden
11
- border-r-neutral-200
9
+ border-r-0
10
+ border-neutral-200
12
11
  bg-white
13
12
  px-4
14
13
  py-6
15
14
  sm:border-r
16
15
  md:max-w-xs
17
16
  lg:px-6
18
- dark:border-r-neutral-900
17
+ dark:border-neutral-900
19
18
  dark:bg-neutral-950;
20
19
 
21
- > section {
20
+ .navigation {
22
21
  @apply hidden
23
22
  sm:flex;
24
23
  }
25
24
 
26
- > span {
25
+ .mobileSelect {
27
26
  @apply flex
28
27
  w-full
29
28
  sm:hidden;
@@ -5,80 +5,84 @@ import Sidebar from '#ui/Containers/Sidebar';
5
5
  type Story = StoryObj<typeof Sidebar>;
6
6
  type Meta = MetaObj<typeof Sidebar>;
7
7
 
8
- export const Default: Story = {
9
- args: {
10
- groups: [
11
- {
12
- groupName: 'About Node.js',
13
- items: [
14
- {
15
- link: '/item1',
16
- label: 'About Node.js',
17
- },
18
- {
19
- link: '/item2',
20
- label: 'Project Governance',
21
- },
22
- {
23
- link: '/item3',
24
- label: 'Releases',
25
- },
26
- {
27
- link: '/item4',
28
- label: 'Branding',
29
- },
30
- {
31
- link: '/item5',
32
- label: 'Privacy Policy',
33
- },
34
- {
35
- link: '/item6',
36
- label: 'Security Reporting',
37
- },
38
- ],
39
- },
40
- {
41
- groupName: 'Get Involved',
42
- items: [
43
- {
44
- link: '/item7',
45
- label: 'Get Involved',
46
- },
47
- {
48
- link: '/item8',
49
- label: 'Collab Summit',
50
- },
51
- {
52
- link: '/item9',
53
- label: 'Contribute',
54
- },
55
- {
56
- link: '/item10',
57
- label: 'Code of Conduct',
58
- },
59
- ],
60
- },
61
- {
62
- groupName: 'Download',
63
- items: [
64
- {
65
- link: '/item11',
66
- label: 'Download',
67
- },
68
- {
69
- link: '/item12',
70
- label: 'Package Manager',
71
- },
72
- {
73
- link: '/item13',
74
- label: 'Node.js Releases',
75
- },
76
- ],
77
- },
78
- ],
79
- title: 'Sidebar',
80
- onSelect: console.log,
81
- },
8
+ const args = {
9
+ groups: [
10
+ {
11
+ groupName: 'About Node.js',
12
+ items: [
13
+ {
14
+ link: '/item1',
15
+ label: 'About Node.js',
16
+ },
17
+ {
18
+ link: '/item2',
19
+ label: 'Project Governance',
20
+ },
21
+ {
22
+ link: '/item3',
23
+ label: 'Releases',
24
+ },
25
+ {
26
+ link: '/item4',
27
+ label: 'Branding',
28
+ },
29
+ {
30
+ link: '/item5',
31
+ label: 'Privacy Policy',
32
+ },
33
+ {
34
+ link: '/item6',
35
+ label: 'Security Reporting',
36
+ },
37
+ ],
38
+ },
39
+ {
40
+ groupName: 'Get Involved',
41
+ items: [
42
+ {
43
+ link: '/item7',
44
+ label: 'Get Involved',
45
+ },
46
+ {
47
+ link: '/item8',
48
+ label: 'Collab Summit',
49
+ },
50
+ {
51
+ link: '/item9',
52
+ label: 'Contribute',
53
+ },
54
+ {
55
+ link: '/item10',
56
+ label: 'Code of Conduct',
57
+ },
58
+ ],
59
+ },
60
+ {
61
+ groupName: 'Download',
62
+ items: [
63
+ {
64
+ link: '/item11',
65
+ label: 'Download',
66
+ },
67
+ {
68
+ link: '/item12',
69
+ label: 'Package Manager',
70
+ },
71
+ {
72
+ link: '/item13',
73
+ label: 'Node.js Releases',
74
+ },
75
+ ],
76
+ },
77
+ ],
78
+ title: 'Sidebar',
79
+ onSelect: console.log,
80
+ pathname: '/item1',
81
+ };
82
+
83
+ export const Default: Story = { args };
84
+ export const Progression: Story = {
85
+ args: { ...args, showProgressionIcons: true },
82
86
  };
83
87
 
84
88
  export default { component: Sidebar } as Meta;
@@ -1,4 +1,4 @@
1
- import type { ComponentProps, FC } from 'react';
1
+ import type { ComponentProps, FC, PropsWithChildren } from 'react';
2
2
 
3
3
  import Select from '#ui/Common/Select';
4
4
  import SidebarGroup from '#ui/Containers/Sidebar/SidebarGroup';
@@ -7,19 +7,26 @@ import type { LinkLike } from '#ui/types';
7
7
  import styles from './index.module.css';
8
8
 
9
9
  type SidebarProps = {
10
- groups: Array<Omit<ComponentProps<typeof SidebarGroup>, 'as' | 'pathname'>>;
10
+ groups: Array<
11
+ Pick<ComponentProps<typeof SidebarGroup>, 'items' | 'groupName'>
12
+ >;
11
13
  pathname?: string;
12
14
  title: string;
13
15
  onSelect: (value: string) => void;
14
16
  as?: LinkLike;
17
+ showProgressionIcons?: boolean;
18
+ placeholder?: string;
15
19
  };
16
20
 
17
- const SideBar: FC<SidebarProps> = ({
21
+ const SideBar: FC<PropsWithChildren<SidebarProps>> = ({
18
22
  groups,
19
23
  pathname,
20
24
  title,
21
25
  onSelect,
22
26
  as,
27
+ showProgressionIcons = false,
28
+ children,
29
+ placeholder,
23
30
  }) => {
24
31
  const selectItems = groups.map(({ items, groupName }) => ({
25
32
  label: groupName,
@@ -27,18 +34,21 @@ const SideBar: FC<SidebarProps> = ({
27
34
  }));
28
35
 
29
36
  const currentItem = selectItems
30
- .map(item => item.items)
31
- .flat()
37
+ .flatMap(item => item.items)
32
38
  .find(item => pathname === item.value);
33
39
 
34
40
  return (
35
41
  <aside className={styles.wrapper}>
42
+ {children}
43
+
36
44
  {selectItems.length > 0 && (
37
45
  <Select
38
46
  label={title}
39
47
  values={selectItems}
40
48
  defaultValue={currentItem?.value}
49
+ placeholder={placeholder}
41
50
  onChange={onSelect}
51
+ className={styles.mobileSelect}
42
52
  />
43
53
  )}
44
54
 
@@ -49,6 +59,8 @@ const SideBar: FC<SidebarProps> = ({
49
59
  items={items}
50
60
  pathname={pathname}
51
61
  as={as}
62
+ showProgressionIcons={showProgressionIcons}
63
+ className={styles.navigation}
52
64
  />
53
65
  ))}
54
66
  </aside>