@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
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.qdr-toggle {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
position: relative;
|
|
4
|
+
width: 48px;
|
|
5
|
+
height: 24px;
|
|
6
|
+
background-color: var(--qdr-text-disabled);
|
|
7
|
+
border-radius: 999px;
|
|
8
|
+
transition: background-color var(--qdr-duration-short) var(--qdr-easing-standard);
|
|
9
|
+
will-change: background-color;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
|
|
12
|
+
&__input {
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
margin: 0;
|
|
16
|
+
opacity: 0;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&__control {
|
|
21
|
+
position: absolute;
|
|
22
|
+
content: '';
|
|
23
|
+
top: 2px;
|
|
24
|
+
left: 2px;
|
|
25
|
+
width: 20px;
|
|
26
|
+
height: 20px;
|
|
27
|
+
border-radius: 50%;
|
|
28
|
+
background-color: var(--qdr-on-primary);
|
|
29
|
+
transition: left var(--qdr-duration-short) var(--qdr-easing-standard);
|
|
30
|
+
will-change: left;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&--checked {
|
|
34
|
+
background-color: var(--qdr-primary);
|
|
35
|
+
|
|
36
|
+
&.qdr-toggle--disabled {
|
|
37
|
+
background-color: var(--qdr-primary-light);
|
|
38
|
+
cursor: not-allowed;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.qdr-toggle__control {
|
|
42
|
+
left: calc(100% - 22px);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&--disabled {
|
|
47
|
+
background-color: var(--qdr-action-disabled-bg);
|
|
48
|
+
cursor: not-allowed;
|
|
49
|
+
|
|
50
|
+
.qdr-toggle__input {
|
|
51
|
+
cursor: default;
|
|
52
|
+
pointer-events: none;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
package/components/tooltip.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.qdr-tooltip__mask{position:absolute;width:100%;top:0;left:0;z-index:20}.qdr-tooltip__popup{position:absolute;max-width:250px;overflow:hidden;overflow-wrap:break-word;box-sizing:border-box}.qdr-tooltip__popup--top{padding-bottom:10px}.qdr-tooltip__popup--right{padding-left:10px}.qdr-tooltip__popup--bottom{padding-top:10px}.qdr-tooltip__popup--left{padding-right:10px}.qdr-tooltip__content{background-color:var(--qdr-surface);border:1px solid var(--qdr-border);color:var(--qdr-text);border-radius:4px;padding:16px;font-size:13px;white-space:pre-wrap}.qdr-tooltip__arrow{position:absolute;content:"";width:10px;height:10px;background-color:var(--qdr-surface);border:1px solid var(--qdr-border);transform:translateX(-50%) translateY(-50%) rotate(45deg)}.qdr-tooltip__arrow--top{top:calc(100% - 10px);left:50%;border-top:none;border-left:none}.qdr-tooltip__arrow--bottom{left:50%;top:10px;border-bottom:none;border-right:none}.qdr-tooltip__arrow--right{left:10px;top:50%;border-top:none;border-right:none}.qdr-tooltip__arrow--left{left:calc(100% - 10px);top:50%;border-bottom:none;border-left:none}.qdr-tooltip__arrow--top-left,.qdr-tooltip__arrow--bottom-left{left:20px}.qdr-tooltip__arrow--top-right,.qdr-tooltip__arrow--bottom-right{left:calc(100% - 20px)}.qdr-tooltip__fade--enter{opacity:.01}.qdr-tooltip__fade--enter-active{opacity:1;transition:all 200ms ease-out}.qdr-tooltip__fade--exit{opacity:1}.qdr-tooltip__fade--exit-active{opacity:0;transition:all 200ms ease-in}
|
|
1
|
+
.qdr-tooltip__mask{position:absolute;width:100%;top:0;left:0;z-index:20}.qdr-tooltip__popup{position:absolute;max-width:250px;overflow:hidden;overflow-wrap:break-word;box-sizing:border-box}.qdr-tooltip__popup--top{padding-bottom:10px}.qdr-tooltip__popup--right{padding-left:10px}.qdr-tooltip__popup--bottom{padding-top:10px}.qdr-tooltip__popup--left{padding-right:10px}.qdr-tooltip__content{background-color:var(--qdr-surface);border:1px solid var(--qdr-border);color:var(--qdr-text-primary);border-radius:4px;padding:16px;font-size:13px;white-space:pre-wrap}.qdr-tooltip__arrow{position:absolute;content:"";width:10px;height:10px;background-color:var(--qdr-surface);border:1px solid var(--qdr-border);transform:translateX(-50%) translateY(-50%) rotate(45deg)}.qdr-tooltip__arrow--top{top:calc(100% - 10px);left:50%;border-top:none;border-left:none}.qdr-tooltip__arrow--bottom{left:50%;top:10px;border-bottom:none;border-right:none}.qdr-tooltip__arrow--right{left:10px;top:50%;border-top:none;border-right:none}.qdr-tooltip__arrow--left{left:calc(100% - 10px);top:50%;border-bottom:none;border-left:none}.qdr-tooltip__arrow--top-left,.qdr-tooltip__arrow--bottom-left{left:20px}.qdr-tooltip__arrow--top-right,.qdr-tooltip__arrow--bottom-right{left:calc(100% - 20px)}.qdr-tooltip__fade--enter{opacity:.01}.qdr-tooltip__fade--enter-active{opacity:1;transition:all 200ms ease-out}.qdr-tooltip__fade--exit{opacity:1}.qdr-tooltip__fade--exit-active{opacity:0;transition:all 200ms ease-in}
|
package/components/tooltip.scss
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { __rest } from 'tslib';
|
|
2
2
|
import React, { useState, useCallback } from 'react';
|
|
3
3
|
import { useSlate, Editable as Editable$1 } from 'slate-react';
|
|
4
|
+
import { Element } from 'slate';
|
|
4
5
|
import clsx from 'clsx';
|
|
5
6
|
import { isAncestorEmpty, Editor } from '@quadrats/core';
|
|
6
7
|
import { useLocale, useTheme } from '@quadrats/react/configs';
|
|
7
8
|
import DefaultLeaf from './DefaultLeaf.js';
|
|
8
|
-
import {
|
|
9
|
+
import { CompositionProvider } from '../contexts/composition/CompositionProvider.js';
|
|
10
|
+
import { PLACEHOLDER_KEY } from '../constants.js';
|
|
9
11
|
|
|
10
12
|
function Editable(props) {
|
|
11
13
|
const locale = useLocale();
|
|
@@ -14,6 +16,8 @@ function Editable(props) {
|
|
|
14
16
|
const editor = useSlate();
|
|
15
17
|
const isEditorEmpty = isAncestorEmpty(editor);
|
|
16
18
|
const [placeholderShowable, setPlaceholderShowable] = useState(isEditorEmpty);
|
|
19
|
+
const [compositionType, setCompositionType] = useState('');
|
|
20
|
+
const [compositionPath, setCompositionPath] = useState([]);
|
|
17
21
|
const decorate = useCallback((entry) => {
|
|
18
22
|
const result = decorateProp ? decorateProp(entry) : [];
|
|
19
23
|
const [node] = entry;
|
|
@@ -28,15 +32,29 @@ function Editable(props) {
|
|
|
28
32
|
return result;
|
|
29
33
|
}, [decorateProp, isEditorEmpty]);
|
|
30
34
|
const onCompositionEnd = useCallback((event) => {
|
|
35
|
+
setCompositionType('');
|
|
36
|
+
setCompositionPath([]);
|
|
31
37
|
onCompositionEndProp === null || onCompositionEndProp === void 0 ? void 0 : onCompositionEndProp(event);
|
|
32
38
|
setPlaceholderShowable(true);
|
|
33
39
|
}, [onCompositionEndProp]);
|
|
34
40
|
const onCompositionStart = useCallback((event) => {
|
|
41
|
+
if (editor.selection) {
|
|
42
|
+
const [, path] = Editor.node(editor, editor.selection);
|
|
43
|
+
const match = Editor.above(editor, {
|
|
44
|
+
at: path,
|
|
45
|
+
match: (n) => Element.isElement(n),
|
|
46
|
+
mode: 'lowest',
|
|
47
|
+
});
|
|
48
|
+
if (match) {
|
|
49
|
+
setCompositionPath(match[1]);
|
|
50
|
+
setCompositionType(match[0].type);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
35
53
|
onCompositionStartProp === null || onCompositionStartProp === void 0 ? void 0 : onCompositionStartProp(event);
|
|
36
54
|
if (isEditorEmpty) {
|
|
37
55
|
setPlaceholderShowable(false);
|
|
38
56
|
}
|
|
39
|
-
}, [onCompositionStartProp, isEditorEmpty]);
|
|
57
|
+
}, [editor, onCompositionStartProp, isEditorEmpty]);
|
|
40
58
|
const renderLeaf = useCallback((props) => {
|
|
41
59
|
const children = renderLeafProp ? renderLeafProp(props) : React.createElement(DefaultLeaf, Object.assign({}, props));
|
|
42
60
|
if (placeholderShowable && props.leaf[PLACEHOLDER_KEY]) {
|
|
@@ -46,7 +64,8 @@ function Editable(props) {
|
|
|
46
64
|
}
|
|
47
65
|
return children;
|
|
48
66
|
}, [renderLeafProp, placeholder, placeholderShowable]);
|
|
49
|
-
return (React.createElement(
|
|
67
|
+
return (React.createElement(CompositionProvider, { compositionType: compositionType, compositionPath: compositionPath },
|
|
68
|
+
React.createElement(Editable$1, Object.assign({}, slateEditableProps, { className: clsx('qdr-editable', themeProps.className, className), decorate: decorate, onCompositionStart: onCompositionStart, onCompositionEnd: onCompositionEnd, renderLeaf: renderLeaf, style: Object.assign(Object.assign({}, themeProps.style), style) }))));
|
|
50
69
|
}
|
|
51
70
|
|
|
52
71
|
export { Editable as default };
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { Slate } from 'slate-react';
|
|
3
3
|
import { ConfigsProviderProps } from '@quadrats/react/configs';
|
|
4
|
+
import { ConfirmModalConfig } from '../contexts/modal/modal';
|
|
4
5
|
import { Descendant } from '..';
|
|
5
6
|
export type QuadratsProps = Pick<Parameters<typeof Slate>[0], 'children' | 'editor'> & Omit<ConfigsProviderProps, 'children'> & {
|
|
6
7
|
onChange: (value: Descendant[]) => void;
|
|
7
8
|
value: Descendant[];
|
|
9
|
+
needConfirmModal?: ConfirmModalConfig | null;
|
|
10
|
+
setNeedConfirmModal?: Dispatch<SetStateAction<ConfirmModalConfig | null>>;
|
|
8
11
|
};
|
|
9
12
|
/**
|
|
10
13
|
* Provide configs of quadrats and control the value.
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Slate } from 'slate-react';
|
|
3
3
|
import { ConfigsProvider } from '@quadrats/react/configs';
|
|
4
|
+
import { ModalProvider } from '../contexts/modal/ModalProvider.js';
|
|
5
|
+
import { MessageProvider } from '../contexts/message/MessageProvider.js';
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Provide configs of quadrats and control the value.
|
|
7
9
|
*/
|
|
8
10
|
function Quadrats(props) {
|
|
9
|
-
const { children, editor, locale, onChange, theme, value, } = props;
|
|
11
|
+
const { children, editor, locale, onChange, theme, value, needConfirmModal, setNeedConfirmModal } = props;
|
|
10
12
|
return (React.createElement(ConfigsProvider, { theme: theme, locale: locale },
|
|
11
|
-
React.createElement(Slate, { editor: editor, onChange: onChange, initialValue: value },
|
|
13
|
+
React.createElement(Slate, { editor: editor, onChange: onChange, initialValue: value },
|
|
14
|
+
React.createElement(MessageProvider, null,
|
|
15
|
+
React.createElement(ModalProvider, { needConfirmModal: needConfirmModal, setNeedConfirmModal: setNeedConfirmModal }, children)))));
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
export { Quadrats as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PLACEHOLDER_KEY = "__quadrats-placeholder__";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { Path } from '@quadrats/core';
|
|
3
|
+
export interface CompositionProviderProps {
|
|
4
|
+
compositionType: string;
|
|
5
|
+
compositionPath: Path;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const CompositionProvider: ({ compositionType, compositionPath, children }: CompositionProviderProps) => React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CompositionContext } from './composition.js';
|
|
3
|
+
|
|
4
|
+
const CompositionProvider = ({ compositionType, compositionPath, children }) => {
|
|
5
|
+
return (React.createElement(CompositionContext.Provider, { value: { compositionType, compositionPath } }, children));
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { CompositionProvider };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Path } from '@quadrats/core';
|
|
2
|
+
export interface CompositionContextValue {
|
|
3
|
+
compositionType: string;
|
|
4
|
+
compositionPath: Path;
|
|
5
|
+
}
|
|
6
|
+
export declare const CompositionContext: import("react").Context<CompositionContextValue>;
|
|
7
|
+
export declare function useComposition(): CompositionContextValue;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const CompositionContext = createContext({
|
|
4
|
+
compositionType: '',
|
|
5
|
+
compositionPath: [],
|
|
6
|
+
});
|
|
7
|
+
function useComposition() {
|
|
8
|
+
return useContext(CompositionContext);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { CompositionContext, useComposition };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { useContext, useCallback } from 'react';
|
|
2
|
+
import { Message } from '@quadrats/react/components';
|
|
3
|
+
import { ThemeContext } from '@quadrats/react/configs';
|
|
4
|
+
import { MessageContext } from './message.js';
|
|
5
|
+
|
|
6
|
+
const MessageProvider = ({ children }) => {
|
|
7
|
+
const { props: themeProps } = useContext(ThemeContext);
|
|
8
|
+
const message = useCallback(({ type, content, duration }) => {
|
|
9
|
+
switch (type) {
|
|
10
|
+
case 'info': {
|
|
11
|
+
Message.info(content, themeProps, { duration });
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
case 'error': {
|
|
15
|
+
Message.error(content, themeProps, { duration });
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
case 'warning': {
|
|
19
|
+
Message.warning(content, themeProps, { duration });
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case 'success': {
|
|
23
|
+
Message.success(content, themeProps, { duration });
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
default: {
|
|
27
|
+
Message.info(content, themeProps, { duration });
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}, [themeProps]);
|
|
32
|
+
return React.createElement(MessageContext.Provider, { value: { message } }, children);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { MessageProvider };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MessageSeverity } from '@quadrats/react/components';
|
|
2
|
+
export interface MessageContextValue {
|
|
3
|
+
message: ({ type, content, duration }: {
|
|
4
|
+
type?: MessageSeverity;
|
|
5
|
+
content: string;
|
|
6
|
+
duration?: number;
|
|
7
|
+
}) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const MessageContext: import("react").Context<MessageContextValue>;
|
|
10
|
+
export declare function useMessage(): MessageContextValue;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Editor } from '@quadrats/core';
|
|
3
|
+
import { Card, CardAlignment } from '@quadrats/common/card';
|
|
4
|
+
import { ImageUploaderItem } from '@quadrats/react/components';
|
|
5
|
+
export type CardModalValues = {
|
|
6
|
+
alignment: CardAlignment;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
remark: string;
|
|
10
|
+
linkText: string;
|
|
11
|
+
linkUrl: string;
|
|
12
|
+
};
|
|
13
|
+
export interface CardModalProps {
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
close: VoidFunction;
|
|
16
|
+
controller?: Card<Editor>;
|
|
17
|
+
initialValue?: {
|
|
18
|
+
values: CardModalValues;
|
|
19
|
+
imageItem: ImageUploaderItem | null;
|
|
20
|
+
haveLink: boolean;
|
|
21
|
+
};
|
|
22
|
+
onConfirm: ({ values, imageItem, haveLink, }: {
|
|
23
|
+
values: CardModalValues;
|
|
24
|
+
imageItem: ImageUploaderItem | null;
|
|
25
|
+
haveLink: boolean;
|
|
26
|
+
}) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare const CardModal: ({ isOpen, close, controller, initialValue, onConfirm: onConfirmProps }: CardModalProps) => React.JSX.Element;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, { useState, useMemo, useEffect, useCallback } from 'react';
|
|
2
|
+
import { usePreviousValue } from '@quadrats/react/utils';
|
|
3
|
+
import { Modal, SegmentedControl, ImageUploader, Input, Textarea, Toggle } from '@quadrats/react/components';
|
|
4
|
+
import { useMessage } from '../../message/message.js';
|
|
5
|
+
|
|
6
|
+
const options = [
|
|
7
|
+
{
|
|
8
|
+
value: 'leftImageRightText',
|
|
9
|
+
label: '左圖右文',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
value: 'rightImageLeftText',
|
|
13
|
+
label: '右圖左文',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
value: 'noImage',
|
|
17
|
+
label: '純文字顯示',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
// TODO: i18n
|
|
21
|
+
const CardModal = ({ isOpen, close, controller, initialValue, onConfirm: onConfirmProps }) => {
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
23
|
+
const { message } = useMessage();
|
|
24
|
+
const [values, setValues] = useState({
|
|
25
|
+
alignment: 'leftImageRightText',
|
|
26
|
+
title: '',
|
|
27
|
+
description: '',
|
|
28
|
+
remark: '',
|
|
29
|
+
linkText: '',
|
|
30
|
+
linkUrl: '',
|
|
31
|
+
});
|
|
32
|
+
const [imageUploaderItem, setImageUploaderItem] = useState(null);
|
|
33
|
+
const [haveLink, setHaveLink] = useState(true);
|
|
34
|
+
const [errors, setErrors] = useState([]);
|
|
35
|
+
const uploading = useMemo(() => imageUploaderItem && imageUploaderItem.progress !== 100, [imageUploaderItem]);
|
|
36
|
+
const prevIsOpen = usePreviousValue(isOpen);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!prevIsOpen && isOpen && initialValue) {
|
|
39
|
+
setValues(Object.assign({}, initialValue.values));
|
|
40
|
+
setHaveLink(initialValue.haveLink);
|
|
41
|
+
setImageUploaderItem(initialValue.imageItem);
|
|
42
|
+
}
|
|
43
|
+
}, [initialValue, isOpen, prevIsOpen]);
|
|
44
|
+
const onConfirm = useCallback(() => {
|
|
45
|
+
const errorItems = [];
|
|
46
|
+
setErrors([]);
|
|
47
|
+
if (values.alignment !== 'noImage' && (!imageUploaderItem || (imageUploaderItem && !imageUploaderItem.url))) {
|
|
48
|
+
errorItems.push({ field: 'image', message: '必填欄位' });
|
|
49
|
+
}
|
|
50
|
+
if (!values.title) {
|
|
51
|
+
errorItems.push({ field: 'title', message: '必填欄位' });
|
|
52
|
+
}
|
|
53
|
+
if (!values.description) {
|
|
54
|
+
errorItems.push({ field: 'description', message: '必填欄位' });
|
|
55
|
+
}
|
|
56
|
+
if (haveLink) {
|
|
57
|
+
const urlValidation = /^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-./?%&=]*)?$/;
|
|
58
|
+
if (!values.linkText) {
|
|
59
|
+
errorItems.push({ field: 'linkText', message: '必填欄位' });
|
|
60
|
+
}
|
|
61
|
+
if (!values.linkUrl) {
|
|
62
|
+
errorItems.push({ field: 'linkUrl', message: '必填欄位' });
|
|
63
|
+
}
|
|
64
|
+
if (values.linkUrl && !urlValidation.test(values.linkUrl)) {
|
|
65
|
+
errorItems.push({ field: 'linkUrl', message: '格式錯誤' });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (errorItems.length > 0) {
|
|
69
|
+
setErrors(errorItems);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
onConfirmProps({ values, imageItem: values.alignment === 'noImage' ? null : imageUploaderItem, haveLink });
|
|
73
|
+
}
|
|
74
|
+
}, [imageUploaderItem, onConfirmProps, haveLink, values]);
|
|
75
|
+
return (React.createElement(Modal, { isOpen: isOpen, size: "medium", title: "\u5EFA\u7ACB\u5361\u7247", confirmText: "\u5EFA\u7ACB\u5361\u7247", mainAreaClassName: "qdr-card-modal__main", closable: !uploading, maskClosable: !uploading, onClose: () => {
|
|
76
|
+
close();
|
|
77
|
+
}, onConfirm: onConfirm },
|
|
78
|
+
React.createElement("div", { className: "qdr-card-modal__block" },
|
|
79
|
+
React.createElement("p", { className: "qdr-card-modal__block-title" }, "\u986F\u793A\u8A2D\u5B9A"),
|
|
80
|
+
React.createElement(SegmentedControl, { options: options, value: values.alignment, onChange: (value) => setValues((prev) => (Object.assign(Object.assign({}, prev), { alignment: value }))) })),
|
|
81
|
+
React.createElement("div", { className: "qdr-card-modal__block" },
|
|
82
|
+
React.createElement("p", { className: "qdr-card-modal__block-title" }, "\u57FA\u672C\u8A2D\u5B9A"),
|
|
83
|
+
React.createElement("div", { className: "qdr-card-modal__block-content" },
|
|
84
|
+
values.alignment !== 'noImage' && controller && (React.createElement(ImageUploader, { label: "\u5716\u7247", getBody: controller.getBody, getHeaders: controller.getHeaders, getUrl: controller.getUrl, uploader: controller.uploader, imageUploaderItem: imageUploaderItem, setImageUploaderItem: setImageUploaderItem, width: 240, accept: controller === null || controller === void 0 ? void 0 : controller.accept, ratio: controller === null || controller === void 0 ? void 0 : controller.ratio, limitSize: controller === null || controller === void 0 ? void 0 : controller.limitSize, onOverLimitSize: () => {
|
|
85
|
+
message({ type: 'error', content: '圖片檔案過大,檔案需小於 2MB' });
|
|
86
|
+
}, onErrorAccept: () => {
|
|
87
|
+
message({ type: 'error', content: '圖片類型錯誤' });
|
|
88
|
+
}, required: true, errorMessage: (_b = (_a = errors.find((e) => e.field === 'image')) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : '' })),
|
|
89
|
+
React.createElement(Input, { value: values.title, className: "qdr-card-modal__block-field", onChange: (value) => setValues((prev) => (Object.assign(Object.assign({}, prev), { title: value }))), label: "\u6A19\u984C", placeholder: "\u8ACB\u8F38\u5165\u6A19\u984C", maxLength: 30, required: true, errorMessage: (_d = (_c = errors.find((e) => e.field === 'title')) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : '' }),
|
|
90
|
+
React.createElement(Textarea, { value: values.description, className: "qdr-card-modal__block-field", onChange: (value) => setValues((prev) => (Object.assign(Object.assign({}, prev), { description: value }))), label: "\u7C21\u8FF0", placeholder: "\u8ACB\u8F38\u5165\u7C21\u8FF0", height: 86, maxLength: 50, required: true, errorMessage: (_f = (_e = errors.find((e) => e.field === 'description')) === null || _e === void 0 ? void 0 : _e.message) !== null && _f !== void 0 ? _f : '' }),
|
|
91
|
+
React.createElement(Input, { value: values.remark, className: "qdr-card-modal__block-field", onChange: (value) => setValues((prev) => (Object.assign(Object.assign({}, prev), { remark: value }))), label: "\u5099\u8A3B", placeholder: "\u8ACB\u8F38\u5165\u5099\u8A3B\u8CC7\u8A0A", maxLength: 30 }))),
|
|
92
|
+
React.createElement("div", { className: "qdr-card-modal__block" },
|
|
93
|
+
React.createElement("div", { className: "qdr-card-modal__block-title" },
|
|
94
|
+
React.createElement("span", null, "\u5C0E\u9023\u6309\u9215"),
|
|
95
|
+
React.createElement("div", { className: "qdr-card-modal__toggle-wrapper" },
|
|
96
|
+
React.createElement(Toggle, { checked: haveLink, onChange: setHaveLink }),
|
|
97
|
+
React.createElement("span", null, "\u986F\u793A\u6309\u9215"))),
|
|
98
|
+
haveLink && (React.createElement("div", { className: "qdr-card-modal__link-wrapper" },
|
|
99
|
+
React.createElement(Input, { value: values.linkText, onChange: (value) => setValues((prev) => (Object.assign(Object.assign({}, prev), { linkText: value }))), width: 180, label: "\u986F\u793A\u6587\u5B57", placeholder: "\u8ACB\u8F38\u5165\u986F\u793A\u6587\u5B57", maxLength: 6, required: true, errorMessage: (_h = (_g = errors.find((e) => e.field === 'linkText')) === null || _g === void 0 ? void 0 : _g.message) !== null && _h !== void 0 ? _h : '' }),
|
|
100
|
+
React.createElement(Input, { value: values.linkUrl, onChange: (value) => setValues((prev) => (Object.assign(Object.assign({}, prev), { linkUrl: value }))), className: "qdr-card-modal__url-field", label: "\u9023\u7D50", placeholder: "\u8CBC\u4E0A\u9023\u7D50\uFF0C\u5982 https://...", required: true, errorMessage: (_k = (_j = errors.find((e) => e.field === 'linkUrl')) === null || _j === void 0 ? void 0 : _j.message) !== null && _k !== void 0 ? _k : '' }))))));
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export { CardModal };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface CarouselItemProps {
|
|
3
|
+
url: string;
|
|
4
|
+
preview: string;
|
|
5
|
+
progress: number;
|
|
6
|
+
caption: string;
|
|
7
|
+
index: number;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
onRemove: VoidFunction;
|
|
10
|
+
swap: (from: number, to: number) => void;
|
|
11
|
+
ratio?: [number, number];
|
|
12
|
+
isError?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const CarouselItem: ({ url, preview, progress, caption, index, onChange, onRemove, swap, ratio, isError, }: CarouselItemProps) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
15
|
+
export default CarouselItem;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useDrag, useDrop } from 'react-dnd';
|
|
4
|
+
import { Progress, Icon, Input } from '@quadrats/react/components';
|
|
5
|
+
import { Trash, Image } from '@quadrats/icons';
|
|
6
|
+
|
|
7
|
+
const CarouselItem = ({ url, preview, progress, caption, index, onChange, onRemove, swap, ratio, isError, }) => {
|
|
8
|
+
const [inputValue, setInputValue] = useState(caption);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const timeoutId = setTimeout(() => {
|
|
11
|
+
onChange(inputValue);
|
|
12
|
+
}, 500);
|
|
13
|
+
return () => {
|
|
14
|
+
clearTimeout(timeoutId);
|
|
15
|
+
};
|
|
16
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
17
|
+
}, [inputValue]);
|
|
18
|
+
const [{ isDragging }, drag, dragPreview] = useDrag(() => ({
|
|
19
|
+
type: 'CarouselItem',
|
|
20
|
+
collect: (monitor) => ({
|
|
21
|
+
isDragging: monitor.isDragging(),
|
|
22
|
+
}),
|
|
23
|
+
item: { index },
|
|
24
|
+
}));
|
|
25
|
+
const [{ isOver }, drop] = useDrop(() => ({
|
|
26
|
+
accept: 'CarouselItem',
|
|
27
|
+
collect: (monitor) => ({
|
|
28
|
+
isOver: monitor.isOver({ shallow: true }),
|
|
29
|
+
}),
|
|
30
|
+
drop: (item) => {
|
|
31
|
+
if (item.index !== index) {
|
|
32
|
+
swap(item.index, index);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
}));
|
|
36
|
+
// TODO: i18n
|
|
37
|
+
return drop(drag(dragPreview(React.createElement("div", { className: clsx('qdr-carousel-modal__item', {
|
|
38
|
+
'qdr-carousel-modal__item--isDragging': isDragging,
|
|
39
|
+
'qdr-carousel-modal__item--isOver': isOver,
|
|
40
|
+
}) },
|
|
41
|
+
progress !== 100 && React.createElement(Progress, { percentage: progress }),
|
|
42
|
+
React.createElement("div", { contentEditable: false, className: clsx('qdr-inline-toolbar', 'qdr-carousel-modal__inline-toolbar') },
|
|
43
|
+
React.createElement(Icon, { className: "qdr-inline-toolbar__icon", icon: Trash, width: 24, height: 24, onClick: onRemove })),
|
|
44
|
+
React.createElement("div", { className: "qdr-carousel-modal__image-wrapper" }, isError ? (React.createElement("div", { className: "qdr-carousel-modal__error-wrapper", style: {
|
|
45
|
+
aspectRatio: ratio ? `${ratio[0]} / ${ratio[1]}` : '3 /2',
|
|
46
|
+
} },
|
|
47
|
+
React.createElement(Icon, { className: "qdr-carousel-modal__error-icon", icon: Image, width: 48, height: 48 }),
|
|
48
|
+
React.createElement("p", { className: "qdr-carousel-modal__error-text" }, "\u4E0A\u50B3\u932F\u8AA4"))) : (React.createElement("img", { src: url || preview, className: "qdr-carousel-modal__image", style: {
|
|
49
|
+
objectFit: ratio ? 'cover' : 'contain',
|
|
50
|
+
aspectRatio: ratio ? `${ratio[0]} / ${ratio[1]}` : '3 /2',
|
|
51
|
+
} }))),
|
|
52
|
+
React.createElement("div", { className: "qdr-carousel-modal__input-wrapper" },
|
|
53
|
+
React.createElement(Input, { value: inputValue, onChange: setInputValue, placeholder: "\u5716\u7247\u8AAA\u660E\u6216\u66FF\u4EE3\u6587\u5B57..." }))))));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { CarouselItem as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Editor } from '@quadrats/core';
|
|
3
|
+
import { Carousel, CarouselFieldArrayItem } from '@quadrats/common/carousel';
|
|
4
|
+
export interface CarouselModalProps {
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
close: VoidFunction;
|
|
7
|
+
controller?: Carousel<Editor>;
|
|
8
|
+
initialValue?: CarouselFieldArrayItem[];
|
|
9
|
+
onConfirm?: (items: CarouselFieldArrayItem[]) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const CarouselModal: ({ isOpen, close, controller, initialValue, onConfirm }: CarouselModalProps) => React.JSX.Element;
|