@frontify/guideline-blocks-settings 0.32.1 → 0.33.0

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 (100) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/dist/components/Attachments/AttachmentItem.es.js +128 -109
  3. package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
  4. package/dist/components/Attachments/Attachments.es.js +9 -1
  5. package/dist/components/Attachments/Attachments.es.js.map +1 -1
  6. package/dist/components/Attachments/AttachmentsButtonTrigger.es.js +17 -9
  7. package/dist/components/Attachments/AttachmentsButtonTrigger.es.js.map +1 -1
  8. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +38 -44
  9. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
  10. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js +33 -0
  11. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js.map +1 -0
  12. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js +26 -0
  13. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js.map +1 -0
  14. package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js +28 -0
  15. package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js.map +1 -0
  16. package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js +35 -0
  17. package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js.map +1 -0
  18. package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js +44 -0
  19. package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js.map +1 -0
  20. package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js +25 -0
  21. package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js.map +1 -0
  22. package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.es.js +29 -0
  23. package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.es.js.map +1 -0
  24. package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js +11 -112
  25. package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js.map +1 -1
  26. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js +12 -0
  27. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js.map +1 -0
  28. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js +20 -0
  29. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js.map +1 -0
  30. package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js +11 -0
  31. package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js.map +1 -0
  32. package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js +18 -0
  33. package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js.map +1 -0
  34. package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js +1 -1
  35. package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js.map +1 -1
  36. package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js +18 -0
  37. package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js.map +1 -0
  38. package/dist/helpers/mapColorPalettes.es.js +20 -8
  39. package/dist/helpers/mapColorPalettes.es.js.map +1 -1
  40. package/dist/index.cjs.js +3 -3
  41. package/dist/index.cjs.js.map +1 -1
  42. package/dist/index.d.ts +92 -27
  43. package/dist/index.es.js +205 -187
  44. package/dist/index.es.js.map +1 -1
  45. package/dist/index.umd.js +3 -3
  46. package/dist/index.umd.js.map +1 -1
  47. package/dist/styles.css +1 -1
  48. package/package.json +4 -2
  49. package/setupTests.ts +7 -2
  50. package/src/components/Attachments/AttachmentItem.tsx +21 -0
  51. package/src/components/Attachments/Attachments.spec.ct.tsx +20 -1
  52. package/src/components/Attachments/Attachments.tsx +8 -4
  53. package/src/components/Attachments/AttachmentsButtonTrigger.tsx +11 -3
  54. package/src/components/Attachments/types.ts +4 -2
  55. package/src/components/BlockItemWrapper/BlockItemWrapper.spec.ct.tsx +37 -38
  56. package/src/components/BlockItemWrapper/BlockItemWrapper.tsx +44 -48
  57. package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.spec.tsx +96 -0
  58. package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.tsx +42 -0
  59. package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.spec.tsx +44 -0
  60. package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.tsx +24 -0
  61. package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/index.ts +3 -0
  62. package/src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.spec.tsx +40 -0
  63. package/src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.tsx +37 -0
  64. package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.spec.tsx +89 -0
  65. package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.tsx +40 -0
  66. package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/index.ts +3 -0
  67. package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.spec.tsx +140 -0
  68. package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.tsx +61 -0
  69. package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/index.ts +3 -0
  70. package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.spec.tsx +77 -0
  71. package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.tsx +30 -0
  72. package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.spec.tsx +63 -0
  73. package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.tsx +40 -0
  74. package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/index.ts +3 -0
  75. package/src/components/BlockItemWrapper/Toolbar/Toolbar.spec.tsx +189 -57
  76. package/src/components/BlockItemWrapper/Toolbar/Toolbar.tsx +29 -126
  77. package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.spec.tsx +70 -0
  78. package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.tsx +19 -0
  79. package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/index.ts +3 -0
  80. package/src/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.tsx +25 -0
  81. package/src/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.tsx +15 -0
  82. package/src/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.tsx +25 -0
  83. package/src/components/BlockItemWrapper/Toolbar/context/index.ts +4 -0
  84. package/src/components/BlockItemWrapper/Toolbar/helpers.ts +1 -1
  85. package/src/components/BlockItemWrapper/Toolbar/hooks/index.ts +3 -0
  86. package/src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.spec.tsx +59 -0
  87. package/src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.ts +24 -0
  88. package/src/components/BlockItemWrapper/Toolbar/index.ts +6 -0
  89. package/src/components/BlockItemWrapper/Toolbar/types.ts +10 -30
  90. package/src/components/BlockItemWrapper/types.ts +1 -2
  91. package/src/helpers/mapColorPalettes.spec.ts +14 -113
  92. package/src/helpers/mapColorPalettes.ts +51 -8
  93. package/src/hooks/useAttachments.spec.tsx +1 -0
  94. package/tsconfig.json +1 -1
  95. package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachments.es.js +0 -27
  96. package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachments.es.js.map +0 -1
  97. package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachmentsTrigger.es.js +0 -12
  98. package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachmentsTrigger.es.js.map +0 -1
  99. package/src/components/BlockItemWrapper/Toolbar/ToolbarAttachments.tsx +0 -29
  100. package/src/components/BlockItemWrapper/Toolbar/ToolbarAttachmentsTrigger.tsx +0 -14
@@ -1,21 +1,29 @@
1
- import { jsxs as o, jsx as t } from "react/jsx-runtime";
2
- import { IconPaperclip16 as n, IconCaretDown12 as s } from "@frontify/fondue";
3
- import { joinClassNames as i } from "../../utilities/react/joinClassNames.es.js";
4
- const x = ({ children: e, isFlyoutOpen: r }) => /* @__PURE__ */ o(
5
- "div",
1
+ import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
+ import { IconPaperclip16 as a, IconCaretDown12 as i } from "@frontify/fondue";
3
+ import { joinClassNames as w } from "../../utilities/react/joinClassNames.es.js";
4
+ const b = ({
5
+ children: e,
6
+ isFlyoutOpen: r,
7
+ triggerProps: o,
8
+ triggerRef: n
9
+ }) => /* @__PURE__ */ s(
10
+ "button",
6
11
  {
7
- className: i([
12
+ className: w([
8
13
  "tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",
9
14
  r ? "tw-bg-box-neutral-pressed tw-text-box-neutral-inverse-pressed" : "tw-bg-base hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed tw-text-box-neutral-inverse hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed"
10
15
  ]),
16
+ ...o,
17
+ ref: n,
18
+ "data-test-id": "attachments-button-trigger",
11
19
  children: [
12
- /* @__PURE__ */ t(n, {}),
20
+ /* @__PURE__ */ t(a, {}),
13
21
  e,
14
- /* @__PURE__ */ t(s, {})
22
+ /* @__PURE__ */ t(i, {})
15
23
  ]
16
24
  }
17
25
  );
18
26
  export {
19
- x as AttachmentsButtonTrigger
27
+ b as AttachmentsButtonTrigger
20
28
  };
21
29
  //# sourceMappingURL=AttachmentsButtonTrigger.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentsButtonTrigger.es.js","sources":["../../../src/components/Attachments/AttachmentsButtonTrigger.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown12, IconPaperclip16 } from '@frontify/fondue';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { type AttachmentsTriggerProps } from './types';\n\nexport const AttachmentsButtonTrigger = ({ children, isFlyoutOpen }: AttachmentsTriggerProps) => (\n <div\n className={joinClassNames([\n 'tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line',\n isFlyoutOpen\n ? 'tw-bg-box-neutral-pressed tw-text-box-neutral-inverse-pressed'\n : 'tw-bg-base hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed tw-text-box-neutral-inverse hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed',\n ])}\n >\n <IconPaperclip16 />\n {children}\n <IconCaretDown12 />\n </div>\n);\n"],"names":["AttachmentsButtonTrigger","children","isFlyoutOpen","jsxs","joinClassNames","jsx","IconPaperclip16","IconCaretDown12"],"mappings":";;;AAQO,MAAMA,IAA2B,CAAC,EAAE,UAAAC,GAAU,cAAAC,EACjD,MAAA,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,WAAWC,EAAe;AAAA,MACtB;AAAA,MACAF,IACM,kEACA;AAAA,IAAA,CACT;AAAA,IAED,UAAA;AAAA,MAAA,gBAAAG,EAACC,GAAgB,EAAA;AAAA,MAChBL;AAAA,wBACAM,GAAgB,EAAA;AAAA,IAAA;AAAA,EAAA;AACrB;"}
1
+ {"version":3,"file":"AttachmentsButtonTrigger.es.js","sources":["../../../src/components/Attachments/AttachmentsButtonTrigger.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown12, IconPaperclip16 } from '@frontify/fondue';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { type AttachmentsTriggerProps } from './types';\n\nexport const AttachmentsButtonTrigger = ({\n children,\n isFlyoutOpen,\n triggerProps,\n triggerRef,\n}: AttachmentsTriggerProps) => (\n <button\n className={joinClassNames([\n 'tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line',\n isFlyoutOpen\n ? 'tw-bg-box-neutral-pressed tw-text-box-neutral-inverse-pressed'\n : 'tw-bg-base hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed tw-text-box-neutral-inverse hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed',\n ])}\n {...triggerProps}\n ref={triggerRef}\n data-test-id=\"attachments-button-trigger\"\n >\n <IconPaperclip16 />\n {children}\n <IconCaretDown12 />\n </button>\n);\n"],"names":["AttachmentsButtonTrigger","children","isFlyoutOpen","triggerProps","triggerRef","jsxs","joinClassNames","jsx","IconPaperclip16","IconCaretDown12"],"mappings":";;;AAQO,MAAMA,IAA2B,CAAC;AAAA,EACrC,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AACJ,MACI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,WAAWC,EAAe;AAAA,MACtB;AAAA,MACAJ,IACM,kEACA;AAAA,IAAA,CACT;AAAA,IACA,GAAGC;AAAA,IACJ,KAAKC;AAAA,IACL,gBAAa;AAAA,IAEb,UAAA;AAAA,MAAA,gBAAAG,EAACC,GAAgB,EAAA;AAAA,MAChBP;AAAA,wBACAQ,GAAgB,EAAA;AAAA,IAAA;AAAA,EAAA;AACrB;"}
@@ -1,67 +1,61 @@
1
- import { jsx as o, Fragment as O, jsxs as b } from "react/jsx-runtime";
2
- import { useState as p, useRef as F } from "react";
3
- import { Toolbar as j } from "./Toolbar/Toolbar.es.js";
4
- import { joinClassNames as r } from "../../utilities/react/joinClassNames.es.js";
5
- const A = ({
1
+ import { jsx as t, Fragment as y, jsxs as h } from "react/jsx-runtime";
2
+ import { useState as x, useRef as g } from "react";
3
+ import { DragPreviewContextProvider as b } from "./Toolbar/context/DragPreviewContext.es.js";
4
+ import { MultiFlyoutContextProvider as F } from "./Toolbar/context/MultiFlyoutContext.es.js";
5
+ import { DEFAULT_MENU_BUTTON_ID as N } from "./Toolbar/MenuToolbarButton/MenuToolbarButton.es.js";
6
+ import { Toolbar as T } from "./Toolbar/Toolbar.es.js";
7
+ import { joinClassNames as w } from "../../utilities/react/joinClassNames.es.js";
8
+ const k = ({
6
9
  children: i,
7
- toolbarFlyoutItems: w,
8
- toolbarItems: t,
9
- shouldHideWrapper: c,
10
- shouldHideComponent: u = !1,
11
- isDragging: f,
12
- shouldFillContainer: m,
13
- outlineOffset: e = 2,
14
- shouldBeShown: n = !1,
15
- showAttachments: y = !1
10
+ toolbarItems: e,
11
+ shouldHideWrapper: a,
12
+ shouldHideComponent: n = !1,
13
+ isDragging: p = !1,
14
+ shouldFillContainer: c,
15
+ outlineOffset: o = 2,
16
+ shouldBeShown: r = !1,
17
+ showAttachments: u = !1
16
18
  }) => {
17
- const [s, h] = p(n), [l, d] = p(!1), x = F(null);
18
- if (c)
19
- return /* @__PURE__ */ o(O, { children: i });
20
- const g = t == null ? void 0 : t.filter((v) => v !== void 0), a = s || l || n;
21
- return /* @__PURE__ */ b(
19
+ const [l, f] = x(r ? [N] : []), m = g(null);
20
+ if (a)
21
+ return /* @__PURE__ */ t(y, { children: i });
22
+ const d = e == null ? void 0 : e.filter((v) => v !== void 0), s = l.length > 0 || r;
23
+ return /* @__PURE__ */ t(b, { isDragPreview: p, children: /* @__PURE__ */ t(F, { openFlyoutIds: l, setOpenFlyoutIds: f, children: /* @__PURE__ */ h(
22
24
  "div",
23
25
  {
24
- ref: x,
26
+ ref: m,
25
27
  "data-test-id": "block-item-wrapper",
26
28
  style: {
27
- outlineOffset: e
29
+ outlineOffset: o
28
30
  },
29
- className: r([
31
+ className: w([
30
32
  "tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse",
31
- m && "tw-flex-1 tw-h-full tw-w-full",
33
+ c && "tw-flex-1 tw-h-full tw-w-full",
32
34
  "hover:tw-outline focus-within:tw-outline",
33
- a && "tw-outline",
34
- u && "tw-opacity-0"
35
+ s && "tw-outline",
36
+ n && "tw-opacity-0"
35
37
  ]),
36
38
  children: [
37
- /* @__PURE__ */ o(
39
+ /* @__PURE__ */ t(
38
40
  "div",
39
41
  {
40
42
  style: {
41
- right: -1 - e,
42
- bottom: `calc(100% - ${2 + e}px)`
43
+ right: -1 - o,
44
+ bottom: `calc(100% - ${2 + o}px)`
43
45
  },
44
- className: r([
46
+ className: w([
45
47
  "tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]",
46
48
  "group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100",
47
49
  "tw-flex tw-justify-end",
48
- a && "tw-opacity-100"
50
+ s && "tw-opacity-100"
49
51
  ]),
50
- children: /* @__PURE__ */ o(
51
- j,
52
+ children: /* @__PURE__ */ t(
53
+ T,
52
54
  {
53
- flyoutMenu: {
54
- items: w,
55
- isOpen: s,
56
- onOpenChange: h
57
- },
58
55
  attachments: {
59
- isEnabled: y,
60
- isOpen: l,
61
- onOpenChange: d
56
+ isEnabled: u
62
57
  },
63
- items: g,
64
- isDragging: f
58
+ items: d
65
59
  }
66
60
  )
67
61
  }
@@ -69,9 +63,9 @@ const A = ({
69
63
  i
70
64
  ]
71
65
  }
72
- );
66
+ ) }) });
73
67
  };
74
68
  export {
75
- A as BlockItemWrapper
69
+ k as BlockItemWrapper
76
70
  };
77
71
  //# sourceMappingURL=BlockItemWrapper.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BlockItemWrapper.es.js","sources":["../../../src/components/BlockItemWrapper/BlockItemWrapper.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactElement, useRef, useState } from 'react';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { Toolbar, type ToolbarItem } from './Toolbar';\nimport { type BlockItemWrapperProps } from './types';\n\nexport const BlockItemWrapper = ({\n children,\n toolbarFlyoutItems,\n toolbarItems,\n shouldHideWrapper,\n shouldHideComponent = false,\n isDragging,\n shouldFillContainer,\n outlineOffset = 2,\n shouldBeShown = false,\n showAttachments = false,\n}: BlockItemWrapperProps): ReactElement => {\n const [isMenuFlyoutOpen, setIsMenuFlyoutOpen] = useState(shouldBeShown);\n const [isAttachmentFlyoutOpen, setIsAttachmentFlyoutOpen] = useState(false);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n if (shouldHideWrapper) {\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{children}</>;\n }\n\n const items = toolbarItems?.filter((item): item is ToolbarItem => item !== undefined);\n\n const shouldToolbarBeVisible = isMenuFlyoutOpen || isAttachmentFlyoutOpen || shouldBeShown;\n\n return (\n <div\n ref={wrapperRef}\n data-test-id=\"block-item-wrapper\"\n style={{\n outlineOffset,\n }}\n className={joinClassNames([\n 'tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse',\n shouldFillContainer && 'tw-flex-1 tw-h-full tw-w-full',\n 'hover:tw-outline focus-within:tw-outline',\n shouldToolbarBeVisible && 'tw-outline',\n shouldHideComponent && 'tw-opacity-0',\n ])}\n >\n <div\n style={{\n right: -1 - outlineOffset,\n bottom: `calc(100% - ${2 + outlineOffset}px)`,\n }}\n className={joinClassNames([\n 'tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]',\n 'group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100',\n 'tw-flex tw-justify-end',\n shouldToolbarBeVisible && 'tw-opacity-100',\n ])}\n >\n <Toolbar\n flyoutMenu={{\n items: toolbarFlyoutItems,\n isOpen: isMenuFlyoutOpen,\n onOpenChange: setIsMenuFlyoutOpen,\n }}\n attachments={{\n isEnabled: showAttachments,\n isOpen: isAttachmentFlyoutOpen,\n onOpenChange: setIsAttachmentFlyoutOpen,\n }}\n items={items}\n isDragging={isDragging}\n />\n </div>\n {children}\n </div>\n );\n};\n"],"names":["BlockItemWrapper","children","toolbarFlyoutItems","toolbarItems","shouldHideWrapper","shouldHideComponent","isDragging","shouldFillContainer","outlineOffset","shouldBeShown","showAttachments","isMenuFlyoutOpen","setIsMenuFlyoutOpen","useState","isAttachmentFlyoutOpen","setIsAttachmentFlyoutOpen","wrapperRef","useRef","items","item","shouldToolbarBeVisible","jsxs","joinClassNames","jsx","Toolbar"],"mappings":";;;;AASO,MAAMA,IAAmB,CAAC;AAAA,EAC7B,UAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,YAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,eAAAC,IAAgB;AAAA,EAChB,iBAAAC,IAAkB;AACtB,MAA2C;AACvC,QAAM,CAACC,GAAkBC,CAAmB,IAAIC,EAASJ,CAAa,GAChE,CAACK,GAAwBC,CAAyB,IAAIF,EAAS,EAAK,GACpEG,IAAaC,EAAuB,IAAI;AAE9C,MAAIb;AAEA,kCAAU,UAAAH,EAAS,CAAA;AAGvB,QAAMiB,IAAQf,KAAA,gBAAAA,EAAc,OAAO,CAACgB,MAA8BA,MAAS,SAErEC,IAAyBT,KAAoBG,KAA0BL;AAGzE,SAAA,gBAAAY;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAKL;AAAA,MACL,gBAAa;AAAA,MACb,OAAO;AAAA,QACH,eAAAR;AAAA,MACJ;AAAA,MACA,WAAWc,EAAe;AAAA,QACtB;AAAA,QACAf,KAAuB;AAAA,QACvB;AAAA,QACAa,KAA0B;AAAA,QAC1Bf,KAAuB;AAAA,MAAA,CAC1B;AAAA,MAED,UAAA;AAAA,QAAA,gBAAAkB;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,OAAO;AAAA,cACH,OAAO,KAAKf;AAAA,cACZ,QAAQ,eAAe,IAAIA,CAAa;AAAA,YAC5C;AAAA,YACA,WAAWc,EAAe;AAAA,cACtB;AAAA,cACA;AAAA,cACA;AAAA,cACAF,KAA0B;AAAA,YAAA,CAC7B;AAAA,YAED,UAAA,gBAAAG;AAAA,cAACC;AAAA,cAAA;AAAA,gBACG,YAAY;AAAA,kBACR,OAAOtB;AAAA,kBACP,QAAQS;AAAA,kBACR,cAAcC;AAAA,gBAClB;AAAA,gBACA,aAAa;AAAA,kBACT,WAAWF;AAAA,kBACX,QAAQI;AAAA,kBACR,cAAcC;AAAA,gBAClB;AAAA,gBACA,OAAAG;AAAA,gBACA,YAAAZ;AAAA,cAAA;AAAA,YACJ;AAAA,UAAA;AAAA,QACJ;AAAA,QACCL;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGb;"}
1
+ {"version":3,"file":"BlockItemWrapper.es.js","sources":["../../../src/components/BlockItemWrapper/BlockItemWrapper.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactElement, useRef, useState } from 'react';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { DEFAULT_MENU_BUTTON_ID, Toolbar, type ToolbarItem } from './Toolbar';\nimport { type BlockItemWrapperProps } from './types';\nimport { DragPreviewContextProvider } from './Toolbar/context/DragPreviewContext';\nimport { MultiFlyoutContextProvider } from './Toolbar/context/MultiFlyoutContext';\n\nexport const BlockItemWrapper = ({\n children,\n toolbarItems,\n shouldHideWrapper,\n shouldHideComponent = false,\n isDragging = false,\n shouldFillContainer,\n outlineOffset = 2,\n shouldBeShown = false,\n showAttachments = false,\n}: BlockItemWrapperProps): ReactElement => {\n const [openFlyoutIds, setOpenFlyoutIds] = useState<string[]>(shouldBeShown ? [DEFAULT_MENU_BUTTON_ID] : []);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n if (shouldHideWrapper) {\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{children}</>;\n }\n\n const items = toolbarItems?.filter((item): item is ToolbarItem => item !== undefined);\n\n const shouldToolbarBeVisible = openFlyoutIds.length > 0 || shouldBeShown;\n\n return (\n <DragPreviewContextProvider isDragPreview={isDragging}>\n <MultiFlyoutContextProvider openFlyoutIds={openFlyoutIds} setOpenFlyoutIds={setOpenFlyoutIds}>\n <div\n ref={wrapperRef}\n data-test-id=\"block-item-wrapper\"\n style={{\n outlineOffset,\n }}\n className={joinClassNames([\n 'tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse',\n shouldFillContainer && 'tw-flex-1 tw-h-full tw-w-full',\n 'hover:tw-outline focus-within:tw-outline',\n shouldToolbarBeVisible && 'tw-outline',\n shouldHideComponent && 'tw-opacity-0',\n ])}\n >\n <div\n style={{\n right: -1 - outlineOffset,\n bottom: `calc(100% - ${2 + outlineOffset}px)`,\n }}\n className={joinClassNames([\n 'tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]',\n 'group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100',\n 'tw-flex tw-justify-end',\n shouldToolbarBeVisible && 'tw-opacity-100',\n ])}\n >\n <Toolbar\n attachments={{\n isEnabled: showAttachments,\n }}\n items={items}\n />\n </div>\n {children}\n </div>\n </MultiFlyoutContextProvider>\n </DragPreviewContextProvider>\n );\n};\n"],"names":["BlockItemWrapper","children","toolbarItems","shouldHideWrapper","shouldHideComponent","isDragging","shouldFillContainer","outlineOffset","shouldBeShown","showAttachments","openFlyoutIds","setOpenFlyoutIds","useState","DEFAULT_MENU_BUTTON_ID","wrapperRef","useRef","items","item","shouldToolbarBeVisible","DragPreviewContextProvider","jsx","MultiFlyoutContextProvider","jsxs","joinClassNames","Toolbar"],"mappings":";;;;;;;AAWO,MAAMA,IAAmB,CAAC;AAAA,EAC7B,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,YAAAC,IAAa;AAAA,EACb,qBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,eAAAC,IAAgB;AAAA,EAChB,iBAAAC,IAAkB;AACtB,MAA2C;AACjC,QAAA,CAACC,GAAeC,CAAgB,IAAIC,EAAmBJ,IAAgB,CAACK,CAAsB,IAAI,CAAA,CAAE,GACpGC,IAAaC,EAAuB,IAAI;AAE9C,MAAIZ;AAEA,kCAAU,UAAAF,EAAS,CAAA;AAGvB,QAAMe,IAAQd,KAAA,gBAAAA,EAAc,OAAO,CAACe,MAA8BA,MAAS,SAErEC,IAAyBR,EAAc,SAAS,KAAKF;AAE3D,2BACKW,GAA2B,EAAA,eAAed,GACvC,UAAC,gBAAAe,EAAAC,GAAA,EAA2B,eAAAX,GAA8B,kBAAAC,GACtD,UAAA,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAKR;AAAA,MACL,gBAAa;AAAA,MACb,OAAO;AAAA,QACH,eAAAP;AAAA,MACJ;AAAA,MACA,WAAWgB,EAAe;AAAA,QACtB;AAAA,QACAjB,KAAuB;AAAA,QACvB;AAAA,QACAY,KAA0B;AAAA,QAC1Bd,KAAuB;AAAA,MAAA,CAC1B;AAAA,MAED,UAAA;AAAA,QAAA,gBAAAgB;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,OAAO;AAAA,cACH,OAAO,KAAKb;AAAA,cACZ,QAAQ,eAAe,IAAIA,CAAa;AAAA,YAC5C;AAAA,YACA,WAAWgB,EAAe;AAAA,cACtB;AAAA,cACA;AAAA,cACA;AAAA,cACAL,KAA0B;AAAA,YAAA,CAC7B;AAAA,YAED,UAAA,gBAAAE;AAAA,cAACI;AAAA,cAAA;AAAA,gBACG,aAAa;AAAA,kBACT,WAAWf;AAAA,gBACf;AAAA,gBACA,OAAAO;AAAA,cAAA;AAAA,YACJ;AAAA,UAAA;AAAA,QACJ;AAAA,QACCf;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,EAET,CAAA,EACJ,CAAA;AAER;"}
@@ -0,0 +1,33 @@
1
+ import { jsx as h } from "react/jsx-runtime";
2
+ import { useMemoizedId as A } from "@frontify/fondue";
3
+ import { useMultiFlyoutState as l } from "../hooks/useMultiFlyoutState.es.js";
4
+ import { AttachmentsToolbarButtonTrigger as d } from "./AttachmentsToolbarButtonTrigger.es.js";
5
+ import { useDragPreviewContext as u } from "../context/DragPreviewContext.es.js";
6
+ import { useAttachmentsContext as T } from "../../../../hooks/useAttachments.es.js";
7
+ import { Attachments as g } from "../../../Attachments/Attachments.es.js";
8
+ const f = "attachments", U = ({
9
+ flyoutId: o = f
10
+ }) => {
11
+ const n = A(o), { appBridge: r, attachments: m, onAttachmentsAdd: t, onAttachmentDelete: s, onAttachmentReplace: e, onAttachmentsSorted: a } = T(), { isOpen: i, onOpenChange: c } = l(n), p = u();
12
+ return /* @__PURE__ */ h(
13
+ g,
14
+ {
15
+ onUpload: t,
16
+ onDelete: s,
17
+ onReplaceWithBrowse: e,
18
+ onReplaceWithUpload: e,
19
+ onSorted: a,
20
+ onBrowse: t,
21
+ items: m,
22
+ appBridge: r,
23
+ triggerComponent: d,
24
+ isOpen: i && !p,
25
+ onOpenChange: c
26
+ }
27
+ );
28
+ };
29
+ export {
30
+ U as AttachmentsToolbarButton,
31
+ f as DEFAULT_ATTACHMENTS_BUTTON_ID
32
+ };
33
+ //# sourceMappingURL=AttachmentsToolbarButton.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AttachmentsToolbarButton.es.js","sources":["../../../../../src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useMemoizedId } from '@frontify/fondue';\n\nimport { useAttachmentsContext } from '../../../../hooks';\nimport { Attachments } from '../../../Attachments';\nimport { useMultiFlyoutState } from '../hooks/useMultiFlyoutState';\n\nimport { AttachmentsToolbarButtonTrigger } from './AttachmentsToolbarButtonTrigger';\nimport { useDragPreviewContext } from '../context/DragPreviewContext';\n\nexport const DEFAULT_ATTACHMENTS_BUTTON_ID = 'attachments';\n\ntype AttachmentsToolbarButtonProps = { flyoutId?: string };\n\nexport const AttachmentsToolbarButton = ({\n flyoutId = DEFAULT_ATTACHMENTS_BUTTON_ID,\n}: AttachmentsToolbarButtonProps) => {\n const id = useMemoizedId(flyoutId);\n\n const { appBridge, attachments, onAttachmentsAdd, onAttachmentDelete, onAttachmentReplace, onAttachmentsSorted } =\n useAttachmentsContext();\n\n const { isOpen, onOpenChange } = useMultiFlyoutState(id);\n const isDragPreview = useDragPreviewContext();\n\n return (\n <Attachments\n onUpload={onAttachmentsAdd}\n onDelete={onAttachmentDelete}\n onReplaceWithBrowse={onAttachmentReplace}\n onReplaceWithUpload={onAttachmentReplace}\n onSorted={onAttachmentsSorted}\n onBrowse={onAttachmentsAdd}\n items={attachments}\n appBridge={appBridge}\n triggerComponent={AttachmentsToolbarButtonTrigger}\n isOpen={isOpen && !isDragPreview}\n onOpenChange={onOpenChange}\n />\n );\n};\n"],"names":["DEFAULT_ATTACHMENTS_BUTTON_ID","AttachmentsToolbarButton","flyoutId","id","useMemoizedId","appBridge","attachments","onAttachmentsAdd","onAttachmentDelete","onAttachmentReplace","onAttachmentsSorted","useAttachmentsContext","isOpen","onOpenChange","useMultiFlyoutState","isDragPreview","useDragPreviewContext","jsx","Attachments","AttachmentsToolbarButtonTrigger"],"mappings":";;;;;;;AAWO,MAAMA,IAAgC,eAIhCC,IAA2B,CAAC;AAAA,EACrC,UAAAC,IAAWF;AACf,MAAqC;AAC3B,QAAAG,IAAKC,EAAcF,CAAQ,GAE3B,EAAE,WAAAG,GAAW,aAAAC,GAAa,kBAAAC,GAAkB,oBAAAC,GAAoB,qBAAAC,GAAqB,qBAAAC,MACvFC,KAEE,EAAE,QAAAC,GAAQ,cAAAC,EAAa,IAAIC,EAAoBX,CAAE,GACjDY,IAAgBC;AAGlB,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,UAAUX;AAAA,MACV,UAAUC;AAAA,MACV,qBAAqBC;AAAA,MACrB,qBAAqBA;AAAA,MACrB,UAAUC;AAAA,MACV,UAAUH;AAAA,MACV,OAAOD;AAAA,MACP,WAAAD;AAAA,MACA,kBAAkBc;AAAA,MAClB,QAAQP,KAAU,CAACG;AAAA,MACnB,cAAAF;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
@@ -0,0 +1,26 @@
1
+ import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
+ import { IconPaperclip16 as c, IconCaretDown12 as i } from "@frontify/fondue";
3
+ import { BaseToolbarButton as m } from "../BaseToolbarButton.es.js";
4
+ const f = ({
5
+ children: o,
6
+ isFlyoutOpen: r,
7
+ triggerProps: e,
8
+ triggerRef: a
9
+ }) => /* @__PURE__ */ n(
10
+ m,
11
+ {
12
+ forceActiveStyle: r,
13
+ "data-test-id": "attachments-toolbar-button-trigger",
14
+ ...e,
15
+ ref: a,
16
+ children: [
17
+ /* @__PURE__ */ t(c, {}),
18
+ o,
19
+ /* @__PURE__ */ t(i, {})
20
+ ]
21
+ }
22
+ );
23
+ export {
24
+ f as AttachmentsToolbarButtonTrigger
25
+ };
26
+ //# sourceMappingURL=AttachmentsToolbarButtonTrigger.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AttachmentsToolbarButtonTrigger.es.js","sources":["../../../../../src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown12, IconPaperclip16 } from '@frontify/fondue';\nimport { type AttachmentsTriggerProps } from '../../../Attachments/types';\n\nimport { BaseToolbarButton } from '../BaseToolbarButton';\n\nexport const AttachmentsToolbarButtonTrigger = ({\n children,\n isFlyoutOpen,\n triggerProps,\n triggerRef,\n}: AttachmentsTriggerProps) => (\n <BaseToolbarButton\n forceActiveStyle={isFlyoutOpen}\n data-test-id=\"attachments-toolbar-button-trigger\"\n {...triggerProps}\n ref={triggerRef}\n >\n <IconPaperclip16 />\n {children}\n <IconCaretDown12 />\n </BaseToolbarButton>\n);\n"],"names":["AttachmentsToolbarButtonTrigger","children","isFlyoutOpen","triggerProps","triggerRef","jsxs","BaseToolbarButton","jsx","IconPaperclip16","IconCaretDown12"],"mappings":";;;AAOO,MAAMA,IAAkC,CAAC;AAAA,EAC5C,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AACJ,MACI,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACG,kBAAkBJ;AAAA,IAClB,gBAAa;AAAA,IACZ,GAAGC;AAAA,IACJ,KAAKC;AAAA,IAEL,UAAA;AAAA,MAAA,gBAAAG,EAACC,GAAgB,EAAA;AAAA,MAChBP;AAAA,wBACAQ,GAAgB,EAAA;AAAA,IAAA;AAAA,EAAA;AACrB;"}
@@ -0,0 +1,28 @@
1
+ import { jsx as b } from "react/jsx-runtime";
2
+ import { forwardRef as i } from "react";
3
+ import { getToolbarButtonClassNames as l } from "./helpers.es.js";
4
+ const n = i(
5
+ ({
6
+ onClick: t,
7
+ children: o,
8
+ forceActiveStyle: a,
9
+ cursor: r = "pointer",
10
+ "data-test-id": s = "base-toolbar-button",
11
+ ...e
12
+ }, m) => /* @__PURE__ */ b(
13
+ "button",
14
+ {
15
+ onClick: t,
16
+ className: l(r, a),
17
+ "data-test-id": s,
18
+ ...e,
19
+ ref: m,
20
+ children: o
21
+ }
22
+ )
23
+ );
24
+ n.displayName = "BaseToolbarButton";
25
+ export {
26
+ n as BaseToolbarButton
27
+ };
28
+ //# sourceMappingURL=BaseToolbarButton.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseToolbarButton.es.js","sources":["../../../../src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type HTMLAttributes, type ReactNode, forwardRef } from 'react';\nimport { getToolbarButtonClassNames } from './helpers';\n\ntype BaseToolbarButtonProps = {\n children: ReactNode;\n forceActiveStyle?: boolean;\n cursor?: 'pointer' | 'grab';\n 'data-test-id'?: string;\n} & HTMLAttributes<HTMLButtonElement>;\n\nexport const BaseToolbarButton = forwardRef<HTMLButtonElement, BaseToolbarButtonProps>(\n (\n {\n onClick,\n children,\n forceActiveStyle,\n cursor = 'pointer',\n 'data-test-id': dataTestId = 'base-toolbar-button',\n ...props\n },\n ref,\n ) => (\n <button\n onClick={onClick}\n className={getToolbarButtonClassNames(cursor, forceActiveStyle)}\n data-test-id={dataTestId}\n {...props}\n ref={ref}\n >\n {children}\n </button>\n ),\n);\n\nBaseToolbarButton.displayName = 'BaseToolbarButton';\n"],"names":["BaseToolbarButton","forwardRef","onClick","children","forceActiveStyle","cursor","dataTestId","props","ref","jsx","getToolbarButtonClassNames"],"mappings":";;;AAYO,MAAMA,IAAoBC;AAAA,EAC7B,CACI;AAAA,IACI,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,QAAAC,IAAS;AAAA,IACT,gBAAgBC,IAAa;AAAA,IAC7B,GAAGC;AAAA,KAEPC,MAEA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,SAAAP;AAAA,MACA,WAAWQ,EAA2BL,GAAQD,CAAgB;AAAA,MAC9D,gBAAcE;AAAA,MACb,GAAGC;AAAA,MACJ,KAAAC;AAAA,MAEC,UAAAL;AAAA,IAAA;AAAA,EACL;AAER;AAEAH,EAAkB,cAAc;"}
@@ -0,0 +1,35 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { DEFAULT_DRAGGING_TOOLTIP as a, DEFAULT_DRAG_TOOLTIP as l } from "../../constants.es.js";
3
+ import { useDragPreviewContext as m } from "../context/DragPreviewContext.es.js";
4
+ import { BaseToolbarButton as c } from "../BaseToolbarButton.es.js";
5
+ import { ToolbarButtonTooltip as p } from "../ToolbarButtonTooltip.es.js";
6
+ const D = ({
7
+ tooltip: t,
8
+ icon: e,
9
+ setActivatorNodeRef: i,
10
+ draggableProps: n
11
+ }) => {
12
+ const o = m();
13
+ return /* @__PURE__ */ r(
14
+ p,
15
+ {
16
+ open: o,
17
+ content: /* @__PURE__ */ r("div", { children: o ? a : t ?? l }),
18
+ children: /* @__PURE__ */ r(
19
+ c,
20
+ {
21
+ ref: i,
22
+ "data-test-id": "block-item-wrapper-toolbar-btn",
23
+ forceActiveStyle: o,
24
+ cursor: "grab",
25
+ ...n,
26
+ children: e
27
+ }
28
+ )
29
+ }
30
+ );
31
+ };
32
+ export {
33
+ D as DragHandleToolbarButton
34
+ };
35
+ //# sourceMappingURL=DragHandleToolbarButton.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragHandleToolbarButton.es.js","sources":["../../../../../src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ReactNode } from 'react';\nimport { DEFAULT_DRAGGING_TOOLTIP, DEFAULT_DRAG_TOOLTIP } from '../../constants';\nimport { useDragPreviewContext } from '../context/DragPreviewContext';\nimport { BaseToolbarButton } from '../BaseToolbarButton';\nimport { ToolbarButtonTooltip } from '../ToolbarButtonTooltip';\n\nexport type DragHandleToolbarButtonProps = {\n icon?: ReactNode;\n tooltip?: string;\n draggableProps: Record<string, unknown>;\n setActivatorNodeRef?: (node: HTMLElement | null) => void;\n};\n\nexport const DragHandleToolbarButton = ({\n tooltip,\n icon,\n setActivatorNodeRef,\n draggableProps,\n}: DragHandleToolbarButtonProps) => {\n const isDragPreview = useDragPreviewContext();\n\n return (\n <ToolbarButtonTooltip\n open={isDragPreview}\n content={<div>{isDragPreview ? DEFAULT_DRAGGING_TOOLTIP : tooltip ?? DEFAULT_DRAG_TOOLTIP}</div>}\n >\n <BaseToolbarButton\n ref={setActivatorNodeRef}\n data-test-id=\"block-item-wrapper-toolbar-btn\"\n forceActiveStyle={isDragPreview}\n cursor=\"grab\"\n {...draggableProps}\n >\n {icon}\n </BaseToolbarButton>\n </ToolbarButtonTooltip>\n );\n};\n"],"names":["DragHandleToolbarButton","tooltip","icon","setActivatorNodeRef","draggableProps","isDragPreview","useDragPreviewContext","jsx","ToolbarButtonTooltip","DEFAULT_DRAGGING_TOOLTIP","DEFAULT_DRAG_TOOLTIP","BaseToolbarButton"],"mappings":";;;;;AAeO,MAAMA,IAA0B,CAAC;AAAA,EACpC,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,gBAAAC;AACJ,MAAoC;AAChC,QAAMC,IAAgBC;AAGlB,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,MAAMH;AAAA,MACN,SAAU,gBAAAE,EAAA,OAAA,EAAK,UAAgBF,IAAAI,IAA2BR,KAAWS,GAAqB;AAAA,MAE1F,UAAA,gBAAAH;AAAA,QAACI;AAAA,QAAA;AAAA,UACG,KAAKR;AAAA,UACL,gBAAa;AAAA,UACb,kBAAkBE;AAAA,UAClB,QAAO;AAAA,UACN,GAAGD;AAAA,UAEH,UAAAF;AAAA,QAAA;AAAA,MACL;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
@@ -0,0 +1,44 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { useDragPreviewContext as u } from "../context/DragPreviewContext.es.js";
3
+ import { ToolbarButtonTooltip as p } from "../ToolbarButtonTooltip.es.js";
4
+ import { useMemoizedId as h, Flyout as g, FlyoutPlacement as w } from "@frontify/fondue";
5
+ import { BaseToolbarButton as x } from "../BaseToolbarButton.es.js";
6
+ import { useMultiFlyoutState as y } from "../hooks/useMultiFlyoutState.es.js";
7
+ const O = ({
8
+ content: r,
9
+ icon: i,
10
+ tooltip: l,
11
+ flyoutId: n,
12
+ flyoutFooter: a,
13
+ flyoutHeader: s
14
+ }) => {
15
+ const m = h(n), { isOpen: e, onOpenChange: f } = y(m), o = u();
16
+ return /* @__PURE__ */ t(p, { disabled: o || e, content: l, children: /* @__PURE__ */ t("div", { className: "tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative", children: /* @__PURE__ */ t(
17
+ g,
18
+ {
19
+ isOpen: e && !o,
20
+ legacyFooter: !1,
21
+ fixedFooter: a,
22
+ fixedHeader: s,
23
+ fitContent: !0,
24
+ hug: !1,
25
+ placement: w.BottomRight,
26
+ onOpenChange: f,
27
+ trigger: (c, d) => /* @__PURE__ */ t(
28
+ x,
29
+ {
30
+ "data-test-id": "block-item-wrapper-toolbar-flyout",
31
+ forceActiveStyle: e && !o,
32
+ ...c,
33
+ ref: d,
34
+ children: i
35
+ }
36
+ ),
37
+ children: r
38
+ }
39
+ ) }) });
40
+ };
41
+ export {
42
+ O as FlyoutToolbarButton
43
+ };
44
+ //# sourceMappingURL=FlyoutToolbarButton.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlyoutToolbarButton.es.js","sources":["../../../../../src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type MutableRefObject, type ReactNode } from 'react';\nimport { useDragPreviewContext } from '../context/DragPreviewContext';\nimport { ToolbarButtonTooltip } from '../ToolbarButtonTooltip';\nimport { Flyout, FlyoutPlacement, useMemoizedId } from '@frontify/fondue';\nimport { BaseToolbarButton } from '../BaseToolbarButton';\nimport { useMultiFlyoutState } from '../hooks/useMultiFlyoutState';\n\nexport type FlyoutToolbarButtonProps = {\n content: ReactNode;\n icon: ReactNode;\n tooltip: ReactNode;\n flyoutId: string;\n flyoutFooter?: ReactNode;\n flyoutHeader?: ReactNode;\n};\n\nexport const FlyoutToolbarButton = ({\n content,\n icon,\n tooltip,\n flyoutId,\n flyoutFooter,\n flyoutHeader,\n}: FlyoutToolbarButtonProps) => {\n const id = useMemoizedId(flyoutId);\n\n const { isOpen, onOpenChange } = useMultiFlyoutState(id);\n\n const isDragPreview = useDragPreviewContext();\n\n return (\n <ToolbarButtonTooltip disabled={isDragPreview || isOpen} content={tooltip}>\n <div className=\"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative\">\n <Flyout\n isOpen={isOpen && !isDragPreview}\n legacyFooter={false}\n fixedFooter={flyoutFooter}\n fixedHeader={flyoutHeader}\n fitContent\n hug={false}\n placement={FlyoutPlacement.BottomRight}\n onOpenChange={onOpenChange}\n trigger={(triggerProps, triggerRef) => (\n <BaseToolbarButton\n data-test-id=\"block-item-wrapper-toolbar-flyout\"\n forceActiveStyle={isOpen && !isDragPreview}\n {...triggerProps}\n ref={triggerRef as MutableRefObject<HTMLButtonElement>}\n >\n {icon}\n </BaseToolbarButton>\n )}\n >\n {content}\n </Flyout>\n </div>\n </ToolbarButtonTooltip>\n );\n};\n"],"names":["FlyoutToolbarButton","content","icon","tooltip","flyoutId","flyoutFooter","flyoutHeader","id","useMemoizedId","isOpen","onOpenChange","useMultiFlyoutState","isDragPreview","useDragPreviewContext","jsx","ToolbarButtonTooltip","Flyout","FlyoutPlacement","triggerProps","triggerRef","BaseToolbarButton"],"mappings":";;;;;;AAkBO,MAAMA,IAAsB,CAAC;AAAA,EAChC,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AACJ,MAAgC;AACtB,QAAAC,IAAKC,EAAcJ,CAAQ,GAE3B,EAAE,QAAAK,GAAQ,cAAAC,EAAa,IAAIC,EAAoBJ,CAAE,GAEjDK,IAAgBC;AAGlB,SAAA,gBAAAC,EAACC,GAAqB,EAAA,UAAUH,KAAiBH,GAAQ,SAASN,GAC9D,UAAA,gBAAAW,EAAC,OAAI,EAAA,WAAU,yDACX,UAAA,gBAAAA;AAAA,IAACE;AAAA,IAAA;AAAA,MACG,QAAQP,KAAU,CAACG;AAAA,MACnB,cAAc;AAAA,MACd,aAAaP;AAAA,MACb,aAAaC;AAAA,MACb,YAAU;AAAA,MACV,KAAK;AAAA,MACL,WAAWW,EAAgB;AAAA,MAC3B,cAAAP;AAAA,MACA,SAAS,CAACQ,GAAcC,MACpB,gBAAAL;AAAA,QAACM;AAAA,QAAA;AAAA,UACG,gBAAa;AAAA,UACb,kBAAkBX,KAAU,CAACG;AAAA,UAC5B,GAAGM;AAAA,UACJ,KAAKC;AAAA,UAEJ,UAAAjB;AAAA,QAAA;AAAA,MACL;AAAA,MAGH,UAAAD;AAAA,IAAA;AAAA,EAAA,EAET,CAAA,EACJ,CAAA;AAER;"}
@@ -0,0 +1,25 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useMemoizedId as m, IconDotsHorizontal16 as e } from "@frontify/fondue";
3
+ import { ToolbarFlyoutMenu as i } from "./ToolbarFlyoutMenu.es.js";
4
+ import { FlyoutToolbarButton as l } from "../FlyoutToolbarButton/FlyoutToolbarButton.es.js";
5
+ const s = "menu", d = ({
6
+ items: n,
7
+ flyoutId: r = s,
8
+ tooltip: u = "Options"
9
+ }) => {
10
+ const t = m(r);
11
+ return /* @__PURE__ */ o(
12
+ l,
13
+ {
14
+ icon: /* @__PURE__ */ o(e, {}),
15
+ tooltip: u,
16
+ flyoutId: t,
17
+ content: /* @__PURE__ */ o(i, { items: n, flyoutId: t })
18
+ }
19
+ );
20
+ };
21
+ export {
22
+ s as DEFAULT_MENU_BUTTON_ID,
23
+ d as MenuToolbarButton
24
+ };
25
+ //# sourceMappingURL=MenuToolbarButton.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuToolbarButton.es.js","sources":["../../../../../src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconDotsHorizontal16, useMemoizedId } from '@frontify/fondue';\nimport { ToolbarFlyoutMenu, ToolbarFlyoutMenuItem } from './ToolbarFlyoutMenu';\nimport { FlyoutToolbarButton } from '../FlyoutToolbarButton/FlyoutToolbarButton';\n\nexport const DEFAULT_MENU_BUTTON_ID = 'menu';\n\nexport type MenuToolbarButtonProps = {\n items: ToolbarFlyoutMenuItem[][];\n flyoutId?: string;\n tooltip?: string;\n};\n\nexport const MenuToolbarButton = ({\n items,\n flyoutId = DEFAULT_MENU_BUTTON_ID,\n tooltip = 'Options',\n}: MenuToolbarButtonProps) => {\n const id = useMemoizedId(flyoutId);\n\n return (\n <FlyoutToolbarButton\n icon={<IconDotsHorizontal16 />}\n tooltip={tooltip}\n flyoutId={id}\n content={<ToolbarFlyoutMenu items={items} flyoutId={id} />}\n />\n );\n};\n"],"names":["DEFAULT_MENU_BUTTON_ID","MenuToolbarButton","items","flyoutId","tooltip","id","useMemoizedId","jsx","FlyoutToolbarButton","IconDotsHorizontal16","ToolbarFlyoutMenu"],"mappings":";;;;AAMO,MAAMA,IAAyB,QAQzBC,IAAoB,CAAC;AAAA,EAC9B,OAAAC;AAAA,EACA,UAAAC,IAAWH;AAAA,EACX,SAAAI,IAAU;AACd,MAA8B;AACpB,QAAAC,IAAKC,EAAcH,CAAQ;AAG7B,SAAA,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,wBAAOC,GAAqB,EAAA;AAAA,MAC5B,SAAAL;AAAA,MACA,UAAUC;AAAA,MACV,SAAS,gBAAAE,EAACG,GAAkB,EAAA,OAAAR,GAAc,UAAUG,GAAI;AAAA,IAAA;AAAA,EAAA;AAGpE;"}
@@ -0,0 +1,29 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { ActionMenu as m, MenuItemContentSize as s } from "@frontify/fondue";
3
+ import { useMultiFlyoutState as u } from "../hooks/useMultiFlyoutState.es.js";
4
+ const d = ({ items: n, flyoutId: i }) => {
5
+ const { onOpenChange: r } = u(i);
6
+ return /* @__PURE__ */ e(
7
+ m,
8
+ {
9
+ menuBlocks: n.map((l, o) => ({
10
+ id: o.toString(),
11
+ menuItems: l.map((t, a) => ({
12
+ id: o.toString() + a.toString(),
13
+ size: s.XSmall,
14
+ title: t.title,
15
+ style: t.style,
16
+ onClick: () => {
17
+ r(!1), t.onClick();
18
+ },
19
+ initialValue: !0,
20
+ decorator: /* @__PURE__ */ e("div", { className: "tw-mr-2", children: t.icon })
21
+ }))
22
+ }))
23
+ }
24
+ );
25
+ };
26
+ export {
27
+ d as ToolbarFlyoutMenu
28
+ };
29
+ //# sourceMappingURL=ToolbarFlyoutMenu.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolbarFlyoutMenu.es.js","sources":["../../../../../src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ActionMenu, MenuItemContentSize, MenuItemStyle } from '@frontify/fondue';\nimport { useMultiFlyoutState } from '../hooks/useMultiFlyoutState';\n\nexport type ToolbarFlyoutMenuItem = {\n title: string;\n onClick: () => void;\n icon: JSX.Element;\n style?: MenuItemStyle;\n};\n\nexport type ToolbarFlyoutMenuProps = {\n items: ToolbarFlyoutMenuItem[][];\n flyoutId: string;\n};\n\nexport const ToolbarFlyoutMenu = ({ items, flyoutId }: ToolbarFlyoutMenuProps) => {\n const { onOpenChange } = useMultiFlyoutState(flyoutId);\n\n return (\n <ActionMenu\n menuBlocks={items.map((block, blockIndex) => ({\n id: blockIndex.toString(),\n menuItems: block.map((item, itemIndex) => ({\n id: blockIndex.toString() + itemIndex.toString(),\n size: MenuItemContentSize.XSmall,\n title: item.title,\n style: item.style,\n onClick: () => {\n onOpenChange(false);\n item.onClick();\n },\n initialValue: true,\n decorator: <div className=\"tw-mr-2\">{item.icon}</div>,\n })),\n }))}\n />\n );\n};\n"],"names":["ToolbarFlyoutMenu","items","flyoutId","onOpenChange","useMultiFlyoutState","jsx","ActionMenu","block","blockIndex","item","itemIndex","MenuItemContentSize"],"mappings":";;;AAiBO,MAAMA,IAAoB,CAAC,EAAE,OAAAC,GAAO,UAAAC,QAAuC;AAC9E,QAAM,EAAE,cAAAC,EAAA,IAAiBC,EAAoBF,CAAQ;AAGjD,SAAA,gBAAAG;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,YAAYL,EAAM,IAAI,CAACM,GAAOC,OAAgB;AAAA,QAC1C,IAAIA,EAAW,SAAS;AAAA,QACxB,WAAWD,EAAM,IAAI,CAACE,GAAMC,OAAe;AAAA,UACvC,IAAIF,EAAW,aAAaE,EAAU,SAAS;AAAA,UAC/C,MAAMC,EAAoB;AAAA,UAC1B,OAAOF,EAAK;AAAA,UACZ,OAAOA,EAAK;AAAA,UACZ,SAAS,MAAM;AACX,YAAAN,EAAa,EAAK,GAClBM,EAAK,QAAQ;AAAA,UACjB;AAAA,UACA,cAAc;AAAA,UACd,WAAY,gBAAAJ,EAAA,OAAA,EAAI,WAAU,WAAW,YAAK,MAAK;AAAA,QAAA,EACjD;AAAA,MAAA,EACJ;AAAA,IAAA;AAAA,EAAA;AAGd;"}
@@ -1,123 +1,22 @@
1
- import { jsxs as p, jsx as e } from "react/jsx-runtime";
2
- import { LegacyTooltip as a, TooltipPosition as s, Flyout as h, IconDotsHorizontal16 as b, ActionMenu as O, MenuItemContentSize as T } from "@frontify/fondue";
3
- import { DEFAULT_DRAGGING_TOOLTIP as v, DEFAULT_DRAG_TOOLTIP as f } from "../constants.es.js";
4
- import { ToolbarSegment as c } from "./ToolbarSegment.es.js";
5
- import { ToolbarAttachments as C } from "./ToolbarAttachments.es.js";
6
- import { getToolbarButtonClassNames as d } from "./helpers.es.js";
7
- const y = ({ items: m, flyoutMenu: r, attachments: l, isDragging: o }) => /* @__PURE__ */ p(
1
+ import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
+ import { ToolbarSegment as r } from "./ToolbarSegment.es.js";
3
+ import { AttachmentsToolbarButton as a } from "./AttachmentsToolbarButton/AttachmentsToolbarButton.es.js";
4
+ import { DragHandleToolbarButton as p } from "./DragHandleToolbarButton/DragHandleToolbarButton.es.js";
5
+ import { MenuToolbarButton as d } from "./MenuToolbarButton/MenuToolbarButton.es.js";
6
+ import { FlyoutToolbarButton as i } from "./FlyoutToolbarButton/FlyoutToolbarButton.es.js";
7
+ import { ToolbarButton as s } from "./ToolbarButton/ToolbarButton.es.js";
8
+ const g = ({ items: e, attachments: l }) => /* @__PURE__ */ n(
8
9
  "div",
9
10
  {
10
11
  "data-test-id": "block-item-wrapper-toolbar",
11
12
  className: "tw-rounded-md tw-bg-base tw-border tw-border-line-strong tw-divide-x tw-divide-line-strong tw-shadow-lg tw-flex tw-flex-none tw-items-center tw-isolate",
12
13
  children: [
13
- l.isEnabled && /* @__PURE__ */ e(c, { children: /* @__PURE__ */ e(
14
- C,
15
- {
16
- isOpen: l.isOpen && !o,
17
- onOpenChange: l.onOpenChange
18
- }
19
- ) }),
20
- /* @__PURE__ */ p(c, { children: [
21
- m.map(
22
- (t, n) => "draggableProps" in t ? /* @__PURE__ */ e(
23
- a,
24
- {
25
- withArrow: !0,
26
- hoverDelay: 0,
27
- enterDelay: 300,
28
- open: o,
29
- position: s.Top,
30
- content: /* @__PURE__ */ e("div", { children: o ? v : t.tooltip ?? f }),
31
- triggerElement: /* @__PURE__ */ e(
32
- "button",
33
- {
34
- ref: t.setActivatorNodeRef,
35
- "data-test-id": "block-item-wrapper-toolbar-btn",
36
- ...t.draggableProps,
37
- className: d("grab", o),
38
- children: t.icon
39
- }
40
- )
41
- },
42
- n
43
- ) : /* @__PURE__ */ e(
44
- a,
45
- {
46
- withArrow: !0,
47
- enterDelay: 300,
48
- hoverDelay: 0,
49
- disabled: o,
50
- position: s.Top,
51
- content: /* @__PURE__ */ e("div", { children: t.tooltip ?? "" }),
52
- triggerElement: /* @__PURE__ */ e(
53
- "button",
54
- {
55
- "data-test-id": "block-item-wrapper-toolbar-btn",
56
- onClick: t.onClick,
57
- className: d("pointer"),
58
- children: t.icon
59
- }
60
- )
61
- },
62
- n
63
- )
64
- ),
65
- r.items.length > 0 && /* @__PURE__ */ e(
66
- a,
67
- {
68
- withArrow: !0,
69
- hoverDelay: 0,
70
- enterDelay: 300,
71
- disabled: o || r.isOpen,
72
- position: s.Top,
73
- content: /* @__PURE__ */ e("div", { children: "Options" }),
74
- triggerElement: /* @__PURE__ */ e("div", { className: "tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative", children: /* @__PURE__ */ e(
75
- h,
76
- {
77
- isOpen: r.isOpen && !o,
78
- legacyFooter: !1,
79
- fitContent: !0,
80
- hug: !1,
81
- onOpenChange: r.onOpenChange,
82
- trigger: /* @__PURE__ */ e(
83
- "div",
84
- {
85
- "data-test-id": "block-item-wrapper-toolbar-flyout",
86
- className: d(
87
- "pointer",
88
- r.isOpen && !o
89
- ),
90
- children: /* @__PURE__ */ e(b, {})
91
- }
92
- ),
93
- children: /* @__PURE__ */ e(
94
- O,
95
- {
96
- menuBlocks: r.items.map((t, n) => ({
97
- id: n.toString(),
98
- menuItems: t.map((i, w) => ({
99
- id: n.toString() + w.toString(),
100
- size: T.XSmall,
101
- title: i.title,
102
- style: i.style,
103
- onClick: () => {
104
- r.onOpenChange(!1), i.onClick();
105
- },
106
- initialValue: !0,
107
- decorator: /* @__PURE__ */ e("div", { className: "tw-mr-2", children: i.icon })
108
- }))
109
- }))
110
- }
111
- )
112
- }
113
- ) })
114
- }
115
- )
116
- ] })
14
+ l.isEnabled && /* @__PURE__ */ t(r, { children: /* @__PURE__ */ t(a, {}) }),
15
+ /* @__PURE__ */ t(r, { children: e.map((o) => o.type === "dragHandle" ? /* @__PURE__ */ t(p, { ...o }, o.tooltip + o.type) : o.type === "menu" ? /* @__PURE__ */ t(d, { ...o }, o.tooltip + o.type) : o.type === "flyout" ? /* @__PURE__ */ t(i, { ...o }, o.tooltip + o.type) : /* @__PURE__ */ t(s, { ...o }, o.tooltip + o.type)) })
117
16
  ]
118
17
  }
119
18
  );
120
19
  export {
121
- y as Toolbar
20
+ g as Toolbar
122
21
  };
123
22
  //# sourceMappingURL=Toolbar.es.js.map