@frontify/guideline-blocks-settings 0.27.0 → 0.28.1
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/.eslintrc.js +1 -1
- package/CHANGELOG.md +21 -0
- package/README.md +24 -5
- package/dist/_virtual/_commonjsHelpers.es.js +7 -0
- package/dist/_virtual/_commonjsHelpers.es.js.map +1 -0
- package/dist/_virtual/index.es.js +5 -0
- package/dist/_virtual/index.es.js.map +1 -0
- package/dist/_virtual/index.es2.js +5 -0
- package/dist/_virtual/index.es2.js.map +1 -0
- package/dist/_virtual/index.es3.js +5 -0
- package/dist/_virtual/index.es3.js.map +1 -0
- package/dist/_virtual/jsx-runtime.es.js +5 -0
- package/dist/_virtual/jsx-runtime.es.js.map +1 -0
- package/dist/_virtual/react-dom.development.es.js +5 -0
- package/dist/_virtual/react-dom.development.es.js.map +1 -0
- package/dist/_virtual/react-dom.production.min.es.js +5 -0
- package/dist/_virtual/react-dom.production.min.es.js.map +1 -0
- package/dist/_virtual/react-jsx-runtime.development.es.js +5 -0
- package/dist/_virtual/react-jsx-runtime.development.es.js.map +1 -0
- package/dist/_virtual/react-jsx-runtime.production.min.es.js +5 -0
- package/dist/_virtual/react-jsx-runtime.production.min.es.js.map +1 -0
- package/dist/_virtual/react.development.es.js +5 -0
- package/dist/_virtual/react.development.es.js.map +1 -0
- package/dist/_virtual/react.production.min.es.js +5 -0
- package/dist/_virtual/react.production.min.es.js.map +1 -0
- package/dist/_virtual/scheduler.development.es.js +5 -0
- package/dist/_virtual/scheduler.development.es.js.map +1 -0
- package/dist/_virtual/scheduler.production.min.es.js +5 -0
- package/dist/_virtual/scheduler.production.min.es.js.map +1 -0
- package/dist/components/Attachments/AttachmentItem.es.js +180 -0
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -0
- package/dist/components/Attachments/Attachments.es.js +145 -0
- package/dist/components/Attachments/Attachments.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 +73 -0
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar.es.js +113 -0
- package/dist/components/BlockItemWrapper/Toolbar.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/RichTextEditor/RichTextEditor.es.js +42 -0
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -0
- package/dist/components/RichTextEditor/SerializedText.es.js +13 -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 +34 -0
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +54 -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 +17 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +30 -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 +16 -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 +37 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.es.js +20 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.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 +105 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.es.js +20 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.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 +58 -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 +43 -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 +62 -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 +75 -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 +53 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +19 -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 +37 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.es.js +53 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.es.js +29 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.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 +80 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js +40 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +93 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +27 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js +12 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.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 +39 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +18 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/relativeUrlRegex.es.js +5 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/relativeUrlRegex.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/url.es.js +17 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/url.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +46 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +39 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +39 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +39 -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 +46 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +46 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +41 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +48 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.es.js +68 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.es.js +55 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.es.js +62 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.es.js +61 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.es.js +34 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/SectionLink.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/SectionLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/styles.es.js +168 -0
- package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/button.es.js +16 -0
- package/dist/components/RichTextEditor/serializer/nodes/button.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js +19 -0
- package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/default.es.js +17 -0
- package/dist/components/RichTextEditor/serializer/nodes/default.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/link.es.js +15 -0
- package/dist/components/RichTextEditor/serializer/nodes/link.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/mentionHtmlNode.es.js +12 -0
- package/dist/components/RichTextEditor/serializer/nodes/mentionHtmlNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js +61 -0
- package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/serializeToHtml.es.js +25 -0
- package/dist/components/RichTextEditor/serializer/serializeToHtml.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.es.js +8 -0
- package/dist/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/utlis/serializeLeafToHtml.es.js +13 -0
- package/dist/components/RichTextEditor/serializer/utlis/serializeLeafToHtml.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 +16 -0
- package/dist/helpers/mapColorPalettes.es.js.map +1 -0
- package/dist/hooks/useAttachments.es.js +31 -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 +252 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +816 -1
- package/dist/index.es.js +172 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +252 -1
- package/dist/index.umd.js.map +1 -1
- 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/style.css +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 +46 -10
- package/postcss.config.js +8 -0
- package/setupTests.ts +13 -0
- package/src/components/Attachments/AttachmentItem.tsx +257 -0
- package/src/components/Attachments/Attachments.spec.ct.tsx +151 -0
- package/src/components/Attachments/Attachments.tsx +221 -0
- package/src/components/Attachments/index.ts +4 -0
- package/src/components/Attachments/types.ts +30 -0
- package/src/components/BlockInjectButton/BlockInjectButton.spec.ct.tsx +48 -0
- package/src/components/BlockInjectButton/BlockInjectButton.tsx +212 -0
- package/src/components/BlockInjectButton/index.ts +4 -0
- package/src/components/BlockInjectButton/types.ts +18 -0
- package/src/components/BlockItemWrapper/BlockItemWrapper.spec.ct.tsx +146 -0
- package/src/components/BlockItemWrapper/BlockItemWrapper.tsx +76 -0
- package/src/components/BlockItemWrapper/Toolbar.tsx +128 -0
- package/src/components/BlockItemWrapper/constants.ts +4 -0
- package/src/components/BlockItemWrapper/index.ts +5 -0
- package/src/components/BlockItemWrapper/types.ts +46 -0
- package/src/components/DownloadButton/DownloadButton.spec.ct.tsx +20 -0
- package/src/components/DownloadButton/DownloadButton.tsx +36 -0
- package/src/components/DownloadButton/index.ts +3 -0
- package/src/components/DownloadButton/types.ts +5 -0
- package/src/components/RichTextEditor/RichTextEditor.spec.ct.tsx +204 -0
- package/src/components/RichTextEditor/RichTextEditor.tsx +62 -0
- package/src/components/RichTextEditor/SerializedText.tsx +25 -0
- package/src/components/RichTextEditor/constants.ts +3 -0
- package/src/components/RichTextEditor/index.ts +6 -0
- package/src/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.tsx +53 -0
- package/src/components/RichTextEditor/pluginPresets/index.ts +3 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.tsx +74 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.ts +11 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.tsx +20 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.tsx +56 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.tsx +19 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.tsx +42 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.tsx +37 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.tsx +22 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.tsx +30 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.tsx +81 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/types.ts +13 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.ts +143 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.tsx +31 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.ts +46 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/index.ts +12 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.ts +113 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.ts +21 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.ts +30 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.ts +71 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.ts +22 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/index.ts +3 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts +116 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/index.ts +7 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/index.ts +8 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.ts +17 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.ts +40 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts +68 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts +198 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts +40 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts +30 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/types.ts +13 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts +28 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts +14 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts +18 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/index.ts +8 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.ts +77 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.ts +23 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.ts +30 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.ts +45 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts +106 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.tsx +26 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.tsx +43 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/index.ts +4 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.ts +113 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.tsx +45 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.tsx +5 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.tsx +105 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/index.ts +4 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/types.ts +16 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.ts +73 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.ts +136 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkButton.tsx +38 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.tsx +36 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.ts +11 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/id.ts +3 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/index.ts +48 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/types.ts +12 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.ts +30 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/index.ts +4 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/relativeUrlRegex.spec.ts +35 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/relativeUrlRegex.ts +3 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/url.spec.ts +75 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/url.ts +21 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.tsx +62 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.tsx +58 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.tsx +58 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.tsx +59 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/helpers.tsx +44 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/index.ts +15 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.tsx +58 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.tsx +62 -0
- package/src/components/RichTextEditor/plugins/index.ts +6 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.tsx +80 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.tsx +97 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.spec.ct.tsx +138 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.tsx +80 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.tsx +83 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.tsx +68 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/SectionLink.tsx +37 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/index.ts +3 -0
- package/src/components/RichTextEditor/plugins/styles.ts +179 -0
- package/src/components/RichTextEditor/serializer/index.ts +3 -0
- package/src/components/RichTextEditor/serializer/nodes/button.ts +25 -0
- package/src/components/RichTextEditor/serializer/nodes/checkItemNode.ts +29 -0
- package/src/components/RichTextEditor/serializer/nodes/default.ts +52 -0
- package/src/components/RichTextEditor/serializer/nodes/link.ts +25 -0
- package/src/components/RichTextEditor/serializer/nodes/mentionHtmlNode.ts +17 -0
- package/src/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.ts +134 -0
- package/src/components/RichTextEditor/serializer/serializeToHtml.ts +49 -0
- package/src/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.ts +21 -0
- package/src/components/RichTextEditor/serializer/utlis/serializeLeafToHtml.ts +32 -0
- package/src/components/RichTextEditor/types.ts +23 -0
- package/src/components/index.ts +7 -0
- package/src/helpers/addHttps.spec.ts +42 -0
- package/src/helpers/addHttps.ts +15 -0
- package/src/helpers/convertToRichTextValue.spec.ts +32 -0
- package/src/helpers/convertToRichTextValue.ts +6 -0
- package/src/helpers/customCoordinatesGetterFactory.spec.ts +69 -0
- package/src/helpers/customCoordinatesGetterFactory.ts +39 -0
- package/src/helpers/hasRichTextValue.spec.ts +63 -0
- package/src/helpers/hasRichTextValue.ts +29 -0
- package/src/helpers/index.ts +8 -0
- package/src/helpers/isDownloadable.spec.ts +47 -0
- package/src/helpers/isDownloadable.ts +7 -0
- package/src/helpers/mapColorPalettes.spec.ts +146 -0
- package/src/helpers/mapColorPalettes.ts +22 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useAttachments.spec.ts +79 -0
- package/src/hooks/useAttachments.ts +46 -0
- package/src/hooks/useDndSensors.spec.ts +40 -0
- package/src/hooks/useDndSensors.ts +23 -0
- package/src/index.ts +8 -0
- package/src/settings/background.spec.ts +173 -0
- package/src/settings/background.ts +49 -0
- package/src/settings/border.spec.ts +76 -0
- package/src/settings/border.ts +90 -0
- package/src/settings/borderRadius.spec.ts +30 -0
- package/src/settings/borderRadius.ts +73 -0
- package/src/settings/borderRadiusExtended.spec.ts +52 -0
- package/src/settings/borderRadiusExtended.ts +84 -0
- package/src/settings/defaultValues.ts +21 -0
- package/src/settings/gutter.spec.ts +60 -0
- package/src/settings/gutter.ts +75 -0
- package/src/settings/index.ts +14 -0
- package/src/settings/margin.spec.ts +42 -0
- package/src/settings/margin.ts +72 -0
- package/src/settings/marginExtended.spec.ts +45 -0
- package/src/settings/marginExtended.ts +91 -0
- package/src/settings/padding.spec.ts +42 -0
- package/src/settings/padding.ts +73 -0
- package/src/settings/paddingExtended.spec.ts +45 -0
- package/src/settings/paddingExtended.ts +91 -0
- package/src/settings/security.spec.ts +87 -0
- package/src/settings/security.ts +61 -0
- package/src/settings/securityDownloadable.spec.ts +46 -0
- package/src/settings/securityDownloadable.ts +33 -0
- package/src/settings/securityGlobalControl.ts +42 -0
- package/src/settings/types.ts +128 -0
- package/src/utilities/color/getReadableColor.spec.ts +32 -0
- package/src/utilities/color/getReadableColor.ts +34 -0
- package/src/utilities/color/index.ts +10 -0
- package/src/utilities/color/isDark.spec.ts +33 -0
- package/src/utilities/color/isDark.ts +29 -0
- package/src/utilities/color/setAlpha.spec.ts +28 -0
- package/src/utilities/color/setAlpha.ts +14 -0
- package/src/utilities/color/toColorObject.spec.ts +19 -0
- package/src/utilities/color/toColorObject.ts +16 -0
- package/src/utilities/color/toHex8String.spec.ts +17 -0
- package/src/utilities/color/toHex8String.ts +14 -0
- package/src/utilities/color/toHexString.spec.ts +17 -0
- package/src/utilities/color/toHexString.ts +10 -0
- package/src/utilities/color/toRgbaString.spec.ts +12 -0
- package/src/utilities/color/toRgbaString.ts +14 -0
- package/src/utilities/color/toShortRgba.spec.ts +16 -0
- package/src/utilities/color/toShortRgba.ts +35 -0
- package/src/utilities/index.ts +5 -0
- package/src/utilities/moveItemInArray.spec.ts +17 -0
- package/src/utilities/moveItemInArray.ts +21 -0
- package/src/utilities/react/getBackgroundColorStyles.spec.ts +18 -0
- package/src/utilities/react/getBackgroundColorStyles.ts +11 -0
- package/src/utilities/react/getBorderStyles.spec.ts +39 -0
- package/src/utilities/react/getBorderStyles.ts +21 -0
- package/src/utilities/react/getRadiusStyles.spec.ts +25 -0
- package/src/utilities/react/getRadiusStyles.ts +8 -0
- package/src/utilities/react/index.ts +6 -0
- package/src/utilities/react/joinClassNames.spec.ts +18 -0
- package/src/utilities/react/joinClassNames.ts +10 -0
- package/tailwind.config.js +27 -0
- package/tsconfig.json +3 -1
- package/vite.config.ts +11 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
export const BACKGROUND_COLOR_DEFAULT_VALUE = {
|
|
4
|
+
red: 241,
|
|
5
|
+
green: 241,
|
|
6
|
+
blue: 241,
|
|
7
|
+
alpha: 1,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const BORDER_COLOR_DEFAULT_VALUE = {
|
|
11
|
+
red: 234,
|
|
12
|
+
green: 235,
|
|
13
|
+
blue: 235,
|
|
14
|
+
alpha: 1,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const BORDER_WIDTH_DEFAULT_VALUE = '1px';
|
|
18
|
+
|
|
19
|
+
export const PADDING_DEFAULT_PLACEHOLDER = '24px';
|
|
20
|
+
|
|
21
|
+
export const MARGIN_DEFAULT_PLACEHOLDER = '24px';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { GutterSpacing, getGutterSettings } from '.';
|
|
5
|
+
import { SwitchBlock } from '..';
|
|
6
|
+
|
|
7
|
+
describe('getGutterSettings', () => {
|
|
8
|
+
it('should return gutter settings without arguments', () => {
|
|
9
|
+
const gutterSettings = getGutterSettings() as SwitchBlock;
|
|
10
|
+
|
|
11
|
+
expect(gutterSettings).toHaveProperty('id', 'hasCustomSpacing');
|
|
12
|
+
expect(gutterSettings).toHaveProperty('label', 'Gutter');
|
|
13
|
+
expect(gutterSettings).toHaveProperty('type', 'switch');
|
|
14
|
+
expect(gutterSettings).toHaveProperty('defaultValue', false);
|
|
15
|
+
expect(gutterSettings.on?.[0]).toHaveProperty('id', 'spacingCustom');
|
|
16
|
+
expect(gutterSettings.on?.[0]).toHaveProperty('type', 'input');
|
|
17
|
+
expect(gutterSettings.off?.[0]).toHaveProperty('id', 'spacingChoice');
|
|
18
|
+
expect(gutterSettings.off?.[0]).toHaveProperty('type', 'slider');
|
|
19
|
+
expect(gutterSettings.off?.[0]).toHaveProperty('choices', [
|
|
20
|
+
{
|
|
21
|
+
value: GutterSpacing.Auto,
|
|
22
|
+
label: 'Auto',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: GutterSpacing.S,
|
|
26
|
+
label: 'S',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: GutterSpacing.M,
|
|
30
|
+
label: 'M',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
value: GutterSpacing.L,
|
|
34
|
+
label: 'L',
|
|
35
|
+
},
|
|
36
|
+
]);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should return gutter settings with id', () => {
|
|
40
|
+
expect(getGutterSettings({ id: 'Test' })).toHaveProperty('id', 'Test');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should return gutter settings with custom spacing choice id', () => {
|
|
44
|
+
const gutterSettings = getGutterSettings({ spacingChoiceId: 'Choice_ID' }) as SwitchBlock;
|
|
45
|
+
|
|
46
|
+
expect(gutterSettings.off?.[0]).toHaveProperty('id', 'Choice_ID');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should return gutter settings with custom spacing custom id', () => {
|
|
50
|
+
const gutterSettings = getGutterSettings({ spacingCustomId: 'Custom_ID' }) as SwitchBlock;
|
|
51
|
+
|
|
52
|
+
expect(gutterSettings.on?.[0]).toHaveProperty('id', 'Custom_ID');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should return gutter settings with custom spacing custom id', () => {
|
|
56
|
+
const gutterSettings = getGutterSettings({ defaultValueChoices: GutterSpacing.L }) as SwitchBlock;
|
|
57
|
+
|
|
58
|
+
expect(gutterSettings.off?.[0]).toHaveProperty('defaultValue', GutterSpacing.L);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { SettingBlock, appendUnit, numericalOrPixelRule, presetCustomValue } from '../';
|
|
4
|
+
import { GutterSpacing, gutterSpacingStyleMap } from './types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns gutter settings: gutter switch, gutter choices or gutter custom input
|
|
8
|
+
*
|
|
9
|
+
* @param options Options for the settings
|
|
10
|
+
* @param options.id Custom id for the gutters switch
|
|
11
|
+
* @param options.dependentSettingId Id of the dependent setting
|
|
12
|
+
* @param options.spacingChoiceId Id of the spacing choice
|
|
13
|
+
* @param options.defaultValueChoices Default value for the spacing choice
|
|
14
|
+
* @returns {SettingBlock} Returns the gutter settings
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
type GutterSettingsType = {
|
|
18
|
+
id?: string;
|
|
19
|
+
dependentSettingId?: string;
|
|
20
|
+
spacingChoiceId?: string;
|
|
21
|
+
spacingCustomId?: string;
|
|
22
|
+
defaultValueChoices?: GutterSpacing;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const getGutterSettings = (options?: GutterSettingsType): SettingBlock => {
|
|
26
|
+
const id = options?.id ? options.id : 'hasCustomSpacing';
|
|
27
|
+
const dependentSettingId = options?.dependentSettingId ? options.dependentSettingId : 'columns';
|
|
28
|
+
const spacingChoiceId = options?.spacingChoiceId ? options.spacingChoiceId : 'spacingChoice';
|
|
29
|
+
const spacingCustomId = options?.spacingCustomId ? options.spacingCustomId : 'spacingCustom';
|
|
30
|
+
const defaultValueChoices = options?.defaultValueChoices ? options.defaultValueChoices : GutterSpacing.M;
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
id,
|
|
34
|
+
type: 'switch',
|
|
35
|
+
defaultValue: false,
|
|
36
|
+
switchLabel: 'Custom',
|
|
37
|
+
label: 'Gutter',
|
|
38
|
+
info: 'An official nerds term for ‘gap’',
|
|
39
|
+
onChange: (bundle) => presetCustomValue(bundle, spacingChoiceId, spacingCustomId, gutterSpacingStyleMap),
|
|
40
|
+
show: (bundle) => bundle.getBlock(dependentSettingId)?.value !== '1',
|
|
41
|
+
on: [
|
|
42
|
+
{
|
|
43
|
+
id: spacingCustomId,
|
|
44
|
+
type: 'input',
|
|
45
|
+
rules: [numericalOrPixelRule],
|
|
46
|
+
onChange: (bundle) => appendUnit(bundle, spacingCustomId),
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
off: [
|
|
50
|
+
{
|
|
51
|
+
id: spacingChoiceId,
|
|
52
|
+
type: 'slider',
|
|
53
|
+
defaultValue: defaultValueChoices,
|
|
54
|
+
choices: [
|
|
55
|
+
{
|
|
56
|
+
value: GutterSpacing.Auto,
|
|
57
|
+
label: 'Auto',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
value: GutterSpacing.S,
|
|
61
|
+
label: 'S',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
value: GutterSpacing.M,
|
|
65
|
+
label: 'M',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
value: GutterSpacing.L,
|
|
69
|
+
label: 'L',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
export * from './background';
|
|
4
|
+
export * from './border';
|
|
5
|
+
export * from './borderRadius';
|
|
6
|
+
export * from './borderRadiusExtended';
|
|
7
|
+
export * from './gutter';
|
|
8
|
+
export * from './margin';
|
|
9
|
+
export * from './marginExtended';
|
|
10
|
+
export * from './padding';
|
|
11
|
+
export * from './paddingExtended';
|
|
12
|
+
export * from './types';
|
|
13
|
+
export * from './securityDownloadable';
|
|
14
|
+
export * from './securityGlobalControl';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { Margin, getMarginSettings } from '.';
|
|
5
|
+
import { SwitchBlock } from '..';
|
|
6
|
+
|
|
7
|
+
describe('getMarginSettings', () => {
|
|
8
|
+
it('should return margin settings without arguments', () => {
|
|
9
|
+
const marginSettings = getMarginSettings() as SwitchBlock;
|
|
10
|
+
|
|
11
|
+
expect(marginSettings).toHaveProperty('id', 'hasCustomMarginValue');
|
|
12
|
+
expect(marginSettings).toHaveProperty('label', 'Margin');
|
|
13
|
+
expect(marginSettings).toHaveProperty('type', 'switch');
|
|
14
|
+
expect(marginSettings).toHaveProperty('defaultValue', false);
|
|
15
|
+
expect(marginSettings.on?.[0]).toHaveProperty('id', 'marginValue');
|
|
16
|
+
expect(marginSettings.on?.[0]).toHaveProperty('type', 'input');
|
|
17
|
+
expect(marginSettings.off?.[0]).toHaveProperty('id', 'marginChoice');
|
|
18
|
+
expect(marginSettings.off?.[0]).toHaveProperty('type', 'segmentedControls');
|
|
19
|
+
expect(marginSettings.off?.[0]).toHaveProperty('choices', [
|
|
20
|
+
{
|
|
21
|
+
value: Margin.None,
|
|
22
|
+
label: 'None',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: Margin.Small,
|
|
26
|
+
label: 'S',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: Margin.Medium,
|
|
30
|
+
label: 'M',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
value: Margin.Large,
|
|
34
|
+
label: 'L',
|
|
35
|
+
},
|
|
36
|
+
]);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should return margin settings with id', () => {
|
|
40
|
+
expect(getMarginSettings({ id: 'Test' })).toHaveProperty('id', 'hasCustomMarginValue_Test');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
SettingBlock,
|
|
5
|
+
appendUnit,
|
|
6
|
+
maximumNumericalOrPixelOrAutoRule,
|
|
7
|
+
numericalOrPixelRule,
|
|
8
|
+
presetCustomValue,
|
|
9
|
+
} from '../';
|
|
10
|
+
import { MARGIN_DEFAULT_PLACEHOLDER } from './defaultValues';
|
|
11
|
+
import { Margin, marginStyleMap } from './types';
|
|
12
|
+
|
|
13
|
+
type MarginSettingsType = {
|
|
14
|
+
id?: string;
|
|
15
|
+
marginStyleMap?: Record<Margin, string>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns margin settings: margin switch, margin slider, custom margin input
|
|
20
|
+
*
|
|
21
|
+
* @param {string} id Custom suffix for the setting ids
|
|
22
|
+
* @returns {SettingBlock} Returns margin settings
|
|
23
|
+
*/
|
|
24
|
+
export const getMarginSlider = (id: string): SettingBlock => ({
|
|
25
|
+
id,
|
|
26
|
+
type: 'segmentedControls',
|
|
27
|
+
defaultValue: Margin.None,
|
|
28
|
+
choices: [
|
|
29
|
+
{
|
|
30
|
+
value: Margin.None,
|
|
31
|
+
label: 'None',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
value: Margin.Small,
|
|
35
|
+
label: 'S',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
value: Margin.Medium,
|
|
39
|
+
label: 'M',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
value: Margin.Large,
|
|
43
|
+
label: 'L',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const getMarginSettings = (options?: MarginSettingsType): SettingBlock => {
|
|
49
|
+
const hasId = options?.id ? `hasCustomMarginValue_${options?.id}` : 'hasCustomMarginValue';
|
|
50
|
+
const valueId = options?.id ? `marginValue_${options?.id}` : 'marginValue';
|
|
51
|
+
const choiceId = options?.id ? `marginChoice_${options?.id}` : 'marginChoice';
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
id: hasId,
|
|
55
|
+
label: 'Margin',
|
|
56
|
+
type: 'switch',
|
|
57
|
+
switchLabel: 'Custom',
|
|
58
|
+
defaultValue: false,
|
|
59
|
+
info: 'The spacing around UI elements to create more space',
|
|
60
|
+
onChange: (bundle) => presetCustomValue(bundle, choiceId, valueId, options?.marginStyleMap || marginStyleMap),
|
|
61
|
+
on: [
|
|
62
|
+
{
|
|
63
|
+
id: valueId,
|
|
64
|
+
type: 'input',
|
|
65
|
+
placeholder: MARGIN_DEFAULT_PLACEHOLDER,
|
|
66
|
+
rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],
|
|
67
|
+
onChange: (bundle) => appendUnit(bundle, valueId),
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
off: [getMarginSlider(choiceId)],
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { MultiInputBlock, MultiInputLayout } from '@frontify/sidebar-settings';
|
|
5
|
+
import { Margin, getMarginExtendedSettings } from '.';
|
|
6
|
+
import { SwitchBlock } from '..';
|
|
7
|
+
import { AppBridgeBlock } from '@frontify/app-bridge';
|
|
8
|
+
|
|
9
|
+
describe('getMarginExtendedSettings', () => {
|
|
10
|
+
it('should return extended margin settings without arguments', () => {
|
|
11
|
+
const extendedMarginSettings = getMarginExtendedSettings() as SwitchBlock;
|
|
12
|
+
|
|
13
|
+
expect(extendedMarginSettings).toHaveProperty('id', 'hasExtendedCustomMargin');
|
|
14
|
+
expect(extendedMarginSettings).toHaveProperty('label', 'Margin');
|
|
15
|
+
expect(extendedMarginSettings).toHaveProperty('type', 'switch');
|
|
16
|
+
expect(extendedMarginSettings).toHaveProperty('defaultValue', false);
|
|
17
|
+
expect(extendedMarginSettings.on?.[0]).toHaveProperty('id', 'extendedMarginValues');
|
|
18
|
+
expect(extendedMarginSettings.on?.[0]).toHaveProperty('type', 'multiInput');
|
|
19
|
+
expect(extendedMarginSettings.on?.[0]).toHaveProperty('layout', MultiInputLayout.Spider);
|
|
20
|
+
|
|
21
|
+
expect((extendedMarginSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[0]).toHaveProperty(
|
|
22
|
+
'id',
|
|
23
|
+
'extendedMarginTop'
|
|
24
|
+
);
|
|
25
|
+
expect((extendedMarginSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[1]).toHaveProperty(
|
|
26
|
+
'id',
|
|
27
|
+
'extendedMarginLeft'
|
|
28
|
+
);
|
|
29
|
+
expect((extendedMarginSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[2]).toHaveProperty(
|
|
30
|
+
'id',
|
|
31
|
+
'extendedMarginRight'
|
|
32
|
+
);
|
|
33
|
+
expect((extendedMarginSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[3]).toHaveProperty(
|
|
34
|
+
'id',
|
|
35
|
+
'extendedMarginBottom'
|
|
36
|
+
);
|
|
37
|
+
expect(extendedMarginSettings.off?.[0]).toHaveProperty('id', 'extendedMarginChoice');
|
|
38
|
+
expect(extendedMarginSettings.off?.[0]).toHaveProperty('type', 'segmentedControls');
|
|
39
|
+
expect(extendedMarginSettings.off?.[0]).toHaveProperty('defaultValue', Margin.None);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should return extended margin settings with id', () => {
|
|
43
|
+
expect(getMarginExtendedSettings({ id: 'Test' })).toHaveProperty('id', 'hasExtendedCustomMargin_Test');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
MultiInputLayout,
|
|
5
|
+
SettingBlock,
|
|
6
|
+
appendUnit,
|
|
7
|
+
maximumNumericalOrPixelOrAutoRule,
|
|
8
|
+
numericalOrPixelRule,
|
|
9
|
+
presetCustomValue,
|
|
10
|
+
} from '../';
|
|
11
|
+
import { MARGIN_DEFAULT_PLACEHOLDER } from './defaultValues';
|
|
12
|
+
import { getMarginSlider } from './margin';
|
|
13
|
+
import { marginStyleMap } from './types';
|
|
14
|
+
|
|
15
|
+
type MarginSettingsType = {
|
|
16
|
+
id?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Returns margin settings: margin switch, margin slider, custom margin input for every direction
|
|
21
|
+
*
|
|
22
|
+
* @param options Options for the settings
|
|
23
|
+
* @param options.id Custom suffix for the setting ids
|
|
24
|
+
* @returns {SettingBlock} Returns margin settings
|
|
25
|
+
*/
|
|
26
|
+
export const getMarginExtendedSettings = (options?: MarginSettingsType): SettingBlock => {
|
|
27
|
+
const hasId = options?.id ? `hasExtendedCustomMargin_${options?.id}` : 'hasExtendedCustomMargin';
|
|
28
|
+
const valueId = options?.id ? `extendedMarginValues_${options?.id}` : 'extendedMarginValues';
|
|
29
|
+
const choiceId = options?.id ? `extendedMarginChoice_${options?.id}` : 'extendedMarginChoice';
|
|
30
|
+
const topId = options?.id ? `extendedMarginTop_${options?.id}` : 'extendedMarginTop';
|
|
31
|
+
const leftId = options?.id ? `extendedMarginLeft_${options?.id}` : 'extendedMarginLeft';
|
|
32
|
+
const rightId = options?.id ? `extendedMarginRight_${options?.id}` : 'extendedMarginRight';
|
|
33
|
+
const bottomId = options?.id ? `extendedMarginBottom_${options?.id}` : 'extendedMarginBottom';
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
id: hasId,
|
|
37
|
+
label: 'Margin',
|
|
38
|
+
type: 'switch',
|
|
39
|
+
switchLabel: 'Custom',
|
|
40
|
+
defaultValue: false,
|
|
41
|
+
info: 'The spacing around UI elements to create more negative space',
|
|
42
|
+
onChange: (bundle) => {
|
|
43
|
+
presetCustomValue(bundle, choiceId, topId, marginStyleMap);
|
|
44
|
+
presetCustomValue(bundle, choiceId, leftId, marginStyleMap);
|
|
45
|
+
presetCustomValue(bundle, choiceId, rightId, marginStyleMap);
|
|
46
|
+
presetCustomValue(bundle, choiceId, bottomId, marginStyleMap);
|
|
47
|
+
},
|
|
48
|
+
on: [
|
|
49
|
+
{
|
|
50
|
+
id: valueId,
|
|
51
|
+
type: 'multiInput',
|
|
52
|
+
layout: MultiInputLayout.Spider,
|
|
53
|
+
blocks: [
|
|
54
|
+
{
|
|
55
|
+
id: topId,
|
|
56
|
+
type: 'input',
|
|
57
|
+
label: 'Top',
|
|
58
|
+
placeholder: MARGIN_DEFAULT_PLACEHOLDER,
|
|
59
|
+
onChange: (bundle) => appendUnit(bundle, topId),
|
|
60
|
+
rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: leftId,
|
|
64
|
+
type: 'input',
|
|
65
|
+
label: 'Left',
|
|
66
|
+
placeholder: MARGIN_DEFAULT_PLACEHOLDER,
|
|
67
|
+
onChange: (bundle) => appendUnit(bundle, leftId),
|
|
68
|
+
rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: rightId,
|
|
72
|
+
type: 'input',
|
|
73
|
+
label: 'Right',
|
|
74
|
+
placeholder: MARGIN_DEFAULT_PLACEHOLDER,
|
|
75
|
+
onChange: (bundle) => appendUnit(bundle, rightId),
|
|
76
|
+
rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: bottomId,
|
|
80
|
+
type: 'input',
|
|
81
|
+
label: 'Bottom',
|
|
82
|
+
placeholder: MARGIN_DEFAULT_PLACEHOLDER,
|
|
83
|
+
onChange: (bundle) => appendUnit(bundle, bottomId),
|
|
84
|
+
rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
off: [getMarginSlider(choiceId)],
|
|
90
|
+
};
|
|
91
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { Padding, getPaddingSettings } from '.';
|
|
5
|
+
import { SwitchBlock } from '..';
|
|
6
|
+
|
|
7
|
+
describe('getPaddingSettings', () => {
|
|
8
|
+
it('should return padding settings without arguments', () => {
|
|
9
|
+
const paddingSettings = getPaddingSettings() as SwitchBlock;
|
|
10
|
+
|
|
11
|
+
expect(paddingSettings).toHaveProperty('id', 'hasCustomPaddingValue');
|
|
12
|
+
expect(paddingSettings).toHaveProperty('label', 'Padding');
|
|
13
|
+
expect(paddingSettings).toHaveProperty('type', 'switch');
|
|
14
|
+
expect(paddingSettings).toHaveProperty('defaultValue', false);
|
|
15
|
+
expect(paddingSettings.on?.[0]).toHaveProperty('id', 'paddingValue');
|
|
16
|
+
expect(paddingSettings.on?.[0]).toHaveProperty('type', 'input');
|
|
17
|
+
expect(paddingSettings.off?.[0]).toHaveProperty('id', 'paddingChoice');
|
|
18
|
+
expect(paddingSettings.off?.[0]).toHaveProperty('type', 'segmentedControls');
|
|
19
|
+
expect(paddingSettings.off?.[0]).toHaveProperty('choices', [
|
|
20
|
+
{
|
|
21
|
+
value: Padding.None,
|
|
22
|
+
label: 'None',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: Padding.Small,
|
|
26
|
+
label: 'S',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: Padding.Medium,
|
|
30
|
+
label: 'M',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
value: Padding.Large,
|
|
34
|
+
label: 'L',
|
|
35
|
+
},
|
|
36
|
+
]);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should return padding settings with id', () => {
|
|
40
|
+
expect(getPaddingSettings({ id: 'Test' })).toHaveProperty('id', 'hasCustomPaddingValue_Test');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
SettingBlock,
|
|
5
|
+
appendUnit,
|
|
6
|
+
maximumNumericalOrPixelOrAutoRule,
|
|
7
|
+
numericalOrPixelRule,
|
|
8
|
+
presetCustomValue,
|
|
9
|
+
} from '../';
|
|
10
|
+
import { PADDING_DEFAULT_PLACEHOLDER } from './defaultValues';
|
|
11
|
+
import { Padding, paddingStyleMap } from './types';
|
|
12
|
+
|
|
13
|
+
type PaddingSettingsType = {
|
|
14
|
+
id?: string;
|
|
15
|
+
paddingStyleMap?: Record<Padding, string>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns padding settings: padding switch, padding slider, custom padding input
|
|
20
|
+
*
|
|
21
|
+
* @param options Options for the settings
|
|
22
|
+
* @param options.id Custom suffix for the setting ids
|
|
23
|
+
* @returns {SettingBlock} Returns padding settings
|
|
24
|
+
*/
|
|
25
|
+
export const getPaddingSlider = (id: string): SettingBlock => ({
|
|
26
|
+
id,
|
|
27
|
+
type: 'segmentedControls',
|
|
28
|
+
defaultValue: Padding.Small,
|
|
29
|
+
choices: [
|
|
30
|
+
{
|
|
31
|
+
value: Padding.None,
|
|
32
|
+
label: 'None',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: Padding.Small,
|
|
36
|
+
label: 'S',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: Padding.Medium,
|
|
40
|
+
label: 'M',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: Padding.Large,
|
|
44
|
+
label: 'L',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const getPaddingSettings = (options?: PaddingSettingsType): SettingBlock => {
|
|
50
|
+
const hasId = options?.id ? `hasCustomPaddingValue_${options?.id}` : 'hasCustomPaddingValue';
|
|
51
|
+
const valueId = options?.id ? `paddingValue_${options?.id}` : 'paddingValue';
|
|
52
|
+
const choiceId = options?.id ? `paddingChoice_${options?.id}` : 'paddingChoice';
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
id: hasId,
|
|
56
|
+
label: 'Padding',
|
|
57
|
+
type: 'switch',
|
|
58
|
+
switchLabel: 'Custom',
|
|
59
|
+
defaultValue: false,
|
|
60
|
+
info: 'The spacing around UI elements to create more negative space',
|
|
61
|
+
onChange: (bundle) => presetCustomValue(bundle, choiceId, valueId, options?.paddingStyleMap || paddingStyleMap),
|
|
62
|
+
on: [
|
|
63
|
+
{
|
|
64
|
+
id: valueId,
|
|
65
|
+
type: 'input',
|
|
66
|
+
placeholder: PADDING_DEFAULT_PLACEHOLDER,
|
|
67
|
+
rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],
|
|
68
|
+
onChange: (bundle) => appendUnit(bundle, valueId),
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
off: [getPaddingSlider(choiceId)],
|
|
72
|
+
};
|
|
73
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { MultiInputBlock, MultiInputLayout } from '@frontify/sidebar-settings';
|
|
5
|
+
import { Padding, getPaddingExtendedSettings } from '.';
|
|
6
|
+
import { SwitchBlock } from '..';
|
|
7
|
+
import { AppBridgeBlock } from '@frontify/app-bridge';
|
|
8
|
+
|
|
9
|
+
describe('getPaddingExtendedSettings', () => {
|
|
10
|
+
it('should return extended padding settings without arguments', () => {
|
|
11
|
+
const extendedPaddingSettings = getPaddingExtendedSettings() as SwitchBlock;
|
|
12
|
+
|
|
13
|
+
expect(extendedPaddingSettings).toHaveProperty('id', 'hasExtendedCustomPadding');
|
|
14
|
+
expect(extendedPaddingSettings).toHaveProperty('label', 'Padding');
|
|
15
|
+
expect(extendedPaddingSettings).toHaveProperty('type', 'switch');
|
|
16
|
+
expect(extendedPaddingSettings).toHaveProperty('defaultValue', false);
|
|
17
|
+
expect(extendedPaddingSettings.on?.[0]).toHaveProperty('id', 'extendedPaddingValues');
|
|
18
|
+
expect(extendedPaddingSettings.on?.[0]).toHaveProperty('type', 'multiInput');
|
|
19
|
+
expect(extendedPaddingSettings.on?.[0]).toHaveProperty('layout', MultiInputLayout.Spider);
|
|
20
|
+
|
|
21
|
+
expect((extendedPaddingSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[0]).toHaveProperty(
|
|
22
|
+
'id',
|
|
23
|
+
'extendedPaddingTop'
|
|
24
|
+
);
|
|
25
|
+
expect((extendedPaddingSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[1]).toHaveProperty(
|
|
26
|
+
'id',
|
|
27
|
+
'extendedPaddingLeft'
|
|
28
|
+
);
|
|
29
|
+
expect((extendedPaddingSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[2]).toHaveProperty(
|
|
30
|
+
'id',
|
|
31
|
+
'extendedPaddingRight'
|
|
32
|
+
);
|
|
33
|
+
expect((extendedPaddingSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[3]).toHaveProperty(
|
|
34
|
+
'id',
|
|
35
|
+
'extendedPaddingBottom'
|
|
36
|
+
);
|
|
37
|
+
expect(extendedPaddingSettings.off?.[0]).toHaveProperty('id', 'extendedPaddingChoice');
|
|
38
|
+
expect(extendedPaddingSettings.off?.[0]).toHaveProperty('type', 'segmentedControls');
|
|
39
|
+
expect(extendedPaddingSettings.off?.[0]).toHaveProperty('defaultValue', Padding.Small);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should return extended margin settings with id', () => {
|
|
43
|
+
expect(getPaddingExtendedSettings({ id: 'Test' })).toHaveProperty('id', 'hasExtendedCustomPadding_Test');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
MultiInputLayout,
|
|
5
|
+
SettingBlock,
|
|
6
|
+
appendUnit,
|
|
7
|
+
maximumNumericalOrPixelOrAutoRule,
|
|
8
|
+
numericalOrPixelRule,
|
|
9
|
+
presetCustomValue,
|
|
10
|
+
} from '../';
|
|
11
|
+
import { PADDING_DEFAULT_PLACEHOLDER } from './defaultValues';
|
|
12
|
+
import { getPaddingSlider } from './padding';
|
|
13
|
+
import { paddingStyleMap } from './types';
|
|
14
|
+
|
|
15
|
+
type PaddingSettingsType = {
|
|
16
|
+
id?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Returns padding settings: padding switch, padding slider, custom padding input for every direction
|
|
21
|
+
*
|
|
22
|
+
* @param options Options for the settings
|
|
23
|
+
* @param options.id Custom suffix for the setting ids
|
|
24
|
+
* @returns {SettingBlock} Returns padding settings
|
|
25
|
+
*/
|
|
26
|
+
export const getPaddingExtendedSettings = (options?: PaddingSettingsType): SettingBlock => {
|
|
27
|
+
const hasId = options?.id ? `hasExtendedCustomPadding_${options?.id}` : 'hasExtendedCustomPadding';
|
|
28
|
+
const valueId = options?.id ? `extendedPaddingValues_${options?.id}` : 'extendedPaddingValues';
|
|
29
|
+
const choiceId = options?.id ? `extendedPaddingChoice_${options?.id}` : 'extendedPaddingChoice';
|
|
30
|
+
const topId = options?.id ? `extendedPaddingTop_${options?.id}` : 'extendedPaddingTop';
|
|
31
|
+
const leftId = options?.id ? `extendedPaddingLeft_${options?.id}` : 'extendedPaddingLeft';
|
|
32
|
+
const rightId = options?.id ? `extendedPaddingRight_${options?.id}` : 'extendedPaddingRight';
|
|
33
|
+
const bottomId = options?.id ? `extendedPaddingBottom_${options?.id}` : 'extendedPaddingBottom';
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
id: hasId,
|
|
37
|
+
label: 'Padding',
|
|
38
|
+
type: 'switch',
|
|
39
|
+
switchLabel: 'Custom',
|
|
40
|
+
defaultValue: false,
|
|
41
|
+
info: 'The spacing around UI elements to create more negative space',
|
|
42
|
+
onChange: (bundle) => {
|
|
43
|
+
presetCustomValue(bundle, choiceId, topId, paddingStyleMap);
|
|
44
|
+
presetCustomValue(bundle, choiceId, leftId, paddingStyleMap);
|
|
45
|
+
presetCustomValue(bundle, choiceId, rightId, paddingStyleMap);
|
|
46
|
+
presetCustomValue(bundle, choiceId, bottomId, paddingStyleMap);
|
|
47
|
+
},
|
|
48
|
+
on: [
|
|
49
|
+
{
|
|
50
|
+
id: valueId,
|
|
51
|
+
type: 'multiInput',
|
|
52
|
+
layout: MultiInputLayout.Spider,
|
|
53
|
+
blocks: [
|
|
54
|
+
{
|
|
55
|
+
id: topId,
|
|
56
|
+
type: 'input',
|
|
57
|
+
label: 'Top',
|
|
58
|
+
placeholder: PADDING_DEFAULT_PLACEHOLDER,
|
|
59
|
+
onChange: (bundle) => appendUnit(bundle, topId),
|
|
60
|
+
rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: leftId,
|
|
64
|
+
type: 'input',
|
|
65
|
+
label: 'Left',
|
|
66
|
+
placeholder: PADDING_DEFAULT_PLACEHOLDER,
|
|
67
|
+
onChange: (bundle) => appendUnit(bundle, leftId),
|
|
68
|
+
rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: rightId,
|
|
72
|
+
type: 'input',
|
|
73
|
+
label: 'Right',
|
|
74
|
+
placeholder: PADDING_DEFAULT_PLACEHOLDER,
|
|
75
|
+
onChange: (bundle) => appendUnit(bundle, rightId),
|
|
76
|
+
rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: bottomId,
|
|
80
|
+
type: 'input',
|
|
81
|
+
label: 'Bottom',
|
|
82
|
+
placeholder: PADDING_DEFAULT_PLACEHOLDER,
|
|
83
|
+
onChange: (bundle) => appendUnit(bundle, bottomId),
|
|
84
|
+
rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
off: [getPaddingSlider(choiceId)],
|
|
90
|
+
};
|
|
91
|
+
};
|