@availity/mui-feedback 0.1.0

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 ADDED
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
+
5
+ ## 0.1.0 (2023-11-21)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `mui-button` updated to version `0.5.1`
10
+ * `mui-icon` updated to version `0.7.3`
11
+ * `mui-popover` updated to version `0.1.1`
12
+ * `mui-textfield` updated to version `0.3.3`
13
+ * `mui-toggle-button` updated to version `0.1.6`
14
+ * `mui-form-utils` updated to version `0.5.4`
15
+ * `mui-typography` updated to version `0.1.5`
16
+
17
+ ### Features
18
+
19
+ * **mui-feedback:** initial commit ([2362d7f](https://github.com/Availity/element/commit/2362d7f892274f6260d4814fd8b19b85d8e4fe70))
20
+ * **mui-page-header:** add feedback ([c4ae9cf](https://github.com/Availity/element/commit/c4ae9cff82c163c72818f8d015e103f10869cdd0))
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # @availity/mui-feedback
2
+
3
+ > Availity MUI Feedback component to be used with @availity/element design system.
4
+
5
+ [![Version](https://img.shields.io/npm/v/@availity/mui-feedback.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/mui-feedback)
6
+ [![NPM Downloads](https://img.shields.io/npm/dt/@availity/mui-feedback.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/mui-feedback)
7
+ [![Dependency Status](https://img.shields.io/librariesio/release/npm/@availity/mui-feedback?style=for-the-badge)](https://github.com/Availity/element/blob/main/packages/mui-feedback/package.json)
8
+
9
+ ## Documentation
10
+
11
+ This package extends the MUI Feedback component: [MUI Feedback Docs](https://mui.com/components/feedback/)
12
+
13
+ Live demo and documentation in our [Storybook](https://availity.github.io/element/?path=/docs/components-feedback-introduction--docs)
14
+
15
+ Availity standards for design and usage can be found in the [Availity Design Guide](https://zeroheight.com/2e36e50c7)
16
+
17
+ ## Installation
18
+
19
+ ### Import Through @availity/element (Recommended)
20
+
21
+ #### NPM
22
+
23
+ ```bash
24
+ npm install @availity/element
25
+ ```
26
+
27
+ #### Yarn
28
+
29
+ ```bash
30
+ yarn add @availity/element
31
+ ```
32
+
33
+ ### Direct Import
34
+
35
+ #### NPM
36
+
37
+ _This package has a few peer dependencies. Add `@mui/material` & `@emotion/react` to your project if not already installed._
38
+
39
+ ```bash
40
+ npm install @availity/mui-feedback
41
+ ```
42
+
43
+ #### Yarn
44
+
45
+ ```bash
46
+ yarn add @availity/mui-feedback
47
+ ```
48
+
49
+ ### Usage
50
+
51
+ #### Import through @availity/element
52
+
53
+ ```tsx
54
+ import { Feedback } from '@availity/element';
55
+ ```
56
+
57
+ #### Direct import
58
+
59
+ ```tsx
60
+ import { Feedback } from '@availity/mui-feedback';
61
+ ```
@@ -0,0 +1,9 @@
1
+ interface FeedbackProps {
2
+ analytics?: {
3
+ info: (entries: any) => any;
4
+ };
5
+ appName: string;
6
+ }
7
+ declare const Feedback: ({ analytics, appName }: FeedbackProps) => JSX.Element;
8
+
9
+ export { Feedback, FeedbackProps };
package/dist/index.js ADDED
@@ -0,0 +1,582 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+
26
+ // src/index.ts
27
+ var src_exports = {};
28
+ __export(src_exports, {
29
+ Feedback: () => Feedback
30
+ });
31
+ module.exports = __toCommonJS(src_exports);
32
+
33
+ // src/lib/Feedback.tsx
34
+ var import_react5 = require("react");
35
+ var import_mui_popover = require("@availity/mui-popover");
36
+ var import_mui_button4 = require("@availity/mui-button");
37
+ var import_material6 = require("@mui/material");
38
+ var import_api_axios2 = require("@availity/api-axios");
39
+
40
+ // src/lib/FeedbackForm.tsx
41
+ var import_react3 = require("react");
42
+ var import_mui_textfield = require("@availity/mui-textfield");
43
+ var import_mui_button2 = require("@availity/mui-button");
44
+ var import_mui_toggle_button = require("@availity/mui-toggle-button");
45
+ var import_material3 = require("@mui/material");
46
+ var import_mui_icon4 = require("@availity/mui-icon");
47
+
48
+ // ../../node_modules/@availity/message-core/dist/index.mjs
49
+ var __defProp2 = Object.defineProperty;
50
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
51
+ var __publicField = (obj, key, value) => {
52
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
53
+ return value;
54
+ };
55
+ var __accessCheck = (obj, member, msg) => {
56
+ if (!member.has(obj))
57
+ throw TypeError("Cannot " + msg);
58
+ };
59
+ var __privateGet = (obj, member, getter) => {
60
+ __accessCheck(obj, member, "read from private field");
61
+ return getter ? getter.call(obj) : member.get(obj);
62
+ };
63
+ var __privateAdd = (obj, member, value) => {
64
+ if (member.has(obj))
65
+ throw TypeError("Cannot add the same private member more than once");
66
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
67
+ };
68
+ var __privateSet = (obj, member, value, setter) => {
69
+ __accessCheck(obj, member, "write to private field");
70
+ setter ? setter.call(obj, value) : member.set(obj, value);
71
+ return value;
72
+ };
73
+ var _lastId;
74
+ var AvMessage = class {
75
+ constructor() {
76
+ __publicField(this, "subscribers", {});
77
+ __publicField(this, "getEventData", (event) => {
78
+ const isSameWindow = event.source === window;
79
+ if (!this.isEnabled || !event || !event.data || !event.origin || !event.source || !this.isDomain(event.origin)) {
80
+ return;
81
+ }
82
+ let { data } = event;
83
+ if (typeof data === "string") {
84
+ try {
85
+ data = JSON.parse(data);
86
+ } catch {
87
+ }
88
+ }
89
+ if (typeof data === "string") {
90
+ event = data;
91
+ data = void 0;
92
+ } else {
93
+ event = data && data.event || this.DEFAULT_EVENT;
94
+ }
95
+ const metadata = { isSameWindow };
96
+ this.onMessage(event, data, metadata);
97
+ });
98
+ __privateAdd(this, _lastId, 0);
99
+ this.isEnabled = true;
100
+ this.DEFAULT_EVENT = "avMessage";
101
+ this.DOMAIN = /https?:\/\/([\w-]+\.)?availity\.(com|net)/;
102
+ window.addEventListener("message", this.getEventData);
103
+ }
104
+ enabled(value) {
105
+ if (arguments.length > 0) {
106
+ this.isEnabled = !!value;
107
+ }
108
+ return this.isEnabled;
109
+ }
110
+ subscribe(event, callback, options) {
111
+ var _a;
112
+ if (!this.subscribers[event]) {
113
+ this.subscribers[event] = [];
114
+ }
115
+ __privateSet(this, _lastId, __privateGet(this, _lastId) + 1);
116
+ const id = __privateGet(this, _lastId);
117
+ const ignoreSameWindow = (_a = options == null ? void 0 : options.ignoreSameWindow) != null ? _a : true;
118
+ const subscriber = { id, callback, options: { ignoreSameWindow } };
119
+ this.subscribers[event].push(subscriber);
120
+ return () => {
121
+ this.subscribers[event] = this.subscribers[event].filter((subscriber2) => subscriber2.id !== id);
122
+ };
123
+ }
124
+ unsubscribe(event) {
125
+ delete this.subscribers[event];
126
+ }
127
+ unsubscribeAll() {
128
+ this.subscribers = {};
129
+ }
130
+ onMessage(event, data, metadata) {
131
+ const { isSameWindow } = metadata;
132
+ if (this.subscribers[event]) {
133
+ for (const subscriber of this.subscribers[event]) {
134
+ const { ignoreSameWindow } = subscriber.options;
135
+ const skip = isSameWindow && ignoreSameWindow;
136
+ if (!skip) {
137
+ subscriber.callback(data);
138
+ }
139
+ }
140
+ }
141
+ }
142
+ isDomain(url) {
143
+ return !this.DOMAIN.test(this.domain()) || this.DOMAIN.test(url);
144
+ }
145
+ domain() {
146
+ if (window.location.origin) {
147
+ return window.location.origin;
148
+ }
149
+ if (window.location.hostname) {
150
+ return `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ""}`;
151
+ }
152
+ return "*";
153
+ }
154
+ send(payload, target = window.top) {
155
+ if (!this.isEnabled || !payload) {
156
+ return;
157
+ }
158
+ try {
159
+ const message = typeof payload === "string" ? payload : JSON.stringify(payload);
160
+ target.postMessage(message, this.domain());
161
+ } catch (error) {
162
+ console.warn("AvMessage.send()", error);
163
+ }
164
+ }
165
+ };
166
+ _lastId = /* @__PURE__ */ new WeakMap();
167
+ var AvMessage_default = AvMessage;
168
+ var src_default = new AvMessage_default();
169
+
170
+ // ../form-utils/src/lib/FieldHelpIcon.tsx
171
+ var import_mui_icon = require("@availity/mui-icon");
172
+ var import_mui_button = require("@availity/mui-button");
173
+ var import_jsx_runtime = require("react/jsx-runtime");
174
+ var triggerFieldHelp = (id) => {
175
+ src_default.send({
176
+ event: "nav:help:field",
177
+ id
178
+ });
179
+ };
180
+ var FieldHelpIcon = ({ helpTopicId, labelId, sx, ...rest }) => {
181
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_button.IconButton, {
182
+ ...rest,
183
+ color: "primary",
184
+ title: "Help",
185
+ role: "link",
186
+ onClick: () => triggerFieldHelp(helpTopicId),
187
+ "aria-describedby": labelId,
188
+ size: "small",
189
+ sx: { ...sx, padding: 0.5, fontSize: "inherit", marginTop: "-2px", opacity: 1 },
190
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_icon.HelpCircleIcon, {
191
+ "aria-hidden": true,
192
+ titleAccess: void 0
193
+ })
194
+ });
195
+ };
196
+
197
+ // ../form-utils/src/lib/FormControlLabel.tsx
198
+ var import_react = require("react");
199
+ var import_material = require("@mui/material");
200
+ var import_jsx_runtime = require("react/jsx-runtime");
201
+ var FormControlLabel = (0, import_react.forwardRef)(({ helpTopicId, id, ...rest }, ref) => {
202
+ const labelId = id || (rest.htmlFor ? `${rest.htmlFor}-label` : void 0);
203
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Box, {
204
+ children: [
205
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.FormControlLabel, {
206
+ id: labelId,
207
+ ...rest,
208
+ ref
209
+ }),
210
+ helpTopicId ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldHelpIcon, {
211
+ helpTopicId: "12345",
212
+ labelId
213
+ }) : null
214
+ ]
215
+ });
216
+ });
217
+
218
+ // ../form-utils/src/lib/FormHelperText.tsx
219
+ var import_FormHelperText = __toESM(require("@mui/material/FormHelperText"));
220
+ var import_mui_icon2 = require("@availity/mui-icon");
221
+ var import_jsx_runtime = require("react/jsx-runtime");
222
+
223
+ // ../form-utils/src/lib/FormLabel.tsx
224
+ var import_react2 = require("react");
225
+ var import_material2 = require("@mui/material");
226
+ var import_jsx_runtime = require("react/jsx-runtime");
227
+ var Children = (0, import_material2.styled)("span", {
228
+ name: "MuiFormLabel",
229
+ slot: "Children",
230
+ overridesResolver: (props, styles) => styles.children
231
+ })({});
232
+ var StyleOverrides = {
233
+ position: "relative !important",
234
+ transform: "none !important",
235
+ transition: "none !important",
236
+ animation: "none !important"
237
+ };
238
+ var FormLabel = (0, import_react2.forwardRef)((props, ref) => {
239
+ const { children, helpTopicId, id, sx, ...rest } = props;
240
+ const labelId = id || (rest.htmlFor ? `${rest.htmlFor}-label` : void 0);
241
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material2.Box, {
242
+ display: "flex",
243
+ flexDirection: "row",
244
+ sx,
245
+ children: [
246
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material2.FormLabel, {
247
+ id: labelId,
248
+ sx: { ...StyleOverrides },
249
+ ...rest,
250
+ ref,
251
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Children, {
252
+ className: "MuiFormLabel-children",
253
+ children
254
+ })
255
+ }),
256
+ helpTopicId ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldHelpIcon, {
257
+ helpTopicId,
258
+ labelId,
259
+ sx: { px: 0.5 }
260
+ }) : null
261
+ ]
262
+ });
263
+ });
264
+
265
+ // ../form-utils/src/lib/Input.tsx
266
+ var import_OutlinedInput = __toESM(require("@mui/material/OutlinedInput"));
267
+ var import_InputAdornment = __toESM(require("@mui/material/InputAdornment"));
268
+ var import_jsx_runtime = require("react/jsx-runtime");
269
+ var InputPropOverrides = {
270
+ notched: false
271
+ };
272
+
273
+ // ../form-utils/src/lib/Select.tsx
274
+ var import_Select = __toESM(require("@mui/material/Select"));
275
+ var import_Divider = __toESM(require("@mui/material/Divider"));
276
+ var import_Stack = __toESM(require("@mui/material/Stack"));
277
+ var import_mui_icon3 = require("@availity/mui-icon");
278
+ var import_jsx_runtime = require("react/jsx-runtime");
279
+ var InnerEndAdornment = (args) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Stack.default, {
280
+ ...args,
281
+ direction: "row",
282
+ spacing: 1,
283
+ height: "100%",
284
+ paddingY: ".5rem",
285
+ top: "unset!important",
286
+ children: [
287
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Divider.default, {
288
+ orientation: "vertical"
289
+ }),
290
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_icon3.ExpandIcon, {
291
+ sx: { position: "relative", top: "calc(50% - .5rem)" }
292
+ })
293
+ ]
294
+ });
295
+ var SelectPropOverrides = {
296
+ IconComponent: InnerEndAdornment,
297
+ ...InputPropOverrides
298
+ };
299
+
300
+ // src/lib/FeedbackForm.tsx
301
+ var import_api_axios = require("@availity/api-axios");
302
+ var import_react_hook_form = require("react-hook-form");
303
+ var import_jsx_runtime = require("react/jsx-runtime");
304
+ var SmileButtons = (0, import_material3.styled)(import_mui_toggle_button.ToggleButtonGroup, { name: "AvFeedbackContainer", slot: "SmileButtons" })({});
305
+ var SmileButton = ({ disabled, Icon, label, value, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
306
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_toggle_button.ToggleButton, {
307
+ "aria-label": value,
308
+ value,
309
+ ...props,
310
+ disabled,
311
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
312
+ fontSize: "large"
313
+ })
314
+ })
315
+ });
316
+ var FeedbackForm = ({
317
+ analytics,
318
+ appName,
319
+ handleClose,
320
+ loading,
321
+ sent,
322
+ setLoading,
323
+ setSent
324
+ }) => {
325
+ var _a;
326
+ const {
327
+ control,
328
+ formState: { errors },
329
+ handleSubmit,
330
+ register,
331
+ setValue,
332
+ watch
333
+ } = (0, import_react_hook_form.useForm)();
334
+ const onSubmit = async ({ smileField, ...values }) => {
335
+ setLoading(true);
336
+ try {
337
+ const response = await import_api_axios.avRegionsApi.getCurrentRegion();
338
+ await analytics.info({
339
+ surveyId: `${appName.replace(/\s/g, "_")}_Smile_Survey`,
340
+ smileLocation: `${appName}`,
341
+ smile: `icon-${smileField}`,
342
+ url: window.location.href,
343
+ region: response.data.regions[0] && response.data.regions[0].id,
344
+ userAgent: window.navigator.userAgent,
345
+ submitTime: new Date(),
346
+ ...values
347
+ });
348
+ setSent(true);
349
+ setLoading(false);
350
+ } catch {
351
+ setSent(false);
352
+ setLoading(false);
353
+ }
354
+ };
355
+ (0, import_react3.useEffect)(() => {
356
+ if (sent) {
357
+ setTimeout(() => {
358
+ handleClose();
359
+ }, 2e3);
360
+ }
361
+ }, [sent]);
362
+ const options = [
363
+ {
364
+ Icon: import_mui_icon4.FaceSmileIcon,
365
+ label: "What do you like?",
366
+ value: "smile"
367
+ },
368
+ {
369
+ Icon: import_mui_icon4.FaceNeutralIcon,
370
+ label: "What would you improve?",
371
+ value: "meh"
372
+ },
373
+ { Icon: import_mui_icon4.FaceFrownIcon, label: "What don't you like?", value: "frown" }
374
+ ];
375
+ const getFeedbackLabel = () => {
376
+ const smile = watch("smileField");
377
+ const option = options.find((option2) => option2.value === smile);
378
+ return (option == null ? void 0 : option.label) || "What would you improve?";
379
+ };
380
+ if (!sent) {
381
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material3.Grid, {
382
+ component: "form",
383
+ container: true,
384
+ justifyContent: "center",
385
+ onSubmit: handleSubmit(onSubmit),
386
+ "aria-label": "Feedback Form",
387
+ "aria-describedby": "feedback-form-header",
388
+ children: [
389
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_hook_form.Controller, {
390
+ control,
391
+ name: "smileField",
392
+ render: ({ field }) => {
393
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SmileButtons, {
394
+ children: options.map((props, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SmileButton, {
395
+ autoFocus: index === 0,
396
+ disabled: loading,
397
+ ...props
398
+ }, props.value)),
399
+ ...field,
400
+ "aria-labelledby": "feedback-form-header",
401
+ onChange: (event, value) => {
402
+ setValue(field.name, value);
403
+ },
404
+ size: "medium",
405
+ exclusive: true
406
+ });
407
+ }
408
+ }),
409
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_textfield.TextField, {
410
+ ...register("feedback", {
411
+ required: "This field is required",
412
+ maxLength: { value: 200, message: "This field must not exceed 200 characters" }
413
+ }),
414
+ fullWidth: true,
415
+ multiline: true,
416
+ minRows: 3,
417
+ maxRows: 3,
418
+ label: getFeedbackLabel(),
419
+ inputProps: { "aria-required": "true" },
420
+ InputLabelProps: {
421
+ component: FormLabel,
422
+ required: true
423
+ },
424
+ helperText: ((_a = errors.feedback) == null ? void 0 : _a.message) || "Max 200 characters",
425
+ error: !!errors.feedback,
426
+ disabled: loading
427
+ }),
428
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material3.Grid, {
429
+ container: true,
430
+ direction: "row",
431
+ marginTop: "16px",
432
+ spacing: 1,
433
+ children: [
434
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material3.Grid, {
435
+ item: true,
436
+ xs: 6,
437
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_button2.Button, {
438
+ color: "secondary",
439
+ disabled: loading,
440
+ fullWidth: true,
441
+ onClick: handleClose,
442
+ children: "Cancel"
443
+ })
444
+ }),
445
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material3.Grid, {
446
+ item: true,
447
+ xs: 6,
448
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_button2.LoadingButton, {
449
+ disabled: !watch("smileField"),
450
+ fullWidth: true,
451
+ loading,
452
+ type: "submit",
453
+ variant: "contained",
454
+ children: "Send Feedback"
455
+ })
456
+ })
457
+ ]
458
+ })
459
+ ]
460
+ });
461
+ } else {
462
+ return null;
463
+ }
464
+ };
465
+
466
+ // src/lib/FeedbackHeader.tsx
467
+ var import_mui_button3 = require("@availity/mui-button");
468
+ var import_mui_icon5 = require("@availity/mui-icon");
469
+
470
+ // ../typography/src/lib/Typography.tsx
471
+ var import_react4 = require("react");
472
+ var import_material4 = require("@mui/material");
473
+ var import_jsx_runtime = require("react/jsx-runtime");
474
+ var Typography = (0, import_react4.forwardRef)(
475
+ ({ children, ...rest }, ref) => {
476
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material4.Typography, {
477
+ ...rest,
478
+ ref,
479
+ children
480
+ });
481
+ }
482
+ );
483
+
484
+ // src/lib/FeedbackHeader.tsx
485
+ var import_material5 = require("@mui/material");
486
+ var import_jsx_runtime = require("react/jsx-runtime");
487
+ var FeedbackHeader = ({ appName, handleClose, loading, sent }) => {
488
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material5.Grid, {
489
+ alignItems: "center",
490
+ container: true,
491
+ direction: "row",
492
+ marginBottom: !sent ? "8px" : "0px",
493
+ justifyContent: "space-between",
494
+ flexWrap: "nowrap",
495
+ id: "feedback-form-header",
496
+ children: [
497
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material5.Grid, {
498
+ item: true,
499
+ whiteSpace: "normal",
500
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, {
501
+ component: "h2",
502
+ variant: "h5",
503
+ children: sent ? "Thank you for your feedback." : `Tell us what you think about ${appName}`
504
+ })
505
+ }),
506
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material5.Grid, {
507
+ item: true,
508
+ marginRight: "-8px",
509
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_button3.IconButton, {
510
+ disabled: loading,
511
+ title: "Close",
512
+ onClick: handleClose,
513
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_icon5.CloseIcon, {})
514
+ })
515
+ })
516
+ ]
517
+ });
518
+ };
519
+
520
+ // src/lib/Feedback.tsx
521
+ var import_jsx_runtime = require("react/jsx-runtime");
522
+ var FeedbackContainer = (0, import_material6.styled)(import_material6.Container, { name: "AvFeedbackContainer", slot: "root" })({});
523
+ var Feedback = ({ analytics = import_api_axios2.avLogMessagesApi, appName }) => {
524
+ const [anchorEl, setAnchorEl] = (0, import_react5.useState)(null);
525
+ const [sent, setSent] = (0, import_react5.useState)(false);
526
+ const [loading, setLoading] = (0, import_react5.useState)(false);
527
+ const handlePopoverOpen = (event) => {
528
+ setAnchorEl(event.currentTarget);
529
+ };
530
+ const handlePopoverClose = () => {
531
+ setAnchorEl(null);
532
+ };
533
+ const open = Boolean(anchorEl);
534
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
535
+ children: [
536
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_button4.Button, {
537
+ onClick: handlePopoverOpen,
538
+ color: "secondary",
539
+ size: "large",
540
+ children: "Give Feedback"
541
+ }),
542
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_popover.Popover, {
543
+ anchorEl,
544
+ anchorOrigin: {
545
+ vertical: "bottom",
546
+ horizontal: "right"
547
+ },
548
+ sx: { marginTop: "4px" },
549
+ disableRestoreFocus: true,
550
+ onClose: handlePopoverClose,
551
+ open,
552
+ transformOrigin: {
553
+ vertical: "top",
554
+ horizontal: "right"
555
+ },
556
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FeedbackContainer, {
557
+ children: [
558
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FeedbackHeader, {
559
+ appName,
560
+ handleClose: handlePopoverClose,
561
+ loading,
562
+ sent
563
+ }),
564
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FeedbackForm, {
565
+ analytics,
566
+ appName,
567
+ handleClose: handlePopoverClose,
568
+ loading,
569
+ sent,
570
+ setLoading,
571
+ setSent
572
+ })
573
+ ]
574
+ })
575
+ })
576
+ ]
577
+ });
578
+ };
579
+ // Annotate the CommonJS export names for ESM import in node:
580
+ 0 && (module.exports = {
581
+ Feedback
582
+ });