@node-core/ui-components 1.0.1-cc5c2626b0639fe2088a736f54169ea3e10ed325 → 1.0.1-da75492230302b0f459aab323d2f6fdac6269a06
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.js +5 -0
- package/Common/AlertBox/index.module.css +2 -83
- package/Common/AvatarGroup/Avatar/index.js +11 -0
- package/Common/AvatarGroup/Avatar/index.module.css +2 -40
- package/Common/AvatarGroup/Overlay/index.js +6 -0
- package/Common/AvatarGroup/Overlay/index.module.css +2 -31
- package/Common/AvatarGroup/index.js +21 -0
- package/Common/AvatarGroup/index.module.css +2 -21
- package/Common/Badge/index.js +5 -0
- package/Common/Badge/index.module.css +2 -38
- package/Common/BadgeGroup/index.js +6 -0
- package/Common/BadgeGroup/index.module.css +2 -77
- package/Common/Banner/index.js +4 -0
- package/Common/Banner/index.module.css +2 -42
- package/Common/BaseActiveLink/index.js +14 -0
- package/Common/BaseButton/index.js +10 -0
- package/Common/BaseButton/index.module.css +2 -145
- package/Common/BaseCodeBox/index.js +50 -0
- package/Common/BaseCodeBox/index.module.css +2 -78
- package/Common/BaseCrossLink/index.js +12 -0
- package/Common/BaseCrossLink/index.module.css +2 -51
- package/Common/BaseLinkTabs/index.js +5 -0
- package/Common/BaseLinkTabs/index.module.css +2 -43
- package/Common/BasePagination/Ellipsis/index.js +4 -0
- package/Common/BasePagination/Ellipsis/index.module.css +2 -10
- package/Common/BasePagination/PaginationListItem/index.js +6 -0
- package/Common/BasePagination/PaginationListItem/index.module.css +2 -27
- package/Common/BasePagination/PrevNextArrow.js +7 -0
- package/Common/BasePagination/index.js +10 -0
- package/Common/BasePagination/index.module.css +2 -39
- package/Common/BasePagination/useGetPageElements.js +77 -0
- package/Common/Blockquote/index.js +4 -0
- package/Common/Blockquote/index.module.css +2 -29
- package/Common/Breadcrumbs/BreadcrumbHomeLink/index.js +9 -0
- package/Common/Breadcrumbs/BreadcrumbHomeLink/index.module.css +2 -5
- package/Common/Breadcrumbs/BreadcrumbItem/index.js +6 -0
- package/Common/Breadcrumbs/BreadcrumbItem/index.module.css +2 -41
- package/Common/Breadcrumbs/BreadcrumbLink/index.js +5 -0
- package/Common/Breadcrumbs/BreadcrumbLink/index.module.css +2 -22
- package/Common/Breadcrumbs/BreadcrumbRoot/index.js +4 -0
- package/Common/Breadcrumbs/BreadcrumbRoot/index.module.css +2 -9
- package/Common/Breadcrumbs/BreadcrumbTruncatedItem/index.js +4 -0
- package/Common/Breadcrumbs/index.js +22 -0
- package/Common/ChangeHistory/index.js +9 -0
- package/Common/ChangeHistory/index.module.css +2 -83
- package/Common/CodeTabs/index.js +5 -0
- package/Common/CodeTabs/index.module.css +2 -56
- package/Common/DataTag/index.js +18 -0
- package/Common/DataTag/index.module.css +2 -56
- package/Common/GlowingBackdrop/index.js +5 -0
- package/Common/GlowingBackdrop/index.module.css +2 -32
- package/Common/LanguageDropDown/index.js +11 -0
- package/Common/LanguageDropDown/index.module.css +2 -53
- package/Common/Modal/index.js +10 -0
- package/Common/Modal/index.module.css +2 -79
- package/Common/NodejsLogo/index.js +7 -0
- package/Common/NodejsLogo/index.module.css +2 -6
- package/Common/Notification/index.js +6 -0
- package/Common/Notification/index.module.css +2 -20
- package/Common/Preview/index.js +7 -0
- package/Common/Preview/index.module.css +2 -79
- package/Common/Select/index.js +47 -0
- package/Common/Select/index.module.css +2 -161
- package/Common/Separator/index.js +7 -0
- package/Common/Separator/index.module.css +2 -16
- package/Common/Skeleton/index.js +18 -0
- package/Common/Skeleton/index.module.css +2 -30
- package/Common/Tabs/index.js +6 -0
- package/Common/Tabs/index.module.css +2 -54
- package/Common/ThemeToggle/index.js +7 -0
- package/Common/ThemeToggle/index.module.css +2 -15
- package/Common/Tooltip/index.js +8 -0
- package/Common/Tooltip/index.module.css +2 -43
- package/Containers/Article/index.js +4 -0
- package/Containers/Article/index.module.css +2 -70
- package/Containers/Footer/index.js +21 -0
- package/Containers/Footer/index.module.css +2 -46
- package/Containers/MetaBar/index.js +12 -0
- package/Containers/MetaBar/index.module.css +2 -91
- package/Containers/NavBar/NavItem/index.js +7 -0
- package/Containers/NavBar/NavItem/index.module.css +2 -60
- package/Containers/NavBar/index.js +18 -0
- package/Containers/NavBar/index.module.css +2 -125
- package/Containers/Sidebar/ProgressionIcon/index.js +3 -0
- package/Containers/Sidebar/SidebarGroup/index.js +9 -0
- package/Containers/Sidebar/SidebarGroup/index.module.css +2 -64
- package/Containers/Sidebar/SidebarItem/index.js +11 -0
- package/Containers/Sidebar/SidebarItem/index.module.css +2 -56
- package/Containers/Sidebar/index.js +15 -0
- package/Containers/Sidebar/index.module.css +2 -30
- package/Icons/HexagonGrid.js +3 -0
- package/Icons/InstallationMethod/Choco.js +3 -0
- package/Icons/InstallationMethod/Devbox.js +3 -0
- package/Icons/InstallationMethod/Docker.js +3 -0
- package/Icons/InstallationMethod/FNM.js +3 -0
- package/Icons/InstallationMethod/Homebrew.js +3 -0
- package/Icons/InstallationMethod/N.js +5 -0
- package/Icons/InstallationMethod/NVM.js +3 -0
- package/Icons/InstallationMethod/Volta.js +3 -0
- package/Icons/InstallationMethod/{index.ts → index.js} +0 -1
- package/Icons/Logos/JsWhite.js +3 -0
- package/Icons/Logos/Nodejs.js +12 -0
- package/Icons/Logos/index.js +3 -0
- package/Icons/OperatingSystem/AIX.js +3 -0
- package/Icons/OperatingSystem/Apple.js +3 -0
- package/Icons/OperatingSystem/Linux.js +3 -0
- package/Icons/OperatingSystem/Microsoft.js +3 -0
- package/Icons/OperatingSystem/{index.ts → index.js} +0 -1
- package/Icons/PackageManager/Npm.js +3 -0
- package/Icons/PackageManager/Pnpm.js +3 -0
- package/Icons/PackageManager/Yarn.js +3 -0
- package/Icons/PackageManager/{index.ts → index.js} +0 -1
- package/Icons/Social/Bluesky.js +3 -0
- package/Icons/Social/Discord.js +3 -0
- package/Icons/Social/GitHub.js +3 -0
- package/Icons/Social/LinkedIn.js +3 -0
- package/Icons/Social/Mastodon.js +3 -0
- package/Icons/Social/Slack.js +3 -0
- package/Icons/Social/X.js +3 -0
- package/Icons/Social/{index.ts → index.js} +0 -1
- package/MDX/CodeTabs.js +25 -0
- package/Providers/NotificationProvider/index.js +16 -0
- package/Providers/NotificationProvider/index.module.css +2 -0
- package/package.json +6 -51
- package/stylelint/one-utility-class-per-line.mjs +34 -50
- package/stylelint/utils.mjs +19 -25
- package/styles/index.css +2 -38
- package/types.js +1 -0
- package/Common/AlertBox/index.stories.tsx +0 -96
- package/Common/AlertBox/index.tsx +0 -24
- package/Common/AvatarGroup/Avatar/index.stories.tsx +0 -22
- package/Common/AvatarGroup/Avatar/index.tsx +0 -67
- package/Common/AvatarGroup/Overlay/index.stories.tsx +0 -33
- package/Common/AvatarGroup/Overlay/index.tsx +0 -37
- package/Common/AvatarGroup/__tests__/index.test.jsx +0 -55
- package/Common/AvatarGroup/index.stories.tsx +0 -56
- package/Common/AvatarGroup/index.tsx +0 -83
- package/Common/Badge/index.stories.tsx +0 -38
- package/Common/Badge/index.tsx +0 -35
- package/Common/BadgeGroup/index.stories.tsx +0 -35
- package/Common/BadgeGroup/index.tsx +0 -35
- package/Common/Banner/index.stories.tsx +0 -29
- package/Common/Banner/index.tsx +0 -18
- package/Common/BaseActiveLink/__tests__/index.test.jsx +0 -52
- package/Common/BaseActiveLink/index.tsx +0 -34
- package/Common/BaseButton/index.stories.tsx +0 -67
- package/Common/BaseButton/index.tsx +0 -59
- package/Common/BaseCodeBox/index.stories.tsx +0 -39
- package/Common/BaseCodeBox/index.tsx +0 -122
- package/Common/BaseCrossLink/index.stories.tsx +0 -38
- package/Common/BaseCrossLink/index.tsx +0 -46
- package/Common/BaseLinkTabs/index.stories.tsx +0 -34
- package/Common/BaseLinkTabs/index.tsx +0 -53
- package/Common/BasePagination/Ellipsis/index.stories.tsx +0 -10
- package/Common/BasePagination/Ellipsis/index.tsx +0 -11
- package/Common/BasePagination/PaginationListItem/__tests__/index.test.jsx +0 -58
- package/Common/BasePagination/PaginationListItem/index.stories.tsx +0 -40
- package/Common/BasePagination/PaginationListItem/index.tsx +0 -39
- package/Common/BasePagination/PrevNextArrow.tsx +0 -15
- package/Common/BasePagination/__tests__/index.test.jsx +0 -180
- package/Common/BasePagination/index.stories.tsx +0 -67
- package/Common/BasePagination/index.tsx +0 -77
- package/Common/BasePagination/useGetPageElements.tsx +0 -132
- package/Common/Blockquote/index.stories.tsx +0 -45
- package/Common/Blockquote/index.tsx +0 -11
- package/Common/Breadcrumbs/BreadcrumbHomeLink/index.tsx +0 -30
- package/Common/Breadcrumbs/BreadcrumbItem/index.tsx +0 -42
- package/Common/Breadcrumbs/BreadcrumbLink/index.tsx +0 -37
- package/Common/Breadcrumbs/BreadcrumbRoot/index.tsx +0 -20
- package/Common/Breadcrumbs/BreadcrumbTruncatedItem/index.tsx +0 -9
- package/Common/Breadcrumbs/index.stories.tsx +0 -94
- package/Common/Breadcrumbs/index.tsx +0 -81
- package/Common/ChangeHistory/index.stories.tsx +0 -130
- package/Common/ChangeHistory/index.tsx +0 -67
- package/Common/CodeTabs/index.stories.tsx +0 -73
- package/Common/CodeTabs/index.tsx +0 -16
- package/Common/DataTag/index.stories.tsx +0 -40
- package/Common/DataTag/index.tsx +0 -39
- package/Common/GlowingBackdrop/index.stories.tsx +0 -10
- package/Common/GlowingBackdrop/index.tsx +0 -13
- package/Common/LanguageDropDown/index.stories.tsx +0 -19
- package/Common/LanguageDropDown/index.tsx +0 -56
- package/Common/Modal/index.stories.tsx +0 -34
- package/Common/Modal/index.tsx +0 -50
- package/Common/NodejsLogo/index.stories.tsx +0 -14
- package/Common/NodejsLogo/index.tsx +0 -26
- package/Common/Notification/index.stories.tsx +0 -36
- package/Common/Notification/index.tsx +0 -34
- package/Common/Preview/index.stories.tsx +0 -44
- package/Common/Preview/index.tsx +0 -25
- package/Common/Select/__tests__/index.test.jsx +0 -67
- package/Common/Select/index.stories.tsx +0 -111
- package/Common/Select/index.tsx +0 -187
- package/Common/Separator/index.stories.tsx +0 -32
- package/Common/Separator/index.tsx +0 -27
- package/Common/Skeleton/index.tsx +0 -39
- package/Common/Tabs/__tests__/index.test.jsx +0 -52
- package/Common/Tabs/index.stories.tsx +0 -50
- package/Common/Tabs/index.tsx +0 -54
- package/Common/ThemeToggle/__tests__/index.test.jsx +0 -35
- package/Common/ThemeToggle/index.stories.tsx +0 -10
- package/Common/ThemeToggle/index.tsx +0 -15
- package/Common/Tooltip/index.stories.tsx +0 -73
- package/Common/Tooltip/index.tsx +0 -48
- package/Containers/Article/index.stories.tsx +0 -39
- package/Containers/Article/index.tsx +0 -9
- package/Containers/DocSideBar/index.tsx +0 -0
- package/Containers/Footer/index.stories.tsx +0 -27
- package/Containers/Footer/index.tsx +0 -95
- package/Containers/MetaBar/__tests__/index.test.jsx +0 -63
- package/Containers/MetaBar/index.stories.tsx +0 -80
- package/Containers/MetaBar/index.tsx +0 -72
- package/Containers/NavBar/NavItem/index.stories.tsx +0 -38
- package/Containers/NavBar/NavItem/index.tsx +0 -44
- package/Containers/NavBar/index.stories.tsx +0 -45
- package/Containers/NavBar/index.tsx +0 -94
- package/Containers/Sidebar/ProgressionIcon/index.tsx +0 -16
- package/Containers/Sidebar/SidebarGroup/index.stories.tsx +0 -36
- package/Containers/Sidebar/SidebarGroup/index.tsx +0 -49
- package/Containers/Sidebar/SidebarItem/index.stories.tsx +0 -15
- package/Containers/Sidebar/SidebarItem/index.tsx +0 -43
- package/Containers/Sidebar/index.stories.tsx +0 -88
- package/Containers/Sidebar/index.tsx +0 -70
- package/Icons/HexagonGrid.stories.tsx +0 -10
- package/Icons/HexagonGrid.tsx +0 -1434
- package/Icons/InstallationMethod/Choco.tsx +0 -78
- package/Icons/InstallationMethod/Devbox.tsx +0 -21
- package/Icons/InstallationMethod/Docker.tsx +0 -20
- package/Icons/InstallationMethod/FNM.tsx +0 -132
- package/Icons/InstallationMethod/Homebrew.tsx +0 -69
- package/Icons/InstallationMethod/N.tsx +0 -32
- package/Icons/InstallationMethod/NVM.tsx +0 -63
- package/Icons/InstallationMethod/Volta.tsx +0 -34
- package/Icons/Logos/JsGreen.tsx +0 -24
- package/Icons/Logos/JsWhite.tsx +0 -37
- package/Icons/Logos/Nodejs.tsx +0 -372
- package/Icons/Logos/NodejsStackedBlack.tsx +0 -98
- package/Icons/Logos/NodejsStackedDark.tsx +0 -124
- package/Icons/Logos/NodejsStackedLight.tsx +0 -123
- package/Icons/Logos/NodejsStackedWhite.tsx +0 -98
- package/Icons/Logos/index.ts +0 -17
- package/Icons/OperatingSystem/AIX.tsx +0 -46
- package/Icons/OperatingSystem/Apple.tsx +0 -23
- package/Icons/OperatingSystem/Linux.tsx +0 -969
- package/Icons/OperatingSystem/Microsoft.tsx +0 -19
- package/Icons/PackageManager/Npm.tsx +0 -21
- package/Icons/PackageManager/Pnpm.tsx +0 -22
- package/Icons/PackageManager/Yarn.tsx +0 -22
- package/Icons/Social/Bluesky.tsx +0 -19
- package/Icons/Social/Discord.tsx +0 -20
- package/Icons/Social/GitHub.tsx +0 -16
- package/Icons/Social/LinkedIn.tsx +0 -16
- package/Icons/Social/Mastodon.tsx +0 -36
- package/Icons/Social/Slack.tsx +0 -31
- package/Icons/Social/X.tsx +0 -16
- package/MDX/CodeTabs.tsx +0 -47
- package/stylelint/__tests__/index.test.mjs +0 -80
- package/styles/animations.css +0 -47
- package/styles/base.css +0 -17
- package/styles/effects.css +0 -12
- package/styles/markdown.css +0 -173
- package/styles/theme.css +0 -175
- package/types.ts +0 -25
|
@@ -0,0 +1,50 @@
|
|
|
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,78 +1,2 @@
|
|
|
1
|
-
|
|
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
|
+
/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */
|
|
2
|
+
.root{border-radius:var(--radius-sm,.25rem);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-neutral-900,#2c3437);background-color:var(--color-neutral-950,#0d121c);width:100%}.root .content{margin:calc(var(--spacing,.25rem)*0);padding:calc(var(--spacing,.25rem)*4)}.root .content>code{padding:calc(var(--spacing,.25rem)*0);font-family:var(--font-ibm-plex-mono,var(--font-ibm-plex-mono));font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,1.42857));--tw-leading:var(--leading-snug,1.375);line-height:var(--leading-snug,1.375);--tw-font-weight:var(--font-weight-regular,400);font-weight:var(--font-weight-regular,400);color:var(--color-neutral-400,#cbd4d9);counter-reset:line;scrollbar-width:thin;background-color:#0000;display:grid;overflow-x:auto}.root .content>code>[class=line]{min-width:calc(var(--spacing,.25rem)*0);padding-left:calc(var(--spacing,.25rem)*8);position:relative}.root .content>code>[class=line]:not(:empty:last-child):before{--tw-content:"";content:var(--tw-content);display:inline-block}.root .content>code>[class=line]:not(:empty:last-child):after{top:calc(var(--spacing,.25rem)*0);left:calc(var(--spacing,.25rem)*0);margin-right:calc(var(--spacing,.25rem)*4);width:calc(var(--spacing,.25rem)*4.5);text-align:right;font-family:var(--font-ibm-plex-mono,var(--font-ibm-plex-mono));color:var(--color-neutral-600,#929fa5);content:counter(line);counter-increment:line;position:absolute}.root>.footer{border-top-style:var(--tw-border-style);border-top-width:1px;border-top-color:var(--color-neutral-900,#2c3437);padding-inline:calc(var(--spacing,.25rem)*4);padding-block:calc(var(--spacing,.25rem)*3);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,1.42857));--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);justify-content:space-between;align-items:center;display:flex}.root>.footer>.language{color:var(--color-neutral-400,#cbd4d9)}.root>.footer>.action{padding-inline:calc(var(--spacing,.25rem)*3);padding-block:calc(var(--spacing,.25rem)*1.5);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500)}.icon{width:calc(var(--spacing,.25rem)*4);height:calc(var(--spacing,.25rem)*4)}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}
|
|
@@ -0,0 +1,12 @@
|
|
|
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,51 +1,2 @@
|
|
|
1
|
-
|
|
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
|
-
}
|
|
1
|
+
/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */
|
|
2
|
+
.crossLink{align-items:flex-start;gap:calc(var(--spacing,.25rem)*2);text-overflow:ellipsis;white-space:nowrap;border-radius:var(--radius-sm,.25rem);border-style:var(--tw-border-style);--tw-border-style:solid;border-style:solid;border-width:1px;border-color:var(--color-neutral-300,#d9e1e4);background-color:var(--color-white,#fff);padding:calc(var(--spacing,.25rem)*3);flex-direction:column;text-decoration-line:none;display:flex;overflow:hidden}.crossLink:where([data-theme=dark],[data-theme=dark] *){border-color:var(--color-neutral-900,#2c3437);background-color:var(--color-neutral-950,#0d121c)}.crossLink .header{align-items:center;gap:calc(var(--spacing,.25rem)*2);font-size:var(--text-xs,.75rem);line-height:var(--tw-leading,var(--text-xs--line-height,1.33333));color:var(--color-neutral-800,#556066);align-self:stretch;display:flex}.crossLink .header:where([data-theme=dark],[data-theme=dark] *){color:var(--color-neutral-100,#f6f7f9)}.crossLink .header.reverse{flex-direction:row-reverse;justify-content:flex-start}.crossLink .header .icon{width:calc(var(--spacing,.25rem)*4);height:calc(var(--spacing,.25rem)*4);color:var(--color-neutral-600,#929fa5)}.crossLink .header .icon:where([data-theme=dark],[data-theme=dark] *){color:var(--color-neutral-400,#cbd4d9)}.crossLink .content{text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,1.42857));color:var(--color-neutral-900,#2c3437);align-self:stretch;overflow:hidden}.crossLink .content:where([data-theme=dark],[data-theme=dark] *){color:var(--color-white,#fff)}.crossLink .content.reverse{text-align:right}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}
|
|
@@ -0,0 +1,5 @@
|
|
|
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,43 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.tabsList {
|
|
4
|
-
@apply font-open-sans
|
|
5
|
-
max-xs:hidden
|
|
6
|
-
mb-6
|
|
7
|
-
mt-10
|
|
8
|
-
flex
|
|
9
|
-
gap-2
|
|
10
|
-
border-b
|
|
11
|
-
border-b-neutral-200
|
|
12
|
-
dark:border-b-neutral-800;
|
|
13
|
-
|
|
14
|
-
.tabsTrigger {
|
|
15
|
-
@apply border-b-2
|
|
16
|
-
border-b-transparent
|
|
17
|
-
px-1
|
|
18
|
-
pb-[11px]
|
|
19
|
-
text-sm
|
|
20
|
-
font-semibold
|
|
21
|
-
text-neutral-800
|
|
22
|
-
dark:text-neutral-200;
|
|
23
|
-
|
|
24
|
-
&[data-state='active'] {
|
|
25
|
-
@apply border-b-green-600
|
|
26
|
-
text-green-600
|
|
27
|
-
dark:border-b-green-400
|
|
28
|
-
dark:text-green-400;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.tabsSelect {
|
|
34
|
-
@apply sm:visible
|
|
35
|
-
md:hidden;
|
|
36
|
-
|
|
37
|
-
> span {
|
|
38
|
-
@apply max-xs:flex
|
|
39
|
-
my-6
|
|
40
|
-
hidden
|
|
41
|
-
w-full;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
1
|
+
/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */
|
|
2
|
+
.tabsList{margin-top:calc(var(--spacing,.25rem)*10);margin-bottom:calc(var(--spacing,.25rem)*6);gap:calc(var(--spacing,.25rem)*2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-bottom-color:var(--color-neutral-200,#e9edf0);font-family:var(--font-open-sans,var(--font-open-sans));display:flex}@media not all and (min-width:670px){.tabsList{display:none}}.tabsList:where([data-theme=dark],[data-theme=dark] *){border-bottom-color:var(--color-neutral-800,#556066)}.tabsList .tabsTrigger{border-bottom-style:var(--tw-border-style);padding-inline:calc(var(--spacing,.25rem)*1);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,1.42857));--tw-font-weight:var(--font-weight-semibold,600);font-weight:var(--font-weight-semibold,600);color:var(--color-neutral-800,#556066);border-bottom-width:2px;border-bottom-color:#0000;padding-bottom:11px}.tabsList .tabsTrigger:where([data-theme=dark],[data-theme=dark] *){color:var(--color-neutral-200,#e9edf0)}.tabsList .tabsTrigger:not([data-state=active]):hover{border-bottom-color:var(--color-neutral-900,#2c3437);color:var(--color-neutral-900,#2c3437)}.tabsList .tabsTrigger:not([data-state=active]):hover:where([data-theme=dark],[data-theme=dark] *){border-bottom-color:var(--color-neutral-300,#d9e1e4);color:var(--color-neutral-300,#d9e1e4)}.tabsList .tabsTrigger[data-state=active]{border-bottom-color:var(--color-green-600,#417e38);color:var(--color-green-600,#417e38)}.tabsList .tabsTrigger[data-state=active]:where([data-theme=dark],[data-theme=dark] *){border-bottom-color:var(--color-green-400,#84ba64);color:var(--color-green-400,#84ba64)}@media (min-width:40rem){.tabsSelect{visibility:visible}}@media (min-width:48rem){.tabsSelect{display:none}}.tabsSelect>span{margin-block:calc(var(--spacing,.25rem)*6);width:100%;display:none}@media not all and (min-width:670px){.tabsSelect>span{display:flex}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.ellipsis {
|
|
4
|
-
@apply w-10
|
|
5
|
-
px-3
|
|
6
|
-
py-2.5
|
|
7
|
-
leading-none
|
|
8
|
-
text-neutral-800
|
|
9
|
-
dark:text-neutral-200;
|
|
10
|
-
}
|
|
1
|
+
/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */
|
|
2
|
+
.ellipsis{width:calc(var(--spacing,.25rem)*10);padding-inline:calc(var(--spacing,.25rem)*3);padding-block:calc(var(--spacing,.25rem)*2.5);--tw-leading:1;color:var(--color-neutral-800,#556066);line-height:1}.ellipsis:where([data-theme=dark],[data-theme=dark] *){color:var(--color-neutral-200,#e9edf0)}@property --tw-leading{syntax:"*";inherits:false}
|
|
@@ -0,0 +1,6 @@
|
|
|
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,27 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.listItem,
|
|
4
|
-
.listItem:link,
|
|
5
|
-
.listItem:active {
|
|
6
|
-
@apply aria-current:bg-green-600
|
|
7
|
-
aria-current:text-white
|
|
8
|
-
aria-current:cursor-default
|
|
9
|
-
flex
|
|
10
|
-
size-10
|
|
11
|
-
cursor-pointer
|
|
12
|
-
items-center
|
|
13
|
-
justify-center
|
|
14
|
-
rounded-sm
|
|
15
|
-
px-3
|
|
16
|
-
py-2.5
|
|
17
|
-
text-neutral-800
|
|
18
|
-
motion-safe:transition-colors
|
|
19
|
-
dark:text-neutral-200;
|
|
20
|
-
|
|
21
|
-
&:hover:not([aria-current='page']) {
|
|
22
|
-
@apply bg-neutral-100
|
|
23
|
-
text-neutral-800
|
|
24
|
-
dark:bg-neutral-900
|
|
25
|
-
dark:text-neutral-200;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */
|
|
2
|
+
.listItem,.listItem:link,.listItem:active{width:calc(var(--spacing,.25rem)*10);height:calc(var(--spacing,.25rem)*10);cursor:pointer;border-radius:var(--radius-sm,.25rem);padding-inline:calc(var(--spacing,.25rem)*3);padding-block:calc(var(--spacing,.25rem)*2.5);color:var(--color-neutral-800,#556066);justify-content:center;align-items:center;display:flex}@media (prefers-reduced-motion:no-preference){.listItem,.listItem:link,.listItem:active{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4,0,.2,1)));transition-duration:var(--tw-duration,var(--default-transition-duration,.15s))}}:is(.listItem,.listItem:link,.listItem:active):where([data-theme=dark],[data-theme=dark] *){color:var(--color-neutral-200,#e9edf0)}:is(.listItem,.listItem:link,.listItem:active)[aria-current=page]{cursor:default;background-color:var(--color-green-600,#417e38);color:var(--color-white,#fff)}:is(.listItem,.listItem:link,.listItem:active):hover:not([aria-current=page]){background-color:var(--color-neutral-100,#f6f7f9);color:var(--color-neutral-800,#556066)}:is(.listItem,.listItem:link,.listItem:active):hover:not([aria-current=page]):where([data-theme=dark],[data-theme=dark] *){background-color:var(--color-neutral-900,#2c3437);color:var(--color-neutral-200,#e9edf0)}
|
|
@@ -0,0 +1,7 @@
|
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
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,39 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.pagination {
|
|
4
|
-
@apply grid
|
|
5
|
-
items-center
|
|
6
|
-
justify-between
|
|
7
|
-
gap-y-5
|
|
8
|
-
[grid-template-areas:'pages_pages_pages''prev_._next']
|
|
9
|
-
md:gap-y-0
|
|
10
|
-
md:[grid-template-areas:'prev_pages_next'];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.previousButton,
|
|
14
|
-
.nextButton {
|
|
15
|
-
@apply text-sm;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.previousButton {
|
|
19
|
-
@apply [grid-area:prev];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.nextButton {
|
|
23
|
-
@apply [grid-area:next];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.arrowIcon {
|
|
27
|
-
@apply h-5
|
|
28
|
-
shrink-0
|
|
29
|
-
text-neutral-600
|
|
30
|
-
dark:text-neutral-400;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.list {
|
|
34
|
-
@apply flex
|
|
35
|
-
list-none
|
|
36
|
-
justify-center
|
|
37
|
-
gap-1
|
|
38
|
-
[grid-area:pages];
|
|
39
|
-
}
|
|
1
|
+
/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */
|
|
2
|
+
.pagination{justify-content:space-between;align-items:center;row-gap:calc(var(--spacing,.25rem)*5);grid-template-areas:"pages pages pages""prev.next";display:grid}@media (min-width:48rem){.pagination{row-gap:calc(var(--spacing,.25rem)*0);grid-template-areas:"prev pages next"}}.previousButton,.nextButton{font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,1.42857))}.previousButton{grid-area:prev}.nextButton{grid-area:next}.arrowIcon{height:calc(var(--spacing,.25rem)*5);color:var(--color-neutral-600,#929fa5);flex-shrink:0}.arrowIcon:where([data-theme=dark],[data-theme=dark] *){color:var(--color-neutral-400,#cbd4d9)}.list{justify-content:center;gap:calc(var(--spacing,.25rem)*1);grid-area:pages;list-style-type:none;display:flex}
|
|
@@ -0,0 +1,77 @@
|
|
|
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: url,
|
|
6
|
+
pageNumber: index + 1,
|
|
7
|
+
currentPage: currentPage,
|
|
8
|
+
totalPages: totalPages,
|
|
9
|
+
label: getLabel(index + 1),
|
|
10
|
+
as: 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
|
+
};
|
|
@@ -1,29 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.wrapper {
|
|
4
|
-
@apply flex
|
|
5
|
-
max-w-2xl
|
|
6
|
-
flex-col
|
|
7
|
-
items-start
|
|
8
|
-
gap-4
|
|
9
|
-
self-stretch
|
|
10
|
-
border-l-2
|
|
11
|
-
border-green-600
|
|
12
|
-
py-2
|
|
13
|
-
pl-5
|
|
14
|
-
text-lg
|
|
15
|
-
font-semibold
|
|
16
|
-
text-neutral-900
|
|
17
|
-
dark:border-green-400
|
|
18
|
-
dark:text-white;
|
|
19
|
-
|
|
20
|
-
& cite {
|
|
21
|
-
@apply font-regular
|
|
22
|
-
text-base
|
|
23
|
-
not-italic;
|
|
24
|
-
|
|
25
|
-
&::before {
|
|
26
|
-
@apply content-['—_'];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */
|
|
2
|
+
.wrapper{max-width:var(--container-2xl,42rem);align-items:flex-start;gap:calc(var(--spacing,.25rem)*4);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-green-600,#417e38);padding-block:calc(var(--spacing,.25rem)*2);padding-left:calc(var(--spacing,.25rem)*5);font-size:var(--text-lg,1.125rem);line-height:var(--tw-leading,var(--text-lg--line-height,1.55556));--tw-font-weight:var(--font-weight-semibold,600);font-weight:var(--font-weight-semibold,600);color:var(--color-neutral-900,#2c3437);flex-direction:column;align-self:stretch;display:flex}.wrapper:where([data-theme=dark],[data-theme=dark] *){border-color:var(--color-green-400,#84ba64);color:var(--color-white,#fff)}.wrapper cite{font-size:var(--text-base,1rem);line-height:var(--tw-leading,var(--text-base--line-height,1.5));--tw-font-weight:var(--font-weight-regular,400);font-weight:var(--font-weight-regular,400);font-style:normal}.wrapper cite:before{--tw-content:"— ";content:var(--tw-content)}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import HomeIcon from '@heroicons/react/24/outline/HomeIcon';
|
|
3
|
+
import BreadcrumbLink from '#ui/Common/Breadcrumbs/BreadcrumbLink';
|
|
4
|
+
import styles from './index.module.css';
|
|
5
|
+
const BreadcrumbHomeLink = ({ href = '/', ...props }) => {
|
|
6
|
+
const ariaLabel = props['aria-label'];
|
|
7
|
+
return (_jsx(BreadcrumbLink, { href: href, ...props, children: _jsx(HomeIcon, { title: ariaLabel, "aria-label": ariaLabel, className: styles.icon }) }));
|
|
8
|
+
};
|
|
9
|
+
export default BreadcrumbHomeLink;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import ChevronRightIcon from '@heroicons/react/24/outline/ChevronRightIcon';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import styles from './index.module.css';
|
|
5
|
+
const BreadcrumbItem = ({ disableMicrodata, children, hidden = false, hideSeparator = false, position, ...props }) => (_jsxs("li", { ...props, itemProp: !disableMicrodata ? 'itemListElement' : undefined, itemScope: !disableMicrodata ? true : undefined, itemType: !disableMicrodata ? 'https://schema.org/ListItem' : undefined, className: classNames(styles.item, { [styles.visuallyHidden]: hidden }, props.className), "aria-hidden": hidden ? 'true' : undefined, children: [children, position && _jsx("meta", { itemProp: "position", content: `${position}` }), !hideSeparator && (_jsx(ChevronRightIcon, { "aria-hidden": "true", className: styles.separator }))] }));
|
|
6
|
+
export default BreadcrumbItem;
|
|
@@ -1,41 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.item {
|
|
4
|
-
@apply flex
|
|
5
|
-
max-w-fit
|
|
6
|
-
items-center
|
|
7
|
-
gap-5
|
|
8
|
-
truncate
|
|
9
|
-
text-sm
|
|
10
|
-
font-medium;
|
|
11
|
-
|
|
12
|
-
&:last-child {
|
|
13
|
-
@apply w-full;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
a {
|
|
17
|
-
@apply shrink
|
|
18
|
-
grow;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&,
|
|
22
|
-
> a,
|
|
23
|
-
> a:hover {
|
|
24
|
-
@apply text-neutral-800
|
|
25
|
-
motion-safe:transition-colors
|
|
26
|
-
dark:text-neutral-200;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&.visuallyHidden {
|
|
30
|
-
@apply hidden;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.separator {
|
|
34
|
-
@apply size-4
|
|
35
|
-
max-w-fit
|
|
36
|
-
shrink-0
|
|
37
|
-
grow
|
|
38
|
-
text-neutral-600
|
|
39
|
-
dark:text-neutral-400;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */
|
|
2
|
+
.item{align-items:center;gap:calc(var(--spacing,.25rem)*5);text-overflow:ellipsis;white-space:nowrap;max-width:fit-content;font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,1.42857));--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);display:flex;overflow:hidden}.item:last-child{width:100%}.item a{flex-grow:1;flex-shrink:1}.item,.item>a,.item>a:hover{color:var(--color-neutral-800,#556066)}@media (prefers-reduced-motion:no-preference){.item,.item>a,.item>a:hover{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4,0,.2,1)));transition-duration:var(--tw-duration,var(--default-transition-duration,.15s))}}:is(.item,.item>a,.item>a:hover):where([data-theme=dark],[data-theme=dark] *){color:var(--color-neutral-200,#e9edf0)}.item.visuallyHidden{display:none}.item .separator{width:calc(var(--spacing,.25rem)*4);height:calc(var(--spacing,.25rem)*4);max-width:fit-content;color:var(--color-neutral-600,#929fa5);flex-grow:1;flex-shrink:0}.item .separator:where([data-theme=dark],[data-theme=dark] *){color:var(--color-neutral-400,#cbd4d9)}@property --tw-font-weight{syntax:"*";inherits:false}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import styles from './index.module.css';
|
|
4
|
+
const BreadcrumbLink = ({ href, active, as: Component = 'a', ...props }) => (_jsx(Component, { itemScope: true, itemType: "http://schema.org/Thing", itemProp: "item", itemID: href?.toString(), href: href, className: classNames(styles.link, { [styles.active]: active }, props.className), "aria-current": active ? 'page' : undefined, ...props, children: _jsx("span", { itemProp: "name", children: props.children }) }));
|
|
5
|
+
export default BreadcrumbLink;
|
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.link {
|
|
4
|
-
@apply max-w-fit
|
|
5
|
-
truncate;
|
|
6
|
-
|
|
7
|
-
&.active {
|
|
8
|
-
@apply rounded
|
|
9
|
-
bg-green-600
|
|
10
|
-
px-2
|
|
11
|
-
py-1
|
|
12
|
-
font-semibold
|
|
13
|
-
text-white
|
|
14
|
-
motion-safe:transition-colors
|
|
15
|
-
dark:text-white;
|
|
16
|
-
|
|
17
|
-
&:hover {
|
|
18
|
-
@apply bg-green-700
|
|
19
|
-
text-white;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */
|
|
2
|
+
.link{text-overflow:ellipsis;white-space:nowrap;max-width:fit-content;overflow:hidden}.link.active{background-color:var(--color-green-600,#417e38);padding-inline:calc(var(--spacing,.25rem)*2);padding-block:calc(var(--spacing,.25rem)*1);--tw-font-weight:var(--font-weight-semibold,600);font-weight:var(--font-weight-semibold,600);color:var(--color-white,#fff);border-radius:.25rem}@media (prefers-reduced-motion:no-preference){.link.active{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4,0,.2,1)));transition-duration:var(--tw-duration,var(--default-transition-duration,.15s))}}.link.active:where([data-theme=dark],[data-theme=dark] *){color:var(--color-white,#fff)}.link.active:hover{background-color:var(--color-green-700,#2c682c);color:var(--color-white,#fff)}@property --tw-font-weight{syntax:"*";inherits:false}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styles from './index.module.css';
|
|
3
|
+
const BreadcrumbRoot = ({ children, ...props }) => (_jsx("nav", { "aria-label": "breadcrumb", ...props, children: _jsx("ol", { itemScope: true, itemType: "https://schema.org/BreadcrumbList", className: styles.list, children: children }) }));
|
|
4
|
+
export default BreadcrumbRoot;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.list {
|
|
4
|
-
@apply xs:w-full
|
|
5
|
-
flex
|
|
6
|
-
w-screen
|
|
7
|
-
gap-5
|
|
8
|
-
px-6;
|
|
9
|
-
}
|
|
1
|
+
/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */
|
|
2
|
+
.list{gap:calc(var(--spacing,.25rem)*5);width:100vw;padding-inline:calc(var(--spacing,.25rem)*6);display:flex}@media (min-width:670px){.list{width:100%}}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import BreadcrumbItem from '#ui/Common/Breadcrumbs/BreadcrumbItem';
|
|
3
|
+
const BreadcrumbTruncatedItem = () => (_jsx(BreadcrumbItem, { disableMicrodata: true, children: _jsx("button", { disabled: true, children: "\u2026" }) }));
|
|
4
|
+
export default BreadcrumbTruncatedItem;
|