@availity/mui-spaces 0.3.4 → 0.3.5
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 +2 -0
- package/dist/index.d.mts +1 -7
- package/dist/index.d.ts +1 -7
- package/dist/index.js +85 -432
- package/dist/index.mjs +73 -424
- package/package.json +12 -1
package/dist/index.js
CHANGED
|
@@ -93,7 +93,7 @@ __export(src_exports, {
|
|
|
93
93
|
module.exports = __toCommonJS(src_exports);
|
|
94
94
|
|
|
95
95
|
// src/lib/Spaces.tsx
|
|
96
|
-
var
|
|
96
|
+
var import_react3 = require("react");
|
|
97
97
|
var import_react_query = require("@tanstack/react-query");
|
|
98
98
|
|
|
99
99
|
// src/lib/spaces-data.tsx
|
|
@@ -266,7 +266,7 @@ var configurationFindMany_default = `query configurationFindMany($ids: [String!]
|
|
|
266
266
|
}`;
|
|
267
267
|
|
|
268
268
|
// src/lib/modals/ModalProvider.tsx
|
|
269
|
-
var
|
|
269
|
+
var import_react2 = require("react");
|
|
270
270
|
var import_resolve_url = require("@availity/resolve-url");
|
|
271
271
|
var import_mui_dialog3 = require("@availity/mui-dialog");
|
|
272
272
|
var import_mui_button = require("@availity/mui-button");
|
|
@@ -345,72 +345,12 @@ var updateTopApps = (space, akaname) => __async(void 0, null, function* () {
|
|
|
345
345
|
});
|
|
346
346
|
|
|
347
347
|
// src/lib/modals/DisclaimerModal.tsx
|
|
348
|
-
var
|
|
348
|
+
var import_react = require("react");
|
|
349
349
|
var import_api_axios2 = require("@availity/api-axios");
|
|
350
350
|
var import_react_markdown = __toESM(require("react-markdown"));
|
|
351
|
-
|
|
352
|
-
// ../progress/src/lib/CircularProgress.tsx
|
|
353
|
-
var import_react = require("react");
|
|
354
|
-
var import_CircularProgress = __toESM(require("@mui/material/CircularProgress"));
|
|
355
|
-
var import_Stack = __toESM(require("@mui/material/Stack"));
|
|
356
|
-
var import_mui_icon = require("@availity/mui-icon");
|
|
357
|
-
var import_mui_typography = require("@availity/mui-typography");
|
|
358
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
359
|
-
var StatusIcon = ({ status, size }) => {
|
|
360
|
-
const fontSize = size === "small" ? "medium" : "large";
|
|
361
|
-
switch (status) {
|
|
362
|
-
case "error":
|
|
363
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_icon.WarningCircleIcon, { color: "error", fontSize, titleAccess: "loading error" });
|
|
364
|
-
case "success":
|
|
365
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_icon.SuccessCircleIcon, { color: "success", fontSize, titleAccess: "loading successful" });
|
|
366
|
-
default:
|
|
367
|
-
return null;
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
var getCaptionText = (status) => ({
|
|
371
|
-
loading: "Loading",
|
|
372
|
-
error: "Loading error",
|
|
373
|
-
success: "Loading successful"
|
|
374
|
-
})[status] || "";
|
|
375
|
-
var CircularProgress = (_a) => {
|
|
376
|
-
var _b = _a, {
|
|
377
|
-
loadingCaption = true,
|
|
378
|
-
error = false,
|
|
379
|
-
success = false,
|
|
380
|
-
size = "default"
|
|
381
|
-
} = _b, props = __objRest(_b, [
|
|
382
|
-
"loadingCaption",
|
|
383
|
-
"error",
|
|
384
|
-
"success",
|
|
385
|
-
"size"
|
|
386
|
-
]);
|
|
387
|
-
const [status, setStatus] = (0, import_react.useState)("loading");
|
|
388
|
-
(0, import_react.useEffect)(() => {
|
|
389
|
-
if (error) {
|
|
390
|
-
setStatus("error");
|
|
391
|
-
} else if (success) {
|
|
392
|
-
setStatus("success");
|
|
393
|
-
} else {
|
|
394
|
-
setStatus("loading");
|
|
395
|
-
}
|
|
396
|
-
}, [error, success]);
|
|
397
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Stack.default, { width: "fit-content", alignItems: "center", children: [
|
|
398
|
-
status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
399
|
-
import_CircularProgress.default,
|
|
400
|
-
__spreadProps(__spreadValues({
|
|
401
|
-
"aria-label": "Loading"
|
|
402
|
-
}, props), {
|
|
403
|
-
size: size === "small" ? 24 : 40,
|
|
404
|
-
variant: "indeterminate"
|
|
405
|
-
})
|
|
406
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusIcon, { status, size }),
|
|
407
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_typography.Typography, { marginTop: "8px", variant: "caption", children: loadingCaption || error || success ? getCaptionText(status) : null })
|
|
408
|
-
] });
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
// src/lib/modals/DisclaimerModal.tsx
|
|
351
|
+
var import_mui_progress = require("@availity/mui-progress");
|
|
412
352
|
var import_mui_dialog = require("@availity/mui-dialog");
|
|
413
|
-
var
|
|
353
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
414
354
|
var disclaimerQuery = `query disclaimerFindOne($id: ID!) {
|
|
415
355
|
configurationFindOne(id: $id) {
|
|
416
356
|
... on Text {
|
|
@@ -419,8 +359,8 @@ var disclaimerQuery = `query disclaimerFindOne($id: ID!) {
|
|
|
419
359
|
}
|
|
420
360
|
}`;
|
|
421
361
|
var DisclaimerModal = ({ disclaimerId }) => {
|
|
422
|
-
const [disclaimer, setDisclaimer] = (0,
|
|
423
|
-
(0,
|
|
362
|
+
const [disclaimer, setDisclaimer] = (0, import_react.useState)("");
|
|
363
|
+
(0, import_react.useEffect)(() => {
|
|
424
364
|
const fetchDisclaimer = () => __async(void 0, null, function* () {
|
|
425
365
|
if (disclaimerId) {
|
|
426
366
|
const result = yield import_api_axios2.avWebQLApi.create({ query: disclaimerQuery, variables: { id: disclaimerId } });
|
|
@@ -429,17 +369,18 @@ var DisclaimerModal = ({ disclaimerId }) => {
|
|
|
429
369
|
});
|
|
430
370
|
fetchDisclaimer();
|
|
431
371
|
}, [disclaimerId]);
|
|
432
|
-
return /* @__PURE__ */ (0,
|
|
372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_dialog.DialogContent, { children: disclaimer ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_markdown.default, { children: disclaimer }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_progress.CircularProgress, {}) });
|
|
433
373
|
};
|
|
434
374
|
|
|
435
375
|
// src/lib/modals/MultiPayerModal.tsx
|
|
436
376
|
var import_mui_dialog2 = require("@availity/mui-dialog");
|
|
437
377
|
var import_mui_layout = require("@availity/mui-layout");
|
|
438
|
-
var
|
|
378
|
+
var import_mui_typography = require("@availity/mui-typography");
|
|
439
379
|
|
|
440
380
|
// src/lib/SpacesImage.tsx
|
|
381
|
+
var import_mui_progress2 = require("@availity/mui-progress");
|
|
441
382
|
var import_react_image = require("react-image");
|
|
442
|
-
var
|
|
383
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
443
384
|
var SpacesImage = (_a) => {
|
|
444
385
|
var _b = _a, { spaceId, payerId, imageType = "url", fallback } = _b, props = __objRest(_b, ["spaceId", "payerId", "imageType", "fallback"]);
|
|
445
386
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
@@ -461,29 +402,29 @@ var SpacesImage = (_a) => {
|
|
|
461
402
|
};
|
|
462
403
|
let url = imageMap[imageType];
|
|
463
404
|
if (!url && loading) {
|
|
464
|
-
return /* @__PURE__ */ (0,
|
|
405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_mui_progress2.CircularProgress, { id: `app-${id}-loading` });
|
|
465
406
|
}
|
|
466
407
|
if (!url && !loading && fallback) {
|
|
467
408
|
url = fallback;
|
|
468
409
|
}
|
|
469
410
|
if (!url || !id)
|
|
470
411
|
return null;
|
|
471
|
-
return /* @__PURE__ */ (0,
|
|
412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
472
413
|
import_react_image.Img,
|
|
473
414
|
__spreadValues({
|
|
474
415
|
id: props.id || `app-img-${id}`,
|
|
475
416
|
src: url,
|
|
476
417
|
alt: `Space ${imageType}`,
|
|
477
|
-
loader: /* @__PURE__ */ (0,
|
|
418
|
+
loader: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_mui_progress2.CircularProgress, { id: `app-img-${id}-loading` })
|
|
478
419
|
}, props)
|
|
479
420
|
);
|
|
480
421
|
};
|
|
481
422
|
|
|
482
423
|
// src/lib/modals/MultiPayerModal.tsx
|
|
483
|
-
var
|
|
484
|
-
var MultiPayerModal = ({ parentPayerSpaces, name, state: { selectedOption }, setState }) => /* @__PURE__ */ (0,
|
|
485
|
-
/* @__PURE__ */ (0,
|
|
486
|
-
/* @__PURE__ */ (0,
|
|
424
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
425
|
+
var MultiPayerModal = ({ parentPayerSpaces, name, state: { selectedOption }, setState }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_mui_dialog2.DialogContent, { children: [
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_typography.Typography, { children: `Open ${name} as: ${selectedOption ? selectedOption.name || selectedOption.id : ""}` }),
|
|
427
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_layout.Grid, { direction: "row", children: parentPayerSpaces && parentPayerSpaces.map((payerSpace) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_layout.Box, { onClick: () => setState({ selectedOption: payerSpace }), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SpacesImage, { spaceId: payerSpace.configurationId, imageType: "images.tile" }) })) })
|
|
487
428
|
] });
|
|
488
429
|
|
|
489
430
|
// src/lib/modals/modal-types.tsx
|
|
@@ -491,16 +432,16 @@ var isModalOptions = (action) => action.spaceType !== void 0;
|
|
|
491
432
|
var isModalState = (action) => action.selectedOption !== void 0;
|
|
492
433
|
|
|
493
434
|
// src/lib/modals/ModalProvider.tsx
|
|
494
|
-
var
|
|
435
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
495
436
|
var MODAL_INITIAL_STATE = {
|
|
496
437
|
isOpen: false,
|
|
497
438
|
modalOptions: void 0,
|
|
498
439
|
modalState: { selectedOption: { id: "", name: "" } },
|
|
499
440
|
selectedModal: {}
|
|
500
441
|
};
|
|
501
|
-
var ModalContext = (0,
|
|
442
|
+
var ModalContext = (0, import_react2.createContext)(null);
|
|
502
443
|
var useModal = () => {
|
|
503
|
-
const ctx = (0,
|
|
444
|
+
const ctx = (0, import_react2.useContext)(ModalContext);
|
|
504
445
|
if (!ctx)
|
|
505
446
|
throw new Error("ModalContext be used inside a Provider");
|
|
506
447
|
return ctx;
|
|
@@ -571,27 +512,27 @@ var modalReducer = (state, _a) => {
|
|
|
571
512
|
return state;
|
|
572
513
|
};
|
|
573
514
|
var ModalProvider = ({ children }) => {
|
|
574
|
-
const [{ selectedModal, modalOptions, modalState, isOpen }, dispatch] = (0,
|
|
515
|
+
const [{ selectedModal, modalOptions, modalState, isOpen }, dispatch] = (0, import_react2.useReducer)(modalReducer, MODAL_INITIAL_STATE);
|
|
575
516
|
const toggle = () => dispatch({ type: "RESET" });
|
|
576
517
|
const buttonProps = (selectedModal == null ? void 0 : selectedModal.buttonProps) && (selectedModal == null ? void 0 : selectedModal.buttonProps(__spreadProps(__spreadValues({}, modalState), { modalOptions })));
|
|
577
518
|
const Body = selectedModal == null ? void 0 : selectedModal.body;
|
|
578
|
-
return /* @__PURE__ */ (0,
|
|
519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
579
520
|
ModalContext.Provider,
|
|
580
521
|
{
|
|
581
522
|
value: (modalType, modalOptions2) => dispatch(__spreadValues({ type: `OPEN_${modalType}` }, modalOptions2)),
|
|
582
523
|
children: [
|
|
583
|
-
/* @__PURE__ */ (0,
|
|
584
|
-
/* @__PURE__ */ (0,
|
|
585
|
-
Body && /* @__PURE__ */ (0,
|
|
524
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_mui_dialog3.Dialog, { open: isOpen, children: [
|
|
525
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_mui_dialog3.DialogTitle, { id: "disclaimer-header", children: modalOptions == null ? void 0 : modalOptions.title }),
|
|
526
|
+
Body && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
586
527
|
Body,
|
|
587
528
|
__spreadProps(__spreadValues({}, modalOptions), {
|
|
588
529
|
setState: (newState) => dispatch(__spreadValues({ type: "UPDATE_MODAL_STATE" }, newState)),
|
|
589
530
|
state: modalState
|
|
590
531
|
})
|
|
591
532
|
),
|
|
592
|
-
/* @__PURE__ */ (0,
|
|
593
|
-
/* @__PURE__ */ (0,
|
|
594
|
-
/* @__PURE__ */ (0,
|
|
533
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_mui_dialog3.DialogActions, { children: [
|
|
534
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_mui_button.Button, { onClick: toggle, children: "Cancel" }),
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
595
536
|
import_mui_button.Button,
|
|
596
537
|
__spreadProps(__spreadValues({
|
|
597
538
|
color: "primary"
|
|
@@ -624,12 +565,12 @@ var ModalProvider = ({ children }) => {
|
|
|
624
565
|
};
|
|
625
566
|
|
|
626
567
|
// src/lib/Spaces.tsx
|
|
627
|
-
var
|
|
568
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
628
569
|
var INITIAL_STATE = {
|
|
629
570
|
loading: true
|
|
630
571
|
};
|
|
631
|
-
var SpacesContext = (0,
|
|
632
|
-
var useSpacesContext = () => (0,
|
|
572
|
+
var SpacesContext = (0, import_react3.createContext)(INITIAL_STATE);
|
|
573
|
+
var useSpacesContext = () => (0, import_react3.useContext)(SpacesContext);
|
|
633
574
|
var Spaces = ({
|
|
634
575
|
query = configurationFindMany_default,
|
|
635
576
|
variables = { types: ["PAYERSPACE"] },
|
|
@@ -639,7 +580,7 @@ var Spaces = ({
|
|
|
639
580
|
spaceIds,
|
|
640
581
|
spaces: spacesFromProps
|
|
641
582
|
}) => {
|
|
642
|
-
const [{ previousSpacesMap, previousSpacesByConfigMap, previousSpacesByPayerMap, loading, error }, dispatch] = (0,
|
|
583
|
+
const [{ previousSpacesMap, previousSpacesByConfigMap, previousSpacesByPayerMap, loading, error }, dispatch] = (0, import_react3.useReducer)(spacesReducer, INITIAL_STATE);
|
|
643
584
|
const spacesMap = new Map(previousSpacesMap);
|
|
644
585
|
const configIdsMap = new Map(previousSpacesByConfigMap);
|
|
645
586
|
const payerIdsMap = new Map(previousSpacesByPayerMap);
|
|
@@ -698,7 +639,7 @@ var Spaces = ({
|
|
|
698
639
|
}
|
|
699
640
|
]
|
|
700
641
|
});
|
|
701
|
-
(0,
|
|
642
|
+
(0, import_react3.useEffect)(() => {
|
|
702
643
|
if (isErrorByPayerIds || isErrorBySpaceIds) {
|
|
703
644
|
dispatch({
|
|
704
645
|
type: "ERROR",
|
|
@@ -707,7 +648,7 @@ var Spaces = ({
|
|
|
707
648
|
});
|
|
708
649
|
}
|
|
709
650
|
}, [isErrorByPayerIds, isErrorBySpaceIds]);
|
|
710
|
-
(0,
|
|
651
|
+
(0, import_react3.useEffect)(() => {
|
|
711
652
|
dispatch({
|
|
712
653
|
type: "LOADING",
|
|
713
654
|
loading: true
|
|
@@ -774,7 +715,7 @@ var Spaces = ({
|
|
|
774
715
|
return isReactNodeFunction(children) ? (() => children({ spaces: [spacesMap.values()], loading, error }))() : children;
|
|
775
716
|
}
|
|
776
717
|
};
|
|
777
|
-
return /* @__PURE__ */ (0,
|
|
718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
778
719
|
SpacesContext.Provider,
|
|
779
720
|
{
|
|
780
721
|
value: {
|
|
@@ -784,7 +725,7 @@ var Spaces = ({
|
|
|
784
725
|
loading: loading || isLoadingByPayerIds || isLoadingBySpaceIds,
|
|
785
726
|
error
|
|
786
727
|
},
|
|
787
|
-
children: /* @__PURE__ */ (0,
|
|
728
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ModalProvider, { children: spacesChildren() })
|
|
788
729
|
}
|
|
789
730
|
);
|
|
790
731
|
};
|
|
@@ -813,305 +754,17 @@ var useSpaces = (...ids) => {
|
|
|
813
754
|
|
|
814
755
|
// src/lib/SpacesLink/SpacesLink.tsx
|
|
815
756
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
var
|
|
819
|
-
var
|
|
820
|
-
var
|
|
821
|
-
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
822
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Card.default, __spreadProps(__spreadValues({}, rest), { children }));
|
|
823
|
-
};
|
|
824
|
-
|
|
825
|
-
// ../card/src/lib/CardActionArea.tsx
|
|
826
|
-
var import_CardActionArea = __toESM(require("@mui/material/CardActionArea"));
|
|
827
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
828
|
-
|
|
829
|
-
// ../card/src/lib/CardActions.tsx
|
|
830
|
-
var import_CardActions = __toESM(require("@mui/material/CardActions"));
|
|
831
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
832
|
-
|
|
833
|
-
// ../card/src/lib/CardContent.tsx
|
|
834
|
-
var import_CardContent = __toESM(require("@mui/material/CardContent"));
|
|
835
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
836
|
-
var CardContent = (_a) => {
|
|
837
|
-
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
838
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_CardContent.default, __spreadProps(__spreadValues({}, rest), { children }));
|
|
839
|
-
};
|
|
840
|
-
|
|
841
|
-
// ../card/src/lib/CardHeader.tsx
|
|
842
|
-
var import_styles = require("@mui/material/styles");
|
|
843
|
-
var import_CardHeader = __toESM(require("@mui/material/CardHeader"));
|
|
844
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
845
|
-
|
|
846
|
-
// ../card/src/lib/CardMedia.tsx
|
|
847
|
-
var import_CardMedia = __toESM(require("@mui/material/CardMedia"));
|
|
848
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
849
|
-
|
|
850
|
-
// src/lib/SpacesLink/SpacesLink.tsx
|
|
851
|
-
var import_mui_typography3 = require("@availity/mui-typography");
|
|
852
|
-
var import_react9 = require("react");
|
|
853
|
-
|
|
854
|
-
// ../chip/src/lib/Chip.tsx
|
|
855
|
-
var import_Chip = __toESM(require("@mui/material/Chip"));
|
|
856
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
857
|
-
|
|
858
|
-
// ../chip/src/lib/StatusChip.tsx
|
|
859
|
-
var import_Chip2 = __toESM(require("@mui/material/Chip"));
|
|
860
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
861
|
-
var StatusChip = (_a) => {
|
|
862
|
-
var _b = _a, { color = "default" } = _b, rest = __objRest(_b, ["color"]);
|
|
863
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Chip2.default, __spreadProps(__spreadValues({ color }, rest), { size: "small" }));
|
|
864
|
-
};
|
|
865
|
-
|
|
866
|
-
// src/lib/SpacesLink/SpacesLink.tsx
|
|
757
|
+
var import_mui_card = require("@availity/mui-card");
|
|
758
|
+
var import_mui_typography2 = require("@availity/mui-typography");
|
|
759
|
+
var import_react4 = require("react");
|
|
760
|
+
var import_mui_chip = require("@availity/mui-chip");
|
|
761
|
+
var import_mui_progress3 = require("@availity/mui-progress");
|
|
867
762
|
var import_Link = __toESM(require("@mui/material/Link"));
|
|
868
|
-
|
|
869
|
-
// ../favorites/src/lib/Favorites.tsx
|
|
870
|
-
var import_react5 = require("react");
|
|
871
|
-
var import_react_query3 = require("@tanstack/react-query");
|
|
872
|
-
var import_message_core3 = __toESM(require("@availity/message-core"));
|
|
873
|
-
|
|
874
|
-
// ../favorites/src/lib/utils.ts
|
|
875
|
-
var import_message_core2 = __toESM(require("@availity/message-core"));
|
|
876
|
-
var import_api_axios3 = require("@availity/api-axios");
|
|
877
|
-
var import_react_query2 = require("@tanstack/react-query");
|
|
878
|
-
|
|
879
|
-
// ../favorites/src/lib/Favorites.tsx
|
|
880
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
881
|
-
var FavoritesContext = (0, import_react5.createContext)(null);
|
|
882
|
-
var noOp = () => {
|
|
883
|
-
};
|
|
884
|
-
var useFavorites = (id) => {
|
|
885
|
-
const context = (0, import_react5.useContext)(FavoritesContext);
|
|
886
|
-
if (context === null) {
|
|
887
|
-
throw new Error("useFavorites must be used within a FavoritesProvider");
|
|
888
|
-
}
|
|
889
|
-
const { favorites, queryStatus, mutationStatus, lastClickedFavoriteId, deleteFavorite, addFavorite } = context;
|
|
890
|
-
const isLastClickedFavorite = lastClickedFavoriteId === id;
|
|
891
|
-
const isFavorited = (0, import_react5.useMemo)(() => {
|
|
892
|
-
const fav = favorites == null ? void 0 : favorites.find((f) => f.id === id);
|
|
893
|
-
return !!fav;
|
|
894
|
-
}, [favorites, id]);
|
|
895
|
-
const toggleFavorite = () => isFavorited ? deleteFavorite(id) : addFavorite(id);
|
|
896
|
-
const isDisabled = queryStatus === "loading" || queryStatus === "idle" || mutationStatus === "loading";
|
|
897
|
-
let status = "initLoading";
|
|
898
|
-
if (queryStatus === "loading")
|
|
899
|
-
status = "initLoading";
|
|
900
|
-
if (mutationStatus === "loading")
|
|
901
|
-
status = "reloading";
|
|
902
|
-
if (queryStatus === "error" || mutationStatus === "error")
|
|
903
|
-
status = "error";
|
|
904
|
-
if (queryStatus === "success" && (mutationStatus === "success" || mutationStatus === "idle"))
|
|
905
|
-
status = "success";
|
|
906
|
-
return {
|
|
907
|
-
isFavorited,
|
|
908
|
-
status,
|
|
909
|
-
isLastClickedFavorite,
|
|
910
|
-
toggleFavorite: isDisabled ? noOp : toggleFavorite
|
|
911
|
-
};
|
|
912
|
-
};
|
|
913
|
-
|
|
914
|
-
// ../tooltip/src/lib/Tooltip.tsx
|
|
915
|
-
var import_Tooltip = __toESM(require("@mui/material/Tooltip"));
|
|
916
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
917
|
-
var Tooltip = (props) => {
|
|
918
|
-
const _a = props, { children, dangerouslySetTransitionTimer } = _a, rest = __objRest(_a, ["children", "dangerouslySetTransitionTimer"]);
|
|
919
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
920
|
-
import_Tooltip.default,
|
|
921
|
-
__spreadProps(__spreadValues({}, rest), {
|
|
922
|
-
TransitionProps: { timeout: dangerouslySetTransitionTimer !== void 0 ? dangerouslySetTransitionTimer : 100 },
|
|
923
|
-
arrow: true,
|
|
924
|
-
children
|
|
925
|
-
})
|
|
926
|
-
);
|
|
927
|
-
};
|
|
928
|
-
|
|
929
|
-
// ../favorites/src/lib/FavoriteHeart.tsx
|
|
930
|
-
var import_mui_icon2 = require("@availity/mui-icon");
|
|
931
|
-
var import_styles2 = require("@mui/material/styles");
|
|
932
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
933
|
-
var icons = {
|
|
934
|
-
spinner: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CircularProgress, { "aria-hidden": true, size: "small", loadingCaption: false }),
|
|
935
|
-
unknownDisabledHeart: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_mui_icon2.HeartIcon, { "aria-hidden": true, color: "disabled" }),
|
|
936
|
-
favoritedDisabledHeart: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_mui_icon2.HeartIcon, { "aria-hidden": true, color: "error", opacity: "0.6" }),
|
|
937
|
-
unfavoritedDisabledHeart: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_mui_icon2.HeartEmptyIcon, { "aria-hidden": true, color: "disabled", opacity: "0.6" }),
|
|
938
|
-
favoritedHeart: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_mui_icon2.HeartIcon, { "aria-hidden": true, color: "error" }),
|
|
939
|
-
unfavoritedHeart: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_mui_icon2.HeartEmptyIcon, { "aria-hidden": true, color: "secondary" })
|
|
940
|
-
};
|
|
941
|
-
var FavoriteHeartContainer = (0, import_styles2.styled)("div", { name: "AvFavoriteHeart", slot: "root" })({});
|
|
942
|
-
var FavoriteInput = (0, import_styles2.styled)("input", {
|
|
943
|
-
name: "AvFavoriteHeart",
|
|
944
|
-
slot: "input"
|
|
945
|
-
})({});
|
|
946
|
-
var FavoriteIcon = (0, import_styles2.styled)("div", {
|
|
947
|
-
name: "AvFavoriteHeart",
|
|
948
|
-
slot: "icon"
|
|
949
|
-
})({});
|
|
950
|
-
var FavoriteHeart = ({
|
|
951
|
-
id,
|
|
952
|
-
name,
|
|
953
|
-
onChange,
|
|
954
|
-
onMouseDown,
|
|
955
|
-
disabled = false
|
|
956
|
-
}) => {
|
|
957
|
-
const { isFavorited, isLastClickedFavorite, status, toggleFavorite } = useFavorites(id);
|
|
958
|
-
const handleChange = (event) => {
|
|
959
|
-
onChange == null ? void 0 : onChange(isFavorited, event);
|
|
960
|
-
toggleFavorite();
|
|
961
|
-
};
|
|
962
|
-
const handleKeyPress = (event) => {
|
|
963
|
-
if (event.code === "Enter" || event.key === "Enter") {
|
|
964
|
-
onChange == null ? void 0 : onChange(isFavorited, event);
|
|
965
|
-
toggleFavorite();
|
|
966
|
-
}
|
|
967
|
-
};
|
|
968
|
-
const iconKey = (() => {
|
|
969
|
-
if (status === "initLoading")
|
|
970
|
-
return "unknownDisabledHeart";
|
|
971
|
-
if (status === "reloading") {
|
|
972
|
-
if (isLastClickedFavorite)
|
|
973
|
-
return "spinner";
|
|
974
|
-
return isFavorited ? "favoritedDisabledHeart" : "unfavoritedDisabledHeart";
|
|
975
|
-
}
|
|
976
|
-
if (disabled) {
|
|
977
|
-
return isFavorited ? "favoritedDisabledHeart" : "unfavoritedDisabledHeart";
|
|
978
|
-
}
|
|
979
|
-
if (isFavorited)
|
|
980
|
-
return "favoritedHeart";
|
|
981
|
-
return "unfavoritedHeart";
|
|
982
|
-
})();
|
|
983
|
-
const cursor = disabled || !isLastClickedFavorite && (status === "initLoading" || status === "reloading") ? "not-allowed" : void 0;
|
|
984
|
-
const tooltipContent = `${isFavorited ? "Remove from" : "Add to"} My Favorites`;
|
|
985
|
-
const favoriteInputProps = {
|
|
986
|
-
onKeyDown: handleKeyPress,
|
|
987
|
-
type: "checkbox",
|
|
988
|
-
"aria-label": `Favorite ${name}`,
|
|
989
|
-
id: `av-favorite-heart-${id}`,
|
|
990
|
-
disabled,
|
|
991
|
-
checked: isFavorited,
|
|
992
|
-
onChange: handleChange,
|
|
993
|
-
onMouseDown,
|
|
994
|
-
style: { cursor }
|
|
995
|
-
};
|
|
996
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(FavoriteHeartContainer, { children: [
|
|
997
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FavoriteIcon, { children: icons[iconKey] }),
|
|
998
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
999
|
-
"span",
|
|
1000
|
-
{
|
|
1001
|
-
style: {
|
|
1002
|
-
position: "absolute",
|
|
1003
|
-
width: "1px",
|
|
1004
|
-
height: "1px",
|
|
1005
|
-
padding: 0,
|
|
1006
|
-
margin: "-1px",
|
|
1007
|
-
overflow: "hidden",
|
|
1008
|
-
clip: "rect(0,0,0,0)",
|
|
1009
|
-
whiteSpace: "nowrap",
|
|
1010
|
-
border: 0
|
|
1011
|
-
},
|
|
1012
|
-
"aria-live": isLastClickedFavorite && (status === "reloading" || status === "error") ? "polite" : "off",
|
|
1013
|
-
children: isLastClickedFavorite && status === "reloading" ? "Loading..." : isLastClickedFavorite && status === "error" ? "An error has occurred. Please try again." : ""
|
|
1014
|
-
}
|
|
1015
|
-
),
|
|
1016
|
-
disabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FavoriteInput, __spreadValues({}, favoriteInputProps)) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tooltip, { title: tooltipContent, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FavoriteInput, __spreadValues({}, favoriteInputProps)) })
|
|
1017
|
-
] });
|
|
1018
|
-
};
|
|
1019
|
-
|
|
1020
|
-
// src/lib/SpacesLink/SpacesLink.tsx
|
|
763
|
+
var import_mui_favorites = require("@availity/mui-favorites");
|
|
1021
764
|
var import_mui_layout2 = require("@availity/mui-layout");
|
|
1022
|
-
|
|
1023
|
-
// ../list/src/lib/List.tsx
|
|
1024
|
-
var import_List = __toESM(require("@mui/material/List"));
|
|
1025
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1026
|
-
|
|
1027
|
-
// ../list/src/lib/ListItem.tsx
|
|
1028
|
-
var import_ListItem = __toESM(require("@mui/material/ListItem"));
|
|
1029
|
-
var import_react6 = require("react");
|
|
1030
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1031
|
-
var ListItem = (0, import_react6.forwardRef)((props, ref) => {
|
|
1032
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_ListItem.default, __spreadProps(__spreadValues({}, props), { ref }));
|
|
1033
|
-
});
|
|
1034
|
-
|
|
1035
|
-
// ../list/src/lib/ListItemAvatar.tsx
|
|
1036
|
-
var import_ListItemAvatar = __toESM(require("@mui/material/ListItemAvatar"));
|
|
1037
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1038
|
-
|
|
1039
|
-
// ../list/src/lib/ListItemButton.tsx
|
|
1040
|
-
var import_ListItemButton = __toESM(require("@mui/material/ListItemButton"));
|
|
1041
|
-
var import_react7 = require("react");
|
|
1042
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1043
|
-
var ListItemButton = (0, import_react7.forwardRef)((props, ref) => {
|
|
1044
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_ListItemButton.default, __spreadProps(__spreadValues({}, props), { ref }));
|
|
1045
|
-
});
|
|
1046
|
-
|
|
1047
|
-
// ../list/src/lib/ListItemIcon.tsx
|
|
1048
|
-
var import_ListItemIcon = __toESM(require("@mui/material/ListItemIcon"));
|
|
1049
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1050
|
-
|
|
1051
|
-
// ../list/src/lib/ListItemStatusCard.tsx
|
|
1052
|
-
var import_react8 = require("react");
|
|
1053
|
-
var import_styles3 = require("@mui/material/styles");
|
|
1054
|
-
var import_ListItem2 = __toESM(require("@mui/material/ListItem"));
|
|
1055
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1056
|
-
var ListItemStatusCardSlot = (0, import_styles3.styled)(import_ListItem2.default, {
|
|
1057
|
-
name: "AvListItemStatusCard",
|
|
1058
|
-
slot: "root",
|
|
1059
|
-
overridesResolver: (props, styles) => [styles.root, props.color && styles.color]
|
|
1060
|
-
})(({ theme, ownerState }) => __spreadValues({
|
|
1061
|
-
backgroundColor: theme.palette.background.paper,
|
|
1062
|
-
border: `1px solid ${theme.palette.divider}`,
|
|
1063
|
-
borderRadius: "4px",
|
|
1064
|
-
marginBottom: "4px",
|
|
1065
|
-
paddingLeft: "8px",
|
|
1066
|
-
"&.MuiListItem-padding.MuiListItem-gutters": {
|
|
1067
|
-
paddingLeft: "calc(16px + 8px)"
|
|
1068
|
-
}
|
|
1069
|
-
}, ownerState.color && ownerState.color !== "default" && {
|
|
1070
|
-
".AvListItemStatusCard-statusAccent": {
|
|
1071
|
-
backgroundColor: `${theme.palette[ownerState.color].main}`
|
|
1072
|
-
}
|
|
1073
|
-
}));
|
|
1074
|
-
var StatusAccent = (0, import_styles3.styled)("div", {
|
|
1075
|
-
name: "AvListItemStatusCard",
|
|
1076
|
-
slot: "statusAccent",
|
|
1077
|
-
overridesResolver: (props, styles) => [styles.statusAccent, props.color && styles.color]
|
|
1078
|
-
})(({ theme }) => ({
|
|
1079
|
-
position: "absolute",
|
|
1080
|
-
left: 0,
|
|
1081
|
-
top: 0,
|
|
1082
|
-
height: "100%",
|
|
1083
|
-
width: "8px",
|
|
1084
|
-
backgroundColor: theme.palette.divider,
|
|
1085
|
-
backgroundClip: "border-box",
|
|
1086
|
-
borderTopLeftRadius: "3px",
|
|
1087
|
-
borderBottomLeftRadius: "3px",
|
|
1088
|
-
content: "''"
|
|
1089
|
-
}));
|
|
1090
|
-
var ListItemStatusCard = (0, import_react8.forwardRef)((props, ref) => {
|
|
1091
|
-
const _a = props, { alignItems = "flex-start", children, color } = _a, rest = __objRest(_a, ["alignItems", "children", "color"]);
|
|
1092
|
-
const themeProps = (0, import_styles3.useThemeProps)({ props, name: "AvListItemStatusCard" });
|
|
1093
|
-
const ownerState = __spreadProps(__spreadValues({}, themeProps), { color });
|
|
1094
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(ListItemStatusCardSlot, __spreadProps(__spreadValues({ alignItems, divider: false, ownerState }, rest), { ref, children: [
|
|
1095
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StatusAccent, { className: "AvListItemStatusCard-statusAccent" }),
|
|
1096
|
-
children
|
|
1097
|
-
] }));
|
|
1098
|
-
});
|
|
1099
|
-
|
|
1100
|
-
// ../list/src/lib/ListItemText.tsx
|
|
1101
|
-
var import_ListItemText = __toESM(require("@mui/material/ListItemText"));
|
|
1102
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1103
|
-
var ListItemText = (_a) => {
|
|
1104
|
-
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
1105
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ListItemText.default, __spreadProps(__spreadValues({}, rest), { children }));
|
|
1106
|
-
};
|
|
1107
|
-
|
|
1108
|
-
// ../list/src/lib/ListSubheader.tsx
|
|
1109
|
-
var import_ListSubheader = __toESM(require("@mui/material/ListSubheader"));
|
|
1110
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1111
|
-
|
|
1112
|
-
// src/lib/SpacesLink/SpacesLink.tsx
|
|
765
|
+
var import_mui_list = require("@availity/mui-list");
|
|
1113
766
|
var import_react_markdown2 = __toESM(require("react-markdown"));
|
|
1114
|
-
var
|
|
767
|
+
var import_styles = require("@mui/material/styles");
|
|
1115
768
|
|
|
1116
769
|
// src/lib/SpacesLink/useLink.tsx
|
|
1117
770
|
var import_hooks = require("@availity/hooks");
|
|
@@ -1254,20 +907,20 @@ var useLink = (spaceOrSpaceId, options) => {
|
|
|
1254
907
|
};
|
|
1255
908
|
|
|
1256
909
|
// src/lib/SpacesLink/SpacesLink.tsx
|
|
1257
|
-
var
|
|
1258
|
-
var SpacesLinkContainer = (0,
|
|
1259
|
-
var DateInfo = (0,
|
|
1260
|
-
var SpacesLinkFavoriteHeart = (0,
|
|
1261
|
-
var IconLink = (0,
|
|
910
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
911
|
+
var SpacesLinkContainer = (0, import_styles.styled)(import_mui_layout2.Box, { name: "AvSpacesLink", slot: "root" })({});
|
|
912
|
+
var DateInfo = (0, import_styles.styled)(import_mui_layout2.Grid, { name: "AvSpacesLink", slot: "AvDateInfo" })({});
|
|
913
|
+
var SpacesLinkFavoriteHeart = (0, import_styles.styled)(import_mui_layout2.Grid, { name: "AvSpacesLink", slot: "AvFavoriteHeart" })({});
|
|
914
|
+
var IconLink = (0, import_styles.styled)(import_Link.default, { name: "AvSpacesLink", slot: "IconLink" })({});
|
|
1262
915
|
var getDisplayDate = (date) => (0, import_dayjs2.default)(date).format("MM/DD/YYYY");
|
|
1263
916
|
var getContainerTag = (propTag, variant) => {
|
|
1264
917
|
if (variant && variant !== "default")
|
|
1265
|
-
return { card: Card, list: ListItem }[variant];
|
|
918
|
+
return { card: import_mui_card.Card, list: import_mui_list.ListItem }[variant];
|
|
1266
919
|
return propTag || "div";
|
|
1267
920
|
};
|
|
1268
921
|
var getBodyTag = (propTag, variant) => {
|
|
1269
922
|
if (variant && variant !== "default")
|
|
1270
|
-
return { card: CardContent, list: "div" }[variant];
|
|
923
|
+
return { card: import_mui_card.CardContent, list: "div" }[variant];
|
|
1271
924
|
return propTag || "div";
|
|
1272
925
|
};
|
|
1273
926
|
var getTitleTag = (propTag, variant) => {
|
|
@@ -1277,7 +930,7 @@ var getTitleTag = (propTag, variant) => {
|
|
|
1277
930
|
};
|
|
1278
931
|
var getTextTag = (propTag, variant) => {
|
|
1279
932
|
if (variant && variant !== "default")
|
|
1280
|
-
return { card:
|
|
933
|
+
return { card: import_mui_typography2.Typography, list: import_mui_list.ListItemText }[variant];
|
|
1281
934
|
return propTag || "div";
|
|
1282
935
|
};
|
|
1283
936
|
var SpacesLink = (_a) => {
|
|
@@ -1345,9 +998,9 @@ var SpacesLink = (_a) => {
|
|
|
1345
998
|
const isLoading = loading || propsLoading;
|
|
1346
999
|
const [linkSpace, props] = useLink(propSpace || spaceId, { clientId: propsClientId, linkAttributes });
|
|
1347
1000
|
const showUrl = !(linkSpace == null ? void 0 : linkSpace.isGhosted) && ((_a2 = linkSpace == null ? void 0 : linkSpace.link) == null ? void 0 : _a2.url);
|
|
1348
|
-
const favoriteIcon = (0,
|
|
1349
|
-
() => (linkSpace == null ? void 0 : linkSpace.configurationId) && favorite && /* @__PURE__ */ (0,
|
|
1350
|
-
FavoriteHeart,
|
|
1001
|
+
const favoriteIcon = (0, import_react4.useMemo)(
|
|
1002
|
+
() => (linkSpace == null ? void 0 : linkSpace.configurationId) && favorite && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SpacesLinkFavoriteHeart, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1003
|
+
import_mui_favorites.FavoriteHeart,
|
|
1351
1004
|
{
|
|
1352
1005
|
id: `${idPrefix}${linkSpace == null ? void 0 : linkSpace.configurationId}`,
|
|
1353
1006
|
name: linkSpace == null ? void 0 : linkSpace.name,
|
|
@@ -1356,11 +1009,11 @@ var SpacesLink = (_a) => {
|
|
|
1356
1009
|
) }),
|
|
1357
1010
|
[favorite, linkSpace == null ? void 0 : linkSpace.configurationId, linkSpace == null ? void 0 : linkSpace.name, idPrefix]
|
|
1358
1011
|
);
|
|
1359
|
-
const dateInfo = (0,
|
|
1360
|
-
() => (showNew || showDate) && /* @__PURE__ */ (0,
|
|
1361
|
-
showNew && (linkSpace == null ? void 0 : linkSpace.isNew) && /* @__PURE__ */ (0,
|
|
1362
|
-
showDate && /* @__PURE__ */ (0,
|
|
1363
|
-
|
|
1012
|
+
const dateInfo = (0, import_react4.useMemo)(
|
|
1013
|
+
() => (showNew || showDate) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DateInfo, { textAlign: stacked ? "center" : "right", children: [
|
|
1014
|
+
showNew && (linkSpace == null ? void 0 : linkSpace.isNew) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_mui_chip.StatusChip, { id: `${idPrefix}app-new-badge-${linkSpace == null ? void 0 : linkSpace.configurationId}`, label: "New!", color: "secondary" }),
|
|
1015
|
+
showDate && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1016
|
+
import_mui_typography2.Typography,
|
|
1364
1017
|
{
|
|
1365
1018
|
id: `${idPrefix}app-date-badge-${linkSpace == null ? void 0 : linkSpace.configurationId}`,
|
|
1366
1019
|
variant: "caption",
|
|
@@ -1371,14 +1024,14 @@ var SpacesLink = (_a) => {
|
|
|
1371
1024
|
] }),
|
|
1372
1025
|
[linkSpace == null ? void 0 : linkSpace.activeDate, linkSpace == null ? void 0 : linkSpace.isNew, showDate, showNew, stacked, linkSpace == null ? void 0 : linkSpace.configurationId, idPrefix]
|
|
1373
1026
|
);
|
|
1374
|
-
const customBadgeDisplay = (0,
|
|
1375
|
-
() => customBadgeText && /* @__PURE__ */ (0,
|
|
1027
|
+
const customBadgeDisplay = (0, import_react4.useMemo)(
|
|
1028
|
+
() => customBadgeText && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1376
1029
|
import_mui_layout2.Box,
|
|
1377
1030
|
{
|
|
1378
1031
|
textAlign: stacked ? "center" : "inherit",
|
|
1379
1032
|
marginRight: variant !== "card" && (showDate || showNew && (linkSpace == null ? void 0 : linkSpace.isNew)) ? 1 : void 0,
|
|
1380
|
-
children: /* @__PURE__ */ (0,
|
|
1381
|
-
StatusChip,
|
|
1033
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1034
|
+
import_mui_chip.StatusChip,
|
|
1382
1035
|
{
|
|
1383
1036
|
color: customBadgeColor || "info",
|
|
1384
1037
|
id: `${idPrefix}app-custom-badge-${linkSpace == null ? void 0 : linkSpace.configurationId}-${customBadgeText}`,
|
|
@@ -1400,7 +1053,7 @@ var SpacesLink = (_a) => {
|
|
|
1400
1053
|
]
|
|
1401
1054
|
);
|
|
1402
1055
|
if (isLoading) {
|
|
1403
|
-
return /* @__PURE__ */ (0,
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_mui_progress3.CircularProgress, __spreadValues({ id: `${idPrefix}app-${linkSpace == null ? void 0 : linkSpace.configurationId}-loading` }, rest));
|
|
1404
1057
|
}
|
|
1405
1058
|
const Tag = getContainerTag(tag, variant);
|
|
1406
1059
|
const BodyTag = getBodyTag(bodyTag, variant);
|
|
@@ -1408,7 +1061,7 @@ var SpacesLink = (_a) => {
|
|
|
1408
1061
|
const TextTag = getTextTag(textTag, variant);
|
|
1409
1062
|
const renderChildren = () => {
|
|
1410
1063
|
if (children) {
|
|
1411
|
-
return isFunction(children) ? (() => children(__spreadValues(__spreadValues(__spreadValues({}, linkSpace), analytics), props)))() : (0,
|
|
1064
|
+
return isFunction(children) ? (() => children(__spreadValues(__spreadValues(__spreadValues({}, linkSpace), analytics), props)))() : (0, import_react4.cloneElement)(children, __spreadValues(__spreadValues({
|
|
1412
1065
|
role: "link",
|
|
1413
1066
|
tabIndex: 0,
|
|
1414
1067
|
style: { cursor: showUrl ? "pointer" : "not-allowed" },
|
|
@@ -1416,7 +1069,7 @@ var SpacesLink = (_a) => {
|
|
|
1416
1069
|
}, analytics), props));
|
|
1417
1070
|
}
|
|
1418
1071
|
};
|
|
1419
|
-
return /* @__PURE__ */ (0,
|
|
1072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1420
1073
|
SpacesLinkContainer,
|
|
1421
1074
|
__spreadProps(__spreadValues({
|
|
1422
1075
|
component: Tag,
|
|
@@ -1425,7 +1078,7 @@ var SpacesLink = (_a) => {
|
|
|
1425
1078
|
}, rest), {
|
|
1426
1079
|
style: __spreadValues({}, style),
|
|
1427
1080
|
role: variant === "list" ? "listitem" : role,
|
|
1428
|
-
children: /* @__PURE__ */ (0,
|
|
1081
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BodyTag, { style: { width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1429
1082
|
import_mui_layout2.Grid,
|
|
1430
1083
|
{
|
|
1431
1084
|
alignItems: !showDescription || stacked ? "center" : "start",
|
|
@@ -1434,24 +1087,24 @@ var SpacesLink = (_a) => {
|
|
|
1434
1087
|
flexWrap: "nowrap",
|
|
1435
1088
|
children: [
|
|
1436
1089
|
!stacked && favoriteIcon,
|
|
1437
|
-
FileIcon && (linkSpace == null ? void 0 : linkSpace.url) && ((_b2 = linkSpace == null ? void 0 : linkSpace.type) == null ? void 0 : _b2.toUpperCase()) === "FILE" ? /* @__PURE__ */ (0,
|
|
1090
|
+
FileIcon && (linkSpace == null ? void 0 : linkSpace.url) && ((_b2 = linkSpace == null ? void 0 : linkSpace.type) == null ? void 0 : _b2.toUpperCase()) === "FILE" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1438
1091
|
IconLink,
|
|
1439
1092
|
{
|
|
1440
1093
|
target: "_blank",
|
|
1441
1094
|
href: linkSpace == null ? void 0 : linkSpace.url,
|
|
1442
1095
|
role: "link",
|
|
1443
1096
|
"aria-labelledby": `${idPrefix}app-title-${linkSpace == null ? void 0 : linkSpace.configurationId}`,
|
|
1444
|
-
children: /* @__PURE__ */ (0,
|
|
1097
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FileIcon, { "data-testid": "icon" })
|
|
1445
1098
|
}
|
|
1446
1099
|
) : null,
|
|
1447
|
-
children ? renderChildren() : body && /* @__PURE__ */ (0,
|
|
1448
|
-
/* @__PURE__ */ (0,
|
|
1100
|
+
children ? renderChildren() : body && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_mui_layout2.Grid, { id: `${idPrefix}${linkSpace == null ? void 0 : linkSpace.type}-${linkSpace == null ? void 0 : linkSpace.configurationId}`, flexGrow: 1, children: [
|
|
1101
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1449
1102
|
import_mui_layout2.Box,
|
|
1450
1103
|
{
|
|
1451
1104
|
marginBottom: !customBadgeDisplay && (!showDescription || !(linkSpace == null ? void 0 : linkSpace.description)) ? 0 : void 0,
|
|
1452
1105
|
paddingTop: stacked ? 3 : void 0,
|
|
1453
1106
|
textAlign: stacked ? "center" : void 0,
|
|
1454
|
-
children: /* @__PURE__ */ (0,
|
|
1107
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1455
1108
|
TitleTag,
|
|
1456
1109
|
__spreadProps(__spreadValues(__spreadValues({
|
|
1457
1110
|
id: `${idPrefix}app-title-${linkSpace == null ? void 0 : linkSpace.configurationId}`,
|
|
@@ -1472,7 +1125,7 @@ var SpacesLink = (_a) => {
|
|
|
1472
1125
|
}
|
|
1473
1126
|
),
|
|
1474
1127
|
stacked && dateInfo,
|
|
1475
|
-
showDescription && (linkSpace == null ? void 0 : linkSpace.description) && /* @__PURE__ */ (0,
|
|
1128
|
+
showDescription && (linkSpace == null ? void 0 : linkSpace.description) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1476
1129
|
TextTag,
|
|
1477
1130
|
{
|
|
1478
1131
|
component: "div",
|
|
@@ -1485,7 +1138,7 @@ var SpacesLink = (_a) => {
|
|
|
1485
1138
|
textOverflow: "ellipsis"
|
|
1486
1139
|
},
|
|
1487
1140
|
id: `${idPrefix}app-description-${linkSpace == null ? void 0 : linkSpace.configurationId}`,
|
|
1488
|
-
children: /* @__PURE__ */ (0,
|
|
1141
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_markdown2.default, { children: linkSpace == null ? void 0 : linkSpace.description })
|
|
1489
1142
|
}
|
|
1490
1143
|
),
|
|
1491
1144
|
variant === "card" && customBadgeDisplay
|
|
@@ -1500,16 +1153,16 @@ var SpacesLink = (_a) => {
|
|
|
1500
1153
|
};
|
|
1501
1154
|
|
|
1502
1155
|
// src/lib/SpacesAgreement.tsx
|
|
1503
|
-
var
|
|
1156
|
+
var import_mui_typography3 = require("@availity/mui-typography");
|
|
1504
1157
|
var import_react_markdown3 = __toESM(require("react-markdown"));
|
|
1505
|
-
var
|
|
1158
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1506
1159
|
var SpacesAgreement = ({ spaceId, markdown = false, id: elementId }) => {
|
|
1507
1160
|
const spaces = useSpaces(spaceId);
|
|
1508
1161
|
if (spaces && spaces.length > 0) {
|
|
1509
1162
|
const { description: agreement, id } = spaces[0];
|
|
1510
1163
|
if (agreement) {
|
|
1511
|
-
const children = markdown ? /* @__PURE__ */ (0,
|
|
1512
|
-
return /* @__PURE__ */ (0,
|
|
1164
|
+
const children = markdown ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_markdown3.default, { children: agreement }) : agreement;
|
|
1165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_mui_typography3.Typography, { variant: "agreement", id: elementId || `spaces-agreement-${spaceId || id}`, children });
|
|
1513
1166
|
}
|
|
1514
1167
|
}
|
|
1515
1168
|
return null;
|
|
@@ -1518,7 +1171,7 @@ var SpacesAgreement = ({ spaceId, markdown = false, id: elementId }) => {
|
|
|
1518
1171
|
// src/lib/SpacesDisclaimer.tsx
|
|
1519
1172
|
var import_mui_disclaimer = require("@availity/mui-disclaimer");
|
|
1520
1173
|
var import_react_markdown4 = __toESM(require("react-markdown"));
|
|
1521
|
-
var
|
|
1174
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1522
1175
|
var SpacesDisclaimer = (_a) => {
|
|
1523
1176
|
var _b = _a, {
|
|
1524
1177
|
accent = true,
|
|
@@ -1535,8 +1188,8 @@ var SpacesDisclaimer = (_a) => {
|
|
|
1535
1188
|
if (spaces && spaces.length > 0) {
|
|
1536
1189
|
const { description: disclaimer, id } = spaces[0];
|
|
1537
1190
|
if (disclaimer) {
|
|
1538
|
-
const children = markdown ? /* @__PURE__ */ (0,
|
|
1539
|
-
return /* @__PURE__ */ (0,
|
|
1191
|
+
const children = markdown ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_markdown4.default, { children: disclaimer }) : disclaimer;
|
|
1192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1540
1193
|
import_mui_disclaimer.Disclaimer,
|
|
1541
1194
|
__spreadValues({
|
|
1542
1195
|
accent,
|
|
@@ -1550,14 +1203,14 @@ var SpacesDisclaimer = (_a) => {
|
|
|
1550
1203
|
};
|
|
1551
1204
|
|
|
1552
1205
|
// src/lib/SpacesGhostText.tsx
|
|
1553
|
-
var
|
|
1206
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1554
1207
|
var SpacesGhostText = (_a) => {
|
|
1555
1208
|
var _b = _a, { spaceId, id } = _b, props = __objRest(_b, ["spaceId", "id"]);
|
|
1556
1209
|
var _a2;
|
|
1557
1210
|
const spaces = useSpaces(spaceId);
|
|
1558
1211
|
const space = spaces == null ? void 0 : spaces[0];
|
|
1559
1212
|
if (space == null ? void 0 : space.isGhosted) {
|
|
1560
|
-
return /* @__PURE__ */ (0,
|
|
1213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", __spreadProps(__spreadValues({ id: id || `app-ghost-text-${spaceId}` }, props), { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("em", { children: (_a2 = space == null ? void 0 : space.meta) == null ? void 0 : _a2.ghostText }) }));
|
|
1561
1214
|
}
|
|
1562
1215
|
return null;
|
|
1563
1216
|
};
|