@node-core/ui-components 1.0.1-1b9af3ec9e0268bfc734b2489cbc584fa3edf026 → 1.0.1-1ccf19c1836415b6ec7bc2d63ffba4686b390ca9
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.
- package/Common/AlertBox/index.module.css +46 -47
- package/Common/AlertBox/index.stories.tsx +73 -0
- package/Common/AlertBox/index.tsx +24 -0
- package/Common/AvatarGroup/Avatar/index.module.css +30 -50
- package/Common/AvatarGroup/Avatar/index.stories.tsx +22 -0
- package/Common/AvatarGroup/Avatar/index.tsx +67 -0
- package/Common/AvatarGroup/Overlay/index.module.css +21 -28
- package/Common/AvatarGroup/Overlay/index.stories.tsx +33 -0
- package/Common/AvatarGroup/Overlay/index.tsx +37 -0
- package/Common/AvatarGroup/__tests__/index.test.jsx +55 -0
- package/Common/AvatarGroup/index.module.css +11 -12
- package/Common/AvatarGroup/index.stories.tsx +56 -0
- package/Common/AvatarGroup/index.tsx +83 -0
- package/Common/Badge/index.module.css +26 -34
- package/Common/Badge/index.stories.tsx +38 -0
- package/Common/Badge/index.tsx +35 -0
- package/Common/BadgeGroup/index.module.css +51 -75
- package/Common/BadgeGroup/index.stories.tsx +35 -0
- package/Common/BadgeGroup/index.tsx +35 -0
- package/Common/Banner/index.module.css +27 -30
- package/Common/Banner/index.stories.tsx +29 -0
- package/Common/Banner/index.tsx +18 -0
- package/Common/BaseActiveLink/__tests__/index.test.jsx +52 -0
- package/Common/BaseActiveLink/index.tsx +34 -0
- package/Common/BaseButton/index.module.css +102 -332
- package/Common/BaseButton/index.stories.tsx +67 -0
- package/Common/BaseButton/index.tsx +59 -0
- package/Common/BaseCodeBox/index.module.css +58 -76
- package/Common/BaseCodeBox/index.stories.tsx +39 -0
- package/Common/BaseCodeBox/index.tsx +122 -0
- package/Common/BaseCrossLink/index.module.css +39 -57
- package/Common/BaseCrossLink/index.stories.tsx +38 -0
- package/Common/BaseCrossLink/index.tsx +46 -0
- package/Common/BaseLinkTabs/index.module.css +33 -67
- package/Common/BaseLinkTabs/index.stories.tsx +34 -0
- package/Common/BaseLinkTabs/index.tsx +53 -0
- package/Common/BasePagination/Ellipsis/index.module.css +8 -14
- package/Common/BasePagination/Ellipsis/index.stories.tsx +10 -0
- package/Common/BasePagination/Ellipsis/index.tsx +11 -0
- package/Common/BasePagination/PaginationListItem/__tests__/index.test.jsx +58 -0
- package/Common/BasePagination/PaginationListItem/index.module.css +21 -36
- package/Common/BasePagination/PaginationListItem/index.stories.tsx +40 -0
- package/Common/BasePagination/PaginationListItem/index.tsx +39 -0
- package/Common/BasePagination/PrevNextArrow.tsx +15 -0
- package/Common/BasePagination/__tests__/index.test.jsx +180 -0
- package/Common/BasePagination/index.module.css +26 -27
- package/Common/BasePagination/index.stories.tsx +67 -0
- package/Common/BasePagination/index.tsx +77 -0
- package/Common/BasePagination/useGetPageElements.tsx +132 -0
- package/Common/Blockquote/index.module.css +23 -44
- package/Common/Blockquote/index.stories.tsx +45 -0
- package/Common/Blockquote/index.tsx +11 -0
- package/Common/Breadcrumbs/BreadcrumbHomeLink/index.module.css +3 -3
- package/Common/Breadcrumbs/BreadcrumbHomeLink/index.tsx +30 -0
- package/Common/Breadcrumbs/BreadcrumbItem/index.module.css +27 -38
- package/Common/Breadcrumbs/BreadcrumbItem/index.tsx +42 -0
- package/Common/Breadcrumbs/BreadcrumbLink/index.module.css +16 -26
- package/Common/Breadcrumbs/BreadcrumbLink/index.tsx +37 -0
- package/Common/Breadcrumbs/BreadcrumbRoot/index.module.css +7 -8
- package/Common/Breadcrumbs/BreadcrumbRoot/index.tsx +20 -0
- package/Common/Breadcrumbs/BreadcrumbTruncatedItem/index.tsx +9 -0
- package/Common/Breadcrumbs/index.stories.tsx +94 -0
- package/Common/Breadcrumbs/index.tsx +81 -0
- package/Common/CodeTabs/index.module.css +36 -47
- package/Common/CodeTabs/index.stories.tsx +73 -0
- package/Common/CodeTabs/index.tsx +16 -0
- package/Common/DataTag/index.module.css +32 -30
- package/Common/DataTag/index.stories.tsx +40 -0
- package/Common/DataTag/index.tsx +39 -0
- package/Common/GlowingBackdrop/index.module.css +28 -126
- package/Common/GlowingBackdrop/index.stories.tsx +10 -0
- package/Common/GlowingBackdrop/index.tsx +13 -0
- package/Common/LanguageDropDown/index.module.css +42 -140
- package/Common/LanguageDropDown/index.stories.tsx +19 -0
- package/Common/LanguageDropDown/index.tsx +56 -0
- package/Common/Modal/index.module.css +62 -217
- package/Common/Modal/index.stories.tsx +32 -0
- package/Common/Modal/index.tsx +48 -0
- package/Common/NodejsLogo/index.module.css +4 -3
- package/Common/NodejsLogo/index.stories.tsx +14 -0
- package/Common/NodejsLogo/index.tsx +26 -0
- package/Common/Notification/index.module.css +17 -101
- package/Common/Notification/index.stories.tsx +36 -0
- package/Common/Notification/index.tsx +34 -0
- package/Common/Preview/index.module.css +65 -269
- package/Common/Preview/index.stories.tsx +44 -0
- package/Common/Preview/index.tsx +25 -0
- package/Common/Select/__tests__/index.test.jsx +67 -0
- package/Common/Select/index.module.css +127 -294
- package/Common/Select/index.stories.tsx +111 -0
- package/Common/Select/index.tsx +187 -0
- package/Common/Separator/index.module.css +10 -7
- package/Common/Separator/index.stories.tsx +32 -0
- package/Common/Separator/index.tsx +27 -0
- package/Common/Skeleton/index.module.css +21 -118
- package/Common/Skeleton/index.tsx +39 -0
- package/Common/Tabs/__tests__/index.test.jsx +52 -0
- package/Common/Tabs/index.module.css +40 -58
- package/Common/Tabs/index.stories.tsx +50 -0
- package/Common/Tabs/index.tsx +54 -0
- package/Common/ThemeToggle/__tests__/index.test.jsx +35 -0
- package/Common/ThemeToggle/index.module.css +11 -18
- package/Common/ThemeToggle/index.stories.tsx +10 -0
- package/Common/ThemeToggle/index.tsx +15 -0
- package/Common/Tooltip/index.module.css +29 -119
- package/Common/Tooltip/index.stories.tsx +73 -0
- package/Common/Tooltip/index.tsx +48 -0
- package/Containers/Article/index.module.css +58 -127
- package/Containers/Article/index.stories.tsx +39 -0
- package/Containers/Article/index.tsx +9 -0
- package/Containers/DocSideBar/index.tsx +0 -0
- package/Containers/Footer/index.module.css +36 -51
- package/Containers/Footer/index.stories.tsx +27 -0
- package/Containers/Footer/index.tsx +95 -0
- package/Containers/MetaBar/__tests__/index.test.jsx +63 -0
- package/Containers/MetaBar/index.module.css +69 -101
- package/Containers/MetaBar/index.stories.tsx +80 -0
- package/Containers/MetaBar/index.tsx +72 -0
- package/Containers/NavBar/NavItem/index.module.css +36 -50
- package/Containers/NavBar/NavItem/index.stories.tsx +38 -0
- package/Containers/NavBar/NavItem/index.tsx +44 -0
- package/Containers/NavBar/index.module.css +96 -176
- package/Containers/NavBar/index.stories.tsx +45 -0
- package/Containers/NavBar/index.tsx +94 -0
- package/Containers/Sidebar/ProgressionIcon/index.tsx +16 -0
- package/Containers/Sidebar/SidebarGroup/index.module.css +52 -180
- package/Containers/Sidebar/SidebarGroup/index.stories.tsx +36 -0
- package/Containers/Sidebar/SidebarGroup/index.tsx +49 -0
- package/Containers/Sidebar/SidebarItem/index.module.css +38 -49
- package/Containers/Sidebar/SidebarItem/index.stories.tsx +15 -0
- package/Containers/Sidebar/SidebarItem/index.tsx +43 -0
- package/Containers/Sidebar/index.module.css +24 -42
- package/Containers/Sidebar/index.stories.tsx +88 -0
- package/Containers/Sidebar/index.tsx +67 -0
- package/Icons/HexagonGrid.stories.tsx +10 -0
- package/Icons/HexagonGrid.tsx +1434 -0
- package/Icons/InstallationMethod/Choco.tsx +78 -0
- package/Icons/InstallationMethod/Devbox.tsx +21 -0
- package/Icons/InstallationMethod/Docker.tsx +20 -0
- package/Icons/InstallationMethod/FNM.tsx +132 -0
- package/Icons/InstallationMethod/Homebrew.tsx +69 -0
- package/Icons/InstallationMethod/N.tsx +32 -0
- package/Icons/InstallationMethod/NVM.tsx +63 -0
- package/Icons/InstallationMethod/Volta.tsx +34 -0
- package/Icons/InstallationMethod/{index.js → index.ts} +1 -0
- package/Icons/Logos/JsGreen.tsx +24 -0
- package/Icons/Logos/JsWhite.tsx +37 -0
- package/Icons/Logos/Nodejs.tsx +188 -0
- package/Icons/Logos/NodejsStackedBlack.tsx +98 -0
- package/Icons/Logos/NodejsStackedDark.tsx +124 -0
- package/Icons/Logos/NodejsStackedLight.tsx +123 -0
- package/Icons/Logos/NodejsStackedWhite.tsx +98 -0
- package/Icons/Logos/{index.js → index.ts} +10 -1
- package/Icons/OperatingSystem/AIX.tsx +46 -0
- package/Icons/OperatingSystem/Apple.tsx +23 -0
- package/Icons/OperatingSystem/Linux.tsx +969 -0
- package/Icons/OperatingSystem/Microsoft.tsx +19 -0
- package/Icons/OperatingSystem/{index.js → index.ts} +1 -0
- package/Icons/PackageManager/Npm.tsx +21 -0
- package/Icons/PackageManager/Pnpm.tsx +22 -0
- package/Icons/PackageManager/Yarn.tsx +22 -0
- package/Icons/PackageManager/{index.js → index.ts} +1 -0
- package/Icons/Social/Bluesky.tsx +19 -0
- package/Icons/Social/Discord.tsx +20 -0
- package/Icons/Social/GitHub.tsx +16 -0
- package/Icons/Social/LinkedIn.tsx +16 -0
- package/Icons/Social/Mastodon.tsx +36 -0
- package/Icons/Social/Slack.tsx +31 -0
- package/Icons/Social/X.tsx +16 -0
- package/Icons/Social/{index.js → index.ts} +1 -0
- package/MDX/CodeTabs.tsx +47 -0
- package/package.json +54 -6
- package/stylelint/__tests__/index.test.mjs +80 -0
- package/stylelint/one-utility-class-per-line.mjs +50 -34
- package/stylelint/utils.mjs +25 -19
- package/styles/animations.css +47 -0
- package/styles/base.css +17 -0
- package/styles/effects.css +12 -0
- package/styles/index.css +26 -1127
- package/styles/markdown.css +173 -0
- package/styles/theme.css +175 -0
- package/types.ts +25 -0
- package/Common/AlertBox/index.js +0 -5
- package/Common/AvatarGroup/Avatar/index.js +0 -11
- package/Common/AvatarGroup/Overlay/index.js +0 -6
- package/Common/AvatarGroup/index.js +0 -21
- package/Common/Badge/index.js +0 -7
- package/Common/BadgeGroup/index.js +0 -6
- package/Common/Banner/index.js +0 -4
- package/Common/BaseActiveLink/index.js +0 -14
- package/Common/BaseButton/index.js +0 -10
- package/Common/BaseCodeBox/index.js +0 -50
- package/Common/BaseCrossLink/index.js +0 -12
- package/Common/BaseLinkTabs/index.js +0 -5
- package/Common/BasePagination/Ellipsis/index.js +0 -4
- package/Common/BasePagination/PaginationListItem/index.js +0 -6
- package/Common/BasePagination/PrevNextArrow.js +0 -7
- package/Common/BasePagination/index.js +0 -10
- package/Common/BasePagination/useGetPageElements.js +0 -77
- package/Common/Blockquote/index.js +0 -4
- package/Common/Breadcrumbs/BreadcrumbHomeLink/index.js +0 -9
- package/Common/Breadcrumbs/BreadcrumbItem/index.js +0 -6
- package/Common/Breadcrumbs/BreadcrumbLink/index.js +0 -5
- package/Common/Breadcrumbs/BreadcrumbRoot/index.js +0 -4
- package/Common/Breadcrumbs/BreadcrumbTruncatedItem/index.js +0 -4
- package/Common/Breadcrumbs/index.js +0 -22
- package/Common/ChangeHistory/index.js +0 -9
- package/Common/ChangeHistory/index.module.css +0 -198
- package/Common/CodeTabs/index.js +0 -5
- package/Common/DataTag/index.js +0 -18
- package/Common/GlowingBackdrop/index.js +0 -5
- package/Common/LanguageDropDown/index.js +0 -11
- package/Common/Modal/index.js +0 -10
- package/Common/NodejsLogo/index.js +0 -7
- package/Common/Notification/index.js +0 -6
- package/Common/Preview/index.js +0 -7
- package/Common/Select/index.js +0 -46
- package/Common/Separator/index.js +0 -7
- package/Common/Skeleton/index.js +0 -18
- package/Common/Tabs/index.js +0 -6
- package/Common/ThemeToggle/index.js +0 -7
- package/Common/Tooltip/index.js +0 -8
- package/Containers/Article/index.js +0 -4
- package/Containers/DocSideBar/index.js +0 -1
- package/Containers/Footer/index.js +0 -22
- package/Containers/MetaBar/index.js +0 -12
- package/Containers/NavBar/NavItem/index.js +0 -7
- package/Containers/NavBar/index.js +0 -18
- package/Containers/Sidebar/ProgressionIcon/index.js +0 -3
- package/Containers/Sidebar/SidebarGroup/index.js +0 -9
- package/Containers/Sidebar/SidebarItem/index.js +0 -11
- package/Containers/Sidebar/index.js +0 -15
- package/Icons/HexagonGrid.js +0 -3
- package/Icons/InstallationMethod/Choco.js +0 -3
- package/Icons/InstallationMethod/Devbox.js +0 -3
- package/Icons/InstallationMethod/Docker.js +0 -3
- package/Icons/InstallationMethod/FNM.js +0 -3
- package/Icons/InstallationMethod/Homebrew.js +0 -3
- package/Icons/InstallationMethod/N.js +0 -5
- package/Icons/InstallationMethod/NVM.js +0 -3
- package/Icons/InstallationMethod/Volta.js +0 -3
- package/Icons/Logos/JsGreen.js +0 -3
- package/Icons/Logos/JsWhite.js +0 -3
- package/Icons/Logos/Nodejs.js +0 -6
- package/Icons/Logos/NodejsStackedBlack.js +0 -3
- package/Icons/Logos/NodejsStackedDark.js +0 -3
- package/Icons/Logos/NodejsStackedLight.js +0 -3
- package/Icons/Logos/NodejsStackedWhite.js +0 -3
- package/Icons/OperatingSystem/AIX.js +0 -3
- package/Icons/OperatingSystem/Apple.js +0 -3
- package/Icons/OperatingSystem/Linux.js +0 -3
- package/Icons/OperatingSystem/Microsoft.js +0 -3
- package/Icons/PackageManager/Npm.js +0 -3
- package/Icons/PackageManager/Pnpm.js +0 -3
- package/Icons/PackageManager/Yarn.js +0 -3
- package/Icons/Social/Bluesky.js +0 -3
- package/Icons/Social/Discord.js +0 -3
- package/Icons/Social/GitHub.js +0 -3
- package/Icons/Social/LinkedIn.js +0 -3
- package/Icons/Social/Mastodon.js +0 -3
- package/Icons/Social/Slack.js +0 -3
- package/Icons/Social/X.js +0 -3
- package/MDX/CodeTabs.js +0 -16
- package/types.js +0 -1
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
main {
|
|
2
|
+
@apply flex
|
|
3
|
+
w-full
|
|
4
|
+
flex-col
|
|
5
|
+
gap-6;
|
|
6
|
+
|
|
7
|
+
hr {
|
|
8
|
+
@apply w-full
|
|
9
|
+
border-t
|
|
10
|
+
border-t-neutral-200
|
|
11
|
+
bg-white
|
|
12
|
+
dark:border-t-neutral-900
|
|
13
|
+
dark:bg-neutral-950;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
h1 {
|
|
17
|
+
@apply text-3xl;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
h2 {
|
|
21
|
+
@apply text-2xl;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
h3 {
|
|
25
|
+
@apply text-xl;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
h4 {
|
|
29
|
+
@apply text-lg;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
h5,
|
|
33
|
+
h6 {
|
|
34
|
+
@apply text-base;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
h1,
|
|
38
|
+
h2,
|
|
39
|
+
h3,
|
|
40
|
+
h4,
|
|
41
|
+
h5,
|
|
42
|
+
h6 {
|
|
43
|
+
@apply font-semibold
|
|
44
|
+
text-neutral-900
|
|
45
|
+
dark:text-white;
|
|
46
|
+
|
|
47
|
+
&[id] a {
|
|
48
|
+
@apply text-neutral-900
|
|
49
|
+
dark:text-white;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
strong {
|
|
54
|
+
@apply font-semibold;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
code {
|
|
58
|
+
@apply font-ibm-plex-mono
|
|
59
|
+
rounded-xs
|
|
60
|
+
bg-neutral-100
|
|
61
|
+
px-1
|
|
62
|
+
text-base
|
|
63
|
+
font-semibold
|
|
64
|
+
text-neutral-900
|
|
65
|
+
dark:bg-neutral-900
|
|
66
|
+
dark:text-white;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
p {
|
|
70
|
+
@apply text-neutral-900
|
|
71
|
+
dark:text-white;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* link that isn't inside a heading */
|
|
75
|
+
a:not(h1 > a):not(h2 > a):not(h3 > a):not(h4 > a):not(h5 > a):not(h6 > a),
|
|
76
|
+
.anchor {
|
|
77
|
+
@apply max-xs:font-semibold
|
|
78
|
+
text-green-600
|
|
79
|
+
dark:text-green-400;
|
|
80
|
+
|
|
81
|
+
&:hover {
|
|
82
|
+
@apply text-green-900
|
|
83
|
+
dark:text-green-300;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&[role='button'] {
|
|
87
|
+
@apply max-xs:font-regular;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&:has(code) {
|
|
91
|
+
@apply max-xs:decoration-neutral-800
|
|
92
|
+
dark:max-xs:decoration-neutral-200;
|
|
93
|
+
|
|
94
|
+
code {
|
|
95
|
+
@apply text-inherit;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
ul {
|
|
101
|
+
@apply list-disc
|
|
102
|
+
pl-9
|
|
103
|
+
pr-5
|
|
104
|
+
leading-6
|
|
105
|
+
text-neutral-900
|
|
106
|
+
dark:text-white;
|
|
107
|
+
|
|
108
|
+
li div:has(> pre) {
|
|
109
|
+
@apply my-1!;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
ol {
|
|
114
|
+
@apply list-decimal
|
|
115
|
+
px-5
|
|
116
|
+
leading-6
|
|
117
|
+
text-neutral-900
|
|
118
|
+
dark:text-white;
|
|
119
|
+
|
|
120
|
+
li div:has(> pre) {
|
|
121
|
+
@apply my-1!;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
table {
|
|
126
|
+
@apply rounded-xs
|
|
127
|
+
mb-1
|
|
128
|
+
w-full
|
|
129
|
+
border-separate
|
|
130
|
+
border-spacing-0
|
|
131
|
+
border
|
|
132
|
+
border-neutral-200
|
|
133
|
+
text-left
|
|
134
|
+
text-sm
|
|
135
|
+
dark:border-neutral-800;
|
|
136
|
+
|
|
137
|
+
th,
|
|
138
|
+
td {
|
|
139
|
+
@apply max-xs:block
|
|
140
|
+
max-xs:border-l-0
|
|
141
|
+
border
|
|
142
|
+
border-r-0
|
|
143
|
+
border-t-0
|
|
144
|
+
border-neutral-200
|
|
145
|
+
px-4
|
|
146
|
+
py-2
|
|
147
|
+
text-neutral-900
|
|
148
|
+
dark:border-neutral-800
|
|
149
|
+
dark:text-white;
|
|
150
|
+
|
|
151
|
+
> a {
|
|
152
|
+
@apply pr-2;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
th {
|
|
157
|
+
@apply font-semibold;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
tr:last-child td {
|
|
161
|
+
@apply sm:border-b-0;
|
|
162
|
+
|
|
163
|
+
&:last-child {
|
|
164
|
+
@apply max-xs:border-b-0;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
td:first-child,
|
|
169
|
+
th:first-child {
|
|
170
|
+
@apply sm:border-l-0;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
package/styles/theme.css
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
|
|
2
|
+
|
|
3
|
+
@source '../Common';
|
|
4
|
+
@source '../Containers';
|
|
5
|
+
@source '../Icons';
|
|
6
|
+
|
|
7
|
+
@theme {
|
|
8
|
+
--color-green-100: #edf2eb;
|
|
9
|
+
--color-green-200: #c5e5b4;
|
|
10
|
+
--color-green-300: #99cc7d;
|
|
11
|
+
--color-green-400: #84ba64;
|
|
12
|
+
--color-green-500: #5fa04e;
|
|
13
|
+
--color-green-600: #417e38;
|
|
14
|
+
--color-green-700: #2c682c;
|
|
15
|
+
--color-green-800: #2c682c;
|
|
16
|
+
--color-green-900: #1a3f1d;
|
|
17
|
+
--color-neutral-100: #f6f7f9;
|
|
18
|
+
--color-neutral-200: #e9edf0;
|
|
19
|
+
--color-neutral-300: #d9e1e4;
|
|
20
|
+
--color-neutral-400: #cbd4d9;
|
|
21
|
+
--color-neutral-500: #b1bcc2;
|
|
22
|
+
--color-neutral-600: #929fa5;
|
|
23
|
+
--color-neutral-700: #6e7b83;
|
|
24
|
+
--color-neutral-800: #556066;
|
|
25
|
+
--color-neutral-900: #2c3437;
|
|
26
|
+
--color-neutral-950: #0d121c;
|
|
27
|
+
--color-danger-100: #fbf1f0;
|
|
28
|
+
--color-danger-200: #fad3d4;
|
|
29
|
+
--color-danger-300: #fab6b7;
|
|
30
|
+
--color-danger-400: #fa8e8e;
|
|
31
|
+
--color-danger-500: #f65354;
|
|
32
|
+
--color-danger-600: #de1a1b;
|
|
33
|
+
--color-danger-700: #b80c0c;
|
|
34
|
+
--color-danger-800: #900e0e;
|
|
35
|
+
--color-danger-900: #661514;
|
|
36
|
+
--color-warning-100: #fdf3e7;
|
|
37
|
+
--color-warning-200: #fad9b0;
|
|
38
|
+
--color-warning-300: #f5bc75;
|
|
39
|
+
--color-warning-400: #e99c40;
|
|
40
|
+
--color-warning-500: #d07912;
|
|
41
|
+
--color-warning-600: #ae5f00;
|
|
42
|
+
--color-warning-700: #8b4d04;
|
|
43
|
+
--color-warning-800: #683d08;
|
|
44
|
+
--color-warning-900: #4d2f0b;
|
|
45
|
+
--color-info-100: #e9f4fa;
|
|
46
|
+
--color-info-200: #bce6fc;
|
|
47
|
+
--color-info-300: #8ed4f8;
|
|
48
|
+
--color-info-400: #52baed;
|
|
49
|
+
--color-info-500: #229ad6;
|
|
50
|
+
--color-info-600: #0c7bb3;
|
|
51
|
+
--color-info-700: #066291;
|
|
52
|
+
--color-info-800: #074d71;
|
|
53
|
+
--color-info-900: #0a3953;
|
|
54
|
+
--color-accent1-100: #f7f1fb;
|
|
55
|
+
--color-accent1-200: #ead9fb;
|
|
56
|
+
--color-accent1-300: #dbbdf9;
|
|
57
|
+
--color-accent1-400: #c79bf2;
|
|
58
|
+
--color-accent1-500: #af74e8;
|
|
59
|
+
--color-accent1-600: #9756d6;
|
|
60
|
+
--color-accent1-700: #7d3cbe;
|
|
61
|
+
--color-accent1-800: #642b9e;
|
|
62
|
+
--color-accent1-900: #361b52;
|
|
63
|
+
--color-accent2-100: #fbf0f4;
|
|
64
|
+
--color-accent2-200: #fbd4e6;
|
|
65
|
+
--color-accent2-300: #fbb4d2;
|
|
66
|
+
--color-accent2-400: #f68bb7;
|
|
67
|
+
--color-accent2-500: #ed5393;
|
|
68
|
+
--color-accent2-600: #d6246e;
|
|
69
|
+
--color-accent2-700: #b01356;
|
|
70
|
+
--color-accent2-800: #8b1245;
|
|
71
|
+
--color-accent2-900: #411526;
|
|
72
|
+
--color-pulse-100: #0000330f;
|
|
73
|
+
--color-pulse-200: #00002d17;
|
|
74
|
+
--color-pulse-300: #ddeaf814;
|
|
75
|
+
--color-pulse-400: #d3edf81d;
|
|
76
|
+
--color-white: #fff;
|
|
77
|
+
--color-transparent: 'transparent';
|
|
78
|
+
--color-shadow: #101828;
|
|
79
|
+
--shadow-xs: 0px 1px 2px 0px --alpha(var(--color-shadow, #101828) / 5%);
|
|
80
|
+
--shadow-lg:
|
|
81
|
+
0px 4px 6px -2px --alpha(var(--color-shadow, #101828) / 3%),
|
|
82
|
+
0px 12px 16px -4px --alpha(var(--color-shadow, #101828) / 8%);
|
|
83
|
+
|
|
84
|
+
/* TODO(@avivkeller): The --font-xyz-xyz variable is assigned by Next.js in apps/site.
|
|
85
|
+
Ideally, this package shouldn't depend on the consuming application's
|
|
86
|
+
variables, it should remain self-contained. */
|
|
87
|
+
--font-open-sans: var(--font-open-sans);
|
|
88
|
+
--font-ibm-plex-mono: var(--font-ibm-plex-mono);
|
|
89
|
+
--font-weight-regular: 400;
|
|
90
|
+
--font-weight-medium: 500;
|
|
91
|
+
--font-weight-semibold: 600;
|
|
92
|
+
--font-weight-bold: 700;
|
|
93
|
+
--font-xs: 0.75rem;
|
|
94
|
+
--font-xs-line-height: 1rem;
|
|
95
|
+
--font-sm: 0.87rem;
|
|
96
|
+
--font-sm-line-height: 1.25rem;
|
|
97
|
+
--font-base: 1rem;
|
|
98
|
+
--font-base-line-height: 1.5rem;
|
|
99
|
+
--font-lg: 1.125rem;
|
|
100
|
+
--font-lg-line-height: 1.75rem;
|
|
101
|
+
--font-xl: 1.25rem;
|
|
102
|
+
--font-xl-line-height: 1.875rem;
|
|
103
|
+
--font-2xl: 1.5rem;
|
|
104
|
+
--font-2xl-line-height: 2rem;
|
|
105
|
+
--font-3xl: 1.875rem;
|
|
106
|
+
--font-3xl-line-height: 2.25rem;
|
|
107
|
+
--font-4xl: 2.25rem;
|
|
108
|
+
--font-4xl-line-height: 2.5rem;
|
|
109
|
+
--font-5xl: 3rem;
|
|
110
|
+
--font-5xl-line-height: 3rem;
|
|
111
|
+
--font-6xl: 3.75rem;
|
|
112
|
+
--font-6xl-line-height: 3.75rem;
|
|
113
|
+
--font-7xl: 4.5rem;
|
|
114
|
+
--font-7xl-line-height: 4.5rem;
|
|
115
|
+
--breakpoint-xs: 670px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@utility scrollbar-thin {
|
|
119
|
+
scrollbar-width: thin;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@utility max-w-8xl {
|
|
123
|
+
max-width: 95rem;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@utility bg-gradient-subtle-dark {
|
|
127
|
+
background-image: linear-gradient(
|
|
128
|
+
180deg,
|
|
129
|
+
--alpha(var(--color-neutral-900) / 50%) 0%,
|
|
130
|
+
--alpha(var(--color-neutral-900) / 0%) 48.32%
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@utility bg-gradient-subtle {
|
|
135
|
+
background-image: linear-gradient(
|
|
136
|
+
180deg,
|
|
137
|
+
--alpha(var(--color-neutral-100) / 50%) 0%,
|
|
138
|
+
--alpha(var(--color-neutral-100) / 0%) 48.32%
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@utility bg-gradient-subtle-gray {
|
|
143
|
+
background-image: linear-gradient(
|
|
144
|
+
180deg,
|
|
145
|
+
var(--color-neutral-900) 0%,
|
|
146
|
+
--alpha(var(--color-neutral-900) / 80%) 100%
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@utility bg-gradient-subtle-white {
|
|
151
|
+
background-image: linear-gradient(
|
|
152
|
+
180deg,
|
|
153
|
+
var(--color-white) 0%,
|
|
154
|
+
--alpha(var(--color-white) / 80%) 100%
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@utility bg-gradient-glow-backdrop {
|
|
159
|
+
background-image: radial-gradient(
|
|
160
|
+
8em circle at calc(50%) 10px,
|
|
161
|
+
var(--color-green-400),
|
|
162
|
+
transparent 30%
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@utility bg-gradient-radial {
|
|
167
|
+
background-image: radial-gradient(
|
|
168
|
+
var(--tw-gradient-from),
|
|
169
|
+
var(--tw-gradient-to)
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@utility text-inherit {
|
|
174
|
+
color: inherit;
|
|
175
|
+
}
|
package/types.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SVGProps,
|
|
3
|
+
AnchorHTMLAttributes,
|
|
4
|
+
ReactElement,
|
|
5
|
+
JSXElementConstructor,
|
|
6
|
+
ReactNode,
|
|
7
|
+
} from 'react';
|
|
8
|
+
|
|
9
|
+
export type LogoVariant = 'default' | 'pride';
|
|
10
|
+
export type TailwindSVG = SVGProps<SVGSVGElement> & { tw?: string };
|
|
11
|
+
export type BlogPreviewType = 'announcements' | 'release' | 'vulnerability';
|
|
12
|
+
export type LinkLike =
|
|
13
|
+
| JSXElementConstructor<AnchorHTMLAttributes<HTMLAnchorElement>>
|
|
14
|
+
| 'a';
|
|
15
|
+
|
|
16
|
+
export type FormattedMessage =
|
|
17
|
+
| string
|
|
18
|
+
| ReactElement<HTMLElement, string | JSXElementConstructor<HTMLElement>>
|
|
19
|
+
| ReadonlyArray<ReactNode>;
|
|
20
|
+
|
|
21
|
+
export type SimpleLocaleConfig = {
|
|
22
|
+
code: string;
|
|
23
|
+
localName: string;
|
|
24
|
+
name: string;
|
|
25
|
+
};
|
package/Common/AlertBox/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import styles from './index.module.css';
|
|
4
|
-
const AlertBox = ({ level, title, children, size = 'default', }) => (_jsxs("div", { className: classNames(styles.alertBox, styles[level], styles[size]), children: [_jsx("span", { className: styles.title, children: title }), _jsx("span", { children: children })] }));
|
|
5
|
-
export default AlertBox;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as RadixAvatar from '@radix-ui/react-avatar';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
import { forwardRef } from 'react';
|
|
5
|
-
import styles from './index.module.css';
|
|
6
|
-
const Avatar = forwardRef(({ image, nickname, name, fallback, url, size = 'small', as: Component = 'a', ...props }, ref) => {
|
|
7
|
-
if (!url)
|
|
8
|
-
Component = 'div';
|
|
9
|
-
return (_jsx(RadixAvatar.Root, { ...props, ref: ref, className: classNames(styles.avatar, styles[size], props.className), children: _jsxs(Component, { href: url || undefined, target: url ? '_blank' : undefined, className: styles.wrapper, children: [_jsx(RadixAvatar.Image, { loading: "lazy", decoding: "async", src: image, alt: name || nickname, className: styles.item }), _jsx(RadixAvatar.Fallback, { className: classNames(styles.item, styles[size]), children: fallback })] }) }));
|
|
10
|
-
});
|
|
11
|
-
export default Avatar;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ArrowUpRightIcon } from '@heroicons/react/24/solid';
|
|
3
|
-
import Avatar from '#ui/Common/AvatarGroup/Avatar';
|
|
4
|
-
import styles from './index.module.css';
|
|
5
|
-
const AvatarOverlay = ({ image, name, nickname, fallback, url, as: Component = 'a', }) => (_jsxs(Component, { className: styles.overlay, href: url, target: "_blank", children: [_jsx(Avatar, { image: image, name: name, nickname: nickname, fallback: fallback, size: "medium" }), _jsxs("div", { className: styles.user, children: [name && _jsx("div", { className: styles.name, children: name }), nickname && _jsx("div", { className: styles.nickname, children: nickname })] }), _jsx(ArrowUpRightIcon, { className: styles.arrow })] }));
|
|
6
|
-
export default AvatarOverlay;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
import { useState, useMemo } from 'react';
|
|
5
|
-
import Avatar from '#ui/Common/AvatarGroup/Avatar';
|
|
6
|
-
import avatarstyles from '#ui/Common/AvatarGroup/Avatar/index.module.css';
|
|
7
|
-
import AvatarOverlay from '#ui/Common/AvatarGroup/Overlay';
|
|
8
|
-
import Tooltip from '#ui/Common/Tooltip';
|
|
9
|
-
import styles from './index.module.css';
|
|
10
|
-
const AvatarGroup = ({ avatars, limit = 10, isExpandable = true, size = 'small', container, as, }) => {
|
|
11
|
-
const [showMore, setShowMore] = useState(false);
|
|
12
|
-
const renderAvatars = useMemo(() => avatars.slice(0, showMore ? avatars.length : limit), [avatars, limit, showMore]);
|
|
13
|
-
const handleShowMoreClick = isExpandable
|
|
14
|
-
? () => setShowMore(prev => !prev)
|
|
15
|
-
: undefined;
|
|
16
|
-
return (_jsxs("div", { className: classNames(styles.avatarGroup, styles[size]), children: [renderAvatars.map(avatar => (_jsx(Tooltip, { asChild: true, container: container, content: _jsx(AvatarOverlay, { ...avatar, as: as }), children: _jsx(Avatar, { ...avatar, size: size, className: classNames({
|
|
17
|
-
'cursor-pointer': avatar.url,
|
|
18
|
-
'pointer-events-none': !avatar.url,
|
|
19
|
-
}), as: as }) }, avatar.nickname))), avatars.length > limit && (_jsx("span", { onClick: handleShowMoreClick, className: classNames(avatarstyles.avatar, avatarstyles[size], 'cursor-pointer'), children: _jsx("span", { className: avatarstyles.item, children: `${showMore ? '-' : '+'}${avatars.length - limit}` }) }))] }));
|
|
20
|
-
};
|
|
21
|
-
export default AvatarGroup;
|
package/Common/Badge/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import styles from './index.module.css';
|
|
4
|
-
const Badge = ({ kind = 'default', size = 'medium', className, children, ...props }) => {
|
|
5
|
-
return (_jsx("span", { className: classNames(styles.badge, styles[kind], styles[size], className), ...props, children: children }));
|
|
6
|
-
};
|
|
7
|
-
export default Badge;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import ArrowRightIcon from '@heroicons/react/24/solid/ArrowRightIcon';
|
|
3
|
-
import Badge from '#ui/Common/Badge';
|
|
4
|
-
import styles from './index.module.css';
|
|
5
|
-
const BadgeGroup = ({ kind = 'default', badgeText, children, as: Component = 'a', ...args }) => (_jsxs(Component, { className: `${styles.wrapper} ${styles[kind]}`, ...args, children: [badgeText && (_jsx(Badge, { kind: kind, className: styles.badge, children: badgeText })), _jsx("span", { className: styles.message, children: children }), args.href && _jsx(ArrowRightIcon, { className: styles.icon })] }));
|
|
6
|
-
export default BadgeGroup;
|
package/Common/Banner/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import styles from './index.module.css';
|
|
3
|
-
const Banner = ({ type = 'default', children, }) => (_jsx("div", { className: `${styles.banner} ${styles[type] || styles.default}`, children: children }));
|
|
4
|
-
export default Banner;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
const BaseActiveLink = ({ activeClassName = 'active', allowSubPath = false, className, href = '', pathname = '/', as: Component = 'a', ...props }) => {
|
|
4
|
-
const finalClassName = classNames(className, {
|
|
5
|
-
[activeClassName]: allowSubPath
|
|
6
|
-
? // When using allowSubPath we want only to check if
|
|
7
|
-
// the current pathname starts with the utmost upper level
|
|
8
|
-
// of an href (e.g. /docs/...)
|
|
9
|
-
pathname.startsWith(`/${href.toString().split('/')[1]}`)
|
|
10
|
-
: href.toString() === pathname,
|
|
11
|
-
});
|
|
12
|
-
return _jsx(Component, { className: finalClassName, href: href, ...props });
|
|
13
|
-
};
|
|
14
|
-
export default BaseActiveLink;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import styles from './index.module.css';
|
|
4
|
-
const BaseButton = ({ kind = 'primary', size = 'default', disabled = false, className, as: Component = 'a', ...props }) => {
|
|
5
|
-
if ('href' in props && Component) {
|
|
6
|
-
return (_jsx(Component, { role: "button", href: disabled ? undefined : props.href, "aria-disabled": disabled, className: classNames(styles.button, styles[kind], styles[size], className), tabIndex: disabled ? -1 : 0, ...props }));
|
|
7
|
-
}
|
|
8
|
-
return (_jsx("button", { disabled: disabled, className: classNames(styles.button, styles[kind], styles[size], className), type: "button", ...props }));
|
|
9
|
-
};
|
|
10
|
-
export default BaseButton;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { DocumentDuplicateIcon } from '@heroicons/react/24/outline';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { Fragment, isValidElement, useRef } from 'react';
|
|
6
|
-
import BaseButton from '#ui/Common/BaseButton';
|
|
7
|
-
import styles from './index.module.css';
|
|
8
|
-
// Transforms a code element with plain text content into a more structured
|
|
9
|
-
// format for rendering with line numbers
|
|
10
|
-
const transformCode = (code, language) => {
|
|
11
|
-
if (!isValidElement(code)) {
|
|
12
|
-
// Early return when the `CodeBox` child is not a valid element since the
|
|
13
|
-
// type is a ReactNode, and can assume any value
|
|
14
|
-
return code;
|
|
15
|
-
}
|
|
16
|
-
const content = code.props?.children;
|
|
17
|
-
if (code.type !== 'code' || typeof content !== 'string') {
|
|
18
|
-
// There is no need to transform an element that is not a code element or
|
|
19
|
-
// a content that is not a string
|
|
20
|
-
return code;
|
|
21
|
-
}
|
|
22
|
-
// Note that since we use `.split` we will have an extra entry
|
|
23
|
-
// being an empty string, so we need to remove it
|
|
24
|
-
const lines = content.split('\n');
|
|
25
|
-
const extraStyle = language.length === 0 ? { fontFamily: 'monospace' } : {};
|
|
26
|
-
return (_jsx("code", { style: extraStyle, children: lines
|
|
27
|
-
.flatMap((line, lineIndex) => {
|
|
28
|
-
const columns = line.split(' ');
|
|
29
|
-
return [
|
|
30
|
-
_jsx("span", { className: "line", children: columns.map((column, columnIndex) => (_jsxs(Fragment, { children: [_jsx("span", { children: column }), columnIndex < columns.length - 1 && _jsx("span", { children: " " })] }, columnIndex))) }, lineIndex),
|
|
31
|
-
// Add a break line so the text content is formatted correctly
|
|
32
|
-
// when copying to clipboard
|
|
33
|
-
'\n',
|
|
34
|
-
];
|
|
35
|
-
})
|
|
36
|
-
// Here we remove that empty line from before and
|
|
37
|
-
// the last flatMap entry which is an `\n`
|
|
38
|
-
.slice(0, -2) }));
|
|
39
|
-
};
|
|
40
|
-
const BaseCodeBox = ({ children, language, className, onCopy, buttonText, as = 'a', showCopyButton = true, }) => {
|
|
41
|
-
const containerRef = useRef(null);
|
|
42
|
-
const handleCopy = () => {
|
|
43
|
-
const text = containerRef.current?.textContent;
|
|
44
|
-
if (text) {
|
|
45
|
-
onCopy(text);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
return (_jsxs("div", { className: styles.root, children: [_jsx("pre", { ref: containerRef, className: classNames(styles.content, className), tabIndex: 0, children: transformCode(children, language) }), language && (_jsxs("div", { className: styles.footer, children: [_jsx("span", { className: styles.language, children: language }), showCopyButton && (_jsxs(BaseButton, { as: as, className: styles.action, kind: "neutral", onClick: handleCopy, children: [_jsx(DocumentDuplicateIcon, { className: styles.icon }), buttonText] }))] }))] }));
|
|
49
|
-
};
|
|
50
|
-
export default BaseCodeBox;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import PrevNextArrow from '#ui/Common/BasePagination/PrevNextArrow';
|
|
4
|
-
import styles from './index.module.css';
|
|
5
|
-
const BaseCrossLink = ({ type, label, text, link, as: Component = 'a', }) => {
|
|
6
|
-
return (_jsxs(Component, { className: styles.crossLink, href: link, children: [_jsxs("span", { className: classNames(styles.header, {
|
|
7
|
-
[styles.reverse]: type === 'next',
|
|
8
|
-
}), children: [_jsx(PrevNextArrow, { className: styles.icon, type: type }), label] }), _jsx("span", { className: classNames(styles.content, {
|
|
9
|
-
[styles.reverse]: type === 'next',
|
|
10
|
-
}), children: text })] }));
|
|
11
|
-
};
|
|
12
|
-
export default BaseCrossLink;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Select from '#ui/Common/Select';
|
|
3
|
-
import styles from './index.module.css';
|
|
4
|
-
const BaseLinkTabs = ({ tabs, label, activeTab, children, as: Component = 'a', onSelect, }) => (_jsxs(_Fragment, { children: [_jsx("div", { className: styles.tabsList, children: tabs.map(tab => (_jsx(Component, { href: tab.link, className: styles.tabsTrigger, "data-state": tab.key === activeTab ? 'active' : 'inactive', children: tab.label }, tab.key))) }), _jsx("div", { className: styles.tabsSelect, children: _jsx(Select, { label: label, defaultValue: tabs.find(tab => tab.key === activeTab)?.link, values: tabs.map(tab => ({ label: tab.label, value: tab.link })), onChange: onSelect }) }), children] }));
|
|
5
|
-
export default BaseLinkTabs;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import styles from './index.module.css';
|
|
3
|
-
const PaginationListItem = ({ url, pageNumber, currentPage, totalPages, as: Component = 'a', label, }) => {
|
|
4
|
-
return (_jsx("li", { "aria-setsize": totalPages, "aria-posinset": pageNumber, children: _jsx(Component, { href: url, "aria-label": label, className: styles.listItem, ...(pageNumber === currentPage && { 'aria-current': 'page' }), children: _jsx("span", { children: pageNumber }) }) }, pageNumber));
|
|
5
|
-
};
|
|
6
|
-
export default PaginationListItem;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/solid';
|
|
3
|
-
const PrevNextArrow = ({ type, ...extra }) => {
|
|
4
|
-
const ChevronComponent = type === 'previous' ? ChevronLeftIcon : ChevronRightIcon;
|
|
5
|
-
return _jsx(ChevronComponent, { ...extra });
|
|
6
|
-
};
|
|
7
|
-
export default PrevNextArrow;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ArrowRightIcon, ArrowLeftIcon } from '@heroicons/react/20/solid';
|
|
3
|
-
import Button from '#ui/Common/BaseButton';
|
|
4
|
-
import { useGetPageElements } from '#ui/Common/BasePagination/useGetPageElements';
|
|
5
|
-
import styles from './index.module.css';
|
|
6
|
-
const BasePagination = ({ currentPage, pages, as = 'a', currentPageSiblingsCount = 1, labels, getPageLabel, }) => {
|
|
7
|
-
const parsedPages = useGetPageElements(currentPage, pages, currentPageSiblingsCount, as, getPageLabel);
|
|
8
|
-
return (_jsxs("nav", { "aria-label": labels.aria, className: styles.pagination, children: [_jsxs(Button, { as: as, "aria-label": labels.prevAria, disabled: currentPage === 1, kind: "secondary", className: styles.previousButton, href: pages[currentPage - 2]?.url, children: [_jsx(ArrowLeftIcon, { className: styles.arrowIcon }), _jsx("span", { children: labels.prev })] }), _jsx("ol", { className: styles.list, children: parsedPages }), _jsxs(Button, { as: as, "aria-label": labels.nextAria, disabled: currentPage === pages.length, kind: "secondary", className: styles.nextButton, href: pages[currentPage]?.url, children: [_jsx("span", { children: labels.next }), _jsx(ArrowRightIcon, { className: styles.arrowIcon })] })] }));
|
|
9
|
-
};
|
|
10
|
-
export default BasePagination;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import Ellipsis from '#ui/Common/BasePagination/Ellipsis';
|
|
3
|
-
import PaginationListItem from '#ui/Common/BasePagination/PaginationListItem';
|
|
4
|
-
const parsePages = (pages, currentPage, totalPages, as, getLabel) => pages.map(({ url }, index) => ({
|
|
5
|
-
url,
|
|
6
|
-
pageNumber: index + 1,
|
|
7
|
-
currentPage,
|
|
8
|
-
totalPages,
|
|
9
|
-
label: getLabel(index + 1),
|
|
10
|
-
as,
|
|
11
|
-
}));
|
|
12
|
-
const createPaginationListItems = (parsedPages) => parsedPages.map(page => _jsx(PaginationListItem, { ...page }, page.url));
|
|
13
|
-
// The minimum amount of elements are first page, current page, and last page
|
|
14
|
-
const MINIMUM_AMOUNT_OF_ELEMENTS = 3;
|
|
15
|
-
// Not more than two ellipses will be shown at the same time
|
|
16
|
-
const MAXIMUM_AMOUNT_OF_ELLIPSES = 2;
|
|
17
|
-
// The logic of this custom hook has taken the internal logic of
|
|
18
|
-
// React MUI's Pagination component as reference. More info here:
|
|
19
|
-
// https://github.com/mui/material-ui/blob/master/packages/mui-material/src/usePagination/usePagination.js
|
|
20
|
-
export const useGetPageElements = (currentPage, pages, currentPageSiblingsCount, as, getLabel) => {
|
|
21
|
-
const totalPages = pages.length;
|
|
22
|
-
const parsedPages = parsePages(pages, currentPage, totalPages, as, getLabel);
|
|
23
|
-
const currentPageIndex = currentPage - 1;
|
|
24
|
-
// We multiply it by two (2) as siblings are located on both left and right sides
|
|
25
|
-
// of the current page
|
|
26
|
-
const totalSiblingsCount = 2 * currentPageSiblingsCount;
|
|
27
|
-
const visiblePages = totalSiblingsCount +
|
|
28
|
-
MINIMUM_AMOUNT_OF_ELEMENTS +
|
|
29
|
-
MAXIMUM_AMOUNT_OF_ELLIPSES;
|
|
30
|
-
// When there are more pages than the visible pages to be shown
|
|
31
|
-
// we do not need to perform any calculations
|
|
32
|
-
if (totalPages <= visiblePages) {
|
|
33
|
-
return createPaginationListItems(parsedPages);
|
|
34
|
-
}
|
|
35
|
-
// The index of the far-left sibling of the current page
|
|
36
|
-
const leftSiblingsFirstIndex = Math.max(currentPageIndex - currentPageSiblingsCount, 1);
|
|
37
|
-
// The index of the far-right sibling of the current page
|
|
38
|
-
const rightSiblingsLastIndex = Math.min(currentPageIndex + currentPageSiblingsCount + 1, totalPages);
|
|
39
|
-
const firstIndex = 0;
|
|
40
|
-
const lastIndex = totalPages - 1;
|
|
41
|
-
// If there are at least two (2) elements between the far-left sibling of
|
|
42
|
-
// the current page, and the first page, we should show left ellipsis
|
|
43
|
-
// between them
|
|
44
|
-
const hasLeftEllipsis = leftSiblingsFirstIndex > firstIndex + 2;
|
|
45
|
-
// If there are at least two (2) elements between the far-right sibling of
|
|
46
|
-
// the current page, and the last page, we should show right ellipsis
|
|
47
|
-
// between them
|
|
48
|
-
const hasRightEllipsis = rightSiblingsLastIndex < lastIndex - 1;
|
|
49
|
-
if (!hasLeftEllipsis && hasRightEllipsis) {
|
|
50
|
-
const leftPagesLastIndex = MINIMUM_AMOUNT_OF_ELEMENTS + totalSiblingsCount;
|
|
51
|
-
const leftPages = parsedPages.slice(firstIndex, leftPagesLastIndex);
|
|
52
|
-
return [
|
|
53
|
-
...createPaginationListItems(leftPages),
|
|
54
|
-
_jsx(Ellipsis, {}, "ellipsis"),
|
|
55
|
-
...createPaginationListItems(parsedPages.slice(lastIndex)),
|
|
56
|
-
];
|
|
57
|
-
}
|
|
58
|
-
if (hasLeftEllipsis && !hasRightEllipsis) {
|
|
59
|
-
const rightPagesFirstIndex = MINIMUM_AMOUNT_OF_ELEMENTS + totalSiblingsCount;
|
|
60
|
-
const rightPages = parsedPages.slice(totalPages - rightPagesFirstIndex);
|
|
61
|
-
return [
|
|
62
|
-
...createPaginationListItems(parsedPages.slice(firstIndex, firstIndex + 1)),
|
|
63
|
-
_jsx(Ellipsis, {}, "ellipsis"),
|
|
64
|
-
...createPaginationListItems(rightPages),
|
|
65
|
-
];
|
|
66
|
-
}
|
|
67
|
-
if (hasLeftEllipsis && hasRightEllipsis) {
|
|
68
|
-
const middlePages = parsedPages.slice(leftSiblingsFirstIndex, rightSiblingsLastIndex);
|
|
69
|
-
return [
|
|
70
|
-
...createPaginationListItems(parsedPages.slice(firstIndex, firstIndex + 1)),
|
|
71
|
-
_jsx(Ellipsis, {}, "ellipsis-1"),
|
|
72
|
-
...createPaginationListItems(middlePages),
|
|
73
|
-
_jsx(Ellipsis, {}, "ellipsis-2"),
|
|
74
|
-
...createPaginationListItems(parsedPages.slice(lastIndex)),
|
|
75
|
-
];
|
|
76
|
-
}
|
|
77
|
-
};
|