@xyo-network/react-embed 2.64.0 → 2.64.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/components/EmbedPlugin.js +203 -11
- package/dist/browser/components/EmbedPlugin.js.map +1 -1
- package/dist/browser/components/EmbedResolver.js +13 -3
- package/dist/browser/components/EmbedResolver.js.map +1 -1
- package/dist/browser/components/controls/EmbedFormControl.js +3 -2
- package/dist/browser/components/controls/EmbedFormControl.js.map +1 -1
- package/dist/browser/components/controls/ListModeSelect.js +23 -11
- package/dist/browser/components/controls/ListModeSelect.js.map +1 -1
- package/dist/browser/components/controls/RenderSelect.js +26 -7
- package/dist/browser/components/controls/RenderSelect.js.map +1 -1
- package/dist/browser/components/controls/index.js +63 -3
- package/dist/browser/components/controls/index.js.map +1 -1
- package/dist/browser/components/embed-card/EmbedCardResolver.js +52 -5
- package/dist/browser/components/embed-card/EmbedCardResolver.js.map +1 -1
- package/dist/browser/components/embed-card/EmbedPluginCard.js +429 -11
- package/dist/browser/components/embed-card/EmbedPluginCard.js.map +1 -1
- package/dist/browser/components/embed-card/card/BusyCard.js +3 -2
- package/dist/browser/components/embed-card/card/BusyCard.js.map +1 -1
- package/dist/browser/components/embed-card/card/EmbedCardHeader.js +61 -10
- package/dist/browser/components/embed-card/card/EmbedCardHeader.js.map +1 -1
- package/dist/browser/components/embed-card/card/EmbedPluginCard.js +168 -13
- package/dist/browser/components/embed-card/card/EmbedPluginCard.js.map +1 -1
- package/dist/browser/components/embed-card/card/index.js +182 -3
- package/dist/browser/components/embed-card/card/index.js.map +1 -1
- package/dist/browser/components/embed-card/error-handling/EmbedCardApiErrorRenderer.js +26 -6
- package/dist/browser/components/embed-card/error-handling/EmbedCardApiErrorRenderer.js.map +1 -1
- package/dist/browser/components/embed-card/error-handling/EmbedErrorCard.js +4 -3
- package/dist/browser/components/embed-card/error-handling/EmbedErrorCard.js.map +1 -1
- package/dist/browser/components/embed-card/error-handling/index.js +33 -2
- package/dist/browser/components/embed-card/error-handling/index.js.map +1 -1
- package/dist/browser/components/embed-card/index.js +481 -2
- package/dist/browser/components/embed-card/index.js.map +1 -1
- package/dist/browser/components/embed-card/menu/EmbedMenu.js +30 -6
- package/dist/browser/components/embed-card/menu/EmbedMenu.js.map +1 -1
- package/dist/browser/components/embed-card/menu/JsonMenuItem.js +13 -3
- package/dist/browser/components/embed-card/menu/JsonMenuItem.js.map +1 -1
- package/dist/browser/components/embed-card/menu/index.js +46 -1
- package/dist/browser/components/embed-card/menu/index.js.map +1 -1
- package/dist/browser/components/embed-plugin-stories/storyPayload.js +2 -1
- package/dist/browser/components/embed-plugin-stories/storyPayload.js.map +1 -1
- package/dist/browser/components/embed-plugin-stories/storyShared.js +480 -5
- package/dist/browser/components/embed-plugin-stories/storyShared.js.map +1 -1
- package/dist/browser/components/index.js +482 -2
- package/dist/browser/components/index.js.map +1 -1
- package/dist/browser/components/validation-alerts/ValidatePayload.js +13 -3
- package/dist/browser/components/validation-alerts/ValidatePayload.js.map +1 -1
- package/dist/browser/components/validation-alerts/ValidatePlugins.js +21 -3
- package/dist/browser/components/validation-alerts/ValidatePlugins.js.map +1 -1
- package/dist/browser/components/validation-alerts/index.js +59 -2
- package/dist/browser/components/validation-alerts/index.js.map +1 -1
- package/dist/browser/contexts/EmbedPluginContext/Context.js +2 -1
- package/dist/browser/contexts/EmbedPluginContext/Context.js.map +1 -1
- package/dist/browser/contexts/EmbedPluginContext/Provider.js +9 -3
- package/dist/browser/contexts/EmbedPluginContext/Provider.js.map +1 -1
- package/dist/browser/contexts/EmbedPluginContext/index.js +44 -4
- package/dist/browser/contexts/EmbedPluginContext/index.js.map +1 -1
- package/dist/browser/contexts/EmbedPluginContext/use.js +8 -2
- package/dist/browser/contexts/EmbedPluginContext/use.js.map +1 -1
- package/dist/browser/contexts/RefreshPayloadContext/Context.js +2 -1
- package/dist/browser/contexts/RefreshPayloadContext/Context.js.map +1 -1
- package/dist/browser/contexts/RefreshPayloadContext/Provider.js +9 -3
- package/dist/browser/contexts/RefreshPayloadContext/Provider.js.map +1 -1
- package/dist/browser/contexts/RefreshPayloadContext/index.js +21 -3
- package/dist/browser/contexts/RefreshPayloadContext/index.js.map +1 -1
- package/dist/browser/contexts/RefreshPayloadContext/use.js +8 -2
- package/dist/browser/contexts/RefreshPayloadContext/use.js.map +1 -1
- package/dist/browser/contexts/ResolvePayloadContext/Context.js +2 -1
- package/dist/browser/contexts/ResolvePayloadContext/Context.js.map +1 -1
- package/dist/browser/contexts/ResolvePayloadContext/Provider.js +17 -4
- package/dist/browser/contexts/ResolvePayloadContext/Provider.js.map +1 -1
- package/dist/browser/contexts/ResolvePayloadContext/index.js +72 -4
- package/dist/browser/contexts/ResolvePayloadContext/index.js.map +1 -1
- package/dist/browser/contexts/ResolvePayloadContext/use.js +8 -2
- package/dist/browser/contexts/ResolvePayloadContext/use.js.map +1 -1
- package/dist/browser/contexts/ValidatePayloadContext/Context.js +2 -1
- package/dist/browser/contexts/ValidatePayloadContext/Context.js.map +1 -1
- package/dist/browser/contexts/ValidatePayloadContext/Provider.js +17 -4
- package/dist/browser/contexts/ValidatePayloadContext/Provider.js.map +1 -1
- package/dist/browser/contexts/ValidatePayloadContext/index.js +49 -3
- package/dist/browser/contexts/ValidatePayloadContext/index.js.map +1 -1
- package/dist/browser/contexts/ValidatePayloadContext/use.js +8 -2
- package/dist/browser/contexts/ValidatePayloadContext/use.js.map +1 -1
- package/dist/browser/contexts/index.js +165 -4
- package/dist/browser/contexts/index.js.map +1 -1
- package/dist/browser/index.js +492 -3
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/types/index.js +0 -1
- package/dist/browser/types/index.js.map +1 -1
- package/dist/docs.json +109 -109
- package/package.json +15 -15
@@ -1,30 +1,81 @@
|
|
1
|
-
|
1
|
+
// src/components/embed-card/card/EmbedCardHeader.tsx
|
2
2
|
import { Refresh as RefreshIcon } from "@mui/icons-material";
|
3
3
|
import { Avatar, CardHeader, Chip } from "@mui/material";
|
4
4
|
import { FlexRow } from "@xylabs/react-flexbox";
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
|
6
|
+
// src/contexts/EmbedPluginContext/Context.tsx
|
7
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
8
|
+
var EmbedPluginContext = createContextEx();
|
9
|
+
|
10
|
+
// src/contexts/EmbedPluginContext/use.tsx
|
11
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
12
|
+
var useEmbedPluginState = () => useContextEx(EmbedPluginContext, "EmbedPlugin", true);
|
13
|
+
|
14
|
+
// src/contexts/ResolvePayloadContext/Context.ts
|
15
|
+
import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
|
16
|
+
var ResolvePayloadContext = createContextEx2();
|
17
|
+
|
18
|
+
// src/contexts/ResolvePayloadContext/use.tsx
|
19
|
+
import { useContextEx as useContextEx2 } from "@xyo-network/react-shared";
|
20
|
+
var useResolvePayload = () => useContextEx2(ResolvePayloadContext, "ResolvePayload", true);
|
21
|
+
|
22
|
+
// src/components/embed-card/menu/EmbedMenu.tsx
|
23
|
+
import { MoreVert as MoreVertIcon } from "@mui/icons-material";
|
24
|
+
import { IconButton, Menu } from "@mui/material";
|
25
|
+
import { useState } from "react";
|
26
|
+
|
27
|
+
// src/components/embed-card/menu/JsonMenuItem.tsx
|
28
|
+
import { OpenInNew as OpenInNewIcon } from "@mui/icons-material";
|
29
|
+
import { ListItemIcon, ListItemText, MenuItem } from "@mui/material";
|
30
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
31
|
+
var JsonMenuItem = (props) => {
|
32
|
+
const { huri } = useResolvePayload();
|
33
|
+
return /* @__PURE__ */ jsx(Fragment, { children: huri ? /* @__PURE__ */ jsxs(MenuItem, { title: "Source Payload JSON", onClick: () => window.open(huri, "_blank"), ...props, children: [
|
34
|
+
/* @__PURE__ */ jsx(ListItemText, { sx: { mr: 1 }, children: "JSON" }),
|
35
|
+
/* @__PURE__ */ jsx(ListItemIcon, { sx: { justifyContent: "end" }, children: /* @__PURE__ */ jsx(OpenInNewIcon, { fontSize: "small" }) })
|
36
|
+
] }) : null });
|
37
|
+
};
|
38
|
+
|
39
|
+
// src/components/embed-card/menu/EmbedMenu.tsx
|
40
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
41
|
+
var EmbedMenu = (props) => {
|
42
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
43
|
+
const open = Boolean(anchorEl);
|
44
|
+
const handleClick = (event) => {
|
45
|
+
setAnchorEl(event.currentTarget);
|
46
|
+
};
|
47
|
+
const handleClose = () => {
|
48
|
+
setAnchorEl(null);
|
49
|
+
};
|
50
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
51
|
+
/* @__PURE__ */ jsx2(IconButton, { onClick: handleClick, ...props, children: /* @__PURE__ */ jsx2(MoreVertIcon, {}) }),
|
52
|
+
/* @__PURE__ */ jsx2(Menu, { anchorEl, open, onClose: handleClose, PaperProps: { variant: "elevation" }, MenuListProps: { dense: true }, children: /* @__PURE__ */ jsx2(JsonMenuItem, {}) })
|
53
|
+
] });
|
54
|
+
};
|
55
|
+
|
56
|
+
// src/components/embed-card/card/EmbedCardHeader.tsx
|
57
|
+
import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
58
|
+
var EmbedCardHeader = () => {
|
8
59
|
const { refreshHuri, huri } = useResolvePayload();
|
9
60
|
const { activePlugin, timestampLabel, hideElementsConfig } = useEmbedPluginState();
|
10
61
|
const { hideAvatar, hideTitle, hideRefreshButton, hideTimestamp, hideCardActions } = hideElementsConfig ?? {};
|
11
62
|
const timestamp = Date.now();
|
12
|
-
return /* @__PURE__ */
|
63
|
+
return /* @__PURE__ */ jsx3(
|
13
64
|
CardHeader,
|
14
65
|
{
|
15
66
|
sx: { flexWrap: "wrap", rowGap: 1 },
|
16
|
-
avatar: hideAvatar ? /* @__PURE__ */
|
17
|
-
action: /* @__PURE__ */
|
18
|
-
timestamp ? hideTimestamp && hideRefreshButton ? "" : /* @__PURE__ */
|
67
|
+
avatar: hideAvatar ? /* @__PURE__ */ jsx3(Fragment3, {}) : /* @__PURE__ */ jsx3(Avatar, { sx: { bgcolor: (theme) => theme.palette.primary.main }, "aria-label": activePlugin?.name, children: activePlugin?.name?.charAt(0) }),
|
68
|
+
action: /* @__PURE__ */ jsxs3(FlexRow, { flexWrap: "wrap", columnGap: 0.5, children: [
|
69
|
+
timestamp ? hideTimestamp && hideRefreshButton ? "" : /* @__PURE__ */ jsx3(
|
19
70
|
Chip,
|
20
71
|
{
|
21
|
-
avatar: hideRefreshButton ? /* @__PURE__ */
|
72
|
+
avatar: hideRefreshButton ? /* @__PURE__ */ jsx3(Fragment3, {}) : /* @__PURE__ */ jsx3(RefreshIcon, {}),
|
22
73
|
clickable: hideRefreshButton ? false : true,
|
23
74
|
onClick: refreshHuri,
|
24
75
|
label: hideTimestamp ? "" : `${timestampLabel} ${new Date(timestamp).toLocaleString()}`
|
25
76
|
}
|
26
77
|
) : null,
|
27
|
-
hideCardActions || huri === void 0 ? null : /* @__PURE__ */
|
78
|
+
hideCardActions || huri === void 0 ? null : /* @__PURE__ */ jsx3(EmbedMenu, {})
|
28
79
|
] }),
|
29
80
|
title: hideTitle ? "" : activePlugin?.name
|
30
81
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/embed-card/card/EmbedCardHeader.tsx"],"sourcesContent":["import { Refresh as RefreshIcon } from '@mui/icons-material'\nimport { Avatar, CardHeader, CardHeaderProps, Chip, Theme } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\n\nimport { useEmbedPluginState, useResolvePayload } from '../../../contexts'\nimport { EmbedMenu } from '../menu'\n\nexport const EmbedCardHeader: React.FC<CardHeaderProps> = () => {\n const { refreshHuri, huri } = useResolvePayload()\n const { activePlugin, timestampLabel, hideElementsConfig } = useEmbedPluginState()\n const { hideAvatar, hideTitle, hideRefreshButton, hideTimestamp, hideCardActions } = hideElementsConfig ?? {}\n //this is temporary so that we can add the ability to get a timestamp via diviner later\n const timestamp = Date.now()\n return (\n <CardHeader\n sx={{ flexWrap: 'wrap', rowGap: 1 }}\n avatar={\n hideAvatar ? (\n <></>\n ) : (\n <Avatar sx={{ bgcolor: (theme: Theme) => theme.palette.primary.main }} aria-label={activePlugin?.name}>\n {activePlugin?.name?.charAt(0)}\n </Avatar>\n )\n }\n action={\n <FlexRow flexWrap=\"wrap\" columnGap={0.5}>\n {timestamp ? (\n hideTimestamp && hideRefreshButton ? (\n ''\n ) : (\n <Chip\n avatar={hideRefreshButton ? <></> : <RefreshIcon />}\n clickable={hideRefreshButton ? false : true}\n onClick={refreshHuri}\n label={hideTimestamp ? '' : `${timestampLabel} ${new Date(timestamp).toLocaleString()}`}\n />\n )\n ) : null}\n {/* Huri case is valid as long as the only menu item is JSON */}\n {hideCardActions || huri === undefined ? null : <EmbedMenu />}\n </FlexRow>\n }\n title={hideTitle ? '' : activePlugin?.name}\n />\n )\n}\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../../../src/components/embed-card/card/EmbedCardHeader.tsx","../../../../../src/contexts/EmbedPluginContext/Context.tsx","../../../../../src/contexts/EmbedPluginContext/use.tsx","../../../../../src/contexts/ResolvePayloadContext/Context.ts","../../../../../src/contexts/ResolvePayloadContext/use.tsx","../../../../../src/components/embed-card/menu/EmbedMenu.tsx","../../../../../src/components/embed-card/menu/JsonMenuItem.tsx"],"sourcesContent":["import { Refresh as RefreshIcon } from '@mui/icons-material'\nimport { Avatar, CardHeader, CardHeaderProps, Chip, Theme } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\n\nimport { useEmbedPluginState, useResolvePayload } from '../../../contexts'\nimport { EmbedMenu } from '../menu'\n\nexport const EmbedCardHeader: React.FC<CardHeaderProps> = () => {\n const { refreshHuri, huri } = useResolvePayload()\n const { activePlugin, timestampLabel, hideElementsConfig } = useEmbedPluginState()\n const { hideAvatar, hideTitle, hideRefreshButton, hideTimestamp, hideCardActions } = hideElementsConfig ?? {}\n //this is temporary so that we can add the ability to get a timestamp via diviner later\n const timestamp = Date.now()\n return (\n <CardHeader\n sx={{ flexWrap: 'wrap', rowGap: 1 }}\n avatar={\n hideAvatar ? (\n <></>\n ) : (\n <Avatar sx={{ bgcolor: (theme: Theme) => theme.palette.primary.main }} aria-label={activePlugin?.name}>\n {activePlugin?.name?.charAt(0)}\n </Avatar>\n )\n }\n action={\n <FlexRow flexWrap=\"wrap\" columnGap={0.5}>\n {timestamp ? (\n hideTimestamp && hideRefreshButton ? (\n ''\n ) : (\n <Chip\n avatar={hideRefreshButton ? <></> : <RefreshIcon />}\n clickable={hideRefreshButton ? false : true}\n onClick={refreshHuri}\n label={hideTimestamp ? '' : `${timestampLabel} ${new Date(timestamp).toLocaleString()}`}\n />\n )\n ) : null}\n {/* Huri case is valid as long as the only menu item is JSON */}\n {hideCardActions || huri === undefined ? null : <EmbedMenu />}\n </FlexRow>\n }\n title={hideTitle ? '' : activePlugin?.name}\n />\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginState } from './State'\n\nexport const EmbedPluginContext = createContextEx<EmbedPluginState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginContext } from './Context'\n\nexport const useEmbedPluginState = () => useContextEx(EmbedPluginContext, 'EmbedPlugin', true)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadState } from './State'\n\nexport const ResolvePayloadContext = createContextEx<ResolvePayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadContext } from './Context'\n\nexport const useResolvePayload = () => useContextEx(ResolvePayloadContext, 'ResolvePayload', true)\n","import { MoreVert as MoreVertIcon } from '@mui/icons-material'\nimport { IconButton, IconButtonProps, Menu } from '@mui/material'\nimport { useState } from 'react'\n\nimport { JsonMenuItem } from './JsonMenuItem'\n\nexport const EmbedMenu: React.FC<IconButtonProps> = (props) => {\n // TODO - link to explore website\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null)\n const open = Boolean(anchorEl)\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget)\n }\n const handleClose = () => {\n setAnchorEl(null)\n }\n\n return (\n <>\n <IconButton onClick={handleClick} {...props}>\n <MoreVertIcon />\n </IconButton>\n <Menu anchorEl={anchorEl} open={open} onClose={handleClose} PaperProps={{ variant: 'elevation' }} MenuListProps={{ dense: true }}>\n <JsonMenuItem />\n </Menu>\n </>\n )\n}\n","import { OpenInNew as OpenInNewIcon } from '@mui/icons-material'\nimport { ListItemIcon, ListItemText, MenuItem, MenuItemProps } from '@mui/material'\n\nimport { useResolvePayload } from '../../../contexts'\n\nexport const JsonMenuItem: React.FC<MenuItemProps> = (props) => {\n const { huri } = useResolvePayload()\n\n return (\n <>\n {huri ? (\n <MenuItem title=\"Source Payload JSON\" onClick={() => window.open(huri, '_blank')} {...props}>\n <ListItemText sx={{ mr: 1 }}>JSON</ListItemText>\n <ListItemIcon sx={{ justifyContent: 'end' }}>\n <OpenInNewIcon fontSize=\"small\" />\n </ListItemIcon>\n </MenuItem>\n ) : null}\n </>\n )\n}\n"],"mappings":";AAAA,SAAS,WAAW,mBAAmB;AACvC,SAAS,QAAQ,YAA6B,YAAmB;AACjE,SAAS,eAAe;;;ACFxB,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ACJpE,SAAS,oBAAoB;AAItB,IAAM,sBAAsB,MAAM,aAAa,oBAAoB,eAAe,IAAI;;;ACJ7F,SAAS,mBAAAA,wBAAuB;AAIzB,IAAM,wBAAwBA,iBAAqC;;;ACJ1E,SAAS,gBAAAC,qBAAoB;AAItB,IAAM,oBAAoB,MAAMC,cAAa,uBAAuB,kBAAkB,IAAI;;;ACJjG,SAAS,YAAY,oBAAoB;AACzC,SAAS,YAA6B,YAAY;AAClD,SAAS,gBAAgB;;;ACFzB,SAAS,aAAa,qBAAqB;AAC3C,SAAS,cAAc,cAAc,gBAA+B;AAQhE,mBA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gBAAAD;AAAA,IAAC;AAAA;AAAA,MACC,IAAI,EAAE,UAAU,QAAQ,QAAQ,EAAE;AAAA,MAClC,QACE,aACE,gBAAAA,KAAAD,WAAA,EAAE,IAEF,gBAAAC,KAAC,UAAO,IAAI,EAAE,SAAS,CAAC,UAAiB,MAAM,QAAQ,QAAQ,KAAK,GAAG,cAAY,cAAc,MAC9F,wBAAc,MAAM,OAAO,CAAC,GAC/B;AAAA,MAGJ,QACE,gBAAAC,MAAC,WAAQ,UAAS,QAAO,WAAW,KACjC;AAAA,oBACC,iBAAiB,oBACf,KAEA,gBAAAD;AAAA,UAAC;AAAA;AAAA,YACC,QAAQ,oBAAoB,gBAAAA,KAAAD,WAAA,EAAE,IAAM,gBAAAC,KAAC,eAAY;AAAA,YACjD,WAAW,oBAAoB,QAAQ;AAAA,YACvC,SAAS;AAAA,YACT,OAAO,gBAAgB,KAAK,GAAG,cAAc,IAAI,IAAI,KAAK,SAAS,EAAE,eAAe,CAAC;AAAA;AAAA,QACvF,IAEA;AAAA,QAEH,mBAAmB,SAAS,SAAY,OAAO,gBAAAA,KAAC,aAAU;AAAA,SAC7D;AAAA,MAEF,OAAO,YAAY,KAAK,cAAc;AAAA;AAAA,EACxC;AAEJ;","names":["createContextEx","useContextEx","useContextEx","Fragment","jsx","jsxs","Fragment","jsx","jsxs"]}
|
@@ -1,23 +1,178 @@
|
|
1
|
-
|
1
|
+
// src/components/embed-card/card/EmbedPluginCard.tsx
|
2
2
|
import { CardContent } from "@mui/material";
|
3
3
|
import { FlexGrowRow } from "@xylabs/react-flexbox";
|
4
|
+
import { useListMode as useListMode2 } from "@xyo-network/react-shared";
|
5
|
+
|
6
|
+
// src/contexts/EmbedPluginContext/Context.tsx
|
7
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
8
|
+
var EmbedPluginContext = createContextEx();
|
9
|
+
|
10
|
+
// src/contexts/EmbedPluginContext/use.tsx
|
11
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
12
|
+
var useEmbedPluginState = () => useContextEx(EmbedPluginContext, "EmbedPlugin", true);
|
13
|
+
|
14
|
+
// src/contexts/ResolvePayloadContext/Context.ts
|
15
|
+
import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
|
16
|
+
var ResolvePayloadContext = createContextEx2();
|
17
|
+
|
18
|
+
// src/contexts/ResolvePayloadContext/use.tsx
|
19
|
+
import { useContextEx as useContextEx2 } from "@xyo-network/react-shared";
|
20
|
+
var useResolvePayload = () => useContextEx2(ResolvePayloadContext, "ResolvePayload", true);
|
21
|
+
|
22
|
+
// src/components/controls/EmbedFormControl.tsx
|
23
|
+
import { FormControl, InputLabel } from "@mui/material";
|
24
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
25
|
+
var EmbedFormControl = ({ formId, formLabel, children, ...props }) => {
|
26
|
+
return /* @__PURE__ */ jsxs(FormControl, { ...props, children: [
|
27
|
+
/* @__PURE__ */ jsx(InputLabel, { id: formId, children: formLabel }),
|
28
|
+
children
|
29
|
+
] });
|
30
|
+
};
|
31
|
+
|
32
|
+
// src/components/controls/ListModeSelect.tsx
|
33
|
+
import { MenuItem, Select } from "@mui/material";
|
4
34
|
import { useListMode } from "@xyo-network/react-shared";
|
5
|
-
import {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
const
|
35
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
36
|
+
var listModeSelectId = "listmode-select-id";
|
37
|
+
var listModeSelectLabel = "List Mode";
|
38
|
+
var ListModeSelect = (props) => {
|
39
|
+
const { listMode, setListMode } = useListMode();
|
40
|
+
return /* @__PURE__ */ jsxs2(
|
41
|
+
Select,
|
42
|
+
{
|
43
|
+
value: listMode ?? "default",
|
44
|
+
onChange: (event) => {
|
45
|
+
setListMode?.(event.target.value);
|
46
|
+
},
|
47
|
+
...props,
|
48
|
+
children: [
|
49
|
+
/* @__PURE__ */ jsx2(MenuItem, { value: "default", children: "Default" }, "default"),
|
50
|
+
/* @__PURE__ */ jsx2(MenuItem, { value: "table", children: "Table" }, "table"),
|
51
|
+
/* @__PURE__ */ jsx2(MenuItem, { value: "grid", children: "Grid" }, "grid")
|
52
|
+
]
|
53
|
+
}
|
54
|
+
);
|
55
|
+
};
|
56
|
+
var ListModeSelectFormControl = (props) => {
|
57
|
+
return /* @__PURE__ */ jsx2(EmbedFormControl, { formId: listModeSelectId, formLabel: listModeSelectLabel, children: /* @__PURE__ */ jsx2(ListModeSelect, { size: "small", label: listModeSelectLabel, labelId: listModeSelectId, ...props }) });
|
58
|
+
};
|
59
|
+
|
60
|
+
// src/components/controls/RenderSelect.tsx
|
61
|
+
import { MenuItem as MenuItem2, Select as Select2 } from "@mui/material";
|
62
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
63
|
+
var renderSelectId = "render-select-id";
|
64
|
+
var renderSelectLabel = "Renderer";
|
65
|
+
var EmbedRenderSelect = (props) => {
|
66
|
+
const { activePlugin, setActivePlugin, plugins } = useEmbedPluginState();
|
67
|
+
return /* @__PURE__ */ jsx3(EmbedFormControl, { formId: renderSelectId, formLabel: renderSelectLabel, children: /* @__PURE__ */ jsx3(Select2, { size: "small", value: activePlugin?.name, ...props, children: plugins?.map((plugin) => /* @__PURE__ */ jsx3(MenuItem2, { value: plugin.name, onClick: () => setActivePlugin?.(plugin), children: plugin.name }, plugin.name)) }) });
|
68
|
+
};
|
69
|
+
|
70
|
+
// src/components/embed-card/card/BusyCard.tsx
|
71
|
+
import { Card } from "@mui/material";
|
72
|
+
import { useBusyTiming } from "@xylabs/react-flexbox";
|
73
|
+
import {
|
74
|
+
BusyCircularProgress,
|
75
|
+
BusyLinearProgress
|
76
|
+
} from "@xylabs/react-shared";
|
77
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
78
|
+
var BusyCard = ({
|
79
|
+
busy,
|
80
|
+
busyMinimum = 500,
|
81
|
+
busyVariant = "circular",
|
82
|
+
busyVariantProps,
|
83
|
+
children,
|
84
|
+
...props
|
85
|
+
}) => {
|
86
|
+
const internalBusy = useBusyTiming(busy, busyMinimum);
|
87
|
+
return /* @__PURE__ */ jsxs3(Card, { ...props, children: [
|
88
|
+
children,
|
89
|
+
busyVariant === "circular" && internalBusy ? /* @__PURE__ */ jsx4(BusyCircularProgress, { ...busyVariantProps }) : null,
|
90
|
+
busyVariant === "linear" && internalBusy ? /* @__PURE__ */ jsx4(BusyLinearProgress, { ...busyVariantProps }) : null
|
91
|
+
] });
|
92
|
+
};
|
93
|
+
|
94
|
+
// src/components/embed-card/card/EmbedCardHeader.tsx
|
95
|
+
import { Refresh as RefreshIcon } from "@mui/icons-material";
|
96
|
+
import { Avatar, CardHeader, Chip } from "@mui/material";
|
97
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
98
|
+
|
99
|
+
// src/components/embed-card/menu/EmbedMenu.tsx
|
100
|
+
import { MoreVert as MoreVertIcon } from "@mui/icons-material";
|
101
|
+
import { IconButton, Menu } from "@mui/material";
|
102
|
+
import { useState } from "react";
|
103
|
+
|
104
|
+
// src/components/embed-card/menu/JsonMenuItem.tsx
|
105
|
+
import { OpenInNew as OpenInNewIcon } from "@mui/icons-material";
|
106
|
+
import { ListItemIcon, ListItemText, MenuItem as MenuItem3 } from "@mui/material";
|
107
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
108
|
+
var JsonMenuItem = (props) => {
|
109
|
+
const { huri } = useResolvePayload();
|
110
|
+
return /* @__PURE__ */ jsx5(Fragment, { children: huri ? /* @__PURE__ */ jsxs4(MenuItem3, { title: "Source Payload JSON", onClick: () => window.open(huri, "_blank"), ...props, children: [
|
111
|
+
/* @__PURE__ */ jsx5(ListItemText, { sx: { mr: 1 }, children: "JSON" }),
|
112
|
+
/* @__PURE__ */ jsx5(ListItemIcon, { sx: { justifyContent: "end" }, children: /* @__PURE__ */ jsx5(OpenInNewIcon, { fontSize: "small" }) })
|
113
|
+
] }) : null });
|
114
|
+
};
|
115
|
+
|
116
|
+
// src/components/embed-card/menu/EmbedMenu.tsx
|
117
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
118
|
+
var EmbedMenu = (props) => {
|
119
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
120
|
+
const open = Boolean(anchorEl);
|
121
|
+
const handleClick = (event) => {
|
122
|
+
setAnchorEl(event.currentTarget);
|
123
|
+
};
|
124
|
+
const handleClose = () => {
|
125
|
+
setAnchorEl(null);
|
126
|
+
};
|
127
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
128
|
+
/* @__PURE__ */ jsx6(IconButton, { onClick: handleClick, ...props, children: /* @__PURE__ */ jsx6(MoreVertIcon, {}) }),
|
129
|
+
/* @__PURE__ */ jsx6(Menu, { anchorEl, open, onClose: handleClose, PaperProps: { variant: "elevation" }, MenuListProps: { dense: true }, children: /* @__PURE__ */ jsx6(JsonMenuItem, {}) })
|
130
|
+
] });
|
131
|
+
};
|
132
|
+
|
133
|
+
// src/components/embed-card/card/EmbedCardHeader.tsx
|
134
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
135
|
+
var EmbedCardHeader = () => {
|
136
|
+
const { refreshHuri, huri } = useResolvePayload();
|
137
|
+
const { activePlugin, timestampLabel, hideElementsConfig } = useEmbedPluginState();
|
138
|
+
const { hideAvatar, hideTitle, hideRefreshButton, hideTimestamp, hideCardActions } = hideElementsConfig ?? {};
|
139
|
+
const timestamp = Date.now();
|
140
|
+
return /* @__PURE__ */ jsx7(
|
141
|
+
CardHeader,
|
142
|
+
{
|
143
|
+
sx: { flexWrap: "wrap", rowGap: 1 },
|
144
|
+
avatar: hideAvatar ? /* @__PURE__ */ jsx7(Fragment3, {}) : /* @__PURE__ */ jsx7(Avatar, { sx: { bgcolor: (theme) => theme.palette.primary.main }, "aria-label": activePlugin?.name, children: activePlugin?.name?.charAt(0) }),
|
145
|
+
action: /* @__PURE__ */ jsxs6(FlexRow, { flexWrap: "wrap", columnGap: 0.5, children: [
|
146
|
+
timestamp ? hideTimestamp && hideRefreshButton ? "" : /* @__PURE__ */ jsx7(
|
147
|
+
Chip,
|
148
|
+
{
|
149
|
+
avatar: hideRefreshButton ? /* @__PURE__ */ jsx7(Fragment3, {}) : /* @__PURE__ */ jsx7(RefreshIcon, {}),
|
150
|
+
clickable: hideRefreshButton ? false : true,
|
151
|
+
onClick: refreshHuri,
|
152
|
+
label: hideTimestamp ? "" : `${timestampLabel} ${new Date(timestamp).toLocaleString()}`
|
153
|
+
}
|
154
|
+
) : null,
|
155
|
+
hideCardActions || huri === void 0 ? null : /* @__PURE__ */ jsx7(EmbedMenu, {})
|
156
|
+
] }),
|
157
|
+
title: hideTitle ? "" : activePlugin?.name
|
158
|
+
}
|
159
|
+
);
|
160
|
+
};
|
161
|
+
|
162
|
+
// src/components/embed-card/card/EmbedPluginCard.tsx
|
163
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
164
|
+
var EmbedPluginCard = ({ ...props }) => {
|
10
165
|
const { payload } = useResolvePayload();
|
11
166
|
const { activePlugin: ActivePlugin, plugins, hideElementsConfig } = useEmbedPluginState();
|
12
|
-
const { listMode } =
|
167
|
+
const { listMode } = useListMode2();
|
13
168
|
const supportsListMode = ActivePlugin?.components?.box?.listModes?.length ?? 0 > 1;
|
14
|
-
return /* @__PURE__ */
|
15
|
-
hideElementsConfig?.hideCardHeader ? null : /* @__PURE__ */
|
16
|
-
plugins && plugins.length || supportsListMode ? /* @__PURE__ */
|
17
|
-
plugins && plugins.length > 1 ? /* @__PURE__ */
|
18
|
-
supportsListMode ? /* @__PURE__ */
|
169
|
+
return /* @__PURE__ */ jsxs7(BusyCard, { ...props, children: [
|
170
|
+
hideElementsConfig?.hideCardHeader ? null : /* @__PURE__ */ jsx8(EmbedCardHeader, {}),
|
171
|
+
plugins && plugins.length || supportsListMode ? /* @__PURE__ */ jsxs7(FlexGrowRow, { columnGap: 2, rowGap: 2, flexWrap: "wrap", pb: 1, children: [
|
172
|
+
plugins && plugins.length > 1 ? /* @__PURE__ */ jsx8(EmbedRenderSelect, {}) : null,
|
173
|
+
supportsListMode ? /* @__PURE__ */ jsx8(ListModeSelectFormControl, {}) : null
|
19
174
|
] }) : null,
|
20
|
-
/* @__PURE__ */
|
175
|
+
/* @__PURE__ */ jsx8(CardContent, { sx: { height: "100%" }, children: ActivePlugin ? /* @__PURE__ */ jsx8(ActivePlugin.components.box.detailsBox, { payload, ...supportsListMode && { listMode } }) : null })
|
21
176
|
] });
|
22
177
|
};
|
23
178
|
export {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/embed-card/card/EmbedPluginCard.tsx"],"sourcesContent":["import { CardContent } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { useListMode } from '@xyo-network/react-shared'\n\nimport { useEmbedPluginState, useResolvePayload } from '../../../contexts'\nimport { EmbedRenderSelect, ListModeSelectFormControl } from '../../controls'\nimport { BusyCard, BusyCardProps } from './BusyCard'\nimport { EmbedCardHeader } from './EmbedCardHeader'\n\nexport const EmbedPluginCard: React.FC<BusyCardProps> = ({ ...props }) => {\n const { payload } = useResolvePayload()\n const { activePlugin: ActivePlugin, plugins, hideElementsConfig } = useEmbedPluginState()\n const { listMode } = useListMode()\n const supportsListMode = ActivePlugin?.components?.box?.listModes?.length ?? 0 > 1\n\n return (\n <BusyCard {...props}>\n {hideElementsConfig?.hideCardHeader ? null : <EmbedCardHeader />}\n {/* Only show the row if the children are present */}\n {(plugins && plugins.length) || supportsListMode ? (\n <FlexGrowRow columnGap={2} rowGap={2} flexWrap=\"wrap\" pb={1}>\n {plugins && plugins.length > 1 ? <EmbedRenderSelect /> : null}\n {supportsListMode ? <ListModeSelectFormControl /> : null}\n </FlexGrowRow>\n ) : null}\n <CardContent sx={{ height: '100%' }}>\n {ActivePlugin ? <ActivePlugin.components.box.detailsBox payload={payload} {...(supportsListMode && { listMode })} /> : null}\n </CardContent>\n </BusyCard>\n )\n}\n"],"mappings":"AAiBmD,cAG3C,YAH2C;AAjBnD,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAE5B,SAAS,qBAAqB,yBAAyB;AACvD,SAAS,mBAAmB,iCAAiC;AAC7D,SAAS,gBAA+B;AACxC,SAAS,uBAAuB;AAEzB,MAAM,kBAA2C,CAAC,EAAE,GAAG,MAAM,MAAM;AACxE,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AACtC,QAAM,EAAE,cAAc,cAAc,SAAS,mBAAmB,IAAI,oBAAoB;AACxF,QAAM,EAAE,SAAS,IAAI,YAAY;AACjC,QAAM,mBAAmB,cAAc,YAAY,KAAK,WAAW,UAAU,IAAI;AAEjF,SACE,qBAAC,YAAU,GAAG,OACX;AAAA,wBAAoB,iBAAiB,OAAO,oBAAC,mBAAgB;AAAA,IAE5D,WAAW,QAAQ,UAAW,mBAC9B,qBAAC,eAAY,WAAW,GAAG,QAAQ,GAAG,UAAS,QAAO,IAAI,GACvD;AAAA,iBAAW,QAAQ,SAAS,IAAI,oBAAC,qBAAkB,IAAK;AAAA,MACxD,mBAAmB,oBAAC,6BAA0B,IAAK;AAAA,OACtD,IACE;AAAA,IACJ,oBAAC,eAAY,IAAI,EAAE,QAAQ,OAAO,GAC/B,yBAAe,oBAAC,aAAa,WAAW,IAAI,YAA5B,EAAuC,SAAmB,GAAI,oBAAoB,EAAE,SAAS,GAAI,IAAK,MACzH;AAAA,KACF;AAEJ;","names":[]}
|
1
|
+
{"version":3,"sources":["../../../../../src/components/embed-card/card/EmbedPluginCard.tsx","../../../../../src/contexts/EmbedPluginContext/Context.tsx","../../../../../src/contexts/EmbedPluginContext/use.tsx","../../../../../src/contexts/ResolvePayloadContext/Context.ts","../../../../../src/contexts/ResolvePayloadContext/use.tsx","../../../../../src/components/controls/EmbedFormControl.tsx","../../../../../src/components/controls/ListModeSelect.tsx","../../../../../src/components/controls/RenderSelect.tsx","../../../../../src/components/embed-card/card/BusyCard.tsx","../../../../../src/components/embed-card/card/EmbedCardHeader.tsx","../../../../../src/components/embed-card/menu/EmbedMenu.tsx","../../../../../src/components/embed-card/menu/JsonMenuItem.tsx"],"sourcesContent":["import { CardContent } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { useListMode } from '@xyo-network/react-shared'\n\nimport { useEmbedPluginState, useResolvePayload } from '../../../contexts'\nimport { EmbedRenderSelect, ListModeSelectFormControl } from '../../controls'\nimport { BusyCard, BusyCardProps } from './BusyCard'\nimport { EmbedCardHeader } from './EmbedCardHeader'\n\nexport const EmbedPluginCard: React.FC<BusyCardProps> = ({ ...props }) => {\n const { payload } = useResolvePayload()\n const { activePlugin: ActivePlugin, plugins, hideElementsConfig } = useEmbedPluginState()\n const { listMode } = useListMode()\n const supportsListMode = ActivePlugin?.components?.box?.listModes?.length ?? 0 > 1\n\n return (\n <BusyCard {...props}>\n {hideElementsConfig?.hideCardHeader ? null : <EmbedCardHeader />}\n {/* Only show the row if the children are present */}\n {(plugins && plugins.length) || supportsListMode ? (\n <FlexGrowRow columnGap={2} rowGap={2} flexWrap=\"wrap\" pb={1}>\n {plugins && plugins.length > 1 ? <EmbedRenderSelect /> : null}\n {supportsListMode ? <ListModeSelectFormControl /> : null}\n </FlexGrowRow>\n ) : null}\n <CardContent sx={{ height: '100%' }}>\n {ActivePlugin ? <ActivePlugin.components.box.detailsBox payload={payload} {...(supportsListMode && { listMode })} /> : null}\n </CardContent>\n </BusyCard>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginState } from './State'\n\nexport const EmbedPluginContext = createContextEx<EmbedPluginState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginContext } from './Context'\n\nexport const useEmbedPluginState = () => useContextEx(EmbedPluginContext, 'EmbedPlugin', true)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadState } from './State'\n\nexport const ResolvePayloadContext = createContextEx<ResolvePayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadContext } from './Context'\n\nexport const useResolvePayload = () => useContextEx(ResolvePayloadContext, 'ResolvePayload', true)\n","import { FormControl, FormControlProps, InputLabel } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\ninterface EmbedFormControlProps extends FormControlProps {\n formId?: string\n formLabel?: string\n}\n\nexport const EmbedFormControl: React.FC<WithChildren<EmbedFormControlProps>> = ({ formId, formLabel, children, ...props }) => {\n return (\n <FormControl {...props}>\n <InputLabel id={formId}>{formLabel}</InputLabel>\n {children}\n </FormControl>\n )\n}\n","import { MenuItem, Select, SelectProps } from '@mui/material'\nimport { ListMode, useListMode } from '@xyo-network/react-shared'\n\nimport { EmbedFormControl } from './EmbedFormControl'\n\nconst listModeSelectId = 'listmode-select-id'\nconst listModeSelectLabel = 'List Mode'\n\nexport const ListModeSelect: React.FC<SelectProps<ListMode>> = (props) => {\n const { listMode, setListMode } = useListMode()\n\n return (\n <Select<ListMode>\n value={(listMode ?? 'default') as ListMode}\n onChange={(event) => {\n setListMode?.(event.target.value as ListMode)\n }}\n {...props}\n >\n <MenuItem key=\"default\" value=\"default\">\n Default\n </MenuItem>\n <MenuItem key=\"table\" value=\"table\">\n Table\n </MenuItem>\n <MenuItem key=\"grid\" value=\"grid\">\n Grid\n </MenuItem>\n </Select>\n )\n}\n\nexport const ListModeSelectFormControl: React.FC<SelectProps<ListMode>> = (props) => {\n return (\n <EmbedFormControl formId={listModeSelectId} formLabel={listModeSelectLabel}>\n <ListModeSelect size=\"small\" label={listModeSelectLabel} labelId={listModeSelectId} {...props} />\n </EmbedFormControl>\n )\n}\n","import { MenuItem, Select, SelectProps } from '@mui/material'\n\nimport { useEmbedPluginState } from '../../contexts'\nimport { EmbedFormControl } from './EmbedFormControl'\n\nconst renderSelectId = 'render-select-id'\nconst renderSelectLabel = 'Renderer'\n\nexport const EmbedRenderSelect: React.FC<SelectProps> = (props) => {\n const { activePlugin, setActivePlugin, plugins } = useEmbedPluginState()\n return (\n <EmbedFormControl formId={renderSelectId} formLabel={renderSelectLabel}>\n <Select size=\"small\" value={activePlugin?.name} {...props}>\n {plugins?.map((plugin) => (\n <MenuItem value={plugin.name} key={plugin.name} onClick={() => setActivePlugin?.(plugin)}>\n {plugin.name}\n </MenuItem>\n ))}\n </Select>\n </EmbedFormControl>\n )\n}\n","import { Card, CardProps } from '@mui/material'\nimport { useBusyTiming } from '@xylabs/react-flexbox'\nimport {\n BusyCircularProgress,\n BusyCircularProgressProps,\n BusyLinearProgress,\n BusyLinearProgressProps,\n BusyVariant,\n WithChildren,\n} from '@xylabs/react-shared'\n\nexport interface BusyCardProps extends CardProps {\n busy?: boolean\n busyMinimum?: number\n busyVariant?: BusyVariant\n busyVariantProps?: BusyCircularProgressProps | BusyLinearProgressProps\n}\n\nexport const BusyCard: React.FC<WithChildren<BusyCardProps>> = ({\n busy,\n busyMinimum = 500,\n busyVariant = 'circular',\n busyVariantProps,\n children,\n ...props\n}) => {\n const internalBusy = useBusyTiming(busy, busyMinimum)\n return (\n <Card {...props}>\n {children}\n {busyVariant === 'circular' && internalBusy ? <BusyCircularProgress {...(busyVariantProps as BusyCircularProgressProps)} /> : null}\n {busyVariant === 'linear' && internalBusy ? <BusyLinearProgress {...(busyVariantProps as BusyLinearProgressProps)} /> : null}\n </Card>\n )\n}\n","import { Refresh as RefreshIcon } from '@mui/icons-material'\nimport { Avatar, CardHeader, CardHeaderProps, Chip, Theme } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\n\nimport { useEmbedPluginState, useResolvePayload } from '../../../contexts'\nimport { EmbedMenu } from '../menu'\n\nexport const EmbedCardHeader: React.FC<CardHeaderProps> = () => {\n const { refreshHuri, huri } = useResolvePayload()\n const { activePlugin, timestampLabel, hideElementsConfig } = useEmbedPluginState()\n const { hideAvatar, hideTitle, hideRefreshButton, hideTimestamp, hideCardActions } = hideElementsConfig ?? {}\n //this is temporary so that we can add the ability to get a timestamp via diviner later\n const timestamp = Date.now()\n return (\n <CardHeader\n sx={{ flexWrap: 'wrap', rowGap: 1 }}\n avatar={\n hideAvatar ? (\n <></>\n ) : (\n <Avatar sx={{ bgcolor: (theme: Theme) => theme.palette.primary.main }} aria-label={activePlugin?.name}>\n {activePlugin?.name?.charAt(0)}\n </Avatar>\n )\n }\n action={\n <FlexRow flexWrap=\"wrap\" columnGap={0.5}>\n {timestamp ? (\n hideTimestamp && hideRefreshButton ? (\n ''\n ) : (\n <Chip\n avatar={hideRefreshButton ? <></> : <RefreshIcon />}\n clickable={hideRefreshButton ? false : true}\n onClick={refreshHuri}\n label={hideTimestamp ? '' : `${timestampLabel} ${new Date(timestamp).toLocaleString()}`}\n />\n )\n ) : null}\n {/* Huri case is valid as long as the only menu item is JSON */}\n {hideCardActions || huri === undefined ? null : <EmbedMenu />}\n </FlexRow>\n }\n title={hideTitle ? '' : activePlugin?.name}\n />\n )\n}\n","import { MoreVert as MoreVertIcon } from '@mui/icons-material'\nimport { IconButton, IconButtonProps, Menu } from '@mui/material'\nimport { useState } from 'react'\n\nimport { JsonMenuItem } from './JsonMenuItem'\n\nexport const EmbedMenu: React.FC<IconButtonProps> = (props) => {\n // TODO - link to explore website\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null)\n const open = Boolean(anchorEl)\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget)\n }\n const handleClose = () => {\n setAnchorEl(null)\n }\n\n return (\n <>\n <IconButton onClick={handleClick} {...props}>\n <MoreVertIcon />\n </IconButton>\n <Menu anchorEl={anchorEl} open={open} onClose={handleClose} PaperProps={{ variant: 'elevation' }} MenuListProps={{ dense: true }}>\n <JsonMenuItem />\n </Menu>\n </>\n )\n}\n","import { OpenInNew as OpenInNewIcon } from '@mui/icons-material'\nimport { ListItemIcon, ListItemText, MenuItem, MenuItemProps } from '@mui/material'\n\nimport { useResolvePayload } from '../../../contexts'\n\nexport const JsonMenuItem: React.FC<MenuItemProps> = (props) => {\n const { huri } = useResolvePayload()\n\n return (\n <>\n {huri ? (\n <MenuItem title=\"Source Payload JSON\" onClick={() => window.open(huri, '_blank')} {...props}>\n <ListItemText sx={{ mr: 1 }}>JSON</ListItemText>\n <ListItemIcon sx={{ justifyContent: 'end' }}>\n <OpenInNewIcon fontSize=\"small\" />\n </ListItemIcon>\n </MenuItem>\n ) : null}\n </>\n )\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,eAAAA,oBAAmB;;;ACF5B,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ACJpE,SAAS,oBAAoB;AAItB,IAAM,sBAAsB,MAAM,aAAa,oBAAoB,eAAe,IAAI;;;ACJ7F,SAAS,mBAAAC,wBAAuB;AAIzB,IAAM,wBAAwBA,iBAAqC;;;ACJ1E,SAAS,gBAAAC,qBAAoB;AAItB,IAAM,oBAAoB,MAAMC,cAAa,uBAAuB,kBAAkB,IAAI;;;ACJjG,SAAS,aAA+B,kBAAkB;AAUtD,SACE,KADF;AAFG,IAAM,mBAAkE,CAAC,EAAE,QAAQ,WAAW,UAAU,GAAG,MAAM,MAAM;AAC5H,SACE,qBAAC,eAAa,GAAG,OACf;AAAA,wBAAC,cAAW,IAAI,QAAS,qBAAU;AAAA,IAClC;AAAA,KACH;AAEJ;;;ACfA,SAAS,UAAU,cAA2B;AAC9C,SAAmB,mBAAmB;AAWlC,SAOE,OAAAC,MAPF,QAAAC,aAAA;AAPJ,IAAM,mBAAmB;AACzB,IAAM,sBAAsB;AAErB,IAAM,iBAAkD,CAAC,UAAU;AACxE,QAAM,EAAE,UAAU,YAAY,IAAI,YAAY;AAE9C,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC,OAAQ,YAAY;AAAA,MACpB,UAAU,CAAC,UAAU;AACnB,sBAAc,MAAM,OAAO,KAAiB;AAAA,MAC9C;AAAA,MACC,GAAG;AAAA,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C,QAAAC,aAH2C;AAR5C,IAAM,kBAA2C,CAAC,EAAE,GAAG,MAAM,MAAM;AACxE,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AACtC,QAAM,EAAE,cAAc,cAAc,SAAS,mBAAmB,IAAI,oBAAoB;AACxF,QAAM,EAAE,SAAS,IAAIC,aAAY;AACjC,QAAM,mBAAmB,cAAc,YAAY,KAAK,WAAW,UAAU,IAAI;AAEjF,SACE,gBAAAD,MAAC,YAAU,GAAG,OACX;AAAA,wBAAoB,iBAAiB,OAAO,gBAAAD,KAAC,mBAAgB;AAAA,IAE5D,WAAW,QAAQ,UAAW,mBAC9B,gBAAAC,MAAC,eAAY,WAAW,GAAG,QAAQ,GAAG,UAAS,QAAO,IAAI,GACvD;AAAA,iBAAW,QAAQ,SAAS,IAAI,gBAAAD,KAAC,qBAAkB,IAAK;AAAA,MACxD,mBAAmB,gBAAAA,KAAC,6BAA0B,IAAK;AAAA,OACtD,IACE;AAAA,IACJ,gBAAAA,KAAC,eAAY,IAAI,EAAE,QAAQ,OAAO,GAC/B,yBAAe,gBAAAA,KAAC,aAAa,WAAW,IAAI,YAA5B,EAAuC,SAAmB,GAAI,oBAAoB,EAAE,SAAS,GAAI,IAAK,MACzH;AAAA,KACF;AAEJ;","names":["useListMode","createContextEx","useContextEx","useContextEx","jsx","jsxs","MenuItem","Select","jsx","Select","MenuItem","jsx","jsxs","MenuItem","jsx","jsxs","MenuItem","Fragment","jsx","jsxs","Fragment","jsx","jsxs","jsx","jsxs","useListMode"]}
|
@@ -1,4 +1,183 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
// src/components/embed-card/card/BusyCard.tsx
|
2
|
+
import { Card } from "@mui/material";
|
3
|
+
import { useBusyTiming } from "@xylabs/react-flexbox";
|
4
|
+
import {
|
5
|
+
BusyCircularProgress,
|
6
|
+
BusyLinearProgress
|
7
|
+
} from "@xylabs/react-shared";
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
9
|
+
var BusyCard = ({
|
10
|
+
busy,
|
11
|
+
busyMinimum = 500,
|
12
|
+
busyVariant = "circular",
|
13
|
+
busyVariantProps,
|
14
|
+
children,
|
15
|
+
...props
|
16
|
+
}) => {
|
17
|
+
const internalBusy = useBusyTiming(busy, busyMinimum);
|
18
|
+
return /* @__PURE__ */ jsxs(Card, { ...props, children: [
|
19
|
+
children,
|
20
|
+
busyVariant === "circular" && internalBusy ? /* @__PURE__ */ jsx(BusyCircularProgress, { ...busyVariantProps }) : null,
|
21
|
+
busyVariant === "linear" && internalBusy ? /* @__PURE__ */ jsx(BusyLinearProgress, { ...busyVariantProps }) : null
|
22
|
+
] });
|
23
|
+
};
|
24
|
+
|
25
|
+
// src/components/embed-card/card/EmbedCardHeader.tsx
|
26
|
+
import { Refresh as RefreshIcon } from "@mui/icons-material";
|
27
|
+
import { Avatar, CardHeader, Chip } from "@mui/material";
|
28
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
29
|
+
|
30
|
+
// src/contexts/EmbedPluginContext/Context.tsx
|
31
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
32
|
+
var EmbedPluginContext = createContextEx();
|
33
|
+
|
34
|
+
// src/contexts/EmbedPluginContext/use.tsx
|
35
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
36
|
+
var useEmbedPluginState = () => useContextEx(EmbedPluginContext, "EmbedPlugin", true);
|
37
|
+
|
38
|
+
// src/contexts/ResolvePayloadContext/Context.ts
|
39
|
+
import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
|
40
|
+
var ResolvePayloadContext = createContextEx2();
|
41
|
+
|
42
|
+
// src/contexts/ResolvePayloadContext/use.tsx
|
43
|
+
import { useContextEx as useContextEx2 } from "@xyo-network/react-shared";
|
44
|
+
var useResolvePayload = () => useContextEx2(ResolvePayloadContext, "ResolvePayload", true);
|
45
|
+
|
46
|
+
// src/components/embed-card/menu/EmbedMenu.tsx
|
47
|
+
import { MoreVert as MoreVertIcon } from "@mui/icons-material";
|
48
|
+
import { IconButton, Menu } from "@mui/material";
|
49
|
+
import { useState } from "react";
|
50
|
+
|
51
|
+
// src/components/embed-card/menu/JsonMenuItem.tsx
|
52
|
+
import { OpenInNew as OpenInNewIcon } from "@mui/icons-material";
|
53
|
+
import { ListItemIcon, ListItemText, MenuItem } from "@mui/material";
|
54
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
55
|
+
var JsonMenuItem = (props) => {
|
56
|
+
const { huri } = useResolvePayload();
|
57
|
+
return /* @__PURE__ */ jsx2(Fragment, { children: huri ? /* @__PURE__ */ jsxs2(MenuItem, { title: "Source Payload JSON", onClick: () => window.open(huri, "_blank"), ...props, children: [
|
58
|
+
/* @__PURE__ */ jsx2(ListItemText, { sx: { mr: 1 }, children: "JSON" }),
|
59
|
+
/* @__PURE__ */ jsx2(ListItemIcon, { sx: { justifyContent: "end" }, children: /* @__PURE__ */ jsx2(OpenInNewIcon, { fontSize: "small" }) })
|
60
|
+
] }) : null });
|
61
|
+
};
|
62
|
+
|
63
|
+
// src/components/embed-card/menu/EmbedMenu.tsx
|
64
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
65
|
+
var EmbedMenu = (props) => {
|
66
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
67
|
+
const open = Boolean(anchorEl);
|
68
|
+
const handleClick = (event) => {
|
69
|
+
setAnchorEl(event.currentTarget);
|
70
|
+
};
|
71
|
+
const handleClose = () => {
|
72
|
+
setAnchorEl(null);
|
73
|
+
};
|
74
|
+
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
75
|
+
/* @__PURE__ */ jsx3(IconButton, { onClick: handleClick, ...props, children: /* @__PURE__ */ jsx3(MoreVertIcon, {}) }),
|
76
|
+
/* @__PURE__ */ jsx3(Menu, { anchorEl, open, onClose: handleClose, PaperProps: { variant: "elevation" }, MenuListProps: { dense: true }, children: /* @__PURE__ */ jsx3(JsonMenuItem, {}) })
|
77
|
+
] });
|
78
|
+
};
|
79
|
+
|
80
|
+
// src/components/embed-card/card/EmbedCardHeader.tsx
|
81
|
+
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
82
|
+
var EmbedCardHeader = () => {
|
83
|
+
const { refreshHuri, huri } = useResolvePayload();
|
84
|
+
const { activePlugin, timestampLabel, hideElementsConfig } = useEmbedPluginState();
|
85
|
+
const { hideAvatar, hideTitle, hideRefreshButton, hideTimestamp, hideCardActions } = hideElementsConfig ?? {};
|
86
|
+
const timestamp = Date.now();
|
87
|
+
return /* @__PURE__ */ jsx4(
|
88
|
+
CardHeader,
|
89
|
+
{
|
90
|
+
sx: { flexWrap: "wrap", rowGap: 1 },
|
91
|
+
avatar: hideAvatar ? /* @__PURE__ */ jsx4(Fragment3, {}) : /* @__PURE__ */ jsx4(Avatar, { sx: { bgcolor: (theme) => theme.palette.primary.main }, "aria-label": activePlugin?.name, children: activePlugin?.name?.charAt(0) }),
|
92
|
+
action: /* @__PURE__ */ jsxs4(FlexRow, { flexWrap: "wrap", columnGap: 0.5, children: [
|
93
|
+
timestamp ? hideTimestamp && hideRefreshButton ? "" : /* @__PURE__ */ jsx4(
|
94
|
+
Chip,
|
95
|
+
{
|
96
|
+
avatar: hideRefreshButton ? /* @__PURE__ */ jsx4(Fragment3, {}) : /* @__PURE__ */ jsx4(RefreshIcon, {}),
|
97
|
+
clickable: hideRefreshButton ? false : true,
|
98
|
+
onClick: refreshHuri,
|
99
|
+
label: hideTimestamp ? "" : `${timestampLabel} ${new Date(timestamp).toLocaleString()}`
|
100
|
+
}
|
101
|
+
) : null,
|
102
|
+
hideCardActions || huri === void 0 ? null : /* @__PURE__ */ jsx4(EmbedMenu, {})
|
103
|
+
] }),
|
104
|
+
title: hideTitle ? "" : activePlugin?.name
|
105
|
+
}
|
106
|
+
);
|
107
|
+
};
|
108
|
+
|
109
|
+
// src/components/embed-card/card/EmbedPluginCard.tsx
|
110
|
+
import { CardContent } from "@mui/material";
|
111
|
+
import { FlexGrowRow } from "@xylabs/react-flexbox";
|
112
|
+
import { useListMode as useListMode2 } from "@xyo-network/react-shared";
|
113
|
+
|
114
|
+
// src/components/controls/EmbedFormControl.tsx
|
115
|
+
import { FormControl, InputLabel } from "@mui/material";
|
116
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
117
|
+
var EmbedFormControl = ({ formId, formLabel, children, ...props }) => {
|
118
|
+
return /* @__PURE__ */ jsxs5(FormControl, { ...props, children: [
|
119
|
+
/* @__PURE__ */ jsx5(InputLabel, { id: formId, children: formLabel }),
|
120
|
+
children
|
121
|
+
] });
|
122
|
+
};
|
123
|
+
|
124
|
+
// src/components/controls/ListModeSelect.tsx
|
125
|
+
import { MenuItem as MenuItem2, Select } from "@mui/material";
|
126
|
+
import { useListMode } from "@xyo-network/react-shared";
|
127
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
128
|
+
var listModeSelectId = "listmode-select-id";
|
129
|
+
var listModeSelectLabel = "List Mode";
|
130
|
+
var ListModeSelect = (props) => {
|
131
|
+
const { listMode, setListMode } = useListMode();
|
132
|
+
return /* @__PURE__ */ jsxs6(
|
133
|
+
Select,
|
134
|
+
{
|
135
|
+
value: listMode ?? "default",
|
136
|
+
onChange: (event) => {
|
137
|
+
setListMode?.(event.target.value);
|
138
|
+
},
|
139
|
+
...props,
|
140
|
+
children: [
|
141
|
+
/* @__PURE__ */ jsx6(MenuItem2, { value: "default", children: "Default" }, "default"),
|
142
|
+
/* @__PURE__ */ jsx6(MenuItem2, { value: "table", children: "Table" }, "table"),
|
143
|
+
/* @__PURE__ */ jsx6(MenuItem2, { value: "grid", children: "Grid" }, "grid")
|
144
|
+
]
|
145
|
+
}
|
146
|
+
);
|
147
|
+
};
|
148
|
+
var ListModeSelectFormControl = (props) => {
|
149
|
+
return /* @__PURE__ */ jsx6(EmbedFormControl, { formId: listModeSelectId, formLabel: listModeSelectLabel, children: /* @__PURE__ */ jsx6(ListModeSelect, { size: "small", label: listModeSelectLabel, labelId: listModeSelectId, ...props }) });
|
150
|
+
};
|
151
|
+
|
152
|
+
// src/components/controls/RenderSelect.tsx
|
153
|
+
import { MenuItem as MenuItem3, Select as Select2 } from "@mui/material";
|
154
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
155
|
+
var renderSelectId = "render-select-id";
|
156
|
+
var renderSelectLabel = "Renderer";
|
157
|
+
var EmbedRenderSelect = (props) => {
|
158
|
+
const { activePlugin, setActivePlugin, plugins } = useEmbedPluginState();
|
159
|
+
return /* @__PURE__ */ jsx7(EmbedFormControl, { formId: renderSelectId, formLabel: renderSelectLabel, children: /* @__PURE__ */ jsx7(Select2, { size: "small", value: activePlugin?.name, ...props, children: plugins?.map((plugin) => /* @__PURE__ */ jsx7(MenuItem3, { value: plugin.name, onClick: () => setActivePlugin?.(plugin), children: plugin.name }, plugin.name)) }) });
|
160
|
+
};
|
161
|
+
|
162
|
+
// src/components/embed-card/card/EmbedPluginCard.tsx
|
163
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
164
|
+
var EmbedPluginCard = ({ ...props }) => {
|
165
|
+
const { payload } = useResolvePayload();
|
166
|
+
const { activePlugin: ActivePlugin, plugins, hideElementsConfig } = useEmbedPluginState();
|
167
|
+
const { listMode } = useListMode2();
|
168
|
+
const supportsListMode = ActivePlugin?.components?.box?.listModes?.length ?? 0 > 1;
|
169
|
+
return /* @__PURE__ */ jsxs7(BusyCard, { ...props, children: [
|
170
|
+
hideElementsConfig?.hideCardHeader ? null : /* @__PURE__ */ jsx8(EmbedCardHeader, {}),
|
171
|
+
plugins && plugins.length || supportsListMode ? /* @__PURE__ */ jsxs7(FlexGrowRow, { columnGap: 2, rowGap: 2, flexWrap: "wrap", pb: 1, children: [
|
172
|
+
plugins && plugins.length > 1 ? /* @__PURE__ */ jsx8(EmbedRenderSelect, {}) : null,
|
173
|
+
supportsListMode ? /* @__PURE__ */ jsx8(ListModeSelectFormControl, {}) : null
|
174
|
+
] }) : null,
|
175
|
+
/* @__PURE__ */ jsx8(CardContent, { sx: { height: "100%" }, children: ActivePlugin ? /* @__PURE__ */ jsx8(ActivePlugin.components.box.detailsBox, { payload, ...supportsListMode && { listMode } }) : null })
|
176
|
+
] });
|
177
|
+
};
|
178
|
+
export {
|
179
|
+
BusyCard,
|
180
|
+
EmbedCardHeader,
|
181
|
+
EmbedPluginCard
|
182
|
+
};
|
4
183
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/embed-card/card/index.ts"],"sourcesContent":["export * from './BusyCard'\nexport * from './EmbedCardHeader'\nexport * from './EmbedPluginCard'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
1
|
+
{"version":3,"sources":["../../../../../src/components/embed-card/card/BusyCard.tsx","../../../../../src/components/embed-card/card/EmbedCardHeader.tsx","../../../../../src/contexts/EmbedPluginContext/Context.tsx","../../../../../src/contexts/EmbedPluginContext/use.tsx","../../../../../src/contexts/ResolvePayloadContext/Context.ts","../../../../../src/contexts/ResolvePayloadContext/use.tsx","../../../../../src/components/embed-card/menu/EmbedMenu.tsx","../../../../../src/components/embed-card/menu/JsonMenuItem.tsx","../../../../../src/components/embed-card/card/EmbedPluginCard.tsx","../../../../../src/components/controls/EmbedFormControl.tsx","../../../../../src/components/controls/ListModeSelect.tsx","../../../../../src/components/controls/RenderSelect.tsx"],"sourcesContent":["import { Card, CardProps } from '@mui/material'\nimport { useBusyTiming } from '@xylabs/react-flexbox'\nimport {\n BusyCircularProgress,\n BusyCircularProgressProps,\n BusyLinearProgress,\n BusyLinearProgressProps,\n BusyVariant,\n WithChildren,\n} from '@xylabs/react-shared'\n\nexport interface BusyCardProps extends CardProps {\n busy?: boolean\n busyMinimum?: number\n busyVariant?: BusyVariant\n busyVariantProps?: BusyCircularProgressProps | BusyLinearProgressProps\n}\n\nexport const BusyCard: React.FC<WithChildren<BusyCardProps>> = ({\n busy,\n busyMinimum = 500,\n busyVariant = 'circular',\n busyVariantProps,\n children,\n ...props\n}) => {\n const internalBusy = useBusyTiming(busy, busyMinimum)\n return (\n <Card {...props}>\n {children}\n {busyVariant === 'circular' && internalBusy ? <BusyCircularProgress {...(busyVariantProps as BusyCircularProgressProps)} /> : null}\n {busyVariant === 'linear' && internalBusy ? <BusyLinearProgress {...(busyVariantProps as BusyLinearProgressProps)} /> : null}\n </Card>\n )\n}\n","import { Refresh as RefreshIcon } from '@mui/icons-material'\nimport { Avatar, CardHeader, CardHeaderProps, Chip, Theme } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\n\nimport { useEmbedPluginState, useResolvePayload } from '../../../contexts'\nimport { EmbedMenu } from '../menu'\n\nexport const EmbedCardHeader: React.FC<CardHeaderProps> = () => {\n const { refreshHuri, huri } = useResolvePayload()\n const { activePlugin, timestampLabel, hideElementsConfig } = useEmbedPluginState()\n const { hideAvatar, hideTitle, hideRefreshButton, hideTimestamp, hideCardActions } = hideElementsConfig ?? {}\n //this is temporary so that we can add the ability to get a timestamp via diviner later\n const timestamp = Date.now()\n return (\n <CardHeader\n sx={{ flexWrap: 'wrap', rowGap: 1 }}\n avatar={\n hideAvatar ? (\n <></>\n ) : (\n <Avatar sx={{ bgcolor: (theme: Theme) => theme.palette.primary.main }} aria-label={activePlugin?.name}>\n {activePlugin?.name?.charAt(0)}\n </Avatar>\n )\n }\n action={\n <FlexRow flexWrap=\"wrap\" columnGap={0.5}>\n {timestamp ? (\n hideTimestamp && hideRefreshButton ? (\n ''\n ) : (\n <Chip\n avatar={hideRefreshButton ? <></> : <RefreshIcon />}\n clickable={hideRefreshButton ? false : true}\n onClick={refreshHuri}\n label={hideTimestamp ? '' : `${timestampLabel} ${new Date(timestamp).toLocaleString()}`}\n />\n )\n ) : null}\n {/* Huri case is valid as long as the only menu item is JSON */}\n {hideCardActions || huri === undefined ? null : <EmbedMenu />}\n </FlexRow>\n }\n title={hideTitle ? '' : activePlugin?.name}\n />\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginState } from './State'\n\nexport const EmbedPluginContext = createContextEx<EmbedPluginState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginContext } from './Context'\n\nexport const useEmbedPluginState = () => useContextEx(EmbedPluginContext, 'EmbedPlugin', true)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadState } from './State'\n\nexport const ResolvePayloadContext = createContextEx<ResolvePayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadContext } from './Context'\n\nexport const useResolvePayload = () => useContextEx(ResolvePayloadContext, 'ResolvePayload', true)\n","import { MoreVert as MoreVertIcon } from '@mui/icons-material'\nimport { IconButton, IconButtonProps, Menu } from '@mui/material'\nimport { useState } from 'react'\n\nimport { JsonMenuItem } from './JsonMenuItem'\n\nexport const EmbedMenu: React.FC<IconButtonProps> = (props) => {\n // TODO - link to explore website\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null)\n const open = Boolean(anchorEl)\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget)\n }\n const handleClose = () => {\n setAnchorEl(null)\n }\n\n return (\n <>\n <IconButton onClick={handleClick} {...props}>\n <MoreVertIcon />\n </IconButton>\n <Menu anchorEl={anchorEl} open={open} onClose={handleClose} PaperProps={{ variant: 'elevation' }} MenuListProps={{ dense: true }}>\n <JsonMenuItem />\n </Menu>\n </>\n )\n}\n","import { OpenInNew as OpenInNewIcon } from '@mui/icons-material'\nimport { ListItemIcon, ListItemText, MenuItem, MenuItemProps } from '@mui/material'\n\nimport { useResolvePayload } from '../../../contexts'\n\nexport const JsonMenuItem: React.FC<MenuItemProps> = (props) => {\n const { huri } = useResolvePayload()\n\n return (\n <>\n {huri ? (\n <MenuItem title=\"Source Payload JSON\" onClick={() => window.open(huri, '_blank')} {...props}>\n <ListItemText sx={{ mr: 1 }}>JSON</ListItemText>\n <ListItemIcon sx={{ justifyContent: 'end' }}>\n <OpenInNewIcon fontSize=\"small\" />\n </ListItemIcon>\n </MenuItem>\n ) : null}\n </>\n )\n}\n","import { CardContent } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { useListMode } from '@xyo-network/react-shared'\n\nimport { useEmbedPluginState, useResolvePayload } from '../../../contexts'\nimport { EmbedRenderSelect, ListModeSelectFormControl } from '../../controls'\nimport { BusyCard, BusyCardProps } from './BusyCard'\nimport { EmbedCardHeader } from './EmbedCardHeader'\n\nexport const EmbedPluginCard: React.FC<BusyCardProps> = ({ ...props }) => {\n const { payload } = useResolvePayload()\n const { activePlugin: ActivePlugin, plugins, hideElementsConfig } = useEmbedPluginState()\n const { listMode } = useListMode()\n const supportsListMode = ActivePlugin?.components?.box?.listModes?.length ?? 0 > 1\n\n return (\n <BusyCard {...props}>\n {hideElementsConfig?.hideCardHeader ? null : <EmbedCardHeader />}\n {/* Only show the row if the children are present */}\n {(plugins && plugins.length) || supportsListMode ? (\n <FlexGrowRow columnGap={2} rowGap={2} flexWrap=\"wrap\" pb={1}>\n {plugins && plugins.length > 1 ? <EmbedRenderSelect /> : null}\n {supportsListMode ? <ListModeSelectFormControl /> : null}\n </FlexGrowRow>\n ) : null}\n <CardContent sx={{ height: '100%' }}>\n {ActivePlugin ? <ActivePlugin.components.box.detailsBox payload={payload} {...(supportsListMode && { listMode })} /> : null}\n </CardContent>\n </BusyCard>\n )\n}\n","import { FormControl, FormControlProps, InputLabel } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\ninterface EmbedFormControlProps extends FormControlProps {\n formId?: string\n formLabel?: string\n}\n\nexport const EmbedFormControl: React.FC<WithChildren<EmbedFormControlProps>> = ({ formId, formLabel, children, ...props }) => {\n return (\n <FormControl {...props}>\n <InputLabel id={formId}>{formLabel}</InputLabel>\n {children}\n </FormControl>\n )\n}\n","import { MenuItem, Select, SelectProps } from '@mui/material'\nimport { ListMode, useListMode } from '@xyo-network/react-shared'\n\nimport { EmbedFormControl } from './EmbedFormControl'\n\nconst listModeSelectId = 'listmode-select-id'\nconst listModeSelectLabel = 'List Mode'\n\nexport const ListModeSelect: React.FC<SelectProps<ListMode>> = (props) => {\n const { listMode, setListMode } = useListMode()\n\n return (\n <Select<ListMode>\n value={(listMode ?? 'default') as ListMode}\n onChange={(event) => {\n setListMode?.(event.target.value as ListMode)\n }}\n {...props}\n >\n <MenuItem key=\"default\" value=\"default\">\n Default\n </MenuItem>\n <MenuItem key=\"table\" value=\"table\">\n Table\n </MenuItem>\n <MenuItem key=\"grid\" value=\"grid\">\n Grid\n </MenuItem>\n </Select>\n )\n}\n\nexport const ListModeSelectFormControl: React.FC<SelectProps<ListMode>> = (props) => {\n return (\n <EmbedFormControl formId={listModeSelectId} formLabel={listModeSelectLabel}>\n <ListModeSelect size=\"small\" label={listModeSelectLabel} labelId={listModeSelectId} {...props} />\n </EmbedFormControl>\n )\n}\n","import { MenuItem, Select, SelectProps } from '@mui/material'\n\nimport { useEmbedPluginState } from '../../contexts'\nimport { EmbedFormControl } from './EmbedFormControl'\n\nconst renderSelectId = 'render-select-id'\nconst renderSelectLabel = 'Renderer'\n\nexport const EmbedRenderSelect: React.FC<SelectProps> = (props) => {\n const { activePlugin, setActivePlugin, plugins } = useEmbedPluginState()\n return (\n <EmbedFormControl formId={renderSelectId} formLabel={renderSelectLabel}>\n <Select size=\"small\" value={activePlugin?.name} {...props}>\n {plugins?.map((plugin) => (\n <MenuItem value={plugin.name} key={plugin.name} onClick={() => setActivePlugin?.(plugin)}>\n {plugin.name}\n </MenuItem>\n ))}\n </Select>\n </EmbedFormControl>\n )\n}\n"],"mappings":";AAAA,SAAS,YAAuB;AAChC,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EAEA;AAAA,OAIK;AAmBH,SAEgD,KAFhD;AAVG,IAAM,WAAkD,CAAC;AAAA,EAC9D;AAAA,EACA,cAAc;AAA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UAAS,QAAO,IAAI,GACvD;AAAA,iBAAW,QAAQ,SAAS,IAAI,gBAAAD,KAAC,qBAAkB,IAAK;AAAA,MACxD,mBAAmB,gBAAAA,KAAC,6BAA0B,IAAK;AAAA,OACtD,IACE;AAAA,IACJ,gBAAAA,KAAC,eAAY,IAAI,EAAE,QAAQ,OAAO,GAC/B,yBAAe,gBAAAA,KAAC,aAAa,WAAW,IAAI,YAA5B,EAAuC,SAAmB,GAAI,oBAAoB,EAAE,SAAS,GAAI,IAAK,MACzH;AAAA,KACF;AAEJ;","names":["createContextEx","useContextEx","useContextEx","jsx","jsxs","Fragment","jsx","jsxs","Fragment","jsx","jsxs","useListMode","jsx","jsxs","MenuItem","jsx","jsxs","MenuItem","MenuItem","Select","jsx","Select","MenuItem","jsx","jsxs","useListMode"]}
|
@@ -1,11 +1,31 @@
|
|
1
|
-
|
1
|
+
// src/components/embed-card/error-handling/EmbedCardApiErrorRenderer.tsx
|
2
2
|
import { ErrorAlert, ErrorRender } from "@xyo-network/react-error";
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
|
4
|
+
// src/components/embed-card/error-handling/EmbedErrorCard.tsx
|
5
|
+
import { Alert, AlertTitle, Card, CardContent, Typography } from "@mui/material";
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
7
|
+
var EmbedErrorCard = (props) => {
|
8
|
+
const { alertProps, error, hideErrorDetails = true, children, ...cardProps } = props;
|
9
|
+
const errorProps = { alertProps, error, hideErrorDetails };
|
10
|
+
return /* @__PURE__ */ jsx(Card, { ...cardProps, children: /* @__PURE__ */ jsx(CardContent, { children: children ?? /* @__PURE__ */ jsx(DefaultErrorAlert, { ...errorProps }) }) });
|
6
11
|
};
|
7
|
-
|
8
|
-
return /* @__PURE__ */
|
12
|
+
var DefaultErrorAlert = ({ alertProps, hideErrorDetails, error }) => {
|
13
|
+
return /* @__PURE__ */ jsxs(Alert, { severity: "error", ...alertProps, children: [
|
14
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "Whoops! Something went wrong" }),
|
15
|
+
!hideErrorDetails && error ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
16
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: "Error: " }),
|
17
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: error?.message })
|
18
|
+
] }) : /* @__PURE__ */ jsx(Typography, { variant: "caption", fontSize: "small", children: "Error Loading Plugin" })
|
19
|
+
] });
|
20
|
+
};
|
21
|
+
|
22
|
+
// src/components/embed-card/error-handling/EmbedCardApiErrorRenderer.tsx
|
23
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
24
|
+
var EmbedCardApiErrorRenderer = ({ xyoError, children, ...props }) => {
|
25
|
+
return /* @__PURE__ */ jsx2(ErrorRender, { error: xyoError, noReAuth: true, noErrorDisplay: true, customError: /* @__PURE__ */ jsx2(CustomApiErrorCard, { xyoError, ...props }), children });
|
26
|
+
};
|
27
|
+
var CustomApiErrorCard = ({ xyoError, ...props }) => {
|
28
|
+
return /* @__PURE__ */ jsx2(EmbedErrorCard, { ...props, children: /* @__PURE__ */ jsx2(ErrorAlert, { error: xyoError }) });
|
9
29
|
};
|
10
30
|
export {
|
11
31
|
EmbedCardApiErrorRenderer
|