@frontify/guideline-blocks-settings 0.28.2 → 0.28.4

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 (129) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/components/Attachments/AttachmentItem.es.js +67 -67
  3. package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
  4. package/dist/components/Attachments/Attachments.es.js +80 -80
  5. package/dist/components/Attachments/Attachments.es.js.map +1 -1
  6. package/dist/components/BlockInjectButton/BlockInjectButton.es.js +67 -67
  7. package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -1
  8. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +28 -28
  9. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
  10. package/dist/components/BlockItemWrapper/Toolbar.es.js +33 -33
  11. package/dist/components/BlockItemWrapper/Toolbar.es.js.map +1 -1
  12. package/dist/components/DownloadButton/DownloadButton.es.js +12 -12
  13. package/dist/components/DownloadButton/DownloadButton.es.js.map +1 -1
  14. package/dist/components/RichTextEditor/RichTextEditor.es.js +12 -12
  15. package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
  16. package/dist/components/RichTextEditor/SerializedText.es.js +4 -4
  17. package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -1
  18. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +9 -9
  19. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -1
  20. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +8 -8
  21. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -1
  22. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +6 -6
  23. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -1
  24. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +10 -10
  25. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js.map +1 -1
  26. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js +13 -13
  27. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -1
  28. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +18 -18
  29. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js.map +1 -1
  30. package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -1
  31. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +11 -11
  32. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -1
  33. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js +15 -15
  34. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -1
  35. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js +3 -3
  36. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js.map +1 -1
  37. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +40 -40
  38. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -1
  39. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +10 -10
  40. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -1
  41. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +4 -4
  42. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -1
  43. package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -1
  44. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +14 -14
  45. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -1
  46. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +14 -14
  47. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -1
  48. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +14 -14
  49. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -1
  50. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +20 -20
  51. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -1
  52. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +17 -17
  53. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -1
  54. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +17 -17
  55. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -1
  56. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +17 -17
  57. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -1
  58. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +18 -18
  59. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -1
  60. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +16 -16
  61. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -1
  62. package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +19 -19
  63. package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -1
  64. package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +15 -15
  65. package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -1
  66. package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.es.js +32 -32
  67. package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.es.js.map +1 -1
  68. package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.es.js +15 -15
  69. package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.es.js.map +1 -1
  70. package/dist/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.es.js +30 -30
  71. package/dist/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.es.js.map +1 -1
  72. package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.es.js +27 -27
  73. package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.es.js.map +1 -1
  74. package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.es.js +12 -12
  75. package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.es.js.map +1 -1
  76. package/dist/components/RichTextEditor/plugins/shared/LinkSelector/SectionLink.es.js +14 -14
  77. package/dist/components/RichTextEditor/plugins/shared/LinkSelector/SectionLink.es.js.map +1 -1
  78. package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -1
  79. package/dist/components/RichTextEditor/serializer/nodes/button.es.js +3 -2
  80. package/dist/components/RichTextEditor/serializer/nodes/button.es.js.map +1 -1
  81. package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js +7 -7
  82. package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js.map +1 -1
  83. package/dist/components/RichTextEditor/serializer/nodes/default.es.js +27 -12
  84. package/dist/components/RichTextEditor/serializer/nodes/default.es.js.map +1 -1
  85. package/dist/components/RichTextEditor/serializer/nodes/link.es.js +7 -7
  86. package/dist/components/RichTextEditor/serializer/nodes/link.es.js.map +1 -1
  87. package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js +33 -33
  88. package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js.map +1 -1
  89. package/dist/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.es.js.map +1 -1
  90. package/dist/index.cjs.js +12 -37
  91. package/dist/index.cjs.js.map +1 -1
  92. package/dist/index.umd.js +12 -37
  93. package/dist/index.umd.js.map +1 -1
  94. package/dist/utilities/react/getBackgroundColorStyles.es.js.map +1 -1
  95. package/dist/utilities/react/getBorderStyles.es.js.map +1 -1
  96. package/dist/utilities/react/getRadiusStyles.es.js.map +1 -1
  97. package/package.json +12 -11
  98. package/src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts +1 -1
  99. package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.tsx +2 -2
  100. package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.tsx +1 -1
  101. package/src/components/RichTextEditor/plugins/LinkPlugin/index.ts +2 -1
  102. package/src/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.tsx +1 -1
  103. package/src/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.tsx +1 -1
  104. package/src/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.tsx +1 -1
  105. package/src/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.tsx +1 -1
  106. package/src/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.tsx +1 -1
  107. package/src/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.tsx +1 -1
  108. package/src/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.tsx +1 -1
  109. package/src/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.tsx +1 -1
  110. package/src/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.tsx +1 -1
  111. package/src/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.tsx +1 -1
  112. package/src/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.tsx +1 -1
  113. package/src/components/RichTextEditor/plugins/styles.ts +1 -1
  114. package/src/components/RichTextEditor/serializer/nodes/button.ts +3 -1
  115. package/src/components/RichTextEditor/serializer/nodes/checkItemNode.ts +5 -4
  116. package/src/components/RichTextEditor/serializer/nodes/default.ts +30 -14
  117. package/src/components/RichTextEditor/serializer/nodes/link.ts +5 -4
  118. package/src/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.ts +5 -5
  119. package/src/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.ts +1 -1
  120. package/src/utilities/react/getBackgroundColorStyles.ts +2 -3
  121. package/src/utilities/react/getBorderStyles.ts +2 -3
  122. package/src/utilities/react/getRadiusStyles.ts +1 -1
  123. package/vite.config.ts +4 -2
  124. package/dist/_virtual/jsx-runtime.es.js +0 -5
  125. package/dist/_virtual/jsx-runtime.es.js.map +0 -1
  126. package/dist/_virtual/react-jsx-runtime.development.es.js +0 -5
  127. package/dist/_virtual/react-jsx-runtime.development.es.js.map +0 -1
  128. package/dist/_virtual/react-jsx-runtime.production.min.es.js +0 -5
  129. package/dist/_virtual/react-jsx-runtime.production.min.es.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @frontify/guideline-blocks-settings
2
2
 
3
+ ## 0.28.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#503](https://github.com/Frontify/brand-sdk/pull/503) [`c56e7e9`](https://github.com/Frontify/brand-sdk/commit/c56e7e9112e04ae0e9ae35e4b7a98c11665045f2) Thanks [@fulopdaniel](https://github.com/fulopdaniel)! - feat(RTE): add dir to serializer
8
+
9
+ - [`22684e3`](https://github.com/Frontify/brand-sdk/commit/22684e358fd2b073790a0959606c6a5d44e35c4e) Thanks [@SamuelAlev](https://github.com/SamuelAlev)! - Update dependencies
10
+
11
+ - Updated dependencies [[`22684e3`](https://github.com/Frontify/brand-sdk/commit/22684e358fd2b073790a0959606c6a5d44e35c4e)]:
12
+ - @frontify/sidebar-settings@0.6.2
13
+
14
+ ## 0.28.3
15
+
16
+ ### Patch Changes
17
+
18
+ - [`07624cb`](https://github.com/Frontify/brand-sdk/commit/07624cb8fba8d9ede4e5ea5db43780658f69f0ba) Thanks [@SamuelAlev](https://github.com/SamuelAlev)! - Fix react being bundled into the package
19
+
3
20
  ## 0.28.2
4
21
 
5
22
  ### Patch Changes
@@ -1,11 +1,11 @@
1
- import { j as t } from "../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
2
- import { forwardRef as E, useState as U, useEffect as v } from "react";
3
- import { useFileInput as L, useAssetUpload as M } from "@frontify/app-bridge";
4
- import { useSortable as P } from "@dnd-kit/sortable";
5
- import { useFocusRing as V } from "@react-aria/focus";
6
- import { LoadingCircle as B, LoadingCircleSize as O, FOCUS_STYLE as $, IconGrabHandle20 as T, Flyout as X, FlyoutPlacement as G, Button as H, IconPen20 as _, ButtonEmphasis as Y, ActionMenu as q, MenuItemContentSize as f, IconArrowCircleUp20 as J, IconImageStack20 as K, MenuItemStyle as Q, IconTrashBin20 as W, IconImage24 as Z, IconPlayFrame24 as tt, IconMusicNote24 as et, IconDocument24 as ot } from "@frontify/fondue";
7
- import { joinClassNames as h } from "../../utilities/react/joinClassNames.es.js";
8
- const at = (e) => e === "IMAGE" ? /* @__PURE__ */ t.jsx(Z, {}) : e === "VIDEO" ? /* @__PURE__ */ t.jsx(tt, {}) : e === "AUDIO" ? /* @__PURE__ */ t.jsx(et, {}) : /* @__PURE__ */ t.jsx(ot, {}), I = E(
1
+ import { jsxs as h, jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as E, useState as L, useEffect as y } from "react";
3
+ import { useFileInput as M, useAssetUpload as P } from "@frontify/app-bridge";
4
+ import { useSortable as V } from "@dnd-kit/sortable";
5
+ import { useFocusRing as B } from "@react-aria/focus";
6
+ import { LoadingCircle as O, LoadingCircleSize as $, FOCUS_STYLE as T, IconGrabHandle20 as X, Flyout as G, FlyoutPlacement as H, Button as _, IconPen20 as Y, ButtonEmphasis as q, ActionMenu as J, MenuItemContentSize as g, IconArrowCircleUp20 as K, IconImageStack20 as Q, MenuItemStyle as W, IconTrashBin20 as Z, IconImage24 as tt, IconPlayFrame24 as et, IconMusicNote24 as ot, IconDocument24 as at } from "@frontify/fondue";
7
+ import { joinClassNames as v } from "../../utilities/react/joinClassNames.es.js";
8
+ const rt = (e) => e === "IMAGE" ? /* @__PURE__ */ t(tt, {}) : e === "VIDEO" ? /* @__PURE__ */ t(et, {}) : e === "AUDIO" ? /* @__PURE__ */ t(ot, {}) : /* @__PURE__ */ t(at, {}), k = E(
9
9
  ({
10
10
  item: e,
11
11
  isEditing: c,
@@ -13,90 +13,90 @@ const at = (e) => e === "IMAGE" ? /* @__PURE__ */ t.jsx(Z, {}) : e === "VIDEO" ?
13
13
  transformStyle: u,
14
14
  isDragging: o,
15
15
  isOverlay: r,
16
- isLoading: s,
16
+ isLoading: i,
17
17
  onDelete: w,
18
18
  onReplaceWithBrowse: m,
19
- onReplaceWithUpload: y
20
- }, k) => {
21
- const [a, n] = U(), [S, { selectedFiles: i }] = L({ multiple: !0, accept: "image/*" }), [N, { results: g, doneAll: x }] = M(), { focusProps: C, isFocusVisible: j } = V();
22
- v(() => {
23
- i && N(i[0]);
24
- }, [i]), v(() => {
25
- x && y(g[0]);
26
- }, [x, g]);
27
- const F = (l, p) => {
28
- fetch(l).then((z) => {
29
- z.blob().then((D) => {
30
- const A = URL.createObjectURL(D), b = document.createElement("a");
31
- b.href = A, b.download = p, b.click();
19
+ onReplaceWithUpload: S
20
+ }, N) => {
21
+ const [a, n] = L(), [C, { selectedFiles: l }] = M({ multiple: !0, accept: "image/*" }), [F, { results: x, doneAll: p }] = P(), { focusProps: R, isFocusVisible: I } = B();
22
+ y(() => {
23
+ l && F(l[0]);
24
+ }, [l]), y(() => {
25
+ p && S(x[0]);
26
+ }, [p, x]);
27
+ const z = (s, b) => {
28
+ fetch(s).then((A) => {
29
+ A.blob().then((U) => {
30
+ const j = URL.createObjectURL(U), f = document.createElement("a");
31
+ f.href = j, f.download = b, f.click();
32
32
  });
33
33
  });
34
- }, R = s || i && !x;
35
- return /* @__PURE__ */ t.jsxs(
34
+ }, D = i || l && !p;
35
+ return /* @__PURE__ */ h(
36
36
  "button",
37
37
  {
38
38
  "aria-label": "Download attachment",
39
39
  "data-test-id": "attachments-item",
40
- onClick: () => F(e.genericUrl, e.fileName),
41
- ref: k,
40
+ onClick: () => z(e.genericUrl, e.fileName),
41
+ ref: N,
42
42
  style: {
43
43
  ...u,
44
44
  opacity: o && !r ? 0.3 : 1,
45
45
  fontFamily: "var(-f-theme-settings-body-font-family)"
46
46
  },
47
- className: h([
47
+ className: v([
48
48
  "tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-box-neutral-hover",
49
49
  o ? "tw-bg-box-neutral-hover" : ""
50
50
  ]),
51
51
  children: [
52
- /* @__PURE__ */ t.jsx("div", { className: "tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover", children: R ? /* @__PURE__ */ t.jsx(B, { size: O.Small }) : at(e.objectType) }),
53
- /* @__PURE__ */ t.jsxs("div", { className: "tw-text-s tw-flex-1 tw-min-w-0", children: [
54
- /* @__PURE__ */ t.jsx("div", { className: "tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover", children: e.title }),
55
- /* @__PURE__ */ t.jsx("div", { className: "tw-text-text-weak", children: `${e.fileSizeHumanReadable} - ${e.extension}` })
52
+ /* @__PURE__ */ t("div", { className: "tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover", children: D ? /* @__PURE__ */ t(O, { size: $.Small }) : rt(e.objectType) }),
53
+ /* @__PURE__ */ h("div", { className: "tw-text-s tw-flex-1 tw-min-w-0", children: [
54
+ /* @__PURE__ */ t("div", { className: "tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover", children: e.title }),
55
+ /* @__PURE__ */ t("div", { className: "tw-text-text-weak", children: `${e.fileSizeHumanReadable} - ${e.extension}` })
56
56
  ] }),
57
- c && /* @__PURE__ */ t.jsxs(
57
+ c && /* @__PURE__ */ h(
58
58
  "div",
59
59
  {
60
60
  "data-test-id": "attachments-actionbar",
61
- className: h([
61
+ className: v([
62
62
  "tw-flex tw-gap-0.5 group-focus:tw-opacity-100 focus-visible:tw-opacity-100 focus-within:tw-opacity-100 group-hover:tw-opacity-100",
63
63
  r || (a == null ? void 0 : a.id) === e.id ? "tw-opacity-100" : "tw-opacity-0"
64
64
  ]),
65
65
  children: [
66
- /* @__PURE__ */ t.jsx(
66
+ /* @__PURE__ */ t(
67
67
  "button",
68
68
  {
69
- ...C,
69
+ ...R,
70
70
  ...d,
71
71
  "aria-label": "Drag attachment",
72
- className: h([
72
+ className: v([
73
73
  " tw-border-button-border tw-bg-button-background active:tw-bg-button-background-pressed tw-group tw-border tw-box-box tw-relative tw-flex tw-items-center tw-justify-center tw-outline-none tw-font-medium tw-rounded tw-h-9 tw-w-9 ",
74
74
  o || r ? "tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed" : "tw-cursor-grab hover:tw-bg-button-background-hover",
75
- j && $,
76
- j && "tw-z-[2]"
75
+ I && T,
76
+ I && "tw-z-[2]"
77
77
  ]),
78
- children: /* @__PURE__ */ t.jsx(T, {})
78
+ children: /* @__PURE__ */ t(X, {})
79
79
  }
80
80
  ),
81
- /* @__PURE__ */ t.jsx("div", { "data-test-id": "attachments-actionbar-flyout", children: /* @__PURE__ */ t.jsx(
82
- X,
81
+ /* @__PURE__ */ t("div", { "data-test-id": "attachments-actionbar-flyout", children: /* @__PURE__ */ t(
82
+ G,
83
83
  {
84
- placement: G.Right,
84
+ placement: H.Right,
85
85
  isOpen: (a == null ? void 0 : a.id) === e.id,
86
86
  fitContent: !0,
87
87
  legacyFooter: !1,
88
- onOpenChange: (l) => n(l ? e : void 0),
89
- trigger: (l, p) => /* @__PURE__ */ t.jsx(
90
- H,
88
+ onOpenChange: (s) => n(s ? e : void 0),
89
+ trigger: (s, b) => /* @__PURE__ */ t(
90
+ _,
91
91
  {
92
- ref: p,
93
- icon: /* @__PURE__ */ t.jsx(_, {}),
94
- emphasis: Y.Default,
92
+ ref: b,
93
+ icon: /* @__PURE__ */ t(Y, {}),
94
+ emphasis: q.Default,
95
95
  onClick: () => n(e)
96
96
  }
97
97
  ),
98
- children: /* @__PURE__ */ t.jsx(
99
- q,
98
+ children: /* @__PURE__ */ t(
99
+ J,
100
100
  {
101
101
  menuBlocks: [
102
102
  {
@@ -104,23 +104,23 @@ const at = (e) => e === "IMAGE" ? /* @__PURE__ */ t.jsx(Z, {}) : e === "VIDEO" ?
104
104
  menuItems: [
105
105
  {
106
106
  id: "upload",
107
- size: f.XSmall,
107
+ size: g.XSmall,
108
108
  title: "Replace with upload",
109
109
  onClick: () => {
110
- S(), n(void 0);
110
+ C(), n(void 0);
111
111
  },
112
112
  initialValue: !0,
113
- decorator: /* @__PURE__ */ t.jsx("div", { className: "tw-mr-2", children: /* @__PURE__ */ t.jsx(J, {}) })
113
+ decorator: /* @__PURE__ */ t("div", { className: "tw-mr-2", children: /* @__PURE__ */ t(K, {}) })
114
114
  },
115
115
  {
116
116
  id: "asset",
117
- size: f.XSmall,
117
+ size: g.XSmall,
118
118
  title: "Replace with asset",
119
119
  onClick: () => {
120
120
  m(), n(void 0);
121
121
  },
122
122
  initialValue: !0,
123
- decorator: /* @__PURE__ */ t.jsx("div", { className: "tw-mr-2", children: /* @__PURE__ */ t.jsx(K, {}) })
123
+ decorator: /* @__PURE__ */ t("div", { className: "tw-mr-2", children: /* @__PURE__ */ t(Q, {}) })
124
124
  }
125
125
  ]
126
126
  },
@@ -129,14 +129,14 @@ const at = (e) => e === "IMAGE" ? /* @__PURE__ */ t.jsx(Z, {}) : e === "VIDEO" ?
129
129
  menuItems: [
130
130
  {
131
131
  id: "delete",
132
- size: f.XSmall,
132
+ size: g.XSmall,
133
133
  title: "Delete",
134
- style: Q.Danger,
134
+ style: W.Danger,
135
135
  onClick: () => {
136
136
  w(), n(void 0);
137
137
  },
138
138
  initialValue: !0,
139
- decorator: /* @__PURE__ */ t.jsx("div", { className: "tw-mr-2", children: /* @__PURE__ */ t.jsx(W, {}) })
139
+ decorator: /* @__PURE__ */ t("div", { className: "tw-mr-2", children: /* @__PURE__ */ t(Z, {}) })
140
140
  }
141
141
  ]
142
142
  }
@@ -153,20 +153,20 @@ const at = (e) => e === "IMAGE" ? /* @__PURE__ */ t.jsx(Z, {}) : e === "VIDEO" ?
153
153
  );
154
154
  }
155
155
  );
156
- I.displayName = "AttachmentItem";
157
- const ut = (e) => {
158
- const { attributes: c, listeners: d, setNodeRef: u, transform: o, transition: r, isDragging: s } = P({
156
+ k.displayName = "AttachmentItem";
157
+ const wt = (e) => {
158
+ const { attributes: c, listeners: d, setNodeRef: u, transform: o, transition: r, isDragging: i } = V({
159
159
  id: e.item.id
160
160
  }), w = {
161
161
  transform: o ? `translate(${o.x}px, ${o.y}px)` : "",
162
162
  transition: r,
163
- zIndex: s ? 2 : 1
163
+ zIndex: i ? 2 : 1
164
164
  }, m = { ...c, ...d };
165
- return /* @__PURE__ */ t.jsx(
166
- I,
165
+ return /* @__PURE__ */ t(
166
+ k,
167
167
  {
168
168
  ref: u,
169
- isDragging: s,
169
+ isDragging: i,
170
170
  transformStyle: w,
171
171
  draggableProps: m,
172
172
  ...e
@@ -174,7 +174,7 @@ const ut = (e) => {
174
174
  );
175
175
  };
176
176
  export {
177
- I as AttachmentItem,
178
- ut as SortableAttachmentItem
177
+ k as AttachmentItem,
178
+ wt as SortableAttachmentItem
179
179
  };
180
180
  //# sourceMappingURL=AttachmentItem.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentItem.es.js","sources":["../../../src/components/Attachments/AttachmentItem.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { MutableRefObject, forwardRef, useEffect, useState } from 'react';\nimport { Asset, useAssetUpload, useFileInput } from '@frontify/app-bridge';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { useFocusRing } from '@react-aria/focus';\n\nimport {\n ActionMenu,\n Button,\n ButtonEmphasis,\n FOCUS_STYLE,\n Flyout,\n FlyoutPlacement,\n IconArrowCircleUp20,\n IconDocument24,\n IconGrabHandle20,\n IconImage24,\n IconImageStack20,\n IconMusicNote24,\n IconPen20,\n IconPlayFrame24,\n IconTrashBin20,\n LoadingCircle,\n LoadingCircleSize,\n MenuItemContentSize,\n MenuItemStyle,\n} from '@frontify/fondue';\nimport { AttachmentItemProps, SortableAttachmentItemProps } from './types';\nimport { joinClassNames } from '../../utilities';\n\nconst getDecorator = (type: string) => {\n if (type === 'IMAGE') {\n return <IconImage24 />;\n } else if (type === 'VIDEO') {\n return <IconPlayFrame24 />;\n } else if (type === 'AUDIO') {\n return <IconMusicNote24 />;\n } else {\n return <IconDocument24 />;\n }\n};\n\nexport const AttachmentItem = forwardRef<HTMLButtonElement, AttachmentItemProps>(\n (\n {\n item,\n isEditing,\n draggableProps,\n transformStyle,\n isDragging,\n isOverlay,\n isLoading,\n onDelete,\n onReplaceWithBrowse,\n onReplaceWithUpload,\n },\n ref,\n ) => {\n const [selectedAsset, setSelectedAsset] = useState<Asset | undefined>();\n const [openFileDialog, { selectedFiles }] = useFileInput({ multiple: true, accept: 'image/*' });\n const [uploadFile, { results: uploadResults, doneAll }] = useAssetUpload();\n const { focusProps, isFocusVisible } = useFocusRing();\n\n useEffect(() => {\n if (selectedFiles) {\n uploadFile(selectedFiles[0]);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedFiles]);\n\n useEffect(() => {\n if (doneAll) {\n onReplaceWithUpload(uploadResults[0]);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [doneAll, uploadResults]);\n\n const download = (url: string, filename: string) => {\n fetch(url).then((response) => {\n response.blob().then((blob) => {\n const url = URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = filename;\n a.click();\n });\n });\n };\n\n const showLoadingCircle = isLoading || (selectedFiles && !doneAll);\n\n return (\n <button\n aria-label=\"Download attachment\"\n data-test-id=\"attachments-item\"\n onClick={() => download(item.genericUrl, item.fileName)}\n ref={ref}\n style={{\n ...transformStyle,\n opacity: isDragging && !isOverlay ? 0.3 : 1,\n fontFamily: 'var(-f-theme-settings-body-font-family)',\n }}\n className={joinClassNames([\n 'tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-box-neutral-hover',\n isDragging ? 'tw-bg-box-neutral-hover' : '',\n ])}\n >\n <div className=\"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover\">\n {showLoadingCircle ? (\n <LoadingCircle size={LoadingCircleSize.Small} />\n ) : (\n getDecorator(item.objectType)\n )}\n </div>\n <div className=\"tw-text-s tw-flex-1 tw-min-w-0\">\n <div className=\"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover\">\n {item.title}\n </div>\n <div className=\"tw-text-text-weak\">{`${item.fileSizeHumanReadable} - ${item.extension}`}</div>\n </div>\n {isEditing && (\n <div\n data-test-id=\"attachments-actionbar\"\n className={joinClassNames([\n 'tw-flex tw-gap-0.5 group-focus:tw-opacity-100 focus-visible:tw-opacity-100 focus-within:tw-opacity-100 group-hover:tw-opacity-100',\n isOverlay || selectedAsset?.id === item.id ? 'tw-opacity-100' : 'tw-opacity-0',\n ])}\n >\n <button\n {...focusProps}\n {...draggableProps}\n aria-label=\"Drag attachment\"\n className={joinClassNames([\n ' tw-border-button-border tw-bg-button-background active:tw-bg-button-background-pressed tw-group tw-border tw-box-box tw-relative tw-flex tw-items-center tw-justify-center tw-outline-none tw-font-medium tw-rounded tw-h-9 tw-w-9 ',\n isDragging || isOverlay\n ? 'tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed'\n : 'tw-cursor-grab hover:tw-bg-button-background-hover',\n isFocusVisible && FOCUS_STYLE,\n isFocusVisible && 'tw-z-[2]',\n ])}\n >\n <IconGrabHandle20 />\n </button>\n <div data-test-id=\"attachments-actionbar-flyout\">\n <Flyout\n placement={FlyoutPlacement.Right}\n isOpen={selectedAsset?.id === item.id}\n fitContent\n legacyFooter={false}\n onOpenChange={(isOpen) => setSelectedAsset(isOpen ? item : undefined)}\n trigger={(_, ref) => (\n <Button\n ref={ref as MutableRefObject<HTMLButtonElement>}\n icon={<IconPen20 />}\n emphasis={ButtonEmphasis.Default}\n onClick={() => setSelectedAsset(item)}\n />\n )}\n >\n <ActionMenu\n menuBlocks={[\n {\n id: 'menu',\n menuItems: [\n {\n id: 'upload',\n size: MenuItemContentSize.XSmall,\n title: 'Replace with upload',\n onClick: () => {\n openFileDialog();\n setSelectedAsset(undefined);\n },\n\n initialValue: true,\n decorator: (\n <div className=\"tw-mr-2\">\n <IconArrowCircleUp20 />\n </div>\n ),\n },\n\n {\n id: 'asset',\n size: MenuItemContentSize.XSmall,\n title: 'Replace with asset',\n onClick: () => {\n onReplaceWithBrowse();\n setSelectedAsset(undefined);\n },\n initialValue: true,\n decorator: (\n <div className=\"tw-mr-2\">\n <IconImageStack20 />\n </div>\n ),\n },\n ],\n },\n {\n id: 'menu-delete',\n menuItems: [\n {\n id: 'delete',\n size: MenuItemContentSize.XSmall,\n title: 'Delete',\n style: MenuItemStyle.Danger,\n onClick: () => {\n onDelete();\n setSelectedAsset(undefined);\n },\n\n initialValue: true,\n decorator: (\n <div className=\"tw-mr-2\">\n <IconTrashBin20 />\n </div>\n ),\n },\n ],\n },\n ]}\n />\n </Flyout>\n </div>\n </div>\n )}\n </button>\n );\n },\n);\n\nAttachmentItem.displayName = 'AttachmentItem';\n\nexport const SortableAttachmentItem = (props: SortableAttachmentItemProps) => {\n const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({\n id: props.item.id,\n });\n\n const transformStyle = {\n transform: transform ? `translate(${transform.x}px, ${transform.y}px)` : '',\n transition,\n zIndex: isDragging ? 2 : 1,\n };\n\n const draggableProps = { ...attributes, ...listeners };\n\n return (\n <AttachmentItem\n ref={setNodeRef}\n isDragging={isDragging}\n transformStyle={transformStyle}\n draggableProps={draggableProps}\n {...props}\n />\n );\n};\n"],"names":["getDecorator","type","IconImage24","IconPlayFrame24","IconMusicNote24","IconDocument24","AttachmentItem","forwardRef","item","isEditing","draggableProps","transformStyle","isDragging","isOverlay","isLoading","onDelete","onReplaceWithBrowse","onReplaceWithUpload","ref","selectedAsset","setSelectedAsset","useState","openFileDialog","selectedFiles","useFileInput","uploadFile","uploadResults","doneAll","useAssetUpload","focusProps","isFocusVisible","useFocusRing","useEffect","download","url","filename","response","blob","a","showLoadingCircle","jsxs","joinClassNames","jsx","LoadingCircle","LoadingCircleSize","FOCUS_STYLE","IconGrabHandle20","Flyout","FlyoutPlacement","isOpen","_","Button","IconPen20","ButtonEmphasis","ActionMenu","MenuItemContentSize","IconArrowCircleUp20","IconImageStack20","MenuItemStyle","IconTrashBin20","SortableAttachmentItem","props","attributes","listeners","setNodeRef","transform","transition","useSortable"],"mappings":";;;;;;;AA+BA,MAAMA,KAAe,CAACC,MACdA,MAAS,gCACDC,GAAY,CAAA,CAAA,IACbD,MAAS,gCACRE,IAAgB,CAAA,CAAA,IACjBF,MAAS,gCACRG,IAAgB,CAAA,CAAA,0BAEhBC,IAAe,CAAA,CAAA,GAIlBC,IAAiBC;AAAA,EAC1B,CACI;AAAA,IACI,MAAAC;AAAA,IACA,WAAA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,MAAMF,EAAoB;AAAA,gCAC1B,OAAO;AAAA,gCACP,OAAOG,EAAc;AAAA,gCACrB,SAAS,MAAM;AACF,kCAAA3C,KACTK,EAAiB,MAAS;AAAA,gCAC9B;AAAA,gCAEA,cAAc;AAAA,gCACd,WACKsB,gBAAAA,EAAA,IAAA,OAAA,EAAI,WAAU,WACX,UAAAA,gBAAAA,MAACiB,IAAe,CAAA,GACpB;AAAA,8BAER;AAAA,4BACJ;AAAA,0BACJ;AAAA,wBACJ;AAAA,sBAAA;AAAA,oBACJ;AAAA,kBAAA;AAAA,gBAAA,GAER;AAAA,cAAA;AAAA,YAAA;AAAA,UACJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIhB;AACJ;AAEArD,EAAe,cAAc;AAEhB,MAAAsD,KAAyB,CAACC,MAAuC;AACpE,QAAA,EAAE,YAAAC,GAAY,WAAAC,GAAW,YAAAC,GAAY,WAAAC,GAAW,YAAAC,GAAY,YAAAtD,MAAeuD,EAAY;AAAA,IACzF,IAAIN,EAAM,KAAK;AAAA,EAAA,CAClB,GAEKlD,IAAiB;AAAA,IACnB,WAAWsD,IAAY,aAAaA,EAAU,CAAC,OAAOA,EAAU,CAAC,QAAQ;AAAA,IACzE,YAAAC;AAAA,IACA,QAAQtD,IAAa,IAAI;AAAA,EAAA,GAGvBF,IAAiB,EAAE,GAAGoD,GAAY,GAAGC,EAAU;AAGjD,SAAArB,gBAAAA,EAAA;AAAA,IAACpC;AAAA,IAAA;AAAA,MACG,KAAK0D;AAAA,MACL,YAAApD;AAAA,MACA,gBAAAD;AAAA,MACA,gBAAAD;AAAA,MACC,GAAGmD;AAAA,IAAA;AAAA,EAAA;AAGhB;"}
1
+ {"version":3,"file":"AttachmentItem.es.js","sources":["../../../src/components/Attachments/AttachmentItem.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { MutableRefObject, forwardRef, useEffect, useState } from 'react';\nimport { Asset, useAssetUpload, useFileInput } from '@frontify/app-bridge';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { useFocusRing } from '@react-aria/focus';\n\nimport {\n ActionMenu,\n Button,\n ButtonEmphasis,\n FOCUS_STYLE,\n Flyout,\n FlyoutPlacement,\n IconArrowCircleUp20,\n IconDocument24,\n IconGrabHandle20,\n IconImage24,\n IconImageStack20,\n IconMusicNote24,\n IconPen20,\n IconPlayFrame24,\n IconTrashBin20,\n LoadingCircle,\n LoadingCircleSize,\n MenuItemContentSize,\n MenuItemStyle,\n} from '@frontify/fondue';\nimport { AttachmentItemProps, SortableAttachmentItemProps } from './types';\nimport { joinClassNames } from '../../utilities';\n\nconst getDecorator = (type: string) => {\n if (type === 'IMAGE') {\n return <IconImage24 />;\n } else if (type === 'VIDEO') {\n return <IconPlayFrame24 />;\n } else if (type === 'AUDIO') {\n return <IconMusicNote24 />;\n } else {\n return <IconDocument24 />;\n }\n};\n\nexport const AttachmentItem = forwardRef<HTMLButtonElement, AttachmentItemProps>(\n (\n {\n item,\n isEditing,\n draggableProps,\n transformStyle,\n isDragging,\n isOverlay,\n isLoading,\n onDelete,\n onReplaceWithBrowse,\n onReplaceWithUpload,\n },\n ref,\n ) => {\n const [selectedAsset, setSelectedAsset] = useState<Asset | undefined>();\n const [openFileDialog, { selectedFiles }] = useFileInput({ multiple: true, accept: 'image/*' });\n const [uploadFile, { results: uploadResults, doneAll }] = useAssetUpload();\n const { focusProps, isFocusVisible } = useFocusRing();\n\n useEffect(() => {\n if (selectedFiles) {\n uploadFile(selectedFiles[0]);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedFiles]);\n\n useEffect(() => {\n if (doneAll) {\n onReplaceWithUpload(uploadResults[0]);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [doneAll, uploadResults]);\n\n const download = (url: string, filename: string) => {\n fetch(url).then((response) => {\n response.blob().then((blob) => {\n const url = URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = filename;\n a.click();\n });\n });\n };\n\n const showLoadingCircle = isLoading || (selectedFiles && !doneAll);\n\n return (\n <button\n aria-label=\"Download attachment\"\n data-test-id=\"attachments-item\"\n onClick={() => download(item.genericUrl, item.fileName)}\n ref={ref}\n style={{\n ...transformStyle,\n opacity: isDragging && !isOverlay ? 0.3 : 1,\n fontFamily: 'var(-f-theme-settings-body-font-family)',\n }}\n className={joinClassNames([\n 'tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-box-neutral-hover',\n isDragging ? 'tw-bg-box-neutral-hover' : '',\n ])}\n >\n <div className=\"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover\">\n {showLoadingCircle ? (\n <LoadingCircle size={LoadingCircleSize.Small} />\n ) : (\n getDecorator(item.objectType)\n )}\n </div>\n <div className=\"tw-text-s tw-flex-1 tw-min-w-0\">\n <div className=\"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover\">\n {item.title}\n </div>\n <div className=\"tw-text-text-weak\">{`${item.fileSizeHumanReadable} - ${item.extension}`}</div>\n </div>\n {isEditing && (\n <div\n data-test-id=\"attachments-actionbar\"\n className={joinClassNames([\n 'tw-flex tw-gap-0.5 group-focus:tw-opacity-100 focus-visible:tw-opacity-100 focus-within:tw-opacity-100 group-hover:tw-opacity-100',\n isOverlay || selectedAsset?.id === item.id ? 'tw-opacity-100' : 'tw-opacity-0',\n ])}\n >\n <button\n {...focusProps}\n {...draggableProps}\n aria-label=\"Drag attachment\"\n className={joinClassNames([\n ' tw-border-button-border tw-bg-button-background active:tw-bg-button-background-pressed tw-group tw-border tw-box-box tw-relative tw-flex tw-items-center tw-justify-center tw-outline-none tw-font-medium tw-rounded tw-h-9 tw-w-9 ',\n isDragging || isOverlay\n ? 'tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed'\n : 'tw-cursor-grab hover:tw-bg-button-background-hover',\n isFocusVisible && FOCUS_STYLE,\n isFocusVisible && 'tw-z-[2]',\n ])}\n >\n <IconGrabHandle20 />\n </button>\n <div data-test-id=\"attachments-actionbar-flyout\">\n <Flyout\n placement={FlyoutPlacement.Right}\n isOpen={selectedAsset?.id === item.id}\n fitContent\n legacyFooter={false}\n onOpenChange={(isOpen) => setSelectedAsset(isOpen ? item : undefined)}\n trigger={(_, ref) => (\n <Button\n ref={ref as MutableRefObject<HTMLButtonElement>}\n icon={<IconPen20 />}\n emphasis={ButtonEmphasis.Default}\n onClick={() => setSelectedAsset(item)}\n />\n )}\n >\n <ActionMenu\n menuBlocks={[\n {\n id: 'menu',\n menuItems: [\n {\n id: 'upload',\n size: MenuItemContentSize.XSmall,\n title: 'Replace with upload',\n onClick: () => {\n openFileDialog();\n setSelectedAsset(undefined);\n },\n\n initialValue: true,\n decorator: (\n <div className=\"tw-mr-2\">\n <IconArrowCircleUp20 />\n </div>\n ),\n },\n\n {\n id: 'asset',\n size: MenuItemContentSize.XSmall,\n title: 'Replace with asset',\n onClick: () => {\n onReplaceWithBrowse();\n setSelectedAsset(undefined);\n },\n initialValue: true,\n decorator: (\n <div className=\"tw-mr-2\">\n <IconImageStack20 />\n </div>\n ),\n },\n ],\n },\n {\n id: 'menu-delete',\n menuItems: [\n {\n id: 'delete',\n size: MenuItemContentSize.XSmall,\n title: 'Delete',\n style: MenuItemStyle.Danger,\n onClick: () => {\n onDelete();\n setSelectedAsset(undefined);\n },\n\n initialValue: true,\n decorator: (\n <div className=\"tw-mr-2\">\n <IconTrashBin20 />\n </div>\n ),\n },\n ],\n },\n ]}\n />\n </Flyout>\n </div>\n </div>\n )}\n </button>\n );\n },\n);\n\nAttachmentItem.displayName = 'AttachmentItem';\n\nexport const SortableAttachmentItem = (props: SortableAttachmentItemProps) => {\n const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({\n id: props.item.id,\n });\n\n const transformStyle = {\n transform: transform ? `translate(${transform.x}px, ${transform.y}px)` : '',\n transition,\n zIndex: isDragging ? 2 : 1,\n };\n\n const draggableProps = { ...attributes, ...listeners };\n\n return (\n <AttachmentItem\n ref={setNodeRef}\n isDragging={isDragging}\n transformStyle={transformStyle}\n draggableProps={draggableProps}\n {...props}\n />\n );\n};\n"],"names":["getDecorator","type","IconImage24","IconPlayFrame24","IconMusicNote24","IconDocument24","AttachmentItem","forwardRef","item","isEditing","draggableProps","transformStyle","isDragging","isOverlay","isLoading","onDelete","onReplaceWithBrowse","onReplaceWithUpload","ref","selectedAsset","setSelectedAsset","useState","openFileDialog","selectedFiles","useFileInput","uploadFile","uploadResults","doneAll","useAssetUpload","focusProps","isFocusVisible","useFocusRing","useEffect","download","url","filename","response","blob","a","showLoadingCircle","jsxs","joinClassNames","jsx","LoadingCircle","LoadingCircleSize","FOCUS_STYLE","IconGrabHandle20","Flyout","FlyoutPlacement","isOpen","_","Button","IconPen20","ButtonEmphasis","ActionMenu","MenuItemContentSize","IconArrowCircleUp20","IconImageStack20","MenuItemStyle","IconTrashBin20","SortableAttachmentItem","props","attributes","listeners","setNodeRef","transform","transition","useSortable"],"mappings":";;;;;;;AA+BA,MAAMA,KAAe,CAACC,MACdA,MAAS,4BACDC,IAAY,CAAA,CAAA,IACbD,MAAS,4BACRE,IAAgB,CAAA,CAAA,IACjBF,MAAS,4BACRG,IAAgB,CAAA,CAAA,sBAEhBC,IAAe,CAAA,CAAA,GAIlBC,IAAiBC;AAAA,EAC1B,CACI;AAAA,IACI,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,qBAAAC;AAAA,KAEJC,MACC;AACD,UAAM,CAACC,GAAeC,CAAgB,IAAIC,EAA4B,GAChE,CAACC,GAAgB,EAAE,eAAAC,EAAA,CAAe,IAAIC,EAAa,EAAE,UAAU,I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,UACJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIhB;AACJ;AAEArD,EAAe,cAAc;AAEhB,MAAAsD,KAAyB,CAACC,MAAuC;AACpE,QAAA,EAAE,YAAAC,GAAY,WAAAC,GAAW,YAAAC,GAAY,WAAAC,GAAW,YAAAC,GAAY,YAAAtD,MAAeuD,EAAY;AAAA,IACzF,IAAIN,EAAM,KAAK;AAAA,EAAA,CAClB,GAEKlD,IAAiB;AAAA,IACnB,WAAWsD,IAAY,aAAaA,EAAU,CAAC,OAAOA,EAAU,CAAC,QAAQ;AAAA,IACzE,YAAAC;AAAA,IACA,QAAQtD,IAAa,IAAI;AAAA,EAAA,GAGvBF,IAAiB,EAAE,GAAGoD,GAAY,GAAGC,EAAU;AAGjD,SAAA,gBAAArB;AAAA,IAACpC;AAAA,IAAA;AAAA,MACG,KAAK0D;AAAA,MACL,YAAApD;AAAA,MACA,gBAAAD;AAAA,MACA,gBAAAD;AAAA,MACC,GAAGmD;AAAA,IAAA;AAAA,EAAA;AAGhB;"}
@@ -1,135 +1,135 @@
1
- import { j as e } from "../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
2
- import { useState as r, useEffect as m } from "react";
3
- import { useSensors as M, useSensor as E, PointerSensor as q, KeyboardSensor as B, DndContext as G, closestCenter as H, DragOverlay as J } from "@dnd-kit/core";
4
- import { SortableContext as Q, rectSortingStrategy as X, arrayMove as Y } from "@dnd-kit/sortable";
5
- import { useEditorState as Z, useAssetUpload as _ } from "@frontify/app-bridge";
6
- import { Tooltip as $, TooltipPosition as tt, Flyout as et, FlyoutPlacement as st, IconPaperclip16 as ot, IconCaretDown12 as nt, AssetInput as it, AssetInputSize as rt } from "@frontify/fondue";
7
- import { SortableAttachmentItem as lt, AttachmentItem as dt } from "./AttachmentItem.es.js";
8
- import { restrictToWindowEdges as at } from "@dnd-kit/modifiers";
9
- const ft = ({
1
+ import { jsx as o, jsxs as g } from "react/jsx-runtime";
2
+ import { useState as r, useEffect as f } from "react";
3
+ import { useSensors as q, useSensor as E, PointerSensor as B, KeyboardSensor as G, DndContext as H, closestCenter as J, DragOverlay as Q } from "@dnd-kit/core";
4
+ import { SortableContext as X, rectSortingStrategy as Y, arrayMove as Z } from "@dnd-kit/sortable";
5
+ import { useEditorState as _, useAssetUpload as $ } from "@frontify/app-bridge";
6
+ import { Tooltip as tt, TooltipPosition as et, Flyout as ot, FlyoutPlacement as st, IconPaperclip16 as nt, IconCaretDown12 as it, AssetInput as rt, AssetInputSize as lt } from "@frontify/fondue";
7
+ import { SortableAttachmentItem as dt, AttachmentItem as at } from "./AttachmentItem.es.js";
8
+ import { restrictToWindowEdges as ct } from "@dnd-kit/modifiers";
9
+ const vt = ({
10
10
  items: l = [],
11
- onDelete: w,
12
- onReplaceWithBrowse: F,
13
- onReplaceWithUpload: U,
14
- onBrowse: L,
15
- onUpload: O,
16
- onSorted: W,
11
+ onDelete: x,
12
+ onReplaceWithBrowse: L,
13
+ onReplaceWithUpload: O,
14
+ onBrowse: W,
15
+ onUpload: N,
16
+ onSorted: P,
17
17
  appBridge: d
18
18
  }) => {
19
- const [s, f] = r(l), [v, a] = r(!1), N = M(E(q), E(B)), [y, I] = r(void 0), [b, g] = r(!1), [c, u] = r([]), [x, P] = r(null), p = Z(d), i = s == null ? void 0 : s.find((t) => t.id === y), [R, { results: j, doneAll: A }] = _({
20
- onUploadProgress: () => !b && g(!0)
19
+ const [e, v] = r(l), [y, a] = r(!1), R = q(E(B), E(G)), [I, b] = r(void 0), [A, h] = r(!1), [c, u] = r([]), [m, T] = r(null), p = _(d), i = e == null ? void 0 : e.find((t) => t.id === I), [j, { results: S, doneAll: D }] = $({
20
+ onUploadProgress: () => !A && h(!0)
21
21
  });
22
- m(() => {
23
- f(l);
24
- }, [l]), m(() => {
25
- x && (g(!0), R(x));
26
- }, [x]), m(() => {
22
+ f(() => {
23
+ v(l);
24
+ }, [l]), f(() => {
25
+ m && (h(!0), j(m));
26
+ }, [m]), f(() => {
27
27
  (async () => {
28
- A && (await O(j), g(!1));
28
+ D && (await N(S), h(!1));
29
29
  })();
30
- }, [A, j]);
31
- const T = () => {
30
+ }, [D, S]);
31
+ const k = () => {
32
32
  a(!1), d.openAssetChooser(
33
33
  (t) => {
34
- L(t), d.closeAssetChooser(), a(!0);
34
+ W(t), d.closeAssetChooser(), a(!0);
35
35
  },
36
36
  {
37
37
  multiSelection: !0,
38
- selectedValueIds: s.map((t) => t.id)
38
+ selectedValueIds: e.map((t) => t.id)
39
39
  }
40
40
  );
41
- }, S = (t) => {
41
+ }, C = (t) => {
42
42
  a(!1), d.openAssetChooser(
43
- async (o) => {
44
- a(!0), d.closeAssetChooser(), u([...c, t.id]), await F(t, o[0]), u(c.filter((n) => n !== t.id));
43
+ async (s) => {
44
+ a(!0), d.closeAssetChooser(), u([...c, t.id]), await L(t, s[0]), u(c.filter((n) => n !== t.id));
45
45
  },
46
46
  {
47
47
  multiSelection: !1,
48
- selectedValueIds: s.map((o) => o.id)
48
+ selectedValueIds: e.map((s) => s.id)
49
49
  }
50
50
  );
51
- }, D = async (t, o) => {
52
- u([...c, t.id]), await U(t, o), u(c.filter((n) => n !== t.id));
53
- }, k = (t) => {
54
- const { active: o } = t;
55
- I(o.id);
51
+ }, F = async (t, s) => {
52
+ u([...c, t.id]), await O(t, s), u(c.filter((n) => n !== t.id));
56
53
  }, z = (t) => {
57
- const { active: o, over: n } = t;
58
- if (n && o.id !== n.id && s) {
59
- const V = s.findIndex((h) => h.id === o.id), K = s.findIndex((h) => h.id === n.id), C = Y(s, V, K);
60
- f(C), W(C);
54
+ const { active: s } = t;
55
+ b(s.id);
56
+ }, V = (t) => {
57
+ const { active: s, over: n } = t;
58
+ if (n && s.id !== n.id && e) {
59
+ const K = e.findIndex((w) => w.id === s.id), M = e.findIndex((w) => w.id === n.id), U = Z(e, K, M);
60
+ v(U), P(U);
61
61
  }
62
- I(void 0);
62
+ b(void 0);
63
63
  };
64
- return p || ((s == null ? void 0 : s.length) ?? 0) > 0 ? /* @__PURE__ */ e.jsx(
65
- $,
64
+ return p || ((e == null ? void 0 : e.length) ?? 0) > 0 ? /* @__PURE__ */ o(
65
+ tt,
66
66
  {
67
67
  withArrow: !0,
68
- position: tt.Top,
68
+ position: et.Top,
69
69
  content: "Attachments",
70
- disabled: v,
70
+ disabled: y,
71
71
  enterDelay: 500,
72
- triggerElement: /* @__PURE__ */ e.jsx("div", { "data-test-id": "attachments-flyout-button", children: /* @__PURE__ */ e.jsx(
73
- et,
72
+ triggerElement: /* @__PURE__ */ o("div", { "data-test-id": "attachments-flyout-button", children: /* @__PURE__ */ o(
73
+ ot,
74
74
  {
75
75
  placement: st.BottomRight,
76
76
  onOpenChange: (t) => a(i ? !0 : t),
77
- isOpen: v,
77
+ isOpen: y,
78
78
  hug: !1,
79
79
  fitContent: !0,
80
80
  legacyFooter: !1,
81
- trigger: /* @__PURE__ */ e.jsxs("div", { className: "tw-flex tw-text-[13px] tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-[1px] tw-p-[6px] tw-outline-line", children: [
82
- /* @__PURE__ */ e.jsx(ot, {}),
83
- /* @__PURE__ */ e.jsx("div", { children: l.length > 0 ? l.length : "Add" }),
84
- /* @__PURE__ */ e.jsx(nt, {})
81
+ trigger: /* @__PURE__ */ g("div", { className: "tw-flex tw-text-[13px] tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-[1px] tw-p-[6px] tw-outline-line", children: [
82
+ /* @__PURE__ */ o(nt, {}),
83
+ /* @__PURE__ */ o("div", { children: l.length > 0 ? l.length : "Add" }),
84
+ /* @__PURE__ */ o(it, {})
85
85
  ] }),
86
- children: /* @__PURE__ */ e.jsxs("div", { className: "tw-w-[300px]", children: [
87
- s.length > 0 && /* @__PURE__ */ e.jsxs(
88
- G,
86
+ children: /* @__PURE__ */ g("div", { className: "tw-w-[300px]", children: [
87
+ e.length > 0 && /* @__PURE__ */ g(
88
+ H,
89
89
  {
90
- sensors: N,
91
- collisionDetection: H,
92
- onDragStart: k,
93
- onDragEnd: z,
94
- modifiers: [at],
90
+ sensors: R,
91
+ collisionDetection: J,
92
+ onDragStart: z,
93
+ onDragEnd: V,
94
+ modifiers: [ct],
95
95
  children: [
96
- /* @__PURE__ */ e.jsx(Q, { items: s, strategy: X, children: /* @__PURE__ */ e.jsx("div", { className: "tw-border-b tw-border-b-line", children: s.map((t) => /* @__PURE__ */ e.jsx(
97
- lt,
96
+ /* @__PURE__ */ o(X, { items: e, strategy: Y, children: /* @__PURE__ */ o("div", { className: "tw-border-b tw-border-b-line", children: e.map((t) => /* @__PURE__ */ o(
97
+ dt,
98
98
  {
99
99
  isEditing: p,
100
100
  isLoading: c.includes(t.id),
101
101
  item: t,
102
- onDelete: () => w(t),
103
- onReplaceWithBrowse: () => S(t),
104
- onReplaceWithUpload: (o) => D(t, o)
102
+ onDelete: () => x(t),
103
+ onReplaceWithBrowse: () => C(t),
104
+ onReplaceWithUpload: (s) => F(t, s)
105
105
  },
106
106
  t.id
107
107
  )) }) }),
108
- /* @__PURE__ */ e.jsx(J, { children: i && /* @__PURE__ */ e.jsx(
109
- dt,
108
+ /* @__PURE__ */ o(Q, { children: i && /* @__PURE__ */ o(
109
+ at,
110
110
  {
111
111
  isOverlay: !0,
112
112
  isEditing: p,
113
113
  item: i,
114
114
  isDragging: !0,
115
- onDelete: () => w(i),
116
- onReplaceWithBrowse: () => S(i),
117
- onReplaceWithUpload: (t) => D(i, t)
115
+ onDelete: () => x(i),
116
+ onReplaceWithBrowse: () => C(i),
117
+ onReplaceWithUpload: (t) => F(i, t)
118
118
  },
119
- y
119
+ I
120
120
  ) })
121
121
  ]
122
122
  }
123
123
  ),
124
- p && /* @__PURE__ */ e.jsxs("div", { className: "tw-px-5 tw-py-3", children: [
125
- /* @__PURE__ */ e.jsx("div", { className: "tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4", children: "Add attachments" }),
126
- /* @__PURE__ */ e.jsx(
127
- it,
124
+ p && /* @__PURE__ */ g("div", { className: "tw-px-5 tw-py-3", children: [
125
+ /* @__PURE__ */ o("div", { className: "tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4", children: "Add attachments" }),
126
+ /* @__PURE__ */ o(
127
+ rt,
128
128
  {
129
- isLoading: b,
130
- size: rt.Small,
131
- onUploadClick: (t) => P(t),
132
- onLibraryClick: T
129
+ isLoading: A,
130
+ size: lt.Small,
131
+ onUploadClick: (t) => T(t),
132
+ onLibraryClick: k
133
133
  }
134
134
  )
135
135
  ] })
@@ -140,6 +140,6 @@ const ft = ({
140
140
  ) : null;
141
141
  };
142
142
  export {
143
- ft as Attachments
143
+ vt as Attachments
144
144
  };
145
145
  //# sourceMappingURL=Attachments.es.js.map