@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.
Files changed (32) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/components/Link/LinkSelector/DocumentLink.es.js +20 -22
  3. package/dist/components/Link/LinkSelector/DocumentLink.es.js.map +1 -1
  4. package/dist/components/Link/LinkSelector/DocumentLinks.es.js +19 -19
  5. package/dist/components/Link/LinkSelector/DocumentLinks.es.js.map +1 -1
  6. package/dist/components/Link/LinkSelector/LoadingIndicator.es.js +7 -0
  7. package/dist/components/Link/LinkSelector/LoadingIndicator.es.js.map +1 -0
  8. package/dist/components/Link/LinkSelector/PageLink.es.js +25 -28
  9. package/dist/components/Link/LinkSelector/PageLink.es.js.map +1 -1
  10. package/dist/components/Link/LinkSelector/PageLinks.es.js +19 -19
  11. package/dist/components/Link/LinkSelector/PageLinks.es.js.map +1 -1
  12. package/dist/components/Link/LinkSelector/SectionLink.es.js +11 -12
  13. package/dist/components/Link/LinkSelector/SectionLink.es.js.map +1 -1
  14. package/dist/components/RichTextEditor/SerializedText.es.js +14 -7
  15. package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -1
  16. package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js +16 -15
  17. package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -1
  18. package/dist/index.cjs.js +3 -3
  19. package/dist/index.cjs.js.map +1 -1
  20. package/dist/index.umd.js +3 -3
  21. package/dist/index.umd.js.map +1 -1
  22. package/dist/styles.css +1 -1
  23. package/package.json +4 -4
  24. package/src/components/Link/LinkSelector/DocumentLink.tsx +4 -6
  25. package/src/components/Link/LinkSelector/DocumentLinks.tsx +2 -4
  26. package/src/components/Link/LinkSelector/LinkSelector.spec.ct.tsx +3 -0
  27. package/src/components/Link/LinkSelector/LoadingIndicator.tsx +11 -0
  28. package/src/components/Link/LinkSelector/PageLink.tsx +4 -7
  29. package/src/components/Link/LinkSelector/PageLinks.tsx +3 -7
  30. package/src/components/Link/LinkSelector/SectionLink.tsx +0 -1
  31. package/src/components/RichTextEditor/SerializedText.tsx +5 -1
  32. 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 i, Fragment as l, jsx as e } from "react/jsx-runtime";
2
- import { useState as x, useEffect as b } from "react";
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 a, IconColorFan16 as h } from "@frontify/fondue";
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: w,
9
- onSelectUrl: n,
8
+ selectedUrl: n,
9
+ onSelectUrl: s,
10
10
  itemsToExpandInitially: r
11
11
  }) => {
12
- const [o, s] = x(t.id === r.documentId), d = t.permanentLink === w;
13
- return b(() => {
14
- t.id === r.documentId && s(!0);
15
- }, [r, t.id]), /* @__PURE__ */ i(l, { children: [
16
- /* @__PURE__ */ i(
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: a([
21
- "tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-px-2.5 tw-leading-5 tw-cursor-pointer tw-w-full",
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: () => n(t.permanentLink),
25
- onFocus: () => n(t.permanentLink),
24
+ onClick: () => s(t.permanentLink),
26
25
  children: [
27
26
  /* @__PURE__ */ e(
28
- "div",
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-p-1.5 tw-cursor-pointer",
34
- onClick: () => s(!o),
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: a([
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(h, {}),
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: w,
59
- onSelectUrl: n,
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-px-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 onFocus={() => onSelectUrl(document.permanentLink)}\n >\n <div\n role=\"button\"\n tabIndex={0}\n data-test-id=\"tree-item-toggle\"\n className=\"tw-flex tw-items-center tw-justify-center tw-p-1.5 tw-cursor-pointer\"\n onClick={() => setIsExpanded(!isExpanded)}\n onFocus={() => 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 </div>\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,QACjD,SAAS,MAAMG,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,cACxC,SAAS,MAAMC,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
+ {"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 x } from "./DocumentLink.es.js";
5
- const C = ({ appBridge: e, selectedUrl: n, onSelectUrl: m }) => {
6
- const [u, l] = r(!0), [f, I] = r([]), [g, p] = r({
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
- n && o.length > 0 && y().then((t) => {
12
- p(t);
11
+ e && o.length > 0 && p().then((t) => {
12
+ D(t);
13
13
  });
14
14
  }, [o.length]), d(() => {
15
- e.getAllDocuments().then((t) => {
15
+ n.getAllDocuments().then((t) => {
16
16
  I(t);
17
17
  }).finally(() => {
18
18
  l(!1);
19
19
  });
20
20
  }, []);
21
- const y = async () => {
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 === n))
26
+ if (o.find((s) => s.permanentLink === e))
27
27
  return t;
28
28
  for (const s of o) {
29
- const D = await e.getDocumentPagesByDocumentId(s.id);
30
- e.getAllDocuments();
31
- const a = [...D.values()];
32
- if (!!a.find((c) => c.permanentLink === n))
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 e.getDocumentSectionsByDocumentPageId(c.id)).values()].find((L) => L.permanentLink === n))
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("div", { className: "tw-flex tw-justify-center tw-p-4", children: /* @__PURE__ */ i(h, {}) }) : /* @__PURE__ */ i(v, { children: o.map((t) => /* @__PURE__ */ i(
41
- x,
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: e,
45
- selectedUrl: n,
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
- C as DocumentLinks
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 { LoadingCircle } from '@frontify/fondue';\nimport { ReactElement, useEffect, useState } from 'react';\nimport { DocumentLink } from './DocumentLink';\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 <div className=\"tw-flex tw-justify-center tw-p-4\">\n <LoadingCircle />\n </div>\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","jsx","LoadingCircle","Fragment","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;AAGX,SAAOZ,IACH,gBAAAkB,EAAC,OAAI,EAAA,WAAU,oCACX,UAAA,gBAAAA,EAACC,GAAc,CAAA,CAAA,GACnB,IAEA,gBAAAD,EAAAE,GAAA,EACK,UAAcb,EAAA,IAAI,CAACM,MAEZ,gBAAAK;AAAA,IAACG;AAAA,IAAA;AAAA,MAEG,UAAAR;AAAA,MACA,WAAAhB;AAAA,MACA,aAAAC;AAAA,MACA,aAAAC;AAAA,MACA,wBAAAM;AAAA,IAAA;AAAA,IALKQ,EAAS;AAAA,EAAA,CAQzB,EACL,CAAA;AAER;"}
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 d, Fragment as b, jsx as e } from "react/jsx-runtime";
2
- import { useDocumentSection as u } from "@frontify/app-bridge";
3
- import { merge as l } from "@frontify/fondue";
4
- import { useState as v, useEffect as f } from "react";
5
- import { SectionLink as p } from "./SectionLink.es.js";
6
- const F = ({ page: t, selectedUrl: c, onSelectUrl: n, itemsToExpandInitially: o, appBridge: m }) => {
7
- const [r, s] = v(t.id === o.documentId), x = t.permanentLink === c, { documentSections: h } = u(m, t.id), i = [...h.values()], w = i.length > 0;
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 === o.pageId && s(!0);
10
- }, [o, t.id]), /* @__PURE__ */ d(b, { children: [
9
+ t.id === r.pageId && w(!0);
10
+ }, [r, t.id]), /* @__PURE__ */ l(b, { children: [
11
11
  /* @__PURE__ */ e(
12
- "div",
12
+ "button",
13
13
  {
14
- tabIndex: 0,
15
14
  "data-test-id": "internal-link-selector-page-link",
16
- className: l([
17
- "tw-py-2 tw-px-2.5 tw-leading-5 tw-cursor-pointer",
18
- w ? "tw-pl-7" : "tw-pl-12",
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: () => n(t.permanentLink),
22
- onFocus: () => n(t.permanentLink),
23
- children: /* @__PURE__ */ d("div", { className: "tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6", children: [
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-p-1.5 tw-cursor-pointer",
29
- onClick: () => s(!r),
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: l([
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
- r ? "tw-rotate-90" : ""
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
- r && i.length > 0 && i.map((a) => /* @__PURE__ */ e(
48
- p,
44
+ n && o.length > 0 && o.map((a) => /* @__PURE__ */ e(
45
+ v,
49
46
  {
50
47
  section: a,
51
- selectedUrl: c,
52
- onSelectUrl: n
48
+ selectedUrl: s,
49
+ onSelectUrl: i
53
50
  },
54
51
  a.id
55
52
  ))
56
53
  ] });
57
54
  };
58
55
  export {
59
- F as PageLink
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 <div\n tabIndex={0}\n data-test-id=\"internal-link-selector-page-link\"\n className={merge([\n 'tw-py-2 tw-px-2.5 tw-leading-5 tw-cursor-pointer',\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 onFocus={() => 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-p-1.5 tw-cursor-pointer\"\n onClick={() => setIsExpanded(!isExpanded)}\n onFocus={() => 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 </div>\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,UAAU;AAAA,QACV,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,QAC7C,SAAS,MAAME,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,cACxC,SAAS,MAAMC,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,GAjBnEhB,EAAK,EAkBf;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
+ {"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 o, Fragment as h } from "react/jsx-runtime";
2
- import { LoadingCircle as x } from "@frontify/fondue";
3
- import { useState as i, useEffect as L } from "react";
4
- import { PageLink as P } from "./PageLink.es.js";
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: r,
6
+ appBridge: s,
7
7
  documentId: c,
8
8
  selectedUrl: g,
9
- onSelectUrl: l,
10
- itemsToExpandInitially: m
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 L(() => {
14
- r.getDocumentPagesByDocumentId(c).then((e) => {
15
- const p = e.filter((t) => !!t.category).sort(
16
- (t, s) => t.category.sort === s.category.sort ? t.sort - s.sort : t.category.sort - s.category.sort
17
- ), w = e.filter((t) => !t.category).sort((t, s) => t.sort - s.sort);
18
- d([...p, ...w]);
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__ */ o("div", { className: "tw-flex tw-justify-center tw-p-4", children: /* @__PURE__ */ o(x, {}) }) : y ? /* @__PURE__ */ o(h, { children: n.map((e) => /* @__PURE__ */ o(
23
- P,
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: r,
26
+ appBridge: s,
27
27
  selectedUrl: g,
28
- onSelectUrl: l,
29
- itemsToExpandInitially: m
28
+ onSelectUrl: m,
29
+ itemsToExpandInitially: l
30
30
  },
31
31
  e.id
32
- )) }) : /* @__PURE__ */ o("div", { className: "tw-py-2 tw-px-2.5 tw-pl-7 tw-leading-5 tw-text-s tw-text-text-weak", children: "This document does not contain any pages." });
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 { LoadingCircle } from '@frontify/fondue';\nimport { ReactElement, useEffect, useState } from 'react';\nimport { InitiallyExpandedItems } from '../';\nimport { PageLink } from './PageLink';\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 (\n <div className=\"tw-flex tw-justify-center tw-p-4\">\n <LoadingCircle />\n </div>\n );\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-py-2 tw-px-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","jsx","LoadingCircle","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,sBAEK,OAAI,EAAA,WAAU,oCACX,UAAA,gBAAAW,EAACC,KAAc,EACnB,CAAA,IAIDT,IACH,gBAAAQ,EAAAE,GAAA,EACK,UAAWX,EAAA,IAAI,CAACK,MAET,gBAAAI;AAAA,IAACG;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,sEAAqE,UAEpF,4CAAA,CAAA;AAER;"}
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 e, jsxs as s } from "react/jsx-runtime";
2
- import { merge as i, IconDocumentText16 as l } from "@frontify/fondue";
3
- const c = ({ section: t, selectedUrl: r, onSelectUrl: n }) => {
4
- const o = t.permanentLink === r;
5
- return /* @__PURE__ */ e(
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: i([
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(t.permanentLink),
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__ */ e(l, {}),
17
- /* @__PURE__ */ e("span", { className: "tw-text-s", children: t.title }),
18
- /* @__PURE__ */ e("span", { className: "tw-flex-auto tw-font-sans tw-text-xs tw-text-right", children: "Section" })
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
- c as SectionLink
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 onFocus={() => 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,MAChD,SAAS,MAAME,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
+ {"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 o } from "react";
3
- import { serializeRawToHtmlAsync as u } from "@frontify/fondue";
4
- const c = ({ value: e = "", gap: l, columns: r, show: m = !0, plugins: a }) => {
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 o(() => {
7
- (async () => n(await u(e, a, r, l)))();
8
- }, [e, r, l, a]), !m || t === "<br />" ? null : t !== null ? /* @__PURE__ */ s("div", { className: "tw-w-full", "data-test-id": "rte-content-html", dangerouslySetInnerHTML: { __html: t } }) : /* @__PURE__ */ s("div", { className: "tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full" });
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
- c as SerializedText
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 className=\"tw-w-full\" data-test-id=\"rte-content-html\" dangerouslySetInnerHTML={{ __html: html }} />\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,EAAC,OAAI,EAAA,WAAU,aAAY,gBAAa,oBAAmB,yBAAyB,EAAE,QAAQL,EAAK,EAAA,CAAG,IAErG,gBAAAK,EAAA,OAAA,EAAI,WAAU,oFAAoF,CAAA;AAE3G;"}
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 s, AlignCenterPlugin as w, AlignRightPlugin as m, AlignJustifyPlugin as d, UnorderedListPlugin as a, CheckboxListPlugin as y, OrderedListPlugin as f, ResetFormattingPlugin as h } from "@frontify/fondue";
2
- import { TextStylePluginsWithoutImage as p, TextStylesWithoutImage as e } from "../plugins/TextStylePlugins/helpers.es.js";
3
- import { LinkPlugin as T } from "../plugins/LinkPlugin/index.es.js";
4
- import { ButtonPlugin as x } from "../plugins/ButtonPlugin/createButtonPlugin.es.js";
5
- const v = (n) => new i().setPlugin(
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: p
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 T({ appBridge: n }),
17
- new x({ appBridge: n }),
16
+ new x({ appBridge: e }),
17
+ new L({ appBridge: e }),
18
18
  new P()
19
19
  ],
20
20
  [
21
- new s({ validTypes: e }),
22
- new w({ validTypes: e }),
23
- new m({ validTypes: e }),
24
- new d({ validTypes: e }),
25
- new a(),
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 h()
27
+ new y(),
28
+ new h(),
29
+ new p()
29
30
  ]
30
31
  );
31
32
  export {