@frontify/guideline-blocks-settings 1.0.13-alpha.4 → 1.0.13-alpha.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.
- package/dist/components/Attachments/AttachmentItem.es.js +30 -30
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
- package/dist/components/Attachments/AttachmentsButtonTrigger.es.js +3 -3
- package/dist/components/Attachments/AttachmentsButtonTrigger.es.js.map +1 -1
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js +11 -12
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js +7 -7
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.es.js +9 -8
- package/dist/components/DownloadButton/DownloadButton.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/LinkSelector.es.js +31 -39
- package/dist/components/Link/LinkSelector/LinkSelector.es.js.map +1 -1
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,77 +1,69 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Dialog as
|
|
1
|
+
import { jsx as n, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as o, Button as d, ScrollArea as y } from "@frontify/fondue/components";
|
|
3
3
|
import { IconLink as x } from "@frontify/fondue/icons";
|
|
4
4
|
import { useState as m, useEffect as L } from "react";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { DocumentLinks as O } from "./DocumentLinks.es.js";
|
|
7
7
|
const j = ({
|
|
8
|
-
url:
|
|
8
|
+
url: r,
|
|
9
9
|
onUrlChange: s,
|
|
10
10
|
buttonSize: l = "medium",
|
|
11
|
-
getAllDocuments:
|
|
12
|
-
getDocumentPagesByDocumentId:
|
|
11
|
+
getAllDocuments: f,
|
|
12
|
+
getDocumentPagesByDocumentId: h,
|
|
13
13
|
getDocumentSectionsByDocumentPageId: u
|
|
14
14
|
}) => {
|
|
15
|
-
const [k, a] = m(!1), [
|
|
16
|
-
c(
|
|
17
|
-
}, P = (
|
|
18
|
-
|
|
15
|
+
const [k, a] = m(!1), [t, c] = m(r), D = (e) => {
|
|
16
|
+
c(e);
|
|
17
|
+
}, P = (e) => {
|
|
18
|
+
e.key === "Enter" && (e.preventDefault(), p());
|
|
19
19
|
};
|
|
20
20
|
L(() => {
|
|
21
|
-
|
|
22
|
-
}, [
|
|
21
|
+
r && !t && c(r);
|
|
22
|
+
}, [r, t]);
|
|
23
23
|
const p = () => {
|
|
24
|
-
s == null || s(
|
|
24
|
+
s == null || s(t), a(!1);
|
|
25
25
|
}, g = {
|
|
26
26
|
onOpenAutoFocus: () => {
|
|
27
27
|
},
|
|
28
28
|
showUnderlay: !0,
|
|
29
|
+
"data-is-underlay": !0,
|
|
29
30
|
minWidth: "800px"
|
|
30
31
|
};
|
|
31
32
|
return (
|
|
32
33
|
// eslint-disable-next-line jsx-a11y-x/no-static-element-interactions
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ n(
|
|
34
35
|
"div",
|
|
35
36
|
{
|
|
36
|
-
onPointerDownCapture: (
|
|
37
|
-
|
|
37
|
+
onPointerDownCapture: (e) => {
|
|
38
|
+
e.stopPropagation(), e.preventDefault();
|
|
38
39
|
},
|
|
39
|
-
onFocusCapture: (
|
|
40
|
-
|
|
40
|
+
onFocusCapture: (e) => {
|
|
41
|
+
e.stopPropagation(), e.preventDefault();
|
|
41
42
|
},
|
|
42
43
|
"data-test-id": "internal-link-selector",
|
|
43
44
|
onKeyDown: P,
|
|
44
|
-
children: /* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ i(o.Root, { modal: !0, open: k, onOpenChange: a, children: [
|
|
46
|
+
/* @__PURE__ */ n(o.Trigger, { asChild: !0, children: /* @__PURE__ */ i(d, { size: l, emphasis: "default", children: [
|
|
47
|
+
/* @__PURE__ */ n(x, { size: "20" }),
|
|
47
48
|
"Internal link"
|
|
48
49
|
] }) }),
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
50
|
+
/* @__PURE__ */ i(o.Content, { ...g, children: [
|
|
51
|
+
/* @__PURE__ */ n(o.Header, { children: /* @__PURE__ */ n(o.Title, { children: "Select internal link" }) }),
|
|
52
|
+
/* @__PURE__ */ n(o.Body, { padding: "none", children: /* @__PURE__ */ n(y, { padding: "compact", children: /* @__PURE__ */ n(
|
|
52
53
|
O,
|
|
53
54
|
{
|
|
54
|
-
selectedUrl:
|
|
55
|
+
selectedUrl: t,
|
|
55
56
|
onSelectUrl: D,
|
|
56
|
-
getAllDocuments:
|
|
57
|
-
getDocumentPagesByDocumentId:
|
|
57
|
+
getAllDocuments: f,
|
|
58
|
+
getDocumentPagesByDocumentId: h,
|
|
58
59
|
getDocumentSectionsByDocumentPageId: u
|
|
59
60
|
}
|
|
60
61
|
) }) }),
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
d,
|
|
65
|
-
{
|
|
66
|
-
size: l,
|
|
67
|
-
disabled: !o,
|
|
68
|
-
emphasis: "strong",
|
|
69
|
-
onPress: () => p(),
|
|
70
|
-
children: "Choose"
|
|
71
|
-
}
|
|
72
|
-
)
|
|
62
|
+
/* @__PURE__ */ i(o.Footer, { children: [
|
|
63
|
+
/* @__PURE__ */ n(d, { size: l, emphasis: "default", onPress: () => a(!1), children: "Cancel" }),
|
|
64
|
+
/* @__PURE__ */ n(d, { size: l, disabled: !t, emphasis: "strong", onPress: () => p(), children: "Choose" })
|
|
73
65
|
] })
|
|
74
|
-
] })
|
|
66
|
+
] })
|
|
75
67
|
] })
|
|
76
68
|
}
|
|
77
69
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkSelector.es.js","sources":["../../../../src/components/Link/LinkSelector/LinkSelector.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Document, type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { Button, Dialog, ScrollArea } from '@frontify/fondue/components';\nimport { IconLink } from '@frontify/fondue/icons';\nimport { type KeyboardEvent, type ReactElement, useEffect, useState } from 'react';\n\nimport './LinkSelector.css';\nimport { DocumentLinks } from './DocumentLinks';\n\ntype LinkSelectorProps = {\n url: string;\n onUrlChange?: (value: string) => void;\n buttonSize?: 'small' | 'medium' | 'large';\n getAllDocuments: () => Promise<Document[]>;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const LinkSelector = ({\n url,\n onUrlChange,\n buttonSize = 'medium',\n getAllDocuments,\n getDocumentPagesByDocumentId,\n getDocumentSectionsByDocumentPageId,\n}: LinkSelectorProps): ReactElement => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [selectedUrl, setSelectedUrl] = useState<string>(url);\n\n const onSelectUrl = (url: string) => {\n setSelectedUrl(url);\n };\n\n const onPressEnter = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n saveLink();\n }\n };\n\n useEffect(() => {\n if (url && !selectedUrl) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setSelectedUrl(url);\n }\n }, [url, selectedUrl]);\n\n const saveLink = () => {\n onUrlChange?.(selectedUrl);\n setIsModalOpen(false);\n };\n\n const dialogProps = {\n onOpenAutoFocus: () => {},\n showUnderlay: true,\n minWidth: '800px',\n };\n\n return (\n // eslint-disable-next-line jsx-a11y-x/no-static-element-interactions\n <div\n onPointerDownCapture={(event) => {\n event.stopPropagation();\n event.preventDefault();\n }}\n onFocusCapture={(event) => {\n event.stopPropagation();\n event.preventDefault();\n }}\n data-test-id=\"internal-link-selector\"\n onKeyDown={onPressEnter}\n >\n <Dialog.Root modal open={isModalOpen} onOpenChange={setIsModalOpen}>\n <Dialog.Trigger asChild>\n <Button size={buttonSize} emphasis=\"default\">\n <IconLink size=\"20\" />\n Internal link\n </Button>\n </Dialog.Trigger>\n <Dialog.Content {...dialogProps}>\n <
|
|
1
|
+
{"version":3,"file":"LinkSelector.es.js","sources":["../../../../src/components/Link/LinkSelector/LinkSelector.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Document, type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { Button, Dialog, ScrollArea } from '@frontify/fondue/components';\nimport { IconLink } from '@frontify/fondue/icons';\nimport { type KeyboardEvent, type ReactElement, useEffect, useState } from 'react';\n\nimport './LinkSelector.css';\nimport { DocumentLinks } from './DocumentLinks';\n\ntype LinkSelectorProps = {\n url: string;\n onUrlChange?: (value: string) => void;\n buttonSize?: 'small' | 'medium' | 'large';\n getAllDocuments: () => Promise<Document[]>;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const LinkSelector = ({\n url,\n onUrlChange,\n buttonSize = 'medium',\n getAllDocuments,\n getDocumentPagesByDocumentId,\n getDocumentSectionsByDocumentPageId,\n}: LinkSelectorProps): ReactElement => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [selectedUrl, setSelectedUrl] = useState<string>(url);\n\n const onSelectUrl = (url: string) => {\n setSelectedUrl(url);\n };\n\n const onPressEnter = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n saveLink();\n }\n };\n\n useEffect(() => {\n if (url && !selectedUrl) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setSelectedUrl(url);\n }\n }, [url, selectedUrl]);\n\n const saveLink = () => {\n onUrlChange?.(selectedUrl);\n setIsModalOpen(false);\n };\n\n const dialogProps = {\n onOpenAutoFocus: () => {},\n showUnderlay: true,\n 'data-is-underlay': true,\n minWidth: '800px',\n };\n\n return (\n // eslint-disable-next-line jsx-a11y-x/no-static-element-interactions\n <div\n onPointerDownCapture={(event) => {\n event.stopPropagation();\n event.preventDefault();\n }}\n onFocusCapture={(event) => {\n event.stopPropagation();\n event.preventDefault();\n }}\n data-test-id=\"internal-link-selector\"\n onKeyDown={onPressEnter}\n >\n <Dialog.Root modal open={isModalOpen} onOpenChange={setIsModalOpen}>\n <Dialog.Trigger asChild>\n <Button size={buttonSize} emphasis=\"default\">\n <IconLink size=\"20\" />\n Internal link\n </Button>\n </Dialog.Trigger>\n <Dialog.Content {...dialogProps}>\n <Dialog.Header>\n <Dialog.Title>Select internal link</Dialog.Title>\n </Dialog.Header>\n <Dialog.Body padding=\"none\">\n <ScrollArea padding=\"compact\">\n <DocumentLinks\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n getAllDocuments={getAllDocuments}\n getDocumentPagesByDocumentId={getDocumentPagesByDocumentId}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n />\n </ScrollArea>\n </Dialog.Body>\n <Dialog.Footer>\n <Button size={buttonSize} emphasis=\"default\" onPress={() => setIsModalOpen(false)}>\n Cancel\n </Button>\n <Button size={buttonSize} disabled={!selectedUrl} emphasis=\"strong\" onPress={() => saveLink()}>\n Choose\n </Button>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog.Root>\n </div>\n );\n};\n"],"names":["LinkSelector","url","onUrlChange","buttonSize","getAllDocuments","getDocumentPagesByDocumentId","getDocumentSectionsByDocumentPageId","isModalOpen","setIsModalOpen","useState","selectedUrl","setSelectedUrl","onSelectUrl","onPressEnter","event","saveLink","useEffect","dialogProps","jsx","jsxs","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