@selfcommunity/react-ui 0.8.1-alpha.4 → 0.9.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/CreateEventButton/CreateEventButton.d.ts +2 -2
- package/lib/cjs/components/CreateEventButton/CreateEventButton.js +4 -4
- package/lib/cjs/components/EditEventButton/EditEventButton.js +1 -1
- package/lib/cjs/components/EventForm/EventForm.d.ts +7 -12
- package/lib/cjs/components/EventForm/EventForm.js +55 -55
- package/lib/cjs/components/EventFormDialog/EventFormDialog.d.ts +48 -0
- package/lib/cjs/components/EventFormDialog/EventFormDialog.js +56 -0
- package/lib/cjs/components/EventFormDialog/constants.d.ts +1 -0
- package/lib/cjs/components/EventFormDialog/constants.js +4 -0
- package/lib/cjs/components/EventFormDialog/index.d.ts +3 -0
- package/lib/cjs/components/EventFormDialog/index.js +5 -0
- package/lib/cjs/components/EventMediaWidget/EventMediaWidget.d.ts +37 -0
- package/lib/cjs/components/EventMediaWidget/EventMediaWidget.js +242 -0
- package/lib/cjs/components/EventMediaWidget/Skeleton.d.ts +2 -0
- package/lib/cjs/components/EventMediaWidget/Skeleton.js +28 -0
- package/lib/cjs/components/EventMediaWidget/TriggerButton.d.ts +17 -0
- package/lib/cjs/components/EventMediaWidget/TriggerButton.js +66 -0
- package/lib/cjs/components/EventMediaWidget/asUploadButton.d.ts +7 -0
- package/lib/cjs/components/EventMediaWidget/asUploadButton.js +25 -0
- package/lib/cjs/components/EventMediaWidget/constants.d.ts +1 -0
- package/lib/cjs/components/EventMediaWidget/constants.js +4 -0
- package/lib/cjs/components/EventMediaWidget/index.d.ts +4 -0
- package/lib/cjs/components/EventMediaWidget/index.js +8 -0
- package/lib/cjs/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +1 -3
- package/lib/cjs/index.d.ts +8 -5
- package/lib/cjs/index.js +18 -13
- package/lib/cjs/shared/Lightbox/BaseLightbox.d.ts +19 -0
- package/lib/cjs/shared/Lightbox/BaseLightbox.js +35 -0
- package/lib/cjs/shared/Lightbox/Lightbox.d.ts +31 -17
- package/lib/cjs/shared/Lightbox/Lightbox.js +16 -19
- package/lib/cjs/shared/Lightbox/constants.d.ts +1 -0
- package/lib/cjs/shared/Lightbox/constants.js +4 -0
- package/lib/cjs/shared/Lightbox/index.d.ts +4 -2
- package/lib/cjs/shared/Lightbox/index.js +4 -1
- package/lib/cjs/shared/Media/File/DisplayComponent.js +23 -6
- package/lib/cjs/shared/MediaChunkUploader/index.js +13 -11
- package/lib/cjs/utils/hash.d.ts +2 -1
- package/lib/esm/components/CreateEventButton/CreateEventButton.d.ts +2 -2
- package/lib/esm/components/CreateEventButton/CreateEventButton.js +4 -4
- package/lib/esm/components/EditEventButton/EditEventButton.js +1 -1
- package/lib/esm/components/EventForm/EventForm.d.ts +7 -12
- package/lib/esm/components/EventForm/EventForm.js +56 -56
- package/lib/esm/components/EventFormDialog/EventFormDialog.d.ts +48 -0
- package/lib/esm/components/EventFormDialog/EventFormDialog.js +53 -0
- package/lib/esm/components/EventFormDialog/constants.d.ts +1 -0
- package/lib/esm/components/EventFormDialog/constants.js +1 -0
- package/lib/esm/components/EventFormDialog/index.d.ts +3 -0
- package/lib/esm/components/EventFormDialog/index.js +2 -0
- package/lib/esm/components/EventMediaWidget/EventMediaWidget.d.ts +37 -0
- package/lib/esm/components/EventMediaWidget/EventMediaWidget.js +239 -0
- package/lib/esm/components/EventMediaWidget/Skeleton.d.ts +2 -0
- package/lib/esm/components/EventMediaWidget/Skeleton.js +22 -0
- package/lib/esm/components/EventMediaWidget/TriggerButton.d.ts +17 -0
- package/lib/esm/components/EventMediaWidget/TriggerButton.js +64 -0
- package/lib/esm/components/EventMediaWidget/asUploadButton.d.ts +7 -0
- package/lib/esm/components/EventMediaWidget/asUploadButton.js +23 -0
- package/lib/esm/components/EventMediaWidget/constants.d.ts +1 -0
- package/lib/esm/components/EventMediaWidget/constants.js +1 -0
- package/lib/esm/components/EventMediaWidget/index.d.ts +4 -0
- package/lib/esm/components/EventMediaWidget/index.js +4 -0
- package/lib/esm/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +1 -3
- package/lib/esm/index.d.ts +8 -5
- package/lib/esm/index.js +10 -8
- package/lib/esm/shared/Lightbox/BaseLightbox.d.ts +19 -0
- package/lib/esm/shared/Lightbox/BaseLightbox.js +33 -0
- package/lib/esm/shared/Lightbox/Lightbox.d.ts +31 -17
- package/lib/esm/shared/Lightbox/Lightbox.js +15 -19
- package/lib/esm/shared/Lightbox/constants.d.ts +1 -0
- package/lib/esm/shared/Lightbox/constants.js +1 -0
- package/lib/esm/shared/Lightbox/index.d.ts +4 -2
- package/lib/esm/shared/Lightbox/index.js +3 -1
- package/lib/esm/shared/Media/File/DisplayComponent.js +23 -6
- package/lib/esm/shared/MediaChunkUploader/index.js +14 -12
- package/lib/esm/utils/hash.d.ts +2 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +6 -6
- package/lib/cjs/shared/Media/File/Lightbox/index.d.ts +0 -28
- package/lib/cjs/shared/Media/File/Lightbox/index.js +0 -37
- package/lib/esm/shared/Media/File/Lightbox/index.d.ts +0 -28
- package/lib/esm/shared/Media/File/Lightbox/index.js +0 -34
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LoadingButtonProps } from '@mui/lab';
|
|
3
|
+
import { SCMediaType } from '@selfcommunity/types';
|
|
4
|
+
export interface TriggerIconButtonProps extends LoadingButtonProps {
|
|
5
|
+
/**
|
|
6
|
+
* Callback triggered when a media is added
|
|
7
|
+
* @param media
|
|
8
|
+
*/
|
|
9
|
+
onAdd?: (media: SCMediaType) => void | null;
|
|
10
|
+
/**
|
|
11
|
+
* Prop to change shape
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
isSquare?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<TriggerIconButtonProps, "id" | "role" | "className" | "style" | "classes" | "form" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "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" | "sx" | "variant" | "name" | "type" | "href" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "action" | "loading" | "size" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "startIcon" | "loadingIndicator" | "loadingPosition" | "onAdd" | "isSquare"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { LoadingButton } from '@mui/lab';
|
|
4
|
+
import { Stack, Typography } from '@mui/material';
|
|
5
|
+
import Icon from '@mui/material/Icon';
|
|
6
|
+
import { styled } from '@mui/material/styles';
|
|
7
|
+
import ChunkedUploady from '@rpldy/chunked-uploady';
|
|
8
|
+
import { Endpoints } from '@selfcommunity/api-services';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import { useSnackbar } from 'notistack';
|
|
11
|
+
import { forwardRef, useCallback, useState } from 'react';
|
|
12
|
+
import { FormattedMessage } from 'react-intl';
|
|
13
|
+
import MediaChunkUploader from '../../shared/MediaChunkUploader';
|
|
14
|
+
import asUploadButton from './asUploadButton';
|
|
15
|
+
import { PREFIX } from './constants';
|
|
16
|
+
const classes = {
|
|
17
|
+
triggerRoot: `${PREFIX}-trigger-root`,
|
|
18
|
+
triggerContent: `${PREFIX}-trigger-content`,
|
|
19
|
+
triggerIcon: `${PREFIX}-trigger-icon`
|
|
20
|
+
};
|
|
21
|
+
const Root = styled(LoadingButton, {
|
|
22
|
+
name: PREFIX,
|
|
23
|
+
slot: 'TriggerRoot',
|
|
24
|
+
overridesResolver: (_props, styles) => styles.triggerRoot,
|
|
25
|
+
shouldForwardProp: (prop) => prop !== 'isSquare'
|
|
26
|
+
})(() => ({}));
|
|
27
|
+
const GalleryUploadStack = asUploadButton(forwardRef((props, ref) => _jsx(Stack, Object.assign({}, props, { "aria-label": "upload", ref: ref }))), { accept: 'image/*' });
|
|
28
|
+
function TriggerButton(props, ref) {
|
|
29
|
+
// PROPS
|
|
30
|
+
const { className, onAdd = null, isSquare = false } = props, rest = __rest(props, ["className", "onAdd", "isSquare"]);
|
|
31
|
+
// STATE
|
|
32
|
+
const [isUploading, setIsUploading] = useState(false);
|
|
33
|
+
// HOOKS
|
|
34
|
+
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
|
|
35
|
+
const handleFilterByMime = useCallback((file) => {
|
|
36
|
+
return file.type.startsWith('image/');
|
|
37
|
+
}, []);
|
|
38
|
+
const handleSuccess = useCallback((media) => {
|
|
39
|
+
onAdd === null || onAdd === void 0 ? void 0 : onAdd(media);
|
|
40
|
+
}, []);
|
|
41
|
+
const handleProgress = useCallback((chunks) => {
|
|
42
|
+
setIsUploading(Object.keys(chunks).length > 0);
|
|
43
|
+
}, []);
|
|
44
|
+
const handleError = useCallback((chunk, error) => {
|
|
45
|
+
const _snackBar = enqueueSnackbar(`${chunk.name}: ${error}`, {
|
|
46
|
+
variant: 'error',
|
|
47
|
+
anchorOrigin: { horizontal: 'center', vertical: 'top' },
|
|
48
|
+
autoHideDuration: 2000,
|
|
49
|
+
SnackbarProps: {
|
|
50
|
+
onClick: () => {
|
|
51
|
+
closeSnackbar(_snackBar);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}, [enqueueSnackbar]);
|
|
56
|
+
return (_jsxs(ChunkedUploady, Object.assign({ destination: {
|
|
57
|
+
url: Endpoints.ComposerChunkUploadMedia.url(),
|
|
58
|
+
method: Endpoints.ComposerChunkUploadMedia.method
|
|
59
|
+
}, fileFilter: handleFilterByMime, chunkSize: 204800 }, { children: [_jsx(MediaChunkUploader, { onSuccess: handleSuccess, onProgress: handleProgress, onError: handleError, type: "image" }), _jsx(Root, Object.assign({ className: classNames(className, classes.triggerRoot), ref: ref }, rest, { "aria-label": "add media", loading: isUploading,
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
isSquare: isSquare }, { children: _jsxs(GalleryUploadStack, Object.assign({ className: classes.triggerContent }, { children: [!isSquare && (_jsx(Typography, Object.assign({ variant: "caption", component: "p" }, { children: _jsx(FormattedMessage, { id: "ui.eventMediaWidget.add", defaultMessage: "ui.eventMediaWidget.add" }) }))), _jsx(Icon, Object.assign({ className: classes.triggerIcon }, { children: "add" }))] })) }))] })));
|
|
63
|
+
}
|
|
64
|
+
export default forwardRef(TriggerButton);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UploadButtonProps } from '@rpldy/upload-button';
|
|
2
|
+
import type { ComponentType } from 'react';
|
|
3
|
+
declare type FileInputProps = {
|
|
4
|
+
accept: string;
|
|
5
|
+
};
|
|
6
|
+
declare const asUploadButton: (Component: ComponentType<any>, inputProps: FileInputProps) => import("react").ForwardRefExoticComponent<Pick<UploadButtonProps<Element>, "id" | "className" | "text" | "children" | "onClick" | "method" | "headers" | "paramName" | "params" | "forceJsonResponse" | "withCredentials" | "formatGroupParamName" | "sendWithFormData" | "formDataAllowUndefined" | "formatServerResponse" | "isSuccessfulCall" | "destination" | "fileFilter" | "autoUpload" | "clearPendingOnAdd" | "grouped" | "maxGroupSize" | "inputFieldName" | "fastAbortThreshold" | "userData" | "extraProps"> & import("react").RefAttributes<any>>;
|
|
7
|
+
export default asUploadButton;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { markAsUploadOptionsComponent, useUploadyContext } from '@rpldy/shared-ui';
|
|
4
|
+
import { forwardRef, useCallback, useRef } from 'react';
|
|
5
|
+
const asUploadButton = (Component, inputProps) => {
|
|
6
|
+
const AsUploadButton = (props, ref) => {
|
|
7
|
+
const { showFileUpload, getInternalFileInput } = useUploadyContext();
|
|
8
|
+
const { id, className, text, children, extraProps, onClick } = props, uploadOptions = __rest(props, ["id", "className", "text", "children", "extraProps", "onClick"]);
|
|
9
|
+
//using ref so onButtonClick can stay memoized
|
|
10
|
+
const uploadOptionsRef = useRef();
|
|
11
|
+
uploadOptionsRef.current = uploadOptions;
|
|
12
|
+
const onButtonClick = useCallback((e) => {
|
|
13
|
+
const input = getInternalFileInput();
|
|
14
|
+
input.current.accept = inputProps.accept;
|
|
15
|
+
showFileUpload(uploadOptionsRef.current);
|
|
16
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
17
|
+
}, [getInternalFileInput, showFileUpload, uploadOptionsRef, onClick]);
|
|
18
|
+
return _jsx(Component, Object.assign({ ref: ref, onClick: onButtonClick, id: id, className: className, children: children || text || 'Upload' }, extraProps));
|
|
19
|
+
};
|
|
20
|
+
markAsUploadOptionsComponent(AsUploadButton);
|
|
21
|
+
return forwardRef(AsUploadButton);
|
|
22
|
+
};
|
|
23
|
+
export default asUploadButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCEventMediaWidget";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PREFIX = 'SCEventMediaWidget';
|
|
@@ -162,7 +162,5 @@ export default function PrivateMessageThreadItem(inProps) {
|
|
|
162
162
|
message.status !== SCPrivateMessageStatusType.HIDDEN && _jsx(PrivateMessageSettingsIconButton, { onMenuItemDeleteClick: handleMenuItemClick }) }, { children: [message.group && ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.username) !== message.sender.username && (_jsx(Typography, Object.assign({ color: "secondary", variant: "h4", className: classes.username }, { children: message.sender.username }))), _jsxs(_Fragment, { children: [hasFile && message.status !== SCPrivateMessageStatusType.HIDDEN ? (renderMessageFile(message)) : (_jsx(Box, Object.assign({ className: classes.text }, { children: _jsx(Typography, { component: "span", dangerouslySetInnerHTML: { __html: message.message } }) }))), _jsx(Typography, Object.assign({ className: classes.messageTime, color: "text.secondary" }, { children: `${intl.formatDate(message.created_at, {
|
|
163
163
|
hour: 'numeric',
|
|
164
164
|
minute: 'numeric'
|
|
165
|
-
})}` }))] }), openDialog && (_jsx(_Fragment, { children: (message === null || message === void 0 ? void 0 : message.file.mimetype.startsWith(SCMessageFileType.VIDEO)) ? (_jsx(DialogRoot, Object.assign({ open: openDialog, onClose: () => setOpenDialog(false), className: classes.dialogRoot }, { children: _jsx(AutoPlayer, { url: message === null || message === void 0 ? void 0 : message.file.url, width: '100%', enableAutoplay: false }) }))) : (_jsx(LightBox, { images: [{ src: message === null || message === void 0 ? void 0 : message.file.url, key: message.file.uuid }], onClose: () => setOpenDialog(false), toolbarButtons:
|
|
166
|
-
_jsx(IconButton, Object.assign({ onClick: () => handleDownload(message === null || message === void 0 ? void 0 : message.file), className: classes.downloadButton }, { children: _jsx(Icon, { children: "download" }) }), 'download')
|
|
167
|
-
] })) }))] })));
|
|
165
|
+
})}` }))] }), openDialog && (_jsx(_Fragment, { children: (message === null || message === void 0 ? void 0 : message.file.mimetype.startsWith(SCMessageFileType.VIDEO)) ? (_jsx(DialogRoot, Object.assign({ open: openDialog, onClose: () => setOpenDialog(false), className: classes.dialogRoot }, { children: _jsx(AutoPlayer, { url: message === null || message === void 0 ? void 0 : message.file.url, width: '100%', enableAutoplay: false }) }))) : (_jsx(LightBox, { images: [{ src: message === null || message === void 0 ? void 0 : message.file.url, key: message.file.uuid }], onClose: () => setOpenDialog(false), toolbarButtons: _jsx(IconButton, Object.assign({ onClick: () => handleDownload(message === null || message === void 0 ? void 0 : message.file), className: classes.downloadButton }, { children: _jsx(Icon, { children: "download" }) }), 'download') })) }))] })));
|
|
168
166
|
}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ import ConsentSolution, { ConsentSolutionProps, ConsentSolutionSkeleton } from '
|
|
|
37
37
|
import ConsentSolutionButton, { ConsentSolutionButtonProps } from './components/ConsentSolutionButton';
|
|
38
38
|
import CreateEventButton, { CreateEventButtonProps } from './components/CreateEventButton';
|
|
39
39
|
import CreateEventWidget, { CreateEventWidgetProps, CreateEventWidgetSkeleton } from './components/CreateEventWidget';
|
|
40
|
+
import EventForm, { EventFormProps } from './components/EventForm';
|
|
41
|
+
import EventFormDialog, { EventFormDialogProps } from './components/EventFormDialog';
|
|
40
42
|
import CreateGroupButton, { CreateGroupButtonProps } from './components/CreateGroupButton';
|
|
41
43
|
import CustomAdv, { CustomAdvProps, CustomAdvSkeleton } from './components/CustomAdv';
|
|
42
44
|
import EditEventButton, { EditEventButtonProps } from './components/EditEventButton';
|
|
@@ -47,6 +49,7 @@ import EventHeader, { EventHeaderProps, EventHeaderSkeleton } from './components
|
|
|
47
49
|
import EventInfoWidget, { EventInfoWidgetProps } from './components/EventInfoWidget';
|
|
48
50
|
import EventInviteButton, { EventInviteButtonProps } from './components/EventInviteButton';
|
|
49
51
|
import EventLocationWidget, { EventLocationWidgetProps, EventLocationWidgetSkeleton } from './components/EventLocationWidget';
|
|
52
|
+
import EventMediaWidget, { EventMediaWidgetProps, EventMediaWidgetSkeleton } from './components/EventMediaWidget';
|
|
50
53
|
import EventMembersWidget, { EventMembersWidgetProps, EventMembersWidgetSkeleton } from './components/EventMembersWidget';
|
|
51
54
|
import EventParticipantsButton, { EventParticipantsButtonProps } from './components/EventParticipantsButton';
|
|
52
55
|
import Events, { EventsProps, EventsSkeleton, EventsSkeletonProps } from './components/Events';
|
|
@@ -79,7 +82,7 @@ import InviteUserEventButton, { InviteUserEventButtonProps } from './components/
|
|
|
79
82
|
import LocationAutocomplete, { LocationAutocompleteProps } from './components/LocationAutocomplete';
|
|
80
83
|
import LoyaltyProgramWidget, { LoyaltyProgramWidgetProps, LoyaltyProgramWidgetSkeleton } from './components/LoyaltyProgramWidget';
|
|
81
84
|
import MyEventsWidget, { MyEventsWidgetProps, MyEventsWidgetSkeleton } from './components/MyEventsWidget';
|
|
82
|
-
import NavigationMenuIconButton, { NavigationMenuContent,
|
|
85
|
+
import NavigationMenuIconButton, { NavigationMenuContent, NavigationMenuDrawer, NavigationMenuDrawerProps, NavigationMenuHeader, NavigationMenuIconButtonProps } from './components/NavigationMenuIconButton';
|
|
83
86
|
import DefaultDrawerContent, { DefaultDrawerContentProps } from './components/NavigationMenuIconButton/DefaultDrawerContent';
|
|
84
87
|
import DefaultHeaderContent, { DefaultHeaderContentProps } from './components/NavigationMenuIconButton/DefaultHeaderContent';
|
|
85
88
|
import NavigationSettingsIconButton, { NavigationSettingsIconButtonProps, NavigationSettingsItem } from './components/NavigationSettingsIconButton';
|
|
@@ -132,7 +135,7 @@ import EventActionsMenu, { EventActionsMenuProps } from './shared/EventActionsMe
|
|
|
132
135
|
import EventInfoDetails, { EventInfoDetailsProps } from './shared/EventInfoDetails';
|
|
133
136
|
import HiddenPlaceholder from './shared/HiddenPlaceholder';
|
|
134
137
|
import LanguageSwitcher from './shared/LanguageSwitcher';
|
|
135
|
-
import Lightbox from './shared/Lightbox';
|
|
138
|
+
import BaseLightbox, { BaseLightboxProps, Lightbox, LightboxProps } from './shared/Lightbox';
|
|
136
139
|
import { EditMediaProps, File, Link, Share } from './shared/Media';
|
|
137
140
|
import MediaChunkUploader, { MediaChunkUploaderProps } from './shared/MediaChunkUploader';
|
|
138
141
|
import PasswordTextField from './shared/PasswordTextField';
|
|
@@ -144,7 +147,7 @@ import UrlTextField from './shared/UrlTextField';
|
|
|
144
147
|
import UserAvatar, { UserAvatarProps } from './shared/UserAvatar';
|
|
145
148
|
import UserDeletedSnackBar, { UserDeletedSnackBarProps } from './shared/UserDeletedSnackBar';
|
|
146
149
|
import UsernameTextField from './shared/UsernameTextField';
|
|
147
|
-
import { PlatformWidgetActionType, SCBroadcastMessageTemplateType, SCCommentsOrderBy, SCFeedObjectActivitiesType, SCFeedObjectTemplateType, SCFeedWidgetType, SCMediaChunkType, SCMediaObjectType, SCNotificationObjectTemplateType, SCUserProfileFields, SCUserProfileSettings, SCUserSocialAssociations, VirtualScrollerItemProps
|
|
150
|
+
import { PlatformWidgetActionType, SCBroadcastMessageTemplateType, SCCommentsOrderBy, SCEventTemplateType, SCFeedObjectActivitiesType, SCFeedObjectTemplateType, SCFeedWidgetType, SCMediaChunkType, SCMediaObjectType, SCNotificationObjectTemplateType, SCUserProfileFields, SCUserProfileSettings, SCUserSocialAssociations, VirtualScrollerItemProps } from './types';
|
|
148
151
|
/**
|
|
149
152
|
* Constants
|
|
150
153
|
*/
|
|
@@ -152,9 +155,9 @@ import { DEFAULT_WIDGETS_NUMBER } from './constants/Feed';
|
|
|
152
155
|
import { DEFAULT_PRELOAD_OFFSET_VIEWPORT, MAX_PRELOAD_OFFSET_VIEWPORT, MIN_PRELOAD_OFFSET_VIEWPORT } from './constants/LazyLoad';
|
|
153
156
|
import { LEGAL_POLICIES } from './constants/LegalPolicies';
|
|
154
157
|
import { DEFAULT_PAGINATION_LIMIT, DEFAULT_PAGINATION_OFFSET, DEFAULT_PAGINATION_QUERY_PARAM_NAME } from './constants/Pagination';
|
|
158
|
+
import { SCEventMembersEventType, SCGroupMembersEventType } from './constants/PubSub';
|
|
155
159
|
import { FACEBOOK_SHARE, LINKEDIN_SHARE, X_SHARE } from './constants/SocialShare';
|
|
156
160
|
import { DEFAULT_FIELDS } from './constants/UserProfile';
|
|
157
|
-
import { SCTopicType, SCGroupEventType, SCEventMembersEventType, SCGroupMembersEventType } from './constants/PubSub';
|
|
158
161
|
/**
|
|
159
162
|
* Utilities
|
|
160
163
|
*/
|
|
@@ -174,4 +177,4 @@ import LogoSelfCommunity from './assets/logo';
|
|
|
174
177
|
/**
|
|
175
178
|
* List all exports
|
|
176
179
|
*/
|
|
177
|
-
export { AcceptRequestUserEventButton, AcceptRequestUserEventButtonProps, AccountChangeMailValidation, AccountChangeMailValidationProps, AccountDataPortability, AccountDataPortabilityButton, AccountDataPortabilityButtonProps, AccountDataPortabilityProps, AccountDelete, AccountDeleteButton, AccountDeleteButtonProps, AccountDeleteProps, AccountRecover, AccountRecoverProps, AccountReset, AccountResetProps, AccountVerify, AccountVerifyProps, AvatarGroupSkeleton, BaseDialog, BaseDialogProps, BaseItem, BaseItemProps, BottomNavigation, BottomNavigationProps, BroadcastMessages, BroadcastMessagesProps, BroadcastMessagesSkeleton, bytesToSize, Calendar, CalendarProps, Categories, CategoriesPopularWidget, CategoriesPopularWidgetSkeleton, CategoriesProps, CategoriesSkeleton, CategoriesSkeletonProps, CategoriesSuggestionWidget, CategoriesSuggestionWidgetProps, CategoriesSuggestionWidgetSkeleton, Category, CategoryAutocomplete, CategoryAutocompleteProps, CategoryFollowButton, CategoryFollowButtonProps, CategoryFollowersButton, CategoryFollowersButtonProps, CategoryHeader, CategoryHeaderProps, CategoryHeaderSkeleton, CategoryProps, CategorySkeleton, CategoryTrendingFeedWidget, CategoryTrendingFeedWidgetProps, CategoryTrendingFeedWidgetSkeleton, CategoryTrendingPeopleWidgetSkeleton, CategoryTrendingUsersWidget, CategoryTrendingUsersWidgetProps, CentralProgress, ChangeCover, ChangeCoverProps, ChangeGroupCover, ChangeGroupCoverProps, ChangeGroupPicture, ChangeGroupPictureProps, ChangePicture, ChangePictureProps, CommentObject, CommentObjectProps, CommentObjectReply, CommentObjectReplyProps, CommentObjectSkeleton, CommentsFeedObject, CommentsFeedObjectProps, CommentsFeedObjectSkeleton, CommentsObject, CommentsObjectProps, CommentsObjectSkeleton, Composer, ComposerIconButton, ComposerIconButtonProps, ComposerProps, ConfirmDialog, ConnectionUserButton, ConsentSolution, ConsentSolutionButton, ConsentSolutionButtonProps, ConsentSolutionProps, ConsentSolutionSkeleton, ContributionUtils, CreateEventButton, CreateEventButtonProps, CreateEventWidget, CreateEventWidgetProps, CreateEventWidgetSkeleton, CreateGroupButton, CreateGroupButtonProps, CustomAdv, CustomAdvProps, CustomAdvSkeleton, DEFAULT_FIELDS, DEFAULT_PAGINATION_LIMIT, DEFAULT_PAGINATION_OFFSET, DEFAULT_PAGINATION_QUERY_PARAM_NAME, DEFAULT_PRELOAD_OFFSET_VIEWPORT, DEFAULT_WIDGETS_NUMBER, DefaultDrawerContent, DefaultDrawerContentProps, DefaultHeaderContent, DefaultHeaderContentProps,
|
|
180
|
+
export { AcceptRequestUserEventButton, AcceptRequestUserEventButtonProps, AccountChangeMailValidation, AccountChangeMailValidationProps, AccountDataPortability, AccountDataPortabilityButton, AccountDataPortabilityButtonProps, AccountDataPortabilityProps, AccountDelete, AccountDeleteButton, AccountDeleteButtonProps, AccountDeleteProps, AccountRecover, AccountRecoverProps, AccountReset, AccountResetProps, AccountVerify, AccountVerifyProps, AvatarGroupSkeleton, BaseDialog, BaseDialogProps, BaseItem, BaseItemProps, BaseLightbox, BaseLightboxProps, BottomNavigation, BottomNavigationProps, BroadcastMessages, BroadcastMessagesProps, BroadcastMessagesSkeleton, bytesToSize, Calendar, CalendarProps, Categories, CategoriesPopularWidget, CategoriesPopularWidgetSkeleton, CategoriesProps, CategoriesSkeleton, CategoriesSkeletonProps, CategoriesSuggestionWidget, CategoriesSuggestionWidgetProps, CategoriesSuggestionWidgetSkeleton, Category, CategoryAutocomplete, CategoryAutocompleteProps, CategoryFollowButton, CategoryFollowButtonProps, CategoryFollowersButton, CategoryFollowersButtonProps, CategoryHeader, CategoryHeaderProps, CategoryHeaderSkeleton, CategoryProps, CategorySkeleton, CategoryTrendingFeedWidget, CategoryTrendingFeedWidgetProps, CategoryTrendingFeedWidgetSkeleton, CategoryTrendingPeopleWidgetSkeleton, CategoryTrendingUsersWidget, CategoryTrendingUsersWidgetProps, CentralProgress, ChangeCover, ChangeCoverProps, ChangeGroupCover, ChangeGroupCoverProps, ChangeGroupPicture, ChangeGroupPictureProps, ChangePicture, ChangePictureProps, CommentObject, CommentObjectProps, CommentObjectReply, CommentObjectReplyProps, CommentObjectSkeleton, CommentsFeedObject, CommentsFeedObjectProps, CommentsFeedObjectSkeleton, CommentsObject, CommentsObjectProps, CommentsObjectSkeleton, Composer, ComposerIconButton, ComposerIconButtonProps, ComposerProps, ConfirmDialog, ConnectionUserButton, ConsentSolution, ConsentSolutionButton, ConsentSolutionButtonProps, ConsentSolutionProps, ConsentSolutionSkeleton, ContributionUtils, CreateEventButton, CreateEventButtonProps, CreateEventWidget, CreateEventWidgetProps, CreateEventWidgetSkeleton, CreateGroupButton, EventForm, EventFormProps, EventFormDialog, EventFormDialogProps, CreateGroupButtonProps, CustomAdv, CustomAdvProps, CustomAdvSkeleton, DEFAULT_FIELDS, DEFAULT_PAGINATION_LIMIT, DEFAULT_PAGINATION_OFFSET, DEFAULT_PAGINATION_QUERY_PARAM_NAME, DEFAULT_PRELOAD_OFFSET_VIEWPORT, DEFAULT_WIDGETS_NUMBER, DefaultDrawerContent, DefaultDrawerContentProps, DefaultHeaderContent, DefaultHeaderContentProps, EditEventButton, EditEventButtonProps, EditGroupButton, EditGroupButtonProps, EditMediaProps, Editor, EditorProps, EditorSkeleton, EmailTextField, Event, EventActionsMenu, EventActionsMenuProps, EventHeader, EventHeaderProps, EventHeaderSkeleton, EventInfoDetails, EventInfoDetailsProps, EventInfoWidget, EventInfoWidgetProps, EventInviteButton, EventInviteButtonProps, EventLocationWidget, EventLocationWidgetProps, EventLocationWidgetSkeleton, EventMediaWidget, EventMediaWidgetProps, EventMediaWidgetSkeleton, EventMembersWidget, EventMembersWidgetProps, EventMembersWidgetSkeleton, EventParticipantsButton, EventParticipantsButtonProps, EventProps, Events, EventSkeleton, EventSkeletonProps, EventsProps, EventsSkeleton, EventsSkeletonProps, FACEBOOK_SHARE, Feed, FeedObject, FeedObjectMediaPreview, FeedObjectMediaPreviewProps, FeedObjectProps, FeedObjectSkeleton, FeedProps, FeedRef, FeedSidebarProps, FeedSkeleton, FeedUpdatesWidget, FeedUpdatesWidgetProps, FeedUpdatesWidgetSkeleton, File, FollowUserButton, FollowUserButtonProps, Footer, FooterProps, FooterSkeleton, FriendshipButtonProps, FriendshipUserButton, GenericSkeleton, getRelativeTime, getUnseenNotification, getUnseenNotificationCounter, Group, GroupActionsMenu, GroupActionsMenuProps, GroupForm, GroupFormProps, GroupHeader, GroupHeaderProps, GroupHeaderSkeleton, GroupInfoWidget, GroupInfoWidgetProps, GroupInfoWidgetSkeleton, GroupInviteButton, GroupInviteButtonProps, GroupInvitedWidget, GroupInvitedWidgetProps, GroupInvitedWidgetSkeleton, GroupMembersButton, GroupMembersButtonProps, GroupMembersWidget, GroupMembersWidgetProps, GroupMembersWidgetSkeleton, GroupProps, GroupRequestsWidget, GroupRequestsWidgetProps, GroupRequestsWidgetSkeleton, Groups, GroupSettingsIconButton, GroupSettingsIconButtonProps, GroupSkeleton, GroupsProps, GroupsSkeleton, GroupSubscribeButton, GroupSubscribeButtonProps, HiddenPlaceholder, Incubator, IncubatorDetail, IncubatorDetailProps, IncubatorListWidget, IncubatorListWidgetProps, IncubatorProps, IncubatorSubscribeButton, IncubatorSubscribeButtonProps, IncubatorSuggestionWidget, IncubatorSuggestionWidgetProps, InfiniteScroll, InlineComposerWidget, InlineComposerWidgetProps, InlineComposerWidgetSkeleton, InviteUserEventButton, InviteUserEventButtonProps, LanguageSwitcher, LEGAL_POLICIES, Lightbox, LightboxProps, Link, LINKEDIN_SHARE, LocationAutocomplete, LocationAutocompleteProps, LogoSelfCommunity, LoyaltyProgramWidget, LoyaltyProgramWidgetProps, LoyaltyProgramWidgetSkeleton, MAX_PRELOAD_OFFSET_VIEWPORT, MEDIA_EMBED_SC_LINK_TYPE, MEDIA_EMBED_SC_SHARED_EVENT, MEDIA_EMBED_SC_SHARED_OBJECT, MEDIA_TYPE_DOCUMENT, MEDIA_TYPE_EMBED, MEDIA_TYPE_EVENT, MEDIA_TYPE_IMAGE, MEDIA_TYPE_LINK, MEDIA_TYPE_SHARE, MEDIA_TYPE_URL, MEDIA_TYPE_VIDEO, MediaChunkUploader, MediaChunkUploaderProps, MessageUploaderUtils, MetadataField, MetadataFieldProps, MIN_PRELOAD_OFFSET_VIEWPORT, MyEventsWidget, MyEventsWidgetProps, MyEventsWidgetSkeleton, NavigationMenuContent, NavigationMenuDrawer, NavigationMenuDrawerProps, NavigationMenuHeader, NavigationMenuIconButton, NavigationMenuIconButtonProps, NavigationSettingsIconButton, NavigationSettingsIconButtonProps, NavigationSettingsItem, NavigationToolbar, NavigationToolbarMobile, NavigationToolbarMobileProps, NavigationToolbarMobileSkeleton, NavigationToolbarProps, NavigationToolbarSkeleton, Notification, NotificationProps, NotificationSkeleton, OnBoardingWidget, OnBoardingWidgetProps, OnBoardingWidgetSkeleton, PasswordTextField, PhoneTextField, PlatformWidget, PlatformWidgetActionType, PlatformWidgetProps, PlatformWidgetSkeleton, PollSuggestionWidget, PollSuggestionWidgetProps, PrivateMessageComponent, PrivateMessageComponentProps, PrivateMessageComponentSkeleton, PrivateMessageEditor, PrivateMessageEditorProps, PrivateMessageEditorSkeleton, PrivateMessageSettingsIconButton, PrivateMessageSettingsIconButtonProps, PrivateMessageSnippetItem, PrivateMessageSnippetItemProps, PrivateMessageSnippetItemSkeleton, PrivateMessageSnippets, PrivateMessageSnippetsProps, PrivateMessageSnippetsSkeleton, PrivateMessageThread, PrivateMessageThreadItem, PrivateMessageThreadItemProps, PrivateMessageThreadItemSkeleton, PrivateMessageThreadProps, PrivateMessageThreadSkeleton, ProgressBar, ProgressBarProps, RelatedEventsWidget, RelatedEventsWidgetProps, RelatedEventsWidgetSkeleton, RelatedFeedObjectsWidget, RelatedFeedObjectsWidgetSkeleton, RelatedFeedObjectWidgetProps, ReplyComment, SCBroadcastMessageTemplateType, SCCommentsOrderBy, SCEventMembersEventType, SCEventTemplateType, SCFeedObjectActivitiesType, SCFeedObjectTemplateType, SCFeedWidgetType, SCGroupMembersEventType, SCMediaChunkType, SCMediaObjectType, SCNotificationObjectTemplateType, SCUserProfileFields, SCUserProfileSettings, SCUserSocialAssociations, SearchAutocomplete, SearchAutocompleteProps, SearchDialog, SearchDialogProps, Share, SnippetNotifications, SnippetNotificationsProps, SnippetNotificationsSkeleton, StickyBox, StickyBoxComponent, StickyBoxProps, SuggestedEventsWidget, SuggestedEventsWidgetProps, SuggestedEventsWidgetSkeleton, TagChip, TagChipProps, ToastNotifications, ToastNotificationsProps, ToastNotificationsSkeleton, UrlTextField, User, UserActionIconButton, UserActionIconButtonProps, UserAvatar, UserAvatarProps, UserConnectionsRequestsSentWidget, UserConnectionsRequestsSentWidgetProps, UserConnectionsRequestsSentWidgetSkeleton, UserConnectionsRequestsWidget, UserConnectionsRequestsWidgetProps, UserConnectionsRequestsWidgetSkeleton, UserConnectionsWidget, UserConnectionsWidgetProps, UserConnectionsWidgetSkeleton, UserCounters, UserCountersProps, UserDeletedSnackBar, UserDeletedSnackBarProps, UserFollowedCategoriesWidget, UserFollowedCategoriesWidgetProps, UserFollowedCategoriesWidgetSkeleton, UserFollowedUsersWidget, UserFollowedUsersWidgetProps, UserFollowedUsersWidgetSkeleton, UserFollowersWidget, UserFollowersWidgetProps, UserFollowersWidgetSkeleton, UserInfo, UserInfoDialog, UserInfoDialogProps, UserInfoProps, UserInfoSkeleton, UsernameTextField, UserProfileBlocked, UserProfileBlockedProps, UserProfileEdit, UserProfileEditProps, UserProfileEditSectionAccount, UserProfileEditSectionAccountProps, UserProfileEditSectionPublicInfo, UserProfileEditSectionPublicInfoProps, UserProfileEditSectionSettings, UserProfileEditSectionSettingsProps, UserProfileEditSkeleton, UserProfileHeader, UserProfileHeaderProps, UserProfileHeaderSkeleton, UserProps, UserSkeleton, UserSocialAssociation, UserSocialAssociationProps, UserSubscribedGroupsWidget, UserSubscribedGroupsWidgetProps, UserSubscribedGroupsWidgetSkeleton, UserSuggestionWidget, UserSuggestionWidgetProps, UserSuggestionWidgetSkeleton, useStickyBox, UseStickyBoxProps, VirtualScrollerItemProps, Widget, WidgetProps, X_SHARE };
|
package/lib/esm/index.js
CHANGED
|
@@ -37,6 +37,8 @@ import ConsentSolution, { ConsentSolutionSkeleton } from './components/ConsentSo
|
|
|
37
37
|
import ConsentSolutionButton from './components/ConsentSolutionButton';
|
|
38
38
|
import CreateEventButton from './components/CreateEventButton';
|
|
39
39
|
import CreateEventWidget, { CreateEventWidgetSkeleton } from './components/CreateEventWidget';
|
|
40
|
+
import EventForm from './components/EventForm';
|
|
41
|
+
import EventFormDialog from './components/EventFormDialog';
|
|
40
42
|
import CreateGroupButton from './components/CreateGroupButton';
|
|
41
43
|
import CustomAdv, { CustomAdvSkeleton } from './components/CustomAdv';
|
|
42
44
|
import EditEventButton from './components/EditEventButton';
|
|
@@ -47,6 +49,7 @@ import EventHeader, { EventHeaderSkeleton } from './components/EventHeader';
|
|
|
47
49
|
import EventInfoWidget from './components/EventInfoWidget';
|
|
48
50
|
import EventInviteButton from './components/EventInviteButton';
|
|
49
51
|
import EventLocationWidget, { EventLocationWidgetSkeleton } from './components/EventLocationWidget';
|
|
52
|
+
import EventMediaWidget, { EventMediaWidgetSkeleton } from './components/EventMediaWidget';
|
|
50
53
|
import EventMembersWidget, { EventMembersWidgetSkeleton } from './components/EventMembersWidget';
|
|
51
54
|
import EventParticipantsButton from './components/EventParticipantsButton';
|
|
52
55
|
import Events, { EventsSkeleton } from './components/Events';
|
|
@@ -79,7 +82,7 @@ import InviteUserEventButton from './components/InviteUserEventButton';
|
|
|
79
82
|
import LocationAutocomplete from './components/LocationAutocomplete';
|
|
80
83
|
import LoyaltyProgramWidget, { LoyaltyProgramWidgetSkeleton } from './components/LoyaltyProgramWidget';
|
|
81
84
|
import MyEventsWidget, { MyEventsWidgetSkeleton } from './components/MyEventsWidget';
|
|
82
|
-
import NavigationMenuIconButton, { NavigationMenuContent,
|
|
85
|
+
import NavigationMenuIconButton, { NavigationMenuContent, NavigationMenuDrawer, NavigationMenuHeader } from './components/NavigationMenuIconButton';
|
|
83
86
|
import DefaultDrawerContent from './components/NavigationMenuIconButton/DefaultDrawerContent';
|
|
84
87
|
import DefaultHeaderContent from './components/NavigationMenuIconButton/DefaultHeaderContent';
|
|
85
88
|
import NavigationSettingsIconButton from './components/NavigationSettingsIconButton';
|
|
@@ -132,7 +135,7 @@ import EventActionsMenu from './shared/EventActionsMenu';
|
|
|
132
135
|
import EventInfoDetails from './shared/EventInfoDetails';
|
|
133
136
|
import HiddenPlaceholder from './shared/HiddenPlaceholder';
|
|
134
137
|
import LanguageSwitcher from './shared/LanguageSwitcher';
|
|
135
|
-
import Lightbox from './shared/Lightbox';
|
|
138
|
+
import BaseLightbox, { Lightbox } from './shared/Lightbox';
|
|
136
139
|
import { File, Link, Share } from './shared/Media';
|
|
137
140
|
import MediaChunkUploader from './shared/MediaChunkUploader';
|
|
138
141
|
import PasswordTextField from './shared/PasswordTextField';
|
|
@@ -144,7 +147,7 @@ import UrlTextField from './shared/UrlTextField';
|
|
|
144
147
|
import UserAvatar from './shared/UserAvatar';
|
|
145
148
|
import UserDeletedSnackBar from './shared/UserDeletedSnackBar';
|
|
146
149
|
import UsernameTextField from './shared/UsernameTextField';
|
|
147
|
-
import { SCBroadcastMessageTemplateType, SCCommentsOrderBy, SCFeedObjectActivitiesType, SCFeedObjectTemplateType, SCNotificationObjectTemplateType, SCUserProfileFields, SCUserProfileSettings, SCUserSocialAssociations
|
|
150
|
+
import { SCBroadcastMessageTemplateType, SCCommentsOrderBy, SCEventTemplateType, SCFeedObjectActivitiesType, SCFeedObjectTemplateType, SCNotificationObjectTemplateType, SCUserProfileFields, SCUserProfileSettings, SCUserSocialAssociations } from './types';
|
|
148
151
|
/**
|
|
149
152
|
* Constants
|
|
150
153
|
*/
|
|
@@ -154,7 +157,6 @@ import { LEGAL_POLICIES } from './constants/LegalPolicies';
|
|
|
154
157
|
import { DEFAULT_PAGINATION_LIMIT, DEFAULT_PAGINATION_OFFSET, DEFAULT_PAGINATION_QUERY_PARAM_NAME } from './constants/Pagination';
|
|
155
158
|
import { FACEBOOK_SHARE, LINKEDIN_SHARE, X_SHARE } from './constants/SocialShare';
|
|
156
159
|
import { DEFAULT_FIELDS } from './constants/UserProfile';
|
|
157
|
-
import { SCTopicType, SCGroupEventType } from './constants/PubSub';
|
|
158
160
|
/**
|
|
159
161
|
* Utilities
|
|
160
162
|
*/
|
|
@@ -174,12 +176,12 @@ import LogoSelfCommunity from './assets/logo';
|
|
|
174
176
|
/**
|
|
175
177
|
* List all exports
|
|
176
178
|
*/
|
|
177
|
-
export { AcceptRequestUserEventButton, AccountChangeMailValidation, AccountDataPortability, AccountDataPortabilityButton, AccountDelete, AccountDeleteButton, AccountRecover, AccountReset, AccountVerify, AvatarGroupSkeleton, BaseDialog, BaseItem, BottomNavigation, BroadcastMessages, BroadcastMessagesSkeleton, bytesToSize, Calendar, Categories, CategoriesPopularWidget, CategoriesPopularWidgetSkeleton, CategoriesSkeleton, CategoriesSuggestionWidget, CategoriesSuggestionWidgetSkeleton, Category, CategoryAutocomplete, CategoryFollowButton, CategoryFollowersButton, CategoryHeader, CategoryHeaderSkeleton, CategorySkeleton, CategoryTrendingFeedWidget, CategoryTrendingFeedWidgetSkeleton, CategoryTrendingPeopleWidgetSkeleton, CategoryTrendingUsersWidget, CentralProgress, ChangeCover, ChangeGroupCover, ChangeGroupPicture, ChangePicture, CommentObject, CommentObjectReply, CommentObjectSkeleton, CommentsFeedObject, CommentsFeedObjectSkeleton, CommentsObject, CommentsObjectSkeleton, Composer, ComposerIconButton, ConfirmDialog, ConnectionUserButton,
|
|
179
|
+
export { AcceptRequestUserEventButton, AccountChangeMailValidation, AccountDataPortability, AccountDataPortabilityButton, AccountDelete, AccountDeleteButton, AccountRecover, AccountReset, AccountVerify, AvatarGroupSkeleton, BaseDialog, BaseItem, BaseLightbox, BottomNavigation, BroadcastMessages, BroadcastMessagesSkeleton, bytesToSize, Calendar, Categories, CategoriesPopularWidget, CategoriesPopularWidgetSkeleton, CategoriesSkeleton, CategoriesSuggestionWidget, CategoriesSuggestionWidgetSkeleton, Category, CategoryAutocomplete, CategoryFollowButton, CategoryFollowersButton, CategoryHeader, CategoryHeaderSkeleton, CategorySkeleton, CategoryTrendingFeedWidget, CategoryTrendingFeedWidgetSkeleton, CategoryTrendingPeopleWidgetSkeleton, CategoryTrendingUsersWidget, CentralProgress, ChangeCover, ChangeGroupCover, ChangeGroupPicture, ChangePicture, CommentObject, CommentObjectReply, CommentObjectSkeleton, CommentsFeedObject, CommentsFeedObjectSkeleton, CommentsObject, CommentsObjectSkeleton, Composer, ComposerIconButton, ConfirmDialog, ConnectionUserButton,
|
|
178
180
|
/* SC CONSENT SOLUTION */
|
|
179
|
-
ConsentSolution, ConsentSolutionButton, ConsentSolutionSkeleton, ContributionUtils, CreateEventButton, CreateEventWidget, CreateEventWidgetSkeleton, CreateGroupButton, CustomAdv, CustomAdvSkeleton, DEFAULT_FIELDS, DEFAULT_PAGINATION_LIMIT, DEFAULT_PAGINATION_OFFSET,
|
|
181
|
+
ConsentSolution, ConsentSolutionButton, ConsentSolutionSkeleton, ContributionUtils, CreateEventButton, CreateEventWidget, CreateEventWidgetSkeleton, CreateGroupButton, EventForm, EventFormDialog, CustomAdv, CustomAdvSkeleton, DEFAULT_FIELDS, DEFAULT_PAGINATION_LIMIT, DEFAULT_PAGINATION_OFFSET,
|
|
180
182
|
/* SC UI PAGINATION */
|
|
181
|
-
DEFAULT_PAGINATION_QUERY_PARAM_NAME, DEFAULT_PRELOAD_OFFSET_VIEWPORT, DEFAULT_WIDGETS_NUMBER, DefaultDrawerContent, DefaultHeaderContent,
|
|
183
|
+
DEFAULT_PAGINATION_QUERY_PARAM_NAME, DEFAULT_PRELOAD_OFFSET_VIEWPORT, DEFAULT_WIDGETS_NUMBER, DefaultDrawerContent, DefaultHeaderContent, EditEventButton, EditGroupButton, Editor, EditorSkeleton, EmailTextField, Event, EventActionsMenu, EventHeader, EventHeaderSkeleton, EventInfoDetails, EventInfoWidget, EventInviteButton, EventLocationWidget, EventLocationWidgetSkeleton, EventMediaWidget, EventMediaWidgetSkeleton, EventMembersWidget, EventMembersWidgetSkeleton, EventParticipantsButton, Events, EventSkeleton, EventsSkeleton, FACEBOOK_SHARE, Feed, FeedObject, FeedObjectMediaPreview, FeedObjectSkeleton, FeedSkeleton, FeedUpdatesWidget, FeedUpdatesWidgetSkeleton, File, FollowUserButton, Footer, FooterSkeleton, FriendshipUserButton, GenericSkeleton, getRelativeTime, getUnseenNotification, getUnseenNotificationCounter, Group, GroupActionsMenu, GroupForm, GroupHeader, GroupHeaderSkeleton, GroupInfoWidget, GroupInfoWidgetSkeleton, GroupInviteButton, GroupInvitedWidget, GroupInvitedWidgetSkeleton, GroupMembersButton, GroupMembersWidget, GroupMembersWidgetSkeleton, GroupRequestsWidget, GroupRequestsWidgetSkeleton, Groups, GroupSettingsIconButton, GroupSkeleton, GroupsSkeleton, GroupSubscribeButton,
|
|
182
184
|
/* SC UI SHARED */
|
|
183
185
|
HiddenPlaceholder, Incubator, IncubatorDetail, IncubatorListWidget, IncubatorSubscribeButton, IncubatorSuggestionWidget, InfiniteScroll, InlineComposerWidget, InlineComposerWidgetSkeleton, InviteUserEventButton, LanguageSwitcher, LEGAL_POLICIES, Lightbox, Link, LINKEDIN_SHARE, LocationAutocomplete,
|
|
184
186
|
/* Assets */
|
|
185
|
-
LogoSelfCommunity, LoyaltyProgramWidget, LoyaltyProgramWidgetSkeleton, MAX_PRELOAD_OFFSET_VIEWPORT, MEDIA_EMBED_SC_LINK_TYPE, MEDIA_EMBED_SC_SHARED_EVENT, MEDIA_EMBED_SC_SHARED_OBJECT, MEDIA_TYPE_DOCUMENT, MEDIA_TYPE_EMBED, MEDIA_TYPE_EVENT, MEDIA_TYPE_IMAGE, MEDIA_TYPE_LINK, MEDIA_TYPE_SHARE, MEDIA_TYPE_URL, MEDIA_TYPE_VIDEO, MediaChunkUploader, MessageUploaderUtils, MetadataField, MIN_PRELOAD_OFFSET_VIEWPORT, MyEventsWidget, MyEventsWidgetSkeleton, NavigationMenuContent, NavigationMenuHeader, NavigationMenuIconButton,
|
|
187
|
+
LogoSelfCommunity, LoyaltyProgramWidget, LoyaltyProgramWidgetSkeleton, MAX_PRELOAD_OFFSET_VIEWPORT, MEDIA_EMBED_SC_LINK_TYPE, MEDIA_EMBED_SC_SHARED_EVENT, MEDIA_EMBED_SC_SHARED_OBJECT, MEDIA_TYPE_DOCUMENT, MEDIA_TYPE_EMBED, MEDIA_TYPE_EVENT, MEDIA_TYPE_IMAGE, MEDIA_TYPE_LINK, MEDIA_TYPE_SHARE, MEDIA_TYPE_URL, MEDIA_TYPE_VIDEO, MediaChunkUploader, MessageUploaderUtils, MetadataField, MIN_PRELOAD_OFFSET_VIEWPORT, MyEventsWidget, MyEventsWidgetSkeleton, NavigationMenuContent, NavigationMenuDrawer, NavigationMenuHeader, NavigationMenuIconButton, NavigationSettingsIconButton, NavigationToolbar, NavigationToolbarMobile, NavigationToolbarMobileSkeleton, NavigationToolbarSkeleton, Notification, NotificationSkeleton, OnBoardingWidget, OnBoardingWidgetSkeleton, PasswordTextField, PhoneTextField, PlatformWidget, PlatformWidgetSkeleton, PollSuggestionWidget, PrivateMessageComponent, PrivateMessageComponentSkeleton, PrivateMessageEditor, PrivateMessageEditorSkeleton, PrivateMessageSettingsIconButton, PrivateMessageSnippetItem, PrivateMessageSnippetItemSkeleton, PrivateMessageSnippets, PrivateMessageSnippetsSkeleton, PrivateMessageThread, PrivateMessageThreadItem, PrivateMessageThreadItemSkeleton, PrivateMessageThreadSkeleton, ProgressBar, RelatedEventsWidget, RelatedEventsWidgetSkeleton, RelatedFeedObjectsWidget, RelatedFeedObjectsWidgetSkeleton, ReplyComment, SCBroadcastMessageTemplateType, SCCommentsOrderBy, SCEventTemplateType, SCFeedObjectActivitiesType, SCFeedObjectTemplateType, SCNotificationObjectTemplateType, SCUserProfileFields, SCUserProfileSettings, SCUserSocialAssociations, SearchAutocomplete, SearchDialog, Share, SnippetNotifications, SnippetNotificationsSkeleton, StickyBox, SuggestedEventsWidget, SuggestedEventsWidgetSkeleton, TagChip, ToastNotifications, ToastNotificationsSkeleton, UrlTextField, User, UserActionIconButton, UserAvatar, UserConnectionsRequestsSentWidget, UserConnectionsRequestsSentWidgetSkeleton, UserConnectionsRequestsWidget, UserConnectionsRequestsWidgetSkeleton, UserConnectionsWidget, UserConnectionsWidgetSkeleton, UserCounters, UserDeletedSnackBar, UserFollowedCategoriesWidget, UserFollowedCategoriesWidgetSkeleton, UserFollowedUsersWidget, UserFollowedUsersWidgetSkeleton, UserFollowersWidget, UserFollowersWidgetSkeleton, UserInfo, UserInfoDialog, UserInfoSkeleton, UsernameTextField, UserProfileBlocked, UserProfileEdit, UserProfileEditSectionAccount, UserProfileEditSectionPublicInfo, UserProfileEditSectionSettings, UserProfileEditSkeleton, UserProfileHeader, UserProfileHeaderSkeleton, UserSkeleton, UserSocialAssociation, UserSubscribedGroupsWidget, UserSubscribedGroupsWidgetSkeleton, UserSuggestionWidget, UserSuggestionWidgetSkeleton, useStickyBox, Widget, X_SHARE };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MouseEvent, TouchEvent } from 'react';
|
|
2
|
+
import { PhotoProviderBase } from 'react-photo-view/dist/types';
|
|
3
|
+
import { DataType } from '../../types/lightbox';
|
|
4
|
+
/**
|
|
5
|
+
* Overrides/extends the styles applied to the component.
|
|
6
|
+
* @default null
|
|
7
|
+
*/
|
|
8
|
+
export interface BaseLightboxProps extends PhotoProviderBase {
|
|
9
|
+
className?: string;
|
|
10
|
+
images: DataType[];
|
|
11
|
+
index?: number;
|
|
12
|
+
onIndexChange?: (index: number) => void;
|
|
13
|
+
visible?: boolean;
|
|
14
|
+
onClose?: (evt?: MouseEvent | TouchEvent) => void;
|
|
15
|
+
afterClose?: () => void;
|
|
16
|
+
toolbarButtons?: JSX.Element;
|
|
17
|
+
}
|
|
18
|
+
declare const BaseLightbox: (props: BaseLightboxProps) => JSX.Element;
|
|
19
|
+
export default BaseLightbox;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { CircularProgress } from '@mui/material';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { useCallback, useState } from 'react';
|
|
6
|
+
import { PhotoSlider } from 'react-photo-view';
|
|
7
|
+
import { PREFIX } from './constants';
|
|
8
|
+
const classes = {
|
|
9
|
+
root: `${PREFIX}-root`
|
|
10
|
+
};
|
|
11
|
+
const Root = styled(PhotoSlider, {
|
|
12
|
+
name: PREFIX,
|
|
13
|
+
slot: 'Root',
|
|
14
|
+
overridesResolver: (_props, styles) => styles.root
|
|
15
|
+
})(() => ({}));
|
|
16
|
+
const BaseLightbox = (props) => {
|
|
17
|
+
const { images = [], index, onClose, visible = true, afterClose, onIndexChange, toolbarRender, toolbarButtons } = props, rest = __rest(props, ["images", "index", "onClose", "visible", "afterClose", "onIndexChange", "toolbarRender", "toolbarButtons"]);
|
|
18
|
+
// STATE
|
|
19
|
+
const [currentImageIndex, setCurrentImageIndex] = useState(index || 0);
|
|
20
|
+
const handleIndexChange = useCallback((index) => {
|
|
21
|
+
onIndexChange === null || onIndexChange === void 0 ? void 0 : onIndexChange(index);
|
|
22
|
+
setCurrentImageIndex(index);
|
|
23
|
+
}, [onIndexChange, setCurrentImageIndex]);
|
|
24
|
+
/**
|
|
25
|
+
* Renders root object
|
|
26
|
+
*/
|
|
27
|
+
return (_jsx(Root, Object.assign({}, rest, { className: classes.root, images: images, visible: visible && index !== -1, index: currentImageIndex, onIndexChange: handleIndexChange, onClose: onClose, afterClose: afterClose, loadingElement: _jsx(CircularProgress, { color: 'primary' }), toolbarRender: toolbarRender
|
|
28
|
+
? toolbarRender
|
|
29
|
+
: () => {
|
|
30
|
+
return toolbarButtons;
|
|
31
|
+
} })));
|
|
32
|
+
};
|
|
33
|
+
export default BaseLightbox;
|
|
@@ -1,19 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { SCMediaType } from '@selfcommunity/types/src/types';
|
|
2
|
+
export interface LightboxProps {
|
|
3
|
+
/**
|
|
4
|
+
* Images objs
|
|
5
|
+
* @default []
|
|
6
|
+
*/
|
|
7
|
+
medias: SCMediaType[];
|
|
8
|
+
/**
|
|
9
|
+
* Obj index
|
|
10
|
+
* @default 0
|
|
11
|
+
*/
|
|
12
|
+
index: number;
|
|
13
|
+
/**
|
|
14
|
+
* Toolbar
|
|
15
|
+
* @default undefined
|
|
16
|
+
*/
|
|
17
|
+
toolbarButtons?: JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* Handles on close
|
|
20
|
+
* @default () => void
|
|
21
|
+
*/
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Handles on index change
|
|
25
|
+
* @default undefined
|
|
26
|
+
*/
|
|
12
27
|
onIndexChange?: (index: number) => void;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Any other properties
|
|
30
|
+
*/
|
|
31
|
+
[p: string]: any;
|
|
17
32
|
}
|
|
18
|
-
|
|
19
|
-
export default ReactImageLightbox;
|
|
33
|
+
export default function Lightbox(props: LightboxProps): JSX.Element;
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx
|
|
3
|
-
import { useState } from 'react';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
3
|
import { styled } from '@mui/material/styles';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
4
|
+
import { useCallback } from 'react';
|
|
5
|
+
import BaseLightbox from './BaseLightbox';
|
|
6
|
+
import { PREFIX } from './constants';
|
|
8
7
|
const classes = {
|
|
9
|
-
root: `${PREFIX}-root`
|
|
8
|
+
root: `${PREFIX}-lightbox-root`
|
|
10
9
|
};
|
|
11
|
-
const Root = styled(
|
|
10
|
+
const Root = styled(BaseLightbox, {
|
|
12
11
|
name: PREFIX,
|
|
13
|
-
slot: '
|
|
14
|
-
overridesResolver: (props, styles) => styles.root
|
|
12
|
+
slot: 'LightboxRoot'
|
|
15
13
|
})(() => ({}));
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
14
|
+
export default function Lightbox(props) {
|
|
15
|
+
// PROPS
|
|
16
|
+
const { medias = [], index = 0, toolbarButtons, onClose, onIndexChange } = props, rest = __rest(props, ["medias", "index", "toolbarButtons", "onClose", "onIndexChange"]);
|
|
17
|
+
const mediaToDataTypeMap = useCallback((media, index) => {
|
|
18
|
+
return { src: media.image, width: media.image_width, height: media.image_height, key: index };
|
|
19
|
+
}, []);
|
|
21
20
|
/**
|
|
22
21
|
* Renders root object
|
|
23
22
|
*/
|
|
24
|
-
return (_jsx(Root, Object.assign({}, rest, { className: classes.root, images:
|
|
25
|
-
|
|
26
|
-
} })));
|
|
27
|
-
};
|
|
28
|
-
export default ReactImageLightbox;
|
|
23
|
+
return (_jsx(Root, Object.assign({}, rest, { className: classes.root, images: medias.map(mediaToDataTypeMap), visible: index !== -1, onClose: onClose, index: index, onIndexChange: onIndexChange, toolbarButtons: toolbarButtons })));
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCLightbox";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PREFIX = 'SCLightbox';
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import BaseLightbox, { BaseLightboxProps } from './BaseLightbox';
|
|
2
|
+
import Lightbox, { LightboxProps } from './Lightbox';
|
|
3
|
+
export default BaseLightbox;
|
|
4
|
+
export { BaseLightboxProps, Lightbox, LightboxProps };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { Box, Grid, IconButton, Typography } from '@mui/material';
|
|
3
|
+
import Icon from '@mui/material/Icon';
|
|
3
4
|
import { styled } from '@mui/material/styles';
|
|
4
|
-
import
|
|
5
|
-
import { Box, Grid, Typography } from '@mui/material';
|
|
5
|
+
import { Link } from '@selfcommunity/react-core';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import
|
|
7
|
+
import { MEDIA_TYPE_DOCUMENT } from '../../../constants/Media';
|
|
8
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
8
9
|
import { useInView } from 'react-intersection-observer';
|
|
10
|
+
import { Lightbox } from '../../Lightbox';
|
|
9
11
|
import { PREFIX } from './constants';
|
|
10
12
|
import filter from './filter';
|
|
11
13
|
const classes = {
|
|
@@ -27,18 +29,20 @@ const classes = {
|
|
|
27
29
|
const Root = styled(Box, {
|
|
28
30
|
name: PREFIX,
|
|
29
31
|
slot: 'DisplayRoot'
|
|
30
|
-
})(({
|
|
32
|
+
})(({}) => ({}));
|
|
31
33
|
export default (props) => {
|
|
32
34
|
// PROPS
|
|
33
35
|
const { className = '', medias = [], maxVisible = 5, gallery = true, onMediaClick = null } = props;
|
|
34
36
|
// STATE
|
|
35
37
|
const [preview, setPreview] = useState(-1);
|
|
38
|
+
const [toolbarButtons, setToolbarButtons] = useState(undefined);
|
|
36
39
|
const { ref, inView } = useInView({ triggerOnce: false });
|
|
37
40
|
// MEMO
|
|
38
41
|
const _medias = useMemo(() => medias.filter(filter), [medias]);
|
|
39
42
|
// HANDLERS
|
|
40
43
|
const handleClose = () => {
|
|
41
44
|
setPreview(-1);
|
|
45
|
+
setToolbarButtons(undefined);
|
|
42
46
|
};
|
|
43
47
|
// UTILS
|
|
44
48
|
const getImageUrl = (image, original = false) => {
|
|
@@ -110,6 +114,19 @@ export default (props) => {
|
|
|
110
114
|
more && (_jsx("div", Object.assign({ className: classes.coverText, style: { fontSize: '200%' } }, { children: _jsxs("p", { children: ["+", extra] }) }), "count-sub"))
|
|
111
115
|
];
|
|
112
116
|
};
|
|
117
|
+
const handleIndexChange = useCallback((index) => {
|
|
118
|
+
if (_medias[index].type === MEDIA_TYPE_DOCUMENT) {
|
|
119
|
+
setToolbarButtons(_jsx(IconButton, Object.assign({ component: Link, to: medias[index].url, target: "_blank", color: "inherit" }, { children: _jsx(Icon, { children: "download" }) })));
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
setToolbarButtons(undefined);
|
|
123
|
+
}
|
|
124
|
+
}, [_medias, setToolbarButtons]);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (preview !== -1) {
|
|
127
|
+
handleIndexChange(preview);
|
|
128
|
+
}
|
|
129
|
+
}, [preview]);
|
|
113
130
|
const imagesToShow = [..._medias];
|
|
114
131
|
if (maxVisible && _medias.length > maxVisible) {
|
|
115
132
|
imagesToShow.length = maxVisible;
|
|
@@ -117,5 +134,5 @@ export default (props) => {
|
|
|
117
134
|
if (_medias.length === 0) {
|
|
118
135
|
return null;
|
|
119
136
|
}
|
|
120
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.displayRoot, className) }, { children: [[1, 3, 4].includes(imagesToShow.length) && renderOne(), imagesToShow.length >= 2 && imagesToShow.length != 4 && renderTwo(), imagesToShow.length >= 4 && renderThree(), preview !== -1 && _jsx(Lightbox, { onClose: handleClose, index: preview, medias: _medias })] })));
|
|
137
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.displayRoot, className) }, { children: [[1, 3, 4].includes(imagesToShow.length) && renderOne(), imagesToShow.length >= 2 && imagesToShow.length != 4 && renderTwo(), imagesToShow.length >= 4 && renderThree(), preview !== -1 && (_jsx(Lightbox, { onClose: handleClose, index: preview, medias: _medias, toolbarButtons: toolbarButtons, onIndexChange: handleIndexChange }))] })));
|
|
121
138
|
};
|