@frontify/guideline-blocks-settings 0.33.4 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Attachments/AttachmentItem.es.js +174 -0
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -0
- package/dist/components/Attachments/Attachments.es.js +160 -0
- package/dist/components/Attachments/Attachments.es.js.map +1 -0
- package/dist/components/Attachments/AttachmentsButtonTrigger.es.js +29 -0
- package/dist/components/Attachments/AttachmentsButtonTrigger.es.js.map +1 -0
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js +150 -0
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +71 -0
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js +33 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js +26 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js +28 -0
- package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js +35 -0
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js +44 -0
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js +25 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.es.js +29 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js +22 -0
- package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js +12 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js +20 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js +6 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js +11 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js +18 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js +26 -0
- package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js +18 -0
- package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/constants.es.js +6 -0
- package/dist/components/BlockItemWrapper/constants.es.js.map +1 -0
- package/dist/components/DownloadButton/DownloadButton.es.js +39 -0
- package/dist/components/DownloadButton/DownloadButton.es.js.map +1 -0
- package/dist/components/Link/LinkInput.es.js +63 -0
- package/dist/components/Link/LinkInput.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/DocumentLink.es.js +68 -0
- package/dist/components/Link/LinkSelector/DocumentLink.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js +60 -0
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/LinkSelector.es.js +86 -0
- package/dist/components/Link/LinkSelector/LinkSelector.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js +7 -0
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/PageLink.es.js +70 -0
- package/dist/components/Link/LinkSelector/PageLink.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/PageLinks.es.js +38 -0
- package/dist/components/Link/LinkSelector/PageLinks.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/SectionLink.es.js +25 -0
- package/dist/components/Link/LinkSelector/SectionLink.es.js.map +1 -0
- package/dist/components/Link/utils/getUrl.es.js +18 -0
- package/dist/components/Link/utils/getUrl.es.js.map +1 -0
- package/dist/components/Link/utils/relativeUrlRegex.es.js +5 -0
- package/dist/components/Link/utils/relativeUrlRegex.es.js.map +1 -0
- package/dist/components/Link/utils/url.es.js +17 -0
- package/dist/components/Link/utils/url.es.js.map +1 -0
- package/dist/components/RichTextEditor/RichTextEditor.es.js +42 -0
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -0
- package/dist/components/RichTextEditor/SerializedText.es.js +20 -0
- package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -0
- package/dist/components/RichTextEditor/constants.es.js +5 -0
- package/dist/components/RichTextEditor/constants.es.js.map +1 -0
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js +35 -0
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +41 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js +12 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +24 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +28 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js +48 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +69 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +104 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js +32 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js +57 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js +19 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js +41 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js +18 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +67 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js +13 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js +35 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js +86 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js +24 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js +19 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js +13 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js +11 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js +10 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js +81 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js +18 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js +17 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js +14 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js +52 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +32 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js +35 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js +8 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +66 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +79 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +22 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +12 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js +11 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js +5 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +13 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +50 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +50 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +50 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js +40 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +53 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/styles.es.js +167 -0
- package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -0
- package/dist/helpers/addHttps.es.js +14 -0
- package/dist/helpers/addHttps.es.js.map +1 -0
- package/dist/helpers/convertToRichTextValue.es.js +6 -0
- package/dist/helpers/convertToRichTextValue.es.js.map +1 -0
- package/dist/helpers/customCoordinatesGetterFactory.es.js +32 -0
- package/dist/helpers/customCoordinatesGetterFactory.es.js.map +1 -0
- package/dist/helpers/hasRichTextValue.es.js +15 -0
- package/dist/helpers/hasRichTextValue.es.js.map +1 -0
- package/dist/helpers/isDownloadable.es.js +6 -0
- package/dist/helpers/isDownloadable.es.js.map +1 -0
- package/dist/helpers/mapColorPalettes.es.js +28 -0
- package/dist/helpers/mapColorPalettes.es.js.map +1 -0
- package/dist/hooks/useAttachments.es.js +53 -0
- package/dist/hooks/useAttachments.es.js.map +1 -0
- package/dist/hooks/useDndSensors.es.js +20 -0
- package/dist/hooks/useDndSensors.es.js.map +1 -0
- package/dist/index.cjs.js +4 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +1190 -0
- package/dist/index.es.js +217 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +4 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/settings/background.es.js +22 -0
- package/dist/settings/background.es.js.map +1 -0
- package/dist/settings/border.es.js +61 -0
- package/dist/settings/border.es.js.map +1 -0
- package/dist/settings/borderRadius.es.js +56 -0
- package/dist/settings/borderRadius.es.js.map +1 -0
- package/dist/settings/borderRadiusExtended.es.js +64 -0
- package/dist/settings/borderRadiusExtended.es.js.map +1 -0
- package/dist/settings/defaultValues.es.js +19 -0
- package/dist/settings/defaultValues.es.js.map +1 -0
- package/dist/settings/gutter.es.js +56 -0
- package/dist/settings/gutter.es.js.map +1 -0
- package/dist/settings/margin.es.js +53 -0
- package/dist/settings/margin.es.js.map +1 -0
- package/dist/settings/marginExtended.es.js +65 -0
- package/dist/settings/marginExtended.es.js.map +1 -0
- package/dist/settings/padding.es.js +53 -0
- package/dist/settings/padding.es.js.map +1 -0
- package/dist/settings/paddingExtended.es.js +65 -0
- package/dist/settings/paddingExtended.es.js.map +1 -0
- package/dist/settings/securityDownloadable.es.js +19 -0
- package/dist/settings/securityDownloadable.es.js.map +1 -0
- package/dist/settings/securityGlobalControl.es.js +33 -0
- package/dist/settings/securityGlobalControl.es.js.map +1 -0
- package/dist/settings/types.es.js +48 -0
- package/dist/settings/types.es.js.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/styles.css.es.js +2 -0
- package/dist/styles.css.es.js.map +1 -0
- package/dist/utilities/color/getReadableColor.es.js +14 -0
- package/dist/utilities/color/getReadableColor.es.js.map +1 -0
- package/dist/utilities/color/isDark.es.js +10 -0
- package/dist/utilities/color/isDark.es.js.map +1 -0
- package/dist/utilities/color/setAlpha.es.js +6 -0
- package/dist/utilities/color/setAlpha.es.js.map +1 -0
- package/dist/utilities/color/toColorObject.es.js +9 -0
- package/dist/utilities/color/toColorObject.es.js.map +1 -0
- package/dist/utilities/color/toHex8String.es.js +7 -0
- package/dist/utilities/color/toHex8String.es.js.map +1 -0
- package/dist/utilities/color/toHexString.es.js +7 -0
- package/dist/utilities/color/toHexString.es.js.map +1 -0
- package/dist/utilities/color/toRgbaString.es.js +7 -0
- package/dist/utilities/color/toRgbaString.es.js.map +1 -0
- package/dist/utilities/color/toShortRgba.es.js +11 -0
- package/dist/utilities/color/toShortRgba.es.js.map +1 -0
- package/dist/utilities/moveItemInArray.es.js +12 -0
- package/dist/utilities/moveItemInArray.es.js.map +1 -0
- package/dist/utilities/react/getBackgroundColorStyles.es.js +8 -0
- package/dist/utilities/react/getBackgroundColorStyles.es.js.map +1 -0
- package/dist/utilities/react/getBorderStyles.es.js +12 -0
- package/dist/utilities/react/getBorderStyles.es.js.map +1 -0
- package/dist/utilities/react/getRadiusStyles.es.js +8 -0
- package/dist/utilities/react/getRadiusStyles.es.js.map +1 -0
- package/dist/utilities/react/joinClassNames.es.js +5 -0
- package/dist/utilities/react/joinClassNames.es.js.map +1 -0
- package/package.json +9 -6
- package/.eslintrc.cjs +0 -27
- package/.prettierrc +0 -7
- package/CHANGELOG.md +0 -787
- package/postcss.config.cjs +0 -8
- package/setupTests.ts +0 -23
- package/src/components/Attachments/AttachmentItem.tsx +0 -247
- package/src/components/Attachments/Attachments.spec.ct.tsx +0 -165
- package/src/components/Attachments/Attachments.tsx +0 -241
- package/src/components/Attachments/AttachmentsButtonTrigger.tsx +0 -30
- package/src/components/Attachments/index.ts +0 -4
- package/src/components/Attachments/types.ts +0 -40
- package/src/components/BlockInjectButton/BlockInjectButton.spec.ct.tsx +0 -48
- package/src/components/BlockInjectButton/BlockInjectButton.tsx +0 -212
- package/src/components/BlockInjectButton/index.ts +0 -4
- package/src/components/BlockInjectButton/types.ts +0 -18
- package/src/components/BlockItemWrapper/BlockItemWrapper.spec.ct.tsx +0 -145
- package/src/components/BlockItemWrapper/BlockItemWrapper.tsx +0 -76
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.spec.tsx +0 -96
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.tsx +0 -42
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.spec.tsx +0 -44
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.tsx +0 -24
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.spec.tsx +0 -40
- package/src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.tsx +0 -37
- package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.spec.tsx +0 -89
- package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.tsx +0 -40
- package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.spec.tsx +0 -140
- package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.tsx +0 -61
- package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.spec.tsx +0 -77
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.tsx +0 -30
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.spec.tsx +0 -63
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.tsx +0 -40
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/index.ts +0 -4
- package/src/components/BlockItemWrapper/Toolbar/Toolbar.spec.tsx +0 -259
- package/src/components/BlockItemWrapper/Toolbar/Toolbar.tsx +0 -36
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.spec.tsx +0 -70
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.tsx +0 -19
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.tsx +0 -25
- package/src/components/BlockItemWrapper/Toolbar/ToolbarSegment.tsx +0 -9
- package/src/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.tsx +0 -15
- package/src/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.tsx +0 -25
- package/src/components/BlockItemWrapper/Toolbar/context/index.ts +0 -4
- package/src/components/BlockItemWrapper/Toolbar/helpers.ts +0 -33
- package/src/components/BlockItemWrapper/Toolbar/hooks/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.spec.tsx +0 -59
- package/src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.ts +0 -24
- package/src/components/BlockItemWrapper/Toolbar/index.ts +0 -10
- package/src/components/BlockItemWrapper/Toolbar/types.ts +0 -18
- package/src/components/BlockItemWrapper/constants.ts +0 -4
- package/src/components/BlockItemWrapper/index.ts +0 -6
- package/src/components/BlockItemWrapper/types.ts +0 -24
- package/src/components/DownloadButton/DownloadButton.spec.ct.tsx +0 -20
- package/src/components/DownloadButton/DownloadButton.tsx +0 -36
- package/src/components/DownloadButton/index.ts +0 -3
- package/src/components/DownloadButton/types.ts +0 -5
- package/src/components/Link/LinkInput.spec.ct.tsx +0 -142
- package/src/components/Link/LinkInput.tsx +0 -86
- package/src/components/Link/LinkSelector/DocumentLink.tsx +0 -81
- package/src/components/Link/LinkSelector/DocumentLinks.tsx +0 -102
- package/src/components/Link/LinkSelector/LinkSelector.spec.ct.tsx +0 -196
- package/src/components/Link/LinkSelector/LinkSelector.tsx +0 -96
- package/src/components/Link/LinkSelector/LoadingIndicator.tsx +0 -11
- package/src/components/Link/LinkSelector/PageLink.tsx +0 -96
- package/src/components/Link/LinkSelector/PageLinks.tsx +0 -71
- package/src/components/Link/LinkSelector/SectionLink.tsx +0 -36
- package/src/components/Link/LinkSelector/index.ts +0 -3
- package/src/components/Link/index.ts +0 -6
- package/src/components/Link/types.ts +0 -6
- package/src/components/Link/utils/getUrl.ts +0 -30
- package/src/components/Link/utils/index.ts +0 -5
- package/src/components/Link/utils/relativeUrlRegex.spec.ts +0 -32
- package/src/components/Link/utils/relativeUrlRegex.ts +0 -3
- package/src/components/Link/utils/url.spec.ts +0 -75
- package/src/components/Link/utils/url.ts +0 -21
- package/src/components/RichTextEditor/RichTextEditor.spec.ct.tsx +0 -231
- package/src/components/RichTextEditor/RichTextEditor.tsx +0 -62
- package/src/components/RichTextEditor/SerializedText.tsx +0 -29
- package/src/components/RichTextEditor/constants.ts +0 -3
- package/src/components/RichTextEditor/index.ts +0 -6
- package/src/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.tsx +0 -55
- package/src/components/RichTextEditor/pluginPresets/index.ts +0 -3
- package/src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.tsx +0 -74
- package/src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.ts +0 -11
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.tsx +0 -20
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.tsx +0 -56
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.tsx +0 -19
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.tsx +0 -42
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.tsx +0 -37
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.tsx +0 -22
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.tsx +0 -30
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.tsx +0 -81
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/types.ts +0 -13
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.ts +0 -143
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.tsx +0 -31
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.ts +0 -46
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/index.ts +0 -12
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.ts +0 -113
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.ts +0 -21
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.ts +0 -30
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.ts +0 -71
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.ts +0 -22
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/index.ts +0 -3
- package/src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts +0 -118
- package/src/components/RichTextEditor/plugins/ButtonPlugin/index.ts +0 -7
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/index.ts +0 -8
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.ts +0 -17
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.ts +0 -40
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts +0 -68
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts +0 -198
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts +0 -40
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts +0 -30
- package/src/components/RichTextEditor/plugins/ButtonPlugin/types.ts +0 -13
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts +0 -28
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts +0 -14
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts +0 -18
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/index.ts +0 -8
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.ts +0 -83
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.ts +0 -23
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.ts +0 -30
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.ts +0 -45
- package/src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts +0 -106
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.tsx +0 -26
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.tsx +0 -43
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/index.ts +0 -4
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.ts +0 -113
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.tsx +0 -45
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.tsx +0 -5
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.tsx +0 -88
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/index.ts +0 -4
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/types.ts +0 -11
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.ts +0 -73
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.ts +0 -136
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkButton.tsx +0 -38
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.tsx +0 -36
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.ts +0 -11
- package/src/components/RichTextEditor/plugins/LinkPlugin/id.ts +0 -3
- package/src/components/RichTextEditor/plugins/LinkPlugin/index.ts +0 -49
- package/src/components/RichTextEditor/plugins/LinkPlugin/types.ts +0 -12
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.tsx +0 -63
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.tsx +0 -63
- package/src/components/RichTextEditor/plugins/TextStylePlugins/helpers.tsx +0 -44
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/index.ts +0 -15
- package/src/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.tsx +0 -58
- package/src/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.tsx +0 -63
- package/src/components/RichTextEditor/plugins/index.ts +0 -6
- package/src/components/RichTextEditor/plugins/styles.ts +0 -178
- package/src/components/RichTextEditor/types.ts +0 -23
- package/src/components/index.ts +0 -8
- package/src/helpers/addHttps.spec.ts +0 -42
- package/src/helpers/addHttps.ts +0 -15
- package/src/helpers/convertToRichTextValue.spec.ts +0 -32
- package/src/helpers/convertToRichTextValue.ts +0 -6
- package/src/helpers/customCoordinatesGetterFactory.spec.ts +0 -69
- package/src/helpers/customCoordinatesGetterFactory.ts +0 -39
- package/src/helpers/hasRichTextValue.spec.ts +0 -63
- package/src/helpers/hasRichTextValue.ts +0 -29
- package/src/helpers/index.ts +0 -8
- package/src/helpers/isDownloadable.spec.ts +0 -47
- package/src/helpers/isDownloadable.ts +0 -7
- package/src/helpers/mapColorPalettes.spec.ts +0 -47
- package/src/helpers/mapColorPalettes.ts +0 -65
- package/src/hooks/index.ts +0 -4
- package/src/hooks/useAttachments.spec.tsx +0 -127
- package/src/hooks/useAttachments.tsx +0 -90
- package/src/hooks/useDndSensors.spec.ts +0 -40
- package/src/hooks/useDndSensors.ts +0 -23
- package/src/index.ts +0 -138
- package/src/settings/background.spec.ts +0 -173
- package/src/settings/background.ts +0 -52
- package/src/settings/border.spec.ts +0 -76
- package/src/settings/border.ts +0 -90
- package/src/settings/borderRadius.spec.ts +0 -30
- package/src/settings/borderRadius.ts +0 -73
- package/src/settings/borderRadiusExtended.spec.ts +0 -52
- package/src/settings/borderRadiusExtended.ts +0 -84
- package/src/settings/defaultValues.ts +0 -21
- package/src/settings/gutter.spec.ts +0 -60
- package/src/settings/gutter.ts +0 -75
- package/src/settings/index.ts +0 -14
- package/src/settings/margin.spec.ts +0 -42
- package/src/settings/margin.ts +0 -72
- package/src/settings/marginExtended.spec.ts +0 -45
- package/src/settings/marginExtended.ts +0 -91
- package/src/settings/padding.spec.ts +0 -42
- package/src/settings/padding.ts +0 -73
- package/src/settings/paddingExtended.spec.ts +0 -45
- package/src/settings/paddingExtended.ts +0 -91
- package/src/settings/security.spec.ts +0 -87
- package/src/settings/security.ts +0 -61
- package/src/settings/securityDownloadable.spec.ts +0 -46
- package/src/settings/securityDownloadable.ts +0 -33
- package/src/settings/securityGlobalControl.ts +0 -42
- package/src/settings/types.ts +0 -128
- package/src/styles.css +0 -3
- package/src/utilities/color/getReadableColor.spec.ts +0 -32
- package/src/utilities/color/getReadableColor.ts +0 -34
- package/src/utilities/color/index.ts +0 -10
- package/src/utilities/color/isDark.spec.ts +0 -33
- package/src/utilities/color/isDark.ts +0 -29
- package/src/utilities/color/setAlpha.spec.ts +0 -28
- package/src/utilities/color/setAlpha.ts +0 -14
- package/src/utilities/color/toColorObject.spec.ts +0 -19
- package/src/utilities/color/toColorObject.ts +0 -16
- package/src/utilities/color/toHex8String.spec.ts +0 -17
- package/src/utilities/color/toHex8String.ts +0 -14
- package/src/utilities/color/toHexString.spec.ts +0 -17
- package/src/utilities/color/toHexString.ts +0 -10
- package/src/utilities/color/toRgbaString.spec.ts +0 -12
- package/src/utilities/color/toRgbaString.ts +0 -14
- package/src/utilities/color/toShortRgba.spec.ts +0 -16
- package/src/utilities/color/toShortRgba.ts +0 -35
- package/src/utilities/index.ts +0 -5
- package/src/utilities/moveItemInArray.spec.ts +0 -17
- package/src/utilities/moveItemInArray.ts +0 -21
- package/src/utilities/react/getBackgroundColorStyles.spec.ts +0 -18
- package/src/utilities/react/getBackgroundColorStyles.ts +0 -10
- package/src/utilities/react/getBorderStyles.spec.ts +0 -39
- package/src/utilities/react/getBorderStyles.ts +0 -20
- package/src/utilities/react/getRadiusStyles.spec.ts +0 -25
- package/src/utilities/react/getRadiusStyles.ts +0 -8
- package/src/utilities/react/index.ts +0 -6
- package/src/utilities/react/joinClassNames.spec.ts +0 -18
- package/src/utilities/react/joinClassNames.ts +0 -10
- package/tailwind.config.ts +0 -27
- package/tsconfig.json +0 -24
- package/tsconfig.node.json +0 -12
- package/vite.config.ts +0 -71
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { IconCaretDown12, IconPaperclip16 } from '@frontify/fondue';
|
|
4
|
-
|
|
5
|
-
import { joinClassNames } from '../../utilities';
|
|
6
|
-
|
|
7
|
-
import { type AttachmentsTriggerProps } from './types';
|
|
8
|
-
|
|
9
|
-
export const AttachmentsButtonTrigger = ({
|
|
10
|
-
children,
|
|
11
|
-
isFlyoutOpen,
|
|
12
|
-
triggerProps,
|
|
13
|
-
triggerRef,
|
|
14
|
-
}: AttachmentsTriggerProps) => (
|
|
15
|
-
<button
|
|
16
|
-
className={joinClassNames([
|
|
17
|
-
'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',
|
|
18
|
-
isFlyoutOpen
|
|
19
|
-
? 'tw-bg-box-neutral-pressed tw-text-box-neutral-inverse-pressed'
|
|
20
|
-
: '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',
|
|
21
|
-
])}
|
|
22
|
-
{...triggerProps}
|
|
23
|
-
ref={triggerRef}
|
|
24
|
-
data-test-id="attachments-button-trigger"
|
|
25
|
-
>
|
|
26
|
-
<IconPaperclip16 />
|
|
27
|
-
{children}
|
|
28
|
-
<IconCaretDown12 />
|
|
29
|
-
</button>
|
|
30
|
-
);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { type AppBridgeBlock, type Asset } from '@frontify/app-bridge';
|
|
4
|
-
import { HTMLAttributes, MutableRefObject, ReactElement, type ReactNode } from 'react';
|
|
5
|
-
|
|
6
|
-
export type AttachmentsTriggerProps = {
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
isFlyoutOpen: boolean;
|
|
9
|
-
triggerProps: HTMLAttributes<HTMLButtonElement>;
|
|
10
|
-
triggerRef: MutableRefObject<HTMLButtonElement>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type AttachmentsProps = {
|
|
14
|
-
items?: Asset[];
|
|
15
|
-
appBridge: AppBridgeBlock;
|
|
16
|
-
onReplaceWithUpload: (attachmentToReplace: Asset, newAsset: Asset) => Promise<void>;
|
|
17
|
-
onReplaceWithBrowse: (attachmentToReplace: Asset, newAsset: Asset) => Promise<void>;
|
|
18
|
-
onDelete: (attachmentToDelete: Asset) => void;
|
|
19
|
-
onUpload: (uploadedAttachments: Asset[]) => Promise<void>;
|
|
20
|
-
onBrowse: (browserAttachments: Asset[]) => void;
|
|
21
|
-
onSorted: (sortedAttachments: Asset[]) => void;
|
|
22
|
-
triggerComponent?: (props: AttachmentsTriggerProps) => ReactElement;
|
|
23
|
-
} & ({ isOpen?: never; onOpenChange?: never } | { isOpen: boolean; onOpenChange: (isOpen: boolean) => void });
|
|
24
|
-
|
|
25
|
-
export type AttachmentItemProps = SortableAttachmentItemProps & {
|
|
26
|
-
isDragging?: boolean;
|
|
27
|
-
transformStyle?: Record<string, unknown>;
|
|
28
|
-
draggableProps?: Record<string, unknown>;
|
|
29
|
-
isOverlay?: boolean;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export type SortableAttachmentItemProps = {
|
|
33
|
-
item: Asset;
|
|
34
|
-
isEditing: boolean;
|
|
35
|
-
onDelete: () => void;
|
|
36
|
-
isLoading?: boolean;
|
|
37
|
-
onReplaceWithBrowse: () => void;
|
|
38
|
-
onReplaceWithUpload: (uploadedAsset: Asset) => void;
|
|
39
|
-
onDownload?: () => Promise<void>;
|
|
40
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { withAppBridgeBlockStubs } from '@frontify/app-bridge';
|
|
4
|
-
import { mount } from 'cypress/react18';
|
|
5
|
-
import { BlockInjectButton } from './BlockInjectButton';
|
|
6
|
-
import { IconAdobeCreativeCloud } from '@frontify/fondue';
|
|
7
|
-
|
|
8
|
-
const BlockInjectButtonSelector = '[data-test-id="block-inject-button"]';
|
|
9
|
-
const ActionMenuItemSelector = '[data-test-id="menu-item"]';
|
|
10
|
-
|
|
11
|
-
describe('Block Inject Button', () => {
|
|
12
|
-
it('renders a simple block inject button', () => {
|
|
13
|
-
const [BlockInjectButtonWithStubs] = withAppBridgeBlockStubs(BlockInjectButton, {});
|
|
14
|
-
|
|
15
|
-
mount(
|
|
16
|
-
<BlockInjectButtonWithStubs
|
|
17
|
-
label="label"
|
|
18
|
-
icon={<IconAdobeCreativeCloud />}
|
|
19
|
-
secondaryLabel="second label"
|
|
20
|
-
withMenu={false}
|
|
21
|
-
/>,
|
|
22
|
-
);
|
|
23
|
-
cy.get(BlockInjectButtonSelector)
|
|
24
|
-
.should('exist')
|
|
25
|
-
.should('have.class', 'first:tw-rounded-tl last:tw-rounded-br', 'first:tw-rounded-bl last:tw-rounded-tr');
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('renders a block inject button with Menu upload and asset', () => {
|
|
29
|
-
const [BlockInjectButtonWithStubs] = withAppBridgeBlockStubs(BlockInjectButton, {});
|
|
30
|
-
|
|
31
|
-
mount(
|
|
32
|
-
<BlockInjectButtonWithStubs
|
|
33
|
-
label="label"
|
|
34
|
-
secondaryLabel="second label"
|
|
35
|
-
onAssetChooseClick={cy.stub().as('onClickOpenAssetChooser')}
|
|
36
|
-
onUploadClick={cy.stub().as('onClickonUploadClick')}
|
|
37
|
-
/>,
|
|
38
|
-
);
|
|
39
|
-
cy.get(BlockInjectButtonSelector).click();
|
|
40
|
-
cy.get(ActionMenuItemSelector).should('have.length', 2);
|
|
41
|
-
cy.get(ActionMenuItemSelector).eq(0).should('have.text', 'Upload asset').click();
|
|
42
|
-
cy.get('@onClickonUploadClick').should('have.been.calledOnce');
|
|
43
|
-
|
|
44
|
-
cy.get(BlockInjectButtonSelector).click();
|
|
45
|
-
cy.get(ActionMenuItemSelector).eq(1).should('have.text', 'Browse asset').click();
|
|
46
|
-
cy.get('@onClickOpenAssetChooser').should('have.been.calledOnce');
|
|
47
|
-
});
|
|
48
|
-
});
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ActionMenu,
|
|
5
|
-
Flyout,
|
|
6
|
-
IconArrowCircleUp20,
|
|
7
|
-
IconExclamationMarkTriangle,
|
|
8
|
-
IconImageStack20,
|
|
9
|
-
LoadingCircle,
|
|
10
|
-
MenuItemContentSize,
|
|
11
|
-
} from '@frontify/fondue';
|
|
12
|
-
import { DragEventHandler, MouseEventHandler, useRef, useState } from 'react';
|
|
13
|
-
import { joinClassNames } from '../../utilities/react/joinClassNames';
|
|
14
|
-
import { BlockInjectButtonProps } from './types';
|
|
15
|
-
import { FileExtension, FileExtensionSets } from '@frontify/app-bridge';
|
|
16
|
-
|
|
17
|
-
export const BlockInjectButton = ({
|
|
18
|
-
onDrop,
|
|
19
|
-
label,
|
|
20
|
-
icon,
|
|
21
|
-
secondaryLabel,
|
|
22
|
-
isLoading,
|
|
23
|
-
fillParentContainer,
|
|
24
|
-
onAssetChooseClick,
|
|
25
|
-
onUploadClick,
|
|
26
|
-
withMenu = true,
|
|
27
|
-
onClick,
|
|
28
|
-
validFileType,
|
|
29
|
-
verticalLayout,
|
|
30
|
-
}: BlockInjectButtonProps) => {
|
|
31
|
-
const [isDraggingOver, setIsDraggingOver] = useState(false);
|
|
32
|
-
const [menuPosition, setMenuPosition] = useState<[number, number] | undefined>();
|
|
33
|
-
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
34
|
-
const [errorMsg, setErrorMsg] = useState<string | undefined>(undefined);
|
|
35
|
-
|
|
36
|
-
const handleDrop: DragEventHandler<HTMLButtonElement> = (event) => {
|
|
37
|
-
event.preventDefault();
|
|
38
|
-
setIsDraggingOver(false);
|
|
39
|
-
if (!isValidAsset(event.dataTransfer.files)) {
|
|
40
|
-
setErrorMsg('Invalid');
|
|
41
|
-
setTimeout(() => {
|
|
42
|
-
setErrorMsg(undefined);
|
|
43
|
-
}, 1000);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
onDrop?.(event.dataTransfer.files);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const isValidAsset = (files: FileList) => {
|
|
50
|
-
if (!validFileType) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
for (let i = 0; i < files.length; i++) {
|
|
54
|
-
const droppedFileExtension = (files[i].name.split('.').pop() ?? '') as FileExtension;
|
|
55
|
-
if (!FileExtensionSets[validFileType].includes(droppedFileExtension)) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return true;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const openMenu: MouseEventHandler<HTMLButtonElement> = (event) => {
|
|
63
|
-
if (!buttonRef.current || isLoading) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const { left, top } = buttonRef.current.getBoundingClientRect();
|
|
67
|
-
const XInsideComponent = event.clientX - left;
|
|
68
|
-
const YInsideComponent = event.clientY - top;
|
|
69
|
-
setMenuPosition([XInsideComponent, YInsideComponent]);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<button
|
|
74
|
-
ref={buttonRef}
|
|
75
|
-
data-test-id="block-inject-button"
|
|
76
|
-
className={joinClassNames([
|
|
77
|
-
'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',
|
|
78
|
-
verticalLayout
|
|
79
|
-
? '[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl'
|
|
80
|
-
: '[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr',
|
|
81
|
-
fillParentContainer ? 'tw-h-full' : 'tw-h-[72px]',
|
|
82
|
-
isDraggingOver && !isLoading ? 'tw-border-dashed' : 'tw-border-solid',
|
|
83
|
-
menuPosition && 'tw-bg-blank-state-pressed-inverse',
|
|
84
|
-
isDraggingOver && 'tw-bg-blank-state-weak-inverse',
|
|
85
|
-
errorMsg ? '!tw-border-red-50 !tw-cursor-not-allowed' : ' tw-border-blank-state-line',
|
|
86
|
-
isLoading || menuPosition || isDraggingOver || errorMsg
|
|
87
|
-
? ''
|
|
88
|
-
: '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',
|
|
89
|
-
(isDraggingOver || !!menuPosition) && !errorMsg
|
|
90
|
-
? '[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover'
|
|
91
|
-
: 'tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded',
|
|
92
|
-
])}
|
|
93
|
-
onDragEnter={
|
|
94
|
-
onDrop
|
|
95
|
-
? (event) => {
|
|
96
|
-
setIsDraggingOver(true);
|
|
97
|
-
// is now only used for images, can be adapted if needed
|
|
98
|
-
if (validFileType === 'Images') {
|
|
99
|
-
for (const item of Array.from(event.dataTransfer.items)) {
|
|
100
|
-
if (!item?.type?.startsWith('image/')) {
|
|
101
|
-
setErrorMsg('Invalid');
|
|
102
|
-
} else {
|
|
103
|
-
setErrorMsg(undefined);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
: undefined
|
|
109
|
-
}
|
|
110
|
-
onDragLeave={
|
|
111
|
-
onDrop
|
|
112
|
-
? () => {
|
|
113
|
-
setIsDraggingOver(false);
|
|
114
|
-
setErrorMsg(undefined);
|
|
115
|
-
}
|
|
116
|
-
: undefined
|
|
117
|
-
}
|
|
118
|
-
onDrop={onDrop ? handleDrop : undefined}
|
|
119
|
-
onClick={(event) => {
|
|
120
|
-
withMenu && openMenu(event);
|
|
121
|
-
onClick?.();
|
|
122
|
-
}}
|
|
123
|
-
>
|
|
124
|
-
{isLoading ? (
|
|
125
|
-
<LoadingCircle />
|
|
126
|
-
) : // eslint-disable-next-line unicorn/no-nested-ternary
|
|
127
|
-
errorMsg ? (
|
|
128
|
-
<div className=" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium">
|
|
129
|
-
<IconExclamationMarkTriangle />
|
|
130
|
-
{errorMsg}
|
|
131
|
-
</div>
|
|
132
|
-
) : (
|
|
133
|
-
<>
|
|
134
|
-
{icon && <div>{icon}</div>}
|
|
135
|
-
{(label || secondaryLabel) && (
|
|
136
|
-
<div className="tw-flex tw-flex-col tw-items-start">
|
|
137
|
-
{label && <div className="tw-font-medium">{label}</div>}
|
|
138
|
-
{secondaryLabel && <div className="tw-font-normal">{secondaryLabel}</div>}
|
|
139
|
-
</div>
|
|
140
|
-
)}
|
|
141
|
-
</>
|
|
142
|
-
)}
|
|
143
|
-
{menuPosition && (
|
|
144
|
-
<div
|
|
145
|
-
className="tw-absolute tw-left-0 tw-top-full tw-z-20"
|
|
146
|
-
style={{
|
|
147
|
-
left: menuPosition[0],
|
|
148
|
-
top: menuPosition[1],
|
|
149
|
-
}}
|
|
150
|
-
>
|
|
151
|
-
<Flyout
|
|
152
|
-
onOpenChange={(isOpen) => !isOpen && setMenuPosition(undefined)}
|
|
153
|
-
isOpen={true}
|
|
154
|
-
fitContent
|
|
155
|
-
hug={false}
|
|
156
|
-
legacyFooter={false}
|
|
157
|
-
trigger={<div />}
|
|
158
|
-
>
|
|
159
|
-
<ActionMenu
|
|
160
|
-
menuBlocks={[
|
|
161
|
-
{
|
|
162
|
-
id: 'menu',
|
|
163
|
-
menuItems: [
|
|
164
|
-
...(onUploadClick
|
|
165
|
-
? [
|
|
166
|
-
{
|
|
167
|
-
id: 'upload',
|
|
168
|
-
size: MenuItemContentSize.XSmall,
|
|
169
|
-
title: 'Upload asset',
|
|
170
|
-
onClick: () => {
|
|
171
|
-
onUploadClick();
|
|
172
|
-
setMenuPosition(undefined);
|
|
173
|
-
},
|
|
174
|
-
|
|
175
|
-
initialValue: true,
|
|
176
|
-
decorator: (
|
|
177
|
-
<div className="tw-mr-2">
|
|
178
|
-
<IconArrowCircleUp20 />
|
|
179
|
-
</div>
|
|
180
|
-
),
|
|
181
|
-
},
|
|
182
|
-
]
|
|
183
|
-
: []),
|
|
184
|
-
...(onAssetChooseClick
|
|
185
|
-
? [
|
|
186
|
-
{
|
|
187
|
-
id: 'asset',
|
|
188
|
-
size: MenuItemContentSize.XSmall,
|
|
189
|
-
title: 'Browse asset',
|
|
190
|
-
onClick: () => {
|
|
191
|
-
onAssetChooseClick();
|
|
192
|
-
setMenuPosition(undefined);
|
|
193
|
-
},
|
|
194
|
-
initialValue: true,
|
|
195
|
-
decorator: (
|
|
196
|
-
<div className="tw-mr-2">
|
|
197
|
-
<IconImageStack20 />
|
|
198
|
-
</div>
|
|
199
|
-
),
|
|
200
|
-
},
|
|
201
|
-
]
|
|
202
|
-
: []),
|
|
203
|
-
],
|
|
204
|
-
},
|
|
205
|
-
]}
|
|
206
|
-
/>
|
|
207
|
-
</Flyout>
|
|
208
|
-
</div>
|
|
209
|
-
)}
|
|
210
|
-
</button>
|
|
211
|
-
);
|
|
212
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import type { FileType } from '@frontify/app-bridge';
|
|
4
|
-
|
|
5
|
-
export type BlockInjectButtonProps = {
|
|
6
|
-
isLoading?: boolean;
|
|
7
|
-
label?: string;
|
|
8
|
-
validFileType?: keyof typeof FileType;
|
|
9
|
-
secondaryLabel?: string;
|
|
10
|
-
icon?: JSX.Element;
|
|
11
|
-
onDrop?: (files: FileList) => void;
|
|
12
|
-
fillParentContainer?: boolean;
|
|
13
|
-
onUploadClick?: () => void;
|
|
14
|
-
onAssetChooseClick?: () => void;
|
|
15
|
-
withMenu?: boolean;
|
|
16
|
-
onClick?: () => void;
|
|
17
|
-
verticalLayout?: boolean;
|
|
18
|
-
};
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { IconMagnifier16 } from '@frontify/fondue';
|
|
4
|
-
import { mount } from 'cypress/react18';
|
|
5
|
-
import { BlockItemWrapper } from './BlockItemWrapper';
|
|
6
|
-
|
|
7
|
-
const BlockItemWrapperSelector = '[data-test-id="block-item-wrapper"]';
|
|
8
|
-
const ToolbarSelector = '[data-test-id="block-item-wrapper-toolbar"]';
|
|
9
|
-
const FlyoutSelector = '[data-test-id="block-item-wrapper-toolbar-flyout"]';
|
|
10
|
-
const MenuItemSelector = '[data-test-id="menu-item"]';
|
|
11
|
-
const ToolbarButtonSelector = '[data-test-id="block-item-wrapper-toolbar-btn"]';
|
|
12
|
-
const ChildSelector = '[data-test-id="block-item-wrapper-child"]';
|
|
13
|
-
|
|
14
|
-
describe('Block Item Wrapper', () => {
|
|
15
|
-
it('should render the wrapper and the children', () => {
|
|
16
|
-
mount(
|
|
17
|
-
<BlockItemWrapper toolbarItems={[]}>
|
|
18
|
-
<div data-test-id="block-item-wrapper-child" className="tw-w-8 tw-h-8 tw-bg-red-50" />
|
|
19
|
-
</BlockItemWrapper>,
|
|
20
|
-
);
|
|
21
|
-
cy.get(BlockItemWrapperSelector).should('exist');
|
|
22
|
-
cy.get(ChildSelector).should('exist');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should render the outline class', () => {
|
|
26
|
-
mount(
|
|
27
|
-
<BlockItemWrapper toolbarItems={[]}>
|
|
28
|
-
<div data-test-id="block-item-wrapper-child" className="tw-w-8 tw-h-8 tw-bg-red-50" />
|
|
29
|
-
</BlockItemWrapper>,
|
|
30
|
-
);
|
|
31
|
-
cy.get(BlockItemWrapperSelector).should('have.class', 'hover:tw-outline');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should not render the outline class if the hide prop is set', () => {
|
|
35
|
-
mount(
|
|
36
|
-
<BlockItemWrapper toolbarItems={[]} shouldHideWrapper>
|
|
37
|
-
<div data-test-id="block-item-wrapper-child" className="tw-w-8 tw-h-8 tw-bg-red-50" />
|
|
38
|
-
</BlockItemWrapper>,
|
|
39
|
-
);
|
|
40
|
-
cy.get(BlockItemWrapperSelector).should('not.exist');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should render the right amount of toolbar items', () => {
|
|
44
|
-
mount(
|
|
45
|
-
<BlockItemWrapper
|
|
46
|
-
toolbarItems={[
|
|
47
|
-
{ type: 'button', icon: <IconMagnifier16 />, onClick: cy.stub(), tooltip: 'Test tooltip' },
|
|
48
|
-
{ type: 'button', icon: <IconMagnifier16 />, onClick: cy.stub(), tooltip: 'Test tooltip' },
|
|
49
|
-
]}
|
|
50
|
-
>
|
|
51
|
-
<div data-test-id="block-item-wrapper-child" className="tw-w-8 tw-h-8 tw-bg-red-50" />
|
|
52
|
-
</BlockItemWrapper>,
|
|
53
|
-
);
|
|
54
|
-
cy.get(ToolbarButtonSelector).should('have.length', 2);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('should render the flyout button with the right amount of menu items', () => {
|
|
58
|
-
mount(
|
|
59
|
-
<BlockItemWrapper
|
|
60
|
-
toolbarItems={[
|
|
61
|
-
{ type: 'button', icon: <IconMagnifier16 />, onClick: cy.stub(), tooltip: 'Test tooltip' },
|
|
62
|
-
{ type: 'button', icon: <IconMagnifier16 />, onClick: cy.stub(), tooltip: 'Test tooltip' },
|
|
63
|
-
{
|
|
64
|
-
type: 'menu',
|
|
65
|
-
items: [
|
|
66
|
-
[
|
|
67
|
-
{
|
|
68
|
-
icon: <IconMagnifier16 />,
|
|
69
|
-
onClick: cy.stub(),
|
|
70
|
-
title: 'Test title',
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
[
|
|
74
|
-
{
|
|
75
|
-
icon: <IconMagnifier16 />,
|
|
76
|
-
onClick: cy.stub(),
|
|
77
|
-
title: 'Test title',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
icon: <IconMagnifier16 />,
|
|
81
|
-
onClick: cy.stub(),
|
|
82
|
-
title: 'Test title',
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
],
|
|
86
|
-
},
|
|
87
|
-
]}
|
|
88
|
-
>
|
|
89
|
-
<div data-test-id="block-item-wrapper-child" className="tw-mt-8 tw-w-8 tw-h-8 tw-bg-red-50" />
|
|
90
|
-
</BlockItemWrapper>,
|
|
91
|
-
);
|
|
92
|
-
cy.get(ToolbarButtonSelector).eq(0).focus();
|
|
93
|
-
cy.get(FlyoutSelector).should('exist');
|
|
94
|
-
cy.get(FlyoutSelector).click({ force: true });
|
|
95
|
-
cy.get(MenuItemSelector).should('have.length', 3);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('should render the outline if a toolbar button is focused', () => {
|
|
99
|
-
mount(
|
|
100
|
-
<BlockItemWrapper
|
|
101
|
-
toolbarItems={[
|
|
102
|
-
{ type: 'button', icon: <IconMagnifier16 />, onClick: cy.stub(), tooltip: 'Test tooltip' },
|
|
103
|
-
{ type: 'button', icon: <IconMagnifier16 />, onClick: cy.stub(), tooltip: 'Test tooltip' },
|
|
104
|
-
]}
|
|
105
|
-
>
|
|
106
|
-
<div data-test-id="block-item-wrapper-child" className="tw-w-8 tw-h-8 tw-bg-red-50" />
|
|
107
|
-
</BlockItemWrapper>,
|
|
108
|
-
);
|
|
109
|
-
cy.get(ToolbarButtonSelector).eq(0).focus();
|
|
110
|
-
cy.get(BlockItemWrapperSelector).should('have.css', 'outline-style', 'solid');
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('should render the toolbar if a button is focused', () => {
|
|
114
|
-
mount(
|
|
115
|
-
<BlockItemWrapper
|
|
116
|
-
shouldHideComponent={false}
|
|
117
|
-
toolbarItems={[
|
|
118
|
-
{ type: 'button', icon: <IconMagnifier16 />, onClick: cy.stub(), tooltip: 'Test tooltip' },
|
|
119
|
-
{ type: 'button', icon: <IconMagnifier16 />, onClick: cy.stub(), tooltip: 'Test tooltip' },
|
|
120
|
-
]}
|
|
121
|
-
>
|
|
122
|
-
<div data-test-id="block-item-wrapper-child" className="tw-w-8 tw-h-8 tw-bg-red-50" />
|
|
123
|
-
</BlockItemWrapper>,
|
|
124
|
-
);
|
|
125
|
-
cy.get(ToolbarButtonSelector).eq(0).focus();
|
|
126
|
-
cy.get(ToolbarSelector).should('be.visible');
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('should render the outline and the toolbar if enabled', () => {
|
|
130
|
-
mount(
|
|
131
|
-
<BlockItemWrapper
|
|
132
|
-
toolbarItems={[
|
|
133
|
-
{ type: 'button', icon: <IconMagnifier16 />, onClick: cy.stub(), tooltip: 'Test tooltip' },
|
|
134
|
-
{ type: 'button', icon: <IconMagnifier16 />, onClick: cy.stub(), tooltip: 'Test tooltip' },
|
|
135
|
-
]}
|
|
136
|
-
shouldBeShown
|
|
137
|
-
>
|
|
138
|
-
<div data-test-id="block-item-wrapper-child" className="tw-w-8 tw-h-8 tw-bg-red-50" />
|
|
139
|
-
</BlockItemWrapper>,
|
|
140
|
-
);
|
|
141
|
-
cy.get(ChildSelector).should('exist');
|
|
142
|
-
cy.get(BlockItemWrapperSelector).should('have.css', 'outline-style', 'solid');
|
|
143
|
-
cy.get(ToolbarSelector).should('be.visible');
|
|
144
|
-
});
|
|
145
|
-
});
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { type ReactElement, useRef, useState } from 'react';
|
|
4
|
-
|
|
5
|
-
import { joinClassNames } from '../../utilities';
|
|
6
|
-
|
|
7
|
-
import { DEFAULT_MENU_BUTTON_ID, Toolbar, type ToolbarItem } from './Toolbar';
|
|
8
|
-
import { type BlockItemWrapperProps } from './types';
|
|
9
|
-
import { DragPreviewContextProvider } from './Toolbar/context/DragPreviewContext';
|
|
10
|
-
import { MultiFlyoutContextProvider } from './Toolbar/context/MultiFlyoutContext';
|
|
11
|
-
|
|
12
|
-
export const BlockItemWrapper = ({
|
|
13
|
-
children,
|
|
14
|
-
toolbarItems,
|
|
15
|
-
shouldHideWrapper,
|
|
16
|
-
shouldHideComponent = false,
|
|
17
|
-
isDragging = false,
|
|
18
|
-
shouldFillContainer,
|
|
19
|
-
outlineOffset = 2,
|
|
20
|
-
shouldBeShown = false,
|
|
21
|
-
showAttachments = false,
|
|
22
|
-
}: BlockItemWrapperProps): ReactElement => {
|
|
23
|
-
const [openFlyoutIds, setOpenFlyoutIds] = useState<string[]>(shouldBeShown ? [DEFAULT_MENU_BUTTON_ID] : []);
|
|
24
|
-
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
25
|
-
|
|
26
|
-
if (shouldHideWrapper) {
|
|
27
|
-
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
28
|
-
return <>{children}</>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const items = toolbarItems?.filter((item): item is ToolbarItem => item !== undefined);
|
|
32
|
-
|
|
33
|
-
const shouldToolbarBeVisible = openFlyoutIds.length > 0 || shouldBeShown;
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<DragPreviewContextProvider isDragPreview={isDragging}>
|
|
37
|
-
<MultiFlyoutContextProvider openFlyoutIds={openFlyoutIds} setOpenFlyoutIds={setOpenFlyoutIds}>
|
|
38
|
-
<div
|
|
39
|
-
ref={wrapperRef}
|
|
40
|
-
data-test-id="block-item-wrapper"
|
|
41
|
-
style={{
|
|
42
|
-
outlineOffset,
|
|
43
|
-
}}
|
|
44
|
-
className={joinClassNames([
|
|
45
|
-
'tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse',
|
|
46
|
-
shouldFillContainer && 'tw-flex-1 tw-h-full tw-w-full',
|
|
47
|
-
'hover:tw-outline focus-within:tw-outline',
|
|
48
|
-
shouldToolbarBeVisible && 'tw-outline',
|
|
49
|
-
shouldHideComponent && 'tw-opacity-0',
|
|
50
|
-
])}
|
|
51
|
-
>
|
|
52
|
-
<div
|
|
53
|
-
style={{
|
|
54
|
-
right: -1 - outlineOffset,
|
|
55
|
-
bottom: `calc(100% - ${2 + outlineOffset}px)`,
|
|
56
|
-
}}
|
|
57
|
-
className={joinClassNames([
|
|
58
|
-
'tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]',
|
|
59
|
-
'group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100',
|
|
60
|
-
'tw-flex tw-justify-end',
|
|
61
|
-
shouldToolbarBeVisible && 'tw-opacity-100',
|
|
62
|
-
])}
|
|
63
|
-
>
|
|
64
|
-
<Toolbar
|
|
65
|
-
attachments={{
|
|
66
|
-
isEnabled: showAttachments,
|
|
67
|
-
}}
|
|
68
|
-
items={items}
|
|
69
|
-
/>
|
|
70
|
-
</div>
|
|
71
|
-
{children}
|
|
72
|
-
</div>
|
|
73
|
-
</MultiFlyoutContextProvider>
|
|
74
|
-
</DragPreviewContextProvider>
|
|
75
|
-
);
|
|
76
|
-
};
|