@selfcommunity/react-ui 0.7.0-alpha.335 → 0.7.0-alpha.336
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/lib/cjs/components/BottomNavigation/BottomNavigation.js +8 -11
- package/lib/cjs/components/Composer/Attributes/Attributes.d.ts +22 -0
- package/lib/cjs/components/Composer/Attributes/Attributes.js +41 -0
- package/lib/cjs/components/Composer/Attributes/index.d.ts +3 -0
- package/lib/cjs/components/Composer/{Poll → Attributes}/index.js +2 -2
- package/lib/cjs/components/Composer/Composer.d.ts +53 -84
- package/lib/cjs/components/Composer/Composer.js +249 -443
- package/lib/cjs/components/Composer/Content/ContentDiscussion/ContentDiscussion.d.ts +32 -0
- package/lib/cjs/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +53 -0
- package/lib/cjs/components/Composer/Content/ContentDiscussion/index.d.ts +3 -0
- package/lib/cjs/components/Composer/Content/ContentDiscussion/index.js +5 -0
- package/lib/cjs/components/Composer/Content/ContentPoll/ContentPoll.d.ts +26 -0
- package/lib/cjs/components/Composer/Content/ContentPoll/ContentPoll.js +129 -0
- package/lib/cjs/components/Composer/Content/ContentPoll/index.d.ts +3 -0
- package/lib/cjs/components/Composer/Content/ContentPoll/index.js +5 -0
- package/lib/cjs/components/Composer/Content/ContentPost/ContentPost.d.ts +32 -0
- package/lib/cjs/components/Composer/Content/ContentPost/ContentPost.js +51 -0
- package/lib/cjs/components/Composer/Content/ContentPost/index.d.ts +3 -0
- package/lib/cjs/components/Composer/Content/ContentPost/index.js +5 -0
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +11 -0
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +74 -0
- package/lib/cjs/components/Composer/Layer/AudienceLayer/index.d.ts +3 -0
- package/lib/cjs/components/Composer/Layer/AudienceLayer/index.js +5 -0
- package/lib/cjs/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +9 -0
- package/lib/cjs/components/Composer/Layer/CategoryLayer/CategoryLayer.js +41 -0
- package/lib/cjs/components/Composer/Layer/CategoryLayer/index.d.ts +3 -0
- package/lib/cjs/components/Composer/Layer/CategoryLayer/index.js +5 -0
- package/lib/cjs/components/Composer/Layer/CloseLayer/CloseLayer.d.ts +7 -0
- package/lib/cjs/components/Composer/Layer/CloseLayer/CloseLayer.js +41 -0
- package/lib/cjs/components/Composer/Layer/CloseLayer/index.d.ts +3 -0
- package/lib/cjs/components/Composer/{Audience → Layer/CloseLayer}/index.js +2 -2
- package/lib/cjs/components/Composer/Layer/LocationLayer/LocationLayer.d.ts +9 -0
- package/lib/cjs/components/Composer/Layer/LocationLayer/LocationLayer.js +41 -0
- package/lib/cjs/components/Composer/Layer/LocationLayer/index.d.ts +3 -0
- package/lib/cjs/components/Composer/Layer/LocationLayer/index.js +5 -0
- package/lib/cjs/components/Composer/Skeleton.d.ts +0 -4
- package/lib/cjs/components/Composer/Skeleton.js +10 -72
- package/lib/cjs/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.d.ts +6 -0
- package/lib/cjs/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +47 -0
- package/lib/cjs/components/Composer/TypeSwitchButtonGroup/index.d.ts +3 -0
- package/lib/cjs/components/Composer/TypeSwitchButtonGroup/index.js +5 -0
- package/lib/cjs/components/Composer/constants.d.ts +1 -0
- package/lib/cjs/components/Composer/constants.js +4 -0
- package/lib/cjs/components/Composer/index.d.ts +2 -3
- package/lib/cjs/components/Composer/index.js +1 -6
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.d.ts +2 -1
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.js +8 -8
- package/lib/cjs/components/Editor/Editor.js +14 -5
- package/lib/cjs/components/Feed/prefetchedData.d.ts +2 -368
- package/lib/cjs/components/Feed/prefetchedData.js +17 -16
- package/lib/cjs/components/FeedObject/Actions/Share/Share.js +2 -2
- package/lib/cjs/components/FeedObject/FeedObject.d.ts +2 -2
- package/lib/cjs/components/FeedObject/FeedObject.js +5 -5
- package/lib/cjs/components/FeedObjectMediaPreview/FeedObjectMediaPreview.d.ts +38 -0
- package/lib/cjs/components/FeedObjectMediaPreview/FeedObjectMediaPreview.js +66 -0
- package/lib/cjs/components/FeedObjectMediaPreview/index.d.ts +3 -0
- package/lib/cjs/components/FeedObjectMediaPreview/index.js +5 -0
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.d.ts +25 -33
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.js +34 -67
- package/lib/cjs/components/InlineComposerWidget/Skeleton.d.ts +4 -5
- package/lib/cjs/components/InlineComposerWidget/Skeleton.js +17 -37
- package/lib/cjs/components/InlineComposerWidget/constants.d.ts +1 -0
- package/lib/cjs/components/InlineComposerWidget/constants.js +4 -0
- package/lib/cjs/components/LocationAutocomplete/LocationAutocomplete.d.ts +2 -2
- package/lib/cjs/components/LocationAutocomplete/LocationAutocomplete.js +4 -2
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +1 -1
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +0 -5
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +19 -30
- package/lib/cjs/components/NavigationToolbarMobile/Skeleton.js +5 -6
- package/lib/cjs/components/NavigationToolbarMobile/constants.d.ts +1 -0
- package/lib/cjs/components/NavigationToolbarMobile/constants.js +4 -0
- package/lib/cjs/constants/Composer.d.ts +2 -0
- package/lib/cjs/constants/Composer.js +4 -2
- package/lib/cjs/index.d.ts +12 -12
- package/lib/cjs/index.js +14 -17
- package/lib/cjs/shared/Lightbox/Lightbox.js +2 -2
- package/lib/{esm/shared/Media/Image/PreviewComponent.d.ts → cjs/shared/Media/File/DisplayComponent.d.ts} +1 -11
- package/lib/cjs/shared/Media/{Image/PreviewComponent.js → File/DisplayComponent.js} +55 -145
- package/lib/{esm/shared/Media/Image/PreviewImage → cjs/shared/Media/File/Lightbox}/index.d.ts +4 -3
- package/lib/cjs/shared/Media/File/Lightbox/index.js +37 -0
- package/lib/cjs/shared/Media/File/PreviewComponent.d.ts +9 -0
- package/lib/cjs/shared/Media/File/PreviewComponent.js +51 -0
- package/lib/cjs/shared/Media/File/TriggerButton.d.ts +12 -0
- package/lib/cjs/shared/Media/File/TriggerButton.js +112 -0
- package/lib/cjs/shared/Media/File/asUploadButton.d.ts +7 -0
- package/lib/cjs/shared/Media/File/asUploadButton.js +30 -0
- package/lib/cjs/shared/Media/File/constants.d.ts +1 -0
- package/lib/cjs/shared/Media/File/constants.js +4 -0
- package/lib/cjs/shared/Media/File/filter.d.ts +3 -0
- package/lib/cjs/shared/Media/File/filter.js +4 -0
- package/lib/cjs/shared/Media/File/index.d.ts +3 -0
- package/lib/cjs/shared/Media/File/index.js +16 -0
- package/lib/cjs/shared/Media/Link/DisplayComponent.d.ts +20 -0
- package/lib/cjs/shared/Media/Link/DisplayComponent.js +69 -0
- package/lib/cjs/shared/Media/Link/LayerComponent.d.ts +9 -0
- package/lib/cjs/shared/Media/Link/LayerComponent.js +46 -0
- package/lib/cjs/shared/Media/Link/PreviewComponent.d.ts +7 -21
- package/lib/cjs/shared/Media/Link/PreviewComponent.js +28 -56
- package/lib/cjs/shared/Media/Link/TriggerButton.d.ts +4 -0
- package/lib/cjs/shared/Media/Link/TriggerButton.js +21 -0
- package/lib/cjs/shared/Media/Link/UrlTextField/index.js +1 -2
- package/lib/cjs/shared/Media/Link/constants.d.ts +1 -0
- package/lib/cjs/shared/Media/Link/constants.js +4 -0
- package/lib/cjs/shared/Media/Link/filter.d.ts +3 -0
- package/lib/cjs/shared/Media/Link/filter.js +4 -0
- package/lib/cjs/shared/Media/Link/index.js +9 -8
- package/lib/cjs/shared/Media/Share/DisplayComponent.d.ts +11 -0
- package/lib/cjs/shared/Media/Share/DisplayComponent.js +31 -0
- package/lib/cjs/shared/Media/Share/constants.d.ts +1 -0
- package/lib/cjs/shared/Media/Share/constants.js +4 -0
- package/lib/cjs/shared/Media/Share/filter.d.ts +3 -0
- package/lib/cjs/shared/Media/Share/filter.js +4 -0
- package/lib/cjs/shared/Media/Share/index.js +7 -7
- package/lib/cjs/shared/Media/index.d.ts +2 -4
- package/lib/cjs/shared/Media/index.js +3 -7
- package/lib/cjs/types/composer.d.ts +15 -0
- package/lib/cjs/types/composer.js +2 -0
- package/lib/cjs/types/media.d.ts +9 -5
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +8 -11
- package/lib/esm/components/Composer/Attributes/Attributes.d.ts +22 -0
- package/lib/esm/components/Composer/Attributes/Attributes.js +38 -0
- package/lib/esm/components/Composer/Attributes/index.d.ts +3 -0
- package/lib/esm/components/Composer/Attributes/index.js +2 -0
- package/lib/esm/components/Composer/Composer.d.ts +53 -84
- package/lib/esm/components/Composer/Composer.js +246 -439
- package/lib/esm/components/Composer/Content/ContentDiscussion/ContentDiscussion.d.ts +32 -0
- package/lib/esm/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +50 -0
- package/lib/esm/components/Composer/Content/ContentDiscussion/index.d.ts +3 -0
- package/lib/esm/components/Composer/Content/ContentDiscussion/index.js +2 -0
- package/lib/esm/components/Composer/Content/ContentPoll/ContentPoll.d.ts +26 -0
- package/lib/esm/components/Composer/Content/ContentPoll/ContentPoll.js +127 -0
- package/lib/esm/components/Composer/Content/ContentPoll/index.d.ts +3 -0
- package/lib/esm/components/Composer/Content/ContentPoll/index.js +2 -0
- package/lib/esm/components/Composer/Content/ContentPost/ContentPost.d.ts +32 -0
- package/lib/esm/components/Composer/Content/ContentPost/ContentPost.js +49 -0
- package/lib/esm/components/Composer/Content/ContentPost/index.d.ts +3 -0
- package/lib/esm/components/Composer/Content/ContentPost/index.js +2 -0
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +11 -0
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +72 -0
- package/lib/esm/components/Composer/Layer/AudienceLayer/index.d.ts +3 -0
- package/lib/esm/components/Composer/Layer/AudienceLayer/index.js +2 -0
- package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +9 -0
- package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.js +39 -0
- package/lib/esm/components/Composer/Layer/CategoryLayer/index.d.ts +3 -0
- package/lib/esm/components/Composer/Layer/CategoryLayer/index.js +2 -0
- package/lib/esm/components/Composer/Layer/CloseLayer/CloseLayer.d.ts +7 -0
- package/lib/esm/components/Composer/Layer/CloseLayer/CloseLayer.js +39 -0
- package/lib/esm/components/Composer/Layer/CloseLayer/index.d.ts +3 -0
- package/lib/esm/components/Composer/Layer/CloseLayer/index.js +2 -0
- package/lib/esm/components/Composer/Layer/LocationLayer/LocationLayer.d.ts +9 -0
- package/lib/esm/components/Composer/Layer/LocationLayer/LocationLayer.js +39 -0
- package/lib/esm/components/Composer/Layer/LocationLayer/index.d.ts +3 -0
- package/lib/esm/components/Composer/Layer/LocationLayer/index.js +2 -0
- package/lib/esm/components/Composer/Skeleton.d.ts +0 -4
- package/lib/esm/components/Composer/Skeleton.js +6 -68
- package/lib/esm/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.d.ts +6 -0
- package/lib/esm/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +44 -0
- package/lib/esm/components/Composer/TypeSwitchButtonGroup/index.d.ts +3 -0
- package/lib/esm/components/Composer/TypeSwitchButtonGroup/index.js +2 -0
- package/lib/esm/components/Composer/constants.d.ts +1 -0
- package/lib/esm/components/Composer/constants.js +1 -0
- package/lib/esm/components/Composer/index.d.ts +2 -3
- package/lib/esm/components/Composer/index.js +1 -3
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.d.ts +2 -1
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.js +8 -8
- package/lib/esm/components/Editor/Editor.js +16 -7
- package/lib/esm/components/Feed/Feed.js +4 -4
- package/lib/esm/components/Feed/prefetchedData.d.ts +2 -368
- package/lib/esm/components/Feed/prefetchedData.js +17 -16
- package/lib/esm/components/FeedObject/Actions/Share/Share.js +4 -4
- package/lib/esm/components/FeedObject/FeedObject.d.ts +2 -2
- package/lib/esm/components/FeedObject/FeedObject.js +8 -8
- package/lib/esm/components/FeedObjectMediaPreview/FeedObjectMediaPreview.d.ts +38 -0
- package/lib/esm/components/FeedObjectMediaPreview/FeedObjectMediaPreview.js +64 -0
- package/lib/esm/components/FeedObjectMediaPreview/index.d.ts +3 -0
- package/lib/esm/components/FeedObjectMediaPreview/index.js +2 -0
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.d.ts +25 -33
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.js +31 -64
- package/lib/esm/components/InlineComposerWidget/Skeleton.d.ts +4 -5
- package/lib/esm/components/InlineComposerWidget/Skeleton.js +15 -35
- package/lib/esm/components/InlineComposerWidget/constants.d.ts +1 -0
- package/lib/esm/components/InlineComposerWidget/constants.js +1 -0
- package/lib/esm/components/LocationAutocomplete/LocationAutocomplete.d.ts +2 -2
- package/lib/esm/components/LocationAutocomplete/LocationAutocomplete.js +4 -2
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +1 -1
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.js +1 -1
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +0 -5
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +12 -23
- package/lib/esm/components/NavigationToolbarMobile/Skeleton.js +3 -4
- package/lib/esm/components/NavigationToolbarMobile/constants.d.ts +1 -0
- package/lib/esm/components/NavigationToolbarMobile/constants.js +1 -0
- package/lib/esm/constants/Composer.d.ts +2 -0
- package/lib/esm/constants/Composer.js +3 -1
- package/lib/esm/index.d.ts +12 -12
- package/lib/esm/index.js +33 -33
- package/lib/esm/shared/Lightbox/Lightbox.js +2 -2
- package/lib/{cjs/shared/Media/Image/PreviewComponent.d.ts → esm/shared/Media/File/DisplayComponent.d.ts} +1 -11
- package/lib/esm/shared/Media/{Image/PreviewComponent.js → File/DisplayComponent.js} +50 -140
- package/lib/{cjs/shared/Media/Image/PreviewImage → esm/shared/Media/File/Lightbox}/index.d.ts +4 -3
- package/lib/esm/shared/Media/File/Lightbox/index.js +34 -0
- package/lib/esm/shared/Media/File/PreviewComponent.d.ts +9 -0
- package/lib/esm/shared/Media/File/PreviewComponent.js +49 -0
- package/lib/esm/shared/Media/File/TriggerButton.d.ts +12 -0
- package/lib/esm/shared/Media/File/TriggerButton.js +110 -0
- package/lib/esm/shared/Media/File/asUploadButton.d.ts +7 -0
- package/lib/esm/shared/Media/File/asUploadButton.js +28 -0
- package/lib/esm/shared/Media/File/constants.d.ts +1 -0
- package/lib/esm/shared/Media/File/constants.js +1 -0
- package/lib/esm/shared/Media/File/filter.d.ts +3 -0
- package/lib/esm/shared/Media/File/filter.js +2 -0
- package/lib/esm/shared/Media/File/index.d.ts +3 -0
- package/lib/esm/shared/Media/File/index.js +13 -0
- package/lib/esm/shared/Media/Link/DisplayComponent.d.ts +20 -0
- package/lib/esm/shared/Media/Link/DisplayComponent.js +67 -0
- package/lib/esm/shared/Media/Link/LayerComponent.d.ts +9 -0
- package/lib/esm/shared/Media/Link/LayerComponent.js +44 -0
- package/lib/esm/shared/Media/Link/PreviewComponent.d.ts +7 -21
- package/lib/esm/shared/Media/Link/PreviewComponent.js +27 -54
- package/lib/esm/shared/Media/Link/TriggerButton.d.ts +4 -0
- package/lib/esm/shared/Media/Link/TriggerButton.js +19 -0
- package/lib/esm/shared/Media/Link/UrlTextField/index.js +2 -3
- package/lib/esm/shared/Media/Link/constants.d.ts +1 -0
- package/lib/esm/shared/Media/Link/constants.js +1 -0
- package/lib/esm/shared/Media/Link/filter.d.ts +3 -0
- package/lib/esm/shared/Media/Link/filter.js +2 -0
- package/lib/esm/shared/Media/Link/index.js +9 -8
- package/lib/esm/shared/Media/Share/DisplayComponent.d.ts +11 -0
- package/lib/esm/shared/Media/Share/DisplayComponent.js +29 -0
- package/lib/esm/shared/Media/Share/constants.d.ts +1 -0
- package/lib/esm/shared/Media/Share/constants.js +1 -0
- package/lib/esm/shared/Media/Share/filter.d.ts +3 -0
- package/lib/esm/shared/Media/Share/filter.js +2 -0
- package/lib/esm/shared/Media/Share/index.js +7 -7
- package/lib/esm/shared/Media/index.d.ts +2 -4
- package/lib/esm/shared/Media/index.js +2 -4
- package/lib/esm/types/composer.d.ts +15 -0
- package/lib/esm/types/composer.js +1 -0
- package/lib/esm/types/media.d.ts +9 -5
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
- package/lib/cjs/components/Composer/Audience/Audience.d.ts +0 -71
- package/lib/cjs/components/Composer/Audience/Audience.js +0 -69
- package/lib/cjs/components/Composer/Audience/index.d.ts +0 -3
- package/lib/cjs/components/Composer/Poll/Poll.d.ts +0 -31
- package/lib/cjs/components/Composer/Poll/Poll.js +0 -151
- package/lib/cjs/components/Composer/Poll/index.d.ts +0 -3
- package/lib/cjs/shared/Media/Document/EditButton.d.ts +0 -2
- package/lib/cjs/shared/Media/Document/EditButton.js +0 -10
- package/lib/cjs/shared/Media/Document/EditComponent.d.ts +0 -3
- package/lib/cjs/shared/Media/Document/EditComponent.js +0 -103
- package/lib/cjs/shared/Media/Document/PreviewComponent.d.ts +0 -3
- package/lib/cjs/shared/Media/Document/PreviewComponent.js +0 -43
- package/lib/cjs/shared/Media/Document/index.d.ts +0 -3
- package/lib/cjs/shared/Media/Document/index.js +0 -16
- package/lib/cjs/shared/Media/Image/EditButton.d.ts +0 -2
- package/lib/cjs/shared/Media/Image/EditButton.js +0 -10
- package/lib/cjs/shared/Media/Image/EditComponent.d.ts +0 -3
- package/lib/cjs/shared/Media/Image/EditComponent.js +0 -102
- package/lib/cjs/shared/Media/Image/PreviewImage/index.js +0 -41
- package/lib/cjs/shared/Media/Image/index.d.ts +0 -3
- package/lib/cjs/shared/Media/Image/index.js +0 -16
- package/lib/cjs/shared/Media/Link/EditButton.d.ts +0 -2
- package/lib/cjs/shared/Media/Link/EditButton.js +0 -10
- package/lib/cjs/shared/Media/Link/EditComponent.d.ts +0 -3
- package/lib/cjs/shared/Media/Link/EditComponent.js +0 -46
- package/lib/cjs/shared/Media/Share/PreviewComponent.d.ts +0 -7
- package/lib/cjs/shared/Media/Share/PreviewComponent.js +0 -32
- package/lib/cjs/shared/Media/Video/EditButton.d.ts +0 -2
- package/lib/cjs/shared/Media/Video/EditButton.js +0 -10
- package/lib/cjs/shared/Media/Video/EditComponent.d.ts +0 -3
- package/lib/cjs/shared/Media/Video/EditComponent.js +0 -89
- package/lib/cjs/shared/Media/Video/PreviewComponent.d.ts +0 -19
- package/lib/cjs/shared/Media/Video/PreviewComponent.js +0 -37
- package/lib/cjs/shared/Media/Video/index.d.ts +0 -3
- package/lib/cjs/shared/Media/Video/index.js +0 -16
- package/lib/cjs/shared/MediasPreview/index.d.ts +0 -18
- package/lib/cjs/shared/MediasPreview/index.js +0 -44
- package/lib/esm/components/Composer/Audience/Audience.d.ts +0 -71
- package/lib/esm/components/Composer/Audience/Audience.js +0 -66
- package/lib/esm/components/Composer/Audience/index.d.ts +0 -3
- package/lib/esm/components/Composer/Audience/index.js +0 -2
- package/lib/esm/components/Composer/Poll/Poll.d.ts +0 -31
- package/lib/esm/components/Composer/Poll/Poll.js +0 -149
- package/lib/esm/components/Composer/Poll/index.d.ts +0 -3
- package/lib/esm/components/Composer/Poll/index.js +0 -2
- package/lib/esm/shared/Media/Document/EditButton.d.ts +0 -2
- package/lib/esm/shared/Media/Document/EditButton.js +0 -7
- package/lib/esm/shared/Media/Document/EditComponent.d.ts +0 -3
- package/lib/esm/shared/Media/Document/EditComponent.js +0 -101
- package/lib/esm/shared/Media/Document/PreviewComponent.d.ts +0 -3
- package/lib/esm/shared/Media/Document/PreviewComponent.js +0 -41
- package/lib/esm/shared/Media/Document/index.d.ts +0 -3
- package/lib/esm/shared/Media/Document/index.js +0 -13
- package/lib/esm/shared/Media/Image/EditButton.d.ts +0 -2
- package/lib/esm/shared/Media/Image/EditButton.js +0 -7
- package/lib/esm/shared/Media/Image/EditComponent.d.ts +0 -3
- package/lib/esm/shared/Media/Image/EditComponent.js +0 -100
- package/lib/esm/shared/Media/Image/PreviewImage/index.js +0 -38
- package/lib/esm/shared/Media/Image/index.d.ts +0 -3
- package/lib/esm/shared/Media/Image/index.js +0 -13
- package/lib/esm/shared/Media/Link/EditButton.d.ts +0 -2
- package/lib/esm/shared/Media/Link/EditButton.js +0 -7
- package/lib/esm/shared/Media/Link/EditComponent.d.ts +0 -3
- package/lib/esm/shared/Media/Link/EditComponent.js +0 -43
- package/lib/esm/shared/Media/Share/PreviewComponent.d.ts +0 -7
- package/lib/esm/shared/Media/Share/PreviewComponent.js +0 -29
- package/lib/esm/shared/Media/Video/EditButton.d.ts +0 -2
- package/lib/esm/shared/Media/Video/EditButton.js +0 -7
- package/lib/esm/shared/Media/Video/EditComponent.d.ts +0 -3
- package/lib/esm/shared/Media/Video/EditComponent.js +0 -87
- package/lib/esm/shared/Media/Video/PreviewComponent.d.ts +0 -19
- package/lib/esm/shared/Media/Video/PreviewComponent.js +0 -34
- package/lib/esm/shared/Media/Video/index.d.ts +0 -3
- package/lib/esm/shared/Media/Video/index.js +0 -13
- package/lib/esm/shared/MediasPreview/index.d.ts +0 -18
- package/lib/esm/shared/MediasPreview/index.js +0 -42
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BoxProps } from '@mui/material';
|
|
3
|
+
import { SCMediaType } from '@selfcommunity/types/src/index';
|
|
4
|
+
export interface PreviewComponentProps extends Omit<BoxProps, 'value' | 'onChange'> {
|
|
5
|
+
onChange: (value: SCMediaType[]) => void;
|
|
6
|
+
value: SCMediaType[];
|
|
7
|
+
}
|
|
8
|
+
declare const PreviewComponent: React.ForwardRefExoticComponent<Pick<PreviewComponentProps, "p" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "component" | "sx" | "classes" | "value"> & React.RefAttributes<unknown>>;
|
|
9
|
+
export default PreviewComponent;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
|
|
8
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
9
|
+
const react_sortablejs_1 = require("react-sortablejs");
|
|
10
|
+
const constants_1 = require("./constants");
|
|
11
|
+
const filter_1 = tslib_1.__importDefault(require("./filter"));
|
|
12
|
+
const Media_1 = require("../../../constants/Media");
|
|
13
|
+
const classes = {
|
|
14
|
+
previewRoot: `${constants_1.PREFIX}-preview-root`,
|
|
15
|
+
media: `${constants_1.PREFIX}-media`,
|
|
16
|
+
delete: `${constants_1.PREFIX}-delete`,
|
|
17
|
+
title: `${constants_1.PREFIX}-title`
|
|
18
|
+
};
|
|
19
|
+
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
20
|
+
name: constants_1.PREFIX,
|
|
21
|
+
slot: 'PreviewRoot'
|
|
22
|
+
})(() => ({}));
|
|
23
|
+
const SORTABLE_ID = 'file_sort';
|
|
24
|
+
const PreviewComponent = react_1.default.forwardRef((props, ref) => {
|
|
25
|
+
// PROPS
|
|
26
|
+
const { className, onChange, value = [] } = props, rest = tslib_1.__rest(props, ["className", "onChange", "value"]);
|
|
27
|
+
// MEMO
|
|
28
|
+
const medias = (0, react_1.useMemo)(() => value.filter(filter_1.default), [value]);
|
|
29
|
+
// EFFECTS
|
|
30
|
+
(0, react_1.useEffect)(() => {
|
|
31
|
+
if (typeof document === undefined) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const sortable = document.getElementById(SORTABLE_ID);
|
|
35
|
+
if (sortable) {
|
|
36
|
+
sortable.scrollLeft = sortable.scrollWidth;
|
|
37
|
+
}
|
|
38
|
+
}, [medias]);
|
|
39
|
+
// HANDLERS
|
|
40
|
+
const handleSort = (0, react_1.useCallback)((medias) => {
|
|
41
|
+
onChange && onChange([...value.filter((media) => medias.findIndex((m) => m.id === media.id) === -1), ...medias]);
|
|
42
|
+
}, [onChange]);
|
|
43
|
+
const handleDelete = (0, react_1.useCallback)((id) => () => onChange && onChange(value.filter((media) => media.id !== id)), [onChange, value]);
|
|
44
|
+
return react_1.default.createElement(Root, Object.assign({ ref: ref, className: (0, classnames_1.default)(className, classes.previewRoot) }, rest), medias.length > 0 && (react_1.default.createElement(react_sortablejs_1.ReactSortable, { id: SORTABLE_ID, list: medias, setList: handleSort }, medias.map((media) => (react_1.default.createElement(material_1.Box, { key: media.id, className: classes.media, sx: { backgroundImage: `url(${(media === null || media === void 0 ? void 0 : media.image_thumbnail) ? media.image_thumbnail.url : media.image})` } },
|
|
45
|
+
react_1.default.createElement(material_1.IconButton, { className: classes.delete, onClick: handleDelete(media.id), size: "small" },
|
|
46
|
+
react_1.default.createElement(Icon_1.default, null, "delete")),
|
|
47
|
+
media.title && react_1.default.createElement(material_1.Typography, { className: classes.title },
|
|
48
|
+
media.type === Media_1.MEDIA_TYPE_DOCUMENT && react_1.default.createElement(Icon_1.default, null, "picture_as_pdf"),
|
|
49
|
+
media.title)))))));
|
|
50
|
+
});
|
|
51
|
+
exports.default = PreviewComponent;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { IconButtonProps } from '@mui/material';
|
|
3
|
+
import { SCMediaType } from '@selfcommunity/types';
|
|
4
|
+
export interface TriggerIconButtonProps extends IconButtonProps {
|
|
5
|
+
/**
|
|
6
|
+
* Callback triggered when a media is added
|
|
7
|
+
* @param media
|
|
8
|
+
*/
|
|
9
|
+
onAdd?: (media: SCMediaType) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: ({ className, onAdd, ...rest }: TriggerIconButtonProps) => ReactElement;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const styles_1 = require("@mui/material/styles");
|
|
9
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
10
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
11
|
+
const react_intl_1 = require("react-intl");
|
|
12
|
+
const MediaChunkUploader_1 = tslib_1.__importDefault(require("../../MediaChunkUploader"));
|
|
13
|
+
const chunked_uploady_1 = tslib_1.__importDefault(require("@rpldy/chunked-uploady"));
|
|
14
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
15
|
+
const asUploadButton_1 = tslib_1.__importDefault(require("./asUploadButton"));
|
|
16
|
+
const notistack_1 = require("notistack");
|
|
17
|
+
const classes = {
|
|
18
|
+
triggerRoot: `${constants_1.PREFIX}-trigger-root`,
|
|
19
|
+
triggerDrawerRoot: `${constants_1.PREFIX}-trigger-drawer-root`,
|
|
20
|
+
triggerMenuRoot: `${constants_1.PREFIX}-trigger-menu-root`,
|
|
21
|
+
paper: `${constants_1.PREFIX}-paper`,
|
|
22
|
+
item: `${constants_1.PREFIX}-item`,
|
|
23
|
+
};
|
|
24
|
+
const Root = (0, styles_1.styled)(material_1.IconButton, {
|
|
25
|
+
name: constants_1.PREFIX,
|
|
26
|
+
slot: 'TriggerRoot'
|
|
27
|
+
})(() => ({}));
|
|
28
|
+
const SwipeableDrawerRoot = (0, styles_1.styled)(material_1.SwipeableDrawer, {
|
|
29
|
+
name: constants_1.PREFIX,
|
|
30
|
+
slot: 'TriggerDrawerRoot'
|
|
31
|
+
})(() => ({}));
|
|
32
|
+
const MenuRoot = (0, styles_1.styled)(material_1.Menu, {
|
|
33
|
+
name: constants_1.PREFIX,
|
|
34
|
+
slot: 'TriggerMenuRoot'
|
|
35
|
+
})(() => ({}));
|
|
36
|
+
const PhotoUploadListItemButton = (0, asUploadButton_1.default)((0, react_1.forwardRef)((props, ref) => (react_1.default.createElement(material_1.ListItemButton, Object.assign({}, props, { "aria-label": "upload", ref: ref })))), { accept: 'image/*', capture: 'camera' });
|
|
37
|
+
const GalleryUploadListItemButton = (0, asUploadButton_1.default)((0, react_1.forwardRef)((props, ref) => (react_1.default.createElement(material_1.ListItemButton, Object.assign({}, props, { "aria-label": "upload", ref: ref })))), { accept: 'image/*' });
|
|
38
|
+
const DocumentUploadListItemButton = (0, asUploadButton_1.default)((0, react_1.forwardRef)((props, ref) => (react_1.default.createElement(material_1.ListItemButton, Object.assign({}, props, { "aria-label": "upload", ref: ref })))), { accept: 'application/pdf' });
|
|
39
|
+
const GalleryUploadMenuItem = (0, asUploadButton_1.default)((0, react_1.forwardRef)((props, ref) => (react_1.default.createElement(material_1.MenuItem, Object.assign({}, props, { "aria-label": "upload", ref: ref })))), { accept: 'image/*' });
|
|
40
|
+
const DocumentUploadMenuItem = (0, asUploadButton_1.default)((0, react_1.forwardRef)((props, ref) => (react_1.default.createElement(material_1.MenuItem, Object.assign({}, props, { "aria-label": "upload", ref: ref })))), { accept: 'application/pdf' });
|
|
41
|
+
exports.default = (_a) => {
|
|
42
|
+
var { className, onAdd = null } = _a, rest = tslib_1.__rest(_a, ["className", "onAdd"]);
|
|
43
|
+
// STATE
|
|
44
|
+
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
45
|
+
const [isUploading, setIsUploading] = (0, react_1.useState)(false);
|
|
46
|
+
// CONTEXT
|
|
47
|
+
const scContext = (0, react_core_1.useSCContext)();
|
|
48
|
+
// HOOKS
|
|
49
|
+
const theme = (0, material_1.useTheme)();
|
|
50
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
51
|
+
const { enqueueSnackbar, closeSnackbar } = (0, notistack_1.useSnackbar)();
|
|
52
|
+
// HANDLERS
|
|
53
|
+
const handleOpen = (0, react_1.useCallback)((event) => {
|
|
54
|
+
setAnchorEl(event.currentTarget);
|
|
55
|
+
}, []);
|
|
56
|
+
const handleClose = (0, react_1.useCallback)(() => {
|
|
57
|
+
setAnchorEl(null);
|
|
58
|
+
}, []);
|
|
59
|
+
const handleFilterByMime = (0, react_1.useCallback)((file) => {
|
|
60
|
+
return file.type.startsWith('image/') || file.type === 'application/pdf';
|
|
61
|
+
}, []);
|
|
62
|
+
const handleSuccess = (0, react_1.useCallback)((media) => {
|
|
63
|
+
onAdd && onAdd(media);
|
|
64
|
+
}, [onAdd]);
|
|
65
|
+
const handleProgress = (0, react_1.useCallback)((chunks) => {
|
|
66
|
+
console.log(chunks);
|
|
67
|
+
setIsUploading(Object.keys(chunks).length > 0);
|
|
68
|
+
}, []);
|
|
69
|
+
const handleError = (0, react_1.useCallback)((chunk, error) => {
|
|
70
|
+
const _snackBar = enqueueSnackbar(`${chunk.name}: ${error}`, {
|
|
71
|
+
variant: 'error',
|
|
72
|
+
anchorOrigin: { horizontal: 'center', vertical: 'top' },
|
|
73
|
+
autoHideDuration: 2000,
|
|
74
|
+
SnackbarProps: {
|
|
75
|
+
onClick: () => {
|
|
76
|
+
closeSnackbar(_snackBar);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}, [enqueueSnackbar]);
|
|
81
|
+
const list = (0, react_1.useMemo)(() => {
|
|
82
|
+
if (isMobile) {
|
|
83
|
+
return [
|
|
84
|
+
react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "photo" },
|
|
85
|
+
react_1.default.createElement(PhotoUploadListItemButton, { inputFieldName: "image" },
|
|
86
|
+
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.media.file.photo", defaultMessage: "ui.composer.media.file.photo" }))),
|
|
87
|
+
react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "gallery" },
|
|
88
|
+
react_1.default.createElement(GalleryUploadListItemButton, { inputFieldName: "image" },
|
|
89
|
+
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.media.file.gallery", defaultMessage: "ui.composer.media.file.gallery" }))),
|
|
90
|
+
react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "document" },
|
|
91
|
+
react_1.default.createElement(DocumentUploadListItemButton, { inputFieldName: "document" },
|
|
92
|
+
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.media.file.document", defaultMessage: "ui.composer.media.file.document" })))
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
return [
|
|
97
|
+
react_1.default.createElement(GalleryUploadMenuItem, { extraProps: { className: classes.item }, inputFieldName: "image", key: "gallery" },
|
|
98
|
+
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.media.file.gallery", defaultMessage: "ui.composer.media.file.gallery" })),
|
|
99
|
+
react_1.default.createElement(DocumentUploadMenuItem, { extraProps: { className: classes.item }, key: "document", inputFieldName: "document" },
|
|
100
|
+
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.media.file.document", defaultMessage: "ui.composer.media.file.document" }))
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
}, [isMobile, handleFilterByMime, handleSuccess, handleProgress, handleError]);
|
|
104
|
+
return (react_1.default.createElement(chunked_uploady_1.default, { destination: {
|
|
105
|
+
url: `${scContext.settings.portal}${api_services_1.Endpoints.ComposerChunkUploadMedia.url()}`,
|
|
106
|
+
method: api_services_1.Endpoints.ComposerChunkUploadMedia.method
|
|
107
|
+
}, fileFilter: handleFilterByMime, chunkSize: 204800, multiple: true },
|
|
108
|
+
react_1.default.createElement(MediaChunkUploader_1.default, { onSuccess: handleSuccess, onProgress: handleProgress, onError: handleError }),
|
|
109
|
+
react_1.default.createElement(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.triggerRoot) }, rest, { "aria-label": "add media", disabled: isUploading, onClick: handleOpen }), isUploading ? react_1.default.createElement(material_1.CircularProgress, { size: 20 }) : react_1.default.createElement(Icon_1.default, null, "photo_file")),
|
|
110
|
+
isMobile ? (react_1.default.createElement(SwipeableDrawerRoot, { onClick: () => setAnchorEl(null), className: classes.triggerDrawerRoot, anchor: "bottom", open: Boolean(anchorEl), onClose: handleClose, onOpen: handleOpen, PaperProps: { className: classes.paper }, disableSwipeToOpen: true },
|
|
111
|
+
react_1.default.createElement(material_1.List, null, list))) : (react_1.default.createElement(MenuRoot, { onClick: () => setAnchorEl(null), className: classes.triggerMenuRoot, anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, PaperProps: { className: classes.paper } }, list))));
|
|
112
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const shared_ui_1 = require("@rpldy/shared-ui");
|
|
6
|
+
const asUploadButton = (Component, InputProps) => {
|
|
7
|
+
const AsUploadButton = (props, ref) => {
|
|
8
|
+
const { showFileUpload, getInternalFileInput } = (0, shared_ui_1.useUploadyContext)();
|
|
9
|
+
const { id, className, text, children, extraProps, onClick } = props, uploadOptions = tslib_1.__rest(props, ["id", "className", "text", "children", "extraProps", "onClick"]);
|
|
10
|
+
//using ref so onButtonClick can stay memoized
|
|
11
|
+
const uploadOptionsRef = (0, react_1.useRef)();
|
|
12
|
+
uploadOptionsRef.current = uploadOptions;
|
|
13
|
+
const onButtonClick = (0, react_1.useCallback)((e) => {
|
|
14
|
+
const input = getInternalFileInput();
|
|
15
|
+
input.current.accept = InputProps.accept;
|
|
16
|
+
if (InputProps.capture) {
|
|
17
|
+
input.current.capture = InputProps.capture;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
input.current.removeAttribute('capture');
|
|
21
|
+
}
|
|
22
|
+
showFileUpload(uploadOptionsRef.current);
|
|
23
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
24
|
+
}, [getInternalFileInput, showFileUpload, uploadOptionsRef, onClick]);
|
|
25
|
+
return react_1.default.createElement(Component, Object.assign({ ref: ref, onClick: onButtonClick, id: id, className: className, children: children || text || "Upload" }, extraProps));
|
|
26
|
+
};
|
|
27
|
+
(0, shared_ui_1.markAsUploadOptionsComponent)(AsUploadButton);
|
|
28
|
+
return (0, react_1.forwardRef)(AsUploadButton);
|
|
29
|
+
};
|
|
30
|
+
exports.default = asUploadButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCMediaFile";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const DisplayComponent_1 = tslib_1.__importDefault(require("./DisplayComponent"));
|
|
5
|
+
const TriggerButton_1 = tslib_1.__importDefault(require("./TriggerButton"));
|
|
6
|
+
const PreviewComponent_1 = tslib_1.__importDefault(require("./PreviewComponent"));
|
|
7
|
+
const filter_1 = tslib_1.__importDefault(require("./filter"));
|
|
8
|
+
const File = {
|
|
9
|
+
name: 'file',
|
|
10
|
+
displayComponent: DisplayComponent_1.default,
|
|
11
|
+
triggerButton: TriggerButton_1.default,
|
|
12
|
+
layerComponent: null,
|
|
13
|
+
previewComponent: PreviewComponent_1.default,
|
|
14
|
+
filter: filter_1.default
|
|
15
|
+
};
|
|
16
|
+
exports.default = File;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { BoxProps } from '@mui/material';
|
|
3
|
+
import { SCMediaType } from '@selfcommunity/types/src/types';
|
|
4
|
+
export interface DisplayComponentProps extends BoxProps {
|
|
5
|
+
/**
|
|
6
|
+
* Medias
|
|
7
|
+
*/
|
|
8
|
+
medias: SCMediaType[];
|
|
9
|
+
/**
|
|
10
|
+
* Handle full width option
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Handles on media click
|
|
16
|
+
*/
|
|
17
|
+
onMediaClick?: (any: any) => void;
|
|
18
|
+
}
|
|
19
|
+
declare const _default: (props: DisplayComponentProps) => ReactElement;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const react_lazyload_1 = tslib_1.__importDefault(require("react-lazyload"));
|
|
7
|
+
const Media_1 = require("../../../constants/Media");
|
|
8
|
+
const AutoPlayer_1 = tslib_1.__importDefault(require("../../AutoPlayer"));
|
|
9
|
+
const Box_1 = tslib_1.__importDefault(require("@mui/material/Box"));
|
|
10
|
+
const LazyLoad_1 = require("../../../constants/LazyLoad");
|
|
11
|
+
const Skeleton_1 = tslib_1.__importDefault(require("@mui/material/Skeleton"));
|
|
12
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
13
|
+
const constants_1 = require("./constants");
|
|
14
|
+
const filter_1 = tslib_1.__importDefault(require("./filter"));
|
|
15
|
+
const classes = {
|
|
16
|
+
displayRoot: `${constants_1.PREFIX}-display-root`,
|
|
17
|
+
displayLink: `${constants_1.PREFIX}-link`,
|
|
18
|
+
displayVideo: `${constants_1.PREFIX}-video`,
|
|
19
|
+
thumbnail: `${constants_1.PREFIX}-thumbnail`,
|
|
20
|
+
thumbnailFullWidth: `${constants_1.PREFIX}-thumbnail`,
|
|
21
|
+
image: `${constants_1.PREFIX}-image`,
|
|
22
|
+
snippet: `${constants_1.PREFIX}-snippet`,
|
|
23
|
+
snippetTitle: `${constants_1.PREFIX}-snippet-title`,
|
|
24
|
+
snippetDescription: `${constants_1.PREFIX}-snippet-description`
|
|
25
|
+
};
|
|
26
|
+
const Root = (0, styles_1.styled)(Box_1.default, {
|
|
27
|
+
name: constants_1.PREFIX,
|
|
28
|
+
slot: 'DisplayRoot'
|
|
29
|
+
})(({ theme }) => ({}));
|
|
30
|
+
exports.default = (props) => {
|
|
31
|
+
// PROPS
|
|
32
|
+
const { className = '', medias, fullWidth = false, onMediaClick = null } = props, rest = tslib_1.__rest(props, ["className", "medias", "fullWidth", "onMediaClick"]);
|
|
33
|
+
// HANDLERS
|
|
34
|
+
const handleLinkClick = (link) => {
|
|
35
|
+
onMediaClick && onMediaClick(link);
|
|
36
|
+
};
|
|
37
|
+
// MEMO
|
|
38
|
+
const _medias = (0, react_1.useMemo)(() => medias.filter(filter_1.default), [medias]);
|
|
39
|
+
// RENDER
|
|
40
|
+
/**
|
|
41
|
+
* Renders link display
|
|
42
|
+
* @param (link)
|
|
43
|
+
* @param(key)
|
|
44
|
+
*/
|
|
45
|
+
const renderPreview = (link, key) => {
|
|
46
|
+
const domain = new URL(link.embed.metadata.url).hostname.replace('www.', '');
|
|
47
|
+
return (react_1.default.createElement(Box_1.default, { className: classes.displayLink, key: key },
|
|
48
|
+
link.embed.metadata.images && link.embed.metadata.images.length > 0 && (react_1.default.createElement(react_1.default.Fragment, null, fullWidth ? (react_1.default.createElement(Box_1.default, { className: (0, classnames_1.default)(classes.thumbnailFullWidth, classes.image), style: { background: `url(${link.image})`, paddingBottom: `${100 / link.image_width / link.image_height}%` } })) : (react_1.default.createElement(Box_1.default, { className: (0, classnames_1.default)(classes.thumbnail, classes.image), style: { background: `url(${link.image})` } })))),
|
|
49
|
+
react_1.default.createElement(Box_1.default, { className: classes.snippet },
|
|
50
|
+
react_1.default.createElement("b", { className: classes.snippetTitle }, link.embed.metadata.title),
|
|
51
|
+
react_1.default.createElement("br", null),
|
|
52
|
+
react_1.default.createElement("p", { className: classes.snippetDescription }, link.embed.metadata.description),
|
|
53
|
+
react_1.default.createElement("a", { href: link.embed.metadata.url, target: '_blank', onClick: () => handleLinkClick(link) }, domain)),
|
|
54
|
+
react_1.default.createElement("div", { style: { clear: 'both' } })));
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Renders component
|
|
58
|
+
*/
|
|
59
|
+
if (_medias.length === 0) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return (react_1.default.createElement(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.displayRoot) }, rest), _medias.map((l, i) => {
|
|
63
|
+
if (l.embed.metadata && l.embed.metadata.type === Media_1.MEDIA_TYPE_VIDEO) {
|
|
64
|
+
return (react_1.default.createElement(react_lazyload_1.default, { className: classes.displayVideo, placeholder: react_1.default.createElement(Skeleton_1.default, { variant: "rectangular", height: 360, width: '100%' }), key: i, once: true, offset: LazyLoad_1.DEFAULT_PRELOAD_OFFSET_VIEWPORT },
|
|
65
|
+
react_1.default.createElement(AutoPlayer_1.default, { url: l.url, width: '100%', key: i, onVideoWatch: () => handleLinkClick(l) })));
|
|
66
|
+
}
|
|
67
|
+
return react_1.default.createElement(react_1.default.Fragment, { key: i }, renderPreview(l, i));
|
|
68
|
+
})));
|
|
69
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BoxProps } from '@mui/material';
|
|
3
|
+
import { SCMediaType } from '@selfcommunity/types/src/index';
|
|
4
|
+
import { ComposerLayerProps } from '../../../types/composer';
|
|
5
|
+
export interface LayerComponentProps extends Omit<BoxProps, 'defaultValue'>, ComposerLayerProps {
|
|
6
|
+
defaultValue: SCMediaType[];
|
|
7
|
+
}
|
|
8
|
+
declare const LayerComponent: React.ForwardRefExoticComponent<Pick<LayerComponentProps, "p" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "component" | "sx" | "classes" | "onClose" | "onSave"> & React.RefAttributes<unknown>>;
|
|
9
|
+
export default LayerComponent;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const react_intl_1 = require("react-intl");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const styles_1 = require("@mui/material/styles");
|
|
8
|
+
const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
|
|
9
|
+
const DialogContent_1 = tslib_1.__importDefault(require("@mui/material/DialogContent"));
|
|
10
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
11
|
+
const constants_1 = require("./constants");
|
|
12
|
+
const PreviewComponent_1 = tslib_1.__importDefault(require("./PreviewComponent"));
|
|
13
|
+
const UrlTextField_1 = tslib_1.__importDefault(require("./UrlTextField"));
|
|
14
|
+
const classes = {
|
|
15
|
+
layerRoot: `${constants_1.PREFIX}-layer-root`,
|
|
16
|
+
title: `${constants_1.PREFIX}-layer-title`,
|
|
17
|
+
content: `${constants_1.PREFIX}-layer-content`,
|
|
18
|
+
media: `${constants_1.PREFIX}-media`,
|
|
19
|
+
delete: `${constants_1.PREFIX}-delete`
|
|
20
|
+
};
|
|
21
|
+
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
22
|
+
name: constants_1.PREFIX,
|
|
23
|
+
slot: 'LayerRoot'
|
|
24
|
+
})(() => ({}));
|
|
25
|
+
const LayerComponent = react_1.default.forwardRef((props, ref) => {
|
|
26
|
+
// PROPS
|
|
27
|
+
const { className, onClose, onSave, defaultValue = [] } = props, rest = tslib_1.__rest(props, ["className", "onClose", "onSave", "defaultValue"]);
|
|
28
|
+
// STATE
|
|
29
|
+
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
30
|
+
// HANDLERS
|
|
31
|
+
const handleSave = (0, react_1.useCallback)(() => onSave(value), [value]);
|
|
32
|
+
const handleAdd = (0, react_1.useCallback)((media) => setValue([...value, media]), [value]);
|
|
33
|
+
const handleChange = (0, react_1.useCallback)((medias) => setValue(medias), []);
|
|
34
|
+
return react_1.default.createElement(Root, Object.assign({ ref: ref, className: (0, classnames_1.default)(className, classes.layerRoot) }, rest),
|
|
35
|
+
react_1.default.createElement(material_1.DialogTitle, { className: classes.title },
|
|
36
|
+
react_1.default.createElement(material_1.IconButton, { onClick: onClose },
|
|
37
|
+
react_1.default.createElement(Icon_1.default, null, "arrow_back")),
|
|
38
|
+
react_1.default.createElement(material_1.Typography, null,
|
|
39
|
+
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.media.link.layer.title", defaultMessage: "ui.composer.media.link.layer.title" })),
|
|
40
|
+
react_1.default.createElement(material_1.Button, { size: "small", color: "secondary", variant: "contained", onClick: handleSave },
|
|
41
|
+
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.save", defaultMessage: "ui.composer.layer.save" }))),
|
|
42
|
+
react_1.default.createElement(DialogContent_1.default, { className: classes.content },
|
|
43
|
+
react_1.default.createElement(UrlTextField_1.default, { id: "page", name: "page", label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.media.link.add.label", defaultMessage: "ui.composer.media.link.add.label" }), fullWidth: true, variant: "outlined", placeholder: "https://", onSuccess: handleAdd }),
|
|
44
|
+
react_1.default.createElement(PreviewComponent_1.default, { onChange: handleChange, value: value })));
|
|
45
|
+
});
|
|
46
|
+
exports.default = LayerComponent;
|
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Handle full width option
|
|
9
|
-
* @default false
|
|
10
|
-
*/
|
|
11
|
-
fullWidth?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Component adornments
|
|
14
|
-
* @default null
|
|
15
|
-
*/
|
|
16
|
-
adornment?: React.ReactNode;
|
|
17
|
-
/**
|
|
18
|
-
* Handles on media click
|
|
19
|
-
*/
|
|
20
|
-
onMediaClick?: (any: any) => void;
|
|
2
|
+
import { BoxProps } from '@mui/material';
|
|
3
|
+
import { SCMediaType } from '@selfcommunity/types/src/index';
|
|
4
|
+
export interface PreviewComponentProps extends Omit<BoxProps, 'value' | 'onChange'> {
|
|
5
|
+
onChange: (value: SCMediaType[]) => void;
|
|
6
|
+
value: SCMediaType[];
|
|
21
7
|
}
|
|
22
|
-
declare const
|
|
23
|
-
export default
|
|
8
|
+
declare const PreviewComponent: React.ForwardRefExoticComponent<Pick<PreviewComponentProps, "p" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "component" | "sx" | "classes" | "value"> & React.RefAttributes<unknown>>;
|
|
9
|
+
export default PreviewComponent;
|
|
@@ -1,65 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const react_1 = tslib_1.
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
5
6
|
const styles_1 = require("@mui/material/styles");
|
|
6
|
-
const
|
|
7
|
-
const Media_1 = require("../../../constants/Media");
|
|
8
|
-
const AutoPlayer_1 = tslib_1.__importDefault(require("../../AutoPlayer"));
|
|
9
|
-
const Box_1 = tslib_1.__importDefault(require("@mui/material/Box"));
|
|
10
|
-
const LazyLoad_1 = require("../../../constants/LazyLoad");
|
|
11
|
-
const Skeleton_1 = tslib_1.__importDefault(require("@mui/material/Skeleton"));
|
|
7
|
+
const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
|
|
12
8
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
13
|
-
const
|
|
9
|
+
const react_sortablejs_1 = require("react-sortablejs");
|
|
10
|
+
const DisplayComponent_1 = tslib_1.__importDefault(require("./DisplayComponent"));
|
|
11
|
+
const constants_1 = require("./constants");
|
|
12
|
+
const filter_1 = tslib_1.__importDefault(require("./filter"));
|
|
14
13
|
const classes = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
thumbnailFullWidth: `${PREFIX}-thumbnail`,
|
|
19
|
-
image: `${PREFIX}-image`,
|
|
20
|
-
snippet: `${PREFIX}-snippet`,
|
|
21
|
-
snippetTitle: `${PREFIX}-snippet-title`,
|
|
22
|
-
snippetDescription: `${PREFIX}-snippet-description`
|
|
14
|
+
previewRoot: `${constants_1.PREFIX}-preview-root`,
|
|
15
|
+
media: `${constants_1.PREFIX}-media`,
|
|
16
|
+
delete: `${constants_1.PREFIX}-delete`
|
|
23
17
|
};
|
|
24
|
-
const Root = (0, styles_1.styled)(
|
|
25
|
-
name: PREFIX,
|
|
26
|
-
slot: '
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
exports.default = (props) => {
|
|
18
|
+
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
19
|
+
name: constants_1.PREFIX,
|
|
20
|
+
slot: 'PreviewRoot'
|
|
21
|
+
})(() => ({}));
|
|
22
|
+
const PreviewComponent = react_1.default.forwardRef((props, ref) => {
|
|
30
23
|
// PROPS
|
|
31
|
-
const {
|
|
24
|
+
const { className, onChange, value = [] } = props, rest = tslib_1.__rest(props, ["className", "onChange", "value"]);
|
|
25
|
+
// MEMO
|
|
26
|
+
const medias = (0, react_1.useMemo)(() => value.filter(filter_1.default), [value]);
|
|
32
27
|
// HANDLERS
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const domain = new URL(link.embed.metadata.url).hostname.replace('www.', '');
|
|
44
|
-
return (react_1.default.createElement(Box_1.default, { className: classes.previewLink, key: key },
|
|
45
|
-
link.embed.metadata.images && link.embed.metadata.images.length > 0 && (react_1.default.createElement(react_1.default.Fragment, null, fullWidth ? (react_1.default.createElement(Box_1.default, { className: (0, classnames_1.default)(classes.thumbnailFullWidth, classes.image), style: { background: `url(${link.image})`, paddingBottom: `${100 / link.image_width / link.image_height}%` } })) : (react_1.default.createElement(Box_1.default, { className: (0, classnames_1.default)(classes.thumbnail, classes.image), style: { background: `url(${link.image})` } })))),
|
|
46
|
-
react_1.default.createElement(Box_1.default, { className: classes.snippet },
|
|
47
|
-
react_1.default.createElement("b", { className: classes.snippetTitle }, link.embed.metadata.title),
|
|
48
|
-
react_1.default.createElement("br", null),
|
|
49
|
-
react_1.default.createElement("p", { className: classes.snippetDescription }, link.embed.metadata.description),
|
|
50
|
-
react_1.default.createElement("a", { href: link.embed.metadata.url, target: '_blank', onClick: () => handleLinkClick(link) }, domain)),
|
|
51
|
-
react_1.default.createElement("div", { style: { clear: 'both' } })));
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Renders component
|
|
55
|
-
*/
|
|
56
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, medias.length > 0 && (react_1.default.createElement(Root, null,
|
|
57
|
-
adornment,
|
|
58
|
-
medias.map((l, i) => {
|
|
59
|
-
if (l.embed.metadata && l.embed.metadata.type === Media_1.MEDIA_TYPE_VIDEO) {
|
|
60
|
-
return (react_1.default.createElement(react_lazyload_1.default, { className: classes.previewVideo, placeholder: react_1.default.createElement(Skeleton_1.default, { variant: "rectangular", height: 360, width: '100%' }), key: i, once: true, offset: LazyLoad_1.DEFAULT_PRELOAD_OFFSET_VIEWPORT },
|
|
61
|
-
react_1.default.createElement(AutoPlayer_1.default, { url: l.url, width: '100%', key: i, onVideoWatch: () => handleLinkClick(l) })));
|
|
62
|
-
}
|
|
63
|
-
return react_1.default.createElement(react_1.default.Fragment, { key: i }, renderPreview(l, i));
|
|
64
|
-
})))));
|
|
65
|
-
};
|
|
28
|
+
const handleSort = (0, react_1.useCallback)((medias) => {
|
|
29
|
+
onChange && onChange([...value.filter((media) => medias.findIndex((m) => m.id === media.id) === -1), ...medias]);
|
|
30
|
+
}, [onChange]);
|
|
31
|
+
const handleDelete = (0, react_1.useCallback)((id) => () => onChange && onChange(value.filter((media) => media.id !== id)), [onChange, value]);
|
|
32
|
+
return react_1.default.createElement(Root, Object.assign({ ref: ref, className: (0, classnames_1.default)(className, classes.previewRoot) }, rest), medias.length > 0 && (react_1.default.createElement(react_sortablejs_1.ReactSortable, { list: medias, setList: handleSort }, medias.map((media) => (react_1.default.createElement(material_1.Box, { key: media.id, className: classes.media },
|
|
33
|
+
react_1.default.createElement(DisplayComponent_1.default, { medias: [media] }),
|
|
34
|
+
react_1.default.createElement(material_1.IconButton, { className: classes.delete, onClick: handleDelete(media.id), size: "small" },
|
|
35
|
+
react_1.default.createElement(Icon_1.default, null, "delete"))))))));
|
|
36
|
+
});
|
|
37
|
+
exports.default = PreviewComponent;
|