@quadrats/react 0.7.7 → 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/createReactImage.js +13 -13
- package/image/image.css +1 -1
- package/image/image.scss +61 -6
- package/image/index.cjs.js +97 -45
- 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,356 @@
|
|
|
1
|
+
.qdr-carousel {
|
|
2
|
+
position: relative;
|
|
3
|
+
margin: var(--qdr-spacing-14) 0;
|
|
4
|
+
|
|
5
|
+
&__image-wrapper {
|
|
6
|
+
flex: 0 0 100%;
|
|
7
|
+
width: 100%;
|
|
8
|
+
position: relative;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
border-radius: var(--qdr-radius-1);
|
|
13
|
+
|
|
14
|
+
&::after {
|
|
15
|
+
content: '';
|
|
16
|
+
position: absolute;
|
|
17
|
+
inset: 0;
|
|
18
|
+
background-color: transparent;
|
|
19
|
+
transition: background-color var(--qdr-duration-short) var(--qdr-easing-standard);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&--with-inline-toolbar {
|
|
24
|
+
&:hover {
|
|
25
|
+
.qdr-carousel__image-wrapper {
|
|
26
|
+
&::after {
|
|
27
|
+
background-color: var(--qdr-overlay-dark);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:hover {
|
|
34
|
+
.qdr-carousel__inline-toolbar {
|
|
35
|
+
opacity: 1;
|
|
36
|
+
pointer-events: auto;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&-modal {
|
|
41
|
+
&__side {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
justify-content: flex-start;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: var(--qdr-spacing-9);
|
|
47
|
+
|
|
48
|
+
&__hints-wrapper {
|
|
49
|
+
width: 100%;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&__hints-title {
|
|
53
|
+
color: var(--qdr-text-primary);
|
|
54
|
+
font-size: var(--qdr-typography-basic-h6-font-size);
|
|
55
|
+
line-height: var(--qdr-typography-basic-h6-line-height);
|
|
56
|
+
letter-spacing: var(--qdr-typography-basic-h6-letter-spacing);
|
|
57
|
+
font-weight: var(--qdr-typography-basic-h6-font-weight);
|
|
58
|
+
margin-bottom: var(--qdr-spacing-4);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&__upload {
|
|
62
|
+
width: 100%;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&__main {
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
position: relative;
|
|
70
|
+
background-color: var(--qdr-bg);
|
|
71
|
+
overflow-y: unset;
|
|
72
|
+
padding: unset;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&__counter {
|
|
76
|
+
color: var(--qdr-text-secondary);
|
|
77
|
+
font-size: var(--qdr-typography-basic-body2-font-size);
|
|
78
|
+
line-height: var(--qdr-typography-basic-body2-line-height);
|
|
79
|
+
letter-spacing: var(--qdr-typography-basic-body2-letter-spacing);
|
|
80
|
+
font-weight: var(--qdr-typography-basic-body2-font-weight);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&__placeholder {
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
pointer-events: none;
|
|
88
|
+
height: 100%;
|
|
89
|
+
|
|
90
|
+
&__block {
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
justify-content: flex-start;
|
|
94
|
+
align-items: center;
|
|
95
|
+
width: 360px;
|
|
96
|
+
padding-bottom: var(--qdr-spacing-14);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&__icon {
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
color: var(--qdr-action-inactive);
|
|
104
|
+
padding: var(--qdr-spacing-4);
|
|
105
|
+
border: 1px solid var(--qdr-divider);
|
|
106
|
+
background-color: var(--qdr-surface);
|
|
107
|
+
border-radius: var(--qdr-radius-5);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&__title {
|
|
111
|
+
color: var(--qdr-text-primary);
|
|
112
|
+
font-size: var(--qdr-typography-basic-h5-font-size);
|
|
113
|
+
line-height: var(--qdr-typography-basic-h5-line-height);
|
|
114
|
+
letter-spacing: var(--qdr-typography-basic-h5-letter-spacing);
|
|
115
|
+
font-weight: var(--qdr-typography-basic-h5-font-weight);
|
|
116
|
+
text-align: center;
|
|
117
|
+
margin-top: var(--qdr-spacing-9);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&__hint {
|
|
121
|
+
color: var(--qdr-text-secondary);
|
|
122
|
+
font-size: var(--qdr-typography-basic-body2-font-size);
|
|
123
|
+
line-height: var(--qdr-typography-basic-body2-line-height);
|
|
124
|
+
letter-spacing: var(--qdr-typography-basic-body2-letter-spacing);
|
|
125
|
+
font-weight: var(--qdr-typography-basic-body2-font-weight);
|
|
126
|
+
text-align: center;
|
|
127
|
+
margin-top: var(--qdr-spacing-2);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&__zone {
|
|
132
|
+
flex: 1;
|
|
133
|
+
align-self: stretch;
|
|
134
|
+
overflow-y: auto;
|
|
135
|
+
padding: var(--qdr-spacing-9);
|
|
136
|
+
|
|
137
|
+
&__wrapper {
|
|
138
|
+
position: absolute;
|
|
139
|
+
inset: 0;
|
|
140
|
+
width: 100%;
|
|
141
|
+
height: 100%;
|
|
142
|
+
z-index: 101;
|
|
143
|
+
display: flex;
|
|
144
|
+
align-items: flex-end;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
background-color: var(--qdr-primary-hover-bg);
|
|
147
|
+
pointer-events: none;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&__block {
|
|
151
|
+
display: flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
justify-content: flex-start;
|
|
154
|
+
gap: var(--qdr-spacing-2);
|
|
155
|
+
background-color: var(--qdr-primary);
|
|
156
|
+
color: var(--qdr-on-primary);
|
|
157
|
+
padding: var(--qdr-spacing-7) var(--qdr-spacing-14);
|
|
158
|
+
box-shadow: var(--qdr-shadow-xl);
|
|
159
|
+
margin-bottom: var(--qdr-spacing-7);
|
|
160
|
+
border-radius: 9999px;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&__grid {
|
|
165
|
+
display: grid;
|
|
166
|
+
grid-template-columns: repeat(3, 1fr);
|
|
167
|
+
gap: var(--qdr-spacing-6);
|
|
168
|
+
|
|
169
|
+
&--isDragging {
|
|
170
|
+
opacity: 0;
|
|
171
|
+
pointer-events: none;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&__image-wrapper {
|
|
176
|
+
display: flex;
|
|
177
|
+
align-items: center;
|
|
178
|
+
justify-content: center;
|
|
179
|
+
position: relative;
|
|
180
|
+
|
|
181
|
+
&::after {
|
|
182
|
+
content: '';
|
|
183
|
+
position: absolute;
|
|
184
|
+
inset: 0;
|
|
185
|
+
background-color: transparent;
|
|
186
|
+
transition: background-color var(--qdr-duration-short) var(--qdr-easing-standard);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&__error-wrapper {
|
|
191
|
+
width: 100%;
|
|
192
|
+
display: flex;
|
|
193
|
+
flex-direction: column;
|
|
194
|
+
align-items: center;
|
|
195
|
+
justify-content: center;
|
|
196
|
+
gap: var(--qdr-spacing-4);
|
|
197
|
+
background-color: var(--qdr-error-hover-bg);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
&__error-icon {
|
|
201
|
+
color: var(--qdr-error);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&__error-text {
|
|
205
|
+
color: var(--qdr-error);
|
|
206
|
+
font-size: var(--qdr-typography-basic-h6-font-size);
|
|
207
|
+
line-height: var(--qdr-typography-basic-h6-line-height);
|
|
208
|
+
letter-spacing: var(--qdr-typography-basic-h6-letter-spacing);
|
|
209
|
+
font-weight: var(--qdr-typography-basic-h6-font-weight);
|
|
210
|
+
margin: 0;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&__item {
|
|
214
|
+
display: flex;
|
|
215
|
+
flex-direction: column;
|
|
216
|
+
position: relative;
|
|
217
|
+
border: 1px solid var(--qdr-divider);
|
|
218
|
+
border-radius: var(--qdr-radius-2);
|
|
219
|
+
overflow: hidden;
|
|
220
|
+
transition: box-shadow var(--qdr-duration-short) var(--qdr-easing-standard);
|
|
221
|
+
z-index: 100;
|
|
222
|
+
|
|
223
|
+
&:hover {
|
|
224
|
+
box-shadow:
|
|
225
|
+
0 0 0 2px var(--qdr-surface),
|
|
226
|
+
0 0 0 4px var(--qdr-primary-light);
|
|
227
|
+
|
|
228
|
+
.qdr-carousel-modal__image-wrapper {
|
|
229
|
+
&::after {
|
|
230
|
+
background-color: var(--qdr-overlay-dark);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.qdr-carousel-modal__inline-toolbar {
|
|
235
|
+
opacity: 1;
|
|
236
|
+
pointer-events: auto;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
&--isDragging {
|
|
241
|
+
border-style: dashed;
|
|
242
|
+
border-color: var(--qdr-primary);
|
|
243
|
+
box-shadow: var(--qdr-shadow-xl);
|
|
244
|
+
cursor: grabbing;
|
|
245
|
+
|
|
246
|
+
> * {
|
|
247
|
+
display: none;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
&--isOver {
|
|
252
|
+
box-shadow:
|
|
253
|
+
0 0 0 2px var(--qdr-surface),
|
|
254
|
+
0 0 0 4px var(--qdr-primary-light);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
&__image {
|
|
259
|
+
width: 100%;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
&__input-wrapper {
|
|
263
|
+
border-top: 1px solid var(--qdr-divider);
|
|
264
|
+
background-color: var(--qdr-surface);
|
|
265
|
+
padding: var(--qdr-spacing-6);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
&__placeholder {
|
|
270
|
+
margin: var(--qdr-spacing-14) 0;
|
|
271
|
+
|
|
272
|
+
&__icon-wrapper {
|
|
273
|
+
display: flex;
|
|
274
|
+
align-items: center;
|
|
275
|
+
justify-content: center;
|
|
276
|
+
width: 100%;
|
|
277
|
+
border-radius: var(--qdr-radius-1);
|
|
278
|
+
border: 1px solid var(--qdr-divider);
|
|
279
|
+
background-color: var(--qdr-block);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
&__icon {
|
|
283
|
+
color: var(--qdr-action-inactive);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
&__dots {
|
|
288
|
+
display: flex;
|
|
289
|
+
align-items: center;
|
|
290
|
+
justify-content: center;
|
|
291
|
+
margin-top: var(--qdr-spacing-4);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
&__dot {
|
|
295
|
+
width: 5px;
|
|
296
|
+
height: 5px;
|
|
297
|
+
border-radius: 50%;
|
|
298
|
+
background-color: var(--qdr-action-disabled-bg);
|
|
299
|
+
margin: 2.5px;
|
|
300
|
+
|
|
301
|
+
&:hover {
|
|
302
|
+
cursor: pointer;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
&--active {
|
|
306
|
+
background-color: var(--qdr-primary);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
&__images-wrapper {
|
|
311
|
+
display: flex;
|
|
312
|
+
flex-direction: column;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
&__slider-wrapper {
|
|
316
|
+
width: 100%;
|
|
317
|
+
overflow-x: hidden;
|
|
318
|
+
border-radius: var(--qdr-radius-1);
|
|
319
|
+
|
|
320
|
+
&:hover {
|
|
321
|
+
cursor: grab;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
&--isDragging {
|
|
325
|
+
&:hover {
|
|
326
|
+
cursor: grabbing;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
&__slider {
|
|
332
|
+
width: 100%;
|
|
333
|
+
display: flex;
|
|
334
|
+
align-items: flex-start;
|
|
335
|
+
justify-content: flex-start;
|
|
336
|
+
transition: transform var(--qdr-duration-short) var(--qdr-easing-standard);
|
|
337
|
+
|
|
338
|
+
&--isDragging {
|
|
339
|
+
transition: none;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
&__image {
|
|
344
|
+
width: 100%;
|
|
345
|
+
border-radius: var(--qdr-radius-1);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
&__caption {
|
|
349
|
+
color: var(--qdr-text-primary);
|
|
350
|
+
font-size: var(--qdr-typography-basic-body2-font-size);
|
|
351
|
+
line-height: var(--qdr-typography-basic-body2-line-height);
|
|
352
|
+
letter-spacing: var(--qdr-typography-basic-body2-letter-spacing);
|
|
353
|
+
font-weight: var(--qdr-typography-basic-body2-font-weight);
|
|
354
|
+
margin-top: var(--qdr-spacing-6);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RenderElementProps } from '@quadrats/react';
|
|
3
|
+
import { RenderCarouselElementProps } from '../typings';
|
|
4
|
+
export declare function Carousel({ attributes, children, element, controller, }: {
|
|
5
|
+
attributes?: RenderElementProps['attributes'];
|
|
6
|
+
children: RenderElementProps['children'];
|
|
7
|
+
element: RenderCarouselElementProps['element'];
|
|
8
|
+
controller: RenderCarouselElementProps['controller'];
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
export declare function CarouselWithoutToolbar({ attributes, children, }: {
|
|
11
|
+
attributes?: RenderElementProps['attributes'];
|
|
12
|
+
children: RenderElementProps['children'];
|
|
13
|
+
element: RenderCarouselElementProps['element'];
|
|
14
|
+
}): React.JSX.Element;
|
|
15
|
+
export default Carousel;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Transforms } from '@quadrats/core';
|
|
3
|
+
import { useModal, useSlateStatic, ReactEditor } from '@quadrats/react';
|
|
4
|
+
import { InlineToolbar } from '@quadrats/react/toolbar';
|
|
5
|
+
import { Edit, Trash } from '@quadrats/icons';
|
|
6
|
+
import { CarouselContext } from '../contexts/CarouselContext.js';
|
|
7
|
+
|
|
8
|
+
function Carousel({ attributes, children, element, controller, }) {
|
|
9
|
+
const { setCarouselModalConfig, setConfirmModalConfig } = useModal();
|
|
10
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
11
|
+
const editor = useSlateStatic();
|
|
12
|
+
const path = ReactEditor.findPath(editor, element);
|
|
13
|
+
return (React.createElement(CarouselContext.Provider, { value: {
|
|
14
|
+
activeIndex,
|
|
15
|
+
setActiveIndex,
|
|
16
|
+
} },
|
|
17
|
+
React.createElement("div", Object.assign({}, attributes, { contentEditable: false, className: "qdr-carousel qdr-carousel--with-inline-toolbar" }),
|
|
18
|
+
React.createElement(InlineToolbar, { className: "qdr-carousel__inline-toolbar", leftIcons: [], rightIcons: [
|
|
19
|
+
{
|
|
20
|
+
icon: Edit,
|
|
21
|
+
onClick: () => {
|
|
22
|
+
setCarouselModalConfig({
|
|
23
|
+
controller,
|
|
24
|
+
initialValue: element.items,
|
|
25
|
+
onConfirm: (items) => {
|
|
26
|
+
controller.updateCarouselElement({ editor, items, path });
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
icon: Trash,
|
|
33
|
+
onClick: () => {
|
|
34
|
+
if (controller.confirmModal) {
|
|
35
|
+
// TODO: i18n
|
|
36
|
+
setConfirmModalConfig({
|
|
37
|
+
title: '刪除輪播',
|
|
38
|
+
content: '是否確認刪除此輪播?刪除後將立即移除,且此操作無法復原。',
|
|
39
|
+
confirmText: '刪除輪播',
|
|
40
|
+
onConfirm: () => {
|
|
41
|
+
Transforms.removeNodes(editor, { at: path });
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
Transforms.removeNodes(editor, { at: path });
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
] }),
|
|
51
|
+
children)));
|
|
52
|
+
}
|
|
53
|
+
function CarouselWithoutToolbar({ attributes, children, }) {
|
|
54
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
55
|
+
return (React.createElement(CarouselContext.Provider, { value: {
|
|
56
|
+
activeIndex,
|
|
57
|
+
setActiveIndex,
|
|
58
|
+
} },
|
|
59
|
+
React.createElement("div", Object.assign({}, attributes, { contentEditable: false, className: "qdr-carousel" }), children)));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { Carousel, CarouselWithoutToolbar, Carousel as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RenderElementProps } from '@quadrats/react';
|
|
3
|
+
import { RenderCarouselCaptionElementProps } from '../typings';
|
|
4
|
+
export declare function CarouselCaption({ attributes, element, }: {
|
|
5
|
+
attributes?: RenderElementProps['attributes'];
|
|
6
|
+
children: RenderElementProps['children'];
|
|
7
|
+
element: RenderCarouselCaptionElementProps['element'];
|
|
8
|
+
}): React.JSX.Element | null;
|
|
9
|
+
export default CarouselCaption;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { useCarousel } from '../hooks/useCarousel.js';
|
|
3
|
+
|
|
4
|
+
function CarouselCaption({ attributes, element, }) {
|
|
5
|
+
const { activeIndex } = useCarousel();
|
|
6
|
+
const currentCaption = useMemo(() => element.captions[activeIndex], [activeIndex, element.captions]);
|
|
7
|
+
if (!currentCaption)
|
|
8
|
+
return null;
|
|
9
|
+
return (React.createElement("div", Object.assign({}, attributes, { contentEditable: false, className: "qdr-carousel__caption" }), currentCaption));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { CarouselCaption, CarouselCaption as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RenderElementProps } from '@quadrats/react';
|
|
3
|
+
import { RenderCarouselImagesElementProps } from '../typings';
|
|
4
|
+
export declare function CarouselImages({ attributes, element, }: {
|
|
5
|
+
attributes?: RenderElementProps['attributes'];
|
|
6
|
+
children: RenderElementProps['children'];
|
|
7
|
+
element: RenderCarouselImagesElementProps['element'];
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
export default CarouselImages;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { useRef, useState, useMemo, useCallback } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useCarousel } from '../hooks/useCarousel.js';
|
|
4
|
+
|
|
5
|
+
const deltaLimit = 100;
|
|
6
|
+
function CarouselImages({ attributes, element, }) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const imageRef = useRef(null);
|
|
9
|
+
const { activeIndex, setActiveIndex } = useCarousel();
|
|
10
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
11
|
+
const [startX, setStartX] = useState(0);
|
|
12
|
+
const [delta, setDelta] = useState(0);
|
|
13
|
+
const images = useMemo(() => element.images, [element.images]);
|
|
14
|
+
const onMouseUp = useCallback(() => {
|
|
15
|
+
setIsDragging(false);
|
|
16
|
+
if (delta < -100 && activeIndex < images.length - 1) {
|
|
17
|
+
setActiveIndex((prev) => prev + 1);
|
|
18
|
+
}
|
|
19
|
+
else if (delta > deltaLimit && activeIndex > 0) {
|
|
20
|
+
setActiveIndex((prev) => prev - 1);
|
|
21
|
+
}
|
|
22
|
+
setDelta(0);
|
|
23
|
+
}, [activeIndex, delta, images.length, setActiveIndex]);
|
|
24
|
+
return (React.createElement("div", Object.assign({}, attributes, { contentEditable: false, className: "qdr-carousel__images-wrapper" }),
|
|
25
|
+
React.createElement("div", { className: clsx('qdr-carousel__slider-wrapper', {
|
|
26
|
+
'qdr-carousel__slider-wrapper--isDragging': isDragging,
|
|
27
|
+
}), onMouseDown: (e) => {
|
|
28
|
+
setIsDragging(true);
|
|
29
|
+
setStartX(e.clientX);
|
|
30
|
+
}, onMouseMove: (e) => {
|
|
31
|
+
if (isDragging) {
|
|
32
|
+
const delta = e.clientX - startX;
|
|
33
|
+
setDelta(delta);
|
|
34
|
+
}
|
|
35
|
+
}, onMouseUp: onMouseUp },
|
|
36
|
+
React.createElement("div", { className: clsx('qdr-carousel__slider', {
|
|
37
|
+
'qdr-carousel__slider--isDragging': isDragging,
|
|
38
|
+
}), style: {
|
|
39
|
+
transform: `translateX(${delta - activeIndex * ((_b = (_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 0)}px)`,
|
|
40
|
+
} }, images.map((image) => (React.createElement("div", { key: image, className: "qdr-carousel__image-wrapper" },
|
|
41
|
+
React.createElement("img", { ref: imageRef, draggable: false, className: "qdr-carousel__image", src: image, style: {
|
|
42
|
+
objectFit: element.ratio ? 'cover' : 'contain',
|
|
43
|
+
aspectRatio: element.ratio ? `${element.ratio[0]} / ${element.ratio[1]}` : '3 / 2',
|
|
44
|
+
} })))))),
|
|
45
|
+
React.createElement("div", { className: "qdr-carousel__dots" }, images.map((_, index) => (React.createElement("div", { key: index, onClick: () => {
|
|
46
|
+
setActiveIndex(index);
|
|
47
|
+
}, className: clsx('qdr-carousel__dot', {
|
|
48
|
+
'qdr-carousel__dot--active': index === activeIndex,
|
|
49
|
+
}) }))))));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { CarouselImages, CarouselImages as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Icon } from '@quadrats/react/components';
|
|
3
|
+
import { Image } from '@quadrats/icons';
|
|
4
|
+
|
|
5
|
+
function CarouselPlaceholder({ attributes, element }) {
|
|
6
|
+
return (React.createElement("div", Object.assign({}, attributes, { className: "qdr-carousel__placeholder", contentEditable: false }),
|
|
7
|
+
React.createElement("div", { className: "qdr-carousel__placeholder__icon-wrapper", style: { aspectRatio: element.ratio ? `${element.ratio[0]} / ${element.ratio[1]}` : '3 / 2' } },
|
|
8
|
+
React.createElement(Icon, { className: "qdr-carousel__placeholder__icon", icon: Image, width: 48, height: 48 })),
|
|
9
|
+
React.createElement("div", { className: "qdr-carousel__dots" },
|
|
10
|
+
React.createElement("div", { className: "qdr-carousel__dot qdr-carousel__dot--active" }),
|
|
11
|
+
React.createElement("div", { className: "qdr-carousel__dot" }),
|
|
12
|
+
React.createElement("div", { className: "qdr-carousel__dot" }),
|
|
13
|
+
React.createElement("div", { className: "qdr-carousel__dot" }),
|
|
14
|
+
React.createElement("div", { className: "qdr-carousel__dot" }))));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { CarouselPlaceholder, CarouselPlaceholder as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CreateCarouselOptions } from '@quadrats/common/carousel';
|
|
2
|
+
import { ReactCarousel } from './typings';
|
|
3
|
+
export type CreateReactCarouselOptions = CreateCarouselOptions;
|
|
4
|
+
export declare function createReactCarousel(options: CreateReactCarouselOptions): ReactCarousel;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createCarousel, CAROUSEL_PLACEHOLDER_TYPE } from '@quadrats/common/carousel';
|
|
2
|
+
import { createRenderElement, createRenderElements } from '@quadrats/react';
|
|
3
|
+
import { removePreviousElement } from '@quadrats/react/utils';
|
|
4
|
+
import { defaultRenderCarouselPlaceholderElement, defaultRenderCarouselElements } from './defaultRenderCarouselElements.js';
|
|
5
|
+
|
|
6
|
+
function createReactCarousel(options) {
|
|
7
|
+
const core = createCarousel(options);
|
|
8
|
+
const { types, confirmModal } = core;
|
|
9
|
+
return Object.assign(Object.assign({}, core), { createHandlers: (setNeedConfirmModal, locale) => ({
|
|
10
|
+
onKeyDown(event, editor, next) {
|
|
11
|
+
if (event.key === 'Backspace') {
|
|
12
|
+
removePreviousElement({
|
|
13
|
+
event,
|
|
14
|
+
editor,
|
|
15
|
+
type: types.carousel,
|
|
16
|
+
confirmModal,
|
|
17
|
+
doConfirm: (remove) => {
|
|
18
|
+
if (setNeedConfirmModal) {
|
|
19
|
+
// TODO: i18n
|
|
20
|
+
console.log('locale', locale);
|
|
21
|
+
setNeedConfirmModal({
|
|
22
|
+
title: '刪除輪播',
|
|
23
|
+
content: '是否確認刪除此輪播?刪除後將立即移除,且此操作無法復原。',
|
|
24
|
+
confirmText: '刪除輪播',
|
|
25
|
+
onConfirm: () => {
|
|
26
|
+
remove();
|
|
27
|
+
setNeedConfirmModal(null);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
next();
|
|
35
|
+
},
|
|
36
|
+
}), createRenderElement: (options = {}) => {
|
|
37
|
+
const renderCarousel = options.carousel || defaultRenderCarouselElements.carousel;
|
|
38
|
+
const renderCarouselImages = options.carousel_images || defaultRenderCarouselElements.carousel_images;
|
|
39
|
+
const renderCarouselCaption = options.carousel_caption || defaultRenderCarouselElements.carousel_caption;
|
|
40
|
+
return createRenderElements([
|
|
41
|
+
{
|
|
42
|
+
type: types.carousel,
|
|
43
|
+
render: (props) => {
|
|
44
|
+
const { attributes, children, element } = props;
|
|
45
|
+
return renderCarousel({
|
|
46
|
+
attributes,
|
|
47
|
+
element,
|
|
48
|
+
children,
|
|
49
|
+
controller: core,
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: types.carousel_images,
|
|
55
|
+
render: (props) => {
|
|
56
|
+
const { attributes, children, element } = props;
|
|
57
|
+
return renderCarouselImages({
|
|
58
|
+
attributes,
|
|
59
|
+
element,
|
|
60
|
+
children,
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: types.carousel_caption,
|
|
66
|
+
render: (props) => {
|
|
67
|
+
const { attributes, children, element } = props;
|
|
68
|
+
return renderCarouselCaption({
|
|
69
|
+
attributes,
|
|
70
|
+
element,
|
|
71
|
+
children,
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
]);
|
|
76
|
+
}, createRenderPlaceholderElement: ({ render = defaultRenderCarouselPlaceholderElement } = {}) => createRenderElement({
|
|
77
|
+
type: CAROUSEL_PLACEHOLDER_TYPE,
|
|
78
|
+
render,
|
|
79
|
+
}) });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { createReactCarousel };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Carousel } from './components/Carousel.js';
|
|
3
|
+
import { CarouselImages } from './components/CarouselImages.js';
|
|
4
|
+
import { CarouselCaption } from './components/CarouselCaption.js';
|
|
5
|
+
import { CarouselPlaceholder } from './components/CarouselPlaceholder.js';
|
|
6
|
+
|
|
7
|
+
const defaultRenderCarouselElements = {
|
|
8
|
+
carousel: (props) => React.createElement(Carousel, Object.assign({}, props)),
|
|
9
|
+
carousel_images: (props) => React.createElement(CarouselImages, Object.assign({}, props)),
|
|
10
|
+
carousel_caption: (props) => React.createElement(CarouselCaption, Object.assign({}, props)),
|
|
11
|
+
};
|
|
12
|
+
const defaultRenderCarouselPlaceholderElement = (props) => (React.createElement(CarouselPlaceholder, Object.assign({}, props)));
|
|
13
|
+
|
|
14
|
+
export { defaultRenderCarouselElements, defaultRenderCarouselPlaceholderElement };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useCarousel(): import("..").CarouselContextType;
|