@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,25 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { Dispatch, ReactNode, SetStateAction, createContext, useContext, useMemo } from 'react';
|
|
4
|
-
|
|
5
|
-
export type MultiFlyoutContextType = {
|
|
6
|
-
openFlyoutIds: string[];
|
|
7
|
-
setOpenFlyoutIds: Dispatch<SetStateAction<string[]>>;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const MultiFlyoutContext = createContext<MultiFlyoutContextType>({
|
|
11
|
-
openFlyoutIds: [],
|
|
12
|
-
setOpenFlyoutIds: () => console.error('No MultiFlyoutContext Provider found'),
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const MultiFlyoutContextProvider = ({
|
|
16
|
-
children,
|
|
17
|
-
openFlyoutIds,
|
|
18
|
-
setOpenFlyoutIds,
|
|
19
|
-
}: { children: ReactNode } & MultiFlyoutContextType) => {
|
|
20
|
-
const memoizedContext = useMemo(() => ({ openFlyoutIds, setOpenFlyoutIds }), [openFlyoutIds, setOpenFlyoutIds]);
|
|
21
|
-
|
|
22
|
-
return <MultiFlyoutContext.Provider value={memoizedContext}>{children}</MultiFlyoutContext.Provider>;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const useMultiFlyoutContext = () => useContext(MultiFlyoutContext);
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { FOCUS_VISIBLE_STYLE } from '@frontify/fondue';
|
|
4
|
-
|
|
5
|
-
import { joinClassNames } from '../../../utilities';
|
|
6
|
-
|
|
7
|
-
export const getToolbarButtonClassNames = (cursor: 'grab' | 'pointer', forceActiveStyle?: boolean) => {
|
|
8
|
-
const classNames = [
|
|
9
|
-
FOCUS_VISIBLE_STYLE,
|
|
10
|
-
'tw-relative tw-inline-flex tw-items-center tw-justify-center',
|
|
11
|
-
'tw-h-6 tw-p-1',
|
|
12
|
-
'tw-rounded',
|
|
13
|
-
'tw-text-xs tw-font-medium',
|
|
14
|
-
'tw-gap-0.5',
|
|
15
|
-
'focus-visible:tw-z-10',
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
if (forceActiveStyle) {
|
|
19
|
-
classNames.push(
|
|
20
|
-
'tw-bg-box-neutral-pressed',
|
|
21
|
-
'tw-text-box-neutral-inverse-pressed',
|
|
22
|
-
cursor === 'grab' ? 'tw-cursor-grabbing' : 'tw-cursor-pointer',
|
|
23
|
-
);
|
|
24
|
-
} else {
|
|
25
|
-
classNames.push(
|
|
26
|
-
'hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed',
|
|
27
|
-
'tw-text-text-weak hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed',
|
|
28
|
-
cursor === 'grab' ? '!tw-cursor-grab active:tw-cursor-grabbing' : 'tw-cursor-pointer',
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return joinClassNames(classNames);
|
|
33
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { renderHook } from '@testing-library/react';
|
|
4
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
-
import { useMultiFlyoutState } from './useMultiFlyoutState';
|
|
6
|
-
import { MultiFlyoutContextProvider, MultiFlyoutContextType } from '../context/MultiFlyoutContext';
|
|
7
|
-
|
|
8
|
-
const FLYOUT_ID = 'flyout';
|
|
9
|
-
|
|
10
|
-
const renderMultiFlyoutState = ({ openFlyoutIds, setOpenFlyoutIds }: MultiFlyoutContextType) =>
|
|
11
|
-
renderHook(() => useMultiFlyoutState(FLYOUT_ID), {
|
|
12
|
-
wrapper: ({ children }) => (
|
|
13
|
-
<MultiFlyoutContextProvider openFlyoutIds={openFlyoutIds} setOpenFlyoutIds={setOpenFlyoutIds}>
|
|
14
|
-
{children}
|
|
15
|
-
</MultiFlyoutContextProvider>
|
|
16
|
-
),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
describe('useMultiFlyoutState', () => {
|
|
20
|
-
it('should be open when flyout id in context array', () => {
|
|
21
|
-
const { result } = renderMultiFlyoutState({ openFlyoutIds: [FLYOUT_ID], setOpenFlyoutIds: vi.fn() });
|
|
22
|
-
expect(result.current.isOpen).toEqual(true);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should be closed when flyout id is not in context array', () => {
|
|
26
|
-
const { result } = renderMultiFlyoutState({ openFlyoutIds: [], setOpenFlyoutIds: vi.fn() });
|
|
27
|
-
expect(result.current.isOpen).toEqual(false);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('should add id to array when opening', () => {
|
|
31
|
-
const setOpenFlyoutIdsStub = vi.fn();
|
|
32
|
-
const { result } = renderMultiFlyoutState({ openFlyoutIds: [], setOpenFlyoutIds: setOpenFlyoutIdsStub });
|
|
33
|
-
|
|
34
|
-
result.current.onOpenChange(true);
|
|
35
|
-
const dispatchedResult = setOpenFlyoutIdsStub.mock.lastCall[0]([]);
|
|
36
|
-
|
|
37
|
-
expect(dispatchedResult).toEqual([FLYOUT_ID]);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should remove id from array when closing', () => {
|
|
41
|
-
const setOpenFlyoutIdsStub = vi.fn();
|
|
42
|
-
const { result } = renderMultiFlyoutState({ openFlyoutIds: [], setOpenFlyoutIds: setOpenFlyoutIdsStub });
|
|
43
|
-
|
|
44
|
-
result.current.onOpenChange(false);
|
|
45
|
-
const dispatchedResult = setOpenFlyoutIdsStub.mock.lastCall[0]([FLYOUT_ID]);
|
|
46
|
-
|
|
47
|
-
expect(dispatchedResult).toEqual([]);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should remove duplicates from array', () => {
|
|
51
|
-
const setOpenFlyoutIdsStub = vi.fn();
|
|
52
|
-
const { result } = renderMultiFlyoutState({ openFlyoutIds: [], setOpenFlyoutIds: setOpenFlyoutIdsStub });
|
|
53
|
-
|
|
54
|
-
result.current.onOpenChange(true);
|
|
55
|
-
const dispatchedResult = setOpenFlyoutIdsStub.mock.lastCall[0]([FLYOUT_ID, FLYOUT_ID, FLYOUT_ID]);
|
|
56
|
-
|
|
57
|
-
expect(dispatchedResult).toEqual([FLYOUT_ID]);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { useCallback } from 'react';
|
|
4
|
-
import { useMultiFlyoutContext } from '../context/MultiFlyoutContext';
|
|
5
|
-
|
|
6
|
-
export const useMultiFlyoutState = (flyoutId: string) => {
|
|
7
|
-
const { openFlyoutIds, setOpenFlyoutIds } = useMultiFlyoutContext();
|
|
8
|
-
|
|
9
|
-
const onOpenChange = useCallback(
|
|
10
|
-
(isFlyoutOpen: boolean) => {
|
|
11
|
-
setOpenFlyoutIds((currentIds) => {
|
|
12
|
-
const filteredIds = currentIds.filter((id) => id !== flyoutId);
|
|
13
|
-
if (!isFlyoutOpen) {
|
|
14
|
-
return filteredIds;
|
|
15
|
-
} else {
|
|
16
|
-
return [...filteredIds, flyoutId];
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
},
|
|
20
|
-
[flyoutId, setOpenFlyoutIds],
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
return { isOpen: openFlyoutIds.includes(flyoutId), onOpenChange };
|
|
24
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
export * from './context';
|
|
4
|
-
export * from './hooks';
|
|
5
|
-
export * from './Toolbar';
|
|
6
|
-
export * from './AttachmentsToolbarButton';
|
|
7
|
-
export * from './DragHandleToolbarButton';
|
|
8
|
-
export * from './FlyoutToolbarButton';
|
|
9
|
-
export * from './MenuToolbarButton';
|
|
10
|
-
export * from './types';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { type ToolbarButtonProps } from './ToolbarButton';
|
|
4
|
-
import { type DragHandleToolbarButtonProps } from './DragHandleToolbarButton';
|
|
5
|
-
import { type FlyoutToolbarButtonProps } from './FlyoutToolbarButton';
|
|
6
|
-
import { type MenuToolbarButtonProps } from './MenuToolbarButton';
|
|
7
|
-
|
|
8
|
-
export type ToolbarProps = {
|
|
9
|
-
items: ToolbarItem[];
|
|
10
|
-
attachments: { isEnabled: boolean };
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type DragHandleToolbarItem = { type: 'dragHandle' } & DragHandleToolbarButtonProps;
|
|
14
|
-
export type ButtonToolbarItem = { type: 'button' } & ToolbarButtonProps;
|
|
15
|
-
export type FlyoutToolbarItem = { type: 'flyout' } & FlyoutToolbarButtonProps;
|
|
16
|
-
export type MenuToolbarItem = { type: 'menu' } & MenuToolbarButtonProps;
|
|
17
|
-
|
|
18
|
-
export type ToolbarItem = DragHandleToolbarItem | ButtonToolbarItem | FlyoutToolbarItem | MenuToolbarItem;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { type ReactNode } from 'react';
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
|
-
import { type AttachmentsProvider, type withAttachmentsProvider } from '../../hooks/useAttachments';
|
|
7
|
-
import { type ToolbarItem } from './Toolbar';
|
|
8
|
-
|
|
9
|
-
export type BlockItemWrapperProps = {
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
shouldHideWrapper?: boolean;
|
|
12
|
-
shouldHideComponent?: boolean;
|
|
13
|
-
toolbarItems: (ToolbarItem | undefined)[];
|
|
14
|
-
isDragging?: boolean;
|
|
15
|
-
shouldFillContainer?: boolean;
|
|
16
|
-
outlineOffset?: number;
|
|
17
|
-
shouldBeShown?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* When set to true the BlockItemWrapper must be a child of a {@link AttachmentsProvider} component,
|
|
20
|
-
* or the block must be wrapped with a {@link withAttachmentsProvider} HOC.
|
|
21
|
-
* @default false
|
|
22
|
-
*/
|
|
23
|
-
showAttachments?: boolean;
|
|
24
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { mount } from 'cypress/react18';
|
|
4
|
-
import { DownloadButton } from '.';
|
|
5
|
-
|
|
6
|
-
const DownloadButtonSelector = '[data-test-id="download-button"]';
|
|
7
|
-
|
|
8
|
-
describe('DownloadButton', () => {
|
|
9
|
-
it('renders component', () => {
|
|
10
|
-
mount(<DownloadButton onDownload={cy.stub()} />);
|
|
11
|
-
cy.get(DownloadButtonSelector).should('exist');
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('calls onDownload on click', () => {
|
|
15
|
-
const onDownloadStub = cy.stub().as('downloadStub');
|
|
16
|
-
mount(<DownloadButton onDownload={onDownloadStub} />);
|
|
17
|
-
cy.get(DownloadButtonSelector).click();
|
|
18
|
-
cy.get('@downloadStub').should('have.been.called');
|
|
19
|
-
});
|
|
20
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { DownloadButtonProps } from './types';
|
|
4
|
-
import { useFocusRing } from '@react-aria/focus';
|
|
5
|
-
import { FOCUS_STYLE, IconArrowCircleDown16, LegacyTooltip as Tooltip, TooltipPosition } from '@frontify/fondue';
|
|
6
|
-
import { joinClassNames } from '../../utilities';
|
|
7
|
-
|
|
8
|
-
export const DownloadButton = ({ onDownload }: DownloadButtonProps) => {
|
|
9
|
-
const { isFocused, focusProps } = useFocusRing();
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<Tooltip
|
|
13
|
-
withArrow
|
|
14
|
-
position={TooltipPosition.Top}
|
|
15
|
-
content="Download"
|
|
16
|
-
enterDelay={500}
|
|
17
|
-
triggerElement={
|
|
18
|
-
<button
|
|
19
|
-
tabIndex={0}
|
|
20
|
-
aria-label="Download"
|
|
21
|
-
{...focusProps}
|
|
22
|
-
className={joinClassNames(['tw-outline-none tw-rounded', isFocused && FOCUS_STYLE])}
|
|
23
|
-
onClick={onDownload}
|
|
24
|
-
onPointerDown={(e) => e.preventDefault()}
|
|
25
|
-
>
|
|
26
|
-
<span
|
|
27
|
-
data-test-id="download-button"
|
|
28
|
-
className="tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line"
|
|
29
|
-
>
|
|
30
|
-
<IconArrowCircleDown16 />
|
|
31
|
-
</span>
|
|
32
|
-
</button>
|
|
33
|
-
}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
@@ -1,142 +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 { LinkInput } from './LinkInput';
|
|
6
|
-
import { ButtonSize, CheckboxState } from '@frontify/fondue';
|
|
7
|
-
|
|
8
|
-
const LINK_INPUT_ID = '[data-test-id="link-input"]';
|
|
9
|
-
const TEXT_INPUT_ID = '[data-test-id="text-input"]';
|
|
10
|
-
const INPUT_LABEL_CONTAINER_ID = '[data-test-id="input-label-container"]';
|
|
11
|
-
const BUTTON_ID = '[data-test-id="button"]';
|
|
12
|
-
const CLEAR_ICON_ID = '[data-test-id="clear-icon"]';
|
|
13
|
-
const CHECKBOX_ID = '[data-test-id="checkbox-input"]';
|
|
14
|
-
|
|
15
|
-
describe('Link Input', () => {
|
|
16
|
-
it('renders the link input', () => {
|
|
17
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
18
|
-
mount(<LinkInputWithStubs />);
|
|
19
|
-
cy.get(LINK_INPUT_ID).should('exist');
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('renders the link inpus label, placeholder and info', () => {
|
|
23
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
24
|
-
mount(<LinkInputWithStubs label="Custom Label" info="Custom Info" placeholder="Custom Placeholder" />);
|
|
25
|
-
cy.get(LINK_INPUT_ID).should('exist');
|
|
26
|
-
cy.get(INPUT_LABEL_CONTAINER_ID).contains('Custom Label');
|
|
27
|
-
cy.get(INPUT_LABEL_CONTAINER_ID).contains('Custom Info');
|
|
28
|
-
cy.get(TEXT_INPUT_ID).should('have.attr', 'placeholder', 'Custom Placeholder');
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('renders the link inpu with a valid url', () => {
|
|
32
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
33
|
-
mount(<LinkInputWithStubs url="https://example.com" />);
|
|
34
|
-
cy.get(LINK_INPUT_ID).should('exist');
|
|
35
|
-
cy.get(TEXT_INPUT_ID).should('have.value', 'https://example.com');
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('renders with clear icon', () => {
|
|
39
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
40
|
-
mount(<LinkInputWithStubs url="https://frontify.com" clearable />);
|
|
41
|
-
|
|
42
|
-
cy.get(CLEAR_ICON_ID).should('exist');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('renders without clear icon', () => {
|
|
46
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
47
|
-
mount(<LinkInputWithStubs clearable={false} />);
|
|
48
|
-
|
|
49
|
-
cy.get(TEXT_INPUT_ID).click({ force: true });
|
|
50
|
-
cy.get(TEXT_INPUT_ID).type('https://frontify.com').type('{enter}');
|
|
51
|
-
cy.get(CLEAR_ICON_ID).should('not.exist');
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('toggles checkbox on click', () => {
|
|
55
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
56
|
-
mount(
|
|
57
|
-
<LinkInputWithStubs
|
|
58
|
-
onToggleTab={cy.stub().as('onToggleTab')}
|
|
59
|
-
url="https://frontify.com"
|
|
60
|
-
openInNewTab={false}
|
|
61
|
-
/>,
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
cy.get(CHECKBOX_ID).should('not.be.checked');
|
|
65
|
-
cy.get(CHECKBOX_ID).click({ force: true });
|
|
66
|
-
cy.get('@onToggleTab').should('be.called.with', true);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('toggles checkbox on click if its already checked', () => {
|
|
70
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
71
|
-
mount(<LinkInputWithStubs onToggleTab={cy.stub().as('onToggleTab')} url="https://frontify.com" openInNewTab />);
|
|
72
|
-
|
|
73
|
-
cy.get(CHECKBOX_ID).should('be.checked');
|
|
74
|
-
cy.get(CHECKBOX_ID).click({ force: true });
|
|
75
|
-
cy.get('@onToggleTab').should('be.called.with', false);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('handles "Checked" state from newTab', () => {
|
|
79
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
80
|
-
mount(
|
|
81
|
-
<LinkInputWithStubs
|
|
82
|
-
onToggleTab={cy.stub().as('onToggleTab')}
|
|
83
|
-
url="https://frontify.com"
|
|
84
|
-
newTab={CheckboxState.Checked}
|
|
85
|
-
/>,
|
|
86
|
-
);
|
|
87
|
-
cy.get(CHECKBOX_ID).should('be.checked');
|
|
88
|
-
cy.get(CHECKBOX_ID).click({ force: true });
|
|
89
|
-
cy.get('@onToggleTab').should('be.called.with', false);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('handles "Unchecked" state from newTab', () => {
|
|
93
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
94
|
-
mount(
|
|
95
|
-
<LinkInputWithStubs
|
|
96
|
-
onToggleTab={cy.stub().as('onToggleTab')}
|
|
97
|
-
url="https://frontify.com"
|
|
98
|
-
newTab={CheckboxState.Unchecked}
|
|
99
|
-
/>,
|
|
100
|
-
);
|
|
101
|
-
cy.get(CHECKBOX_ID).should('not.be.checked');
|
|
102
|
-
cy.get(CHECKBOX_ID).click({ force: true });
|
|
103
|
-
cy.get('@onToggleTab').should('be.called.with', true);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('types into search field', () => {
|
|
107
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
108
|
-
mount(<LinkInputWithStubs onUrlChange={cy.stub().as('onUrlChange')} />);
|
|
109
|
-
|
|
110
|
-
cy.get(TEXT_INPUT_ID).click({ force: true });
|
|
111
|
-
cy.get(TEXT_INPUT_ID).type('https://frontify.com');
|
|
112
|
-
cy.get('@onUrlChange').should('be.called.with', 'https://frontify.com');
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('shows internal link button', () => {
|
|
116
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
117
|
-
mount(<LinkInputWithStubs />);
|
|
118
|
-
|
|
119
|
-
cy.get(BUTTON_ID).should('exist');
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('hides internal link button', () => {
|
|
123
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
124
|
-
mount(<LinkInputWithStubs hideInternalLinkButton />);
|
|
125
|
-
|
|
126
|
-
cy.get(BUTTON_ID).should('not.exist');
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('renders * if input is required', () => {
|
|
130
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
131
|
-
mount(<LinkInputWithStubs required label="Link" />);
|
|
132
|
-
|
|
133
|
-
cy.get(INPUT_LABEL_CONTAINER_ID).contains('*');
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it('renders custom buttonsize', () => {
|
|
137
|
-
const [LinkInputWithStubs] = withAppBridgeBlockStubs(LinkInput, {});
|
|
138
|
-
mount(<LinkInputWithStubs buttonSize={ButtonSize.Small} />);
|
|
139
|
-
|
|
140
|
-
cy.get(BUTTON_ID).should('have.class', 'tw-text-body-small');
|
|
141
|
-
});
|
|
142
|
-
});
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import type { AppBridgeBlock, AppBridgeTheme } from '@frontify/app-bridge';
|
|
4
|
-
import { ButtonSize, Checkbox, CheckboxState, FormControl, TextInput, TooltipPosition } from '@frontify/fondue';
|
|
5
|
-
import { LinkSelector } from './LinkSelector';
|
|
6
|
-
import { isValidUrlOrEmpty as internalIsValidUrlOrEmpty } from './utils';
|
|
7
|
-
|
|
8
|
-
type LinkInputProps = {
|
|
9
|
-
url?: string;
|
|
10
|
-
info?: string;
|
|
11
|
-
label?: string;
|
|
12
|
-
required?: boolean;
|
|
13
|
-
newTab?: CheckboxState;
|
|
14
|
-
openInNewTab?: boolean;
|
|
15
|
-
onUrlChange?: (value: string) => void;
|
|
16
|
-
onToggleTab?: (checked: boolean) => void;
|
|
17
|
-
isValidUrlOrEmpty?: (url: string) => boolean;
|
|
18
|
-
appBridge: AppBridgeBlock | AppBridgeTheme;
|
|
19
|
-
clearable?: boolean;
|
|
20
|
-
placeholder?: string;
|
|
21
|
-
buttonSize?: ButtonSize;
|
|
22
|
-
hideInternalLinkButton?: boolean;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const LinkInput = ({
|
|
26
|
-
onUrlChange,
|
|
27
|
-
onToggleTab,
|
|
28
|
-
isValidUrlOrEmpty,
|
|
29
|
-
appBridge,
|
|
30
|
-
clearable,
|
|
31
|
-
placeholder,
|
|
32
|
-
newTab,
|
|
33
|
-
openInNewTab,
|
|
34
|
-
url = '',
|
|
35
|
-
required,
|
|
36
|
-
info,
|
|
37
|
-
label,
|
|
38
|
-
buttonSize,
|
|
39
|
-
hideInternalLinkButton,
|
|
40
|
-
}: LinkInputProps) => {
|
|
41
|
-
const isUrlValid = isValidUrlOrEmpty ? isValidUrlOrEmpty(url) : internalIsValidUrlOrEmpty(url);
|
|
42
|
-
const checkedState = newTab ?? (openInNewTab ? CheckboxState.Checked : CheckboxState.Unchecked);
|
|
43
|
-
return (
|
|
44
|
-
<div data-test-id="link-input">
|
|
45
|
-
<FormControl
|
|
46
|
-
label={{
|
|
47
|
-
children: label,
|
|
48
|
-
htmlFor: 'url',
|
|
49
|
-
required,
|
|
50
|
-
tooltip: info ? { content: info, position: TooltipPosition.Top } : undefined,
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
<TextInput
|
|
54
|
-
id="url"
|
|
55
|
-
value={url}
|
|
56
|
-
clearable={clearable}
|
|
57
|
-
onChange={onUrlChange}
|
|
58
|
-
placeholder={placeholder ?? 'https://example.com'}
|
|
59
|
-
focusOnMount
|
|
60
|
-
/>
|
|
61
|
-
</FormControl>
|
|
62
|
-
{!isUrlValid && <div className="tw-text-text-negative tw-mt-1 tw-text-s">Please enter a valid URL.</div>}
|
|
63
|
-
|
|
64
|
-
{!hideInternalLinkButton && (
|
|
65
|
-
<div className="tw-mt-3">
|
|
66
|
-
<LinkSelector
|
|
67
|
-
url={url}
|
|
68
|
-
onUrlChange={onUrlChange}
|
|
69
|
-
buttonSize={buttonSize ?? ButtonSize.Medium}
|
|
70
|
-
getAllDocuments={() => appBridge.getAllDocuments()}
|
|
71
|
-
getDocumentPagesByDocumentId={(documentId) =>
|
|
72
|
-
appBridge.getDocumentPagesByDocumentId(documentId)
|
|
73
|
-
}
|
|
74
|
-
getDocumentSectionsByDocumentPageId={(documentPageId) =>
|
|
75
|
-
appBridge.getDocumentSectionsByDocumentPageId(documentPageId)
|
|
76
|
-
}
|
|
77
|
-
/>
|
|
78
|
-
</div>
|
|
79
|
-
)}
|
|
80
|
-
|
|
81
|
-
<div className="tw-mt-3">
|
|
82
|
-
<Checkbox value="new-tab" label="Open in new tab" state={checkedState} onChange={onToggleTab} />
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
);
|
|
86
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import type { DocumentPage, DocumentSection } from '@frontify/app-bridge';
|
|
4
|
-
import { useEffect, useState } from 'react';
|
|
5
|
-
import { PageLinks } from './PageLinks';
|
|
6
|
-
import { IconColorFan16, merge } from '@frontify/fondue';
|
|
7
|
-
import { InitiallyExpandedItems } from '../';
|
|
8
|
-
|
|
9
|
-
type DocumentLinkProps = {
|
|
10
|
-
document: {
|
|
11
|
-
id: number;
|
|
12
|
-
title: string;
|
|
13
|
-
permanentLink: string;
|
|
14
|
-
};
|
|
15
|
-
selectedUrl: string;
|
|
16
|
-
onSelectUrl: (url: string) => void;
|
|
17
|
-
itemsToExpandInitially: InitiallyExpandedItems;
|
|
18
|
-
getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;
|
|
19
|
-
getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const DocumentLink = ({
|
|
23
|
-
document,
|
|
24
|
-
selectedUrl,
|
|
25
|
-
onSelectUrl,
|
|
26
|
-
itemsToExpandInitially,
|
|
27
|
-
getDocumentSectionsByDocumentPageId,
|
|
28
|
-
getDocumentPagesByDocumentId,
|
|
29
|
-
}: DocumentLinkProps) => {
|
|
30
|
-
const [isExpanded, setIsExpanded] = useState(document.id === itemsToExpandInitially.documentId);
|
|
31
|
-
const isActive = document.permanentLink === selectedUrl;
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if (document.id === itemsToExpandInitially.documentId) {
|
|
35
|
-
setIsExpanded(true);
|
|
36
|
-
}
|
|
37
|
-
}, [itemsToExpandInitially, document.id]);
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<>
|
|
41
|
-
<button
|
|
42
|
-
data-test-id="internal-link-selector-document-link"
|
|
43
|
-
className={merge([
|
|
44
|
-
'tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-w-full',
|
|
45
|
-
isActive
|
|
46
|
-
? 'tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover'
|
|
47
|
-
: 'hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover',
|
|
48
|
-
])}
|
|
49
|
-
onClick={() => onSelectUrl(document.permanentLink)}
|
|
50
|
-
>
|
|
51
|
-
<button
|
|
52
|
-
role="button"
|
|
53
|
-
tabIndex={0}
|
|
54
|
-
data-test-id="tree-item-toggle"
|
|
55
|
-
className="tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer"
|
|
56
|
-
onClick={() => setIsExpanded(!isExpanded)}
|
|
57
|
-
>
|
|
58
|
-
<div
|
|
59
|
-
className={merge([
|
|
60
|
-
'tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong',
|
|
61
|
-
isExpanded ? 'tw-rotate-90' : '',
|
|
62
|
-
])}
|
|
63
|
-
></div>
|
|
64
|
-
</button>
|
|
65
|
-
<IconColorFan16 />
|
|
66
|
-
<span className="tw-text-s">{document.title}</span>
|
|
67
|
-
<span className="tw-flex-auto tw-font-sans tw-text-xs tw-text-right">Document</span>
|
|
68
|
-
</button>
|
|
69
|
-
{isExpanded && (
|
|
70
|
-
<PageLinks
|
|
71
|
-
documentId={document.id}
|
|
72
|
-
selectedUrl={selectedUrl}
|
|
73
|
-
onSelectUrl={onSelectUrl}
|
|
74
|
-
itemsToExpandInitially={itemsToExpandInitially}
|
|
75
|
-
getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}
|
|
76
|
-
getDocumentPagesByDocumentId={getDocumentPagesByDocumentId}
|
|
77
|
-
/>
|
|
78
|
-
)}
|
|
79
|
-
</>
|
|
80
|
-
);
|
|
81
|
-
};
|