@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,100 @@
1
+ import clsx from "clsx"
2
+ import React from "react"
3
+
4
+ export type ButtonVariants =
5
+ | "primary"
6
+ | "secondary"
7
+ | "transparent"
8
+ | "transparent-clear"
9
+
10
+ export type ButtonType = "default" | "icon"
11
+
12
+ export type ButtonProps = {
13
+ isSelected?: boolean
14
+ disabled?: boolean
15
+ variant?: ButtonVariants
16
+ className?: string
17
+ buttonType?: ButtonType
18
+ buttonRef?: React.LegacyRef<HTMLButtonElement>
19
+ type?: "button" | "submit" | "reset"
20
+ } & React.HTMLAttributes<HTMLButtonElement>
21
+
22
+ export const Button = ({
23
+ className,
24
+ children,
25
+ variant = "primary",
26
+ buttonType = "default",
27
+ buttonRef,
28
+ ...props
29
+ }: ButtonProps) => {
30
+ const variantClasses = {
31
+ primary: [
32
+ "px-docs_0.5 py-docs_0.25 rounded-docs_sm cursor-pointer",
33
+ "bg-acmekit-button-inverted",
34
+ "hover:bg-acmekit-button-inverted-hover hover:no-underline",
35
+ "active:bg-acmekit-button-inverted-pressed",
36
+ "focus:bg-acmekit-button-inverted",
37
+ "shadow-button-inverted focus:shadow-button-inverted-focused transition-shadow",
38
+ "dark:shadow-button-inverted-dark dark:focus:shadow-button-inverted-focused-dark",
39
+ "disabled:bg-acmekit-bg-disabled disabled:shadow-button-neutral dark:disabled:shadow-button-neutral-dark",
40
+ "disabled:cursor-not-allowed",
41
+ "text-compact-small-plus text-acmekit-contrast-fg-primary",
42
+ "[&_a]:text-acmekit-contrast-fg-primary",
43
+ "disabled:text-acmekit-fg-disabled",
44
+ "[&_a]:disabled:text-acmekit-fg-disabled",
45
+ "select-none",
46
+ ],
47
+ secondary: [
48
+ "px-docs_0.5 py-docs_0.25 rounded-docs_sm cursor-pointer",
49
+ "bg-acmekit-button-neutral",
50
+ "hover:bg-acmekit-button-neutral-hover hover:no-underline",
51
+ "active:bg-acmekit-button-neutral-pressed",
52
+ "focus:bg-acmekit-button-neutral",
53
+ "disabled:bg-acmekit-bg-disabled disabled:shadow-button-neutral dark:disabled:shadow-button-neutral-dark",
54
+ "disabled:cursor-not-allowed disabled:text-acmekit-fg-disabled",
55
+ "text-compact-small-plus text-acmekit-fg-base",
56
+ "[&_a]:text-acmekit-fg-base",
57
+ "shadow-button-neutral focus:shadow-button-neutral-focused active:shadow-button-neutral transition-shadow",
58
+ "dark:shadow-button-neutral dark:focus:shadow-button-neutral-focused dark:active:shadow-button-neutral",
59
+ "select-none",
60
+ ],
61
+ transparent: [
62
+ "px-docs_0.5 py-docs_0.25 rounded-docs_sm cursor-pointer",
63
+ "bg-transparent shadow-none border-0 outline-none",
64
+ "text-compact-small-plus text-acmekit-fg-base",
65
+ "hover:bg-acmekit-button-transparent-hover",
66
+ "active:bg-acmekit-button-transparent-pressed",
67
+ "focus:bg-acmekit-bg-base focus:shadow-button-neutral-focused dark:focus:shadow-button-neutral-focused-dark",
68
+ "disabled:bg-transparent disabled:shadow-button-neutral dark:disabled:shadow-button-neutral-dark",
69
+ "disabled:cursor-not-allowed disabled:text-acmekit-fg-disabled",
70
+ ],
71
+ transparentClear: [
72
+ "px-docs_0.5 py-docs_0.25 rounded-docs_sm cursor-pointer",
73
+ "bg-transparent shadow-none border-0 outline-none",
74
+ "text-compact-small-plus text-acmekit-fg-muted",
75
+ "hover:bg-acmekit-button-transparent-hover",
76
+ "active:bg-acmekit-button-transparent-pressed",
77
+ "focus:bg-acmekit-bg-base focus:shadow-button-neutral-focused dark:focus:shadow-button-neutral-focused-dark",
78
+ "disabled:bg-transparent disabled:shadow-button-neutral dark:disabled:shadow-button-neutral-dark",
79
+ "disabled:cursor-not-allowed disabled:text-acmekit-fg-disabled",
80
+ ],
81
+ }
82
+
83
+ return (
84
+ <button
85
+ className={clsx(
86
+ "inline-flex flex-row justify-center items-center gap-[6px] font-base",
87
+ variant === "primary" && variantClasses.primary,
88
+ variant === "secondary" && variantClasses.secondary,
89
+ variant === "transparent" && variantClasses.transparent,
90
+ variant === "transparent-clear" && variantClasses.transparentClear,
91
+ buttonType === "icon" && "!px-docs_0.25",
92
+ className
93
+ )}
94
+ ref={buttonRef}
95
+ {...props}
96
+ >
97
+ {children}
98
+ </button>
99
+ )
100
+ }
@@ -0,0 +1,124 @@
1
+ import React from "react"
2
+ import clsx from "clsx"
3
+ import { Badge } from "../../../../components/Badge"
4
+ import { BorderedIcon } from "../../../../components/BorderedIcon"
5
+ import { Link } from "../../../../components/Link"
6
+ import { ArrowUpRightOnBox, TriangleRightMini } from "@acmekit/icons"
7
+ import { CardProps } from "../../.."
8
+ import { useIsExternalLink } from "../../../.."
9
+
10
+ export const CardDefaultLayout = ({
11
+ icon,
12
+ image,
13
+ title,
14
+ text,
15
+ href,
16
+ className,
17
+ contentClassName,
18
+ iconClassName,
19
+ children,
20
+ badge,
21
+ rightIcon: RightIconComponent,
22
+ highlightText = [],
23
+ onClick,
24
+ }: CardProps) => {
25
+ const isExternal = useIsExternalLink({ href })
26
+
27
+ const getHighlightedText = (textToHighlight: string) => {
28
+ if (!highlightText.length) {
29
+ return textToHighlight
30
+ }
31
+
32
+ const parts = textToHighlight.split(
33
+ new RegExp(`(${highlightText.join("|")})`, "gi")
34
+ )
35
+ return parts.map((part, index) => {
36
+ const isHighlighted = highlightText.some((highlight) => {
37
+ return part.toLowerCase() === highlight.toLowerCase()
38
+ })
39
+ return isHighlighted ? (
40
+ <span
41
+ key={index}
42
+ className="bg-acmekit-tag-blue-bg px-px rounded-s-docs_xxs"
43
+ data-testid="highlight-text"
44
+ >
45
+ {part}
46
+ </span>
47
+ ) : (
48
+ part
49
+ )
50
+ })
51
+ }
52
+
53
+ return (
54
+ <div
55
+ className={clsx(
56
+ "bg-acmekit-bg-component w-full rounded-docs_DEFAULT",
57
+ "shadow-elevation-card-rest dark:shadow-elevation-card-rest-dark",
58
+ "py-docs_0.5 px-docs_0.75 relative",
59
+ "flex justify-start items-center gap-docs_0.75 transition-shadow",
60
+ href &&
61
+ "hover:shadow-elevation-card-hover dark:hover:shadow-elevation-card-hover-dark",
62
+ className
63
+ )}
64
+ >
65
+ {icon && (
66
+ <BorderedIcon
67
+ wrapperClassName={clsx(
68
+ "p-[4.5px] bg-acmekit-bg-component-hover",
69
+ iconClassName
70
+ )}
71
+ IconComponent={icon}
72
+ />
73
+ )}
74
+ {image && (
75
+ <BorderedIcon
76
+ wrapperClassName={clsx("bg-acmekit-bg-base", iconClassName)}
77
+ icon={image}
78
+ />
79
+ )}
80
+ <div
81
+ className={clsx("flex flex-col flex-1 overflow-auto", contentClassName)}
82
+ >
83
+ {title && (
84
+ <div
85
+ className="text-small-plus text-acmekit-fg-base truncate"
86
+ data-testid="title"
87
+ >
88
+ {getHighlightedText(title)}
89
+ </div>
90
+ )}
91
+ {text && (
92
+ <span
93
+ className="text-small-plus text-acmekit-fg-subtle"
94
+ data-testid="text"
95
+ >
96
+ {getHighlightedText(text)}
97
+ </span>
98
+ )}
99
+ {children}
100
+ </div>
101
+ {badge && <Badge {...badge} />}
102
+ <span className="text-acmekit-fg-subtle">
103
+ {RightIconComponent && <RightIconComponent />}
104
+ {!RightIconComponent && isExternal && (
105
+ <ArrowUpRightOnBox data-testid="external-icon" />
106
+ )}
107
+ {!RightIconComponent && !isExternal && (
108
+ <TriangleRightMini data-testid="internal-icon" />
109
+ )}
110
+ </span>
111
+
112
+ {href && (
113
+ <Link
114
+ to={href}
115
+ className="absolute left-0 top-0 h-full w-full rounded"
116
+ rel={isExternal ? "noopener noreferrer" : undefined}
117
+ target={isExternal ? "_blank" : undefined}
118
+ aria-label={title}
119
+ onClick={onClick}
120
+ />
121
+ )}
122
+ </div>
123
+ )
124
+ }
@@ -0,0 +1,30 @@
1
+ import React from "react"
2
+ import { CardProps } from "../../../.."
3
+ import clsx from "clsx"
4
+ import { Link } from "react-router-dom"
5
+
6
+ export const CardFillerLayout = ({ text, href, className }: CardProps) => {
7
+ return (
8
+ <div
9
+ className={clsx(
10
+ "flex justify-center items-center w-full",
11
+ "gap-docs_0.75 px-docs_0.75 py-docs_0.5 rounded-docs_DEFAULT",
12
+ "border border-dashed border-acmekit-border-strong",
13
+ "bg-acmekit-bg-component text-acmekit-fg-subtle",
14
+ className
15
+ )}
16
+ >
17
+ <div>
18
+ <span className="text-compact-small">{text}</span>
19
+ {href && (
20
+ <>
21
+ {" "}
22
+ <Link to={href} className="text-compact-small-plus">
23
+ Show All↗
24
+ </Link>
25
+ </>
26
+ )}
27
+ </div>
28
+ </div>
29
+ )
30
+ }
@@ -0,0 +1,88 @@
1
+ import React from "react"
2
+ import { CardProps } from "../../../../components/Card"
3
+ import { useIsExternalLink } from "../../../../hooks/use-is-external-link"
4
+ import clsx from "clsx"
5
+ import { ArrowUpRightOnBox, TriangleRightMini } from "@acmekit/icons"
6
+ import { Link } from "react-router-dom"
7
+
8
+ export const CardLargeLayout = ({
9
+ title,
10
+ text,
11
+ image,
12
+ icon,
13
+ href,
14
+ className,
15
+ onClick,
16
+ }: CardProps) => {
17
+ const isExternal = useIsExternalLink({ href })
18
+ const IconComponent = icon
19
+
20
+ return (
21
+ <div
22
+ className={clsx(
23
+ "relative flex flex-col gap-docs_0.75",
24
+ "justify-start group",
25
+ className
26
+ )}
27
+ >
28
+ <div
29
+ className={clsx(
30
+ "rounded-docs_DEFAULT bg-acmekit-bg-component w-[290px] h-[144px]",
31
+ "shadow-elevation-card-rest dark:shadow-elevation-card-rest-dark",
32
+ href &&
33
+ "group-hover:shadow-elevation-card-hover group-hover:dark:shadow-elevation-card-hover-dark",
34
+ "px-docs_0.75 py-docs_0.5 flex justify-center items-center w-full"
35
+ )}
36
+ >
37
+ {IconComponent && (
38
+ <IconComponent
39
+ className="text-acmekit-fg-subtle"
40
+ width={32}
41
+ height={32}
42
+ viewBox="0 0 32 32"
43
+ />
44
+ )}
45
+ {image && (
46
+ <img src={image} alt={title || text || ""} className="w-[144px]" />
47
+ )}
48
+ </div>
49
+ <div className="flex flex-col">
50
+ <div className="flex gap-docs_0.25 items-center text-acmekit-fg-base">
51
+ {title && (
52
+ <span className="text-compact-small-plus" data-testid="title">
53
+ {title}
54
+ </span>
55
+ )}
56
+ {href && isExternal && (
57
+ <ArrowUpRightOnBox data-testid="external-icon" />
58
+ )}
59
+ {href && !isExternal && (
60
+ <TriangleRightMini
61
+ className="group-hover:translate-x-docs_0.125 transition-transform"
62
+ data-testid="internal-icon"
63
+ />
64
+ )}
65
+ </div>
66
+ {text && (
67
+ <span
68
+ className="text-small-plus text-acmekit-fg-subtle"
69
+ data-testid="text"
70
+ >
71
+ {text}
72
+ </span>
73
+ )}
74
+ </div>
75
+ {href && (
76
+ <Link
77
+ to={href}
78
+ className="absolute left-0 top-0 h-full w-full rounded"
79
+
80
+ rel={isExternal ? "noopener noreferrer" : undefined}
81
+ target={isExternal ? "_blank" : undefined}
82
+ aria-label={title}
83
+ onClick={onClick}
84
+ />
85
+ )}
86
+ </div>
87
+ )
88
+ }
@@ -0,0 +1,142 @@
1
+
2
+ import React from "react"
3
+ import clsx from "clsx"
4
+ import { CardProps } from "../../../../components/Card"
5
+ import { BorderedIcon } from "../../../../components/BorderedIcon"
6
+ import { Button } from "../../../../components/Button"
7
+ import { ThemeImage } from "../../../../components/ThemeImage"
8
+ import { useIsExternalLink } from "../../../../hooks/use-is-external-link"
9
+ import { Link } from "react-router-dom"
10
+
11
+ import { ArrowUpRightOnBox, TriangleRightMini, XMark } from "@acmekit/icons"
12
+
13
+ export const CardLayoutMini = ({
14
+ icon,
15
+ image,
16
+ themeImage,
17
+ title,
18
+ text,
19
+ href,
20
+ hrefProps = {},
21
+ closeable = false,
22
+ onClose,
23
+ className,
24
+ imageDimensions = { width: 45, height: 36 },
25
+ iconClassName,
26
+ cardRef,
27
+ onClick,
28
+ }: CardProps) => {
29
+ const isExternal = useIsExternalLink({ href })
30
+
31
+ return (
32
+ <div
33
+ className={clsx(
34
+ "relative rounded-docs_DEFAULT border-acmekit-fg-on-inverted border",
35
+ "shadow-elevation-card-rest dark:shadow-elevation-card-rest-dark",
36
+ "hover:shadow-elevation-card-hover dark:hover:shadow-elevation-card-hover-dark",
37
+ "bg-acmekit-tag-neutral-bg dark:bg-acmekit-bg-component",
38
+ "hover:bg-acmekit-tag-neutral-bg-hover dark:hover:bg-acmekit-bg-component-hover",
39
+ "w-fit transition-[shadow,background]",
40
+ className
41
+ )}
42
+ ref={cardRef}
43
+ >
44
+ <div
45
+ className={clsx(
46
+ "rounded-docs_DEFAULT flex gap-docs_0.75 py-docs_0.25",
47
+ "pl-docs_0.25 pr-docs_0.75 items-center"
48
+ )}
49
+ >
50
+ {icon && (
51
+ <BorderedIcon
52
+ wrapperClassName={clsx("p-[4.5px] bg-acmekit-bg-component-hover")}
53
+ IconComponent={icon}
54
+ />
55
+ )}
56
+ {image && (
57
+ <img
58
+ src={image}
59
+ className={clsx(
60
+ "shadow-elevation-card-rest dark:shadow-elevation-card-rest-dark",
61
+ "rounded-docs_xs",
62
+ iconClassName
63
+ )}
64
+ width={imageDimensions.width}
65
+ height={imageDimensions.height}
66
+ alt={title || text || ""}
67
+ style={{
68
+ width: `${imageDimensions.width}px`,
69
+ height: `${imageDimensions.height}px`,
70
+ }}
71
+ />
72
+ )}
73
+ {themeImage && (
74
+ <ThemeImage
75
+ {...themeImage}
76
+ className={clsx(
77
+ "shadow-elevation-card-rest dark:shadow-elevation-card-rest-dark",
78
+ "rounded-docs_xs",
79
+ iconClassName
80
+ )}
81
+ width={imageDimensions.width}
82
+ height={imageDimensions.height}
83
+ alt={title || text || ""}
84
+ style={{
85
+ width: `${imageDimensions.width}px`,
86
+ height: `${imageDimensions.height}px`,
87
+ }}
88
+ />
89
+ )}
90
+ <div className="flex flex-col">
91
+ {title && (
92
+ <span
93
+ className="text-x-small-plus text-acmekit-fg-base"
94
+ data-testid="title"
95
+ >
96
+ {title}
97
+ </span>
98
+ )}
99
+ {text && (
100
+ <span
101
+ className="text-x-small-plus text-acmekit-fg-subtle"
102
+ data-testid="text"
103
+ >
104
+ {text}
105
+ </span>
106
+ )}
107
+ </div>
108
+ {!closeable && (
109
+ <span className="text-acmekit-fg-subtle">
110
+ {isExternal ? (
111
+ <ArrowUpRightOnBox data-testid="external-icon" />
112
+ ) : (
113
+ <TriangleRightMini data-testid="internal-icon" />
114
+ )}
115
+ </span>
116
+ )}
117
+ {href && (
118
+ <Link
119
+ to={href}
120
+ className="absolute left-0 top-0 w-full h-full z-[1]"
121
+
122
+ {...hrefProps}
123
+ rel={isExternal ? "noopener noreferrer" : undefined}
124
+ target={isExternal ? "_blank" : undefined}
125
+ aria-label={title}
126
+ onClick={onClick}
127
+ />
128
+ )}
129
+ {closeable && (
130
+ <Button
131
+ variant="transparent-clear"
132
+ onClick={onClose}
133
+ className="!p-[2.5px] z-[2] hover:!bg-acmekit-button-transparent-hover focus:!shadow-none focus:!bg-transparent"
134
+ data-testid="close-button"
135
+ >
136
+ <XMark data-testid="close-icon" />
137
+ </Button>
138
+ )}
139
+ </div>
140
+ </div>
141
+ )
142
+ }
@@ -0,0 +1,50 @@
1
+ import React from "react"
2
+ import { BadgeProps } from "../../components/Badge"
3
+ import { CardDefaultLayout } from "./Layout/Default"
4
+ import { IconProps } from "@acmekit/icons/dist/types"
5
+ import { CardLargeLayout } from "./Layout/Large"
6
+ import { CardFillerLayout } from "./Layout/Filler"
7
+ import { CardLayoutMini } from "./Layout/Mini"
8
+ import type { LinkProps } from "react-router-dom"
9
+
10
+ export type CardProps = {
11
+ type?: "default" | "large" | "filler" | "mini"
12
+ icon?: React.FC<IconProps>
13
+ rightIcon?: React.FC<IconProps>
14
+ image?: string
15
+ themeImage?: {
16
+ light: string
17
+ dark: string
18
+ }
19
+ imageDimensions?: {
20
+ width: number
21
+ height: number
22
+ }
23
+ title?: string
24
+ text?: string
25
+ href?: string
26
+ className?: string
27
+ contentClassName?: string
28
+ iconClassName?: string
29
+ children?: React.ReactNode
30
+ badge?: BadgeProps
31
+ highlightText?: string[]
32
+ closeable?: boolean
33
+ onClose?: () => void
34
+ onClick?: () => void
35
+ hrefProps?: Partial<LinkProps & React.AllHTMLAttributes<HTMLAnchorElement>>
36
+ cardRef?: React.Ref<HTMLDivElement>
37
+ }
38
+
39
+ export const Card = ({ type = "default", ...props }: CardProps) => {
40
+ switch (type) {
41
+ case "large":
42
+ return <CardLargeLayout {...props} />
43
+ case "filler":
44
+ return <CardFillerLayout {...props} />
45
+ case "mini":
46
+ return <CardLayoutMini {...props} />
47
+ default:
48
+ return <CardDefaultLayout {...props} />
49
+ }
50
+ }
@@ -0,0 +1,40 @@
1
+ import React from "react"
2
+ import { Card, CardProps } from "../../components/Card"
3
+ import clsx from "clsx"
4
+
5
+ type CardListProps = {
6
+ items: CardProps[]
7
+ itemsPerRow?: number
8
+ defaultItemsPerRow?: number
9
+ className?: string
10
+ }
11
+
12
+ export const CardList = ({
13
+ items,
14
+ itemsPerRow,
15
+ className,
16
+ defaultItemsPerRow,
17
+ }: CardListProps) => {
18
+ if (!itemsPerRow) {
19
+ // if length of items is even, set to `2`, else set to `3`
20
+ itemsPerRow =
21
+ items.length === 1
22
+ ? 1
23
+ : defaultItemsPerRow || (items.length % 2 === 0 ? 2 : 3)
24
+ }
25
+ return (
26
+ <section
27
+ className={clsx(
28
+ "grid gap-x-docs_1 auto-rows-fr gap-y-docs_1",
29
+ itemsPerRow === 1 && "grid-cols-1",
30
+ itemsPerRow === 2 && "md:grid-cols-2 grid-cols-1",
31
+ itemsPerRow === 3 && "lg:grid-cols-3 md:grid-col-2 grid-cols-1",
32
+ className
33
+ )}
34
+ >
35
+ {items.map((item, key) => (
36
+ <Card {...item} key={key} />
37
+ ))}
38
+ </section>
39
+ )
40
+ }
@@ -0,0 +1,9 @@
1
+ import React from "react"
2
+
3
+ export type UseChildDocsProps = {
4
+ onlyTopLevel?: boolean
5
+ }
6
+
7
+ export const ChildDocs = (_props: UseChildDocsProps) => {
8
+ return null
9
+ }
@@ -0,0 +1,10 @@
1
+ import React from "react"
2
+
3
+ export type CodeBlockAskAiActionProps = {
4
+ source: string
5
+ inHeader?: boolean
6
+ }
7
+
8
+ export const CodeBlockAskAiAction = (_props: CodeBlockAskAiActionProps) => {
9
+ return null
10
+ }
@@ -0,0 +1,59 @@
1
+ import React, { useEffect, useState } from "react"
2
+ import { CopyButton } from "../../../CopyButton"
3
+ import clsx from "clsx"
4
+ import { CheckMini, SquareTwoStack } from "@acmekit/icons"
5
+
6
+ export type CodeBlockCopyActionProps = {
7
+ source: string
8
+ inHeader: boolean
9
+ }
10
+
11
+ export const CodeBlockCopyAction = ({
12
+ source,
13
+ inHeader,
14
+ }: CodeBlockCopyActionProps) => {
15
+ const [copied, setCopied] = useState(false)
16
+
17
+ useEffect(() => {
18
+ if (!copied) {
19
+ return
20
+ }
21
+
22
+ const timeout = setTimeout(() => {
23
+ setCopied(false)
24
+ }, 1000)
25
+
26
+ return () => clearTimeout(timeout)
27
+ }, [copied])
28
+
29
+ const iconClassName = [
30
+ "text-acmekit-contrast-fg-secondary",
31
+ "group-hover:text-acmekit-contrast-fg-primary",
32
+ "group-focus:text-acmekit-contrast-fg-primary",
33
+ ]
34
+
35
+ return (
36
+ <CopyButton
37
+ text={source}
38
+ tooltipClassName="font-base"
39
+ className={clsx("group")}
40
+ buttonClassName={clsx(!inHeader && "p-[6px]", inHeader && "p-[4.5px]")}
41
+ tooltipInnerClassName={clsx(
42
+ inHeader && "flex",
43
+ "h-fit rounded-docs_sm",
44
+ "group-hover:bg-acmekit-contrast-bg-base-hover group-focus:bg-acmekit-contrast-bg-base-hover"
45
+ )}
46
+ onCopy={() => setCopied(true)}
47
+ >
48
+ {!copied && (
49
+ <SquareTwoStack
50
+ className={clsx(iconClassName)}
51
+ data-testid="not-copied-icon"
52
+ />
53
+ )}
54
+ {copied && (
55
+ <CheckMini className={clsx(iconClassName)} data-testid="copied-icon" />
56
+ )}
57
+ </CopyButton>
58
+ )
59
+ }