@redocly/realm 0.124.2 → 0.124.3
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/CHANGELOG.md +12 -0
- package/dist/client/runtime/generated/browser-plugins.js +12 -0
- package/dist/client/runtime/generated/package.json +1 -0
- package/dist/client/runtime/generated/routes.js +6 -0
- package/dist/client/runtime/generated/templates.js +27 -0
- package/dist/server/esbuild/cache/server/api-request-handlers-entry.js +13 -0
- package/dist/server/esbuild/cache/server/chunks/403-QNUJFFYN.js +21 -0
- package/dist/server/esbuild/cache/server/chunks/403OIDC-XVNN4OKQ.js +20 -0
- package/dist/server/esbuild/cache/server/chunks/404-TJA4JKKM.js +22 -0
- package/dist/server/esbuild/cache/server/chunks/AsyncApiDocs-DO2XADGJ.js +5012 -0
- package/dist/server/esbuild/cache/server/chunks/AsyncApiDocs-LWZY6WLJ.css +228 -0
- package/dist/server/esbuild/cache/server/chunks/CatalogClassic-62FIL6VX.js +27 -0
- package/dist/server/esbuild/cache/server/chunks/CompilationError-3AK7S6GQ.js +28 -0
- package/dist/server/esbuild/cache/server/chunks/ErrorDetails-NOXCZVSO.css +228 -0
- package/dist/server/esbuild/cache/server/chunks/ErrorDetails-Z6XTH26B.js +32 -0
- package/dist/server/esbuild/cache/server/chunks/GraphQLDocs-R7GIPOHX.js +14517 -0
- package/dist/server/esbuild/cache/server/chunks/GraphQLDocs-XWEZKQTJ.css +228 -0
- package/dist/server/esbuild/cache/server/chunks/Invite-JG7HOKGB.js +72 -0
- package/dist/server/esbuild/cache/server/chunks/Markdown-U5QMVBIW.js +90 -0
- package/dist/server/esbuild/cache/server/chunks/OpenAPIDocs-33NUY4VY.js +93 -0
- package/dist/server/esbuild/cache/server/chunks/OpenAPIDocs-QNK5DFJC.css +228 -0
- package/dist/server/esbuild/cache/server/chunks/ar-QYSYPAAE.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/changelog.page-P7J4MWQX.js +9133 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-27G3BZUU.js +6053 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-37VWTTWG.js +112 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-3F23673J.js +63 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-5Q7CA7UT.js +3610 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-5RECXZNE.js +23042 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-5WWZZ3I5.js +148 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-65DJDEU7.js +21923 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-6TWMFDXM.js +50 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-6ZPXNRVV.js +72349 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-72YI47PJ.js +61 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-AOEKZ7MP.js +1653 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-ARMFCOWJ.js +58 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-CEMEM3CC.js +1201 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-CYRM4SZM.js +200 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-CZ4WUWHR.js +145 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-EPDKKVDX.js +49 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-F2FIOV3B.js +3564 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-FN46NAFA.js +880 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-FWP7SBRO.js +40 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-HH6YBD7K.js +39 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-HMCVWUH5.js +21734 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-IPLOR6BM.js +39 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-IU4AXQIQ.js +20 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-OFZF52DH.js +367 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-ORVLLFH3.js +34 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-PLCILU3C.js +189 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-PP5BCTYO.js +481 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-PS2DM6W4.js +233 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-PX5DFLJN.js +6418 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-QD5LMSMC.js +39 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-R2ATFYSQ.js +18 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-RAOSTGG5.js +68 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-RD675JLY.js +63 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-RP4GABLB.js +104 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-TSM7ATHM.js +63 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-UNPSJPQX.js +421 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-UOJU7UCE.js +117 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-VQWN4DGI.js +117 -0
- package/dist/server/esbuild/cache/server/chunks/chunk-ZTN3K75A.js +17085 -0
- package/dist/server/esbuild/cache/server/chunks/de-NFTIOJWS.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/en-MHWJMBVA.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/es-FNU5GYZ3.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/fr-26CHXVGL.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/get-server-props-6AZWGXNL.js +23 -0
- package/dist/server/esbuild/cache/server/chunks/get-server-props-7QLMUENA.js +35 -0
- package/dist/server/esbuild/cache/server/chunks/get-server-props-CBKOAQ63.js +23 -0
- package/dist/server/esbuild/cache/server/chunks/get-server-props-UVJ7E655.js +257 -0
- package/dist/server/esbuild/cache/server/chunks/get-server-props-custom-fields-3L6PMPKS.js +30 -0
- package/dist/server/esbuild/cache/server/chunks/getMachineId-bsd-XBQCAKER.js +41 -0
- package/dist/server/esbuild/cache/server/chunks/getMachineId-darwin-75TDDERU.js +41 -0
- package/dist/server/esbuild/cache/server/chunks/getMachineId-linux-ZVY3HPZF.js +33 -0
- package/dist/server/esbuild/cache/server/chunks/getMachineId-unsupported-Z55ZGKX4.js +24 -0
- package/dist/server/esbuild/cache/server/chunks/getMachineId-win-XFRAFDV7.js +43 -0
- package/dist/server/esbuild/cache/server/chunks/hi-LMIMTEVV.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/it-KQBB6UHC.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/ja-M4G7SWOW.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/ko-UMCYPTNU.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/lib-7OVRXOGN.js +9738 -0
- package/dist/server/esbuild/cache/server/chunks/mock-server-request-handler-EPNUNSB4.js +19760 -0
- package/dist/server/esbuild/cache/server/chunks/openapi-PYAD6YIG.js +211 -0
- package/dist/server/esbuild/cache/server/chunks/openapi-SWJOOCDZ.css +228 -0
- package/dist/server/esbuild/cache/server/chunks/pl-WFS4SBNZ.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/pt-BR-6UMAIW4R.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/pt-H3U3OOD6.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/replay-SG7SV62B.js +44 -0
- package/dist/server/esbuild/cache/server/chunks/replay-tauri-path-CUezwea2-PVNYM2NO.js +51 -0
- package/dist/server/esbuild/cache/server/chunks/ru-XWABYCCX.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/schema-OQNNVD4I.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/spec-download.api-224C7JPA.js +2678 -0
- package/dist/server/esbuild/cache/server/chunks/spec-download.api-456PUG54.js +36 -0
- package/dist/server/esbuild/cache/server/chunks/template-NMUEV3UV.css +228 -0
- package/dist/server/esbuild/cache/server/chunks/template-TMZOF26J.js +6490 -0
- package/dist/server/esbuild/cache/server/chunks/uk-SANI42KH.js +9 -0
- package/dist/server/esbuild/cache/server/chunks/zh-FC3S2NSG.js +9 -0
- package/dist/server/esbuild/cache/server/middleware-entry.js +9 -0
- package/dist/server/esbuild/cache/server/migrations/catalog-sqlite/0000_initial_migration.sql +46 -0
- package/dist/server/esbuild/cache/server/migrations/catalog-sqlite/meta/0000_snapshot.json +307 -0
- package/dist/server/esbuild/cache/server/migrations/catalog-sqlite/meta/_journal.json +13 -0
- package/dist/server/esbuild/cache/server/migrations/main-sqlite/0000_initial_migration.sql +11 -0
- package/dist/server/esbuild/cache/server/migrations/main-sqlite/meta/0000_snapshot.json +82 -0
- package/dist/server/esbuild/cache/server/migrations/main-sqlite/meta/_journal.json +13 -0
- package/dist/server/esbuild/cache/server/package.json +1 -0
- package/dist/server/esbuild/cache/server/server-entry.css +294 -0
- package/dist/server/esbuild/cache/server/server-entry.js +1716 -0
- package/dist/server/esbuild/cache/server/server-props-entry.js +15 -0
- package/dist/server/esbuild/cache/server/user-tags-entry.js +9 -0
- package/package.json +5 -5
|
@@ -0,0 +1,1201 @@
|
|
|
1
|
+
import { createRequire as topLevelCreateRequire } from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
init_hooks,
|
|
5
|
+
useActiveHeading,
|
|
6
|
+
useFullHeight,
|
|
7
|
+
useOutsideClick,
|
|
8
|
+
useThemeConfig,
|
|
9
|
+
useThemeHooks
|
|
10
|
+
} from "./chunk-F2FIOV3B.js";
|
|
11
|
+
import {
|
|
12
|
+
Button,
|
|
13
|
+
init_Button
|
|
14
|
+
} from "./chunk-5WWZZ3I5.js";
|
|
15
|
+
import {
|
|
16
|
+
DEFAULT_FEEDBACK_TYPE,
|
|
17
|
+
Ne,
|
|
18
|
+
breakpoints,
|
|
19
|
+
getCssColorVariable,
|
|
20
|
+
getDisplayedHeadings,
|
|
21
|
+
getLeastDepth,
|
|
22
|
+
init_constants,
|
|
23
|
+
init_styled_components_esm,
|
|
24
|
+
init_utils,
|
|
25
|
+
styled_components_esm_default
|
|
26
|
+
} from "./chunk-27G3BZUU.js";
|
|
27
|
+
import {
|
|
28
|
+
__esm
|
|
29
|
+
} from "./chunk-6TWMFDXM.js";
|
|
30
|
+
|
|
31
|
+
// ../../packages/theme/src/components/TableOfContent/TableOfContent.tsx
|
|
32
|
+
import * as React from "react";
|
|
33
|
+
function TableOfContent(props) {
|
|
34
|
+
const {
|
|
35
|
+
headings,
|
|
36
|
+
contentWrapper,
|
|
37
|
+
className
|
|
38
|
+
} = props;
|
|
39
|
+
const {
|
|
40
|
+
useTranslate,
|
|
41
|
+
useTelemetry
|
|
42
|
+
} = useThemeHooks();
|
|
43
|
+
const {
|
|
44
|
+
translate
|
|
45
|
+
} = useTranslate();
|
|
46
|
+
const telemetry = useTelemetry();
|
|
47
|
+
const sidebar = React.useRef(null);
|
|
48
|
+
useFullHeight(sidebar);
|
|
49
|
+
const {
|
|
50
|
+
markdown: {
|
|
51
|
+
toc = {}
|
|
52
|
+
} = {}
|
|
53
|
+
} = useThemeConfig();
|
|
54
|
+
const displayedHeadings = getDisplayedHeadings(headings, toc.depth || 3);
|
|
55
|
+
const leastDepth = getLeastDepth(displayedHeadings);
|
|
56
|
+
const {
|
|
57
|
+
heading: activeHeading,
|
|
58
|
+
handleHeadingClick
|
|
59
|
+
} = useActiveHeading(contentWrapper, displayedHeadings);
|
|
60
|
+
if (toc?.hide) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return /* @__PURE__ */ React.createElement(TableOfContentMenu, { "data-component-name": "TableOfContent/TableOfContent", className }, /* @__PURE__ */ React.createElement(TableOfContentItems, { ref: sidebar }, displayedHeadings.length ? /* @__PURE__ */ React.createElement(TableOfContentHeader, { "data-translation-key": "toc.header" }, translate("toc.header", toc.header || "On this page")) : null, displayedHeadings.map((heading, idx) => {
|
|
64
|
+
if (!heading) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const href = "#" + heading.id;
|
|
68
|
+
return /* @__PURE__ */ React.createElement(TableOfContentMenuItem, { key: href + idx, href, depth: heading.depth - leastDepth + 1 || 0, className: activeHeading === heading.id ? "active" : "", dangerouslySetInnerHTML: {
|
|
69
|
+
__html: heading.value || ""
|
|
70
|
+
}, "data-testid": `toc-${heading.value}`, onClick: (e) => {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
telemetry.send({
|
|
73
|
+
type: "toc_item.clicked"
|
|
74
|
+
});
|
|
75
|
+
handleHeadingClick(heading.id);
|
|
76
|
+
} });
|
|
77
|
+
})));
|
|
78
|
+
}
|
|
79
|
+
var TableOfContentMenu, TableOfContentHeader, TableOfContentItems, TableOfContentMenuItem;
|
|
80
|
+
var init_TableOfContent = __esm({
|
|
81
|
+
"../../packages/theme/src/components/TableOfContent/TableOfContent.tsx"() {
|
|
82
|
+
init_styled_components_esm();
|
|
83
|
+
init_hooks();
|
|
84
|
+
init_utils();
|
|
85
|
+
TableOfContentMenu = styled_components_esm_default.aside.withConfig({
|
|
86
|
+
displayName: "TableOfContent__TableOfContentMenu",
|
|
87
|
+
componentId: "sc-kstbuq-0"
|
|
88
|
+
})(["background-color:var(--toc-bg-color);flex-shrink:0;display:none !important;@media screen and (min-width:", "){width:var(--toc-width);display:block !important;}"], breakpoints.medium);
|
|
89
|
+
TableOfContentHeader = styled_components_esm_default.div.withConfig({
|
|
90
|
+
displayName: "TableOfContent__TableOfContentHeader",
|
|
91
|
+
componentId: "sc-kstbuq-1"
|
|
92
|
+
})(["font-family:var(--toc-heading-font-family);font-size:var(--toc-heading-font-size);font-weight:var(--toc-heading-font-weight);padding:var(--toc-item-padding-vertical) var(--toc-item-padding-horizontal);color:var(--toc-heading-text-color);text-transform:var(--toc-heading-text-transform);line-height:var(--toc-heading-line-height);"]);
|
|
93
|
+
TableOfContentItems = styled_components_esm_default.div.withConfig({
|
|
94
|
+
displayName: "TableOfContent__TableOfContentItems",
|
|
95
|
+
componentId: "sc-kstbuq-2"
|
|
96
|
+
})(["position:sticky;top:calc(var(--navbar-height) + var(--toc-offset-top));max-height:calc(100vh - var(--navbar-height) - var(--toc-offset-top));overflow-y:auto;width:var(--toc-width);border-left:solid 1px var(--toc-border-color);"]);
|
|
97
|
+
TableOfContentMenuItem = styled_components_esm_default.a.withConfig({
|
|
98
|
+
displayName: "TableOfContent__TableOfContentMenuItem",
|
|
99
|
+
componentId: "sc-kstbuq-3"
|
|
100
|
+
})(["display:block;color:var(--toc-item-text-color);font-weight:var(--toc-item-font-weight);background-color:var(--toc-item-bg-color);cursor:pointer;font-size:var(--toc-item-font-size);padding:var(--toc-item-padding-vertical) var(--toc-item-padding-horizontal);padding-left:calc(var(--toc-item-nested-offset) * ", ");transition:background-color 0.3s,color 0.3s;text-decoration:none;word-break:break-word;font-family:var(--heading-font-family,var(--toc-item-font-family));line-height:var(--toc-item-line-height);border-left:solid 2px transparent;:hover{color:var(--toc-item-text-color-active);}&.active{color:var(--toc-item-text-color-active);border-left:solid 2px var(--toc-item-border-color-active);}:empty{padding:0;}"], ({
|
|
101
|
+
depth
|
|
102
|
+
}) => depth);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// ../../packages/theme/src/components/Feedback/Reasons.tsx
|
|
107
|
+
import * as React2 from "react";
|
|
108
|
+
function Reasons({
|
|
109
|
+
settings,
|
|
110
|
+
onChange,
|
|
111
|
+
className
|
|
112
|
+
}) {
|
|
113
|
+
const {
|
|
114
|
+
label,
|
|
115
|
+
component,
|
|
116
|
+
items = []
|
|
117
|
+
} = settings;
|
|
118
|
+
const [checkedState, setCheckedState] = React2.useState(new Array(items.length).fill(false));
|
|
119
|
+
const {
|
|
120
|
+
useTranslate
|
|
121
|
+
} = useThemeHooks();
|
|
122
|
+
const {
|
|
123
|
+
translate
|
|
124
|
+
} = useTranslate();
|
|
125
|
+
if (!items.length) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
const input_type = component || "checkbox";
|
|
129
|
+
const handleOptionChange = (position) => {
|
|
130
|
+
const updatedCheckedState = component === "checkbox" ? checkedState.map((item, index) => index === position ? !item : item) : items.map((_, idx) => position === idx);
|
|
131
|
+
setCheckedState(updatedCheckedState);
|
|
132
|
+
onChange(items.filter((_, index) => !!updatedCheckedState[index]));
|
|
133
|
+
};
|
|
134
|
+
return /* @__PURE__ */ React2.createElement(ReasonsWrapper, { "data-component-name": "Feedback/Reasons", "data-translation-key": "feedback.settings.reasons.label", className }, /* @__PURE__ */ React2.createElement(Label, null, label || translate("feedback.settings.reasons.label", "Which statement describes your thoughts about this page?")), items.map((reason, idx) => /* @__PURE__ */ React2.createElement(OptionWrapper, { key: reason }, /* @__PURE__ */ React2.createElement("input", { type: input_type, value: reason, checked: checkedState[idx], name: "reasons", onChange: () => handleOptionChange(idx) }), /* @__PURE__ */ React2.createElement("label", { "data-translation-key": `feedback.settings.reasons.items.${idx + 1}`, id: reason, onClick: () => handleOptionChange(idx) }, translate(`feedback.settings.reasons.items.${idx + 1}`, reason)))));
|
|
135
|
+
}
|
|
136
|
+
var ReasonsWrapper, Label, OptionWrapper;
|
|
137
|
+
var init_Reasons = __esm({
|
|
138
|
+
"../../packages/theme/src/components/Feedback/Reasons.tsx"() {
|
|
139
|
+
init_styled_components_esm();
|
|
140
|
+
init_hooks();
|
|
141
|
+
ReasonsWrapper = styled_components_esm_default.div.withConfig({
|
|
142
|
+
displayName: "Reasons__ReasonsWrapper",
|
|
143
|
+
componentId: "sc-clbfy6-0"
|
|
144
|
+
})(["font-family:var(--feedback-font-family);display:flex;flex-direction:column;"]);
|
|
145
|
+
Label = styled_components_esm_default.h4.withConfig({
|
|
146
|
+
displayName: "Reasons__Label",
|
|
147
|
+
componentId: "sc-clbfy6-1"
|
|
148
|
+
})(["font-family:var(--feedback-font-family);font-weight:var(--font-weight-regular);font-size:var(--feedback-font-size);line-height:var(--feedback-header-line-height);color:var(--feedback-header-text-color);margin:0;"]);
|
|
149
|
+
OptionWrapper = styled_components_esm_default.div.withConfig({
|
|
150
|
+
displayName: "Reasons__OptionWrapper",
|
|
151
|
+
componentId: "sc-clbfy6-2"
|
|
152
|
+
})(["margin:5px 0;display:flex;input{margin-right:10px;cursor:pointer;}label{font-size:var(--feedback-font-size);cursor:pointer;}"]);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// ../../packages/theme/src/icons/RadioCheckButtonIcon/RadioCheckButtonIcon.tsx
|
|
157
|
+
import React3 from "react";
|
|
158
|
+
var Icon, RadioCheckButtonIcon;
|
|
159
|
+
var init_RadioCheckButtonIcon = __esm({
|
|
160
|
+
"../../packages/theme/src/icons/RadioCheckButtonIcon/RadioCheckButtonIcon.tsx"() {
|
|
161
|
+
init_styled_components_esm();
|
|
162
|
+
Icon = () => /* @__PURE__ */ React3.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React3.createElement("rect", { width: "16", height: "16", fill: "none" }), /* @__PURE__ */ React3.createElement("path", { d: "M8 1C6.61553 1 5.26216 1.41054 4.11101 2.17971C2.95987 2.94888 2.06266 4.04213 1.53285 5.32122C1.00303 6.6003 0.86441 8.00776 1.13451 9.36563C1.4046 10.7235 2.07129 11.9708 3.05026 12.9497C4.02922 13.9287 5.2765 14.5954 6.63437 14.8655C7.99224 15.1356 9.3997 14.997 10.6788 14.4672C11.9579 13.9373 13.0511 13.0401 13.8203 11.889C14.5895 10.7378 15 9.38447 15 8C15 6.14348 14.2625 4.36301 12.9497 3.05025C11.637 1.7375 9.85652 1 8 1ZM8 14C6.81332 14 5.65328 13.6481 4.66658 12.9888C3.67989 12.3295 2.91085 11.3925 2.45673 10.2961C2.0026 9.19974 1.88378 7.99334 2.11529 6.82946C2.3468 5.66557 2.91825 4.59647 3.75736 3.75736C4.59648 2.91824 5.66558 2.3468 6.82946 2.11529C7.99335 1.88378 9.19975 2.0026 10.2961 2.45672C11.3925 2.91085 12.3295 3.67988 12.9888 4.66658C13.6481 5.65327 14 6.81331 14 8C14 9.5913 13.3679 11.1174 12.2426 12.2426C11.1174 13.3679 9.5913 14 8 14Z", fill: "currentColor" }), /* @__PURE__ */ React3.createElement("path", { d: "M7 10.625L4.5 8.145L5.295 7.375L7 9.05L10.705 5.375L11.5 6.165L7 10.625Z", fill: "currentColor" }));
|
|
163
|
+
RadioCheckButtonIcon = styled_components_esm_default(Icon).attrs(() => ({
|
|
164
|
+
"data-component-name": "icons/RadioCheckButtonIcon/RadioCheckButtonIcon"
|
|
165
|
+
})).withConfig({
|
|
166
|
+
displayName: "RadioCheckButtonIcon",
|
|
167
|
+
componentId: "sc-qjq9kc-0"
|
|
168
|
+
})([""]);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// ../../packages/theme/src/components/Feedback/Comment.tsx
|
|
173
|
+
import React4, { useRef as useRef2 } from "react";
|
|
174
|
+
function Comment({
|
|
175
|
+
settings,
|
|
176
|
+
onSubmit,
|
|
177
|
+
onCancel,
|
|
178
|
+
className,
|
|
179
|
+
standAlone = true,
|
|
180
|
+
isDialog = false
|
|
181
|
+
}) {
|
|
182
|
+
const {
|
|
183
|
+
useTranslate
|
|
184
|
+
} = useThemeHooks();
|
|
185
|
+
const {
|
|
186
|
+
translate
|
|
187
|
+
} = useTranslate();
|
|
188
|
+
const {
|
|
189
|
+
label,
|
|
190
|
+
submitText
|
|
191
|
+
} = settings || {};
|
|
192
|
+
const [text, setText] = React4.useState("");
|
|
193
|
+
const [submitValue, setSubmitValue] = React4.useState("");
|
|
194
|
+
const modalRef = useRef2(null);
|
|
195
|
+
useOutsideClick(modalRef, onCancel);
|
|
196
|
+
const send = () => {
|
|
197
|
+
if (!text) return;
|
|
198
|
+
setSubmitValue(text);
|
|
199
|
+
onSubmit({
|
|
200
|
+
comment: text
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
const handleTextAreaChange = (e) => {
|
|
204
|
+
const commentValue = e.target.value;
|
|
205
|
+
setText(commentValue);
|
|
206
|
+
if (!standAlone) {
|
|
207
|
+
onSubmit({
|
|
208
|
+
comment: commentValue
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
if (submitValue) {
|
|
213
|
+
return /* @__PURE__ */ React4.createElement(StateWrapper, { "data-component-name": "Feedback/Comment", className }, /* @__PURE__ */ React4.createElement(StyledFormMandatoryFields, null, /* @__PURE__ */ React4.createElement(Label2, { "data-translation-key": "feedback.settings.comment.submitText", standAlone }, submitText || translate("feedback.settings.comment.submitText", "Thank you for helping improve our documentation!")), /* @__PURE__ */ React4.createElement(RadioCheckButtonIcon, null)));
|
|
214
|
+
}
|
|
215
|
+
return /* @__PURE__ */ React4.createElement(CommentWrapper, { ref: modalRef, "data-component-name": "Feedback/Comment", className, style: standAlone ? {
|
|
216
|
+
width: "var(--feedback-report-dialog-width)"
|
|
217
|
+
} : {
|
|
218
|
+
width: "auto"
|
|
219
|
+
} }, /* @__PURE__ */ React4.createElement(Label2, { "data-translation-key": "feedback.settings.comment.label", standAlone }, label || translate("feedback.settings.comment.label", "Please share your feedback with us.")), /* @__PURE__ */ React4.createElement(TextArea, { rows: 3, onChange: handleTextAreaChange }), standAlone && /* @__PURE__ */ React4.createElement(ButtonsContainer, null, onCancel && /* @__PURE__ */ React4.createElement(Button, { "data-translation-key": "feedback.settings.comment.cancel", onClick: onCancel, variant: "text", size: "small" }, translate("feedback.settings.comment.cancel", "Cancel")), /* @__PURE__ */ React4.createElement(Button, { "data-translation-key": "feedback.settings.comment.send", onClick: send, variant: isDialog ? "primary" : "secondary", size: "small" }, translate("feedback.settings.comment.send", "Send"))));
|
|
220
|
+
}
|
|
221
|
+
var StyledFormMandatoryFields, CommentWrapper, StateWrapper, Label2, TextArea, ButtonsContainer;
|
|
222
|
+
var init_Comment = __esm({
|
|
223
|
+
"../../packages/theme/src/components/Feedback/Comment.tsx"() {
|
|
224
|
+
init_styled_components_esm();
|
|
225
|
+
init_hooks();
|
|
226
|
+
init_RadioCheckButtonIcon();
|
|
227
|
+
init_Button();
|
|
228
|
+
StyledFormMandatoryFields = styled_components_esm_default.div.withConfig({
|
|
229
|
+
displayName: "Comment__StyledFormMandatoryFields",
|
|
230
|
+
componentId: "sc-lbdj57-0"
|
|
231
|
+
})(["display:flex;justify-content:space-between;align-items:center;gap:var(--spacing-xs);> svg{margin:var(--button-icon-padding) 0;}"]);
|
|
232
|
+
CommentWrapper = styled_components_esm_default.div.withConfig({
|
|
233
|
+
displayName: "Comment__CommentWrapper",
|
|
234
|
+
componentId: "sc-lbdj57-1"
|
|
235
|
+
})(["font-family:var(--font-family-base);display:flex;flex-direction:column;justify-content:space-between;border-radius:var(--border-radius-lg);background:var(--feedback-bg-color);gap:var(--spacing-xxs);max-width:var(--feedback-report-dialog-max-width);"]);
|
|
236
|
+
StateWrapper = styled_components_esm_default(CommentWrapper).withConfig({
|
|
237
|
+
displayName: "Comment__StateWrapper",
|
|
238
|
+
componentId: "sc-lbdj57-2"
|
|
239
|
+
})(["flex-direction:row;align-items:center;gap:var(--spacing-xxs);"]);
|
|
240
|
+
Label2 = styled_components_esm_default.h4.withConfig({
|
|
241
|
+
displayName: "Comment__Label",
|
|
242
|
+
componentId: "sc-lbdj57-3"
|
|
243
|
+
})(["font-weight:var(--font-weight-regular);font-size:var(--feedback-font-size);line-height:var(--feedback-line-height);", " margin:0;"], ({
|
|
244
|
+
standAlone
|
|
245
|
+
}) => standAlone && Ne(["font-size:var(--feedback-header-font-size);line-height:var(--feedback-header-line-height);"]));
|
|
246
|
+
TextArea = styled_components_esm_default.textarea.withConfig({
|
|
247
|
+
displayName: "Comment__TextArea",
|
|
248
|
+
componentId: "sc-lbdj57-4"
|
|
249
|
+
})(["background-color:var(--bg-color);border-radius:var(--border-radius-lg);border:var(--input-border);outline:none;color:var(--feedback-text-color);font-family:var(--feedback-font-family);padding:10px;min-height:calc(var(--line-height-base) * 3 + 20px);min-width:var(--feedback-comment-min-width);max-width:var(--feedback-comment-max-width);resize:vertical;"]);
|
|
250
|
+
ButtonsContainer = styled_components_esm_default.div.withConfig({
|
|
251
|
+
displayName: "Comment__ButtonsContainer",
|
|
252
|
+
componentId: "sc-lbdj57-5"
|
|
253
|
+
})(["display:flex;justify-content:end;margin-bottom:var(--spacing-xxs);margin-top:var(--spacing-xs);gap:var(--spacing-xs);"]);
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
// ../../packages/theme/src/icons/StarIcon/StarIcon.tsx
|
|
258
|
+
import React5 from "react";
|
|
259
|
+
var Icon2, StarIcon;
|
|
260
|
+
var init_StarIcon = __esm({
|
|
261
|
+
"../../packages/theme/src/icons/StarIcon/StarIcon.tsx"() {
|
|
262
|
+
init_styled_components_esm();
|
|
263
|
+
init_utils();
|
|
264
|
+
Icon2 = (props) => /* @__PURE__ */ React5.createElement("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React5.createElement("path", { d: "M8.00001 3.26L9.38001 6.05L9.61001 6.55L10.11 6.625L13.19 7.07L11 9.22L10.625 9.585L10.715 10.085L11.24 13.15L8.48501 11.705L8.00001 11.5L7.53501 11.745L4.78001 13.17L5.28001 10.105L5.37001 9.605L5.00001 9.22L2.79001 7.045L5.87001 6.6L6.37001 6.525L6.60001 6.025L8.00001 3.26ZM8.00001 1L5.72501 5.61L0.640015 6.345L4.32001 9.935L3.45001 15L8.00001 12.61L12.55 15L11.68 9.935L15.36 6.35L10.275 5.61L8.00001 1Z" }));
|
|
265
|
+
StarIcon = styled_components_esm_default(Icon2).attrs(() => ({
|
|
266
|
+
"data-component-name": "icons/StarIcon/StarIcon"
|
|
267
|
+
})).withConfig({
|
|
268
|
+
displayName: "StarIcon",
|
|
269
|
+
componentId: "sc-1ddrqba-0"
|
|
270
|
+
})(["path{fill:", ";}height:", ";width:", ";"], ({
|
|
271
|
+
color
|
|
272
|
+
}) => getCssColorVariable(color), ({
|
|
273
|
+
size
|
|
274
|
+
}) => size || "16px", ({
|
|
275
|
+
size
|
|
276
|
+
}) => size || "16px");
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
// ../../packages/theme/src/icons/StarFilledIcon/StarFilledIcon.tsx
|
|
281
|
+
import React6 from "react";
|
|
282
|
+
var Icon3, StarFilledIcon;
|
|
283
|
+
var init_StarFilledIcon = __esm({
|
|
284
|
+
"../../packages/theme/src/icons/StarFilledIcon/StarFilledIcon.tsx"() {
|
|
285
|
+
init_styled_components_esm();
|
|
286
|
+
init_utils();
|
|
287
|
+
Icon3 = (props) => /* @__PURE__ */ React6.createElement("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React6.createElement("path", { d: "M8.00001 1L5.72501 5.61L0.640015 6.345L4.32001 9.935L3.45001 15L8.00001 12.61L12.55 15L11.68 9.935L15.36 6.35L10.275 5.61L8.00001 1Z" }));
|
|
288
|
+
StarFilledIcon = styled_components_esm_default(Icon3).attrs(() => ({
|
|
289
|
+
"data-component-name": "icons/StarFilledIcon/StarFilledIcon"
|
|
290
|
+
})).withConfig({
|
|
291
|
+
displayName: "StarFilledIcon",
|
|
292
|
+
componentId: "sc-1n1f60x-0"
|
|
293
|
+
})(["path{fill:", ";}height:", ";width:", ";"], ({
|
|
294
|
+
color
|
|
295
|
+
}) => getCssColorVariable(color), ({
|
|
296
|
+
size
|
|
297
|
+
}) => size || "16px", ({
|
|
298
|
+
size
|
|
299
|
+
}) => size || "16px");
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// ../../packages/theme/src/components/Feedback/Stars.tsx
|
|
304
|
+
import * as React7 from "react";
|
|
305
|
+
function Stars({
|
|
306
|
+
max = 5,
|
|
307
|
+
onChange,
|
|
308
|
+
value
|
|
309
|
+
}) {
|
|
310
|
+
const [hovered, setHovered] = React7.useState(value || 0);
|
|
311
|
+
const stars = [];
|
|
312
|
+
for (let index = 1; index <= max; index++) {
|
|
313
|
+
stars.push(/* @__PURE__ */ React7.createElement(Star, { "data-testid": `star-${index}`, key: index, onClick: () => onChange(index), onMouseOver: () => setHovered(index), onMouseLeave: () => !value && setHovered(0) }, hovered < index ? /* @__PURE__ */ React7.createElement(StarIcon, { color: "var(--feedback-star-color)" }) : /* @__PURE__ */ React7.createElement(StarFilledIcon, { color: "var(--feedback-star-color)" })));
|
|
314
|
+
}
|
|
315
|
+
return /* @__PURE__ */ React7.createElement(StarsWrapper, { "data-component-name": "Feedback/Stars" }, stars);
|
|
316
|
+
}
|
|
317
|
+
var StarsWrapper, Star;
|
|
318
|
+
var init_Stars = __esm({
|
|
319
|
+
"../../packages/theme/src/components/Feedback/Stars.tsx"() {
|
|
320
|
+
init_styled_components_esm();
|
|
321
|
+
init_StarIcon();
|
|
322
|
+
init_StarFilledIcon();
|
|
323
|
+
StarsWrapper = styled_components_esm_default.div.withConfig({
|
|
324
|
+
displayName: "Stars__StarsWrapper",
|
|
325
|
+
componentId: "sc-7enpoj-0"
|
|
326
|
+
})(["display:flex;gap:var(--spacing-xs);flex-direction:row;align-items:center;"]);
|
|
327
|
+
Star = styled_components_esm_default.button.attrs(() => ({
|
|
328
|
+
type: "button"
|
|
329
|
+
})).withConfig({
|
|
330
|
+
displayName: "Stars__Star",
|
|
331
|
+
componentId: "sc-7enpoj-1"
|
|
332
|
+
})(["cursor:pointer;padding:0;border:none;background-color:transparent;height:16px;gap:var(--spacing-xs);"]);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
// ../../packages/theme/src/components/Feedback/Rating.tsx
|
|
337
|
+
import * as React8 from "react";
|
|
338
|
+
import { useEffect } from "react";
|
|
339
|
+
function Rating({
|
|
340
|
+
settings,
|
|
341
|
+
onSubmit,
|
|
342
|
+
className
|
|
343
|
+
}) {
|
|
344
|
+
const {
|
|
345
|
+
label,
|
|
346
|
+
submitText,
|
|
347
|
+
comment: commentSettings,
|
|
348
|
+
reasons: reasonsSettings,
|
|
349
|
+
optionalEmail: optionalEmailSettings
|
|
350
|
+
} = settings || {};
|
|
351
|
+
const [isSubmitted, setIsSubmitted] = React8.useState(false);
|
|
352
|
+
const [score, setScore] = React8.useState(0);
|
|
353
|
+
const [reasons, setReasons] = React8.useState([]);
|
|
354
|
+
const [comment, setComment] = React8.useState("");
|
|
355
|
+
const [email, setEmail] = React8.useState();
|
|
356
|
+
const {
|
|
357
|
+
useTranslate,
|
|
358
|
+
useUserMenu
|
|
359
|
+
} = useThemeHooks();
|
|
360
|
+
const {
|
|
361
|
+
userData
|
|
362
|
+
} = useUserMenu();
|
|
363
|
+
const {
|
|
364
|
+
translate
|
|
365
|
+
} = useTranslate();
|
|
366
|
+
const onEmailChange = (e) => {
|
|
367
|
+
const value = e.target.value;
|
|
368
|
+
setEmail(value || void 0);
|
|
369
|
+
};
|
|
370
|
+
const onSubmitRatingForm = () => {
|
|
371
|
+
onSubmit({
|
|
372
|
+
score,
|
|
373
|
+
comment,
|
|
374
|
+
reasons,
|
|
375
|
+
max: FEEDBACK_MAX_RATING,
|
|
376
|
+
email
|
|
377
|
+
});
|
|
378
|
+
setIsSubmitted(true);
|
|
379
|
+
};
|
|
380
|
+
const onCancelRatingForm = () => {
|
|
381
|
+
setScore(0);
|
|
382
|
+
setComment("");
|
|
383
|
+
setReasons([]);
|
|
384
|
+
setEmail(void 0);
|
|
385
|
+
};
|
|
386
|
+
const displayReasons = !!(score && reasonsSettings && !reasonsSettings.hide);
|
|
387
|
+
const displayComment = !!(score && !commentSettings?.hide);
|
|
388
|
+
const displaySubmitBnt = !!(score && (displayReasons || displayComment));
|
|
389
|
+
const displayFeedbackEmail = !!score && !optionalEmailSettings?.hide && !userData.isAuthenticated;
|
|
390
|
+
useEffect(() => {
|
|
391
|
+
if (score && !displayComment && !displayReasons && !displayFeedbackEmail) {
|
|
392
|
+
onSubmitRatingForm();
|
|
393
|
+
}
|
|
394
|
+
}, [score, displayComment, displayReasons, displayFeedbackEmail]);
|
|
395
|
+
if (isSubmitted) {
|
|
396
|
+
return /* @__PURE__ */ React8.createElement(RatingWrapper, { "data-component-name": "Feedback/Rating" }, /* @__PURE__ */ React8.createElement(StyledFormMandatoryFields2, null, /* @__PURE__ */ React8.createElement(Label3, { "data-translation-key": "feedback.settings.submitText" }, submitText || translate("feedback.settings.submitText", "Thank you for helping improve our documentation!")), /* @__PURE__ */ React8.createElement(RadioCheckButtonIcon, null)));
|
|
397
|
+
}
|
|
398
|
+
return /* @__PURE__ */ React8.createElement(RatingWrapper, { "data-component-name": "Feedback/Rating", className }, /* @__PURE__ */ React8.createElement(StyledForm, null, /* @__PURE__ */ React8.createElement(StyledFormMandatoryFields2, null, /* @__PURE__ */ React8.createElement(Label3, { "data-translation-key": "feedback.settings.label" }, label || translate("feedback.settings.label", "Was this helpful?")), /* @__PURE__ */ React8.createElement(StyledMandatoryFieldContainer, null, /* @__PURE__ */ React8.createElement(Stars, { max: FEEDBACK_MAX_RATING, onChange: setScore, value: score }))), (displayReasons || displayComment) && /* @__PURE__ */ React8.createElement(StyledFormOptionalFields, null, displayReasons && /* @__PURE__ */ React8.createElement(Reasons, { settings: {
|
|
399
|
+
label: reasonsSettings?.label,
|
|
400
|
+
items: reasonsSettings?.items || [],
|
|
401
|
+
component: reasonsSettings?.component
|
|
402
|
+
}, onChange: setReasons }), displayComment && /* @__PURE__ */ React8.createElement(Comment, { standAlone: false, onSubmit: ({
|
|
403
|
+
comment: comment2
|
|
404
|
+
}) => setComment(comment2), settings: {
|
|
405
|
+
label: commentSettings?.label || translate("feedback.settings.comment.label", "Please share your feedback with us.")
|
|
406
|
+
} })), displayFeedbackEmail && /* @__PURE__ */ React8.createElement(StyledFormOptionalFields, null, /* @__PURE__ */ React8.createElement(InputLabel, { "data-translation-key": "feedback.settings.optionalEmail.label" }, optionalEmailSettings?.label || translate("feedback.settings.optionalEmail.label", "Your email (optional, for follow-up)")), /* @__PURE__ */ React8.createElement(EmailInput, { onChange: onEmailChange, placeholder: optionalEmailSettings?.placeholder || translate("feedback.settings.optionalEmail.placeholder", "yourname@example.com"), type: "email", required: !!email, onKeyDown: (e) => {
|
|
407
|
+
if (e.key === "Enter") {
|
|
408
|
+
e.preventDefault();
|
|
409
|
+
onSubmitRatingForm();
|
|
410
|
+
}
|
|
411
|
+
} })), displaySubmitBnt && /* @__PURE__ */ React8.createElement(ButtonsContainer2, null, /* @__PURE__ */ React8.createElement(Button, { onClick: onCancelRatingForm, variant: "text", size: "small" }, "Cancel"), /* @__PURE__ */ React8.createElement(Button, { onClick: onSubmitRatingForm, variant: "secondary", size: "small" }, "Submit"))));
|
|
412
|
+
}
|
|
413
|
+
var FEEDBACK_MAX_RATING, StyledForm, StyledFormOptionalFields, StyledFormMandatoryFields2, StyledMandatoryFieldContainer, RatingWrapper, Label3, InputLabel, ButtonsContainer2, EmailInput;
|
|
414
|
+
var init_Rating = __esm({
|
|
415
|
+
"../../packages/theme/src/components/Feedback/Rating.tsx"() {
|
|
416
|
+
init_styled_components_esm();
|
|
417
|
+
init_Reasons();
|
|
418
|
+
init_hooks();
|
|
419
|
+
init_RadioCheckButtonIcon();
|
|
420
|
+
init_Comment();
|
|
421
|
+
init_Stars();
|
|
422
|
+
init_Button();
|
|
423
|
+
FEEDBACK_MAX_RATING = 5;
|
|
424
|
+
StyledForm = styled_components_esm_default.form.withConfig({
|
|
425
|
+
displayName: "Rating__StyledForm",
|
|
426
|
+
componentId: "sc-l0bg02-0"
|
|
427
|
+
})(["width:100%;gap:var(--spacing-sm);display:flex;flex-direction:column;"]);
|
|
428
|
+
StyledFormOptionalFields = styled_components_esm_default.div.withConfig({
|
|
429
|
+
displayName: "Rating__StyledFormOptionalFields",
|
|
430
|
+
componentId: "sc-l0bg02-1"
|
|
431
|
+
})(["display:flex;flex-flow:column;"]);
|
|
432
|
+
StyledFormMandatoryFields2 = styled_components_esm_default.div.withConfig({
|
|
433
|
+
displayName: "Rating__StyledFormMandatoryFields",
|
|
434
|
+
componentId: "sc-l0bg02-2"
|
|
435
|
+
})(["display:flex;justify-content:space-between;align-items:center;gap:var(--spacing-xs);"]);
|
|
436
|
+
StyledMandatoryFieldContainer = styled_components_esm_default.div.withConfig({
|
|
437
|
+
displayName: "Rating__StyledMandatoryFieldContainer",
|
|
438
|
+
componentId: "sc-l0bg02-3"
|
|
439
|
+
})(["display:flex;"]);
|
|
440
|
+
RatingWrapper = styled_components_esm_default.div.withConfig({
|
|
441
|
+
displayName: "Rating__RatingWrapper",
|
|
442
|
+
componentId: "sc-l0bg02-4"
|
|
443
|
+
})(["font-family:var(--font-family-base);display:flex;justify-content:space-between;align-items:center;"]);
|
|
444
|
+
Label3 = styled_components_esm_default.h4.withConfig({
|
|
445
|
+
displayName: "Rating__Label",
|
|
446
|
+
componentId: "sc-l0bg02-5"
|
|
447
|
+
})(["font-family:var(--feedback-font-family);font-weight:var(--font-weight-regular);font-size:var(--feedback-header-font-size);line-height:var(--feedback-header-line-height);color:var(--feedback-header-text-color);margin:0;"]);
|
|
448
|
+
InputLabel = styled_components_esm_default.h4.withConfig({
|
|
449
|
+
displayName: "Rating__InputLabel",
|
|
450
|
+
componentId: "sc-l0bg02-6"
|
|
451
|
+
})(["font-weight:var(--font-weight-regular);font-size:var(--feedback-font-size);line-height:var(--feedback-line-height);margin:0;"]);
|
|
452
|
+
ButtonsContainer2 = styled_components_esm_default.div.withConfig({
|
|
453
|
+
displayName: "Rating__ButtonsContainer",
|
|
454
|
+
componentId: "sc-l0bg02-7"
|
|
455
|
+
})(["display:flex;justify-content:end;margin-bottom:var(--spacing-xxs);gap:var(--spacing-xxs);"]);
|
|
456
|
+
EmailInput = styled_components_esm_default.input.withConfig({
|
|
457
|
+
displayName: "Rating__EmailInput",
|
|
458
|
+
componentId: "sc-l0bg02-8"
|
|
459
|
+
})(["background-color:var(--bg-color);border-radius:var(--border-radius-lg);border:var(--input-border);outline:none;color:var(--feedback-text-color);font-family:var(--feedback-font-family);padding:10px;"]);
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
// ../../packages/theme/src/icons/ThumbDownIcon/ThumbDownIcon.tsx
|
|
464
|
+
import React9 from "react";
|
|
465
|
+
var Icon4, ThumbDownIcon;
|
|
466
|
+
var init_ThumbDownIcon = __esm({
|
|
467
|
+
"../../packages/theme/src/icons/ThumbDownIcon/ThumbDownIcon.tsx"() {
|
|
468
|
+
init_styled_components_esm();
|
|
469
|
+
Icon4 = () => /* @__PURE__ */ React9.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none" }, /* @__PURE__ */ React9.createElement("path", { d: "M12.8422 6.66036C12.8984 6.47286 12.9266 6.27911 12.9266 6.08224C12.9266 5.64005 12.7812 5.21505 12.5188 4.86818C12.575 4.68068 12.6031 4.48693 12.6031 4.29005C12.6031 3.84786 12.4578 3.42286 12.1953 3.07599C12.2516 2.88849 12.2797 2.69474 12.2797 2.49786C12.2797 1.69161 11.8 0.965052 11.0562 0.647865C10.9255 0.591503 10.7845 0.562777 10.6422 0.56349H1.25C0.973437 0.56349 0.75 0.786927 0.75 1.06349V6.75099C0.75 7.02755 0.973437 7.25099 1.25 7.25099H3.27031L4.61094 12.1072C4.82656 12.8901 5.54531 13.4369 6.35781 13.4369C6.82188 13.4369 7.25469 13.2526 7.575 12.9151C7.89531 12.5791 8.05937 12.1385 8.03594 11.6744L7.94219 9.75411H11.6906C11.8797 9.75411 12.0641 9.70411 12.2266 9.6088C12.8578 9.24161 13.25 8.57599 13.25 7.87443C13.25 7.43224 13.1047 7.00724 12.8422 6.66036ZM1.875 6.12443V1.68693H3.14062V6.12443H1.875ZM11.675 8.63068H6.7625L6.9125 11.7307C6.92188 11.9166 6.83906 12.0916 6.68437 12.2072C6.58906 12.2776 6.47188 12.3135 6.35469 12.3119C6.20497 12.3105 6.05977 12.2605 5.94087 12.1695C5.82198 12.0785 5.73581 11.9514 5.69531 11.8072L4.14062 6.17443V1.68693H10.6313C10.7874 1.75692 10.9201 1.87054 11.0132 2.01413C11.1063 2.15772 11.156 2.32515 11.1562 2.4963C11.1562 2.64786 11.1203 2.79161 11.0484 2.92286L10.8313 3.31974L11.1734 3.61661C11.2698 3.70003 11.347 3.80322 11.3998 3.91917C11.4527 4.03511 11.4799 4.16107 11.4797 4.28849C11.4797 4.44005 11.4437 4.5838 11.3719 4.71505L11.1547 5.11193L11.4969 5.4088C11.5932 5.49222 11.6704 5.59541 11.7232 5.71135C11.7761 5.82729 11.8033 5.95326 11.8031 6.08068C11.8031 6.23224 11.7672 6.37599 11.6953 6.50724L11.4766 6.90568L11.8188 7.20255C11.9151 7.28597 11.9923 7.38916 12.0451 7.5051C12.098 7.62104 12.1252 7.74701 12.125 7.87443C12.125 8.17286 11.9531 8.46036 11.675 8.63068Z", fill: "currentColor" }));
|
|
470
|
+
ThumbDownIcon = styled_components_esm_default(Icon4).attrs(() => ({
|
|
471
|
+
"data-component-name": "icons/ThumbDownIcon/ThumbDownIcon"
|
|
472
|
+
})).withConfig({
|
|
473
|
+
displayName: "ThumbDownIcon",
|
|
474
|
+
componentId: "sc-4zvi9h-0"
|
|
475
|
+
})([""]);
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
// ../../packages/theme/src/icons/ThumbUpIcon/ThumbUpIcon.tsx
|
|
480
|
+
import React10 from "react";
|
|
481
|
+
var Icon5, ThumbUpIcon;
|
|
482
|
+
var init_ThumbUpIcon = __esm({
|
|
483
|
+
"../../packages/theme/src/icons/ThumbUpIcon/ThumbUpIcon.tsx"() {
|
|
484
|
+
init_styled_components_esm();
|
|
485
|
+
Icon5 = () => /* @__PURE__ */ React10.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none" }, /* @__PURE__ */ React10.createElement("path", { d: "M12.8422 7.33966C13.1047 6.99279 13.25 6.56779 13.25 6.1256C13.25 5.42404 12.8578 4.75997 12.2266 4.38966C12.0641 4.29434 11.879 4.24417 11.6906 4.24435H7.94375L8.0375 2.32404C8.05938 1.85997 7.89531 1.41935 7.57656 1.08341C7.42013 0.917829 7.23141 0.786087 7.02206 0.696324C6.8127 0.606562 6.58716 0.560687 6.35938 0.561535C5.54688 0.561535 4.82812 1.10841 4.6125 1.89122L3.27031 6.7506H1.25C0.973437 6.7506 0.75 6.97404 0.75 7.2506V12.9381C0.75 13.2147 0.973437 13.4381 1.25 13.4381H10.6453C10.7891 13.4381 10.9297 13.41 11.0594 13.3537C11.8031 13.0365 12.2828 12.31 12.2828 11.5037C12.2828 11.3068 12.2547 11.1131 12.1984 10.9256C12.4609 10.5787 12.6062 10.1537 12.6062 9.71154C12.6062 9.51466 12.5781 9.32091 12.5219 9.13341C12.7844 8.78654 12.9297 8.36154 12.9297 7.91935C12.9266 7.72247 12.8984 7.52716 12.8422 7.33966ZM1.875 12.3131V7.8756H3.14062V12.3131H1.875ZM11.8188 6.79747L11.4766 7.09435L11.6938 7.49122C11.7653 7.62196 11.8024 7.76875 11.8016 7.91779C11.8016 8.1756 11.6891 8.42091 11.4953 8.58966L11.1531 8.88654L11.3703 9.28341C11.4419 9.41414 11.479 9.56094 11.4781 9.70997C11.4781 9.96779 11.3656 10.2131 11.1719 10.3818L10.8297 10.6787L11.0469 11.0756C11.1184 11.2063 11.1555 11.3531 11.1547 11.5022C11.1547 11.8522 10.9484 12.1678 10.6297 12.3115H4.14062V7.8256L5.69531 2.19279C5.7354 2.04841 5.82146 1.92104 5.94044 1.82997C6.05943 1.7389 6.20485 1.68909 6.35469 1.6881C6.47344 1.6881 6.59062 1.72247 6.68437 1.79279C6.83906 1.90841 6.92188 2.08341 6.9125 2.26935L6.7625 5.36935H11.675C11.9531 5.53966 12.125 5.82716 12.125 6.1256C12.125 6.38341 12.0125 6.62716 11.8188 6.79747Z", fill: "currentColor" }));
|
|
486
|
+
ThumbUpIcon = styled_components_esm_default(Icon5).attrs(() => ({
|
|
487
|
+
"data-component-name": "icons/ThumbUpIcon/ThumbUpIcon"
|
|
488
|
+
})).withConfig({
|
|
489
|
+
displayName: "ThumbUpIcon",
|
|
490
|
+
componentId: "sc-1mr22fg-0"
|
|
491
|
+
})([""]);
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
// ../../packages/theme/src/components/Feedback/Sentiment.tsx
|
|
496
|
+
import * as React11 from "react";
|
|
497
|
+
import { useEffect as useEffect2 } from "react";
|
|
498
|
+
function Sentiment({
|
|
499
|
+
settings,
|
|
500
|
+
onSubmit,
|
|
501
|
+
className
|
|
502
|
+
}) {
|
|
503
|
+
const {
|
|
504
|
+
label,
|
|
505
|
+
submitText,
|
|
506
|
+
comment: commentSettings,
|
|
507
|
+
reasons: reasonsSettings,
|
|
508
|
+
optionalEmail: optionalEmailSettings
|
|
509
|
+
} = settings || {};
|
|
510
|
+
const [isSubmitted, setIsSubmitted] = React11.useState(false);
|
|
511
|
+
const [score, setScore] = React11.useState(0);
|
|
512
|
+
const [comment, setComment] = React11.useState("");
|
|
513
|
+
const [reasons, setReasons] = React11.useState([]);
|
|
514
|
+
const [email, setEmail] = React11.useState();
|
|
515
|
+
const {
|
|
516
|
+
useTranslate,
|
|
517
|
+
useUserMenu
|
|
518
|
+
} = useThemeHooks();
|
|
519
|
+
const {
|
|
520
|
+
userData
|
|
521
|
+
} = useUserMenu();
|
|
522
|
+
const {
|
|
523
|
+
translate
|
|
524
|
+
} = useTranslate();
|
|
525
|
+
const onEmailChange = (e) => {
|
|
526
|
+
const value = e.target.value;
|
|
527
|
+
setEmail(value || void 0);
|
|
528
|
+
};
|
|
529
|
+
const getScoreSpecificReasonSettings = (score2) => {
|
|
530
|
+
switch (score2) {
|
|
531
|
+
case 1:
|
|
532
|
+
return reasonsSettings?.like;
|
|
533
|
+
case -1:
|
|
534
|
+
return reasonsSettings?.dislike;
|
|
535
|
+
default:
|
|
536
|
+
return reasonsSettings;
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
const checkIfShouldDisplayReasons = (score2) => {
|
|
540
|
+
if (!score2 || !reasonsSettings) {
|
|
541
|
+
return false;
|
|
542
|
+
}
|
|
543
|
+
const scoreSpecificReasonsSettings = getScoreSpecificReasonSettings(score2);
|
|
544
|
+
if (typeof scoreSpecificReasonsSettings?.hide === "undefined") {
|
|
545
|
+
return !reasonsSettings.hide;
|
|
546
|
+
}
|
|
547
|
+
return !scoreSpecificReasonsSettings?.hide;
|
|
548
|
+
};
|
|
549
|
+
const displayReasons = checkIfShouldDisplayReasons(score);
|
|
550
|
+
const displayComment = !!(score && !commentSettings?.hide);
|
|
551
|
+
const displaySubmitBnt = !!(score && (displayReasons || displayComment));
|
|
552
|
+
const displayFeedbackEmail = !!score && !optionalEmailSettings?.hide && !userData.isAuthenticated;
|
|
553
|
+
const commentLabel = score === 1 ? commentSettings && commentSettings.likeLabel || translate("feedback.settings.comment.likeLabel", "What was most helpful?") : commentSettings && commentSettings.dislikeLabel || translate("feedback.settings.comment.dislikeLabel", "What can we improve?");
|
|
554
|
+
const renderReasonsLabel = (score2) => {
|
|
555
|
+
const scoreSpecificReasonSettings = getScoreSpecificReasonSettings(score2);
|
|
556
|
+
return scoreSpecificReasonSettings?.label;
|
|
557
|
+
};
|
|
558
|
+
const resolveReasonsItems = (score2) => {
|
|
559
|
+
const defaultReasonsItems = reasonsSettings?.items || [];
|
|
560
|
+
const scoreSpecificReasonSettings = getScoreSpecificReasonSettings(score2);
|
|
561
|
+
return defaultReasonsItems.concat(scoreSpecificReasonSettings?.items ?? []);
|
|
562
|
+
};
|
|
563
|
+
const resolveReasonsComponent = (score2) => {
|
|
564
|
+
const scoreSpecificReasonSettings = getScoreSpecificReasonSettings(score2);
|
|
565
|
+
return scoreSpecificReasonSettings?.component;
|
|
566
|
+
};
|
|
567
|
+
const onSubmitSentimentForm = () => {
|
|
568
|
+
onSubmit({
|
|
569
|
+
score,
|
|
570
|
+
comment,
|
|
571
|
+
reasons,
|
|
572
|
+
email
|
|
573
|
+
});
|
|
574
|
+
setIsSubmitted(true);
|
|
575
|
+
};
|
|
576
|
+
const onCancelSentimentForm = () => {
|
|
577
|
+
setScore(0);
|
|
578
|
+
setComment("");
|
|
579
|
+
setReasons([]);
|
|
580
|
+
setEmail(void 0);
|
|
581
|
+
};
|
|
582
|
+
useEffect2(() => {
|
|
583
|
+
if (score && !displayComment && !displayReasons && !displayFeedbackEmail) {
|
|
584
|
+
onSubmitSentimentForm();
|
|
585
|
+
}
|
|
586
|
+
}, [score, displayComment, displayReasons, displayFeedbackEmail]);
|
|
587
|
+
if (isSubmitted) {
|
|
588
|
+
return /* @__PURE__ */ React11.createElement(SentimentWrapper, { "data-component-name": "Feedback/Sentiment" }, /* @__PURE__ */ React11.createElement(StyledFormMandatoryFields3, null, /* @__PURE__ */ React11.createElement(Label4, { "data-translation-key": "feedback.settings.submitText" }, submitText || translate("feedback.settings.submitText", "Thank you for helping improve our documentation!")), /* @__PURE__ */ React11.createElement(RadioCheckButtonIcon, null)));
|
|
589
|
+
}
|
|
590
|
+
return /* @__PURE__ */ React11.createElement(SentimentWrapper, { "data-component-name": "Feedback/Sentiment", className }, /* @__PURE__ */ React11.createElement(StyledForm2, null, /* @__PURE__ */ React11.createElement(StyledFormMandatoryFields3, null, /* @__PURE__ */ React11.createElement(Label4, { "data-translation-key": "feedback.settings.label" }, label || translate("feedback.settings.label", "Was this helpful?")), /* @__PURE__ */ React11.createElement(StyledMandatoryFieldContainer2, null, /* @__PURE__ */ React11.createElement(Button, { type: "button", size: "medium", variant: score === 1 ? "primary" : "secondary", onClick: () => {
|
|
591
|
+
setScore(1);
|
|
592
|
+
}, "aria-label": translate("feedback.sentiment.thumbUp", "Like"), icon: /* @__PURE__ */ React11.createElement(ThumbUpIcon, null) }), /* @__PURE__ */ React11.createElement(Button, { size: "medium", type: "button", variant: score === -1 ? "primary" : "secondary", tone: score === -1 ? "danger" : "default", onClick: () => {
|
|
593
|
+
setScore(-1);
|
|
594
|
+
}, "aria-label": translate("feedback.sentiment.thumbDown", "Dislike"), icon: /* @__PURE__ */ React11.createElement(ThumbDownIcon, null) }))), (displayReasons || displayComment) && /* @__PURE__ */ React11.createElement(StyledFormOptionalFields2, null, displayReasons && /* @__PURE__ */ React11.createElement(Reasons, { settings: {
|
|
595
|
+
label: renderReasonsLabel(score),
|
|
596
|
+
items: resolveReasonsItems(score),
|
|
597
|
+
component: resolveReasonsComponent(score)
|
|
598
|
+
}, onChange: setReasons }), displayComment && /* @__PURE__ */ React11.createElement(Comment, { standAlone: false, onSubmit: ({
|
|
599
|
+
comment: comment2
|
|
600
|
+
}) => setComment(comment2), settings: {
|
|
601
|
+
label: commentLabel
|
|
602
|
+
} })), displayFeedbackEmail && /* @__PURE__ */ React11.createElement(StyledFormOptionalFields2, null, /* @__PURE__ */ React11.createElement(InputLabel2, { "data-translation-key": "feedback.settings.optionalEmail.label" }, optionalEmailSettings?.label || translate("feedback.settings.optionalEmail.label", "Your email (optional, for follow-up)")), /* @__PURE__ */ React11.createElement(EmailInput2, { onChange: onEmailChange, placeholder: optionalEmailSettings?.placeholder || translate("feedback.settings.optionalEmail.placeholder", "yourname@example.com"), type: "email", required: !!email, onKeyDown: (e) => {
|
|
603
|
+
if (e.key === "Enter") {
|
|
604
|
+
e.preventDefault();
|
|
605
|
+
onSubmitSentimentForm();
|
|
606
|
+
}
|
|
607
|
+
} })), displaySubmitBnt && /* @__PURE__ */ React11.createElement(ButtonsContainer3, null, /* @__PURE__ */ React11.createElement(Button, { onClick: onCancelSentimentForm, variant: "text", size: "small" }, translate("feedback.cancel", "Cancel")), /* @__PURE__ */ React11.createElement(Button, { onClick: onSubmitSentimentForm, variant: "secondary", size: "small" }, translate("feedback.submit", "Submit")))));
|
|
608
|
+
}
|
|
609
|
+
var SentimentWrapper, Label4, InputLabel2, StyledForm2, StyledFormOptionalFields2, StyledFormMandatoryFields3, StyledMandatoryFieldContainer2, ButtonsContainer3, EmailInput2;
|
|
610
|
+
var init_Sentiment = __esm({
|
|
611
|
+
"../../packages/theme/src/components/Feedback/Sentiment.tsx"() {
|
|
612
|
+
init_styled_components_esm();
|
|
613
|
+
init_Reasons();
|
|
614
|
+
init_hooks();
|
|
615
|
+
init_RadioCheckButtonIcon();
|
|
616
|
+
init_Comment();
|
|
617
|
+
init_Button();
|
|
618
|
+
init_ThumbDownIcon();
|
|
619
|
+
init_ThumbUpIcon();
|
|
620
|
+
SentimentWrapper = styled_components_esm_default.div.withConfig({
|
|
621
|
+
displayName: "Sentiment__SentimentWrapper",
|
|
622
|
+
componentId: "sc-1kmnv8-0"
|
|
623
|
+
})(["font-family:var(--font-family-base);display:flex;justify-content:space-between;align-items:center;"]);
|
|
624
|
+
Label4 = styled_components_esm_default.h4.withConfig({
|
|
625
|
+
displayName: "Sentiment__Label",
|
|
626
|
+
componentId: "sc-1kmnv8-1"
|
|
627
|
+
})(["font-family:var(--feedback-font-family);font-weight:var(--font-weight-regular);font-size:var(--feedback-header-font-size);line-height:var(--feedback-header-line-height);color:var(--feedback-header-text-color);margin:0;"]);
|
|
628
|
+
InputLabel2 = styled_components_esm_default.h4.withConfig({
|
|
629
|
+
displayName: "Sentiment__InputLabel",
|
|
630
|
+
componentId: "sc-1kmnv8-2"
|
|
631
|
+
})(["font-weight:var(--font-weight-regular);font-size:var(--feedback-font-size);line-height:var(--feedback-line-height);margin:0;"]);
|
|
632
|
+
StyledForm2 = styled_components_esm_default.form.withConfig({
|
|
633
|
+
displayName: "Sentiment__StyledForm",
|
|
634
|
+
componentId: "sc-1kmnv8-3"
|
|
635
|
+
})(["width:100%;gap:var(--spacing-sm);display:flex;flex-direction:column;"]);
|
|
636
|
+
StyledFormOptionalFields2 = styled_components_esm_default.div.withConfig({
|
|
637
|
+
displayName: "Sentiment__StyledFormOptionalFields",
|
|
638
|
+
componentId: "sc-1kmnv8-4"
|
|
639
|
+
})(["display:flex;flex-flow:column;"]);
|
|
640
|
+
StyledFormMandatoryFields3 = styled_components_esm_default.div.withConfig({
|
|
641
|
+
displayName: "Sentiment__StyledFormMandatoryFields",
|
|
642
|
+
componentId: "sc-1kmnv8-5"
|
|
643
|
+
})(["display:flex;justify-content:space-between;align-items:center;gap:var(--spacing-xs);> svg{margin:var(--button-icon-padding) 0;}"]);
|
|
644
|
+
StyledMandatoryFieldContainer2 = styled_components_esm_default.div.withConfig({
|
|
645
|
+
displayName: "Sentiment__StyledMandatoryFieldContainer",
|
|
646
|
+
componentId: "sc-1kmnv8-6"
|
|
647
|
+
})(["display:flex;align-items:center;gap:var(--spacing-xxs);", "{margin:0;}"], Button);
|
|
648
|
+
ButtonsContainer3 = styled_components_esm_default.div.withConfig({
|
|
649
|
+
displayName: "Sentiment__ButtonsContainer",
|
|
650
|
+
componentId: "sc-1kmnv8-7"
|
|
651
|
+
})(["display:flex;justify-content:end;margin-bottom:var(--spacing-xxs);gap:var(--spacing-xxs);"]);
|
|
652
|
+
EmailInput2 = styled_components_esm_default.input.withConfig({
|
|
653
|
+
displayName: "Sentiment__EmailInput",
|
|
654
|
+
componentId: "sc-1kmnv8-8"
|
|
655
|
+
})(["background-color:var(--bg-color);border-radius:var(--border-radius-lg);border:var(--input-border);outline:none;color:var(--feedback-text-color);font-family:var(--feedback-font-family);padding:10px;"]);
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
// ../../packages/theme/src/icons/FaceDissatisfiedIcon/FaceDissatisfiedIcon.tsx
|
|
660
|
+
import React12 from "react";
|
|
661
|
+
var Icon6, FaceDissatisfiedIcon;
|
|
662
|
+
var init_FaceDissatisfiedIcon = __esm({
|
|
663
|
+
"../../packages/theme/src/icons/FaceDissatisfiedIcon/FaceDissatisfiedIcon.tsx"() {
|
|
664
|
+
init_styled_components_esm();
|
|
665
|
+
init_utils();
|
|
666
|
+
Icon6 = (props) => /* @__PURE__ */ React12.createElement("svg", { viewBox: "1 1 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React12.createElement("path", { d: "M8 1C6.61553 1 5.26216 1.41054 4.11101 2.17971C2.95987 2.94888 2.06266 4.04213 1.53285 5.32122C1.00303 6.6003 0.86441 8.00776 1.13451 9.36563C1.4046 10.7235 2.07129 11.9708 3.05026 12.9497C4.02922 13.9287 5.2765 14.5954 6.63437 14.8655C7.99224 15.1356 9.3997 14.997 10.6788 14.4672C11.9579 13.9373 13.0511 13.0401 13.8203 11.889C14.5895 10.7378 15 9.38447 15 8C15 6.14348 14.2625 4.36301 12.9497 3.05025C11.637 1.7375 9.85652 1 8 1ZM8 14C6.81332 14 5.65328 13.6481 4.66658 12.9888C3.67989 12.3295 2.91085 11.3925 2.45673 10.2961C2.0026 9.19974 1.88378 7.99334 2.11529 6.82946C2.3468 5.66557 2.91825 4.59647 3.75736 3.75736C4.59648 2.91824 5.66558 2.3468 6.82946 2.11529C7.99335 1.88378 9.19975 2.0026 10.2961 2.45672C11.3925 2.91085 12.3295 3.67988 12.9888 4.66658C13.6481 5.65327 14 6.81331 14 8C14 9.5913 13.3679 11.1174 12.2426 12.2426C11.1174 13.3679 9.5913 14 8 14Z" }), /* @__PURE__ */ React12.createElement("path", { d: "M5.75 5.5C5.50278 5.5 5.2611 5.57331 5.05554 5.71066C4.84998 5.84801 4.68976 6.04324 4.59515 6.27165C4.50054 6.50005 4.47579 6.75139 4.52402 6.99386C4.57225 7.23634 4.6913 7.45907 4.86612 7.63388C5.04094 7.8087 5.26366 7.92775 5.50614 7.97598C5.74862 8.02421 5.99995 7.99946 6.22836 7.90485C6.45677 7.81024 6.65199 7.65002 6.78934 7.44446C6.92669 7.2389 7 6.99723 7 6.75C7 6.41848 6.86831 6.10054 6.63389 5.86612C6.39947 5.6317 6.08152 5.5 5.75 5.5Z" }), /* @__PURE__ */ React12.createElement("path", { d: "M10.25 5.5C10.0028 5.5 9.7611 5.57331 9.55554 5.71066C9.34998 5.84801 9.18976 6.04324 9.09515 6.27165C9.00054 6.50005 8.97579 6.75139 9.02402 6.99386C9.07225 7.23634 9.1913 7.45907 9.36612 7.63388C9.54093 7.8087 9.76366 7.92775 10.0061 7.97598C10.2486 8.02421 10.4999 7.99946 10.7284 7.90485C10.9568 7.81024 11.152 7.65002 11.2893 7.44446C11.4267 7.2389 11.5 6.99723 11.5 6.75C11.5 6.41848 11.3683 6.10054 11.1339 5.86612C10.8995 5.6317 10.5815 5.5 10.25 5.5Z" }), /* @__PURE__ */ React12.createElement("path", { d: "M8 9.5C7.30982 9.50117 6.63168 9.6809 6.03151 10.0217C5.43135 10.3625 4.92958 10.8529 4.575 11.445L5.43 11.945C5.69683 11.5019 6.07369 11.1353 6.524 10.8808C6.97431 10.6263 7.48276 10.4926 8 10.4926C8.51724 10.4926 9.0257 10.6263 9.47601 10.8808C9.92631 11.1353 10.3032 11.5019 10.57 11.945L11.425 11.445C11.0704 10.8529 10.5687 10.3625 9.96849 10.0217C9.36833 9.6809 8.69019 9.50117 8 9.5Z" }));
|
|
667
|
+
FaceDissatisfiedIcon = styled_components_esm_default(Icon6).attrs(() => ({
|
|
668
|
+
"data-component-name": "icons/FaceDissatisfiedIcon/FaceDissatisfiedIcon"
|
|
669
|
+
})).withConfig({
|
|
670
|
+
displayName: "FaceDissatisfiedIcon",
|
|
671
|
+
componentId: "sc-1mq0tcx-0"
|
|
672
|
+
})(["path{fill:", ";}height:", ";width:", ";"], ({
|
|
673
|
+
color
|
|
674
|
+
}) => getCssColorVariable(color), ({
|
|
675
|
+
size
|
|
676
|
+
}) => size || "16px", ({
|
|
677
|
+
size
|
|
678
|
+
}) => size || "16px");
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
// ../../packages/theme/src/icons/FaceSatisfiedIcon/FaceSatisfiedIcon.tsx
|
|
683
|
+
import React13 from "react";
|
|
684
|
+
var Icon7, FaceSatisfiedIcon;
|
|
685
|
+
var init_FaceSatisfiedIcon = __esm({
|
|
686
|
+
"../../packages/theme/src/icons/FaceSatisfiedIcon/FaceSatisfiedIcon.tsx"() {
|
|
687
|
+
init_styled_components_esm();
|
|
688
|
+
init_utils();
|
|
689
|
+
Icon7 = (props) => /* @__PURE__ */ React13.createElement("svg", { viewBox: "1 1 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React13.createElement("path", { d: "M8 1C6.61553 1 5.26216 1.41054 4.11101 2.17971C2.95987 2.94888 2.06266 4.04213 1.53285 5.32122C1.00303 6.6003 0.86441 8.00776 1.13451 9.36563C1.4046 10.7235 2.07129 11.9708 3.05026 12.9497C4.02922 13.9287 5.2765 14.5954 6.63437 14.8655C7.99224 15.1356 9.3997 14.997 10.6788 14.4672C11.9579 13.9373 13.0511 13.0401 13.8203 11.889C14.5895 10.7378 15 9.38447 15 8C15 6.14348 14.2625 4.36301 12.9497 3.05025C11.637 1.7375 9.85652 1 8 1ZM8 14C6.81332 14 5.65328 13.6481 4.66658 12.9888C3.67989 12.3295 2.91085 11.3925 2.45673 10.2961C2.0026 9.19974 1.88378 7.99334 2.11529 6.82946C2.3468 5.66557 2.91825 4.59647 3.75736 3.75736C4.59648 2.91824 5.66558 2.3468 6.82946 2.11529C7.99335 1.88378 9.19975 2.0026 10.2961 2.45672C11.3925 2.91085 12.3295 3.67988 12.9888 4.66658C13.6481 5.65327 14 6.81331 14 8C14 9.5913 13.3679 11.1174 12.2426 12.2426C11.1174 13.3679 9.5913 14 8 14Z" }), /* @__PURE__ */ React13.createElement("path", { d: "M5.75 5.5C5.50278 5.5 5.2611 5.57331 5.05554 5.71066C4.84998 5.84801 4.68976 6.04324 4.59515 6.27165C4.50054 6.50005 4.47579 6.75139 4.52402 6.99386C4.57225 7.23634 4.6913 7.45907 4.86612 7.63388C5.04094 7.8087 5.26366 7.92775 5.50614 7.97598C5.74862 8.02421 5.99995 7.99946 6.22836 7.90485C6.45677 7.81024 6.65199 7.65002 6.78934 7.44446C6.92669 7.2389 7 6.99723 7 6.75C7.00134 6.58548 6.96991 6.42233 6.90757 6.27007C6.84522 6.11782 6.7532 5.97949 6.63686 5.86315C6.52052 5.74681 6.38219 5.65478 6.22993 5.59244C6.07767 5.53009 5.91453 5.49867 5.75 5.5Z" }), /* @__PURE__ */ React13.createElement("path", { d: "M10.25 5.5C10.0028 5.5 9.7611 5.57331 9.55554 5.71066C9.34998 5.84801 9.18976 6.04324 9.09515 6.27165C9.00054 6.50005 8.97579 6.75139 9.02402 6.99386C9.07225 7.23634 9.1913 7.45907 9.36612 7.63388C9.54093 7.8087 9.76366 7.92775 10.0061 7.97598C10.2486 8.02421 10.4999 7.99946 10.7284 7.90485C10.9568 7.81024 11.152 7.65002 11.2893 7.44446C11.4267 7.2389 11.5 6.99723 11.5 6.75C11.5013 6.58548 11.4699 6.42233 11.4076 6.27007C11.3452 6.11782 11.2532 5.97949 11.1369 5.86315C11.0205 5.74681 10.8822 5.65478 10.7299 5.59244C10.5777 5.53009 10.4145 5.49867 10.25 5.5Z" }), /* @__PURE__ */ React13.createElement("path", { d: "M8 12C8.69019 11.9988 9.36833 11.8191 9.96849 11.4783C10.5687 11.1375 11.0704 10.6471 11.425 10.055L10.57 9.555C10.3032 9.9981 9.92631 10.3647 9.47601 10.6192C9.0257 10.8737 8.51724 11.0074 8 11.0074C7.48276 11.0074 6.97431 10.8737 6.524 10.6192C6.07369 10.3647 5.69683 9.9981 5.43 9.555L4.575 10.055C4.92958 10.6471 5.43135 11.1375 6.03151 11.4783C6.63168 11.8191 7.30982 11.9988 8 12Z" }));
|
|
690
|
+
FaceSatisfiedIcon = styled_components_esm_default(Icon7).attrs(() => ({
|
|
691
|
+
"data-component-name": "icons/FaceSatisfiedIcon/FaceSatisfiedIcon"
|
|
692
|
+
})).withConfig({
|
|
693
|
+
displayName: "FaceSatisfiedIcon",
|
|
694
|
+
componentId: "sc-1qghnnx-0"
|
|
695
|
+
})(["path{fill:", ";}height:", ";width:", ";"], ({
|
|
696
|
+
color
|
|
697
|
+
}) => getCssColorVariable(color), ({
|
|
698
|
+
size
|
|
699
|
+
}) => size || "16px", ({
|
|
700
|
+
size
|
|
701
|
+
}) => size || "16px");
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
// ../../packages/theme/src/icons/FaceNeutralIcon/FaceNeutralIcon.tsx
|
|
706
|
+
import React14 from "react";
|
|
707
|
+
var Icon8, FaceNeutralIcon;
|
|
708
|
+
var init_FaceNeutralIcon = __esm({
|
|
709
|
+
"../../packages/theme/src/icons/FaceNeutralIcon/FaceNeutralIcon.tsx"() {
|
|
710
|
+
init_styled_components_esm();
|
|
711
|
+
init_utils();
|
|
712
|
+
Icon8 = (props) => /* @__PURE__ */ React14.createElement("svg", { viewBox: "1 1 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React14.createElement("path", { d: "M8 1C6.61553 1 5.26216 1.41054 4.11101 2.17971C2.95987 2.94888 2.06266 4.04213 1.53285 5.32122C1.00303 6.6003 0.86441 8.00776 1.13451 9.36563C1.4046 10.7235 2.07129 11.9708 3.05026 12.9497C4.02922 13.9287 5.2765 14.5954 6.63437 14.8655C7.99224 15.1356 9.3997 14.997 10.6788 14.4672C11.9579 13.9373 13.0511 13.0401 13.8203 11.889C14.5895 10.7378 15 9.38447 15 8C15 6.14348 14.2625 4.36301 12.9497 3.05025C11.637 1.7375 9.85652 1 8 1ZM8 14C6.81332 14 5.65328 13.6481 4.66658 12.9888C3.67989 12.3295 2.91085 11.3925 2.45673 10.2961C2.0026 9.19974 1.88378 7.99334 2.11529 6.82946C2.3468 5.66557 2.91825 4.59647 3.75736 3.75736C4.59648 2.91824 5.66558 2.3468 6.82946 2.11529C7.99335 1.88378 9.19975 2.0026 10.2961 2.45672C11.3925 2.91085 12.3295 3.67988 12.9888 4.66658C13.6481 5.65327 14 6.81331 14 8C14 9.5913 13.3679 11.1174 12.2426 12.2426C11.1174 13.3679 9.5913 14 8 14Z" }), /* @__PURE__ */ React14.createElement("path", { d: "M5.75 5.5C5.50278 5.5 5.2611 5.57331 5.05554 5.71066C4.84998 5.84801 4.68976 6.04324 4.59515 6.27165C4.50054 6.50005 4.47579 6.75139 4.52402 6.99386C4.57225 7.23634 4.6913 7.45907 4.86612 7.63388C5.04094 7.8087 5.26366 7.92775 5.50614 7.97598C5.74862 8.02421 5.99995 7.99946 6.22836 7.90485C6.45677 7.81024 6.65199 7.65002 6.78934 7.44446C6.92669 7.2389 7 6.99723 7 6.75C7 6.41848 6.86831 6.10054 6.63389 5.86612C6.39947 5.6317 6.08152 5.5 5.75 5.5Z" }), /* @__PURE__ */ React14.createElement("path", { d: "M10.25 5.5C10.0028 5.5 9.7611 5.57331 9.55554 5.71066C9.34998 5.84801 9.18976 6.04324 9.09515 6.27165C9.00054 6.50005 8.97579 6.75139 9.02402 6.99386C9.07225 7.23634 9.1913 7.45907 9.36612 7.63388C9.54093 7.8087 9.76366 7.92775 10.0061 7.97598C10.2486 8.02421 10.4999 7.99946 10.7284 7.90485C10.9568 7.81024 11.152 7.65002 11.2893 7.44446C11.4267 7.2389 11.5 6.99723 11.5 6.75C11.5 6.41848 11.3683 6.10054 11.1339 5.86612C10.8995 5.6317 10.5815 5.5 10.25 5.5Z" }), /* @__PURE__ */ React14.createElement("path", { d: "M11 10H5V11H11V10Z" }));
|
|
713
|
+
FaceNeutralIcon = styled_components_esm_default(Icon8).attrs(() => ({
|
|
714
|
+
"data-component-name": "icons/FaceNeutralIcon/FaceNeutralIcon"
|
|
715
|
+
})).withConfig({
|
|
716
|
+
displayName: "FaceNeutralIcon",
|
|
717
|
+
componentId: "sc-kylii8-0"
|
|
718
|
+
})(["path{fill:", ";}height:", ";width:", ";"], ({
|
|
719
|
+
color
|
|
720
|
+
}) => getCssColorVariable(color), ({
|
|
721
|
+
size
|
|
722
|
+
}) => size || "16px", ({
|
|
723
|
+
size
|
|
724
|
+
}) => size || "16px");
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
// ../../packages/theme/src/components/Feedback/Mood.tsx
|
|
729
|
+
import * as React15 from "react";
|
|
730
|
+
import { useEffect as useEffect3 } from "react";
|
|
731
|
+
function Mood({
|
|
732
|
+
settings,
|
|
733
|
+
onSubmit,
|
|
734
|
+
className
|
|
735
|
+
}) {
|
|
736
|
+
const {
|
|
737
|
+
label,
|
|
738
|
+
submitText,
|
|
739
|
+
comment: commentSettings,
|
|
740
|
+
reasons: reasonsSettings,
|
|
741
|
+
optionalEmail: optionalEmailSettings
|
|
742
|
+
} = settings || {};
|
|
743
|
+
const [score, setScore] = React15.useState("");
|
|
744
|
+
const [isSubmitted, setIsSubmitted] = React15.useState(false);
|
|
745
|
+
const [comment, setComment] = React15.useState("");
|
|
746
|
+
const [reasons, setReasons] = React15.useState([]);
|
|
747
|
+
const [email, setEmail] = React15.useState();
|
|
748
|
+
const {
|
|
749
|
+
useTranslate,
|
|
750
|
+
useUserMenu
|
|
751
|
+
} = useThemeHooks();
|
|
752
|
+
const {
|
|
753
|
+
userData
|
|
754
|
+
} = useUserMenu();
|
|
755
|
+
const {
|
|
756
|
+
translate
|
|
757
|
+
} = useTranslate();
|
|
758
|
+
const onEmailChange = (e) => {
|
|
759
|
+
const value = e.target.value;
|
|
760
|
+
setEmail(value || void 0);
|
|
761
|
+
};
|
|
762
|
+
const checkIfShouldDisplayReasons = (score2) => {
|
|
763
|
+
if (!score2 || !reasonsSettings) {
|
|
764
|
+
return false;
|
|
765
|
+
}
|
|
766
|
+
const scoreSpecificReasonsSettings = reasonsSettings[score2];
|
|
767
|
+
if (typeof scoreSpecificReasonsSettings?.hide === "undefined") {
|
|
768
|
+
return !reasonsSettings.hide;
|
|
769
|
+
}
|
|
770
|
+
return !scoreSpecificReasonsSettings?.hide;
|
|
771
|
+
};
|
|
772
|
+
const renderCommentLabel = (score2) => {
|
|
773
|
+
if (!commentSettings || commentSettings?.hide === true) return "";
|
|
774
|
+
switch (score2) {
|
|
775
|
+
case "satisfied" /* SATISFIED */:
|
|
776
|
+
return commentSettings.satisfiedLabel || translate("feedback.settings.comment.satisfiedLabel", "What was most helpful?");
|
|
777
|
+
case "neutral" /* NEUTRAL */:
|
|
778
|
+
return commentSettings.neutralLabel || translate("feedback.settings.comment.neutralLabel", "What can we improve?");
|
|
779
|
+
case "dissatisfied" /* DISSATISFIED */:
|
|
780
|
+
return commentSettings.dissatisfiedLabel || translate("feedback.settings.comment.dissatisfiedLabel", "What can we improve?");
|
|
781
|
+
default:
|
|
782
|
+
return translate("feedback.settings.comment.satisfiedLabel", "What can we improve?");
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
const renderReasonsLabel = (score2) => {
|
|
786
|
+
if (!reasonsSettings || reasonsSettings?.hide === true) return "";
|
|
787
|
+
return reasonsSettings[score2]?.label;
|
|
788
|
+
};
|
|
789
|
+
const resolveReasonsItems = (score2) => {
|
|
790
|
+
if (!reasonsSettings) {
|
|
791
|
+
return [];
|
|
792
|
+
}
|
|
793
|
+
const defaultReasonsItems = reasonsSettings?.items || [];
|
|
794
|
+
return defaultReasonsItems.concat(reasonsSettings[score2]?.items ?? []);
|
|
795
|
+
};
|
|
796
|
+
const resolveReasonsComponent = (score2) => {
|
|
797
|
+
if (!reasonsSettings || reasonsSettings?.hide === true) return "checkbox";
|
|
798
|
+
return reasonsSettings[score2]?.component;
|
|
799
|
+
};
|
|
800
|
+
const displayReasons = checkIfShouldDisplayReasons(score);
|
|
801
|
+
const displayComment = !!(score && !commentSettings?.hide);
|
|
802
|
+
const displaySubmitBnt = !!(score && (displayReasons || displayComment));
|
|
803
|
+
const displayFeedbackEmail = !!score && !optionalEmailSettings?.hide && !userData.isAuthenticated;
|
|
804
|
+
const onSubmitMoodForm = () => {
|
|
805
|
+
onSubmit({
|
|
806
|
+
score: remapScore(score),
|
|
807
|
+
comment,
|
|
808
|
+
reasons,
|
|
809
|
+
email
|
|
810
|
+
});
|
|
811
|
+
setIsSubmitted(true);
|
|
812
|
+
};
|
|
813
|
+
const onCancelMoodForm = () => {
|
|
814
|
+
setScore("");
|
|
815
|
+
setComment("");
|
|
816
|
+
setReasons([]);
|
|
817
|
+
setEmail(void 0);
|
|
818
|
+
};
|
|
819
|
+
useEffect3(() => {
|
|
820
|
+
if (score && !displayComment && !displayReasons && !displayFeedbackEmail) {
|
|
821
|
+
onSubmitMoodForm();
|
|
822
|
+
}
|
|
823
|
+
}, [score, displayComment, displayReasons, displayFeedbackEmail]);
|
|
824
|
+
if (isSubmitted) {
|
|
825
|
+
return /* @__PURE__ */ React15.createElement(MoodWrapper, { "data-component-name": "Feedback/Mood" }, /* @__PURE__ */ React15.createElement(StyledFormMandatoryFields4, null, /* @__PURE__ */ React15.createElement(Label5, { standAlone: true, "data-translation-key": "feedback.settings.submitText" }, submitText || translate("feedback.settings.submitText", "Thank you for helping improve our documentation!")), /* @__PURE__ */ React15.createElement(RadioCheckButtonIcon, null)));
|
|
826
|
+
}
|
|
827
|
+
return /* @__PURE__ */ React15.createElement(MoodWrapper, { "data-component-name": "Feedback/Mood", className }, /* @__PURE__ */ React15.createElement(StyledForm3, { onSubmit: onSubmitMoodForm }, /* @__PURE__ */ React15.createElement(StyledFormMandatoryFields4, null, /* @__PURE__ */ React15.createElement(Label5, { standAlone: true, "data-translation-key": "feedback.settings.label" }, label || translate("feedback.settings.label", "Was this helpful?")), /* @__PURE__ */ React15.createElement(StyledMandatoryFieldContainer3, null, /* @__PURE__ */ React15.createElement(Button, { "aria-label": "dissatisfied" /* DISSATISFIED */, type: "button", size: "medium", variant: score === "dissatisfied" /* DISSATISFIED */ ? "primary" : "secondary", tone: score === "dissatisfied" /* DISSATISFIED */ ? "danger" : "default", onClick: () => {
|
|
828
|
+
setScore("dissatisfied" /* DISSATISFIED */);
|
|
829
|
+
}, icon: /* @__PURE__ */ React15.createElement(FaceDissatisfiedIcon, null) }), /* @__PURE__ */ React15.createElement(Button, { "aria-label": "neutral" /* NEUTRAL */, type: "button", variant: score === "neutral" /* NEUTRAL */ ? "primary" : "secondary", size: "medium", onClick: () => {
|
|
830
|
+
setScore("neutral" /* NEUTRAL */);
|
|
831
|
+
}, icon: /* @__PURE__ */ React15.createElement(FaceNeutralIcon, null) }), /* @__PURE__ */ React15.createElement(Button, { "aria-label": "satisfied" /* SATISFIED */, type: "button", variant: score === "satisfied" /* SATISFIED */ ? "primary" : "secondary", size: "medium", onClick: () => {
|
|
832
|
+
setScore("satisfied" /* SATISFIED */);
|
|
833
|
+
}, icon: /* @__PURE__ */ React15.createElement(FaceSatisfiedIcon, null) }))), (displayReasons || displayComment) && /* @__PURE__ */ React15.createElement(StyledFormOptionalFields3, null, displayReasons && /* @__PURE__ */ React15.createElement(Reasons, { settings: {
|
|
834
|
+
label: renderReasonsLabel(score),
|
|
835
|
+
items: resolveReasonsItems(score),
|
|
836
|
+
component: resolveReasonsComponent(score)
|
|
837
|
+
}, onChange: setReasons }), displayComment && /* @__PURE__ */ React15.createElement(Comment, { standAlone: false, onSubmit: ({
|
|
838
|
+
comment: comment2
|
|
839
|
+
}) => setComment(comment2), settings: {
|
|
840
|
+
label: renderCommentLabel(score)
|
|
841
|
+
} })), displayFeedbackEmail && /* @__PURE__ */ React15.createElement(StyledFormOptionalFields3, null, /* @__PURE__ */ React15.createElement(InputLabel3, { "data-translation-key": "feedback.settings.optionalEmail.label" }, optionalEmailSettings?.label || translate("feedback.settings.optionalEmail.label", "Your email (optional, for follow-up)")), /* @__PURE__ */ React15.createElement(EmailInput3, { onChange: onEmailChange, placeholder: optionalEmailSettings?.placeholder || translate("feedback.settings.optionalEmail.placeholder", "yourname@example.com"), type: "email", required: !!email, onKeyDown: (e) => {
|
|
842
|
+
if (e.key === "Enter") {
|
|
843
|
+
e.preventDefault();
|
|
844
|
+
onSubmitMoodForm();
|
|
845
|
+
}
|
|
846
|
+
} })), displaySubmitBnt && /* @__PURE__ */ React15.createElement(ButtonsContainer4, null, /* @__PURE__ */ React15.createElement(Button, { onClick: onCancelMoodForm, variant: "text", size: "small" }, "Cancel"), /* @__PURE__ */ React15.createElement(Button, { type: "submit", variant: "secondary", size: "small" }, "Submit"))));
|
|
847
|
+
}
|
|
848
|
+
var MOOD_STATES, remapScore, MoodWrapper, Label5, InputLabel3, ButtonsContainer4, StyledForm3, StyledFormOptionalFields3, StyledFormMandatoryFields4, StyledMandatoryFieldContainer3, EmailInput3;
|
|
849
|
+
var init_Mood = __esm({
|
|
850
|
+
"../../packages/theme/src/components/Feedback/Mood.tsx"() {
|
|
851
|
+
init_styled_components_esm();
|
|
852
|
+
init_Reasons();
|
|
853
|
+
init_hooks();
|
|
854
|
+
init_RadioCheckButtonIcon();
|
|
855
|
+
init_Comment();
|
|
856
|
+
init_Button();
|
|
857
|
+
init_FaceDissatisfiedIcon();
|
|
858
|
+
init_FaceSatisfiedIcon();
|
|
859
|
+
init_FaceNeutralIcon();
|
|
860
|
+
MOOD_STATES = /* @__PURE__ */ ((MOOD_STATES2) => {
|
|
861
|
+
MOOD_STATES2["SATISFIED"] = "satisfied";
|
|
862
|
+
MOOD_STATES2["NEUTRAL"] = "neutral";
|
|
863
|
+
MOOD_STATES2["DISSATISFIED"] = "dissatisfied";
|
|
864
|
+
return MOOD_STATES2;
|
|
865
|
+
})(MOOD_STATES || {});
|
|
866
|
+
remapScore = (score) => {
|
|
867
|
+
switch (score) {
|
|
868
|
+
case "satisfied" /* SATISFIED */:
|
|
869
|
+
return 1;
|
|
870
|
+
case "neutral" /* NEUTRAL */:
|
|
871
|
+
return 0;
|
|
872
|
+
case "dissatisfied" /* DISSATISFIED */:
|
|
873
|
+
return -1;
|
|
874
|
+
default:
|
|
875
|
+
return 0;
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
MoodWrapper = styled_components_esm_default.div.withConfig({
|
|
879
|
+
displayName: "Mood__MoodWrapper",
|
|
880
|
+
componentId: "sc-1ett8m-0"
|
|
881
|
+
})(["font-family:var(--feedback-font-family);display:flex;justify-content:space-between;align-items:center;"]);
|
|
882
|
+
Label5 = styled_components_esm_default.h4.withConfig({
|
|
883
|
+
displayName: "Mood__Label",
|
|
884
|
+
componentId: "sc-1ett8m-1"
|
|
885
|
+
})(["font-family:var(--feedback-font-family);font-weight:var(--font-weight-regular);font-size:var(--feedback-font-size);line-height:var(--feedback-line-height);color:var(--feedback-text-color);", " margin:0;"], ({
|
|
886
|
+
standAlone = false
|
|
887
|
+
}) => standAlone && Ne(["font-size:var(--feedback-header-font-size);line-height:var(--feedback-header-line-height);color:var(--feedback-header-text-color);"]));
|
|
888
|
+
InputLabel3 = styled_components_esm_default.h4.withConfig({
|
|
889
|
+
displayName: "Mood__InputLabel",
|
|
890
|
+
componentId: "sc-1ett8m-2"
|
|
891
|
+
})(["font-weight:var(--font-weight-regular);font-size:var(--feedback-font-size);line-height:var(--feedback-line-height);margin:0;"]);
|
|
892
|
+
ButtonsContainer4 = styled_components_esm_default.div.withConfig({
|
|
893
|
+
displayName: "Mood__ButtonsContainer",
|
|
894
|
+
componentId: "sc-1ett8m-3"
|
|
895
|
+
})(["display:flex;justify-content:end;gap:var(--spacing-xxs);"]);
|
|
896
|
+
StyledForm3 = styled_components_esm_default.form.withConfig({
|
|
897
|
+
displayName: "Mood__StyledForm",
|
|
898
|
+
componentId: "sc-1ett8m-4"
|
|
899
|
+
})(["width:100%;gap:var(--spacing-sm);display:flex;flex-direction:column;"]);
|
|
900
|
+
StyledFormOptionalFields3 = styled_components_esm_default.div.withConfig({
|
|
901
|
+
displayName: "Mood__StyledFormOptionalFields",
|
|
902
|
+
componentId: "sc-1ett8m-5"
|
|
903
|
+
})(["display:flex;flex-flow:column;"]);
|
|
904
|
+
StyledFormMandatoryFields4 = styled_components_esm_default.div.withConfig({
|
|
905
|
+
displayName: "Mood__StyledFormMandatoryFields",
|
|
906
|
+
componentId: "sc-1ett8m-6"
|
|
907
|
+
})(["display:flex;justify-content:space-between;align-items:center;gap:var(--spacing-xs);> svg{margin:var(--button-icon-padding) 0;}"]);
|
|
908
|
+
StyledMandatoryFieldContainer3 = styled_components_esm_default.div.withConfig({
|
|
909
|
+
displayName: "Mood__StyledMandatoryFieldContainer",
|
|
910
|
+
componentId: "sc-1ett8m-7"
|
|
911
|
+
})(["display:flex;align-items:center;gap:var(--spacing-xxs);"]);
|
|
912
|
+
EmailInput3 = styled_components_esm_default.input.withConfig({
|
|
913
|
+
displayName: "Mood__EmailInput",
|
|
914
|
+
componentId: "sc-1ett8m-8"
|
|
915
|
+
})(["background-color:var(--bg-color);border-radius:var(--border-radius-lg);border:var(--input-border);outline:none;color:var(--feedback-text-color);font-family:var(--feedback-font-family);padding:10px;"]);
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
|
|
919
|
+
// ../../packages/theme/src/components/Feedback/Scale.tsx
|
|
920
|
+
import * as React16 from "react";
|
|
921
|
+
import { useEffect as useEffect4 } from "react";
|
|
922
|
+
function Scale({
|
|
923
|
+
settings,
|
|
924
|
+
onSubmit,
|
|
925
|
+
className
|
|
926
|
+
}) {
|
|
927
|
+
const {
|
|
928
|
+
label,
|
|
929
|
+
submitText,
|
|
930
|
+
leftScaleLabel,
|
|
931
|
+
rightScaleLabel,
|
|
932
|
+
comment: commentSettings,
|
|
933
|
+
reasons: reasonsSettings,
|
|
934
|
+
optionalEmail: optionalEmailSettings
|
|
935
|
+
} = settings || {};
|
|
936
|
+
const [score, setScore] = React16.useState(0);
|
|
937
|
+
const [isSubmitted, setIsSubmitted] = React16.useState(false);
|
|
938
|
+
const [comment, setComment] = React16.useState("");
|
|
939
|
+
const [reasons, setReasons] = React16.useState([]);
|
|
940
|
+
const [email, setEmail] = React16.useState();
|
|
941
|
+
const {
|
|
942
|
+
useTranslate,
|
|
943
|
+
useUserMenu
|
|
944
|
+
} = useThemeHooks();
|
|
945
|
+
const {
|
|
946
|
+
userData
|
|
947
|
+
} = useUserMenu();
|
|
948
|
+
const {
|
|
949
|
+
translate
|
|
950
|
+
} = useTranslate();
|
|
951
|
+
const onEmailChange = (e) => {
|
|
952
|
+
const value = e.target.value;
|
|
953
|
+
setEmail(value || void 0);
|
|
954
|
+
};
|
|
955
|
+
const scaleOptions = [];
|
|
956
|
+
for (let i = 1; i <= MAX_SCALE; i++) {
|
|
957
|
+
scaleOptions.push(/* @__PURE__ */ React16.createElement(Button, { id: `scale-option-${i}`, key: `scale-option-${i}`, type: "button", onClick: () => setScore(i), className: `${score === i ? "active" : ""}` }, i));
|
|
958
|
+
}
|
|
959
|
+
const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
|
|
960
|
+
const displayComment = !!(score && !commentSettings?.hide);
|
|
961
|
+
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
962
|
+
const displayFeedbackEmail = !!score && !optionalEmailSettings?.hide && !userData.isAuthenticated;
|
|
963
|
+
const handleCancel = () => {
|
|
964
|
+
setScore(0);
|
|
965
|
+
setComment("");
|
|
966
|
+
setReasons([]);
|
|
967
|
+
setEmail(void 0);
|
|
968
|
+
};
|
|
969
|
+
const onSubmitScaleForm = () => {
|
|
970
|
+
onSubmit({
|
|
971
|
+
score,
|
|
972
|
+
comment,
|
|
973
|
+
reasons,
|
|
974
|
+
max: MAX_SCALE,
|
|
975
|
+
email
|
|
976
|
+
});
|
|
977
|
+
setIsSubmitted(true);
|
|
978
|
+
};
|
|
979
|
+
useEffect4(() => {
|
|
980
|
+
if (score && !displayComment && !displayReasons && !displayFeedbackEmail) {
|
|
981
|
+
onSubmitScaleForm();
|
|
982
|
+
}
|
|
983
|
+
}, [score, displayComment, displayReasons, displayFeedbackEmail]);
|
|
984
|
+
if (isSubmitted) {
|
|
985
|
+
return /* @__PURE__ */ React16.createElement(ScaleWrapper, { "data-component-name": "Feedback/Scale" }, /* @__PURE__ */ React16.createElement(Label6, { "data-translation-key": "feedback.settings.submitText" }, submitText || translate("feedback.settings.submitText", "Thank you for helping improve our documentation!")), /* @__PURE__ */ React16.createElement(RadioCheckButtonIcon, null));
|
|
986
|
+
}
|
|
987
|
+
return /* @__PURE__ */ React16.createElement(ScaleWrapper, { "data-component-name": "Feedback/Scale", className }, /* @__PURE__ */ React16.createElement(StyledForm4, { onSubmit: onSubmitScaleForm }, /* @__PURE__ */ React16.createElement(StyledFormMandatoryFields5, null, /* @__PURE__ */ React16.createElement(Label6, { "data-translation-key": "feedback.settings.label" }, label || translate("feedback.settings.label", "Was this helpful?")), /* @__PURE__ */ React16.createElement(ScaleOptionsWrapper, null, scaleOptions), /* @__PURE__ */ React16.createElement(SubLabelContainer, null, /* @__PURE__ */ React16.createElement(SubLabel, { "data-translation-key": "feedback.settings.leftScaleLabel" }, leftScaleLabel || translate("feedback.settings.leftScaleLabel", "Not helpful at all")), /* @__PURE__ */ React16.createElement(SubLabel, { "data-translation-key": "feedback.settings.rightScaleLabel" }, rightScaleLabel || translate("feedback.settings.rightScaleLabel", "Extremely helpful")))), /* @__PURE__ */ React16.createElement(StyledFormOptionalFields4, null, displayReasons && /* @__PURE__ */ React16.createElement(Reasons, { settings: {
|
|
988
|
+
label: reasonsSettings?.label,
|
|
989
|
+
items: reasonsSettings?.items || [],
|
|
990
|
+
component: reasonsSettings?.component
|
|
991
|
+
}, onChange: setReasons }), displayComment && /* @__PURE__ */ React16.createElement(Comment, { standAlone: false, onSubmit: ({
|
|
992
|
+
comment: comment2
|
|
993
|
+
}) => setComment(comment2), settings: {
|
|
994
|
+
label: commentSettings?.label || translate("feedback.settings.comment.label", "Please share your feedback with us.")
|
|
995
|
+
} })), displayFeedbackEmail && /* @__PURE__ */ React16.createElement(StyledFormOptionalFields4, null, /* @__PURE__ */ React16.createElement(InputLabel4, { "data-translation-key": "feedback.settings.optionalEmail.label" }, optionalEmailSettings?.label || translate("feedback.settings.optionalEmail.label", "Your email (optional, for follow-up)")), /* @__PURE__ */ React16.createElement(EmailInput4, { onChange: onEmailChange, placeholder: optionalEmailSettings?.placeholder || translate("feedback.settings.optionalEmail.placeholder", "yourname@example.com"), type: "email", required: !!email, onKeyDown: (e) => {
|
|
996
|
+
if (e.key === "Enter") {
|
|
997
|
+
e.preventDefault();
|
|
998
|
+
onSubmitScaleForm();
|
|
999
|
+
}
|
|
1000
|
+
} })), displaySubmitBnt && /* @__PURE__ */ React16.createElement(ButtonsContainer5, null, /* @__PURE__ */ React16.createElement(Button, { "data-translation-key": "feedback.settings.comment.cancel", onClick: handleCancel, variant: "text", size: "small" }, translate("feedback.settings.comment.cancel", "Cancel")), /* @__PURE__ */ React16.createElement(Button, { "data-translation-key": "feedback.submit", type: "submit", variant: "secondary", size: "small" }, translate("feedback.submit", "Submit")))));
|
|
1001
|
+
}
|
|
1002
|
+
var MAX_SCALE, ScaleWrapper, Label6, InputLabel4, SubLabelContainer, SubLabel, StyledForm4, ButtonsContainer5, StyledFormOptionalFields4, StyledFormMandatoryFields5, ScaleOptionsWrapper, EmailInput4;
|
|
1003
|
+
var init_Scale = __esm({
|
|
1004
|
+
"../../packages/theme/src/components/Feedback/Scale.tsx"() {
|
|
1005
|
+
init_styled_components_esm();
|
|
1006
|
+
init_utils();
|
|
1007
|
+
init_hooks();
|
|
1008
|
+
init_RadioCheckButtonIcon();
|
|
1009
|
+
init_Comment();
|
|
1010
|
+
init_Reasons();
|
|
1011
|
+
init_Button();
|
|
1012
|
+
MAX_SCALE = 10;
|
|
1013
|
+
ScaleWrapper = styled_components_esm_default.div.withConfig({
|
|
1014
|
+
displayName: "Scale__ScaleWrapper",
|
|
1015
|
+
componentId: "sc-1i5fldo-0"
|
|
1016
|
+
})(["font-family:var(--feedback-font-family);display:flex;justify-content:space-between;align-items:center;"]);
|
|
1017
|
+
Label6 = styled_components_esm_default.h4.withConfig({
|
|
1018
|
+
displayName: "Scale__Label",
|
|
1019
|
+
componentId: "sc-1i5fldo-1"
|
|
1020
|
+
})(["font-family:var(--feedback-font-family);font-weight:var(--font-weight-regular);font-size:var(--feedback-header-font-size);line-height:var(--feedback-header-line-height);color:var(--feedback-header-text-color);margin:0;width:100%;"]);
|
|
1021
|
+
InputLabel4 = styled_components_esm_default.h4.withConfig({
|
|
1022
|
+
displayName: "Scale__InputLabel",
|
|
1023
|
+
componentId: "sc-1i5fldo-2"
|
|
1024
|
+
})(["font-weight:var(--font-weight-regular);font-size:var(--feedback-font-size);line-height:var(--feedback-line-height);margin:0;"]);
|
|
1025
|
+
SubLabelContainer = styled_components_esm_default.div.withConfig({
|
|
1026
|
+
displayName: "Scale__SubLabelContainer",
|
|
1027
|
+
componentId: "sc-1i5fldo-3"
|
|
1028
|
+
})(["display:flex;justify-content:space-between;width:100%;flex-direction:row;"]);
|
|
1029
|
+
SubLabel = styled_components_esm_default(Label6).withConfig({
|
|
1030
|
+
displayName: "Scale__SubLabel",
|
|
1031
|
+
componentId: "sc-1i5fldo-4"
|
|
1032
|
+
})(["width:fit-content;color:var(--text-color-description);font-size:var(--feedback-font-size);margin-bottom:var(--spacing-xxs);"]);
|
|
1033
|
+
StyledForm4 = styled_components_esm_default.form.withConfig({
|
|
1034
|
+
displayName: "Scale__StyledForm",
|
|
1035
|
+
componentId: "sc-1i5fldo-5"
|
|
1036
|
+
})(["width:100%;gap:var(--spacing-sm);display:flex;flex-direction:column;"]);
|
|
1037
|
+
ButtonsContainer5 = styled_components_esm_default.div.withConfig({
|
|
1038
|
+
displayName: "Scale__ButtonsContainer",
|
|
1039
|
+
componentId: "sc-1i5fldo-6"
|
|
1040
|
+
})(["display:flex;justify-content:end;margin-bottom:var(--spacing-xxs);gap:var(--spacing-xxs);"]);
|
|
1041
|
+
StyledFormOptionalFields4 = styled_components_esm_default.div.withConfig({
|
|
1042
|
+
displayName: "Scale__StyledFormOptionalFields",
|
|
1043
|
+
componentId: "sc-1i5fldo-7"
|
|
1044
|
+
})(["display:flex;flex-flow:column;&:empty{display:none;}"]);
|
|
1045
|
+
StyledFormMandatoryFields5 = styled_components_esm_default.div.withConfig({
|
|
1046
|
+
displayName: "Scale__StyledFormMandatoryFields",
|
|
1047
|
+
componentId: "sc-1i5fldo-8"
|
|
1048
|
+
})(["display:flex;flex-direction:column;align-items:center;gap:var(--spacing-sm);align-items:center;"]);
|
|
1049
|
+
ScaleOptionsWrapper = styled_components_esm_default.div.withConfig({
|
|
1050
|
+
displayName: "Scale__ScaleOptionsWrapper",
|
|
1051
|
+
componentId: "sc-1i5fldo-9"
|
|
1052
|
+
})(["display:flex;justify-content:space-between;flex-direction:row;gap:var(--spacing-xxs);width:100%;", "{margin-left:0;}@media screen and (max-width:", "){gap:2px;}"], Button, breakpoints.small);
|
|
1053
|
+
EmailInput4 = styled_components_esm_default.input.withConfig({
|
|
1054
|
+
displayName: "Scale__EmailInput",
|
|
1055
|
+
componentId: "sc-1i5fldo-10"
|
|
1056
|
+
})(["background-color:var(--bg-color);border-radius:var(--border-radius-lg);border:var(--input-border);outline:none;color:var(--feedback-text-color);font-family:var(--feedback-font-family);padding:10px;"]);
|
|
1057
|
+
}
|
|
1058
|
+
});
|
|
1059
|
+
|
|
1060
|
+
// ../../packages/theme/src/components/Feedback/Feedback.tsx
|
|
1061
|
+
import * as React17 from "react";
|
|
1062
|
+
import { useLocation } from "react-router-dom";
|
|
1063
|
+
function Feedback(props) {
|
|
1064
|
+
const {
|
|
1065
|
+
useSubmitFeedback,
|
|
1066
|
+
useTelemetry
|
|
1067
|
+
} = useThemeHooks();
|
|
1068
|
+
const {
|
|
1069
|
+
submitFeedback
|
|
1070
|
+
} = useSubmitFeedback();
|
|
1071
|
+
const telemetry = useTelemetry();
|
|
1072
|
+
const {
|
|
1073
|
+
pathname
|
|
1074
|
+
} = useLocation();
|
|
1075
|
+
const {
|
|
1076
|
+
feedback: themeFeedbackConf
|
|
1077
|
+
} = useThemeConfig();
|
|
1078
|
+
const feedbackConf = {
|
|
1079
|
+
...themeFeedbackConf,
|
|
1080
|
+
path: props?.path,
|
|
1081
|
+
type: props?.type || themeFeedbackConf?.type || DEFAULT_FEEDBACK_TYPE,
|
|
1082
|
+
settings: props?.settings || themeFeedbackConf?.settings || {},
|
|
1083
|
+
hide: props.hide ?? themeFeedbackConf?.hide
|
|
1084
|
+
};
|
|
1085
|
+
if (feedbackConf.hide) {
|
|
1086
|
+
return null;
|
|
1087
|
+
}
|
|
1088
|
+
const renderFeedbackComponent = () => {
|
|
1089
|
+
const {
|
|
1090
|
+
type,
|
|
1091
|
+
settings,
|
|
1092
|
+
path
|
|
1093
|
+
} = feedbackConf;
|
|
1094
|
+
const FeedbackComponent = feedbackComponents[type];
|
|
1095
|
+
if (!FeedbackComponent) {
|
|
1096
|
+
return null;
|
|
1097
|
+
}
|
|
1098
|
+
return /* @__PURE__ */ React17.createElement(FeedbackWrapper, { "data-component-name": "Feedback/Feedback" }, /* @__PURE__ */ React17.createElement(FeedbackComponent, { settings, onSubmit: (values) => {
|
|
1099
|
+
submitFeedback({
|
|
1100
|
+
type,
|
|
1101
|
+
values,
|
|
1102
|
+
path
|
|
1103
|
+
});
|
|
1104
|
+
telemetry.send({
|
|
1105
|
+
type: "feedback.sent",
|
|
1106
|
+
payload: {
|
|
1107
|
+
feedbackType: type
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
1110
|
+
} }));
|
|
1111
|
+
};
|
|
1112
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, { key: pathname }, renderFeedbackComponent());
|
|
1113
|
+
}
|
|
1114
|
+
var feedbackComponents, FeedbackWrapper;
|
|
1115
|
+
var init_Feedback = __esm({
|
|
1116
|
+
"../../packages/theme/src/components/Feedback/Feedback.tsx"() {
|
|
1117
|
+
init_styled_components_esm();
|
|
1118
|
+
init_hooks();
|
|
1119
|
+
init_Rating();
|
|
1120
|
+
init_Sentiment();
|
|
1121
|
+
init_Comment();
|
|
1122
|
+
init_Mood();
|
|
1123
|
+
init_Scale();
|
|
1124
|
+
init_constants();
|
|
1125
|
+
feedbackComponents = {
|
|
1126
|
+
rating: Rating,
|
|
1127
|
+
sentiment: Sentiment,
|
|
1128
|
+
mood: Mood,
|
|
1129
|
+
scale: Scale,
|
|
1130
|
+
comment: Comment
|
|
1131
|
+
};
|
|
1132
|
+
FeedbackWrapper = styled_components_esm_default.div.withConfig({
|
|
1133
|
+
displayName: "Feedback__FeedbackWrapper",
|
|
1134
|
+
componentId: "sc-hcc569-0"
|
|
1135
|
+
})(["padding:var(--feedback-padding);background-color:var(--feedback-bg-color);color:var(--feedback-font-color);font-size:var(--feedback-font-size);width:var(--feedback-width);max-width:100%;border-radius:var(--feedback-border-radius);@media print{display:none;}"]);
|
|
1136
|
+
}
|
|
1137
|
+
});
|
|
1138
|
+
|
|
1139
|
+
// ../../packages/theme/src/layouts/CodeWalkthroughLayout.tsx
|
|
1140
|
+
import React18 from "react";
|
|
1141
|
+
function CodeWalkthroughLayout({
|
|
1142
|
+
className,
|
|
1143
|
+
children
|
|
1144
|
+
}) {
|
|
1145
|
+
return /* @__PURE__ */ React18.createElement(LayoutWrapper, { "data-component-name": "Layout/CodeWalkthroughLayout", className }, /* @__PURE__ */ React18.createElement(ContentWrapper, null, children));
|
|
1146
|
+
}
|
|
1147
|
+
var LayoutWrapper, ContentWrapper;
|
|
1148
|
+
var init_CodeWalkthroughLayout = __esm({
|
|
1149
|
+
"../../packages/theme/src/layouts/CodeWalkthroughLayout.tsx"() {
|
|
1150
|
+
init_styled_components_esm();
|
|
1151
|
+
init_utils();
|
|
1152
|
+
LayoutWrapper = styled_components_esm_default.div.attrs(({
|
|
1153
|
+
className
|
|
1154
|
+
}) => ({
|
|
1155
|
+
className
|
|
1156
|
+
})).withConfig({
|
|
1157
|
+
displayName: "CodeWalkthroughLayout__LayoutWrapper",
|
|
1158
|
+
componentId: "sc-1tzdtrv-0"
|
|
1159
|
+
})(["display:flex;flex:1;width:100%;"]);
|
|
1160
|
+
ContentWrapper = styled_components_esm_default.section.withConfig({
|
|
1161
|
+
displayName: "CodeWalkthroughLayout__ContentWrapper",
|
|
1162
|
+
componentId: "sc-1tzdtrv-1"
|
|
1163
|
+
})(["width:100%;--md-content-font-size:var(--font-size-lg);--md-content-line-height:var(--line-height-lg);--md-table-font-size:var(--md-content-font-size);--md-table-line-height:var(--md-content-line-height);--md-tabs-content-font-size:var(--md-content-font-size);--md-tabs-content-line-height:var(--md-content-line-height);article{padding:var(--spacing-xl) 0;> :not(.code-walkthrough):has(+ .code-walkthrough){margin-bottom:var(--spacing-xl);}> .code-walkthrough:not(:last-child){margin-bottom:var(--spacing-xl);}> :not(.code-walkthrough){max-width:var(--md-content-max-width);padding-left:0;padding-right:0;margin-left:auto !important;margin-right:auto !important;}&:has(.code-walkthrough:first-child){padding-top:0;}&:has(.code-walkthrough:last-child){padding-bottom:0;}.code-walkthrough{width:100%;max-width:", ";margin-left:auto;margin-right:auto;}&:first-child > h1:first-child{margin-top:0;}}"], breakpoints.max);
|
|
1164
|
+
}
|
|
1165
|
+
});
|
|
1166
|
+
|
|
1167
|
+
export {
|
|
1168
|
+
Comment,
|
|
1169
|
+
init_Comment,
|
|
1170
|
+
TableOfContent,
|
|
1171
|
+
init_TableOfContent,
|
|
1172
|
+
Reasons,
|
|
1173
|
+
init_Reasons,
|
|
1174
|
+
StarIcon,
|
|
1175
|
+
init_StarIcon,
|
|
1176
|
+
StarFilledIcon,
|
|
1177
|
+
init_StarFilledIcon,
|
|
1178
|
+
Stars,
|
|
1179
|
+
init_Stars,
|
|
1180
|
+
FEEDBACK_MAX_RATING,
|
|
1181
|
+
Rating,
|
|
1182
|
+
init_Rating,
|
|
1183
|
+
Sentiment,
|
|
1184
|
+
init_Sentiment,
|
|
1185
|
+
FaceDissatisfiedIcon,
|
|
1186
|
+
init_FaceDissatisfiedIcon,
|
|
1187
|
+
FaceSatisfiedIcon,
|
|
1188
|
+
init_FaceSatisfiedIcon,
|
|
1189
|
+
FaceNeutralIcon,
|
|
1190
|
+
init_FaceNeutralIcon,
|
|
1191
|
+
MOOD_STATES,
|
|
1192
|
+
Mood,
|
|
1193
|
+
init_Mood,
|
|
1194
|
+
MAX_SCALE,
|
|
1195
|
+
Scale,
|
|
1196
|
+
init_Scale,
|
|
1197
|
+
Feedback,
|
|
1198
|
+
init_Feedback,
|
|
1199
|
+
CodeWalkthroughLayout,
|
|
1200
|
+
init_CodeWalkthroughLayout
|
|
1201
|
+
};
|