@frontify/guideline-blocks-settings 1.0.13-alpha.4 → 1.0.13-alpha.6

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.
@@ -1,43 +1,43 @@
1
1
  import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
2
  import { useSortable as C } from "@dnd-kit/sortable";
3
3
  import { useFileInput as R, useAssetUpload as A } from "@frontify/app-bridge";
4
- import { IconGrabHandle20 as j, FOCUS_STYLE as D, IconImage24 as E, IconPlayFrame24 as G, IconMusicNote24 as T, IconDocument24 as U } from "@frontify/fondue";
5
- import { LoadingCircle as $, Dropdown as a, Button as L } from "@frontify/fondue/components";
6
- import { IconPen as B, IconArrowCircleUp as H, IconImageStack as M, IconTrashBin as O } from "@frontify/fondue/icons";
4
+ import { FOCUS_STYLE as j } from "@frontify/fondue";
5
+ import { LoadingCircle as D, Dropdown as a, Button as E } from "@frontify/fondue/components";
6
+ import { IconGrabHandle as G, IconPen as T, IconArrowCircleUp as U, IconImageStack as $, IconTrashBin as L, IconImage as B, IconPlayFrame as H, IconMusicNote as M, IconDocument as O } from "@frontify/fondue/icons";
7
7
  import { useFocusRing as V } from "@react-aria/focus";
8
8
  import { forwardRef as q, useState as Y, useEffect as y } from "react";
9
9
  import { joinClassNames as g } from "../../utilities/react/joinClassNames.es.js";
10
- const _ = (o) => o === "IMAGE" ? /* @__PURE__ */ e(E, {}) : o === "VIDEO" ? /* @__PURE__ */ e(G, {}) : o === "AUDIO" ? /* @__PURE__ */ e(T, {}) : /* @__PURE__ */ e(U, {}), S = q(
10
+ const _ = (o) => o === "IMAGE" ? /* @__PURE__ */ e(B, { size: "24" }) : o === "VIDEO" ? /* @__PURE__ */ e(H, { size: "24" }) : o === "AUDIO" ? /* @__PURE__ */ e(M, { size: "24" }) : /* @__PURE__ */ e(O, { size: "24" }), z = q(
11
11
  ({
12
12
  item: o,
13
13
  isEditing: u,
14
14
  draggableProps: w,
15
15
  transformStyle: p,
16
16
  isDragging: i,
17
- isOverlay: s,
17
+ isOverlay: n,
18
18
  isLoading: c,
19
19
  onDelete: m,
20
20
  onReplaceWithBrowse: h,
21
- onReplaceWithUpload: N,
21
+ onReplaceWithUpload: S,
22
22
  onDownload: b
23
23
  }, x) => {
24
- const [n, l] = Y(), [k, { selectedFiles: d }] = R({ multiple: !0, accept: "image/*" }), [F, { results: I, doneAll: f }] = A(), { focusProps: P, isFocusVisible: v } = V();
24
+ const [s, l] = Y(), [N, { selectedFiles: d }] = R({ multiple: !0, accept: "image/*" }), [k, { results: I, doneAll: f }] = A(), { focusProps: F, isFocusVisible: v } = V();
25
25
  y(() => {
26
- d && F(d[0]);
26
+ d && k(d[0]);
27
27
  }, [d]), y(() => {
28
- f && N(I[0]);
28
+ f && S(I[0]);
29
29
  }, [f, I]);
30
- const z = c || d && !f;
30
+ const P = c || d && !f;
31
31
  return /* @__PURE__ */ r(
32
32
  "button",
33
33
  {
34
34
  "aria-label": "Download attachment",
35
35
  "data-test-id": "attachments-item",
36
- onClick: () => !n && (b == null ? void 0 : b()),
36
+ onClick: () => !s && (b == null ? void 0 : b()),
37
37
  ref: x,
38
38
  style: {
39
39
  ...p,
40
- opacity: i && !s ? 0.3 : 1,
40
+ opacity: i && !n ? 0.3 : 1,
41
41
  fontFamily: "var(-f-theme-settings-body-font-family)"
42
42
  },
43
43
  className: g([
@@ -45,7 +45,7 @@ const _ = (o) => o === "IMAGE" ? /* @__PURE__ */ e(E, {}) : o === "VIDEO" ? /* @
45
45
  i ? "tw-bg-box-neutral-hover" : ""
46
46
  ]),
47
47
  children: [
48
- /* @__PURE__ */ e("div", { className: "tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover", children: z ? /* @__PURE__ */ e($, { size: "small" }) : _(o.objectType) }),
48
+ /* @__PURE__ */ e("div", { className: "tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover", children: P ? /* @__PURE__ */ e(D, { size: "small" }) : _(o.objectType) }),
49
49
  /* @__PURE__ */ r("div", { className: "tw-text-s tw-flex-1 tw-min-w-0", children: [
50
50
  /* @__PURE__ */ e("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: o.title }),
51
51
  /* @__PURE__ */ e("div", { className: "tw-text-text-weak", children: `${o.fileSizeHumanReadable} - ${o.extension}` })
@@ -56,32 +56,32 @@ const _ = (o) => o === "IMAGE" ? /* @__PURE__ */ e(E, {}) : o === "VIDEO" ? /* @
56
56
  "data-test-id": "attachments-actionbar",
57
57
  className: g([
58
58
  "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",
59
- s || (n == null ? void 0 : n.id) === o.id ? "tw-opacity-100" : "tw-opacity-0"
59
+ n || (s == null ? void 0 : s.id) === o.id ? "tw-opacity-100" : "tw-opacity-0"
60
60
  ]),
61
61
  children: [
62
62
  /* @__PURE__ */ e(
63
63
  "button",
64
64
  {
65
- ...P,
65
+ ...F,
66
66
  ...w,
67
67
  "aria-label": "Drag attachment",
68
68
  className: g([
69
69
  " 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 ",
70
- i || s ? "tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed" : "tw-cursor-grab hover:tw-bg-button-background-hover",
71
- v && D,
70
+ i || n ? "tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed" : "tw-cursor-grab hover:tw-bg-button-background-hover",
71
+ v && j,
72
72
  v && "tw-z-[2]"
73
73
  ]),
74
- children: /* @__PURE__ */ e(j, {})
74
+ children: /* @__PURE__ */ e(G, {})
75
75
  }
76
76
  ),
77
77
  /* @__PURE__ */ e("div", { "data-test-id": "attachments-actionbar-flyout", children: /* @__PURE__ */ r(
78
78
  a.Root,
79
79
  {
80
- open: (n == null ? void 0 : n.id) === o.id,
80
+ open: (s == null ? void 0 : s.id) === o.id,
81
81
  onOpenChange: (t) => l(t ? o : void 0),
82
82
  children: [
83
83
  /* @__PURE__ */ e(a.Trigger, { children: /* @__PURE__ */ e(
84
- L,
84
+ E,
85
85
  {
86
86
  aspect: "square",
87
87
  ref: x,
@@ -89,7 +89,7 @@ const _ = (o) => o === "IMAGE" ? /* @__PURE__ */ e(E, {}) : o === "VIDEO" ? /* @
89
89
  t == null || t.stopPropagation(), t == null || t.preventDefault();
90
90
  },
91
91
  emphasis: "default",
92
- children: /* @__PURE__ */ e(B, { size: "20" })
92
+ children: /* @__PURE__ */ e(T, { size: "20" })
93
93
  }
94
94
  ) }),
95
95
  /* @__PURE__ */ r(a.Content, { side: "right", children: [
@@ -99,10 +99,10 @@ const _ = (o) => o === "IMAGE" ? /* @__PURE__ */ e(E, {}) : o === "VIDEO" ? /* @
99
99
  {
100
100
  "data-test-id": "menu-item",
101
101
  onSelect: (t) => {
102
- t == null || t.stopPropagation(), k(), l(void 0);
102
+ t == null || t.stopPropagation(), N(), l(void 0);
103
103
  },
104
104
  children: [
105
- /* @__PURE__ */ e(H, { size: "20" }),
105
+ /* @__PURE__ */ e(U, { size: "20" }),
106
106
  "Replace with upload"
107
107
  ]
108
108
  }
@@ -114,7 +114,7 @@ const _ = (o) => o === "IMAGE" ? /* @__PURE__ */ e(E, {}) : o === "VIDEO" ? /* @
114
114
  t == null || t.stopPropagation(), h(), l(void 0);
115
115
  },
116
116
  children: [
117
- /* @__PURE__ */ e(M, { size: "20" }),
117
+ /* @__PURE__ */ e($, { size: "20" }),
118
118
  "Replace with asset"
119
119
  ]
120
120
  }
@@ -128,7 +128,7 @@ const _ = (o) => o === "IMAGE" ? /* @__PURE__ */ e(E, {}) : o === "VIDEO" ? /* @
128
128
  t == null || t.stopPropagation(), m(), l(void 0);
129
129
  },
130
130
  children: [
131
- /* @__PURE__ */ e(O, { size: "20" }),
131
+ /* @__PURE__ */ e(L, { size: "20" }),
132
132
  "Delete"
133
133
  ]
134
134
  }
@@ -145,17 +145,17 @@ const _ = (o) => o === "IMAGE" ? /* @__PURE__ */ e(E, {}) : o === "VIDEO" ? /* @
145
145
  );
146
146
  }
147
147
  );
148
- S.displayName = "AttachmentItem";
148
+ z.displayName = "AttachmentItem";
149
149
  const rt = (o) => {
150
- const { attributes: u, listeners: w, setNodeRef: p, transform: i, transition: s, isDragging: c } = C({
150
+ const { attributes: u, listeners: w, setNodeRef: p, transform: i, transition: n, isDragging: c } = C({
151
151
  id: o.item.id
152
152
  }), m = {
153
153
  transform: i ? `translate(${i.x}px, ${i.y}px)` : "",
154
- transition: s,
154
+ transition: n,
155
155
  zIndex: c ? 2 : 1
156
156
  }, h = { ...u, ...w };
157
157
  return /* @__PURE__ */ e(
158
- S,
158
+ z,
159
159
  {
160
160
  ref: p,
161
161
  isDragging: c,
@@ -166,7 +166,7 @@ const rt = (o) => {
166
166
  );
167
167
  };
168
168
  export {
169
- S as AttachmentItem,
169
+ z as AttachmentItem,
170
170
  rt as SortableAttachmentItem
171
171
  };
172
172
  //# 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 { useSortable } from '@dnd-kit/sortable';\nimport { type Asset, useAssetUpload, useFileInput } from '@frontify/app-bridge';\nimport {\n FOCUS_STYLE,\n IconDocument24,\n IconGrabHandle20,\n IconImage24,\n IconMusicNote24,\n IconPlayFrame24,\n} from '@frontify/fondue';\nimport { LoadingCircle, Dropdown, Button } from '@frontify/fondue/components';\nimport { IconArrowCircleUp, IconImageStack, IconPen, IconTrashBin } from '@frontify/fondue/icons';\nimport { useFocusRing } from '@react-aria/focus';\nimport { type MutableRefObject, forwardRef, useEffect, useState } from 'react';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { type AttachmentItemProps, type SortableAttachmentItemProps } from './types';\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 onDownload,\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\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 showLoadingCircle = isLoading || (selectedFiles && !doneAll);\n\n return (\n <button\n aria-label=\"Download attachment\"\n data-test-id=\"attachments-item\"\n onClick={() => !selectedAsset && onDownload?.()}\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 ? <LoadingCircle size=\"small\" /> : getDecorator(item.objectType)}\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 <Dropdown.Root\n open={selectedAsset?.id === item.id}\n onOpenChange={(isOpen) => setSelectedAsset(isOpen ? item : undefined)}\n >\n <Dropdown.Trigger>\n <Button\n aspect=\"square\"\n ref={ref as MutableRefObject<HTMLButtonElement>}\n onPress={(e) => {\n e?.stopPropagation();\n e?.preventDefault();\n }}\n emphasis=\"default\"\n >\n <IconPen size=\"20\" />\n </Button>\n </Dropdown.Trigger>\n <Dropdown.Content side=\"right\">\n <Dropdown.Group>\n <Dropdown.Item\n data-test-id=\"menu-item\"\n onSelect={(event) => {\n event?.stopPropagation();\n openFileDialog();\n setSelectedAsset(undefined);\n }}\n >\n <IconArrowCircleUp size=\"20\" />\n Replace with upload\n </Dropdown.Item>\n <Dropdown.Item\n onSelect={(event) => {\n event?.stopPropagation();\n onReplaceWithBrowse();\n setSelectedAsset(undefined);\n }}\n >\n <IconImageStack size=\"20\" />\n Replace with asset\n </Dropdown.Item>\n </Dropdown.Group>\n <Dropdown.Group>\n <Dropdown.Item\n emphasis=\"danger\"\n onSelect={(event) => {\n event?.stopPropagation();\n onDelete();\n setSelectedAsset(undefined);\n }}\n >\n <IconTrashBin size=\"20\" />\n Delete\n </Dropdown.Item>\n </Dropdown.Group>\n </Dropdown.Content>\n </Dropdown.Root>\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","onDownload","ref","selectedAsset","setSelectedAsset","useState","openFileDialog","selectedFiles","useFileInput","uploadFile","uploadResults","doneAll","useAssetUpload","focusProps","isFocusVisible","useFocusRing","useEffect","showLoadingCircle","jsxs","joinClassNames","jsx","LoadingCircle","FOCUS_STYLE","IconGrabHandle20","Dropdown","isOpen","Button","e","IconPen","event","IconArrowCircleUp","IconImageStack","IconTrashBin","SortableAttachmentItem","props","attributes","listeners","setNodeRef","transform","transition","useSortable"],"mappings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U;AACjB,8BAAAA,KAAA,QAAAA,EAAO,mBACP/B,EAAA,GACAM,EAAiB,MAAS;AAAA,4BAC9B;AAAA,4BAEA,UAAA;AAAA,8BAAA,gBAAAgB,EAACY,GAAA,EAAa,MAAK,KAAA,CAAK;AAAA,8BAAE;AAAA,4BAAA;AAAA,0BAAA;AAAA,wBAAA,EAE9B,CACJ;AAAA,sBAAA,EAAA,CACJ;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAAA,EACJ,CACJ;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAIhB;AACJ;AAEA3C,EAAe,cAAc;AAEtB,MAAM4C,KAAyB,CAACC,MAAuC;AAC1E,QAAM,EAAE,YAAAC,GAAY,WAAAC,GAAW,YAAAC,GAAY,WAAAC,GAAW,YAAAC,GAAY,YAAA5C,EAAA,IAAe6C,EAAY;AAAA,IACzF,IAAIN,EAAM,KAAK;AAAA,EAAA,CAClB,GAEKxC,IAAiB;AAAA,IACnB,WAAW4C,IAAY,aAAaA,EAAU,CAAC,OAAOA,EAAU,CAAC,QAAQ;AAAA,IACzE,YAAAC;AAAA,IACA,QAAQ5C,IAAa,IAAI;AAAA,EAAA,GAGvBF,IAAiB,EAAE,GAAG0C,GAAY,GAAGC,EAAA;AAE3C,SACI,gBAAAhB;AAAA,IAAC/B;AAAA,IAAA;AAAA,MACG,KAAKgD;AAAA,MACL,YAAA1C;AAAA,MACA,gBAAAD;AAAA,MACA,gBAAAD;AAAA,MACC,GAAGyC;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 { useSortable } from '@dnd-kit/sortable';\nimport { type Asset, useAssetUpload, useFileInput } from '@frontify/app-bridge';\nimport { FOCUS_STYLE } from '@frontify/fondue';\nimport { LoadingCircle, Dropdown, Button } from '@frontify/fondue/components';\nimport {\n IconArrowCircleUp,\n IconImageStack,\n IconPen,\n IconTrashBin,\n IconDocument,\n IconImage,\n IconPlayFrame,\n IconMusicNote,\n IconGrabHandle,\n} from '@frontify/fondue/icons';\nimport { useFocusRing } from '@react-aria/focus';\nimport { type MutableRefObject, forwardRef, useEffect, useState } from 'react';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { type AttachmentItemProps, type SortableAttachmentItemProps } from './types';\n\nconst getDecorator = (type: string) => {\n if (type === 'IMAGE') {\n return <IconImage size=\"24\" />;\n } else if (type === 'VIDEO') {\n return <IconPlayFrame size=\"24\" />;\n } else if (type === 'AUDIO') {\n return <IconMusicNote size=\"24\" />;\n } else {\n return <IconDocument size=\"24\" />;\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 onDownload,\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\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 showLoadingCircle = isLoading || (selectedFiles && !doneAll);\n\n return (\n <button\n aria-label=\"Download attachment\"\n data-test-id=\"attachments-item\"\n onClick={() => !selectedAsset && onDownload?.()}\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 ? <LoadingCircle size=\"small\" /> : getDecorator(item.objectType)}\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 <IconGrabHandle />\n </button>\n <div data-test-id=\"attachments-actionbar-flyout\">\n <Dropdown.Root\n open={selectedAsset?.id === item.id}\n onOpenChange={(isOpen) => setSelectedAsset(isOpen ? item : undefined)}\n >\n <Dropdown.Trigger>\n <Button\n aspect=\"square\"\n ref={ref as MutableRefObject<HTMLButtonElement>}\n onPress={(e) => {\n e?.stopPropagation();\n e?.preventDefault();\n }}\n emphasis=\"default\"\n >\n <IconPen size=\"20\" />\n </Button>\n </Dropdown.Trigger>\n <Dropdown.Content side=\"right\">\n <Dropdown.Group>\n <Dropdown.Item\n data-test-id=\"menu-item\"\n onSelect={(event) => {\n event?.stopPropagation();\n openFileDialog();\n setSelectedAsset(undefined);\n }}\n >\n <IconArrowCircleUp size=\"20\" />\n Replace with upload\n </Dropdown.Item>\n <Dropdown.Item\n onSelect={(event) => {\n event?.stopPropagation();\n onReplaceWithBrowse();\n setSelectedAsset(undefined);\n }}\n >\n <IconImageStack size=\"20\" />\n Replace with asset\n </Dropdown.Item>\n </Dropdown.Group>\n <Dropdown.Group>\n <Dropdown.Item\n emphasis=\"danger\"\n onSelect={(event) => {\n event?.stopPropagation();\n onDelete();\n setSelectedAsset(undefined);\n }}\n >\n <IconTrashBin size=\"20\" />\n Delete\n </Dropdown.Item>\n </Dropdown.Group>\n </Dropdown.Content>\n </Dropdown.Root>\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","jsx","IconImage","IconPlayFrame","IconMusicNote","IconDocument","AttachmentItem","forwardRef","item","isEditing","draggableProps","transformStyle","isDragging","isOverlay","isLoading","onDelete","onReplaceWithBrowse","onReplaceWithUpload","onDownload","ref","selectedAsset","setSelectedAsset","useState","openFileDialog","selectedFiles","useFileInput","uploadFile","uploadResults","doneAll","useAssetUpload","focusProps","isFocusVisible","useFocusRing","useEffect","showLoadingCircle","jsxs","joinClassNames","LoadingCircle","FOCUS_STYLE","IconGrabHandle","Dropdown","isOpen","Button","e","IconPen","event","IconArrowCircleUp","IconImageStack","IconTrashBin","SortableAttachmentItem","props","attributes","listeners","setNodeRef","transform","transition","useSortable"],"mappings":";;;;;;;;;AAwBA,MAAMA,IAAe,CAACC,MACdA,MAAS,UACF,gBAAAC,EAACC,GAAA,EAAU,MAAK,KAAA,CAAK,IACrBF,MAAS,UACT,gBAAAC,EAACE,GAAA,EAAc,MAAK,KAAA,CAAK,IACzBH,MAAS,UACT,gBAAAC,EAACG,GAAA,EAAc,MAAK,KAAA,CAAK,IAEzB,gBAAAH,EAACI,GAAA,EAAa,MAAK,KAAA,CAAK,GAI1BC,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,IACA,YAAAC;AAAA,EAAA,GAEJC,MACC;AACD,UAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAA,GACpC,CAACC,GAAgB,EAAE,eAAAC,EAAA,CAAe,IAAIC,EAAa,EAAE,UAAU,IAAM,QAAQ,WAAW,GACxF,CAACC,GAAY,EAAE,SAASC,GAAe,SAAAC,EAAA,CAAS,IAAIC,EAAA,GAEpD,EAAE,YAAAC,GAAY,gBAAAC,EAAA,IAAmBC,EAAA;AAEvC,IAAAC,EAAU,MAAM;AACZ,MAAIT,KACAE,EAAWF,EAAc,CAAC,CAAC;AAAA,IAGnC,GAAG,CAACA,CAAa,CAAC,GAElBS,EAAU,MAAM;AACZ,MAAIL,KACAX,EAAoBU,EAAc,CAAC,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nD;AAAA,IAACK;AAAA,IAAA;AAAA,MACG,KAAK+C;AAAA,MACL,YAAAzC;AAAA,MACA,gBAAAD;AAAA,MACA,gBAAAD;AAAA,MACC,GAAGwC;AAAA,IAAA;AAAA,EAAA;AAGhB;"}
@@ -1,5 +1,5 @@
1
1
  import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
- import { IconPaperclip16 as a, IconCaretDown12 as i } from "@frontify/fondue";
2
+ import { IconPaperclip as a, IconCaretDown as i } from "@frontify/fondue/icons";
3
3
  import { forwardRef as w } from "react";
4
4
  import { joinClassNames as l } from "../../utilities/react/joinClassNames.es.js";
5
5
  const u = w(
@@ -14,9 +14,9 @@ const u = w(
14
14
  "data-test-id": "attachments-button-trigger",
15
15
  ...o,
16
16
  children: [
17
- /* @__PURE__ */ t(a, {}),
17
+ /* @__PURE__ */ t(a, { size: "16" }),
18
18
  e,
19
- /* @__PURE__ */ t(i, {})
19
+ /* @__PURE__ */ t(i, { size: "12" })
20
20
  ]
21
21
  }
22
22
  )
@@ -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';\nimport { forwardRef } from 'react';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { type AttachmentsTriggerProps } from './types';\n\nexport const AttachmentsButtonTrigger = forwardRef<HTMLButtonElement, AttachmentsTriggerProps>(\n ({ children, isFlyoutOpen, ...props }, ref) => (\n <button\n ref={ref}\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 data-test-id=\"attachments-button-trigger\"\n {...props}\n >\n <IconPaperclip16 />\n {children}\n <IconCaretDown12 />\n </button>\n ),\n);\n\nAttachmentsButtonTrigger.displayName = 'AttachmentsButtonTrigger';\n"],"names":["AttachmentsButtonTrigger","forwardRef","children","isFlyoutOpen","props","ref","jsxs","joinClassNames","jsx","IconPaperclip16","IconCaretDown12"],"mappings":";;;;AASO,MAAMA,IAA2BC;AAAA,EACpC,CAAC,EAAE,UAAAC,GAAU,cAAAC,GAAc,GAAGC,EAAA,GAASC,MACnC,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAAD;AAAA,MACA,WAAWE,EAAe;AAAA,QACtB;AAAA,QACAJ,IACM,kEACA;AAAA,MAAA,CACT;AAAA,MACD,gBAAa;AAAA,MACZ,GAAGC;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAI,EAACC,GAAA,EAAgB;AAAA,QAChBP;AAAA,0BACAQ,GAAA,CAAA,CAAgB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG7B;AAEAV,EAAyB,cAAc;"}
1
+ {"version":3,"file":"AttachmentsButtonTrigger.es.js","sources":["../../../src/components/Attachments/AttachmentsButtonTrigger.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconPaperclip } from '@frontify/fondue/icons';\nimport { forwardRef } from 'react';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { type AttachmentsTriggerProps } from './types';\n\nexport const AttachmentsButtonTrigger = forwardRef<HTMLButtonElement, AttachmentsTriggerProps>(\n ({ children, isFlyoutOpen, ...props }, ref) => (\n <button\n ref={ref}\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 data-test-id=\"attachments-button-trigger\"\n {...props}\n >\n <IconPaperclip size=\"16\" />\n {children}\n <IconCaretDown size=\"12\" />\n </button>\n ),\n);\n\nAttachmentsButtonTrigger.displayName = 'AttachmentsButtonTrigger';\n"],"names":["AttachmentsButtonTrigger","forwardRef","children","isFlyoutOpen","props","ref","jsxs","joinClassNames","jsx","IconPaperclip","IconCaretDown"],"mappings":";;;;AASO,MAAMA,IAA2BC;AAAA,EACpC,CAAC,EAAE,UAAAC,GAAU,cAAAC,GAAc,GAAGC,EAAA,GAASC,MACnC,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAAD;AAAA,MACA,WAAWE,EAAe;AAAA,QACtB;AAAA,QACAJ,IACM,kEACA;AAAA,MAAA,CACT;AAAA,MACD,gBAAa;AAAA,MACZ,GAAGC;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAI,EAACC,GAAA,EAAc,MAAK,KAAA,CAAK;AAAA,QACxBP;AAAA,QACD,gBAAAM,EAACE,GAAA,EAAc,MAAK,KAAA,CAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGrC;AAEAV,EAAyB,cAAc;"}
@@ -1,11 +1,10 @@
1
1
  import { jsx as e, jsxs as o, Fragment as A } from "react/jsx-runtime";
2
2
  import { FileExtensionSets as D } from "@frontify/app-bridge";
3
- import { IconExclamationMarkTriangle as K } from "@frontify/fondue";
4
- import { LoadingCircle as V, Flyout as k, Dropdown as w } from "@frontify/fondue/components";
5
- import { IconArrowCircleUp as W, IconImageStack as q } from "@frontify/fondue/icons";
3
+ import { LoadingCircle as K, Flyout as k, Dropdown as w } from "@frontify/fondue/components";
4
+ import { IconArrowCircleUp as V, IconImageStack as W, IconExclamationMarkTriangle as q } from "@frontify/fondue/icons";
6
5
  import { useState as j, useRef as G, useCallback as H, useMemo as J } from "react";
7
6
  import { joinClassNames as Q } from "../../utilities/react/joinClassNames.es.js";
8
- const rt = ({
7
+ const et = ({
9
8
  onDrop: i,
10
9
  label: f,
11
10
  icon: N,
@@ -39,20 +38,20 @@ const rt = ({
39
38
  }, y = (t) => {
40
39
  if (!x.current || d)
41
40
  return;
42
- const { clientX: r, clientY: n } = t, S = r === 0 && n === 0, { left: z, top: C, width: F, height: P } = x.current.getBoundingClientRect(), X = S ? F / 2 : r - z, Y = S ? P / 2 : n - C;
41
+ const { clientX: r, clientY: n } = t, S = r === 0 && n === 0, { left: B, top: C, width: F, height: P } = x.current.getBoundingClientRect(), X = S ? F / 2 : r - B, Y = S ? P / 2 : n - C;
43
42
  p([X, Y]);
44
43
  }, I = H((t) => {
45
44
  t(), p(void 0);
46
- }, []), B = J(() => {
45
+ }, []), z = J(() => {
47
46
  const t = [];
48
47
  return v && t.push({
49
48
  onSelect: () => I(v),
50
49
  title: "Upload asset",
51
- icon: /* @__PURE__ */ e(W, { size: "20" })
50
+ icon: /* @__PURE__ */ e(V, { size: "20" })
52
51
  }), m && t.push({
53
52
  onSelect: () => I(m),
54
53
  title: "Browse asset",
55
- icon: /* @__PURE__ */ e(q, { size: "20" })
54
+ icon: /* @__PURE__ */ e(W, { size: "20" })
56
55
  }), t;
57
56
  }, [m, v, I]);
58
57
  return /* @__PURE__ */ o(
@@ -85,8 +84,8 @@ const rt = ({
85
84
  M && !s && y(t), h == null || h();
86
85
  },
87
86
  children: [
88
- d ? /* @__PURE__ */ e(V, {}) : a ? /* @__PURE__ */ o("div", { className: " tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium", children: [
89
- /* @__PURE__ */ e(K, {}),
87
+ d ? /* @__PURE__ */ e(K, {}) : a ? /* @__PURE__ */ o("div", { className: " tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium", children: [
88
+ /* @__PURE__ */ e(q, { size: "16" }),
90
89
  a
91
90
  ] }) : /* @__PURE__ */ o(A, { children: [
92
91
  N && /* @__PURE__ */ e("div", { children: N }),
@@ -107,7 +106,7 @@ const rt = ({
107
106
  /* @__PURE__ */ e(k.Trigger, { children: /* @__PURE__ */ e("div", {}) }),
108
107
  /* @__PURE__ */ e(k.Content, { triggerOffset: "compact", children: /* @__PURE__ */ o(w.Root, { open: !0, children: [
109
108
  /* @__PURE__ */ e(w.Trigger, { children: /* @__PURE__ */ e("div", {}) }),
110
- /* @__PURE__ */ e(w.Content, { triggerOffset: "compact", children: B.map((t) => /* @__PURE__ */ o(w.Item, { onSelect: t.onSelect, children: [
109
+ /* @__PURE__ */ e(w.Content, { triggerOffset: "compact", children: z.map((t) => /* @__PURE__ */ o(w.Item, { onSelect: t.onSelect, children: [
111
110
  t.icon,
112
111
  t.title
113
112
  ] }, t.title)) })
@@ -120,6 +119,6 @@ const rt = ({
120
119
  );
121
120
  };
122
121
  export {
123
- rt as BlockInjectButton
122
+ et as BlockInjectButton
124
123
  };
125
124
  //# sourceMappingURL=BlockInjectButton.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BlockInjectButton.es.js","sources":["../../../src/components/BlockInjectButton/BlockInjectButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type FileExtension, FileExtensionSets } from '@frontify/app-bridge';\nimport { IconExclamationMarkTriangle } from '@frontify/fondue';\nimport { Dropdown, Flyout, LoadingCircle } from '@frontify/fondue/components';\nimport { IconArrowCircleUp, IconImageStack } from '@frontify/fondue/icons';\nimport { type DragEventHandler, type MouseEventHandler, useCallback, useMemo, useRef, useState } from 'react';\n\nimport { joinClassNames } from '../../utilities/react/joinClassNames';\n\nimport { type BlockInjectButtonProps } from './types';\n\nexport const BlockInjectButton = ({\n onDrop,\n label,\n icon,\n secondaryLabel,\n isLoading,\n fillParentContainer,\n onAssetChooseClick,\n onUploadClick,\n withMenu = true,\n onClick,\n validFileType,\n verticalLayout,\n}: BlockInjectButtonProps) => {\n const [isDraggingOver, setIsDraggingOver] = useState(false);\n const [menuPosition, setMenuPosition] = useState<[number, number] | undefined>();\n const buttonRef = useRef<HTMLButtonElement>(null);\n const [errorMsg, setErrorMsg] = useState<string | undefined>(undefined);\n\n const handleDrop: DragEventHandler<HTMLButtonElement> = (event) => {\n event.preventDefault();\n setIsDraggingOver(false);\n if (!isValidAsset(event.dataTransfer.files)) {\n setErrorMsg('Invalid');\n setTimeout(() => {\n setErrorMsg(undefined);\n }, 1000);\n return;\n }\n onDrop?.(event.dataTransfer.files);\n };\n\n const isValidAsset = (files: FileList) => {\n if (!validFileType) {\n return true;\n }\n for (let i = 0; i < files.length; i++) {\n const droppedFileExtension = (files[i].name.split('.').pop() ?? '') as FileExtension;\n if (!FileExtensionSets[validFileType].includes(droppedFileExtension)) {\n return false;\n }\n }\n return true;\n };\n\n const openMenu: MouseEventHandler<HTMLButtonElement> = (event) => {\n if (!buttonRef.current || isLoading) {\n return;\n }\n const { clientX, clientY } = event;\n const isKeyboardEvent = clientX === 0 && clientY === 0;\n const { left, top, width, height } = buttonRef.current.getBoundingClientRect();\n const XInsideComponent = !isKeyboardEvent ? clientX - left : width / 2;\n const YInsideComponent = !isKeyboardEvent ? clientY - top : height / 2;\n setMenuPosition([XInsideComponent, YInsideComponent]);\n };\n\n const onItemClick = useCallback((callback: () => unknown) => {\n callback();\n setMenuPosition(undefined);\n }, []);\n\n const menuItems = useMemo(() => {\n const items = [];\n if (onUploadClick) {\n items.push({\n onSelect: () => onItemClick(onUploadClick),\n title: 'Upload asset',\n icon: <IconArrowCircleUp size=\"20\" />,\n });\n }\n if (onAssetChooseClick) {\n items.push({\n onSelect: () => onItemClick(onAssetChooseClick),\n title: 'Browse asset',\n icon: <IconImageStack size=\"20\" />,\n });\n }\n return items;\n }, [onAssetChooseClick, onUploadClick, onItemClick]);\n return (\n <button\n ref={buttonRef}\n data-test-id=\"block-inject-button\"\n className={joinClassNames([\n 'tw-font-body tw-relative tw-text-sm tw-leading-4 tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br',\n verticalLayout\n ? '[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl'\n : '[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr',\n fillParentContainer ? 'tw-h-full' : 'tw-h-[72px]',\n isDraggingOver && !isLoading ? 'tw-border-dashed' : 'tw-border-solid',\n menuPosition && 'tw-bg-blank-state-pressed-inverse',\n isDraggingOver && 'tw-bg-blank-state-weak-inverse',\n errorMsg ? '!tw-border-red-50 !tw-cursor-not-allowed' : ' tw-border-blank-state-line',\n isLoading || menuPosition || isDraggingOver || errorMsg\n ? ''\n : 'tw-text-text-weak hover:tw-text-blank-state-hover hover:tw-bg-blank-state-hover-inverse hover:tw-border-blank-state-line-hover active:tw-text-blank-state-pressed active:tw-bg-blank-state-pressed-inverse active:tw-border-blank-state-line-hover',\n (isDraggingOver || !!menuPosition) && !errorMsg\n ? '[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover'\n : 'tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded',\n ])}\n onDragEnter={\n onDrop\n ? (event) => {\n setIsDraggingOver(true);\n // is now only used for images, can be adapted if needed\n if (validFileType === 'Images') {\n for (const item of Array.from(event.dataTransfer.items)) {\n if (!item?.type?.startsWith('image/')) {\n setErrorMsg('Invalid');\n } else {\n setErrorMsg(undefined);\n }\n }\n }\n }\n : undefined\n }\n onDragLeave={\n onDrop\n ? () => {\n setIsDraggingOver(false);\n setErrorMsg(undefined);\n }\n : undefined\n }\n onDrop={onDrop ? handleDrop : undefined}\n onClick={(event) => {\n if (withMenu && !menuPosition) {\n openMenu(event);\n }\n onClick?.();\n }}\n >\n {isLoading ? (\n <LoadingCircle />\n ) : errorMsg ? (\n <div className=\" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium\">\n <IconExclamationMarkTriangle />\n {errorMsg}\n </div>\n ) : (\n <>\n {icon && <div>{icon}</div>}\n {(label || secondaryLabel) && (\n <div className=\"tw-flex tw-flex-col tw-items-start\">\n {label && <div className=\"tw-font-medium\">{label}</div>}\n {secondaryLabel && <div className=\"tw-font-normal\">{secondaryLabel}</div>}\n </div>\n )}\n </>\n )}\n {menuPosition && (\n <div\n className=\"tw-absolute tw-left-0 tw-top-full tw-z-20\"\n style={{\n left: menuPosition[0],\n top: menuPosition[1],\n }}\n >\n <Flyout.Root open onOpenChange={(isOpen) => !isOpen && setMenuPosition(undefined)}>\n <Flyout.Trigger>\n <div />\n </Flyout.Trigger>\n <Flyout.Content triggerOffset=\"compact\">\n <Dropdown.Root open>\n <Dropdown.Trigger>\n <div />\n </Dropdown.Trigger>\n <Dropdown.Content triggerOffset=\"compact\">\n {menuItems.map((item) => (\n <Dropdown.Item key={item.title} onSelect={item.onSelect}>\n {item.icon}\n {item.title}\n </Dropdown.Item>\n ))}\n </Dropdown.Content>\n </Dropdown.Root>\n </Flyout.Content>\n </Flyout.Root>\n </div>\n )}\n </button>\n );\n};\n"],"names":["BlockInjectButton","onDrop","label","icon","secondaryLabel","isLoading","fillParentContainer","onAssetChooseClick","onUploadClick","withMenu","onClick","validFileType","verticalLayout","isDraggingOver","setIsDraggingOver","useState","menuPosition","setMenuPosition","buttonRef","useRef","errorMsg","setErrorMsg","handleDrop","event","isValidAsset","files","i","droppedFileExtension","FileExtensionSets","openMenu","clientX","clientY","isKeyboardEvent","left","top","width","height","XInsideComponent","YInsideComponent","onItemClick","useCallback","callback","menuItems","useMemo","items","jsx","IconArrowCircleUp","IconImageStack","jsxs","joinClassNames","item","_a","LoadingCircle","IconExclamationMarkTriangle","Fragment","Flyout","isOpen","Dropdown"],"mappings":";;;;;;;AAYO,MAAMA,KAAoB,CAAC;AAAA,EAC9B,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAA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C1B,UAAA,gBAAAP,EAACS,EAAS,MAAT,EAAc,MAAI,IACf,UAAA;AAAA,gBAAA,gBAAAZ,EAACY,EAAS,SAAT,EACG,UAAA,gBAAAZ,EAAC,SAAI,GACT;AAAA,kCACCY,EAAS,SAAT,EAAiB,eAAc,WAC3B,UAAAf,EAAU,IAAI,CAACQ,wBACXO,EAAS,MAAT,EAA+B,UAAUP,EAAK,UAC1C,UAAA;AAAA,kBAAAA,EAAK;AAAA,kBACLA,EAAK;AAAA,gBAAA,KAFUA,EAAK,KAGzB,CACH,EAAA,CACL;AAAA,cAAA,EAAA,CACJ,EAAA,CACJ;AAAA,YAAA,EAAA,CACJ;AAAA,UAAA;AAAA,QAAA;AAAA,MACJ;AAAA,IAAA;AAAA,EAAA;AAIhB;"}
1
+ {"version":3,"file":"BlockInjectButton.es.js","sources":["../../../src/components/BlockInjectButton/BlockInjectButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type FileExtension, FileExtensionSets } from '@frontify/app-bridge';\nimport { Dropdown, Flyout, LoadingCircle } from '@frontify/fondue/components';\nimport { IconArrowCircleUp, IconImageStack, IconExclamationMarkTriangle } from '@frontify/fondue/icons';\nimport { type DragEventHandler, type MouseEventHandler, useCallback, useMemo, useRef, useState } from 'react';\n\nimport { joinClassNames } from '../../utilities/react/joinClassNames';\n\nimport { type BlockInjectButtonProps } from './types';\n\nexport const BlockInjectButton = ({\n onDrop,\n label,\n icon,\n secondaryLabel,\n isLoading,\n fillParentContainer,\n onAssetChooseClick,\n onUploadClick,\n withMenu = true,\n onClick,\n validFileType,\n verticalLayout,\n}: BlockInjectButtonProps) => {\n const [isDraggingOver, setIsDraggingOver] = useState(false);\n const [menuPosition, setMenuPosition] = useState<[number, number] | undefined>();\n const buttonRef = useRef<HTMLButtonElement>(null);\n const [errorMsg, setErrorMsg] = useState<string | undefined>(undefined);\n\n const handleDrop: DragEventHandler<HTMLButtonElement> = (event) => {\n event.preventDefault();\n setIsDraggingOver(false);\n if (!isValidAsset(event.dataTransfer.files)) {\n setErrorMsg('Invalid');\n setTimeout(() => {\n setErrorMsg(undefined);\n }, 1000);\n return;\n }\n onDrop?.(event.dataTransfer.files);\n };\n\n const isValidAsset = (files: FileList) => {\n if (!validFileType) {\n return true;\n }\n for (let i = 0; i < files.length; i++) {\n const droppedFileExtension = (files[i].name.split('.').pop() ?? '') as FileExtension;\n if (!FileExtensionSets[validFileType].includes(droppedFileExtension)) {\n return false;\n }\n }\n return true;\n };\n\n const openMenu: MouseEventHandler<HTMLButtonElement> = (event) => {\n if (!buttonRef.current || isLoading) {\n return;\n }\n const { clientX, clientY } = event;\n const isKeyboardEvent = clientX === 0 && clientY === 0;\n const { left, top, width, height } = buttonRef.current.getBoundingClientRect();\n const XInsideComponent = !isKeyboardEvent ? clientX - left : width / 2;\n const YInsideComponent = !isKeyboardEvent ? clientY - top : height / 2;\n setMenuPosition([XInsideComponent, YInsideComponent]);\n };\n\n const onItemClick = useCallback((callback: () => unknown) => {\n callback();\n setMenuPosition(undefined);\n }, []);\n\n const menuItems = useMemo(() => {\n const items = [];\n if (onUploadClick) {\n items.push({\n onSelect: () => onItemClick(onUploadClick),\n title: 'Upload asset',\n icon: <IconArrowCircleUp size=\"20\" />,\n });\n }\n if (onAssetChooseClick) {\n items.push({\n onSelect: () => onItemClick(onAssetChooseClick),\n title: 'Browse asset',\n icon: <IconImageStack size=\"20\" />,\n });\n }\n return items;\n }, [onAssetChooseClick, onUploadClick, onItemClick]);\n return (\n <button\n ref={buttonRef}\n data-test-id=\"block-inject-button\"\n className={joinClassNames([\n 'tw-font-body tw-relative tw-text-sm tw-leading-4 tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br',\n verticalLayout\n ? '[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl'\n : '[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr',\n fillParentContainer ? 'tw-h-full' : 'tw-h-[72px]',\n isDraggingOver && !isLoading ? 'tw-border-dashed' : 'tw-border-solid',\n menuPosition && 'tw-bg-blank-state-pressed-inverse',\n isDraggingOver && 'tw-bg-blank-state-weak-inverse',\n errorMsg ? '!tw-border-red-50 !tw-cursor-not-allowed' : ' tw-border-blank-state-line',\n isLoading || menuPosition || isDraggingOver || errorMsg\n ? ''\n : 'tw-text-text-weak hover:tw-text-blank-state-hover hover:tw-bg-blank-state-hover-inverse hover:tw-border-blank-state-line-hover active:tw-text-blank-state-pressed active:tw-bg-blank-state-pressed-inverse active:tw-border-blank-state-line-hover',\n (isDraggingOver || !!menuPosition) && !errorMsg\n ? '[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover'\n : 'tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded',\n ])}\n onDragEnter={\n onDrop\n ? (event) => {\n setIsDraggingOver(true);\n // is now only used for images, can be adapted if needed\n if (validFileType === 'Images') {\n for (const item of Array.from(event.dataTransfer.items)) {\n if (!item?.type?.startsWith('image/')) {\n setErrorMsg('Invalid');\n } else {\n setErrorMsg(undefined);\n }\n }\n }\n }\n : undefined\n }\n onDragLeave={\n onDrop\n ? () => {\n setIsDraggingOver(false);\n setErrorMsg(undefined);\n }\n : undefined\n }\n onDrop={onDrop ? handleDrop : undefined}\n onClick={(event) => {\n if (withMenu && !menuPosition) {\n openMenu(event);\n }\n onClick?.();\n }}\n >\n {isLoading ? (\n <LoadingCircle />\n ) : errorMsg ? (\n <div className=\" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium\">\n <IconExclamationMarkTriangle size=\"16\" />\n {errorMsg}\n </div>\n ) : (\n <>\n {icon && <div>{icon}</div>}\n {(label || secondaryLabel) && (\n <div className=\"tw-flex tw-flex-col tw-items-start\">\n {label && <div className=\"tw-font-medium\">{label}</div>}\n {secondaryLabel && <div className=\"tw-font-normal\">{secondaryLabel}</div>}\n </div>\n )}\n </>\n )}\n {menuPosition && (\n <div\n className=\"tw-absolute tw-left-0 tw-top-full tw-z-20\"\n style={{\n left: menuPosition[0],\n top: menuPosition[1],\n }}\n >\n <Flyout.Root open onOpenChange={(isOpen) => !isOpen && setMenuPosition(undefined)}>\n <Flyout.Trigger>\n <div />\n </Flyout.Trigger>\n <Flyout.Content triggerOffset=\"compact\">\n <Dropdown.Root open>\n <Dropdown.Trigger>\n <div />\n </Dropdown.Trigger>\n <Dropdown.Content triggerOffset=\"compact\">\n {menuItems.map((item) => (\n <Dropdown.Item key={item.title} onSelect={item.onSelect}>\n {item.icon}\n {item.title}\n </Dropdown.Item>\n ))}\n </Dropdown.Content>\n </Dropdown.Root>\n </Flyout.Content>\n </Flyout.Root>\n </div>\n )}\n </button>\n );\n};\n"],"names":["BlockInjectButton","onDrop","label","icon","secondaryLabel","isLoading","fillParentContainer","onAssetChooseClick","onUploadClick","withMenu","onClick","validFileType","verticalLayout","isDraggingOver","setIsDraggingOver","useState","menuPosition","setMenuPosition","buttonRef","useRef","errorMsg","setErrorMsg","handleDrop","event","isValidAsset","files","i","droppedFileExtension","FileExtensionSets","openMenu","clientX","clientY","isKeyboardEvent","left","top","width","height","XInsideComponent","YInsideComponent","onItemClick","useCallback","callback","menuItems","useMemo","items","jsx","IconArrowCircleUp","IconImageStack","jsxs","joinClassNames","item","_a","LoadingCircle","IconExclamationMarkTriangle","Fragment","Flyout","isOpen","Dropdown"],"mappings":";;;;;;AAWO,MAAMA,KAAoB,CAAC;AAAA,EAC9B,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,gBAAAC;AACJ,MAA8B;AAC1B,QAAM,CAACC,GAAgBC,CAAiB,IAAIC,EAAS,EAAK,GACpD,CAACC,GAAcC,CAA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ACXO,EAAS,MAAT,EAA+B,UAAUP,EAAK,UAC1C,UAAA;AAAA,kBAAAA,EAAK;AAAA,kBACLA,EAAK;AAAA,gBAAA,KAFUA,EAAK,KAGzB,CACH,EAAA,CACL;AAAA,cAAA,EAAA,CACJ,EAAA,CACJ;AAAA,YAAA,EAAA,CACJ;AAAA,UAAA;AAAA,QAAA;AAAA,MACJ;AAAA,IAAA;AAAA,EAAA;AAIhB;"}
@@ -1,19 +1,19 @@
1
1
  import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
- import { IconPaperclip16 as m, IconCaretDown12 as n } from "@frontify/fondue";
3
- import { forwardRef as c } from "react";
4
- import { BaseToolbarButton as s } from "../BaseToolbarButton.es.js";
5
- const l = c(
2
+ import { IconPaperclip as m, IconCaretDown as n } from "@frontify/fondue/icons";
3
+ import { forwardRef as s } from "react";
4
+ import { BaseToolbarButton as c } from "../BaseToolbarButton.es.js";
5
+ const l = s(
6
6
  ({ children: o, isFlyoutOpen: r, ...e }, a) => /* @__PURE__ */ i(
7
- s,
7
+ c,
8
8
  {
9
9
  forceActiveStyle: r,
10
10
  "data-test-id": "attachments-toolbar-button-trigger",
11
11
  ref: a,
12
12
  ...e,
13
13
  children: [
14
- /* @__PURE__ */ t(m, {}),
14
+ /* @__PURE__ */ t(m, { size: "16" }),
15
15
  o,
16
- /* @__PURE__ */ t(n, {})
16
+ /* @__PURE__ */ t(n, { size: "12" })
17
17
  ]
18
18
  }
19
19
  )
@@ -1 +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 { forwardRef } from 'react';\n\nimport { type AttachmentsTriggerProps } from '../../../Attachments/types';\nimport { BaseToolbarButton } from '../BaseToolbarButton';\n\nexport const AttachmentsToolbarButtonTrigger = forwardRef<HTMLButtonElement, AttachmentsTriggerProps>(\n ({ children, isFlyoutOpen, ...props }, ref) => (\n <BaseToolbarButton\n forceActiveStyle={isFlyoutOpen}\n data-test-id=\"attachments-toolbar-button-trigger\"\n ref={ref}\n {...props}\n >\n <IconPaperclip16 />\n {children}\n <IconCaretDown12 />\n </BaseToolbarButton>\n ),\n);\n\nAttachmentsToolbarButtonTrigger.displayName = 'AttachmentsToolbarButtonTrigger';\n"],"names":["AttachmentsToolbarButtonTrigger","forwardRef","children","isFlyoutOpen","props","ref","jsxs","BaseToolbarButton","jsx","IconPaperclip16","IconCaretDown12"],"mappings":";;;;AAQO,MAAMA,IAAkCC;AAAA,EAC3C,CAAC,EAAE,UAAAC,GAAU,cAAAC,GAAc,GAAGC,EAAA,GAASC,MACnC,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,kBAAkBJ;AAAA,MAClB,gBAAa;AAAA,MACb,KAAAE;AAAA,MACC,GAAGD;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAI,EAACC,GAAA,EAAgB;AAAA,QAChBP;AAAA,0BACAQ,GAAA,CAAA,CAAgB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG7B;AAEAV,EAAgC,cAAc;"}
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 { IconCaretDown, IconPaperclip } from '@frontify/fondue/icons';\nimport { forwardRef } from 'react';\n\nimport { type AttachmentsTriggerProps } from '../../../Attachments/types';\nimport { BaseToolbarButton } from '../BaseToolbarButton';\n\nexport const AttachmentsToolbarButtonTrigger = forwardRef<HTMLButtonElement, AttachmentsTriggerProps>(\n ({ children, isFlyoutOpen, ...props }, ref) => (\n <BaseToolbarButton\n forceActiveStyle={isFlyoutOpen}\n data-test-id=\"attachments-toolbar-button-trigger\"\n ref={ref}\n {...props}\n >\n <IconPaperclip size=\"16\" />\n {children}\n <IconCaretDown size=\"12\" />\n </BaseToolbarButton>\n ),\n);\n\nAttachmentsToolbarButtonTrigger.displayName = 'AttachmentsToolbarButtonTrigger';\n"],"names":["AttachmentsToolbarButtonTrigger","forwardRef","children","isFlyoutOpen","props","ref","jsxs","BaseToolbarButton","jsx","IconPaperclip","IconCaretDown"],"mappings":";;;;AAQO,MAAMA,IAAkCC;AAAA,EAC3C,CAAC,EAAE,UAAAC,GAAU,cAAAC,GAAc,GAAGC,EAAA,GAASC,MACnC,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,kBAAkBJ;AAAA,MAClB,gBAAa;AAAA,MACb,KAAAE;AAAA,MACC,GAAGD;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAI,EAACC,GAAA,EAAc,MAAK,KAAA,CAAK;AAAA,QACxBP;AAAA,QACD,gBAAAM,EAACE,GAAA,EAAc,MAAK,KAAA,CAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGrC;AAEAV,EAAgC,cAAc;"}
@@ -1,28 +1,29 @@
1
1
  import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
- import { IconArrowCircleDown16 as a, FOCUS_STYLE as w } from "@frontify/fondue";
2
+ import { FOCUS_STYLE as a } from "@frontify/fondue";
3
3
  import { Tooltip as o } from "@frontify/fondue/components";
4
+ import { IconArrowCircleDown as w } from "@frontify/fondue/icons";
4
5
  import { useFocusRing as d } from "@react-aria/focus";
5
6
  import { joinClassNames as u } from "../../utilities/react/joinClassNames.es.js";
6
- const x = ({ onDownload: e, ariaLabel: n }) => {
7
- const { isFocused: r, focusProps: s } = d();
7
+ const g = ({ onDownload: e, ariaLabel: n }) => {
8
+ const { isFocused: r, focusProps: i } = d();
8
9
  return /* @__PURE__ */ l(o.Root, { enterDelay: 500, children: [
9
10
  /* @__PURE__ */ t(o.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
10
11
  "button",
11
12
  {
12
13
  tabIndex: 0,
13
14
  "aria-label": n ?? "Download",
14
- ...s,
15
- className: u(["tw-outline-none tw-rounded", r && w]),
15
+ ...i,
16
+ className: u(["tw-outline-none tw-rounded", r && a]),
16
17
  onClick: e,
17
- onPointerDown: (i) => i.preventDefault(),
18
+ onPointerDown: (s) => s.preventDefault(),
18
19
  "data-test-id": "download-button",
19
- children: /* @__PURE__ */ t("span", { className: "tw-flex tw-text-xs 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-1 tw-p-1.5 tw-outline-line", children: /* @__PURE__ */ t(a, {}) })
20
+ children: /* @__PURE__ */ t("span", { className: "tw-flex tw-text-xs 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-1 tw-p-1.5 tw-outline-line", children: /* @__PURE__ */ t(w, { size: "16" }) })
20
21
  }
21
22
  ) }),
22
23
  /* @__PURE__ */ t(o.Content, { side: "top", children: "Download" })
23
24
  ] });
24
25
  };
25
26
  export {
26
- x as DownloadButton
27
+ g as DownloadButton
27
28
  };
28
29
  //# sourceMappingURL=DownloadButton.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DownloadButton.es.js","sources":["../../../src/components/DownloadButton/DownloadButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { FOCUS_STYLE, IconArrowCircleDown16 } from '@frontify/fondue';\nimport { Tooltip } from '@frontify/fondue/components';\nimport { useFocusRing } from '@react-aria/focus';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { type DownloadButtonProps } from './types';\n\nexport const DownloadButton = ({ onDownload, ariaLabel }: DownloadButtonProps) => {\n const { isFocused, focusProps } = useFocusRing();\n\n return (\n <Tooltip.Root enterDelay={500}>\n <Tooltip.Trigger asChild>\n <button\n tabIndex={0}\n aria-label={ariaLabel ?? 'Download'}\n {...focusProps}\n className={joinClassNames(['tw-outline-none tw-rounded', isFocused && FOCUS_STYLE])}\n onClick={onDownload}\n onPointerDown={(e) => e.preventDefault()}\n data-test-id=\"download-button\"\n >\n <span className=\"tw-flex tw-text-xs 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-1 tw-p-1.5 tw-outline-line\">\n <IconArrowCircleDown16 />\n </span>\n </button>\n </Tooltip.Trigger>\n <Tooltip.Content side=\"top\">Download</Tooltip.Content>\n </Tooltip.Root>\n );\n};\n"],"names":["DownloadButton","onDownload","ariaLabel","isFocused","focusProps","useFocusRing","jsxs","Tooltip","jsx","joinClassNames","FOCUS_STYLE","e","IconArrowCircleDown16"],"mappings":";;;;;AAUO,MAAMA,IAAiB,CAAC,EAAE,YAAAC,GAAY,WAAAC,QAAqC;AAC9E,QAAM,EAAE,WAAAC,GAAW,YAAAC,EAAA,IAAeC,EAAA;AAElC,SACI,gBAAAC,EAACC,EAAQ,MAAR,EAAa,YAAY,KACtB,UAAA;AAAA,IAAA,gBAAAC,EAACD,EAAQ,SAAR,EAAgB,SAAO,IACpB,UAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,UAAU;AAAA,QACV,cAAYN,KAAa;AAAA,QACxB,GAAGE;AAAA,QACJ,WAAWK,EAAe,CAAC,8BAA8BN,KAAaO,CAAW,CAAC;AAAA,QAClF,SAAST;AAAA,QACT,eAAe,CAACU,MAAMA,EAAE,eAAA;AAAA,QACxB,gBAAa;AAAA,QAEb,4BAAC,QAAA,EAAK,WAAU,0SACZ,UAAA,gBAAAH,EAACI,KAAsB,EAAA,CAC3B;AAAA,MAAA;AAAA,IAAA,GAER;AAAA,sBACCL,EAAQ,SAAR,EAAgB,MAAK,OAAM,UAAA,WAAA,CAAQ;AAAA,EAAA,GACxC;AAER;"}
1
+ {"version":3,"file":"DownloadButton.es.js","sources":["../../../src/components/DownloadButton/DownloadButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { FOCUS_STYLE } from '@frontify/fondue';\nimport { Tooltip } from '@frontify/fondue/components';\nimport { IconArrowCircleDown } from '@frontify/fondue/icons';\nimport { useFocusRing } from '@react-aria/focus';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { type DownloadButtonProps } from './types';\n\nexport const DownloadButton = ({ onDownload, ariaLabel }: DownloadButtonProps) => {\n const { isFocused, focusProps } = useFocusRing();\n\n return (\n <Tooltip.Root enterDelay={500}>\n <Tooltip.Trigger asChild>\n <button\n tabIndex={0}\n aria-label={ariaLabel ?? 'Download'}\n {...focusProps}\n className={joinClassNames(['tw-outline-none tw-rounded', isFocused && FOCUS_STYLE])}\n onClick={onDownload}\n onPointerDown={(e) => e.preventDefault()}\n data-test-id=\"download-button\"\n >\n <span className=\"tw-flex tw-text-xs 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-1 tw-p-1.5 tw-outline-line\">\n <IconArrowCircleDown size=\"16\" />\n </span>\n </button>\n </Tooltip.Trigger>\n <Tooltip.Content side=\"top\">Download</Tooltip.Content>\n </Tooltip.Root>\n );\n};\n"],"names":["DownloadButton","onDownload","ariaLabel","isFocused","focusProps","useFocusRing","jsxs","Tooltip","jsx","joinClassNames","FOCUS_STYLE","e","IconArrowCircleDown"],"mappings":";;;;;;AAWO,MAAMA,IAAiB,CAAC,EAAE,YAAAC,GAAY,WAAAC,QAAqC;AAC9E,QAAM,EAAE,WAAAC,GAAW,YAAAC,EAAA,IAAeC,EAAA;AAElC,SACI,gBAAAC,EAACC,EAAQ,MAAR,EAAa,YAAY,KACtB,UAAA;AAAA,IAAA,gBAAAC,EAACD,EAAQ,SAAR,EAAgB,SAAO,IACpB,UAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,UAAU;AAAA,QACV,cAAYN,KAAa;AAAA,QACxB,GAAGE;AAAA,QACJ,WAAWK,EAAe,CAAC,8BAA8BN,KAAaO,CAAW,CAAC;AAAA,QAClF,SAAST;AAAA,QACT,eAAe,CAACU,MAAMA,EAAE,eAAA;AAAA,QACxB,gBAAa;AAAA,QAEb,UAAA,gBAAAH,EAAC,UAAK,WAAU,0SACZ,4BAACI,GAAA,EAAoB,MAAK,MAAK,EAAA,CACnC;AAAA,MAAA;AAAA,IAAA,GAER;AAAA,sBACCL,EAAQ,SAAR,EAAgB,MAAK,OAAM,UAAA,WAAA,CAAQ;AAAA,EAAA,GACxC;AAER;"}