@capillarytech/blaze-ui 6.1.6 → 6.1.8
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/CapDragAndDrop/index.d.ts +3 -19
- package/CapDragAndDrop/index.d.ts.map +1 -1
- package/CapDragAndDrop/index.js +24 -29
- package/CapDragAndDrop/messages.d.ts +25 -0
- package/CapDragAndDrop/messages.d.ts.map +1 -0
- package/CapDragAndDrop/messages.js +28 -0
- package/CapDragAndDrop/styles.css +17 -15
- package/CapDragAndDrop/styles.module.scss.js +21 -0
- package/CapDragAndDrop/styles.scss +18 -16
- package/CapDragAndDrop/types.d.ts +17 -0
- package/CapDragAndDrop/types.d.ts.map +1 -0
- package/CapDragAndDrop/types.js +1 -0
- package/CapIcon/index.js +12 -12
- package/CapIcon/styles.css +17 -21
- package/CapIcon/styles.module.scss.js +3 -4
- package/CapIcon/styles.scss +10 -15
- package/CapMediaPreview/ImageRenderer.d.ts +2 -15
- package/CapMediaPreview/ImageRenderer.d.ts.map +1 -1
- package/CapMediaPreview/ImageRenderer.js +3 -11
- package/CapMediaPreview/MediaRenderer.d.ts +2 -1
- package/CapMediaPreview/MediaRenderer.d.ts.map +1 -1
- package/CapMediaPreview/MediaRenderer.js +17 -15
- package/CapMediaPreview/VideoPlayer.d.ts +2 -1
- package/CapMediaPreview/VideoPlayer.d.ts.map +1 -1
- package/CapMediaPreview/VideoPlayer.js +16 -15
- package/CapMediaPreview/index.d.ts +4 -51
- package/CapMediaPreview/index.d.ts.map +1 -1
- package/CapMediaPreview/index.js +86 -69
- package/CapMediaPreview/styles.css +31 -21
- package/CapMediaPreview/styles.module.scss.js +24 -0
- package/CapMediaPreview/styles.scss +38 -27
- package/CapMediaPreview/types.d.ts +48 -0
- package/CapMediaPreview/types.d.ts.map +1 -0
- package/CapMediaPreview/types.js +1 -0
- package/CapSelectFilter/types.d.ts +1 -1
- package/CapSelectFilter/types.d.ts.map +1 -1
- package/CapTimeline/CapTimelineCard.d.ts +4 -27
- package/CapTimeline/CapTimelineCard.d.ts.map +1 -1
- package/CapTimeline/CapTimelineCard.js +40 -157
- package/CapTimeline/CapTimelinePanesWrapper.d.ts +4 -25
- package/CapTimeline/CapTimelinePanesWrapper.d.ts.map +1 -1
- package/CapTimeline/CapTimelinePanesWrapper.js +24 -20
- package/CapTimeline/index.d.ts +2 -17
- package/CapTimeline/index.d.ts.map +1 -1
- package/CapTimeline/index.js +62 -23
- package/CapTimeline/messages.d.ts +21 -0
- package/CapTimeline/messages.d.ts.map +1 -0
- package/CapTimeline/messages.js +24 -0
- package/CapTimeline/styles.css +40 -40
- package/CapTimeline/styles.module.scss.js +30 -0
- package/CapTimeline/styles.scss +76 -57
- package/CapTimeline/tests/CapTimeline.mockData.d.ts +14 -0
- package/CapTimeline/tests/CapTimeline.mockData.d.ts.map +1 -0
- package/CapTimeline/types.d.ts +60 -0
- package/CapTimeline/types.d.ts.map +1 -0
- package/CapTimeline/types.js +1 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -1
- package/index.js +175 -169
- package/package.json +2 -2
- package/utils/getCapThemeConfig.d.ts +1 -1
- package/utils/getCapThemeConfig.d.ts.map +1 -1
- package/utils/getCapThemeConfig.js +9 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaRenderer.d.ts","sourceRoot":"","sources":["../../components/CapMediaPreview/MediaRenderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MediaRenderer.d.ts","sourceRoot":"","sources":["../../components/CapMediaPreview/MediaRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAWnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;;AAsDlD,wBAAyC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import { useState, useEffect } from "react";
|
|
4
3
|
import { injectIntl } from "react-intl";
|
|
5
4
|
import CapIcon from "../CapIcon/index.js";
|
|
@@ -8,8 +7,9 @@ import CapRow from "../CapRow/index.js";
|
|
|
8
7
|
import { CLASS_PREFIX, MEDIA_TYPES } from "./constants.js";
|
|
9
8
|
import ImageRenderer from "./ImageRenderer.js";
|
|
10
9
|
import messages from "./messages.js";
|
|
10
|
+
import styles from "./styles.module.scss.js";
|
|
11
11
|
import VideoPlayer from "./VideoPlayer.js";
|
|
12
|
-
const MediaRenderer = ({ intl: { formatMessage }, currentMedia }) => {
|
|
12
|
+
const MediaRenderer = ({ intl: { formatMessage }, currentMedia = {} }) => {
|
|
13
13
|
var _a;
|
|
14
14
|
const { type, file, imageProps, videoProps } = currentMedia;
|
|
15
15
|
const [mediaUrl, setMediaUrl] = useState(null);
|
|
@@ -24,10 +24,10 @@ const MediaRenderer = ({ intl: { formatMessage }, currentMedia }) => {
|
|
|
24
24
|
setMediaUrl(null);
|
|
25
25
|
}
|
|
26
26
|
} else {
|
|
27
|
-
setMediaUrl(file);
|
|
27
|
+
setMediaUrl(typeof file === "string" ? file : null);
|
|
28
28
|
}
|
|
29
29
|
return () => {
|
|
30
|
-
if (url) {
|
|
30
|
+
if (url && typeof URL !== "undefined" && URL.revokeObjectURL) {
|
|
31
31
|
URL.revokeObjectURL(url);
|
|
32
32
|
}
|
|
33
33
|
};
|
|
@@ -39,19 +39,21 @@ const MediaRenderer = ({ intl: { formatMessage }, currentMedia }) => {
|
|
|
39
39
|
case MEDIA_TYPES.VIDEO:
|
|
40
40
|
return /* @__PURE__ */ jsx(VideoPlayer, { src: mediaUrl, videoProps });
|
|
41
41
|
default:
|
|
42
|
-
return /* @__PURE__ */ jsxs(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
return /* @__PURE__ */ jsxs(
|
|
43
|
+
CapRow,
|
|
44
|
+
{
|
|
45
|
+
className: styles[`${CLASS_PREFIX}-unsupported`],
|
|
46
|
+
type: "flex",
|
|
47
|
+
align: "middle",
|
|
48
|
+
justify: "middle",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx(CapIcon, { type: "file", className: styles[`${CLASS_PREFIX}-unsupported-icon`] }),
|
|
51
|
+
/* @__PURE__ */ jsx(CapLabelWithStatic, { type: "label16", className: styles[`${CLASS_PREFIX}-unsupported-label`], children: formatMessage(messages.thisFileTypeIsNotSupportedForPreview) })
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
);
|
|
46
55
|
}
|
|
47
56
|
};
|
|
48
|
-
MediaRenderer.propTypes = {
|
|
49
|
-
intl: PropTypes.object.isRequired,
|
|
50
|
-
currentMedia: PropTypes.object
|
|
51
|
-
};
|
|
52
|
-
MediaRenderer.defaultProps = {
|
|
53
|
-
currentMedia: {}
|
|
54
|
-
};
|
|
55
57
|
const MediaRenderer$1 = injectIntl(MediaRenderer);
|
|
56
58
|
export {
|
|
57
59
|
MediaRenderer$1 as default
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import type { VideoPlayerProps } from './types';
|
|
3
|
+
declare const _default: React.ComponentType<Omit<VideoPlayerProps, "intl">>;
|
|
3
4
|
export default _default;
|
|
4
5
|
//# sourceMappingURL=VideoPlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoPlayer.d.ts","sourceRoot":"","sources":["../../components/CapMediaPreview/VideoPlayer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VideoPlayer.d.ts","sourceRoot":"","sources":["../../components/CapMediaPreview/VideoPlayer.tsx"],"names":[],"mappings":"AACA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAQjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;;AA4BhD,wBAAuC"}
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import classNames from "classnames";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
3
|
import { useRef, useEffect } from "react";
|
|
5
4
|
import { injectIntl } from "react-intl";
|
|
6
5
|
import CapLabelWithStatic from "../CapLabel/index.js";
|
|
7
6
|
import { CLASS_PREFIX } from "./constants.js";
|
|
8
7
|
import messages from "./messages.js";
|
|
9
|
-
|
|
8
|
+
import styles from "./styles.module.scss.js";
|
|
9
|
+
const VideoPlayer = ({ intl: { formatMessage }, src = "", videoProps = {} }) => {
|
|
10
10
|
const videoRef = useRef(null);
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
if (videoRef.current) {
|
|
13
13
|
videoRef.current.load();
|
|
14
14
|
}
|
|
15
15
|
}, [src]);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
const { className: videoClassName, ...restVideoProps } = videoProps;
|
|
17
|
+
return /* @__PURE__ */ jsxs(
|
|
18
|
+
"video",
|
|
19
|
+
{
|
|
20
|
+
ref: videoRef,
|
|
21
|
+
className: classNames(styles[`${CLASS_PREFIX}-video`], videoClassName),
|
|
22
|
+
controls: true,
|
|
23
|
+
...restVideoProps,
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsx("source", { src: src || void 0 }),
|
|
26
|
+
/* @__PURE__ */ jsx(CapLabelWithStatic, { type: "label16", children: formatMessage(messages.yourBrowserDoesNotSupportVideoTag) })
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
);
|
|
29
30
|
};
|
|
30
31
|
const VideoPlayer$1 = injectIntl(VideoPlayer);
|
|
31
32
|
export {
|
|
@@ -4,57 +4,10 @@
|
|
|
4
4
|
* A component for displaying enlarged media (images, videos, documents, and more) in a carousel view
|
|
5
5
|
*
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
7
|
import React from 'react';
|
|
9
|
-
import '
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
formatMessage: any;
|
|
14
|
-
};
|
|
15
|
-
overrideClassName: any;
|
|
16
|
-
overrideWrapperClassName: any;
|
|
17
|
-
isMediaPreviewVisible: any;
|
|
18
|
-
media: any;
|
|
19
|
-
startIndex: any;
|
|
20
|
-
width: any;
|
|
21
|
-
height: any;
|
|
22
|
-
topNavigationHeight: any;
|
|
23
|
-
onClose: any;
|
|
24
|
-
modalProps: any;
|
|
25
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
propTypes: {
|
|
27
|
-
intl: PropTypes.Validator<object>;
|
|
28
|
-
overrideClassName: PropTypes.Requireable<string>;
|
|
29
|
-
overrideWrapperClassName: PropTypes.Requireable<string>;
|
|
30
|
-
isMediaPreviewVisible: PropTypes.Requireable<boolean>;
|
|
31
|
-
media: PropTypes.Requireable<PropTypes.InferProps<{
|
|
32
|
-
type: PropTypes.Validator<string>;
|
|
33
|
-
file: PropTypes.Validator<NonNullable<NonNullable<string | object>>>;
|
|
34
|
-
name: PropTypes.Requireable<string>;
|
|
35
|
-
imageProps: PropTypes.Requireable<object>;
|
|
36
|
-
videoProps: PropTypes.Requireable<object>;
|
|
37
|
-
}>[]>;
|
|
38
|
-
startIndex: PropTypes.Requireable<number>;
|
|
39
|
-
width: PropTypes.Requireable<string>;
|
|
40
|
-
height: PropTypes.Requireable<string>;
|
|
41
|
-
topNavigationHeight: PropTypes.Requireable<string>;
|
|
42
|
-
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
43
|
-
modalProps: PropTypes.Requireable<object>;
|
|
44
|
-
};
|
|
45
|
-
defaultProps: {
|
|
46
|
-
overrideClassName: string;
|
|
47
|
-
overrideWrapperClassName: string;
|
|
48
|
-
isMediaPreviewVisible: boolean;
|
|
49
|
-
media: any[];
|
|
50
|
-
startIndex: number;
|
|
51
|
-
width: string;
|
|
52
|
-
height: string;
|
|
53
|
-
topNavigationHeight: string;
|
|
54
|
-
onClose: () => void;
|
|
55
|
-
modalProps: {};
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
declare const _default: React.ComponentType<Omit<import("react-intl").WrappedComponentProps, "intl">>;
|
|
8
|
+
import type { WrappedComponentProps } from 'react-intl';
|
|
9
|
+
import type { CapMediaPreviewProps } from './types';
|
|
10
|
+
export declare const CapMediaPreview: ({ intl: { formatMessage }, overrideClassName, overrideWrapperClassName, isMediaPreviewVisible, media, startIndex, width, height, topNavigationHeight, onClose, modalProps, ...rest }: CapMediaPreviewProps & WrappedComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const _default: React.ComponentType<Omit<CapMediaPreviewProps & WrappedComponentProps, "intl">>;
|
|
59
12
|
export default _default;
|
|
60
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapMediaPreview/index.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapMediaPreview/index.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAA2C,MAAM,OAAO,CAAC;AAEhE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAWxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,eAAe,GAAI,sLAa7B,oBAAoB,GAAG,qBAAqB,4CAsL9C,CAAC;;AAEF,wBAA2C"}
|
package/CapMediaPreview/index.js
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Modal } from "antd";
|
|
2
|
+
import { Modal } from "antd-v5";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
4
|
import { useState, useEffect, useCallback } from "react";
|
|
6
5
|
import { injectIntl } from "react-intl";
|
|
7
6
|
import CapHeader from "../CapHeader/index.js";
|
|
8
7
|
import CapIcon from "../CapIcon/index.js";
|
|
9
8
|
import CapRow from "../CapRow/index.js";
|
|
9
|
+
import logDeprecationWarning from "../utils/logDeprecationWarning.js";
|
|
10
10
|
import { CLASS_PREFIX } from "./constants.js";
|
|
11
11
|
import MediaRenderer from "./MediaRenderer.js";
|
|
12
12
|
import messages from "./messages.js";
|
|
13
|
-
import
|
|
13
|
+
import styles from "./styles.module.scss.js";
|
|
14
14
|
const CapMediaPreview = ({
|
|
15
15
|
intl: { formatMessage },
|
|
16
|
-
overrideClassName,
|
|
17
|
-
overrideWrapperClassName,
|
|
18
|
-
isMediaPreviewVisible,
|
|
19
|
-
media,
|
|
20
|
-
startIndex,
|
|
21
|
-
width,
|
|
22
|
-
height,
|
|
23
|
-
topNavigationHeight,
|
|
24
|
-
onClose
|
|
25
|
-
|
|
16
|
+
overrideClassName = "",
|
|
17
|
+
overrideWrapperClassName = "",
|
|
18
|
+
isMediaPreviewVisible = false,
|
|
19
|
+
media = [],
|
|
20
|
+
startIndex = 0,
|
|
21
|
+
width = "100vw",
|
|
22
|
+
height = "100vh",
|
|
23
|
+
topNavigationHeight = "64px",
|
|
24
|
+
onClose = () => {
|
|
25
|
+
},
|
|
26
|
+
modalProps = {},
|
|
27
|
+
...rest
|
|
26
28
|
}) => {
|
|
27
|
-
const [currentIndex, setCurrentIndex] = useState(startIndex
|
|
29
|
+
const [currentIndex, setCurrentIndex] = useState(startIndex);
|
|
28
30
|
const mediaLength = (media == null ? void 0 : media.length) || 0;
|
|
29
31
|
const currentMedia = media && media[currentIndex] ? media[currentIndex] : {};
|
|
30
32
|
const showNavigation = mediaLength > 1;
|
|
31
33
|
const isLeftNavDisabled = currentIndex === 0;
|
|
32
34
|
const isRightNavDisabled = currentIndex === mediaLength - 1;
|
|
33
35
|
useEffect(() => {
|
|
34
|
-
if (isMediaPreviewVisible
|
|
36
|
+
if (isMediaPreviewVisible) {
|
|
35
37
|
setCurrentIndex(startIndex);
|
|
36
38
|
}
|
|
37
39
|
}, [startIndex, isMediaPreviewVisible]);
|
|
@@ -71,64 +73,113 @@ const CapMediaPreview = ({
|
|
|
71
73
|
if (!isMediaPreviewVisible || !(media == null ? void 0 : media.length)) {
|
|
72
74
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
73
75
|
}
|
|
76
|
+
const modalPropsWithDeprecation = modalProps;
|
|
77
|
+
if (modalPropsWithDeprecation.visible !== void 0) {
|
|
78
|
+
logDeprecationWarning("CapMediaPreview", "visible", modalPropsWithDeprecation.visible, "open");
|
|
79
|
+
}
|
|
80
|
+
if (modalPropsWithDeprecation.onVisibleChange !== void 0) {
|
|
81
|
+
logDeprecationWarning(
|
|
82
|
+
"CapMediaPreview",
|
|
83
|
+
"onVisibleChange",
|
|
84
|
+
modalPropsWithDeprecation.onVisibleChange,
|
|
85
|
+
"afterOpenChange"
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
const finalOpen = modalPropsWithDeprecation.open ?? modalPropsWithDeprecation.visible ?? isMediaPreviewVisible;
|
|
89
|
+
const finalOnCancel = modalPropsWithDeprecation.onCancel ?? onClose;
|
|
90
|
+
const {
|
|
91
|
+
visible: _visible,
|
|
92
|
+
onVisibleChange: _onVisibleChange,
|
|
93
|
+
classNames: _classNames,
|
|
94
|
+
styles: _styles,
|
|
95
|
+
style: _style,
|
|
96
|
+
...spreadableModalProps
|
|
97
|
+
} = modalPropsWithDeprecation;
|
|
98
|
+
const existingClassNames = typeof _classNames === "object" && _classNames && !("call" in _classNames) ? _classNames : {};
|
|
99
|
+
const modalClassNames = {
|
|
100
|
+
wrapper: classNames(
|
|
101
|
+
styles[`${CLASS_PREFIX}-wrapper`],
|
|
102
|
+
overrideWrapperClassName,
|
|
103
|
+
existingClassNames.wrapper
|
|
104
|
+
),
|
|
105
|
+
container: classNames(styles[`${CLASS_PREFIX}-modal-content`], existingClassNames.container),
|
|
106
|
+
body: classNames(styles[`${CLASS_PREFIX}-body`], existingClassNames.body),
|
|
107
|
+
...Object.fromEntries(
|
|
108
|
+
Object.entries(existingClassNames).filter(
|
|
109
|
+
([key]) => !["wrapper", "container", "body"].includes(key)
|
|
110
|
+
)
|
|
111
|
+
)
|
|
112
|
+
};
|
|
74
113
|
return /* @__PURE__ */ jsx(
|
|
75
114
|
Modal,
|
|
76
115
|
{
|
|
77
|
-
|
|
116
|
+
open: finalOpen,
|
|
78
117
|
footer: null,
|
|
79
118
|
closable: false,
|
|
80
119
|
centered: true,
|
|
81
120
|
keyboard: false,
|
|
82
121
|
destroyOnClose: true,
|
|
83
|
-
onCancel:
|
|
122
|
+
onCancel: finalOnCancel,
|
|
84
123
|
className: classNames(CLASS_PREFIX, overrideClassName),
|
|
85
|
-
|
|
124
|
+
classNames: modalClassNames,
|
|
125
|
+
width,
|
|
126
|
+
styles: _styles,
|
|
86
127
|
style: {
|
|
87
128
|
"--top-navigation-height": topNavigationHeight,
|
|
88
|
-
"--modal-width": width,
|
|
89
|
-
"--modal-height": height
|
|
129
|
+
"--modal-width": width !== void 0 ? String(width) : void 0,
|
|
130
|
+
"--modal-height": height,
|
|
131
|
+
..._style
|
|
90
132
|
},
|
|
91
|
-
...
|
|
92
|
-
|
|
133
|
+
...spreadableModalProps,
|
|
134
|
+
...rest,
|
|
135
|
+
children: /* @__PURE__ */ jsxs(CapRow, { className: styles[`${CLASS_PREFIX}-container`], children: [
|
|
93
136
|
/* @__PURE__ */ jsxs(
|
|
94
137
|
CapRow,
|
|
95
138
|
{
|
|
96
|
-
className: `${CLASS_PREFIX}-header
|
|
139
|
+
className: styles[`${CLASS_PREFIX}-header`],
|
|
97
140
|
type: "flex",
|
|
98
141
|
justify: "space-between",
|
|
99
142
|
align: "middle",
|
|
100
143
|
children: [
|
|
101
144
|
/* @__PURE__ */ jsx(CapHeader, { title: (currentMedia == null ? void 0 : currentMedia.name) || formatMessage(messages.mediaPreview) }),
|
|
102
|
-
/* @__PURE__ */ jsx(CapIcon, { type: "close", onClick:
|
|
145
|
+
/* @__PURE__ */ jsx(CapIcon, { type: "close", onClick: finalOnCancel })
|
|
103
146
|
]
|
|
104
147
|
}
|
|
105
148
|
),
|
|
106
|
-
/* @__PURE__ */ jsxs(CapRow, { className: `${CLASS_PREFIX}-content
|
|
149
|
+
/* @__PURE__ */ jsxs(CapRow, { className: styles[`${CLASS_PREFIX}-content`], children: [
|
|
107
150
|
showNavigation && /* @__PURE__ */ jsx(
|
|
108
151
|
CapRow,
|
|
109
152
|
{
|
|
110
|
-
className: classNames(
|
|
111
|
-
|
|
112
|
-
|
|
153
|
+
className: classNames(
|
|
154
|
+
styles[`${CLASS_PREFIX}-nav-button`],
|
|
155
|
+
styles[`${CLASS_PREFIX}-nav-button-left`],
|
|
156
|
+
{
|
|
157
|
+
[styles[`${CLASS_PREFIX}-nav-button-disabled`]]: isLeftNavDisabled
|
|
158
|
+
}
|
|
159
|
+
),
|
|
113
160
|
onClick: handlePrevious,
|
|
114
161
|
disabled: isLeftNavDisabled,
|
|
115
|
-
children: /* @__PURE__ */ jsx(CapIcon, { className: `${CLASS_PREFIX}-nav-button-icon
|
|
162
|
+
children: /* @__PURE__ */ jsx(CapIcon, { className: styles[`${CLASS_PREFIX}-nav-button-icon`], type: "chevron-left" })
|
|
116
163
|
}
|
|
117
164
|
),
|
|
118
|
-
/* @__PURE__ */ jsx(CapRow, { className: `${CLASS_PREFIX}-media-container
|
|
165
|
+
/* @__PURE__ */ jsx(CapRow, { className: styles[`${CLASS_PREFIX}-media-container`], children: /* @__PURE__ */ jsx(MediaRenderer, { currentMedia }) }),
|
|
119
166
|
showNavigation && /* @__PURE__ */ jsx(
|
|
120
167
|
CapRow,
|
|
121
168
|
{
|
|
122
|
-
className: classNames(
|
|
123
|
-
|
|
124
|
-
|
|
169
|
+
className: classNames(
|
|
170
|
+
styles[`${CLASS_PREFIX}-nav-button`],
|
|
171
|
+
styles[`${CLASS_PREFIX}-nav-button-right`],
|
|
172
|
+
{
|
|
173
|
+
[styles[`${CLASS_PREFIX}-nav-button-disabled`]]: isRightNavDisabled
|
|
174
|
+
}
|
|
175
|
+
),
|
|
125
176
|
onClick: handleNext,
|
|
126
177
|
disabled: isRightNavDisabled,
|
|
127
|
-
children: /* @__PURE__ */ jsx(CapIcon, { className: `${CLASS_PREFIX}-nav-button-icon
|
|
178
|
+
children: /* @__PURE__ */ jsx(CapIcon, { className: styles[`${CLASS_PREFIX}-nav-button-icon`], type: "chevron-right" })
|
|
128
179
|
}
|
|
129
180
|
)
|
|
130
181
|
] }),
|
|
131
|
-
mediaLength > 1 && /* @__PURE__ */ jsxs(CapRow, { className: `${CLASS_PREFIX}-counter
|
|
182
|
+
mediaLength > 1 && /* @__PURE__ */ jsxs(CapRow, { className: styles[`${CLASS_PREFIX}-counter`], children: [
|
|
132
183
|
currentIndex + 1,
|
|
133
184
|
" / ",
|
|
134
185
|
mediaLength
|
|
@@ -137,40 +188,6 @@ const CapMediaPreview = ({
|
|
|
137
188
|
}
|
|
138
189
|
);
|
|
139
190
|
};
|
|
140
|
-
CapMediaPreview.propTypes = {
|
|
141
|
-
intl: PropTypes.object.isRequired,
|
|
142
|
-
overrideClassName: PropTypes.string,
|
|
143
|
-
overrideWrapperClassName: PropTypes.string,
|
|
144
|
-
isMediaPreviewVisible: PropTypes.bool,
|
|
145
|
-
media: PropTypes.arrayOf(
|
|
146
|
-
PropTypes.shape({
|
|
147
|
-
type: PropTypes.string.isRequired,
|
|
148
|
-
file: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
|
|
149
|
-
name: PropTypes.string,
|
|
150
|
-
imageProps: PropTypes.object,
|
|
151
|
-
videoProps: PropTypes.object
|
|
152
|
-
})
|
|
153
|
-
),
|
|
154
|
-
startIndex: PropTypes.number,
|
|
155
|
-
width: PropTypes.string,
|
|
156
|
-
height: PropTypes.string,
|
|
157
|
-
topNavigationHeight: PropTypes.string,
|
|
158
|
-
onClose: PropTypes.func,
|
|
159
|
-
modalProps: PropTypes.object
|
|
160
|
-
};
|
|
161
|
-
CapMediaPreview.defaultProps = {
|
|
162
|
-
overrideClassName: "",
|
|
163
|
-
overrideWrapperClassName: "",
|
|
164
|
-
isMediaPreviewVisible: false,
|
|
165
|
-
media: [],
|
|
166
|
-
startIndex: 0,
|
|
167
|
-
width: "100vw",
|
|
168
|
-
height: "100vh",
|
|
169
|
-
topNavigationHeight: "64px",
|
|
170
|
-
onClose: () => {
|
|
171
|
-
},
|
|
172
|
-
modalProps: {}
|
|
173
|
-
};
|
|
174
191
|
const index = injectIntl(CapMediaPreview);
|
|
175
192
|
export {
|
|
176
193
|
CapMediaPreview,
|
|
@@ -15,33 +15,42 @@
|
|
|
15
15
|
top: 0;
|
|
16
16
|
padding-bottom: 0;
|
|
17
17
|
}
|
|
18
|
-
.cap-media-preview
|
|
18
|
+
.ant-modal.cap-media-preview,
|
|
19
|
+
.ant-modal-wrap .ant-modal.cap-media-preview {
|
|
19
20
|
width: var(--modal-width) !important;
|
|
20
21
|
height: var(--modal-height) !important;
|
|
21
22
|
top: var(--top-navigation-height) !important;
|
|
22
|
-
padding: 0;
|
|
23
|
-
margin: 0;
|
|
24
|
-
}
|
|
25
|
-
.cap-media-preview .ant-modal-content {
|
|
26
|
-
height: calc(var(--modal-height) - var(--top-navigation-height));
|
|
27
|
-
background-color: rgba(94, 94, 94, 0.4);
|
|
28
|
-
backdrop-filter: blur(0.857rem);
|
|
29
|
-
border-radius: 0;
|
|
30
|
-
display: flex;
|
|
31
|
-
flex-direction: column;
|
|
32
|
-
padding: 0;
|
|
33
23
|
}
|
|
34
|
-
.cap-media-preview
|
|
35
|
-
|
|
24
|
+
.cap-media-preview-modal-content {
|
|
25
|
+
height: calc(var(--modal-height) - var(--top-navigation-height)) !important;
|
|
26
|
+
background: rgba(94, 94, 94, 0.4) !important;
|
|
27
|
+
backdrop-filter: blur(0.857rem) !important;
|
|
28
|
+
border-radius: 0 !important;
|
|
29
|
+
display: flex !important;
|
|
30
|
+
flex-direction: column !important;
|
|
31
|
+
padding: 0 !important;
|
|
32
|
+
box-shadow: none !important;
|
|
33
|
+
width: 100% !important;
|
|
34
|
+
margin: 0 !important;
|
|
35
|
+
border: none !important;
|
|
36
|
+
outline: none !important;
|
|
37
|
+
transform: none !important;
|
|
38
|
+
position: relative !important;
|
|
39
|
+
color: inherit !important;
|
|
40
|
+
}
|
|
41
|
+
.cap-media-preview-body {
|
|
42
|
+
flex: 1 !important;
|
|
43
|
+
flex-direction: column !important;
|
|
36
44
|
display: flex;
|
|
37
45
|
align-items: center;
|
|
38
46
|
justify-content: center;
|
|
39
|
-
padding: 0;
|
|
47
|
+
padding: 0 !important;
|
|
40
48
|
overflow: hidden;
|
|
41
49
|
}
|
|
42
50
|
.cap-media-preview-container {
|
|
43
51
|
width: 100%;
|
|
44
|
-
|
|
52
|
+
flex: 1;
|
|
53
|
+
min-height: 0;
|
|
45
54
|
display: flex;
|
|
46
55
|
flex-direction: column;
|
|
47
56
|
align-items: center;
|
|
@@ -61,7 +70,8 @@
|
|
|
61
70
|
.cap-media-preview-content {
|
|
62
71
|
position: relative;
|
|
63
72
|
width: 100%;
|
|
64
|
-
|
|
73
|
+
flex: 1;
|
|
74
|
+
min-height: 0;
|
|
65
75
|
display: flex;
|
|
66
76
|
align-items: center;
|
|
67
77
|
justify-content: center;
|
|
@@ -98,16 +108,16 @@
|
|
|
98
108
|
background-color: #f4f5f7;
|
|
99
109
|
cursor: pointer;
|
|
100
110
|
}
|
|
101
|
-
.cap-media-preview-nav-button.left {
|
|
111
|
+
.cap-media-preview-nav-button.cap-media-preview-nav-button-left {
|
|
102
112
|
left: 1.714rem;
|
|
103
113
|
}
|
|
104
|
-
.cap-media-preview-nav-button.right {
|
|
114
|
+
.cap-media-preview-nav-button.cap-media-preview-nav-button-right {
|
|
105
115
|
right: 1.714rem;
|
|
106
116
|
}
|
|
107
|
-
.cap-media-preview-nav-button.disabled {
|
|
117
|
+
.cap-media-preview-nav-button.cap-media-preview-nav-button-disabled {
|
|
108
118
|
cursor: not-allowed;
|
|
109
119
|
}
|
|
110
|
-
.cap-media-preview-nav-button.disabled .cap-media-preview-nav-button-icon {
|
|
120
|
+
.cap-media-preview-nav-button.cap-media-preview-nav-button-disabled .cap-media-preview-nav-button-icon {
|
|
111
121
|
color: #b3bac5;
|
|
112
122
|
}
|
|
113
123
|
.cap-media-preview-counter {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import './styles.css';const styles = {
|
|
2
|
+
"cap-media-preview-wrapper": "cap-media-preview-wrapper",
|
|
3
|
+
"cap-media-preview": "cap-media-preview",
|
|
4
|
+
"cap-media-preview-modal-content": "cap-media-preview-modal-content",
|
|
5
|
+
"cap-media-preview-body": "cap-media-preview-body",
|
|
6
|
+
"cap-media-preview-container": "cap-media-preview-container",
|
|
7
|
+
"cap-media-preview-header": "cap-media-preview-header",
|
|
8
|
+
"cap-media-preview-content": "cap-media-preview-content",
|
|
9
|
+
"cap-media-preview-media-container": "cap-media-preview-media-container",
|
|
10
|
+
"cap-media-preview-image": "cap-media-preview-image",
|
|
11
|
+
"cap-media-preview-video": "cap-media-preview-video",
|
|
12
|
+
"cap-media-preview-nav-button": "cap-media-preview-nav-button",
|
|
13
|
+
"cap-media-preview-nav-button-left": "cap-media-preview-nav-button-left",
|
|
14
|
+
"cap-media-preview-nav-button-right": "cap-media-preview-nav-button-right",
|
|
15
|
+
"cap-media-preview-nav-button-disabled": "cap-media-preview-nav-button-disabled",
|
|
16
|
+
"cap-media-preview-nav-button-icon": "cap-media-preview-nav-button-icon",
|
|
17
|
+
"cap-media-preview-counter": "cap-media-preview-counter",
|
|
18
|
+
"cap-media-preview-unsupported": "cap-media-preview-unsupported",
|
|
19
|
+
"cap-media-preview-unsupported-icon": "cap-media-preview-unsupported-icon",
|
|
20
|
+
"cap-media-preview-unsupported-label": "cap-media-preview-unsupported-label"
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
styles as default
|
|
24
|
+
};
|
|
@@ -12,42 +12,51 @@ $flex-center: (
|
|
|
12
12
|
#{$property}: $value;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.ant-modal {
|
|
15
|
+
:global(.ant-modal) {
|
|
16
16
|
top: 0;
|
|
17
17
|
padding-bottom: 0;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
.#{$media-preview}
|
|
21
|
+
:global(.ant-modal).#{$media-preview},
|
|
22
|
+
:global(.ant-modal-wrap .ant-modal).#{$media-preview} {
|
|
22
23
|
width: var(--modal-width) !important;
|
|
23
24
|
height: var(--modal-height) !important;
|
|
24
25
|
top: var(--top-navigation-height) !important;
|
|
25
|
-
|
|
26
|
-
margin: 0;
|
|
27
|
-
|
|
28
|
-
.ant-modal-content {
|
|
29
|
-
height: calc(var(--modal-height) - var(--top-navigation-height));
|
|
30
|
-
background-color: rgba(94, 94, 94, 0.4);
|
|
31
|
-
backdrop-filter: blur($CAP_SPACE_12);
|
|
32
|
-
border-radius: 0;
|
|
33
|
-
display: flex;
|
|
34
|
-
flex-direction: column;
|
|
35
|
-
padding: 0;
|
|
36
|
-
}
|
|
26
|
+
}
|
|
37
27
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
28
|
+
.#{$media-preview}-modal-content {
|
|
29
|
+
height: calc(var(--modal-height) - var(--top-navigation-height)) !important;
|
|
30
|
+
background: rgba(94, 94, 94, 0.4) !important;
|
|
31
|
+
backdrop-filter: blur($CAP_SPACE_12) !important;
|
|
32
|
+
border-radius: 0 !important;
|
|
33
|
+
display: flex !important;
|
|
34
|
+
flex-direction: column !important;
|
|
35
|
+
padding: 0 !important;
|
|
36
|
+
box-shadow: none !important;
|
|
37
|
+
width: 100% !important;
|
|
38
|
+
margin: 0 !important;
|
|
39
|
+
border: none !important;
|
|
40
|
+
outline: none !important;
|
|
41
|
+
transform: none !important;
|
|
42
|
+
position: relative !important;
|
|
43
|
+
color: inherit !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.#{$media-preview}-body {
|
|
47
|
+
flex: 1 !important;
|
|
48
|
+
flex-direction: column !important;
|
|
49
|
+
@each $property, $value in $flex-center {
|
|
50
|
+
#{$property}: $value;
|
|
45
51
|
}
|
|
52
|
+
padding: 0 !important;
|
|
53
|
+
overflow: hidden;
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
.#{$media-preview}-container {
|
|
49
57
|
width: 100%;
|
|
50
|
-
|
|
58
|
+
flex: 1;
|
|
59
|
+
min-height: 0;
|
|
51
60
|
display: flex;
|
|
52
61
|
flex-direction: column;
|
|
53
62
|
@each $property, $value in $flex-center {
|
|
@@ -73,7 +82,8 @@ $flex-center: (
|
|
|
73
82
|
.#{$media-preview}-content {
|
|
74
83
|
position: relative;
|
|
75
84
|
width: 100%;
|
|
76
|
-
|
|
85
|
+
flex: 1;
|
|
86
|
+
min-height: 0;
|
|
77
87
|
@each $property, $value in $flex-center {
|
|
78
88
|
#{$property}: $value;
|
|
79
89
|
}
|
|
@@ -100,7 +110,8 @@ $flex-center: (
|
|
|
100
110
|
flex-shrink: 0;
|
|
101
111
|
aspect-ratio: 964.62/540;
|
|
102
112
|
object-fit: contain;
|
|
103
|
-
box-shadow:
|
|
113
|
+
box-shadow:
|
|
114
|
+
0 0 0.071rem rgba(9, 30, 66, 0.31),
|
|
104
115
|
0 0.286rem 0.571rem -0.143rem rgba(9, 30, 66, 0.25);
|
|
105
116
|
}
|
|
106
117
|
|
|
@@ -115,15 +126,15 @@ $flex-center: (
|
|
|
115
126
|
background-color: $CAP_G09;
|
|
116
127
|
cursor: pointer;
|
|
117
128
|
|
|
118
|
-
|
|
129
|
+
&.#{$media-preview}-nav-button-left {
|
|
119
130
|
left: $CAP_SPACE_24;
|
|
120
131
|
}
|
|
121
132
|
|
|
122
|
-
|
|
133
|
+
&.#{$media-preview}-nav-button-right {
|
|
123
134
|
right: $CAP_SPACE_24;
|
|
124
135
|
}
|
|
125
136
|
|
|
126
|
-
|
|
137
|
+
&.#{$media-preview}-nav-button-disabled {
|
|
127
138
|
cursor: not-allowed;
|
|
128
139
|
.#{$media-preview}-nav-button-icon {
|
|
129
140
|
color: $CAP_G06;
|