@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,87 @@
1
+ import React from "react"
2
+ import { Table as UiTable } from "@acmekit/ui"
3
+ import clsx from "clsx"
4
+
5
+ type RootProps = React.HTMLAttributes<HTMLTableElement>
6
+
7
+ const Root = ({ className, ...props }: RootProps) => {
8
+ return (
9
+ <UiTable
10
+ className={clsx(
11
+ className,
12
+ "table-fixed mb-docs_1",
13
+ "[&_pre_span]:!max-w-full [&_pre_span]:!break-words [&_pre_span]:!whitespace-break-spaces",
14
+ "[&_pre>div]:mt-docs_1",
15
+ "shadow-elevation-card-rest dark:shadow-elevation-card-rest-dark",
16
+ "rounded-docs_DEFAULT"
17
+ )}
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+
23
+ type HeaderProps = React.HTMLAttributes<HTMLTableSectionElement>
24
+
25
+ const Header = ({ className, ...props }: HeaderProps) => {
26
+ return (
27
+ <UiTable.Header
28
+ className={clsx(
29
+ className,
30
+ "!border-0 bg-acmekit-bg-component [&_tr]:!bg-acmekit-bg-component",
31
+ "rounded-docs_DEFAULT [&_tr]:rounded-docs_DEFAULT"
32
+ )}
33
+ {...props}
34
+ />
35
+ )
36
+ }
37
+
38
+ type HeaderCellProps = React.HTMLAttributes<HTMLTableCellElement>
39
+
40
+ const HeaderCell = ({ className, ...props }: HeaderCellProps) => {
41
+ return (
42
+ <UiTable.HeaderCell
43
+ className={clsx(
44
+ className,
45
+ "text-left !px-docs_0.75 py-docs_0.5 break-words",
46
+ "!text-compact-small-plus text-acmekit-fg-subtle",
47
+ "first:rounded-tl-docs_DEFAULT last:rounded-tr-docs_DEFAULT"
48
+ )}
49
+ {...props}
50
+ />
51
+ )
52
+ }
53
+
54
+ type CellProps = React.HTMLAttributes<HTMLTableCellElement>
55
+
56
+ const Cell = ({ className, ...props }: CellProps) => {
57
+ return (
58
+ <UiTable.Cell
59
+ className={clsx(
60
+ className,
61
+ "!px-docs_0.75 py-docs_0.5 break-words align-top"
62
+ )}
63
+ {...props}
64
+ />
65
+ )
66
+ }
67
+
68
+ type BodyProps = React.HTMLAttributes<HTMLTableSectionElement>
69
+
70
+ const Body = ({ className, ...props }: BodyProps) => {
71
+ return (
72
+ <UiTable.Body
73
+ className={clsx(className, "[&_tr:last-child]:border-b-0 border-b-0")}
74
+ {...props}
75
+ />
76
+ )
77
+ }
78
+
79
+ const Table = Object.assign(Root, {
80
+ Row: UiTable.Row,
81
+ Cell,
82
+ Header,
83
+ HeaderCell,
84
+ Body,
85
+ })
86
+
87
+ export { Table }
@@ -0,0 +1,106 @@
1
+
2
+ import React, { useMemo } from "react"
3
+ import { Tabs as UiTabs } from "@acmekit/ui"
4
+ import { ComponentProps } from "react"
5
+ import clsx from "clsx"
6
+ import { EllipseMiniSolid } from "@acmekit/icons"
7
+ import { useMobile } from "../../providers/Mobile"
8
+
9
+ type TabsProps = ComponentProps<typeof UiTabs> & {
10
+ layoutType?: "horizontal" | "vertical"
11
+ }
12
+
13
+ export const Tabs = ({
14
+ layoutType = "horizontal",
15
+ className,
16
+ ...props
17
+ }: TabsProps) => {
18
+ const { isMobile } = useMobile()
19
+
20
+ const layout = useMemo(() => {
21
+ return isMobile ? "horizontal" : layoutType
22
+ }, [layoutType, isMobile])
23
+
24
+ return (
25
+ <UiTabs
26
+ {...props}
27
+ className={clsx(
28
+ className,
29
+ layout === "vertical" && [
30
+ "flex gap-docs_1",
31
+ "[&_[role=tablist]]:flex-col [&_[role=tablist]]:items-start",
32
+ "[&_[role=tablist]+*]:flex-1 [&_[role=tablist]+*]:!mt-0",
33
+ "[&_[role=tablist]+*]:w-3/4 [&_[role=tablist]]:w-1/4",
34
+ ]
35
+ )}
36
+ />
37
+ )
38
+ }
39
+
40
+ export const TabsList = ({
41
+ className,
42
+ ...props
43
+ }: ComponentProps<typeof UiTabs.List>) => (
44
+ <UiTabs.List {...props} className={clsx(className, "gap-docs_0.5")} />
45
+ )
46
+
47
+ export const TabsTrigger = ({
48
+ className,
49
+ ...props
50
+ }: ComponentProps<typeof UiTabs.Trigger>) => (
51
+ <UiTabs.Trigger
52
+ {...props}
53
+ className={clsx(
54
+ className,
55
+ "px-[10px] py-docs_0.25 data-[state=active]:text-ui-fg-base data-[state=active]:bg-ui-bg-base data-[state=active]:shadow-elevation-card-rest",
56
+ "hover:text-ui-fg-base focus-visible:border-ui-border-interactive focus-visible:!shadow-borders-focus focus-visible:bg-ui-bg-base"
57
+ )}
58
+ />
59
+ )
60
+
61
+ export const TabsTriggerVertical = ({
62
+ className,
63
+ children,
64
+ ...props
65
+ }: ComponentProps<typeof UiTabs.Trigger>) => {
66
+ const { isMobile } = useMobile()
67
+
68
+ if (isMobile) {
69
+ return (
70
+ <TabsTrigger className={className} {...props}>
71
+ {children}
72
+ </TabsTrigger>
73
+ )
74
+ }
75
+
76
+ return (
77
+ <UiTabs.Trigger
78
+ {...props}
79
+ className={clsx(
80
+ className,
81
+ "px-docs_0.5 py-docs_0.25 !text-acmekit-fg-base text-compact-small data-[state=active]:!text-compact-small-plus",
82
+ "[&[data-state=active]_svg]:!visible hover:!bg-acmekit-bg-base-hover rounded-docs_DEFAULT",
83
+ "!shadow-none"
84
+ )}
85
+ >
86
+ <EllipseMiniSolid className="invisible" />
87
+ {children}
88
+ </UiTabs.Trigger>
89
+ )
90
+ }
91
+
92
+ type TabsContentWrapperProps = {
93
+ className?: string
94
+ children: React.ReactNode
95
+ }
96
+
97
+ export const TabsContentWrapper = ({
98
+ className,
99
+ ...props
100
+ }: TabsContentWrapperProps) => (
101
+ <div {...props} className={clsx(className, "mt-docs_0.5")} />
102
+ )
103
+
104
+ export const TabsContent = (props: ComponentProps<typeof UiTabs.Content>) => (
105
+ <UiTabs.Content {...props} />
106
+ )
@@ -0,0 +1,30 @@
1
+ import React from "react"
2
+ import clsx from "clsx"
3
+
4
+ export type TextAreaProps = {
5
+ className?: string
6
+ } & React.DetailedHTMLProps<
7
+ React.TextareaHTMLAttributes<HTMLTextAreaElement>,
8
+ HTMLTextAreaElement
9
+ >
10
+
11
+ export const TextArea = (props: TextAreaProps) => {
12
+ return (
13
+ <textarea
14
+ {...props}
15
+ className={clsx(
16
+ "bg-acmekit-bg-field shadow-border-base dark:shadow-border-base-dark",
17
+ "rounded-docs_sm",
18
+ "py-[6px] px-docs_0.5 text-medium font-base",
19
+ "hover:bg-acmekit-bg-field-hover",
20
+ "focus:shadow-acmekit-border-interactive-with-focus",
21
+ "active:shadow-acmekit-border-interactive-with-focus",
22
+ "disabled:bg-acmekit-bg-disabled",
23
+ "disabled:border-acmekit-border-base disabled:border disabled:shadow-none",
24
+ "placeholder:text-acmekit-fg-muted",
25
+ "disabled:placeholder:text-acmekit-fg-disabled",
26
+ props.className
27
+ )}
28
+ />
29
+ )
30
+ }
@@ -0,0 +1,26 @@
1
+
2
+ import React from "react"
3
+ import { useColorMode } from "../../providers/ColorMode"
4
+
5
+ export type ThemeImageProps = {
6
+ light: string
7
+ dark?: string
8
+ alt?: string
9
+ } & React.AllHTMLAttributes<HTMLImageElement>
10
+
11
+ export const ThemeImage = ({
12
+ light,
13
+ dark,
14
+ alt = "",
15
+ ...props
16
+ }: ThemeImageProps) => {
17
+ const { colorMode } = useColorMode()
18
+
19
+ return (
20
+ <img
21
+ alt={alt}
22
+ src={colorMode === "light" ? light : dark || light}
23
+ {...props}
24
+ />
25
+ )
26
+ }
@@ -0,0 +1,28 @@
1
+ import { Switch } from "@acmekit/ui"
2
+ import clsx from "clsx"
3
+ import React from "react"
4
+
5
+ export const Toggle = ({
6
+ className,
7
+ ...props
8
+ }: React.ComponentProps<typeof Switch>) => {
9
+ return (
10
+ <Switch
11
+ {...props}
12
+ className={clsx(
13
+ className,
14
+ "bg-ui-bg-switch-off hover:bg-ui-bg-switch-off-hover data-[state=unchecked]:hover:after:bg-switch-off-hover-gradient",
15
+ "before:shadow-details-switch-background focus-visible:shadow-details-switch-background-focus data-[state=checked]:bg-ui-bg-interactive",
16
+ "disabled:!bg-ui-bg-disabled group relative inline-flex items-center rounded-full outline-none transition-all before:absolute",
17
+ "before:inset-0 before:rounded-full before:content-[''] after:absolute after:inset-0 after:rounded-full after:content-['']",
18
+ "disabled:cursor-not-allowed",
19
+
20
+ props.size !== "small" &&
21
+ "h-[18px] w-[32px] [&_span]:h-[14px] [&_span]:w-[14px]",
22
+ "[&_span]:bg-acmekit-fg-on-color [&_span]:shadow-details-switch-handle [&_span]:group-disabled:bg-ui-fg-disabled [&_span]:pointer-events-none",
23
+ "[&_span]:rounded-full [&_span]:group-disabled:shadow-none [&_span]:transition-transform",
24
+ "[&_span]:data-[state=checked]:translate-x-docs_1 [&_span]:data-[state=unchecked]:translate-x-docs_0.125"
25
+ )}
26
+ />
27
+ )
28
+ }
@@ -0,0 +1,65 @@
1
+
2
+ import React, { forwardRef, useId } from "react"
3
+ import { Tooltip as ReactTooltip } from "react-tooltip"
4
+ import type { ITooltip } from "react-tooltip"
5
+ import clsx from "clsx"
6
+ import "react-tooltip/dist/react-tooltip.css"
7
+
8
+ export type TooltipProps = {
9
+ text?: string
10
+ tooltipClassName?: string
11
+ html?: string
12
+ tooltipChildren?: React.ReactNode
13
+ innerClassName?: string
14
+ } & React.HTMLAttributes<HTMLSpanElement> &
15
+ ITooltip
16
+
17
+ export const Tooltip = forwardRef<HTMLSpanElement, TooltipProps>(
18
+ function Tooltip(
19
+ {
20
+ text = "",
21
+ tooltipClassName = "",
22
+ children,
23
+ html = "",
24
+ tooltipChildren,
25
+ className,
26
+ innerClassName,
27
+ ...tooltipProps
28
+ },
29
+ ref
30
+ ) {
31
+ const elementId = useId()
32
+
33
+ return (
34
+ <span className={clsx(className, "notranslate")} translate="no" ref={ref}>
35
+ <span
36
+ id={elementId}
37
+ data-tooltip-content={text}
38
+ data-tooltip-html={html}
39
+ data-tooltip-id={elementId}
40
+ className={innerClassName}
41
+ >
42
+ {children}
43
+ </span>
44
+ <ReactTooltip
45
+ anchorId={elementId}
46
+ // anchorSelect={elementId ? `#${elementId}` : undefined}
47
+ className={clsx(
48
+ "!text-compact-x-small !shadow-elevation-tooltip dark:!shadow-elevation-tooltip-dark !rounded-docs_DEFAULT",
49
+ "!py-docs_0.25 !z-[399] hidden !px-docs_0.5 lg:block",
50
+ "!bg-acmekit-bg-component",
51
+ "!text-acmekit-fg-base text-center",
52
+ tooltipClassName
53
+ )}
54
+ wrapper="span"
55
+ noArrow={true}
56
+ positionStrategy={"fixed"}
57
+ opacity={1}
58
+ {...tooltipProps}
59
+ >
60
+ {tooltipChildren}
61
+ </ReactTooltip>
62
+ </span>
63
+ )
64
+ }
65
+ )
@@ -0,0 +1,337 @@
1
+
2
+ import React, { useEffect, useMemo, useRef, useState } from "react"
3
+ import { Details } from "../../../components/Details"
4
+ import { CopyButton } from "../../../components/CopyButton"
5
+ import { DetailsSummary } from "../../../components/Details/Summary"
6
+ import { ExpandableNotice } from "../../../components/Notices/ExpandableNotice"
7
+ import { FeatureFlagNotice } from "../../../components/Notices/FeatureFlagNotice"
8
+ import { InlineCode } from "../../../components/InlineCode"
9
+ import { MarkdownContent } from "../../../components/MarkdownContent"
10
+ import { MDXComponents } from "../../../components/MDXComponents"
11
+ import clsx from "clsx"
12
+ import { Type, CommonProps as ParentCommonProps } from ".."
13
+ import {
14
+ ArrowDownLeftMini,
15
+ ArrowsPointingOutMini,
16
+ FlagMini,
17
+ Link,
18
+ TriangleRightMini,
19
+ } from "@acmekit/icons"
20
+ import { decodeStr } from "../../../utils/decode-str"
21
+ import { isInView } from "../../../utils/is-in-view"
22
+ import { useLocation } from "react-router-dom"
23
+ import { useSiteConfig } from "../../../providers/SiteConfig"
24
+ import { useIsBrowser } from "../../../providers/BrowserProvider"
25
+ import { VersionNotice } from "../../Notices/VersionNotice"
26
+ import { DeprecatedNotice } from "../../Notices/DeprecatedNotice"
27
+
28
+ type CommonProps = ParentCommonProps & {
29
+ level?: number
30
+ referenceType?: "method" | "workflow"
31
+ }
32
+
33
+ type TypeListItemProps = {
34
+ typeItem: Type
35
+ elementKey: number
36
+ } & CommonProps &
37
+ React.AllHTMLAttributes<HTMLDivElement>
38
+
39
+ const TypeListItem = ({
40
+ typeItem,
41
+ level = 1,
42
+ expandUrl,
43
+ elementKey,
44
+ sectionTitle,
45
+ referenceType = "method",
46
+ openedLevel = 0,
47
+ }: TypeListItemProps) => {
48
+ const { isBrowser } = useIsBrowser()
49
+ const { pathname } = useLocation()
50
+ const {
51
+ config: { baseUrl, basePath },
52
+ } = useSiteConfig()
53
+ const siteUrl = `${baseUrl}${basePath}`
54
+
55
+ const groupName = useMemo(() => {
56
+ switch (level) {
57
+ case 1:
58
+ return "group/typeOne"
59
+ case 2:
60
+ return "group/typeTwo"
61
+ case 3:
62
+ return "group/typeThree"
63
+ case 4:
64
+ return "group/typeFour"
65
+ }
66
+ }, [level])
67
+ const borderForGroupName = useMemo(() => {
68
+ switch (level) {
69
+ case 1:
70
+ return "group-open/typeOne:border-solid group-open/typeOne:border-0 group-open/typeOne:border-b"
71
+ case 2:
72
+ return "group-open/typeTwo:border-solid group-open/typeTwo:border-0 group-open/typeTwo:border-b"
73
+ case 3:
74
+ return "group-open/typeThree:border-solid group-open/typeThree:border-0 group-open/typeThree:border-b"
75
+ case 4:
76
+ return "group-open/typeFour:border-solid group-open/typeFour:border-0 group-open/typeFour:border-b"
77
+ }
78
+ }, [level])
79
+ const rotateForGroupName = useMemo(() => {
80
+ switch (level) {
81
+ case 1:
82
+ return "group-open/typeOne:rotate-90"
83
+ case 2:
84
+ return "group-open/typeTwo:rotate-90"
85
+ case 3:
86
+ return "group-open/typeThree:rotate-90"
87
+ case 4:
88
+ return "group-open/typeFour:rotate-90"
89
+ }
90
+ }, [level])
91
+ function getItemClassNames(details = true) {
92
+ return clsx(
93
+ "odd:[&:not(:first-child):not(:last-child)]:!border-y last:not(:first-child):!border-t",
94
+ "first:!border-t-0 first:not(:last-child):!border-b last:!border-b-0 even:!border-y-0",
95
+ details && groupName,
96
+ !details && borderForGroupName
97
+ )
98
+ }
99
+ const formatId = (str: string) => {
100
+ return str.replaceAll(" ", "_")
101
+ }
102
+ const typeId = useMemo(() => {
103
+ return sectionTitle
104
+ ? `#${formatId(sectionTitle)}-${formatId(
105
+ typeItem.name
106
+ )}-${level}-${elementKey}`
107
+ : ""
108
+ }, [sectionTitle, typeItem, elementKey])
109
+ const typePath = useMemo(() => `${pathname}${typeId}`, [pathname, typeId])
110
+ const typeUrl = useMemo(() => `${siteUrl}${typePath}`, [siteUrl, typePath])
111
+
112
+ const ref = useRef<HTMLDivElement>(null)
113
+ const [isSelected, setIsSelected] = useState(false)
114
+
115
+ useEffect(() => {
116
+ if (!typeId.length || !isBrowser) {
117
+ return
118
+ }
119
+
120
+ const shouldScroll = window.location.hash === typeId
121
+
122
+ if (shouldScroll && !isSelected && ref.current && !isInView(ref.current)) {
123
+ ref.current.scrollIntoView({
124
+ block: "center",
125
+ })
126
+ }
127
+
128
+ setIsSelected(shouldScroll)
129
+ }, [typeId, isBrowser])
130
+
131
+ function getSummary(item: Type, nested = true) {
132
+ return (
133
+ <DetailsSummary
134
+ subtitle={
135
+ item.description || item.defaultValue || item.example ? (
136
+ <>
137
+ {item.description && (
138
+ <MarkdownContent
139
+ allowedElements={[
140
+ "a",
141
+ "strong",
142
+ "code",
143
+ "ul",
144
+ "ol",
145
+ "li",
146
+ "br",
147
+ ]}
148
+ unwrapDisallowed={true}
149
+ components={{
150
+ ...MDXComponents,
151
+ ol: (props: React.HTMLAttributes<HTMLElement>) => (
152
+ // @ts-expect-error Not recognized as a JSX element
153
+ <MDXComponents.ol
154
+ {...props}
155
+ className={clsx(props.className, "mt-docs_1.5")}
156
+ />
157
+ ),
158
+ li: (props: React.HTMLAttributes<HTMLElement>) => (
159
+ // @ts-expect-error Not recognized as a JSX element
160
+ <MDXComponents.li
161
+ {...props}
162
+ className={clsx(
163
+ props.className,
164
+ "!text-acmekit-fg-subtle"
165
+ )}
166
+ />
167
+ ),
168
+ }}
169
+ >
170
+ {item.description}
171
+ </MarkdownContent>
172
+ )}
173
+ {item.defaultValue && (
174
+ <p className="mt-0.5 mb-0">
175
+ Default: <InlineCode>{item.defaultValue}</InlineCode>
176
+ </p>
177
+ )}
178
+ {item.example && (
179
+ <div className="mt-0.5">
180
+ Example: <InlineCode>{item.example}</InlineCode>
181
+ </div>
182
+ )}
183
+ </>
184
+ ) : undefined
185
+ }
186
+ expandable={(item.children?.length || 0) > 0}
187
+ hideExpandableIcon={true}
188
+ className={clsx(
189
+ getItemClassNames(false),
190
+ "py-1 pr-1",
191
+ level === 1 && "pl-1",
192
+ level === 2 && "pl-3",
193
+ level === 3 && "pl-[120px]",
194
+ level === 4 && "pl-[160px]",
195
+ !nested && "cursor-auto",
196
+ isSelected && "animate-flash animate-bg-surface"
197
+ )}
198
+ onClick={(e) => {
199
+ const targetElm = e.target as HTMLElement
200
+ if (targetElm.tagName.toLowerCase() === "a") {
201
+ window.location.href =
202
+ targetElm.getAttribute("href") || window.location.href
203
+ return
204
+ }
205
+ }}
206
+ summaryRef={!nested ? ref : undefined}
207
+ id={!nested && typeId ? typeId : ""}
208
+ >
209
+ <div className="flex gap-0.5">
210
+ {nested && (
211
+ <TriangleRightMini
212
+ className={clsx(
213
+ "text-acmekit-fg-subtle transition-transform",
214
+ rotateForGroupName
215
+ )}
216
+ />
217
+ )}
218
+ {!nested && level > 1 && (
219
+ <ArrowDownLeftMini
220
+ className={clsx("text-acmekit-fg-subtle flip-y")}
221
+ />
222
+ )}
223
+ {level === 1 && typeId.length > 0 && (
224
+ <CopyButton
225
+ text={typeUrl}
226
+ onCopy={(e) => {
227
+ e.preventDefault()
228
+ e.stopPropagation()
229
+ }}
230
+ >
231
+ <Link
232
+ className={clsx(
233
+ "text-acmekit-fg-interactive hover:text-acmekit-fg-interactive-hover"
234
+ )}
235
+ />
236
+ </CopyButton>
237
+ )}
238
+ <div className="flex gap-0.75 flex-wrap flex-1">
239
+ <InlineCode data-testid="type-name">
240
+ {decodeStr(item.name)}
241
+ </InlineCode>
242
+ <span
243
+ className="font-monospace text-compact-small-plus text-acmekit-fg-subtle"
244
+ data-testid="type-type"
245
+ >
246
+ <MarkdownContent allowedElements={["a"]} unwrapDisallowed={true}>
247
+ {item.type}
248
+ </MarkdownContent>
249
+ </span>
250
+ {item.optional === true && (
251
+ <span
252
+ className={clsx(
253
+ "text-compact-x-small-plus",
254
+ "text-acmekit-tag-blue-text"
255
+ )}
256
+ data-testid="type-optional"
257
+ >
258
+ Optional
259
+ </span>
260
+ )}
261
+ {item.featureFlag && (
262
+ <FeatureFlagNotice
263
+ featureFlag={item.featureFlag}
264
+ type="type"
265
+ badgeClassName="!p-0 leading-none"
266
+ badgeContent={
267
+ <FlagMini className="!text-acmekit-tag-green-text" />
268
+ }
269
+ />
270
+ )}
271
+ {item.expandable && (
272
+ <ExpandableNotice
273
+ type={referenceType}
274
+ link={expandUrl || "#"}
275
+ badgeClassName="!p-docs_0.25 block leading-none"
276
+ badgeContent={<ArrowsPointingOutMini />}
277
+ />
278
+ )}
279
+ {item.since && (
280
+ <VersionNotice
281
+ version={item.since}
282
+ badgeClassName="!p-0 leading-none"
283
+ />
284
+ )}
285
+ {item.deprecated?.is_deprecated && (
286
+ <DeprecatedNotice description={item.deprecated?.description} />
287
+ )}
288
+ </div>
289
+ </div>
290
+ </DetailsSummary>
291
+ )
292
+ }
293
+
294
+ return (
295
+ <>
296
+ {(typeItem.children?.length || 0) > 0 && (
297
+ <Details
298
+ summaryElm={getSummary(typeItem)}
299
+ className={clsx(getItemClassNames())}
300
+ heightAnimation={true}
301
+ id={typeId ? typeId : ""}
302
+ openInitial={openedLevel >= level}
303
+ >
304
+ {typeItem.children && (
305
+ <TypeListItems
306
+ types={typeItem.children}
307
+ level={level + 1}
308
+ expandUrl={expandUrl}
309
+ />
310
+ )}
311
+ </Details>
312
+ )}
313
+ {(typeItem.children?.length || 0) === 0 && getSummary(typeItem, false)}
314
+ </>
315
+ )
316
+ }
317
+
318
+ type TypeListItemsProps = {
319
+ types: Type[]
320
+ } & CommonProps
321
+
322
+ const TypeListItems = ({ types, ...rest }: TypeListItemsProps) => {
323
+ return (
324
+ <div>
325
+ {types.map((typeItem, key) => (
326
+ <TypeListItem
327
+ typeItem={typeItem}
328
+ key={key}
329
+ elementKey={key}
330
+ {...rest}
331
+ />
332
+ ))}
333
+ </div>
334
+ )
335
+ }
336
+
337
+ export default TypeListItems