@quadrats/react 0.7.8 → 1.0.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/accordion/accordion.css +1 -0
- package/accordion/accordion.scss +81 -0
- package/accordion/components/Accordion.d.ts +9 -0
- package/accordion/components/Accordion.js +22 -0
- package/accordion/components/AccordionContent.d.ts +8 -0
- package/accordion/components/AccordionContent.js +24 -0
- package/accordion/components/AccordionTitle.d.ts +8 -0
- package/accordion/components/AccordionTitle.js +20 -0
- package/accordion/contexts/AccordionContext.d.ts +2 -0
- package/accordion/contexts/AccordionContext.js +5 -0
- package/accordion/createReactAccordion.d.ts +4 -0
- package/accordion/createReactAccordion.js +144 -0
- package/accordion/defaultRenderAccordionElements.d.ts +2 -0
- package/accordion/defaultRenderAccordionElements.js +12 -0
- package/accordion/hooks/useAccordion.d.ts +1 -0
- package/accordion/hooks/useAccordion.js +8 -0
- package/accordion/index.cjs.js +212 -0
- package/accordion/index.d.ts +8 -0
- package/accordion/index.js +10 -0
- package/accordion/jsx-serializer/createJsxSerializeAccordion.d.ts +5 -0
- package/accordion/jsx-serializer/createJsxSerializeAccordion.js +48 -0
- package/accordion/jsx-serializer/defaultRenderAccordionElements.d.ts +2 -0
- package/accordion/jsx-serializer/defaultRenderAccordionElements.js +16 -0
- package/accordion/jsx-serializer/index.cjs.js +64 -0
- package/accordion/jsx-serializer/index.d.ts +3 -0
- package/accordion/jsx-serializer/index.js +2 -0
- package/accordion/jsx-serializer/package.json +7 -0
- package/accordion/jsx-serializer/typings.d.ts +4 -0
- package/accordion/package.json +10 -0
- package/accordion/toolbar/AccordionToolbarIcon.d.ts +8 -0
- package/accordion/toolbar/AccordionToolbarIcon.js +12 -0
- package/accordion/toolbar/index.cjs.js +22 -0
- package/accordion/toolbar/index.d.ts +2 -0
- package/accordion/toolbar/index.js +2 -0
- package/accordion/toolbar/package.json +7 -0
- package/accordion/toolbar/useAccordionTool.d.ts +4 -0
- package/accordion/toolbar/useAccordionTool.js +10 -0
- package/accordion/typings.d.ts +25 -0
- package/align/constants.d.ts +8 -0
- package/align/constants.js +10 -0
- package/align/createReactAlign.d.ts +2 -0
- package/align/createReactAlign.js +26 -0
- package/align/index.cjs.js +39 -0
- package/align/index.d.ts +3 -0
- package/align/index.js +2 -0
- package/align/package.json +7 -0
- package/align/toolbar/AlignToolbarIcon.d.ts +10 -0
- package/align/toolbar/AlignToolbarIcon.js +12 -0
- package/align/toolbar/index.cjs.js +30 -0
- package/align/toolbar/index.d.ts +2 -0
- package/align/toolbar/index.js +2 -0
- package/align/toolbar/package.json +7 -0
- package/align/toolbar/useAlignTool.d.ts +6 -0
- package/align/toolbar/useAlignTool.js +18 -0
- package/align/typings.d.ts +17 -0
- package/blockquote/blockquote.css +1 -0
- package/blockquote/blockquote.scss +23 -0
- package/blockquote/defaultRenderBlockquoteElement.js +3 -1
- package/blockquote/index.cjs.js +3 -1
- package/blockquote/package.json +4 -1
- package/card/card.css +1 -0
- package/card/card.scss +243 -0
- package/card/components/Card.d.ts +15 -0
- package/card/components/Card.js +101 -0
- package/card/components/CardContents.d.ts +9 -0
- package/card/components/CardContents.js +18 -0
- package/card/components/CardImage.d.ts +9 -0
- package/card/components/CardImage.js +13 -0
- package/card/components/CardPlaceholder.d.ts +4 -0
- package/card/components/CardPlaceholder.js +21 -0
- package/card/createReactCard.d.ts +4 -0
- package/card/createReactCard.js +82 -0
- package/card/defaultRenderCardElements.d.ts +3 -0
- package/card/defaultRenderCardElements.js +14 -0
- package/card/index.cjs.js +234 -0
- package/card/index.d.ts +7 -0
- package/card/index.js +6 -0
- package/card/jsx-serializer/createJsxSerializeCard.d.ts +5 -0
- package/card/jsx-serializer/createJsxSerializeCard.js +48 -0
- package/card/jsx-serializer/defaultRenderCardElements.d.ts +2 -0
- package/card/jsx-serializer/defaultRenderCardElements.js +10 -0
- package/card/jsx-serializer/index.cjs.js +58 -0
- package/card/jsx-serializer/index.d.ts +3 -0
- package/card/jsx-serializer/index.js +2 -0
- package/card/jsx-serializer/package.json +7 -0
- package/card/jsx-serializer/typings.d.ts +9 -0
- package/card/package.json +10 -0
- package/card/toolbar/CardToolbarIcon.d.ts +8 -0
- package/card/toolbar/CardToolbarIcon.js +12 -0
- package/card/toolbar/index.cjs.js +66 -0
- package/card/toolbar/index.d.ts +2 -0
- package/card/toolbar/index.js +2 -0
- package/card/toolbar/package.json +7 -0
- package/card/toolbar/useCardTool.d.ts +4 -0
- package/card/toolbar/useCardTool.js +55 -0
- package/card/typings.d.ts +24 -0
- package/carousel/carousel.css +1 -0
- package/carousel/carousel.scss +356 -0
- package/carousel/components/Carousel.d.ts +15 -0
- package/carousel/components/Carousel.js +62 -0
- package/carousel/components/CarouselCaption.d.ts +9 -0
- package/carousel/components/CarouselCaption.js +12 -0
- package/carousel/components/CarouselImages.d.ts +9 -0
- package/carousel/components/CarouselImages.js +52 -0
- package/carousel/components/CarouselPlaceholder.d.ts +4 -0
- package/carousel/components/CarouselPlaceholder.js +17 -0
- package/carousel/contexts/CarouselContext.d.ts +2 -0
- package/carousel/contexts/CarouselContext.js +5 -0
- package/carousel/createReactCarousel.d.ts +4 -0
- package/carousel/createReactCarousel.js +82 -0
- package/carousel/defaultRenderCarouselElements.d.ts +3 -0
- package/carousel/defaultRenderCarouselElements.js +14 -0
- package/carousel/hooks/useCarousel.d.ts +1 -0
- package/carousel/hooks/useCarousel.js +8 -0
- package/carousel/index.cjs.js +232 -0
- package/carousel/index.d.ts +9 -0
- package/carousel/index.js +8 -0
- package/carousel/jsx-serializer/createJsxSerializeCarousel.d.ts +5 -0
- package/carousel/jsx-serializer/createJsxSerializeCarousel.js +48 -0
- package/carousel/jsx-serializer/defaultRenderCarouselElements.d.ts +2 -0
- package/carousel/jsx-serializer/defaultRenderCarouselElements.js +10 -0
- package/carousel/jsx-serializer/index.cjs.js +58 -0
- package/carousel/jsx-serializer/index.d.ts +3 -0
- package/carousel/jsx-serializer/index.js +2 -0
- package/carousel/jsx-serializer/package.json +7 -0
- package/carousel/jsx-serializer/typings.d.ts +9 -0
- package/carousel/package.json +10 -0
- package/carousel/toolbar/CarouselToolbarIcon.d.ts +8 -0
- package/carousel/toolbar/CarouselToolbarIcon.js +12 -0
- package/carousel/toolbar/index.cjs.js +57 -0
- package/carousel/toolbar/index.d.ts +2 -0
- package/carousel/toolbar/index.js +2 -0
- package/carousel/toolbar/package.json +7 -0
- package/carousel/toolbar/useCarouselTool.d.ts +4 -0
- package/carousel/toolbar/useCarouselTool.js +46 -0
- package/carousel/typings.d.ts +27 -0
- package/components/BaseField/index.d.ts +11 -0
- package/components/BaseField/index.js +17 -0
- package/components/Button/index.d.ts +14 -0
- package/components/Button/index.js +12 -0
- package/components/Hint/index.d.ts +15 -0
- package/components/Hint/index.js +30 -0
- package/components/ImageUploader/index.d.ts +25 -0
- package/components/ImageUploader/index.js +174 -0
- package/components/Input/index.d.ts +14 -0
- package/components/Input/index.js +24 -0
- package/components/Message/index.d.ts +18 -0
- package/components/Message/index.js +72 -0
- package/components/Modal/index.d.ts +28 -0
- package/components/Modal/index.js +61 -0
- package/components/Notifier/NotifierManager.d.ts +17 -0
- package/components/Notifier/NotifierManager.js +24 -0
- package/components/Notifier/createNotifier.d.ts +21 -0
- package/components/Notifier/createNotifier.js +60 -0
- package/components/Notifier/typings.d.ts +28 -0
- package/components/Progress/index.d.ts +1 -1
- package/components/Progress/index.js +12 -8
- package/components/SegmentedControl/index.d.ts +13 -0
- package/components/SegmentedControl/index.js +14 -0
- package/components/Textarea/index.d.ts +15 -0
- package/components/Textarea/index.js +24 -0
- package/components/Toggle/index.d.ts +8 -0
- package/components/Toggle/index.js +15 -0
- package/components/Transition/SlideFade.d.ts +20 -0
- package/components/Transition/SlideFade.js +91 -0
- package/components/Transition/Transition.d.ts +98 -0
- package/components/Transition/Transition.js +27 -0
- package/components/Transition/getTransitionStyleProps.d.ts +16 -0
- package/components/Transition/getTransitionStyleProps.js +25 -0
- package/components/Transition/useSetNodeTransition.d.ts +7 -0
- package/components/Transition/useSetNodeTransition.js +35 -0
- package/components/baseField.css +1 -0
- package/components/baseField.scss +34 -0
- package/components/button.css +1 -0
- package/components/button.scss +254 -0
- package/components/components.css +1 -0
- package/components/components.scss +12 -0
- package/components/hint.css +1 -0
- package/components/hint.scss +59 -0
- package/components/index.cjs.js +647 -11
- package/components/index.d.ts +12 -0
- package/components/index.js +11 -0
- package/components/input.css +1 -0
- package/components/input.scss +102 -0
- package/components/message.css +1 -0
- package/components/message.scss +57 -0
- package/components/modal.css +1 -0
- package/components/modal.scss +200 -0
- package/components/progress.css +1 -1
- package/components/progress.scss +32 -20
- package/components/segmentedControl.css +1 -0
- package/components/segmentedControl.scss +63 -0
- package/components/textarea.css +1 -0
- package/components/textarea.scss +104 -0
- package/components/toggle.css +1 -0
- package/components/toggle.scss +55 -0
- package/components/tooltip.css +1 -1
- package/components/tooltip.scss +1 -1
- package/core/components/Editable.js +22 -3
- package/core/components/Quadrats.d.ts +4 -1
- package/core/components/Quadrats.js +6 -2
- package/core/constants.d.ts +1 -0
- package/core/constants.js +3 -0
- package/core/contexts/composition/CompositionProvider.d.ts +8 -0
- package/core/contexts/composition/CompositionProvider.js +8 -0
- package/core/contexts/composition/composition.d.ts +7 -0
- package/core/contexts/composition/composition.js +11 -0
- package/core/contexts/message/MessageProvider.d.ts +5 -0
- package/core/contexts/message/MessageProvider.js +35 -0
- package/core/contexts/message/message.d.ts +10 -0
- package/core/contexts/message/message.js +10 -0
- package/core/contexts/modal/CardModal/CardModal.d.ts +28 -0
- package/core/contexts/modal/CardModal/CardModal.js +103 -0
- package/core/contexts/modal/CarouselModal/CarouselItem.d.ts +15 -0
- package/core/contexts/modal/CarouselModal/CarouselItem.js +56 -0
- package/core/contexts/modal/CarouselModal/CarouselModal.d.ts +11 -0
- package/core/contexts/modal/CarouselModal/CarouselModal.js +174 -0
- package/core/contexts/modal/CarouselModal/FilesDropZone.d.ts +13 -0
- package/core/contexts/modal/CarouselModal/FilesDropZone.js +64 -0
- package/core/contexts/modal/ConfirmModal/ConfirmModal.d.ts +14 -0
- package/core/contexts/modal/ConfirmModal/ConfirmModal.js +21 -0
- package/core/contexts/modal/EmbedModal/EmbedModal.d.ts +11 -0
- package/core/contexts/modal/EmbedModal/EmbedModal.js +25 -0
- package/core/contexts/modal/ModalProvider.d.ts +8 -0
- package/core/contexts/modal/ModalProvider.js +66 -0
- package/core/contexts/modal/modal.d.ts +24 -0
- package/core/contexts/modal/modal.js +15 -0
- package/core/index.d.ts +8 -1
- package/divider/defaultRenderDividerElement.d.ts +1 -1
- package/divider/defaultRenderDividerElement.js +2 -3
- package/divider/divider.css +1 -0
- package/divider/divider.scss +9 -0
- package/divider/index.cjs.js +2 -3
- package/divider/jsx-serializer/defaultRenderDividerElement.js +2 -1
- package/divider/jsx-serializer/index.cjs.js +2 -1
- package/divider/package.json +4 -1
- package/editable.css +1 -1
- package/editable.scss +5 -6
- package/embed/components/VideoIframe.d.ts +3 -2
- package/embed/components/VideoIframe.js +2 -1
- package/embed/createReactEmbed.js +4 -1
- package/embed/createRenderEmbedElementBase.js +3 -1
- package/embed/embed.css +1 -0
- package/embed/embed.scss +234 -0
- package/embed/index.cjs.js +8 -2
- package/embed/jsx-serializer/youtube/index.cjs.js +1 -10
- package/embed/jsx-serializer/youtube/index.d.ts +1 -1
- package/embed/jsx-serializer/youtube/index.js +1 -1
- package/embed/package.json +4 -1
- package/embed/renderers/base/components/BaseEmbedElement.d.ts +21 -0
- package/embed/renderers/base/components/BaseEmbedElement.js +62 -0
- package/embed/renderers/base/index.cjs.js +65 -0
- package/embed/renderers/base/index.d.ts +1 -0
- package/embed/renderers/base/index.js +1 -0
- package/embed/renderers/base/package.json +7 -0
- package/embed/renderers/facebook/components/Facebook.d.ts +3 -2
- package/embed/renderers/facebook/components/Facebook.js +18 -11
- package/embed/renderers/facebook/defaultRenderFacebookEmbedElement.d.ts +2 -0
- package/embed/renderers/facebook/defaultRenderFacebookEmbedElement.js +42 -2
- package/embed/renderers/facebook/index.cjs.js +61 -12
- package/embed/renderers/facebook/index.d.ts +1 -1
- package/embed/renderers/facebook/index.js +1 -1
- package/embed/renderers/instagram/components/Instagram.d.ts +3 -2
- package/embed/renderers/instagram/components/Instagram.js +22 -11
- package/embed/renderers/instagram/defaultRenderInstagramEmbedElement.d.ts +2 -0
- package/embed/renderers/instagram/defaultRenderInstagramEmbedElement.js +42 -2
- package/embed/renderers/instagram/index.cjs.js +65 -12
- package/embed/renderers/instagram/index.d.ts +1 -1
- package/embed/renderers/instagram/index.js +1 -1
- package/embed/renderers/podcast-apple/components/PodcastApple.d.ts +3 -2
- package/embed/renderers/podcast-apple/components/PodcastApple.js +2 -1
- package/embed/renderers/podcast-apple/defaultRenderPodcastAppleEmbedElement.d.ts +2 -0
- package/embed/renderers/podcast-apple/defaultRenderPodcastAppleEmbedElement.js +35 -2
- package/embed/renderers/podcast-apple/index.cjs.js +38 -2
- package/embed/renderers/podcast-apple/index.d.ts +1 -1
- package/embed/renderers/podcast-apple/index.js +1 -1
- package/embed/renderers/spotify/components/Spotify.d.ts +3 -2
- package/embed/renderers/spotify/components/Spotify.js +3 -1
- package/embed/renderers/spotify/defaultRenderSpotifyEmbedElement.d.ts +2 -0
- package/embed/renderers/spotify/defaultRenderSpotifyEmbedElement.js +32 -2
- package/embed/renderers/spotify/index.cjs.js +36 -2
- package/embed/renderers/spotify/index.d.ts +1 -1
- package/embed/renderers/spotify/index.js +1 -1
- package/embed/renderers/twitter/components/Twitter.d.ts +3 -2
- package/embed/renderers/twitter/components/Twitter.js +14 -2
- package/embed/renderers/twitter/defaultRenderTwitterEmbedElement.d.ts +2 -0
- package/embed/renderers/twitter/defaultRenderTwitterEmbedElement.js +42 -2
- package/embed/renderers/twitter/index.cjs.js +57 -3
- package/embed/renderers/twitter/index.d.ts +1 -1
- package/embed/renderers/twitter/index.js +1 -1
- package/embed/renderers/vimeo/defaultRenderVimeoEmbedElement.d.ts +2 -0
- package/embed/renderers/vimeo/defaultRenderVimeoEmbedElement.js +26 -2
- package/embed/renderers/vimeo/index.cjs.js +27 -1
- package/embed/renderers/vimeo/index.d.ts +1 -1
- package/embed/renderers/vimeo/index.js +1 -1
- package/embed/renderers/youtube/defaultRenderYoutubeEmbedElement.d.ts +2 -0
- package/embed/renderers/youtube/defaultRenderYoutubeEmbedElement.js +26 -2
- package/embed/renderers/youtube/index.cjs.js +27 -1
- package/embed/renderers/youtube/index.d.ts +1 -1
- package/embed/renderers/youtube/index.js +1 -1
- package/embed/toolbar/EmbedToolbarIcon.d.ts +3 -6
- package/embed/toolbar/EmbedToolbarIcon.js +2 -2
- package/embed/toolbar/index.cjs.js +98 -13
- package/embed/toolbar/useEmbedTool.d.ts +1 -3
- package/embed/toolbar/useEmbedTool.js +96 -11
- package/embed/typings.d.ts +1 -0
- package/file-uploader/components/FileUploader.js +1 -2
- package/file-uploader/createReactFileUploader.js +4 -1
- package/file-uploader/defaultRenderFileUploaderElement.js +1 -1
- package/file-uploader/file-uploader.css +1 -1
- package/file-uploader/file-uploader.scss +0 -20
- package/file-uploader/index.cjs.js +5 -3
- package/file-uploader/toolbar/index.cjs.js +4 -1
- package/file-uploader/toolbar/useFileUploaderTool.d.ts +1 -1
- package/file-uploader/toolbar/useFileUploaderTool.js +4 -1
- package/file-uploader/typings.d.ts +6 -1
- package/footnote/defaultRenderFootnoteElement.js +1 -1
- package/footnote/index.cjs.js +1 -1
- package/footnote/jsx-serializer/defaultRenderFootnoteElement.js +1 -1
- package/footnote/jsx-serializer/index.cjs.js +1 -1
- package/footnote/toolbar/index.cjs.js +1 -1
- package/footnote/toolbar/useFootnoteTool.js +1 -1
- package/heading/defaultRenderHeadingElement.js +2 -1
- package/heading/heading.css +1 -0
- package/heading/heading.scss +53 -0
- package/heading/index.cjs.js +2 -1
- package/heading/package.json +4 -1
- package/image/components/Image.js +51 -10
- package/image/components/ImageCaption.js +6 -4
- package/image/components/ImagePlaceholder.d.ts +4 -0
- package/image/components/ImagePlaceholder.js +11 -0
- package/image/image.css +1 -1
- package/image/image.scss +61 -6
- package/image/index.cjs.js +84 -32
- package/image/index.d.ts +1 -0
- package/image/index.js +1 -0
- package/image/jsx-serializer/defaultRenderImageElements.js +2 -1
- package/image/jsx-serializer/index.cjs.js +2 -1
- package/image/jsx-serializer/typings.d.ts +2 -0
- package/image/typings.d.ts +2 -0
- package/index.cjs.js +555 -6
- package/index.js +9 -3
- package/input-block/components/InputBlock.js +19 -9
- package/input-block/defaultRenderInputBlockElement.js +1 -1
- package/input-block/hooks/useInputBlock.d.ts +2 -0
- package/input-block/hooks/useInputBlock.js +16 -8
- package/input-block/index.cjs.js +35 -17
- package/input-block/input-block.css +1 -0
- package/input-block/input-block.scss +38 -0
- package/input-block/package.json +4 -1
- package/line-break/line-break.scss +0 -2
- package/list/createReactList.js +11 -1
- package/list/index.cjs.js +15 -5
- package/list/list.css +1 -0
- package/list/list.scss +43 -0
- package/list/package.json +4 -1
- package/package.json +11 -8
- package/paragraph/createReactParagraph.d.ts +2 -0
- package/paragraph/createReactParagraph.js +8 -0
- package/paragraph/createRenderParagraphElement.d.ts +1 -1
- package/paragraph/defaultRenderParagraphElement.d.ts +3 -1
- package/paragraph/defaultRenderParagraphElement.js +4 -1
- package/paragraph/index.cjs.js +15 -2
- package/paragraph/index.d.ts +1 -0
- package/paragraph/index.js +1 -0
- package/paragraph/paragraph.css +1 -1
- package/paragraph/paragraph.scss +7 -2
- package/paragraph/renderParagraphElementWithSymbol.d.ts +3 -1
- package/paragraph/renderParagraphElementWithSymbol.js +4 -1
- package/paragraph/toolbar/ParagraphToolbarIcon.d.ts +8 -0
- package/paragraph/toolbar/ParagraphToolbarIcon.js +12 -0
- package/paragraph/toolbar/index.cjs.js +23 -0
- package/paragraph/toolbar/index.d.ts +2 -0
- package/paragraph/toolbar/index.js +2 -0
- package/paragraph/toolbar/package.json +7 -0
- package/paragraph/toolbar/useToggleParagraphTool.d.ts +5 -0
- package/paragraph/toolbar/useToggleParagraphTool.js +11 -0
- package/read-more/components/ReadMore.js +5 -3
- package/read-more/index.cjs.js +5 -3
- package/read-more/read-more.css +1 -1
- package/read-more/read-more.scss +27 -20
- package/toolbar/components/InlineToolbar.d.ts +18 -0
- package/toolbar/components/InlineToolbar.js +27 -0
- package/toolbar/components/Toolbar.js +23 -6
- package/toolbar/components/ToolbarGroupIcon.d.ts +7 -0
- package/toolbar/components/ToolbarGroupIcon.js +80 -0
- package/toolbar/components/ToolbarIcon.d.ts +3 -1
- package/toolbar/components/ToolbarIcon.js +24 -6
- package/toolbar/components/toolbarIconName.d.ts +2 -0
- package/toolbar/components/toolbarIconName.js +86 -0
- package/toolbar/contexts/toolbar.d.ts +7 -0
- package/toolbar/contexts/toolbar.js +10 -0
- package/toolbar/contexts/toolbarMenu.d.ts +6 -0
- package/toolbar/contexts/toolbarMenu.js +11 -0
- package/toolbar/hooks/useAutoGroupIcons.d.ts +12 -0
- package/toolbar/hooks/useAutoGroupIcons.js +68 -0
- package/toolbar/index.cjs.js +300 -12
- package/toolbar/index.d.ts +2 -0
- package/toolbar/index.js +2 -0
- package/toolbar/toolbar.css +1 -1
- package/toolbar/toolbar.scss +191 -43
- package/utils/index.cjs.js +153 -0
- package/utils/index.d.ts +6 -0
- package/utils/index.js +6 -0
- package/utils/removePreviousElement.d.ts +9 -0
- package/utils/removePreviousElement.js +38 -0
- package/utils/upload.d.ts +11 -0
- package/utils/upload.js +57 -0
- package/utils/useClickAway.d.ts +5 -0
- package/utils/useClickAway.js +23 -0
- package/utils/useDocumentEvents.d.ts +5 -0
- package/utils/useDocumentEvents.js +21 -0
- package/utils/useIsomorphicLayoutEffect.d.ts +2 -0
- package/utils/useIsomorphicLayoutEffect.js +9 -0
- package/utils/usePreviousValue.d.ts +1 -0
- package/utils/usePreviousValue.js +11 -0
- package/core/index.js +0 -11
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { Icon } from '@quadrats/react/components';
|
|
3
|
+
import { Edit, Trash } from '@quadrats/icons';
|
|
4
|
+
import { useClickAway } from '@quadrats/react/utils';
|
|
2
5
|
import { useInputBlock } from '../hooks/useInputBlock.js';
|
|
3
6
|
|
|
4
7
|
function InputBlock(props) {
|
|
5
|
-
const { attributes
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const { attributes } = props;
|
|
9
|
+
const blockRef = useRef(null);
|
|
10
|
+
const { inputRef, onConfirm, onRemove, onKeyDown, placeholder, } = useInputBlock(props);
|
|
11
|
+
useClickAway(() => {
|
|
12
|
+
return () => {
|
|
13
|
+
onRemove();
|
|
14
|
+
};
|
|
15
|
+
}, blockRef, [blockRef]);
|
|
16
|
+
return (React.createElement("div", Object.assign({}, attributes, { ref: blockRef, contentEditable: false, className: "qdr-input-block" }),
|
|
17
|
+
React.createElement("input", { ref: inputRef, onKeyDown: onKeyDown, placeholder: placeholder, className: "qdr-input-block__input", style: {
|
|
11
18
|
display: 'block',
|
|
12
19
|
color: 'currentColor',
|
|
13
|
-
font: 'inherit',
|
|
14
20
|
width: '100%',
|
|
15
21
|
margin: 0,
|
|
16
22
|
border: 0,
|
|
@@ -19,7 +25,11 @@ function InputBlock(props) {
|
|
|
19
25
|
outline: 0,
|
|
20
26
|
boxSizing: 'border-box',
|
|
21
27
|
} }),
|
|
22
|
-
|
|
28
|
+
React.createElement("div", { className: "qdr-input-block__icons" },
|
|
29
|
+
React.createElement("div", { className: "qdr-input-block__icon", onClick: onConfirm },
|
|
30
|
+
React.createElement(Icon, { icon: Edit, width: 24, height: 24 })),
|
|
31
|
+
React.createElement("div", { className: "qdr-input-block__icon", onClick: onRemove },
|
|
32
|
+
React.createElement(Icon, { icon: Trash, width: 24, height: 24 })))));
|
|
23
33
|
}
|
|
24
34
|
|
|
25
35
|
export { InputBlock as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import InputBlock from './components/InputBlock.js';
|
|
3
3
|
|
|
4
|
-
const defaultRenderInputBlockElement =
|
|
4
|
+
const defaultRenderInputBlockElement = props => React.createElement(InputBlock, Object.assign({}, props));
|
|
5
5
|
|
|
6
6
|
export { defaultRenderInputBlockElement };
|
|
@@ -2,6 +2,8 @@ import { KeyboardEvent } from 'react';
|
|
|
2
2
|
import { RenderInputBlockElementProps } from '../typings';
|
|
3
3
|
export declare function useInputBlock({ confirm, element, remove }: RenderInputBlockElementProps): {
|
|
4
4
|
inputRef: import("react").RefObject<HTMLInputElement | null>;
|
|
5
|
+
onRemove: () => void;
|
|
6
|
+
onConfirm: () => void;
|
|
5
7
|
onBlur: () => void;
|
|
6
8
|
onKeyDown: (event: KeyboardEvent) => void;
|
|
7
9
|
placeholder: string;
|
|
@@ -12,10 +12,21 @@ function useInputBlock({ confirm, element, remove }) {
|
|
|
12
12
|
* Add a `removeable` flag to avoid.
|
|
13
13
|
*/
|
|
14
14
|
const removeable = useRef(true);
|
|
15
|
+
const onRemove = () => {
|
|
16
|
+
removeable.current = false;
|
|
17
|
+
remove(editor, element);
|
|
18
|
+
};
|
|
19
|
+
const onConfirm = () => {
|
|
20
|
+
var _a;
|
|
21
|
+
const value = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value;
|
|
22
|
+
if (value) {
|
|
23
|
+
removeable.current = false;
|
|
24
|
+
confirm(editor, element, value);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
15
27
|
const removeIfRemovable = () => {
|
|
16
28
|
if (removeable.current) {
|
|
17
|
-
|
|
18
|
-
remove(editor, element);
|
|
29
|
+
onRemove();
|
|
19
30
|
}
|
|
20
31
|
};
|
|
21
32
|
useLayoutEffect(() => {
|
|
@@ -26,16 +37,13 @@ function useInputBlock({ confirm, element, remove }) {
|
|
|
26
37
|
}, [inputRef]);
|
|
27
38
|
return {
|
|
28
39
|
inputRef,
|
|
40
|
+
onRemove,
|
|
41
|
+
onConfirm,
|
|
29
42
|
onBlur: removeIfRemovable,
|
|
30
43
|
onKeyDown: (event) => {
|
|
31
|
-
var _a;
|
|
32
|
-
const value = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value;
|
|
33
44
|
if (event.key === 'Enter') {
|
|
34
45
|
event.preventDefault();
|
|
35
|
-
|
|
36
|
-
removeable.current = false;
|
|
37
|
-
confirm(editor, element, value);
|
|
38
|
-
}
|
|
46
|
+
onConfirm();
|
|
39
47
|
}
|
|
40
48
|
else if (event.key === 'Escape') {
|
|
41
49
|
event.preventDefault();
|
package/input-block/index.cjs.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var react = require('@quadrats/react');
|
|
5
|
+
var components = require('@quadrats/react/components');
|
|
6
|
+
var icons = require('@quadrats/icons');
|
|
7
|
+
var utils = require('@quadrats/react/utils');
|
|
5
8
|
var inputBlock = require('@quadrats/common/input-block');
|
|
6
9
|
|
|
7
10
|
function useInputBlock({ confirm, element, remove }) {
|
|
@@ -15,10 +18,21 @@ function useInputBlock({ confirm, element, remove }) {
|
|
|
15
18
|
* Add a `removeable` flag to avoid.
|
|
16
19
|
*/
|
|
17
20
|
const removeable = React.useRef(true);
|
|
21
|
+
const onRemove = () => {
|
|
22
|
+
removeable.current = false;
|
|
23
|
+
remove(editor, element);
|
|
24
|
+
};
|
|
25
|
+
const onConfirm = () => {
|
|
26
|
+
var _a;
|
|
27
|
+
const value = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value;
|
|
28
|
+
if (value) {
|
|
29
|
+
removeable.current = false;
|
|
30
|
+
confirm(editor, element, value);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
18
33
|
const removeIfRemovable = () => {
|
|
19
34
|
if (removeable.current) {
|
|
20
|
-
|
|
21
|
-
remove(editor, element);
|
|
35
|
+
onRemove();
|
|
22
36
|
}
|
|
23
37
|
};
|
|
24
38
|
React.useLayoutEffect(() => {
|
|
@@ -29,16 +43,13 @@ function useInputBlock({ confirm, element, remove }) {
|
|
|
29
43
|
}, [inputRef]);
|
|
30
44
|
return {
|
|
31
45
|
inputRef,
|
|
46
|
+
onRemove,
|
|
47
|
+
onConfirm,
|
|
32
48
|
onBlur: removeIfRemovable,
|
|
33
49
|
onKeyDown: (event) => {
|
|
34
|
-
var _a;
|
|
35
|
-
const value = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value;
|
|
36
50
|
if (event.key === 'Enter') {
|
|
37
51
|
event.preventDefault();
|
|
38
|
-
|
|
39
|
-
removeable.current = false;
|
|
40
|
-
confirm(editor, element, value);
|
|
41
|
-
}
|
|
52
|
+
onConfirm();
|
|
42
53
|
}
|
|
43
54
|
else if (event.key === 'Escape') {
|
|
44
55
|
event.preventDefault();
|
|
@@ -50,15 +61,18 @@ function useInputBlock({ confirm, element, remove }) {
|
|
|
50
61
|
}
|
|
51
62
|
|
|
52
63
|
function InputBlock(props) {
|
|
53
|
-
const { attributes
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
const { attributes } = props;
|
|
65
|
+
const blockRef = React.useRef(null);
|
|
66
|
+
const { inputRef, onConfirm, onRemove, onKeyDown, placeholder, } = useInputBlock(props);
|
|
67
|
+
utils.useClickAway(() => {
|
|
68
|
+
return () => {
|
|
69
|
+
onRemove();
|
|
70
|
+
};
|
|
71
|
+
}, blockRef, [blockRef]);
|
|
72
|
+
return (React.createElement("div", Object.assign({}, attributes, { ref: blockRef, contentEditable: false, className: "qdr-input-block" }),
|
|
73
|
+
React.createElement("input", { ref: inputRef, onKeyDown: onKeyDown, placeholder: placeholder, className: "qdr-input-block__input", style: {
|
|
59
74
|
display: 'block',
|
|
60
75
|
color: 'currentColor',
|
|
61
|
-
font: 'inherit',
|
|
62
76
|
width: '100%',
|
|
63
77
|
margin: 0,
|
|
64
78
|
border: 0,
|
|
@@ -67,10 +81,14 @@ function InputBlock(props) {
|
|
|
67
81
|
outline: 0,
|
|
68
82
|
boxSizing: 'border-box',
|
|
69
83
|
} }),
|
|
70
|
-
|
|
84
|
+
React.createElement("div", { className: "qdr-input-block__icons" },
|
|
85
|
+
React.createElement("div", { className: "qdr-input-block__icon", onClick: onConfirm },
|
|
86
|
+
React.createElement(components.Icon, { icon: icons.Edit, width: 24, height: 24 })),
|
|
87
|
+
React.createElement("div", { className: "qdr-input-block__icon", onClick: onRemove },
|
|
88
|
+
React.createElement(components.Icon, { icon: icons.Trash, width: 24, height: 24 })))));
|
|
71
89
|
}
|
|
72
90
|
|
|
73
|
-
const defaultRenderInputBlockElement =
|
|
91
|
+
const defaultRenderInputBlockElement = props => React.createElement(InputBlock, Object.assign({}, props));
|
|
74
92
|
|
|
75
93
|
function createReactInputBlock(options = {}) {
|
|
76
94
|
const core = inputBlock.createInputBlock(options);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.qdr-input-block{display:flex;align-items:center;justify-content:space-between;gap:var(--qdr-spacing-4);background-color:var(--qdr-bg);padding:var(--qdr-spacing-2) var(--qdr-spacing-4);border-radius:var(--qdr-radius-2)}.qdr-input-block__input{font-size:var(--qdr-typography-basic-input2-font-size);line-height:var(--qdr-typography-basic-input2-line-height);letter-spacing:var(--qdr-typography-basic-input2-letter-spacing);font-weight:var(--qdr-typography-basic-input2-font-weight)}.qdr-input-block__icons{display:flex;align-items:center;justify-content:flex-start;gap:var(--qdr-spacing-1)}.qdr-input-block__icon{display:flex;align-items:center;justify-content:center;padding:var(--qdr-spacing-1);border-radius:var(--qdr-radius-2);color:var(--qdr-action-inactive);cursor:pointer}.qdr-input-block__icon:hover{color:var(--qdr-action-active);background:var(--qdr-secondary-hover-bg)}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.qdr-input-block {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
gap: var(--qdr-spacing-4);
|
|
6
|
+
background-color: var(--qdr-bg);
|
|
7
|
+
padding: var(--qdr-spacing-2) var(--qdr-spacing-4);
|
|
8
|
+
border-radius: var(--qdr-radius-2);
|
|
9
|
+
|
|
10
|
+
&__input {
|
|
11
|
+
font-size: var(--qdr-typography-basic-input2-font-size);
|
|
12
|
+
line-height: var(--qdr-typography-basic-input2-line-height);
|
|
13
|
+
letter-spacing: var(--qdr-typography-basic-input2-letter-spacing);
|
|
14
|
+
font-weight: var(--qdr-typography-basic-input2-font-weight);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&__icons {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: flex-start;
|
|
21
|
+
gap: var(--qdr-spacing-1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&__icon {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
padding: var(--qdr-spacing-1);
|
|
29
|
+
border-radius: var(--qdr-radius-2);
|
|
30
|
+
color: var(--qdr-action-inactive);
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
|
|
33
|
+
&:hover {
|
|
34
|
+
color: var(--qdr-action-active);
|
|
35
|
+
background: var(--qdr-secondary-hover-bg);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
package/input-block/package.json
CHANGED
package/list/createReactList.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createList } from '@quadrats/common/list';
|
|
2
|
+
import { Node, Element } from '@quadrats/core';
|
|
2
3
|
import { createRenderElements } from '@quadrats/react';
|
|
3
4
|
import { defaultRenderListElements } from './defaultRenderListElements.js';
|
|
4
5
|
|
|
5
6
|
function createReactList(options = {}) {
|
|
6
7
|
const core = createList(options);
|
|
7
|
-
return Object.assign(Object.assign({}, core), { createRenderElement: (options = {}) => createRenderElements(['ol', 'ul', 'li'].map(key => ({
|
|
8
|
+
return Object.assign(Object.assign({}, core), { createRenderElement: (options = {}) => createRenderElements(['ol', 'ul', 'li'].map((key) => ({
|
|
8
9
|
type: core.types[key],
|
|
9
10
|
render: options[key] || defaultRenderListElements[key],
|
|
10
11
|
}))), createHandlers: () => ({
|
|
@@ -13,6 +14,15 @@ function createReactList(options = {}) {
|
|
|
13
14
|
const entries = core.getAboveListAndItem(editor);
|
|
14
15
|
if (entries) {
|
|
15
16
|
event.preventDefault();
|
|
17
|
+
const [, path] = entries.listItem;
|
|
18
|
+
const depth = path.filter((_, i) => {
|
|
19
|
+
const ancestorPath = path.slice(0, i + 1);
|
|
20
|
+
const ancestor = Node.get(editor, ancestorPath);
|
|
21
|
+
return Element.isElement(ancestor) && (ancestor.type === 'ol' || ancestor.type === 'ul');
|
|
22
|
+
}).length;
|
|
23
|
+
if (depth >= core.labels) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
16
26
|
(event.shiftKey ? core.decreaseListItemDepth : core.increaseListItemDepth)(editor, entries);
|
|
17
27
|
return;
|
|
18
28
|
}
|
package/list/index.cjs.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var list = require('@quadrats/common/list');
|
|
5
|
+
var core = require('@quadrats/core');
|
|
5
6
|
var react = require('@quadrats/react');
|
|
6
7
|
|
|
7
8
|
const defaultRenderListElements = {
|
|
@@ -11,17 +12,26 @@ const defaultRenderListElements = {
|
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
function createReactList(options = {}) {
|
|
14
|
-
const core = list.createList(options);
|
|
15
|
-
return Object.assign(Object.assign({}, core), { createRenderElement: (options = {}) => react.createRenderElements(['ol', 'ul', 'li'].map(key => ({
|
|
16
|
-
type: core.types[key],
|
|
15
|
+
const core$1 = list.createList(options);
|
|
16
|
+
return Object.assign(Object.assign({}, core$1), { createRenderElement: (options = {}) => react.createRenderElements(['ol', 'ul', 'li'].map((key) => ({
|
|
17
|
+
type: core$1.types[key],
|
|
17
18
|
render: options[key] || defaultRenderListElements[key],
|
|
18
19
|
}))), createHandlers: () => ({
|
|
19
20
|
onKeyDown: (event, editor, next) => {
|
|
20
21
|
if (event.key === 'Tab') {
|
|
21
|
-
const entries = core.getAboveListAndItem(editor);
|
|
22
|
+
const entries = core$1.getAboveListAndItem(editor);
|
|
22
23
|
if (entries) {
|
|
23
24
|
event.preventDefault();
|
|
24
|
-
|
|
25
|
+
const [, path] = entries.listItem;
|
|
26
|
+
const depth = path.filter((_, i) => {
|
|
27
|
+
const ancestorPath = path.slice(0, i + 1);
|
|
28
|
+
const ancestor = core.Node.get(editor, ancestorPath);
|
|
29
|
+
return core.Element.isElement(ancestor) && (ancestor.type === 'ol' || ancestor.type === 'ul');
|
|
30
|
+
}).length;
|
|
31
|
+
if (depth >= core$1.labels) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
(event.shiftKey ? core$1.decreaseListItemDepth : core$1.increaseListItemDepth)(editor, entries);
|
|
25
35
|
return;
|
|
26
36
|
}
|
|
27
37
|
}
|
package/list/list.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.qdr-ol,.qdr-ul{padding-inline-start:var(--qdr-spacing-11);margin:0 0 var(--qdr-spacing-8)}.qdr-ol .qdr-li,.qdr-ul .qdr-li{padding:var(--qdr-spacing-1) 0}.qdr-ol .qdr-li>*,.qdr-ul .qdr-li>*{margin:0}:is(.qdr-ul) :is(.qdr-ul) :is(.qdr-ul) .qdr-ul{list-style-type:none}:is(.qdr-ul) :is(.qdr-ul) :is(.qdr-ul) .qdr-ul .qdr-li{position:relative}:is(.qdr-ul) :is(.qdr-ul) :is(.qdr-ul) .qdr-ul .qdr-li::before{content:"";width:4px;height:4px;border:1px solid var(--qdr-text-primary);position:absolute;top:calc(var(--qdr-typography-article-body1-font-size)*var(--qdr-typography-article-body1-line-height)*.5);left:calc(-1*var(--qdr-spacing-4) - 8px);color:#000}:is(.qdr-ol) .qdr-ol{list-style-type:lower-alpha}:is(.qdr-ol) :is(.qdr-ol) .qdr-ol{list-style-type:upper-roman}:is(.qdr-ol) :is(.qdr-ol) :is(.qdr-ol) .qdr-ol{list-style-type:lower-roman}
|
package/list/list.scss
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.qdr-ol, .qdr-ul {
|
|
2
|
+
padding-inline-start: var(--qdr-spacing-11);
|
|
3
|
+
margin: 0 0 var(--qdr-spacing-8);
|
|
4
|
+
|
|
5
|
+
.qdr-li {
|
|
6
|
+
padding: var(--qdr-spacing-1) 0;
|
|
7
|
+
|
|
8
|
+
> * {
|
|
9
|
+
margin: 0;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:is(.qdr-ul) :is(.qdr-ul) :is(.qdr-ul) .qdr-ul {
|
|
15
|
+
list-style-type: none;
|
|
16
|
+
|
|
17
|
+
.qdr-li {
|
|
18
|
+
position: relative;
|
|
19
|
+
|
|
20
|
+
&::before {
|
|
21
|
+
content: "";
|
|
22
|
+
width: 4px;
|
|
23
|
+
height: 4px;
|
|
24
|
+
border: 1px solid var(--qdr-text-primary);
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: calc(var(--qdr-typography-article-body1-font-size) * var(--qdr-typography-article-body1-line-height) * 0.5);
|
|
27
|
+
left: calc(-1 * var(--qdr-spacing-4) - 8px);
|
|
28
|
+
color: black;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:is(.qdr-ol) .qdr-ol {
|
|
34
|
+
list-style-type: lower-alpha;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:is(.qdr-ol) :is(.qdr-ol) .qdr-ol {
|
|
38
|
+
list-style-type: upper-roman;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:is(.qdr-ol) :is(.qdr-ol) :is(.qdr-ol) .qdr-ol {
|
|
42
|
+
list-style-type: lower-roman;
|
|
43
|
+
}
|
package/list/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quadrats/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Rytass",
|
|
6
6
|
"homepage": "https://github.com/Quadrats/quadrats#readme",
|
|
@@ -20,16 +20,18 @@
|
|
|
20
20
|
"url": "https://github.com/Quadrats/quadrats/issues"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@quadrats/common": "^0.
|
|
24
|
-
"@quadrats/core": "^0.
|
|
25
|
-
"@quadrats/icons": "^0.
|
|
26
|
-
"@quadrats/locales": "^0.
|
|
27
|
-
"@quadrats/theme": "^0.
|
|
28
|
-
"@quadrats/utils": "^0.
|
|
23
|
+
"@quadrats/common": "^1.0.0",
|
|
24
|
+
"@quadrats/core": "^1.0.0",
|
|
25
|
+
"@quadrats/icons": "^1.0.0",
|
|
26
|
+
"@quadrats/locales": "^1.0.0",
|
|
27
|
+
"@quadrats/theme": "^1.0.0",
|
|
28
|
+
"@quadrats/utils": "^1.0.0",
|
|
29
29
|
"@types/is-hotkey": "^0.1.9",
|
|
30
30
|
"@types/react-transition-group": "^4.4.9",
|
|
31
31
|
"clsx": "^2.1.1",
|
|
32
32
|
"is-hotkey": "^0.2.0",
|
|
33
|
+
"react-dnd": "^16.0.1",
|
|
34
|
+
"react-dnd-html5-backend": "^16.0.1",
|
|
33
35
|
"react-transition-group": "^4.4.5",
|
|
34
36
|
"slate-dom": "^0.112.2",
|
|
35
37
|
"slate-react": "^0.112.1",
|
|
@@ -37,7 +39,8 @@
|
|
|
37
39
|
},
|
|
38
40
|
"peerDependencies": {
|
|
39
41
|
"react": "^19.1.0",
|
|
40
|
-
"react-dom": "^19.1.0"
|
|
42
|
+
"react-dom": "^19.1.0",
|
|
43
|
+
"slate": "^0.112.0"
|
|
41
44
|
},
|
|
42
45
|
"main": "./index.cjs.js",
|
|
43
46
|
"module": "./index.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
|
-
import { ParagraphElement } from '@quadrats/core';
|
|
3
2
|
import { RenderElementProps } from '@quadrats/react';
|
|
3
|
+
import { ParagraphElement } from '@quadrats/common/paragraph';
|
|
4
4
|
export type RenderParagraphElementProps = RenderElementProps<ParagraphElement>;
|
|
5
5
|
export interface CreateRenderParagraphElementOptions {
|
|
6
6
|
render?: (props: RenderParagraphElementProps) => JSX.Element | null | undefined;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ParagraphElement } from '@quadrats/common/paragraph';
|
|
2
3
|
import { RenderElementProps } from '@quadrats/react';
|
|
3
|
-
export declare const defaultRenderParagraphElement: ({ attributes, children, }: {
|
|
4
|
+
export declare const defaultRenderParagraphElement: ({ attributes, children, element, }: {
|
|
4
5
|
attributes?: RenderElementProps["attributes"];
|
|
5
6
|
children: any;
|
|
7
|
+
element: ParagraphElement;
|
|
6
8
|
}) => React.JSX.Element;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
const defaultRenderParagraphElement = ({ attributes, children, }) =>
|
|
3
|
+
const defaultRenderParagraphElement = ({ attributes, children, element, }) => {
|
|
4
|
+
const style = element.align ? { textAlign: element.align } : undefined;
|
|
5
|
+
return (React.createElement("p", Object.assign({}, attributes, { className: "qdr-paragraph", style: style }), children));
|
|
6
|
+
};
|
|
4
7
|
|
|
5
8
|
export { defaultRenderParagraphElement };
|
package/paragraph/index.cjs.js
CHANGED
|
@@ -3,16 +3,29 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var core = require('@quadrats/core');
|
|
5
5
|
var react = require('@quadrats/react');
|
|
6
|
+
var paragraph = require('@quadrats/common/paragraph');
|
|
6
7
|
|
|
7
|
-
const defaultRenderParagraphElement = ({ attributes, children, }) =>
|
|
8
|
+
const defaultRenderParagraphElement = ({ attributes, children, element, }) => {
|
|
9
|
+
const style = element.align ? { textAlign: element.align } : undefined;
|
|
10
|
+
return (React.createElement("p", Object.assign({}, attributes, { className: "qdr-paragraph", style: style }), children));
|
|
11
|
+
};
|
|
8
12
|
|
|
9
13
|
function createRenderParagraphElement(options = {}) {
|
|
10
14
|
const { render = defaultRenderParagraphElement } = options;
|
|
11
15
|
return react.createRenderElement({ type: core.PARAGRAPH_TYPE, render });
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
function createReactParagraph() {
|
|
19
|
+
const core = paragraph.createParagraph();
|
|
20
|
+
return Object.assign({}, core);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const renderParagraphElementWithSymbol = ({ attributes, children, element, }) => {
|
|
24
|
+
const style = element.align ? { textAlign: element.align } : undefined;
|
|
25
|
+
return (React.createElement("p", Object.assign({}, attributes, { className: "qdr-paragraph qdr-paragraph__with-line-break-symbol", style: style }), children));
|
|
26
|
+
};
|
|
15
27
|
|
|
28
|
+
exports.createReactParagraph = createReactParagraph;
|
|
16
29
|
exports.createRenderParagraphElement = createRenderParagraphElement;
|
|
17
30
|
exports.defaultRenderParagraphElement = defaultRenderParagraphElement;
|
|
18
31
|
exports.renderParagraphElementWithSymbol = renderParagraphElementWithSymbol;
|
package/paragraph/index.d.ts
CHANGED
package/paragraph/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { defaultRenderParagraphElement } from './defaultRenderParagraphElement.js';
|
|
2
2
|
export { createRenderParagraphElement } from './createRenderParagraphElement.js';
|
|
3
|
+
export { createReactParagraph } from './createReactParagraph.js';
|
|
3
4
|
export { renderParagraphElementWithSymbol } from './renderParagraphElementWithSymbol.js';
|
package/paragraph/paragraph.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.qdr-paragraph__with-line-break-symbol>*:last-child{position:relative}.qdr-paragraph__with-line-break-symbol>*:last-child::after{content:"";display:block;width:16px;height:16px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAA60lEQVRoge2ZwQ3CMBAEdxH/0AF0AKVQQkqgA6ACKIFSKAE6oJNDEREPxOccwybSjuRPrEt2JMeJdYwITJnZpNNbYARYQI0F1FhAjQXUzMcQguT7hywimKn1ElJjATUWUGMBNRZQYwE1FiC5IHmrEyfPIAGSGwBd+LUof7kAyS2AK4Bl3Ug5ig40JHcATh/XDv+P/zoBpQaAS1f2q5HNM7Zd6J4tSC+hiGhJPgDsP6aO2Xt94ZwtKG5wkGz7BzYoOIzXYlCHpt9Gu52oUQkMegciovsGrErWbi3cI1NjATUWUGMBNRZQYwEpAJ566ofECQ43YwAAAABJRU5ErkJggg==");background-size:16px;background-position:center;background-repeat:no-repeat;position:absolute;right:-16px;bottom:0;opacity:.5}
|
|
1
|
+
.qdr-paragraph{margin:0 0 var(--qdr-spacing-6);color:var(--qdr-text-primary);font-size:var(--qdr-typography-article-body1-font-size);line-height:var(--qdr-typography-article-body1-line-height);letter-spacing:var(--qdr-typography-article-body1-letter-spacing);font-weight:var(--qdr-typography-article-body1-font-weight)}.qdr-paragraph__with-line-break-symbol>*:last-child{position:relative}.qdr-paragraph__with-line-break-symbol>*:last-child::after{content:"";display:block;width:16px;height:16px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAA60lEQVRoge2ZwQ3CMBAEdxH/0AF0AKVQQkqgA6ACKIFSKAE6oJNDEREPxOccwybSjuRPrEt2JMeJdYwITJnZpNNbYARYQI0F1FhAjQXUzMcQguT7hywimKn1ElJjATUWUGMBNRZQYwE1FiC5IHmrEyfPIAGSGwBd+LUof7kAyS2AK4Bl3Ug5ig40JHcATh/XDv+P/zoBpQaAS1f2q5HNM7Zd6J4tSC+hiGhJPgDsP6aO2Xt94ZwtKG5wkGz7BzYoOIzXYlCHpt9Gu52oUQkMegciovsGrErWbi3cI1NjATUWUGMBNRZQYwEpAJ566ofECQ43YwAAAABJRU5ErkJggg==");background-size:16px;background-position:center;background-repeat:no-repeat;position:absolute;right:-16px;bottom:0;opacity:.5}
|
package/paragraph/paragraph.scss
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
$qdr-image-resizer-size: 6px;
|
|
2
|
-
|
|
3
1
|
.qdr-paragraph {
|
|
2
|
+
margin: 0 0 var(--qdr-spacing-6);
|
|
3
|
+
color: var(--qdr-text-primary);
|
|
4
|
+
font-size: var(--qdr-typography-article-body1-font-size);
|
|
5
|
+
line-height: var(--qdr-typography-article-body1-line-height);
|
|
6
|
+
letter-spacing: var(--qdr-typography-article-body1-letter-spacing);
|
|
7
|
+
font-weight: var(--qdr-typography-article-body1-font-weight);
|
|
8
|
+
|
|
4
9
|
&__with-line-break-symbol {
|
|
5
10
|
> *:last-child {
|
|
6
11
|
position: relative;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ParagraphElement } from '@quadrats/common/paragraph';
|
|
2
3
|
import { RenderElementProps } from '@quadrats/react';
|
|
3
|
-
export declare const renderParagraphElementWithSymbol: ({ attributes, children, }: {
|
|
4
|
+
export declare const renderParagraphElementWithSymbol: ({ attributes, children, element, }: {
|
|
4
5
|
attributes?: RenderElementProps["attributes"];
|
|
5
6
|
children: any;
|
|
7
|
+
element: ParagraphElement;
|
|
6
8
|
}) => React.JSX.Element;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
const renderParagraphElementWithSymbol = ({ attributes, children, }) =>
|
|
3
|
+
const renderParagraphElementWithSymbol = ({ attributes, children, element, }) => {
|
|
4
|
+
const style = element.align ? { textAlign: element.align } : undefined;
|
|
5
|
+
return (React.createElement("p", Object.assign({}, attributes, { className: "qdr-paragraph qdr-paragraph__with-line-break-symbol", style: style }), children));
|
|
6
|
+
};
|
|
4
7
|
|
|
5
8
|
export { renderParagraphElementWithSymbol };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Paragraph } from '@quadrats/common/paragraph';
|
|
3
|
+
import { ToolbarIconProps } from '@quadrats/react/toolbar';
|
|
4
|
+
export interface ParagraphToolbarIconProps extends Omit<ToolbarIconProps, 'active' | 'onClick'> {
|
|
5
|
+
controller: Paragraph;
|
|
6
|
+
}
|
|
7
|
+
declare function ParagraphToolbarIcon(props: ParagraphToolbarIconProps): React.JSX.Element;
|
|
8
|
+
export default ParagraphToolbarIcon;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ToolbarIcon } from '@quadrats/react/toolbar';
|
|
4
|
+
import { useToggleParagraphTool } from './useToggleParagraphTool.js';
|
|
5
|
+
|
|
6
|
+
function ParagraphToolbarIcon(props) {
|
|
7
|
+
const { controller } = props, rest = __rest(props, ["controller"]);
|
|
8
|
+
const { active, onClick } = useToggleParagraphTool(controller);
|
|
9
|
+
return React.createElement(ToolbarIcon, Object.assign({}, rest, { active: active, onClick: onClick }));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { ParagraphToolbarIcon as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('@quadrats/react');
|
|
4
|
+
var tslib = require('tslib');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var toolbar = require('@quadrats/react/toolbar');
|
|
7
|
+
|
|
8
|
+
function useToggleParagraphTool(controller) {
|
|
9
|
+
const editor = react.useQuadrats();
|
|
10
|
+
return {
|
|
11
|
+
active: controller.isSelectionInParagraph(editor),
|
|
12
|
+
onClick: () => controller.setParagraphNodes(editor),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function ParagraphToolbarIcon(props) {
|
|
17
|
+
const { controller } = props, rest = tslib.__rest(props, ["controller"]);
|
|
18
|
+
const { active, onClick } = useToggleParagraphTool(controller);
|
|
19
|
+
return React.createElement(toolbar.ToolbarIcon, Object.assign({}, rest, { active: active, onClick: onClick }));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.ParagraphToolbarIcon = ParagraphToolbarIcon;
|
|
23
|
+
exports.useToggleParagraphTool = useToggleParagraphTool;
|