@frontify/guideline-blocks-settings 0.29.6 → 0.29.8
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 +24 -0
- package/dist/components/Link/LinkSelector/DocumentLink.es.js +20 -22
- package/dist/components/Link/LinkSelector/DocumentLink.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js +19 -19
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js +7 -0
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/PageLink.es.js +25 -28
- package/dist/components/Link/LinkSelector/PageLink.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/PageLinks.es.js +19 -19
- package/dist/components/Link/LinkSelector/PageLinks.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/SectionLink.es.js +11 -12
- package/dist/components/Link/LinkSelector/SectionLink.es.js.map +1 -1
- package/dist/components/RichTextEditor/SerializedText.es.js +14 -7
- package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -1
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js +16 -15
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.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/dist/styles.css +1 -1
- package/package.json +4 -4
- package/src/components/Link/LinkSelector/DocumentLink.tsx +4 -6
- package/src/components/Link/LinkSelector/DocumentLinks.tsx +2 -4
- package/src/components/Link/LinkSelector/LinkSelector.spec.ct.tsx +3 -0
- package/src/components/Link/LinkSelector/LoadingIndicator.tsx +11 -0
- package/src/components/Link/LinkSelector/PageLink.tsx +4 -7
- package/src/components/Link/LinkSelector/PageLinks.tsx +3 -7
- package/src/components/Link/LinkSelector/SectionLink.tsx +0 -1
- package/src/components/RichTextEditor/SerializedText.tsx +5 -1
- package/src/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.tsx +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @frontify/guideline-blocks-settings
|
|
2
2
|
|
|
3
|
+
## 0.29.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#577](https://github.com/Frontify/brand-sdk/pull/577) [`2c17f39`](https://github.com/Frontify/brand-sdk/commit/2c17f396b7f3670cf8c9c041937a414bcd22ae94) Thanks [@ragi96](https://github.com/ragi96)! - feat: add autoFormatPlugin to defaultPluginsWithLinkChooser
|
|
8
|
+
|
|
9
|
+
- [#570](https://github.com/Frontify/brand-sdk/pull/570) [`9b2e5f3`](https://github.com/Frontify/brand-sdk/commit/9b2e5f3853832dfa3cf0ec9fe0ec2ad1c5927d23) Thanks [@ragi96](https://github.com/ragi96)! - fix(RTE): list style inconsistent between view and edit mode
|
|
10
|
+
|
|
11
|
+
- [#577](https://github.com/Frontify/brand-sdk/pull/577) [`2c17f39`](https://github.com/Frontify/brand-sdk/commit/2c17f396b7f3670cf8c9c041937a414bcd22ae94) Thanks [@ragi96](https://github.com/ragi96)! - chore: bump fondue to v12.0.0-beta.334
|
|
12
|
+
|
|
13
|
+
- [#574](https://github.com/Frontify/brand-sdk/pull/574) [`a025aee`](https://github.com/Frontify/brand-sdk/commit/a025aeecfd3647a7bd75d139d9309310092d5b54) Thanks [@fulopdaniel](https://github.com/fulopdaniel)! - fix(LinkSelector): initial click triggered twice
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`2c17f39`](https://github.com/Frontify/brand-sdk/commit/2c17f396b7f3670cf8c9c041937a414bcd22ae94)]:
|
|
16
|
+
- @frontify/sidebar-settings@0.6.11
|
|
17
|
+
|
|
18
|
+
## 0.29.7
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#566](https://github.com/Frontify/brand-sdk/pull/566) [`ece6876`](https://github.com/Frontify/brand-sdk/commit/ece68765bcd1675cf32f9fd20b77c8dd5e665ee1) Thanks [@ragi96](https://github.com/ragi96)! - chore: bump fondue to v12.0.0-beta.324
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [[`ece6876`](https://github.com/Frontify/brand-sdk/commit/ece68765bcd1675cf32f9fd20b77c8dd5e665ee1)]:
|
|
25
|
+
- @frontify/sidebar-settings@0.6.10
|
|
26
|
+
|
|
3
27
|
## 0.29.6
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -1,42 +1,40 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as a, Fragment as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useEffect as x } from "react";
|
|
3
3
|
import { PageLinks as m } from "./PageLinks.es.js";
|
|
4
|
-
import { merge as
|
|
4
|
+
import { merge as i, IconColorFan16 as p } from "@frontify/fondue";
|
|
5
5
|
const u = ({
|
|
6
6
|
document: t,
|
|
7
7
|
appBridge: c,
|
|
8
|
-
selectedUrl:
|
|
9
|
-
onSelectUrl:
|
|
8
|
+
selectedUrl: n,
|
|
9
|
+
onSelectUrl: s,
|
|
10
10
|
itemsToExpandInitially: r
|
|
11
11
|
}) => {
|
|
12
|
-
const [o,
|
|
13
|
-
return
|
|
14
|
-
t.id === r.documentId &&
|
|
15
|
-
}, [r, t.id]), /* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
12
|
+
const [o, w] = b(t.id === r.documentId), d = t.permanentLink === n;
|
|
13
|
+
return x(() => {
|
|
14
|
+
t.id === r.documentId && w(!0);
|
|
15
|
+
}, [r, t.id]), /* @__PURE__ */ a(l, { children: [
|
|
16
|
+
/* @__PURE__ */ a(
|
|
17
17
|
"button",
|
|
18
18
|
{
|
|
19
19
|
"data-test-id": "internal-link-selector-document-link",
|
|
20
|
-
className:
|
|
21
|
-
"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-
|
|
20
|
+
className: i([
|
|
21
|
+
"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-w-full",
|
|
22
22
|
d ? "tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover" : "hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"
|
|
23
23
|
]),
|
|
24
|
-
onClick: () =>
|
|
25
|
-
onFocus: () => n(t.permanentLink),
|
|
24
|
+
onClick: () => s(t.permanentLink),
|
|
26
25
|
children: [
|
|
27
26
|
/* @__PURE__ */ e(
|
|
28
|
-
"
|
|
27
|
+
"button",
|
|
29
28
|
{
|
|
30
29
|
role: "button",
|
|
31
30
|
tabIndex: 0,
|
|
32
31
|
"data-test-id": "tree-item-toggle",
|
|
33
|
-
className: "tw-flex tw-items-center tw-justify-center tw-
|
|
34
|
-
onClick: () =>
|
|
35
|
-
onFocus: () => s(!o),
|
|
32
|
+
className: "tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",
|
|
33
|
+
onClick: () => w(!o),
|
|
36
34
|
children: /* @__PURE__ */ e(
|
|
37
35
|
"div",
|
|
38
36
|
{
|
|
39
|
-
className:
|
|
37
|
+
className: i([
|
|
40
38
|
"tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",
|
|
41
39
|
o ? "tw-rotate-90" : ""
|
|
42
40
|
])
|
|
@@ -44,7 +42,7 @@ const u = ({
|
|
|
44
42
|
)
|
|
45
43
|
}
|
|
46
44
|
),
|
|
47
|
-
/* @__PURE__ */ e(
|
|
45
|
+
/* @__PURE__ */ e(p, {}),
|
|
48
46
|
/* @__PURE__ */ e("span", { className: "tw-text-s", children: t.title }),
|
|
49
47
|
/* @__PURE__ */ e("span", { className: "tw-flex-auto tw-font-sans tw-text-xs tw-text-right", children: "Document" })
|
|
50
48
|
]
|
|
@@ -55,8 +53,8 @@ const u = ({
|
|
|
55
53
|
{
|
|
56
54
|
appBridge: c,
|
|
57
55
|
documentId: t.id,
|
|
58
|
-
selectedUrl:
|
|
59
|
-
onSelectUrl:
|
|
56
|
+
selectedUrl: n,
|
|
57
|
+
onSelectUrl: s,
|
|
60
58
|
itemsToExpandInitially: r
|
|
61
59
|
}
|
|
62
60
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentLink.es.js","sources":["../../../../src/components/Link/LinkSelector/DocumentLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { AppBridgeBlock, AppBridgeTheme } from '@frontify/app-bridge';\nimport { useEffect, useState } from 'react';\nimport { PageLinks } from './PageLinks';\nimport { IconColorFan16, merge } from '@frontify/fondue';\nimport { InitiallyExpandedItems } from '../';\n\ntype DocumentLinkProps = {\n document: {\n id: number;\n title: string;\n permanentLink: string;\n };\n appBridge: AppBridgeBlock | AppBridgeTheme;\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n itemsToExpandInitially: InitiallyExpandedItems;\n};\n\nexport const DocumentLink = ({\n document,\n appBridge,\n selectedUrl,\n onSelectUrl,\n itemsToExpandInitially,\n}: DocumentLinkProps) => {\n const [isExpanded, setIsExpanded] = useState(document.id === itemsToExpandInitially.documentId);\n const isActive = document.permanentLink === selectedUrl;\n\n useEffect(() => {\n if (document.id === itemsToExpandInitially.documentId) {\n setIsExpanded(true);\n }\n }, [itemsToExpandInitially, document.id]);\n\n return (\n <>\n <button\n data-test-id=\"internal-link-selector-document-link\"\n className={merge([\n 'tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-
|
|
1
|
+
{"version":3,"file":"DocumentLink.es.js","sources":["../../../../src/components/Link/LinkSelector/DocumentLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { AppBridgeBlock, AppBridgeTheme } from '@frontify/app-bridge';\nimport { useEffect, useState } from 'react';\nimport { PageLinks } from './PageLinks';\nimport { IconColorFan16, merge } from '@frontify/fondue';\nimport { InitiallyExpandedItems } from '../';\n\ntype DocumentLinkProps = {\n document: {\n id: number;\n title: string;\n permanentLink: string;\n };\n appBridge: AppBridgeBlock | AppBridgeTheme;\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n itemsToExpandInitially: InitiallyExpandedItems;\n};\n\nexport const DocumentLink = ({\n document,\n appBridge,\n selectedUrl,\n onSelectUrl,\n itemsToExpandInitially,\n}: DocumentLinkProps) => {\n const [isExpanded, setIsExpanded] = useState(document.id === itemsToExpandInitially.documentId);\n const isActive = document.permanentLink === selectedUrl;\n\n useEffect(() => {\n if (document.id === itemsToExpandInitially.documentId) {\n setIsExpanded(true);\n }\n }, [itemsToExpandInitially, document.id]);\n\n return (\n <>\n <button\n data-test-id=\"internal-link-selector-document-link\"\n className={merge([\n 'tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-w-full',\n isActive\n ? 'tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover'\n : 'hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover',\n ])}\n onClick={() => onSelectUrl(document.permanentLink)}\n >\n <button\n role=\"button\"\n tabIndex={0}\n data-test-id=\"tree-item-toggle\"\n className=\"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer\"\n onClick={() => setIsExpanded(!isExpanded)}\n >\n <div\n className={merge([\n 'tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong',\n isExpanded ? 'tw-rotate-90' : '',\n ])}\n ></div>\n </button>\n <IconColorFan16 />\n <span className=\"tw-text-s\">{document.title}</span>\n <span className=\"tw-flex-auto tw-font-sans tw-text-xs tw-text-right\">Document</span>\n </button>\n {isExpanded && (\n <PageLinks\n appBridge={appBridge}\n documentId={document.id}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n itemsToExpandInitially={itemsToExpandInitially}\n />\n )}\n </>\n );\n};\n"],"names":["DocumentLink","document","appBridge","selectedUrl","onSelectUrl","itemsToExpandInitially","isExpanded","setIsExpanded","useState","isActive","useEffect","jsxs","Fragment","merge","jsx","IconColorFan16","PageLinks"],"mappings":";;;;AAoBO,MAAMA,IAAe,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,wBAAAC;AACJ,MAAyB;AACf,QAAA,CAACC,GAAYC,CAAa,IAAIC,EAASP,EAAS,OAAOI,EAAuB,UAAU,GACxFI,IAAWR,EAAS,kBAAkBE;AAE5C,SAAAO,EAAU,MAAM;AACR,IAAAT,EAAS,OAAOI,EAAuB,cACvCE,EAAc,EAAI;AAAA,EAEvB,GAAA,CAACF,GAAwBJ,EAAS,EAAE,CAAC,GAIhC,gBAAAU,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAD;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,gBAAa;AAAA,QACb,WAAWE,EAAM;AAAA,UACb;AAAA,UACAJ,IACM,oKACA;AAAA,QAAA,CACT;AAAA,QACD,SAAS,MAAML,EAAYH,EAAS,aAAa;AAAA,QAEjD,UAAA;AAAA,UAAA,gBAAAa;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,MAAK;AAAA,cACL,UAAU;AAAA,cACV,gBAAa;AAAA,cACb,WAAU;AAAA,cACV,SAAS,MAAMP,EAAc,CAACD,CAAU;AAAA,cAExC,UAAA,gBAAAQ;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACG,WAAWD,EAAM;AAAA,oBACb;AAAA,oBACAP,IAAa,iBAAiB;AAAA,kBAAA,CACjC;AAAA,gBAAA;AAAA,cACJ;AAAA,YAAA;AAAA,UACL;AAAA,4BACCS,GAAe,EAAA;AAAA,UACf,gBAAAD,EAAA,QAAA,EAAK,WAAU,aAAa,YAAS,OAAM;AAAA,UAC3C,gBAAAA,EAAA,QAAA,EAAK,WAAU,sDAAqD,UAAQ,YAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACjF;AAAA,IACCR,KACG,gBAAAQ;AAAA,MAACE;AAAA,MAAA;AAAA,QACG,WAAAd;AAAA,QACA,YAAYD,EAAS;AAAA,QACrB,aAAAE;AAAA,QACA,aAAAC;AAAA,QACA,wBAAAC;AAAA,MAAA;AAAA,IACJ;AAAA,EAER,EAAA,CAAA;AAER;"}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
import { jsx as i, Fragment as v } from "react/jsx-runtime";
|
|
2
|
-
import { LoadingCircle as h } from "@frontify/fondue";
|
|
3
2
|
import { useState as r, useEffect as d } from "react";
|
|
4
|
-
import { DocumentLink as
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { DocumentLink as A } from "./DocumentLink.es.js";
|
|
4
|
+
import { LoadingIndicator as h } from "./LoadingIndicator.es.js";
|
|
5
|
+
const F = ({ appBridge: n, selectedUrl: e, onSelectUrl: m }) => {
|
|
6
|
+
const [u, l] = r(!0), [f, I] = r([]), [g, D] = r({
|
|
7
7
|
documentId: void 0,
|
|
8
8
|
pageId: void 0
|
|
9
9
|
}), o = [...f.values()];
|
|
10
10
|
d(() => {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
e && o.length > 0 && p().then((t) => {
|
|
12
|
+
D(t);
|
|
13
13
|
});
|
|
14
14
|
}, [o.length]), d(() => {
|
|
15
|
-
|
|
15
|
+
n.getAllDocuments().then((t) => {
|
|
16
16
|
I(t);
|
|
17
17
|
}).finally(() => {
|
|
18
18
|
l(!1);
|
|
19
19
|
});
|
|
20
20
|
}, []);
|
|
21
|
-
const
|
|
21
|
+
const p = async () => {
|
|
22
22
|
const t = {
|
|
23
23
|
documentId: void 0,
|
|
24
24
|
pageId: void 0
|
|
25
25
|
};
|
|
26
|
-
if (o.find((s) => s.permanentLink ===
|
|
26
|
+
if (o.find((s) => s.permanentLink === e))
|
|
27
27
|
return t;
|
|
28
28
|
for (const s of o) {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
const a = [...
|
|
32
|
-
if (!!a.find((c) => c.permanentLink ===
|
|
29
|
+
const y = await n.getDocumentPagesByDocumentId(s.id);
|
|
30
|
+
n.getAllDocuments();
|
|
31
|
+
const a = [...y.values()];
|
|
32
|
+
if (!!a.find((c) => c.permanentLink === e))
|
|
33
33
|
return t.documentId = s.id, t;
|
|
34
34
|
for (const c of a)
|
|
35
|
-
if (!![...(await
|
|
35
|
+
if (!![...(await n.getDocumentSectionsByDocumentPageId(c.id)).values()].find((L) => L.permanentLink === e))
|
|
36
36
|
return t.documentId = s.id, t.pageId = c.id, t;
|
|
37
37
|
}
|
|
38
38
|
return t;
|
|
39
39
|
};
|
|
40
|
-
return u ? /* @__PURE__ */ i(
|
|
41
|
-
|
|
40
|
+
return u ? /* @__PURE__ */ i(h, {}) : /* @__PURE__ */ i(v, { children: o.map((t) => /* @__PURE__ */ i(
|
|
41
|
+
A,
|
|
42
42
|
{
|
|
43
43
|
document: t,
|
|
44
|
-
appBridge:
|
|
45
|
-
selectedUrl:
|
|
44
|
+
appBridge: n,
|
|
45
|
+
selectedUrl: e,
|
|
46
46
|
onSelectUrl: m,
|
|
47
47
|
itemsToExpandInitially: g
|
|
48
48
|
},
|
|
@@ -50,6 +50,6 @@ const C = ({ appBridge: e, selectedUrl: n, onSelectUrl: m }) => {
|
|
|
50
50
|
)) });
|
|
51
51
|
};
|
|
52
52
|
export {
|
|
53
|
-
|
|
53
|
+
F as DocumentLinks
|
|
54
54
|
};
|
|
55
55
|
//# sourceMappingURL=DocumentLinks.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentLinks.es.js","sources":["../../../../src/components/Link/LinkSelector/DocumentLinks.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { AppBridgeBlock, AppBridgeTheme, Document } from '@frontify/app-bridge';\nimport {
|
|
1
|
+
{"version":3,"file":"DocumentLinks.es.js","sources":["../../../../src/components/Link/LinkSelector/DocumentLinks.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { AppBridgeBlock, AppBridgeTheme, Document } from '@frontify/app-bridge';\nimport { ReactElement, useEffect, useState } from 'react';\nimport { DocumentLink } from './DocumentLink';\nimport { LoadingIndicator } from './LoadingIndicator';\nimport { InitiallyExpandedItems } from '../';\n\ntype DocumentLinksProps = {\n appBridge: AppBridgeBlock | AppBridgeTheme;\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n};\n\nexport const DocumentLinks = ({ appBridge, selectedUrl, onSelectUrl }: DocumentLinksProps): ReactElement => {\n const [isLoading, setIsLoading] = useState(true);\n const [documents, setDocuments] = useState<Document[]>([]);\n const [itemsToExpandInitially, setItemsToExpandInitially] = useState<InitiallyExpandedItems>({\n documentId: undefined,\n pageId: undefined,\n });\n\n const documentArray = [...documents.values()];\n\n useEffect(() => {\n if (selectedUrl && documentArray.length > 0) {\n findLocationOfSelectedUrl().then((items) => {\n setItemsToExpandInitially(items);\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [documentArray.length]);\n\n useEffect(() => {\n appBridge\n .getAllDocuments()\n .then((_documents) => {\n setDocuments(_documents);\n })\n .finally(() => {\n setIsLoading(false);\n });\n }, []);\n\n const findLocationOfSelectedUrl = async () => {\n const itemsToExpand: InitiallyExpandedItems = {\n documentId: undefined,\n pageId: undefined,\n };\n const selectedUrlIsDocument = documentArray.find((document) => document.permanentLink === selectedUrl);\n if (selectedUrlIsDocument) {\n return itemsToExpand;\n }\n for (const document of documentArray) {\n const pages = await appBridge.getDocumentPagesByDocumentId(document.id);\n appBridge.getAllDocuments();\n const pagesArray = [...pages.values()];\n const selectedUrlIsPage = !!pagesArray.find((page) => page.permanentLink === selectedUrl);\n if (selectedUrlIsPage) {\n itemsToExpand.documentId = document.id;\n return itemsToExpand;\n }\n for (const page of pagesArray) {\n const sections = await appBridge.getDocumentSectionsByDocumentPageId(page.id);\n const sectionsArray = [...sections.values()];\n const selectedUrlIsSection = !!sectionsArray.find((section) => section.permanentLink === selectedUrl);\n if (selectedUrlIsSection) {\n itemsToExpand.documentId = document.id;\n itemsToExpand.pageId = page.id;\n return itemsToExpand;\n }\n }\n }\n return itemsToExpand;\n };\n\n return isLoading ? (\n <LoadingIndicator />\n ) : (\n <>\n {documentArray.map((document) => {\n return (\n <DocumentLink\n key={document.id}\n document={document}\n appBridge={appBridge}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n itemsToExpandInitially={itemsToExpandInitially}\n />\n );\n })}\n </>\n );\n};\n"],"names":["DocumentLinks","appBridge","selectedUrl","onSelectUrl","isLoading","setIsLoading","useState","documents","setDocuments","itemsToExpandInitially","setItemsToExpandInitially","documentArray","useEffect","findLocationOfSelectedUrl","items","_documents","itemsToExpand","document","pages","pagesArray","page","section","LoadingIndicator","jsx","DocumentLink"],"mappings":";;;;AAcO,MAAMA,IAAgB,CAAC,EAAE,WAAAC,GAAW,aAAAC,GAAa,aAAAC,QAAoD;AACxG,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAI,GACzC,CAACC,GAAWC,CAAY,IAAIF,EAAqB,CAAE,CAAA,GACnD,CAACG,GAAwBC,CAAyB,IAAIJ,EAAiC;AAAA,IACzF,YAAY;AAAA,IACZ,QAAQ;AAAA,EAAA,CACX,GAEKK,IAAgB,CAAC,GAAGJ,EAAU,OAAQ,CAAA;AAE5C,EAAAK,EAAU,MAAM;AACR,IAAAV,KAAeS,EAAc,SAAS,KACZE,EAAA,EAAE,KAAK,CAACC,MAAU;AACxC,MAAAJ,EAA0BI,CAAK;AAAA,IAAA,CAClC;AAAA,EACL,GAED,CAACH,EAAc,MAAM,CAAC,GAEzBC,EAAU,MAAM;AACZ,IAAAX,EACK,gBAAgB,EAChB,KAAK,CAACc,MAAe;AAClB,MAAAP,EAAaO,CAAU;AAAA,IAAA,CAC1B,EACA,QAAQ,MAAM;AACX,MAAAV,EAAa,EAAK;AAAA,IAAA,CACrB;AAAA,EACT,GAAG,CAAE,CAAA;AAEL,QAAMQ,IAA4B,YAAY;AAC1C,UAAMG,IAAwC;AAAA,MAC1C,YAAY;AAAA,MACZ,QAAQ;AAAA,IAAA;AAGZ,QAD8BL,EAAc,KAAK,CAACM,MAAaA,EAAS,kBAAkBf,CAAW;AAE1F,aAAAc;AAEX,eAAWC,KAAYN,GAAe;AAClC,YAAMO,IAAQ,MAAMjB,EAAU,6BAA6BgB,EAAS,EAAE;AACtE,MAAAhB,EAAU,gBAAgB;AAC1B,YAAMkB,IAAa,CAAC,GAAGD,EAAM,OAAQ,CAAA;AAErC,UAD0B,CAAC,CAACC,EAAW,KAAK,CAACC,MAASA,EAAK,kBAAkBlB,CAAW;AAEpF,eAAAc,EAAc,aAAaC,EAAS,IAC7BD;AAEX,iBAAWI,KAAQD;AAIf,YAD6B,CAAC,CADR,CAAC,IADN,MAAMlB,EAAU,oCAAoCmB,EAAK,EAAE,GACzC,OAAQ,CAAA,EACE,KAAK,CAACC,MAAYA,EAAQ,kBAAkBnB,CAAW;AAEhG,iBAAAc,EAAc,aAAaC,EAAS,IACpCD,EAAc,SAASI,EAAK,IACrBJ;AAAA,IAGnB;AACO,WAAAA;AAAA,EAAA;AAGJ,SAAAZ,sBACFkB,GAAiB,CAAA,CAAA,2BAGb,UAAcX,EAAA,IAAI,CAACM,MAEZ,gBAAAM;AAAA,IAACC;AAAA,IAAA;AAAA,MAEG,UAAAP;AAAA,MACA,WAAAhB;AAAA,MACA,aAAAC;AAAA,MACA,aAAAC;AAAA,MACA,wBAAAM;AAAA,IAAA;AAAA,IALKQ,EAAS;AAAA,EAAA,CAQzB,EACL,CAAA;AAER;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { LoadingCircle as i, LoadingCircleSize as t } from "@frontify/fondue";
|
|
3
|
+
const n = () => /* @__PURE__ */ e("div", { className: "tw-flex tw-justify-center tw-h-10 tw-items-center", children: /* @__PURE__ */ e(i, { size: t.Small }) });
|
|
4
|
+
export {
|
|
5
|
+
n as LoadingIndicator
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=LoadingIndicator.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingIndicator.es.js","sources":["../../../../src/components/Link/LinkSelector/LoadingIndicator.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { LoadingCircle, LoadingCircleSize } from '@frontify/fondue';\n\nexport const LoadingIndicator = () => {\n return (\n <div className=\"tw-flex tw-justify-center tw-h-10 tw-items-center\">\n <LoadingCircle size={LoadingCircleSize.Small} />\n </div>\n );\n};\n"],"names":["LoadingIndicator","jsx","LoadingCircle","LoadingCircleSize"],"mappings":";;AAIO,MAAMA,IAAmB,MAExB,gBAAAC,EAAC,SAAI,WAAU,qDACX,4BAACC,GAAc,EAAA,MAAMC,EAAkB,MAAO,CAAA,EAClD,CAAA;"}
|
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useDocumentSection as
|
|
3
|
-
import { merge as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { SectionLink as
|
|
6
|
-
const
|
|
7
|
-
const [
|
|
1
|
+
import { jsxs as l, Fragment as b, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useDocumentSection as p } from "@frontify/app-bridge";
|
|
3
|
+
import { merge as d } from "@frontify/fondue";
|
|
4
|
+
import { useState as u, useEffect as f } from "react";
|
|
5
|
+
import { SectionLink as v } from "./SectionLink.es.js";
|
|
6
|
+
const j = ({ page: t, selectedUrl: s, onSelectUrl: i, itemsToExpandInitially: r, appBridge: m }) => {
|
|
7
|
+
const [n, w] = u(t.id === r.documentId), x = t.permanentLink === s, { documentSections: h } = p(m, t.id), o = [...h.values()], c = o.length > 0;
|
|
8
8
|
return f(() => {
|
|
9
|
-
t.id ===
|
|
10
|
-
}, [
|
|
9
|
+
t.id === r.pageId && w(!0);
|
|
10
|
+
}, [r, t.id]), /* @__PURE__ */ l(b, { children: [
|
|
11
11
|
/* @__PURE__ */ e(
|
|
12
|
-
"
|
|
12
|
+
"button",
|
|
13
13
|
{
|
|
14
|
-
tabIndex: 0,
|
|
15
14
|
"data-test-id": "internal-link-selector-page-link",
|
|
16
|
-
className:
|
|
17
|
-
"tw-py-2 tw-
|
|
18
|
-
|
|
15
|
+
className: d([
|
|
16
|
+
"tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full",
|
|
17
|
+
c ? "tw-pl-7" : "tw-pl-12",
|
|
19
18
|
x ? "tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover" : "hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"
|
|
20
19
|
]),
|
|
21
|
-
onClick: () =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
w && /* @__PURE__ */ e(
|
|
20
|
+
onClick: () => i(t.permanentLink),
|
|
21
|
+
children: /* @__PURE__ */ l("div", { className: "tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6", children: [
|
|
22
|
+
c && /* @__PURE__ */ e(
|
|
25
23
|
"button",
|
|
26
24
|
{
|
|
27
25
|
"data-test-id": "tree-item-toggle",
|
|
28
|
-
className: "tw-flex tw-items-center tw-justify-center tw-
|
|
29
|
-
onClick: () =>
|
|
30
|
-
onFocus: () => s(!r),
|
|
26
|
+
className: "tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",
|
|
27
|
+
onClick: () => w(!n),
|
|
31
28
|
children: /* @__PURE__ */ e(
|
|
32
29
|
"div",
|
|
33
30
|
{
|
|
34
|
-
className:
|
|
31
|
+
className: d([
|
|
35
32
|
"tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",
|
|
36
|
-
|
|
33
|
+
n ? "tw-rotate-90" : ""
|
|
37
34
|
])
|
|
38
35
|
}
|
|
39
36
|
)
|
|
@@ -44,18 +41,18 @@ const F = ({ page: t, selectedUrl: c, onSelectUrl: n, itemsToExpandInitially: o,
|
|
|
44
41
|
] }, t.id)
|
|
45
42
|
}
|
|
46
43
|
),
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
n && o.length > 0 && o.map((a) => /* @__PURE__ */ e(
|
|
45
|
+
v,
|
|
49
46
|
{
|
|
50
47
|
section: a,
|
|
51
|
-
selectedUrl:
|
|
52
|
-
onSelectUrl:
|
|
48
|
+
selectedUrl: s,
|
|
49
|
+
onSelectUrl: i
|
|
53
50
|
},
|
|
54
51
|
a.id
|
|
55
52
|
))
|
|
56
53
|
] });
|
|
57
54
|
};
|
|
58
55
|
export {
|
|
59
|
-
|
|
56
|
+
j as PageLink
|
|
60
57
|
};
|
|
61
58
|
//# sourceMappingURL=PageLink.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLink.es.js","sources":["../../../../src/components/Link/LinkSelector/PageLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { AppBridgeBlock, AppBridgeTheme, useDocumentSection } from '@frontify/app-bridge';\nimport { merge } from '@frontify/fondue';\nimport { useEffect, useState } from 'react';\nimport { InitiallyExpandedItems } from '../';\nimport { SectionLink } from './SectionLink';\n\ntype DocumentLinkProps = {\n page: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n appBridge: AppBridgeBlock | AppBridgeTheme;\n itemsToExpandInitially: InitiallyExpandedItems;\n};\n\nexport const PageLink = ({ page, selectedUrl, onSelectUrl, itemsToExpandInitially, appBridge }: DocumentLinkProps) => {\n const [isExpanded, setIsExpanded] = useState(page.id === itemsToExpandInitially.documentId);\n const isActive = page.permanentLink === selectedUrl;\n const { documentSections } = useDocumentSection(appBridge, page.id);\n const sectionsArray = [...documentSections.values()];\n const hasSections = sectionsArray.length > 0;\n\n useEffect(() => {\n if (page.id === itemsToExpandInitially.pageId) {\n setIsExpanded(true);\n }\n }, [itemsToExpandInitially, page.id]);\n\n return (\n <>\n <
|
|
1
|
+
{"version":3,"file":"PageLink.es.js","sources":["../../../../src/components/Link/LinkSelector/PageLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { AppBridgeBlock, AppBridgeTheme, useDocumentSection } from '@frontify/app-bridge';\nimport { merge } from '@frontify/fondue';\nimport { useEffect, useState } from 'react';\nimport { InitiallyExpandedItems } from '../';\nimport { SectionLink } from './SectionLink';\n\ntype DocumentLinkProps = {\n page: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n appBridge: AppBridgeBlock | AppBridgeTheme;\n itemsToExpandInitially: InitiallyExpandedItems;\n};\n\nexport const PageLink = ({ page, selectedUrl, onSelectUrl, itemsToExpandInitially, appBridge }: DocumentLinkProps) => {\n const [isExpanded, setIsExpanded] = useState(page.id === itemsToExpandInitially.documentId);\n const isActive = page.permanentLink === selectedUrl;\n const { documentSections } = useDocumentSection(appBridge, page.id);\n const sectionsArray = [...documentSections.values()];\n const hasSections = sectionsArray.length > 0;\n\n useEffect(() => {\n if (page.id === itemsToExpandInitially.pageId) {\n setIsExpanded(true);\n }\n }, [itemsToExpandInitially, page.id]);\n\n return (\n <>\n <button\n data-test-id=\"internal-link-selector-page-link\"\n className={merge([\n 'tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full',\n hasSections ? 'tw-pl-7' : 'tw-pl-12',\n isActive\n ? 'tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover'\n : 'hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover',\n ])}\n onClick={() => onSelectUrl(page.permanentLink)}\n >\n <div key={page.id} className=\"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6\">\n {hasSections && (\n <button\n data-test-id=\"tree-item-toggle\"\n className=\"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer\"\n onClick={() => setIsExpanded(!isExpanded)}\n >\n <div\n className={merge([\n 'tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong',\n isExpanded ? 'tw-rotate-90' : '',\n ])}\n ></div>\n </button>\n )}\n <span className=\"tw-text-s\">{page.title}</span>\n <span className=\"tw-flex-auto tw-font-sans tw-text-xs tw-text-right\">Page</span>\n </div>\n </button>\n {isExpanded &&\n sectionsArray.length > 0 &&\n sectionsArray.map((section) => {\n return (\n <SectionLink\n key={section.id}\n section={section}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n />\n );\n })}\n </>\n );\n};\n"],"names":["PageLink","page","selectedUrl","onSelectUrl","itemsToExpandInitially","appBridge","isExpanded","setIsExpanded","useState","isActive","documentSections","useDocumentSection","sectionsArray","hasSections","useEffect","jsxs","Fragment","jsx","merge","section","SectionLink"],"mappings":";;;;;AAoBa,MAAAA,IAAW,CAAC,EAAE,MAAAC,GAAM,aAAAC,GAAa,aAAAC,GAAa,wBAAAC,GAAwB,WAAAC,QAAmC;AAC5G,QAAA,CAACC,GAAYC,CAAa,IAAIC,EAASP,EAAK,OAAOG,EAAuB,UAAU,GACpFK,IAAWR,EAAK,kBAAkBC,GAClC,EAAE,kBAAAQ,EAAiB,IAAIC,EAAmBN,GAAWJ,EAAK,EAAE,GAC5DW,IAAgB,CAAC,GAAGF,EAAiB,OAAQ,CAAA,GAC7CG,IAAcD,EAAc,SAAS;AAE3C,SAAAE,EAAU,MAAM;AACR,IAAAb,EAAK,OAAOG,EAAuB,UACnCG,EAAc,EAAI;AAAA,EAEvB,GAAA,CAACH,GAAwBH,EAAK,EAAE,CAAC,GAI5B,gBAAAc,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,gBAAa;AAAA,QACb,WAAWC,EAAM;AAAA,UACb;AAAA,UACAL,IAAc,YAAY;AAAA,UAC1BJ,IACM,oKACA;AAAA,QAAA,CACT;AAAA,QACD,SAAS,MAAMN,EAAYF,EAAK,aAAa;AAAA,QAE7C,UAAA,gBAAAc,EAAC,OAAkB,EAAA,WAAU,yDACxB,UAAA;AAAA,UACGF,KAAA,gBAAAI;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,gBAAa;AAAA,cACb,WAAU;AAAA,cACV,SAAS,MAAMV,EAAc,CAACD,CAAU;AAAA,cAExC,UAAA,gBAAAW;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACG,WAAWC,EAAM;AAAA,oBACb;AAAA,oBACAZ,IAAa,iBAAiB;AAAA,kBAAA,CACjC;AAAA,gBAAA;AAAA,cACJ;AAAA,YAAA;AAAA,UACL;AAAA,UAEH,gBAAAW,EAAA,QAAA,EAAK,WAAU,aAAa,YAAK,OAAM;AAAA,UACvC,gBAAAA,EAAA,QAAA,EAAK,WAAU,sDAAqD,UAAI,QAAA;AAAA,QAAA,EAAA,GAhBnEhB,EAAK,EAiBf;AAAA,MAAA;AAAA,IACJ;AAAA,IACCK,KACGM,EAAc,SAAS,KACvBA,EAAc,IAAI,CAACO,MAEX,gBAAAF;AAAA,MAACG;AAAA,MAAA;AAAA,QAEG,SAAAD;AAAA,QACA,aAAAjB;AAAA,QACA,aAAAC;AAAA,MAAA;AAAA,MAHKgB,EAAQ;AAAA,IAAA,CAMxB;AAAA,EACT,EAAA,CAAA;AAER;"}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { jsx as r, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import { useState as i, useEffect as x } from "react";
|
|
3
|
+
import { PageLink as L } from "./PageLink.es.js";
|
|
4
|
+
import { LoadingIndicator as P } from "./LoadingIndicator.es.js";
|
|
5
5
|
const D = ({
|
|
6
|
-
appBridge:
|
|
6
|
+
appBridge: s,
|
|
7
7
|
documentId: c,
|
|
8
8
|
selectedUrl: g,
|
|
9
|
-
onSelectUrl:
|
|
10
|
-
itemsToExpandInitially:
|
|
9
|
+
onSelectUrl: m,
|
|
10
|
+
itemsToExpandInitially: l
|
|
11
11
|
}) => {
|
|
12
12
|
const [f, d] = i([]), [a, u] = i(!0), n = [...f.values()], y = !a && n.length > 0;
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
(t,
|
|
17
|
-
),
|
|
18
|
-
d([...
|
|
13
|
+
return x(() => {
|
|
14
|
+
s.getDocumentPagesByDocumentId(c).then((e) => {
|
|
15
|
+
const h = e.filter((t) => !!t.category).sort(
|
|
16
|
+
(t, o) => t.category.sort === o.category.sort ? t.sort - o.sort : t.category.sort - o.category.sort
|
|
17
|
+
), p = e.filter((t) => !t.category).sort((t, o) => t.sort - o.sort);
|
|
18
|
+
d([...h, ...p]);
|
|
19
19
|
}).finally(() => {
|
|
20
20
|
u(!1);
|
|
21
21
|
});
|
|
22
|
-
}, []), a ? /* @__PURE__ */
|
|
23
|
-
|
|
22
|
+
}, []), a ? /* @__PURE__ */ r(P, {}) : y ? /* @__PURE__ */ r(w, { children: n.map((e) => /* @__PURE__ */ r(
|
|
23
|
+
L,
|
|
24
24
|
{
|
|
25
25
|
page: e,
|
|
26
|
-
appBridge:
|
|
26
|
+
appBridge: s,
|
|
27
27
|
selectedUrl: g,
|
|
28
|
-
onSelectUrl:
|
|
29
|
-
itemsToExpandInitially:
|
|
28
|
+
onSelectUrl: m,
|
|
29
|
+
itemsToExpandInitially: l
|
|
30
30
|
},
|
|
31
31
|
e.id
|
|
32
|
-
)) }) : /* @__PURE__ */
|
|
32
|
+
)) }) : /* @__PURE__ */ r("div", { className: "tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-s tw-text-text-weak", children: "This document does not contain any pages." });
|
|
33
33
|
};
|
|
34
34
|
export {
|
|
35
35
|
D as PageLinks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLinks.es.js","sources":["../../../../src/components/Link/LinkSelector/PageLinks.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { AppBridgeBlock, AppBridgeTheme, DocumentPage } from '@frontify/app-bridge';\nimport {
|
|
1
|
+
{"version":3,"file":"PageLinks.es.js","sources":["../../../../src/components/Link/LinkSelector/PageLinks.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { AppBridgeBlock, AppBridgeTheme, DocumentPage } from '@frontify/app-bridge';\nimport { ReactElement, useEffect, useState } from 'react';\nimport { InitiallyExpandedItems } from '../';\nimport { PageLink } from './PageLink';\nimport { LoadingIndicator } from './LoadingIndicator';\n\ntype PageLinksProps = {\n appBridge: AppBridgeBlock | AppBridgeTheme;\n documentId: number;\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n itemsToExpandInitially: InitiallyExpandedItems;\n};\n\nexport const PageLinks = ({\n appBridge,\n documentId,\n selectedUrl,\n onSelectUrl,\n itemsToExpandInitially,\n}: PageLinksProps): ReactElement => {\n const [pages, setPages] = useState<DocumentPage[]>([]);\n const [isLoading, setIsLoading] = useState(true);\n const pagesArray = [...pages.values()];\n const hasPages = !isLoading && pagesArray.length > 0;\n\n useEffect(() => {\n appBridge\n .getDocumentPagesByDocumentId(documentId)\n .then((_pages) => {\n const pagesWithCategories = _pages\n .filter((page) => !!page.category)\n .sort((a, b) =>\n a.category.sort === b.category.sort ? a.sort - b.sort : a.category.sort - b.category.sort,\n );\n const pagesWithoutCategories = _pages.filter((page) => !page.category).sort((a, b) => a.sort - b.sort);\n setPages([...pagesWithCategories, ...pagesWithoutCategories]);\n })\n .finally(() => {\n setIsLoading(false);\n });\n }, []);\n\n if (isLoading) {\n return <LoadingIndicator />;\n }\n\n return hasPages ? (\n <>\n {pagesArray.map((page) => {\n return (\n <PageLink\n key={page.id}\n page={page}\n appBridge={appBridge}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n itemsToExpandInitially={itemsToExpandInitially}\n />\n );\n })}\n </>\n ) : (\n <div className=\"tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-s tw-text-text-weak\">\n This document does not contain any pages.\n </div>\n );\n};\n"],"names":["PageLinks","appBridge","documentId","selectedUrl","onSelectUrl","itemsToExpandInitially","pages","setPages","useState","isLoading","setIsLoading","pagesArray","hasPages","useEffect","_pages","pagesWithCategories","page","a","b","pagesWithoutCategories","LoadingIndicator","jsx","Fragment","PageLink"],"mappings":";;;;AAgBO,MAAMA,IAAY,CAAC;AAAA,EACtB,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,wBAAAC;AACJ,MAAoC;AAChC,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAyB,CAAE,CAAA,GAC/C,CAACC,GAAWC,CAAY,IAAIF,EAAS,EAAI,GACzCG,IAAa,CAAC,GAAGL,EAAM,OAAQ,CAAA,GAC/BM,IAAW,CAACH,KAAaE,EAAW,SAAS;AAmBnD,SAjBAE,EAAU,MAAM;AACZ,IAAAZ,EACK,6BAA6BC,CAAU,EACvC,KAAK,CAACY,MAAW;AACR,YAAAC,IAAsBD,EACvB,OAAO,CAACE,MAAS,CAAC,CAACA,EAAK,QAAQ,EAChC;AAAA,QAAK,CAACC,GAAGC,MACND,EAAE,SAAS,SAASC,EAAE,SAAS,OAAOD,EAAE,OAAOC,EAAE,OAAOD,EAAE,SAAS,OAAOC,EAAE,SAAS;AAAA,MAAA,GAEvFC,IAAyBL,EAAO,OAAO,CAACE,MAAS,CAACA,EAAK,QAAQ,EAAE,KAAK,CAACC,GAAGC,MAAMD,EAAE,OAAOC,EAAE,IAAI;AACrG,MAAAX,EAAS,CAAC,GAAGQ,GAAqB,GAAGI,CAAsB,CAAC;AAAA,IAAA,CAC/D,EACA,QAAQ,MAAM;AACX,MAAAT,EAAa,EAAK;AAAA,IAAA,CACrB;AAAA,EACT,GAAG,CAAE,CAAA,GAEDD,sBACQW,GAAiB,CAAA,CAAA,IAGtBR,IACH,gBAAAS,EAAAC,GAAA,EACK,UAAWX,EAAA,IAAI,CAACK,MAET,gBAAAK;AAAA,IAACE;AAAA,IAAA;AAAA,MAEG,MAAAP;AAAA,MACA,WAAAf;AAAA,MACA,aAAAE;AAAA,MACA,aAAAC;AAAA,MACA,wBAAAC;AAAA,IAAA;AAAA,IALKW,EAAK;AAAA,EAAA,CAQrB,EACL,CAAA,sBAEC,OAAI,EAAA,WAAU,8FAA6F,UAE5G,4CAAA,CAAA;AAER;"}
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { merge as
|
|
3
|
-
const
|
|
4
|
-
const o =
|
|
5
|
-
return /* @__PURE__ */
|
|
1
|
+
import { jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { merge as l, IconDocumentText16 as i } from "@frontify/fondue";
|
|
3
|
+
const x = ({ section: e, selectedUrl: r, onSelectUrl: n }) => {
|
|
4
|
+
const o = e.permanentLink === r;
|
|
5
|
+
return /* @__PURE__ */ t(
|
|
6
6
|
"button",
|
|
7
7
|
{
|
|
8
8
|
"data-test-id": "internal-link-selector-section-link",
|
|
9
|
-
className:
|
|
9
|
+
className: l([
|
|
10
10
|
"tw-py-2 tw-px-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",
|
|
11
11
|
o ? "tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover" : "hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"
|
|
12
12
|
]),
|
|
13
|
-
onClick: () => n(
|
|
14
|
-
onFocus: () => n(t.permanentLink),
|
|
13
|
+
onClick: () => n(e.permanentLink),
|
|
15
14
|
children: /* @__PURE__ */ s("div", { className: "tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6", children: [
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
15
|
+
/* @__PURE__ */ t(i, {}),
|
|
16
|
+
/* @__PURE__ */ t("span", { className: "tw-text-s", children: e.title }),
|
|
17
|
+
/* @__PURE__ */ t("span", { className: "tw-flex-auto tw-font-sans tw-text-xs tw-text-right", children: "Section" })
|
|
19
18
|
] })
|
|
20
19
|
}
|
|
21
20
|
);
|
|
22
21
|
};
|
|
23
22
|
export {
|
|
24
|
-
|
|
23
|
+
x as SectionLink
|
|
25
24
|
};
|
|
26
25
|
//# sourceMappingURL=SectionLink.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionLink.es.js","sources":["../../../../src/components/Link/LinkSelector/SectionLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconDocumentText16, merge } from '@frontify/fondue';\n\ntype SectionLinkProps = {\n section: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n};\n\nexport const SectionLink = ({ section, selectedUrl, onSelectUrl }: SectionLinkProps) => {\n const isActive = section.permanentLink === selectedUrl;\n\n return (\n <button\n data-test-id=\"internal-link-selector-section-link\"\n className={merge([\n 'tw-py-2 tw-px-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full',\n isActive\n ? 'tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover'\n : 'hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover',\n ])}\n onClick={() => onSelectUrl(section.permanentLink)}\n
|
|
1
|
+
{"version":3,"file":"SectionLink.es.js","sources":["../../../../src/components/Link/LinkSelector/SectionLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconDocumentText16, merge } from '@frontify/fondue';\n\ntype SectionLinkProps = {\n section: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n};\n\nexport const SectionLink = ({ section, selectedUrl, onSelectUrl }: SectionLinkProps) => {\n const isActive = section.permanentLink === selectedUrl;\n\n return (\n <button\n data-test-id=\"internal-link-selector-section-link\"\n className={merge([\n 'tw-py-2 tw-px-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full',\n isActive\n ? 'tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover'\n : 'hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover',\n ])}\n onClick={() => onSelectUrl(section.permanentLink)}\n >\n <div className=\"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6\">\n <IconDocumentText16 />\n <span className=\"tw-text-s\">{section.title}</span>\n <span className=\"tw-flex-auto tw-font-sans tw-text-xs tw-text-right\">Section</span>\n </div>\n </button>\n );\n};\n"],"names":["SectionLink","section","selectedUrl","onSelectUrl","isActive","jsx","merge","jsxs","IconDocumentText16"],"mappings":";;AAcO,MAAMA,IAAc,CAAC,EAAE,SAAAC,GAAS,aAAAC,GAAa,aAAAC,QAAoC;AAC9E,QAAAC,IAAWH,EAAQ,kBAAkBC;AAGvC,SAAA,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,gBAAa;AAAA,MACb,WAAWC,EAAM;AAAA,QACb;AAAA,QACAF,IACM,oKACA;AAAA,MAAA,CACT;AAAA,MACD,SAAS,MAAMD,EAAYF,EAAQ,aAAa;AAAA,MAEhD,UAAA,gBAAAM,EAAC,OAAI,EAAA,WAAU,yDACX,UAAA;AAAA,QAAA,gBAAAF,EAACG,GAAmB,EAAA;AAAA,QACnB,gBAAAH,EAAA,QAAA,EAAK,WAAU,aAAa,YAAQ,OAAM;AAAA,QAC1C,gBAAAA,EAAA,QAAA,EAAK,WAAU,sDAAqD,UAAO,WAAA;AAAA,MAAA,GAChF;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { useState as i, useEffect as
|
|
3
|
-
import { serializeRawToHtmlAsync as
|
|
4
|
-
const
|
|
2
|
+
import { useState as i, useEffect as w } from "react";
|
|
3
|
+
import { serializeRawToHtmlAsync as o } from "@frontify/fondue";
|
|
4
|
+
const d = ({ value: e = "", gap: l, columns: r, show: m = !0, plugins: a }) => {
|
|
5
5
|
const [t, n] = i(null);
|
|
6
|
-
return
|
|
7
|
-
(async () => n(await
|
|
8
|
-
}, [e, r, l, a]), !m || t === "<br />" ? null : t !== null ? /* @__PURE__ */ s(
|
|
6
|
+
return w(() => {
|
|
7
|
+
(async () => n(await o(e, a, r, l)))();
|
|
8
|
+
}, [e, r, l, a]), !m || t === "<br />" ? null : t !== null ? /* @__PURE__ */ s(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
className: "tw-w-full tw-whitespace-pre-wrap",
|
|
12
|
+
"data-test-id": "rte-content-html",
|
|
13
|
+
dangerouslySetInnerHTML: { __html: t }
|
|
14
|
+
}
|
|
15
|
+
) : /* @__PURE__ */ s("div", { className: "tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full" });
|
|
9
16
|
};
|
|
10
17
|
export {
|
|
11
|
-
|
|
18
|
+
d as SerializedText
|
|
12
19
|
};
|
|
13
20
|
//# sourceMappingURL=SerializedText.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SerializedText.es.js","sources":["../../../src/components/RichTextEditor/SerializedText.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useEffect, useState } from 'react';\nimport { serializeRawToHtmlAsync } from '@frontify/fondue';\nimport { SerializedTextProps } from './types';\n\nexport const SerializedText = ({ value = '', gap, columns, show = true, plugins }: SerializedTextProps) => {\n const [html, setHtml] = useState<string | null>(null);\n\n useEffect(() => {\n (async () => {\n setHtml(await serializeRawToHtmlAsync(value, plugins, columns, gap));\n })();\n }, [value, columns, gap, plugins]);\n\n if (!show || html === '<br />') {\n return null;\n }\n\n return html !== null ? (\n <div
|
|
1
|
+
{"version":3,"file":"SerializedText.es.js","sources":["../../../src/components/RichTextEditor/SerializedText.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useEffect, useState } from 'react';\nimport { serializeRawToHtmlAsync } from '@frontify/fondue';\nimport { SerializedTextProps } from './types';\n\nexport const SerializedText = ({ value = '', gap, columns, show = true, plugins }: SerializedTextProps) => {\n const [html, setHtml] = useState<string | null>(null);\n\n useEffect(() => {\n (async () => {\n setHtml(await serializeRawToHtmlAsync(value, plugins, columns, gap));\n })();\n }, [value, columns, gap, plugins]);\n\n if (!show || html === '<br />') {\n return null;\n }\n\n return html !== null ? (\n <div\n className=\"tw-w-full tw-whitespace-pre-wrap\"\n data-test-id=\"rte-content-html\"\n dangerouslySetInnerHTML={{ __html: html }}\n />\n ) : (\n <div className=\"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full\" />\n );\n};\n"],"names":["SerializedText","value","gap","columns","show","plugins","html","setHtml","useState","useEffect","serializeRawToHtmlAsync","jsx"],"mappings":";;;AAMa,MAAAA,IAAiB,CAAC,EAAE,OAAAC,IAAQ,IAAI,KAAAC,GAAK,SAAAC,GAAS,MAAAC,IAAO,IAAM,SAAAC,QAAmC;AACvG,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAwB,IAAI;AAQhD,SANJC,EAAU,MAAM;AACZ,KAAC,YACGF,EAAQ,MAAMG,EAAwBT,GAAOI,GAASF,GAASD,CAAG,CAAC;AAAA,KAExE,CAACD,GAAOE,GAASD,GAAKG,CAAO,CAAC,GAE7B,CAACD,KAAQE,MAAS,WACX,OAGJA,MAAS,OACZ,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,gBAAa;AAAA,MACb,yBAAyB,EAAE,QAAQL,EAAK;AAAA,IAAA;AAAA,EAG5C,IAAA,gBAAAK,EAAC,OAAI,EAAA,WAAU,oFAAoF,CAAA;AAE3G;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { PluginComposer as i, SoftBreakPlugin as t, TextStylePlugin as l, BoldPlugin as g, ItalicPlugin as u, UnderlinePlugin as o, StrikethroughPlugin as r, CodePlugin as P, AlignLeftPlugin as
|
|
2
|
-
import { TextStylePluginsWithoutImage as
|
|
3
|
-
import { LinkPlugin as
|
|
4
|
-
import { ButtonPlugin as
|
|
5
|
-
const v = (
|
|
1
|
+
import { PluginComposer as i, SoftBreakPlugin as t, TextStylePlugin as l, BoldPlugin as g, ItalicPlugin as u, UnderlinePlugin as o, StrikethroughPlugin as r, CodePlugin as P, AlignLeftPlugin as w, AlignCenterPlugin as s, AlignRightPlugin as m, AlignJustifyPlugin as a, UnorderedListPlugin as d, CheckboxListPlugin as f, OrderedListPlugin as y, ResetFormattingPlugin as h, AutoformatPlugin as p } from "@frontify/fondue";
|
|
2
|
+
import { TextStylePluginsWithoutImage as T, TextStylesWithoutImage as n } from "../plugins/TextStylePlugins/helpers.es.js";
|
|
3
|
+
import { LinkPlugin as x } from "../plugins/LinkPlugin/index.es.js";
|
|
4
|
+
import { ButtonPlugin as L } from "../plugins/ButtonPlugin/createButtonPlugin.es.js";
|
|
5
|
+
const v = (e) => new i().setPlugin(
|
|
6
6
|
new t(),
|
|
7
7
|
new l({
|
|
8
|
-
textStyles:
|
|
8
|
+
textStyles: T
|
|
9
9
|
})
|
|
10
10
|
).setPlugin(
|
|
11
11
|
[
|
|
@@ -13,19 +13,20 @@ const v = (n) => new i().setPlugin(
|
|
|
13
13
|
new u(),
|
|
14
14
|
new o(),
|
|
15
15
|
new r(),
|
|
16
|
-
new
|
|
17
|
-
new
|
|
16
|
+
new x({ appBridge: e }),
|
|
17
|
+
new L({ appBridge: e }),
|
|
18
18
|
new P()
|
|
19
19
|
],
|
|
20
20
|
[
|
|
21
|
-
new
|
|
22
|
-
new
|
|
23
|
-
new m({ validTypes:
|
|
24
|
-
new
|
|
25
|
-
new
|
|
26
|
-
new y(),
|
|
21
|
+
new w({ validTypes: n }),
|
|
22
|
+
new s({ validTypes: n }),
|
|
23
|
+
new m({ validTypes: n }),
|
|
24
|
+
new a({ validTypes: n }),
|
|
25
|
+
new d(),
|
|
27
26
|
new f(),
|
|
28
|
-
new
|
|
27
|
+
new y(),
|
|
28
|
+
new h(),
|
|
29
|
+
new p()
|
|
29
30
|
]
|
|
30
31
|
);
|
|
31
32
|
export {
|