@devx-labs/strapi-preview 1.0.5 → 1.0.6

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.
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const designSystem = require("@strapi/design-system");
5
+ const icons = require("@strapi/icons");
6
+ const index = require("./index-7LCKy9W3.js");
7
+ const ModalContent = index.yt(designSystem.Modal.Content)`
8
+ width: 100vw !important;
9
+ height: 100vh !important;
10
+ max-width: 100% !important;
11
+ max-height: 100% !important;
12
+ `;
13
+ const PreviewImageInput = ({ attribute }) => {
14
+ const url = attribute?.options?.url;
15
+ const disableIframe = attribute?.options?.disableIframe;
16
+ if (!url) return null;
17
+ if (disableIframe) {
18
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
19
+ designSystem.LinkButton,
20
+ {
21
+ href: url,
22
+ target: "_blank",
23
+ rel: "noreferrer",
24
+ variant: "tertiary",
25
+ size: "S",
26
+ endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ExternalLink, {}),
27
+ children: "Preview"
28
+ }
29
+ ) });
30
+ }
31
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Root, { children: [
32
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", size: "S", endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ExternalLink, {}), children: "Preview" }) }),
33
+ /* @__PURE__ */ jsxRuntime.jsxs(ModalContent, { children: [
34
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: "Component Preview" }) }),
35
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(
36
+ designSystem.Box,
37
+ {
38
+ padding: 4,
39
+ background: "neutral100",
40
+ hasRadius: true,
41
+ style: { height: "80vh" },
42
+ children: /* @__PURE__ */ jsxRuntime.jsx(
43
+ "iframe",
44
+ {
45
+ src: url,
46
+ title: "Component Preview",
47
+ width: "100%",
48
+ height: "100%",
49
+ style: { border: "none" }
50
+ }
51
+ )
52
+ }
53
+ ) }),
54
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Close, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", children: "Close" }) }) })
55
+ ] })
56
+ ] }) });
57
+ };
58
+ exports.PreviewImageInput = PreviewImageInput;
@@ -0,0 +1,58 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Flex, LinkButton, Modal, Button, Box } from "@strapi/design-system";
3
+ import { ExternalLink } from "@strapi/icons";
4
+ import { y as yt } from "./index-BUqIITfj.mjs";
5
+ const ModalContent = yt(Modal.Content)`
6
+ width: 100vw !important;
7
+ height: 100vh !important;
8
+ max-width: 100% !important;
9
+ max-height: 100% !important;
10
+ `;
11
+ const PreviewImageInput = ({ attribute }) => {
12
+ const url = attribute?.options?.url;
13
+ const disableIframe = attribute?.options?.disableIframe;
14
+ if (!url) return null;
15
+ if (disableIframe) {
16
+ return /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsx(
17
+ LinkButton,
18
+ {
19
+ href: url,
20
+ target: "_blank",
21
+ rel: "noreferrer",
22
+ variant: "tertiary",
23
+ size: "S",
24
+ endIcon: /* @__PURE__ */ jsx(ExternalLink, {}),
25
+ children: "Preview"
26
+ }
27
+ ) });
28
+ }
29
+ return /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxs(Modal.Root, { children: [
30
+ /* @__PURE__ */ jsx(Modal.Trigger, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "S", endIcon: /* @__PURE__ */ jsx(ExternalLink, {}), children: "Preview" }) }),
31
+ /* @__PURE__ */ jsxs(ModalContent, { children: [
32
+ /* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: "Component Preview" }) }),
33
+ /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx(
34
+ Box,
35
+ {
36
+ padding: 4,
37
+ background: "neutral100",
38
+ hasRadius: true,
39
+ style: { height: "80vh" },
40
+ children: /* @__PURE__ */ jsx(
41
+ "iframe",
42
+ {
43
+ src: url,
44
+ title: "Component Preview",
45
+ width: "100%",
46
+ height: "100%",
47
+ style: { border: "none" }
48
+ }
49
+ )
50
+ }
51
+ ) }),
52
+ /* @__PURE__ */ jsx(Modal.Footer, { children: /* @__PURE__ */ jsx(Modal.Close, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", children: "Close" }) }) })
53
+ ] })
54
+ ] }) });
55
+ };
56
+ export {
57
+ PreviewImageInput
58
+ };