@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.
Files changed (236) hide show
  1. package/dist/Items-YPPZD6C6.mjs +312 -0
  2. package/dist/chunk-JD7BP7O5.mjs +13144 -0
  3. package/dist/index.d.mts +1550 -0
  4. package/dist/index.d.ts +1550 -0
  5. package/dist/index.js +15218 -0
  6. package/dist/index.mjs +366 -0
  7. package/package.json +58 -0
  8. package/src/components/Badge/index.tsx +74 -0
  9. package/src/components/BadgesList/index.tsx +18 -0
  10. package/src/components/BetaBadge/index.tsx +24 -0
  11. package/src/components/Bordered/index.tsx +21 -0
  12. package/src/components/BorderedIcon/index.tsx +60 -0
  13. package/src/components/Breadcrumbs/index.tsx +83 -0
  14. package/src/components/Button/index.tsx +100 -0
  15. package/src/components/Card/Layout/Default/index.tsx +124 -0
  16. package/src/components/Card/Layout/Filler/index.tsx +30 -0
  17. package/src/components/Card/Layout/Large/index.tsx +88 -0
  18. package/src/components/Card/Layout/Mini/index.tsx +142 -0
  19. package/src/components/Card/index.tsx +50 -0
  20. package/src/components/CardList/index.tsx +40 -0
  21. package/src/components/ChildDocs/index.tsx +9 -0
  22. package/src/components/CodeBlock/Actions/AskAi/index.tsx +10 -0
  23. package/src/components/CodeBlock/Actions/Copy/index.tsx +59 -0
  24. package/src/components/CodeBlock/Actions/index.tsx +137 -0
  25. package/src/components/CodeBlock/Collapsible/Button/index.tsx +58 -0
  26. package/src/components/CodeBlock/Collapsible/Fade/index.tsx +55 -0
  27. package/src/components/CodeBlock/Collapsible/Lines/index.tsx +22 -0
  28. package/src/components/CodeBlock/Header/Wrapper/index.tsx +46 -0
  29. package/src/components/CodeBlock/Header/index.tsx +67 -0
  30. package/src/components/CodeBlock/Inline/index.tsx +20 -0
  31. package/src/components/CodeBlock/Line/index.tsx +331 -0
  32. package/src/components/CodeBlock/index.tsx +510 -0
  33. package/src/components/CodeMdx/index.tsx +45 -0
  34. package/src/components/CodeTabs/Item/index.tsx +67 -0
  35. package/src/components/CodeTabs/index.tsx +319 -0
  36. package/src/components/ContentMenu/Actions/index.tsx +7 -0
  37. package/src/components/ContentMenu/Products/index.tsx +64 -0
  38. package/src/components/ContentMenu/Toc/index.tsx +148 -0
  39. package/src/components/ContentMenu/Version/index.tsx +77 -0
  40. package/src/components/ContentMenu/index.tsx +31 -0
  41. package/src/components/CopyButton/index.tsx +76 -0
  42. package/src/components/Details/Summary/index.tsx +75 -0
  43. package/src/components/Details/index.tsx +98 -0
  44. package/src/components/DetailsList/index.tsx +32 -0
  45. package/src/components/DottedSeparator/index.tsx +30 -0
  46. package/src/components/EditButton/index.tsx +32 -0
  47. package/src/components/EditDate/index.tsx +33 -0
  48. package/src/components/ErrorPage/Icon/index.tsx +428 -0
  49. package/src/components/ErrorPage/index.tsx +32 -0
  50. package/src/components/Feedback/Solutions/index.tsx +105 -0
  51. package/src/components/Feedback/index.tsx +304 -0
  52. package/src/components/Footer/index.tsx +23 -0
  53. package/src/components/Heading/H1/index.tsx +21 -0
  54. package/src/components/Heading/H2/index.tsx +47 -0
  55. package/src/components/Heading/H3/index.tsx +42 -0
  56. package/src/components/Heading/H4/index.tsx +14 -0
  57. package/src/components/Heading/index.tsx +4 -0
  58. package/src/components/IconHeadline/index.tsx +15 -0
  59. package/src/components/Icons/AiAssistant/index.tsx +462 -0
  60. package/src/components/Icons/ArrowRightDown/index.tsx +30 -0
  61. package/src/components/Icons/BundledProduct/index.tsx +72 -0
  62. package/src/components/Icons/CalendarRefresh/index.tsx +70 -0
  63. package/src/components/Icons/ChefHat/index.tsx +65 -0
  64. package/src/components/Icons/CircleDottedLine/index.tsx +60 -0
  65. package/src/components/Icons/CloudSolid/index.tsx +47 -0
  66. package/src/components/Icons/ColoredAcmeKit/index.tsx +13 -0
  67. package/src/components/Icons/DecisionProcess/index.tsx +58 -0
  68. package/src/components/Icons/Erp/index.tsx +92 -0
  69. package/src/components/Icons/Github/index.tsx +22 -0
  70. package/src/components/Icons/House/index.tsx +23 -0
  71. package/src/components/Icons/ImageBinary/index.tsx +69 -0
  72. package/src/components/Icons/Kapa/index.tsx +22 -0
  73. package/src/components/Icons/Markdown/index.tsx +25 -0
  74. package/src/components/Icons/NavigationDropdown/Admin/index.tsx +33 -0
  75. package/src/components/Icons/NavigationDropdown/Doc/index.tsx +41 -0
  76. package/src/components/Icons/NavigationDropdown/DocV1/index.tsx +37 -0
  77. package/src/components/Icons/NavigationDropdown/Modules/index.tsx +33 -0
  78. package/src/components/Icons/NavigationDropdown/Resources/index.tsx +37 -0
  79. package/src/components/Icons/NavigationDropdown/Store/index.tsx +37 -0
  80. package/src/components/Icons/NavigationDropdown/Ui/index.tsx +37 -0
  81. package/src/components/Icons/NavigationDropdown/User/index.tsx +37 -0
  82. package/src/components/Icons/PuzzleColored/index.tsx +35 -0
  83. package/src/components/Icons/QuestionMark/index.tsx +23 -0
  84. package/src/components/Icons/Restock/index.tsx +55 -0
  85. package/src/components/Icons/ScrollText/index.tsx +68 -0
  86. package/src/components/Icons/ShadedBg/index.tsx +334 -0
  87. package/src/components/Icons/Shop/index.tsx +68 -0
  88. package/src/components/Icons/SidebarLeft/index.tsx +42 -0
  89. package/src/components/Icons/StripeColored/index.tsx +60 -0
  90. package/src/components/Icons/ThumbDown/index.tsx +23 -0
  91. package/src/components/Icons/ThumbUp/index.tsx +23 -0
  92. package/src/components/Icons/WindowPaintbrush/index.tsx +57 -0
  93. package/src/components/Icons/index.tsx +20 -0
  94. package/src/components/InlineCode/index.tsx +42 -0
  95. package/src/components/InlineIcon/index.tsx +21 -0
  96. package/src/components/InlineThemeImage/index.tsx +14 -0
  97. package/src/components/Input/Search/index.tsx +64 -0
  98. package/src/components/Input/Text/index.tsx +39 -0
  99. package/src/components/Kbd/index.tsx +33 -0
  100. package/src/components/Label/index.tsx +19 -0
  101. package/src/components/Link/index.tsx +67 -0
  102. package/src/components/LinkButton/index.tsx +43 -0
  103. package/src/components/Loading/Dots/index.tsx +16 -0
  104. package/src/components/Loading/Spinner/index.tsx +19 -0
  105. package/src/components/Loading/index.tsx +43 -0
  106. package/src/components/MDXComponents/index.tsx +209 -0
  107. package/src/components/MainNav/DesktopMenu/ThemeMenu/index.tsx +76 -0
  108. package/src/components/MainNav/DesktopMenu/index.tsx +100 -0
  109. package/src/components/MainNav/Items/Dropdown/index.tsx +88 -0
  110. package/src/components/MainNav/Items/Link/index.tsx +34 -0
  111. package/src/components/MainNav/Items/index.tsx +61 -0
  112. package/src/components/MainNav/MobileMenu/Main/index.tsx +67 -0
  113. package/src/components/MainNav/MobileMenu/SubMenu/index.tsx +77 -0
  114. package/src/components/MainNav/MobileMenu/index.tsx +103 -0
  115. package/src/components/MainNav/Version/index.tsx +33 -0
  116. package/src/components/MainNav/index.tsx +153 -0
  117. package/src/components/MarkdownContent/index.tsx +41 -0
  118. package/src/components/Menu/Action/index.tsx +43 -0
  119. package/src/components/Menu/Divider/index.tsx +35 -0
  120. package/src/components/Menu/Dropdown/index.tsx +78 -0
  121. package/src/components/Menu/Item/index.tsx +36 -0
  122. package/src/components/Menu/SubMenu/index.tsx +47 -0
  123. package/src/components/Menu/index.tsx +44 -0
  124. package/src/components/Modal/Footer/index.tsx +29 -0
  125. package/src/components/Modal/Header/index.tsx +33 -0
  126. package/src/components/Modal/index.tsx +124 -0
  127. package/src/components/Note/Layout/index.tsx +139 -0
  128. package/src/components/Note/Types/checks.tsx +7 -0
  129. package/src/components/Note/Types/default.tsx +7 -0
  130. package/src/components/Note/Types/error.tsx +7 -0
  131. package/src/components/Note/Types/soon.tsx +7 -0
  132. package/src/components/Note/Types/sucess.tsx +7 -0
  133. package/src/components/Note/Types/warning.tsx +7 -0
  134. package/src/components/Note/index.tsx +32 -0
  135. package/src/components/Notices/DeprecatedNotice/index.tsx +33 -0
  136. package/src/components/Notices/ExpandableNotice/index.tsx +36 -0
  137. package/src/components/Notices/FeatureFlagNotice/index.tsx +36 -0
  138. package/src/components/Notices/VersionNotice/index.tsx +37 -0
  139. package/src/components/Notification/Item/Layout/Default/index.tsx +89 -0
  140. package/src/components/Notification/Item/index.tsx +88 -0
  141. package/src/components/Notification/index.tsx +65 -0
  142. package/src/components/Pagination/Card/index.tsx +80 -0
  143. package/src/components/Pagination/index.tsx +35 -0
  144. package/src/components/Prerequisites/Item/index.tsx +43 -0
  145. package/src/components/Prerequisites/index.tsx +94 -0
  146. package/src/components/RadioItem/index.tsx +38 -0
  147. package/src/components/Rating/index.tsx +133 -0
  148. package/src/components/RootProviders/index.tsx +31 -0
  149. package/src/components/Select/Badge/index.tsx +122 -0
  150. package/src/components/Select/Dropdown/index.tsx +188 -0
  151. package/src/components/Select/Input/index.tsx +123 -0
  152. package/src/components/Select/index.ts +13 -0
  153. package/src/components/Sidebar/Child/index.tsx +43 -0
  154. package/src/components/Sidebar/Item/Category/index.tsx +151 -0
  155. package/src/components/Sidebar/Item/Link/index.tsx +174 -0
  156. package/src/components/Sidebar/Item/Sidebar/index.tsx +67 -0
  157. package/src/components/Sidebar/Item/SubCategory/index.tsx +83 -0
  158. package/src/components/Sidebar/Item/index.tsx +41 -0
  159. package/src/components/Sidebar/Top/MobileClose/index.tsx +21 -0
  160. package/src/components/Sidebar/Top/index.tsx +33 -0
  161. package/src/components/Sidebar/index.tsx +153 -0
  162. package/src/components/SourceCodeLink/index.tsx +37 -0
  163. package/src/components/SplitLists/index.tsx +58 -0
  164. package/src/components/Table/index.tsx +87 -0
  165. package/src/components/Tabs/index.tsx +106 -0
  166. package/src/components/TextArea/index.tsx +30 -0
  167. package/src/components/ThemeImage/index.tsx +26 -0
  168. package/src/components/Toggle/index.tsx +28 -0
  169. package/src/components/Tooltip/index.tsx +65 -0
  170. package/src/components/TypeList/Items/index.tsx +337 -0
  171. package/src/components/TypeList/index.tsx +63 -0
  172. package/src/components/WideSection/index.tsx +25 -0
  173. package/src/components/ZoomImg/index.tsx +17 -0
  174. package/src/components/index.ts +75 -0
  175. package/src/constants.tsx +261 -0
  176. package/src/global-config.ts +11 -0
  177. package/src/hooks/index.ts +14 -0
  178. package/src/hooks/use-active-on-scroll/index.tsx +223 -0
  179. package/src/hooks/use-click-outside/index.tsx +37 -0
  180. package/src/hooks/use-collapsible/index.tsx +128 -0
  181. package/src/hooks/use-collapsible-code-lines/index.tsx +149 -0
  182. package/src/hooks/use-copy/index.tsx +28 -0
  183. package/src/hooks/use-heading-url/index.tsx +32 -0
  184. package/src/hooks/use-is-external-link/index.tsx +19 -0
  185. package/src/hooks/use-keyboard-shortcut/index.tsx +71 -0
  186. package/src/hooks/use-mutation-observer/index.ts +32 -0
  187. package/src/hooks/use-page-scroll-manager/index.tsx +82 -0
  188. package/src/hooks/use-resize-observer/index.ts +20 -0
  189. package/src/hooks/use-scroll-utils/index.tsx +372 -0
  190. package/src/hooks/use-select/index.tsx +99 -0
  191. package/src/hooks/use-tabs/index.tsx +94 -0
  192. package/src/index.ts +8 -0
  193. package/src/layouts/barebone.tsx +18 -0
  194. package/src/layouts/index.ts +4 -0
  195. package/src/layouts/main-content.tsx +86 -0
  196. package/src/layouts/root.tsx +43 -0
  197. package/src/layouts/tight.tsx +29 -0
  198. package/src/layouts/wide.tsx +25 -0
  199. package/src/providers/AiAssistant/index.tsx +65 -0
  200. package/src/providers/BrowserProvider/index.tsx +40 -0
  201. package/src/providers/ColorMode/index.tsx +73 -0
  202. package/src/providers/Layout/index.tsx +52 -0
  203. package/src/providers/MainNav/index.tsx +134 -0
  204. package/src/providers/Mobile/index.tsx +62 -0
  205. package/src/providers/Modal/index.tsx +52 -0
  206. package/src/providers/Notification/index.tsx +149 -0
  207. package/src/providers/Pagination/index.tsx +230 -0
  208. package/src/providers/Search/index.tsx +91 -0
  209. package/src/providers/Sidebar/index.tsx +745 -0
  210. package/src/providers/SiteConfig/index.tsx +70 -0
  211. package/src/providers/index.ts +13 -0
  212. package/src/types/config.ts +34 -0
  213. package/src/types/frontmatter.ts +23 -0
  214. package/src/types/general.ts +1 -0
  215. package/src/types/index.ts +9 -0
  216. package/src/types/menu.ts +40 -0
  217. package/src/types/navigation-dropdown.ts +16 -0
  218. package/src/types/navigation.ts +21 -0
  219. package/src/types/sidebar.ts +109 -0
  220. package/src/types/toc.ts +19 -0
  221. package/src/types/ui.ts +9 -0
  222. package/src/utils/array-same-elms.ts +10 -0
  223. package/src/utils/capitalize.ts +3 -0
  224. package/src/utils/check-sidebar-item-visibility.ts +47 -0
  225. package/src/utils/decode-str.ts +8 -0
  226. package/src/utils/dom-utils.ts +29 -0
  227. package/src/utils/event-parser.ts +54 -0
  228. package/src/utils/get-link-with-base-path.ts +3 -0
  229. package/src/utils/get-navbar-items.ts +55 -0
  230. package/src/utils/get-scrolled-top.ts +8 -0
  231. package/src/utils/index.ts +13 -0
  232. package/src/utils/is-elm-window.ts +3 -0
  233. package/src/utils/is-in-view.ts +10 -0
  234. package/src/utils/os-browser-utils.ts +39 -0
  235. package/src/utils/set-obj-value.ts +38 -0
  236. package/src/utils/sidebar-utils.ts +129 -0
@@ -0,0 +1,209 @@
1
+ import React from "react"
2
+ import type { MDXComponents as MDXComponentsType } from "mdx/types"
3
+ import { CodeMdx } from "../../components/CodeMdx"
4
+ import { Kbd } from "../../components/Kbd"
5
+ import { Note } from "../../components/Note"
6
+ import { Card } from "../../components/Card"
7
+ import { CardList } from "../../components/CardList"
8
+ import { ZoomImg } from "../../components/ZoomImg"
9
+ import { H1 } from "../../components/Heading/H1"
10
+ import { H2 } from "../../components/Heading/H2"
11
+ import { H3 } from "../../components/Heading/H3"
12
+ import { H4 } from "../../components/Heading/H4"
13
+ import { Link } from "../../components/Link"
14
+ import { Table } from "../../components/Table"
15
+ import clsx from "clsx"
16
+ import { Text } from "@acmekit/ui"
17
+ import { PlusMini } from "@acmekit/icons"
18
+
19
+ export const MDXComponents: MDXComponentsType = {
20
+ table: Table,
21
+ thead: Table.Header,
22
+ tbody: Table.Body,
23
+ tr: Table.Row,
24
+ th: Table.HeaderCell,
25
+ td: Table.Cell,
26
+ code: CodeMdx,
27
+ kbd: Kbd,
28
+ Kbd,
29
+ Note,
30
+ details: ({
31
+ children,
32
+ className,
33
+ ...props
34
+ }: React.HTMLAttributes<HTMLDetailsElement>) => {
35
+ return (
36
+ <details
37
+ {...props}
38
+ className={clsx(
39
+ "border-acmekit-border-base border-y border-solid border-x-0",
40
+ "overflow-hidden [&>summary]:relative",
41
+ "[&[open]>summary>.docs-expand-icon]:rotate-45",
42
+ "my-docs_1",
43
+ className
44
+ )}
45
+ >
46
+ {children}
47
+ </details>
48
+ )
49
+ },
50
+ Details: ({
51
+ children,
52
+ className,
53
+ ...props
54
+ }: React.HTMLAttributes<HTMLDetailsElement>) => {
55
+ return (
56
+ <details
57
+ {...(props as React.HTMLAttributes<HTMLDetailsElement>)}
58
+ className={clsx(
59
+ "border-acmekit-border-base border-y border-solid border-x-0",
60
+ "overflow-hidden [&>summary]:relative",
61
+ "[&[open]>summary>.docs-expand-icon]:rotate-45",
62
+ "my-docs_1",
63
+ className
64
+ )}
65
+ >
66
+ {children}
67
+ </details>
68
+ )
69
+ },
70
+ summary: ({
71
+ children,
72
+ className,
73
+ ...props
74
+ }: React.HTMLAttributes<HTMLElement>) => {
75
+ return (
76
+ <summary
77
+ className={clsx(
78
+ "py-docs_0.75 flex items-center justify-between",
79
+ "cursor-pointer no-marker",
80
+ "text-compact-medium-plus text-acmekit-fg-base",
81
+ className
82
+ )}
83
+ {...props}
84
+ >
85
+ <span>{children}</span>
86
+ <PlusMini className="docs-expand-icon transition-transform text-acmekit-fg-muted" />
87
+ </summary>
88
+ )
89
+ },
90
+ Summary: ({
91
+ children,
92
+ className,
93
+ ...props
94
+ }: React.HTMLAttributes<HTMLElement>) => {
95
+ return (
96
+ <summary
97
+ className={clsx(
98
+ "py-docs_0.75 flex items-center justify-between",
99
+ "cursor-pointer no-marker",
100
+ "text-compact-medium-plus text-acmekit-fg-base",
101
+ className
102
+ )}
103
+ {...props}
104
+ >
105
+ <span>{children}</span>
106
+ <PlusMini className="docs-expand-icon transition-transform text-acmekit-fg-muted" />
107
+ </summary>
108
+ )
109
+ },
110
+ Card,
111
+ CardList: ({ className, ...props }: React.ComponentProps<typeof CardList>) => {
112
+ return <CardList {...props} className={clsx("mt-docs_1", className)} />
113
+ },
114
+ h1: H1,
115
+ h2: H2,
116
+ h3: H3,
117
+ h4: H4,
118
+ p: ({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) => {
119
+ return (
120
+ <p
121
+ className={clsx(
122
+ "text-acmekit-fg-base [&:not(:last-child)]:mb-docs_1.5 last:!mb-0",
123
+ className
124
+ )}
125
+ {...props}
126
+ />
127
+ )
128
+ },
129
+ ul: ({
130
+ className,
131
+ children,
132
+ ...props
133
+ }: React.HTMLAttributes<HTMLUListElement>) => {
134
+ return (
135
+ <ul
136
+ {...props}
137
+ className={clsx(
138
+ "list-disc px-docs_1 mb-docs_1.5 [&_ul]:mb-0 [&_ol]:mb-0 [&_p]:!mb-0",
139
+ className
140
+ )}
141
+ >
142
+ {children}
143
+ </ul>
144
+ )
145
+ },
146
+ ol: ({
147
+ className,
148
+ children,
149
+ ...props
150
+ }: React.HTMLAttributes<HTMLOListElement>) => {
151
+ return (
152
+ <ol
153
+ {...props}
154
+ className={clsx(
155
+ "list-decimal px-docs_1 mb-docs_1.5 [&_ul]:mb-0 [&_ol]:mb-0 [&_p]:!mb-0",
156
+ className
157
+ )}
158
+ >
159
+ {children}
160
+ </ol>
161
+ )
162
+ },
163
+ li: ({
164
+ className,
165
+ children,
166
+ ...props
167
+ }: React.HTMLAttributes<HTMLElement>) => {
168
+ return (
169
+ <li
170
+ className={clsx(
171
+ "text-acmekit-fg-base [&:not(:last-child)]:mb-docs_0.5",
172
+ "[&_ol]:mt-docs_0.5 [&_ul]:mt-docs_0.5",
173
+ className
174
+ )}
175
+ {...props}
176
+ >
177
+ <Text as="span">{children}</Text>
178
+ </li>
179
+ )
180
+ },
181
+ hr: ({ className, ...props }: React.HTMLAttributes<HTMLHRElement>) => {
182
+ return (
183
+ <hr
184
+ className={clsx(
185
+ "my-docs_2 h-[1px] w-full border-0 bg-acmekit-border-base",
186
+ className
187
+ )}
188
+ {...props}
189
+ />
190
+ )
191
+ },
192
+ img: (
193
+ props: React.DetailedHTMLProps<
194
+ React.ImgHTMLAttributes<HTMLImageElement>,
195
+ HTMLImageElement
196
+ >
197
+ ) => {
198
+ // omit key to resolve errors
199
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
200
+ const { key, ...rest } = props
201
+ return <ZoomImg {...rest} />
202
+ },
203
+ a: (props) => <Link {...props} variant="content" />,
204
+ strong: ({ className, ...props }: React.HTMLAttributes<HTMLElement>) => {
205
+ return <strong className={clsx("txt-medium-plus", className)} {...props} />
206
+ },
207
+ }
208
+
209
+ export const Hr = MDXComponents["hr"] as () => React.JSX.Element
@@ -0,0 +1,76 @@
1
+
2
+ import React from "react"
3
+ import { useColorMode } from "../../../../providers/ColorMode"
4
+ import clsx from "clsx"
5
+ import { EllipseMiniSolid } from "@acmekit/icons"
6
+
7
+ export const MainNavThemeMenu = () => {
8
+ const { colorMode, setColorMode } = useColorMode()
9
+
10
+ return (
11
+ <>
12
+ <div
13
+ className={clsx(
14
+ "flex items-center gap-docs_0.5",
15
+ "py-docs_0.25 px-docs_0.5",
16
+ "rounded-docs_xs text-compact-x-small-plus",
17
+ "text-acmekit-fg-subtle"
18
+ )}
19
+ >
20
+ Theme
21
+ </div>
22
+ <div className="px-docs_0.25">
23
+ <div
24
+ className={clsx(
25
+ "flex items-center gap-docs_0.5",
26
+ "py-docs_0.25 px-docs_0.5 cursor-pointer",
27
+ "rounded-docs_xs text-acmekit-fg-base",
28
+ "hover:bg-acmekit-bg-component-hover"
29
+ )}
30
+ tabIndex={-1}
31
+ onClick={() => setColorMode("light")}
32
+ data-testid="light-option"
33
+ >
34
+ <EllipseMiniSolid
35
+ className={clsx(colorMode !== "light" && "invisible")}
36
+ data-testid="ellipse-icon"
37
+ />
38
+ <span
39
+ className={clsx(
40
+ colorMode !== "light" && "text-compact-small",
41
+ colorMode === "light" && "text-compact-small-plus"
42
+ )}
43
+ >
44
+ Light
45
+ </span>
46
+ </div>
47
+ </div>
48
+ <div className="px-docs_0.25">
49
+ <div
50
+ className={clsx(
51
+ "flex items-center gap-docs_0.5",
52
+ "py-docs_0.25 px-docs_0.5 cursor-pointer",
53
+ "rounded-docs_xs text-acmekit-fg-base",
54
+ "hover:bg-acmekit-bg-component-hover"
55
+ )}
56
+ tabIndex={-1}
57
+ onClick={() => setColorMode("dark")}
58
+ data-testid="dark-option"
59
+ >
60
+ <EllipseMiniSolid
61
+ className={clsx(colorMode !== "dark" && "invisible")}
62
+ data-testid="ellipse-icon"
63
+ />
64
+ <span
65
+ className={clsx(
66
+ colorMode !== "dark" && "text-compact-small",
67
+ colorMode === "dark" && "text-compact-small-plus"
68
+ )}
69
+ >
70
+ Dark
71
+ </span>
72
+ </div>
73
+ </div>
74
+ </>
75
+ )
76
+ }
@@ -0,0 +1,100 @@
1
+
2
+ import { BarsThree, Book, SidebarLeft, TimelineVertical } from "@acmekit/icons"
3
+ import React, { useMemo, useRef, useState } from "react"
4
+ import { Button } from "../../../components/Button"
5
+ import { Menu } from "../../../components/Menu"
6
+ import { useSidebar } from "../../../providers/Sidebar"
7
+ import { useClickOutside } from "../../../hooks/use-click-outside"
8
+ import { getOsShortcut } from "../../../utils/os-browser-utils"
9
+ import clsx from "clsx"
10
+ import { HouseIcon } from "../../Icons/House"
11
+ import { MainNavThemeMenu } from "./ThemeMenu"
12
+ import { MenuItem } from "../../../types"
13
+
14
+ export const MainNavDesktopMenu = () => {
15
+ const [isOpen, setIsOpen] = useState(false)
16
+ const { setDesktopSidebarOpen, isSidebarShown, desktopSidebarOpen } =
17
+ useSidebar()
18
+ const ref = useRef<HTMLDivElement>(null)
19
+
20
+ useClickOutside({
21
+ elmRef: ref,
22
+ onClickOutside: () => setIsOpen(false),
23
+ })
24
+
25
+ const items: MenuItem[] = useMemo(() => {
26
+ const items: MenuItem[] = [
27
+ {
28
+ type: "link",
29
+ icon: <HouseIcon />,
30
+ title: "Homepage",
31
+ link: "https://acmekit.com",
32
+ },
33
+ {
34
+ type: "link",
35
+ icon: <Book />,
36
+ title: "AcmeKit v1",
37
+ link: "https://docs.acmekit.com/v1",
38
+ },
39
+ {
40
+ type: "link",
41
+ icon: <TimelineVertical />,
42
+ title: "Changelog",
43
+ link: "https://acmekit.com/changelog",
44
+ },
45
+ ]
46
+
47
+ if (isSidebarShown) {
48
+ items.push(
49
+ {
50
+ type: "divider",
51
+ },
52
+ {
53
+ type: "action",
54
+ title: desktopSidebarOpen ? "Hide Sidebar" : "Show Sidebar",
55
+ icon: <SidebarLeft />,
56
+ shortcut: `${getOsShortcut()}\\`,
57
+ action: () => {
58
+ setDesktopSidebarOpen((prev) => !prev)
59
+ setIsOpen(false)
60
+ },
61
+ }
62
+ )
63
+ }
64
+
65
+ items.push(
66
+ {
67
+ type: "divider",
68
+ },
69
+ {
70
+ type: "custom",
71
+ content: <MainNavThemeMenu />,
72
+ }
73
+ )
74
+
75
+ return items
76
+ }, [isSidebarShown, desktopSidebarOpen])
77
+
78
+ return (
79
+ <div
80
+ className="relative hidden lg:flex justify-center items-center"
81
+ ref={ref}
82
+ >
83
+ <Button
84
+ variant="transparent"
85
+ onClick={() => setIsOpen((prev) => !prev)}
86
+ className="!p-[6.5px]"
87
+ data-testid="menu-button"
88
+ >
89
+ <BarsThree className="text-acmekit-fg-subtle" />
90
+ </Button>
91
+ <Menu
92
+ className={clsx(
93
+ "absolute top-[calc(100%+8px)] right-0 min-w-[200px]",
94
+ !isOpen && "hidden"
95
+ )}
96
+ items={items}
97
+ />
98
+ </div>
99
+ )
100
+ }
@@ -0,0 +1,88 @@
1
+
2
+ import { TriangleDownMini } from "@acmekit/icons"
3
+ import clsx from "clsx"
4
+ import React, { useRef, useState } from "react"
5
+ import { NavigationItemDropdown } from "../../../../types"
6
+ import { Menu } from "../../../Menu"
7
+ import { MainNavItemLink } from "../Link"
8
+
9
+ type MainNavItemDropdownProps = {
10
+ item: NavigationItemDropdown
11
+ isActive: boolean
12
+ className?: string
13
+ wrapperClassName?: string
14
+ }
15
+
16
+ export const MainNavItemDropdown = ({
17
+ item,
18
+ isActive,
19
+ className,
20
+ wrapperClassName,
21
+ }: MainNavItemDropdownProps) => {
22
+ const [isOpen, setIsOpen] = useState(false)
23
+ const ref = useRef<HTMLDivElement>(null)
24
+
25
+ const getItemContent = () => {
26
+ if (item.link) {
27
+ return (
28
+ <MainNavItemLink
29
+ item={{
30
+ ...item,
31
+ link: item.link!,
32
+ type: "link",
33
+ }}
34
+ isActive={isActive}
35
+ icon={
36
+ <TriangleDownMini
37
+ className={clsx("transition-transform", isOpen && "rotate-180")}
38
+ />
39
+ }
40
+ className="!flex"
41
+ />
42
+ )
43
+ }
44
+
45
+ return (
46
+ <div
47
+ className={clsx(
48
+ "cursor-pointer flex gap-docs_0.25 items-center py-docs_0.25",
49
+ isActive && "text-acmekit-fg-base",
50
+ !isActive && [
51
+ "text-acmekit-fg-muted hover:text-acmekit-fg-subtle",
52
+ isOpen && "text-acmekit-fg-subtle",
53
+ ],
54
+ className
55
+ )}
56
+ tabIndex={-1}
57
+ data-testid="dropdown-title-wrapper"
58
+ >
59
+ <span className="text-compact-small-plus" data-testid="dropdown-title">
60
+ {item.title}
61
+ </span>
62
+ <TriangleDownMini
63
+ className={clsx("transition-transform", isOpen && "rotate-180")}
64
+ data-testid="triangle-icon"
65
+ />
66
+ </div>
67
+ )
68
+ }
69
+
70
+ return (
71
+ <div
72
+ className={clsx("relative", wrapperClassName)}
73
+ ref={ref}
74
+ onMouseOver={() => setIsOpen(true)}
75
+ onMouseLeave={() => setIsOpen(false)}
76
+ data-testid="dropdown-wrapper"
77
+ >
78
+ {getItemContent()}
79
+ <div className="absolute top-full -left-docs_0.75 pt-docs_0.25">
80
+ <Menu
81
+ className={clsx("min-w-[190px]", !isOpen && "hidden")}
82
+ items={item.children}
83
+ itemsOnClick={() => setIsOpen(false)}
84
+ />
85
+ </div>
86
+ </div>
87
+ )
88
+ }
@@ -0,0 +1,34 @@
1
+
2
+ import React from "react"
3
+ import { NavigationItemLink } from "../../../../types"
4
+ import { LinkButton } from "../../../LinkButton"
5
+ import clsx from "clsx"
6
+
7
+ type MainNavItemLinkProps = {
8
+ item: NavigationItemLink
9
+ isActive: boolean
10
+ icon?: React.ReactNode
11
+ className?: string
12
+ }
13
+
14
+ export const MainNavItemLink = ({
15
+ item,
16
+ isActive,
17
+ icon,
18
+ className,
19
+ }: MainNavItemLinkProps) => {
20
+ return (
21
+ <LinkButton
22
+ to={item.link}
23
+ className={clsx(
24
+ "!shadow-none focus:!shadow-none outline-none",
25
+ isActive && "!text-acmekit-fg-base",
26
+ !isActive && "!text-acmekit-fg-muted hover:!text-acmekit-fg-subtle",
27
+ className
28
+ )}
29
+ >
30
+ {item.title}
31
+ {icon}
32
+ </LinkButton>
33
+ )
34
+ }
@@ -0,0 +1,61 @@
1
+
2
+ import React from "react"
3
+ import { useLocation } from "react-router-dom"
4
+ import { useMainNav } from "../../../providers/MainNav"
5
+ import clsx from "clsx"
6
+ import { MainNavItemLink } from "./Link"
7
+ import { MainNavItemDropdown } from "./Dropdown"
8
+
9
+ type MainNavItemsProps = {
10
+ className?: string
11
+ }
12
+
13
+ export const MainNavItems = ({ className }: MainNavItemsProps) => {
14
+ const { navItems, activeItemIndex } = useMainNav()
15
+ const { pathname } = useLocation()
16
+
17
+ return (
18
+ <ul
19
+ className={clsx(
20
+ "hidden lg:flex justify-start gap-docs_0.25 items-center",
21
+ "my-docs_0.75",
22
+ className
23
+ )}
24
+ >
25
+ {navItems.map((item, index) => {
26
+ const isActive =
27
+ item.type === "link"
28
+ ? pathname.startsWith(item.link)
29
+ : index === activeItemIndex
30
+
31
+ return (
32
+ <li
33
+ className={clsx(
34
+ "relative flex items-center",
35
+ "after:absolute after:bottom-[-13px] after:left-0 after:right-0",
36
+ "after:h-[2px] after:rounded-full after:transition-colors",
37
+ isActive
38
+ ? "after:bg-acmekit-fg-base"
39
+ : "after:bg-transparent"
40
+ )}
41
+ key={index}
42
+ >
43
+ {item.type === "link" && (
44
+ <MainNavItemLink
45
+ item={item}
46
+ isActive={isActive}
47
+ className={clsx(
48
+ "px-docs_0.5 py-docs_0.25 rounded-docs_sm transition-colors",
49
+ !isActive && "hover:bg-acmekit-button-transparent-hover"
50
+ )}
51
+ />
52
+ )}
53
+ {item.type === "dropdown" && (
54
+ <MainNavItemDropdown item={item} isActive={isActive} />
55
+ )}
56
+ </li>
57
+ )
58
+ })}
59
+ </ul>
60
+ )
61
+ }
@@ -0,0 +1,67 @@
1
+
2
+ import React from "react"
3
+ import { useMainNav } from "../../../../providers/MainNav"
4
+ import { Link } from "react-router-dom"
5
+ import { TriangleRightMini } from "@acmekit/icons"
6
+ import clsx from "clsx"
7
+ import { SelectedMenu } from ".."
8
+
9
+ type MainNavMobileMainMenu = {
10
+ setSelectedMenus: React.Dispatch<React.SetStateAction<SelectedMenu>>
11
+ onOpenLink?: () => void
12
+ }
13
+
14
+ export const MainNavMobileMainMenu = ({
15
+ setSelectedMenus: setSelectedMenu,
16
+ onOpenLink,
17
+ }: MainNavMobileMainMenu) => {
18
+ const { navItems } = useMainNav()
19
+
20
+ return (
21
+ <div className="flex flex-col gap-[23px]">
22
+ <span className="text-compact-small-plus text-acmekit-fg-muted uppercase">
23
+ Menu
24
+ </span>
25
+ <ul className="flex flex-col gap-[18px]">
26
+ {navItems.map((item, index) => (
27
+ <li
28
+ key={index}
29
+ className={clsx(
30
+ "text-h1 text-acmekit-fg-base cursor-pointer",
31
+ "flex justify-between gap-docs_1"
32
+ )}
33
+ onClick={() => {
34
+ if (item.type !== "dropdown") {
35
+ return
36
+ }
37
+
38
+ setSelectedMenu((prev) => [
39
+ ...prev,
40
+ {
41
+ title: item.title,
42
+ menu: item.children,
43
+ },
44
+ ])
45
+ }}
46
+ >
47
+ {item.type === "link" && (
48
+ <Link
49
+ to={item.link}
50
+ className="block w-full"
51
+ onClick={() => onOpenLink?.()}
52
+ >
53
+ {item.title}
54
+ </Link>
55
+ )}
56
+ {item.type === "dropdown" && (
57
+ <>
58
+ <span>{item.title}</span>
59
+ <TriangleRightMini data-testid="triangle-icon" />
60
+ </>
61
+ )}
62
+ </li>
63
+ ))}
64
+ </ul>
65
+ </div>
66
+ )
67
+ }