@selfcommunity/react-ui 1.2.5-alpha.4 → 1.2.5-alpha.5

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.
@@ -1,5 +1,5 @@
1
1
  import { BoxProps } from '@mui/material';
2
- import { SCCourseType } from '@selfcommunity/types';
2
+ import { SCCourseType, SCCourseTypologyType } from '@selfcommunity/types';
3
3
  import { SCCourseFormStepType } from '../../constants/Course';
4
4
  export interface CourseFormProps extends BoxProps {
5
5
  /**
@@ -26,7 +26,7 @@ export interface CourseFormProps extends BoxProps {
26
26
  * On step change callback function
27
27
  * @default null
28
28
  */
29
- onStepChange?: (step: SCCourseFormStepType, type: SCCourseType) => void;
29
+ onStepChange?: (step: SCCourseFormStepType, type: SCCourseTypologyType) => void;
30
30
  /**
31
31
  * On error callback function
32
32
  * @default null
@@ -116,7 +116,7 @@ function CourseForm(inProps) {
116
116
  imageOriginal: (course === null || course === void 0 ? void 0 : course.image_bigger) || '',
117
117
  imageOriginalFile: '',
118
118
  name: (course === null || course === void 0 ? void 0 : course.name) || '',
119
- type: (course === null || course === void 0 ? void 0 : course.type) || '',
119
+ type: (course === null || course === void 0 ? void 0 : course.type) || types_1.SCCourseTypologyType.SELF,
120
120
  description: course ? course.description : '',
121
121
  categories: course ? course.categories : [],
122
122
  privacy: course ? course.privacy : '',
@@ -160,7 +160,7 @@ function CourseForm(inProps) {
160
160
  */
161
161
  const handleChangeStep = (newStep) => {
162
162
  setStep(newStep);
163
- onStepChange(newStep, field.type);
163
+ onStepChange === null || onStepChange === void 0 ? void 0 : onStepChange(newStep, field.type);
164
164
  };
165
165
  /**
166
166
  * Formats categories object to a specific format needed in the form body
@@ -4,6 +4,7 @@ const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
6
  const system_1 = require("@mui/system");
7
+ const types_1 = require("@selfcommunity/types");
7
8
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
8
9
  const react_intl_1 = require("react-intl");
9
10
  const BaseDialog_1 = tslib_1.__importDefault(require("../../shared/BaseDialog"));
@@ -45,9 +46,9 @@ function CourseFormDialog(inProps) {
45
46
  });
46
47
  const { className, open = true, onClose, CourseFormComponentProps = {} } = props, rest = tslib_1.__rest(props, ["className", "open", "onClose", "CourseFormComponentProps"]);
47
48
  // STATE
48
- // TODO - temporary hardcoded CUSTOMIZATION and 'self-paced' --> previous value: GENERAL and ''
49
+ // TODO - temporary hardcoded CUSTOMIZATION and SELF --> previous value: GENERAL and ''
49
50
  const [step, setStep] = (0, react_1.useState)(Course_1.SCCourseFormStepType.CUSTOMIZATION);
50
- const [type, setType] = (0, react_1.useState)('self-paced');
51
+ const [type, setType] = (0, react_1.useState)(types_1.SCCourseTypologyType.SELF);
51
52
  //HANDLERS
52
53
  const handleStepTypeChange = (step, type) => {
53
54
  setStep(step);
@@ -35,4 +35,4 @@ export interface CreateCourseButtonProps extends ButtonProps {
35
35
 
36
36
  * @param inProps
37
37
  */
38
- export default function CreateCourseButton(inProps: CreateCourseButtonProps): JSX.Element;
38
+ export default function CreateCourseButton(inProps: CreateCourseButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -17,7 +17,7 @@ const classes = {
17
17
  const Root = (0, material_1.styled)(material_1.Button, {
18
18
  name: PREFIX,
19
19
  slot: 'Root',
20
- overridesResolver: (props, styles) => styles.root
20
+ overridesResolver: (_props, styles) => styles.root
21
21
  })(() => ({}));
22
22
  /**
23
23
  *> API documentation for the Community-JS Create Group Button component. Learn about the available props and the CSS API.
@@ -23,7 +23,7 @@ export interface ImagePreviewComponentProps {
23
23
  /**
24
24
  * Handles on media click
25
25
  */
26
- onMediaClick?: (any: any) => void;
26
+ onMediaClick?: (media: SCMediaType) => void;
27
27
  }
28
- declare const _default: (props: ImagePreviewComponentProps) => JSX.Element;
28
+ declare const _default: (props: ImagePreviewComponentProps) => import("react/jsx-runtime").JSX.Element;
29
29
  export default _default;
@@ -36,7 +36,7 @@ const Root = (0, material_1.styled)(material_1.Stack, {
36
36
  })(() => ({}));
37
37
  exports.default = (props) => {
38
38
  // PROPS
39
- const { className = '', medias = [], maxVisible = 5, gallery = true, onMediaClick = null } = props;
39
+ const { className = '', medias = [], maxVisible = 5, gallery = true, onMediaClick = undefined } = props;
40
40
  // STATE
41
41
  const [preview, setPreview] = (0, react_1.useState)(-1);
42
42
  const [toolbarButtons, setToolbarButtons] = (0, react_1.useState)(undefined);
@@ -86,8 +86,10 @@ exports.default = (props) => {
86
86
  const renderOne = () => {
87
87
  const overlay = images.length > maxVisible && maxVisible == 1 ? renderCountOverlay(true) : renderOverlay(0);
88
88
  const isGif = images[0]['image_mimetype'] ? images[0]['image_mimetype'].includes('image/gif') : false;
89
- const isLandscape = images[0].image_height < images[0].image_width;
90
- return ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, width: "100%", style: Object.assign({}, (images[0].image_thumbnail && images[0].image_thumbnail.color ? { backgroundColor: images[0].image_thumbnail.color } : {})) }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ ref: ref, size: 12, className: (0, classnames_1.default)(classes.border, classes.heightOne, Object.assign(Object.assign({}, (isGif || isLandscape ? { [classes.background]: true } : { [classes.backgroundPortrait]: true })), { [classes.gallery]: gallery, [classes.heightHalfOne]: images.length > 1 })), onClick: () => openPreviewImage(0), style: Object.assign({ background: `url(${getImageUrl(images[0], inView && isGif)})` }, (isLandscape ? { paddingTop: `${(100 * images[0].image_height) / images[0].image_width}%` } : {})) }, { children: [overlay, renderTitle(images[0])] })) })));
89
+ const isLandscape = images[0].image_height && images[0].image_width && images[0].image_height < images[0].image_width;
90
+ return ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, width: "100%", style: Object.assign({}, (images[0].image_thumbnail && images[0].image_thumbnail.color ? { backgroundColor: images[0].image_thumbnail.color } : {})) }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ ref: ref, size: 12, className: (0, classnames_1.default)(classes.border, classes.heightOne, Object.assign(Object.assign({}, (isGif || isLandscape ? { [classes.background]: true } : { [classes.backgroundPortrait]: true })), { [classes.gallery]: gallery, [classes.heightHalfOne]: images.length > 1 })), onClick: () => openPreviewImage(0), style: Object.assign({ background: `url(${getImageUrl(images[0], inView && isGif)})` }, (isLandscape && images[0].image_height && images[0].image_width
91
+ ? { paddingTop: `${(100 * images[0].image_height) / images[0].image_width}%` }
92
+ : {})) }, { children: [overlay, renderTitle(images[0])] })) })));
91
93
  };
92
94
  const renderTwo = () => {
93
95
  const overlay = images.length > maxVisible && [2, 3].includes(+maxVisible) ? renderCountOverlay(true) : renderOverlay(1);
@@ -124,7 +126,7 @@ exports.default = (props) => {
124
126
  const url = window.URL.createObjectURL(blob);
125
127
  const link = document.createElement('a');
126
128
  link.href = url;
127
- link.download = docs[index].title;
129
+ link.download = docs[index].title || '';
128
130
  link.click();
129
131
  // Cleanup
130
132
  window.URL.revokeObjectURL(url);
@@ -73,6 +73,6 @@ function DocComponent(props) {
73
73
  return fallback_1.default;
74
74
  }
75
75
  }, [document.mimetype]);
76
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.docRoot, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "img", alt: document.title, src: getImage() }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.textWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.title, classes.contrastColor) }, { children: document.title })), document.size && (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.subtitle, classes.contrastColor) }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "delete" }) }))), handleDownload && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [document.mimetype === types_1.SCMimeTypes.PDF && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, component: react_core_1.Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility" }) }))), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "download" }) }))] }))] })))] })));
76
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.docRoot, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "img", alt: document.title, src: getImage() }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.textWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.title, classes.contrastColor) }, { children: document.title })), document.size && (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.subtitle, classes.contrastColor) }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "delete" }) }))), handleDownload && index && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [document.mimetype === types_1.SCMimeTypes.PDF && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, component: react_core_1.Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility" }) }))), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "download" }) }))] }))] })))] })));
77
77
  }
78
78
  exports.default = DocComponent;
@@ -32,7 +32,7 @@ const PreviewComponent = (0, react_1.forwardRef)((props, ref) => {
32
32
  // EFFECTS
33
33
  (0, react_1.useEffect)(() => {
34
34
  if (typeof document === undefined) {
35
- return null;
35
+ return;
36
36
  }
37
37
  const sortable = document.getElementById(SORTABLE_ID);
38
38
  if (sortable) {
@@ -1,5 +1,5 @@
1
1
  import { BoxProps } from '@mui/material';
2
- import { SCCourseType } from '@selfcommunity/types';
2
+ import { SCCourseType, SCCourseTypologyType } from '@selfcommunity/types';
3
3
  import { SCCourseFormStepType } from '../../constants/Course';
4
4
  export interface CourseFormProps extends BoxProps {
5
5
  /**
@@ -26,7 +26,7 @@ export interface CourseFormProps extends BoxProps {
26
26
  * On step change callback function
27
27
  * @default null
28
28
  */
29
- onStepChange?: (step: SCCourseFormStepType, type: SCCourseType) => void;
29
+ onStepChange?: (step: SCCourseFormStepType, type: SCCourseTypologyType) => void;
30
30
  /**
31
31
  * On error callback function
32
32
  * @default null
@@ -114,7 +114,7 @@ export default function CourseForm(inProps) {
114
114
  imageOriginal: (course === null || course === void 0 ? void 0 : course.image_bigger) || '',
115
115
  imageOriginalFile: '',
116
116
  name: (course === null || course === void 0 ? void 0 : course.name) || '',
117
- type: (course === null || course === void 0 ? void 0 : course.type) || '',
117
+ type: (course === null || course === void 0 ? void 0 : course.type) || SCCourseTypologyType.SELF,
118
118
  description: course ? course.description : '',
119
119
  categories: course ? course.categories : [],
120
120
  privacy: course ? course.privacy : '',
@@ -158,7 +158,7 @@ export default function CourseForm(inProps) {
158
158
  */
159
159
  const handleChangeStep = (newStep) => {
160
160
  setStep(newStep);
161
- onStepChange(newStep, field.type);
161
+ onStepChange === null || onStepChange === void 0 ? void 0 : onStepChange(newStep, field.type);
162
162
  };
163
163
  /**
164
164
  * Formats categories object to a specific format needed in the form body
@@ -2,6 +2,7 @@ import { __rest } from "tslib";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { styled } from '@mui/material';
4
4
  import { useThemeProps } from '@mui/system';
5
+ import { SCCourseTypologyType } from '@selfcommunity/types';
5
6
  import classNames from 'classnames';
6
7
  import { FormattedMessage } from 'react-intl';
7
8
  import BaseDialog from '../../shared/BaseDialog';
@@ -43,9 +44,9 @@ export default function CourseFormDialog(inProps) {
43
44
  });
44
45
  const { className, open = true, onClose, CourseFormComponentProps = {} } = props, rest = __rest(props, ["className", "open", "onClose", "CourseFormComponentProps"]);
45
46
  // STATE
46
- // TODO - temporary hardcoded CUSTOMIZATION and 'self-paced' --> previous value: GENERAL and ''
47
+ // TODO - temporary hardcoded CUSTOMIZATION and SELF --> previous value: GENERAL and ''
47
48
  const [step, setStep] = useState(SCCourseFormStepType.CUSTOMIZATION);
48
- const [type, setType] = useState('self-paced');
49
+ const [type, setType] = useState(SCCourseTypologyType.SELF);
49
50
  //HANDLERS
50
51
  const handleStepTypeChange = (step, type) => {
51
52
  setStep(step);
@@ -35,4 +35,4 @@ export interface CreateCourseButtonProps extends ButtonProps {
35
35
 
36
36
  * @param inProps
37
37
  */
38
- export default function CreateCourseButton(inProps: CreateCourseButtonProps): JSX.Element;
38
+ export default function CreateCourseButton(inProps: CreateCourseButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -15,7 +15,7 @@ const classes = {
15
15
  const Root = styled(Button, {
16
16
  name: PREFIX,
17
17
  slot: 'Root',
18
- overridesResolver: (props, styles) => styles.root
18
+ overridesResolver: (_props, styles) => styles.root
19
19
  })(() => ({}));
20
20
  /**
21
21
  *> API documentation for the Community-JS Create Group Button component. Learn about the available props and the CSS API.
package/lib/esm/index.js CHANGED
@@ -238,7 +238,9 @@ export { AcceptRequestUserEventButton, AccountChangeMailValidation, AccountDataP
238
238
  /* SC CONSENT SOLUTION */
239
239
  ConsentSolution, ConsentSolutionButton, ConsentSolutionSkeleton, ContributionUtils, SCCourseEditTabType, Course, CourseSkeleton, CourseJoinButton, Courses, CoursesSkeleton, CourseTypePopover, CreateCourseButton, CourseContentMenu, CourseDashboard, TeacherSkeleton, StudentSkeleton, CreateEventButton, CreateEventWidget, CreateEventWidgetSkeleton, CreateGroupButton, EventForm, EventFormDialog, CustomAdv, CustomAdvSkeleton, DEFAULT_FIELDS, DEFAULT_PAGINATION_LIMIT, DEFAULT_PAGINATION_OFFSET,
240
240
  /* SC UI PAGINATION */
241
- DEFAULT_PAGINATION_QUERY_PARAM_NAME, DEFAULT_PRELOAD_OFFSET_VIEWPORT, DEFAULT_WIDGETS_NUMBER, DefaultDrawerContent, DefaultHeaderContent, DefaultDrawerSkeleton, EditEventButton, EditGroupButton, Editor, EditorSkeleton, EmailTextField, EditCourse, EditCourseSkeleton, 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, getUrlLesson, Group, GroupActionsMenu, GroupForm, GroupHeader, GroupHeaderSkeleton, GroupInfoWidget, GroupInfoWidgetSkeleton, GroupInviteButton, GroupInvitedWidget, GroupInvitedWidgetSkeleton, GroupMembersButton, GroupMembersWidget, GroupMembersWidgetSkeleton, GroupRequestsWidget, GroupRequestsWidgetSkeleton, Groups, GroupSettingsIconButton, GroupSkeleton, GroupsSkeleton, GroupSubscribeButton,
241
+ DEFAULT_PAGINATION_QUERY_PARAM_NAME, DEFAULT_PRELOAD_OFFSET_VIEWPORT, DEFAULT_WIDGETS_NUMBER, DefaultDrawerContent, DefaultHeaderContent, DefaultDrawerSkeleton, EditEventButton, EditGroupButton, Editor, EditorSkeleton, EmailTextField, EditCourse, EditCourseSkeleton,
242
+ /* EVENTS */
243
+ 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, getUrlLesson, Group, GroupActionsMenu, GroupForm, GroupHeader, GroupHeaderSkeleton, GroupInfoWidget, GroupInfoWidgetSkeleton, GroupInviteButton, GroupInvitedWidget, GroupInvitedWidgetSkeleton, GroupMembersButton, GroupMembersWidget, GroupMembersWidgetSkeleton, GroupRequestsWidget, GroupRequestsWidgetSkeleton, Groups, GroupSettingsIconButton, GroupSkeleton, GroupsSkeleton, GroupSubscribeButton,
242
244
  /* SC UI SHARED */
243
245
  AccordionLessons, AccordionLessonsSkeleton, AddUsersButton, CourseUsersTable, CourseUsersTableSkeleton, EmptyStatus, HiddenPlaceholder, Incubator, IncubatorDetail, IncubatorListWidget, IncubatorSubscribeButton, IncubatorSuggestionWidget, InfiniteScroll, ScrollContainer, InlineComposerWidget, InlineComposerWidgetSkeleton, InviteUserEventButton, LessonAppbar, LessonDrawer, LessonEditForm, LessonObject, LanguageSwitcher, LEGAL_POLICIES, CourseCompletedDialog, Lightbox, Link, LINKEDIN_SHARE, LocationAutocomplete,
244
246
  /* Assets */
@@ -23,7 +23,7 @@ export interface ImagePreviewComponentProps {
23
23
  /**
24
24
  * Handles on media click
25
25
  */
26
- onMediaClick?: (any: any) => void;
26
+ onMediaClick?: (media: SCMediaType) => void;
27
27
  }
28
- declare const _default: (props: ImagePreviewComponentProps) => JSX.Element;
28
+ declare const _default: (props: ImagePreviewComponentProps) => import("react/jsx-runtime").JSX.Element;
29
29
  export default _default;
@@ -34,7 +34,7 @@ const Root = styled(Stack, {
34
34
  })(() => ({}));
35
35
  export default (props) => {
36
36
  // PROPS
37
- const { className = '', medias = [], maxVisible = 5, gallery = true, onMediaClick = null } = props;
37
+ const { className = '', medias = [], maxVisible = 5, gallery = true, onMediaClick = undefined } = props;
38
38
  // STATE
39
39
  const [preview, setPreview] = useState(-1);
40
40
  const [toolbarButtons, setToolbarButtons] = useState(undefined);
@@ -84,8 +84,10 @@ export default (props) => {
84
84
  const renderOne = () => {
85
85
  const overlay = images.length > maxVisible && maxVisible == 1 ? renderCountOverlay(true) : renderOverlay(0);
86
86
  const isGif = images[0]['image_mimetype'] ? images[0]['image_mimetype'].includes('image/gif') : false;
87
- const isLandscape = images[0].image_height < images[0].image_width;
88
- return (_jsx(Grid, Object.assign({ container: true, width: "100%", style: Object.assign({}, (images[0].image_thumbnail && images[0].image_thumbnail.color ? { backgroundColor: images[0].image_thumbnail.color } : {})) }, { children: _jsxs(Grid, Object.assign({ ref: ref, size: 12, className: classNames(classes.border, classes.heightOne, Object.assign(Object.assign({}, (isGif || isLandscape ? { [classes.background]: true } : { [classes.backgroundPortrait]: true })), { [classes.gallery]: gallery, [classes.heightHalfOne]: images.length > 1 })), onClick: () => openPreviewImage(0), style: Object.assign({ background: `url(${getImageUrl(images[0], inView && isGif)})` }, (isLandscape ? { paddingTop: `${(100 * images[0].image_height) / images[0].image_width}%` } : {})) }, { children: [overlay, renderTitle(images[0])] })) })));
87
+ const isLandscape = images[0].image_height && images[0].image_width && images[0].image_height < images[0].image_width;
88
+ return (_jsx(Grid, Object.assign({ container: true, width: "100%", style: Object.assign({}, (images[0].image_thumbnail && images[0].image_thumbnail.color ? { backgroundColor: images[0].image_thumbnail.color } : {})) }, { children: _jsxs(Grid, Object.assign({ ref: ref, size: 12, className: classNames(classes.border, classes.heightOne, Object.assign(Object.assign({}, (isGif || isLandscape ? { [classes.background]: true } : { [classes.backgroundPortrait]: true })), { [classes.gallery]: gallery, [classes.heightHalfOne]: images.length > 1 })), onClick: () => openPreviewImage(0), style: Object.assign({ background: `url(${getImageUrl(images[0], inView && isGif)})` }, (isLandscape && images[0].image_height && images[0].image_width
89
+ ? { paddingTop: `${(100 * images[0].image_height) / images[0].image_width}%` }
90
+ : {})) }, { children: [overlay, renderTitle(images[0])] })) })));
89
91
  };
90
92
  const renderTwo = () => {
91
93
  const overlay = images.length > maxVisible && [2, 3].includes(+maxVisible) ? renderCountOverlay(true) : renderOverlay(1);
@@ -122,7 +124,7 @@ export default (props) => {
122
124
  const url = window.URL.createObjectURL(blob);
123
125
  const link = document.createElement('a');
124
126
  link.href = url;
125
- link.download = docs[index].title;
127
+ link.download = docs[index].title || '';
126
128
  link.click();
127
129
  // Cleanup
128
130
  window.URL.revokeObjectURL(url);
@@ -70,5 +70,5 @@ export default function DocComponent(props) {
70
70
  return fallback;
71
71
  }
72
72
  }, [document.mimetype]);
73
- return (_jsxs(Root, Object.assign({ className: classNames(classes.docRoot, className) }, { children: [_jsx(Box, { component: "img", alt: document.title, src: getImage() }), _jsxs(Stack, Object.assign({ className: classes.textWrapper }, { children: [_jsx(Typography, Object.assign({ className: classNames(classes.title, classes.contrastColor) }, { children: document.title })), document.size && _jsx(Typography, Object.assign({ className: classNames(classes.subtitle, classes.contrastColor) }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && (_jsxs(Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && (_jsx(IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: _jsx(Icon, { children: "delete" }) }))), handleDownload && (_jsxs(_Fragment, { children: [document.mimetype === SCMimeTypes.PDF && (_jsx(IconButton, Object.assign({ className: classes.action, component: Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: _jsx(Icon, { children: "visibility" }) }))), _jsx(IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: _jsx(Icon, { children: "download" }) }))] }))] })))] })));
73
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.docRoot, className) }, { children: [_jsx(Box, { component: "img", alt: document.title, src: getImage() }), _jsxs(Stack, Object.assign({ className: classes.textWrapper }, { children: [_jsx(Typography, Object.assign({ className: classNames(classes.title, classes.contrastColor) }, { children: document.title })), document.size && _jsx(Typography, Object.assign({ className: classNames(classes.subtitle, classes.contrastColor) }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && (_jsxs(Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && (_jsx(IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: _jsx(Icon, { children: "delete" }) }))), handleDownload && index && (_jsxs(_Fragment, { children: [document.mimetype === SCMimeTypes.PDF && (_jsx(IconButton, Object.assign({ className: classes.action, component: Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: _jsx(Icon, { children: "visibility" }) }))), _jsx(IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: _jsx(Icon, { children: "download" }) }))] }))] })))] })));
74
74
  }
@@ -30,7 +30,7 @@ const PreviewComponent = forwardRef((props, ref) => {
30
30
  // EFFECTS
31
31
  useEffect(() => {
32
32
  if (typeof document === undefined) {
33
- return null;
33
+ return;
34
34
  }
35
35
  const sortable = document.getElementById(SORTABLE_ID);
36
36
  if (sortable) {