@acmekit/docs-ui 2.13.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Items-YPPZD6C6.mjs +312 -0
- package/dist/chunk-JD7BP7O5.mjs +13144 -0
- package/dist/index.d.mts +1550 -0
- package/dist/index.d.ts +1550 -0
- package/dist/index.js +15218 -0
- package/dist/index.mjs +366 -0
- package/package.json +58 -0
- package/src/components/Badge/index.tsx +74 -0
- package/src/components/BadgesList/index.tsx +18 -0
- package/src/components/BetaBadge/index.tsx +24 -0
- package/src/components/Bordered/index.tsx +21 -0
- package/src/components/BorderedIcon/index.tsx +60 -0
- package/src/components/Breadcrumbs/index.tsx +83 -0
- package/src/components/Button/index.tsx +100 -0
- package/src/components/Card/Layout/Default/index.tsx +124 -0
- package/src/components/Card/Layout/Filler/index.tsx +30 -0
- package/src/components/Card/Layout/Large/index.tsx +88 -0
- package/src/components/Card/Layout/Mini/index.tsx +142 -0
- package/src/components/Card/index.tsx +50 -0
- package/src/components/CardList/index.tsx +40 -0
- package/src/components/ChildDocs/index.tsx +9 -0
- package/src/components/CodeBlock/Actions/AskAi/index.tsx +10 -0
- package/src/components/CodeBlock/Actions/Copy/index.tsx +59 -0
- package/src/components/CodeBlock/Actions/index.tsx +137 -0
- package/src/components/CodeBlock/Collapsible/Button/index.tsx +58 -0
- package/src/components/CodeBlock/Collapsible/Fade/index.tsx +55 -0
- package/src/components/CodeBlock/Collapsible/Lines/index.tsx +22 -0
- package/src/components/CodeBlock/Header/Wrapper/index.tsx +46 -0
- package/src/components/CodeBlock/Header/index.tsx +67 -0
- package/src/components/CodeBlock/Inline/index.tsx +20 -0
- package/src/components/CodeBlock/Line/index.tsx +331 -0
- package/src/components/CodeBlock/index.tsx +510 -0
- package/src/components/CodeMdx/index.tsx +45 -0
- package/src/components/CodeTabs/Item/index.tsx +67 -0
- package/src/components/CodeTabs/index.tsx +319 -0
- package/src/components/ContentMenu/Actions/index.tsx +7 -0
- package/src/components/ContentMenu/Products/index.tsx +64 -0
- package/src/components/ContentMenu/Toc/index.tsx +148 -0
- package/src/components/ContentMenu/Version/index.tsx +77 -0
- package/src/components/ContentMenu/index.tsx +31 -0
- package/src/components/CopyButton/index.tsx +76 -0
- package/src/components/Details/Summary/index.tsx +75 -0
- package/src/components/Details/index.tsx +98 -0
- package/src/components/DetailsList/index.tsx +32 -0
- package/src/components/DottedSeparator/index.tsx +30 -0
- package/src/components/EditButton/index.tsx +32 -0
- package/src/components/EditDate/index.tsx +33 -0
- package/src/components/ErrorPage/Icon/index.tsx +428 -0
- package/src/components/ErrorPage/index.tsx +32 -0
- package/src/components/Feedback/Solutions/index.tsx +105 -0
- package/src/components/Feedback/index.tsx +304 -0
- package/src/components/Footer/index.tsx +23 -0
- package/src/components/Heading/H1/index.tsx +21 -0
- package/src/components/Heading/H2/index.tsx +47 -0
- package/src/components/Heading/H3/index.tsx +42 -0
- package/src/components/Heading/H4/index.tsx +14 -0
- package/src/components/Heading/index.tsx +4 -0
- package/src/components/IconHeadline/index.tsx +15 -0
- package/src/components/Icons/AiAssistant/index.tsx +462 -0
- package/src/components/Icons/ArrowRightDown/index.tsx +30 -0
- package/src/components/Icons/BundledProduct/index.tsx +72 -0
- package/src/components/Icons/CalendarRefresh/index.tsx +70 -0
- package/src/components/Icons/ChefHat/index.tsx +65 -0
- package/src/components/Icons/CircleDottedLine/index.tsx +60 -0
- package/src/components/Icons/CloudSolid/index.tsx +47 -0
- package/src/components/Icons/ColoredAcmeKit/index.tsx +13 -0
- package/src/components/Icons/DecisionProcess/index.tsx +58 -0
- package/src/components/Icons/Erp/index.tsx +92 -0
- package/src/components/Icons/Github/index.tsx +22 -0
- package/src/components/Icons/House/index.tsx +23 -0
- package/src/components/Icons/ImageBinary/index.tsx +69 -0
- package/src/components/Icons/Kapa/index.tsx +22 -0
- package/src/components/Icons/Markdown/index.tsx +25 -0
- package/src/components/Icons/NavigationDropdown/Admin/index.tsx +33 -0
- package/src/components/Icons/NavigationDropdown/Doc/index.tsx +41 -0
- package/src/components/Icons/NavigationDropdown/DocV1/index.tsx +37 -0
- package/src/components/Icons/NavigationDropdown/Modules/index.tsx +33 -0
- package/src/components/Icons/NavigationDropdown/Resources/index.tsx +37 -0
- package/src/components/Icons/NavigationDropdown/Store/index.tsx +37 -0
- package/src/components/Icons/NavigationDropdown/Ui/index.tsx +37 -0
- package/src/components/Icons/NavigationDropdown/User/index.tsx +37 -0
- package/src/components/Icons/PuzzleColored/index.tsx +35 -0
- package/src/components/Icons/QuestionMark/index.tsx +23 -0
- package/src/components/Icons/Restock/index.tsx +55 -0
- package/src/components/Icons/ScrollText/index.tsx +68 -0
- package/src/components/Icons/ShadedBg/index.tsx +334 -0
- package/src/components/Icons/Shop/index.tsx +68 -0
- package/src/components/Icons/SidebarLeft/index.tsx +42 -0
- package/src/components/Icons/StripeColored/index.tsx +60 -0
- package/src/components/Icons/ThumbDown/index.tsx +23 -0
- package/src/components/Icons/ThumbUp/index.tsx +23 -0
- package/src/components/Icons/WindowPaintbrush/index.tsx +57 -0
- package/src/components/Icons/index.tsx +20 -0
- package/src/components/InlineCode/index.tsx +42 -0
- package/src/components/InlineIcon/index.tsx +21 -0
- package/src/components/InlineThemeImage/index.tsx +14 -0
- package/src/components/Input/Search/index.tsx +64 -0
- package/src/components/Input/Text/index.tsx +39 -0
- package/src/components/Kbd/index.tsx +33 -0
- package/src/components/Label/index.tsx +19 -0
- package/src/components/Link/index.tsx +67 -0
- package/src/components/LinkButton/index.tsx +43 -0
- package/src/components/Loading/Dots/index.tsx +16 -0
- package/src/components/Loading/Spinner/index.tsx +19 -0
- package/src/components/Loading/index.tsx +43 -0
- package/src/components/MDXComponents/index.tsx +209 -0
- package/src/components/MainNav/DesktopMenu/ThemeMenu/index.tsx +76 -0
- package/src/components/MainNav/DesktopMenu/index.tsx +100 -0
- package/src/components/MainNav/Items/Dropdown/index.tsx +88 -0
- package/src/components/MainNav/Items/Link/index.tsx +34 -0
- package/src/components/MainNav/Items/index.tsx +61 -0
- package/src/components/MainNav/MobileMenu/Main/index.tsx +67 -0
- package/src/components/MainNav/MobileMenu/SubMenu/index.tsx +77 -0
- package/src/components/MainNav/MobileMenu/index.tsx +103 -0
- package/src/components/MainNav/Version/index.tsx +33 -0
- package/src/components/MainNav/index.tsx +153 -0
- package/src/components/MarkdownContent/index.tsx +41 -0
- package/src/components/Menu/Action/index.tsx +43 -0
- package/src/components/Menu/Divider/index.tsx +35 -0
- package/src/components/Menu/Dropdown/index.tsx +78 -0
- package/src/components/Menu/Item/index.tsx +36 -0
- package/src/components/Menu/SubMenu/index.tsx +47 -0
- package/src/components/Menu/index.tsx +44 -0
- package/src/components/Modal/Footer/index.tsx +29 -0
- package/src/components/Modal/Header/index.tsx +33 -0
- package/src/components/Modal/index.tsx +124 -0
- package/src/components/Note/Layout/index.tsx +139 -0
- package/src/components/Note/Types/checks.tsx +7 -0
- package/src/components/Note/Types/default.tsx +7 -0
- package/src/components/Note/Types/error.tsx +7 -0
- package/src/components/Note/Types/soon.tsx +7 -0
- package/src/components/Note/Types/sucess.tsx +7 -0
- package/src/components/Note/Types/warning.tsx +7 -0
- package/src/components/Note/index.tsx +32 -0
- package/src/components/Notices/DeprecatedNotice/index.tsx +33 -0
- package/src/components/Notices/ExpandableNotice/index.tsx +36 -0
- package/src/components/Notices/FeatureFlagNotice/index.tsx +36 -0
- package/src/components/Notices/VersionNotice/index.tsx +37 -0
- package/src/components/Notification/Item/Layout/Default/index.tsx +89 -0
- package/src/components/Notification/Item/index.tsx +88 -0
- package/src/components/Notification/index.tsx +65 -0
- package/src/components/Pagination/Card/index.tsx +80 -0
- package/src/components/Pagination/index.tsx +35 -0
- package/src/components/Prerequisites/Item/index.tsx +43 -0
- package/src/components/Prerequisites/index.tsx +94 -0
- package/src/components/RadioItem/index.tsx +38 -0
- package/src/components/Rating/index.tsx +133 -0
- package/src/components/RootProviders/index.tsx +31 -0
- package/src/components/Select/Badge/index.tsx +122 -0
- package/src/components/Select/Dropdown/index.tsx +188 -0
- package/src/components/Select/Input/index.tsx +123 -0
- package/src/components/Select/index.ts +13 -0
- package/src/components/Sidebar/Child/index.tsx +43 -0
- package/src/components/Sidebar/Item/Category/index.tsx +151 -0
- package/src/components/Sidebar/Item/Link/index.tsx +174 -0
- package/src/components/Sidebar/Item/Sidebar/index.tsx +67 -0
- package/src/components/Sidebar/Item/SubCategory/index.tsx +83 -0
- package/src/components/Sidebar/Item/index.tsx +41 -0
- package/src/components/Sidebar/Top/MobileClose/index.tsx +21 -0
- package/src/components/Sidebar/Top/index.tsx +33 -0
- package/src/components/Sidebar/index.tsx +153 -0
- package/src/components/SourceCodeLink/index.tsx +37 -0
- package/src/components/SplitLists/index.tsx +58 -0
- package/src/components/Table/index.tsx +87 -0
- package/src/components/Tabs/index.tsx +106 -0
- package/src/components/TextArea/index.tsx +30 -0
- package/src/components/ThemeImage/index.tsx +26 -0
- package/src/components/Toggle/index.tsx +28 -0
- package/src/components/Tooltip/index.tsx +65 -0
- package/src/components/TypeList/Items/index.tsx +337 -0
- package/src/components/TypeList/index.tsx +63 -0
- package/src/components/WideSection/index.tsx +25 -0
- package/src/components/ZoomImg/index.tsx +17 -0
- package/src/components/index.ts +75 -0
- package/src/constants.tsx +261 -0
- package/src/global-config.ts +11 -0
- package/src/hooks/index.ts +14 -0
- package/src/hooks/use-active-on-scroll/index.tsx +223 -0
- package/src/hooks/use-click-outside/index.tsx +37 -0
- package/src/hooks/use-collapsible/index.tsx +128 -0
- package/src/hooks/use-collapsible-code-lines/index.tsx +149 -0
- package/src/hooks/use-copy/index.tsx +28 -0
- package/src/hooks/use-heading-url/index.tsx +32 -0
- package/src/hooks/use-is-external-link/index.tsx +19 -0
- package/src/hooks/use-keyboard-shortcut/index.tsx +71 -0
- package/src/hooks/use-mutation-observer/index.ts +32 -0
- package/src/hooks/use-page-scroll-manager/index.tsx +82 -0
- package/src/hooks/use-resize-observer/index.ts +20 -0
- package/src/hooks/use-scroll-utils/index.tsx +372 -0
- package/src/hooks/use-select/index.tsx +99 -0
- package/src/hooks/use-tabs/index.tsx +94 -0
- package/src/index.ts +8 -0
- package/src/layouts/barebone.tsx +18 -0
- package/src/layouts/index.ts +4 -0
- package/src/layouts/main-content.tsx +86 -0
- package/src/layouts/root.tsx +43 -0
- package/src/layouts/tight.tsx +29 -0
- package/src/layouts/wide.tsx +25 -0
- package/src/providers/AiAssistant/index.tsx +65 -0
- package/src/providers/BrowserProvider/index.tsx +40 -0
- package/src/providers/ColorMode/index.tsx +73 -0
- package/src/providers/Layout/index.tsx +52 -0
- package/src/providers/MainNav/index.tsx +134 -0
- package/src/providers/Mobile/index.tsx +62 -0
- package/src/providers/Modal/index.tsx +52 -0
- package/src/providers/Notification/index.tsx +149 -0
- package/src/providers/Pagination/index.tsx +230 -0
- package/src/providers/Search/index.tsx +91 -0
- package/src/providers/Sidebar/index.tsx +745 -0
- package/src/providers/SiteConfig/index.tsx +70 -0
- package/src/providers/index.ts +13 -0
- package/src/types/config.ts +34 -0
- package/src/types/frontmatter.ts +23 -0
- package/src/types/general.ts +1 -0
- package/src/types/index.ts +9 -0
- package/src/types/menu.ts +40 -0
- package/src/types/navigation-dropdown.ts +16 -0
- package/src/types/navigation.ts +21 -0
- package/src/types/sidebar.ts +109 -0
- package/src/types/toc.ts +19 -0
- package/src/types/ui.ts +9 -0
- package/src/utils/array-same-elms.ts +10 -0
- package/src/utils/capitalize.ts +3 -0
- package/src/utils/check-sidebar-item-visibility.ts +47 -0
- package/src/utils/decode-str.ts +8 -0
- package/src/utils/dom-utils.ts +29 -0
- package/src/utils/event-parser.ts +54 -0
- package/src/utils/get-link-with-base-path.ts +3 -0
- package/src/utils/get-navbar-items.ts +55 -0
- package/src/utils/get-scrolled-top.ts +8 -0
- package/src/utils/index.ts +13 -0
- package/src/utils/is-elm-window.ts +3 -0
- package/src/utils/is-in-view.ts +10 -0
- package/src/utils/os-browser-utils.ts +39 -0
- package/src/utils/set-obj-value.ts +38 -0
- package/src/utils/sidebar-utils.ts +129 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
|
|
2
|
+
import React, { useEffect, useMemo, useRef, useState } from "react"
|
|
3
|
+
// @ts-expect-error can't install the types package because it doesn't support React v19
|
|
4
|
+
import { CSSTransition, SwitchTransition } from "react-transition-group"
|
|
5
|
+
import { Solutions } from "../../components/Feedback/Solutions"
|
|
6
|
+
import clsx from "clsx"
|
|
7
|
+
import { Button } from "../../components/Button"
|
|
8
|
+
import { TextArea } from "../../components/TextArea"
|
|
9
|
+
import { Label } from "../../components/Label"
|
|
10
|
+
import { DottedSeparator } from "../../components/DottedSeparator"
|
|
11
|
+
import { RadioItem } from "../../components/RadioItem"
|
|
12
|
+
import { ChatBubbleLeftRight, ThumbDown, ThumbUp } from "@acmekit/icons"
|
|
13
|
+
import { useSiteConfig } from "../../providers/SiteConfig"
|
|
14
|
+
import { RadioGroup } from "@acmekit/ui"
|
|
15
|
+
|
|
16
|
+
export type FeedbackProps = {
|
|
17
|
+
event: string
|
|
18
|
+
reportLink?: string
|
|
19
|
+
question?: string
|
|
20
|
+
positiveBtn?: string
|
|
21
|
+
negativeBtn?: string
|
|
22
|
+
positiveQuestion?: string
|
|
23
|
+
negativeQuestion?: string
|
|
24
|
+
submitBtn?: string
|
|
25
|
+
submitMessage?: string
|
|
26
|
+
showPossibleSolutions?: boolean
|
|
27
|
+
className?: string
|
|
28
|
+
extraData?: Record<string, unknown>
|
|
29
|
+
vertical?: boolean
|
|
30
|
+
showDottedSeparator?: boolean
|
|
31
|
+
} & React.HTMLAttributes<HTMLDivElement>
|
|
32
|
+
|
|
33
|
+
const feedbackOptions = {
|
|
34
|
+
positive: [
|
|
35
|
+
"Easy to understand",
|
|
36
|
+
"Accurate code and text",
|
|
37
|
+
"Exactly what I was looking for",
|
|
38
|
+
"Ease of use",
|
|
39
|
+
"Other",
|
|
40
|
+
],
|
|
41
|
+
negative: [
|
|
42
|
+
"Difficult to understand",
|
|
43
|
+
"Inaccurate code or text",
|
|
44
|
+
"Didn't find what I was looking for",
|
|
45
|
+
"Trouble using the documentation",
|
|
46
|
+
"Other",
|
|
47
|
+
],
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const Feedback = ({
|
|
51
|
+
event,
|
|
52
|
+
reportLink: initReportLink,
|
|
53
|
+
question = "Was this page helpful?",
|
|
54
|
+
positiveBtn = "It was helpful",
|
|
55
|
+
negativeBtn = "It wasn't helpful",
|
|
56
|
+
positiveQuestion = "What did you like?",
|
|
57
|
+
negativeQuestion = "What was the problem?",
|
|
58
|
+
submitBtn = "Submit",
|
|
59
|
+
submitMessage = "Thank you for helping improve our documentation!",
|
|
60
|
+
showPossibleSolutions = true,
|
|
61
|
+
className = "",
|
|
62
|
+
extraData = {},
|
|
63
|
+
vertical = false,
|
|
64
|
+
showDottedSeparator = true,
|
|
65
|
+
}: FeedbackProps) => {
|
|
66
|
+
const {
|
|
67
|
+
config: { reportIssueLink },
|
|
68
|
+
} = useSiteConfig()
|
|
69
|
+
const reportLink = useMemo(() => {
|
|
70
|
+
return initReportLink || reportIssueLink
|
|
71
|
+
}, [initReportLink, reportIssueLink])
|
|
72
|
+
const [showForm, setShowForm] = useState(false)
|
|
73
|
+
const [submittedFeedback, setSubmittedFeedback] = useState(false)
|
|
74
|
+
const [loading, setLoading] = useState(false)
|
|
75
|
+
const inlineFeedbackRef = useRef<HTMLDivElement>(null)
|
|
76
|
+
const inlineQuestionRef = useRef<HTMLDivElement>(null)
|
|
77
|
+
const inlineMessageRef = useRef<HTMLDivElement>(null)
|
|
78
|
+
const [positiveFeedback, setPositiveFeedback] = useState(false)
|
|
79
|
+
const [message, setMessage] = useState("")
|
|
80
|
+
const [feedbackOption, setFeedbackOption] = useState("")
|
|
81
|
+
const nodeRef = submittedFeedback
|
|
82
|
+
? inlineMessageRef
|
|
83
|
+
: showForm
|
|
84
|
+
? inlineQuestionRef
|
|
85
|
+
: inlineFeedbackRef
|
|
86
|
+
const track = (..._args: any[]) => {}
|
|
87
|
+
|
|
88
|
+
function handleFeedback(feedback: boolean) {
|
|
89
|
+
setPositiveFeedback(feedback)
|
|
90
|
+
setShowForm(true)
|
|
91
|
+
submitFeedback(feedback)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function submitFeedback(feedback = false) {
|
|
95
|
+
if (showForm) {
|
|
96
|
+
setLoading(true)
|
|
97
|
+
}
|
|
98
|
+
track({
|
|
99
|
+
event: {
|
|
100
|
+
event,
|
|
101
|
+
options: {
|
|
102
|
+
feedback:
|
|
103
|
+
(feedback !== null && feedback) ||
|
|
104
|
+
(feedback === null && positiveFeedback)
|
|
105
|
+
? "yes"
|
|
106
|
+
: "no",
|
|
107
|
+
message: message?.length ? message : null,
|
|
108
|
+
feedbackOption,
|
|
109
|
+
...extraData,
|
|
110
|
+
},
|
|
111
|
+
callback: function () {
|
|
112
|
+
if (showForm) {
|
|
113
|
+
setLoading(false)
|
|
114
|
+
resetForm()
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function resetForm() {
|
|
122
|
+
setShowForm(false)
|
|
123
|
+
setSubmittedFeedback(true)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
setFeedbackOption("Other")
|
|
128
|
+
}, [positiveFeedback])
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<div className={clsx(className)}>
|
|
132
|
+
{showDottedSeparator && (
|
|
133
|
+
<DottedSeparator
|
|
134
|
+
wrapperClassName="!px-0 !my-docs_2"
|
|
135
|
+
data-testid="dotted-separator"
|
|
136
|
+
/>
|
|
137
|
+
)}
|
|
138
|
+
<SwitchTransition mode="out-in">
|
|
139
|
+
<CSSTransition
|
|
140
|
+
key={
|
|
141
|
+
showForm
|
|
142
|
+
? "show_form"
|
|
143
|
+
: !submittedFeedback
|
|
144
|
+
? "feedback"
|
|
145
|
+
: "submitted_feedback"
|
|
146
|
+
}
|
|
147
|
+
nodeRef={nodeRef}
|
|
148
|
+
timeout={300}
|
|
149
|
+
addEndListener={(done: () => void) => {
|
|
150
|
+
nodeRef.current?.addEventListener("transitionend", done, false)
|
|
151
|
+
}}
|
|
152
|
+
classNames={{
|
|
153
|
+
enter: "animate-fadeIn animation-fill-forwards animate-fast",
|
|
154
|
+
exit: "animate-fadeOut animation-fill-forwards animate-fast",
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
<>
|
|
158
|
+
{!showForm && !submittedFeedback && (
|
|
159
|
+
<div
|
|
160
|
+
className={clsx(
|
|
161
|
+
"flex gap-docs_0.5",
|
|
162
|
+
!vertical && "flex-col md:flex-row md:items-center",
|
|
163
|
+
vertical && "flex-col justify-center"
|
|
164
|
+
)}
|
|
165
|
+
ref={inlineFeedbackRef}
|
|
166
|
+
data-testid="feedback-form"
|
|
167
|
+
>
|
|
168
|
+
<Label
|
|
169
|
+
className={"text-compact-small text-acmekit-fg-base"}
|
|
170
|
+
data-testid="question-label"
|
|
171
|
+
>
|
|
172
|
+
{question}
|
|
173
|
+
</Label>
|
|
174
|
+
<div
|
|
175
|
+
className={clsx(
|
|
176
|
+
"flex gap-docs_0.5",
|
|
177
|
+
"flex-col md:flex-row md:items-center"
|
|
178
|
+
)}
|
|
179
|
+
>
|
|
180
|
+
<Button
|
|
181
|
+
onClick={() => handleFeedback(true)}
|
|
182
|
+
className={clsx(
|
|
183
|
+
"positive gap-[6px] !justify-start md:!justify-center",
|
|
184
|
+
"!px-docs_0.5 !py-docs_0.25 text-left md:text-center"
|
|
185
|
+
)}
|
|
186
|
+
variant="transparent-clear"
|
|
187
|
+
data-testid="positive-button"
|
|
188
|
+
>
|
|
189
|
+
<ThumbUp className="text-acmekit-fg-subtle" />
|
|
190
|
+
<span className="text-acmekit-fg-base text-compact-small-plus flex-1">
|
|
191
|
+
{positiveBtn}
|
|
192
|
+
</span>
|
|
193
|
+
</Button>
|
|
194
|
+
<Button
|
|
195
|
+
onClick={() => handleFeedback(false)}
|
|
196
|
+
className={clsx(
|
|
197
|
+
"gap-[6px] !justify-start md:!justify-center",
|
|
198
|
+
"!px-docs_0.5 !py-docs_0.25 text-left md:text-center"
|
|
199
|
+
)}
|
|
200
|
+
variant="transparent-clear"
|
|
201
|
+
data-testid="negative-button"
|
|
202
|
+
>
|
|
203
|
+
<ThumbDown className="text-acmekit-fg-subtle" />
|
|
204
|
+
<span className="text-acmekit-fg-base text-compact-small-plus flex-1">
|
|
205
|
+
{negativeBtn}
|
|
206
|
+
</span>
|
|
207
|
+
</Button>
|
|
208
|
+
{reportLink && (
|
|
209
|
+
<Button
|
|
210
|
+
variant="transparent-clear"
|
|
211
|
+
className={clsx(
|
|
212
|
+
"gap-[6px] relative",
|
|
213
|
+
"!px-docs_0.5 !py-docs_0.25",
|
|
214
|
+
"!justify-start md:!justify-center",
|
|
215
|
+
"text-left md:text-center"
|
|
216
|
+
)}
|
|
217
|
+
data-testid="report-issue-button"
|
|
218
|
+
>
|
|
219
|
+
<ChatBubbleLeftRight className="text-acmekit-fg-subtle" />
|
|
220
|
+
<span className="text-acmekit-fg-base text-compact-small-plus flex-1">
|
|
221
|
+
Report Issue
|
|
222
|
+
</span>
|
|
223
|
+
<a
|
|
224
|
+
href={reportLink}
|
|
225
|
+
target="_blank"
|
|
226
|
+
rel="noopener noreferrer"
|
|
227
|
+
className="absolute left-0 top-0 w-full h-full"
|
|
228
|
+
></a>
|
|
229
|
+
</Button>
|
|
230
|
+
)}
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
)}
|
|
234
|
+
{showForm && !submittedFeedback && (
|
|
235
|
+
<div className="flex flex-col gap-docs_1" ref={inlineQuestionRef}>
|
|
236
|
+
<Label data-testid="submit-question-label">
|
|
237
|
+
{positiveFeedback ? positiveQuestion : negativeQuestion}
|
|
238
|
+
</Label>
|
|
239
|
+
<RadioGroup className="gap-docs_0.5">
|
|
240
|
+
{feedbackOptions[
|
|
241
|
+
positiveFeedback ? "positive" : "negative"
|
|
242
|
+
].map((option) => (
|
|
243
|
+
<div
|
|
244
|
+
className="flex items-center gap-x-docs_0.5 cursor-pointer group"
|
|
245
|
+
key={option}
|
|
246
|
+
tabIndex={-1}
|
|
247
|
+
onClick={() => setFeedbackOption(option)}
|
|
248
|
+
>
|
|
249
|
+
<RadioItem
|
|
250
|
+
checked={feedbackOption === option}
|
|
251
|
+
value={option}
|
|
252
|
+
onChange={() => setFeedbackOption(option)}
|
|
253
|
+
className={clsx(
|
|
254
|
+
feedbackOption !== option &&
|
|
255
|
+
"group-hover:bg-acmekit-bg-component-hover"
|
|
256
|
+
)}
|
|
257
|
+
data-testid="feedback-option"
|
|
258
|
+
/>
|
|
259
|
+
<Label className="text-acmekit-fg-base text-compact-small-plus">
|
|
260
|
+
{option}
|
|
261
|
+
</Label>
|
|
262
|
+
</div>
|
|
263
|
+
))}
|
|
264
|
+
</RadioGroup>
|
|
265
|
+
<TextArea
|
|
266
|
+
rows={4}
|
|
267
|
+
value={message}
|
|
268
|
+
onChange={(e) => setMessage(e.target.value)}
|
|
269
|
+
placeholder="Please provide as many details as possible to help us improve the documentation."
|
|
270
|
+
/>
|
|
271
|
+
<Button
|
|
272
|
+
onClick={() => submitFeedback(positiveFeedback)}
|
|
273
|
+
disabled={loading}
|
|
274
|
+
className="w-fit"
|
|
275
|
+
variant="secondary"
|
|
276
|
+
data-testid="submit-button"
|
|
277
|
+
>
|
|
278
|
+
{submitBtn}
|
|
279
|
+
</Button>
|
|
280
|
+
</div>
|
|
281
|
+
)}
|
|
282
|
+
{submittedFeedback && (
|
|
283
|
+
<div>
|
|
284
|
+
<div
|
|
285
|
+
className="text-compact-large-plus flex flex-col"
|
|
286
|
+
ref={inlineMessageRef}
|
|
287
|
+
data-testid="submitted-message"
|
|
288
|
+
>
|
|
289
|
+
<span>{submitMessage}</span>
|
|
290
|
+
{showPossibleSolutions && (
|
|
291
|
+
<Solutions message={message} feedback={positiveFeedback} />
|
|
292
|
+
)}
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
)}
|
|
296
|
+
</>
|
|
297
|
+
</CSSTransition>
|
|
298
|
+
</SwitchTransition>
|
|
299
|
+
{showDottedSeparator && (
|
|
300
|
+
<DottedSeparator wrapperClassName="!px-0 !my-docs_2" />
|
|
301
|
+
)}
|
|
302
|
+
</div>
|
|
303
|
+
)
|
|
304
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { Pagination } from "../Pagination"
|
|
3
|
+
|
|
4
|
+
export type FooterProps = {
|
|
5
|
+
editComponent?: React.ReactNode
|
|
6
|
+
showPagination?: boolean
|
|
7
|
+
feedbackComponent?: React.ReactNode
|
|
8
|
+
editDate?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Footer = ({
|
|
12
|
+
editComponent,
|
|
13
|
+
showPagination,
|
|
14
|
+
feedbackComponent,
|
|
15
|
+
}: FooterProps) => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
{feedbackComponent}
|
|
19
|
+
{showPagination && <Pagination />}
|
|
20
|
+
{editComponent}
|
|
21
|
+
</>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import clsx from "clsx"
|
|
2
|
+
import React from "react"
|
|
3
|
+
|
|
4
|
+
export type H1Props = React.HTMLAttributes<HTMLHeadingElement> & {
|
|
5
|
+
id?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const H1 = ({ className, ...props }: H1Props) => {
|
|
9
|
+
return (
|
|
10
|
+
<div className="flex items-start justify-between gap-2 h1-wrapper">
|
|
11
|
+
<h1
|
|
12
|
+
className={clsx(
|
|
13
|
+
"text-h1 [&>code]:!text-h1 [&>code]:!font-mono mb-docs_1 text-acmekit-fg-base",
|
|
14
|
+
props.id && "scroll-m-docs_7",
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
import clsx from "clsx"
|
|
3
|
+
import React from "react"
|
|
4
|
+
import { CopyButton } from "../../../components/CopyButton"
|
|
5
|
+
import { Link } from "../../../components/Link"
|
|
6
|
+
import { useHeadingUrl } from "../../../hooks/use-heading-url"
|
|
7
|
+
import { useLayout } from "../../../providers/Layout"
|
|
8
|
+
|
|
9
|
+
export type H2Props = React.HTMLAttributes<HTMLHeadingElement> & {
|
|
10
|
+
id?: string
|
|
11
|
+
passRef?: React.RefObject<HTMLHeadingElement | null>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const H2 = ({ className, children, passRef, ...props }: H2Props) => {
|
|
15
|
+
const { showCollapsedNavbar } = useLayout()
|
|
16
|
+
|
|
17
|
+
const copyText = useHeadingUrl({
|
|
18
|
+
id: props.id || "",
|
|
19
|
+
})
|
|
20
|
+
return (
|
|
21
|
+
<h2
|
|
22
|
+
className={clsx(
|
|
23
|
+
"text-h2 [&>code]:!text-h2 [&>code]:!font-mono mb-docs_1 mt-docs_2 text-acmekit-fg-base",
|
|
24
|
+
props.id && [
|
|
25
|
+
"group/h2",
|
|
26
|
+
showCollapsedNavbar && "scroll-m-docs_7",
|
|
27
|
+
!showCollapsedNavbar && "scroll-m-56",
|
|
28
|
+
],
|
|
29
|
+
className
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
ref={passRef as any}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
{props.id && (
|
|
36
|
+
<CopyButton
|
|
37
|
+
text={copyText}
|
|
38
|
+
className="opacity-0 group-hover/h2:opacity-100 transition-opacity ml-docs_0.5 inline-block"
|
|
39
|
+
>
|
|
40
|
+
<Link href={`#${props.id}`}>
|
|
41
|
+
#
|
|
42
|
+
</Link>
|
|
43
|
+
</CopyButton>
|
|
44
|
+
)}
|
|
45
|
+
</h2>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
import clsx from "clsx"
|
|
3
|
+
import React from "react"
|
|
4
|
+
import { CopyButton } from "../../../components/CopyButton"
|
|
5
|
+
import { Link } from "../../../components/Link"
|
|
6
|
+
import { useHeadingUrl } from "../../../hooks/use-heading-url"
|
|
7
|
+
import { useLayout } from "../../../providers/Layout"
|
|
8
|
+
|
|
9
|
+
export type H3Props = React.HTMLAttributes<HTMLHeadingElement> & {
|
|
10
|
+
id?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const H3 = ({ className, children, ...props }: H3Props) => {
|
|
14
|
+
const { showCollapsedNavbar } = useLayout()
|
|
15
|
+
const copyText = useHeadingUrl({ id: props.id || "" })
|
|
16
|
+
return (
|
|
17
|
+
<h3
|
|
18
|
+
className={clsx(
|
|
19
|
+
"text-h3 [&>code]:!text-h3 [&>code]:!font-mono my-docs_1 text-acmekit-fg-base",
|
|
20
|
+
props.id && [
|
|
21
|
+
"group/h3",
|
|
22
|
+
showCollapsedNavbar && "scroll-m-docs_7",
|
|
23
|
+
!showCollapsedNavbar && "scroll-m-56",
|
|
24
|
+
],
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
{props.id && (
|
|
31
|
+
<CopyButton
|
|
32
|
+
text={copyText}
|
|
33
|
+
className="opacity-0 group-hover/h3:opacity-100 transition-opacity ml-docs_0.5 inline-block"
|
|
34
|
+
>
|
|
35
|
+
<Link href={`#${props.id}`}>
|
|
36
|
+
#
|
|
37
|
+
</Link>
|
|
38
|
+
</CopyButton>
|
|
39
|
+
)}
|
|
40
|
+
</h3>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import clsx from "clsx"
|
|
2
|
+
import React from "react"
|
|
3
|
+
|
|
4
|
+
export const H4 = ({
|
|
5
|
+
className,
|
|
6
|
+
...props
|
|
7
|
+
}: React.HTMLAttributes<HTMLHeadingElement>) => {
|
|
8
|
+
return (
|
|
9
|
+
<h4
|
|
10
|
+
className={clsx("mb-docs_1 text-acmekit-fg-base text-h4", className)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
type IconHeadlineProps = {
|
|
4
|
+
title: string
|
|
5
|
+
icon: React.ReactNode
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const IconHeadline = ({ title, icon }: IconHeadlineProps) => {
|
|
9
|
+
return (
|
|
10
|
+
<div className="flex gap-docs_0.5 text-acmekit-fg-base">
|
|
11
|
+
{icon}
|
|
12
|
+
<span className="text-small-plus">{title}</span>
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
15
|
+
}
|