@frontify/guideline-blocks-settings 0.32.0 → 0.32.2

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 (96) hide show
  1. package/CHANGELOG.md +46 -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 +37 -39
  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 +13 -110
  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 +57 -23
  43. package/dist/index.es.js +195 -185
  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 +3 -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.tsx +47 -47
  56. package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.spec.tsx +96 -0
  57. package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.tsx +42 -0
  58. package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.spec.tsx +44 -0
  59. package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.tsx +24 -0
  60. package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/index.ts +3 -0
  61. package/src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.spec.tsx +40 -0
  62. package/src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.tsx +37 -0
  63. package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.spec.tsx +89 -0
  64. package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.tsx +39 -0
  65. package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/index.ts +3 -0
  66. package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.spec.tsx +140 -0
  67. package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.tsx +61 -0
  68. package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/index.ts +3 -0
  69. package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.spec.tsx +77 -0
  70. package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.tsx +30 -0
  71. package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.spec.tsx +63 -0
  72. package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.tsx +40 -0
  73. package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/index.ts +3 -0
  74. package/src/components/BlockItemWrapper/Toolbar/Toolbar.spec.tsx +50 -53
  75. package/src/components/BlockItemWrapper/Toolbar/Toolbar.tsx +24 -126
  76. package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.spec.tsx +70 -0
  77. package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.tsx +19 -0
  78. package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/index.ts +3 -0
  79. package/src/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.tsx +25 -0
  80. package/src/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.tsx +15 -0
  81. package/src/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.tsx +25 -0
  82. package/src/components/BlockItemWrapper/Toolbar/helpers.ts +1 -1
  83. package/src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.spec.tsx +59 -0
  84. package/src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.ts +24 -0
  85. package/src/components/BlockItemWrapper/Toolbar/index.ts +4 -0
  86. package/src/components/BlockItemWrapper/Toolbar/types.ts +8 -27
  87. package/src/helpers/mapColorPalettes.spec.ts +14 -113
  88. package/src/helpers/mapColorPalettes.ts +51 -8
  89. package/src/hooks/useAttachments.spec.tsx +1 -0
  90. package/tsconfig.json +1 -1
  91. package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachments.es.js +0 -27
  92. package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachments.es.js.map +0 -1
  93. package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachmentsTrigger.es.js +0 -12
  94. package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachmentsTrigger.es.js.map +0 -1
  95. package/src/components/BlockItemWrapper/Toolbar/ToolbarAttachments.tsx +0 -29
  96. package/src/components/BlockItemWrapper/Toolbar/ToolbarAttachmentsTrigger.tsx +0 -14
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { describe, expect, it } from 'vitest';
4
4
  import { mapAppBridgeColorPalettesToFonduePalettes } from './mapColorPalettes';
5
+ import { ColorDummy } from '@frontify/app-bridge';
5
6
 
6
7
  describe('mapAppBridgeColorPalettesToFonduePalettes', () => {
7
8
  it('should map app bridge color palette to fondue palette', () => {
@@ -10,107 +11,7 @@ describe('mapAppBridgeColorPalettesToFonduePalettes', () => {
10
11
  id: 19,
11
12
  name: 'Awesome color palette',
12
13
  description: 'This is an awesome color palette',
13
- colors: [
14
- {
15
- id: 6,
16
- name: 'Tarawera',
17
- sort: 1,
18
- nameCss: 'tarawera',
19
- hex: '0b486b',
20
- red: 11,
21
- green: 72,
22
- blue: 107,
23
- alpha: 255,
24
- hue: 202,
25
- saturation: 81,
26
- lightness: 23,
27
- c: 90,
28
- m: 33,
29
- y: 0,
30
- k: 58,
31
- pantone: null,
32
- ral: null,
33
- oracal: null,
34
- pantoneCoated: null,
35
- pantoneUncoated: null,
36
- cmykCoated: null,
37
- cmykUncoated: null,
38
- cmykNewspaper: null,
39
- ncs: null,
40
- pantoneCp: null,
41
- pantonePlastics: null,
42
- pantoneTextile: null,
43
- hks: null,
44
- threeM: null,
45
- lab: null,
46
- },
47
- {
48
- id: 7,
49
- name: 'Oracle',
50
- sort: 2,
51
- nameCss: 'oracle',
52
- hex: '3b8686',
53
- red: 59,
54
- green: 134,
55
- blue: 134,
56
- alpha: 255,
57
- hue: 180,
58
- saturation: 39,
59
- lightness: 38,
60
- c: 56,
61
- m: 0,
62
- y: 0,
63
- k: 47,
64
- pantone: null,
65
- ral: null,
66
- oracal: null,
67
- pantoneCoated: null,
68
- pantoneUncoated: null,
69
- cmykCoated: null,
70
- cmykUncoated: null,
71
- cmykNewspaper: null,
72
- ncs: null,
73
- pantoneCp: null,
74
- pantonePlastics: null,
75
- pantoneTextile: null,
76
- hks: null,
77
- threeM: null,
78
- lab: null,
79
- },
80
- {
81
- id: 8,
82
- name: 'Silver Tree',
83
- sort: 3,
84
- nameCss: 'silver-tree',
85
- hex: '79bd9a',
86
- red: 121,
87
- green: 189,
88
- blue: 154,
89
- alpha: 255,
90
- hue: 149,
91
- saturation: 34,
92
- lightness: 61,
93
- c: 36,
94
- m: 0,
95
- y: 19,
96
- k: 26,
97
- pantone: null,
98
- ral: null,
99
- oracal: null,
100
- pantoneCoated: null,
101
- pantoneUncoated: null,
102
- cmykCoated: null,
103
- cmykUncoated: null,
104
- cmykNewspaper: null,
105
- ncs: null,
106
- pantoneCp: null,
107
- pantonePlastics: null,
108
- pantoneTextile: null,
109
- hks: null,
110
- threeM: null,
111
- lab: null,
112
- },
113
- ],
14
+ colors: [ColorDummy.green(), ColorDummy.yellow(), ColorDummy.red()],
114
15
  },
115
16
  ]);
116
17
  expect(result).toEqual([
@@ -120,24 +21,24 @@ describe('mapAppBridgeColorPalettesToFonduePalettes', () => {
120
21
  colors: [
121
22
  {
122
23
  alpha: 1,
123
- red: 11,
124
- green: 72,
125
- blue: 107,
126
- name: 'Tarawera',
24
+ blue: 0,
25
+ green: 255,
26
+ red: 0,
27
+ name: 'Green',
127
28
  },
128
29
  {
129
30
  alpha: 1,
130
- red: 59,
131
- green: 134,
132
- blue: 134,
133
- name: 'Oracle',
31
+ blue: 0,
32
+ green: 255,
33
+ red: 255,
34
+ name: 'Yellow',
134
35
  },
135
36
  {
136
37
  alpha: 1,
137
- red: 121,
138
- green: 189,
139
- blue: 154,
140
- name: 'Silver Tree',
38
+ blue: 0,
39
+ green: 0,
40
+ red: 255,
41
+ name: 'Red',
141
42
  },
142
43
  ],
143
44
  },
@@ -3,20 +3,63 @@
3
3
  import { ColorPalette } from '@frontify/app-bridge';
4
4
  import { Palette } from '@frontify/fondue';
5
5
 
6
+ type Nullable<T> = T | null;
7
+
8
+ type V3Color = {
9
+ id: number;
10
+ name: Nullable<string>;
11
+ red: Nullable<number>;
12
+ green: Nullable<number>;
13
+ blue: Nullable<number>;
14
+ alpha: Nullable<number>;
15
+ };
16
+
17
+ type V4Color = {
18
+ id: number;
19
+ title: Nullable<string>;
20
+ revision: {
21
+ rgba: {
22
+ red: Nullable<number>;
23
+ green: Nullable<number>;
24
+ blue: Nullable<number>;
25
+ alpha: Nullable<number>;
26
+ };
27
+ };
28
+ };
29
+
30
+ type Color = V3Color | V4Color;
31
+
6
32
  export const mapAppBridgeColorPalettesToFonduePalettes = (colorPalettes: ColorPalette[]): Palette[] => {
7
33
  return colorPalettes.map(mapAppBridgeColorPaletteToFonduePalette);
8
34
  };
9
-
10
35
  export const mapAppBridgeColorPaletteToFonduePalette = (colorPalette: ColorPalette): Palette => {
11
36
  return {
12
37
  id: colorPalette.id,
13
38
  title: colorPalette.name,
14
- colors: colorPalette.colors.map((color) => ({
15
- alpha: color.alpha ? color.alpha / 255 : 1,
16
- red: color.red ?? 0,
17
- green: color.green ?? 0,
18
- blue: color.blue ?? 0,
19
- name: color.name ?? '',
20
- })),
39
+ colors: colorPalette.colors.map(mapColor),
40
+ };
41
+ };
42
+
43
+ const isV4Color = (color: Color): color is V4Color => {
44
+ return 'revision' in color;
45
+ };
46
+
47
+ const mapColor = (color: Color) => {
48
+ if (isV4Color(color)) {
49
+ const { title, revision } = color;
50
+ return {
51
+ alpha: revision.rgba.alpha ? revision.rgba.alpha / 255 : 1,
52
+ red: revision.rgba.red ?? 0,
53
+ green: revision.rgba.green ?? 0,
54
+ blue: revision.rgba.blue ?? 0,
55
+ name: title ?? '',
56
+ };
57
+ }
58
+ return {
59
+ alpha: color.alpha ? color.alpha / 255 : 1,
60
+ red: color.red ?? 0,
61
+ green: color.green ?? 0,
62
+ blue: color.blue ?? 0,
63
+ name: color.name ?? '',
21
64
  };
22
65
  };
@@ -26,6 +26,7 @@ describe('useAttachments', async () => {
26
26
  const STUB_WITH_THREE_ASSETS = getAppBridgeBlockStub({
27
27
  blockId: 2,
28
28
  blockAssets: { [MOCK_SETTINGS_ID]: [AssetDummy.with(1), AssetDummy.with(2), AssetDummy.with(3)] },
29
+ editorState: true,
29
30
  });
30
31
  const { result } = renderHook(() => useAttachments(STUB_WITH_THREE_ASSETS, MOCK_SETTINGS_ID));
31
32
 
package/tsconfig.json CHANGED
@@ -22,6 +22,6 @@
22
22
  "skipLibCheck": true,
23
23
  "types": ["cypress", "node", "cypress-real-events"]
24
24
  },
25
- "include": ["src/**/*"],
25
+ "include": ["src/**/*", "./setupTests.ts"],
26
26
  "exclude": ["node_modules", "dist"]
27
27
  }
@@ -1,27 +0,0 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { ToolbarAttachmentsTrigger as p } from "./ToolbarAttachmentsTrigger.es.js";
3
- import { useAttachmentsContext as h } from "../../../hooks/useAttachments.es.js";
4
- import { Attachments as i } from "../../Attachments/Attachments.es.js";
5
- const f = ({ isOpen: o, onOpenChange: n }) => {
6
- const { appBridge: r, attachments: m, onAttachmentsAdd: t, onAttachmentDelete: a, onAttachmentReplace: e, onAttachmentsSorted: c } = h();
7
- return /* @__PURE__ */ s(
8
- i,
9
- {
10
- onUpload: t,
11
- onDelete: a,
12
- onReplaceWithBrowse: e,
13
- onReplaceWithUpload: e,
14
- onSorted: c,
15
- onBrowse: t,
16
- items: m,
17
- appBridge: r,
18
- triggerComponent: p,
19
- isOpen: o,
20
- onOpenChange: n
21
- }
22
- );
23
- };
24
- export {
25
- f as ToolbarAttachments
26
- };
27
- //# sourceMappingURL=ToolbarAttachments.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToolbarAttachments.es.js","sources":["../../../../src/components/BlockItemWrapper/Toolbar/ToolbarAttachments.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Attachments } from '../../Attachments';\nimport { useAttachmentsContext } from '../../../hooks';\n\nimport { type ToolbarFlyoutState } from './types';\n\nimport { ToolbarAttachmentsTrigger } from './ToolbarAttachmentsTrigger';\n\nexport const ToolbarAttachments = ({ isOpen, onOpenChange }: ToolbarFlyoutState) => {\n const { appBridge, attachments, onAttachmentsAdd, onAttachmentDelete, onAttachmentReplace, onAttachmentsSorted } =\n useAttachmentsContext();\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={ToolbarAttachmentsTrigger}\n isOpen={isOpen}\n onOpenChange={onOpenChange}\n />\n );\n};\n"],"names":["ToolbarAttachments","isOpen","onOpenChange","appBridge","attachments","onAttachmentsAdd","onAttachmentDelete","onAttachmentReplace","onAttachmentsSorted","useAttachmentsContext","jsx","Attachments","ToolbarAttachmentsTrigger"],"mappings":";;;;AASO,MAAMA,IAAqB,CAAC,EAAE,QAAAC,GAAQ,cAAAC,QAAuC;AAC1E,QAAA,EAAE,WAAAC,GAAW,aAAAC,GAAa,kBAAAC,GAAkB,oBAAAC,GAAoB,qBAAAC,GAAqB,qBAAAC,MACvFC;AAGA,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,UAAUN;AAAA,MACV,UAAUC;AAAA,MACV,qBAAqBC;AAAA,MACrB,qBAAqBA;AAAA,MACrB,UAAUC;AAAA,MACV,UAAUH;AAAA,MACV,OAAOD;AAAA,MACP,WAAAD;AAAA,MACA,kBAAkBS;AAAA,MAClB,QAAAX;AAAA,MACA,cAAAC;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
@@ -1,12 +0,0 @@
1
- import { jsxs as e, jsx as o } from "react/jsx-runtime";
2
- import { IconPaperclip16 as s, IconCaretDown12 as a } from "@frontify/fondue";
3
- import { getToolbarButtonClassNames as m } from "./helpers.es.js";
4
- const p = ({ children: r, isFlyoutOpen: t }) => /* @__PURE__ */ e("div", { className: m("pointer", t), children: [
5
- /* @__PURE__ */ o(s, {}),
6
- r,
7
- /* @__PURE__ */ o(a, {})
8
- ] });
9
- export {
10
- p as ToolbarAttachmentsTrigger
11
- };
12
- //# sourceMappingURL=ToolbarAttachmentsTrigger.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToolbarAttachmentsTrigger.es.js","sources":["../../../../src/components/BlockItemWrapper/Toolbar/ToolbarAttachmentsTrigger.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown12, IconPaperclip16 } from '@frontify/fondue';\nimport { type AttachmentsTriggerProps } from '../../Attachments/types';\n\nimport { getToolbarButtonClassNames } from './helpers';\n\nexport const ToolbarAttachmentsTrigger = ({ children, isFlyoutOpen }: AttachmentsTriggerProps) => (\n <div className={getToolbarButtonClassNames('pointer', isFlyoutOpen)}>\n <IconPaperclip16 />\n {children}\n <IconCaretDown12 />\n </div>\n);\n"],"names":["ToolbarAttachmentsTrigger","children","isFlyoutOpen","jsxs","getToolbarButtonClassNames","jsx","IconPaperclip16","IconCaretDown12"],"mappings":";;;AAOO,MAAMA,IAA4B,CAAC,EAAE,UAAAC,GAAU,cAAAC,EAAa,MAC9D,gBAAAC,EAAA,OAAA,EAAI,WAAWC,EAA2B,WAAWF,CAAY,GAC9D,UAAA;AAAA,EAAA,gBAAAG,EAACC,GAAgB,EAAA;AAAA,EAChBL;AAAA,oBACAM,GAAgB,EAAA;AAAA,EACrB,CAAA;"}
@@ -1,29 +0,0 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
- import { Attachments } from '../../Attachments';
4
- import { useAttachmentsContext } from '../../../hooks';
5
-
6
- import { type ToolbarFlyoutState } from './types';
7
-
8
- import { ToolbarAttachmentsTrigger } from './ToolbarAttachmentsTrigger';
9
-
10
- export const ToolbarAttachments = ({ isOpen, onOpenChange }: ToolbarFlyoutState) => {
11
- const { appBridge, attachments, onAttachmentsAdd, onAttachmentDelete, onAttachmentReplace, onAttachmentsSorted } =
12
- useAttachmentsContext();
13
-
14
- return (
15
- <Attachments
16
- onUpload={onAttachmentsAdd}
17
- onDelete={onAttachmentDelete}
18
- onReplaceWithBrowse={onAttachmentReplace}
19
- onReplaceWithUpload={onAttachmentReplace}
20
- onSorted={onAttachmentsSorted}
21
- onBrowse={onAttachmentsAdd}
22
- items={attachments}
23
- appBridge={appBridge}
24
- triggerComponent={ToolbarAttachmentsTrigger}
25
- isOpen={isOpen}
26
- onOpenChange={onOpenChange}
27
- />
28
- );
29
- };
@@ -1,14 +0,0 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
- import { IconCaretDown12, IconPaperclip16 } from '@frontify/fondue';
4
- import { type AttachmentsTriggerProps } from '../../Attachments/types';
5
-
6
- import { getToolbarButtonClassNames } from './helpers';
7
-
8
- export const ToolbarAttachmentsTrigger = ({ children, isFlyoutOpen }: AttachmentsTriggerProps) => (
9
- <div className={getToolbarButtonClassNames('pointer', isFlyoutOpen)}>
10
- <IconPaperclip16 />
11
- {children}
12
- <IconCaretDown12 />
13
- </div>
14
- );