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

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 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/utilities/react/joinClassNames.ts","../src/components/BlockInjectButton/BlockInjectButton.tsx","../src/utilities/color/toShortRgba.ts","../src/utilities/color/isDark.ts","../src/utilities/color/toHex8String.ts","../src/utilities/color/toHexString.ts","../src/utilities/color/toRgbaString.ts","../src/utilities/color/setAlpha.ts","../src/utilities/color/toColorObject.ts","../src/utilities/color/getReadableColor.ts","../src/utilities/moveItemInArray.ts","../src/utilities/react/getBackgroundColorStyles.ts","../src/settings/defaultValues.ts","../src/settings/types.ts","../src/utilities/react/getBorderStyles.ts","../src/utilities/react/getRadiusStyles.ts","../src/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.tsx","../src/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.tsx","../src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.ts","../src/hooks/useAttachments.tsx","../src/helpers/customCoordinatesGetterFactory.ts","../src/hooks/useDndSensors.ts","../src/components/Attachments/AttachmentItem.tsx","../src/components/Attachments/AttachmentsButtonTrigger.tsx","../src/components/Attachments/Attachments.tsx","../src/components/BlockItemWrapper/Toolbar/helpers.ts","../src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.tsx","../src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.tsx","../src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.tsx","../src/components/BlockItemWrapper/constants.ts","../src/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.tsx","../src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.tsx","../src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.tsx","../src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.tsx","../src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.tsx","../src/components/BlockItemWrapper/Toolbar/ToolbarSegment.tsx","../src/components/BlockItemWrapper/Toolbar/Toolbar.tsx","../src/components/BlockItemWrapper/BlockItemWrapper.tsx","../src/components/DownloadButton/DownloadButton.tsx","../src/hooks/useIsInViewport.ts","../src/components/RichTextEditor/SerializedText.tsx","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.ts","../src/helpers/hasRichTextValue.ts","../src/helpers/convertToRichTextValue.ts","../src/helpers/isDownloadable.ts","../src/helpers/mapColorPalettes.ts","../src/components/Link/utils/getUrl.ts","../src/components/Link/utils/relativeUrlRegex.ts","../src/helpers/addHttps.ts","../src/components/Link/utils/url.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.tsx","../src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.tsx","../src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/id.ts","../src/components/RichTextEditor/plugins/styles.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.tsx","../src/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.ts","../src/components/Link/LinkSelector/LoadingIndicator.tsx","../src/components/Link/LinkSelector/SectionLink.tsx","../src/components/Link/LinkSelector/PageLink.tsx","../src/components/Link/LinkSelector/PageLinks.tsx","../src/components/Link/LinkSelector/DocumentLink.tsx","../src/components/Link/LinkSelector/DocumentLinks.tsx","../src/components/Link/LinkSelector/LinkSelector.tsx","../src/components/Link/LinkInput.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.tsx","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.tsx","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.tsx","../src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.ts","../src/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.ts","../src/components/RichTextEditor/RichTextEditor.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.ts","../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.ts","../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/LinkButton.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.ts","../src/components/RichTextEditor/plugins/LinkPlugin/index.ts","../src/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.ts","../src/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/helpers.tsx","../src/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.tsx","../src/components/RichTextEditor/constants.ts","../src/settings/background.ts","../src/settings/border.ts","../src/settings/borderRadius.ts","../src/settings/borderRadiusExtended.ts","../src/settings/gutter.ts","../src/settings/margin.ts","../src/settings/marginExtended.ts","../src/settings/padding.ts","../src/settings/paddingExtended.ts","../src/settings/securityDownloadable.ts","../src/settings/securityGlobalControl.ts","../src/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\n/**\n * Cleans and joins an array of inputs with possible undefined or boolean values.\n *\n * @param {Array} classNames Array of class names\n * @returns Clean string to be used for class name.\n */\nexport const joinClassNames = (classNames: (string | undefined | boolean)[]): string =>\n classNames.filter(Boolean).join(' ');\n","/* (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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Color } from '@frontify/fondue';\n\ntype ShortNotationColor = {\n r: number;\n g: number;\n b: number;\n a?: number;\n};\n\n/**\n * Maps color object from long to short rgba notation.\n *\n * @param {Object} Color object\n * @returns {Object} ShortNotationColor object\n */\n\nexport const toShortRgba = (color: unknown): ShortNotationColor => {\n const isRgbaLongFormat = (value: Color) => {\n const requiredKeys = ['red', 'green', 'blue'];\n return typeof value === 'object' && requiredKeys.every((i) => value.hasOwnProperty(i));\n };\n\n const mapToShortFormat = (value: Color): ShortNotationColor => {\n const alpha = typeof value.alpha === 'number' ? value.alpha : 1;\n return { r: value.red, g: value.green, b: value.blue, a: alpha };\n };\n\n if (isRgbaLongFormat(color as Color)) {\n return mapToShortFormat(color as Color);\n }\n\n return color as ShortNotationColor;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ColorInput, TinyColor } from '@ctrl/tinycolor';\nimport { type Color } from '@frontify/sidebar-settings';\n\nimport { toShortRgba } from './toShortRgba';\n\n/**\n * Calculates if text should be in a light color depending on color (e.g. background-color)\n *\n * @param {Object} value Object of RGBA values\n * @param {Number|undefined} threshold Threshold for the brightness\n * @returns {Boolean} Return if the color is dark\n */\n\nconst isRgbaLongFormat = (value: unknown): value is Color => {\n const requiredKeys = ['red', 'green', 'blue'];\n return typeof value === 'object' && requiredKeys.every((i) => value?.hasOwnProperty(i));\n};\n\nexport const isDark = (color: unknown, threshold?: number): boolean => {\n const inputColor = isRgbaLongFormat(color) ? toShortRgba(color) : (color as ColorInput);\n const parsedColor = new TinyColor(inputColor);\n\n if (threshold) {\n return parsedColor.getBrightness() < threshold;\n }\n\n return parsedColor.isDark() || (parsedColor.getAlpha() > 0.25 && parsedColor.getAlpha() < 1);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TinyColor } from '@ctrl/tinycolor';\nimport { type Color } from '@frontify/fondue';\n\nimport { toShortRgba } from './toShortRgba';\n\n/**\n * Maps color object of rgba values to hex alpha string.\n *\n * @param {Object} Color object\n * @returns {String} To be used as css value.\n */\n\nexport const toHex8String = (color: Color): string => new TinyColor(toShortRgba(color)).toHex8String();\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TinyColor } from '@ctrl/tinycolor';\nimport { type Color } from '@frontify/fondue';\n\nimport { toShortRgba } from './toShortRgba';\n\n/**\n * Maps color object of rgba values to hex alpha string.\n */\nexport const toHexString = (color: Color): string => new TinyColor(toShortRgba(color)).toHexString();\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TinyColor } from '@ctrl/tinycolor';\nimport { type Color } from '@frontify/fondue';\n\nimport { toShortRgba } from './toShortRgba';\n\n/**\n * Maps color object of rgba values to rgba string.\n *\n * @param {Object} Color object\n * @returns {String} To be used as css value.\n */\n\nexport const toRgbaString = (color: Color): string => new TinyColor(toShortRgba(color)).toRgbString();\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TinyColor } from '@ctrl/tinycolor';\n\n/**\n * Sets alpha value and returns rgba string.\n *\n * @param {string} color Rgb or hex string.\n * @returns {String} To be used as css value.\n */\n\nexport const setAlpha = (alpha: number, color?: string): string => {\n return new TinyColor(color).setAlpha(alpha).toRgbString();\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TinyColor } from '@ctrl/tinycolor';\nimport { type Color } from '@frontify/fondue';\n\n/**\n * Maps color strings to color objects.\n *\n * @param {String} String representing color\n * @returns {Color} Color object\n */\n\nexport const toColorObject = (colorString: string): Color => {\n const { r, g, b, a } = new TinyColor(colorString);\n return { red: r, green: g, blue: b, alpha: a };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ColorInput, TinyColor, readability } from '@ctrl/tinycolor';\nimport { type Color } from '@frontify/sidebar-settings';\n\nimport { toShortRgba } from './toShortRgba';\n\n/**\n * Returns darkened text color for a given background color, so that it is readable and has enough contrast (above 4.5)\n *\n * @param {Object} textColor Object of RGBA values\n * @param {Object} backgroundColor Object of RGBA values\n * @returns {string} To be used as css value\n */\n\nconst isRgbaLongFormat = (value: unknown): value is Color => {\n const requiredKeys = ['red', 'green', 'blue'];\n return typeof value === 'object' && requiredKeys.every((i) => value?.hasOwnProperty(i));\n};\n\nexport const getReadableColor = (textColor: unknown, backgroundColor: unknown): string => {\n const inputTextColor = isRgbaLongFormat(textColor) ? toShortRgba(textColor) : (textColor as ColorInput);\n const inputBackgroundColor = isRgbaLongFormat(backgroundColor)\n ? toShortRgba(backgroundColor)\n : (backgroundColor as ColorInput);\n let parsedTextColor = new TinyColor(inputTextColor);\n const parsedBackgroundColor = new TinyColor(inputBackgroundColor);\n\n // darken the text color until readability is good\n while (readability(parsedTextColor, parsedBackgroundColor) < 4.5) {\n parsedTextColor = parsedTextColor.darken(1);\n }\n\n return parsedTextColor.toRgbString();\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\n/**\n * Moves an item from the 'from' position to the 'to' position and updates the array\n *\n * @param {Array} array Array of items\n * @param {Number} from Initial index of the item\n * @param {Number} to New index of the item\n * @returns {Array} New array with the item moved to the new position\n */\nexport const moveItemInArray = <T>(array: T[], from: number, to: number): T[] => {\n const newArray = [...array];\n const toIndex = to < 0 ? newArray.length + to : to;\n\n if (toIndex >= 0 && toIndex < newArray.length) {\n const slice = newArray.splice(from, 1)[0];\n newArray.splice(toIndex, 0, slice);\n }\n\n return newArray;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Color } from '@frontify/fondue';\nimport { type CSSProperties } from 'react';\n\nimport { toRgbaString } from '../color';\n\nexport const getBackgroundColorStyles = (backgroundColor: Color): CSSProperties => ({\n backgroundColor: toRgbaString(backgroundColor),\n});\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const BACKGROUND_COLOR_DEFAULT_VALUE = {\n red: 241,\n green: 241,\n blue: 241,\n alpha: 1,\n};\n\nexport const BORDER_COLOR_DEFAULT_VALUE = {\n red: 234,\n green: 235,\n blue: 235,\n alpha: 1,\n};\n\nexport const BORDER_WIDTH_DEFAULT_VALUE = '1px';\n\nexport const PADDING_DEFAULT_PLACEHOLDER = '24px';\n\nexport const MARGIN_DEFAULT_PLACEHOLDER = '24px';\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Color } from '@frontify/sidebar-settings';\n\nexport enum BorderStyle {\n Solid = 'Solid',\n Dashed = 'Dashed',\n Dotted = 'Dotted',\n}\n\nexport const borderStyleMap: Record<BorderStyle, string> = {\n [BorderStyle.Solid]: 'solid',\n [BorderStyle.Dotted]: 'dotted',\n [BorderStyle.Dashed]: 'dashed',\n};\n\nexport enum Radius {\n None = 'None',\n Small = 'Small',\n Medium = 'Medium',\n Large = 'Large',\n}\n\nexport const radiusStyleMap: Record<Radius, string> = {\n [Radius.None]: '0px',\n [Radius.Small]: '2px',\n [Radius.Medium]: '4px',\n [Radius.Large]: '12px',\n};\n\nexport enum Padding {\n None = 'None',\n Small = 'Small',\n Medium = 'Medium',\n Large = 'Large',\n}\n\nexport const paddingStyleMap: Record<Padding, string> = {\n [Padding.None]: '0px',\n [Padding.Small]: '24px',\n [Padding.Medium]: '36px',\n [Padding.Large]: '60px',\n};\n\nexport type PaddingSettings = {\n paddingChoice: Padding;\n hasCustomPaddingValue: boolean;\n paddingValue: string;\n};\n\nexport type PaddingExtendedSettings = {\n hasExtendedCustomPadding: boolean;\n extendedPaddingChoice: Padding;\n extendedPaddingTop: string;\n extendedPaddingRight: string;\n extendedPaddingBottom: string;\n extendedPaddingLeft: string;\n};\n\nexport type RadiusExtendedSettings = {\n hasExtendedCustomRadius: boolean;\n extendedRadiusChoice: Radius;\n extendedRadiusTopLeft: string;\n extendedRadiusTopRight: string;\n extendedRadiusBottomLeft: string;\n extendedRadiusBottomRight: string;\n};\n\nexport type BorderSettings = {\n hasBorder: boolean;\n borderStyle: BorderStyle;\n borderWidth: string;\n borderColor: Color;\n};\n\nexport type RadiusSettings = {\n hasRadius: boolean;\n radiusValue: string;\n radiusChoice: Radius;\n};\n\nexport enum Margin {\n None = 'None',\n Small = 'Small',\n Medium = 'Medium',\n Large = 'Large',\n}\n\nexport const marginStyleMap: Record<Margin, string> = {\n [Margin.None]: '0px',\n [Margin.Small]: '24px',\n [Margin.Medium]: '36px',\n [Margin.Large]: '60px',\n};\n\nexport type MarginSettings = {\n marginChoice: Margin;\n hasCustomMarginValue: boolean;\n marginValue: string;\n};\n\nexport type MarginExtendedSettings = {\n hasExtendedCustomMargin: boolean;\n extendedMarginChoice: Margin;\n extendedMarginTop: string;\n extendedMarginRight: string;\n extendedMarginBottom: string;\n extendedMarginLeft: string;\n};\n\nexport enum Security {\n Global = 'Global',\n Custom = 'Custom',\n}\n\nexport enum GutterSpacing {\n Auto = 'Auto',\n S = 'S',\n M = 'M',\n L = 'L',\n}\n\nexport const gutterSpacingStyleMap: Record<GutterSpacing, string> = {\n [GutterSpacing.Auto]: '4px',\n [GutterSpacing.S]: '10px',\n [GutterSpacing.M]: '30px',\n [GutterSpacing.L]: '50px',\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Color } from '@frontify/fondue';\nimport { type CSSProperties } from 'react';\n\nimport { BORDER_COLOR_DEFAULT_VALUE } from '../../settings/defaultValues';\nimport { BorderStyle, borderStyleMap } from '../../settings/types';\nimport { toRgbaString } from '../color';\n\nexport const getBorderStyles = (\n style = BorderStyle.Solid,\n borderWidth = '1px',\n color = BORDER_COLOR_DEFAULT_VALUE as Color,\n): CSSProperties => {\n return {\n borderStyle: borderStyleMap[style],\n borderWidth,\n borderColor: toRgbaString(color),\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type CSSProperties } from 'react';\n\nimport { type Radius, radiusStyleMap } from '../../settings/types';\n\nexport const getRadiusStyles = (radiusChoice: Radius, hasRadius = false, radiusValue?: number): CSSProperties => ({\n borderRadius: hasRadius ? radiusValue : radiusStyleMap[radiusChoice],\n});\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactNode, createContext, useContext } from 'react';\n\nconst DragPreviewContext = createContext(false);\nDragPreviewContext.displayName = 'DragPreviewContext';\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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Dispatch, type ReactNode, type 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});\nMultiFlyoutContext.displayName = 'MultiFlyoutContext';\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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useCallback } from 'react';\n\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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock, type Asset, useBlockAssets } from '@frontify/app-bridge';\nimport { type ReactNode, createContext, useContext } from 'react';\n\nimport { type BlockProps } from '../index';\n\nexport const useAttachmentOperations = (attachmentKey: string, blockAssetBundle: ReturnType<typeof useBlockAssets>) => {\n const { blockAssets, addAssetIdsToKey, deleteAssetIdsFromKey, updateAssetIdsFromKey } = blockAssetBundle;\n const attachments = blockAssets?.[attachmentKey] || [];\n\n const onAttachmentsAdd = async (newAssets: Asset[]) => {\n await addAssetIdsToKey(\n attachmentKey,\n newAssets.map((asset) => asset.id),\n );\n };\n\n const onAttachmentDelete = async (assetToDelete: Asset) => {\n await deleteAssetIdsFromKey(attachmentKey, [assetToDelete.id]);\n };\n\n const onAttachmentReplace = async (attachmentToReplace: Asset, newAsset: Asset) => {\n const newAssetIds = attachments.map((attachment) =>\n attachment.id === attachmentToReplace.id ? newAsset.id : attachment.id,\n );\n\n await updateAssetIdsFromKey(attachmentKey, newAssetIds);\n };\n\n const onAttachmentsSorted = async (assets: Asset[]) => {\n const newAssetIds = assets.map((asset) => asset.id);\n\n await updateAssetIdsFromKey(attachmentKey, newAssetIds);\n };\n\n return {\n onAttachmentsAdd,\n onAttachmentDelete,\n onAttachmentReplace,\n onAttachmentsSorted,\n attachments,\n };\n};\n\nexport const useAttachments = (appBridge: AppBridgeBlock, attachmentKey: string) => {\n const { onAttachmentsAdd, onAttachmentDelete, onAttachmentReplace, onAttachmentsSorted, attachments } =\n useAttachmentOperations(attachmentKey, useBlockAssets(appBridge));\n\n return {\n onAttachmentsAdd,\n onAttachmentDelete,\n onAttachmentReplace,\n onAttachmentsSorted,\n attachments,\n appBridge,\n };\n};\n\nconst AttachmentsContext = createContext<ReturnType<typeof useAttachments> | null>(null);\nAttachmentsContext.displayName = 'AttachmentsContext';\n\nexport const AttachmentsProvider = ({\n appBridge,\n children,\n assetId,\n}: {\n appBridge: AppBridgeBlock;\n children: ReactNode;\n assetId: string;\n}) => {\n const attachmentContext = useAttachments(appBridge, assetId);\n\n return <AttachmentsContext.Provider value={attachmentContext}>{children}</AttachmentsContext.Provider>;\n};\n\nexport const AttachmentOperationsProvider = ({\n blockAssetBundle,\n appBridge,\n children,\n assetId,\n}: {\n blockAssetBundle: ReturnType<typeof useBlockAssets>;\n children: ReactNode;\n assetId: string;\n appBridge: AppBridgeBlock;\n}) => {\n const attachmentContext = useAttachmentOperations(assetId, blockAssetBundle);\n\n return (\n <AttachmentsContext.Provider value={{ ...attachmentContext, appBridge }}>\n {children}\n </AttachmentsContext.Provider>\n );\n};\n\nexport const useAttachmentsContext = () => {\n const context = useContext(AttachmentsContext);\n\n if (!context) {\n throw new Error(\n \"No AttachmentsContext Provided. Component must be wrapped in an 'AttachmentsProvider' or the 'withAttachmentsProvider' HOC\",\n );\n }\n\n return context;\n};\n\n/**\n * Block-level HOC for cases when there is only one attachment asset field related to the block.\n * Recommended for most cases.\n * If finer control is required over attachments, use {@link AttachmentsProvider} component.\n */\nexport const withAttachmentsProvider = <T extends BlockProps>(Component: (props: T) => ReactNode, assetId: string) => {\n const wrappedComponent = (props: T) => (\n <AttachmentsProvider appBridge={props.appBridge} assetId={assetId}>\n <Component {...props} />\n </AttachmentsProvider>\n );\n\n wrappedComponent.displayName = 'withAttachmentsProvider';\n\n return wrappedComponent;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { KeyboardCode, type KeyboardCoordinateGetter } from '@dnd-kit/core';\n\nconst directions: string[] = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];\n\nexport const customCoordinatesGetterFactory =\n (columnGap: number, rowGap: number): KeyboardCoordinateGetter =>\n (event, { currentCoordinates, context: { activeNode } }) => {\n event.preventDefault();\n if (directions.includes(event.code)) {\n const width = activeNode?.offsetWidth ?? 0;\n const height = activeNode?.offsetHeight ?? 0;\n\n switch (event.code) {\n case KeyboardCode.Right:\n return {\n ...currentCoordinates,\n x: currentCoordinates.x + width + columnGap,\n };\n case KeyboardCode.Left:\n return {\n ...currentCoordinates,\n x: currentCoordinates.x - width - columnGap,\n };\n case KeyboardCode.Down:\n return {\n ...currentCoordinates,\n y: currentCoordinates.y + height + rowGap,\n };\n case KeyboardCode.Up:\n return {\n ...currentCoordinates,\n y: currentCoordinates.y - height - rowGap,\n };\n }\n }\n return undefined;\n };\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { KeyboardSensor, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';\nimport { useMemo } from 'react';\n\nimport { customCoordinatesGetterFactory } from '../helpers/customCoordinatesGetterFactory';\n\nconst keyboardCodes = {\n start: ['Space', 'Enter'],\n cancel: [],\n end: ['Space', 'Enter', 'Escape'],\n};\n\nexport const useDndSensors = (columnGap = 0, rowGap = 0) => {\n const keyboardSensorOptions = useMemo(() => {\n const customCoordinatesGetter = customCoordinatesGetterFactory(columnGap, rowGap);\n return {\n coordinateGetter: customCoordinatesGetter,\n keyboardCodes,\n };\n }, [columnGap, rowGap]);\n\n const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, keyboardSensorOptions));\n\n return sensors;\n};\n","/* (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","/* (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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n DndContext,\n type DragEndEvent,\n type DragStartEvent,\n KeyboardSensor,\n PointerSensor,\n closestCenter,\n useSensor,\n useSensors,\n} from '@dnd-kit/core';\nimport { restrictToVerticalAxis } from '@dnd-kit/modifiers';\nimport { SortableContext, arrayMove, rectSortingStrategy } from '@dnd-kit/sortable';\nimport { type Asset, useAssetChooser, useAssetUpload, useEditorState } from '@frontify/app-bridge';\nimport { AssetInput, AssetInputSize } from '@frontify/fondue';\nimport { Tooltip, Flyout } from '@frontify/fondue/components';\nimport { useEffect, useState } from 'react';\n\nimport { SortableAttachmentItem } from './AttachmentItem';\nimport { AttachmentsButtonTrigger } from './AttachmentsButtonTrigger';\nimport { type AttachmentsProps } from './types';\n\nexport const Attachments = ({\n items = [],\n onDelete,\n onReplaceWithBrowse,\n onReplaceWithUpload,\n onBrowse,\n onUpload,\n onSorted,\n appBridge,\n triggerComponent: TriggerComponent = AttachmentsButtonTrigger,\n isOpen,\n onOpenChange,\n}: AttachmentsProps) => {\n const [internalItems, setInternalItems] = useState<Asset[]>(items);\n const [isFlyoutOpenInternal, setIsFlyoutOpenInternal] = useState(false);\n const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor));\n const [draggedAssetId, setDraggedAssetId] = useState<number | undefined>(undefined);\n const [isUploadLoading, setIsUploadLoading] = useState(false);\n const [assetIdsLoading, setAssetIdsLoading] = useState<number[]>([]);\n const [selectedFiles, setSelectedFiles] = useState<FileList | null>(null);\n const isEditing = useEditorState(appBridge);\n const { openAssetChooser, closeAssetChooser } = useAssetChooser(appBridge);\n const isControllingStateExternally = isOpen !== undefined;\n const isFlyoutOpen = isControllingStateExternally ? isOpen : isFlyoutOpenInternal;\n\n const draggedItem = internalItems?.find((item) => item.id === draggedAssetId);\n\n const [uploadFile, { results: uploadResults, doneAll }] = useAssetUpload({\n onUploadProgress: () => !isUploadLoading && setIsUploadLoading(true),\n });\n\n const handleFlyoutOpenChange = (isOpen: boolean) => {\n const stateSetter = isControllingStateExternally ? onOpenChange : setIsFlyoutOpenInternal;\n\n stateSetter?.(isOpen);\n };\n\n useEffect(() => {\n setInternalItems(items);\n }, [items]);\n\n useEffect(() => {\n if (selectedFiles) {\n setIsUploadLoading(true);\n uploadFile(selectedFiles);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedFiles]);\n\n useEffect(() => {\n const uploadDone = async () => {\n if (doneAll) {\n await onUpload(uploadResults);\n setIsUploadLoading(false);\n }\n };\n uploadDone();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [doneAll, uploadResults]);\n\n const onOpenAssetChooser = () => {\n handleFlyoutOpenChange(false);\n openAssetChooser(\n (result: Asset[]) => {\n onBrowse(result);\n closeAssetChooser();\n handleFlyoutOpenChange(true);\n },\n {\n multiSelection: true,\n selectedValueIds: internalItems.map((internalItem) => internalItem.id),\n },\n );\n };\n\n const onReplaceItemWithBrowse = (toReplace: Asset) => {\n handleFlyoutOpenChange(false);\n openAssetChooser(\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async (result: Asset[]) => {\n handleFlyoutOpenChange(true);\n closeAssetChooser();\n setAssetIdsLoading([...assetIdsLoading, toReplace.id]);\n await onReplaceWithBrowse(toReplace, result[0]);\n setAssetIdsLoading(assetIdsLoading.filter((id) => id !== toReplace.id));\n },\n {\n multiSelection: false,\n selectedValueIds: internalItems.map((internalItem) => internalItem.id),\n },\n );\n };\n\n const onReplaceItemWithUpload = async (toReplace: Asset, uploadedAsset: Asset) => {\n setAssetIdsLoading([...assetIdsLoading, toReplace.id]);\n await onReplaceWithUpload(toReplace, uploadedAsset);\n setAssetIdsLoading(assetIdsLoading.filter((id) => id !== toReplace.id));\n };\n\n const handleDragStart = (event: DragStartEvent) => {\n const { active } = event;\n setDraggedAssetId(active.id as number);\n };\n\n const handleDragEnd = (event: DragEndEvent) => {\n const { active, over } = event;\n if (over && active.id !== over.id && internalItems) {\n const oldIndex = internalItems.findIndex((i) => i.id === active.id);\n const newIndex = internalItems.findIndex((i) => i.id === over.id);\n const sortedItems = arrayMove(internalItems, oldIndex, newIndex);\n setInternalItems(sortedItems);\n onSorted(sortedItems);\n }\n setDraggedAssetId(undefined);\n };\n\n const autoFocusModifier = {\n onOpenAutoFocus: (event: Event) => {\n event.preventDefault();\n },\n onEscapeKeyDown: (event: Event) => {\n event.stopPropagation();\n handleFlyoutOpenChange(false);\n },\n };\n\n return isEditing || (internalItems?.length ?? 0) > 0 ? (\n <div data-test-id=\"attachments-flyout-button\">\n <Flyout.Root\n open={isFlyoutOpen}\n onOpenChange={(isOpen) => handleFlyoutOpenChange(draggedItem ? true : isOpen)}\n >\n <Tooltip.Root enterDelay={500}>\n <Tooltip.Trigger asChild>\n <Flyout.Trigger asChild data-test-id=\"attachments-button-trigger\">\n <TriggerComponent isFlyoutOpen={isFlyoutOpen}>\n <div>{items.length > 0 ? items.length : 'Add'}</div>\n </TriggerComponent>\n </Flyout.Trigger>\n </Tooltip.Trigger>\n <Flyout.Content side=\"bottom\" align=\"end\" {...autoFocusModifier}>\n <div className=\"tw-w-[300px]\" data-test-id=\"attachments-flyout-content\">\n {internalItems.length > 0 && (\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n modifiers={[restrictToVerticalAxis]}\n >\n <SortableContext items={internalItems} strategy={rectSortingStrategy}>\n <div className=\"tw-border-b tw-border-b-line tw-relative\">\n {internalItems.map((item) => (\n <SortableAttachmentItem\n isEditing={isEditing}\n isLoading={assetIdsLoading.includes(item.id)}\n key={item.id}\n item={item}\n onDelete={() => onDelete(item)}\n onReplaceWithBrowse={() => onReplaceItemWithBrowse(item)}\n onReplaceWithUpload={(uploadedAsset: Asset) =>\n onReplaceItemWithUpload(item, uploadedAsset)\n }\n onDownload={() =>\n appBridge.dispatch({\n name: 'downloadAsset',\n payload: item,\n })\n }\n />\n ))}\n </div>\n </SortableContext>\n </DndContext>\n )}\n {isEditing && (\n <div className=\"tw-px-5 tw-py-3\">\n <div className=\"tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4\">\n Add attachments\n </div>\n <AssetInput\n isLoading={isUploadLoading}\n size={AssetInputSize.Small}\n onUploadClick={(fileList) => setSelectedFiles(fileList)}\n onLibraryClick={onOpenAssetChooser}\n />\n </div>\n )}\n </div>\n </Flyout.Content>\n <Tooltip.Content side=\"top\">Attachments</Tooltip.Content>\n </Tooltip.Root>\n </Flyout.Root>\n </div>\n ) : null;\n};\n","/* (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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type HTMLAttributes, type ReactNode, forwardRef } from 'react';\n\nimport { getToolbarButtonClassNames } from './helpers';\n\ntype BaseToolbarButtonProps = {\n children: ReactNode;\n forceActiveStyle?: boolean;\n cursor?: 'pointer' | 'grab';\n 'data-test-id'?: string;\n} & HTMLAttributes<HTMLButtonElement>;\n\nexport const BaseToolbarButton = forwardRef<HTMLButtonElement, BaseToolbarButtonProps>(\n (\n {\n onClick,\n children,\n forceActiveStyle,\n cursor = 'pointer',\n 'data-test-id': dataTestId = 'base-toolbar-button',\n ...props\n },\n ref,\n ) => (\n <button\n onClick={onClick}\n className={getToolbarButtonClassNames(cursor, forceActiveStyle)}\n data-test-id={dataTestId}\n {...props}\n ref={ref}\n >\n {children}\n </button>\n ),\n);\n\nBaseToolbarButton.displayName = 'BaseToolbarButton';\n","/* (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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useMemoizedId } from '@frontify/fondue';\n\nimport { useAttachmentsContext } from '../../../../hooks';\nimport { Attachments } from '../../../Attachments';\nimport { useDragPreviewContext } from '../context/DragPreviewContext';\nimport { useMultiFlyoutState } from '../hooks/useMultiFlyoutState';\n\nimport { AttachmentsToolbarButtonTrigger } from './AttachmentsToolbarButtonTrigger';\n\nexport const DEFAULT_ATTACHMENTS_BUTTON_ID = 'attachments';\n\ntype AttachmentsToolbarButtonProps = { flyoutId?: string };\n\nexport const AttachmentsToolbarButton = ({\n flyoutId = DEFAULT_ATTACHMENTS_BUTTON_ID,\n}: AttachmentsToolbarButtonProps) => {\n const id = useMemoizedId(flyoutId);\n\n const { appBridge, attachments, onAttachmentsAdd, onAttachmentDelete, onAttachmentReplace, onAttachmentsSorted } =\n useAttachmentsContext();\n\n const { isOpen, onOpenChange } = useMultiFlyoutState(id);\n const isDragPreview = useDragPreviewContext();\n\n return (\n <Attachments\n onUpload={onAttachmentsAdd}\n onDelete={onAttachmentDelete}\n onReplaceWithBrowse={onAttachmentReplace}\n onReplaceWithUpload={onAttachmentReplace}\n onSorted={onAttachmentsSorted}\n onBrowse={onAttachmentsAdd}\n items={attachments}\n appBridge={appBridge}\n triggerComponent={AttachmentsToolbarButtonTrigger}\n isOpen={isOpen && !isDragPreview}\n onOpenChange={onOpenChange}\n />\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const DEFAULT_DRAG_TOOLTIP = 'Drag or press ↵ to move';\nexport const DEFAULT_DRAGGING_TOOLTIP = 'Move with ↑↓←→ and confirm with ↵';\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Tooltip } from '@frontify/fondue/components';\nimport { type ReactElement, type ReactNode } from 'react';\n\ntype ToolbarButtonTooltipProps = {\n content: ReactNode;\n children: ReactElement;\n open?: boolean;\n disabled?: boolean;\n};\n\nexport const ToolbarButtonTooltip = ({ content, children, open, disabled }: ToolbarButtonTooltipProps) => {\n return disabled ? (\n children\n ) : (\n <Tooltip.Root enterDelay={300} open={open}>\n <Tooltip.Trigger asChild>{children}</Tooltip.Trigger>\n <Tooltip.Content side=\"top\">\n <div>{content}</div>\n </Tooltip.Content>\n </Tooltip.Root>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactNode } from 'react';\n\nimport { DEFAULT_DRAGGING_TOOLTIP, DEFAULT_DRAG_TOOLTIP } from '../../constants';\nimport { BaseToolbarButton } from '../BaseToolbarButton';\nimport { ToolbarButtonTooltip } from '../ToolbarButtonTooltip';\nimport { useDragPreviewContext } from '../context/DragPreviewContext';\n\nexport type DragHandleToolbarButtonProps = {\n icon?: ReactNode;\n tooltip?: string;\n draggableProps: Record<string, unknown>;\n setActivatorNodeRef?: (node: HTMLElement | null) => void;\n};\n\nexport const DragHandleToolbarButton = ({\n tooltip,\n icon,\n setActivatorNodeRef,\n draggableProps,\n}: DragHandleToolbarButtonProps) => {\n const isDragPreview = useDragPreviewContext();\n\n return (\n <ToolbarButtonTooltip\n {...(isDragPreview && { open: isDragPreview })}\n content={<div>{isDragPreview ? DEFAULT_DRAGGING_TOOLTIP : (tooltip ?? DEFAULT_DRAG_TOOLTIP)}</div>}\n >\n <BaseToolbarButton\n ref={setActivatorNodeRef}\n data-test-id=\"block-item-wrapper-toolbar-btn\"\n forceActiveStyle={isDragPreview}\n cursor=\"grab\"\n {...draggableProps}\n >\n {icon}\n </BaseToolbarButton>\n </ToolbarButtonTooltip>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useMemoizedId } from '@frontify/fondue';\nimport { Flyout } from '@frontify/fondue/components';\nimport { type ReactNode } from 'react';\n\nimport { BaseToolbarButton } from '../BaseToolbarButton';\nimport { ToolbarButtonTooltip } from '../ToolbarButtonTooltip';\nimport { useDragPreviewContext } from '../context/DragPreviewContext';\nimport { useMultiFlyoutState } from '../hooks/useMultiFlyoutState';\n\nexport type FlyoutToolbarButtonProps = {\n content: ReactNode;\n icon: ReactNode;\n tooltip: ReactNode;\n flyoutId: string;\n flyoutFooter?: ReactNode;\n flyoutHeader?: ReactNode;\n};\n\nexport const FlyoutToolbarButton = ({\n content,\n icon,\n tooltip,\n flyoutId,\n flyoutFooter,\n flyoutHeader,\n}: FlyoutToolbarButtonProps) => {\n const id = useMemoizedId(flyoutId);\n\n const { isOpen, onOpenChange } = useMultiFlyoutState(id);\n\n const isDragPreview = useDragPreviewContext();\n\n return (\n <ToolbarButtonTooltip disabled={isDragPreview || isOpen} content={tooltip}>\n <div className=\"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative\">\n <Flyout.Root open={isOpen && !isDragPreview} onOpenChange={onOpenChange}>\n <Flyout.Trigger asChild>\n <BaseToolbarButton\n data-test-id=\"block-item-wrapper-toolbar-flyout\"\n forceActiveStyle={isOpen && !isDragPreview}\n >\n {icon}\n </BaseToolbarButton>\n </Flyout.Trigger>\n <Flyout.Content side=\"bottom\" align=\"end\" padding=\"comfortable\">\n {flyoutHeader ? <Flyout.Header>{flyoutHeader}</Flyout.Header> : null}\n <Flyout.Body>{content}</Flyout.Body>\n {flyoutFooter ? <Flyout.Footer>{flyoutFooter}</Flyout.Footer> : null}\n </Flyout.Content>\n </Flyout.Root>\n </div>\n </ToolbarButtonTooltip>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useMemoizedId } from '@frontify/fondue';\nimport { Dropdown, Tooltip } from '@frontify/fondue/components';\nimport { IconDotsHorizontal } from '@frontify/fondue/icons';\n\nimport { BaseToolbarButton } from '../BaseToolbarButton';\nimport { useDragPreviewContext } from '../context';\nimport { useMultiFlyoutState } from '../hooks';\n\nexport const DEFAULT_MENU_BUTTON_ID = 'menu';\n\nexport type MenuToolbarButtonProps = {\n items: {\n title: string;\n onClick: () => void;\n icon: JSX.Element;\n style?: 'default' | 'danger';\n }[][];\n flyoutId?: string;\n tooltip?: string;\n};\n\nexport const MenuToolbarButton = ({\n items,\n flyoutId = DEFAULT_MENU_BUTTON_ID,\n tooltip = 'Options',\n}: MenuToolbarButtonProps) => {\n const id = useMemoizedId(flyoutId);\n const { isOpen, onOpenChange } = useMultiFlyoutState(id);\n const isDragPreview = useDragPreviewContext();\n\n return (\n <Dropdown.Root open={isOpen && !isDragPreview} onOpenChange={onOpenChange}>\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <Dropdown.Trigger asChild>\n <BaseToolbarButton data-test-id=\"block-item-wrapper-toolbar-flyout\">\n <IconDotsHorizontal size=\"16\" />\n </BaseToolbarButton>\n </Dropdown.Trigger>\n </Tooltip.Trigger>\n <Dropdown.Content>\n {items.map((block, blockIndex) => (\n <Dropdown.Group key={blockIndex}>\n {block.map((item, itemIndex) => (\n <Dropdown.Item\n data-test-id=\"menu-item\"\n onSelect={() => {\n onOpenChange(false);\n item.onClick();\n }}\n emphasis={item.style || 'default'}\n key={`${blockIndex}-${itemIndex}`}\n >\n <div className=\"tw-mr-2\">{item.icon}</div>\n <span>{item.title}</span>\n </Dropdown.Item>\n ))}\n </Dropdown.Group>\n ))}\n </Dropdown.Content>\n <Tooltip.Content>{tooltip}</Tooltip.Content>\n </Tooltip.Root>\n </Dropdown.Root>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { BaseToolbarButton } from '../BaseToolbarButton';\nimport { ToolbarButtonTooltip } from '../ToolbarButtonTooltip';\nimport { useDragPreviewContext } from '../context/DragPreviewContext';\n\nexport type ToolbarButtonProps = { icon: JSX.Element; tooltip?: string; onClick: () => void };\n\nexport const ToolbarButton = ({ tooltip, icon, onClick }: ToolbarButtonProps) => {\n const isDragPreview = useDragPreviewContext();\n\n return (\n <ToolbarButtonTooltip disabled={isDragPreview} content={tooltip ?? ''}>\n <BaseToolbarButton data-test-id=\"block-item-wrapper-toolbar-btn\" onClick={onClick}>\n {icon}\n </BaseToolbarButton>\n </ToolbarButtonTooltip>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactNode } from 'react';\n\nexport const ToolbarSegment = ({ children }: { children: ReactNode }) => (\n <div\n data-test-id=\"block-item-wrapper-toolbar-segment\"\n className=\"tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-px tw-px-px tw-h-[26px] tw-items-center tw-self-start tw-leading-none\"\n >\n {children}\n </div>\n);\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { AttachmentsToolbarButton } from './AttachmentsToolbarButton';\nimport { DragHandleToolbarButton } from './DragHandleToolbarButton';\nimport { FlyoutToolbarButton } from './FlyoutToolbarButton';\nimport { MenuToolbarButton } from './MenuToolbarButton';\nimport { ToolbarButton } from './ToolbarButton';\nimport { ToolbarSegment } from './ToolbarSegment';\nimport { type ToolbarProps } from './types';\n\nexport const Toolbar = ({ items, attachments }: ToolbarProps) => (\n <div\n data-test-id=\"block-item-wrapper-toolbar\"\n className=\"tw-rounded-md tw-bg-base tw-border tw-border-line-strong tw-divide-x tw-divide-line-strong tw-shadow-lg tw-flex tw-flex-none tw-items-center tw-isolate\"\n >\n {attachments.isEnabled && (\n <ToolbarSegment>\n <AttachmentsToolbarButton />\n </ToolbarSegment>\n )}\n {items.length > 0 && (\n <ToolbarSegment>\n {items.map((item) => {\n switch (item.type) {\n case 'dragHandle':\n return <DragHandleToolbarButton key={item.tooltip + item.type} {...item} />;\n case 'menu':\n return <MenuToolbarButton key={item.tooltip + item.type} {...item} />;\n case 'flyout':\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands, @typescript-eslint/no-base-to-string\n return <FlyoutToolbarButton key={item.tooltip + item.type} {...item} />;\n default:\n return <ToolbarButton key={item.tooltip + item.type} {...item} />;\n }\n })}\n </ToolbarSegment>\n )}\n </div>\n);\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactElement, memo, useRef, useState } from 'react';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { DEFAULT_MENU_BUTTON_ID, Toolbar, type ToolbarItem } from './Toolbar';\nimport { DragPreviewContextProvider } from './Toolbar/context/DragPreviewContext';\nimport { MultiFlyoutContextProvider } from './Toolbar/context/MultiFlyoutContext';\nimport { type BlockItemWrapperProps } from './types';\n\nexport const BlockItemWrapper = memo(\n ({\n children,\n toolbarItems,\n shouldHideWrapper,\n shouldHideComponent = false,\n isDragging = false,\n shouldFillContainer,\n outlineOffset = 0,\n shouldBeShown = false,\n showAttachments = false,\n }: BlockItemWrapperProps): ReactElement => {\n const [openFlyoutIds, setOpenFlyoutIds] = useState<string[]>(shouldBeShown ? [DEFAULT_MENU_BUTTON_ID] : []);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n if (shouldHideWrapper) {\n return <>{children}</>;\n }\n\n const items = toolbarItems?.filter((item): item is ToolbarItem => item !== undefined);\n\n const shouldToolbarBeVisible = openFlyoutIds.length > 0 || shouldBeShown;\n\n return (\n <DragPreviewContextProvider isDragPreview={isDragging}>\n <MultiFlyoutContextProvider openFlyoutIds={openFlyoutIds} setOpenFlyoutIds={setOpenFlyoutIds}>\n <div\n ref={wrapperRef}\n data-test-id=\"block-item-wrapper\"\n style={{\n outlineOffset,\n }}\n className={joinClassNames([\n 'tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse',\n shouldFillContainer && 'tw-flex-1 tw-h-full tw-w-full',\n 'hover:tw-outline focus-within:tw-outline',\n shouldToolbarBeVisible && 'tw-outline',\n shouldHideComponent && 'tw-opacity-0',\n ])}\n >\n <div\n style={{\n right: -1 - outlineOffset,\n bottom: `calc(100% - ${2 + outlineOffset}px)`,\n }}\n className={joinClassNames([\n 'tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]',\n 'group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100',\n 'tw-flex tw-justify-end',\n shouldToolbarBeVisible && 'tw-opacity-100',\n ])}\n >\n <Toolbar\n attachments={{\n isEnabled: showAttachments,\n }}\n items={items}\n />\n </div>\n {children}\n </div>\n </MultiFlyoutContextProvider>\n </DragPreviewContextProvider>\n );\n },\n);\n\nBlockItemWrapper.displayName = 'BlockItemWrapper';\n","/* (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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type RefObject, useEffect } from 'react';\n\nexport const useIsInViewport = <T extends Element>({\n ref,\n disabled,\n onChange,\n}: {\n ref: RefObject<T>;\n disabled: boolean;\n onChange: (isInViewport: boolean) => void;\n}) => {\n useEffect(() => {\n if (disabled || !ref.current) {\n return;\n }\n\n let isInViewport = false;\n\n const intersectionObserver = new IntersectionObserver(([entry]) => {\n if (entry.isIntersecting !== isInViewport) {\n isInViewport = entry.isIntersecting;\n onChange(entry.isIntersecting);\n }\n });\n\n intersectionObserver.observe(ref.current);\n\n return () => {\n intersectionObserver.disconnect();\n };\n }, [ref, disabled, onChange]);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { serializeRawToHtmlAsync } from '@frontify/fondue/rte';\nimport { useEffect, useState } from 'react';\n\nimport { type SerializedTextProps } from './types';\n\nexport const SerializedText = ({ value = '', gap, customClass, show = true, plugins }: SerializedTextProps) => {\n const [html, setHtml] = useState<string | null>(null);\n\n useEffect(() => {\n const updateHtml = async () => {\n const htmlContent = await serializeRawToHtmlAsync(value, plugins, undefined, gap, customClass);\n setHtml(htmlContent);\n };\n updateHtml().catch(console.error);\n }, [value, gap, plugins, customClass]);\n\n if (!show || html === '<br />' || html === null) {\n return null;\n }\n\n return (\n <div\n className=\"tw-w-full tw-whitespace-pre-wrap\"\n data-test-id=\"rte-content-html\"\n dangerouslySetInnerHTML={{ __html: html }}\n />\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { createStore } from '@frontify/fondue/rte';\n\nimport { type RichTextButtonStyle } from '../../types';\n\nexport type FloatingButtonMode = '' | 'insert' | 'edit';\n\nexport const floatingButtonStore: any = createStore('floatingButton')({\n openEditorId: null as null | string,\n mouseDown: false,\n updated: false,\n url: '',\n text: '',\n buttonStyle: 'primary' as RichTextButtonStyle,\n newTab: false,\n mode: '' as FloatingButtonMode,\n isEditing: false,\n})\n .extendActions((set) => ({\n reset: () => {\n set.url('');\n set.text('');\n set.buttonStyle('primary');\n set.newTab(false);\n set.mode('');\n set.isEditing(false);\n },\n }))\n .extendActions((set) => ({\n show: (mode: FloatingButtonMode, editorId: string) => {\n set.mode(mode);\n set.isEditing(false);\n set.openEditorId(editorId);\n },\n hide: () => {\n set.reset();\n set.openEditorId(null);\n },\n }))\n .extendSelectors((state) => ({\n isOpen: (editorId: string) => state.openEditorId === editorId,\n }));\n\nexport const floatingButtonActions = floatingButtonStore.set;\nexport const floatingButtonSelectors = floatingButtonStore.get;\n// eslint-disable-next-line @typescript-eslint/no-unsafe-return\nexport const useFloatingButtonSelectors = () => floatingButtonStore.use;\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\ntype TextElement = {\n text: string;\n children?: TextElement[];\n};\n\nexport const hasRichTextValue = (string?: string): boolean => {\n if (!string) {\n return false;\n }\n const hasText = (children: TextElement[]): boolean =>\n children.some((child: TextElement) => {\n if (child.text) {\n return child.text !== '';\n }\n if (child.children) {\n return hasText(child.children);\n }\n return false;\n });\n\n try {\n const json = JSON.parse(string);\n return hasText(json);\n } catch {\n return false;\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { hasRichTextValue } from './hasRichTextValue';\n\nexport const convertToRteValue = (textStyle = 'p', text = '', align?: 'center' | 'right' | 'left' | 'justify') =>\n hasRichTextValue(text) ? text : JSON.stringify([{ type: textStyle, children: [{ text, textStyle }], align }]);\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Security } from '../settings/types';\n\nexport const isDownloadable = (security: Security, downloadable: boolean, globalAssetDownloadEnabled: boolean) => {\n return security === Security.Custom ? downloadable : globalAssetDownloadEnabled;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ColorPalette } from '@frontify/app-bridge';\nimport { type 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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ELEMENT_LINK, type PlateEditor, getAboveNode } from '@frontify/fondue/rte';\n\nimport { type TLinkElement } from '../../RichTextEditor/plugins/LinkPlugin/types';\n\nconst getLinkNode = (editor: PlateEditor, cb: (link: TLinkElement) => string): string => {\n const linkNode = getAboveNode<TLinkElement>(editor, { match: { type: ELEMENT_LINK } });\n\n if (!Array.isArray(linkNode)) {\n return '';\n }\n\n return cb(linkNode[0]);\n};\n\nexport const getLegacyUrl = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.chosenLink?.searchResult?.link || '');\n};\n\nexport const getUrl = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.url || '');\n};\n\nexport const getUrlFromLinkOrLegacyLink = (link: TLinkElement): string => {\n return link.url || link.chosenLink?.searchResult?.link || '';\n};\n\nexport const getLinkFromEditor = (editor: PlateEditor) => {\n return getLinkNode(editor, getUrlFromLinkOrLegacyLink);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const relativeUrlRegex = /^\\/(document|r)\\/\\S+$/i;\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { relativeUrlRegex } from '../components/Link/utils';\n\nexport const addHttps = (url: string) => {\n if (relativeUrlRegex.test(url)) {\n return url;\n }\n try {\n new URL(url);\n return url;\n } catch {\n return `https://${url}`;\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { addHttps } from '../../../helpers';\n\nimport { relativeUrlRegex } from './relativeUrlRegex';\n\nexport const isValidUrl = (url: string) => {\n if (relativeUrlRegex.test(url)) {\n return true;\n }\n try {\n const parsedUrl = new URL(url);\n const validProtocols = ['http:', 'https:', 'mailto:', 'tel:'];\n return validProtocols.includes(parsedUrl.protocol) && parsedUrl.pathname !== '';\n } catch {\n return false;\n }\n};\n\nexport const isValidUrlOrEmpty = (url: string): boolean => {\n return isValidUrl(addHttps(url)) || url === '';\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type EText,\n Path,\n type PlateEditor,\n type Point,\n type Range,\n type Value,\n type WithOverride,\n getAboveNode,\n getNextNodeStartPoint,\n getPluginType,\n getPreviousNodeEndPoint,\n insertNodes,\n isCollapsed,\n isEndPoint,\n isStartPoint,\n mockPlugin,\n select,\n withRemoveEmptyNodes,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON } from './createButtonPlugin';\n\n/**\n * Insert space after a url to wrap a button.\n * Lookup from the block start to the cursor to check if there is an url.\n * If not found, lookup before the cursor for a space character to check the url.\n *\n * On insert data:\n * Paste a string inside a button element will edit its children text but not its url.\n *\n */\n\nexport const withButton: WithOverride = (editor, { type }) => {\n const { apply, normalizeNode } = editor;\n\n editor.apply = (operation) => {\n if (operation.type !== 'set_selection') {\n apply(operation);\n return;\n }\n\n const range = operation.newProperties;\n if (!range?.focus || !range.anchor || !isCollapsed(range as Range)) {\n apply(operation);\n return;\n }\n\n const entry = getAboveNode(editor, {\n at: range as Range,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (entry) {\n const [, path] = entry;\n\n let newPoint: Point | undefined;\n\n if (isStartPoint(editor, range.focus, path)) {\n newPoint = getPreviousNodeEndPoint(editor, path);\n }\n\n if (isEndPoint(editor, range.focus, path)) {\n newPoint = getNextNodeStartPoint(editor, path);\n }\n\n if (newPoint) {\n operation.newProperties = {\n anchor: newPoint,\n focus: newPoint,\n };\n }\n }\n\n apply(operation);\n };\n\n editor.normalizeNode = ([node, path]) => {\n if (node.type === getPluginType(editor, ELEMENT_BUTTON)) {\n const range = editor.selection as Range | null;\n\n if (range && isCollapsed(range) && isEndPoint(editor, range.focus, path)) {\n const nextPoint = getNextNodeStartPoint(editor, path);\n\n // select next text node if any\n if (nextPoint) {\n select(editor, nextPoint);\n } else {\n // insert text node then select\n const nextPath = Path.next(path);\n insertNodes(editor, { text: '' } as EText<Value>, { at: nextPath });\n select(editor, nextPath);\n }\n }\n }\n\n normalizeNode([node, path]);\n };\n\n return withRemoveEmptyNodes<Value, PlateEditor<Value>>(\n editor,\n mockPlugin<Record<string, any>, Value, PlateEditor<Value>>({\n options: { types: type },\n }),\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type InsertNodesOptions, type PlateEditor, type TText, type Value, insertNodes } from '@frontify/fondue/rte';\n\nimport { type TButtonElement } from '../types';\nimport { type CreateButtonNodeOptions, createButtonNode } from '../utils/index';\n\nexport const insertButton = <V extends Value>(\n editor: PlateEditor<V>,\n createButtonNodeOptions: CreateButtonNodeOptions,\n options?: InsertNodesOptions<V>,\n) => {\n insertNodes<TButtonElement | TText>(\n editor,\n [createButtonNode(editor, createButtonNodeOptions)],\n options as InsertNodesOptions,\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value, focusEditor, getPluginOptions } from '@frontify/fondue/rte';\n\nimport { floatingButtonActions, floatingButtonSelectors } from '../components/FloatingButton/floatingButtonStore';\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../createButtonPlugin';\n\nimport { upsertButton } from '.';\n\nexport const submitFloatingButton = <V extends Value>(editor: PlateEditor<V>) => {\n if (!editor.selection) {\n return;\n }\n\n const { isUrl, forceSubmit } = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON);\n const url = floatingButtonSelectors.url();\n\n const isValid = isUrl?.(url) || forceSubmit;\n if (!isValid) {\n return;\n }\n\n const text = floatingButtonSelectors.text();\n const buttonStyle = floatingButtonSelectors.buttonStyle();\n const target = floatingButtonSelectors.newTab() ? undefined : '_self';\n\n floatingButtonActions.reset();\n\n upsertButton(editor, {\n url,\n text,\n buttonStyle,\n target,\n isUrl: (_url) => (forceSubmit || !isUrl ? true : isUrl(_url)),\n });\n\n setTimeout(() => {\n focusEditor(editor, editor.selection ?? undefined);\n }, 0);\n\n return true;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateEditor,\n type UnwrapNodesOptions,\n type Value,\n getAboveNode,\n getPluginType,\n isElement,\n splitNodes,\n unwrapNodes,\n withoutNormalizing,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\n/**\n * Unwrap button node.\n */\nexport const unwrapButton = <V extends Value>(\n editor: PlateEditor<V>,\n options?: UnwrapNodesOptions & {\n split?: boolean;\n },\n) => {\n return withoutNormalizing(editor, () => {\n if (options?.split) {\n const buttonAboveAnchor = getAboveNode(editor, {\n at: editor.selection?.anchor,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // anchor in button\n if (buttonAboveAnchor) {\n splitNodes(editor, {\n at: editor.selection?.anchor,\n match: (n) => isElement(n) && n.type === getPluginType(editor, ELEMENT_BUTTON),\n });\n unwrapButton(editor, {\n at: editor.selection?.anchor,\n });\n return true;\n }\n const buttonAboveFocus = getAboveNode(editor, {\n at: editor.selection?.focus,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // focus in button\n if (buttonAboveFocus) {\n splitNodes(editor, {\n at: editor.selection?.focus,\n match: (n) => isElement(n) && n.type === getPluginType(editor, ELEMENT_BUTTON),\n });\n unwrapButton(editor, {\n at: editor.selection?.focus,\n });\n return true;\n }\n }\n\n unwrapNodes(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n ...options,\n });\n\n return;\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type InsertNodesOptions,\n type Path,\n type PlateEditor,\n type TNode,\n type TNodeEntry,\n type UnwrapNodesOptions,\n type Value,\n type WrapNodesOptions,\n findNode,\n getAboveNode,\n getEditorString,\n getNodeLeaf,\n getNodeProps,\n getPluginOptions,\n getPluginType,\n isDefined,\n isExpanded,\n removeNodes,\n setNodes,\n} from '@frontify/fondue/rte';\n\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../createButtonPlugin';\nimport { type RichTextButtonStyle, type TButtonElement } from '../types';\nimport { type CreateButtonNodeOptions } from '../utils/index';\n\nimport { insertButton, unwrapButton, upsertButtonText, wrapButton } from '.';\n\nexport type UpsertButtonOptions<V extends Value = Value> = CreateButtonNodeOptions & {\n /**\n * If true, insert text when selection is in url.\n */\n insertTextInButton?: boolean;\n insertNodesOptions?: InsertNodesOptions<V>;\n unwrapNodesOptions?: UnwrapNodesOptions<V>;\n wrapNodesOptions?: WrapNodesOptions<V>;\n isUrl?: (url: string) => boolean;\n};\n\n/**\n * If selection in a button or is not url:\n * - insert text with url, exit\n * If selection is expanded or `update` in a button:\n * - remove button node, get button text\n * Then:\n * - insert button node\n */\nexport const upsertButton = <V extends Value>(\n editor: PlateEditor<V>,\n {\n url,\n text,\n buttonStyle,\n target,\n insertTextInButton,\n insertNodesOptions,\n isUrl = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON).isUrl,\n }: UpsertButtonOptions<V>,\n) => {\n const at = editor.selection;\n if (!at) {\n return;\n }\n\n const buttonAbove = getAboveNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // anchor and focus in button -> insert text\n if (insertTextInButton && buttonAbove) {\n // we don't want to insert marks in buttons\n editor.insertText(url);\n return true;\n }\n\n if (!isUrl?.(url)) {\n return;\n }\n\n if (isDefined(text) && text.length === 0) {\n text = url;\n }\n\n if (buttonAbove) {\n editButtonUrlAndTarget<V>(url, editor, buttonAbove, target, buttonStyle, text);\n return true;\n }\n\n // selection contains at one edge edge or between the edges\n const buttonEntry = findNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n const [buttonNode, buttonPath] = buttonEntry ?? [];\n\n const shouldReplaceText = shouldReplaceButtonText<V>(editor, buttonPath, text);\n\n if (isExpanded(at)) {\n anchorAndFocusInButton<V>(buttonAbove, editor, url, buttonStyle, target, text);\n return true;\n }\n\n if (shouldReplaceText) {\n removeNodes(editor, {\n at: buttonPath,\n });\n }\n\n const props = getNodeProps(buttonNode ?? ({} as TNode));\n\n const path = editor.selection?.focus.path;\n if (!path) {\n return;\n }\n\n // button text should have the focused leaf marks\n const leaf = getNodeLeaf(editor, path);\n\n // if text is empty, text is url\n if (!text?.length) {\n text = url;\n }\n\n insertButton(\n editor,\n {\n ...props,\n url,\n target,\n children: [\n {\n ...leaf,\n text,\n },\n ],\n },\n insertNodesOptions,\n );\n return true;\n};\n\nfunction shouldReplaceButtonText<V extends Value>(editor: PlateEditor<V>, buttonPath?: Path, text?: string) {\n return buttonPath && text?.length && text !== getEditorString(editor, buttonPath);\n}\n\nfunction anchorAndFocusInButton<V extends Value>(\n buttonAbove: undefined,\n editor: PlateEditor<V>,\n url: string,\n buttonStyle?: RichTextButtonStyle,\n target?: string,\n text?: string,\n) {\n if (buttonAbove) {\n unwrapButton(editor, {\n at: buttonAbove[1],\n });\n } else {\n unwrapButton(editor, {\n split: true,\n });\n }\n\n wrapButton(editor, {\n url,\n buttonStyle,\n target,\n });\n\n upsertButtonText(editor, { url, target, text });\n}\n\nfunction editButtonUrlAndTarget<V extends Value>(\n url: string,\n editor: PlateEditor<V>,\n buttonAbove: TNodeEntry<TButtonElement>,\n target?: string,\n buttonStyle?: string,\n text?: string,\n) {\n if (\n url !== buttonAbove[0]?.url ||\n target !== buttonAbove[0]?.target ||\n buttonStyle !== buttonAbove[0]?.buttonStyle\n ) {\n setNodes<TButtonElement>(\n editor,\n { url, target, buttonStyle },\n {\n at: buttonAbove[1],\n },\n );\n }\n\n upsertButtonText(editor, { url, text, target });\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateEditor,\n type TText,\n type Value,\n getAboveNode,\n getEditorString,\n getPluginType,\n replaceNodeChildren,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type TButtonElement } from '..';\n\nimport { type UpsertButtonOptions } from './upsertButton';\n\n/**\n * If the text is different than the button above text, replace button children by a new text.\n * The new text has the same marks than the first text replaced.\n */\nexport const upsertButtonText = <V extends Value>(editor: PlateEditor<V>, { text }: UpsertButtonOptions<V>) => {\n const newButton = getAboveNode<TButtonElement>(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (newButton) {\n const [newButtonNode, newButtonPath] = newButton;\n\n if (text?.length && text !== getEditorString(editor, newButtonPath)) {\n const firstText = newButtonNode.children[0];\n\n // remove button children\n replaceNodeChildren<TText>(editor, {\n at: newButtonPath,\n nodes: { ...firstText, text },\n insertOptions: {\n select: true,\n },\n });\n }\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value, type WrapNodesOptions, getPluginType, wrapNodes } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type RichTextButtonStyle, type TButtonElement } from '..';\n\nexport interface WrapButtonOptions<V extends Value = Value> extends WrapNodesOptions<V> {\n url: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n}\n\n/**\n * Wrap a button node with split.\n */\nexport const wrapButton = <V extends Value>(\n editor: PlateEditor<V>,\n { url, buttonStyle, target, ...options }: WrapButtonOptions<V>,\n) => {\n wrapNodes<TButtonElement, Value>(\n editor,\n {\n type: getPluginType(editor, ELEMENT_BUTTON),\n url,\n buttonStyle,\n target,\n children: [],\n },\n { split: true, ...options } as WrapNodesOptions,\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, getAboveNode } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type TButtonElement } from '..';\n\nconst getLinkNode = (editor: PlateEditor, cb: (link: TButtonElement) => string): string => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return '';\n }\n\n return cb(linkNode[0]);\n};\n\nexport const getUrlFromEditor = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.url ?? '');\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type TText, type Value, getPluginType } from '@frontify/fondue/rte';\n\nimport { type RichTextButtonStyle, type TButtonElement } from '..';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\nexport interface CreateButtonNodeOptions {\n url: string;\n text?: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n children?: TText[];\n}\n\nexport const createButtonNode = <V extends Value>(\n editor: PlateEditor<V>,\n { url, text = '', buttonStyle = 'primary', target, children }: CreateButtonNodeOptions,\n): TButtonElement => {\n const type = getPluginType(editor, ELEMENT_BUTTON);\n\n return {\n type,\n url,\n target,\n buttonStyle,\n children: children ?? [{ text }],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value } from '@frontify/fondue/rte';\n\nimport { floatingButtonSelectors } from '../components';\n\nimport { triggerFloatingButtonEdit, triggerFloatingButtonInsert } from '.';\n\nexport const triggerFloatingButton = <V extends Value>(\n editor: PlateEditor<V>,\n {\n focused,\n }: {\n focused?: boolean;\n } = {},\n) => {\n if (floatingButtonSelectors.mode() === 'edit') {\n triggerFloatingButtonEdit(editor);\n return;\n }\n\n triggerFloatingButtonInsert(editor, {\n focused,\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value, findNode, getEditorString, getPluginType } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type TButtonElement } from '..';\nimport { floatingButtonActions } from '../components/FloatingButton/floatingButtonStore';\n\nexport const triggerFloatingButtonEdit = <V extends Value>(editor: PlateEditor<V>) => {\n const entry = findNode<TButtonElement>(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n if (!entry) {\n return;\n }\n\n const [link, path] = entry;\n\n let text = getEditorString(editor, path);\n\n floatingButtonActions.url(link.url);\n\n floatingButtonActions.newTab(link.target === undefined);\n\n if (text === link.url) {\n text = '';\n }\n\n floatingButtonActions.text(text);\n\n floatingButtonActions.isEditing(true);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateEditor,\n type Value,\n getEditorString,\n getPluginType,\n isRangeAcrossBlocks,\n someNode,\n} from '@frontify/fondue/rte';\n\nimport { floatingButtonActions, floatingButtonSelectors } from '../components/FloatingButton/floatingButtonStore';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\n/**\n * Trigger floating button.\n *\n * Do not trigger when:\n * - selection is across blocks\n * - selection has more than one leaf node\n * - lowest selection is not text\n * - selection has a button node\n */\nexport const triggerFloatingButtonInsert = <V extends Value>(\n editor: PlateEditor<V>,\n {\n focused,\n }: {\n focused?: boolean;\n } = {},\n) => {\n if (floatingButtonSelectors.mode()) {\n return;\n }\n\n if (!focused) {\n return;\n }\n\n if (isRangeAcrossBlocks(editor, { at: editor.selection })) {\n return;\n }\n\n const hasButton = someNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n if (hasButton) {\n return;\n }\n floatingButtonActions.text(getEditorString(editor, editor.selection));\n floatingButtonActions.show('insert', editor.id);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type CSSProperties } from 'react';\n\nconst DefaultButtonStyles: CSSProperties = {\n marginTop: '10px',\n marginBottom: '10px',\n display: 'inline-block',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n maxWidth: '100%',\n verticalAlign: 'middle',\n boxSizing: 'border-box',\n overflowWrap: 'normal',\n};\n\nexport const BlockButtonStyles: Record<string, CSSProperties & { hover?: CSSProperties }> = {\n buttonPrimary: {\n ...DefaultButtonStyles,\n fontFamily: 'var(--f-theme-settings-button-primary-font-family)',\n fontSize: 'var(--f-theme-settings-button-primary-font-size)',\n fontWeight: 'var(--f-theme-settings-button-primary-font-weight)',\n lineHeight: 'var(--f-theme-settings-button-primary-line-height)',\n paddingTop: 'var(--f-theme-settings-button-primary-padding-top)',\n paddingRight: 'var(--f-theme-settings-button-primary-padding-right)',\n paddingBottom: 'var(--f-theme-settings-button-primary-padding-bottom)',\n paddingLeft: 'var(--f-theme-settings-button-primary-padding-left)',\n fontStyle: 'var(--f-theme-settings-button-primary-font-style)',\n textTransform: 'var(--f-theme-settings-button-primary-text-transform)' as CSSProperties['textTransform'],\n backgroundColor: 'var(--f-theme-settings-button-primary-background-color)',\n borderColor: 'var(--f-theme-settings-button-primary-border-color)',\n borderRadius: 'var(--f-theme-settings-button-primary-border-radius)',\n borderWidth: 'var(--f-theme-settings-button-primary-border-width)',\n color: 'var(--f-theme-settings-button-primary-color)',\n\n hover: {\n backgroundColor: 'var(--f-theme-settings-button-primary-background-color-hover)',\n borderColor: 'var(--f-theme-settings-button-primary-border-color-hover)',\n color: 'var(--f-theme-settings-button-primary-color-hover)',\n },\n },\n\n buttonSecondary: {\n ...DefaultButtonStyles,\n fontFamily: 'var(--f-theme-settings-button-secondary-font-family)',\n fontSize: 'var(--f-theme-settings-button-secondary-font-size)',\n fontWeight: 'var(--f-theme-settings-button-secondary-font-weight)',\n lineHeight: 'var(--f-theme-settings-button-secondary-line-height)',\n paddingTop: 'var(--f-theme-settings-button-secondary-padding-top)',\n paddingRight: 'var(--f-theme-settings-button-secondary-padding-right)',\n paddingBottom: 'var(--f-theme-settings-button-secondary-padding-bottom)',\n paddingLeft: 'var(--f-theme-settings-button-secondary-padding-left)',\n fontStyle: 'var(--f-theme-settings-button-secondary-font-style)',\n textTransform: 'var(--f-theme-settings-button-secondary-text-transform)' as CSSProperties['textTransform'],\n backgroundColor: 'var(--f-theme-settings-button-secondary-background-color)',\n borderColor: 'var(--f-theme-settings-button-secondary-border-color)',\n borderRadius: 'var(--f-theme-settings-button-secondary-border-radius)',\n borderWidth: 'var(--f-theme-settings-button-secondary-border-width)',\n color: 'var(--f-theme-settings-button-secondary-color)',\n hover: {\n backgroundColor: 'var(--f-theme-settings-button-secondary-background-color-hover)',\n borderColor: 'var(--f-theme-settings-button-secondary-border-color-hover)',\n color: 'var(--f-theme-settings-button-secondary-color-hover)',\n },\n },\n\n buttonTertiary: {\n ...DefaultButtonStyles,\n fontFamily: 'var(--f-theme-settings-button-tertiary-font-family)',\n fontSize: 'var(--f-theme-settings-button-tertiary-font-size)',\n fontWeight: 'var(--f-theme-settings-button-tertiary-font-weight)',\n lineHeight: 'var(--f-theme-settings-button-tertiary-line-height)',\n paddingTop: 'var(--f-theme-settings-button-tertiary-padding-top)',\n paddingRight: 'var(--f-theme-settings-button-tertiary-padding-right)',\n paddingBottom: 'var(--f-theme-settings-button-tertiary-padding-bottom)',\n paddingLeft: 'var(--f-theme-settings-button-tertiary-padding-left)',\n fontStyle: 'var(--f-theme-settings-button-tertiary-font-style)',\n textTransform: 'var(--f-theme-settings-button-tertiary-text-transform)' as CSSProperties['textTransform'],\n backgroundColor: 'var(--f-theme-settings-button-tertiary-background-color)',\n borderColor: 'var(--f-theme-settings-button-tertiary-border-color)',\n borderRadius: 'var(--f-theme-settings-button-tertiary-border-radius)',\n borderWidth: 'var(--f-theme-settings-button-tertiary-border-width)',\n color: 'var(--f-theme-settings-button-tertiary-color)',\n hover: {\n backgroundColor: 'var(--f-theme-settings-button-tertiary-background-color-hover)',\n borderColor: 'var(--f-theme-settings-button-tertiary-border-color-hover)',\n color: 'var(--f-theme-settings-button-tertiary-color-hover)',\n },\n },\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateRenderElementProps, type Value } from '@frontify/fondue/rte';\nimport { type CSSProperties, type HTMLAttributeAnchorTarget, type ReactElement, type ReactNode, useState } from 'react';\n\nimport { type TButtonElement } from '../types';\nimport { BlockButtonStyles } from '../utils';\n\nexport type ButtonRootProps = PlateRenderElementProps<Value, TButtonElement>;\n\nexport const ButtonMarkupElementNode = (props: ButtonRootProps) => {\n const { attributes, children } = props;\n const href = props.element.url || props.element.chosenLink?.searchResult?.link || '';\n const target = props.element.target || '_self';\n const buttonStyle = String(props.element.buttonStyle) || 'primary';\n return (\n <HoverableButtonLink\n attributes={attributes}\n href={href}\n target={target}\n styles={BlockButtonStyles[`button${buttonStyle.charAt(0).toUpperCase() + buttonStyle.slice(1)}`]}\n >\n {children}\n </HoverableButtonLink>\n );\n};\n\ntype Props = {\n attributes: ButtonRootProps['attributes'];\n children: ReactNode;\n styles?: CSSProperties & { hover?: CSSProperties };\n href?: string;\n target?: HTMLAttributeAnchorTarget;\n};\n\nconst HoverableButtonLink = ({\n attributes,\n styles = { hover: {} },\n children,\n href = '#',\n target,\n}: Props): ReactElement => {\n const [hovered, setHovered] = useState(false);\n\n return (\n <a\n {...attributes}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n href={href}\n target={target}\n style={hovered ? { ...styles, ...styles.hover } : styles}\n >\n {children}\n </a>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { MarkupElement } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\nimport { ButtonMarkupElementNode } from './ButtonMarkupElementNode';\n\nexport class ButtonMarkupElement extends MarkupElement {\n constructor(id = ELEMENT_BUTTON, node = ButtonMarkupElementNode) {\n super(id, node);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconButton } from '@frontify/fondue/icons';\nimport { IconStylingWrapper, ToolbarButton, focusEditor, useEditorRef } from '@frontify/fondue/rte';\nimport { type ReactNode, forwardRef } from 'react';\n\nimport { triggerFloatingButton } from '../utils';\n\nexport const ButtonToolbarButton = forwardRef<\n HTMLButtonElement,\n { disabled: boolean; tooltip: ReactNode; pressed: boolean }\n>((rootProps, ref) => {\n const editor = useEditorRef();\n\n return (\n <ToolbarButton\n ref={ref}\n {...rootProps}\n onMouseDown={(event) => {\n event.preventDefault();\n focusEditor(editor, editor.selection ?? editor.prevSelection ?? undefined);\n }}\n onClick={() => {\n triggerFloatingButton(editor, { focused: true });\n }}\n >\n <IconStylingWrapper icon={<IconButton size={16} />} />\n </ToolbarButton>\n );\n});\n\nButtonToolbarButton.displayName = 'ButtonToolbarButton';\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PluginButtonProps,\n getHotkeyByPlatform,\n getPluginType,\n getTooltip,\n isRangeInSameBlock,\n someNode,\n useEditorState,\n useEventPlateId,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\nimport { ButtonToolbarButton } from './ButtonToolbarButton';\n\nexport const ButtonButton = ({ editorId, id }: PluginButtonProps) => {\n const editor = useEditorState(useEventPlateId(editorId));\n const isEnabled = !!isRangeInSameBlock(editor, {\n at: editor.selection,\n });\n const type = getPluginType(editor, ELEMENT_BUTTON);\n const isLink = !!editor?.selection && someNode(editor, { match: { type } });\n\n return (\n <div data-plugin-id={id}>\n <ButtonToolbarButton\n pressed={isLink}\n disabled={!isEnabled} // maybe pressed\n tooltip={getTooltip(\n isEnabled\n ? `Button\\n${getHotkeyByPlatform('Ctrl+Shift+K')}`\n : 'Buttons can only be set for a single text block.',\n )}\n />\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const LINK_PLUGIN = 'link-plugin';\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type CSSProperties } from 'react';\n\nimport { BlockButtonStyles } from './ButtonPlugin';\nimport { LINK_PLUGIN } from './LinkPlugin/id';\n\nexport enum TextStyles {\n heading1 = 'heading1',\n heading2 = 'heading2',\n heading3 = 'heading3',\n heading4 = 'heading4',\n custom1 = 'custom1',\n custom2 = 'custom2',\n custom3 = 'custom3',\n quote = 'quote',\n imageCaption = 'imageCaption',\n imageTitle = 'imageTitle',\n p = 'p',\n}\nexport const BlockStyles: Record<string, CSSProperties & { hover?: CSSProperties }> = {\n [TextStyles.heading1]: {\n fontSize: 'var(--f-theme-settings-heading1-font-size)',\n lineHeight: 'var(--f-theme-settings-heading1-line-height)',\n marginTop: 'var(--f-theme-settings-heading1-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading1-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading1-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading1-font-style)',\n textTransform: 'var(--f-theme-settings-heading1-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading1-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading1-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading1-font-family)',\n color: 'var(--f-theme-settings-heading1-color)',\n },\n [TextStyles.heading2]: {\n fontSize: 'var(--f-theme-settings-heading2-font-size)',\n lineHeight: 'var(--f-theme-settings-heading2-line-height)',\n marginTop: 'var(--f-theme-settings-heading2-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading2-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading2-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading2-font-style)',\n textTransform: 'var(--f-theme-settings-heading2-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading2-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading2-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading2-font-family)',\n color: 'var(--f-theme-settings-heading2-color)',\n },\n [TextStyles.heading3]: {\n fontSize: 'var(--f-theme-settings-heading3-font-size)',\n lineHeight: 'var(--f-theme-settings-heading3-line-height)',\n marginTop: 'var(--f-theme-settings-heading3-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading3-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading3-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading3-font-style)',\n textTransform: 'var(--f-theme-settings-heading3-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading3-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading3-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading3-font-family)',\n color: 'var(--f-theme-settings-heading3-color)',\n },\n [TextStyles.heading4]: {\n fontSize: 'var(--f-theme-settings-heading4-font-size)',\n lineHeight: 'var(--f-theme-settings-heading4-line-height)',\n marginTop: 'var(--f-theme-settings-heading4-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading4-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading4-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading4-font-style)',\n textTransform: 'var(--f-theme-settings-heading4-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading4-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading4-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading4-font-family)',\n color: 'var(--f-theme-settings-heading4-color)',\n },\n [TextStyles.custom1]: {\n fontSize: 'var(--f-theme-settings-custom1-font-size)',\n lineHeight: 'var(--f-theme-settings-custom1-line-height)',\n marginTop: 'var(--f-theme-settings-custom1-margin-top)',\n marginBottom: 'var(--f-theme-settings-custom1-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-custom1-text-decoration)',\n fontStyle: 'var(--f-theme-settings-custom1-font-style)',\n textTransform: 'var(--f-theme-settings-custom1-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-custom1-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-custom1-font-weight)',\n fontFamily: 'var(--f-theme-settings-custom1-font-family)',\n color: 'var(--f-theme-settings-custom1-color)',\n },\n [TextStyles.custom2]: {\n fontSize: 'var(--f-theme-settings-custom2-font-size)',\n lineHeight: 'var(--f-theme-settings-custom2-line-height)',\n marginTop: 'var(--f-theme-settings-custom2-margin-top)',\n marginBottom: 'var(--f-theme-settings-custom2-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-custom2-text-decoration)',\n fontStyle: 'var(--f-theme-settings-custom2-font-style)',\n textTransform: 'var(--f-theme-settings-custom2-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-custom2-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-custom2-font-weight)',\n fontFamily: 'var(--f-theme-settings-custom2-font-family)',\n color: 'var(--f-theme-settings-custom2-color)',\n },\n [TextStyles.custom3]: {\n fontSize: 'var(--f-theme-settings-custom3-font-size)',\n lineHeight: 'var(--f-theme-settings-custom3-line-height)',\n marginTop: 'var(--f-theme-settings-custom3-margin-top)',\n marginBottom: 'var(--f-theme-settings-custom3-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-custom3-text-decoration)',\n fontStyle: 'var(--f-theme-settings-custom3-font-style)',\n textTransform: 'var(--f-theme-settings-custom3-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-custom3-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-custom3-font-weight)',\n fontFamily: 'var(--f-theme-settings-custom3-font-family)',\n color: 'var(--f-theme-settings-custom3-color)',\n },\n [TextStyles.p]: {\n fontSize: 'var(--f-theme-settings-body-font-size)',\n lineHeight: 'var(--f-theme-settings-body-line-height)',\n marginTop: 'var(--f-theme-settings-body-margin-top)',\n marginBottom: 'var(--f-theme-settings-body-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-body-text-decoration)',\n fontStyle: 'var(--f-theme-settings-body-font-style)',\n textTransform: 'var(--f-theme-settings-body-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-body-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-body-font-weight)',\n fontFamily: 'var(--f-theme-settings-body-font-family)',\n color: 'var(--f-theme-settings-body-color)',\n },\n [TextStyles.quote]: {\n fontSize: 'var(--f-theme-settings-quote-font-size)',\n lineHeight: 'var(--f-theme-settings-quote-line-height)',\n marginTop: 'var(--f-theme-settings-quote-margin-top)',\n marginBottom: 'var(--f-theme-settings-quote-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-quote-text-decoration)',\n fontStyle: 'var(--f-theme-settings-quote-font-style)',\n textTransform: 'var(--f-theme-settings-quote-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-quote-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-quote-font-weight)',\n fontFamily: 'var(--f-theme-settings-quote-font-family)',\n color: 'var(--f-theme-settings-quote-color)',\n },\n [TextStyles.imageCaption]: {\n fontSize: 'var(--f-theme-settings-image-caption-font-size)',\n lineHeight: 'var(--f-theme-settings-image-caption-line-height)',\n marginTop: 'var(--f-theme-settings-image-caption-margin-top)',\n marginBottom: 'var(--f-theme-settings-image-caption-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-image-caption-text-decoration)',\n fontStyle: 'var(--f-theme-settings-image-caption-font-style)',\n textTransform: 'var(--f-theme-settings-image-caption-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-image-caption-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-image-caption-font-weight)',\n fontFamily: 'var(--f-theme-settings-image-caption-font-family)',\n color: 'var(--f-theme-settings-image-caption-color)',\n },\n [TextStyles.imageTitle]: {\n fontSize: 'var(--f-theme-settings-image-title-font-size)',\n lineHeight: 'var(--f-theme-settings-image-title-line-height)',\n marginTop: 'var(--f-theme-settings-image-title-margin-top)',\n marginBottom: 'var(--f-theme-settings-image-title-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-image-title-text-decoration)',\n fontStyle: 'var(--f-theme-settings-image-title-font-style)',\n textTransform: 'var(--f-theme-settings-image-title-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-image-title-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-image-title-font-weight)',\n fontFamily: 'var(--f-theme-settings-image-title-font-family)',\n color: 'var(--f-theme-settings-image-title-color)',\n },\n [LINK_PLUGIN]: {\n fontSize: 'var(--f-theme-settings-link-font-size)',\n lineHeight: 'var(--f-theme-settings-link-line-height)',\n marginTop: 'var(--f-theme-settings-link-margin-top)',\n marginBottom: 'var(--f-theme-settings-link-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-link-text-decoration)',\n fontStyle: 'var(--f-theme-settings-link-font-style)',\n textTransform: 'var(--f-theme-settings-link-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-link-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-link-font-weight)',\n fontFamily: 'var(--f-theme-settings-link-font-family)',\n color: 'var(--f-theme-settings-link-color)',\n },\n ...BlockButtonStyles,\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconPen, IconTrashBin } from '@frontify/fondue/icons';\nimport { FloatingModalWrapper, focusEditor, useEditorRef } from '@frontify/fondue/rte';\n\nimport { LINK_PLUGIN } from '../../../../LinkPlugin/id';\nimport { BlockStyles } from '../../../../styles';\nimport { unwrapButton } from '../../../transforms';\nimport { triggerFloatingButtonEdit } from '../../../utils';\nimport { floatingButtonSelectors } from '../floatingButtonStore';\n\nexport const EditModal = () => {\n const editor = useEditorRef();\n return (\n <FloatingModalWrapper padding=\"16px\" minWidth=\"400px\" data-test-id=\"floating-button-edit\">\n <span data-test-id=\"preview-button-flyout\" className=\"tw-flex tw-justify-between tw-items-center tw-gap-2\">\n <a\n data-test-id=\"floating-button-edit-url\"\n href={floatingButtonSelectors.url()}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n style={BlockStyles[LINK_PLUGIN]}\n className=\"tw-break-all\"\n >\n {floatingButtonSelectors.url()}\n </a>\n <span className=\"tw-flex tw-gap-2\">\n <button\n onClick={() => {\n triggerFloatingButtonEdit(editor);\n }}\n tabIndex={0}\n data-test-id=\"edit-button-button\"\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n >\n <IconPen size={16} />\n </button>\n\n <button\n onClick={() => {\n unwrapButton(editor);\n focusEditor(editor, editor.selection ?? undefined);\n }}\n tabIndex={0}\n data-test-id=\"remove-button-button\"\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n >\n <IconTrashBin size={16} />\n </button>\n </span>\n </span>\n </FloatingModalWrapper>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type DocumentSection } from '@frontify/app-bridge';\n\nimport { type DocumentSectionWithTitle } from '../types';\n\nexport const filterDocumentSectionsWithUnreadableTitles = (sections: DocumentSection[]) =>\n sections.filter((section) => !!section.title?.trim()) as DocumentSectionWithTitle[];\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { LoadingCircle } from '@frontify/fondue/components';\n\nexport const LoadingIndicator = () => {\n return (\n <div className=\"tw-flex tw-justify-center tw-h-10 tw-items-center\">\n <LoadingCircle size=\"small\" />\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { merge } from '@frontify/fondue';\nimport { IconDocumentText } from '@frontify/fondue/icons';\n\ntype SectionLinkProps = {\n section: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n};\n\nexport const SectionLink = ({ section, selectedUrl, onSelectUrl }: SectionLinkProps) => {\n const isActive = section.permanentLink === selectedUrl;\n\n return (\n <button\n data-test-id=\"internal-link-selector-section-link\"\n data-is-active={isActive}\n className={merge([\n 'tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full',\n isActive\n ? 'tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover'\n : 'hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover',\n ])}\n onClick={() => onSelectUrl(section.permanentLink)}\n >\n <div className=\"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6\">\n <IconDocumentText size={16} />\n <span className=\"tw-text-s\">{section.title}</span>\n <span className=\"tw-flex-auto tw-font-sans tw-text-xs tw-text-right\">Section</span>\n </div>\n </button>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type DocumentSection } from '@frontify/app-bridge';\nimport { merge } from '@frontify/fondue';\nimport { useEffect, useState } from 'react';\n\nimport { filterDocumentSectionsWithUnreadableTitles } from '../helpers/filterDocumentSectionsWithUnreadableTitles';\nimport { type DocumentSectionWithTitle, type InitiallyExpandedItems } from '../types';\n\nimport { SectionLink } from './SectionLink';\n\ntype PageLinkProps = {\n page: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n itemsToExpandInitially: InitiallyExpandedItems;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n};\n\nexport const PageLink = ({\n page,\n selectedUrl,\n onSelectUrl,\n itemsToExpandInitially,\n getDocumentSectionsByDocumentPageId,\n}: PageLinkProps) => {\n const [isExpanded, setIsExpanded] = useState(page.id === itemsToExpandInitially.documentId);\n const [documentSections, setDocumentSections] = useState<DocumentSectionWithTitle[]>([]);\n const isActive = page.permanentLink === selectedUrl;\n\n useEffect(() => {\n const fetchDocumentSections = async () => {\n const sections = await getDocumentSectionsByDocumentPageId(page.id);\n const sectionsWithReadableTitles = filterDocumentSectionsWithUnreadableTitles(sections);\n setDocumentSections(sectionsWithReadableTitles);\n };\n\n fetchDocumentSections();\n }, [page.id, getDocumentSectionsByDocumentPageId]);\n\n useEffect(() => {\n if (page.id === itemsToExpandInitially.pageId) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setIsExpanded(true);\n }\n }, [itemsToExpandInitially, page.id]);\n\n const hasSections = documentSections.length > 0;\n\n return (\n <>\n <button\n data-test-id=\"internal-link-selector-page-link\"\n className={merge([\n 'tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full',\n hasSections ? 'tw-pl-7' : 'tw-pl-12',\n isActive\n ? 'tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover'\n : 'hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover',\n ])}\n onClick={() => onSelectUrl(page.permanentLink)}\n >\n <div key={page.id} className=\"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6\">\n {hasSections && (\n <button\n data-test-id=\"tree-item-toggle\"\n className=\"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer\"\n onClick={() => setIsExpanded(!isExpanded)}\n onKeyDown={(event) => event.key === 'Enter' && event.stopPropagation()}\n >\n <div\n className={merge([\n 'tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong',\n isExpanded ? 'tw-rotate-90' : '',\n ])}\n ></div>\n </button>\n )}\n <span className=\"tw-text-s\">{page.title}</span>\n <span className=\"tw-flex-auto tw-font-sans tw-text-xs tw-text-right\">Page</span>\n </div>\n </button>\n {isExpanded &&\n documentSections.length > 0 &&\n documentSections.map((section) => {\n return (\n <SectionLink\n key={section.id}\n section={section}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n />\n );\n })}\n </>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { type ReactElement, useEffect, useState } from 'react';\n\nimport { type InitiallyExpandedItems } from '../types';\n\nimport { LoadingIndicator } from './LoadingIndicator';\nimport { PageLink } from './PageLink';\n\ntype PageLinksProps = {\n documentId: number;\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n itemsToExpandInitially: InitiallyExpandedItems;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const PageLinks = ({\n documentId,\n selectedUrl,\n onSelectUrl,\n itemsToExpandInitially,\n getDocumentSectionsByDocumentPageId,\n getDocumentPagesByDocumentId,\n}: PageLinksProps): ReactElement => {\n const [pages, setPages] = useState<DocumentPage[]>([]);\n const [isLoading, setIsLoading] = useState(true);\n const pagesArray = [...pages.values()];\n const hasPages = !isLoading && pagesArray.length > 0;\n\n useEffect(() => {\n getDocumentPagesByDocumentId(documentId)\n .then((_pages) => {\n const pagesWithCategories = _pages\n .filter((page) => !!page.category)\n .sort((a, b) =>\n a.category.sort === b.category.sort ? a.sort - b.sort : a.category.sort - b.category.sort,\n );\n const pagesWithoutCategories = _pages.filter((page) => !page.category).sort((a, b) => a.sort - b.sort);\n setPages([...pagesWithCategories, ...pagesWithoutCategories]);\n })\n .finally(() => {\n setIsLoading(false);\n });\n }, []);\n\n if (isLoading) {\n return <LoadingIndicator />;\n }\n\n return hasPages ? (\n <>\n {pagesArray.map((page) => {\n return (\n <PageLink\n key={page.id}\n page={page}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n itemsToExpandInitially={itemsToExpandInitially}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n />\n );\n })}\n </>\n ) : (\n <div className=\"tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-s tw-text-text-weak\">\n This document does not contain any pages.\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { merge } from '@frontify/fondue';\nimport { IconColorFan } from '@frontify/fondue/icons';\nimport { useEffect, useState } from 'react';\n\nimport { type InitiallyExpandedItems } from '../types';\n\nimport { PageLinks } from './PageLinks';\n\ntype DocumentLinkProps = {\n document: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n itemsToExpandInitially: InitiallyExpandedItems;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const DocumentLink = ({\n document,\n selectedUrl,\n onSelectUrl,\n itemsToExpandInitially,\n getDocumentSectionsByDocumentPageId,\n getDocumentPagesByDocumentId,\n}: DocumentLinkProps) => {\n const [isExpanded, setIsExpanded] = useState(document.id === itemsToExpandInitially.documentId);\n const isActive = document.permanentLink === selectedUrl;\n\n useEffect(() => {\n if (document.id === itemsToExpandInitially.documentId) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setIsExpanded(true);\n }\n }, [itemsToExpandInitially, document.id]);\n\n return (\n <>\n <button\n data-test-id=\"internal-link-selector-document-link\"\n className={merge([\n 'tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-w-full',\n isActive\n ? 'tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover'\n : 'hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover',\n ])}\n onClick={() => onSelectUrl(document.permanentLink)}\n >\n <button\n type=\"button\"\n tabIndex={0}\n data-test-id=\"tree-item-toggle\"\n className=\"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer\"\n onClick={() => setIsExpanded(!isExpanded)}\n onKeyDown={(event) => event.key === 'Enter' && event.stopPropagation()}\n >\n <div\n className={merge([\n 'tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong',\n isExpanded ? 'tw-rotate-90' : '',\n ])}\n ></div>\n </button>\n <IconColorFan size={16} />\n <span className=\"tw-text-s\">{document.title}</span>\n <span className=\"tw-flex-auto tw-font-sans tw-text-xs tw-text-right\">Document</span>\n </button>\n {isExpanded && (\n <PageLinks\n documentId={document.id}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n itemsToExpandInitially={itemsToExpandInitially}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n getDocumentPagesByDocumentId={getDocumentPagesByDocumentId}\n />\n )}\n </>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Document, type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { type ReactElement, useEffect, useState } from 'react';\n\nimport { filterDocumentSectionsWithUnreadableTitles } from '../helpers/filterDocumentSectionsWithUnreadableTitles';\nimport { type InitiallyExpandedItems } from '../types';\n\nimport { DocumentLink } from './DocumentLink';\nimport { LoadingIndicator } from './LoadingIndicator';\n\ntype DocumentLinksProps = {\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n getAllDocuments: () => Promise<Document[]>;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const DocumentLinks = ({\n selectedUrl,\n onSelectUrl,\n getAllDocuments,\n getDocumentPagesByDocumentId,\n getDocumentSectionsByDocumentPageId,\n}: DocumentLinksProps): ReactElement => {\n const [isLoading, setIsLoading] = useState(true);\n const [documents, setDocuments] = useState<Document[]>([]);\n const [itemsToExpandInitially, setItemsToExpandInitially] = useState<InitiallyExpandedItems>({\n documentId: undefined,\n pageId: undefined,\n });\n\n useEffect(() => {\n if (selectedUrl && documents.length > 0) {\n findLocationOfSelectedUrl().then((items) => {\n setItemsToExpandInitially(items);\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [documents.length]);\n\n useEffect(() => {\n getAllDocuments()\n .then((_documents) => {\n setDocuments(_documents);\n })\n .finally(() => {\n setIsLoading(false);\n });\n }, []);\n\n const findLocationOfSelectedUrl = async () => {\n const itemsToExpand: InitiallyExpandedItems = {\n documentId: undefined,\n pageId: undefined,\n };\n const selectedUrlIsDocument = documents.find((document) => document.permanentLink === selectedUrl);\n if (selectedUrlIsDocument) {\n return itemsToExpand;\n }\n for (const document of documents) {\n const pages = await getDocumentPagesByDocumentId(document.id);\n const selectedUrlIsPage = !!pages.find((page) => page.permanentLink === selectedUrl);\n if (selectedUrlIsPage) {\n itemsToExpand.documentId = document.id;\n return itemsToExpand;\n }\n for (const page of pages) {\n const sections = await getDocumentSectionsByDocumentPageId(page.id);\n const sectionsWithReadableTitles = filterDocumentSectionsWithUnreadableTitles(sections);\n const selectedUrlIsSection = !!sectionsWithReadableTitles.find(\n (section) => section.permanentLink === selectedUrl,\n );\n if (selectedUrlIsSection) {\n itemsToExpand.documentId = document.id;\n itemsToExpand.pageId = page.id;\n return itemsToExpand;\n }\n }\n }\n return itemsToExpand;\n };\n\n return isLoading ? (\n <LoadingIndicator />\n ) : (\n <>\n {documents.map((document) => {\n return (\n <DocumentLink\n key={document.id}\n document={document}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n itemsToExpandInitially={itemsToExpandInitially}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n getDocumentPagesByDocumentId={getDocumentPagesByDocumentId}\n />\n );\n })}\n </>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Document, type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { Button, Dialog, ScrollArea } from '@frontify/fondue/components';\nimport { IconLink } from '@frontify/fondue/icons';\nimport { type KeyboardEvent, type ReactElement, useEffect, useState } from 'react';\n\nimport './LinkSelector.css';\nimport { DocumentLinks } from './DocumentLinks';\n\ntype LinkSelectorProps = {\n url: string;\n onUrlChange?: (value: string) => void;\n buttonSize?: 'small' | 'medium' | 'large';\n getAllDocuments: () => Promise<Document[]>;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const LinkSelector = ({\n url,\n onUrlChange,\n buttonSize = 'medium',\n getAllDocuments,\n getDocumentPagesByDocumentId,\n getDocumentSectionsByDocumentPageId,\n}: LinkSelectorProps): ReactElement => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [selectedUrl, setSelectedUrl] = useState<string>(url);\n\n const onSelectUrl = (url: string) => {\n setSelectedUrl(url);\n };\n\n const onPressEnter = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n saveLink();\n }\n };\n\n useEffect(() => {\n if (url && !selectedUrl) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setSelectedUrl(url);\n }\n }, [url, selectedUrl]);\n\n const saveLink = () => {\n onUrlChange?.(selectedUrl);\n setIsModalOpen(false);\n };\n\n const dialogProps = {\n onOpenAutoFocus: () => {},\n showUnderlay: true,\n minWidth: '800px',\n };\n\n return (\n // eslint-disable-next-line jsx-a11y-x/no-static-element-interactions\n <div\n onPointerDownCapture={(event) => {\n event.stopPropagation();\n event.preventDefault();\n }}\n onFocusCapture={(event) => {\n event.stopPropagation();\n event.preventDefault();\n }}\n data-test-id=\"internal-link-selector\"\n onKeyDown={onPressEnter}\n >\n <Dialog.Root modal open={isModalOpen} onOpenChange={setIsModalOpen}>\n <Dialog.Trigger asChild>\n <Button size={buttonSize} emphasis=\"default\">\n <IconLink size=\"20\" />\n Internal link\n </Button>\n </Dialog.Trigger>\n <Dialog.Content {...dialogProps}>\n <span data-is-underlay=\"true\" style={{ minWidth: 'inherit' }}>\n <Dialog.Header>\n <Dialog.Title>Select internal link</Dialog.Title>\n </Dialog.Header>\n <Dialog.Body padding=\"none\">\n <ScrollArea padding=\"compact\">\n <DocumentLinks\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n getAllDocuments={getAllDocuments}\n getDocumentPagesByDocumentId={getDocumentPagesByDocumentId}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n />\n </ScrollArea>\n </Dialog.Body>\n <Dialog.Footer>\n <Button size={buttonSize} emphasis=\"default\" onPress={() => setIsModalOpen(false)}>\n Cancel\n </Button>\n <Button\n size={buttonSize}\n disabled={!selectedUrl}\n emphasis=\"strong\"\n onPress={() => saveLink()}\n >\n Choose\n </Button>\n </Dialog.Footer>\n </span>\n </Dialog.Content>\n </Dialog.Root>\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport { FormControl } from '@frontify/fondue';\nimport { TextInput, Checkbox, Label } from '@frontify/fondue/components';\n\nimport { LinkSelector } from './LinkSelector';\nimport { isValidUrlOrEmpty as internalIsValidUrlOrEmpty } from './utils';\n\ntype LinkInputProps = {\n url?: string;\n info?: string;\n label?: string;\n required?: boolean;\n newTab?: boolean;\n onUrlChange?: (value: string) => void;\n onToggleTab?: (checked: boolean) => void;\n isValidUrlOrEmpty?: (url: string) => boolean;\n appBridge: AppBridgeBlock;\n placeholder?: string;\n buttonSize?: 'small' | 'medium' | 'large';\n hideInternalLinkButton?: boolean;\n};\n\nexport const LinkInput = ({\n onUrlChange,\n onToggleTab,\n isValidUrlOrEmpty,\n appBridge,\n placeholder,\n newTab,\n url = '',\n required,\n info,\n label,\n buttonSize,\n hideInternalLinkButton,\n}: LinkInputProps) => {\n const isUrlValid = isValidUrlOrEmpty ? isValidUrlOrEmpty(url) : internalIsValidUrlOrEmpty(url);\n return (\n <div data-test-id=\"link-input\">\n <FormControl\n label={{\n children: label,\n htmlFor: 'url',\n required,\n tooltip: info ? { content: info, position: 'top' } : undefined,\n }}\n >\n <TextInput\n data-test-id=\"text-input\"\n id=\"url\"\n value={url}\n onChange={(event) => onUrlChange?.(event.target.value)}\n placeholder={placeholder ?? 'https://example.com'}\n />\n </FormControl>\n {!isUrlValid && <div className=\"tw-text-text-negative tw-mt-1 tw-text-s\">Please enter a valid URL.</div>}\n\n {!hideInternalLinkButton && (\n <div className=\"tw-mt-3\">\n <LinkSelector\n url={url}\n onUrlChange={onUrlChange}\n buttonSize={buttonSize ?? 'medium'}\n getAllDocuments={() => appBridge.getAllDocuments()}\n getDocumentPagesByDocumentId={(documentId) =>\n appBridge.getDocumentPagesByDocumentId(documentId)\n }\n getDocumentSectionsByDocumentPageId={(documentPageId) =>\n appBridge.getDocumentSectionsByDocumentPageId(documentPageId)\n }\n />\n </div>\n )}\n\n <div className=\"tw-mt-3 tw-flex tw-items-center tw-gap-1.5\">\n <Checkbox id=\"new-tab\" value={newTab} onChange={() => onToggleTab?.(!newTab)} />\n <Label id=\"new-tab-label\" htmlFor=\"new-tab\" className=\"tw-whitespace-nowrap\">\n Open in new tab\n </Label>\n </div>\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport { FormControl } from '@frontify/fondue';\nimport { Button, TextInput } from '@frontify/fondue/components';\nimport { IconCheckMark } from '@frontify/fondue/icons';\nimport { FloatingModalWrapper } from '@frontify/fondue/rte';\nimport { type MouseEvent, type ReactElement, type ReactNode } from 'react';\n\nimport { LinkInput } from '../../../../../Link';\n\nimport { type InsertModalStateProps } from './types';\n\ntype Props = {\n state: InsertModalStateProps;\n onTextChange: (value: string) => void;\n onUrlChange: (value: string) => void;\n onToggleTab: (checked: boolean) => void;\n onCancel: () => void;\n onSave: (event: MouseEvent<HTMLButtonElement, globalThis.MouseEvent> | KeyboardEvent | undefined) => void;\n hasValues: boolean;\n isValidUrlOrEmpty: (url: string) => boolean;\n testId?: string;\n children?: ReactNode;\n appBridge: AppBridgeBlock;\n};\n\nexport const InsertModal = ({\n state,\n onTextChange,\n onUrlChange,\n onToggleTab,\n onCancel,\n onSave,\n isValidUrlOrEmpty,\n hasValues,\n testId,\n appBridge,\n children,\n}: Props): ReactElement => (\n <FloatingModalWrapper data-test-id={testId} padding=\"28px\" minWidth=\"400px\">\n <FormControl\n label={{\n children: 'Text',\n htmlFor: 'linkText',\n required: true,\n }}\n >\n <TextInput\n id=\"linkText\"\n value={state.text}\n placeholder=\"Link Text\"\n onChange={(event) => onTextChange(event.target.value)}\n />\n </FormControl>\n\n {children}\n\n <div className=\"tw-mt-5\">\n <LinkInput\n url={state.url}\n newTab={state.newTab}\n onUrlChange={onUrlChange}\n onToggleTab={onToggleTab}\n isValidUrlOrEmpty={isValidUrlOrEmpty}\n appBridge={appBridge}\n />\n </div>\n <div className=\"tw-mt-3\">\n <div className={'tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10'}>\n <Button data-test-id=\"button\" onPress={onCancel} size=\"medium\" emphasis=\"default\">\n Cancel\n </Button>\n <Button\n data-test-id=\"button\"\n onPress={onSave}\n size=\"medium\"\n disabled={!isValidUrlOrEmpty(state?.url) || !hasValues}\n >\n <IconCheckMark size=\"20\" />\n Save\n </Button>\n </div>\n </div>\n </FloatingModalWrapper>\n);\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, getAboveNode } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type RichTextButtonStyle, type TButtonElement } from '..';\n\nexport const getButtonStyle = (editor: PlateEditor): RichTextButtonStyle => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return 'primary';\n }\n\n return (linkNode[0]?.buttonStyle as RichTextButtonStyle) || 'primary';\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport { getPluginOptions, useEditorRef, useHotkeys } from '@frontify/fondue/rte';\nimport { type Dispatch, type Reducer, useEffect, useReducer } from 'react';\n\nimport { addHttps } from '../../../../../../../helpers';\nimport { isValidUrlOrEmpty } from '../../../../../../Link/utils/url';\nimport { ELEMENT_BUTTON } from '../../../createButtonPlugin';\nimport { submitFloatingButton } from '../../../transforms/submitFloatingButton';\nimport { type RichTextButtonStyle } from '../../../types';\nimport { getButtonStyle } from '../../../utils/getButtonStyle';\nimport { floatingButtonActions, floatingButtonSelectors } from '../floatingButtonStore';\n\nimport { type InsertModalDispatchType, type InsertModalStateProps } from './types';\n\nconst initialState: InsertModalStateProps = {\n url: '',\n text: '',\n buttonStyle: 'primary',\n newTab: false,\n};\n\nexport const InsertModalState = (): [InsertModalStateProps, Dispatch<InsertModalDispatchType>] => {\n const [state, dispatch] = useReducer<Reducer<InsertModalStateProps, InsertModalDispatchType>>((state, action) => {\n const { type, payload } = action;\n\n switch (type) {\n case 'NEW_TAB':\n return {\n ...state,\n newTab: true,\n };\n case 'SAME_TAB':\n return {\n ...state,\n newTab: false,\n };\n case 'URL':\n case 'TEXT':\n case 'BUTTON_STYLE':\n case 'INIT':\n return {\n ...state,\n ...payload,\n };\n default:\n return state;\n }\n }, initialState);\n\n return [state, dispatch];\n};\n\nexport const useInsertModal = () => {\n const editor = useEditorRef();\n const [state, dispatch] = InsertModalState();\n\n useEffect(() => {\n const buttonStyle = getButtonStyle(editor);\n\n dispatch({\n type: 'INIT',\n payload: {\n text: floatingButtonSelectors.text() || floatingButtonSelectors.url(),\n buttonStyle,\n newTab: !!floatingButtonSelectors.newTab(),\n url: floatingButtonSelectors.url(),\n },\n });\n }, [dispatch, editor]);\n\n const onTextChange = (value: string) => {\n dispatch({\n type: 'TEXT',\n payload: { text: value },\n });\n };\n\n const onButtonStyleChange = (value: RichTextButtonStyle) => {\n dispatch({\n type: 'BUTTON_STYLE',\n payload: { buttonStyle: value },\n });\n };\n\n const onUrlChange = (value: string) => {\n dispatch({\n type: 'URL',\n payload: { url: value },\n });\n };\n\n const onToggleTab = (checked: boolean) => {\n checked ? dispatch({ type: 'NEW_TAB' }) : dispatch({ type: 'SAME_TAB' });\n };\n\n const onCancel = () => {\n floatingButtonActions.reset();\n };\n\n const onSave = (event: React.MouseEvent<HTMLButtonElement, MouseEvent> | KeyboardEvent | undefined) => {\n if (!isValidUrlOrEmpty(state.url) || !hasValues) {\n return;\n }\n\n const urlToSave = addHttps(state.url);\n\n floatingButtonActions.text(state.text);\n floatingButtonActions.url(urlToSave);\n floatingButtonActions.buttonStyle(state.buttonStyle);\n floatingButtonActions.newTab(state.newTab);\n\n if (submitFloatingButton(editor)) {\n event?.preventDefault();\n }\n };\n\n const hasValues = state.url !== '' && state.text !== '';\n\n const { appBridge } = getPluginOptions<{ appBridge: AppBridgeBlock }>(editor, ELEMENT_BUTTON);\n\n useHotkeys(\n 'enter',\n onSave,\n {\n enableOnFormTags: ['INPUT'],\n },\n [],\n );\n\n return {\n state,\n onTextChange,\n onButtonStyleChange,\n onUrlChange,\n onToggleTab,\n onCancel,\n onSave,\n hasValues,\n isValidUrlOrEmpty,\n appBridge,\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { FormControl } from '@frontify/fondue';\nimport { type CSSProperties, type ReactElement, type ReactNode, useState } from 'react';\n\nimport { InsertModal } from '../../../../LinkPlugin/FloatingLink/InsertLinkModal/InsertModal';\nimport { BlockStyles } from '../../../../styles';\n\nimport { useInsertModal } from './useInsertModal';\n\nexport const InsertButtonModal = () => {\n const modalProps = useInsertModal();\n const { state, onButtonStyleChange } = modalProps;\n\n return (\n <InsertModal {...modalProps} testId=\"floating-button-insert\">\n <div className=\"tw-pt-5\">\n <FormControl\n label={{\n children: 'Button Style',\n htmlFor: 'buttonStyle',\n required: true,\n }}\n >\n <HoverableButton\n id=\"primary\"\n styles={BlockStyles.buttonPrimary}\n isActive={state.buttonStyle === 'primary'}\n onClick={() => onButtonStyleChange('primary')}\n >\n {state.text || 'Primary Button'}\n </HoverableButton>\n\n <HoverableButton\n id=\"secondary\"\n styles={BlockStyles.buttonSecondary}\n isActive={state.buttonStyle === 'secondary'}\n onClick={() => onButtonStyleChange('secondary')}\n >\n {state.text || 'Secondary Button'}\n </HoverableButton>\n\n <HoverableButton\n id=\"tertiary\"\n styles={BlockStyles.buttonTertiary}\n isActive={state.buttonStyle === 'tertiary'}\n onClick={() => onButtonStyleChange('tertiary')}\n >\n {state.text || 'Tertiary Button'}\n </HoverableButton>\n </FormControl>\n </div>\n </InsertModal>\n );\n};\n\ntype Props = {\n id: string;\n styles?: CSSProperties & { hover?: CSSProperties };\n isActive: boolean;\n onClick: () => void;\n children: ReactNode;\n};\n\nconst HoverableButton = ({ id, styles, isActive, onClick, children }: Props): ReactElement => {\n const [hovered, setHovered] = useState(false);\n const getStyles = () => (styles && styles.hover && hovered ? { ...styles, ...styles.hover } : styles);\n\n return (\n <button\n data-test-id={`floating-button-insert-${id}`}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onClick={onClick}\n style={{ ...getStyles(), marginTop: 0, marginBottom: 0 }}\n className={\n isActive ? 'tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit' : 'tw-w-fit'\n }\n >\n {children}\n </button>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TextStyles, type UseVirtualFloatingOptions, flip, offset, useEditorRef } from '@frontify/fondue/rte';\nimport { createPortal } from 'react-dom';\n\nimport { BlockStyles } from '../../../../../RichTextEditor/plugins/styles';\nimport { useFloatingButtonEdit, useFloatingButtonInsert, useFloatingButtonSelectors } from '../FloatingButton';\n\nimport { EditModal } from './EditButtonModal/EditModal';\nimport { InsertButtonModal } from './InsertButtonModal/InsertButtonModal';\n\nconst floatingOptions: UseVirtualFloatingOptions = {\n placement: 'bottom-start',\n strategy: 'absolute',\n middleware: [\n offset(12),\n flip({\n padding: 12,\n fallbackPlacements: ['bottom-end', 'top-start', 'top-end'],\n }),\n ],\n};\n\nexport const CustomFloatingButton = () => {\n const { ref: insertRef, ...insertProps } = useFloatingButtonInsert(floatingOptions);\n const { ref: editRef, ...editProps } = useFloatingButtonEdit(floatingOptions);\n const editor = useEditorRef();\n const state = useFloatingButtonSelectors();\n const isOpen = state.isOpen(editor.id);\n const isEditing = state.isEditing();\n const mode = state.mode();\n\n const input = <InsertButtonModal />;\n const editContent = isEditing ? input : <EditModal />;\n\n return (\n <>\n {isOpen &&\n mode === 'insert' &&\n createPortal(\n <div\n data-is-underlay\n ref={insertRef}\n {...insertProps}\n style={{ ...insertProps.style, ...BlockStyles[TextStyles.p] }}\n >\n {input}\n </div>,\n document.body,\n )}\n\n {isOpen &&\n mode === 'edit' &&\n createPortal(\n <div\n data-is-underlay\n ref={editRef}\n {...editProps}\n style={{ ...editProps.style, ...BlockStyles[TextStyles.p] }}\n >\n {editContent}\n </div>,\n document.body,\n )}\n </>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type RangeBeforeOptions,\n createPluginFactory,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { isValidUrl } from '../../../Link/utils/url';\n\nimport { ButtonMarkupElement } from './ButtonMarkupElement';\nimport { ButtonButton } from './components/ButtonButton';\nimport { CustomFloatingButton } from './components/FloatingButton/CustomFloatingButton';\nimport { BlockButtonStyles } from './utils';\nimport { withButton } from './withButton';\n\nexport const ELEMENT_BUTTON = 'button';\nexport const BUTTON_PLUGIN = 'button-plugin';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport interface ButtonPlugin {\n forceSubmit?: boolean;\n\n /**\n * Allow custom config for rangeBeforeOptions.\n * @example default\n * {\n * matchString: ' ',\n * skipInvalid: true,\n * afterMatch: true,\n * }\n */\n rangeBeforeOptions?: RangeBeforeOptions;\n\n /**\n * Hotkeys to trigger floating button.\n * @default 'command+k, ctrl+k'\n */\n triggerFloatingButtonHotkeys: string;\n\n /**\n * Callback to validate an url.\n * @default isUrl\n */\n isUrl: (text: string) => boolean;\n\n /**\n * Callback to optionally get the href for a url\n * @returns href: an optional link to be used that is different from the text content (example https://google.com for google.com)\n */\n getUrlHref?: (url: string) => string | undefined;\n\n /**\n * On keyboard shortcut or toolbar mousedown, get the link url by calling this promise. The\n * default behavior is to use the browser's native `prompt`.\n */\n getLinkUrl?: (prevUrl: string | null) => Promise<string | null>;\n}\n\n/**\n * Enables support for hyperlinks.\n */\nexport const createButtonPlugin = (appBridge: AppBridgeBlock): PlatePlugin =>\n createPluginFactory({\n key: ELEMENT_BUTTON,\n isElement: true,\n isInline: true,\n props: ({ element }) => ({\n nodeProps: { href: element?.url, target: element?.target },\n }),\n withOverrides: withButton,\n renderAfterEditable: CustomFloatingButton,\n options: {\n isUrl: isValidUrl,\n rangeBeforeOptions: {\n matchString: ' ',\n skipInvalid: true,\n afterMatch: true,\n },\n triggerFloatingButtonHotkeys: 'command+shift+k, ctrl+shift+k',\n appBridge,\n },\n then: (_editor, { type }) => ({\n deserializeHtml: {\n rules: [\n {\n validNodeName: 'A',\n validClassName: 'btn',\n },\n ],\n getNode: (el) => ({\n type,\n url: el.getAttribute('href'),\n target: el.getAttribute('target') || '_blank',\n }),\n },\n }),\n })();\n\nexport type ButtonPluginProps = Omit<PluginProps, 'styles'> & {\n styles?: Record<string, CSSProperties & { hover?: CSSProperties }>;\n} & { appBridge: AppBridgeBlock };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport class ButtonPlugin extends Plugin {\n public styles: CSSProperties = {};\n private appBridge: AppBridgeBlock;\n constructor({ styles = BlockButtonStyles, ...props }: ButtonPluginProps) {\n super(BUTTON_PLUGIN, {\n button: ButtonButton,\n markupElement: new ButtonMarkupElement(),\n ...props,\n });\n this.styles = styles;\n this.appBridge = props?.appBridge;\n }\n\n plugins() {\n return [createButtonPlugin(this.appBridge)];\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type UseVirtualFloatingOptions,\n getAboveNode,\n getDefaultBoundingClientRect,\n getEndPoint,\n getPluginOptions,\n getPluginType,\n getRangeBoundingClientRect,\n getStartPoint,\n someNode,\n useComposedRef,\n useEditorRef,\n useEditorVersion,\n useHotkeys,\n} from '@frontify/fondue/rte';\nimport { type Ref, useCallback, useEffect } from 'react';\n\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../../createButtonPlugin';\nimport { getUrlFromEditor } from '../../utils';\nimport { triggerFloatingButtonEdit } from '../../utils/triggerFloatingButtonEdit';\n\nimport {\n floatingButtonActions,\n floatingButtonSelectors,\n useFloatingButtonEnter,\n useFloatingButtonEscape,\n useFloatingButtonSelectors,\n useVirtualFloatingButton,\n} from '.';\n\nexport const useFloatingButtonEdit = (\n floatingOptions: UseVirtualFloatingOptions,\n): React.HTMLAttributes<HTMLDivElement> & { ref: Ref<HTMLDivElement> } => {\n const editor = useEditorRef();\n const mode = useFloatingButtonSelectors().mode();\n const open = useFloatingButtonSelectors().isOpen(editor.id);\n const version = useEditorVersion();\n\n const { triggerFloatingButtonHotkeys } = getPluginOptions<ButtonPlugin>(editor, ELEMENT_BUTTON);\n\n const getBoundingClientRect = useCallback(() => {\n const entry = getAboveNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (entry) {\n const [, path] = entry;\n return getRangeBoundingClientRect(editor, {\n anchor: getStartPoint(editor, path),\n focus: getEndPoint(editor, path),\n });\n }\n\n return getDefaultBoundingClientRect();\n }, [editor]);\n\n const isOpen = open && mode === 'edit';\n\n const { update, style, floating } = useVirtualFloatingButton({\n open: isOpen,\n getBoundingClientRect,\n ...floatingOptions,\n });\n\n useEffect(() => {\n const url = getUrlFromEditor(editor);\n if (url) {\n floatingButtonActions.url(url);\n }\n\n if (\n editor.selection &&\n someNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n })\n ) {\n floatingButtonActions.show('edit', editor.id);\n update();\n return;\n }\n\n if (floatingButtonSelectors.mode() === 'edit') {\n floatingButtonActions.reset();\n }\n }, [editor, version, update]);\n\n useHotkeys(\n triggerFloatingButtonHotkeys,\n (e) => {\n e.preventDefault();\n\n if (floatingButtonSelectors.mode() === 'edit') {\n triggerFloatingButtonEdit(editor);\n }\n },\n {\n enableOnContentEditable: true,\n },\n [],\n );\n\n useFloatingButtonEnter();\n\n useFloatingButtonEscape();\n\n return {\n style,\n ref: useComposedRef<HTMLElement | null>(floating),\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useEditorRef, useHotkeys } from '@frontify/fondue/rte';\n\nimport { submitFloatingButton } from '../../transforms/submitFloatingButton';\n\nexport const useFloatingButtonEnter = () => {\n const editor = useEditorRef();\n\n useHotkeys(\n '*',\n (e) => {\n if (e.key === 'Enter' && submitFloatingButton(editor)) {\n e.preventDefault();\n }\n },\n {\n enableOnFormTags: ['INPUT'],\n },\n [],\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { focusEditor, useEditorRef, useHotkeys } from '@frontify/fondue/rte';\n\nimport { floatingButtonActions, floatingButtonSelectors } from './floatingButtonStore';\n\nexport const useFloatingButtonEscape = () => {\n const editor = useEditorRef();\n\n useHotkeys(\n 'escape',\n () => {\n if (floatingButtonSelectors.mode() !== 'edit') {\n return;\n }\n\n if (floatingButtonSelectors.isEditing()) {\n floatingButtonActions.show('edit', editor.id);\n focusEditor(editor, editor.selection ?? undefined);\n return;\n }\n\n floatingButtonActions.reset();\n },\n {\n enableOnFormTags: ['INPUT'],\n enableOnContentEditable: true,\n },\n [],\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type UseVirtualFloatingOptions,\n getPluginOptions,\n getSelectionBoundingClientRect,\n useComposedRef,\n useEditorRef,\n useFocused,\n useHotkeys,\n} from '@frontify/fondue/rte';\nimport { type Ref, useEffect } from 'react';\n\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../../createButtonPlugin';\nimport { triggerFloatingButtonInsert } from '../../utils/triggerFloatingButtonInsert';\n\nimport {\n floatingButtonActions,\n useFloatingButtonEscape,\n useFloatingButtonSelectors,\n useVirtualFloatingButton,\n} from '.';\n\nexport const useFloatingButtonInsert = (\n floatingOptions: UseVirtualFloatingOptions,\n): React.HTMLAttributes<HTMLDivElement> & { ref: Ref<HTMLDivElement> } => {\n const editor = useEditorRef();\n const focused = useFocused();\n const mode = useFloatingButtonSelectors().mode();\n const open = useFloatingButtonSelectors().isOpen(editor.id);\n\n const { triggerFloatingButtonHotkeys } = getPluginOptions<ButtonPlugin>(editor, ELEMENT_BUTTON);\n\n useHotkeys(\n triggerFloatingButtonHotkeys,\n (e) => {\n e.preventDefault();\n\n triggerFloatingButtonInsert(editor, {\n focused,\n });\n },\n {\n enableOnContentEditable: true,\n },\n [focused],\n );\n\n const { update, style, floating } = useVirtualFloatingButton({\n open: open && mode === 'insert',\n getBoundingClientRect: getSelectionBoundingClientRect,\n whileElementsMounted: undefined,\n ...floatingOptions,\n });\n\n // wait for update before focusing input\n useEffect(() => {\n if (open) {\n update();\n }\n floatingButtonActions.updated(open);\n }, [open, update]);\n\n useFloatingButtonEscape();\n\n return {\n style,\n ref: useComposedRef<HTMLElement | null>(floating),\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type UseVirtualFloatingOptions, flip, offset, useVirtualFloating } from '@frontify/fondue/rte';\nimport { type CSSProperties, type Ref } from 'react';\n\nconst OFFSET_Y = 12;\nconst OFFSET_X = -22;\nconst PADDING = 96;\n\nexport const useVirtualFloatingButton = (\n floatingOptions?: UseVirtualFloatingOptions,\n): { style: CSSProperties; update: () => void; floating: Ref<HTMLDivElement> } =>\n useVirtualFloating({\n placement: 'bottom-start',\n middleware: [\n offset({\n mainAxis: OFFSET_Y,\n alignmentAxis: OFFSET_X,\n }),\n flip({\n padding: PADDING,\n }),\n ],\n ...floatingOptions,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\n/**\n * As container queries lack a selector like @max-sm, as a workaround\n * the class is disabled by default and reenabled on bigger container sizes\n */\nconst columnBreakDisablingClassUnderMd =\n '[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @md:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @md:[&_.tw-break-after-column]:!tw-break-after-column @md:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column';\n\nconst columnBreakDisablingClassUnderSm =\n '[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @sm:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @sm:[&_.tw-break-after-column]:!tw-break-after-column @sm:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column';\n\nexport const columnClassMap = {\n 1: 'tw-columns-1',\n 2: `tw-columns-1 @sm:!tw-columns-2 ${columnBreakDisablingClassUnderSm}`,\n 3: `tw-columns-1 @md:!tw-columns-3 ${columnBreakDisablingClassUnderMd}`,\n 4: `tw-columns-1 @md:!tw-columns-4 ${columnBreakDisablingClassUnderMd}`,\n 5: `tw-columns-1 @md:!tw-columns-5 ${columnBreakDisablingClassUnderMd}`,\n};\n\nexport const getResponsiveColumnClasses = (columnCount?: number) => {\n if (!columnCount) {\n return '';\n }\n\n return columnClassMap[columnCount as keyof typeof columnClassMap] || columnClassMap[1];\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { RichTextEditor as FondueRichTextEditor } from '@frontify/fondue/rte';\nimport { memo, useCallback, useEffect, useId, useRef, useState } from 'react';\n\nimport { useIsInViewport } from '../../hooks/useIsInViewport';\n\nimport { SerializedText } from './SerializedText';\nimport { floatingButtonActions, floatingButtonSelectors } from './plugins/ButtonPlugin/components';\nimport { getResponsiveColumnClasses } from './plugins/ColumnBreakPlugin/helpers';\nimport { type RichTextEditorProps } from './types';\n\nconst handleHideExternalFloatingModals = (editorId: string) => {\n if (floatingButtonSelectors.isOpen(editorId)) {\n floatingButtonActions.reset();\n }\n};\n\nconst InternalRichTextEditor = memo(\n ({\n isEnabled,\n value,\n columns,\n gap,\n placeholder,\n plugins,\n onTextChange,\n showSerializedText,\n }: Omit<RichTextEditorProps, 'isEditing'> & { isEnabled: boolean }) => {\n const customClass = getResponsiveColumnClasses(columns);\n const [shouldPreventPageLeave, setShouldPreventPageLeave] = useState(false);\n const editorId = useId();\n\n const handleTextChange = useCallback(\n (newContent: string) => {\n if (newContent !== value) {\n onTextChange?.(newContent);\n }\n setShouldPreventPageLeave(false);\n },\n [onTextChange, value],\n );\n\n const handleValueChange = useCallback(() => setShouldPreventPageLeave(true), []);\n\n useEffect(() => {\n const unloadHandler = (event: BeforeUnloadEvent) => {\n event.preventDefault();\n event.returnValue = 'Unprocessed changes';\n };\n\n if (shouldPreventPageLeave) {\n window.addEventListener('beforeunload', unloadHandler);\n }\n\n return () => window.removeEventListener('beforeunload', unloadHandler);\n }, [shouldPreventPageLeave]);\n\n if (isEnabled) {\n return (\n <FondueRichTextEditor\n id={editorId}\n value={value}\n border={false}\n placeholder={placeholder}\n plugins={plugins}\n onValueChanged={handleValueChange}\n onTextChange={handleTextChange}\n hideExternalFloatingModals={handleHideExternalFloatingModals}\n placeholderOpacity=\"high\"\n />\n );\n }\n return (\n <SerializedText\n value={value}\n gap={gap}\n customClass={customClass}\n show={showSerializedText}\n plugins={plugins}\n />\n );\n },\n);\nInternalRichTextEditor.displayName = 'InternalRichTextEditor';\n\nexport const RichTextEditor = (props: RichTextEditorProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const [hasEnteredViewport, setHasEnteredViewport] = useState(false);\n\n const { isEditing, ...internalRteProps } = props;\n\n const onViewportVisibilityChange = useCallback((isInViewport: boolean) => {\n if (isInViewport) {\n setHasEnteredViewport(true);\n }\n }, []);\n\n useIsInViewport({ ref, disabled: !isEditing, onChange: onViewportVisibilityChange });\n\n useEffect(() => {\n if (!isEditing) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setHasEnteredViewport(false);\n }\n }, [isEditing]);\n\n return (\n <div data-test-id=\"rich-text-editor-container\" className=\"tw-block tw-w-full tw-@container\" ref={ref}>\n <InternalRichTextEditor {...internalRteProps} isEnabled={isEditing && hasEnteredViewport} />\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconPen, IconTrashBin } from '@frontify/fondue/icons';\nimport { FloatingModalWrapper, useLinkOpenButtonState } from '@frontify/fondue/rte';\nimport { type MouseEvent } from 'react';\n\nimport { getUrlFromLinkOrLegacyLink } from '../../../../../Link';\nimport { BlockStyles } from '../../../styles';\nimport { LINK_PLUGIN } from '../../id';\n\ntype EditModalProps = {\n editButtonProps: {\n onClick: () => void;\n };\n unlinkButtonProps: {\n onMouseDown: (e: MouseEvent<HTMLButtonElement>) => void;\n onClick: () => void;\n };\n};\n\nexport const EditModal = ({ editButtonProps, unlinkButtonProps }: EditModalProps) => {\n const { element } = useLinkOpenButtonState();\n const url = element ? getUrlFromLinkOrLegacyLink(element) : '';\n\n return (\n <FloatingModalWrapper data-test-id=\"floating-link-edit\" padding=\"16px\" minWidth=\"400px\">\n <span data-test-id=\"preview-link-flyout\" className=\"tw-flex tw-justify-between tw-items-center tw-gap-2\">\n <a\n data-test-id=\"floating-link-edit-url\"\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n style={BlockStyles[LINK_PLUGIN]}\n className=\"tw-break-all\"\n >\n {url}\n </a>\n <span className=\"tw-flex tw-gap-2\">\n <button\n tabIndex={0}\n data-test-id=\"edit-link-button\"\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n {...editButtonProps}\n >\n <IconPen size={16} />\n </button>\n\n <button\n tabIndex={0}\n data-test-id=\"remove-link-button\"\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n {...unlinkButtonProps}\n >\n <IconTrashBin size={16} />\n </button>\n </span>\n </span>\n </FloatingModalWrapper>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ELEMENT_LINK, type PlateEditor, getAboveNode } from '@frontify/fondue/rte';\n\nimport { type TLinkElement } from '../types';\n\nconst getLinkNode = (editor: PlateEditor, cb: (link: TLinkElement) => string): string => {\n const linkNode = getAboveNode<TLinkElement>(editor, { match: { type: ELEMENT_LINK } });\n\n if (!Array.isArray(linkNode)) {\n return '';\n }\n\n return cb(linkNode[0]);\n};\n\nexport const getLegacyUrl = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.chosenLink?.searchResult?.link || '');\n};\n\nexport const getUrl = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.url || '');\n};\n\nexport const getUrlFromLinkOrLegacyLink = (link: TLinkElement): string => {\n return link.url || link.chosenLink?.searchResult?.link || '';\n};\n\nexport const getUrlFromEditor = (editor: PlateEditor) => {\n return getLinkNode(editor, getUrlFromLinkOrLegacyLink);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n ELEMENT_LINK,\n floatingLinkActions,\n floatingLinkSelectors,\n getPluginOptions,\n submitFloatingLink,\n useEditorRef,\n useHotkeys,\n} from '@frontify/fondue/rte';\nimport { type Dispatch, type MouseEvent, type Reducer, useEffect, useReducer } from 'react';\n\nimport { addHttps } from '../../../../../../helpers';\nimport { isValidUrlOrEmpty } from '../../../../../Link';\nimport { getLegacyUrl, getUrl } from '../../utils';\n\nimport { type InsertModalDispatchType, type InsertModalStateProps } from './types';\n\nconst initialState: InsertModalStateProps = {\n url: '',\n text: '',\n newTab: false,\n};\n\nexport const InsertModalState = (): [InsertModalStateProps, Dispatch<InsertModalDispatchType>] => {\n const [state, dispatch] = useReducer<Reducer<InsertModalStateProps, InsertModalDispatchType>>((state, action) => {\n const { type, payload } = action;\n\n switch (type) {\n case 'NEW_TAB':\n return {\n ...state,\n newTab: true,\n };\n case 'SAME_TAB':\n return {\n ...state,\n newTab: false,\n };\n case 'URL':\n case 'TEXT':\n case 'INIT':\n return {\n ...state,\n ...payload,\n };\n default:\n return state;\n }\n }, initialState);\n\n return [state, dispatch];\n};\n\nexport const useInsertModal = () => {\n const editor = useEditorRef();\n const [state, dispatch] = InsertModalState();\n\n useEffect(() => {\n const legacyUrl = getLegacyUrl(editor);\n const url = getUrl(editor);\n const isNewTab = floatingLinkSelectors.newTab();\n dispatch({\n type: 'INIT',\n payload: {\n text: floatingLinkSelectors.text() || floatingLinkSelectors.url(),\n newTab: isNewTab,\n url: legacyUrl && url === '' ? legacyUrl : floatingLinkSelectors.url(),\n },\n });\n }, [dispatch, editor]);\n\n const onTextChange = (value: string) => {\n dispatch({\n type: 'TEXT',\n payload: { text: value },\n });\n };\n\n const onUrlChange = (value: string) => {\n dispatch({\n type: 'URL',\n payload: { url: value },\n });\n };\n\n const onToggleTab = (checked: boolean) => {\n checked ? dispatch({ type: 'NEW_TAB' }) : dispatch({ type: 'SAME_TAB' });\n };\n\n const onCancel = () => {\n floatingLinkActions.reset();\n };\n\n const onSave = (event: MouseEvent<HTMLButtonElement, globalThis.MouseEvent> | KeyboardEvent | undefined) => {\n if (!isValidUrlOrEmpty(state.url) || !hasValues) {\n return;\n }\n\n floatingLinkActions.text(state.text);\n floatingLinkActions.url(addHttps(state.url));\n floatingLinkActions.newTab(state.newTab);\n\n if (submitFloatingLink(editor)) {\n event?.preventDefault();\n }\n };\n\n const hasValues = state.url !== '' && state.text !== '';\n\n const { appBridge } = getPluginOptions<{ appBridge: AppBridgeBlock }>(editor, ELEMENT_LINK);\n\n useHotkeys(\n 'enter',\n onSave,\n {\n enableOnFormTags: ['INPUT'],\n },\n [],\n );\n\n return { state, onTextChange, onUrlChange, onToggleTab, onCancel, onSave, hasValues, isValidUrlOrEmpty, appBridge };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { InsertModal } from './InsertModal';\nimport { useInsertModal } from './useInsertModal';\n\nexport const InsertLinkModal = () => <InsertModal {...useInsertModal()} testId=\"floating-link-insert\" />;\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type LinkFloatingToolbarState,\n type UseVirtualFloatingOptions,\n flip,\n offset,\n useFloatingLinkEdit,\n useFloatingLinkEditState,\n useFloatingLinkInsert,\n useFloatingLinkInsertState,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { BlockStyles, TextStyles } from '../../../../RichTextEditor/plugins/styles';\n\nimport { EditModal } from './EditLinkModal';\nimport { InsertLinkModal } from './InsertLinkModal/InsertLinkModal';\n\nconst floatingOptions: UseVirtualFloatingOptions = {\n placement: 'bottom-start',\n strategy: 'absolute',\n middleware: [\n offset(12),\n flip({\n padding: 12,\n fallbackPlacements: ['bottom-end', 'top-start', 'top-end'],\n }),\n ],\n};\n\nexport type LinkFloatingToolbarProps = {\n state?: LinkFloatingToolbarState;\n};\n\nexport const CustomFloatingLink = () => {\n const insertState = useFloatingLinkInsertState({\n floatingOptions,\n });\n const { props: insertProps, ref: insertRef, hidden } = useFloatingLinkInsert(insertState);\n\n const editState = useFloatingLinkEditState({\n floatingOptions,\n });\n\n const { props: editProps, ref: editRef, editButtonProps, unlinkButtonProps } = useFloatingLinkEdit(editState);\n\n if (hidden) {\n return null;\n }\n\n const input = <InsertLinkModal />;\n const editContent = editState.isEditing ? (\n input\n ) : (\n <EditModal editButtonProps={editButtonProps} unlinkButtonProps={unlinkButtonProps} />\n );\n\n return (\n <>\n {insertState.isOpen &&\n !editState.isOpen &&\n createPortal(\n <div\n data-is-underlay\n ref={insertRef}\n {...insertProps}\n style={{ ...(insertProps.style as CSSProperties), ...BlockStyles[TextStyles.p] }}\n >\n {input}\n </div>,\n document.body,\n )}\n\n {editState.isOpen &&\n createPortal(\n <div\n data-is-underlay\n ref={editRef}\n {...editProps}\n style={{ ...(editProps.style as CSSProperties), ...BlockStyles[TextStyles.p] }}\n >\n {editContent}\n </div>,\n document.body,\n )}\n </>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconLink } from '@frontify/fondue/icons';\nimport {\n IconStylingWrapper,\n ToolbarButton,\n focusEditor,\n useEditorRef,\n useLinkToolbarButton,\n useLinkToolbarButtonState,\n} from '@frontify/fondue/rte';\nimport { type ReactNode, forwardRef } from 'react';\n\nexport const LinkToolbarButton = forwardRef<HTMLButtonElement, { disabled: boolean; tooltip: ReactNode }>(\n (rootProps, ref) => {\n const editor = useEditorRef();\n const state = useLinkToolbarButtonState();\n const { props } = useLinkToolbarButton(state);\n return (\n <ToolbarButton\n onMouseDown={(event) => {\n event.preventDefault();\n focusEditor(editor, editor.selection ?? editor.prevSelection ?? undefined);\n }}\n ref={ref}\n {...props}\n {...rootProps}\n >\n <IconStylingWrapper icon={<IconLink size={16} />} />\n </ToolbarButton>\n );\n },\n);\n\nLinkToolbarButton.displayName = 'LinkToolbarButton';\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PluginButtonProps,\n getHotkeyByPlatform,\n getTooltip,\n isRangeInSameBlock,\n useEditorState,\n useEventPlateId,\n} from '@frontify/fondue/rte';\n\nimport { LinkToolbarButton } from './LinkToolbarButton';\n\nexport const LinkButton = ({ id, editorId }: PluginButtonProps) => {\n const editor = useEditorState(useEventPlateId(editorId));\n const isEnabled = !!isRangeInSameBlock(editor, {\n at: editor.selection,\n });\n\n return (\n <div data-plugin-id={id}>\n <LinkToolbarButton\n disabled={!isEnabled}\n tooltip={getTooltip(\n isEnabled\n ? `Link\\n${getHotkeyByPlatform('Ctrl+K')}`\n : 'Links can only be set for a single text block.',\n )}\n />\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateRenderElementProps,\n type TLinkElement as TPlateLinkElement,\n useRichTextEditorContext,\n} from '@frontify/fondue/rte';\n\nimport { LINK_PLUGIN } from '../id';\n\nexport type TLinkElement = TPlateLinkElement & {\n chosenLink?: {\n searchResult?: {\n link?: string;\n };\n openInNewTab?: boolean;\n };\n};\n\nexport const LinkMarkupElementNode = (props: PlateRenderElementProps & { element: TLinkElement }) => {\n const { attributes, children } = props;\n\n const { styles } = useRichTextEditorContext();\n const href = props.element.url || props.element.chosenLink?.searchResult?.link || '';\n const target = props.element.target || '_self';\n\n return (\n <a {...attributes} href={href} target={target} style={styles[LINK_PLUGIN]}>\n {children}\n </a>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ELEMENT_LINK, MarkupElement, type PlateRenderElementProps } from '@frontify/fondue/rte';\n\nimport { LinkMarkupElementNode, type TLinkElement } from './LinkMarkupElementNode';\n\nexport class LinkMarkupElement extends MarkupElement {\n constructor(\n id = ELEMENT_LINK,\n node: (props: PlateRenderElementProps & { element: TLinkElement }) => JSX.Element = LinkMarkupElementNode,\n ) {\n super(id, node);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n type PlatePlugin,\n Plugin,\n type PluginProps,\n createLinkPlugin as createPlateLinkPlugin,\n createPluginFactory,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { isValidUrl } from '../../../Link';\nimport { BlockStyles } from '../styles';\n\nimport { CustomFloatingLink } from './FloatingLink/CustomFloatingLink';\nimport { LinkButton } from './LinkButton';\nimport { LinkMarkupElement } from './LinkMarkupElement';\nimport { LINK_PLUGIN } from './id';\n\nexport const createLinkPlugin = (appBridge: AppBridgeBlock): PlatePlugin =>\n createPluginFactory({\n ...createPlateLinkPlugin(),\n renderAfterEditable: CustomFloatingLink,\n options: {\n isUrl: isValidUrl,\n rangeBeforeOptions: {\n matchString: ' ',\n skipInvalid: true,\n afterMatch: true,\n },\n triggerFloatingLinkHotkeys: 'meta+k, ctrl+k',\n keepSelectedTextOnPaste: true,\n appBridge,\n },\n })();\n\nexport type LinkPluginProps = PluginProps & { appBridge: AppBridgeBlock };\n\nexport class LinkPlugin extends Plugin {\n public styles: CSSProperties = {};\n private appBridge: AppBridgeBlock;\n constructor({ styles = BlockStyles[LINK_PLUGIN], ...props }: LinkPluginProps) {\n super(LINK_PLUGIN, {\n button: LinkButton,\n markupElement: new LinkMarkupElement(),\n ...props,\n });\n this.styles = styles;\n this.appBridge = props.appBridge;\n }\n\n plugins(): PlatePlugin[] {\n return [createLinkPlugin(this.appBridge)];\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlatePlugin, Plugin, createColumnBreakPlugin, ColumnBreakButton } from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { getResponsiveColumnClasses } from './helpers';\n\nexport const KEY_ELEMENT_BREAK_AFTER_COLUMN = 'breakAfterColumn';\nexport const GAP_DEFAULT = 'normal';\n\nexport class BreakAfterPlugin extends Plugin {\n private columns: number;\n private gap: CSSProperties['gap'];\n private customClass: string | undefined;\n constructor(props?: { columns?: number; gap?: string | number }) {\n super('break-after-plugin', {\n button: ColumnBreakButton,\n ...props,\n });\n this.columns = props?.columns ?? 1;\n this.gap = props?.gap ?? GAP_DEFAULT;\n this.customClass = getResponsiveColumnClasses(this.columns);\n }\n\n plugins(): PlatePlugin[] {\n return [createColumnBreakPlugin(this.columns, this.gap, this.customClass)];\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-custom1-plugin';\n\nexport class Custom1Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.custom1, ...props }: PluginProps = {}) {\n super(TextStyles.custom1, {\n label: 'Custom 1',\n markupElement: new Custom1MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createCustom1Plugin(this.styles)];\n }\n}\n\nclass Custom1MarkupElement extends MarkupElement {\n constructor(id = ID, node = Custom1MarkupElementNode) {\n super(id, node);\n }\n}\n\nconst Custom1MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <p\n {...attributes}\n style={styles}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n >\n {children}\n </p>\n );\n};\n\nconst createCustom1Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.custom1,\n isElement: true,\n deserializeHtml: {\n rules: [{ validClassName: TextStyles.custom1 }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <Custom1MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-custom2-plugin';\n\nexport class Custom2Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.custom2, ...props }: PluginProps = {}) {\n super(TextStyles.custom2, {\n label: 'Custom 2',\n markupElement: new Custom2MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createCustom2Plugin(this.styles)];\n }\n}\n\nclass Custom2MarkupElement extends MarkupElement {\n constructor(id = ID, node = Custom2MarkupElementNode) {\n super(id, node);\n }\n}\n\nconst Custom2MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <p\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </p>\n );\n};\n\nconst createCustom2Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.custom2,\n isElement: true,\n deserializeHtml: {\n rules: [{ validClassName: TextStyles.custom2 }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <Custom2MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n type PlateRenderElementProps,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n TextStyles,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles } from '../styles';\n\nconst ID = 'textstyle-custom3-plugin';\n\nexport class Custom3Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.custom3, ...props }: PluginProps = {}) {\n super(TextStyles.custom3, {\n label: 'Custom 3',\n markupElement: new Custom3MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createCustom3Plugin(this.styles)];\n }\n}\n\nclass Custom3MarkupElement extends MarkupElement {\n constructor(id = ID, node = Custom3MarkupElementNode) {\n super(id, node);\n }\n}\n\nconst Custom3MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <p\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </p>\n );\n};\n\nconst createCustom3Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.custom3,\n isElement: true,\n deserializeHtml: {\n rules: [{ validClassName: TextStyles.custom3 }],\n },\n })({\n component: (props: PlateRenderElementProps) => <Custom3MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n type PlateRenderElementProps,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-heading1-plugin';\nexport class Heading1Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.heading1, ...props }: PluginProps = {}) {\n super(TextStyles.heading1, {\n label: 'Heading 1',\n markupElement: new Heading1MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createHeading1Plugin(this.styles)];\n }\n}\n\nclass Heading1MarkupElement extends MarkupElement {\n constructor(id = ID, node = Heading1MarkupElementNode) {\n super(id, node);\n }\n}\n\nconst Heading1MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <h1\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </h1>\n );\n};\n\nconst createHeading1Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.heading1,\n isElement: true,\n component: Heading1MarkupElementNode,\n deserializeHtml: {\n rules: [{ validNodeName: ['h1', 'H1'] }],\n },\n })({\n component: (props: PlateRenderElementProps) => <Heading1MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-heading2-plugin';\n\nexport class Heading2Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.heading2, ...props }: PluginProps = {}) {\n super(TextStyles.heading2, {\n label: 'Heading 2',\n markupElement: new Heading2MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createHeading2Plugin(this.styles)];\n }\n}\n\nclass Heading2MarkupElement extends MarkupElement {\n constructor(id = ID, node = Heading2MarkupElementNode) {\n super(id, node);\n }\n}\n\nconst Heading2MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <h2\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </h2>\n );\n};\n\nconst createHeading2Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.heading2,\n isElement: true,\n component: Heading2MarkupElementNode,\n deserializeHtml: {\n rules: [{ validNodeName: ['h2', 'H2'] }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <Heading2MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-heading3-plugin';\n\nexport class Heading3Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.heading3, ...props }: PluginProps = {}) {\n super(TextStyles.heading3, {\n label: 'Heading 3',\n markupElement: new Heading3MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createHeading3Plugin(this.styles)];\n }\n}\n\nclass Heading3MarkupElement extends MarkupElement {\n constructor(id = ID, node = Heading3MarkupElementNode) {\n super(id, node);\n }\n}\nconst Heading3MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <h3\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </h3>\n );\n};\n\nconst createHeading3Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.heading3,\n isElement: true,\n component: Heading3MarkupElementNode,\n deserializeHtml: {\n rules: [{ validNodeName: ['h3', 'H3'] }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <Heading3MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-heading4-plugin';\n\nexport class Heading4Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.heading4, ...props }: PluginProps = {}) {\n super(TextStyles.heading4, {\n label: 'Heading 4',\n markupElement: new Heading4MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createHeading4Plugin(this.styles)];\n }\n}\n\nclass Heading4MarkupElement extends MarkupElement {\n constructor(id = ID, node = Heading4MarkupElementNode) {\n super(id, node);\n }\n}\n\nconst Heading4MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <h4\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </h4>\n );\n};\n\nconst createHeading4Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.heading4,\n isElement: true,\n component: Heading4MarkupElementNode,\n deserializeHtml: {\n rules: [{ validNodeName: ['h4', 'H4'] }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <Heading4MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-imageCaption-plugin';\n\nexport class ImageCaptionPlugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.imageCaption, ...props }: PluginProps = {}) {\n super(TextStyles.imageCaption, {\n label: 'Image Caption',\n markupElement: new ImageCaptionMarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createImageCaptionPlugin(this.styles)];\n }\n}\n\nclass ImageCaptionMarkupElement extends MarkupElement {\n constructor(id = ID, node = ImageCaptionMarkupElementNode) {\n super(id, node);\n }\n}\nconst ImageCaptionMarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <p\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </p>\n );\n};\n\nconst createImageCaptionPlugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.imageCaption,\n isElement: true,\n component: ImageCaptionMarkupElementNode,\n deserializeHtml: {\n rules: [{ validClassName: TextStyles.imageCaption }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <ImageCaptionMarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-imageTitle-plugin';\n\nexport class ImageTitlePlugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.imageTitle, ...props }: PluginProps = {}) {\n super(TextStyles.imageTitle, {\n label: 'Image Title',\n markupElement: new ImageTitleMarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createImageTitlePlugin(this.styles)];\n }\n}\n\nclass ImageTitleMarkupElement extends MarkupElement {\n constructor(id = ID, node = ImageTitleMarkupElementNode) {\n super(id, node);\n }\n}\nconst ImageTitleMarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <p\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </p>\n );\n};\n\nconst createImageTitlePlugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.imageTitle,\n isElement: true,\n component: ImageTitleMarkupElementNode,\n deserializeHtml: {\n rules: [{ validClassName: TextStyles.imageTitle }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <ImageTitleMarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createParagraphPlugin as createPlateParagraphPlugin,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nexport class ParagraphPlugin extends Plugin {\n public styles = {};\n constructor({ styles = BlockStyles.p, ...props }: PluginProps = {}) {\n super(TextStyles.p, {\n markupElement: new ParagraphMarkupElement(),\n label: 'Body Text',\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createParagraphPlugin(this.styles)];\n }\n}\n\nexport const PARAGRAPH_CLASSES = 'tw-m-0 tw-px-0 tw-py-0';\n\nexport const ParagraphMarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n const className = merge([align && alignmentClassnames[align], PARAGRAPH_CLASSES, getColumnBreakClasses(element)]);\n return (\n <p {...attributes} className={className} style={styles}>\n {children}\n </p>\n );\n};\n\nexport class ParagraphMarkupElement extends MarkupElement {\n constructor(id = TextStyles.p, node = ParagraphMarkupElementNode) {\n super(id, node);\n }\n}\n\nexport const createParagraphPlugin = (styles: CSSProperties): PlatePlugin =>\n createPluginFactory({\n ...createPlateParagraphPlugin(),\n key: TextStyles.p,\n isElement: true,\n component: ParagraphMarkupElementNode,\n })({\n component: (props: TextStyleRenderElementProps) => <ParagraphMarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-quote-plugin';\n\nexport class QuotePlugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.quote, ...props }: PluginProps = {}) {\n super(TextStyles.quote, {\n label: 'Quote',\n markupElement: new QuoteMarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createQuotePlugin(this.styles)];\n }\n}\n\nclass QuoteMarkupElement extends MarkupElement {\n constructor(id = ID, node = QuoteMarkupElementNode) {\n super(id, node);\n }\n}\n\nexport const QuoteMarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <blockquote\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </blockquote>\n );\n};\n\nexport const createQuotePlugin = (styles: CSSProperties): PlatePlugin =>\n createPluginFactory({\n key: TextStyles.quote,\n isElement: true,\n component: QuoteMarkupElementNode,\n deserializeHtml: {\n rules: [{ validNodeName: ['blockquote', 'BLOCKQUOTE'] }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <QuoteMarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TextStyles } from '../styles';\n\nimport {\n Custom1Plugin,\n Custom2Plugin,\n Custom3Plugin,\n Heading1Plugin,\n Heading2Plugin,\n Heading3Plugin,\n Heading4Plugin,\n ImageCaptionPlugin,\n ImageTitlePlugin,\n ParagraphPlugin,\n QuotePlugin,\n} from '.';\n\nexport const TextStylePluginsWithoutImage = [\n new Heading1Plugin(),\n new Heading2Plugin(),\n new Heading3Plugin(),\n new Heading4Plugin(),\n new Custom1Plugin(),\n new Custom2Plugin(),\n new Custom3Plugin(),\n new QuotePlugin(),\n new ParagraphPlugin(),\n];\n\nexport const TextStylesWithoutImage = [\n TextStyles.heading1,\n TextStyles.heading2,\n TextStyles.heading3,\n TextStyles.heading4,\n TextStyles.custom1,\n TextStyles.custom2,\n TextStyles.custom3,\n TextStyles.quote,\n TextStyles.p,\n];\n\nexport const AllTextStylePlugins = [...TextStylePluginsWithoutImage, new ImageCaptionPlugin(), new ImageTitlePlugin()];\n\nexport const AllTextStyles = [...TextStylesWithoutImage, TextStyles.imageCaption, TextStyles.imageTitle];\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n AlignCenterPlugin,\n AlignJustifyPlugin,\n AlignLeftPlugin,\n AlignRightPlugin,\n AutoformatPlugin,\n BoldPlugin,\n CheckboxListPlugin,\n CodePlugin,\n ItalicPlugin,\n OrderedListPlugin,\n PluginComposer,\n ResetFormattingPlugin,\n SoftBreakPlugin,\n StrikethroughPlugin,\n TextStylePlugin,\n UnderlinePlugin,\n UnorderedListPlugin,\n} from '@frontify/fondue/rte';\n\nimport { ButtonPlugin, LinkPlugin, TextStylePluginsWithoutImage, TextStylesWithoutImage } from '../plugins';\n\nexport const getDefaultPluginsWithLinkChooser = (appBridge: AppBridgeBlock) => {\n return new PluginComposer()\n .setPlugin(\n new SoftBreakPlugin(),\n new TextStylePlugin({\n textStyles: TextStylePluginsWithoutImage,\n }),\n )\n .setPlugin(\n [\n new BoldPlugin(),\n new ItalicPlugin(),\n new UnderlinePlugin(),\n new StrikethroughPlugin(),\n new LinkPlugin({ appBridge }),\n new ButtonPlugin({ appBridge }),\n new CodePlugin(),\n ],\n [\n new AlignLeftPlugin({ validTypes: TextStylesWithoutImage }),\n new AlignCenterPlugin({ validTypes: TextStylesWithoutImage }),\n new AlignRightPlugin({ validTypes: TextStylesWithoutImage }),\n new AlignJustifyPlugin({ validTypes: TextStylesWithoutImage }),\n new UnorderedListPlugin(),\n new CheckboxListPlugin(),\n new OrderedListPlugin(),\n new ResetFormattingPlugin(),\n new AutoformatPlugin(),\n ],\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const THEME_PREFIX = '--f-theme-settings-';\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Color } from '@frontify/fondue';\n\nimport { type SettingBlock } from '../';\n\nimport { BACKGROUND_COLOR_DEFAULT_VALUE } from './defaultValues';\n\ntype BackgroundSettingsType = {\n id?: string;\n defaultValue?: boolean;\n defaultColor?: Color;\n preventDefaultColor?: boolean;\n switchLabel?: string;\n label?: string;\n};\n\n/**\n * Returns background settings: background switch, background color\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @param options.defaultValue Default value for the background switch\n * @param options.defaultColor Default value for the background color\n * @param options.preventDefaultColor Whether the background color should be empty by default\n * @param options.label Label for the background input\n * @param options.switchLabel Label for the background switch\n * @returns {SettingBlock} Returns background settings\n */\n\nexport const getBackgroundSettings = (options?: BackgroundSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasBackground${options.id}` : 'hasBackground';\n const colorId = options?.id ? `backgroundColor${options.id}` : 'backgroundColor';\n const defaultColor = options?.preventDefaultColor\n ? undefined\n : options?.defaultColor || BACKGROUND_COLOR_DEFAULT_VALUE;\n const label = options?.label ? options.label : 'Background';\n const switchLabel = options?.switchLabel ? options.switchLabel : undefined;\n\n return {\n id: hasId,\n label,\n type: 'switch',\n switchLabel,\n defaultValue: !!options?.defaultValue,\n on: [\n {\n id: colorId,\n defaultValue: defaultColor,\n type: 'colorInput',\n },\n ],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type Color,\n MultiInputLayout,\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n minimumNumericalOrPixelRule,\n numericalOrPixelRule,\n} from '../';\n\nimport { BORDER_COLOR_DEFAULT_VALUE, BORDER_WIDTH_DEFAULT_VALUE } from './defaultValues';\nimport { BorderStyle } from './types';\n\n/**\n * Returns border settings: border switch, border style, border width, border color\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @param options.switchLabel Label for the border switch\n * @param options.defaultValue Default value for the border switch\n * @returns {SettingBlock} Returns border settings\n */\n\ntype BorderSettingsType = {\n id?: string;\n defaultValue?: boolean;\n defaultColor?: Color;\n switchLabel?: string;\n};\n\nexport const getBorderSettings = (options?: BorderSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasBorder_${options.id}` : 'hasBorder';\n const selectionId = options?.id ? `borderSelection_${options.id}` : 'borderSelection';\n const styleId = options?.id ? `borderStyle_${options.id}` : 'borderStyle';\n const widthId = options?.id ? `borderWidth_${options.id}` : 'borderWidth';\n const colorId = options?.id ? `borderColor_${options.id}` : 'borderColor';\n const defaultColor = options?.defaultColor || BORDER_COLOR_DEFAULT_VALUE;\n const switchLabel = options?.switchLabel ? options.switchLabel : undefined;\n\n return {\n id: hasId,\n label: 'Border',\n type: 'switch',\n switchLabel,\n defaultValue: !!options?.defaultValue,\n on: [\n {\n id: selectionId,\n type: 'multiInput',\n layout: MultiInputLayout.Columns,\n lastItemFullWidth: true,\n blocks: [\n {\n id: styleId,\n type: 'dropdown',\n defaultValue: BorderStyle.Solid,\n choices: [\n {\n value: BorderStyle.Solid,\n label: BorderStyle.Solid,\n },\n {\n value: BorderStyle.Dotted,\n label: BorderStyle.Dotted,\n },\n {\n value: BorderStyle.Dashed,\n label: BorderStyle.Dashed,\n },\n ],\n },\n {\n id: widthId,\n type: 'input',\n defaultValue: BORDER_WIDTH_DEFAULT_VALUE,\n rules: [\n numericalOrPixelRule,\n minimumNumericalOrPixelRule(0),\n maximumNumericalOrPixelOrAutoRule(500),\n ],\n placeholder: 'e.g. 3px',\n onChange: (bundle) => appendUnit(bundle, widthId),\n },\n {\n id: colorId,\n type: 'colorInput',\n defaultValue: defaultColor,\n },\n ],\n },\n ],\n off: [],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type SettingBlock, appendUnit, numericalOrPixelRule, presetCustomValue } from '../';\n\nimport { Radius, radiusStyleMap } from './types';\n\n/**\n * Returns border radius settings: border radius switch, radius slider, custom radius input\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @param options.dependentSettingId Id of setting which the border radius is dependent on\n * @returns {SettingBlock} Returns border settings\n */\n\ntype BorderRadiusSettingsType = {\n id?: string;\n dependentSettingId?: string;\n radiusStyleMap?: Record<Radius, string>;\n defaultRadius?: Radius;\n};\n\nexport const getBorderRadiusSlider = (id: string, defaultValue: Radius = Radius.None): SettingBlock => ({\n id,\n type: 'segmentedControls',\n defaultValue,\n choices: [\n {\n value: Radius.None,\n label: 'None',\n },\n {\n value: Radius.Small,\n label: 'S',\n },\n {\n value: Radius.Medium,\n label: 'M',\n },\n {\n value: Radius.Large,\n label: 'L',\n },\n ],\n});\n\nexport const getBorderRadiusSettings = (options?: BorderRadiusSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasRadius_${options.id}` : 'hasRadius';\n const valueId = options?.id ? `radiusValue_${options.id}` : 'radiusValue';\n const choiceId = options?.id ? `radiusChoice_${options.id}` : 'radiusChoice';\n const defaultValue = options?.defaultRadius || Radius.None;\n\n return {\n id: hasId,\n label: 'Corner radius',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'Determining how rounded the corners are.',\n show: (bundle) => (options?.dependentSettingId ? !!bundle.getBlock(options.dependentSettingId)?.value : true),\n onChange: (bundle) => presetCustomValue(bundle, choiceId, valueId, options?.radiusStyleMap || radiusStyleMap),\n on: [\n {\n id: valueId,\n type: 'input',\n placeholder: 'e.g. 10px',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, valueId),\n },\n ],\n off: [getBorderRadiusSlider(choiceId, defaultValue)],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { MultiInputLayout, type SettingBlock, appendUnit, numericalOrPixelRule, presetCustomValue } from '../';\n\nimport { getBorderRadiusSlider } from './borderRadius';\nimport { type Radius, radiusStyleMap } from './types';\n\n/**\n * Returns border radius settings: border radius switch, radius slider, custom radius inputs for every corner\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @param options.dependentSettingId Id of setting which the border radius is dependent on\n * @returns {SettingBlock} Returns border settings\n */\n\ntype BorderRadiusSettingsType = {\n id?: string;\n dependentSettingId?: string;\n defaultValue?: Radius;\n};\n\nexport const getExtendedBorderRadiusSettings = (options?: BorderRadiusSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasExtendedCustomRadius_${options.id}` : 'hasExtendedCustomRadius';\n const valueId = options?.id ? `extendedRadiusValue_${options.id}` : 'extendedRadiusValue';\n const choiceId = options?.id ? `extendedRadiusChoice_${options.id}` : 'extendedRadiusChoice';\n const topLeftId = options?.id ? `extendedRadiusTopLeft_${options.id}` : 'extendedRadiusTopLeft';\n const topRightId = options?.id ? `extendedRadiusTopRight_${options.id}` : 'extendedRadiusTopRight';\n const bottomLeftId = options?.id ? `extendedRadiusBottomLeft_${options.id}` : 'extendedRadiusBottomLeft';\n const bottomRightId = options?.id ? `extendedRadiusBottomRight_${options.id}` : 'extendedRadiusBottomRight';\n\n return {\n id: hasId,\n label: 'Corner radius',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'Determining how rounded the corners are.',\n show: (bundle) => (options?.dependentSettingId ? !!bundle.getBlock(options.dependentSettingId)?.value : true),\n onChange: (bundle) => {\n presetCustomValue(bundle, choiceId, topLeftId, radiusStyleMap);\n presetCustomValue(bundle, choiceId, topRightId, radiusStyleMap);\n presetCustomValue(bundle, choiceId, bottomLeftId, radiusStyleMap);\n presetCustomValue(bundle, choiceId, bottomRightId, radiusStyleMap);\n },\n on: [\n {\n id: valueId,\n type: 'multiInput',\n layout: MultiInputLayout.Columns,\n blocks: [\n {\n id: topLeftId,\n type: 'input',\n label: 'Top Left',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, topLeftId),\n },\n {\n id: topRightId,\n type: 'input',\n label: 'Top Right',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, topRightId),\n },\n {\n id: bottomLeftId,\n type: 'input',\n label: 'Bottom Left',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, bottomLeftId),\n },\n {\n id: bottomRightId,\n type: 'input',\n label: 'Bottom Right',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, bottomRightId),\n },\n ],\n },\n ],\n off: [getBorderRadiusSlider(choiceId, options?.defaultValue)],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type SettingBlock, appendUnit, numericalOrPixelRule, presetCustomValue } from '../';\n\nimport { GutterSpacing, gutterSpacingStyleMap } from './types';\n\n/**\n * Returns gutter settings: gutter switch, gutter choices or gutter custom input\n *\n * @param options Options for the settings\n * @param options.id Custom id for the gutters switch\n * @param options.dependentSettingId Id of the dependent setting\n * @param options.spacingChoiceId Id of the spacing choice\n * @param options.defaultValueChoices Default value for the spacing choice\n * @returns {SettingBlock} Returns the gutter settings\n */\n\ntype GutterSettingsType = {\n id?: string;\n dependentSettingId?: string;\n spacingChoiceId?: string;\n spacingCustomId?: string;\n defaultValueChoices?: GutterSpacing;\n};\n\nexport const getGutterSettings = (options?: GutterSettingsType): SettingBlock => {\n const id = options?.id ? options.id : 'hasCustomSpacing';\n const dependentSettingId = options?.dependentSettingId ? options.dependentSettingId : 'columns';\n const spacingChoiceId = options?.spacingChoiceId ? options.spacingChoiceId : 'spacingChoice';\n const spacingCustomId = options?.spacingCustomId ? options.spacingCustomId : 'spacingCustom';\n const defaultValueChoices = options?.defaultValueChoices ? options.defaultValueChoices : GutterSpacing.M;\n\n return {\n id,\n type: 'switch',\n defaultValue: false,\n switchLabel: 'Custom',\n label: 'Gutter',\n info: 'An official nerds term for ‘gap’',\n onChange: (bundle) => presetCustomValue(bundle, spacingChoiceId, spacingCustomId, gutterSpacingStyleMap),\n show: (bundle) => bundle.getBlock(dependentSettingId)?.value !== '1',\n on: [\n {\n id: spacingCustomId,\n type: 'input',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, spacingCustomId),\n },\n ],\n off: [\n {\n id: spacingChoiceId,\n type: 'slider',\n defaultValue: defaultValueChoices,\n choices: [\n {\n value: GutterSpacing.Auto,\n label: 'Auto',\n },\n {\n value: GutterSpacing.S,\n label: 'S',\n },\n {\n value: GutterSpacing.M,\n label: 'M',\n },\n {\n value: GutterSpacing.L,\n label: 'L',\n },\n ],\n },\n ],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n numericalOrPixelRule,\n presetCustomValue,\n} from '../';\n\nimport { MARGIN_DEFAULT_PLACEHOLDER } from './defaultValues';\nimport { Margin, marginStyleMap } from './types';\n\ntype MarginSettingsType = {\n id?: string;\n marginStyleMap?: Record<Margin, string>;\n};\n\n/**\n * Returns margin settings: margin switch, margin slider, custom margin input\n *\n * @param {string} id Custom suffix for the setting ids\n * @returns {SettingBlock} Returns margin settings\n */\nexport const getMarginSlider = (id: string): SettingBlock => ({\n id,\n type: 'segmentedControls',\n defaultValue: Margin.None,\n choices: [\n {\n value: Margin.None,\n label: 'None',\n },\n {\n value: Margin.Small,\n label: 'S',\n },\n {\n value: Margin.Medium,\n label: 'M',\n },\n {\n value: Margin.Large,\n label: 'L',\n },\n ],\n});\n\nexport const getMarginSettings = (options?: MarginSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasCustomMarginValue_${options?.id}` : 'hasCustomMarginValue';\n const valueId = options?.id ? `marginValue_${options?.id}` : 'marginValue';\n const choiceId = options?.id ? `marginChoice_${options?.id}` : 'marginChoice';\n\n return {\n id: hasId,\n label: 'Margin',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'The spacing around UI elements to create more space',\n onChange: (bundle) => presetCustomValue(bundle, choiceId, valueId, options?.marginStyleMap || marginStyleMap),\n on: [\n {\n id: valueId,\n type: 'input',\n placeholder: MARGIN_DEFAULT_PLACEHOLDER,\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n onChange: (bundle) => appendUnit(bundle, valueId),\n },\n ],\n off: [getMarginSlider(choiceId)],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MultiInputLayout,\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n numericalOrPixelRule,\n presetCustomValue,\n} from '../';\n\nimport { MARGIN_DEFAULT_PLACEHOLDER } from './defaultValues';\nimport { getMarginSlider } from './margin';\nimport { marginStyleMap } from './types';\n\ntype MarginSettingsType = {\n id?: string;\n};\n\n/**\n * Returns margin settings: margin switch, margin slider, custom margin input for every direction\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @returns {SettingBlock} Returns margin settings\n */\nexport const getMarginExtendedSettings = (options?: MarginSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasExtendedCustomMargin_${options?.id}` : 'hasExtendedCustomMargin';\n const valueId = options?.id ? `extendedMarginValues_${options?.id}` : 'extendedMarginValues';\n const choiceId = options?.id ? `extendedMarginChoice_${options?.id}` : 'extendedMarginChoice';\n const topId = options?.id ? `extendedMarginTop_${options?.id}` : 'extendedMarginTop';\n const leftId = options?.id ? `extendedMarginLeft_${options?.id}` : 'extendedMarginLeft';\n const rightId = options?.id ? `extendedMarginRight_${options?.id}` : 'extendedMarginRight';\n const bottomId = options?.id ? `extendedMarginBottom_${options?.id}` : 'extendedMarginBottom';\n\n return {\n id: hasId,\n label: 'Margin',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'The spacing around UI elements to create more negative space',\n onChange: (bundle) => {\n presetCustomValue(bundle, choiceId, topId, marginStyleMap);\n presetCustomValue(bundle, choiceId, leftId, marginStyleMap);\n presetCustomValue(bundle, choiceId, rightId, marginStyleMap);\n presetCustomValue(bundle, choiceId, bottomId, marginStyleMap);\n },\n on: [\n {\n id: valueId,\n type: 'multiInput',\n layout: MultiInputLayout.Spider,\n blocks: [\n {\n id: topId,\n type: 'input',\n label: 'Top',\n placeholder: MARGIN_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, topId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n {\n id: leftId,\n type: 'input',\n label: 'Left',\n placeholder: MARGIN_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, leftId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n {\n id: rightId,\n type: 'input',\n label: 'Right',\n placeholder: MARGIN_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, rightId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n {\n id: bottomId,\n type: 'input',\n label: 'Bottom',\n placeholder: MARGIN_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, bottomId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n ],\n },\n ],\n off: [getMarginSlider(choiceId)],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n numericalOrPixelRule,\n presetCustomValue,\n} from '../';\n\nimport { PADDING_DEFAULT_PLACEHOLDER } from './defaultValues';\nimport { Padding, paddingStyleMap } from './types';\n\ntype PaddingSettingsType = {\n id?: string;\n paddingStyleMap?: Record<Padding, string>;\n};\n\n/**\n * Returns padding settings: padding switch, padding slider, custom padding input\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @returns {SettingBlock} Returns padding settings\n */\nexport const getPaddingSlider = (id: string): SettingBlock => ({\n id,\n type: 'segmentedControls',\n defaultValue: Padding.Small,\n choices: [\n {\n value: Padding.None,\n label: 'None',\n },\n {\n value: Padding.Small,\n label: 'S',\n },\n {\n value: Padding.Medium,\n label: 'M',\n },\n {\n value: Padding.Large,\n label: 'L',\n },\n ],\n});\n\nexport const getPaddingSettings = (options?: PaddingSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasCustomPaddingValue_${options?.id}` : 'hasCustomPaddingValue';\n const valueId = options?.id ? `paddingValue_${options?.id}` : 'paddingValue';\n const choiceId = options?.id ? `paddingChoice_${options?.id}` : 'paddingChoice';\n\n return {\n id: hasId,\n label: 'Padding',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'The spacing around UI elements to create more negative space',\n onChange: (bundle) => presetCustomValue(bundle, choiceId, valueId, options?.paddingStyleMap || paddingStyleMap),\n on: [\n {\n id: valueId,\n type: 'input',\n placeholder: PADDING_DEFAULT_PLACEHOLDER,\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n onChange: (bundle) => appendUnit(bundle, valueId),\n },\n ],\n off: [getPaddingSlider(choiceId)],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MultiInputLayout,\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n numericalOrPixelRule,\n presetCustomValue,\n} from '../';\n\nimport { PADDING_DEFAULT_PLACEHOLDER } from './defaultValues';\nimport { getPaddingSlider } from './padding';\nimport { paddingStyleMap } from './types';\n\ntype PaddingSettingsType = {\n id?: string;\n};\n\n/**\n * Returns padding settings: padding switch, padding slider, custom padding input for every direction\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @returns {SettingBlock} Returns padding settings\n */\nexport const getPaddingExtendedSettings = (options?: PaddingSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasExtendedCustomPadding_${options?.id}` : 'hasExtendedCustomPadding';\n const valueId = options?.id ? `extendedPaddingValues_${options?.id}` : 'extendedPaddingValues';\n const choiceId = options?.id ? `extendedPaddingChoice_${options?.id}` : 'extendedPaddingChoice';\n const topId = options?.id ? `extendedPaddingTop_${options?.id}` : 'extendedPaddingTop';\n const leftId = options?.id ? `extendedPaddingLeft_${options?.id}` : 'extendedPaddingLeft';\n const rightId = options?.id ? `extendedPaddingRight_${options?.id}` : 'extendedPaddingRight';\n const bottomId = options?.id ? `extendedPaddingBottom_${options?.id}` : 'extendedPaddingBottom';\n\n return {\n id: hasId,\n label: 'Padding',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'The spacing around UI elements to create more negative space',\n onChange: (bundle) => {\n presetCustomValue(bundle, choiceId, topId, paddingStyleMap);\n presetCustomValue(bundle, choiceId, leftId, paddingStyleMap);\n presetCustomValue(bundle, choiceId, rightId, paddingStyleMap);\n presetCustomValue(bundle, choiceId, bottomId, paddingStyleMap);\n },\n on: [\n {\n id: valueId,\n type: 'multiInput',\n layout: MultiInputLayout.Spider,\n blocks: [\n {\n id: topId,\n type: 'input',\n label: 'Top',\n placeholder: PADDING_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, topId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n {\n id: leftId,\n type: 'input',\n label: 'Left',\n placeholder: PADDING_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, leftId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n {\n id: rightId,\n type: 'input',\n label: 'Right',\n placeholder: PADDING_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, rightId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n {\n id: bottomId,\n type: 'input',\n label: 'Bottom',\n placeholder: PADDING_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, bottomId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n ],\n },\n ],\n off: [getPaddingSlider(choiceId)],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type SettingBlock } from '..';\n\nimport { Security } from './types';\n\n/**\n * Returns the downloadable security settings.\n *\n * @param {string} id custom id for the setting block\n * @param {string} globalControlId custom id for the global control setting block\n *\n * @returns {SettingBlock} Returns downloadable security settings.\n */\n\ntype SecurityDownloadableSettingType = {\n id?: string;\n globalControlId?: string;\n};\n\nexport const getSecurityDownloadableSetting = (options?: SecurityDownloadableSettingType): SettingBlock => {\n const securityId = getSecurityGlobalControlId(options?.globalControlId);\n return {\n id: options?.id ? options.id : 'downloadable',\n type: 'switch',\n defaultValue: false,\n label: 'Downloadable',\n show: (bundle) => bundle.getBlock(securityId)?.value === Security.Custom,\n };\n};\n\nexport const getSecurityGlobalControlId = (id?: string): string => {\n return id || 'security';\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type SettingBlock, createFooter } from '..';\n\nimport { getSecurityGlobalControlId } from './securityDownloadable';\nimport { Security } from './types';\n\n/**\n * Returns segment controls for global security settings.\n *\n * @param {string} id custom id for the setting block\n *\n * @returns {SettingBlock} Returns\n */\n\nexport const getSecurityGlobalControlSetting = (id?: string): SettingBlock[] => {\n const securityId = getSecurityGlobalControlId(id);\n return [\n {\n id: securityId,\n type: 'segmentedControls',\n defaultValue: Security.Global,\n choices: [\n {\n value: Security.Global,\n label: 'Global Settings',\n },\n {\n value: Security.Custom,\n label: 'Custom',\n },\n ],\n },\n {\n id: 'globalSettingsInfo',\n type: 'notification',\n footer: createFooter({\n label: 'Change global settings [here].',\n replace: { here: { event: 'general-settings.open' } },\n }),\n },\n ];\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport './styles.css';\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n type AssetInputBlock as AssetInputBlockSidebarSettings,\n type BaseBlock as BaseBlockSidebarSettings,\n type Bundle as BundleSidebarSettings,\n type ChecklistBlock as ChecklistBlockSidebarSettings,\n type ChoicesType as ChoicesTypeSidebarSettings,\n type ColorInputBlock as ColorInputBlockSidebarSettings,\n type DropdownBlock as DropdownBlockSidebarSettings,\n type DynamicSettingBlock as DynamicSettingBlockSidebarSettings,\n type DynamicSupportedBlock as DynamicSupportedBlockSidebarSettings,\n type FontInputBlock as FontInputBlockSidebarSettings,\n type InputBlock as InputBlockSidebarSettings,\n type LegacyAssetInputBlock as LegacyAssetInputBlockSidebarSettings,\n type LinkBlock as LinkBlockSidebarSettings,\n type LinkChooserBlock as LinkChooserBlockSidebarSettings,\n type MultiInputBlock as MultiInputBlockSidebarSettings,\n type NotificationBlock as NotificationBlockSidebarSettings,\n type SectionHeadingBlock as SectionHeadingBlockSidebarSettings,\n type SegmentedControlsBlock as SegmentedControlsBlockSidebarSettings,\n type SettingBlock as SettingBlockSidebarSettings,\n type SimpleSettingBlock as SimpleSettingBlockSidebarSettings,\n type SwitchBlock as SwitchBlockSidebarSettings,\n type TemplateInputBlock as TemplateInputBlockSidebarSettings,\n type TextareaBlock as TextareaBlockSidebarSettings,\n type ValueOrPromisedValue as ValueOrPromisedValueSidebarSettings,\n} from '@frontify/sidebar-settings';\nimport { type FC } from 'react';\n\nexport * from '@frontify/sidebar-settings';\n\nexport type AssetInputBlock = AssetInputBlockSidebarSettings<AppBridgeBlock>;\nexport type BaseBlock<T = undefined> = BaseBlockSidebarSettings<AppBridgeBlock, T>;\nexport type Bundle = BundleSidebarSettings<AppBridgeBlock>;\nexport type ChecklistBlock = ChecklistBlockSidebarSettings<AppBridgeBlock>;\nexport type ChoicesType = ChoicesTypeSidebarSettings<AppBridgeBlock>;\nexport type ColorInputBlock = ColorInputBlockSidebarSettings<AppBridgeBlock>;\nexport type DropdownBlock = DropdownBlockSidebarSettings<AppBridgeBlock>;\nexport type DynamicSettingBlock<Block extends DynamicSupportedBlock = DynamicSupportedBlock> =\n DynamicSettingBlockSidebarSettings<AppBridgeBlock, Block>;\nexport type DynamicSupportedBlock = DynamicSupportedBlockSidebarSettings<AppBridgeBlock>;\nexport type FontInputBlock = FontInputBlockSidebarSettings<AppBridgeBlock>;\nexport type InputBlock = InputBlockSidebarSettings<AppBridgeBlock>;\nexport type LegacyAssetInputBlock = LegacyAssetInputBlockSidebarSettings<AppBridgeBlock>;\nexport type LinkBlock = LinkBlockSidebarSettings<AppBridgeBlock>;\nexport type LinkChooserBlock = LinkChooserBlockSidebarSettings<AppBridgeBlock>;\nexport type MultiInputBlock = MultiInputBlockSidebarSettings<AppBridgeBlock>;\nexport type NotificationBlock = NotificationBlockSidebarSettings<AppBridgeBlock>;\nexport type SectionHeadingBlock = SectionHeadingBlockSidebarSettings<AppBridgeBlock>;\nexport type SegmentedControlsBlock = SegmentedControlsBlockSidebarSettings<AppBridgeBlock>;\nexport type SettingBlock = SettingBlockSidebarSettings<AppBridgeBlock>;\nexport type SimpleSettingBlock = SimpleSettingBlockSidebarSettings<AppBridgeBlock>;\nexport type SwitchBlock = SwitchBlockSidebarSettings<AppBridgeBlock>;\nexport type TemplateInputBlock = TemplateInputBlockSidebarSettings<AppBridgeBlock>;\nexport type TextareaBlock = TextareaBlockSidebarSettings<AppBridgeBlock>;\nexport type ValueOrPromisedValue<T> = ValueOrPromisedValueSidebarSettings<AppBridgeBlock, T>;\n\nexport enum Sections {\n Main = 'main',\n Basics = 'basics',\n Layout = 'layout',\n Style = 'style',\n Security = 'security',\n Targets = 'targets',\n}\n\nexport type BlockSettingsStructureExport = {\n [Sections.Main]?: SettingBlock[];\n [Sections.Basics]?: SettingBlock[];\n [Sections.Layout]?: SettingBlock[];\n [Sections.Style]?: SettingBlock[];\n [Sections.Security]?: SettingBlock[];\n} & { [customSectionName: string]: SettingBlock[] };\n\nexport type BlockProps = {\n /**\n * The Frontify App Bridge provides an interface to the Frontify app internals.\n * {@link https://developer.frontify.com/document/2569#/details-concepts-1/content-blocks/introducing-the-app-bridge}\n */\n appBridge: AppBridgeBlock;\n};\n\nexport type BlockConfigExport = {\n /**\n * Block component to render.\n * {@link https://developer.frontify.com/document/2569#/details-concepts-1/content-blocks}\n */\n block: FC<BlockProps>;\n /**\n * Contains the block settings and its structure.\n * {@link https://developer.frontify.com/document/2569#/details-concepts-1/block-settings-1}\n */\n settings: ReturnType<typeof defineSettings>;\n /**\n * Block lifecycle hook ran before the block gets added in the Guideline.\n * The hook support both synchronous or asynchronous execution.\n * {@link https://developer.frontify.com/document/2569#/details-concepts-1/block-lifecycle/on-block-creation}\n */\n onBlockCreated?:\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => void)\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => Promise<void>);\n /**\n * Block lifecycle hook ran before the block gets deleted from the Guideline.\n * The hook support both synchronous or asynchronous execution.\n * {@link https://developer.frontify.com/document/2569#/details-concepts-1/block-lifecycle/on-block-deletion}\n */\n onBlockDeleted?:\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => void)\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => Promise<void>);\n};\n\n/**\n * Type helper to make it easier to export a theme, accepts a direct {@link BlockConfigExport} object.\n */\nexport const defineBlock = (config: BlockConfigExport): BlockConfigExport => config;\n\n/**\n * Type helper to make it easier to export block's settings structure, accepts a direct {@link BlockSettingsStructureExport} object\n * or a function return a direct {@link BlockSettingsStructureExport} or a function returning a Promise of {@link BlockSettingsStructureExport}.\n */\nexport const defineSettings = <\n T extends\n | BlockSettingsStructureExport\n | (() => Promise<BlockSettingsStructureExport>)\n | (() => BlockSettingsStructureExport),\n>(\n settingsStructure: T,\n): T => settingsStructure;\n\nexport * from './components';\nexport * from './helpers';\nexport * from './hooks';\nexport * from './settings';\nexport * from './utilities';\n"],"names":["joinClassNames","classNames","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","item","_a","LoadingCircle","IconExclamationMarkTriangle","Fragment","Flyout","isOpen","Dropdown","toShortRgba","color","isRgbaLongFormat","value","mapToShortFormat","alpha","isDark","threshold","inputColor","parsedColor","TinyColor","toHex8String","toHexString","toRgbaString","setAlpha","toColorObject","colorString","r","g","b","a","getReadableColor","textColor","backgroundColor","inputTextColor","inputBackgroundColor","parsedTextColor","parsedBackgroundColor","readability","moveItemInArray","array","from","to","newArray","toIndex","slice","getBackgroundColorStyles","BACKGROUND_COLOR_DEFAULT_VALUE","BORDER_COLOR_DEFAULT_VALUE","BORDER_WIDTH_DEFAULT_VALUE","PADDING_DEFAULT_PLACEHOLDER","MARGIN_DEFAULT_PLACEHOLDER","BorderStyle","borderStyleMap","Radius","radiusStyleMap","Padding","paddingStyleMap","Margin","marginStyleMap","Security","GutterSpacing","gutterSpacingStyleMap","getBorderStyles","style","borderWidth","getRadiusStyles","radiusChoice","hasRadius","radiusValue","DragPreviewContext","createContext","DragPreviewContextProvider","children","isDragPreview","useDragPreviewContext","useContext","MultiFlyoutContext","MultiFlyoutContextProvider","openFlyoutIds","setOpenFlyoutIds","memoizedContext","useMultiFlyoutContext","useMultiFlyoutState","flyoutId","onOpenChange","isFlyoutOpen","currentIds","filteredIds","id","useAttachmentOperations","attachmentKey","blockAssetBundle","blockAssets","addAssetIdsToKey","deleteAssetIdsFromKey","updateAssetIdsFromKey","attachments","newAssets","asset","assetToDelete","attachmentToReplace","newAsset","newAssetIds","attachment","assets","useAttachments","appBridge","onAttachmentsAdd","onAttachmentDelete","onAttachmentReplace","onAttachmentsSorted","useBlockAssets","AttachmentsContext","AttachmentsProvider","assetId","attachmentContext","AttachmentOperationsProvider","useAttachmentsContext","context","withAttachmentsProvider","Component","wrappedComponent","props","directions","KeyboardCode","customCoordinatesGetterFactory","columnGap","rowGap","currentCoordinates","activeNode","keyboardCodes","useDndSensors","keyboardSensorOptions","useSensors","useSensor","PointerSensor","KeyboardSensor","getDecorator","type","IconImage24","IconPlayFrame24","IconMusicNote24","IconDocument24","AttachmentItem","forwardRef","isEditing","draggableProps","transformStyle","isDragging","isOverlay","onDelete","onReplaceWithBrowse","onReplaceWithUpload","onDownload","ref","selectedAsset","setSelectedAsset","openFileDialog","selectedFiles","useFileInput","uploadFile","uploadResults","doneAll","useAssetUpload","focusProps","isFocusVisible","useFocusRing","useEffect","showLoadingCircle","FOCUS_STYLE","IconGrabHandle20","Button","e","IconPen","IconTrashBin","SortableAttachmentItem","attributes","listeners","setNodeRef","transform","transition","useSortable","AttachmentsButtonTrigger","IconPaperclip16","IconCaretDown12","Attachments","onBrowse","onUpload","onSorted","TriggerComponent","internalItems","setInternalItems","isFlyoutOpenInternal","setIsFlyoutOpenInternal","sensors","draggedAssetId","setDraggedAssetId","isUploadLoading","setIsUploadLoading","assetIdsLoading","setAssetIdsLoading","setSelectedFiles","useEditorState","openAssetChooser","closeAssetChooser","useAssetChooser","isControllingStateExternally","draggedItem","handleFlyoutOpenChange","stateSetter","onOpenAssetChooser","result","internalItem","onReplaceItemWithBrowse","toReplace","onReplaceItemWithUpload","uploadedAsset","handleDragStart","active","handleDragEnd","over","oldIndex","newIndex","sortedItems","arrayMove","autoFocusModifier","Tooltip","DndContext","closestCenter","restrictToVerticalAxis","SortableContext","rectSortingStrategy","AssetInput","AssetInputSize","fileList","getToolbarButtonClassNames","cursor","forceActiveStyle","FOCUS_VISIBLE_STYLE","BaseToolbarButton","dataTestId","AttachmentsToolbarButtonTrigger","DEFAULT_ATTACHMENTS_BUTTON_ID","AttachmentsToolbarButton","useMemoizedId","DEFAULT_DRAG_TOOLTIP","DEFAULT_DRAGGING_TOOLTIP","ToolbarButtonTooltip","content","open","disabled","DragHandleToolbarButton","tooltip","setActivatorNodeRef","FlyoutToolbarButton","flyoutFooter","flyoutHeader","DEFAULT_MENU_BUTTON_ID","MenuToolbarButton","IconDotsHorizontal","block","blockIndex","itemIndex","ToolbarButton","ToolbarSegment","Toolbar","BlockItemWrapper","memo","toolbarItems","shouldHideWrapper","shouldHideComponent","shouldFillContainer","outlineOffset","shouldBeShown","showAttachments","wrapperRef","shouldToolbarBeVisible","DownloadButton","ariaLabel","isFocused","IconArrowCircleDown16","useIsInViewport","onChange","isInViewport","intersectionObserver","entry","SerializedText","gap","customClass","show","plugins","html","setHtml","htmlContent","serializeRawToHtmlAsync","floatingButtonStore","createStore","set","mode","editorId","state","floatingButtonActions","floatingButtonSelectors","useFloatingButtonSelectors","hasRichTextValue","string","hasText","child","json","convertToRteValue","textStyle","text","align","isDownloadable","security","downloadable","globalAssetDownloadEnabled","mapAppBridgeColorPalettesToFonduePalettes","colorPalettes","mapAppBridgeColorPaletteToFonduePalette","colorPalette","mapColor","isV4Color","title","revision","getLinkNode","editor","cb","linkNode","getAboveNode","ELEMENT_LINK","getLegacyUrl","link","_b","getUrl","getUrlFromLinkOrLegacyLink","getLinkFromEditor","relativeUrlRegex","addHttps","url","isValidUrl","parsedUrl","isValidUrlOrEmpty","withButton","apply","normalizeNode","operation","range","isCollapsed","getPluginType","ELEMENT_BUTTON","path","newPoint","isStartPoint","getPreviousNodeEndPoint","isEndPoint","getNextNodeStartPoint","node","nextPoint","select","nextPath","Path","insertNodes","withRemoveEmptyNodes","mockPlugin","insertButton","createButtonNodeOptions","options","createButtonNode","submitFloatingButton","isUrl","forceSubmit","getPluginOptions","buttonStyle","target","upsertButton","_url","focusEditor","unwrapButton","withoutNormalizing","splitNodes","n","isElement","_c","_d","_e","_f","unwrapNodes","insertTextInButton","insertNodesOptions","at","buttonAbove","isDefined","editButtonUrlAndTarget","buttonEntry","findNode","buttonNode","buttonPath","shouldReplaceText","shouldReplaceButtonText","isExpanded","anchorAndFocusInButton","removeNodes","getNodeProps","leaf","getNodeLeaf","getEditorString","wrapButton","upsertButtonText","setNodes","newButton","newButtonNode","newButtonPath","firstText","replaceNodeChildren","wrapNodes","getUrlFromEditor","triggerFloatingButton","focused","triggerFloatingButtonEdit","triggerFloatingButtonInsert","isRangeAcrossBlocks","someNode","DefaultButtonStyles","BlockButtonStyles","ButtonMarkupElementNode","href","HoverableButtonLink","styles","hovered","setHovered","ButtonMarkupElement","MarkupElement","ButtonToolbarButton","rootProps","useEditorRef","IconStylingWrapper","IconButton","ButtonButton","useEventPlateId","isEnabled","isRangeInSameBlock","isLink","getTooltip","getHotkeyByPlatform","LINK_PLUGIN","TextStyles","BlockStyles","EditModal","FloatingModalWrapper","filterDocumentSectionsWithUnreadableTitles","sections","section","LoadingIndicator","SectionLink","selectedUrl","onSelectUrl","isActive","merge","IconDocumentText","PageLink","page","itemsToExpandInitially","getDocumentSectionsByDocumentPageId","setIsExpanded","documentSections","setDocumentSections","sectionsWithReadableTitles","hasSections","PageLinks","documentId","getDocumentPagesByDocumentId","pages","setPages","setIsLoading","pagesArray","hasPages","_pages","pagesWithCategories","pagesWithoutCategories","DocumentLink","document","IconColorFan","DocumentLinks","getAllDocuments","documents","setDocuments","setItemsToExpandInitially","findLocationOfSelectedUrl","_documents","itemsToExpand","LinkSelector","onUrlChange","buttonSize","isModalOpen","setIsModalOpen","setSelectedUrl","onPressEnter","saveLink","dialogProps","Dialog","IconLink","ScrollArea","LinkInput","onToggleTab","placeholder","newTab","required","info","hideInternalLinkButton","isUrlValid","internalIsValidUrlOrEmpty","FormControl","TextInput","documentPageId","Checkbox","Label","InsertModal","onTextChange","onCancel","onSave","hasValues","testId","IconCheckMark","getButtonStyle","initialState","InsertModalState","dispatch","useReducer","action","payload","useInsertModal","onButtonStyleChange","checked","urlToSave","useHotkeys","InsertButtonModal","modalProps","HoverableButton","getStyles","floatingOptions","offset","flip","CustomFloatingButton","insertRef","insertProps","useFloatingButtonInsert","editRef","editProps","useFloatingButtonEdit","input","editContent","createPortal","BUTTON_PLUGIN","createButtonPlugin","createPluginFactory","element","_editor","el","ButtonPlugin","Plugin","__publicField","version","useEditorVersion","triggerFloatingButtonHotkeys","getBoundingClientRect","getRangeBoundingClientRect","getStartPoint","getEndPoint","getDefaultBoundingClientRect","update","floating","useVirtualFloatingButton","useFloatingButtonEnter","useFloatingButtonEscape","useComposedRef","useFocused","getSelectionBoundingClientRect","OFFSET_Y","OFFSET_X","PADDING","useVirtualFloating","columnBreakDisablingClassUnderMd","columnBreakDisablingClassUnderSm","columnClassMap","getResponsiveColumnClasses","columnCount","handleHideExternalFloatingModals","InternalRichTextEditor","columns","showSerializedText","shouldPreventPageLeave","setShouldPreventPageLeave","useId","handleTextChange","newContent","handleValueChange","unloadHandler","FondueRichTextEditor","RichTextEditor","hasEnteredViewport","setHasEnteredViewport","internalRteProps","onViewportVisibilityChange","editButtonProps","unlinkButtonProps","useLinkOpenButtonState","legacyUrl","isNewTab","floatingLinkSelectors","floatingLinkActions","submitFloatingLink","InsertLinkModal","CustomFloatingLink","insertState","useFloatingLinkInsertState","hidden","useFloatingLinkInsert","editState","useFloatingLinkEditState","useFloatingLinkEdit","LinkToolbarButton","useLinkToolbarButtonState","useLinkToolbarButton","LinkButton","LinkMarkupElementNode","useRichTextEditorContext","LinkMarkupElement","createLinkPlugin","createPlateLinkPlugin","LinkPlugin","KEY_ELEMENT_BREAK_AFTER_COLUMN","GAP_DEFAULT","BreakAfterPlugin","ColumnBreakButton","createColumnBreakPlugin","ID","Custom1Plugin","Custom1MarkupElement","createCustom1Plugin","Custom1MarkupElementNode","alignmentClassnames","getColumnBreakClasses","Custom2Plugin","Custom2MarkupElement","createCustom2Plugin","Custom2MarkupElementNode","Custom3Plugin","Custom3MarkupElement","createCustom3Plugin","Custom3MarkupElementNode","Heading1Plugin","Heading1MarkupElement","createHeading1Plugin","Heading1MarkupElementNode","Heading2Plugin","Heading2MarkupElement","createHeading2Plugin","Heading2MarkupElementNode","Heading3Plugin","Heading3MarkupElement","createHeading3Plugin","Heading3MarkupElementNode","Heading4Plugin","Heading4MarkupElement","createHeading4Plugin","Heading4MarkupElementNode","ImageCaptionPlugin","ImageCaptionMarkupElement","createImageCaptionPlugin","ImageCaptionMarkupElementNode","ImageTitlePlugin","ImageTitleMarkupElement","createImageTitlePlugin","ImageTitleMarkupElementNode","ParagraphPlugin","ParagraphMarkupElement","createParagraphPlugin","PARAGRAPH_CLASSES","ParagraphMarkupElementNode","className","createPlateParagraphPlugin","QuotePlugin","QuoteMarkupElement","createQuotePlugin","QuoteMarkupElementNode","TextStylePluginsWithoutImage","TextStylesWithoutImage","AllTextStylePlugins","AllTextStyles","getDefaultPluginsWithLinkChooser","PluginComposer","SoftBreakPlugin","TextStylePlugin","BoldPlugin","ItalicPlugin","UnderlinePlugin","StrikethroughPlugin","CodePlugin","AlignLeftPlugin","AlignCenterPlugin","AlignRightPlugin","AlignJustifyPlugin","UnorderedListPlugin","CheckboxListPlugin","OrderedListPlugin","ResetFormattingPlugin","AutoformatPlugin","THEME_PREFIX","getBackgroundSettings","hasId","colorId","defaultColor","switchLabel","getBorderSettings","selectionId","styleId","widthId","MultiInputLayout","numericalOrPixelRule","minimumNumericalOrPixelRule","maximumNumericalOrPixelOrAutoRule","bundle","appendUnit","getBorderRadiusSlider","defaultValue","getBorderRadiusSettings","valueId","choiceId","presetCustomValue","getExtendedBorderRadiusSettings","topLeftId","topRightId","bottomLeftId","bottomRightId","getGutterSettings","dependentSettingId","spacingChoiceId","spacingCustomId","defaultValueChoices","getMarginSlider","getMarginSettings","getMarginExtendedSettings","topId","leftId","rightId","bottomId","getPaddingSlider","getPaddingSettings","getPaddingExtendedSettings","getSecurityDownloadableSetting","securityId","getSecurityGlobalControlId","getSecurityGlobalControlSetting","createFooter","Sections","defineBlock","config","defineSettings","settingsStructure"],"mappings":"wrBAQaA,EAAkBC,GAC3BA,EAAW,OAAO,OAAO,EAAE,KAAK,GAAG,ECG1BC,GAAoB,CAAC,CAC9B,OAAAC,EACA,MAAAC,EACA,KAAAC,EACA,eAAAC,EACA,UAAAC,EACA,oBAAAC,EACA,mBAAAC,EACA,cAAAC,EACA,SAAAC,EAAW,GACX,QAAAC,EACA,cAAAC,EACA,eAAAC,CACJ,IAA8B,CAC1B,KAAM,CAACC,EAAgBC,CAAiB,EAAIC,EAAAA,SAAS,EAAK,EACpD,CAACC,EAAcC,CAAe,EAAIF,WAAA,EAClCG,EAAYC,EAAAA,OAA0B,IAAI,EAC1C,CAACC,EAAUC,CAAW,EAAIN,EAAAA,SAA6B,MAAS,EAEhEO,EAAmDC,GAAU,CAG/D,GAFAA,EAAM,eAAA,EACNT,EAAkB,EAAK,EACnB,CAACU,EAAaD,EAAM,aAAa,KAAK,EAAG,CACzCF,EAAY,SAAS,EACrB,WAAW,IAAM,CACbA,EAAY,MAAS,CACzB,EAAG,GAAI,EACP,MACJ,CACApB,GAAA,MAAAA,EAASsB,EAAM,aAAa,MAChC,EAEMC,EAAgBC,GAAoB,CACtC,GAAI,CAACd,EACD,MAAO,GAEX,QAASe,EAAI,EAAGA,EAAID,EAAM,OAAQC,IAAK,CACnC,MAAMC,EAAwBF,EAAMC,CAAC,EAAE,KAAK,MAAM,GAAG,EAAE,IAAA,GAAS,GAChE,GAAI,CAACE,EAAAA,kBAAkBjB,CAAa,EAAE,SAASgB,CAAoB,EAC/D,MAAO,EAEf,CACA,MAAO,EACX,EAEME,EAAkDN,GAAU,CAC9D,GAAI,CAACL,EAAU,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A,EAMhEC,GAMTC,GACIA"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/utilities/react/joinClassNames.ts","../src/components/BlockInjectButton/BlockInjectButton.tsx","../src/utilities/color/toShortRgba.ts","../src/utilities/color/isDark.ts","../src/utilities/color/toHex8String.ts","../src/utilities/color/toHexString.ts","../src/utilities/color/toRgbaString.ts","../src/utilities/color/setAlpha.ts","../src/utilities/color/toColorObject.ts","../src/utilities/color/getReadableColor.ts","../src/utilities/moveItemInArray.ts","../src/utilities/react/getBackgroundColorStyles.ts","../src/settings/defaultValues.ts","../src/settings/types.ts","../src/utilities/react/getBorderStyles.ts","../src/utilities/react/getRadiusStyles.ts","../src/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.tsx","../src/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.tsx","../src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.ts","../src/hooks/useAttachments.tsx","../src/helpers/customCoordinatesGetterFactory.ts","../src/hooks/useDndSensors.ts","../src/components/Attachments/AttachmentItem.tsx","../src/components/Attachments/AttachmentsButtonTrigger.tsx","../src/components/Attachments/Attachments.tsx","../src/components/BlockItemWrapper/Toolbar/helpers.ts","../src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.tsx","../src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.tsx","../src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.tsx","../src/components/BlockItemWrapper/constants.ts","../src/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.tsx","../src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.tsx","../src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.tsx","../src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.tsx","../src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.tsx","../src/components/BlockItemWrapper/Toolbar/ToolbarSegment.tsx","../src/components/BlockItemWrapper/Toolbar/Toolbar.tsx","../src/components/BlockItemWrapper/BlockItemWrapper.tsx","../src/components/DownloadButton/DownloadButton.tsx","../src/hooks/useIsInViewport.ts","../src/components/RichTextEditor/SerializedText.tsx","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.ts","../src/helpers/hasRichTextValue.ts","../src/helpers/convertToRichTextValue.ts","../src/helpers/isDownloadable.ts","../src/helpers/mapColorPalettes.ts","../src/components/Link/utils/getUrl.ts","../src/components/Link/utils/relativeUrlRegex.ts","../src/helpers/addHttps.ts","../src/components/Link/utils/url.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.tsx","../src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.tsx","../src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/id.ts","../src/components/RichTextEditor/plugins/styles.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.tsx","../src/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.ts","../src/components/Link/LinkSelector/LoadingIndicator.tsx","../src/components/Link/LinkSelector/SectionLink.tsx","../src/components/Link/LinkSelector/PageLink.tsx","../src/components/Link/LinkSelector/PageLinks.tsx","../src/components/Link/LinkSelector/DocumentLink.tsx","../src/components/Link/LinkSelector/DocumentLinks.tsx","../src/components/Link/LinkSelector/LinkSelector.tsx","../src/components/Link/LinkInput.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.tsx","../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.tsx","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.tsx","../src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.ts","../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.ts","../src/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.ts","../src/components/RichTextEditor/RichTextEditor.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.ts","../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.ts","../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/LinkButton.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.tsx","../src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.ts","../src/components/RichTextEditor/plugins/LinkPlugin/index.ts","../src/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.ts","../src/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.tsx","../src/components/RichTextEditor/plugins/TextStylePlugins/helpers.tsx","../src/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.tsx","../src/components/RichTextEditor/constants.ts","../src/settings/background.ts","../src/settings/border.ts","../src/settings/borderRadius.ts","../src/settings/borderRadiusExtended.ts","../src/settings/gutter.ts","../src/settings/margin.ts","../src/settings/marginExtended.ts","../src/settings/padding.ts","../src/settings/paddingExtended.ts","../src/settings/securityDownloadable.ts","../src/settings/securityGlobalControl.ts","../src/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\n/**\n * Cleans and joins an array of inputs with possible undefined or boolean values.\n *\n * @param {Array} classNames Array of class names\n * @returns Clean string to be used for class name.\n */\nexport const joinClassNames = (classNames: (string | undefined | boolean)[]): string =>\n classNames.filter(Boolean).join(' ');\n","/* (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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Color } from '@frontify/fondue';\n\ntype ShortNotationColor = {\n r: number;\n g: number;\n b: number;\n a?: number;\n};\n\n/**\n * Maps color object from long to short rgba notation.\n *\n * @param {Object} Color object\n * @returns {Object} ShortNotationColor object\n */\n\nexport const toShortRgba = (color: unknown): ShortNotationColor => {\n const isRgbaLongFormat = (value: Color) => {\n const requiredKeys = ['red', 'green', 'blue'];\n return typeof value === 'object' && requiredKeys.every((i) => value.hasOwnProperty(i));\n };\n\n const mapToShortFormat = (value: Color): ShortNotationColor => {\n const alpha = typeof value.alpha === 'number' ? value.alpha : 1;\n return { r: value.red, g: value.green, b: value.blue, a: alpha };\n };\n\n if (isRgbaLongFormat(color as Color)) {\n return mapToShortFormat(color as Color);\n }\n\n return color as ShortNotationColor;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ColorInput, TinyColor } from '@ctrl/tinycolor';\nimport { type Color } from '@frontify/sidebar-settings';\n\nimport { toShortRgba } from './toShortRgba';\n\n/**\n * Calculates if text should be in a light color depending on color (e.g. background-color)\n *\n * @param {Object} value Object of RGBA values\n * @param {Number|undefined} threshold Threshold for the brightness\n * @returns {Boolean} Return if the color is dark\n */\n\nconst isRgbaLongFormat = (value: unknown): value is Color => {\n const requiredKeys = ['red', 'green', 'blue'];\n return typeof value === 'object' && requiredKeys.every((i) => value?.hasOwnProperty(i));\n};\n\nexport const isDark = (color: unknown, threshold?: number): boolean => {\n const inputColor = isRgbaLongFormat(color) ? toShortRgba(color) : (color as ColorInput);\n const parsedColor = new TinyColor(inputColor);\n\n if (threshold) {\n return parsedColor.getBrightness() < threshold;\n }\n\n return parsedColor.isDark() || (parsedColor.getAlpha() > 0.25 && parsedColor.getAlpha() < 1);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TinyColor } from '@ctrl/tinycolor';\nimport { type Color } from '@frontify/fondue';\n\nimport { toShortRgba } from './toShortRgba';\n\n/**\n * Maps color object of rgba values to hex alpha string.\n *\n * @param {Object} Color object\n * @returns {String} To be used as css value.\n */\n\nexport const toHex8String = (color: Color): string => new TinyColor(toShortRgba(color)).toHex8String();\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TinyColor } from '@ctrl/tinycolor';\nimport { type Color } from '@frontify/fondue';\n\nimport { toShortRgba } from './toShortRgba';\n\n/**\n * Maps color object of rgba values to hex alpha string.\n */\nexport const toHexString = (color: Color): string => new TinyColor(toShortRgba(color)).toHexString();\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TinyColor } from '@ctrl/tinycolor';\nimport { type Color } from '@frontify/fondue';\n\nimport { toShortRgba } from './toShortRgba';\n\n/**\n * Maps color object of rgba values to rgba string.\n *\n * @param {Object} Color object\n * @returns {String} To be used as css value.\n */\n\nexport const toRgbaString = (color: Color): string => new TinyColor(toShortRgba(color)).toRgbString();\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TinyColor } from '@ctrl/tinycolor';\n\n/**\n * Sets alpha value and returns rgba string.\n *\n * @param {string} color Rgb or hex string.\n * @returns {String} To be used as css value.\n */\n\nexport const setAlpha = (alpha: number, color?: string): string => {\n return new TinyColor(color).setAlpha(alpha).toRgbString();\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TinyColor } from '@ctrl/tinycolor';\nimport { type Color } from '@frontify/fondue';\n\n/**\n * Maps color strings to color objects.\n *\n * @param {String} String representing color\n * @returns {Color} Color object\n */\n\nexport const toColorObject = (colorString: string): Color => {\n const { r, g, b, a } = new TinyColor(colorString);\n return { red: r, green: g, blue: b, alpha: a };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ColorInput, TinyColor, readability } from '@ctrl/tinycolor';\nimport { type Color } from '@frontify/sidebar-settings';\n\nimport { toShortRgba } from './toShortRgba';\n\n/**\n * Returns darkened text color for a given background color, so that it is readable and has enough contrast (above 4.5)\n *\n * @param {Object} textColor Object of RGBA values\n * @param {Object} backgroundColor Object of RGBA values\n * @returns {string} To be used as css value\n */\n\nconst isRgbaLongFormat = (value: unknown): value is Color => {\n const requiredKeys = ['red', 'green', 'blue'];\n return typeof value === 'object' && requiredKeys.every((i) => value?.hasOwnProperty(i));\n};\n\nexport const getReadableColor = (textColor: unknown, backgroundColor: unknown): string => {\n const inputTextColor = isRgbaLongFormat(textColor) ? toShortRgba(textColor) : (textColor as ColorInput);\n const inputBackgroundColor = isRgbaLongFormat(backgroundColor)\n ? toShortRgba(backgroundColor)\n : (backgroundColor as ColorInput);\n let parsedTextColor = new TinyColor(inputTextColor);\n const parsedBackgroundColor = new TinyColor(inputBackgroundColor);\n\n // darken the text color until readability is good\n while (readability(parsedTextColor, parsedBackgroundColor) < 4.5) {\n parsedTextColor = parsedTextColor.darken(1);\n }\n\n return parsedTextColor.toRgbString();\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\n/**\n * Moves an item from the 'from' position to the 'to' position and updates the array\n *\n * @param {Array} array Array of items\n * @param {Number} from Initial index of the item\n * @param {Number} to New index of the item\n * @returns {Array} New array with the item moved to the new position\n */\nexport const moveItemInArray = <T>(array: T[], from: number, to: number): T[] => {\n const newArray = [...array];\n const toIndex = to < 0 ? newArray.length + to : to;\n\n if (toIndex >= 0 && toIndex < newArray.length) {\n const slice = newArray.splice(from, 1)[0];\n newArray.splice(toIndex, 0, slice);\n }\n\n return newArray;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Color } from '@frontify/fondue';\nimport { type CSSProperties } from 'react';\n\nimport { toRgbaString } from '../color';\n\nexport const getBackgroundColorStyles = (backgroundColor: Color): CSSProperties => ({\n backgroundColor: toRgbaString(backgroundColor),\n});\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const BACKGROUND_COLOR_DEFAULT_VALUE = {\n red: 241,\n green: 241,\n blue: 241,\n alpha: 1,\n};\n\nexport const BORDER_COLOR_DEFAULT_VALUE = {\n red: 234,\n green: 235,\n blue: 235,\n alpha: 1,\n};\n\nexport const BORDER_WIDTH_DEFAULT_VALUE = '1px';\n\nexport const PADDING_DEFAULT_PLACEHOLDER = '24px';\n\nexport const MARGIN_DEFAULT_PLACEHOLDER = '24px';\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Color } from '@frontify/sidebar-settings';\n\nexport enum BorderStyle {\n Solid = 'Solid',\n Dashed = 'Dashed',\n Dotted = 'Dotted',\n}\n\nexport const borderStyleMap: Record<BorderStyle, string> = {\n [BorderStyle.Solid]: 'solid',\n [BorderStyle.Dotted]: 'dotted',\n [BorderStyle.Dashed]: 'dashed',\n};\n\nexport enum Radius {\n None = 'None',\n Small = 'Small',\n Medium = 'Medium',\n Large = 'Large',\n}\n\nexport const radiusStyleMap: Record<Radius, string> = {\n [Radius.None]: '0px',\n [Radius.Small]: '2px',\n [Radius.Medium]: '4px',\n [Radius.Large]: '12px',\n};\n\nexport enum Padding {\n None = 'None',\n Small = 'Small',\n Medium = 'Medium',\n Large = 'Large',\n}\n\nexport const paddingStyleMap: Record<Padding, string> = {\n [Padding.None]: '0px',\n [Padding.Small]: '24px',\n [Padding.Medium]: '36px',\n [Padding.Large]: '60px',\n};\n\nexport type PaddingSettings = {\n paddingChoice: Padding;\n hasCustomPaddingValue: boolean;\n paddingValue: string;\n};\n\nexport type PaddingExtendedSettings = {\n hasExtendedCustomPadding: boolean;\n extendedPaddingChoice: Padding;\n extendedPaddingTop: string;\n extendedPaddingRight: string;\n extendedPaddingBottom: string;\n extendedPaddingLeft: string;\n};\n\nexport type RadiusExtendedSettings = {\n hasExtendedCustomRadius: boolean;\n extendedRadiusChoice: Radius;\n extendedRadiusTopLeft: string;\n extendedRadiusTopRight: string;\n extendedRadiusBottomLeft: string;\n extendedRadiusBottomRight: string;\n};\n\nexport type BorderSettings = {\n hasBorder: boolean;\n borderStyle: BorderStyle;\n borderWidth: string;\n borderColor: Color;\n};\n\nexport type RadiusSettings = {\n hasRadius: boolean;\n radiusValue: string;\n radiusChoice: Radius;\n};\n\nexport enum Margin {\n None = 'None',\n Small = 'Small',\n Medium = 'Medium',\n Large = 'Large',\n}\n\nexport const marginStyleMap: Record<Margin, string> = {\n [Margin.None]: '0px',\n [Margin.Small]: '24px',\n [Margin.Medium]: '36px',\n [Margin.Large]: '60px',\n};\n\nexport type MarginSettings = {\n marginChoice: Margin;\n hasCustomMarginValue: boolean;\n marginValue: string;\n};\n\nexport type MarginExtendedSettings = {\n hasExtendedCustomMargin: boolean;\n extendedMarginChoice: Margin;\n extendedMarginTop: string;\n extendedMarginRight: string;\n extendedMarginBottom: string;\n extendedMarginLeft: string;\n};\n\nexport enum Security {\n Global = 'Global',\n Custom = 'Custom',\n}\n\nexport enum GutterSpacing {\n Auto = 'Auto',\n S = 'S',\n M = 'M',\n L = 'L',\n}\n\nexport const gutterSpacingStyleMap: Record<GutterSpacing, string> = {\n [GutterSpacing.Auto]: '4px',\n [GutterSpacing.S]: '10px',\n [GutterSpacing.M]: '30px',\n [GutterSpacing.L]: '50px',\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Color } from '@frontify/fondue';\nimport { type CSSProperties } from 'react';\n\nimport { BORDER_COLOR_DEFAULT_VALUE } from '../../settings/defaultValues';\nimport { BorderStyle, borderStyleMap } from '../../settings/types';\nimport { toRgbaString } from '../color';\n\nexport const getBorderStyles = (\n style = BorderStyle.Solid,\n borderWidth = '1px',\n color = BORDER_COLOR_DEFAULT_VALUE as Color,\n): CSSProperties => {\n return {\n borderStyle: borderStyleMap[style],\n borderWidth,\n borderColor: toRgbaString(color),\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type CSSProperties } from 'react';\n\nimport { type Radius, radiusStyleMap } from '../../settings/types';\n\nexport const getRadiusStyles = (radiusChoice: Radius, hasRadius = false, radiusValue?: number): CSSProperties => ({\n borderRadius: hasRadius ? radiusValue : radiusStyleMap[radiusChoice],\n});\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactNode, createContext, useContext } from 'react';\n\nconst DragPreviewContext = createContext(false);\nDragPreviewContext.displayName = 'DragPreviewContext';\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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Dispatch, type ReactNode, type 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});\nMultiFlyoutContext.displayName = 'MultiFlyoutContext';\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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useCallback } from 'react';\n\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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock, type Asset, useBlockAssets } from '@frontify/app-bridge';\nimport { type ReactNode, createContext, useContext } from 'react';\n\nimport { type BlockProps } from '../index';\n\nexport const useAttachmentOperations = (attachmentKey: string, blockAssetBundle: ReturnType<typeof useBlockAssets>) => {\n const { blockAssets, addAssetIdsToKey, deleteAssetIdsFromKey, updateAssetIdsFromKey } = blockAssetBundle;\n const attachments = blockAssets?.[attachmentKey] || [];\n\n const onAttachmentsAdd = async (newAssets: Asset[]) => {\n await addAssetIdsToKey(\n attachmentKey,\n newAssets.map((asset) => asset.id),\n );\n };\n\n const onAttachmentDelete = async (assetToDelete: Asset) => {\n await deleteAssetIdsFromKey(attachmentKey, [assetToDelete.id]);\n };\n\n const onAttachmentReplace = async (attachmentToReplace: Asset, newAsset: Asset) => {\n const newAssetIds = attachments.map((attachment) =>\n attachment.id === attachmentToReplace.id ? newAsset.id : attachment.id,\n );\n\n await updateAssetIdsFromKey(attachmentKey, newAssetIds);\n };\n\n const onAttachmentsSorted = async (assets: Asset[]) => {\n const newAssetIds = assets.map((asset) => asset.id);\n\n await updateAssetIdsFromKey(attachmentKey, newAssetIds);\n };\n\n return {\n onAttachmentsAdd,\n onAttachmentDelete,\n onAttachmentReplace,\n onAttachmentsSorted,\n attachments,\n };\n};\n\nexport const useAttachments = (appBridge: AppBridgeBlock, attachmentKey: string) => {\n const { onAttachmentsAdd, onAttachmentDelete, onAttachmentReplace, onAttachmentsSorted, attachments } =\n useAttachmentOperations(attachmentKey, useBlockAssets(appBridge));\n\n return {\n onAttachmentsAdd,\n onAttachmentDelete,\n onAttachmentReplace,\n onAttachmentsSorted,\n attachments,\n appBridge,\n };\n};\n\nconst AttachmentsContext = createContext<ReturnType<typeof useAttachments> | null>(null);\nAttachmentsContext.displayName = 'AttachmentsContext';\n\nexport const AttachmentsProvider = ({\n appBridge,\n children,\n assetId,\n}: {\n appBridge: AppBridgeBlock;\n children: ReactNode;\n assetId: string;\n}) => {\n const attachmentContext = useAttachments(appBridge, assetId);\n\n return <AttachmentsContext.Provider value={attachmentContext}>{children}</AttachmentsContext.Provider>;\n};\n\nexport const AttachmentOperationsProvider = ({\n blockAssetBundle,\n appBridge,\n children,\n assetId,\n}: {\n blockAssetBundle: ReturnType<typeof useBlockAssets>;\n children: ReactNode;\n assetId: string;\n appBridge: AppBridgeBlock;\n}) => {\n const attachmentContext = useAttachmentOperations(assetId, blockAssetBundle);\n\n return (\n <AttachmentsContext.Provider value={{ ...attachmentContext, appBridge }}>\n {children}\n </AttachmentsContext.Provider>\n );\n};\n\nexport const useAttachmentsContext = () => {\n const context = useContext(AttachmentsContext);\n\n if (!context) {\n throw new Error(\n \"No AttachmentsContext Provided. Component must be wrapped in an 'AttachmentsProvider' or the 'withAttachmentsProvider' HOC\",\n );\n }\n\n return context;\n};\n\n/**\n * Block-level HOC for cases when there is only one attachment asset field related to the block.\n * Recommended for most cases.\n * If finer control is required over attachments, use {@link AttachmentsProvider} component.\n */\nexport const withAttachmentsProvider = <T extends BlockProps>(Component: (props: T) => ReactNode, assetId: string) => {\n const wrappedComponent = (props: T) => (\n <AttachmentsProvider appBridge={props.appBridge} assetId={assetId}>\n <Component {...props} />\n </AttachmentsProvider>\n );\n\n wrappedComponent.displayName = 'withAttachmentsProvider';\n\n return wrappedComponent;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { KeyboardCode, type KeyboardCoordinateGetter } from '@dnd-kit/core';\n\nconst directions: string[] = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];\n\nexport const customCoordinatesGetterFactory =\n (columnGap: number, rowGap: number): KeyboardCoordinateGetter =>\n (event, { currentCoordinates, context: { activeNode } }) => {\n event.preventDefault();\n if (directions.includes(event.code)) {\n const width = activeNode?.offsetWidth ?? 0;\n const height = activeNode?.offsetHeight ?? 0;\n\n switch (event.code) {\n case KeyboardCode.Right:\n return {\n ...currentCoordinates,\n x: currentCoordinates.x + width + columnGap,\n };\n case KeyboardCode.Left:\n return {\n ...currentCoordinates,\n x: currentCoordinates.x - width - columnGap,\n };\n case KeyboardCode.Down:\n return {\n ...currentCoordinates,\n y: currentCoordinates.y + height + rowGap,\n };\n case KeyboardCode.Up:\n return {\n ...currentCoordinates,\n y: currentCoordinates.y - height - rowGap,\n };\n }\n }\n return undefined;\n };\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { KeyboardSensor, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';\nimport { useMemo } from 'react';\n\nimport { customCoordinatesGetterFactory } from '../helpers/customCoordinatesGetterFactory';\n\nconst keyboardCodes = {\n start: ['Space', 'Enter'],\n cancel: [],\n end: ['Space', 'Enter', 'Escape'],\n};\n\nexport const useDndSensors = (columnGap = 0, rowGap = 0) => {\n const keyboardSensorOptions = useMemo(() => {\n const customCoordinatesGetter = customCoordinatesGetterFactory(columnGap, rowGap);\n return {\n coordinateGetter: customCoordinatesGetter,\n keyboardCodes,\n };\n }, [columnGap, rowGap]);\n\n const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, keyboardSensorOptions));\n\n return sensors;\n};\n","/* (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","/* (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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n DndContext,\n type DragEndEvent,\n type DragStartEvent,\n KeyboardSensor,\n PointerSensor,\n closestCenter,\n useSensor,\n useSensors,\n} from '@dnd-kit/core';\nimport { restrictToVerticalAxis } from '@dnd-kit/modifiers';\nimport { SortableContext, arrayMove, rectSortingStrategy } from '@dnd-kit/sortable';\nimport { type Asset, useAssetChooser, useAssetUpload, useEditorState } from '@frontify/app-bridge';\nimport { AssetInput, AssetInputSize } from '@frontify/fondue';\nimport { Tooltip, Flyout } from '@frontify/fondue/components';\nimport { useEffect, useState } from 'react';\n\nimport { SortableAttachmentItem } from './AttachmentItem';\nimport { AttachmentsButtonTrigger } from './AttachmentsButtonTrigger';\nimport { type AttachmentsProps } from './types';\n\nexport const Attachments = ({\n items = [],\n onDelete,\n onReplaceWithBrowse,\n onReplaceWithUpload,\n onBrowse,\n onUpload,\n onSorted,\n appBridge,\n triggerComponent: TriggerComponent = AttachmentsButtonTrigger,\n isOpen,\n onOpenChange,\n}: AttachmentsProps) => {\n const [internalItems, setInternalItems] = useState<Asset[]>(items);\n const [isFlyoutOpenInternal, setIsFlyoutOpenInternal] = useState(false);\n const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor));\n const [draggedAssetId, setDraggedAssetId] = useState<number | undefined>(undefined);\n const [isUploadLoading, setIsUploadLoading] = useState(false);\n const [assetIdsLoading, setAssetIdsLoading] = useState<number[]>([]);\n const [selectedFiles, setSelectedFiles] = useState<FileList | null>(null);\n const isEditing = useEditorState(appBridge);\n const { openAssetChooser, closeAssetChooser } = useAssetChooser(appBridge);\n const isControllingStateExternally = isOpen !== undefined;\n const isFlyoutOpen = isControllingStateExternally ? isOpen : isFlyoutOpenInternal;\n\n const draggedItem = internalItems?.find((item) => item.id === draggedAssetId);\n\n const [uploadFile, { results: uploadResults, doneAll }] = useAssetUpload({\n onUploadProgress: () => !isUploadLoading && setIsUploadLoading(true),\n });\n\n const handleFlyoutOpenChange = (isOpen: boolean) => {\n const stateSetter = isControllingStateExternally ? onOpenChange : setIsFlyoutOpenInternal;\n\n stateSetter?.(isOpen);\n };\n\n useEffect(() => {\n setInternalItems(items);\n }, [items]);\n\n useEffect(() => {\n if (selectedFiles) {\n setIsUploadLoading(true);\n uploadFile(selectedFiles);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedFiles]);\n\n useEffect(() => {\n const uploadDone = async () => {\n if (doneAll) {\n await onUpload(uploadResults);\n setIsUploadLoading(false);\n }\n };\n uploadDone();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [doneAll, uploadResults]);\n\n const onOpenAssetChooser = () => {\n handleFlyoutOpenChange(false);\n openAssetChooser(\n (result: Asset[]) => {\n onBrowse(result);\n closeAssetChooser();\n handleFlyoutOpenChange(true);\n },\n {\n multiSelection: true,\n selectedValueIds: internalItems.map((internalItem) => internalItem.id),\n },\n );\n };\n\n const onReplaceItemWithBrowse = (toReplace: Asset) => {\n handleFlyoutOpenChange(false);\n openAssetChooser(\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async (result: Asset[]) => {\n handleFlyoutOpenChange(true);\n closeAssetChooser();\n setAssetIdsLoading([...assetIdsLoading, toReplace.id]);\n await onReplaceWithBrowse(toReplace, result[0]);\n setAssetIdsLoading(assetIdsLoading.filter((id) => id !== toReplace.id));\n },\n {\n multiSelection: false,\n selectedValueIds: internalItems.map((internalItem) => internalItem.id),\n },\n );\n };\n\n const onReplaceItemWithUpload = async (toReplace: Asset, uploadedAsset: Asset) => {\n setAssetIdsLoading([...assetIdsLoading, toReplace.id]);\n await onReplaceWithUpload(toReplace, uploadedAsset);\n setAssetIdsLoading(assetIdsLoading.filter((id) => id !== toReplace.id));\n };\n\n const handleDragStart = (event: DragStartEvent) => {\n const { active } = event;\n setDraggedAssetId(active.id as number);\n };\n\n const handleDragEnd = (event: DragEndEvent) => {\n const { active, over } = event;\n if (over && active.id !== over.id && internalItems) {\n const oldIndex = internalItems.findIndex((i) => i.id === active.id);\n const newIndex = internalItems.findIndex((i) => i.id === over.id);\n const sortedItems = arrayMove(internalItems, oldIndex, newIndex);\n setInternalItems(sortedItems);\n onSorted(sortedItems);\n }\n setDraggedAssetId(undefined);\n };\n\n const autoFocusModifier = {\n onOpenAutoFocus: (event: Event) => {\n event.preventDefault();\n },\n onEscapeKeyDown: (event: Event) => {\n event.stopPropagation();\n handleFlyoutOpenChange(false);\n },\n };\n\n return isEditing || (internalItems?.length ?? 0) > 0 ? (\n <div data-test-id=\"attachments-flyout-button\">\n <Flyout.Root\n open={isFlyoutOpen}\n onOpenChange={(isOpen) => handleFlyoutOpenChange(draggedItem ? true : isOpen)}\n >\n <Tooltip.Root enterDelay={500}>\n <Tooltip.Trigger asChild>\n <Flyout.Trigger asChild data-test-id=\"attachments-button-trigger\">\n <TriggerComponent isFlyoutOpen={isFlyoutOpen}>\n <div>{items.length > 0 ? items.length : 'Add'}</div>\n </TriggerComponent>\n </Flyout.Trigger>\n </Tooltip.Trigger>\n <Flyout.Content side=\"bottom\" align=\"end\" {...autoFocusModifier}>\n <div className=\"tw-w-[300px]\" data-test-id=\"attachments-flyout-content\">\n {internalItems.length > 0 && (\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n modifiers={[restrictToVerticalAxis]}\n >\n <SortableContext items={internalItems} strategy={rectSortingStrategy}>\n <div className=\"tw-border-b tw-border-b-line tw-relative\">\n {internalItems.map((item) => (\n <SortableAttachmentItem\n isEditing={isEditing}\n isLoading={assetIdsLoading.includes(item.id)}\n key={item.id}\n item={item}\n onDelete={() => onDelete(item)}\n onReplaceWithBrowse={() => onReplaceItemWithBrowse(item)}\n onReplaceWithUpload={(uploadedAsset: Asset) =>\n onReplaceItemWithUpload(item, uploadedAsset)\n }\n onDownload={() =>\n appBridge.dispatch({\n name: 'downloadAsset',\n payload: item,\n })\n }\n />\n ))}\n </div>\n </SortableContext>\n </DndContext>\n )}\n {isEditing && (\n <div className=\"tw-px-5 tw-py-3\">\n <div className=\"tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4\">\n Add attachments\n </div>\n <AssetInput\n isLoading={isUploadLoading}\n size={AssetInputSize.Small}\n onUploadClick={(fileList) => setSelectedFiles(fileList)}\n onLibraryClick={onOpenAssetChooser}\n />\n </div>\n )}\n </div>\n </Flyout.Content>\n <Tooltip.Content side=\"top\">Attachments</Tooltip.Content>\n </Tooltip.Root>\n </Flyout.Root>\n </div>\n ) : null;\n};\n","/* (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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type HTMLAttributes, type ReactNode, forwardRef } from 'react';\n\nimport { getToolbarButtonClassNames } from './helpers';\n\ntype BaseToolbarButtonProps = {\n children: ReactNode;\n forceActiveStyle?: boolean;\n cursor?: 'pointer' | 'grab';\n 'data-test-id'?: string;\n} & HTMLAttributes<HTMLButtonElement>;\n\nexport const BaseToolbarButton = forwardRef<HTMLButtonElement, BaseToolbarButtonProps>(\n (\n {\n onClick,\n children,\n forceActiveStyle,\n cursor = 'pointer',\n 'data-test-id': dataTestId = 'base-toolbar-button',\n ...props\n },\n ref,\n ) => (\n <button\n onClick={onClick}\n className={getToolbarButtonClassNames(cursor, forceActiveStyle)}\n data-test-id={dataTestId}\n {...props}\n ref={ref}\n >\n {children}\n </button>\n ),\n);\n\nBaseToolbarButton.displayName = 'BaseToolbarButton';\n","/* (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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useMemoizedId } from '@frontify/fondue';\n\nimport { useAttachmentsContext } from '../../../../hooks';\nimport { Attachments } from '../../../Attachments';\nimport { useDragPreviewContext } from '../context/DragPreviewContext';\nimport { useMultiFlyoutState } from '../hooks/useMultiFlyoutState';\n\nimport { AttachmentsToolbarButtonTrigger } from './AttachmentsToolbarButtonTrigger';\n\nexport const DEFAULT_ATTACHMENTS_BUTTON_ID = 'attachments';\n\ntype AttachmentsToolbarButtonProps = { flyoutId?: string };\n\nexport const AttachmentsToolbarButton = ({\n flyoutId = DEFAULT_ATTACHMENTS_BUTTON_ID,\n}: AttachmentsToolbarButtonProps) => {\n const id = useMemoizedId(flyoutId);\n\n const { appBridge, attachments, onAttachmentsAdd, onAttachmentDelete, onAttachmentReplace, onAttachmentsSorted } =\n useAttachmentsContext();\n\n const { isOpen, onOpenChange } = useMultiFlyoutState(id);\n const isDragPreview = useDragPreviewContext();\n\n return (\n <Attachments\n onUpload={onAttachmentsAdd}\n onDelete={onAttachmentDelete}\n onReplaceWithBrowse={onAttachmentReplace}\n onReplaceWithUpload={onAttachmentReplace}\n onSorted={onAttachmentsSorted}\n onBrowse={onAttachmentsAdd}\n items={attachments}\n appBridge={appBridge}\n triggerComponent={AttachmentsToolbarButtonTrigger}\n isOpen={isOpen && !isDragPreview}\n onOpenChange={onOpenChange}\n />\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const DEFAULT_DRAG_TOOLTIP = 'Drag or press ↵ to move';\nexport const DEFAULT_DRAGGING_TOOLTIP = 'Move with ↑↓←→ and confirm with ↵';\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Tooltip } from '@frontify/fondue/components';\nimport { type ReactElement, type ReactNode } from 'react';\n\ntype ToolbarButtonTooltipProps = {\n content: ReactNode;\n children: ReactElement;\n open?: boolean;\n disabled?: boolean;\n};\n\nexport const ToolbarButtonTooltip = ({ content, children, open, disabled }: ToolbarButtonTooltipProps) => {\n return disabled ? (\n children\n ) : (\n <Tooltip.Root enterDelay={300} open={open}>\n <Tooltip.Trigger asChild>{children}</Tooltip.Trigger>\n <Tooltip.Content side=\"top\">\n <div>{content}</div>\n </Tooltip.Content>\n </Tooltip.Root>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactNode } from 'react';\n\nimport { DEFAULT_DRAGGING_TOOLTIP, DEFAULT_DRAG_TOOLTIP } from '../../constants';\nimport { BaseToolbarButton } from '../BaseToolbarButton';\nimport { ToolbarButtonTooltip } from '../ToolbarButtonTooltip';\nimport { useDragPreviewContext } from '../context/DragPreviewContext';\n\nexport type DragHandleToolbarButtonProps = {\n icon?: ReactNode;\n tooltip?: string;\n draggableProps: Record<string, unknown>;\n setActivatorNodeRef?: (node: HTMLElement | null) => void;\n};\n\nexport const DragHandleToolbarButton = ({\n tooltip,\n icon,\n setActivatorNodeRef,\n draggableProps,\n}: DragHandleToolbarButtonProps) => {\n const isDragPreview = useDragPreviewContext();\n\n return (\n <ToolbarButtonTooltip\n {...(isDragPreview && { open: isDragPreview })}\n content={<div>{isDragPreview ? DEFAULT_DRAGGING_TOOLTIP : (tooltip ?? DEFAULT_DRAG_TOOLTIP)}</div>}\n >\n <BaseToolbarButton\n ref={setActivatorNodeRef}\n data-test-id=\"block-item-wrapper-toolbar-btn\"\n forceActiveStyle={isDragPreview}\n cursor=\"grab\"\n {...draggableProps}\n >\n {icon}\n </BaseToolbarButton>\n </ToolbarButtonTooltip>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useMemoizedId } from '@frontify/fondue';\nimport { Flyout } from '@frontify/fondue/components';\nimport { type ReactNode } from 'react';\n\nimport { BaseToolbarButton } from '../BaseToolbarButton';\nimport { ToolbarButtonTooltip } from '../ToolbarButtonTooltip';\nimport { useDragPreviewContext } from '../context/DragPreviewContext';\nimport { useMultiFlyoutState } from '../hooks/useMultiFlyoutState';\n\nexport type FlyoutToolbarButtonProps = {\n content: ReactNode;\n icon: ReactNode;\n tooltip: ReactNode;\n flyoutId: string;\n flyoutFooter?: ReactNode;\n flyoutHeader?: ReactNode;\n};\n\nexport const FlyoutToolbarButton = ({\n content,\n icon,\n tooltip,\n flyoutId,\n flyoutFooter,\n flyoutHeader,\n}: FlyoutToolbarButtonProps) => {\n const id = useMemoizedId(flyoutId);\n\n const { isOpen, onOpenChange } = useMultiFlyoutState(id);\n\n const isDragPreview = useDragPreviewContext();\n\n return (\n <ToolbarButtonTooltip disabled={isDragPreview || isOpen} content={tooltip}>\n <div className=\"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative\">\n <Flyout.Root open={isOpen && !isDragPreview} onOpenChange={onOpenChange}>\n <Flyout.Trigger asChild>\n <BaseToolbarButton\n data-test-id=\"block-item-wrapper-toolbar-flyout\"\n forceActiveStyle={isOpen && !isDragPreview}\n >\n {icon}\n </BaseToolbarButton>\n </Flyout.Trigger>\n <Flyout.Content side=\"bottom\" align=\"end\" padding=\"comfortable\">\n {flyoutHeader ? <Flyout.Header>{flyoutHeader}</Flyout.Header> : null}\n <Flyout.Body>{content}</Flyout.Body>\n {flyoutFooter ? <Flyout.Footer>{flyoutFooter}</Flyout.Footer> : null}\n </Flyout.Content>\n </Flyout.Root>\n </div>\n </ToolbarButtonTooltip>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useMemoizedId } from '@frontify/fondue';\nimport { Dropdown, Tooltip } from '@frontify/fondue/components';\nimport { IconDotsHorizontal } from '@frontify/fondue/icons';\n\nimport { BaseToolbarButton } from '../BaseToolbarButton';\nimport { useDragPreviewContext } from '../context';\nimport { useMultiFlyoutState } from '../hooks';\n\nexport const DEFAULT_MENU_BUTTON_ID = 'menu';\n\nexport type MenuToolbarButtonProps = {\n items: {\n title: string;\n onClick: () => void;\n icon: JSX.Element;\n style?: 'default' | 'danger';\n }[][];\n flyoutId?: string;\n tooltip?: string;\n};\n\nexport const MenuToolbarButton = ({\n items,\n flyoutId = DEFAULT_MENU_BUTTON_ID,\n tooltip = 'Options',\n}: MenuToolbarButtonProps) => {\n const id = useMemoizedId(flyoutId);\n const { isOpen, onOpenChange } = useMultiFlyoutState(id);\n const isDragPreview = useDragPreviewContext();\n\n return (\n <Dropdown.Root open={isOpen && !isDragPreview} onOpenChange={onOpenChange}>\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <Dropdown.Trigger asChild>\n <BaseToolbarButton data-test-id=\"block-item-wrapper-toolbar-flyout\">\n <IconDotsHorizontal size=\"16\" />\n </BaseToolbarButton>\n </Dropdown.Trigger>\n </Tooltip.Trigger>\n <Dropdown.Content>\n {items.map((block, blockIndex) => (\n <Dropdown.Group key={blockIndex}>\n {block.map((item, itemIndex) => (\n <Dropdown.Item\n data-test-id=\"menu-item\"\n onSelect={() => {\n onOpenChange(false);\n item.onClick();\n }}\n emphasis={item.style || 'default'}\n key={`${blockIndex}-${itemIndex}`}\n >\n <div className=\"tw-mr-2\">{item.icon}</div>\n <span>{item.title}</span>\n </Dropdown.Item>\n ))}\n </Dropdown.Group>\n ))}\n </Dropdown.Content>\n <Tooltip.Content>{tooltip}</Tooltip.Content>\n </Tooltip.Root>\n </Dropdown.Root>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { BaseToolbarButton } from '../BaseToolbarButton';\nimport { ToolbarButtonTooltip } from '../ToolbarButtonTooltip';\nimport { useDragPreviewContext } from '../context/DragPreviewContext';\n\nexport type ToolbarButtonProps = { icon: JSX.Element; tooltip?: string; onClick: () => void };\n\nexport const ToolbarButton = ({ tooltip, icon, onClick }: ToolbarButtonProps) => {\n const isDragPreview = useDragPreviewContext();\n\n return (\n <ToolbarButtonTooltip disabled={isDragPreview} content={tooltip ?? ''}>\n <BaseToolbarButton data-test-id=\"block-item-wrapper-toolbar-btn\" onClick={onClick}>\n {icon}\n </BaseToolbarButton>\n </ToolbarButtonTooltip>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactNode } from 'react';\n\nexport const ToolbarSegment = ({ children }: { children: ReactNode }) => (\n <div\n data-test-id=\"block-item-wrapper-toolbar-segment\"\n className=\"tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-px tw-px-px tw-h-[26px] tw-items-center tw-self-start tw-leading-none\"\n >\n {children}\n </div>\n);\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { AttachmentsToolbarButton } from './AttachmentsToolbarButton';\nimport { DragHandleToolbarButton } from './DragHandleToolbarButton';\nimport { FlyoutToolbarButton } from './FlyoutToolbarButton';\nimport { MenuToolbarButton } from './MenuToolbarButton';\nimport { ToolbarButton } from './ToolbarButton';\nimport { ToolbarSegment } from './ToolbarSegment';\nimport { type ToolbarProps } from './types';\n\nexport const Toolbar = ({ items, attachments }: ToolbarProps) => (\n <div\n data-test-id=\"block-item-wrapper-toolbar\"\n className=\"tw-rounded-md tw-bg-base tw-border tw-border-line-strong tw-divide-x tw-divide-line-strong tw-shadow-lg tw-flex tw-flex-none tw-items-center tw-isolate\"\n >\n {attachments.isEnabled && (\n <ToolbarSegment>\n <AttachmentsToolbarButton />\n </ToolbarSegment>\n )}\n {items.length > 0 && (\n <ToolbarSegment>\n {items.map((item) => {\n switch (item.type) {\n case 'dragHandle':\n return <DragHandleToolbarButton key={item.tooltip + item.type} {...item} />;\n case 'menu':\n return <MenuToolbarButton key={item.tooltip + item.type} {...item} />;\n case 'flyout':\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands, @typescript-eslint/no-base-to-string\n return <FlyoutToolbarButton key={item.tooltip + item.type} {...item} />;\n default:\n return <ToolbarButton key={item.tooltip + item.type} {...item} />;\n }\n })}\n </ToolbarSegment>\n )}\n </div>\n);\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactElement, memo, useRef, useState } from 'react';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { DEFAULT_MENU_BUTTON_ID, Toolbar, type ToolbarItem } from './Toolbar';\nimport { DragPreviewContextProvider } from './Toolbar/context/DragPreviewContext';\nimport { MultiFlyoutContextProvider } from './Toolbar/context/MultiFlyoutContext';\nimport { type BlockItemWrapperProps } from './types';\n\nexport const BlockItemWrapper = memo(\n ({\n children,\n toolbarItems,\n shouldHideWrapper,\n shouldHideComponent = false,\n isDragging = false,\n shouldFillContainer,\n outlineOffset = 0,\n shouldBeShown = false,\n showAttachments = false,\n }: BlockItemWrapperProps): ReactElement => {\n const [openFlyoutIds, setOpenFlyoutIds] = useState<string[]>(shouldBeShown ? [DEFAULT_MENU_BUTTON_ID] : []);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n if (shouldHideWrapper) {\n return <>{children}</>;\n }\n\n const items = toolbarItems?.filter((item): item is ToolbarItem => item !== undefined);\n\n const shouldToolbarBeVisible = openFlyoutIds.length > 0 || shouldBeShown;\n\n return (\n <DragPreviewContextProvider isDragPreview={isDragging}>\n <MultiFlyoutContextProvider openFlyoutIds={openFlyoutIds} setOpenFlyoutIds={setOpenFlyoutIds}>\n <div\n ref={wrapperRef}\n data-test-id=\"block-item-wrapper\"\n style={{\n outlineOffset,\n }}\n className={joinClassNames([\n 'tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse',\n shouldFillContainer && 'tw-flex-1 tw-h-full tw-w-full',\n 'hover:tw-outline focus-within:tw-outline',\n shouldToolbarBeVisible && 'tw-outline',\n shouldHideComponent && 'tw-opacity-0',\n ])}\n >\n <div\n style={{\n right: -1 - outlineOffset,\n bottom: `calc(100% - ${2 + outlineOffset}px)`,\n }}\n className={joinClassNames([\n 'tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]',\n 'group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100',\n 'tw-flex tw-justify-end',\n shouldToolbarBeVisible && 'tw-opacity-100',\n ])}\n >\n <Toolbar\n attachments={{\n isEnabled: showAttachments,\n }}\n items={items}\n />\n </div>\n {children}\n </div>\n </MultiFlyoutContextProvider>\n </DragPreviewContextProvider>\n );\n },\n);\n\nBlockItemWrapper.displayName = 'BlockItemWrapper';\n","/* (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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type RefObject, useEffect } from 'react';\n\nexport const useIsInViewport = <T extends Element>({\n ref,\n disabled,\n onChange,\n}: {\n ref: RefObject<T>;\n disabled: boolean;\n onChange: (isInViewport: boolean) => void;\n}) => {\n useEffect(() => {\n if (disabled || !ref.current) {\n return;\n }\n\n let isInViewport = false;\n\n const intersectionObserver = new IntersectionObserver(([entry]) => {\n if (entry.isIntersecting !== isInViewport) {\n isInViewport = entry.isIntersecting;\n onChange(entry.isIntersecting);\n }\n });\n\n intersectionObserver.observe(ref.current);\n\n return () => {\n intersectionObserver.disconnect();\n };\n }, [ref, disabled, onChange]);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { serializeRawToHtmlAsync } from '@frontify/fondue/rte';\nimport { useEffect, useState } from 'react';\n\nimport { type SerializedTextProps } from './types';\n\nexport const SerializedText = ({ value = '', gap, customClass, show = true, plugins }: SerializedTextProps) => {\n const [html, setHtml] = useState<string | null>(null);\n\n useEffect(() => {\n const updateHtml = async () => {\n const htmlContent = await serializeRawToHtmlAsync(value, plugins, undefined, gap, customClass);\n setHtml(htmlContent);\n };\n updateHtml().catch(console.error);\n }, [value, gap, plugins, customClass]);\n\n if (!show || html === '<br />' || html === null) {\n return null;\n }\n\n return (\n <div\n className=\"tw-w-full tw-whitespace-pre-wrap\"\n data-test-id=\"rte-content-html\"\n dangerouslySetInnerHTML={{ __html: html }}\n />\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { createStore } from '@frontify/fondue/rte';\n\nimport { type RichTextButtonStyle } from '../../types';\n\nexport type FloatingButtonMode = '' | 'insert' | 'edit';\n\nexport const floatingButtonStore: any = createStore('floatingButton')({\n openEditorId: null as null | string,\n mouseDown: false,\n updated: false,\n url: '',\n text: '',\n buttonStyle: 'primary' as RichTextButtonStyle,\n newTab: false,\n mode: '' as FloatingButtonMode,\n isEditing: false,\n})\n .extendActions((set) => ({\n reset: () => {\n set.url('');\n set.text('');\n set.buttonStyle('primary');\n set.newTab(false);\n set.mode('');\n set.isEditing(false);\n },\n }))\n .extendActions((set) => ({\n show: (mode: FloatingButtonMode, editorId: string) => {\n set.mode(mode);\n set.isEditing(false);\n set.openEditorId(editorId);\n },\n hide: () => {\n set.reset();\n set.openEditorId(null);\n },\n }))\n .extendSelectors((state) => ({\n isOpen: (editorId: string) => state.openEditorId === editorId,\n }));\n\nexport const floatingButtonActions = floatingButtonStore.set;\nexport const floatingButtonSelectors = floatingButtonStore.get;\n// eslint-disable-next-line @typescript-eslint/no-unsafe-return\nexport const useFloatingButtonSelectors = () => floatingButtonStore.use;\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\ntype TextElement = {\n text: string;\n children?: TextElement[];\n};\n\nexport const hasRichTextValue = (string?: string): boolean => {\n if (!string) {\n return false;\n }\n const hasText = (children: TextElement[]): boolean =>\n children.some((child: TextElement) => {\n if (child.text) {\n return child.text !== '';\n }\n if (child.children) {\n return hasText(child.children);\n }\n return false;\n });\n\n try {\n const json = JSON.parse(string);\n return hasText(json);\n } catch {\n return false;\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { hasRichTextValue } from './hasRichTextValue';\n\nexport const convertToRteValue = (textStyle = 'p', text = '', align?: 'center' | 'right' | 'left' | 'justify') =>\n hasRichTextValue(text) ? text : JSON.stringify([{ type: textStyle, children: [{ text, textStyle }], align }]);\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Security } from '../settings/types';\n\nexport const isDownloadable = (security: Security, downloadable: boolean, globalAssetDownloadEnabled: boolean) => {\n return security === Security.Custom ? downloadable : globalAssetDownloadEnabled;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ColorPalette } from '@frontify/app-bridge';\nimport { type 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","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ELEMENT_LINK, type PlateEditor, getAboveNode } from '@frontify/fondue/rte';\n\nimport { type TLinkElement } from '../../RichTextEditor/plugins/LinkPlugin/types';\n\nconst getLinkNode = (editor: PlateEditor, cb: (link: TLinkElement) => string): string => {\n const linkNode = getAboveNode<TLinkElement>(editor, { match: { type: ELEMENT_LINK } });\n\n if (!Array.isArray(linkNode)) {\n return '';\n }\n\n return cb(linkNode[0]);\n};\n\nexport const getLegacyUrl = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.chosenLink?.searchResult?.link || '');\n};\n\nexport const getUrl = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.url || '');\n};\n\nexport const getUrlFromLinkOrLegacyLink = (link: TLinkElement): string => {\n return link.url || link.chosenLink?.searchResult?.link || '';\n};\n\nexport const getLinkFromEditor = (editor: PlateEditor) => {\n return getLinkNode(editor, getUrlFromLinkOrLegacyLink);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const relativeUrlRegex = /^\\/(document|r)\\/\\S+$/i;\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { relativeUrlRegex } from '../components/Link/utils';\n\nexport const addHttps = (url: string) => {\n if (relativeUrlRegex.test(url)) {\n return url;\n }\n try {\n new URL(url);\n return url;\n } catch {\n return `https://${url}`;\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { addHttps } from '../../../helpers';\n\nimport { relativeUrlRegex } from './relativeUrlRegex';\n\nexport const isValidUrl = (url: string) => {\n if (relativeUrlRegex.test(url)) {\n return true;\n }\n try {\n const parsedUrl = new URL(url);\n const validProtocols = ['http:', 'https:', 'mailto:', 'tel:'];\n return validProtocols.includes(parsedUrl.protocol) && parsedUrl.pathname !== '';\n } catch {\n return false;\n }\n};\n\nexport const isValidUrlOrEmpty = (url: string): boolean => {\n return isValidUrl(addHttps(url)) || url === '';\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type EText,\n Path,\n type PlateEditor,\n type Point,\n type Range,\n type Value,\n type WithOverride,\n getAboveNode,\n getNextNodeStartPoint,\n getPluginType,\n getPreviousNodeEndPoint,\n insertNodes,\n isCollapsed,\n isEndPoint,\n isStartPoint,\n mockPlugin,\n select,\n withRemoveEmptyNodes,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON } from './createButtonPlugin';\n\n/**\n * Insert space after a url to wrap a button.\n * Lookup from the block start to the cursor to check if there is an url.\n * If not found, lookup before the cursor for a space character to check the url.\n *\n * On insert data:\n * Paste a string inside a button element will edit its children text but not its url.\n *\n */\n\nexport const withButton: WithOverride = (editor, { type }) => {\n const { apply, normalizeNode } = editor;\n\n editor.apply = (operation) => {\n if (operation.type !== 'set_selection') {\n apply(operation);\n return;\n }\n\n const range = operation.newProperties;\n if (!range?.focus || !range.anchor || !isCollapsed(range as Range)) {\n apply(operation);\n return;\n }\n\n const entry = getAboveNode(editor, {\n at: range as Range,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (entry) {\n const [, path] = entry;\n\n let newPoint: Point | undefined;\n\n if (isStartPoint(editor, range.focus, path)) {\n newPoint = getPreviousNodeEndPoint(editor, path);\n }\n\n if (isEndPoint(editor, range.focus, path)) {\n newPoint = getNextNodeStartPoint(editor, path);\n }\n\n if (newPoint) {\n operation.newProperties = {\n anchor: newPoint,\n focus: newPoint,\n };\n }\n }\n\n apply(operation);\n };\n\n editor.normalizeNode = ([node, path]) => {\n if (node.type === getPluginType(editor, ELEMENT_BUTTON)) {\n const range = editor.selection as Range | null;\n\n if (range && isCollapsed(range) && isEndPoint(editor, range.focus, path)) {\n const nextPoint = getNextNodeStartPoint(editor, path);\n\n // select next text node if any\n if (nextPoint) {\n select(editor, nextPoint);\n } else {\n // insert text node then select\n const nextPath = Path.next(path);\n insertNodes(editor, { text: '' } as EText<Value>, { at: nextPath });\n select(editor, nextPath);\n }\n }\n }\n\n normalizeNode([node, path]);\n };\n\n return withRemoveEmptyNodes<Value, PlateEditor<Value>>(\n editor,\n mockPlugin<Record<string, any>, Value, PlateEditor<Value>>({\n options: { types: type },\n }),\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type InsertNodesOptions, type PlateEditor, type TText, type Value, insertNodes } from '@frontify/fondue/rte';\n\nimport { type TButtonElement } from '../types';\nimport { type CreateButtonNodeOptions, createButtonNode } from '../utils/index';\n\nexport const insertButton = <V extends Value>(\n editor: PlateEditor<V>,\n createButtonNodeOptions: CreateButtonNodeOptions,\n options?: InsertNodesOptions<V>,\n) => {\n insertNodes<TButtonElement | TText>(\n editor,\n [createButtonNode(editor, createButtonNodeOptions)],\n options as InsertNodesOptions,\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value, focusEditor, getPluginOptions } from '@frontify/fondue/rte';\n\nimport { floatingButtonActions, floatingButtonSelectors } from '../components/FloatingButton/floatingButtonStore';\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../createButtonPlugin';\n\nimport { upsertButton } from '.';\n\nexport const submitFloatingButton = <V extends Value>(editor: PlateEditor<V>) => {\n if (!editor.selection) {\n return;\n }\n\n const { isUrl, forceSubmit } = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON);\n const url = floatingButtonSelectors.url();\n\n const isValid = isUrl?.(url) || forceSubmit;\n if (!isValid) {\n return;\n }\n\n const text = floatingButtonSelectors.text();\n const buttonStyle = floatingButtonSelectors.buttonStyle();\n const target = floatingButtonSelectors.newTab() ? undefined : '_self';\n\n floatingButtonActions.reset();\n\n upsertButton(editor, {\n url,\n text,\n buttonStyle,\n target,\n isUrl: (_url) => (forceSubmit || !isUrl ? true : isUrl(_url)),\n });\n\n setTimeout(() => {\n focusEditor(editor, editor.selection ?? undefined);\n }, 0);\n\n return true;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateEditor,\n type UnwrapNodesOptions,\n type Value,\n getAboveNode,\n getPluginType,\n isElement,\n splitNodes,\n unwrapNodes,\n withoutNormalizing,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\n/**\n * Unwrap button node.\n */\nexport const unwrapButton = <V extends Value>(\n editor: PlateEditor<V>,\n options?: UnwrapNodesOptions & {\n split?: boolean;\n },\n) => {\n return withoutNormalizing(editor, () => {\n if (options?.split) {\n const buttonAboveAnchor = getAboveNode(editor, {\n at: editor.selection?.anchor,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // anchor in button\n if (buttonAboveAnchor) {\n splitNodes(editor, {\n at: editor.selection?.anchor,\n match: (n) => isElement(n) && n.type === getPluginType(editor, ELEMENT_BUTTON),\n });\n unwrapButton(editor, {\n at: editor.selection?.anchor,\n });\n return true;\n }\n const buttonAboveFocus = getAboveNode(editor, {\n at: editor.selection?.focus,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // focus in button\n if (buttonAboveFocus) {\n splitNodes(editor, {\n at: editor.selection?.focus,\n match: (n) => isElement(n) && n.type === getPluginType(editor, ELEMENT_BUTTON),\n });\n unwrapButton(editor, {\n at: editor.selection?.focus,\n });\n return true;\n }\n }\n\n unwrapNodes(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n ...options,\n });\n\n return;\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type InsertNodesOptions,\n type Path,\n type PlateEditor,\n type TNode,\n type TNodeEntry,\n type UnwrapNodesOptions,\n type Value,\n type WrapNodesOptions,\n findNode,\n getAboveNode,\n getEditorString,\n getNodeLeaf,\n getNodeProps,\n getPluginOptions,\n getPluginType,\n isDefined,\n isExpanded,\n removeNodes,\n setNodes,\n} from '@frontify/fondue/rte';\n\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../createButtonPlugin';\nimport { type RichTextButtonStyle, type TButtonElement } from '../types';\nimport { type CreateButtonNodeOptions } from '../utils/index';\n\nimport { insertButton, unwrapButton, upsertButtonText, wrapButton } from '.';\n\nexport type UpsertButtonOptions<V extends Value = Value> = CreateButtonNodeOptions & {\n /**\n * If true, insert text when selection is in url.\n */\n insertTextInButton?: boolean;\n insertNodesOptions?: InsertNodesOptions<V>;\n unwrapNodesOptions?: UnwrapNodesOptions<V>;\n wrapNodesOptions?: WrapNodesOptions<V>;\n isUrl?: (url: string) => boolean;\n};\n\n/**\n * If selection in a button or is not url:\n * - insert text with url, exit\n * If selection is expanded or `update` in a button:\n * - remove button node, get button text\n * Then:\n * - insert button node\n */\nexport const upsertButton = <V extends Value>(\n editor: PlateEditor<V>,\n {\n url,\n text,\n buttonStyle,\n target,\n insertTextInButton,\n insertNodesOptions,\n isUrl = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON).isUrl,\n }: UpsertButtonOptions<V>,\n) => {\n const at = editor.selection;\n if (!at) {\n return;\n }\n\n const buttonAbove = getAboveNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // anchor and focus in button -> insert text\n if (insertTextInButton && buttonAbove) {\n // we don't want to insert marks in buttons\n editor.insertText(url);\n return true;\n }\n\n if (!isUrl?.(url)) {\n return;\n }\n\n if (isDefined(text) && text.length === 0) {\n text = url;\n }\n\n if (buttonAbove) {\n editButtonUrlAndTarget<V>(url, editor, buttonAbove, target, buttonStyle, text);\n return true;\n }\n\n // selection contains at one edge edge or between the edges\n const buttonEntry = findNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n const [buttonNode, buttonPath] = buttonEntry ?? [];\n\n const shouldReplaceText = shouldReplaceButtonText<V>(editor, buttonPath, text);\n\n if (isExpanded(at)) {\n anchorAndFocusInButton<V>(buttonAbove, editor, url, buttonStyle, target, text);\n return true;\n }\n\n if (shouldReplaceText) {\n removeNodes(editor, {\n at: buttonPath,\n });\n }\n\n const props = getNodeProps(buttonNode ?? ({} as TNode));\n\n const path = editor.selection?.focus.path;\n if (!path) {\n return;\n }\n\n // button text should have the focused leaf marks\n const leaf = getNodeLeaf(editor, path);\n\n // if text is empty, text is url\n if (!text?.length) {\n text = url;\n }\n\n insertButton(\n editor,\n {\n ...props,\n url,\n target,\n children: [\n {\n ...leaf,\n text,\n },\n ],\n },\n insertNodesOptions,\n );\n return true;\n};\n\nfunction shouldReplaceButtonText<V extends Value>(editor: PlateEditor<V>, buttonPath?: Path, text?: string) {\n return buttonPath && text?.length && text !== getEditorString(editor, buttonPath);\n}\n\nfunction anchorAndFocusInButton<V extends Value>(\n buttonAbove: undefined,\n editor: PlateEditor<V>,\n url: string,\n buttonStyle?: RichTextButtonStyle,\n target?: string,\n text?: string,\n) {\n if (buttonAbove) {\n unwrapButton(editor, {\n at: buttonAbove[1],\n });\n } else {\n unwrapButton(editor, {\n split: true,\n });\n }\n\n wrapButton(editor, {\n url,\n buttonStyle,\n target,\n });\n\n upsertButtonText(editor, { url, target, text });\n}\n\nfunction editButtonUrlAndTarget<V extends Value>(\n url: string,\n editor: PlateEditor<V>,\n buttonAbove: TNodeEntry<TButtonElement>,\n target?: string,\n buttonStyle?: string,\n text?: string,\n) {\n if (\n url !== buttonAbove[0]?.url ||\n target !== buttonAbove[0]?.target ||\n buttonStyle !== buttonAbove[0]?.buttonStyle\n ) {\n setNodes<TButtonElement>(\n editor,\n { url, target, buttonStyle },\n {\n at: buttonAbove[1],\n },\n );\n }\n\n upsertButtonText(editor, { url, text, target });\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateEditor,\n type TText,\n type Value,\n getAboveNode,\n getEditorString,\n getPluginType,\n replaceNodeChildren,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type TButtonElement } from '..';\n\nimport { type UpsertButtonOptions } from './upsertButton';\n\n/**\n * If the text is different than the button above text, replace button children by a new text.\n * The new text has the same marks than the first text replaced.\n */\nexport const upsertButtonText = <V extends Value>(editor: PlateEditor<V>, { text }: UpsertButtonOptions<V>) => {\n const newButton = getAboveNode<TButtonElement>(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (newButton) {\n const [newButtonNode, newButtonPath] = newButton;\n\n if (text?.length && text !== getEditorString(editor, newButtonPath)) {\n const firstText = newButtonNode.children[0];\n\n // remove button children\n replaceNodeChildren<TText>(editor, {\n at: newButtonPath,\n nodes: { ...firstText, text },\n insertOptions: {\n select: true,\n },\n });\n }\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value, type WrapNodesOptions, getPluginType, wrapNodes } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type RichTextButtonStyle, type TButtonElement } from '..';\n\nexport interface WrapButtonOptions<V extends Value = Value> extends WrapNodesOptions<V> {\n url: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n}\n\n/**\n * Wrap a button node with split.\n */\nexport const wrapButton = <V extends Value>(\n editor: PlateEditor<V>,\n { url, buttonStyle, target, ...options }: WrapButtonOptions<V>,\n) => {\n wrapNodes<TButtonElement, Value>(\n editor,\n {\n type: getPluginType(editor, ELEMENT_BUTTON),\n url,\n buttonStyle,\n target,\n children: [],\n },\n { split: true, ...options } as WrapNodesOptions,\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, getAboveNode } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type TButtonElement } from '..';\n\nconst getLinkNode = (editor: PlateEditor, cb: (link: TButtonElement) => string): string => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return '';\n }\n\n return cb(linkNode[0]);\n};\n\nexport const getUrlFromEditor = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.url ?? '');\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type TText, type Value, getPluginType } from '@frontify/fondue/rte';\n\nimport { type RichTextButtonStyle, type TButtonElement } from '..';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\nexport interface CreateButtonNodeOptions {\n url: string;\n text?: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n children?: TText[];\n}\n\nexport const createButtonNode = <V extends Value>(\n editor: PlateEditor<V>,\n { url, text = '', buttonStyle = 'primary', target, children }: CreateButtonNodeOptions,\n): TButtonElement => {\n const type = getPluginType(editor, ELEMENT_BUTTON);\n\n return {\n type,\n url,\n target,\n buttonStyle,\n children: children ?? [{ text }],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value } from '@frontify/fondue/rte';\n\nimport { floatingButtonSelectors } from '../components';\n\nimport { triggerFloatingButtonEdit, triggerFloatingButtonInsert } from '.';\n\nexport const triggerFloatingButton = <V extends Value>(\n editor: PlateEditor<V>,\n {\n focused,\n }: {\n focused?: boolean;\n } = {},\n) => {\n if (floatingButtonSelectors.mode() === 'edit') {\n triggerFloatingButtonEdit(editor);\n return;\n }\n\n triggerFloatingButtonInsert(editor, {\n focused,\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value, findNode, getEditorString, getPluginType } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type TButtonElement } from '..';\nimport { floatingButtonActions } from '../components/FloatingButton/floatingButtonStore';\n\nexport const triggerFloatingButtonEdit = <V extends Value>(editor: PlateEditor<V>) => {\n const entry = findNode<TButtonElement>(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n if (!entry) {\n return;\n }\n\n const [link, path] = entry;\n\n let text = getEditorString(editor, path);\n\n floatingButtonActions.url(link.url);\n\n floatingButtonActions.newTab(link.target === undefined);\n\n if (text === link.url) {\n text = '';\n }\n\n floatingButtonActions.text(text);\n\n floatingButtonActions.isEditing(true);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateEditor,\n type Value,\n getEditorString,\n getPluginType,\n isRangeAcrossBlocks,\n someNode,\n} from '@frontify/fondue/rte';\n\nimport { floatingButtonActions, floatingButtonSelectors } from '../components/FloatingButton/floatingButtonStore';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\n/**\n * Trigger floating button.\n *\n * Do not trigger when:\n * - selection is across blocks\n * - selection has more than one leaf node\n * - lowest selection is not text\n * - selection has a button node\n */\nexport const triggerFloatingButtonInsert = <V extends Value>(\n editor: PlateEditor<V>,\n {\n focused,\n }: {\n focused?: boolean;\n } = {},\n) => {\n if (floatingButtonSelectors.mode()) {\n return;\n }\n\n if (!focused) {\n return;\n }\n\n if (isRangeAcrossBlocks(editor, { at: editor.selection })) {\n return;\n }\n\n const hasButton = someNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n if (hasButton) {\n return;\n }\n floatingButtonActions.text(getEditorString(editor, editor.selection));\n floatingButtonActions.show('insert', editor.id);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type CSSProperties } from 'react';\n\nconst DefaultButtonStyles: CSSProperties = {\n marginTop: '10px',\n marginBottom: '10px',\n display: 'inline-block',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n maxWidth: '100%',\n verticalAlign: 'middle',\n boxSizing: 'border-box',\n overflowWrap: 'normal',\n};\n\nexport const BlockButtonStyles: Record<string, CSSProperties & { hover?: CSSProperties }> = {\n buttonPrimary: {\n ...DefaultButtonStyles,\n fontFamily: 'var(--f-theme-settings-button-primary-font-family)',\n fontSize: 'var(--f-theme-settings-button-primary-font-size)',\n fontWeight: 'var(--f-theme-settings-button-primary-font-weight)',\n lineHeight: 'var(--f-theme-settings-button-primary-line-height)',\n paddingTop: 'var(--f-theme-settings-button-primary-padding-top)',\n paddingRight: 'var(--f-theme-settings-button-primary-padding-right)',\n paddingBottom: 'var(--f-theme-settings-button-primary-padding-bottom)',\n paddingLeft: 'var(--f-theme-settings-button-primary-padding-left)',\n fontStyle: 'var(--f-theme-settings-button-primary-font-style)',\n textTransform: 'var(--f-theme-settings-button-primary-text-transform)' as CSSProperties['textTransform'],\n backgroundColor: 'var(--f-theme-settings-button-primary-background-color)',\n borderColor: 'var(--f-theme-settings-button-primary-border-color)',\n borderRadius: 'var(--f-theme-settings-button-primary-border-radius)',\n borderWidth: 'var(--f-theme-settings-button-primary-border-width)',\n color: 'var(--f-theme-settings-button-primary-color)',\n\n hover: {\n backgroundColor: 'var(--f-theme-settings-button-primary-background-color-hover)',\n borderColor: 'var(--f-theme-settings-button-primary-border-color-hover)',\n color: 'var(--f-theme-settings-button-primary-color-hover)',\n },\n },\n\n buttonSecondary: {\n ...DefaultButtonStyles,\n fontFamily: 'var(--f-theme-settings-button-secondary-font-family)',\n fontSize: 'var(--f-theme-settings-button-secondary-font-size)',\n fontWeight: 'var(--f-theme-settings-button-secondary-font-weight)',\n lineHeight: 'var(--f-theme-settings-button-secondary-line-height)',\n paddingTop: 'var(--f-theme-settings-button-secondary-padding-top)',\n paddingRight: 'var(--f-theme-settings-button-secondary-padding-right)',\n paddingBottom: 'var(--f-theme-settings-button-secondary-padding-bottom)',\n paddingLeft: 'var(--f-theme-settings-button-secondary-padding-left)',\n fontStyle: 'var(--f-theme-settings-button-secondary-font-style)',\n textTransform: 'var(--f-theme-settings-button-secondary-text-transform)' as CSSProperties['textTransform'],\n backgroundColor: 'var(--f-theme-settings-button-secondary-background-color)',\n borderColor: 'var(--f-theme-settings-button-secondary-border-color)',\n borderRadius: 'var(--f-theme-settings-button-secondary-border-radius)',\n borderWidth: 'var(--f-theme-settings-button-secondary-border-width)',\n color: 'var(--f-theme-settings-button-secondary-color)',\n hover: {\n backgroundColor: 'var(--f-theme-settings-button-secondary-background-color-hover)',\n borderColor: 'var(--f-theme-settings-button-secondary-border-color-hover)',\n color: 'var(--f-theme-settings-button-secondary-color-hover)',\n },\n },\n\n buttonTertiary: {\n ...DefaultButtonStyles,\n fontFamily: 'var(--f-theme-settings-button-tertiary-font-family)',\n fontSize: 'var(--f-theme-settings-button-tertiary-font-size)',\n fontWeight: 'var(--f-theme-settings-button-tertiary-font-weight)',\n lineHeight: 'var(--f-theme-settings-button-tertiary-line-height)',\n paddingTop: 'var(--f-theme-settings-button-tertiary-padding-top)',\n paddingRight: 'var(--f-theme-settings-button-tertiary-padding-right)',\n paddingBottom: 'var(--f-theme-settings-button-tertiary-padding-bottom)',\n paddingLeft: 'var(--f-theme-settings-button-tertiary-padding-left)',\n fontStyle: 'var(--f-theme-settings-button-tertiary-font-style)',\n textTransform: 'var(--f-theme-settings-button-tertiary-text-transform)' as CSSProperties['textTransform'],\n backgroundColor: 'var(--f-theme-settings-button-tertiary-background-color)',\n borderColor: 'var(--f-theme-settings-button-tertiary-border-color)',\n borderRadius: 'var(--f-theme-settings-button-tertiary-border-radius)',\n borderWidth: 'var(--f-theme-settings-button-tertiary-border-width)',\n color: 'var(--f-theme-settings-button-tertiary-color)',\n hover: {\n backgroundColor: 'var(--f-theme-settings-button-tertiary-background-color-hover)',\n borderColor: 'var(--f-theme-settings-button-tertiary-border-color-hover)',\n color: 'var(--f-theme-settings-button-tertiary-color-hover)',\n },\n },\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateRenderElementProps, type Value } from '@frontify/fondue/rte';\nimport { type CSSProperties, type HTMLAttributeAnchorTarget, type ReactElement, type ReactNode, useState } from 'react';\n\nimport { type TButtonElement } from '../types';\nimport { BlockButtonStyles } from '../utils';\n\nexport type ButtonRootProps = PlateRenderElementProps<Value, TButtonElement>;\n\nexport const ButtonMarkupElementNode = (props: ButtonRootProps) => {\n const { attributes, children } = props;\n const href = props.element.url || props.element.chosenLink?.searchResult?.link || '';\n const target = props.element.target || '_self';\n const buttonStyle = String(props.element.buttonStyle) || 'primary';\n return (\n <HoverableButtonLink\n attributes={attributes}\n href={href}\n target={target}\n styles={BlockButtonStyles[`button${buttonStyle.charAt(0).toUpperCase() + buttonStyle.slice(1)}`]}\n >\n {children}\n </HoverableButtonLink>\n );\n};\n\ntype Props = {\n attributes: ButtonRootProps['attributes'];\n children: ReactNode;\n styles?: CSSProperties & { hover?: CSSProperties };\n href?: string;\n target?: HTMLAttributeAnchorTarget;\n};\n\nconst HoverableButtonLink = ({\n attributes,\n styles = { hover: {} },\n children,\n href = '#',\n target,\n}: Props): ReactElement => {\n const [hovered, setHovered] = useState(false);\n\n return (\n <a\n {...attributes}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n href={href}\n target={target}\n style={hovered ? { ...styles, ...styles.hover } : styles}\n >\n {children}\n </a>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { MarkupElement } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\nimport { ButtonMarkupElementNode } from './ButtonMarkupElementNode';\n\nexport class ButtonMarkupElement extends MarkupElement {\n constructor(id = ELEMENT_BUTTON, node = ButtonMarkupElementNode) {\n super(id, node);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconButton } from '@frontify/fondue/icons';\nimport { IconStylingWrapper, ToolbarButton, focusEditor, useEditorRef } from '@frontify/fondue/rte';\nimport { type ReactNode, forwardRef } from 'react';\n\nimport { triggerFloatingButton } from '../utils';\n\nexport const ButtonToolbarButton = forwardRef<\n HTMLButtonElement,\n { disabled: boolean; tooltip: ReactNode; pressed: boolean }\n>((rootProps, ref) => {\n const editor = useEditorRef();\n\n return (\n <ToolbarButton\n ref={ref}\n {...rootProps}\n onMouseDown={(event) => {\n event.preventDefault();\n focusEditor(editor, editor.selection ?? editor.prevSelection ?? undefined);\n }}\n onClick={() => {\n triggerFloatingButton(editor, { focused: true });\n }}\n >\n <IconStylingWrapper icon={<IconButton size={16} />} />\n </ToolbarButton>\n );\n});\n\nButtonToolbarButton.displayName = 'ButtonToolbarButton';\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PluginButtonProps,\n getHotkeyByPlatform,\n getPluginType,\n getTooltip,\n isRangeInSameBlock,\n someNode,\n useEditorState,\n useEventPlateId,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\nimport { ButtonToolbarButton } from './ButtonToolbarButton';\n\nexport const ButtonButton = ({ editorId, id }: PluginButtonProps) => {\n const editor = useEditorState(useEventPlateId(editorId));\n const isEnabled = !!isRangeInSameBlock(editor, {\n at: editor.selection,\n });\n const type = getPluginType(editor, ELEMENT_BUTTON);\n const isLink = !!editor?.selection && someNode(editor, { match: { type } });\n\n return (\n <div data-plugin-id={id}>\n <ButtonToolbarButton\n pressed={isLink}\n disabled={!isEnabled} // maybe pressed\n tooltip={getTooltip(\n isEnabled\n ? `Button\\n${getHotkeyByPlatform('Ctrl+Shift+K')}`\n : 'Buttons can only be set for a single text block.',\n )}\n />\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const LINK_PLUGIN = 'link-plugin';\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type CSSProperties } from 'react';\n\nimport { BlockButtonStyles } from './ButtonPlugin';\nimport { LINK_PLUGIN } from './LinkPlugin/id';\n\nexport enum TextStyles {\n heading1 = 'heading1',\n heading2 = 'heading2',\n heading3 = 'heading3',\n heading4 = 'heading4',\n custom1 = 'custom1',\n custom2 = 'custom2',\n custom3 = 'custom3',\n quote = 'quote',\n imageCaption = 'imageCaption',\n imageTitle = 'imageTitle',\n p = 'p',\n}\nexport const BlockStyles: Record<string, CSSProperties & { hover?: CSSProperties }> = {\n [TextStyles.heading1]: {\n fontSize: 'var(--f-theme-settings-heading1-font-size)',\n lineHeight: 'var(--f-theme-settings-heading1-line-height)',\n marginTop: 'var(--f-theme-settings-heading1-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading1-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading1-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading1-font-style)',\n textTransform: 'var(--f-theme-settings-heading1-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading1-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading1-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading1-font-family)',\n color: 'var(--f-theme-settings-heading1-color)',\n },\n [TextStyles.heading2]: {\n fontSize: 'var(--f-theme-settings-heading2-font-size)',\n lineHeight: 'var(--f-theme-settings-heading2-line-height)',\n marginTop: 'var(--f-theme-settings-heading2-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading2-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading2-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading2-font-style)',\n textTransform: 'var(--f-theme-settings-heading2-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading2-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading2-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading2-font-family)',\n color: 'var(--f-theme-settings-heading2-color)',\n },\n [TextStyles.heading3]: {\n fontSize: 'var(--f-theme-settings-heading3-font-size)',\n lineHeight: 'var(--f-theme-settings-heading3-line-height)',\n marginTop: 'var(--f-theme-settings-heading3-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading3-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading3-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading3-font-style)',\n textTransform: 'var(--f-theme-settings-heading3-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading3-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading3-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading3-font-family)',\n color: 'var(--f-theme-settings-heading3-color)',\n },\n [TextStyles.heading4]: {\n fontSize: 'var(--f-theme-settings-heading4-font-size)',\n lineHeight: 'var(--f-theme-settings-heading4-line-height)',\n marginTop: 'var(--f-theme-settings-heading4-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading4-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading4-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading4-font-style)',\n textTransform: 'var(--f-theme-settings-heading4-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading4-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading4-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading4-font-family)',\n color: 'var(--f-theme-settings-heading4-color)',\n },\n [TextStyles.custom1]: {\n fontSize: 'var(--f-theme-settings-custom1-font-size)',\n lineHeight: 'var(--f-theme-settings-custom1-line-height)',\n marginTop: 'var(--f-theme-settings-custom1-margin-top)',\n marginBottom: 'var(--f-theme-settings-custom1-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-custom1-text-decoration)',\n fontStyle: 'var(--f-theme-settings-custom1-font-style)',\n textTransform: 'var(--f-theme-settings-custom1-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-custom1-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-custom1-font-weight)',\n fontFamily: 'var(--f-theme-settings-custom1-font-family)',\n color: 'var(--f-theme-settings-custom1-color)',\n },\n [TextStyles.custom2]: {\n fontSize: 'var(--f-theme-settings-custom2-font-size)',\n lineHeight: 'var(--f-theme-settings-custom2-line-height)',\n marginTop: 'var(--f-theme-settings-custom2-margin-top)',\n marginBottom: 'var(--f-theme-settings-custom2-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-custom2-text-decoration)',\n fontStyle: 'var(--f-theme-settings-custom2-font-style)',\n textTransform: 'var(--f-theme-settings-custom2-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-custom2-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-custom2-font-weight)',\n fontFamily: 'var(--f-theme-settings-custom2-font-family)',\n color: 'var(--f-theme-settings-custom2-color)',\n },\n [TextStyles.custom3]: {\n fontSize: 'var(--f-theme-settings-custom3-font-size)',\n lineHeight: 'var(--f-theme-settings-custom3-line-height)',\n marginTop: 'var(--f-theme-settings-custom3-margin-top)',\n marginBottom: 'var(--f-theme-settings-custom3-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-custom3-text-decoration)',\n fontStyle: 'var(--f-theme-settings-custom3-font-style)',\n textTransform: 'var(--f-theme-settings-custom3-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-custom3-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-custom3-font-weight)',\n fontFamily: 'var(--f-theme-settings-custom3-font-family)',\n color: 'var(--f-theme-settings-custom3-color)',\n },\n [TextStyles.p]: {\n fontSize: 'var(--f-theme-settings-body-font-size)',\n lineHeight: 'var(--f-theme-settings-body-line-height)',\n marginTop: 'var(--f-theme-settings-body-margin-top)',\n marginBottom: 'var(--f-theme-settings-body-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-body-text-decoration)',\n fontStyle: 'var(--f-theme-settings-body-font-style)',\n textTransform: 'var(--f-theme-settings-body-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-body-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-body-font-weight)',\n fontFamily: 'var(--f-theme-settings-body-font-family)',\n color: 'var(--f-theme-settings-body-color)',\n },\n [TextStyles.quote]: {\n fontSize: 'var(--f-theme-settings-quote-font-size)',\n lineHeight: 'var(--f-theme-settings-quote-line-height)',\n marginTop: 'var(--f-theme-settings-quote-margin-top)',\n marginBottom: 'var(--f-theme-settings-quote-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-quote-text-decoration)',\n fontStyle: 'var(--f-theme-settings-quote-font-style)',\n textTransform: 'var(--f-theme-settings-quote-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-quote-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-quote-font-weight)',\n fontFamily: 'var(--f-theme-settings-quote-font-family)',\n color: 'var(--f-theme-settings-quote-color)',\n },\n [TextStyles.imageCaption]: {\n fontSize: 'var(--f-theme-settings-image-caption-font-size)',\n lineHeight: 'var(--f-theme-settings-image-caption-line-height)',\n marginTop: 'var(--f-theme-settings-image-caption-margin-top)',\n marginBottom: 'var(--f-theme-settings-image-caption-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-image-caption-text-decoration)',\n fontStyle: 'var(--f-theme-settings-image-caption-font-style)',\n textTransform: 'var(--f-theme-settings-image-caption-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-image-caption-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-image-caption-font-weight)',\n fontFamily: 'var(--f-theme-settings-image-caption-font-family)',\n color: 'var(--f-theme-settings-image-caption-color)',\n },\n [TextStyles.imageTitle]: {\n fontSize: 'var(--f-theme-settings-image-title-font-size)',\n lineHeight: 'var(--f-theme-settings-image-title-line-height)',\n marginTop: 'var(--f-theme-settings-image-title-margin-top)',\n marginBottom: 'var(--f-theme-settings-image-title-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-image-title-text-decoration)',\n fontStyle: 'var(--f-theme-settings-image-title-font-style)',\n textTransform: 'var(--f-theme-settings-image-title-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-image-title-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-image-title-font-weight)',\n fontFamily: 'var(--f-theme-settings-image-title-font-family)',\n color: 'var(--f-theme-settings-image-title-color)',\n },\n [LINK_PLUGIN]: {\n fontSize: 'var(--f-theme-settings-link-font-size)',\n lineHeight: 'var(--f-theme-settings-link-line-height)',\n marginTop: 'var(--f-theme-settings-link-margin-top)',\n marginBottom: 'var(--f-theme-settings-link-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-link-text-decoration)',\n fontStyle: 'var(--f-theme-settings-link-font-style)',\n textTransform: 'var(--f-theme-settings-link-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-link-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-link-font-weight)',\n fontFamily: 'var(--f-theme-settings-link-font-family)',\n color: 'var(--f-theme-settings-link-color)',\n },\n ...BlockButtonStyles,\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconPen, IconTrashBin } from '@frontify/fondue/icons';\nimport { FloatingModalWrapper, focusEditor, useEditorRef } from '@frontify/fondue/rte';\n\nimport { LINK_PLUGIN } from '../../../../LinkPlugin/id';\nimport { BlockStyles } from '../../../../styles';\nimport { unwrapButton } from '../../../transforms';\nimport { triggerFloatingButtonEdit } from '../../../utils';\nimport { floatingButtonSelectors } from '../floatingButtonStore';\n\nexport const EditModal = () => {\n const editor = useEditorRef();\n return (\n <FloatingModalWrapper padding=\"16px\" minWidth=\"400px\" data-test-id=\"floating-button-edit\">\n <span data-test-id=\"preview-button-flyout\" className=\"tw-flex tw-justify-between tw-items-center tw-gap-2\">\n <a\n data-test-id=\"floating-button-edit-url\"\n href={floatingButtonSelectors.url()}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n style={BlockStyles[LINK_PLUGIN]}\n className=\"tw-break-all\"\n >\n {floatingButtonSelectors.url()}\n </a>\n <span className=\"tw-flex tw-gap-2\">\n <button\n onClick={() => {\n triggerFloatingButtonEdit(editor);\n }}\n tabIndex={0}\n data-test-id=\"edit-button-button\"\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n >\n <IconPen size={16} />\n </button>\n\n <button\n onClick={() => {\n unwrapButton(editor);\n focusEditor(editor, editor.selection ?? undefined);\n }}\n tabIndex={0}\n data-test-id=\"remove-button-button\"\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n >\n <IconTrashBin size={16} />\n </button>\n </span>\n </span>\n </FloatingModalWrapper>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type DocumentSection } from '@frontify/app-bridge';\n\nimport { type DocumentSectionWithTitle } from '../types';\n\nexport const filterDocumentSectionsWithUnreadableTitles = (sections: DocumentSection[]) =>\n sections.filter((section) => !!section.title?.trim()) as DocumentSectionWithTitle[];\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { LoadingCircle } from '@frontify/fondue/components';\n\nexport const LoadingIndicator = () => {\n return (\n <div className=\"tw-flex tw-justify-center tw-h-10 tw-items-center\">\n <LoadingCircle size=\"small\" />\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { merge } from '@frontify/fondue';\nimport { IconDocumentText } from '@frontify/fondue/icons';\n\ntype SectionLinkProps = {\n section: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n};\n\nexport const SectionLink = ({ section, selectedUrl, onSelectUrl }: SectionLinkProps) => {\n const isActive = section.permanentLink === selectedUrl;\n\n return (\n <button\n data-test-id=\"internal-link-selector-section-link\"\n data-is-active={isActive}\n className={merge([\n 'tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full',\n isActive\n ? 'tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover'\n : 'hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover',\n ])}\n onClick={() => onSelectUrl(section.permanentLink)}\n >\n <div className=\"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6\">\n <IconDocumentText size={16} />\n <span className=\"tw-text-s\">{section.title}</span>\n <span className=\"tw-flex-auto tw-font-sans tw-text-xs tw-text-right\">Section</span>\n </div>\n </button>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type DocumentSection } from '@frontify/app-bridge';\nimport { merge } from '@frontify/fondue';\nimport { useEffect, useState } from 'react';\n\nimport { filterDocumentSectionsWithUnreadableTitles } from '../helpers/filterDocumentSectionsWithUnreadableTitles';\nimport { type DocumentSectionWithTitle, type InitiallyExpandedItems } from '../types';\n\nimport { SectionLink } from './SectionLink';\n\ntype PageLinkProps = {\n page: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n itemsToExpandInitially: InitiallyExpandedItems;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n};\n\nexport const PageLink = ({\n page,\n selectedUrl,\n onSelectUrl,\n itemsToExpandInitially,\n getDocumentSectionsByDocumentPageId,\n}: PageLinkProps) => {\n const [isExpanded, setIsExpanded] = useState(page.id === itemsToExpandInitially.documentId);\n const [documentSections, setDocumentSections] = useState<DocumentSectionWithTitle[]>([]);\n const isActive = page.permanentLink === selectedUrl;\n\n useEffect(() => {\n const fetchDocumentSections = async () => {\n const sections = await getDocumentSectionsByDocumentPageId(page.id);\n const sectionsWithReadableTitles = filterDocumentSectionsWithUnreadableTitles(sections);\n setDocumentSections(sectionsWithReadableTitles);\n };\n\n fetchDocumentSections();\n }, [page.id, getDocumentSectionsByDocumentPageId]);\n\n useEffect(() => {\n if (page.id === itemsToExpandInitially.pageId) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setIsExpanded(true);\n }\n }, [itemsToExpandInitially, page.id]);\n\n const hasSections = documentSections.length > 0;\n\n return (\n <>\n <button\n data-test-id=\"internal-link-selector-page-link\"\n className={merge([\n 'tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full',\n hasSections ? 'tw-pl-7' : 'tw-pl-12',\n isActive\n ? 'tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover'\n : 'hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover',\n ])}\n onClick={() => onSelectUrl(page.permanentLink)}\n >\n <div key={page.id} className=\"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6\">\n {hasSections && (\n <button\n data-test-id=\"tree-item-toggle\"\n className=\"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer\"\n onClick={() => setIsExpanded(!isExpanded)}\n onKeyDown={(event) => event.key === 'Enter' && event.stopPropagation()}\n >\n <div\n className={merge([\n 'tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong',\n isExpanded ? 'tw-rotate-90' : '',\n ])}\n ></div>\n </button>\n )}\n <span className=\"tw-text-s\">{page.title}</span>\n <span className=\"tw-flex-auto tw-font-sans tw-text-xs tw-text-right\">Page</span>\n </div>\n </button>\n {isExpanded &&\n documentSections.length > 0 &&\n documentSections.map((section) => {\n return (\n <SectionLink\n key={section.id}\n section={section}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n />\n );\n })}\n </>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { type ReactElement, useEffect, useState } from 'react';\n\nimport { type InitiallyExpandedItems } from '../types';\n\nimport { LoadingIndicator } from './LoadingIndicator';\nimport { PageLink } from './PageLink';\n\ntype PageLinksProps = {\n documentId: number;\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n itemsToExpandInitially: InitiallyExpandedItems;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const PageLinks = ({\n documentId,\n selectedUrl,\n onSelectUrl,\n itemsToExpandInitially,\n getDocumentSectionsByDocumentPageId,\n getDocumentPagesByDocumentId,\n}: PageLinksProps): ReactElement => {\n const [pages, setPages] = useState<DocumentPage[]>([]);\n const [isLoading, setIsLoading] = useState(true);\n const pagesArray = [...pages.values()];\n const hasPages = !isLoading && pagesArray.length > 0;\n\n useEffect(() => {\n getDocumentPagesByDocumentId(documentId)\n .then((_pages) => {\n const pagesWithCategories = _pages\n .filter((page) => !!page.category)\n .sort((a, b) =>\n a.category.sort === b.category.sort ? a.sort - b.sort : a.category.sort - b.category.sort,\n );\n const pagesWithoutCategories = _pages.filter((page) => !page.category).sort((a, b) => a.sort - b.sort);\n setPages([...pagesWithCategories, ...pagesWithoutCategories]);\n })\n .finally(() => {\n setIsLoading(false);\n });\n }, []);\n\n if (isLoading) {\n return <LoadingIndicator />;\n }\n\n return hasPages ? (\n <>\n {pagesArray.map((page) => {\n return (\n <PageLink\n key={page.id}\n page={page}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n itemsToExpandInitially={itemsToExpandInitially}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n />\n );\n })}\n </>\n ) : (\n <div className=\"tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-s tw-text-text-weak\">\n This document does not contain any pages.\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { merge } from '@frontify/fondue';\nimport { IconColorFan } from '@frontify/fondue/icons';\nimport { useEffect, useState } from 'react';\n\nimport { type InitiallyExpandedItems } from '../types';\n\nimport { PageLinks } from './PageLinks';\n\ntype DocumentLinkProps = {\n document: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n itemsToExpandInitially: InitiallyExpandedItems;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const DocumentLink = ({\n document,\n selectedUrl,\n onSelectUrl,\n itemsToExpandInitially,\n getDocumentSectionsByDocumentPageId,\n getDocumentPagesByDocumentId,\n}: DocumentLinkProps) => {\n const [isExpanded, setIsExpanded] = useState(document.id === itemsToExpandInitially.documentId);\n const isActive = document.permanentLink === selectedUrl;\n\n useEffect(() => {\n if (document.id === itemsToExpandInitially.documentId) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setIsExpanded(true);\n }\n }, [itemsToExpandInitially, document.id]);\n\n return (\n <>\n <button\n data-test-id=\"internal-link-selector-document-link\"\n className={merge([\n 'tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-w-full',\n isActive\n ? 'tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover'\n : 'hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover',\n ])}\n onClick={() => onSelectUrl(document.permanentLink)}\n >\n <button\n type=\"button\"\n tabIndex={0}\n data-test-id=\"tree-item-toggle\"\n className=\"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer\"\n onClick={() => setIsExpanded(!isExpanded)}\n onKeyDown={(event) => event.key === 'Enter' && event.stopPropagation()}\n >\n <div\n className={merge([\n 'tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong',\n isExpanded ? 'tw-rotate-90' : '',\n ])}\n ></div>\n </button>\n <IconColorFan size={16} />\n <span className=\"tw-text-s\">{document.title}</span>\n <span className=\"tw-flex-auto tw-font-sans tw-text-xs tw-text-right\">Document</span>\n </button>\n {isExpanded && (\n <PageLinks\n documentId={document.id}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n itemsToExpandInitially={itemsToExpandInitially}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n getDocumentPagesByDocumentId={getDocumentPagesByDocumentId}\n />\n )}\n </>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Document, type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { type ReactElement, useEffect, useState } from 'react';\n\nimport { filterDocumentSectionsWithUnreadableTitles } from '../helpers/filterDocumentSectionsWithUnreadableTitles';\nimport { type InitiallyExpandedItems } from '../types';\n\nimport { DocumentLink } from './DocumentLink';\nimport { LoadingIndicator } from './LoadingIndicator';\n\ntype DocumentLinksProps = {\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n getAllDocuments: () => Promise<Document[]>;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const DocumentLinks = ({\n selectedUrl,\n onSelectUrl,\n getAllDocuments,\n getDocumentPagesByDocumentId,\n getDocumentSectionsByDocumentPageId,\n}: DocumentLinksProps): ReactElement => {\n const [isLoading, setIsLoading] = useState(true);\n const [documents, setDocuments] = useState<Document[]>([]);\n const [itemsToExpandInitially, setItemsToExpandInitially] = useState<InitiallyExpandedItems>({\n documentId: undefined,\n pageId: undefined,\n });\n\n useEffect(() => {\n if (selectedUrl && documents.length > 0) {\n findLocationOfSelectedUrl().then((items) => {\n setItemsToExpandInitially(items);\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [documents.length]);\n\n useEffect(() => {\n getAllDocuments()\n .then((_documents) => {\n setDocuments(_documents);\n })\n .finally(() => {\n setIsLoading(false);\n });\n }, []);\n\n const findLocationOfSelectedUrl = async () => {\n const itemsToExpand: InitiallyExpandedItems = {\n documentId: undefined,\n pageId: undefined,\n };\n const selectedUrlIsDocument = documents.find((document) => document.permanentLink === selectedUrl);\n if (selectedUrlIsDocument) {\n return itemsToExpand;\n }\n for (const document of documents) {\n const pages = await getDocumentPagesByDocumentId(document.id);\n const selectedUrlIsPage = !!pages.find((page) => page.permanentLink === selectedUrl);\n if (selectedUrlIsPage) {\n itemsToExpand.documentId = document.id;\n return itemsToExpand;\n }\n for (const page of pages) {\n const sections = await getDocumentSectionsByDocumentPageId(page.id);\n const sectionsWithReadableTitles = filterDocumentSectionsWithUnreadableTitles(sections);\n const selectedUrlIsSection = !!sectionsWithReadableTitles.find(\n (section) => section.permanentLink === selectedUrl,\n );\n if (selectedUrlIsSection) {\n itemsToExpand.documentId = document.id;\n itemsToExpand.pageId = page.id;\n return itemsToExpand;\n }\n }\n }\n return itemsToExpand;\n };\n\n return isLoading ? (\n <LoadingIndicator />\n ) : (\n <>\n {documents.map((document) => {\n return (\n <DocumentLink\n key={document.id}\n document={document}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n itemsToExpandInitially={itemsToExpandInitially}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n getDocumentPagesByDocumentId={getDocumentPagesByDocumentId}\n />\n );\n })}\n </>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Document, type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { Button, Dialog, ScrollArea } from '@frontify/fondue/components';\nimport { IconLink } from '@frontify/fondue/icons';\nimport { type KeyboardEvent, type ReactElement, useEffect, useState } from 'react';\n\nimport './LinkSelector.css';\nimport { DocumentLinks } from './DocumentLinks';\n\ntype LinkSelectorProps = {\n url: string;\n onUrlChange?: (value: string) => void;\n buttonSize?: 'small' | 'medium' | 'large';\n getAllDocuments: () => Promise<Document[]>;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const LinkSelector = ({\n url,\n onUrlChange,\n buttonSize = 'medium',\n getAllDocuments,\n getDocumentPagesByDocumentId,\n getDocumentSectionsByDocumentPageId,\n}: LinkSelectorProps): ReactElement => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [selectedUrl, setSelectedUrl] = useState<string>(url);\n\n const onSelectUrl = (url: string) => {\n setSelectedUrl(url);\n };\n\n const onPressEnter = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n saveLink();\n }\n };\n\n useEffect(() => {\n if (url && !selectedUrl) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setSelectedUrl(url);\n }\n }, [url, selectedUrl]);\n\n const saveLink = () => {\n onUrlChange?.(selectedUrl);\n setIsModalOpen(false);\n };\n\n const dialogProps = {\n onOpenAutoFocus: () => {},\n showUnderlay: true,\n 'data-is-underlay': true,\n minWidth: '800px',\n };\n\n return (\n // eslint-disable-next-line jsx-a11y-x/no-static-element-interactions\n <div\n onPointerDownCapture={(event) => {\n event.stopPropagation();\n event.preventDefault();\n }}\n onFocusCapture={(event) => {\n event.stopPropagation();\n event.preventDefault();\n }}\n data-test-id=\"internal-link-selector\"\n onKeyDown={onPressEnter}\n >\n <Dialog.Root modal open={isModalOpen} onOpenChange={setIsModalOpen}>\n <Dialog.Trigger asChild>\n <Button size={buttonSize} emphasis=\"default\">\n <IconLink size=\"20\" />\n Internal link\n </Button>\n </Dialog.Trigger>\n <Dialog.Content {...dialogProps}>\n <Dialog.Header>\n <Dialog.Title>Select internal link</Dialog.Title>\n </Dialog.Header>\n <Dialog.Body padding=\"none\">\n <ScrollArea padding=\"compact\">\n <DocumentLinks\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n getAllDocuments={getAllDocuments}\n getDocumentPagesByDocumentId={getDocumentPagesByDocumentId}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n />\n </ScrollArea>\n </Dialog.Body>\n <Dialog.Footer>\n <Button size={buttonSize} emphasis=\"default\" onPress={() => setIsModalOpen(false)}>\n Cancel\n </Button>\n <Button size={buttonSize} disabled={!selectedUrl} emphasis=\"strong\" onPress={() => saveLink()}>\n Choose\n </Button>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog.Root>\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport { FormControl } from '@frontify/fondue';\nimport { TextInput, Checkbox, Label } from '@frontify/fondue/components';\n\nimport { LinkSelector } from './LinkSelector';\nimport { isValidUrlOrEmpty as internalIsValidUrlOrEmpty } from './utils';\n\ntype LinkInputProps = {\n url?: string;\n info?: string;\n label?: string;\n required?: boolean;\n newTab?: boolean;\n onUrlChange?: (value: string) => void;\n onToggleTab?: (checked: boolean) => void;\n isValidUrlOrEmpty?: (url: string) => boolean;\n appBridge: AppBridgeBlock;\n placeholder?: string;\n buttonSize?: 'small' | 'medium' | 'large';\n hideInternalLinkButton?: boolean;\n};\n\nexport const LinkInput = ({\n onUrlChange,\n onToggleTab,\n isValidUrlOrEmpty,\n appBridge,\n placeholder,\n newTab,\n url = '',\n required,\n info,\n label,\n buttonSize,\n hideInternalLinkButton,\n}: LinkInputProps) => {\n const isUrlValid = isValidUrlOrEmpty ? isValidUrlOrEmpty(url) : internalIsValidUrlOrEmpty(url);\n return (\n <div data-test-id=\"link-input\">\n <FormControl\n label={{\n children: label,\n htmlFor: 'url',\n required,\n tooltip: info ? { content: info, position: 'top' } : undefined,\n }}\n >\n <TextInput\n data-test-id=\"text-input\"\n id=\"url\"\n value={url}\n onChange={(event) => onUrlChange?.(event.target.value)}\n placeholder={placeholder ?? 'https://example.com'}\n />\n </FormControl>\n {!isUrlValid && <div className=\"tw-text-text-negative tw-mt-1 tw-text-s\">Please enter a valid URL.</div>}\n\n {!hideInternalLinkButton && (\n <div className=\"tw-mt-3\">\n <LinkSelector\n url={url}\n onUrlChange={onUrlChange}\n buttonSize={buttonSize ?? 'medium'}\n getAllDocuments={() => appBridge.getAllDocuments()}\n getDocumentPagesByDocumentId={(documentId) =>\n appBridge.getDocumentPagesByDocumentId(documentId)\n }\n getDocumentSectionsByDocumentPageId={(documentPageId) =>\n appBridge.getDocumentSectionsByDocumentPageId(documentPageId)\n }\n />\n </div>\n )}\n\n <div className=\"tw-mt-3 tw-flex tw-items-center tw-gap-1.5\">\n <Checkbox id=\"new-tab\" value={newTab} onChange={() => onToggleTab?.(!newTab)} />\n <Label id=\"new-tab-label\" htmlFor=\"new-tab\" className=\"tw-whitespace-nowrap\">\n Open in new tab\n </Label>\n </div>\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport { FormControl } from '@frontify/fondue';\nimport { Button, TextInput } from '@frontify/fondue/components';\nimport { IconCheckMark } from '@frontify/fondue/icons';\nimport { FloatingModalWrapper } from '@frontify/fondue/rte';\nimport { type MouseEvent, type ReactElement, type ReactNode } from 'react';\n\nimport { LinkInput } from '../../../../../Link';\n\nimport { type InsertModalStateProps } from './types';\n\ntype Props = {\n state: InsertModalStateProps;\n onTextChange: (value: string) => void;\n onUrlChange: (value: string) => void;\n onToggleTab: (checked: boolean) => void;\n onCancel: () => void;\n onSave: (event: MouseEvent<HTMLButtonElement, globalThis.MouseEvent> | KeyboardEvent | undefined) => void;\n hasValues: boolean;\n isValidUrlOrEmpty: (url: string) => boolean;\n testId?: string;\n children?: ReactNode;\n appBridge: AppBridgeBlock;\n};\n\nexport const InsertModal = ({\n state,\n onTextChange,\n onUrlChange,\n onToggleTab,\n onCancel,\n onSave,\n isValidUrlOrEmpty,\n hasValues,\n testId,\n appBridge,\n children,\n}: Props): ReactElement => (\n <FloatingModalWrapper data-test-id={testId} padding=\"28px\" minWidth=\"400px\">\n <FormControl\n label={{\n children: 'Text',\n htmlFor: 'linkText',\n required: true,\n }}\n >\n <TextInput\n id=\"linkText\"\n value={state.text}\n placeholder=\"Link Text\"\n onChange={(event) => onTextChange(event.target.value)}\n />\n </FormControl>\n\n {children}\n\n <div className=\"tw-mt-5\">\n <LinkInput\n url={state.url}\n newTab={state.newTab}\n onUrlChange={onUrlChange}\n onToggleTab={onToggleTab}\n isValidUrlOrEmpty={isValidUrlOrEmpty}\n appBridge={appBridge}\n />\n </div>\n <div className=\"tw-mt-3\">\n <div className={'tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10'}>\n <Button data-test-id=\"button\" onPress={onCancel} size=\"medium\" emphasis=\"default\">\n Cancel\n </Button>\n <Button\n data-test-id=\"button\"\n onPress={onSave}\n size=\"medium\"\n disabled={!isValidUrlOrEmpty(state?.url) || !hasValues}\n >\n <IconCheckMark size=\"20\" />\n Save\n </Button>\n </div>\n </div>\n </FloatingModalWrapper>\n);\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, getAboveNode } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type RichTextButtonStyle, type TButtonElement } from '..';\n\nexport const getButtonStyle = (editor: PlateEditor): RichTextButtonStyle => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return 'primary';\n }\n\n return (linkNode[0]?.buttonStyle as RichTextButtonStyle) || 'primary';\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport { getPluginOptions, useEditorRef, useHotkeys } from '@frontify/fondue/rte';\nimport { type Dispatch, type Reducer, useEffect, useReducer } from 'react';\n\nimport { addHttps } from '../../../../../../../helpers';\nimport { isValidUrlOrEmpty } from '../../../../../../Link/utils/url';\nimport { ELEMENT_BUTTON } from '../../../createButtonPlugin';\nimport { submitFloatingButton } from '../../../transforms/submitFloatingButton';\nimport { type RichTextButtonStyle } from '../../../types';\nimport { getButtonStyle } from '../../../utils/getButtonStyle';\nimport { floatingButtonActions, floatingButtonSelectors } from '../floatingButtonStore';\n\nimport { type InsertModalDispatchType, type InsertModalStateProps } from './types';\n\nconst initialState: InsertModalStateProps = {\n url: '',\n text: '',\n buttonStyle: 'primary',\n newTab: false,\n};\n\nexport const InsertModalState = (): [InsertModalStateProps, Dispatch<InsertModalDispatchType>] => {\n const [state, dispatch] = useReducer<Reducer<InsertModalStateProps, InsertModalDispatchType>>((state, action) => {\n const { type, payload } = action;\n\n switch (type) {\n case 'NEW_TAB':\n return {\n ...state,\n newTab: true,\n };\n case 'SAME_TAB':\n return {\n ...state,\n newTab: false,\n };\n case 'URL':\n case 'TEXT':\n case 'BUTTON_STYLE':\n case 'INIT':\n return {\n ...state,\n ...payload,\n };\n default:\n return state;\n }\n }, initialState);\n\n return [state, dispatch];\n};\n\nexport const useInsertModal = () => {\n const editor = useEditorRef();\n const [state, dispatch] = InsertModalState();\n\n useEffect(() => {\n const buttonStyle = getButtonStyle(editor);\n\n dispatch({\n type: 'INIT',\n payload: {\n text: floatingButtonSelectors.text() || floatingButtonSelectors.url(),\n buttonStyle,\n newTab: !!floatingButtonSelectors.newTab(),\n url: floatingButtonSelectors.url(),\n },\n });\n }, [dispatch, editor]);\n\n const onTextChange = (value: string) => {\n dispatch({\n type: 'TEXT',\n payload: { text: value },\n });\n };\n\n const onButtonStyleChange = (value: RichTextButtonStyle) => {\n dispatch({\n type: 'BUTTON_STYLE',\n payload: { buttonStyle: value },\n });\n };\n\n const onUrlChange = (value: string) => {\n dispatch({\n type: 'URL',\n payload: { url: value },\n });\n };\n\n const onToggleTab = (checked: boolean) => {\n checked ? dispatch({ type: 'NEW_TAB' }) : dispatch({ type: 'SAME_TAB' });\n };\n\n const onCancel = () => {\n floatingButtonActions.reset();\n };\n\n const onSave = (event: React.MouseEvent<HTMLButtonElement, MouseEvent> | KeyboardEvent | undefined) => {\n if (!isValidUrlOrEmpty(state.url) || !hasValues) {\n return;\n }\n\n const urlToSave = addHttps(state.url);\n\n floatingButtonActions.text(state.text);\n floatingButtonActions.url(urlToSave);\n floatingButtonActions.buttonStyle(state.buttonStyle);\n floatingButtonActions.newTab(state.newTab);\n\n if (submitFloatingButton(editor)) {\n event?.preventDefault();\n }\n };\n\n const hasValues = state.url !== '' && state.text !== '';\n\n const { appBridge } = getPluginOptions<{ appBridge: AppBridgeBlock }>(editor, ELEMENT_BUTTON);\n\n useHotkeys(\n 'enter',\n onSave,\n {\n enableOnFormTags: ['INPUT'],\n },\n [],\n );\n\n return {\n state,\n onTextChange,\n onButtonStyleChange,\n onUrlChange,\n onToggleTab,\n onCancel,\n onSave,\n hasValues,\n isValidUrlOrEmpty,\n appBridge,\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { FormControl } from '@frontify/fondue';\nimport { type CSSProperties, type ReactElement, type ReactNode, useState } from 'react';\n\nimport { InsertModal } from '../../../../LinkPlugin/FloatingLink/InsertLinkModal/InsertModal';\nimport { BlockStyles } from '../../../../styles';\n\nimport { useInsertModal } from './useInsertModal';\n\nexport const InsertButtonModal = () => {\n const modalProps = useInsertModal();\n const { state, onButtonStyleChange } = modalProps;\n\n return (\n <InsertModal {...modalProps} testId=\"floating-button-insert\">\n <div className=\"tw-pt-5\">\n <FormControl\n label={{\n children: 'Button Style',\n htmlFor: 'buttonStyle',\n required: true,\n }}\n >\n <HoverableButton\n id=\"primary\"\n styles={BlockStyles.buttonPrimary}\n isActive={state.buttonStyle === 'primary'}\n onClick={() => onButtonStyleChange('primary')}\n >\n {state.text || 'Primary Button'}\n </HoverableButton>\n\n <HoverableButton\n id=\"secondary\"\n styles={BlockStyles.buttonSecondary}\n isActive={state.buttonStyle === 'secondary'}\n onClick={() => onButtonStyleChange('secondary')}\n >\n {state.text || 'Secondary Button'}\n </HoverableButton>\n\n <HoverableButton\n id=\"tertiary\"\n styles={BlockStyles.buttonTertiary}\n isActive={state.buttonStyle === 'tertiary'}\n onClick={() => onButtonStyleChange('tertiary')}\n >\n {state.text || 'Tertiary Button'}\n </HoverableButton>\n </FormControl>\n </div>\n </InsertModal>\n );\n};\n\ntype Props = {\n id: string;\n styles?: CSSProperties & { hover?: CSSProperties };\n isActive: boolean;\n onClick: () => void;\n children: ReactNode;\n};\n\nconst HoverableButton = ({ id, styles, isActive, onClick, children }: Props): ReactElement => {\n const [hovered, setHovered] = useState(false);\n const getStyles = () => (styles && styles.hover && hovered ? { ...styles, ...styles.hover } : styles);\n\n return (\n <button\n data-test-id={`floating-button-insert-${id}`}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onClick={onClick}\n style={{ ...getStyles(), marginTop: 0, marginBottom: 0 }}\n className={\n isActive ? 'tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit' : 'tw-w-fit'\n }\n >\n {children}\n </button>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TextStyles, type UseVirtualFloatingOptions, flip, offset, useEditorRef } from '@frontify/fondue/rte';\nimport { createPortal } from 'react-dom';\n\nimport { BlockStyles } from '../../../../../RichTextEditor/plugins/styles';\nimport { useFloatingButtonEdit, useFloatingButtonInsert, useFloatingButtonSelectors } from '../FloatingButton';\n\nimport { EditModal } from './EditButtonModal/EditModal';\nimport { InsertButtonModal } from './InsertButtonModal/InsertButtonModal';\n\nconst floatingOptions: UseVirtualFloatingOptions = {\n placement: 'bottom-start',\n strategy: 'absolute',\n middleware: [\n offset(12),\n flip({\n padding: 12,\n fallbackPlacements: ['bottom-end', 'top-start', 'top-end'],\n }),\n ],\n};\n\nexport const CustomFloatingButton = () => {\n const { ref: insertRef, ...insertProps } = useFloatingButtonInsert(floatingOptions);\n const { ref: editRef, ...editProps } = useFloatingButtonEdit(floatingOptions);\n const editor = useEditorRef();\n const state = useFloatingButtonSelectors();\n const isOpen = state.isOpen(editor.id);\n const isEditing = state.isEditing();\n const mode = state.mode();\n\n const input = <InsertButtonModal />;\n const editContent = isEditing ? input : <EditModal />;\n\n return (\n <>\n {isOpen &&\n mode === 'insert' &&\n createPortal(\n <div\n data-is-underlay\n ref={insertRef}\n {...insertProps}\n style={{ ...insertProps.style, ...BlockStyles[TextStyles.p] }}\n >\n {input}\n </div>,\n document.body,\n )}\n\n {isOpen &&\n mode === 'edit' &&\n createPortal(\n <div\n data-is-underlay\n ref={editRef}\n {...editProps}\n style={{ ...editProps.style, ...BlockStyles[TextStyles.p] }}\n >\n {editContent}\n </div>,\n document.body,\n )}\n </>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type RangeBeforeOptions,\n createPluginFactory,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { isValidUrl } from '../../../Link/utils/url';\n\nimport { ButtonMarkupElement } from './ButtonMarkupElement';\nimport { ButtonButton } from './components/ButtonButton';\nimport { CustomFloatingButton } from './components/FloatingButton/CustomFloatingButton';\nimport { BlockButtonStyles } from './utils';\nimport { withButton } from './withButton';\n\nexport const ELEMENT_BUTTON = 'button';\nexport const BUTTON_PLUGIN = 'button-plugin';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport interface ButtonPlugin {\n forceSubmit?: boolean;\n\n /**\n * Allow custom config for rangeBeforeOptions.\n * @example default\n * {\n * matchString: ' ',\n * skipInvalid: true,\n * afterMatch: true,\n * }\n */\n rangeBeforeOptions?: RangeBeforeOptions;\n\n /**\n * Hotkeys to trigger floating button.\n * @default 'command+k, ctrl+k'\n */\n triggerFloatingButtonHotkeys: string;\n\n /**\n * Callback to validate an url.\n * @default isUrl\n */\n isUrl: (text: string) => boolean;\n\n /**\n * Callback to optionally get the href for a url\n * @returns href: an optional link to be used that is different from the text content (example https://google.com for google.com)\n */\n getUrlHref?: (url: string) => string | undefined;\n\n /**\n * On keyboard shortcut or toolbar mousedown, get the link url by calling this promise. The\n * default behavior is to use the browser's native `prompt`.\n */\n getLinkUrl?: (prevUrl: string | null) => Promise<string | null>;\n}\n\n/**\n * Enables support for hyperlinks.\n */\nexport const createButtonPlugin = (appBridge: AppBridgeBlock): PlatePlugin =>\n createPluginFactory({\n key: ELEMENT_BUTTON,\n isElement: true,\n isInline: true,\n props: ({ element }) => ({\n nodeProps: { href: element?.url, target: element?.target },\n }),\n withOverrides: withButton,\n renderAfterEditable: CustomFloatingButton,\n options: {\n isUrl: isValidUrl,\n rangeBeforeOptions: {\n matchString: ' ',\n skipInvalid: true,\n afterMatch: true,\n },\n triggerFloatingButtonHotkeys: 'command+shift+k, ctrl+shift+k',\n appBridge,\n },\n then: (_editor, { type }) => ({\n deserializeHtml: {\n rules: [\n {\n validNodeName: 'A',\n validClassName: 'btn',\n },\n ],\n getNode: (el) => ({\n type,\n url: el.getAttribute('href'),\n target: el.getAttribute('target') || '_blank',\n }),\n },\n }),\n })();\n\nexport type ButtonPluginProps = Omit<PluginProps, 'styles'> & {\n styles?: Record<string, CSSProperties & { hover?: CSSProperties }>;\n} & { appBridge: AppBridgeBlock };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport class ButtonPlugin extends Plugin {\n public styles: CSSProperties = {};\n private appBridge: AppBridgeBlock;\n constructor({ styles = BlockButtonStyles, ...props }: ButtonPluginProps) {\n super(BUTTON_PLUGIN, {\n button: ButtonButton,\n markupElement: new ButtonMarkupElement(),\n ...props,\n });\n this.styles = styles;\n this.appBridge = props?.appBridge;\n }\n\n plugins() {\n return [createButtonPlugin(this.appBridge)];\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type UseVirtualFloatingOptions,\n getAboveNode,\n getDefaultBoundingClientRect,\n getEndPoint,\n getPluginOptions,\n getPluginType,\n getRangeBoundingClientRect,\n getStartPoint,\n someNode,\n useComposedRef,\n useEditorRef,\n useEditorVersion,\n useHotkeys,\n} from '@frontify/fondue/rte';\nimport { type Ref, useCallback, useEffect } from 'react';\n\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../../createButtonPlugin';\nimport { getUrlFromEditor } from '../../utils';\nimport { triggerFloatingButtonEdit } from '../../utils/triggerFloatingButtonEdit';\n\nimport {\n floatingButtonActions,\n floatingButtonSelectors,\n useFloatingButtonEnter,\n useFloatingButtonEscape,\n useFloatingButtonSelectors,\n useVirtualFloatingButton,\n} from '.';\n\nexport const useFloatingButtonEdit = (\n floatingOptions: UseVirtualFloatingOptions,\n): React.HTMLAttributes<HTMLDivElement> & { ref: Ref<HTMLDivElement> } => {\n const editor = useEditorRef();\n const mode = useFloatingButtonSelectors().mode();\n const open = useFloatingButtonSelectors().isOpen(editor.id);\n const version = useEditorVersion();\n\n const { triggerFloatingButtonHotkeys } = getPluginOptions<ButtonPlugin>(editor, ELEMENT_BUTTON);\n\n const getBoundingClientRect = useCallback(() => {\n const entry = getAboveNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (entry) {\n const [, path] = entry;\n return getRangeBoundingClientRect(editor, {\n anchor: getStartPoint(editor, path),\n focus: getEndPoint(editor, path),\n });\n }\n\n return getDefaultBoundingClientRect();\n }, [editor]);\n\n const isOpen = open && mode === 'edit';\n\n const { update, style, floating } = useVirtualFloatingButton({\n open: isOpen,\n getBoundingClientRect,\n ...floatingOptions,\n });\n\n useEffect(() => {\n const url = getUrlFromEditor(editor);\n if (url) {\n floatingButtonActions.url(url);\n }\n\n if (\n editor.selection &&\n someNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n })\n ) {\n floatingButtonActions.show('edit', editor.id);\n update();\n return;\n }\n\n if (floatingButtonSelectors.mode() === 'edit') {\n floatingButtonActions.reset();\n }\n }, [editor, version, update]);\n\n useHotkeys(\n triggerFloatingButtonHotkeys,\n (e) => {\n e.preventDefault();\n\n if (floatingButtonSelectors.mode() === 'edit') {\n triggerFloatingButtonEdit(editor);\n }\n },\n {\n enableOnContentEditable: true,\n },\n [],\n );\n\n useFloatingButtonEnter();\n\n useFloatingButtonEscape();\n\n return {\n style,\n ref: useComposedRef<HTMLElement | null>(floating),\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useEditorRef, useHotkeys } from '@frontify/fondue/rte';\n\nimport { submitFloatingButton } from '../../transforms/submitFloatingButton';\n\nexport const useFloatingButtonEnter = () => {\n const editor = useEditorRef();\n\n useHotkeys(\n '*',\n (e) => {\n if (e.key === 'Enter' && submitFloatingButton(editor)) {\n e.preventDefault();\n }\n },\n {\n enableOnFormTags: ['INPUT'],\n },\n [],\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { focusEditor, useEditorRef, useHotkeys } from '@frontify/fondue/rte';\n\nimport { floatingButtonActions, floatingButtonSelectors } from './floatingButtonStore';\n\nexport const useFloatingButtonEscape = () => {\n const editor = useEditorRef();\n\n useHotkeys(\n 'escape',\n () => {\n if (floatingButtonSelectors.mode() !== 'edit') {\n return;\n }\n\n if (floatingButtonSelectors.isEditing()) {\n floatingButtonActions.show('edit', editor.id);\n focusEditor(editor, editor.selection ?? undefined);\n return;\n }\n\n floatingButtonActions.reset();\n },\n {\n enableOnFormTags: ['INPUT'],\n enableOnContentEditable: true,\n },\n [],\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type UseVirtualFloatingOptions,\n getPluginOptions,\n getSelectionBoundingClientRect,\n useComposedRef,\n useEditorRef,\n useFocused,\n useHotkeys,\n} from '@frontify/fondue/rte';\nimport { type Ref, useEffect } from 'react';\n\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../../createButtonPlugin';\nimport { triggerFloatingButtonInsert } from '../../utils/triggerFloatingButtonInsert';\n\nimport {\n floatingButtonActions,\n useFloatingButtonEscape,\n useFloatingButtonSelectors,\n useVirtualFloatingButton,\n} from '.';\n\nexport const useFloatingButtonInsert = (\n floatingOptions: UseVirtualFloatingOptions,\n): React.HTMLAttributes<HTMLDivElement> & { ref: Ref<HTMLDivElement> } => {\n const editor = useEditorRef();\n const focused = useFocused();\n const mode = useFloatingButtonSelectors().mode();\n const open = useFloatingButtonSelectors().isOpen(editor.id);\n\n const { triggerFloatingButtonHotkeys } = getPluginOptions<ButtonPlugin>(editor, ELEMENT_BUTTON);\n\n useHotkeys(\n triggerFloatingButtonHotkeys,\n (e) => {\n e.preventDefault();\n\n triggerFloatingButtonInsert(editor, {\n focused,\n });\n },\n {\n enableOnContentEditable: true,\n },\n [focused],\n );\n\n const { update, style, floating } = useVirtualFloatingButton({\n open: open && mode === 'insert',\n getBoundingClientRect: getSelectionBoundingClientRect,\n whileElementsMounted: undefined,\n ...floatingOptions,\n });\n\n // wait for update before focusing input\n useEffect(() => {\n if (open) {\n update();\n }\n floatingButtonActions.updated(open);\n }, [open, update]);\n\n useFloatingButtonEscape();\n\n return {\n style,\n ref: useComposedRef<HTMLElement | null>(floating),\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type UseVirtualFloatingOptions, flip, offset, useVirtualFloating } from '@frontify/fondue/rte';\nimport { type CSSProperties, type Ref } from 'react';\n\nconst OFFSET_Y = 12;\nconst OFFSET_X = -22;\nconst PADDING = 96;\n\nexport const useVirtualFloatingButton = (\n floatingOptions?: UseVirtualFloatingOptions,\n): { style: CSSProperties; update: () => void; floating: Ref<HTMLDivElement> } =>\n useVirtualFloating({\n placement: 'bottom-start',\n middleware: [\n offset({\n mainAxis: OFFSET_Y,\n alignmentAxis: OFFSET_X,\n }),\n flip({\n padding: PADDING,\n }),\n ],\n ...floatingOptions,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\n/**\n * As container queries lack a selector like @max-sm, as a workaround\n * the class is disabled by default and reenabled on bigger container sizes\n */\nconst columnBreakDisablingClassUnderMd =\n '[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @md:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @md:[&_.tw-break-after-column]:!tw-break-after-column @md:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column';\n\nconst columnBreakDisablingClassUnderSm =\n '[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @sm:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @sm:[&_.tw-break-after-column]:!tw-break-after-column @sm:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column';\n\nexport const columnClassMap = {\n 1: 'tw-columns-1',\n 2: `tw-columns-1 @sm:!tw-columns-2 ${columnBreakDisablingClassUnderSm}`,\n 3: `tw-columns-1 @md:!tw-columns-3 ${columnBreakDisablingClassUnderMd}`,\n 4: `tw-columns-1 @md:!tw-columns-4 ${columnBreakDisablingClassUnderMd}`,\n 5: `tw-columns-1 @md:!tw-columns-5 ${columnBreakDisablingClassUnderMd}`,\n};\n\nexport const getResponsiveColumnClasses = (columnCount?: number) => {\n if (!columnCount) {\n return '';\n }\n\n return columnClassMap[columnCount as keyof typeof columnClassMap] || columnClassMap[1];\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { RichTextEditor as FondueRichTextEditor } from '@frontify/fondue/rte';\nimport { memo, useCallback, useEffect, useId, useRef, useState } from 'react';\n\nimport { useIsInViewport } from '../../hooks/useIsInViewport';\n\nimport { SerializedText } from './SerializedText';\nimport { floatingButtonActions, floatingButtonSelectors } from './plugins/ButtonPlugin/components';\nimport { getResponsiveColumnClasses } from './plugins/ColumnBreakPlugin/helpers';\nimport { type RichTextEditorProps } from './types';\n\nconst handleHideExternalFloatingModals = (editorId: string) => {\n if (floatingButtonSelectors.isOpen(editorId)) {\n floatingButtonActions.reset();\n }\n};\n\nconst InternalRichTextEditor = memo(\n ({\n isEnabled,\n value,\n columns,\n gap,\n placeholder,\n plugins,\n onTextChange,\n showSerializedText,\n }: Omit<RichTextEditorProps, 'isEditing'> & { isEnabled: boolean }) => {\n const customClass = getResponsiveColumnClasses(columns);\n const [shouldPreventPageLeave, setShouldPreventPageLeave] = useState(false);\n const editorId = useId();\n\n const handleTextChange = useCallback(\n (newContent: string) => {\n if (newContent !== value) {\n onTextChange?.(newContent);\n }\n setShouldPreventPageLeave(false);\n },\n [onTextChange, value],\n );\n\n const handleValueChange = useCallback(() => setShouldPreventPageLeave(true), []);\n\n useEffect(() => {\n const unloadHandler = (event: BeforeUnloadEvent) => {\n event.preventDefault();\n event.returnValue = 'Unprocessed changes';\n };\n\n if (shouldPreventPageLeave) {\n window.addEventListener('beforeunload', unloadHandler);\n }\n\n return () => window.removeEventListener('beforeunload', unloadHandler);\n }, [shouldPreventPageLeave]);\n\n if (isEnabled) {\n return (\n <FondueRichTextEditor\n id={editorId}\n value={value}\n border={false}\n placeholder={placeholder}\n plugins={plugins}\n onValueChanged={handleValueChange}\n onTextChange={handleTextChange}\n hideExternalFloatingModals={handleHideExternalFloatingModals}\n placeholderOpacity=\"high\"\n />\n );\n }\n return (\n <SerializedText\n value={value}\n gap={gap}\n customClass={customClass}\n show={showSerializedText}\n plugins={plugins}\n />\n );\n },\n);\nInternalRichTextEditor.displayName = 'InternalRichTextEditor';\n\nexport const RichTextEditor = (props: RichTextEditorProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const [hasEnteredViewport, setHasEnteredViewport] = useState(false);\n\n const { isEditing, ...internalRteProps } = props;\n\n const onViewportVisibilityChange = useCallback((isInViewport: boolean) => {\n if (isInViewport) {\n setHasEnteredViewport(true);\n }\n }, []);\n\n useIsInViewport({ ref, disabled: !isEditing, onChange: onViewportVisibilityChange });\n\n useEffect(() => {\n if (!isEditing) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setHasEnteredViewport(false);\n }\n }, [isEditing]);\n\n return (\n <div data-test-id=\"rich-text-editor-container\" className=\"tw-block tw-w-full tw-@container\" ref={ref}>\n <InternalRichTextEditor {...internalRteProps} isEnabled={isEditing && hasEnteredViewport} />\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconPen, IconTrashBin } from '@frontify/fondue/icons';\nimport { FloatingModalWrapper, useLinkOpenButtonState } from '@frontify/fondue/rte';\nimport { type MouseEvent } from 'react';\n\nimport { getUrlFromLinkOrLegacyLink } from '../../../../../Link';\nimport { BlockStyles } from '../../../styles';\nimport { LINK_PLUGIN } from '../../id';\n\ntype EditModalProps = {\n editButtonProps: {\n onClick: () => void;\n };\n unlinkButtonProps: {\n onMouseDown: (e: MouseEvent<HTMLButtonElement>) => void;\n onClick: () => void;\n };\n};\n\nexport const EditModal = ({ editButtonProps, unlinkButtonProps }: EditModalProps) => {\n const { element } = useLinkOpenButtonState();\n const url = element ? getUrlFromLinkOrLegacyLink(element) : '';\n\n return (\n <FloatingModalWrapper data-test-id=\"floating-link-edit\" padding=\"16px\" minWidth=\"400px\">\n <span data-test-id=\"preview-link-flyout\" className=\"tw-flex tw-justify-between tw-items-center tw-gap-2\">\n <a\n data-test-id=\"floating-link-edit-url\"\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n style={BlockStyles[LINK_PLUGIN]}\n className=\"tw-break-all\"\n >\n {url}\n </a>\n <span className=\"tw-flex tw-gap-2\">\n <button\n tabIndex={0}\n data-test-id=\"edit-link-button\"\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n {...editButtonProps}\n >\n <IconPen size={16} />\n </button>\n\n <button\n tabIndex={0}\n data-test-id=\"remove-link-button\"\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n {...unlinkButtonProps}\n >\n <IconTrashBin size={16} />\n </button>\n </span>\n </span>\n </FloatingModalWrapper>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ELEMENT_LINK, type PlateEditor, getAboveNode } from '@frontify/fondue/rte';\n\nimport { type TLinkElement } from '../types';\n\nconst getLinkNode = (editor: PlateEditor, cb: (link: TLinkElement) => string): string => {\n const linkNode = getAboveNode<TLinkElement>(editor, { match: { type: ELEMENT_LINK } });\n\n if (!Array.isArray(linkNode)) {\n return '';\n }\n\n return cb(linkNode[0]);\n};\n\nexport const getLegacyUrl = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.chosenLink?.searchResult?.link || '');\n};\n\nexport const getUrl = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.url || '');\n};\n\nexport const getUrlFromLinkOrLegacyLink = (link: TLinkElement): string => {\n return link.url || link.chosenLink?.searchResult?.link || '';\n};\n\nexport const getUrlFromEditor = (editor: PlateEditor) => {\n return getLinkNode(editor, getUrlFromLinkOrLegacyLink);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n ELEMENT_LINK,\n floatingLinkActions,\n floatingLinkSelectors,\n getPluginOptions,\n submitFloatingLink,\n useEditorRef,\n useHotkeys,\n} from '@frontify/fondue/rte';\nimport { type Dispatch, type MouseEvent, type Reducer, useEffect, useReducer } from 'react';\n\nimport { addHttps } from '../../../../../../helpers';\nimport { isValidUrlOrEmpty } from '../../../../../Link';\nimport { getLegacyUrl, getUrl } from '../../utils';\n\nimport { type InsertModalDispatchType, type InsertModalStateProps } from './types';\n\nconst initialState: InsertModalStateProps = {\n url: '',\n text: '',\n newTab: false,\n};\n\nexport const InsertModalState = (): [InsertModalStateProps, Dispatch<InsertModalDispatchType>] => {\n const [state, dispatch] = useReducer<Reducer<InsertModalStateProps, InsertModalDispatchType>>((state, action) => {\n const { type, payload } = action;\n\n switch (type) {\n case 'NEW_TAB':\n return {\n ...state,\n newTab: true,\n };\n case 'SAME_TAB':\n return {\n ...state,\n newTab: false,\n };\n case 'URL':\n case 'TEXT':\n case 'INIT':\n return {\n ...state,\n ...payload,\n };\n default:\n return state;\n }\n }, initialState);\n\n return [state, dispatch];\n};\n\nexport const useInsertModal = () => {\n const editor = useEditorRef();\n const [state, dispatch] = InsertModalState();\n\n useEffect(() => {\n const legacyUrl = getLegacyUrl(editor);\n const url = getUrl(editor);\n const isNewTab = floatingLinkSelectors.newTab();\n dispatch({\n type: 'INIT',\n payload: {\n text: floatingLinkSelectors.text() || floatingLinkSelectors.url(),\n newTab: isNewTab,\n url: legacyUrl && url === '' ? legacyUrl : floatingLinkSelectors.url(),\n },\n });\n }, [dispatch, editor]);\n\n const onTextChange = (value: string) => {\n dispatch({\n type: 'TEXT',\n payload: { text: value },\n });\n };\n\n const onUrlChange = (value: string) => {\n dispatch({\n type: 'URL',\n payload: { url: value },\n });\n };\n\n const onToggleTab = (checked: boolean) => {\n checked ? dispatch({ type: 'NEW_TAB' }) : dispatch({ type: 'SAME_TAB' });\n };\n\n const onCancel = () => {\n floatingLinkActions.reset();\n };\n\n const onSave = (event: MouseEvent<HTMLButtonElement, globalThis.MouseEvent> | KeyboardEvent | undefined) => {\n if (!isValidUrlOrEmpty(state.url) || !hasValues) {\n return;\n }\n\n floatingLinkActions.text(state.text);\n floatingLinkActions.url(addHttps(state.url));\n floatingLinkActions.newTab(state.newTab);\n\n if (submitFloatingLink(editor)) {\n event?.preventDefault();\n }\n };\n\n const hasValues = state.url !== '' && state.text !== '';\n\n const { appBridge } = getPluginOptions<{ appBridge: AppBridgeBlock }>(editor, ELEMENT_LINK);\n\n useHotkeys(\n 'enter',\n onSave,\n {\n enableOnFormTags: ['INPUT'],\n },\n [],\n );\n\n return { state, onTextChange, onUrlChange, onToggleTab, onCancel, onSave, hasValues, isValidUrlOrEmpty, appBridge };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { InsertModal } from './InsertModal';\nimport { useInsertModal } from './useInsertModal';\n\nexport const InsertLinkModal = () => <InsertModal {...useInsertModal()} testId=\"floating-link-insert\" />;\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type LinkFloatingToolbarState,\n type UseVirtualFloatingOptions,\n flip,\n offset,\n useFloatingLinkEdit,\n useFloatingLinkEditState,\n useFloatingLinkInsert,\n useFloatingLinkInsertState,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { BlockStyles, TextStyles } from '../../../../RichTextEditor/plugins/styles';\n\nimport { EditModal } from './EditLinkModal';\nimport { InsertLinkModal } from './InsertLinkModal/InsertLinkModal';\n\nconst floatingOptions: UseVirtualFloatingOptions = {\n placement: 'bottom-start',\n strategy: 'absolute',\n middleware: [\n offset(12),\n flip({\n padding: 12,\n fallbackPlacements: ['bottom-end', 'top-start', 'top-end'],\n }),\n ],\n};\n\nexport type LinkFloatingToolbarProps = {\n state?: LinkFloatingToolbarState;\n};\n\nexport const CustomFloatingLink = () => {\n const insertState = useFloatingLinkInsertState({\n floatingOptions,\n });\n const { props: insertProps, ref: insertRef, hidden } = useFloatingLinkInsert(insertState);\n\n const editState = useFloatingLinkEditState({\n floatingOptions,\n });\n\n const { props: editProps, ref: editRef, editButtonProps, unlinkButtonProps } = useFloatingLinkEdit(editState);\n\n if (hidden) {\n return null;\n }\n\n const input = <InsertLinkModal />;\n const editContent = editState.isEditing ? (\n input\n ) : (\n <EditModal editButtonProps={editButtonProps} unlinkButtonProps={unlinkButtonProps} />\n );\n\n return (\n <>\n {insertState.isOpen &&\n !editState.isOpen &&\n createPortal(\n <div\n data-is-underlay\n ref={insertRef}\n {...insertProps}\n style={{ ...(insertProps.style as CSSProperties), ...BlockStyles[TextStyles.p] }}\n >\n {input}\n </div>,\n document.body,\n )}\n\n {editState.isOpen &&\n createPortal(\n <div\n data-is-underlay\n ref={editRef}\n {...editProps}\n style={{ ...(editProps.style as CSSProperties), ...BlockStyles[TextStyles.p] }}\n >\n {editContent}\n </div>,\n document.body,\n )}\n </>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconLink } from '@frontify/fondue/icons';\nimport {\n IconStylingWrapper,\n ToolbarButton,\n focusEditor,\n useEditorRef,\n useLinkToolbarButton,\n useLinkToolbarButtonState,\n} from '@frontify/fondue/rte';\nimport { type ReactNode, forwardRef } from 'react';\n\nexport const LinkToolbarButton = forwardRef<HTMLButtonElement, { disabled: boolean; tooltip: ReactNode }>(\n (rootProps, ref) => {\n const editor = useEditorRef();\n const state = useLinkToolbarButtonState();\n const { props } = useLinkToolbarButton(state);\n return (\n <ToolbarButton\n onMouseDown={(event) => {\n event.preventDefault();\n focusEditor(editor, editor.selection ?? editor.prevSelection ?? undefined);\n }}\n ref={ref}\n {...props}\n {...rootProps}\n >\n <IconStylingWrapper icon={<IconLink size={16} />} />\n </ToolbarButton>\n );\n },\n);\n\nLinkToolbarButton.displayName = 'LinkToolbarButton';\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PluginButtonProps,\n getHotkeyByPlatform,\n getTooltip,\n isRangeInSameBlock,\n useEditorState,\n useEventPlateId,\n} from '@frontify/fondue/rte';\n\nimport { LinkToolbarButton } from './LinkToolbarButton';\n\nexport const LinkButton = ({ id, editorId }: PluginButtonProps) => {\n const editor = useEditorState(useEventPlateId(editorId));\n const isEnabled = !!isRangeInSameBlock(editor, {\n at: editor.selection,\n });\n\n return (\n <div data-plugin-id={id}>\n <LinkToolbarButton\n disabled={!isEnabled}\n tooltip={getTooltip(\n isEnabled\n ? `Link\\n${getHotkeyByPlatform('Ctrl+K')}`\n : 'Links can only be set for a single text block.',\n )}\n />\n </div>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateRenderElementProps,\n type TLinkElement as TPlateLinkElement,\n useRichTextEditorContext,\n} from '@frontify/fondue/rte';\n\nimport { LINK_PLUGIN } from '../id';\n\nexport type TLinkElement = TPlateLinkElement & {\n chosenLink?: {\n searchResult?: {\n link?: string;\n };\n openInNewTab?: boolean;\n };\n};\n\nexport const LinkMarkupElementNode = (props: PlateRenderElementProps & { element: TLinkElement }) => {\n const { attributes, children } = props;\n\n const { styles } = useRichTextEditorContext();\n const href = props.element.url || props.element.chosenLink?.searchResult?.link || '';\n const target = props.element.target || '_self';\n\n return (\n <a {...attributes} href={href} target={target} style={styles[LINK_PLUGIN]}>\n {children}\n </a>\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ELEMENT_LINK, MarkupElement, type PlateRenderElementProps } from '@frontify/fondue/rte';\n\nimport { LinkMarkupElementNode, type TLinkElement } from './LinkMarkupElementNode';\n\nexport class LinkMarkupElement extends MarkupElement {\n constructor(\n id = ELEMENT_LINK,\n node: (props: PlateRenderElementProps & { element: TLinkElement }) => JSX.Element = LinkMarkupElementNode,\n ) {\n super(id, node);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n type PlatePlugin,\n Plugin,\n type PluginProps,\n createLinkPlugin as createPlateLinkPlugin,\n createPluginFactory,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { isValidUrl } from '../../../Link';\nimport { BlockStyles } from '../styles';\n\nimport { CustomFloatingLink } from './FloatingLink/CustomFloatingLink';\nimport { LinkButton } from './LinkButton';\nimport { LinkMarkupElement } from './LinkMarkupElement';\nimport { LINK_PLUGIN } from './id';\n\nexport const createLinkPlugin = (appBridge: AppBridgeBlock): PlatePlugin =>\n createPluginFactory({\n ...createPlateLinkPlugin(),\n renderAfterEditable: CustomFloatingLink,\n options: {\n isUrl: isValidUrl,\n rangeBeforeOptions: {\n matchString: ' ',\n skipInvalid: true,\n afterMatch: true,\n },\n triggerFloatingLinkHotkeys: 'meta+k, ctrl+k',\n keepSelectedTextOnPaste: true,\n appBridge,\n },\n })();\n\nexport type LinkPluginProps = PluginProps & { appBridge: AppBridgeBlock };\n\nexport class LinkPlugin extends Plugin {\n public styles: CSSProperties = {};\n private appBridge: AppBridgeBlock;\n constructor({ styles = BlockStyles[LINK_PLUGIN], ...props }: LinkPluginProps) {\n super(LINK_PLUGIN, {\n button: LinkButton,\n markupElement: new LinkMarkupElement(),\n ...props,\n });\n this.styles = styles;\n this.appBridge = props.appBridge;\n }\n\n plugins(): PlatePlugin[] {\n return [createLinkPlugin(this.appBridge)];\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlatePlugin, Plugin, createColumnBreakPlugin, ColumnBreakButton } from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { getResponsiveColumnClasses } from './helpers';\n\nexport const KEY_ELEMENT_BREAK_AFTER_COLUMN = 'breakAfterColumn';\nexport const GAP_DEFAULT = 'normal';\n\nexport class BreakAfterPlugin extends Plugin {\n private columns: number;\n private gap: CSSProperties['gap'];\n private customClass: string | undefined;\n constructor(props?: { columns?: number; gap?: string | number }) {\n super('break-after-plugin', {\n button: ColumnBreakButton,\n ...props,\n });\n this.columns = props?.columns ?? 1;\n this.gap = props?.gap ?? GAP_DEFAULT;\n this.customClass = getResponsiveColumnClasses(this.columns);\n }\n\n plugins(): PlatePlugin[] {\n return [createColumnBreakPlugin(this.columns, this.gap, this.customClass)];\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-custom1-plugin';\n\nexport class Custom1Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.custom1, ...props }: PluginProps = {}) {\n super(TextStyles.custom1, {\n label: 'Custom 1',\n markupElement: new Custom1MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createCustom1Plugin(this.styles)];\n }\n}\n\nclass Custom1MarkupElement extends MarkupElement {\n constructor(id = ID, node = Custom1MarkupElementNode) {\n super(id, node);\n }\n}\n\nconst Custom1MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <p\n {...attributes}\n style={styles}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n >\n {children}\n </p>\n );\n};\n\nconst createCustom1Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.custom1,\n isElement: true,\n deserializeHtml: {\n rules: [{ validClassName: TextStyles.custom1 }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <Custom1MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-custom2-plugin';\n\nexport class Custom2Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.custom2, ...props }: PluginProps = {}) {\n super(TextStyles.custom2, {\n label: 'Custom 2',\n markupElement: new Custom2MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createCustom2Plugin(this.styles)];\n }\n}\n\nclass Custom2MarkupElement extends MarkupElement {\n constructor(id = ID, node = Custom2MarkupElementNode) {\n super(id, node);\n }\n}\n\nconst Custom2MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <p\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </p>\n );\n};\n\nconst createCustom2Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.custom2,\n isElement: true,\n deserializeHtml: {\n rules: [{ validClassName: TextStyles.custom2 }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <Custom2MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n type PlateRenderElementProps,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n TextStyles,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles } from '../styles';\n\nconst ID = 'textstyle-custom3-plugin';\n\nexport class Custom3Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.custom3, ...props }: PluginProps = {}) {\n super(TextStyles.custom3, {\n label: 'Custom 3',\n markupElement: new Custom3MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createCustom3Plugin(this.styles)];\n }\n}\n\nclass Custom3MarkupElement extends MarkupElement {\n constructor(id = ID, node = Custom3MarkupElementNode) {\n super(id, node);\n }\n}\n\nconst Custom3MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <p\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </p>\n );\n};\n\nconst createCustom3Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.custom3,\n isElement: true,\n deserializeHtml: {\n rules: [{ validClassName: TextStyles.custom3 }],\n },\n })({\n component: (props: PlateRenderElementProps) => <Custom3MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n type PlateRenderElementProps,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-heading1-plugin';\nexport class Heading1Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.heading1, ...props }: PluginProps = {}) {\n super(TextStyles.heading1, {\n label: 'Heading 1',\n markupElement: new Heading1MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createHeading1Plugin(this.styles)];\n }\n}\n\nclass Heading1MarkupElement extends MarkupElement {\n constructor(id = ID, node = Heading1MarkupElementNode) {\n super(id, node);\n }\n}\n\nconst Heading1MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <h1\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </h1>\n );\n};\n\nconst createHeading1Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.heading1,\n isElement: true,\n component: Heading1MarkupElementNode,\n deserializeHtml: {\n rules: [{ validNodeName: ['h1', 'H1'] }],\n },\n })({\n component: (props: PlateRenderElementProps) => <Heading1MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-heading2-plugin';\n\nexport class Heading2Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.heading2, ...props }: PluginProps = {}) {\n super(TextStyles.heading2, {\n label: 'Heading 2',\n markupElement: new Heading2MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createHeading2Plugin(this.styles)];\n }\n}\n\nclass Heading2MarkupElement extends MarkupElement {\n constructor(id = ID, node = Heading2MarkupElementNode) {\n super(id, node);\n }\n}\n\nconst Heading2MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <h2\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </h2>\n );\n};\n\nconst createHeading2Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.heading2,\n isElement: true,\n component: Heading2MarkupElementNode,\n deserializeHtml: {\n rules: [{ validNodeName: ['h2', 'H2'] }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <Heading2MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-heading3-plugin';\n\nexport class Heading3Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.heading3, ...props }: PluginProps = {}) {\n super(TextStyles.heading3, {\n label: 'Heading 3',\n markupElement: new Heading3MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createHeading3Plugin(this.styles)];\n }\n}\n\nclass Heading3MarkupElement extends MarkupElement {\n constructor(id = ID, node = Heading3MarkupElementNode) {\n super(id, node);\n }\n}\nconst Heading3MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <h3\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </h3>\n );\n};\n\nconst createHeading3Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.heading3,\n isElement: true,\n component: Heading3MarkupElementNode,\n deserializeHtml: {\n rules: [{ validNodeName: ['h3', 'H3'] }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <Heading3MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-heading4-plugin';\n\nexport class Heading4Plugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.heading4, ...props }: PluginProps = {}) {\n super(TextStyles.heading4, {\n label: 'Heading 4',\n markupElement: new Heading4MarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createHeading4Plugin(this.styles)];\n }\n}\n\nclass Heading4MarkupElement extends MarkupElement {\n constructor(id = ID, node = Heading4MarkupElementNode) {\n super(id, node);\n }\n}\n\nconst Heading4MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <h4\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </h4>\n );\n};\n\nconst createHeading4Plugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.heading4,\n isElement: true,\n component: Heading4MarkupElementNode,\n deserializeHtml: {\n rules: [{ validNodeName: ['h4', 'H4'] }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <Heading4MarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-imageCaption-plugin';\n\nexport class ImageCaptionPlugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.imageCaption, ...props }: PluginProps = {}) {\n super(TextStyles.imageCaption, {\n label: 'Image Caption',\n markupElement: new ImageCaptionMarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createImageCaptionPlugin(this.styles)];\n }\n}\n\nclass ImageCaptionMarkupElement extends MarkupElement {\n constructor(id = ID, node = ImageCaptionMarkupElementNode) {\n super(id, node);\n }\n}\nconst ImageCaptionMarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <p\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </p>\n );\n};\n\nconst createImageCaptionPlugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.imageCaption,\n isElement: true,\n component: ImageCaptionMarkupElementNode,\n deserializeHtml: {\n rules: [{ validClassName: TextStyles.imageCaption }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <ImageCaptionMarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-imageTitle-plugin';\n\nexport class ImageTitlePlugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.imageTitle, ...props }: PluginProps = {}) {\n super(TextStyles.imageTitle, {\n label: 'Image Title',\n markupElement: new ImageTitleMarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createImageTitlePlugin(this.styles)];\n }\n}\n\nclass ImageTitleMarkupElement extends MarkupElement {\n constructor(id = ID, node = ImageTitleMarkupElementNode) {\n super(id, node);\n }\n}\nconst ImageTitleMarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <p\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </p>\n );\n};\n\nconst createImageTitlePlugin = (styles: CSSProperties) =>\n createPluginFactory({\n key: TextStyles.imageTitle,\n isElement: true,\n component: ImageTitleMarkupElementNode,\n deserializeHtml: {\n rules: [{ validClassName: TextStyles.imageTitle }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <ImageTitleMarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createParagraphPlugin as createPlateParagraphPlugin,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nexport class ParagraphPlugin extends Plugin {\n public styles = {};\n constructor({ styles = BlockStyles.p, ...props }: PluginProps = {}) {\n super(TextStyles.p, {\n markupElement: new ParagraphMarkupElement(),\n label: 'Body Text',\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createParagraphPlugin(this.styles)];\n }\n}\n\nexport const PARAGRAPH_CLASSES = 'tw-m-0 tw-px-0 tw-py-0';\n\nexport const ParagraphMarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n const className = merge([align && alignmentClassnames[align], PARAGRAPH_CLASSES, getColumnBreakClasses(element)]);\n return (\n <p {...attributes} className={className} style={styles}>\n {children}\n </p>\n );\n};\n\nexport class ParagraphMarkupElement extends MarkupElement {\n constructor(id = TextStyles.p, node = ParagraphMarkupElementNode) {\n super(id, node);\n }\n}\n\nexport const createParagraphPlugin = (styles: CSSProperties): PlatePlugin =>\n createPluginFactory({\n ...createPlateParagraphPlugin(),\n key: TextStyles.p,\n isElement: true,\n component: ParagraphMarkupElementNode,\n })({\n component: (props: TextStyleRenderElementProps) => <ParagraphMarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MarkupElement,\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type TextStyleRenderElementProps,\n alignmentClassnames,\n createPluginFactory,\n getColumnBreakClasses,\n merge,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { BlockStyles, TextStyles } from '../styles';\n\nconst ID = 'textstyle-quote-plugin';\n\nexport class QuotePlugin extends Plugin {\n public styles: CSSProperties = {};\n constructor({ styles = BlockStyles.quote, ...props }: PluginProps = {}) {\n super(TextStyles.quote, {\n label: 'Quote',\n markupElement: new QuoteMarkupElement(),\n ...props,\n });\n this.styles = styles;\n }\n\n plugins(): PlatePlugin[] {\n return [createQuotePlugin(this.styles)];\n }\n}\n\nclass QuoteMarkupElement extends MarkupElement {\n constructor(id = ID, node = QuoteMarkupElementNode) {\n super(id, node);\n }\n}\n\nexport const QuoteMarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {\n const align = element.align as string;\n return (\n <blockquote\n {...attributes}\n className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}\n style={styles}\n >\n {children}\n </blockquote>\n );\n};\n\nexport const createQuotePlugin = (styles: CSSProperties): PlatePlugin =>\n createPluginFactory({\n key: TextStyles.quote,\n isElement: true,\n component: QuoteMarkupElementNode,\n deserializeHtml: {\n rules: [{ validNodeName: ['blockquote', 'BLOCKQUOTE'] }],\n },\n })({\n component: (props: TextStyleRenderElementProps) => <QuoteMarkupElementNode {...props} styles={styles} />,\n });\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TextStyles } from '../styles';\n\nimport {\n Custom1Plugin,\n Custom2Plugin,\n Custom3Plugin,\n Heading1Plugin,\n Heading2Plugin,\n Heading3Plugin,\n Heading4Plugin,\n ImageCaptionPlugin,\n ImageTitlePlugin,\n ParagraphPlugin,\n QuotePlugin,\n} from '.';\n\nexport const TextStylePluginsWithoutImage = [\n new Heading1Plugin(),\n new Heading2Plugin(),\n new Heading3Plugin(),\n new Heading4Plugin(),\n new Custom1Plugin(),\n new Custom2Plugin(),\n new Custom3Plugin(),\n new QuotePlugin(),\n new ParagraphPlugin(),\n];\n\nexport const TextStylesWithoutImage = [\n TextStyles.heading1,\n TextStyles.heading2,\n TextStyles.heading3,\n TextStyles.heading4,\n TextStyles.custom1,\n TextStyles.custom2,\n TextStyles.custom3,\n TextStyles.quote,\n TextStyles.p,\n];\n\nexport const AllTextStylePlugins = [...TextStylePluginsWithoutImage, new ImageCaptionPlugin(), new ImageTitlePlugin()];\n\nexport const AllTextStyles = [...TextStylesWithoutImage, TextStyles.imageCaption, TextStyles.imageTitle];\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n AlignCenterPlugin,\n AlignJustifyPlugin,\n AlignLeftPlugin,\n AlignRightPlugin,\n AutoformatPlugin,\n BoldPlugin,\n CheckboxListPlugin,\n CodePlugin,\n ItalicPlugin,\n OrderedListPlugin,\n PluginComposer,\n ResetFormattingPlugin,\n SoftBreakPlugin,\n StrikethroughPlugin,\n TextStylePlugin,\n UnderlinePlugin,\n UnorderedListPlugin,\n} from '@frontify/fondue/rte';\n\nimport { ButtonPlugin, LinkPlugin, TextStylePluginsWithoutImage, TextStylesWithoutImage } from '../plugins';\n\nexport const getDefaultPluginsWithLinkChooser = (appBridge: AppBridgeBlock) => {\n return new PluginComposer()\n .setPlugin(\n new SoftBreakPlugin(),\n new TextStylePlugin({\n textStyles: TextStylePluginsWithoutImage,\n }),\n )\n .setPlugin(\n [\n new BoldPlugin(),\n new ItalicPlugin(),\n new UnderlinePlugin(),\n new StrikethroughPlugin(),\n new LinkPlugin({ appBridge }),\n new ButtonPlugin({ appBridge }),\n new CodePlugin(),\n ],\n [\n new AlignLeftPlugin({ validTypes: TextStylesWithoutImage }),\n new AlignCenterPlugin({ validTypes: TextStylesWithoutImage }),\n new AlignRightPlugin({ validTypes: TextStylesWithoutImage }),\n new AlignJustifyPlugin({ validTypes: TextStylesWithoutImage }),\n new UnorderedListPlugin(),\n new CheckboxListPlugin(),\n new OrderedListPlugin(),\n new ResetFormattingPlugin(),\n new AutoformatPlugin(),\n ],\n );\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const THEME_PREFIX = '--f-theme-settings-';\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Color } from '@frontify/fondue';\n\nimport { type SettingBlock } from '../';\n\nimport { BACKGROUND_COLOR_DEFAULT_VALUE } from './defaultValues';\n\ntype BackgroundSettingsType = {\n id?: string;\n defaultValue?: boolean;\n defaultColor?: Color;\n preventDefaultColor?: boolean;\n switchLabel?: string;\n label?: string;\n};\n\n/**\n * Returns background settings: background switch, background color\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @param options.defaultValue Default value for the background switch\n * @param options.defaultColor Default value for the background color\n * @param options.preventDefaultColor Whether the background color should be empty by default\n * @param options.label Label for the background input\n * @param options.switchLabel Label for the background switch\n * @returns {SettingBlock} Returns background settings\n */\n\nexport const getBackgroundSettings = (options?: BackgroundSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasBackground${options.id}` : 'hasBackground';\n const colorId = options?.id ? `backgroundColor${options.id}` : 'backgroundColor';\n const defaultColor = options?.preventDefaultColor\n ? undefined\n : options?.defaultColor || BACKGROUND_COLOR_DEFAULT_VALUE;\n const label = options?.label ? options.label : 'Background';\n const switchLabel = options?.switchLabel ? options.switchLabel : undefined;\n\n return {\n id: hasId,\n label,\n type: 'switch',\n switchLabel,\n defaultValue: !!options?.defaultValue,\n on: [\n {\n id: colorId,\n defaultValue: defaultColor,\n type: 'colorInput',\n },\n ],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type Color,\n MultiInputLayout,\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n minimumNumericalOrPixelRule,\n numericalOrPixelRule,\n} from '../';\n\nimport { BORDER_COLOR_DEFAULT_VALUE, BORDER_WIDTH_DEFAULT_VALUE } from './defaultValues';\nimport { BorderStyle } from './types';\n\n/**\n * Returns border settings: border switch, border style, border width, border color\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @param options.switchLabel Label for the border switch\n * @param options.defaultValue Default value for the border switch\n * @returns {SettingBlock} Returns border settings\n */\n\ntype BorderSettingsType = {\n id?: string;\n defaultValue?: boolean;\n defaultColor?: Color;\n switchLabel?: string;\n};\n\nexport const getBorderSettings = (options?: BorderSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasBorder_${options.id}` : 'hasBorder';\n const selectionId = options?.id ? `borderSelection_${options.id}` : 'borderSelection';\n const styleId = options?.id ? `borderStyle_${options.id}` : 'borderStyle';\n const widthId = options?.id ? `borderWidth_${options.id}` : 'borderWidth';\n const colorId = options?.id ? `borderColor_${options.id}` : 'borderColor';\n const defaultColor = options?.defaultColor || BORDER_COLOR_DEFAULT_VALUE;\n const switchLabel = options?.switchLabel ? options.switchLabel : undefined;\n\n return {\n id: hasId,\n label: 'Border',\n type: 'switch',\n switchLabel,\n defaultValue: !!options?.defaultValue,\n on: [\n {\n id: selectionId,\n type: 'multiInput',\n layout: MultiInputLayout.Columns,\n lastItemFullWidth: true,\n blocks: [\n {\n id: styleId,\n type: 'dropdown',\n defaultValue: BorderStyle.Solid,\n choices: [\n {\n value: BorderStyle.Solid,\n label: BorderStyle.Solid,\n },\n {\n value: BorderStyle.Dotted,\n label: BorderStyle.Dotted,\n },\n {\n value: BorderStyle.Dashed,\n label: BorderStyle.Dashed,\n },\n ],\n },\n {\n id: widthId,\n type: 'input',\n defaultValue: BORDER_WIDTH_DEFAULT_VALUE,\n rules: [\n numericalOrPixelRule,\n minimumNumericalOrPixelRule(0),\n maximumNumericalOrPixelOrAutoRule(500),\n ],\n placeholder: 'e.g. 3px',\n onChange: (bundle) => appendUnit(bundle, widthId),\n },\n {\n id: colorId,\n type: 'colorInput',\n defaultValue: defaultColor,\n },\n ],\n },\n ],\n off: [],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type SettingBlock, appendUnit, numericalOrPixelRule, presetCustomValue } from '../';\n\nimport { Radius, radiusStyleMap } from './types';\n\n/**\n * Returns border radius settings: border radius switch, radius slider, custom radius input\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @param options.dependentSettingId Id of setting which the border radius is dependent on\n * @returns {SettingBlock} Returns border settings\n */\n\ntype BorderRadiusSettingsType = {\n id?: string;\n dependentSettingId?: string;\n radiusStyleMap?: Record<Radius, string>;\n defaultRadius?: Radius;\n};\n\nexport const getBorderRadiusSlider = (id: string, defaultValue: Radius = Radius.None): SettingBlock => ({\n id,\n type: 'segmentedControls',\n defaultValue,\n choices: [\n {\n value: Radius.None,\n label: 'None',\n },\n {\n value: Radius.Small,\n label: 'S',\n },\n {\n value: Radius.Medium,\n label: 'M',\n },\n {\n value: Radius.Large,\n label: 'L',\n },\n ],\n});\n\nexport const getBorderRadiusSettings = (options?: BorderRadiusSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasRadius_${options.id}` : 'hasRadius';\n const valueId = options?.id ? `radiusValue_${options.id}` : 'radiusValue';\n const choiceId = options?.id ? `radiusChoice_${options.id}` : 'radiusChoice';\n const defaultValue = options?.defaultRadius || Radius.None;\n\n return {\n id: hasId,\n label: 'Corner radius',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'Determining how rounded the corners are.',\n show: (bundle) => (options?.dependentSettingId ? !!bundle.getBlock(options.dependentSettingId)?.value : true),\n onChange: (bundle) => presetCustomValue(bundle, choiceId, valueId, options?.radiusStyleMap || radiusStyleMap),\n on: [\n {\n id: valueId,\n type: 'input',\n placeholder: 'e.g. 10px',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, valueId),\n },\n ],\n off: [getBorderRadiusSlider(choiceId, defaultValue)],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { MultiInputLayout, type SettingBlock, appendUnit, numericalOrPixelRule, presetCustomValue } from '../';\n\nimport { getBorderRadiusSlider } from './borderRadius';\nimport { type Radius, radiusStyleMap } from './types';\n\n/**\n * Returns border radius settings: border radius switch, radius slider, custom radius inputs for every corner\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @param options.dependentSettingId Id of setting which the border radius is dependent on\n * @returns {SettingBlock} Returns border settings\n */\n\ntype BorderRadiusSettingsType = {\n id?: string;\n dependentSettingId?: string;\n defaultValue?: Radius;\n};\n\nexport const getExtendedBorderRadiusSettings = (options?: BorderRadiusSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasExtendedCustomRadius_${options.id}` : 'hasExtendedCustomRadius';\n const valueId = options?.id ? `extendedRadiusValue_${options.id}` : 'extendedRadiusValue';\n const choiceId = options?.id ? `extendedRadiusChoice_${options.id}` : 'extendedRadiusChoice';\n const topLeftId = options?.id ? `extendedRadiusTopLeft_${options.id}` : 'extendedRadiusTopLeft';\n const topRightId = options?.id ? `extendedRadiusTopRight_${options.id}` : 'extendedRadiusTopRight';\n const bottomLeftId = options?.id ? `extendedRadiusBottomLeft_${options.id}` : 'extendedRadiusBottomLeft';\n const bottomRightId = options?.id ? `extendedRadiusBottomRight_${options.id}` : 'extendedRadiusBottomRight';\n\n return {\n id: hasId,\n label: 'Corner radius',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'Determining how rounded the corners are.',\n show: (bundle) => (options?.dependentSettingId ? !!bundle.getBlock(options.dependentSettingId)?.value : true),\n onChange: (bundle) => {\n presetCustomValue(bundle, choiceId, topLeftId, radiusStyleMap);\n presetCustomValue(bundle, choiceId, topRightId, radiusStyleMap);\n presetCustomValue(bundle, choiceId, bottomLeftId, radiusStyleMap);\n presetCustomValue(bundle, choiceId, bottomRightId, radiusStyleMap);\n },\n on: [\n {\n id: valueId,\n type: 'multiInput',\n layout: MultiInputLayout.Columns,\n blocks: [\n {\n id: topLeftId,\n type: 'input',\n label: 'Top Left',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, topLeftId),\n },\n {\n id: topRightId,\n type: 'input',\n label: 'Top Right',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, topRightId),\n },\n {\n id: bottomLeftId,\n type: 'input',\n label: 'Bottom Left',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, bottomLeftId),\n },\n {\n id: bottomRightId,\n type: 'input',\n label: 'Bottom Right',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, bottomRightId),\n },\n ],\n },\n ],\n off: [getBorderRadiusSlider(choiceId, options?.defaultValue)],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type SettingBlock, appendUnit, numericalOrPixelRule, presetCustomValue } from '../';\n\nimport { GutterSpacing, gutterSpacingStyleMap } from './types';\n\n/**\n * Returns gutter settings: gutter switch, gutter choices or gutter custom input\n *\n * @param options Options for the settings\n * @param options.id Custom id for the gutters switch\n * @param options.dependentSettingId Id of the dependent setting\n * @param options.spacingChoiceId Id of the spacing choice\n * @param options.defaultValueChoices Default value for the spacing choice\n * @returns {SettingBlock} Returns the gutter settings\n */\n\ntype GutterSettingsType = {\n id?: string;\n dependentSettingId?: string;\n spacingChoiceId?: string;\n spacingCustomId?: string;\n defaultValueChoices?: GutterSpacing;\n};\n\nexport const getGutterSettings = (options?: GutterSettingsType): SettingBlock => {\n const id = options?.id ? options.id : 'hasCustomSpacing';\n const dependentSettingId = options?.dependentSettingId ? options.dependentSettingId : 'columns';\n const spacingChoiceId = options?.spacingChoiceId ? options.spacingChoiceId : 'spacingChoice';\n const spacingCustomId = options?.spacingCustomId ? options.spacingCustomId : 'spacingCustom';\n const defaultValueChoices = options?.defaultValueChoices ? options.defaultValueChoices : GutterSpacing.M;\n\n return {\n id,\n type: 'switch',\n defaultValue: false,\n switchLabel: 'Custom',\n label: 'Gutter',\n info: 'An official nerds term for ‘gap’',\n onChange: (bundle) => presetCustomValue(bundle, spacingChoiceId, spacingCustomId, gutterSpacingStyleMap),\n show: (bundle) => bundle.getBlock(dependentSettingId)?.value !== '1',\n on: [\n {\n id: spacingCustomId,\n type: 'input',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, spacingCustomId),\n },\n ],\n off: [\n {\n id: spacingChoiceId,\n type: 'slider',\n defaultValue: defaultValueChoices,\n choices: [\n {\n value: GutterSpacing.Auto,\n label: 'Auto',\n },\n {\n value: GutterSpacing.S,\n label: 'S',\n },\n {\n value: GutterSpacing.M,\n label: 'M',\n },\n {\n value: GutterSpacing.L,\n label: 'L',\n },\n ],\n },\n ],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n numericalOrPixelRule,\n presetCustomValue,\n} from '../';\n\nimport { MARGIN_DEFAULT_PLACEHOLDER } from './defaultValues';\nimport { Margin, marginStyleMap } from './types';\n\ntype MarginSettingsType = {\n id?: string;\n marginStyleMap?: Record<Margin, string>;\n};\n\n/**\n * Returns margin settings: margin switch, margin slider, custom margin input\n *\n * @param {string} id Custom suffix for the setting ids\n * @returns {SettingBlock} Returns margin settings\n */\nexport const getMarginSlider = (id: string): SettingBlock => ({\n id,\n type: 'segmentedControls',\n defaultValue: Margin.None,\n choices: [\n {\n value: Margin.None,\n label: 'None',\n },\n {\n value: Margin.Small,\n label: 'S',\n },\n {\n value: Margin.Medium,\n label: 'M',\n },\n {\n value: Margin.Large,\n label: 'L',\n },\n ],\n});\n\nexport const getMarginSettings = (options?: MarginSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasCustomMarginValue_${options?.id}` : 'hasCustomMarginValue';\n const valueId = options?.id ? `marginValue_${options?.id}` : 'marginValue';\n const choiceId = options?.id ? `marginChoice_${options?.id}` : 'marginChoice';\n\n return {\n id: hasId,\n label: 'Margin',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'The spacing around UI elements to create more space',\n onChange: (bundle) => presetCustomValue(bundle, choiceId, valueId, options?.marginStyleMap || marginStyleMap),\n on: [\n {\n id: valueId,\n type: 'input',\n placeholder: MARGIN_DEFAULT_PLACEHOLDER,\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n onChange: (bundle) => appendUnit(bundle, valueId),\n },\n ],\n off: [getMarginSlider(choiceId)],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MultiInputLayout,\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n numericalOrPixelRule,\n presetCustomValue,\n} from '../';\n\nimport { MARGIN_DEFAULT_PLACEHOLDER } from './defaultValues';\nimport { getMarginSlider } from './margin';\nimport { marginStyleMap } from './types';\n\ntype MarginSettingsType = {\n id?: string;\n};\n\n/**\n * Returns margin settings: margin switch, margin slider, custom margin input for every direction\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @returns {SettingBlock} Returns margin settings\n */\nexport const getMarginExtendedSettings = (options?: MarginSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasExtendedCustomMargin_${options?.id}` : 'hasExtendedCustomMargin';\n const valueId = options?.id ? `extendedMarginValues_${options?.id}` : 'extendedMarginValues';\n const choiceId = options?.id ? `extendedMarginChoice_${options?.id}` : 'extendedMarginChoice';\n const topId = options?.id ? `extendedMarginTop_${options?.id}` : 'extendedMarginTop';\n const leftId = options?.id ? `extendedMarginLeft_${options?.id}` : 'extendedMarginLeft';\n const rightId = options?.id ? `extendedMarginRight_${options?.id}` : 'extendedMarginRight';\n const bottomId = options?.id ? `extendedMarginBottom_${options?.id}` : 'extendedMarginBottom';\n\n return {\n id: hasId,\n label: 'Margin',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'The spacing around UI elements to create more negative space',\n onChange: (bundle) => {\n presetCustomValue(bundle, choiceId, topId, marginStyleMap);\n presetCustomValue(bundle, choiceId, leftId, marginStyleMap);\n presetCustomValue(bundle, choiceId, rightId, marginStyleMap);\n presetCustomValue(bundle, choiceId, bottomId, marginStyleMap);\n },\n on: [\n {\n id: valueId,\n type: 'multiInput',\n layout: MultiInputLayout.Spider,\n blocks: [\n {\n id: topId,\n type: 'input',\n label: 'Top',\n placeholder: MARGIN_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, topId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n {\n id: leftId,\n type: 'input',\n label: 'Left',\n placeholder: MARGIN_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, leftId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n {\n id: rightId,\n type: 'input',\n label: 'Right',\n placeholder: MARGIN_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, rightId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n {\n id: bottomId,\n type: 'input',\n label: 'Bottom',\n placeholder: MARGIN_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, bottomId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n ],\n },\n ],\n off: [getMarginSlider(choiceId)],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n numericalOrPixelRule,\n presetCustomValue,\n} from '../';\n\nimport { PADDING_DEFAULT_PLACEHOLDER } from './defaultValues';\nimport { Padding, paddingStyleMap } from './types';\n\ntype PaddingSettingsType = {\n id?: string;\n paddingStyleMap?: Record<Padding, string>;\n};\n\n/**\n * Returns padding settings: padding switch, padding slider, custom padding input\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @returns {SettingBlock} Returns padding settings\n */\nexport const getPaddingSlider = (id: string): SettingBlock => ({\n id,\n type: 'segmentedControls',\n defaultValue: Padding.Small,\n choices: [\n {\n value: Padding.None,\n label: 'None',\n },\n {\n value: Padding.Small,\n label: 'S',\n },\n {\n value: Padding.Medium,\n label: 'M',\n },\n {\n value: Padding.Large,\n label: 'L',\n },\n ],\n});\n\nexport const getPaddingSettings = (options?: PaddingSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasCustomPaddingValue_${options?.id}` : 'hasCustomPaddingValue';\n const valueId = options?.id ? `paddingValue_${options?.id}` : 'paddingValue';\n const choiceId = options?.id ? `paddingChoice_${options?.id}` : 'paddingChoice';\n\n return {\n id: hasId,\n label: 'Padding',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'The spacing around UI elements to create more negative space',\n onChange: (bundle) => presetCustomValue(bundle, choiceId, valueId, options?.paddingStyleMap || paddingStyleMap),\n on: [\n {\n id: valueId,\n type: 'input',\n placeholder: PADDING_DEFAULT_PLACEHOLDER,\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n onChange: (bundle) => appendUnit(bundle, valueId),\n },\n ],\n off: [getPaddingSlider(choiceId)],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n MultiInputLayout,\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n numericalOrPixelRule,\n presetCustomValue,\n} from '../';\n\nimport { PADDING_DEFAULT_PLACEHOLDER } from './defaultValues';\nimport { getPaddingSlider } from './padding';\nimport { paddingStyleMap } from './types';\n\ntype PaddingSettingsType = {\n id?: string;\n};\n\n/**\n * Returns padding settings: padding switch, padding slider, custom padding input for every direction\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @returns {SettingBlock} Returns padding settings\n */\nexport const getPaddingExtendedSettings = (options?: PaddingSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasExtendedCustomPadding_${options?.id}` : 'hasExtendedCustomPadding';\n const valueId = options?.id ? `extendedPaddingValues_${options?.id}` : 'extendedPaddingValues';\n const choiceId = options?.id ? `extendedPaddingChoice_${options?.id}` : 'extendedPaddingChoice';\n const topId = options?.id ? `extendedPaddingTop_${options?.id}` : 'extendedPaddingTop';\n const leftId = options?.id ? `extendedPaddingLeft_${options?.id}` : 'extendedPaddingLeft';\n const rightId = options?.id ? `extendedPaddingRight_${options?.id}` : 'extendedPaddingRight';\n const bottomId = options?.id ? `extendedPaddingBottom_${options?.id}` : 'extendedPaddingBottom';\n\n return {\n id: hasId,\n label: 'Padding',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'The spacing around UI elements to create more negative space',\n onChange: (bundle) => {\n presetCustomValue(bundle, choiceId, topId, paddingStyleMap);\n presetCustomValue(bundle, choiceId, leftId, paddingStyleMap);\n presetCustomValue(bundle, choiceId, rightId, paddingStyleMap);\n presetCustomValue(bundle, choiceId, bottomId, paddingStyleMap);\n },\n on: [\n {\n id: valueId,\n type: 'multiInput',\n layout: MultiInputLayout.Spider,\n blocks: [\n {\n id: topId,\n type: 'input',\n label: 'Top',\n placeholder: PADDING_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, topId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n {\n id: leftId,\n type: 'input',\n label: 'Left',\n placeholder: PADDING_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, leftId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n {\n id: rightId,\n type: 'input',\n label: 'Right',\n placeholder: PADDING_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, rightId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n {\n id: bottomId,\n type: 'input',\n label: 'Bottom',\n placeholder: PADDING_DEFAULT_PLACEHOLDER,\n onChange: (bundle) => appendUnit(bundle, bottomId),\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n },\n ],\n },\n ],\n off: [getPaddingSlider(choiceId)],\n };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type SettingBlock } from '..';\n\nimport { Security } from './types';\n\n/**\n * Returns the downloadable security settings.\n *\n * @param {string} id custom id for the setting block\n * @param {string} globalControlId custom id for the global control setting block\n *\n * @returns {SettingBlock} Returns downloadable security settings.\n */\n\ntype SecurityDownloadableSettingType = {\n id?: string;\n globalControlId?: string;\n};\n\nexport const getSecurityDownloadableSetting = (options?: SecurityDownloadableSettingType): SettingBlock => {\n const securityId = getSecurityGlobalControlId(options?.globalControlId);\n return {\n id: options?.id ? options.id : 'downloadable',\n type: 'switch',\n defaultValue: false,\n label: 'Downloadable',\n show: (bundle) => bundle.getBlock(securityId)?.value === Security.Custom,\n };\n};\n\nexport const getSecurityGlobalControlId = (id?: string): string => {\n return id || 'security';\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type SettingBlock, createFooter } from '..';\n\nimport { getSecurityGlobalControlId } from './securityDownloadable';\nimport { Security } from './types';\n\n/**\n * Returns segment controls for global security settings.\n *\n * @param {string} id custom id for the setting block\n *\n * @returns {SettingBlock} Returns\n */\n\nexport const getSecurityGlobalControlSetting = (id?: string): SettingBlock[] => {\n const securityId = getSecurityGlobalControlId(id);\n return [\n {\n id: securityId,\n type: 'segmentedControls',\n defaultValue: Security.Global,\n choices: [\n {\n value: Security.Global,\n label: 'Global Settings',\n },\n {\n value: Security.Custom,\n label: 'Custom',\n },\n ],\n },\n {\n id: 'globalSettingsInfo',\n type: 'notification',\n footer: createFooter({\n label: 'Change global settings [here].',\n replace: { here: { event: 'general-settings.open' } },\n }),\n },\n ];\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport './styles.css';\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n type AssetInputBlock as AssetInputBlockSidebarSettings,\n type BaseBlock as BaseBlockSidebarSettings,\n type Bundle as BundleSidebarSettings,\n type ChecklistBlock as ChecklistBlockSidebarSettings,\n type ChoicesType as ChoicesTypeSidebarSettings,\n type ColorInputBlock as ColorInputBlockSidebarSettings,\n type DropdownBlock as DropdownBlockSidebarSettings,\n type DynamicSettingBlock as DynamicSettingBlockSidebarSettings,\n type DynamicSupportedBlock as DynamicSupportedBlockSidebarSettings,\n type FontInputBlock as FontInputBlockSidebarSettings,\n type InputBlock as InputBlockSidebarSettings,\n type LegacyAssetInputBlock as LegacyAssetInputBlockSidebarSettings,\n type LinkBlock as LinkBlockSidebarSettings,\n type LinkChooserBlock as LinkChooserBlockSidebarSettings,\n type MultiInputBlock as MultiInputBlockSidebarSettings,\n type NotificationBlock as NotificationBlockSidebarSettings,\n type SectionHeadingBlock as SectionHeadingBlockSidebarSettings,\n type SegmentedControlsBlock as SegmentedControlsBlockSidebarSettings,\n type SettingBlock as SettingBlockSidebarSettings,\n type SimpleSettingBlock as SimpleSettingBlockSidebarSettings,\n type SwitchBlock as SwitchBlockSidebarSettings,\n type TemplateInputBlock as TemplateInputBlockSidebarSettings,\n type TextareaBlock as TextareaBlockSidebarSettings,\n type ValueOrPromisedValue as ValueOrPromisedValueSidebarSettings,\n} from '@frontify/sidebar-settings';\nimport { type FC } from 'react';\n\nexport * from '@frontify/sidebar-settings';\n\nexport type AssetInputBlock = AssetInputBlockSidebarSettings<AppBridgeBlock>;\nexport type BaseBlock<T = undefined> = BaseBlockSidebarSettings<AppBridgeBlock, T>;\nexport type Bundle = BundleSidebarSettings<AppBridgeBlock>;\nexport type ChecklistBlock = ChecklistBlockSidebarSettings<AppBridgeBlock>;\nexport type ChoicesType = ChoicesTypeSidebarSettings<AppBridgeBlock>;\nexport type ColorInputBlock = ColorInputBlockSidebarSettings<AppBridgeBlock>;\nexport type DropdownBlock = DropdownBlockSidebarSettings<AppBridgeBlock>;\nexport type DynamicSettingBlock<Block extends DynamicSupportedBlock = DynamicSupportedBlock> =\n DynamicSettingBlockSidebarSettings<AppBridgeBlock, Block>;\nexport type DynamicSupportedBlock = DynamicSupportedBlockSidebarSettings<AppBridgeBlock>;\nexport type FontInputBlock = FontInputBlockSidebarSettings<AppBridgeBlock>;\nexport type InputBlock = InputBlockSidebarSettings<AppBridgeBlock>;\nexport type LegacyAssetInputBlock = LegacyAssetInputBlockSidebarSettings<AppBridgeBlock>;\nexport type LinkBlock = LinkBlockSidebarSettings<AppBridgeBlock>;\nexport type LinkChooserBlock = LinkChooserBlockSidebarSettings<AppBridgeBlock>;\nexport type MultiInputBlock = MultiInputBlockSidebarSettings<AppBridgeBlock>;\nexport type NotificationBlock = NotificationBlockSidebarSettings<AppBridgeBlock>;\nexport type SectionHeadingBlock = SectionHeadingBlockSidebarSettings<AppBridgeBlock>;\nexport type SegmentedControlsBlock = SegmentedControlsBlockSidebarSettings<AppBridgeBlock>;\nexport type SettingBlock = SettingBlockSidebarSettings<AppBridgeBlock>;\nexport type SimpleSettingBlock = SimpleSettingBlockSidebarSettings<AppBridgeBlock>;\nexport type SwitchBlock = SwitchBlockSidebarSettings<AppBridgeBlock>;\nexport type TemplateInputBlock = TemplateInputBlockSidebarSettings<AppBridgeBlock>;\nexport type TextareaBlock = TextareaBlockSidebarSettings<AppBridgeBlock>;\nexport type ValueOrPromisedValue<T> = ValueOrPromisedValueSidebarSettings<AppBridgeBlock, T>;\n\nexport enum Sections {\n Main = 'main',\n Basics = 'basics',\n Layout = 'layout',\n Style = 'style',\n Security = 'security',\n Targets = 'targets',\n}\n\nexport type BlockSettingsStructureExport = {\n [Sections.Main]?: SettingBlock[];\n [Sections.Basics]?: SettingBlock[];\n [Sections.Layout]?: SettingBlock[];\n [Sections.Style]?: SettingBlock[];\n [Sections.Security]?: SettingBlock[];\n} & { [customSectionName: string]: SettingBlock[] };\n\nexport type BlockProps = {\n /**\n * The Frontify App Bridge provides an interface to the Frontify app internals.\n * {@link https://developer.frontify.com/document/2569#/details-concepts-1/content-blocks/introducing-the-app-bridge}\n */\n appBridge: AppBridgeBlock;\n};\n\nexport type BlockConfigExport = {\n /**\n * Block component to render.\n * {@link https://developer.frontify.com/document/2569#/details-concepts-1/content-blocks}\n */\n block: FC<BlockProps>;\n /**\n * Contains the block settings and its structure.\n * {@link https://developer.frontify.com/document/2569#/details-concepts-1/block-settings-1}\n */\n settings: ReturnType<typeof defineSettings>;\n /**\n * Block lifecycle hook ran before the block gets added in the Guideline.\n * The hook support both synchronous or asynchronous execution.\n * {@link https://developer.frontify.com/document/2569#/details-concepts-1/block-lifecycle/on-block-creation}\n */\n onBlockCreated?:\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => void)\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => Promise<void>);\n /**\n * Block lifecycle hook ran before the block gets deleted from the Guideline.\n * The hook support both synchronous or asynchronous execution.\n * {@link https://developer.frontify.com/document/2569#/details-concepts-1/block-lifecycle/on-block-deletion}\n */\n onBlockDeleted?:\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => void)\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => Promise<void>);\n};\n\n/**\n * Type helper to make it easier to export a theme, accepts a direct {@link BlockConfigExport} object.\n */\nexport const defineBlock = (config: BlockConfigExport): BlockConfigExport => config;\n\n/**\n * Type helper to make it easier to export block's settings structure, accepts a direct {@link BlockSettingsStructureExport} object\n * or a function return a direct {@link BlockSettingsStructureExport} or a function returning a Promise of {@link BlockSettingsStructureExport}.\n */\nexport const defineSettings = <\n T extends\n | BlockSettingsStructureExport\n | (() => Promise<BlockSettingsStructureExport>)\n | (() => BlockSettingsStructureExport),\n>(\n settingsStructure: T,\n): T => settingsStructure;\n\nexport * from './components';\nexport * from './helpers';\nexport * from './hooks';\nexport * from './settings';\nexport * from './utilities';\n"],"names":["joinClassNames","classNames","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","item","_a","LoadingCircle","IconExclamationMarkTriangle","Fragment","Flyout","isOpen","Dropdown","toShortRgba","color","isRgbaLongFormat","value","mapToShortFormat","alpha","isDark","threshold","inputColor","parsedColor","TinyColor","toHex8String","toHexString","toRgbaString","setAlpha","toColorObject","colorString","r","g","b","a","getReadableColor","textColor","backgroundColor","inputTextColor","inputBackgroundColor","parsedTextColor","parsedBackgroundColor","readability","moveItemInArray","array","from","to","newArray","toIndex","slice","getBackgroundColorStyles","BACKGROUND_COLOR_DEFAULT_VALUE","BORDER_COLOR_DEFAULT_VALUE","BORDER_WIDTH_DEFAULT_VALUE","PADDING_DEFAULT_PLACEHOLDER","MARGIN_DEFAULT_PLACEHOLDER","BorderStyle","borderStyleMap","Radius","radiusStyleMap","Padding","paddingStyleMap","Margin","marginStyleMap","Security","GutterSpacing","gutterSpacingStyleMap","getBorderStyles","style","borderWidth","getRadiusStyles","radiusChoice","hasRadius","radiusValue","DragPreviewContext","createContext","DragPreviewContextProvider","children","isDragPreview","useDragPreviewContext","useContext","MultiFlyoutContext","MultiFlyoutContextProvider","openFlyoutIds","setOpenFlyoutIds","memoizedContext","useMultiFlyoutContext","useMultiFlyoutState","flyoutId","onOpenChange","isFlyoutOpen","currentIds","filteredIds","id","useAttachmentOperations","attachmentKey","blockAssetBundle","blockAssets","addAssetIdsToKey","deleteAssetIdsFromKey","updateAssetIdsFromKey","attachments","newAssets","asset","assetToDelete","attachmentToReplace","newAsset","newAssetIds","attachment","assets","useAttachments","appBridge","onAttachmentsAdd","onAttachmentDelete","onAttachmentReplace","onAttachmentsSorted","useBlockAssets","AttachmentsContext","AttachmentsProvider","assetId","attachmentContext","AttachmentOperationsProvider","useAttachmentsContext","context","withAttachmentsProvider","Component","wrappedComponent","props","directions","KeyboardCode","customCoordinatesGetterFactory","columnGap","rowGap","currentCoordinates","activeNode","keyboardCodes","useDndSensors","keyboardSensorOptions","useSensors","useSensor","PointerSensor","KeyboardSensor","getDecorator","type","IconImage24","IconPlayFrame24","IconMusicNote24","IconDocument24","AttachmentItem","forwardRef","isEditing","draggableProps","transformStyle","isDragging","isOverlay","onDelete","onReplaceWithBrowse","onReplaceWithUpload","onDownload","ref","selectedAsset","setSelectedAsset","openFileDialog","selectedFiles","useFileInput","uploadFile","uploadResults","doneAll","useAssetUpload","focusProps","isFocusVisible","useFocusRing","useEffect","showLoadingCircle","FOCUS_STYLE","IconGrabHandle20","Button","e","IconPen","IconTrashBin","SortableAttachmentItem","attributes","listeners","setNodeRef","transform","transition","useSortable","AttachmentsButtonTrigger","IconPaperclip16","IconCaretDown12","Attachments","onBrowse","onUpload","onSorted","TriggerComponent","internalItems","setInternalItems","isFlyoutOpenInternal","setIsFlyoutOpenInternal","sensors","draggedAssetId","setDraggedAssetId","isUploadLoading","setIsUploadLoading","assetIdsLoading","setAssetIdsLoading","setSelectedFiles","useEditorState","openAssetChooser","closeAssetChooser","useAssetChooser","isControllingStateExternally","draggedItem","handleFlyoutOpenChange","stateSetter","onOpenAssetChooser","result","internalItem","onReplaceItemWithBrowse","toReplace","onReplaceItemWithUpload","uploadedAsset","handleDragStart","active","handleDragEnd","over","oldIndex","newIndex","sortedItems","arrayMove","autoFocusModifier","Tooltip","DndContext","closestCenter","restrictToVerticalAxis","SortableContext","rectSortingStrategy","AssetInput","AssetInputSize","fileList","getToolbarButtonClassNames","cursor","forceActiveStyle","FOCUS_VISIBLE_STYLE","BaseToolbarButton","dataTestId","AttachmentsToolbarButtonTrigger","DEFAULT_ATTACHMENTS_BUTTON_ID","AttachmentsToolbarButton","useMemoizedId","DEFAULT_DRAG_TOOLTIP","DEFAULT_DRAGGING_TOOLTIP","ToolbarButtonTooltip","content","open","disabled","DragHandleToolbarButton","tooltip","setActivatorNodeRef","FlyoutToolbarButton","flyoutFooter","flyoutHeader","DEFAULT_MENU_BUTTON_ID","MenuToolbarButton","IconDotsHorizontal","block","blockIndex","itemIndex","ToolbarButton","ToolbarSegment","Toolbar","BlockItemWrapper","memo","toolbarItems","shouldHideWrapper","shouldHideComponent","shouldFillContainer","outlineOffset","shouldBeShown","showAttachments","wrapperRef","shouldToolbarBeVisible","DownloadButton","ariaLabel","isFocused","IconArrowCircleDown16","useIsInViewport","onChange","isInViewport","intersectionObserver","entry","SerializedText","gap","customClass","show","plugins","html","setHtml","htmlContent","serializeRawToHtmlAsync","floatingButtonStore","createStore","set","mode","editorId","state","floatingButtonActions","floatingButtonSelectors","useFloatingButtonSelectors","hasRichTextValue","string","hasText","child","json","convertToRteValue","textStyle","text","align","isDownloadable","security","downloadable","globalAssetDownloadEnabled","mapAppBridgeColorPalettesToFonduePalettes","colorPalettes","mapAppBridgeColorPaletteToFonduePalette","colorPalette","mapColor","isV4Color","title","revision","getLinkNode","editor","cb","linkNode","getAboveNode","ELEMENT_LINK","getLegacyUrl","link","_b","getUrl","getUrlFromLinkOrLegacyLink","getLinkFromEditor","relativeUrlRegex","addHttps","url","isValidUrl","parsedUrl","isValidUrlOrEmpty","withButton","apply","normalizeNode","operation","range","isCollapsed","getPluginType","ELEMENT_BUTTON","path","newPoint","isStartPoint","getPreviousNodeEndPoint","isEndPoint","getNextNodeStartPoint","node","nextPoint","select","nextPath","Path","insertNodes","withRemoveEmptyNodes","mockPlugin","insertButton","createButtonNodeOptions","options","createButtonNode","submitFloatingButton","isUrl","forceSubmit","getPluginOptions","buttonStyle","target","upsertButton","_url","focusEditor","unwrapButton","withoutNormalizing","splitNodes","n","isElement","_c","_d","_e","_f","unwrapNodes","insertTextInButton","insertNodesOptions","at","buttonAbove","isDefined","editButtonUrlAndTarget","buttonEntry","findNode","buttonNode","buttonPath","shouldReplaceText","shouldReplaceButtonText","isExpanded","anchorAndFocusInButton","removeNodes","getNodeProps","leaf","getNodeLeaf","getEditorString","wrapButton","upsertButtonText","setNodes","newButton","newButtonNode","newButtonPath","firstText","replaceNodeChildren","wrapNodes","getUrlFromEditor","triggerFloatingButton","focused","triggerFloatingButtonEdit","triggerFloatingButtonInsert","isRangeAcrossBlocks","someNode","DefaultButtonStyles","BlockButtonStyles","ButtonMarkupElementNode","href","HoverableButtonLink","styles","hovered","setHovered","ButtonMarkupElement","MarkupElement","ButtonToolbarButton","rootProps","useEditorRef","IconStylingWrapper","IconButton","ButtonButton","useEventPlateId","isEnabled","isRangeInSameBlock","isLink","getTooltip","getHotkeyByPlatform","LINK_PLUGIN","TextStyles","BlockStyles","EditModal","FloatingModalWrapper","filterDocumentSectionsWithUnreadableTitles","sections","section","LoadingIndicator","SectionLink","selectedUrl","onSelectUrl","isActive","merge","IconDocumentText","PageLink","page","itemsToExpandInitially","getDocumentSectionsByDocumentPageId","setIsExpanded","documentSections","setDocumentSections","sectionsWithReadableTitles","hasSections","PageLinks","documentId","getDocumentPagesByDocumentId","pages","setPages","setIsLoading","pagesArray","hasPages","_pages","pagesWithCategories","pagesWithoutCategories","DocumentLink","document","IconColorFan","DocumentLinks","getAllDocuments","documents","setDocuments","setItemsToExpandInitially","findLocationOfSelectedUrl","_documents","itemsToExpand","LinkSelector","onUrlChange","buttonSize","isModalOpen","setIsModalOpen","setSelectedUrl","onPressEnter","saveLink","dialogProps","Dialog","IconLink","ScrollArea","LinkInput","onToggleTab","placeholder","newTab","required","info","hideInternalLinkButton","isUrlValid","internalIsValidUrlOrEmpty","FormControl","TextInput","documentPageId","Checkbox","Label","InsertModal","onTextChange","onCancel","onSave","hasValues","testId","IconCheckMark","getButtonStyle","initialState","InsertModalState","dispatch","useReducer","action","payload","useInsertModal","onButtonStyleChange","checked","urlToSave","useHotkeys","InsertButtonModal","modalProps","HoverableButton","getStyles","floatingOptions","offset","flip","CustomFloatingButton","insertRef","insertProps","useFloatingButtonInsert","editRef","editProps","useFloatingButtonEdit","input","editContent","createPortal","BUTTON_PLUGIN","createButtonPlugin","createPluginFactory","element","_editor","el","ButtonPlugin","Plugin","__publicField","version","useEditorVersion","triggerFloatingButtonHotkeys","getBoundingClientRect","getRangeBoundingClientRect","getStartPoint","getEndPoint","getDefaultBoundingClientRect","update","floating","useVirtualFloatingButton","useFloatingButtonEnter","useFloatingButtonEscape","useComposedRef","useFocused","getSelectionBoundingClientRect","OFFSET_Y","OFFSET_X","PADDING","useVirtualFloating","columnBreakDisablingClassUnderMd","columnBreakDisablingClassUnderSm","columnClassMap","getResponsiveColumnClasses","columnCount","handleHideExternalFloatingModals","InternalRichTextEditor","columns","showSerializedText","shouldPreventPageLeave","setShouldPreventPageLeave","useId","handleTextChange","newContent","handleValueChange","unloadHandler","FondueRichTextEditor","RichTextEditor","hasEnteredViewport","setHasEnteredViewport","internalRteProps","onViewportVisibilityChange","editButtonProps","unlinkButtonProps","useLinkOpenButtonState","legacyUrl","isNewTab","floatingLinkSelectors","floatingLinkActions","submitFloatingLink","InsertLinkModal","CustomFloatingLink","insertState","useFloatingLinkInsertState","hidden","useFloatingLinkInsert","editState","useFloatingLinkEditState","useFloatingLinkEdit","LinkToolbarButton","useLinkToolbarButtonState","useLinkToolbarButton","LinkButton","LinkMarkupElementNode","useRichTextEditorContext","LinkMarkupElement","createLinkPlugin","createPlateLinkPlugin","LinkPlugin","KEY_ELEMENT_BREAK_AFTER_COLUMN","GAP_DEFAULT","BreakAfterPlugin","ColumnBreakButton","createColumnBreakPlugin","ID","Custom1Plugin","Custom1MarkupElement","createCustom1Plugin","Custom1MarkupElementNode","alignmentClassnames","getColumnBreakClasses","Custom2Plugin","Custom2MarkupElement","createCustom2Plugin","Custom2MarkupElementNode","Custom3Plugin","Custom3MarkupElement","createCustom3Plugin","Custom3MarkupElementNode","Heading1Plugin","Heading1MarkupElement","createHeading1Plugin","Heading1MarkupElementNode","Heading2Plugin","Heading2MarkupElement","createHeading2Plugin","Heading2MarkupElementNode","Heading3Plugin","Heading3MarkupElement","createHeading3Plugin","Heading3MarkupElementNode","Heading4Plugin","Heading4MarkupElement","createHeading4Plugin","Heading4MarkupElementNode","ImageCaptionPlugin","ImageCaptionMarkupElement","createImageCaptionPlugin","ImageCaptionMarkupElementNode","ImageTitlePlugin","ImageTitleMarkupElement","createImageTitlePlugin","ImageTitleMarkupElementNode","ParagraphPlugin","ParagraphMarkupElement","createParagraphPlugin","PARAGRAPH_CLASSES","ParagraphMarkupElementNode","className","createPlateParagraphPlugin","QuotePlugin","QuoteMarkupElement","createQuotePlugin","QuoteMarkupElementNode","TextStylePluginsWithoutImage","TextStylesWithoutImage","AllTextStylePlugins","AllTextStyles","getDefaultPluginsWithLinkChooser","PluginComposer","SoftBreakPlugin","TextStylePlugin","BoldPlugin","ItalicPlugin","UnderlinePlugin","StrikethroughPlugin","CodePlugin","AlignLeftPlugin","AlignCenterPlugin","AlignRightPlugin","AlignJustifyPlugin","UnorderedListPlugin","CheckboxListPlugin","OrderedListPlugin","ResetFormattingPlugin","AutoformatPlugin","THEME_PREFIX","getBackgroundSettings","hasId","colorId","defaultColor","switchLabel","getBorderSettings","selectionId","styleId","widthId","MultiInputLayout","numericalOrPixelRule","minimumNumericalOrPixelRule","maximumNumericalOrPixelOrAutoRule","bundle","appendUnit","getBorderRadiusSlider","defaultValue","getBorderRadiusSettings","valueId","choiceId","presetCustomValue","getExtendedBorderRadiusSettings","topLeftId","topRightId","bottomLeftId","bottomRightId","getGutterSettings","dependentSettingId","spacingChoiceId","spacingCustomId","defaultValueChoices","getMarginSlider","getMarginSettings","getMarginExtendedSettings","topId","leftId","rightId","bottomId","getPaddingSlider","getPaddingSettings","getPaddingExtendedSettings","getSecurityDownloadableSetting","securityId","getSecurityGlobalControlId","getSecurityGlobalControlSetting","createFooter","Sections","defineBlock","config","defineSettings","settingsStructure"],"mappings":"wrBAQaA,EAAkBC,GAC3BA,EAAW,OAAO,OAAO,EAAE,KAAK,GAAG,ECG1BC,GAAoB,CAAC,CAC9B,OAAAC,EACA,MAAAC,EACA,KAAAC,EACA,eAAAC,EACA,UAAAC,EACA,oBAAAC,EACA,mBAAAC,EACA,cAAAC,EACA,SAAAC,EAAW,GACX,QAAAC,EACA,cAAAC,EACA,eAAAC,CACJ,IAA8B,CAC1B,KAAM,CAACC,EAAgBC,CAAiB,EAAIC,EAAAA,SAAS,EAAK,EACpD,CAACC,EAAcC,CAAe,EAAIF,WAAA,EAClCG,EAAYC,EAAAA,OAA0B,IAAI,EAC1C,CAACC,EAAUC,CAAW,EAAIN,EAAAA,SAA6B,MAAS,EAEhEO,EAAmDC,GAAU,CAG/D,GAFAA,EAAM,eAAA,EACNT,EAAkB,EAAK,EACnB,CAACU,EAAaD,EAAM,aAAa,KAAK,EAAG,CACzCF,EAAY,SAAS,EACrB,WAAW,IAAM,CACbA,EAAY,MAAS,CACzB,EAAG,GAAI,EACP,MACJ,CACApB,GAAA,MAAAA,EAASsB,EAAM,aAAa,MAChC,EAEMC,EAAgBC,GAAoB,CACtC,GAAI,CAACd,EACD,MAAO,GAEX,QAASe,EAAI,EAAGA,EAAID,EAAM,OAAQC,IAAK,CACnC,MAAMC,EAAwBF,EAAMC,CAAC,EAAE,KAAK,MAAM,GAAG,EAAE,IAAA,GAAS,GAChE,GAAI,CAACE,EAAAA,kBAAkBjB,CAAa,EAAE,SAASgB,CAAoB,EAC/D,MAAO,EAEf,CACA,MAAO,EACX,EAEME,EAAkDN,GAAU,CAC9D,GAAI,CAACL,EAAU,SAAWb,EACtB,OAEJ,KAAM,CAAE,QAAAyB,EAAS,QAAAC,CAAA,EAAYR,EACvBS,GAAkBF,IAAY,GAAKC,IAAY,EAC/C,CAAE,KAAAE,GAAM,IAAAC,GAAK,MAAAC,GAAO,OAAAC,I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