@node-core/ui-components 1.0.1-cc5c2626b0639fe2088a736f54169ea3e10ed325 → 1.0.1-e1f87bde264af01e260a8efa4fab1749a2c6bc29
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 +44 -50
- package/Common/AvatarGroup/Avatar/index.js +11 -0
- package/Common/AvatarGroup/Avatar/index.module.css +50 -30
- package/Common/AvatarGroup/Overlay/index.js +6 -0
- package/Common/AvatarGroup/Overlay/index.module.css +28 -21
- package/Common/AvatarGroup/index.js +21 -0
- package/Common/AvatarGroup/index.module.css +12 -11
- package/Common/Badge/index.js +7 -0
- package/Common/Badge/index.module.css +34 -26
- package/Common/BadgeGroup/index.js +6 -0
- package/Common/BadgeGroup/index.module.css +75 -51
- package/Common/Banner/index.js +4 -0
- package/Common/Banner/index.module.css +30 -27
- package/Common/BaseActiveLink/index.js +14 -0
- package/Common/BaseButton/index.js +10 -0
- package/Common/BaseButton/index.module.css +332 -105
- package/Common/BaseCodeBox/index.js +50 -0
- package/Common/BaseCodeBox/index.module.css +76 -58
- package/Common/BaseCrossLink/index.js +12 -0
- package/Common/BaseCrossLink/index.module.css +57 -39
- package/Common/BaseLinkTabs/index.js +5 -0
- package/Common/BaseLinkTabs/index.module.css +67 -33
- package/Common/BasePagination/Ellipsis/index.js +4 -0
- package/Common/BasePagination/Ellipsis/index.module.css +14 -8
- package/Common/BasePagination/PaginationListItem/index.js +6 -0
- package/Common/BasePagination/PaginationListItem/index.module.css +36 -21
- package/Common/BasePagination/PrevNextArrow.js +7 -0
- package/Common/BasePagination/index.js +10 -0
- package/Common/BasePagination/index.module.css +27 -26
- package/Common/BasePagination/useGetPageElements.js +77 -0
- package/Common/Blockquote/index.js +4 -0
- package/Common/Blockquote/index.module.css +44 -23
- package/Common/Breadcrumbs/BreadcrumbHomeLink/index.js +9 -0
- package/Common/Breadcrumbs/BreadcrumbHomeLink/index.module.css +3 -3
- package/Common/Breadcrumbs/BreadcrumbItem/index.js +6 -0
- package/Common/Breadcrumbs/BreadcrumbItem/index.module.css +38 -27
- package/Common/Breadcrumbs/BreadcrumbLink/index.js +5 -0
- package/Common/Breadcrumbs/BreadcrumbLink/index.module.css +26 -16
- package/Common/Breadcrumbs/BreadcrumbRoot/index.js +4 -0
- package/Common/Breadcrumbs/BreadcrumbRoot/index.module.css +8 -7
- 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 +181 -66
- package/Common/CodeTabs/index.js +5 -0
- package/Common/CodeTabs/index.module.css +47 -36
- package/Common/DataTag/index.js +18 -0
- package/Common/DataTag/index.module.css +30 -32
- package/Common/GlowingBackdrop/index.js +5 -0
- package/Common/GlowingBackdrop/index.module.css +126 -28
- package/Common/LanguageDropDown/index.js +11 -0
- package/Common/LanguageDropDown/index.module.css +140 -42
- package/Common/Modal/index.js +10 -0
- package/Common/Modal/index.module.css +217 -62
- package/Common/NodejsLogo/index.js +7 -0
- package/Common/NodejsLogo/index.module.css +3 -4
- package/Common/Notification/index.js +6 -0
- package/Common/Notification/index.module.css +101 -17
- package/Common/Preview/index.js +7 -0
- package/Common/Preview/index.module.css +269 -65
- package/Common/Select/index.js +46 -0
- package/Common/Select/index.module.css +294 -127
- package/Common/Separator/index.js +7 -0
- package/Common/Separator/index.module.css +7 -10
- package/Common/Skeleton/index.js +18 -0
- package/Common/Skeleton/index.module.css +118 -21
- package/Common/Tabs/index.js +6 -0
- package/Common/Tabs/index.module.css +58 -40
- package/Common/ThemeToggle/index.js +7 -0
- package/Common/ThemeToggle/index.module.css +18 -11
- package/Common/Tooltip/index.js +8 -0
- package/Common/Tooltip/index.module.css +119 -29
- package/Containers/Article/index.js +4 -0
- package/Containers/Article/index.module.css +127 -58
- package/Containers/DocSideBar/index.js +1 -0
- package/Containers/Footer/index.js +22 -0
- package/Containers/Footer/index.module.css +51 -36
- package/Containers/MetaBar/index.js +12 -0
- package/Containers/MetaBar/index.module.css +101 -69
- package/Containers/NavBar/NavItem/index.js +7 -0
- package/Containers/NavBar/NavItem/index.module.css +50 -36
- package/Containers/NavBar/index.js +18 -0
- package/Containers/NavBar/index.module.css +176 -96
- package/Containers/Sidebar/ProgressionIcon/index.js +3 -0
- package/Containers/Sidebar/SidebarGroup/index.js +9 -0
- package/Containers/Sidebar/SidebarGroup/index.module.css +180 -52
- package/Containers/Sidebar/SidebarItem/index.js +11 -0
- package/Containers/Sidebar/SidebarItem/index.module.css +49 -38
- package/Containers/Sidebar/index.js +15 -0
- package/Containers/Sidebar/index.module.css +42 -24
- 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 +16 -0
- package/package.json +6 -54
- package/stylelint/one-utility-class-per-line.mjs +34 -50
- package/stylelint/utils.mjs +19 -25
- package/styles/index.css +1124 -26
- 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
|
@@ -1,42 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */
|
|
3
2
|
.banner {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
display: flex;
|
|
4
|
+
width: 100%;
|
|
5
|
+
flex-direction: row;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
gap: calc(var(--spacing, 0.25rem)*2);
|
|
9
|
+
padding-inline: calc(var(--spacing, 0.25rem)*8);
|
|
10
|
+
padding-block: calc(var(--spacing, 0.25rem)*3);
|
|
11
|
+
font-size: var(--text-sm, 0.875rem);
|
|
12
|
+
line-height: var(--tw-leading, var(--text-sm--line-height, 1.42857));
|
|
14
13
|
&,
|
|
15
14
|
a {
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
color: var(--color-white, #fff);
|
|
16
|
+
&:where([data-theme=dark], [data-theme=dark] *) {
|
|
17
|
+
color: var(--color-white, #fff);
|
|
18
|
+
}
|
|
18
19
|
}
|
|
19
|
-
|
|
20
20
|
a {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
width: fit-content;
|
|
22
|
+
text-decoration-line: underline;
|
|
23
|
+
text-decoration-color: color-mix(in srgb, #fff 50%, transparent);
|
|
24
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
25
|
+
text-decoration-color: color-mix(in oklab, var(--color-white, #fff) 50%, transparent);
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
|
-
|
|
26
28
|
svg {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
width: calc(var(--spacing, 0.25rem)*4);
|
|
30
|
+
height: calc(var(--spacing, 0.25rem)*4);
|
|
31
|
+
color: color-mix(in srgb, #fff 50%, transparent);
|
|
32
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
33
|
+
color: color-mix(in oklab, var(--color-white, #fff) 50%, transparent);
|
|
34
|
+
}
|
|
29
35
|
}
|
|
30
36
|
}
|
|
31
|
-
|
|
32
37
|
.default {
|
|
33
|
-
|
|
38
|
+
background-color: var(--color-green-600, #417e38);
|
|
34
39
|
}
|
|
35
|
-
|
|
36
40
|
.error {
|
|
37
|
-
|
|
41
|
+
background-color: var(--color-danger-600, #de1a1b);
|
|
38
42
|
}
|
|
39
|
-
|
|
40
43
|
.warning {
|
|
41
|
-
|
|
44
|
+
background-color: var(--color-warning-600, #ae5f00);
|
|
42
45
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
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,145 +1,372 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */
|
|
3
2
|
.button {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
gap: calc(var(--spacing, 0.25rem)*2);
|
|
8
|
+
padding-inline: calc(var(--spacing, 0.25rem)*4.5);
|
|
9
|
+
padding-block: calc(var(--spacing, 0.25rem)*2.5);
|
|
10
|
+
text-align: center;
|
|
11
|
+
--tw-font-weight: var(--font-weight-semibold, 600);
|
|
12
|
+
font-weight: var(--font-weight-semibold, 600);
|
|
13
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
14
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
15
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function, cubic-bezier(0.4, 0, 0.2, 1)));
|
|
16
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration, 150ms));
|
|
17
|
+
}
|
|
15
18
|
svg {
|
|
16
|
-
|
|
19
|
+
width: calc(var(--spacing, 0.25rem)*5);
|
|
20
|
+
height: calc(var(--spacing, 0.25rem)*5);
|
|
17
21
|
}
|
|
18
|
-
|
|
19
22
|
&[aria-disabled='true'] {
|
|
20
|
-
|
|
23
|
+
cursor: not-allowed;
|
|
21
24
|
}
|
|
22
|
-
|
|
23
25
|
&.small {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
padding-inline: calc(var(--spacing, 0.25rem)*3);
|
|
27
|
+
padding-block: calc(var(--spacing, 0.25rem)*2);
|
|
28
|
+
font-size: var(--text-sm, 0.875rem);
|
|
29
|
+
line-height: var(--tw-leading, var(--text-sm--line-height, 1.42857));
|
|
27
30
|
}
|
|
28
|
-
|
|
29
31
|
&.neutral {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
border-radius: var(--radius-sm, 0.25rem);
|
|
33
|
+
background-color: var(--color-neutral-900, #2c3437);
|
|
34
|
+
color: var(--color-white, #fff);
|
|
35
|
+
&:where([data-theme=dark], [data-theme=dark] *) {
|
|
36
|
+
color: var(--color-neutral-200, #e9edf0);
|
|
37
|
+
}
|
|
35
38
|
&:hover:not([aria-disabled='true']) {
|
|
36
|
-
|
|
39
|
+
background-color: var(--color-neutral-800, #556066);
|
|
37
40
|
}
|
|
38
|
-
|
|
39
41
|
&[aria-disabled='true'] {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
background-color: var(--color-neutral-900, #2c3437);
|
|
43
|
+
opacity: 50%;
|
|
42
44
|
}
|
|
43
|
-
|
|
44
45
|
&:focus {
|
|
45
|
-
|
|
46
|
+
background-color: var(--color-neutral-800, #556066);
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
|
|
49
49
|
&.primary {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
border-radius: var(--radius-sm, 0.25rem);
|
|
51
|
+
border-style: var(--tw-border-style);
|
|
52
|
+
border-width: 1px;
|
|
53
|
+
border-color: var(--color-green-600, #417e38);
|
|
54
|
+
background-color: var(--color-green-600, #417e38);
|
|
55
|
+
color: var(--color-white, #fff);
|
|
56
|
+
--tw-shadow: 0px 1px 2px 0px var(--tw-shadow-color, color-mix(in srgb, #101828 5%, transparent));
|
|
57
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
58
|
+
--tw-shadow: 0px 1px 2px 0px var(--tw-shadow-color, color-mix(in oklab, var(--color-shadow, #101828) 5%, transparent));
|
|
59
|
+
}
|
|
60
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
57
61
|
&:hover:not([aria-disabled='true']) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
border-color: var(--color-green-700, #2c682c);
|
|
63
|
+
background-color: var(--color-green-700, #2c682c);
|
|
64
|
+
color: var(--color-white, #fff);
|
|
61
65
|
}
|
|
62
|
-
|
|
63
66
|
&:focus {
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
border-color: var(--color-green-700, #2c682c);
|
|
68
|
+
background-color: var(--color-green-700, #2c682c);
|
|
66
69
|
}
|
|
67
|
-
|
|
68
70
|
&[aria-disabled='true'] {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
background-color: var(--color-green-600, #417e38);
|
|
72
|
+
opacity: 50%;
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
|
-
|
|
74
75
|
&.secondary {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
border-radius: var(--radius-lg, 0.5rem);
|
|
77
|
+
border-style: var(--tw-border-style);
|
|
78
|
+
border-width: 1px;
|
|
79
|
+
border-color: var(--color-neutral-200, #e9edf0);
|
|
80
|
+
color: var(--color-neutral-800, #556066);
|
|
81
|
+
&:where([data-theme=dark], [data-theme=dark] *) {
|
|
82
|
+
border-color: var(--color-neutral-900, #2c3437);
|
|
83
|
+
}
|
|
84
|
+
&:where([data-theme=dark], [data-theme=dark] *) {
|
|
85
|
+
color: var(--color-neutral-200, #e9edf0);
|
|
86
|
+
}
|
|
82
87
|
&:hover:not([aria-disabled='true']) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
background-color: var(--color-neutral-200, #e9edf0);
|
|
89
|
+
color: var(--color-neutral-800, #556066);
|
|
90
|
+
&:where([data-theme=dark], [data-theme=dark] *) {
|
|
91
|
+
background-color: var(--color-neutral-900, #2c3437);
|
|
92
|
+
}
|
|
93
|
+
&:where([data-theme=dark], [data-theme=dark] *) {
|
|
94
|
+
color: var(--color-neutral-200, #e9edf0);
|
|
95
|
+
}
|
|
87
96
|
}
|
|
88
|
-
|
|
89
97
|
&[aria-disabled='true'] {
|
|
90
|
-
|
|
91
|
-
|
|
98
|
+
background-color: transparent;
|
|
99
|
+
opacity: 50%;
|
|
92
100
|
}
|
|
93
|
-
|
|
94
101
|
&:focus {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
background-color: var(--color-neutral-100, #f6f7f9);
|
|
103
|
+
color: var(--color-neutral-800, #556066);
|
|
104
|
+
&:where([data-theme=dark], [data-theme=dark] *) {
|
|
105
|
+
background-color: var(--color-neutral-900, #2c3437);
|
|
106
|
+
}
|
|
107
|
+
&:where([data-theme=dark], [data-theme=dark] *) {
|
|
108
|
+
color: var(--color-neutral-200, #e9edf0);
|
|
109
|
+
}
|
|
99
110
|
}
|
|
100
111
|
}
|
|
101
|
-
|
|
102
112
|
&.special {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
113
|
+
border-radius: var(--radius-lg, 0.5rem);
|
|
114
|
+
border-style: var(--tw-border-style);
|
|
115
|
+
border-width: 1px;
|
|
116
|
+
border-color: color-mix(in srgb, #417e38 30%, transparent);
|
|
117
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
118
|
+
border-color: color-mix(in oklab, var(--color-green-600, #417e38) 30%, transparent);
|
|
119
|
+
}
|
|
120
|
+
background-color: color-mix(in srgb, #417e38 10%, transparent);
|
|
121
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
122
|
+
background-color: color-mix(in oklab, var(--color-green-600, #417e38) 10%, transparent);
|
|
123
|
+
}
|
|
124
|
+
color: var(--color-white, #fff);
|
|
125
|
+
--tw-shadow: 0px 1px 2px 0px var(--tw-shadow-color, color-mix(in srgb, #101828 5%, transparent));
|
|
126
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
127
|
+
--tw-shadow: 0px 1px 2px 0px var(--tw-shadow-color, color-mix(in oklab, var(--color-shadow, #101828) 5%, transparent));
|
|
128
|
+
}
|
|
129
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
130
|
+
&::before {
|
|
131
|
+
content: var(--tw-content);
|
|
132
|
+
position: absolute;
|
|
133
|
+
}
|
|
134
|
+
&::before {
|
|
135
|
+
content: var(--tw-content);
|
|
136
|
+
top: calc(var(--spacing, 0.25rem)*0);
|
|
137
|
+
}
|
|
138
|
+
&::before {
|
|
139
|
+
content: var(--tw-content);
|
|
140
|
+
right: calc(var(--spacing, 0.25rem)*0);
|
|
141
|
+
}
|
|
142
|
+
&::before {
|
|
143
|
+
content: var(--tw-content);
|
|
144
|
+
left: calc(var(--spacing, 0.25rem)*0);
|
|
145
|
+
}
|
|
146
|
+
&::before {
|
|
147
|
+
content: var(--tw-content);
|
|
148
|
+
z-index: -10;
|
|
149
|
+
}
|
|
150
|
+
&::before {
|
|
151
|
+
content: var(--tw-content);
|
|
152
|
+
margin-inline: auto;
|
|
153
|
+
}
|
|
154
|
+
&::before {
|
|
155
|
+
content: var(--tw-content);
|
|
156
|
+
height: 100%;
|
|
157
|
+
}
|
|
158
|
+
&::before {
|
|
159
|
+
content: var(--tw-content);
|
|
160
|
+
width: 100%;
|
|
161
|
+
}
|
|
162
|
+
&::before {
|
|
163
|
+
content: var(--tw-content);
|
|
164
|
+
background-image: radial-gradient( 8em circle at 50% 10px, var(--color-green-400), transparent 30% );
|
|
165
|
+
}
|
|
166
|
+
&::before {
|
|
167
|
+
content: var(--tw-content);
|
|
168
|
+
opacity: 30%;
|
|
169
|
+
}
|
|
170
|
+
&::before {
|
|
171
|
+
content: var(--tw-content);
|
|
172
|
+
--tw-content: '';
|
|
173
|
+
content: var(--tw-content);
|
|
174
|
+
}
|
|
175
|
+
&::after {
|
|
176
|
+
content: var(--tw-content);
|
|
177
|
+
position: absolute;
|
|
178
|
+
}
|
|
179
|
+
&::after {
|
|
180
|
+
content: var(--tw-content);
|
|
181
|
+
top: -1px;
|
|
182
|
+
}
|
|
183
|
+
&::after {
|
|
184
|
+
content: var(--tw-content);
|
|
185
|
+
right: calc(var(--spacing, 0.25rem)*0);
|
|
186
|
+
}
|
|
187
|
+
&::after {
|
|
188
|
+
content: var(--tw-content);
|
|
189
|
+
left: calc(var(--spacing, 0.25rem)*0);
|
|
190
|
+
}
|
|
191
|
+
&::after {
|
|
192
|
+
content: var(--tw-content);
|
|
193
|
+
margin-inline: auto;
|
|
194
|
+
}
|
|
195
|
+
&::after {
|
|
196
|
+
content: var(--tw-content);
|
|
197
|
+
height: 1px;
|
|
198
|
+
}
|
|
199
|
+
&::after {
|
|
200
|
+
content: var(--tw-content);
|
|
201
|
+
width: 40%;
|
|
202
|
+
}
|
|
203
|
+
&::after {
|
|
204
|
+
content: var(--tw-content);
|
|
205
|
+
--tw-gradient-position: to right in oklab;
|
|
206
|
+
background-image: linear-gradient(var(--tw-gradient-stops));
|
|
207
|
+
}
|
|
208
|
+
&::after {
|
|
209
|
+
content: var(--tw-content);
|
|
210
|
+
--tw-gradient-from: color-mix(in srgb, #417e38 0%, transparent);
|
|
211
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
212
|
+
--tw-gradient-from: color-mix(in oklab, var(--color-green-600, #417e38) 0%, transparent);
|
|
213
|
+
}
|
|
214
|
+
--tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
|
|
215
|
+
}
|
|
216
|
+
&::after {
|
|
217
|
+
content: var(--tw-content);
|
|
218
|
+
--tw-gradient-via: var(--color-green-600, #417e38);
|
|
219
|
+
--tw-gradient-via-stops: var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);
|
|
220
|
+
--tw-gradient-stops: var(--tw-gradient-via-stops);
|
|
221
|
+
}
|
|
222
|
+
&::after {
|
|
223
|
+
content: var(--tw-content);
|
|
224
|
+
--tw-gradient-to: color-mix(in srgb, #417e38 0%, transparent);
|
|
225
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
226
|
+
--tw-gradient-to: color-mix(in oklab, var(--color-green-600, #417e38) 0%, transparent);
|
|
227
|
+
}
|
|
228
|
+
--tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
|
|
229
|
+
}
|
|
230
|
+
&::after {
|
|
231
|
+
content: var(--tw-content);
|
|
232
|
+
--tw-content: '';
|
|
233
|
+
content: var(--tw-content);
|
|
234
|
+
}
|
|
133
235
|
&[aria-disabled='true'] {
|
|
134
|
-
|
|
236
|
+
opacity: 50%;
|
|
135
237
|
}
|
|
136
|
-
|
|
137
238
|
&:hover:not([aria-disabled='true']) {
|
|
138
|
-
|
|
239
|
+
background-color: color-mix(in srgb, #417e38 20%, transparent);
|
|
240
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
241
|
+
background-color: color-mix(in oklab, var(--color-green-600, #417e38) 20%, transparent);
|
|
242
|
+
}
|
|
139
243
|
}
|
|
140
|
-
|
|
141
244
|
&:focus {
|
|
142
|
-
|
|
245
|
+
background-color: color-mix(in srgb, #417e38 20%, transparent);
|
|
246
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
247
|
+
background-color: color-mix(in oklab, var(--color-green-600, #417e38) 20%, transparent);
|
|
248
|
+
}
|
|
143
249
|
}
|
|
144
250
|
}
|
|
145
251
|
}
|
|
252
|
+
@property --tw-font-weight {
|
|
253
|
+
syntax: "*";
|
|
254
|
+
inherits: false;
|
|
255
|
+
}
|
|
256
|
+
@property --tw-border-style {
|
|
257
|
+
syntax: "*";
|
|
258
|
+
inherits: false;
|
|
259
|
+
initial-value: solid;
|
|
260
|
+
}
|
|
261
|
+
@property --tw-shadow {
|
|
262
|
+
syntax: "*";
|
|
263
|
+
inherits: false;
|
|
264
|
+
initial-value: 0 0 #0000;
|
|
265
|
+
}
|
|
266
|
+
@property --tw-shadow-color {
|
|
267
|
+
syntax: "*";
|
|
268
|
+
inherits: false;
|
|
269
|
+
}
|
|
270
|
+
@property --tw-shadow-alpha {
|
|
271
|
+
syntax: "<percentage>";
|
|
272
|
+
inherits: false;
|
|
273
|
+
initial-value: 100%;
|
|
274
|
+
}
|
|
275
|
+
@property --tw-inset-shadow {
|
|
276
|
+
syntax: "*";
|
|
277
|
+
inherits: false;
|
|
278
|
+
initial-value: 0 0 #0000;
|
|
279
|
+
}
|
|
280
|
+
@property --tw-inset-shadow-color {
|
|
281
|
+
syntax: "*";
|
|
282
|
+
inherits: false;
|
|
283
|
+
}
|
|
284
|
+
@property --tw-inset-shadow-alpha {
|
|
285
|
+
syntax: "<percentage>";
|
|
286
|
+
inherits: false;
|
|
287
|
+
initial-value: 100%;
|
|
288
|
+
}
|
|
289
|
+
@property --tw-ring-color {
|
|
290
|
+
syntax: "*";
|
|
291
|
+
inherits: false;
|
|
292
|
+
}
|
|
293
|
+
@property --tw-ring-shadow {
|
|
294
|
+
syntax: "*";
|
|
295
|
+
inherits: false;
|
|
296
|
+
initial-value: 0 0 #0000;
|
|
297
|
+
}
|
|
298
|
+
@property --tw-inset-ring-color {
|
|
299
|
+
syntax: "*";
|
|
300
|
+
inherits: false;
|
|
301
|
+
}
|
|
302
|
+
@property --tw-inset-ring-shadow {
|
|
303
|
+
syntax: "*";
|
|
304
|
+
inherits: false;
|
|
305
|
+
initial-value: 0 0 #0000;
|
|
306
|
+
}
|
|
307
|
+
@property --tw-ring-inset {
|
|
308
|
+
syntax: "*";
|
|
309
|
+
inherits: false;
|
|
310
|
+
}
|
|
311
|
+
@property --tw-ring-offset-width {
|
|
312
|
+
syntax: "<length>";
|
|
313
|
+
inherits: false;
|
|
314
|
+
initial-value: 0px;
|
|
315
|
+
}
|
|
316
|
+
@property --tw-ring-offset-color {
|
|
317
|
+
syntax: "*";
|
|
318
|
+
inherits: false;
|
|
319
|
+
initial-value: #fff;
|
|
320
|
+
}
|
|
321
|
+
@property --tw-ring-offset-shadow {
|
|
322
|
+
syntax: "*";
|
|
323
|
+
inherits: false;
|
|
324
|
+
initial-value: 0 0 #0000;
|
|
325
|
+
}
|
|
326
|
+
@property --tw-content {
|
|
327
|
+
syntax: "*";
|
|
328
|
+
initial-value: "";
|
|
329
|
+
inherits: false;
|
|
330
|
+
}
|
|
331
|
+
@property --tw-gradient-position {
|
|
332
|
+
syntax: "*";
|
|
333
|
+
inherits: false;
|
|
334
|
+
}
|
|
335
|
+
@property --tw-gradient-from {
|
|
336
|
+
syntax: "<color>";
|
|
337
|
+
inherits: false;
|
|
338
|
+
initial-value: #0000;
|
|
339
|
+
}
|
|
340
|
+
@property --tw-gradient-via {
|
|
341
|
+
syntax: "<color>";
|
|
342
|
+
inherits: false;
|
|
343
|
+
initial-value: #0000;
|
|
344
|
+
}
|
|
345
|
+
@property --tw-gradient-to {
|
|
346
|
+
syntax: "<color>";
|
|
347
|
+
inherits: false;
|
|
348
|
+
initial-value: #0000;
|
|
349
|
+
}
|
|
350
|
+
@property --tw-gradient-stops {
|
|
351
|
+
syntax: "*";
|
|
352
|
+
inherits: false;
|
|
353
|
+
}
|
|
354
|
+
@property --tw-gradient-via-stops {
|
|
355
|
+
syntax: "*";
|
|
356
|
+
inherits: false;
|
|
357
|
+
}
|
|
358
|
+
@property --tw-gradient-from-position {
|
|
359
|
+
syntax: "<length-percentage>";
|
|
360
|
+
inherits: false;
|
|
361
|
+
initial-value: 0%;
|
|
362
|
+
}
|
|
363
|
+
@property --tw-gradient-via-position {
|
|
364
|
+
syntax: "<length-percentage>";
|
|
365
|
+
inherits: false;
|
|
366
|
+
initial-value: 50%;
|
|
367
|
+
}
|
|
368
|
+
@property --tw-gradient-to-position {
|
|
369
|
+
syntax: "<length-percentage>";
|
|
370
|
+
inherits: false;
|
|
371
|
+
initial-value: 100%;
|
|
372
|
+
}
|
|
@@ -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;
|