@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
package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.spec.tsx
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { fireEvent, render, waitFor } from '@testing-library/react';
|
|
4
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
-
import { IconAdobeCreativeCloud } from '@frontify/fondue';
|
|
6
|
-
import { MenuToolbarButton } from '.';
|
|
7
|
-
import { MultiFlyoutContextProvider } from '../context/MultiFlyoutContext';
|
|
8
|
-
|
|
9
|
-
const BUTTON_ID = 'block-item-wrapper-toolbar-flyout';
|
|
10
|
-
const MENU_ITEM_ID = 'menu-item';
|
|
11
|
-
const TOOLTIP_ID = 'toolbar-button-tooltip';
|
|
12
|
-
|
|
13
|
-
const TEST_FLYOUT_ID = 'test';
|
|
14
|
-
const TEST_TOOLTIP = 'tooltip';
|
|
15
|
-
/**
|
|
16
|
-
* @vitest-environment happy-dom
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
describe('MenuToolbarButton', () => {
|
|
20
|
-
it('should log error if not inside a flyout provider when opening', async () => {
|
|
21
|
-
vi.spyOn(console, 'error');
|
|
22
|
-
const { getByTestId } = render(<MenuToolbarButton items={[]} />);
|
|
23
|
-
|
|
24
|
-
await fireEvent.click(getByTestId(BUTTON_ID));
|
|
25
|
-
|
|
26
|
-
expect(console.error).toBeCalled();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('should use flyout Id in flyout context', async () => {
|
|
30
|
-
const setOpenFlyoutIdsStub = vi.fn();
|
|
31
|
-
|
|
32
|
-
const { getByTestId } = render(
|
|
33
|
-
<MultiFlyoutContextProvider openFlyoutIds={[]} setOpenFlyoutIds={setOpenFlyoutIdsStub}>
|
|
34
|
-
<MenuToolbarButton items={[]} flyoutId={TEST_FLYOUT_ID} />
|
|
35
|
-
</MultiFlyoutContextProvider>,
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
await fireEvent.click(getByTestId(BUTTON_ID));
|
|
39
|
-
|
|
40
|
-
expect(setOpenFlyoutIdsStub).toHaveBeenCalled();
|
|
41
|
-
const dispatchedStateResult = setOpenFlyoutIdsStub.mock.lastCall[0]([]);
|
|
42
|
-
expect(dispatchedStateResult).toEqual([TEST_FLYOUT_ID]);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('should display menu items', async () => {
|
|
46
|
-
const setOpenFlyoutIdsStub = vi.fn();
|
|
47
|
-
|
|
48
|
-
const { getAllByTestId } = render(
|
|
49
|
-
<MultiFlyoutContextProvider openFlyoutIds={[TEST_FLYOUT_ID]} setOpenFlyoutIds={setOpenFlyoutIdsStub}>
|
|
50
|
-
<MenuToolbarButton
|
|
51
|
-
items={[
|
|
52
|
-
[{ title: 'item-1', onClick: vi.fn(), icon: <IconAdobeCreativeCloud /> }],
|
|
53
|
-
[{ title: 'item-2', onClick: vi.fn(), icon: <IconAdobeCreativeCloud /> }],
|
|
54
|
-
]}
|
|
55
|
-
flyoutId={TEST_FLYOUT_ID}
|
|
56
|
-
/>
|
|
57
|
-
</MultiFlyoutContextProvider>,
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
expect(getAllByTestId(MENU_ITEM_ID)).toHaveLength(2);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('should show tooltip content', async () => {
|
|
64
|
-
const setOpenFlyoutIdsStub = vi.fn();
|
|
65
|
-
|
|
66
|
-
const { getByTestId } = render(
|
|
67
|
-
<MultiFlyoutContextProvider openFlyoutIds={[]} setOpenFlyoutIds={setOpenFlyoutIdsStub}>
|
|
68
|
-
<MenuToolbarButton items={[]} tooltip={TEST_TOOLTIP} flyoutId={TEST_FLYOUT_ID} />
|
|
69
|
-
</MultiFlyoutContextProvider>,
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
getByTestId(BUTTON_ID).focus();
|
|
73
|
-
|
|
74
|
-
await waitFor(() => expect(getByTestId(TOOLTIP_ID)).not.toHaveClass('tw-opacity-0'));
|
|
75
|
-
expect(getByTestId(TOOLTIP_ID)).toHaveTextContent(TEST_TOOLTIP);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { IconDotsHorizontal16, useMemoizedId } from '@frontify/fondue';
|
|
4
|
-
import { ToolbarFlyoutMenu, ToolbarFlyoutMenuItem } from './ToolbarFlyoutMenu';
|
|
5
|
-
import { FlyoutToolbarButton } from '../FlyoutToolbarButton/FlyoutToolbarButton';
|
|
6
|
-
|
|
7
|
-
export const DEFAULT_MENU_BUTTON_ID = 'menu';
|
|
8
|
-
|
|
9
|
-
export type MenuToolbarButtonProps = {
|
|
10
|
-
items: ToolbarFlyoutMenuItem[][];
|
|
11
|
-
flyoutId?: string;
|
|
12
|
-
tooltip?: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const MenuToolbarButton = ({
|
|
16
|
-
items,
|
|
17
|
-
flyoutId = DEFAULT_MENU_BUTTON_ID,
|
|
18
|
-
tooltip = 'Options',
|
|
19
|
-
}: MenuToolbarButtonProps) => {
|
|
20
|
-
const id = useMemoizedId(flyoutId);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<FlyoutToolbarButton
|
|
24
|
-
icon={<IconDotsHorizontal16 />}
|
|
25
|
-
tooltip={tooltip}
|
|
26
|
-
flyoutId={id}
|
|
27
|
-
content={<ToolbarFlyoutMenu items={items} flyoutId={id} />}
|
|
28
|
-
/>
|
|
29
|
-
);
|
|
30
|
-
};
|
package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.spec.tsx
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { fireEvent, render } from '@testing-library/react';
|
|
4
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
-
import { IconAdobeCreativeCloud } from '@frontify/fondue';
|
|
6
|
-
import { ToolbarFlyoutMenu } from './ToolbarFlyoutMenu';
|
|
7
|
-
import { MultiFlyoutContextProvider } from '../context/MultiFlyoutContext';
|
|
8
|
-
|
|
9
|
-
const MENU_ITEM_ID = 'menu-item';
|
|
10
|
-
|
|
11
|
-
const TEST_FLYOUT_ID = 'test';
|
|
12
|
-
/**
|
|
13
|
-
* @vitest-environment happy-dom
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
describe('ToolbarFlyoutMenu', () => {
|
|
17
|
-
it('should display menu items', async () => {
|
|
18
|
-
const setOpenFlyoutIdsStub = vi.fn();
|
|
19
|
-
|
|
20
|
-
const { getAllByTestId } = render(
|
|
21
|
-
<MultiFlyoutContextProvider openFlyoutIds={[TEST_FLYOUT_ID]} setOpenFlyoutIds={setOpenFlyoutIdsStub}>
|
|
22
|
-
<ToolbarFlyoutMenu
|
|
23
|
-
items={[
|
|
24
|
-
[{ title: 'item-1', onClick: vi.fn(), icon: <IconAdobeCreativeCloud /> }],
|
|
25
|
-
[{ title: 'item-2', onClick: vi.fn(), icon: <IconAdobeCreativeCloud /> }],
|
|
26
|
-
]}
|
|
27
|
-
flyoutId={TEST_FLYOUT_ID}
|
|
28
|
-
/>
|
|
29
|
-
</MultiFlyoutContextProvider>,
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
expect(getAllByTestId(MENU_ITEM_ID)).toHaveLength(2);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should close flyout onClick', async () => {
|
|
36
|
-
const setOpenFlyoutIdsStub = vi.fn();
|
|
37
|
-
const onClickStub = vi.fn();
|
|
38
|
-
|
|
39
|
-
const { getByTestId } = render(
|
|
40
|
-
<MultiFlyoutContextProvider openFlyoutIds={[TEST_FLYOUT_ID]} setOpenFlyoutIds={setOpenFlyoutIdsStub}>
|
|
41
|
-
<ToolbarFlyoutMenu
|
|
42
|
-
items={[
|
|
43
|
-
[
|
|
44
|
-
{
|
|
45
|
-
title: 'item-1',
|
|
46
|
-
onClick: onClickStub,
|
|
47
|
-
icon: <IconAdobeCreativeCloud />,
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
]}
|
|
51
|
-
flyoutId={TEST_FLYOUT_ID}
|
|
52
|
-
/>
|
|
53
|
-
</MultiFlyoutContextProvider>,
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
expect(getByTestId(MENU_ITEM_ID)).toBeVisible();
|
|
57
|
-
|
|
58
|
-
await fireEvent.pointerUp(getByTestId(MENU_ITEM_ID));
|
|
59
|
-
|
|
60
|
-
expect(onClickStub).toHaveBeenCalledOnce();
|
|
61
|
-
expect(setOpenFlyoutIdsStub).toHaveBeenCalledOnce();
|
|
62
|
-
});
|
|
63
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { ActionMenu, MenuItemContentSize, MenuItemStyle } from '@frontify/fondue';
|
|
4
|
-
import { useMultiFlyoutState } from '../hooks/useMultiFlyoutState';
|
|
5
|
-
|
|
6
|
-
export type ToolbarFlyoutMenuItem = {
|
|
7
|
-
title: string;
|
|
8
|
-
onClick: () => void;
|
|
9
|
-
icon: JSX.Element;
|
|
10
|
-
style?: MenuItemStyle;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type ToolbarFlyoutMenuProps = {
|
|
14
|
-
items: ToolbarFlyoutMenuItem[][];
|
|
15
|
-
flyoutId: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const ToolbarFlyoutMenu = ({ items, flyoutId }: ToolbarFlyoutMenuProps) => {
|
|
19
|
-
const { onOpenChange } = useMultiFlyoutState(flyoutId);
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<ActionMenu
|
|
23
|
-
menuBlocks={items.map((block, blockIndex) => ({
|
|
24
|
-
id: blockIndex.toString(),
|
|
25
|
-
menuItems: block.map((item, itemIndex) => ({
|
|
26
|
-
id: blockIndex.toString() + itemIndex.toString(),
|
|
27
|
-
size: MenuItemContentSize.XSmall,
|
|
28
|
-
title: item.title,
|
|
29
|
-
style: item.style,
|
|
30
|
-
onClick: () => {
|
|
31
|
-
onOpenChange(false);
|
|
32
|
-
item.onClick();
|
|
33
|
-
},
|
|
34
|
-
initialValue: true,
|
|
35
|
-
decorator: <div className="tw-mr-2">{item.icon}</div>,
|
|
36
|
-
})),
|
|
37
|
-
}))}
|
|
38
|
-
/>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { getAppBridgeBlockStub } from '@frontify/app-bridge';
|
|
4
|
-
import { IconArrowMove16, IconMoveTo, IconTrashBin } from '@frontify/fondue';
|
|
5
|
-
import { fireEvent, render } from '@testing-library/react';
|
|
6
|
-
import userEvent from '@testing-library/user-event';
|
|
7
|
-
import { beforeAll, describe, expect, it, vi } from 'vitest';
|
|
8
|
-
|
|
9
|
-
import { AttachmentsProvider } from '../../../hooks/useAttachments';
|
|
10
|
-
|
|
11
|
-
import { Toolbar } from './Toolbar';
|
|
12
|
-
import { MultiFlyoutContextProvider } from './context/MultiFlyoutContext';
|
|
13
|
-
import { DragPreviewContextProvider } from './context/DragPreviewContext';
|
|
14
|
-
import { DEFAULT_ATTACHMENTS_BUTTON_ID } from './AttachmentsToolbarButton';
|
|
15
|
-
import { DEFAULT_MENU_BUTTON_ID } from './MenuToolbarButton';
|
|
16
|
-
import { ToolbarItem } from './types';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @vitest-environment happy-dom
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
const ATTACHMENTS_FLYOUT_ID = 'attachments-flyout-content';
|
|
23
|
-
const MENU_FLYOUT_ID = 'menu-item';
|
|
24
|
-
|
|
25
|
-
const MOCK_ASSET_FIELD_ID = 'attachment';
|
|
26
|
-
|
|
27
|
-
describe('Toolbar', () => {
|
|
28
|
-
const stubs = vi.hoisted(() => ({
|
|
29
|
-
setOpenFlyoutIds: vi.fn(),
|
|
30
|
-
onClick: vi.fn(),
|
|
31
|
-
onDrag: vi.fn(),
|
|
32
|
-
onKeyDown: vi.fn(),
|
|
33
|
-
}));
|
|
34
|
-
|
|
35
|
-
const STUB_WITH_NO_ASSETS = getAppBridgeBlockStub({
|
|
36
|
-
blockId: 1,
|
|
37
|
-
blockAssets: { [MOCK_ASSET_FIELD_ID]: [] },
|
|
38
|
-
editorState: true,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const FULL_ITEMS: ToolbarItem[] = [
|
|
42
|
-
{
|
|
43
|
-
type: 'dragHandle',
|
|
44
|
-
setActivatorNodeRef: vi.fn(),
|
|
45
|
-
icon: <IconMoveTo />,
|
|
46
|
-
draggableProps: { onDrag: stubs.onDrag, onKeyDown: stubs.onKeyDown },
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
type: 'button',
|
|
50
|
-
onClick: stubs.onClick,
|
|
51
|
-
icon: <IconTrashBin />,
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
type: 'flyout',
|
|
55
|
-
icon: <IconArrowMove16 />,
|
|
56
|
-
tooltip: 'Move To',
|
|
57
|
-
content: <div>Content</div>,
|
|
58
|
-
flyoutHeader: <div>Fixed Header</div>,
|
|
59
|
-
flyoutFooter: <div>Fixed Footer</div>,
|
|
60
|
-
flyoutId: 'move',
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
type: 'menu',
|
|
64
|
-
items: [
|
|
65
|
-
[
|
|
66
|
-
{
|
|
67
|
-
title: 'Replace with upload',
|
|
68
|
-
icon: <div></div>,
|
|
69
|
-
onClick: stubs.onClick,
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
],
|
|
73
|
-
},
|
|
74
|
-
];
|
|
75
|
-
|
|
76
|
-
beforeAll(() => {
|
|
77
|
-
vi.stubGlobal(
|
|
78
|
-
'Worker',
|
|
79
|
-
class Worker {
|
|
80
|
-
constructor() {}
|
|
81
|
-
addEventListener() {}
|
|
82
|
-
terminate() {}
|
|
83
|
-
},
|
|
84
|
-
);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('should not throw error if toolbar does not have attachments enabled', () => {
|
|
88
|
-
expect(() => render(<Toolbar items={[]} attachments={{ isEnabled: false }} />)).not.toThrowError();
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('should throw error if toolbar does have attachments enabled without provider', () => {
|
|
92
|
-
expect(() => render(<Toolbar items={[]} attachments={{ isEnabled: true }} />)).toThrowError();
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('should have every item type accessible by mouse', async () => {
|
|
96
|
-
const ToolbarWithAttachments = () => (
|
|
97
|
-
<MultiFlyoutContextProvider openFlyoutIds={[]} setOpenFlyoutIds={stubs.setOpenFlyoutIds}>
|
|
98
|
-
<AttachmentsProvider appBridge={STUB_WITH_NO_ASSETS} assetId={MOCK_ASSET_FIELD_ID}>
|
|
99
|
-
<Toolbar items={FULL_ITEMS} attachments={{ isEnabled: true }} />
|
|
100
|
-
</AttachmentsProvider>
|
|
101
|
-
</MultiFlyoutContextProvider>
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
const { getAllByRole } = render(<ToolbarWithAttachments />);
|
|
105
|
-
|
|
106
|
-
const buttons = getAllByRole('button');
|
|
107
|
-
expect(buttons).toHaveLength(5);
|
|
108
|
-
|
|
109
|
-
const [attachmentBtn, dragBtn, btn, flyoutBtn, menuBtn] = buttons;
|
|
110
|
-
|
|
111
|
-
// Click Interactions
|
|
112
|
-
|
|
113
|
-
await fireEvent.click(attachmentBtn);
|
|
114
|
-
expect(stubs.setOpenFlyoutIds).toHaveBeenCalledTimes(1);
|
|
115
|
-
|
|
116
|
-
await fireEvent.drag(dragBtn);
|
|
117
|
-
expect(stubs.onDrag).toHaveBeenCalledTimes(1);
|
|
118
|
-
|
|
119
|
-
await fireEvent.click(btn);
|
|
120
|
-
expect(stubs.onClick).toHaveBeenCalledTimes(1);
|
|
121
|
-
|
|
122
|
-
await fireEvent.click(flyoutBtn);
|
|
123
|
-
expect(stubs.setOpenFlyoutIds).toHaveBeenCalledTimes(2);
|
|
124
|
-
|
|
125
|
-
await fireEvent.click(menuBtn);
|
|
126
|
-
expect(stubs.setOpenFlyoutIds).toHaveBeenCalledTimes(3);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('should have every item type accessible by keyboard', async () => {
|
|
130
|
-
const ToolbarWithAttachments = () => (
|
|
131
|
-
<MultiFlyoutContextProvider openFlyoutIds={[]} setOpenFlyoutIds={stubs.setOpenFlyoutIds}>
|
|
132
|
-
<AttachmentsProvider appBridge={STUB_WITH_NO_ASSETS} assetId={MOCK_ASSET_FIELD_ID}>
|
|
133
|
-
<Toolbar items={FULL_ITEMS} attachments={{ isEnabled: true }} />
|
|
134
|
-
</AttachmentsProvider>
|
|
135
|
-
</MultiFlyoutContextProvider>
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
const user = userEvent.setup();
|
|
139
|
-
|
|
140
|
-
const { getAllByRole } = render(<ToolbarWithAttachments />);
|
|
141
|
-
|
|
142
|
-
const buttons = getAllByRole('button');
|
|
143
|
-
expect(buttons).toHaveLength(5);
|
|
144
|
-
|
|
145
|
-
const [attachmentBtn, dragBtn, btn, flyoutBtn, menuBtn] = buttons;
|
|
146
|
-
|
|
147
|
-
await user.keyboard('{Tab}');
|
|
148
|
-
|
|
149
|
-
expect(attachmentBtn).toHaveFocus();
|
|
150
|
-
await user.keyboard('{Enter}');
|
|
151
|
-
expect(stubs.setOpenFlyoutIds).toHaveBeenCalledTimes(1);
|
|
152
|
-
|
|
153
|
-
await user.keyboard('{Tab}');
|
|
154
|
-
|
|
155
|
-
expect(dragBtn).toHaveFocus();
|
|
156
|
-
await user.keyboard('{Enter}');
|
|
157
|
-
expect(stubs.onKeyDown).toHaveBeenCalledTimes(1);
|
|
158
|
-
|
|
159
|
-
await user.keyboard('{Tab}');
|
|
160
|
-
|
|
161
|
-
expect(btn).toHaveFocus();
|
|
162
|
-
await user.keyboard('{Enter}');
|
|
163
|
-
expect(stubs.onClick).toHaveBeenCalledTimes(1);
|
|
164
|
-
|
|
165
|
-
await user.keyboard('{Tab}');
|
|
166
|
-
|
|
167
|
-
expect(flyoutBtn).toHaveFocus();
|
|
168
|
-
await user.keyboard('{Enter}');
|
|
169
|
-
expect(stubs.setOpenFlyoutIds).toHaveBeenCalledTimes(2);
|
|
170
|
-
|
|
171
|
-
await user.keyboard('{Tab}');
|
|
172
|
-
|
|
173
|
-
expect(menuBtn).toHaveFocus();
|
|
174
|
-
await user.keyboard('{Enter}');
|
|
175
|
-
expect(stubs.setOpenFlyoutIds).toHaveBeenCalledTimes(3);
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
it('should open flyouts if not dragging', async () => {
|
|
179
|
-
const STUB_WITH_NO_ASSETS = getAppBridgeBlockStub({
|
|
180
|
-
blockId: 1,
|
|
181
|
-
blockAssets: { [MOCK_ASSET_FIELD_ID]: [] },
|
|
182
|
-
editorState: true,
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
const ToolbarWithAttachments = () => (
|
|
186
|
-
<MultiFlyoutContextProvider
|
|
187
|
-
openFlyoutIds={[DEFAULT_ATTACHMENTS_BUTTON_ID, DEFAULT_MENU_BUTTON_ID]}
|
|
188
|
-
setOpenFlyoutIds={vi.fn()}
|
|
189
|
-
>
|
|
190
|
-
<AttachmentsProvider appBridge={STUB_WITH_NO_ASSETS} assetId={MOCK_ASSET_FIELD_ID}>
|
|
191
|
-
<Toolbar
|
|
192
|
-
items={[
|
|
193
|
-
{
|
|
194
|
-
type: 'menu',
|
|
195
|
-
items: [
|
|
196
|
-
[
|
|
197
|
-
{
|
|
198
|
-
title: 'Replace with upload',
|
|
199
|
-
icon: <div></div>,
|
|
200
|
-
onClick: vi.fn(),
|
|
201
|
-
},
|
|
202
|
-
],
|
|
203
|
-
],
|
|
204
|
-
},
|
|
205
|
-
]}
|
|
206
|
-
attachments={{ isEnabled: true }}
|
|
207
|
-
/>
|
|
208
|
-
</AttachmentsProvider>
|
|
209
|
-
</MultiFlyoutContextProvider>
|
|
210
|
-
);
|
|
211
|
-
|
|
212
|
-
const { baseElement } = render(<ToolbarWithAttachments />, { container: document.body });
|
|
213
|
-
|
|
214
|
-
expect(baseElement.querySelector(`[data-test-id=${ATTACHMENTS_FLYOUT_ID}]`)).not.toBeNull();
|
|
215
|
-
expect(baseElement.querySelector(`[data-test-id=${MENU_FLYOUT_ID}]`)).not.toBeNull();
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
it('should keep flyouts closed if dragging', async () => {
|
|
219
|
-
const MOCK_ASSET_FIELD_ID = 'attachment';
|
|
220
|
-
const STUB_WITH_NO_ASSETS = getAppBridgeBlockStub({
|
|
221
|
-
blockId: 1,
|
|
222
|
-
blockAssets: { [MOCK_ASSET_FIELD_ID]: [] },
|
|
223
|
-
editorState: true,
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
const ToolbarWithAttachments = () => (
|
|
227
|
-
<MultiFlyoutContextProvider
|
|
228
|
-
openFlyoutIds={[DEFAULT_ATTACHMENTS_BUTTON_ID, DEFAULT_MENU_BUTTON_ID]}
|
|
229
|
-
setOpenFlyoutIds={vi.fn()}
|
|
230
|
-
>
|
|
231
|
-
<DragPreviewContextProvider isDragPreview>
|
|
232
|
-
<AttachmentsProvider appBridge={STUB_WITH_NO_ASSETS} assetId={MOCK_ASSET_FIELD_ID}>
|
|
233
|
-
<Toolbar
|
|
234
|
-
items={[
|
|
235
|
-
{
|
|
236
|
-
type: 'menu',
|
|
237
|
-
items: [
|
|
238
|
-
[
|
|
239
|
-
{
|
|
240
|
-
title: 'Replace with upload',
|
|
241
|
-
icon: <div></div>,
|
|
242
|
-
onClick: vi.fn(),
|
|
243
|
-
},
|
|
244
|
-
],
|
|
245
|
-
],
|
|
246
|
-
},
|
|
247
|
-
]}
|
|
248
|
-
attachments={{ isEnabled: true }}
|
|
249
|
-
/>
|
|
250
|
-
</AttachmentsProvider>
|
|
251
|
-
</DragPreviewContextProvider>
|
|
252
|
-
</MultiFlyoutContextProvider>
|
|
253
|
-
);
|
|
254
|
-
|
|
255
|
-
const { baseElement } = render(<ToolbarWithAttachments />, { container: document.body });
|
|
256
|
-
expect(baseElement.querySelector(`[data-test-id=${ATTACHMENTS_FLYOUT_ID}]`)).toBeNull();
|
|
257
|
-
expect(baseElement.querySelector(`[data-test-id=${MENU_FLYOUT_ID}]`)).toBeNull();
|
|
258
|
-
});
|
|
259
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { ToolbarSegment } from './ToolbarSegment';
|
|
4
|
-
import { AttachmentsToolbarButton } from './AttachmentsToolbarButton';
|
|
5
|
-
import { type ToolbarProps } from './types';
|
|
6
|
-
import { ToolbarButton } from './ToolbarButton';
|
|
7
|
-
import { DragHandleToolbarButton } from './DragHandleToolbarButton';
|
|
8
|
-
import { FlyoutToolbarButton } from './FlyoutToolbarButton';
|
|
9
|
-
import { MenuToolbarButton } from './MenuToolbarButton';
|
|
10
|
-
|
|
11
|
-
export const Toolbar = ({ items, attachments }: ToolbarProps) => (
|
|
12
|
-
<div
|
|
13
|
-
data-test-id="block-item-wrapper-toolbar"
|
|
14
|
-
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"
|
|
15
|
-
>
|
|
16
|
-
{attachments.isEnabled && (
|
|
17
|
-
<ToolbarSegment>
|
|
18
|
-
<AttachmentsToolbarButton />
|
|
19
|
-
</ToolbarSegment>
|
|
20
|
-
)}
|
|
21
|
-
<ToolbarSegment>
|
|
22
|
-
{items.map((item) => {
|
|
23
|
-
if (item.type === 'dragHandle') {
|
|
24
|
-
return <DragHandleToolbarButton key={item.tooltip + item.type} {...item} />;
|
|
25
|
-
}
|
|
26
|
-
if (item.type === 'menu') {
|
|
27
|
-
return <MenuToolbarButton key={item.tooltip + item.type} {...item} />;
|
|
28
|
-
}
|
|
29
|
-
if (item.type === 'flyout') {
|
|
30
|
-
return <FlyoutToolbarButton key={item.tooltip + item.type} {...item} />;
|
|
31
|
-
}
|
|
32
|
-
return <ToolbarButton key={item.tooltip + item.type} {...item} />;
|
|
33
|
-
})}
|
|
34
|
-
</ToolbarSegment>
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { fireEvent, render, waitFor } from '@testing-library/react';
|
|
4
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
-
import { ToolbarButton } from './ToolbarButton';
|
|
6
|
-
import { IconAdobeCreativeCloud } from '@frontify/fondue';
|
|
7
|
-
import { DragPreviewContextProvider } from '../context/DragPreviewContext';
|
|
8
|
-
|
|
9
|
-
const TOOLBAR_BUTTON_ID = 'block-item-wrapper-toolbar-btn';
|
|
10
|
-
const TOOLTIP_ID = 'toolbar-button-tooltip';
|
|
11
|
-
|
|
12
|
-
const TOOLTIP_CONTENT = 'content';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @vitest-environment happy-dom
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
describe('ToolbarButton', () => {
|
|
19
|
-
it('should disable tooltip when item is in drag preview context', async () => {
|
|
20
|
-
const { getByTestId } = render(
|
|
21
|
-
<DragPreviewContextProvider isDragPreview>
|
|
22
|
-
<ToolbarButton onClick={vi.fn()} tooltip={TOOLTIP_CONTENT} icon={<IconAdobeCreativeCloud />} />
|
|
23
|
-
</DragPreviewContextProvider>,
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
expect(getByTestId(TOOLTIP_ID)).toHaveClass('tw-opacity-0');
|
|
27
|
-
|
|
28
|
-
getByTestId(TOOLTIP_ID).focus();
|
|
29
|
-
|
|
30
|
-
await waitFor(() => {
|
|
31
|
-
expect(getByTestId(TOOLTIP_ID)).toHaveClass('tw-opacity-0');
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should show tooltip when item is focused', async () => {
|
|
36
|
-
const { getByTestId } = render(
|
|
37
|
-
<ToolbarButton onClick={vi.fn()} tooltip={TOOLTIP_CONTENT} icon={<IconAdobeCreativeCloud />} />,
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
expect(getByTestId(TOOLTIP_ID)).toHaveClass('tw-opacity-0');
|
|
41
|
-
expect(getByTestId(TOOLTIP_ID)).toHaveTextContent(TOOLTIP_CONTENT);
|
|
42
|
-
|
|
43
|
-
getByTestId(TOOLTIP_ID).focus();
|
|
44
|
-
|
|
45
|
-
await waitFor(() => {
|
|
46
|
-
expect(getByTestId(TOOLTIP_ID)).not.toHaveClass('tw-opacity-0');
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should trigger onClick', async () => {
|
|
51
|
-
const onClickStub = vi.fn();
|
|
52
|
-
const { getByTestId } = render(
|
|
53
|
-
<ToolbarButton onClick={onClickStub} tooltip={TOOLTIP_CONTENT} icon={<IconAdobeCreativeCloud />} />,
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
await fireEvent.click(getByTestId(TOOLBAR_BUTTON_ID));
|
|
57
|
-
|
|
58
|
-
expect(onClickStub).toHaveBeenCalledOnce();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('should display icon', async () => {
|
|
62
|
-
const { getByTestId } = render(
|
|
63
|
-
<ToolbarButton onClick={vi.fn()} tooltip={TOOLTIP_CONTENT} icon={<IconAdobeCreativeCloud />} />,
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const icons = [...getByTestId(TOOLBAR_BUTTON_ID).getElementsByTagName('svg')];
|
|
67
|
-
expect(icons).toHaveLength(1);
|
|
68
|
-
expect(icons[0].outerHTML).toMatch('IconAdobeCreativeCloud');
|
|
69
|
-
});
|
|
70
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { useDragPreviewContext } from '../context/DragPreviewContext';
|
|
4
|
-
import { BaseToolbarButton } from '../BaseToolbarButton';
|
|
5
|
-
import { ToolbarButtonTooltip } from '../ToolbarButtonTooltip';
|
|
6
|
-
|
|
7
|
-
export type ToolbarButtonProps = { icon: JSX.Element; tooltip?: string; onClick: () => void };
|
|
8
|
-
|
|
9
|
-
export const ToolbarButton = ({ tooltip, icon, onClick }: ToolbarButtonProps) => {
|
|
10
|
-
const isDragPreview = useDragPreviewContext();
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<ToolbarButtonTooltip disabled={isDragPreview} content={tooltip ?? ''}>
|
|
14
|
-
<BaseToolbarButton data-test-id="block-item-wrapper-toolbar-btn" onClick={onClick}>
|
|
15
|
-
{icon}
|
|
16
|
-
</BaseToolbarButton>
|
|
17
|
-
</ToolbarButtonTooltip>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { LegacyTooltip as Tooltip, TooltipPosition } from '@frontify/fondue';
|
|
4
|
-
import { ReactElement, ReactNode } from 'react';
|
|
5
|
-
|
|
6
|
-
type ToolbarButtonTooltipProps = {
|
|
7
|
-
content: ReactNode;
|
|
8
|
-
children: ReactElement;
|
|
9
|
-
open?: boolean;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const ToolbarButtonTooltip = ({ open, content, children, disabled }: ToolbarButtonTooltipProps) => (
|
|
14
|
-
<Tooltip
|
|
15
|
-
withArrow
|
|
16
|
-
hoverDelay={0}
|
|
17
|
-
enterDelay={300}
|
|
18
|
-
open={open}
|
|
19
|
-
disabled={disabled}
|
|
20
|
-
position={TooltipPosition.Top}
|
|
21
|
-
content={<div>{content}</div>}
|
|
22
|
-
triggerElement={children}
|
|
23
|
-
data-test-id="toolbar-button-tooltip"
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { type ReactNode } from 'react';
|
|
4
|
-
|
|
5
|
-
export const ToolbarSegment = ({ children }: { children: ReactNode }) => (
|
|
6
|
-
<div 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">
|
|
7
|
-
{children}
|
|
8
|
-
</div>
|
|
9
|
-
);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { type ReactNode, createContext, useContext } from 'react';
|
|
4
|
-
|
|
5
|
-
const DragPreviewContext = createContext(false);
|
|
6
|
-
|
|
7
|
-
export const DragPreviewContextProvider = ({
|
|
8
|
-
children,
|
|
9
|
-
isDragPreview,
|
|
10
|
-
}: {
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
isDragPreview: boolean;
|
|
13
|
-
}) => <DragPreviewContext.Provider value={isDragPreview}>{children}</DragPreviewContext.Provider>;
|
|
14
|
-
|
|
15
|
-
export const useDragPreviewContext = () => useContext(DragPreviewContext);
|