@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,33 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { SettingBlock } from '..';
|
|
4
|
-
import { Security } from './types';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Returns the downloadable security settings.
|
|
8
|
-
*
|
|
9
|
-
* @param {string} id custom id for the setting block
|
|
10
|
-
* @param {string} globalControlId custom id for the global control setting block
|
|
11
|
-
*
|
|
12
|
-
* @returns {SettingBlock} Returns downloadable security settings.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
type SecurityDownloadableSettingType = {
|
|
16
|
-
id?: string;
|
|
17
|
-
globalControlId?: string;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const getSecurityDownloadableSetting = (options?: SecurityDownloadableSettingType): SettingBlock => {
|
|
21
|
-
const securityId = getSecurityGlobalControlId(options?.globalControlId);
|
|
22
|
-
return {
|
|
23
|
-
id: options?.id ? options.id : 'downloadable',
|
|
24
|
-
type: 'switch',
|
|
25
|
-
defaultValue: false,
|
|
26
|
-
label: 'Downloadable',
|
|
27
|
-
show: (bundle) => bundle.getBlock(securityId)?.value === Security.Custom,
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const getSecurityGlobalControlId = (id?: string): string => {
|
|
32
|
-
return id || 'security';
|
|
33
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { SettingBlock, createFooter } from '..';
|
|
4
|
-
import { Security } from './types';
|
|
5
|
-
import { getSecurityGlobalControlId } from './securityDownloadable';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Returns segment controls for global security settings.
|
|
9
|
-
*
|
|
10
|
-
* @param {string} id custom id for the setting block
|
|
11
|
-
*
|
|
12
|
-
* @returns {SettingBlock} Returns
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
export const getSecurityGlobalControlSetting = (id?: string): SettingBlock[] => {
|
|
16
|
-
const securityId = getSecurityGlobalControlId(id);
|
|
17
|
-
return [
|
|
18
|
-
{
|
|
19
|
-
id: securityId,
|
|
20
|
-
type: 'segmentedControls',
|
|
21
|
-
defaultValue: Security.Global,
|
|
22
|
-
choices: [
|
|
23
|
-
{
|
|
24
|
-
value: Security.Global,
|
|
25
|
-
label: 'Global Settings',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
value: Security.Custom,
|
|
29
|
-
label: 'Custom',
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: 'globalSettingsInfo',
|
|
35
|
-
type: 'notification',
|
|
36
|
-
footer: createFooter({
|
|
37
|
-
label: 'Change global settings [here].',
|
|
38
|
-
replace: { here: { event: 'general-settings.open' } },
|
|
39
|
-
}),
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
};
|
package/src/settings/types.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { Color } from '@frontify/sidebar-settings';
|
|
4
|
-
|
|
5
|
-
export enum BorderStyle {
|
|
6
|
-
Solid = 'Solid',
|
|
7
|
-
Dashed = 'Dashed',
|
|
8
|
-
Dotted = 'Dotted',
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const borderStyleMap: Record<BorderStyle, string> = {
|
|
12
|
-
[BorderStyle.Solid]: 'solid',
|
|
13
|
-
[BorderStyle.Dotted]: 'dotted',
|
|
14
|
-
[BorderStyle.Dashed]: 'dashed',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export enum Radius {
|
|
18
|
-
None = 'None',
|
|
19
|
-
Small = 'Small',
|
|
20
|
-
Medium = 'Medium',
|
|
21
|
-
Large = 'Large',
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const radiusStyleMap: Record<Radius, string> = {
|
|
25
|
-
[Radius.None]: '0px',
|
|
26
|
-
[Radius.Small]: '2px',
|
|
27
|
-
[Radius.Medium]: '4px',
|
|
28
|
-
[Radius.Large]: '12px',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export enum Padding {
|
|
32
|
-
None = 'None',
|
|
33
|
-
Small = 'Small',
|
|
34
|
-
Medium = 'Medium',
|
|
35
|
-
Large = 'Large',
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const paddingStyleMap: Record<Padding, string> = {
|
|
39
|
-
[Padding.None]: '0px',
|
|
40
|
-
[Padding.Small]: '24px',
|
|
41
|
-
[Padding.Medium]: '36px',
|
|
42
|
-
[Padding.Large]: '60px',
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type PaddingSettings = {
|
|
46
|
-
paddingChoice: Padding;
|
|
47
|
-
hasCustomPaddingValue: boolean;
|
|
48
|
-
paddingValue: string;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export type PaddingExtendedSettings = {
|
|
52
|
-
hasExtendedCustomPadding: boolean;
|
|
53
|
-
extendedPaddingChoice: Padding;
|
|
54
|
-
extendedPaddingTop: string;
|
|
55
|
-
extendedPaddingRight: string;
|
|
56
|
-
extendedPaddingBottom: string;
|
|
57
|
-
extendedPaddingLeft: string;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export type RadiusExtendedSettings = {
|
|
61
|
-
hasExtendedCustomRadius: boolean;
|
|
62
|
-
extendedRadiusChoice: Radius;
|
|
63
|
-
extendedRadiusTopLeft: string;
|
|
64
|
-
extendedRadiusTopRight: string;
|
|
65
|
-
extendedRadiusBottomLeft: string;
|
|
66
|
-
extendedRadiusBottomRight: string;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export type BorderSettings = {
|
|
70
|
-
hasBorder: boolean;
|
|
71
|
-
borderStyle: BorderStyle;
|
|
72
|
-
borderWidth: string;
|
|
73
|
-
borderColor: Color;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export type RadiusSettings = {
|
|
77
|
-
hasRadius: boolean;
|
|
78
|
-
radiusValue: string;
|
|
79
|
-
radiusChoice: Radius;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export enum Margin {
|
|
83
|
-
None = 'None',
|
|
84
|
-
Small = 'Small',
|
|
85
|
-
Medium = 'Medium',
|
|
86
|
-
Large = 'Large',
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export const marginStyleMap: Record<Margin, string> = {
|
|
90
|
-
[Margin.None]: '0px',
|
|
91
|
-
[Margin.Small]: '24px',
|
|
92
|
-
[Margin.Medium]: '36px',
|
|
93
|
-
[Margin.Large]: '60px',
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export type MarginSettings = {
|
|
97
|
-
marginChoice: Margin;
|
|
98
|
-
hasCustomMarginValue: boolean;
|
|
99
|
-
marginValue: string;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export type MarginExtendedSettings = {
|
|
103
|
-
hasExtendedCustomMargin: boolean;
|
|
104
|
-
extendedMarginChoice: Margin;
|
|
105
|
-
extendedMarginTop: string;
|
|
106
|
-
extendedMarginRight: string;
|
|
107
|
-
extendedMarginBottom: string;
|
|
108
|
-
extendedMarginLeft: string;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export enum Security {
|
|
112
|
-
Global = 'Global',
|
|
113
|
-
Custom = 'Custom',
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export enum GutterSpacing {
|
|
117
|
-
Auto = 'Auto',
|
|
118
|
-
S = 'S',
|
|
119
|
-
M = 'M',
|
|
120
|
-
L = 'L',
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export const gutterSpacingStyleMap: Record<GutterSpacing, string> = {
|
|
124
|
-
[GutterSpacing.Auto]: '4px',
|
|
125
|
-
[GutterSpacing.S]: '10px',
|
|
126
|
-
[GutterSpacing.M]: '30px',
|
|
127
|
-
[GutterSpacing.L]: '50px',
|
|
128
|
-
};
|
package/src/styles.css
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { readability } from '@ctrl/tinycolor';
|
|
4
|
-
import { describe, expect, test } from 'vitest';
|
|
5
|
-
import { getReadableColor } from './getReadableColor';
|
|
6
|
-
|
|
7
|
-
describe('getReadableColor', () => {
|
|
8
|
-
const data = [
|
|
9
|
-
{
|
|
10
|
-
textColor: { r: 255, g: 255, b: 255 },
|
|
11
|
-
backgroundColor: { r: 0, g: 0, b: 0 },
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
textColor: { r: 255, g: 255, b: 255 },
|
|
15
|
-
backgroundColor: { r: 255, g: 255, b: 255 },
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
textColor: { r: 230, g: 230, b: 0 },
|
|
19
|
-
backgroundColor: { r: 229, g: 229, b: 10 },
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
textColor: { r: 120, g: 120, b: 120 },
|
|
23
|
-
backgroundColor: { r: 120, g: 120, b: 120, a: 0.1 },
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
test.each(data)('validates against expected values', ({ textColor, backgroundColor }) => {
|
|
28
|
-
const result = getReadableColor(textColor, backgroundColor);
|
|
29
|
-
const colorReadability = readability(result, backgroundColor);
|
|
30
|
-
expect(colorReadability).toBeGreaterThan(4.5);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { ColorInput, TinyColor, readability } from '@ctrl/tinycolor';
|
|
4
|
-
import { toShortRgba } from './toShortRgba';
|
|
5
|
-
import { Color } from '@frontify/sidebar-settings';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Returns darkened text color for a given background color, so that it is readable and has enough contrast (above 4.5)
|
|
9
|
-
*
|
|
10
|
-
* @param {Object} textColor Object of RGBA values
|
|
11
|
-
* @param {Object} backgroundColor Object of RGBA values
|
|
12
|
-
* @returns {string} To be used as css value
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const isRgbaLongFormat = (value: unknown): value is Color => {
|
|
16
|
-
const requiredKeys = ['red', 'green', 'blue'];
|
|
17
|
-
return typeof value === 'object' && requiredKeys.every((i) => value?.hasOwnProperty(i));
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const getReadableColor = (textColor: unknown, backgroundColor: unknown): string => {
|
|
21
|
-
const inputTextColor = isRgbaLongFormat(textColor) ? toShortRgba(textColor) : (textColor as ColorInput);
|
|
22
|
-
const inputBackgroundColor = isRgbaLongFormat(backgroundColor)
|
|
23
|
-
? toShortRgba(backgroundColor)
|
|
24
|
-
: (backgroundColor as ColorInput);
|
|
25
|
-
let parsedTextColor = new TinyColor(inputTextColor);
|
|
26
|
-
const parsedBackgroundColor = new TinyColor(inputBackgroundColor);
|
|
27
|
-
|
|
28
|
-
//darken the text color until readability is good
|
|
29
|
-
while (readability(parsedTextColor, parsedBackgroundColor) < 4.5) {
|
|
30
|
-
parsedTextColor = parsedTextColor.darken(1);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return parsedTextColor.toRgbString();
|
|
34
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
export * from './isDark';
|
|
4
|
-
export * from './toHex8String';
|
|
5
|
-
export * from './toHexString';
|
|
6
|
-
export * from './toRgbaString';
|
|
7
|
-
export * from './setAlpha';
|
|
8
|
-
export * from './toColorObject';
|
|
9
|
-
export * from './getReadableColor';
|
|
10
|
-
export * from './toShortRgba';
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { isDark } from './isDark';
|
|
4
|
-
import { describe, expect, test } from 'vitest';
|
|
5
|
-
|
|
6
|
-
describe('isDark', () => {
|
|
7
|
-
const data = [
|
|
8
|
-
{ color: { red: 0, green: 0, blue: 0 }, expected: true },
|
|
9
|
-
{ color: { red: 255, green: 255, blue: 255 }, expected: false },
|
|
10
|
-
{ color: { red: 130, green: 95, blue: 255 }, expected: true },
|
|
11
|
-
{ color: '#000000', expected: true },
|
|
12
|
-
{ color: '#FFFFFF', expected: false },
|
|
13
|
-
{ color: 'rgb(0,0,0)', expected: true },
|
|
14
|
-
{ color: 'rgb(255,255,255)', expected: false },
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
test.each(data)('validate values correctly', ({ color, expected }) => {
|
|
18
|
-
expect(isDark(color)).toBe(expected);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
describe('isDark with custom threshold', () => {
|
|
23
|
-
const data = [
|
|
24
|
-
{ color: { red: 0, green: 0, blue: 0 }, threshold: 150, expected: true },
|
|
25
|
-
{ color: { red: 255, green: 102, blue: 0 }, threshold: 150, expected: true },
|
|
26
|
-
{ color: { red: 255, green: 147, blue: 73 }, threshold: 171, expected: true },
|
|
27
|
-
{ color: { red: 255, green: 255, blue: 255 }, threshold: 150, expected: false },
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
test.each(data)('validate values correctly', ({ color, threshold, expected }) => {
|
|
31
|
-
expect(isDark(color, threshold)).toBe(expected);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { ColorInput, TinyColor } from '@ctrl/tinycolor';
|
|
4
|
-
import { toShortRgba } from './toShortRgba';
|
|
5
|
-
import { Color } from '@frontify/sidebar-settings';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Calculates if text should be in a light color depending on color (e.g. background-color)
|
|
9
|
-
*
|
|
10
|
-
* @param {Object} value Object of RGBA values
|
|
11
|
-
* @param {Number|undefined} threshold Threshold for the brightness
|
|
12
|
-
* @returns {Boolean} Return if the color is dark
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const isRgbaLongFormat = (value: unknown): value is Color => {
|
|
16
|
-
const requiredKeys = ['red', 'green', 'blue'];
|
|
17
|
-
return typeof value === 'object' && requiredKeys.every((i) => value?.hasOwnProperty(i));
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const isDark = (color: unknown, threshold?: number): boolean => {
|
|
21
|
-
const inputColor = isRgbaLongFormat(color) ? toShortRgba(color) : (color as ColorInput);
|
|
22
|
-
const parsedColor = new TinyColor(inputColor);
|
|
23
|
-
|
|
24
|
-
if (threshold) {
|
|
25
|
-
return parsedColor.getBrightness() < threshold;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return parsedColor.isDark() || (parsedColor.getAlpha() > 0.25 && parsedColor.getAlpha() < 1);
|
|
29
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { setAlpha } from './setAlpha';
|
|
4
|
-
import { describe, expect, test } from 'vitest';
|
|
5
|
-
|
|
6
|
-
describe('setAlpha', () => {
|
|
7
|
-
const data = [
|
|
8
|
-
{
|
|
9
|
-
color: 'rgba(255, 255, 255, 0.1)',
|
|
10
|
-
alpha: 1,
|
|
11
|
-
expected: 'rgb(255, 255, 255)',
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
color: 'rgb(255, 255, 255)',
|
|
15
|
-
alpha: 0.9,
|
|
16
|
-
expected: 'rgba(255, 255, 255, 0.9)',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
color: '#00000',
|
|
20
|
-
alpha: 0.9,
|
|
21
|
-
expected: 'rgba(0, 0, 0, 0.9)',
|
|
22
|
-
},
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
test.each(data)('validates against expected values', ({ color, alpha, expected }) => {
|
|
26
|
-
expect(setAlpha(alpha, color)).toBe(expected);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { TinyColor } from '@ctrl/tinycolor';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Sets alpha value and returns rgba string.
|
|
7
|
-
*
|
|
8
|
-
* @param {string} color Rgb or hex string.
|
|
9
|
-
* @returns {String} To be used as css value.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
export const setAlpha = (alpha: number, color?: string): string => {
|
|
13
|
-
return new TinyColor(color).setAlpha(alpha).toRgbString();
|
|
14
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { describe, expect, test } from 'vitest';
|
|
4
|
-
import { toColorObject } from './toColorObject';
|
|
5
|
-
|
|
6
|
-
describe('toColorObject', () => {
|
|
7
|
-
const data = [
|
|
8
|
-
{ expected: { red: 255, green: 255, blue: 255, alpha: 1 }, color: '#ffffffff' },
|
|
9
|
-
{ expected: { red: 255, green: 221, blue: 255, alpha: 1 }, color: '#ffddffff' },
|
|
10
|
-
{ expected: { red: 255, green: 255, blue: 15, alpha: 0 }, color: '#ffff0f00' },
|
|
11
|
-
{ expected: { red: 238, green: 35, blue: 84, alpha: 0.4 }, color: '#ee235466' },
|
|
12
|
-
{ expected: { red: 255, green: 0, blue: 0, alpha: 1 }, color: 'rgb(255,0,0)' },
|
|
13
|
-
{ expected: { red: 255, green: 0, blue: 0, alpha: 0.5 }, color: 'rgba(255,0,0,0.5)' },
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
test.each(data)('validates against expected values', ({ color, expected }) => {
|
|
17
|
-
expect(toColorObject(color)).toEqual(expected);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { Color } from '@frontify/fondue';
|
|
4
|
-
import { TinyColor } from '@ctrl/tinycolor';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Maps color strings to color objects.
|
|
8
|
-
*
|
|
9
|
-
* @param {String} String representing color
|
|
10
|
-
* @returns {Color} Color object
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
export const toColorObject = (colorString: string): Color => {
|
|
14
|
-
const { r, g, b, a } = new TinyColor(colorString);
|
|
15
|
-
return { red: r, green: g, blue: b, alpha: a };
|
|
16
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { toHex8String } from './toHex8String';
|
|
4
|
-
import { describe, expect, test } from 'vitest';
|
|
5
|
-
|
|
6
|
-
describe('toHex8String', () => {
|
|
7
|
-
const data = [
|
|
8
|
-
{ color: { red: 255, green: 255, blue: 255 }, expected: '#ffffffff' },
|
|
9
|
-
{ color: { red: 255, green: 221, blue: 255, alpha: 1 }, expected: '#ffddffff' },
|
|
10
|
-
{ color: { red: 255, green: 255, blue: 15, alpha: 0 }, expected: '#ffff0f00' },
|
|
11
|
-
{ color: { red: 238, green: 35, blue: 84, alpha: 0.4 }, expected: '#ee235466' },
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
test.each(data)('validates against expected values', ({ color, expected }) => {
|
|
15
|
-
expect(toHex8String(color)).toBe(expected);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { Color } from '@frontify/fondue';
|
|
4
|
-
import { TinyColor } from '@ctrl/tinycolor';
|
|
5
|
-
import { toShortRgba } from './toShortRgba';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Maps color object of rgba values to hex alpha string.
|
|
9
|
-
*
|
|
10
|
-
* @param {Object} Color object
|
|
11
|
-
* @returns {String} To be used as css value.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export const toHex8String = (color: Color): string => new TinyColor(toShortRgba(color)).toHex8String();
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { toHexString } from './toHexString';
|
|
4
|
-
import { describe, expect, test } from 'vitest';
|
|
5
|
-
|
|
6
|
-
describe('toHexString', () => {
|
|
7
|
-
const data = [
|
|
8
|
-
{ color: { red: 255, green: 255, blue: 255 }, expected: '#ffffff' },
|
|
9
|
-
{ color: { red: 255, green: 221, blue: 255 }, expected: '#ffddff' },
|
|
10
|
-
{ color: { red: 255, green: 255, blue: 15 }, expected: '#ffff0f' },
|
|
11
|
-
{ color: { red: 238, green: 35, blue: 84 }, expected: '#ee2354' },
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
test.each(data)('validates against expected values', ({ color, expected }) => {
|
|
15
|
-
expect(toHexString(color)).toBe(expected);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { Color } from '@frontify/fondue';
|
|
4
|
-
import { TinyColor } from '@ctrl/tinycolor';
|
|
5
|
-
import { toShortRgba } from './toShortRgba';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Maps color object of rgba values to hex alpha string.
|
|
9
|
-
*/
|
|
10
|
-
export const toHexString = (color: Color): string => new TinyColor(toShortRgba(color)).toHexString();
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { toRgbaString } from './toRgbaString';
|
|
4
|
-
import { describe, expect, test } from 'vitest';
|
|
5
|
-
|
|
6
|
-
describe('toRgbaString', () => {
|
|
7
|
-
const data = [{ color: { red: 1, green: 2, blue: 3, alpha: 0.5 }, expected: 'rgba(1, 2, 3, 0.5)' }];
|
|
8
|
-
|
|
9
|
-
test.each(data)('validates against expected values', ({ color, expected }) => {
|
|
10
|
-
expect(toRgbaString(color)).toBe(expected);
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { Color } from '@frontify/fondue';
|
|
4
|
-
import { TinyColor } from '@ctrl/tinycolor';
|
|
5
|
-
import { toShortRgba } from './toShortRgba';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Maps color object of rgba values to rgba string.
|
|
9
|
-
*
|
|
10
|
-
* @param {Object} Color object
|
|
11
|
-
* @returns {String} To be used as css value.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export const toRgbaString = (color: Color): string => new TinyColor(toShortRgba(color)).toRgbString();
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { toShortRgba } from './toShortRgba';
|
|
4
|
-
import { describe, expect, test } from 'vitest';
|
|
5
|
-
|
|
6
|
-
describe('toShortRgba', () => {
|
|
7
|
-
const data = [
|
|
8
|
-
{ color: { red: 50, green: 100, blue: 150 }, expected: { r: 50, g: 100, b: 150, a: 1 } },
|
|
9
|
-
{ color: { red: 50, green: 100, blue: 150, alpha: 0.5 }, expected: { r: 50, g: 100, b: 150, a: 0.5 } },
|
|
10
|
-
{ color: { r: 50, g: 100, b: 150, a: 0.5 }, expected: { r: 50, g: 100, b: 150, a: 0.5 } },
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
test.each(data)('validates against expected values', ({ color, expected }) => {
|
|
14
|
-
expect(toShortRgba(color)).toStrictEqual(expected);
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { Color } from '@frontify/fondue';
|
|
4
|
-
|
|
5
|
-
type ShortNotationColor = {
|
|
6
|
-
r: number;
|
|
7
|
-
g: number;
|
|
8
|
-
b: number;
|
|
9
|
-
a?: number;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Maps color object from long to short rgba notation.
|
|
14
|
-
*
|
|
15
|
-
* @param {Object} Color object
|
|
16
|
-
* @returns {Object} ShortNotationColor object
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
export const toShortRgba = (color: unknown): ShortNotationColor => {
|
|
20
|
-
const isRgbaLongFormat = (value: Color) => {
|
|
21
|
-
const requiredKeys = ['red', 'green', 'blue'];
|
|
22
|
-
return typeof value === 'object' && requiredKeys.every((i) => value.hasOwnProperty(i));
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const mapToShortFormat = (value: Color): ShortNotationColor => {
|
|
26
|
-
const alpha = typeof value.alpha === 'number' ? value.alpha : 1;
|
|
27
|
-
return { r: value.red, g: value.green, b: value.blue, a: alpha };
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
if (isRgbaLongFormat(color as Color)) {
|
|
31
|
-
return mapToShortFormat(color as Color);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return color as ShortNotationColor;
|
|
35
|
-
};
|
package/src/utilities/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
-
import { moveItemInArray } from './moveItemInArray';
|
|
5
|
-
|
|
6
|
-
describe('moveItemInArray', () => {
|
|
7
|
-
it.each([
|
|
8
|
-
[[], 0, 0, []],
|
|
9
|
-
[[1, 2, 3], 0, 0, [1, 2, 3]],
|
|
10
|
-
[[1, 2, 3], 0, 1, [2, 1, 3]],
|
|
11
|
-
[[1, 2, 3], 1, 0, [2, 1, 3]],
|
|
12
|
-
[[1, { a: 1 }, 3], 1, 0, [{ a: 1 }, 1, 3]],
|
|
13
|
-
[[{ a: 1 }, { b: 1 }, { c: 1 }], 1, 0, [{ b: 1 }, { a: 1 }, { c: 1 }]],
|
|
14
|
-
])('move items accordingly', (items, from, to, expected) => {
|
|
15
|
-
expect(expected).toEqual(moveItemInArray(items as number[], from, to));
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Moves an item from the 'from' position to the 'to' position and updates the array
|
|
5
|
-
*
|
|
6
|
-
* @param {Array} array Array of items
|
|
7
|
-
* @param {Number} from Initial index of the item
|
|
8
|
-
* @param {Number} to New index of the item
|
|
9
|
-
* @returns {Array} New array with the item moved to the new position
|
|
10
|
-
*/
|
|
11
|
-
export const moveItemInArray = <T>(array: T[], from: number, to: number): T[] => {
|
|
12
|
-
const newArray = [...array];
|
|
13
|
-
const toIndex = to < 0 ? newArray.length + to : to;
|
|
14
|
-
|
|
15
|
-
if (toIndex >= 0 && toIndex < newArray.length) {
|
|
16
|
-
const slice = newArray.splice(from, 1)[0];
|
|
17
|
-
newArray.splice(toIndex, 0, slice);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return newArray;
|
|
21
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { getBackgroundColorStyles } from './getBackgroundColorStyles';
|
|
4
|
-
import { describe, expect, it } from 'vitest';
|
|
5
|
-
|
|
6
|
-
describe('getBackgroundColorStyles', () => {
|
|
7
|
-
it('should return a rgba background color', () => {
|
|
8
|
-
expect(getBackgroundColorStyles({ red: 0, green: 0, blue: 0, alpha: 0.5 })).toEqual({
|
|
9
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should return a rgb background color', () => {
|
|
14
|
-
expect(getBackgroundColorStyles({ red: 255, green: 255, blue: 255 })).toEqual({
|
|
15
|
-
backgroundColor: 'rgb(255, 255, 255)',
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import type { CSSProperties } from 'react';
|
|
4
|
-
import type { Color } from '@frontify/fondue';
|
|
5
|
-
|
|
6
|
-
import { toRgbaString } from '../color';
|
|
7
|
-
|
|
8
|
-
export const getBackgroundColorStyles = (backgroundColor: Color): CSSProperties => ({
|
|
9
|
-
backgroundColor: toRgbaString(backgroundColor),
|
|
10
|
-
});
|