@acmekit/docs-ui 2.13.41
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/dist/Items-YPPZD6C6.mjs +312 -0
- package/dist/chunk-JD7BP7O5.mjs +13144 -0
- package/dist/index.d.mts +1550 -0
- package/dist/index.d.ts +1550 -0
- package/dist/index.js +15218 -0
- package/dist/index.mjs +366 -0
- package/package.json +58 -0
- package/src/components/Badge/index.tsx +74 -0
- package/src/components/BadgesList/index.tsx +18 -0
- package/src/components/BetaBadge/index.tsx +24 -0
- package/src/components/Bordered/index.tsx +21 -0
- package/src/components/BorderedIcon/index.tsx +60 -0
- package/src/components/Breadcrumbs/index.tsx +83 -0
- package/src/components/Button/index.tsx +100 -0
- package/src/components/Card/Layout/Default/index.tsx +124 -0
- package/src/components/Card/Layout/Filler/index.tsx +30 -0
- package/src/components/Card/Layout/Large/index.tsx +88 -0
- package/src/components/Card/Layout/Mini/index.tsx +142 -0
- package/src/components/Card/index.tsx +50 -0
- package/src/components/CardList/index.tsx +40 -0
- package/src/components/ChildDocs/index.tsx +9 -0
- package/src/components/CodeBlock/Actions/AskAi/index.tsx +10 -0
- package/src/components/CodeBlock/Actions/Copy/index.tsx +59 -0
- package/src/components/CodeBlock/Actions/index.tsx +137 -0
- package/src/components/CodeBlock/Collapsible/Button/index.tsx +58 -0
- package/src/components/CodeBlock/Collapsible/Fade/index.tsx +55 -0
- package/src/components/CodeBlock/Collapsible/Lines/index.tsx +22 -0
- package/src/components/CodeBlock/Header/Wrapper/index.tsx +46 -0
- package/src/components/CodeBlock/Header/index.tsx +67 -0
- package/src/components/CodeBlock/Inline/index.tsx +20 -0
- package/src/components/CodeBlock/Line/index.tsx +331 -0
- package/src/components/CodeBlock/index.tsx +510 -0
- package/src/components/CodeMdx/index.tsx +45 -0
- package/src/components/CodeTabs/Item/index.tsx +67 -0
- package/src/components/CodeTabs/index.tsx +319 -0
- package/src/components/ContentMenu/Actions/index.tsx +7 -0
- package/src/components/ContentMenu/Products/index.tsx +64 -0
- package/src/components/ContentMenu/Toc/index.tsx +148 -0
- package/src/components/ContentMenu/Version/index.tsx +77 -0
- package/src/components/ContentMenu/index.tsx +31 -0
- package/src/components/CopyButton/index.tsx +76 -0
- package/src/components/Details/Summary/index.tsx +75 -0
- package/src/components/Details/index.tsx +98 -0
- package/src/components/DetailsList/index.tsx +32 -0
- package/src/components/DottedSeparator/index.tsx +30 -0
- package/src/components/EditButton/index.tsx +32 -0
- package/src/components/EditDate/index.tsx +33 -0
- package/src/components/ErrorPage/Icon/index.tsx +428 -0
- package/src/components/ErrorPage/index.tsx +32 -0
- package/src/components/Feedback/Solutions/index.tsx +105 -0
- package/src/components/Feedback/index.tsx +304 -0
- package/src/components/Footer/index.tsx +23 -0
- package/src/components/Heading/H1/index.tsx +21 -0
- package/src/components/Heading/H2/index.tsx +47 -0
- package/src/components/Heading/H3/index.tsx +42 -0
- package/src/components/Heading/H4/index.tsx +14 -0
- package/src/components/Heading/index.tsx +4 -0
- package/src/components/IconHeadline/index.tsx +15 -0
- package/src/components/Icons/AiAssistant/index.tsx +462 -0
- package/src/components/Icons/ArrowRightDown/index.tsx +30 -0
- package/src/components/Icons/BundledProduct/index.tsx +72 -0
- package/src/components/Icons/CalendarRefresh/index.tsx +70 -0
- package/src/components/Icons/ChefHat/index.tsx +65 -0
- package/src/components/Icons/CircleDottedLine/index.tsx +60 -0
- package/src/components/Icons/CloudSolid/index.tsx +47 -0
- package/src/components/Icons/ColoredAcmeKit/index.tsx +13 -0
- package/src/components/Icons/DecisionProcess/index.tsx +58 -0
- package/src/components/Icons/Erp/index.tsx +92 -0
- package/src/components/Icons/Github/index.tsx +22 -0
- package/src/components/Icons/House/index.tsx +23 -0
- package/src/components/Icons/ImageBinary/index.tsx +69 -0
- package/src/components/Icons/Kapa/index.tsx +22 -0
- package/src/components/Icons/Markdown/index.tsx +25 -0
- package/src/components/Icons/NavigationDropdown/Admin/index.tsx +33 -0
- package/src/components/Icons/NavigationDropdown/Doc/index.tsx +41 -0
- package/src/components/Icons/NavigationDropdown/DocV1/index.tsx +37 -0
- package/src/components/Icons/NavigationDropdown/Modules/index.tsx +33 -0
- package/src/components/Icons/NavigationDropdown/Resources/index.tsx +37 -0
- package/src/components/Icons/NavigationDropdown/Store/index.tsx +37 -0
- package/src/components/Icons/NavigationDropdown/Ui/index.tsx +37 -0
- package/src/components/Icons/NavigationDropdown/User/index.tsx +37 -0
- package/src/components/Icons/PuzzleColored/index.tsx +35 -0
- package/src/components/Icons/QuestionMark/index.tsx +23 -0
- package/src/components/Icons/Restock/index.tsx +55 -0
- package/src/components/Icons/ScrollText/index.tsx +68 -0
- package/src/components/Icons/ShadedBg/index.tsx +334 -0
- package/src/components/Icons/Shop/index.tsx +68 -0
- package/src/components/Icons/SidebarLeft/index.tsx +42 -0
- package/src/components/Icons/StripeColored/index.tsx +60 -0
- package/src/components/Icons/ThumbDown/index.tsx +23 -0
- package/src/components/Icons/ThumbUp/index.tsx +23 -0
- package/src/components/Icons/WindowPaintbrush/index.tsx +57 -0
- package/src/components/Icons/index.tsx +20 -0
- package/src/components/InlineCode/index.tsx +42 -0
- package/src/components/InlineIcon/index.tsx +21 -0
- package/src/components/InlineThemeImage/index.tsx +14 -0
- package/src/components/Input/Search/index.tsx +64 -0
- package/src/components/Input/Text/index.tsx +39 -0
- package/src/components/Kbd/index.tsx +33 -0
- package/src/components/Label/index.tsx +19 -0
- package/src/components/Link/index.tsx +67 -0
- package/src/components/LinkButton/index.tsx +43 -0
- package/src/components/Loading/Dots/index.tsx +16 -0
- package/src/components/Loading/Spinner/index.tsx +19 -0
- package/src/components/Loading/index.tsx +43 -0
- package/src/components/MDXComponents/index.tsx +209 -0
- package/src/components/MainNav/DesktopMenu/ThemeMenu/index.tsx +76 -0
- package/src/components/MainNav/DesktopMenu/index.tsx +100 -0
- package/src/components/MainNav/Items/Dropdown/index.tsx +88 -0
- package/src/components/MainNav/Items/Link/index.tsx +34 -0
- package/src/components/MainNav/Items/index.tsx +61 -0
- package/src/components/MainNav/MobileMenu/Main/index.tsx +67 -0
- package/src/components/MainNav/MobileMenu/SubMenu/index.tsx +77 -0
- package/src/components/MainNav/MobileMenu/index.tsx +103 -0
- package/src/components/MainNav/Version/index.tsx +33 -0
- package/src/components/MainNav/index.tsx +153 -0
- package/src/components/MarkdownContent/index.tsx +41 -0
- package/src/components/Menu/Action/index.tsx +43 -0
- package/src/components/Menu/Divider/index.tsx +35 -0
- package/src/components/Menu/Dropdown/index.tsx +78 -0
- package/src/components/Menu/Item/index.tsx +36 -0
- package/src/components/Menu/SubMenu/index.tsx +47 -0
- package/src/components/Menu/index.tsx +44 -0
- package/src/components/Modal/Footer/index.tsx +29 -0
- package/src/components/Modal/Header/index.tsx +33 -0
- package/src/components/Modal/index.tsx +124 -0
- package/src/components/Note/Layout/index.tsx +139 -0
- package/src/components/Note/Types/checks.tsx +7 -0
- package/src/components/Note/Types/default.tsx +7 -0
- package/src/components/Note/Types/error.tsx +7 -0
- package/src/components/Note/Types/soon.tsx +7 -0
- package/src/components/Note/Types/sucess.tsx +7 -0
- package/src/components/Note/Types/warning.tsx +7 -0
- package/src/components/Note/index.tsx +32 -0
- package/src/components/Notices/DeprecatedNotice/index.tsx +33 -0
- package/src/components/Notices/ExpandableNotice/index.tsx +36 -0
- package/src/components/Notices/FeatureFlagNotice/index.tsx +36 -0
- package/src/components/Notices/VersionNotice/index.tsx +37 -0
- package/src/components/Notification/Item/Layout/Default/index.tsx +89 -0
- package/src/components/Notification/Item/index.tsx +88 -0
- package/src/components/Notification/index.tsx +65 -0
- package/src/components/Pagination/Card/index.tsx +80 -0
- package/src/components/Pagination/index.tsx +35 -0
- package/src/components/Prerequisites/Item/index.tsx +43 -0
- package/src/components/Prerequisites/index.tsx +94 -0
- package/src/components/RadioItem/index.tsx +38 -0
- package/src/components/Rating/index.tsx +133 -0
- package/src/components/RootProviders/index.tsx +31 -0
- package/src/components/Select/Badge/index.tsx +122 -0
- package/src/components/Select/Dropdown/index.tsx +188 -0
- package/src/components/Select/Input/index.tsx +123 -0
- package/src/components/Select/index.ts +13 -0
- package/src/components/Sidebar/Child/index.tsx +43 -0
- package/src/components/Sidebar/Item/Category/index.tsx +151 -0
- package/src/components/Sidebar/Item/Link/index.tsx +174 -0
- package/src/components/Sidebar/Item/Sidebar/index.tsx +67 -0
- package/src/components/Sidebar/Item/SubCategory/index.tsx +83 -0
- package/src/components/Sidebar/Item/index.tsx +41 -0
- package/src/components/Sidebar/Top/MobileClose/index.tsx +21 -0
- package/src/components/Sidebar/Top/index.tsx +33 -0
- package/src/components/Sidebar/index.tsx +153 -0
- package/src/components/SourceCodeLink/index.tsx +37 -0
- package/src/components/SplitLists/index.tsx +58 -0
- package/src/components/Table/index.tsx +87 -0
- package/src/components/Tabs/index.tsx +106 -0
- package/src/components/TextArea/index.tsx +30 -0
- package/src/components/ThemeImage/index.tsx +26 -0
- package/src/components/Toggle/index.tsx +28 -0
- package/src/components/Tooltip/index.tsx +65 -0
- package/src/components/TypeList/Items/index.tsx +337 -0
- package/src/components/TypeList/index.tsx +63 -0
- package/src/components/WideSection/index.tsx +25 -0
- package/src/components/ZoomImg/index.tsx +17 -0
- package/src/components/index.ts +75 -0
- package/src/constants.tsx +261 -0
- package/src/global-config.ts +11 -0
- package/src/hooks/index.ts +14 -0
- package/src/hooks/use-active-on-scroll/index.tsx +223 -0
- package/src/hooks/use-click-outside/index.tsx +37 -0
- package/src/hooks/use-collapsible/index.tsx +128 -0
- package/src/hooks/use-collapsible-code-lines/index.tsx +149 -0
- package/src/hooks/use-copy/index.tsx +28 -0
- package/src/hooks/use-heading-url/index.tsx +32 -0
- package/src/hooks/use-is-external-link/index.tsx +19 -0
- package/src/hooks/use-keyboard-shortcut/index.tsx +71 -0
- package/src/hooks/use-mutation-observer/index.ts +32 -0
- package/src/hooks/use-page-scroll-manager/index.tsx +82 -0
- package/src/hooks/use-resize-observer/index.ts +20 -0
- package/src/hooks/use-scroll-utils/index.tsx +372 -0
- package/src/hooks/use-select/index.tsx +99 -0
- package/src/hooks/use-tabs/index.tsx +94 -0
- package/src/index.ts +8 -0
- package/src/layouts/barebone.tsx +18 -0
- package/src/layouts/index.ts +4 -0
- package/src/layouts/main-content.tsx +86 -0
- package/src/layouts/root.tsx +43 -0
- package/src/layouts/tight.tsx +29 -0
- package/src/layouts/wide.tsx +25 -0
- package/src/providers/AiAssistant/index.tsx +65 -0
- package/src/providers/BrowserProvider/index.tsx +40 -0
- package/src/providers/ColorMode/index.tsx +73 -0
- package/src/providers/Layout/index.tsx +52 -0
- package/src/providers/MainNav/index.tsx +134 -0
- package/src/providers/Mobile/index.tsx +62 -0
- package/src/providers/Modal/index.tsx +52 -0
- package/src/providers/Notification/index.tsx +149 -0
- package/src/providers/Pagination/index.tsx +230 -0
- package/src/providers/Search/index.tsx +91 -0
- package/src/providers/Sidebar/index.tsx +745 -0
- package/src/providers/SiteConfig/index.tsx +70 -0
- package/src/providers/index.ts +13 -0
- package/src/types/config.ts +34 -0
- package/src/types/frontmatter.ts +23 -0
- package/src/types/general.ts +1 -0
- package/src/types/index.ts +9 -0
- package/src/types/menu.ts +40 -0
- package/src/types/navigation-dropdown.ts +16 -0
- package/src/types/navigation.ts +21 -0
- package/src/types/sidebar.ts +109 -0
- package/src/types/toc.ts +19 -0
- package/src/types/ui.ts +9 -0
- package/src/utils/array-same-elms.ts +10 -0
- package/src/utils/capitalize.ts +3 -0
- package/src/utils/check-sidebar-item-visibility.ts +47 -0
- package/src/utils/decode-str.ts +8 -0
- package/src/utils/dom-utils.ts +29 -0
- package/src/utils/event-parser.ts +54 -0
- package/src/utils/get-link-with-base-path.ts +3 -0
- package/src/utils/get-navbar-items.ts +55 -0
- package/src/utils/get-scrolled-top.ts +8 -0
- package/src/utils/index.ts +13 -0
- package/src/utils/is-elm-window.ts +3 -0
- package/src/utils/is-in-view.ts +10 -0
- package/src/utils/os-browser-utils.ts +39 -0
- package/src/utils/set-obj-value.ts +38 -0
- package/src/utils/sidebar-utils.ts +129 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
|
|
2
|
+
import clsx from "clsx"
|
|
3
|
+
import { Link } from "react-router-dom"
|
|
4
|
+
import React, { useMemo } from "react"
|
|
5
|
+
import { MenuItem, MenuItemLink, MenuItemSubMenu } from "../../../../types"
|
|
6
|
+
import { SelectedMenu } from ".."
|
|
7
|
+
import { TriangleRightMini } from "@acmekit/icons"
|
|
8
|
+
|
|
9
|
+
type MainNavMobileSubMenuProps = {
|
|
10
|
+
menu: MenuItem[]
|
|
11
|
+
title: string
|
|
12
|
+
setSelectedMenus: React.Dispatch<React.SetStateAction<SelectedMenu>>
|
|
13
|
+
onOpenLink?: () => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const MainNavMobileSubMenu = ({
|
|
17
|
+
menu,
|
|
18
|
+
title,
|
|
19
|
+
setSelectedMenus,
|
|
20
|
+
onOpenLink,
|
|
21
|
+
}: MainNavMobileSubMenuProps) => {
|
|
22
|
+
const filteredItems: (MenuItemLink | MenuItemSubMenu)[] = useMemo(() => {
|
|
23
|
+
return menu.filter(
|
|
24
|
+
(item) => item.type === "link" || item.type === "sub-menu"
|
|
25
|
+
) as (MenuItemLink | MenuItemSubMenu)[]
|
|
26
|
+
}, [menu])
|
|
27
|
+
return (
|
|
28
|
+
<div className="flex flex-col gap-[23px] max-h-[90%]">
|
|
29
|
+
<span
|
|
30
|
+
className="text-compact-small-plus text-acmekit-fg-muted uppercase"
|
|
31
|
+
data-testid="menu-title"
|
|
32
|
+
>
|
|
33
|
+
{title}
|
|
34
|
+
</span>
|
|
35
|
+
<ul className="flex flex-col gap-[18px] max-h-full overflow-auto">
|
|
36
|
+
{filteredItems.map((item, index) => (
|
|
37
|
+
<li
|
|
38
|
+
key={index}
|
|
39
|
+
className={clsx(
|
|
40
|
+
"text-h1 text-acmekit-fg-base cursor-pointer",
|
|
41
|
+
"flex justify-between gap-docs_1"
|
|
42
|
+
)}
|
|
43
|
+
>
|
|
44
|
+
{item.type === "link" && (
|
|
45
|
+
<Link
|
|
46
|
+
to={item.link}
|
|
47
|
+
className="block w-full"
|
|
48
|
+
onClick={() => onOpenLink?.()}
|
|
49
|
+
data-testid="link-item"
|
|
50
|
+
>
|
|
51
|
+
{item.title}
|
|
52
|
+
</Link>
|
|
53
|
+
)}
|
|
54
|
+
{item.type === "sub-menu" && (
|
|
55
|
+
<div
|
|
56
|
+
className="w-full flex justify-between gap-docs_1"
|
|
57
|
+
onClick={() =>
|
|
58
|
+
setSelectedMenus((prev) => [
|
|
59
|
+
...prev,
|
|
60
|
+
{
|
|
61
|
+
title: item.title,
|
|
62
|
+
menu: item.items,
|
|
63
|
+
},
|
|
64
|
+
])
|
|
65
|
+
}
|
|
66
|
+
data-testid="sub-menu-item"
|
|
67
|
+
>
|
|
68
|
+
<span>{item.title}</span>
|
|
69
|
+
<TriangleRightMini />
|
|
70
|
+
</div>
|
|
71
|
+
)}
|
|
72
|
+
</li>
|
|
73
|
+
))}
|
|
74
|
+
</ul>
|
|
75
|
+
</div>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
|
|
2
|
+
import React, { useRef, useState } from "react"
|
|
3
|
+
import { Button } from "../../Button"
|
|
4
|
+
import { ArrowUturnLeft, BarsThree, XMark } from "@acmekit/icons"
|
|
5
|
+
import clsx from "clsx"
|
|
6
|
+
import { MenuItem } from "../../../types"
|
|
7
|
+
// @ts-expect-error can't install the types package because it doesn't support React v19
|
|
8
|
+
import { CSSTransition, SwitchTransition } from "react-transition-group"
|
|
9
|
+
import { MainNavMobileMainMenu } from "./Main"
|
|
10
|
+
import { MainNavMobileSubMenu } from "./SubMenu"
|
|
11
|
+
|
|
12
|
+
export type SelectedMenu = {
|
|
13
|
+
title: string
|
|
14
|
+
menu: MenuItem[]
|
|
15
|
+
}[]
|
|
16
|
+
|
|
17
|
+
export const MainNavMobileMenu = () => {
|
|
18
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
19
|
+
const [selectedMenus, setSelectedMenus] = useState<SelectedMenu>([])
|
|
20
|
+
const ref = useRef(null)
|
|
21
|
+
|
|
22
|
+
const handleOpenLink = () => {
|
|
23
|
+
setIsOpen(false)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className="flex lg:hidden justify-center items-center">
|
|
28
|
+
<Button
|
|
29
|
+
variant="transparent"
|
|
30
|
+
onClick={() => setIsOpen((prev) => !prev)}
|
|
31
|
+
className="text-acmekit-fg-subtle !p-[6.5px]"
|
|
32
|
+
data-testid="menu-button"
|
|
33
|
+
>
|
|
34
|
+
{!isOpen && <BarsThree />}
|
|
35
|
+
{isOpen && <XMark />}
|
|
36
|
+
</Button>
|
|
37
|
+
<div
|
|
38
|
+
className={clsx(
|
|
39
|
+
"flex items-center justify-center fixed w-full h-[calc(100vh-52px)]",
|
|
40
|
+
"top-[52px] transition-[left] bg-acmekit-bg-subtle z-50",
|
|
41
|
+
!isOpen && "-left-full",
|
|
42
|
+
isOpen && "left-0"
|
|
43
|
+
)}
|
|
44
|
+
data-testid="menu-panel"
|
|
45
|
+
>
|
|
46
|
+
<SwitchTransition>
|
|
47
|
+
<CSSTransition
|
|
48
|
+
key={
|
|
49
|
+
!selectedMenus.length
|
|
50
|
+
? "main"
|
|
51
|
+
: selectedMenus[selectedMenus.length - 1].title
|
|
52
|
+
}
|
|
53
|
+
classNames={{
|
|
54
|
+
enter: "animate-fadeInLeft animate-fast",
|
|
55
|
+
exit: "animate-fadeOutRight animate-fast",
|
|
56
|
+
}}
|
|
57
|
+
nodeRef={ref}
|
|
58
|
+
timeout={250}
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
ref={ref}
|
|
62
|
+
className="w-full px-docs_1.5 h-3/4 flex flex-col justify-center"
|
|
63
|
+
>
|
|
64
|
+
{selectedMenus.length === 0 && (
|
|
65
|
+
<MainNavMobileMainMenu
|
|
66
|
+
setSelectedMenus={setSelectedMenus}
|
|
67
|
+
onOpenLink={handleOpenLink}
|
|
68
|
+
/>
|
|
69
|
+
)}
|
|
70
|
+
{selectedMenus.length > 0 && (
|
|
71
|
+
<>
|
|
72
|
+
<div
|
|
73
|
+
className={clsx(
|
|
74
|
+
"flex items-center gap-docs_0.5",
|
|
75
|
+
"text-acmekit-fg-base my-[14px]",
|
|
76
|
+
"cursor-pointer"
|
|
77
|
+
)}
|
|
78
|
+
tabIndex={-1}
|
|
79
|
+
onClick={() =>
|
|
80
|
+
setSelectedMenus((prev) => {
|
|
81
|
+
const temp = [...prev]
|
|
82
|
+
temp.pop()
|
|
83
|
+
return temp
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
>
|
|
87
|
+
<ArrowUturnLeft />
|
|
88
|
+
<span className="text-h1">Back</span>
|
|
89
|
+
</div>
|
|
90
|
+
<MainNavMobileSubMenu
|
|
91
|
+
{...selectedMenus[selectedMenus.length - 1]}
|
|
92
|
+
setSelectedMenus={setSelectedMenus}
|
|
93
|
+
onOpenLink={handleOpenLink}
|
|
94
|
+
/>
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
</CSSTransition>
|
|
99
|
+
</SwitchTransition>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { useSiteConfig } from "../../../providers/SiteConfig"
|
|
3
|
+
import { Tooltip } from "../../Tooltip"
|
|
4
|
+
import clsx from "clsx"
|
|
5
|
+
|
|
6
|
+
export const MainNavVersion = () => {
|
|
7
|
+
const {
|
|
8
|
+
config: { version },
|
|
9
|
+
} = useSiteConfig()
|
|
10
|
+
|
|
11
|
+
if (!version) {
|
|
12
|
+
return null
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<a
|
|
17
|
+
href={version.releaseUrl}
|
|
18
|
+
target="_blank"
|
|
19
|
+
className={clsx(
|
|
20
|
+
version.hide && "hidden",
|
|
21
|
+
"px-docs_0.5 py-docs_0.25 hover:bg-acmekit-button-transparent-hover rounded-docs_sm"
|
|
22
|
+
)}
|
|
23
|
+
>
|
|
24
|
+
<Tooltip html="View the release notes<br/>on GitHub">
|
|
25
|
+
<span className="relative text-compact-small-plus block">
|
|
26
|
+
<span className="flex justify-center items-center">
|
|
27
|
+
v{version.number}
|
|
28
|
+
</span>
|
|
29
|
+
</span>
|
|
30
|
+
</Tooltip>
|
|
31
|
+
</a>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
|
|
2
|
+
import clsx from "clsx"
|
|
3
|
+
import React from "react"
|
|
4
|
+
import { MagnifyingGlass } from "@acmekit/icons"
|
|
5
|
+
import { BorderedIcon } from "../../components/BorderedIcon"
|
|
6
|
+
import { Button } from "../../components/Button"
|
|
7
|
+
import { GITHUB_ISSUES_LINK } from "../../constants"
|
|
8
|
+
import { useLayout } from "../../providers/Layout"
|
|
9
|
+
import { useSearch } from "../../providers/Search"
|
|
10
|
+
import { useSidebar } from "../../providers/Sidebar"
|
|
11
|
+
import { useSiteConfig } from "../../providers/SiteConfig"
|
|
12
|
+
import { getOsShortcut } from "../../utils/os-browser-utils"
|
|
13
|
+
import { MainNavItems } from "./Items"
|
|
14
|
+
import { MainNavDesktopMenu } from "./DesktopMenu"
|
|
15
|
+
import { SidebarLeftIcon } from "../Icons/SidebarLeft"
|
|
16
|
+
import { MainNavMobileMenu } from "./MobileMenu"
|
|
17
|
+
import { Link } from "react-router-dom"
|
|
18
|
+
import { MainNavVersion } from "./Version"
|
|
19
|
+
import { MainNavItemDropdown } from "./Items/Dropdown"
|
|
20
|
+
|
|
21
|
+
type MainNavProps = {
|
|
22
|
+
className?: string
|
|
23
|
+
itemsClassName?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const MainNav = ({ className, itemsClassName }: MainNavProps) => {
|
|
27
|
+
const { setMobileSidebarOpen, isSidebarShown } = useSidebar()
|
|
28
|
+
const { config } = useSiteConfig()
|
|
29
|
+
const { showCollapsedNavbar } = useLayout()
|
|
30
|
+
const { setIsOpen: setSearchOpen } = useSearch()
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
className={clsx(
|
|
35
|
+
"w-full z-20 sticky top-0 bg-acmekit-bg-base",
|
|
36
|
+
"border-b border-acmekit-border-base",
|
|
37
|
+
className
|
|
38
|
+
)}
|
|
39
|
+
data-testid="main-nav"
|
|
40
|
+
>
|
|
41
|
+
<div
|
|
42
|
+
className={clsx(
|
|
43
|
+
"flex justify-between items-center px-docs_1 w-full gap-docs_1",
|
|
44
|
+
showCollapsedNavbar && "border-b border-acmekit-border-base"
|
|
45
|
+
)}
|
|
46
|
+
data-testid="main-nav-content"
|
|
47
|
+
>
|
|
48
|
+
<div className="flex items-center gap-[10px]">
|
|
49
|
+
{isSidebarShown && (
|
|
50
|
+
<Button
|
|
51
|
+
className="lg:hidden my-docs_0.75 !p-[6.5px]"
|
|
52
|
+
variant="transparent-clear"
|
|
53
|
+
onClick={() => setMobileSidebarOpen(true)}
|
|
54
|
+
data-testid="mobile-sidebar-button"
|
|
55
|
+
>
|
|
56
|
+
<SidebarLeftIcon />
|
|
57
|
+
</Button>
|
|
58
|
+
)}
|
|
59
|
+
<Link
|
|
60
|
+
to={config.baseUrl || "/"}
|
|
61
|
+
className="flex items-center gap-docs_0.5 no-underline"
|
|
62
|
+
data-testid="logo-link"
|
|
63
|
+
>
|
|
64
|
+
{config.logo && (
|
|
65
|
+
<BorderedIcon
|
|
66
|
+
icon={config.logo}
|
|
67
|
+
iconWrapperClassName="my-[14px]"
|
|
68
|
+
wrapperClassName="w-[20px] h-[20px]"
|
|
69
|
+
iconWidth={20}
|
|
70
|
+
iconHeight={20}
|
|
71
|
+
data-testid="logo-icon"
|
|
72
|
+
/>
|
|
73
|
+
)}
|
|
74
|
+
<span className="text-compact-medium-plus text-acmekit-fg-base whitespace-nowrap">
|
|
75
|
+
{config.project?.title || "Docs"}
|
|
76
|
+
</span>
|
|
77
|
+
</Link>
|
|
78
|
+
</div>
|
|
79
|
+
{!showCollapsedNavbar && (
|
|
80
|
+
<MainNavItems className={clsx("flex-grow", itemsClassName)} />
|
|
81
|
+
)}
|
|
82
|
+
<div
|
|
83
|
+
className={clsx(
|
|
84
|
+
"flex items-center my-docs_0.75",
|
|
85
|
+
showCollapsedNavbar && "flex-grow justify-between"
|
|
86
|
+
)}
|
|
87
|
+
data-testid="main-nav-actions"
|
|
88
|
+
>
|
|
89
|
+
<div className="lg:flex items-center gap-[6px] text-acmekit-fg-subtle hidden">
|
|
90
|
+
<MainNavVersion />
|
|
91
|
+
<MainNavItemDropdown
|
|
92
|
+
item={{
|
|
93
|
+
type: "dropdown",
|
|
94
|
+
title: "Help",
|
|
95
|
+
children: [
|
|
96
|
+
{
|
|
97
|
+
type: "link",
|
|
98
|
+
title: "Troubleshooting",
|
|
99
|
+
link: "https://docs.acmekit.com/resources/troubleshooting",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
type: "link",
|
|
103
|
+
title: "Report Issue",
|
|
104
|
+
link: GITHUB_ISSUES_LINK,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
type: "link",
|
|
108
|
+
title: "Discord Community",
|
|
109
|
+
link: "https://discord.gg/acmekit",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
type: "divider",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
type: "link",
|
|
116
|
+
title: "Contact Sales",
|
|
117
|
+
link: "https://acmekit.com/contact/",
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
}}
|
|
121
|
+
isActive={false}
|
|
122
|
+
className="text-acmekit-fg-subtle hover:bg-acmekit-button-transparent-hover rounded-docs_sm px-docs_0.5"
|
|
123
|
+
wrapperClassName="z-10"
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
<div className="flex items-center gap-[6px]">
|
|
127
|
+
<Button
|
|
128
|
+
variant="transparent"
|
|
129
|
+
onClick={() => setSearchOpen(true)}
|
|
130
|
+
className="!p-[6.5px] flex items-center gap-docs_0.5"
|
|
131
|
+
data-testid="search-button"
|
|
132
|
+
>
|
|
133
|
+
<MagnifyingGlass className="text-acmekit-fg-subtle" />
|
|
134
|
+
<span className="text-compact-x-small text-acmekit-fg-muted hidden lg:inline">
|
|
135
|
+
{getOsShortcut()}K
|
|
136
|
+
</span>
|
|
137
|
+
</Button>
|
|
138
|
+
<MainNavDesktopMenu />
|
|
139
|
+
<MainNavMobileMenu />
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
{showCollapsedNavbar && (
|
|
144
|
+
<div
|
|
145
|
+
className={clsx("border-b border-acmekit-border-base px-docs_1")}
|
|
146
|
+
data-testid="collapsed-nav-items"
|
|
147
|
+
>
|
|
148
|
+
<MainNavItems className={clsx("flex-wrap", itemsClassName)} />
|
|
149
|
+
</div>
|
|
150
|
+
)}
|
|
151
|
+
</div>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import ReactMarkdown, {
|
|
3
|
+
Options as ReactMarkdownOptions,
|
|
4
|
+
Components,
|
|
5
|
+
} from "react-markdown"
|
|
6
|
+
import { MDXComponents } from "../../components/MDXComponents"
|
|
7
|
+
import clsx from "clsx"
|
|
8
|
+
|
|
9
|
+
export type MarkdownContentProps = ReactMarkdownOptions & {
|
|
10
|
+
components?: Partial<Components> | null | undefined
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const MarkdownContent = ({
|
|
14
|
+
children,
|
|
15
|
+
components,
|
|
16
|
+
...props
|
|
17
|
+
}: MarkdownContentProps) => {
|
|
18
|
+
return (
|
|
19
|
+
<ReactMarkdown
|
|
20
|
+
components={
|
|
21
|
+
(components || {
|
|
22
|
+
...MDXComponents,
|
|
23
|
+
pre: ({
|
|
24
|
+
className,
|
|
25
|
+
children,
|
|
26
|
+
...props
|
|
27
|
+
}: React.HTMLAttributes<HTMLPreElement>) => {
|
|
28
|
+
return (
|
|
29
|
+
<pre className={clsx("p-0 bg-transparent", className)} {...props}>
|
|
30
|
+
{children}
|
|
31
|
+
</pre>
|
|
32
|
+
)
|
|
33
|
+
},
|
|
34
|
+
}) as any
|
|
35
|
+
}
|
|
36
|
+
{...props}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</ReactMarkdown>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
import clsx from "clsx"
|
|
3
|
+
import React from "react"
|
|
4
|
+
import { MenuItem, MenuItemAction } from "../../../types"
|
|
5
|
+
|
|
6
|
+
export type MenuActionProps = {
|
|
7
|
+
item: MenuItemAction
|
|
8
|
+
onClick?: (item: MenuItem) => void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const MenuAction = ({ item, onClick }: MenuActionProps) => {
|
|
12
|
+
return (
|
|
13
|
+
<div className="px-docs_0.25">
|
|
14
|
+
<span
|
|
15
|
+
className={clsx(
|
|
16
|
+
"flex py-docs_0.25 px-docs_0.5",
|
|
17
|
+
"gap-docs_0.5 rounded-docs_xs",
|
|
18
|
+
"hover:bg-acmekit-bg-component-hover",
|
|
19
|
+
"text-acmekit-fg-base cursor-pointer"
|
|
20
|
+
)}
|
|
21
|
+
tabIndex={-1}
|
|
22
|
+
onClick={() => {
|
|
23
|
+
item.action()
|
|
24
|
+
onClick?.(item)
|
|
25
|
+
}}
|
|
26
|
+
data-testid="menu-action"
|
|
27
|
+
>
|
|
28
|
+
<span className="text-acmekit-fg-subtle mt-[2.5px] block">
|
|
29
|
+
{item.icon}
|
|
30
|
+
</span>
|
|
31
|
+
<span className="text-compact-small flex-1">{item.title}</span>
|
|
32
|
+
{item.shortcut && (
|
|
33
|
+
<span
|
|
34
|
+
className="text-acmekit-fg-subtle text-compact-small"
|
|
35
|
+
data-testid="menu-action-shortcut"
|
|
36
|
+
>
|
|
37
|
+
{item.shortcut}
|
|
38
|
+
</span>
|
|
39
|
+
)}
|
|
40
|
+
</span>
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
import React from "react"
|
|
3
|
+
|
|
4
|
+
export const MenuDivider = () => {
|
|
5
|
+
return (
|
|
6
|
+
<svg
|
|
7
|
+
width="100%"
|
|
8
|
+
height="100%"
|
|
9
|
+
viewBox="0 0 205 8"
|
|
10
|
+
fill="none"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
>
|
|
13
|
+
<rect
|
|
14
|
+
width="197"
|
|
15
|
+
height="8"
|
|
16
|
+
transform="translate(4)"
|
|
17
|
+
fill="var(--docs-bg-component)"
|
|
18
|
+
/>
|
|
19
|
+
<rect
|
|
20
|
+
x="-4"
|
|
21
|
+
y="3"
|
|
22
|
+
width="213"
|
|
23
|
+
height="1"
|
|
24
|
+
fill="var(--docs-border-menu-top)"
|
|
25
|
+
/>
|
|
26
|
+
<rect
|
|
27
|
+
x="-4"
|
|
28
|
+
y="4"
|
|
29
|
+
width="213"
|
|
30
|
+
height="1"
|
|
31
|
+
fill="var(--docs-border-menu-bot)"
|
|
32
|
+
/>
|
|
33
|
+
</svg>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
|
|
2
|
+
import React from "react"
|
|
3
|
+
import { useRef, useState } from "react"
|
|
4
|
+
import { Button } from "../../../components/Button"
|
|
5
|
+
import { Menu } from "../../../components/Menu"
|
|
6
|
+
import { useClickOutside } from "../../../hooks/use-click-outside"
|
|
7
|
+
import { MenuItem } from "../../../types"
|
|
8
|
+
import clsx from "clsx"
|
|
9
|
+
|
|
10
|
+
type DropdownMenuProps = {
|
|
11
|
+
dropdownButtonContent: React.ReactNode
|
|
12
|
+
dropdownButtonClassName?: string
|
|
13
|
+
menuComponent?: React.ReactNode
|
|
14
|
+
menuItems?: MenuItem[]
|
|
15
|
+
menuClassName?: string
|
|
16
|
+
className?: string
|
|
17
|
+
open?: boolean
|
|
18
|
+
setOpen?: (open: boolean) => void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const DropdownMenu = ({
|
|
22
|
+
dropdownButtonContent,
|
|
23
|
+
dropdownButtonClassName,
|
|
24
|
+
menuComponent,
|
|
25
|
+
menuItems,
|
|
26
|
+
menuClassName,
|
|
27
|
+
className,
|
|
28
|
+
open: externalOpen = false,
|
|
29
|
+
setOpen: externalSetOpen,
|
|
30
|
+
}: DropdownMenuProps) => {
|
|
31
|
+
const [open, setOpen] = useState(externalOpen)
|
|
32
|
+
const ref = useRef<HTMLButtonElement | null>(null)
|
|
33
|
+
function changeOpenState(newOpenState: boolean) {
|
|
34
|
+
if (externalSetOpen) {
|
|
35
|
+
externalSetOpen(newOpenState)
|
|
36
|
+
} else {
|
|
37
|
+
setOpen(newOpenState)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
useClickOutside({
|
|
41
|
+
elmRef: ref,
|
|
42
|
+
onClickOutside: () => {
|
|
43
|
+
changeOpenState(false)
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
if (!menuComponent && !menuItems) {
|
|
48
|
+
return null
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div className={clsx("relative", className)} data-testid="dropdown-wrapper">
|
|
53
|
+
<Button
|
|
54
|
+
variant="transparent"
|
|
55
|
+
onClick={() => changeOpenState(!open)}
|
|
56
|
+
className={clsx(
|
|
57
|
+
"!p-[6px] text-acmekit-fg-subtle",
|
|
58
|
+
dropdownButtonClassName
|
|
59
|
+
)}
|
|
60
|
+
buttonRef={ref}
|
|
61
|
+
data-testid="dropdown-button"
|
|
62
|
+
>
|
|
63
|
+
{dropdownButtonContent}
|
|
64
|
+
</Button>
|
|
65
|
+
{menuComponent}
|
|
66
|
+
{!menuComponent && menuItems && (
|
|
67
|
+
<Menu
|
|
68
|
+
items={menuItems}
|
|
69
|
+
className={clsx(
|
|
70
|
+
"absolute right-0 top-[calc(100%+8px)] w-max",
|
|
71
|
+
!open && "hidden",
|
|
72
|
+
menuClassName
|
|
73
|
+
)}
|
|
74
|
+
/>
|
|
75
|
+
)}
|
|
76
|
+
</div>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
import clsx from "clsx"
|
|
3
|
+
import { Link } from "react-router-dom"
|
|
4
|
+
import React from "react"
|
|
5
|
+
import { MenuItem as MenuItemType, MenuItemLink } from "../../../types"
|
|
6
|
+
|
|
7
|
+
export type MenuItemProps = {
|
|
8
|
+
item: MenuItemLink
|
|
9
|
+
onClick?: (item: MenuItemType) => void
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const MenuItem = ({ item, onClick }: MenuItemProps) => {
|
|
13
|
+
return (
|
|
14
|
+
<div className="px-docs_0.25">
|
|
15
|
+
<Link
|
|
16
|
+
className={clsx(
|
|
17
|
+
"flex py-docs_0.25 px-docs_0.5",
|
|
18
|
+
"gap-docs_0.5 rounded-docs_xs",
|
|
19
|
+
"hover:bg-acmekit-bg-component-hover",
|
|
20
|
+
"text-acmekit-fg-base"
|
|
21
|
+
)}
|
|
22
|
+
to={item.link}
|
|
23
|
+
onClick={() => onClick?.(item)}
|
|
24
|
+
target={item.openInNewTab ? "_blank" : undefined}
|
|
25
|
+
rel={item.openInNewTab ? "noopener noreferrer" : undefined}
|
|
26
|
+
>
|
|
27
|
+
{item.icon && (
|
|
28
|
+
<span className="text-acmekit-fg-subtle mt-[2.5px] block">
|
|
29
|
+
{item.icon}
|
|
30
|
+
</span>
|
|
31
|
+
)}
|
|
32
|
+
<span className="text-compact-small">{item.title}</span>
|
|
33
|
+
</Link>
|
|
34
|
+
</div>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
import React, { useState } from "react"
|
|
3
|
+
import { Menu, MenuProps } from ".."
|
|
4
|
+
import clsx from "clsx"
|
|
5
|
+
import { MenuItemSubMenu } from "../../../types"
|
|
6
|
+
import { TriangleRightMini } from "@acmekit/icons"
|
|
7
|
+
import { Link } from "react-router-dom"
|
|
8
|
+
|
|
9
|
+
type MenuSubMenuProps = Pick<MenuProps, "itemsOnClick"> & {
|
|
10
|
+
item: MenuItemSubMenu
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const MenuSubMenu = ({ item, itemsOnClick }: MenuSubMenuProps) => {
|
|
14
|
+
const [open, setOpen] = useState(false)
|
|
15
|
+
|
|
16
|
+
const Component = item.link ? Link : "span"
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
className="px-docs_0.25 relative"
|
|
21
|
+
onMouseOver={() => setOpen(true)}
|
|
22
|
+
onMouseLeave={() => setOpen(false)}
|
|
23
|
+
data-testid="sub-menu-wrapper"
|
|
24
|
+
>
|
|
25
|
+
<Component
|
|
26
|
+
className={clsx(
|
|
27
|
+
"flex py-docs_0.25 px-docs_0.5",
|
|
28
|
+
"gap-docs_0.5 rounded-docs_xs",
|
|
29
|
+
"hover:bg-acmekit-bg-component-hover",
|
|
30
|
+
"text-acmekit-fg-base justify-between"
|
|
31
|
+
)}
|
|
32
|
+
onClick={() => itemsOnClick?.(item)}
|
|
33
|
+
{...(item.link ? { to: item.link } : {})}
|
|
34
|
+
>
|
|
35
|
+
<span className="text-compact-small">{item.title}</span>
|
|
36
|
+
<span className="text-acmekit-fg-subtle mt-[2.5px] block">
|
|
37
|
+
<TriangleRightMini />
|
|
38
|
+
</span>
|
|
39
|
+
</Component>
|
|
40
|
+
{open && (
|
|
41
|
+
<div className="absolute top-0 left-[calc(100%-8px)] w-max">
|
|
42
|
+
<Menu itemsOnClick={itemsOnClick} items={item.items} />
|
|
43
|
+
</div>
|
|
44
|
+
)}
|
|
45
|
+
</div>
|
|
46
|
+
)
|
|
47
|
+
}
|