@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.
- package/CHANGELOG.md +46 -0
- package/dist/components/Attachments/AttachmentItem.es.js +128 -109
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
- package/dist/components/Attachments/Attachments.es.js +9 -1
- package/dist/components/Attachments/Attachments.es.js.map +1 -1
- package/dist/components/Attachments/AttachmentsButtonTrigger.es.js +17 -9
- package/dist/components/Attachments/AttachmentsButtonTrigger.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +37 -39
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js +33 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js +26 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js +28 -0
- package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js +35 -0
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js +44 -0
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js +25 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.es.js +29 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js +13 -110
- package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js +12 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js +20 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js +11 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js +18 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js +18 -0
- package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js.map +1 -0
- package/dist/helpers/mapColorPalettes.es.js +20 -8
- package/dist/helpers/mapColorPalettes.es.js.map +1 -1
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +57 -23
- package/dist/index.es.js +195 -185
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -2
- package/setupTests.ts +7 -2
- package/src/components/Attachments/AttachmentItem.tsx +21 -0
- package/src/components/Attachments/Attachments.spec.ct.tsx +20 -1
- package/src/components/Attachments/Attachments.tsx +8 -4
- package/src/components/Attachments/AttachmentsButtonTrigger.tsx +11 -3
- package/src/components/Attachments/types.ts +4 -2
- package/src/components/BlockItemWrapper/BlockItemWrapper.tsx +47 -47
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.spec.tsx +96 -0
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.tsx +42 -0
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.spec.tsx +44 -0
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.tsx +24 -0
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/index.ts +3 -0
- package/src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.spec.tsx +40 -0
- package/src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.tsx +37 -0
- package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.spec.tsx +89 -0
- package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.tsx +39 -0
- package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/index.ts +3 -0
- package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.spec.tsx +140 -0
- package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.tsx +61 -0
- package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/index.ts +3 -0
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.spec.tsx +77 -0
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.tsx +30 -0
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.spec.tsx +63 -0
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.tsx +40 -0
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/index.ts +3 -0
- package/src/components/BlockItemWrapper/Toolbar/Toolbar.spec.tsx +50 -53
- package/src/components/BlockItemWrapper/Toolbar/Toolbar.tsx +24 -126
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.spec.tsx +70 -0
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.tsx +19 -0
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/index.ts +3 -0
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.tsx +25 -0
- package/src/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.tsx +15 -0
- package/src/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.tsx +25 -0
- package/src/components/BlockItemWrapper/Toolbar/helpers.ts +1 -1
- package/src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.spec.tsx +59 -0
- package/src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.ts +24 -0
- package/src/components/BlockItemWrapper/Toolbar/index.ts +4 -0
- package/src/components/BlockItemWrapper/Toolbar/types.ts +8 -27
- package/src/helpers/mapColorPalettes.spec.ts +14 -113
- package/src/helpers/mapColorPalettes.ts +51 -8
- package/src/hooks/useAttachments.spec.tsx +1 -0
- package/tsconfig.json +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachments.es.js +0 -27
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachments.es.js.map +0 -1
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachmentsTrigger.es.js +0 -12
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachmentsTrigger.es.js.map +0 -1
- package/src/components/BlockItemWrapper/Toolbar/ToolbarAttachments.tsx +0 -29
- package/src/components/BlockItemWrapper/Toolbar/ToolbarAttachmentsTrigger.tsx +0 -14
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { LegacyTooltip as l, TooltipPosition as n } from "@frontify/fondue";
|
|
3
|
+
const m = ({ open: t, content: i, children: r, disabled: e }) => /* @__PURE__ */ o(
|
|
4
|
+
l,
|
|
5
|
+
{
|
|
6
|
+
withArrow: !0,
|
|
7
|
+
hoverDelay: 0,
|
|
8
|
+
enterDelay: 300,
|
|
9
|
+
open: t,
|
|
10
|
+
disabled: e,
|
|
11
|
+
position: n.Top,
|
|
12
|
+
content: /* @__PURE__ */ o("div", { children: i }),
|
|
13
|
+
triggerElement: r,
|
|
14
|
+
"data-test-id": "toolbar-button-tooltip"
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
export {
|
|
18
|
+
m as ToolbarButtonTooltip
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=ToolbarButtonTooltip.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarButtonTooltip.es.js","sources":["../../../../src/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { LegacyTooltip as Tooltip, TooltipPosition } from '@frontify/fondue';\nimport { ReactElement, ReactNode } from 'react';\n\ntype ToolbarButtonTooltipProps = {\n content: ReactNode;\n children: ReactElement;\n open?: boolean;\n disabled?: boolean;\n};\n\nexport const ToolbarButtonTooltip = ({ open, content, children, disabled }: ToolbarButtonTooltipProps) => (\n <Tooltip\n withArrow\n hoverDelay={0}\n enterDelay={300}\n open={open}\n disabled={disabled}\n position={TooltipPosition.Top}\n content={<div>{content}</div>}\n triggerElement={children}\n data-test-id=\"toolbar-button-tooltip\"\n />\n);\n"],"names":["ToolbarButtonTooltip","open","content","children","disabled","jsx","Tooltip","TooltipPosition"],"mappings":";;AAYO,MAAMA,IAAuB,CAAC,EAAE,MAAAC,GAAM,SAAAC,GAAS,UAAAC,GAAU,UAAAC,QAC5D,gBAAAC;AAAA,EAACC;AAAAA,EAAA;AAAA,IACG,WAAS;AAAA,IACT,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,MAAAL;AAAA,IACA,UAAAG;AAAA,IACA,UAAUG,EAAgB;AAAA,IAC1B,SAAU,gBAAAF,EAAA,OAAA,EAAK,UAAQH,EAAA,CAAA;AAAA,IACvB,gBAAgBC;AAAA,IAChB,gBAAa;AAAA,EAAA;AACjB;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as n, useContext as i } from "react";
|
|
3
|
+
const e = n(!1), a = ({
|
|
4
|
+
children: t,
|
|
5
|
+
isDragPreview: r
|
|
6
|
+
}) => /* @__PURE__ */ o(e.Provider, { value: r, children: t }), v = () => i(e);
|
|
7
|
+
export {
|
|
8
|
+
a as DragPreviewContextProvider,
|
|
9
|
+
v as useDragPreviewContext
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=DragPreviewContext.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragPreviewContext.es.js","sources":["../../../../../src/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactNode, createContext, useContext } from 'react';\n\nconst DragPreviewContext = createContext(false);\n\nexport const DragPreviewContextProvider = ({\n children,\n isDragPreview,\n}: {\n children: ReactNode;\n isDragPreview: boolean;\n}) => <DragPreviewContext.Provider value={isDragPreview}>{children}</DragPreviewContext.Provider>;\n\nexport const useDragPreviewContext = () => useContext(DragPreviewContext);\n"],"names":["DragPreviewContext","createContext","DragPreviewContextProvider","children","isDragPreview","useDragPreviewContext","useContext"],"mappings":";;AAIA,MAAMA,IAAqBC,EAAc,EAAK,GAEjCC,IAA6B,CAAC;AAAA,EACvC,UAAAC;AAAA,EACA,eAAAC;AACJ,wBAGOJ,EAAmB,UAAnB,EAA4B,OAAOI,GAAgB,UAAAD,GAAS,GAEtDE,IAAwB,MAAMC,EAAWN,CAAkB;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as i, useMemo as l, useContext as s } from "react";
|
|
3
|
+
const e = i({
|
|
4
|
+
openFlyoutIds: [],
|
|
5
|
+
setOpenFlyoutIds: () => console.error("No MultiFlyoutContext Provider found")
|
|
6
|
+
}), C = ({
|
|
7
|
+
children: r,
|
|
8
|
+
openFlyoutIds: t,
|
|
9
|
+
setOpenFlyoutIds: o
|
|
10
|
+
}) => {
|
|
11
|
+
const n = l(() => ({ openFlyoutIds: t, setOpenFlyoutIds: o }), [t, o]);
|
|
12
|
+
return /* @__PURE__ */ u(e.Provider, { value: n, children: r });
|
|
13
|
+
}, c = () => s(e);
|
|
14
|
+
export {
|
|
15
|
+
C as MultiFlyoutContextProvider,
|
|
16
|
+
c as useMultiFlyoutContext
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=MultiFlyoutContext.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiFlyoutContext.es.js","sources":["../../../../../src/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Dispatch, ReactNode, SetStateAction, createContext, useContext, useMemo } from 'react';\n\nexport type MultiFlyoutContextType = {\n openFlyoutIds: string[];\n setOpenFlyoutIds: Dispatch<SetStateAction<string[]>>;\n};\n\nconst MultiFlyoutContext = createContext<MultiFlyoutContextType>({\n openFlyoutIds: [],\n setOpenFlyoutIds: () => console.error('No MultiFlyoutContext Provider found'),\n});\n\nexport const MultiFlyoutContextProvider = ({\n children,\n openFlyoutIds,\n setOpenFlyoutIds,\n}: { children: ReactNode } & MultiFlyoutContextType) => {\n const memoizedContext = useMemo(() => ({ openFlyoutIds, setOpenFlyoutIds }), [openFlyoutIds, setOpenFlyoutIds]);\n\n return <MultiFlyoutContext.Provider value={memoizedContext}>{children}</MultiFlyoutContext.Provider>;\n};\n\nexport const useMultiFlyoutContext = () => useContext(MultiFlyoutContext);\n"],"names":["MultiFlyoutContext","createContext","MultiFlyoutContextProvider","children","openFlyoutIds","setOpenFlyoutIds","memoizedContext","useMemo","useMultiFlyoutContext","useContext"],"mappings":";;AASA,MAAMA,IAAqBC,EAAsC;AAAA,EAC7D,eAAe,CAAC;AAAA,EAChB,kBAAkB,MAAM,QAAQ,MAAM,sCAAsC;AAChF,CAAC,GAEYC,IAA6B,CAAC;AAAA,EACvC,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,kBAAAC;AACJ,MAAwD;AAC9C,QAAAC,IAAkBC,EAAQ,OAAO,EAAE,eAAAH,GAAe,kBAAAC,EAAqB,IAAA,CAACD,GAAeC,CAAgB,CAAC;AAE9G,2BAAQL,EAAmB,UAAnB,EAA4B,OAAOM,GAAkB,UAAAH,EAAS,CAAA;AAC1E,GAEaK,IAAwB,MAAMC,EAAWT,CAAkB;"}
|
|
@@ -17,7 +17,7 @@ const w = (e, r) => {
|
|
|
17
17
|
) : t.push(
|
|
18
18
|
"hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed",
|
|
19
19
|
"tw-text-text-weak hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed",
|
|
20
|
-
e === "grab" ? "tw-cursor-grab active:tw-cursor-grabbing" : "tw-cursor-pointer"
|
|
20
|
+
e === "grab" ? "!tw-cursor-grab active:tw-cursor-grabbing" : "tw-cursor-pointer"
|
|
21
21
|
), o(t);
|
|
22
22
|
};
|
|
23
23
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.es.js","sources":["../../../../src/components/BlockItemWrapper/Toolbar/helpers.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { FOCUS_VISIBLE_STYLE } from '@frontify/fondue';\n\nimport { joinClassNames } from '../../../utilities';\n\nexport const getToolbarButtonClassNames = (cursor: 'grab' | 'pointer', forceActiveStyle?: boolean) => {\n const classNames = [\n FOCUS_VISIBLE_STYLE,\n 'tw-relative tw-inline-flex tw-items-center tw-justify-center',\n 'tw-h-6 tw-p-1',\n 'tw-rounded',\n 'tw-text-xs tw-font-medium',\n 'tw-gap-0.5',\n 'focus-visible:tw-z-10',\n ];\n\n if (forceActiveStyle) {\n classNames.push(\n 'tw-bg-box-neutral-pressed',\n 'tw-text-box-neutral-inverse-pressed',\n cursor === 'grab' ? 'tw-cursor-grabbing' : 'tw-cursor-pointer',\n );\n } else {\n classNames.push(\n 'hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed',\n 'tw-text-text-weak hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed',\n cursor === 'grab' ? 'tw-cursor-grab active:tw-cursor-grabbing' : 'tw-cursor-pointer',\n );\n }\n\n return joinClassNames(classNames);\n};\n"],"names":["getToolbarButtonClassNames","cursor","forceActiveStyle","classNames","FOCUS_VISIBLE_STYLE","joinClassNames"],"mappings":";;AAMa,MAAAA,IAA6B,CAACC,GAA4BC,MAA+B;AAClG,QAAMC,IAAa;AAAA,IACfC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGJ,SAAIF,IACWC,EAAA;AAAA,IACP;AAAA,IACA;AAAA,IACAF,MAAW,SAAS,uBAAuB;AAAA,EAAA,IAGpCE,EAAA;AAAA,IACP;AAAA,IACA;AAAA,IACAF,MAAW,SAAS,
|
|
1
|
+
{"version":3,"file":"helpers.es.js","sources":["../../../../src/components/BlockItemWrapper/Toolbar/helpers.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { FOCUS_VISIBLE_STYLE } from '@frontify/fondue';\n\nimport { joinClassNames } from '../../../utilities';\n\nexport const getToolbarButtonClassNames = (cursor: 'grab' | 'pointer', forceActiveStyle?: boolean) => {\n const classNames = [\n FOCUS_VISIBLE_STYLE,\n 'tw-relative tw-inline-flex tw-items-center tw-justify-center',\n 'tw-h-6 tw-p-1',\n 'tw-rounded',\n 'tw-text-xs tw-font-medium',\n 'tw-gap-0.5',\n 'focus-visible:tw-z-10',\n ];\n\n if (forceActiveStyle) {\n classNames.push(\n 'tw-bg-box-neutral-pressed',\n 'tw-text-box-neutral-inverse-pressed',\n cursor === 'grab' ? 'tw-cursor-grabbing' : 'tw-cursor-pointer',\n );\n } else {\n classNames.push(\n 'hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed',\n 'tw-text-text-weak hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed',\n cursor === 'grab' ? '!tw-cursor-grab active:tw-cursor-grabbing' : 'tw-cursor-pointer',\n );\n }\n\n return joinClassNames(classNames);\n};\n"],"names":["getToolbarButtonClassNames","cursor","forceActiveStyle","classNames","FOCUS_VISIBLE_STYLE","joinClassNames"],"mappings":";;AAMa,MAAAA,IAA6B,CAACC,GAA4BC,MAA+B;AAClG,QAAMC,IAAa;AAAA,IACfC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGJ,SAAIF,IACWC,EAAA;AAAA,IACP;AAAA,IACA;AAAA,IACAF,MAAW,SAAS,uBAAuB;AAAA,EAAA,IAGpCE,EAAA;AAAA,IACP;AAAA,IACA;AAAA,IACAF,MAAW,SAAS,8CAA8C;AAAA,EAAA,GAInEI,EAAeF,CAAU;AACpC;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useCallback as l } from "react";
|
|
2
|
+
import { useMultiFlyoutContext as p } from "../context/MultiFlyoutContext.es.js";
|
|
3
|
+
const m = (e) => {
|
|
4
|
+
const { openFlyoutIds: s, setOpenFlyoutIds: t } = p(), o = l(
|
|
5
|
+
(r) => {
|
|
6
|
+
t((u) => {
|
|
7
|
+
const n = u.filter((i) => i !== e);
|
|
8
|
+
return r ? [...n, e] : n;
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
[e, t]
|
|
12
|
+
);
|
|
13
|
+
return { isOpen: s.includes(e), onOpenChange: o };
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
m as useMultiFlyoutState
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=useMultiFlyoutState.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMultiFlyoutState.es.js","sources":["../../../../../src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useCallback } from 'react';\nimport { useMultiFlyoutContext } from '../context/MultiFlyoutContext';\n\nexport const useMultiFlyoutState = (flyoutId: string) => {\n const { openFlyoutIds, setOpenFlyoutIds } = useMultiFlyoutContext();\n\n const onOpenChange = useCallback(\n (isFlyoutOpen: boolean) => {\n setOpenFlyoutIds((currentIds) => {\n const filteredIds = currentIds.filter((id) => id !== flyoutId);\n if (!isFlyoutOpen) {\n return filteredIds;\n } else {\n return [...filteredIds, flyoutId];\n }\n });\n },\n [flyoutId, setOpenFlyoutIds],\n );\n\n return { isOpen: openFlyoutIds.includes(flyoutId), onOpenChange };\n};\n"],"names":["useMultiFlyoutState","flyoutId","openFlyoutIds","setOpenFlyoutIds","useMultiFlyoutContext","onOpenChange","useCallback","isFlyoutOpen","currentIds","filteredIds","id"],"mappings":";;AAKa,MAAAA,IAAsB,CAACC,MAAqB;AACrD,QAAM,EAAE,eAAAC,GAAe,kBAAAC,EAAiB,IAAIC,EAAsB,GAE5DC,IAAeC;AAAA,IACjB,CAACC,MAA0B;AACvB,MAAAJ,EAAiB,CAACK,MAAe;AAC7B,cAAMC,IAAcD,EAAW,OAAO,CAACE,MAAOA,MAAOT,CAAQ;AAC7D,eAAKM,IAGM,CAAC,GAAGE,GAAaR,CAAQ,IAFzBQ;AAAA,MAGX,CACH;AAAA,IACL;AAAA,IACA,CAACR,GAAUE,CAAgB;AAAA,EAAA;AAG/B,SAAO,EAAE,QAAQD,EAAc,SAASD,CAAQ,GAAG,cAAAI;AACvD;"}
|
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
const
|
|
2
|
-
id:
|
|
3
|
-
title:
|
|
4
|
-
colors:
|
|
1
|
+
const i = (e) => e.map(n), n = (e) => ({
|
|
2
|
+
id: e.id,
|
|
3
|
+
title: e.name,
|
|
4
|
+
colors: e.colors.map(p)
|
|
5
|
+
}), t = (e) => "revision" in e, p = (e) => {
|
|
6
|
+
if (t(e)) {
|
|
7
|
+
const { title: r, revision: a } = e;
|
|
8
|
+
return {
|
|
9
|
+
alpha: a.rgba.alpha ? a.rgba.alpha / 255 : 1,
|
|
10
|
+
red: a.rgba.red ?? 0,
|
|
11
|
+
green: a.rgba.green ?? 0,
|
|
12
|
+
blue: a.rgba.blue ?? 0,
|
|
13
|
+
name: r ?? ""
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
5
17
|
alpha: e.alpha ? e.alpha / 255 : 1,
|
|
6
18
|
red: e.red ?? 0,
|
|
7
19
|
green: e.green ?? 0,
|
|
8
20
|
blue: e.blue ?? 0,
|
|
9
21
|
name: e.name ?? ""
|
|
10
|
-
}
|
|
11
|
-
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
12
24
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
n as mapAppBridgeColorPaletteToFonduePalette,
|
|
26
|
+
i as mapAppBridgeColorPalettesToFonduePalettes
|
|
15
27
|
};
|
|
16
28
|
//# sourceMappingURL=mapColorPalettes.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapColorPalettes.es.js","sources":["../../src/helpers/mapColorPalettes.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ColorPalette } from '@frontify/app-bridge';\nimport { Palette } from '@frontify/fondue';\n\nexport const mapAppBridgeColorPalettesToFonduePalettes = (colorPalettes: ColorPalette[]): Palette[] => {\n return colorPalettes.map(mapAppBridgeColorPaletteToFonduePalette);\n};\
|
|
1
|
+
{"version":3,"file":"mapColorPalettes.es.js","sources":["../../src/helpers/mapColorPalettes.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ColorPalette } from '@frontify/app-bridge';\nimport { Palette } from '@frontify/fondue';\n\ntype Nullable<T> = T | null;\n\ntype V3Color = {\n id: number;\n name: Nullable<string>;\n red: Nullable<number>;\n green: Nullable<number>;\n blue: Nullable<number>;\n alpha: Nullable<number>;\n};\n\ntype V4Color = {\n id: number;\n title: Nullable<string>;\n revision: {\n rgba: {\n red: Nullable<number>;\n green: Nullable<number>;\n blue: Nullable<number>;\n alpha: Nullable<number>;\n };\n };\n};\n\ntype Color = V3Color | V4Color;\n\nexport const mapAppBridgeColorPalettesToFonduePalettes = (colorPalettes: ColorPalette[]): Palette[] => {\n return colorPalettes.map(mapAppBridgeColorPaletteToFonduePalette);\n};\nexport const mapAppBridgeColorPaletteToFonduePalette = (colorPalette: ColorPalette): Palette => {\n return {\n id: colorPalette.id,\n title: colorPalette.name,\n colors: colorPalette.colors.map(mapColor),\n };\n};\n\nconst isV4Color = (color: Color): color is V4Color => {\n return 'revision' in color;\n};\n\nconst mapColor = (color: Color) => {\n if (isV4Color(color)) {\n const { title, revision } = color;\n return {\n alpha: revision.rgba.alpha ? revision.rgba.alpha / 255 : 1,\n red: revision.rgba.red ?? 0,\n green: revision.rgba.green ?? 0,\n blue: revision.rgba.blue ?? 0,\n name: title ?? '',\n };\n }\n return {\n alpha: color.alpha ? color.alpha / 255 : 1,\n red: color.red ?? 0,\n green: color.green ?? 0,\n blue: color.blue ?? 0,\n name: color.name ?? '',\n };\n};\n"],"names":["mapAppBridgeColorPalettesToFonduePalettes","colorPalettes","mapAppBridgeColorPaletteToFonduePalette","colorPalette","mapColor","isV4Color","color","title","revision"],"mappings":"AA+Ba,MAAAA,IAA4C,CAACC,MAC/CA,EAAc,IAAIC,CAAuC,GAEvDA,IAA0C,CAACC,OAC7C;AAAA,EACH,IAAIA,EAAa;AAAA,EACjB,OAAOA,EAAa;AAAA,EACpB,QAAQA,EAAa,OAAO,IAAIC,CAAQ;AAAA,IAI1CC,IAAY,CAACC,MACR,cAAcA,GAGnBF,IAAW,CAACE,MAAiB;AAC3B,MAAAD,EAAUC,CAAK,GAAG;AACZ,UAAA,EAAE,OAAAC,GAAO,UAAAC,EAAa,IAAAF;AACrB,WAAA;AAAA,MACH,OAAOE,EAAS,KAAK,QAAQA,EAAS,KAAK,QAAQ,MAAM;AAAA,MACzD,KAAKA,EAAS,KAAK,OAAO;AAAA,MAC1B,OAAOA,EAAS,KAAK,SAAS;AAAA,MAC9B,MAAMA,EAAS,KAAK,QAAQ;AAAA,MAC5B,MAAMD,KAAS;AAAA,IAAA;AAAA,EAEvB;AACO,SAAA;AAAA,IACH,OAAOD,EAAM,QAAQA,EAAM,QAAQ,MAAM;AAAA,IACzC,KAAKA,EAAM,OAAO;AAAA,IAClB,OAAOA,EAAM,SAAS;AAAA,IACtB,MAAMA,EAAM,QAAQ;AAAA,IACpB,MAAMA,EAAM,QAAQ;AAAA,EAAA;AAE5B;"}
|