@capillarytech/blaze-ui 6.1.7 → 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.
Files changed (56) hide show
  1. package/CapDragAndDrop/index.d.ts +3 -19
  2. package/CapDragAndDrop/index.d.ts.map +1 -1
  3. package/CapDragAndDrop/index.js +24 -29
  4. package/CapDragAndDrop/messages.d.ts +25 -0
  5. package/CapDragAndDrop/messages.d.ts.map +1 -0
  6. package/CapDragAndDrop/messages.js +28 -0
  7. package/CapDragAndDrop/styles.css +17 -15
  8. package/CapDragAndDrop/styles.module.scss.js +21 -0
  9. package/CapDragAndDrop/styles.scss +18 -16
  10. package/CapDragAndDrop/types.d.ts +17 -0
  11. package/CapDragAndDrop/types.d.ts.map +1 -0
  12. package/CapDragAndDrop/types.js +1 -0
  13. package/CapMediaPreview/ImageRenderer.d.ts +2 -15
  14. package/CapMediaPreview/ImageRenderer.d.ts.map +1 -1
  15. package/CapMediaPreview/ImageRenderer.js +3 -11
  16. package/CapMediaPreview/MediaRenderer.d.ts +2 -1
  17. package/CapMediaPreview/MediaRenderer.d.ts.map +1 -1
  18. package/CapMediaPreview/MediaRenderer.js +17 -15
  19. package/CapMediaPreview/VideoPlayer.d.ts +2 -1
  20. package/CapMediaPreview/VideoPlayer.d.ts.map +1 -1
  21. package/CapMediaPreview/VideoPlayer.js +16 -15
  22. package/CapMediaPreview/index.d.ts +4 -51
  23. package/CapMediaPreview/index.d.ts.map +1 -1
  24. package/CapMediaPreview/index.js +86 -69
  25. package/CapMediaPreview/styles.css +31 -21
  26. package/CapMediaPreview/styles.module.scss.js +24 -0
  27. package/CapMediaPreview/styles.scss +38 -27
  28. package/CapMediaPreview/types.d.ts +48 -0
  29. package/CapMediaPreview/types.d.ts.map +1 -0
  30. package/CapMediaPreview/types.js +1 -0
  31. package/CapTimeline/CapTimelineCard.d.ts +4 -27
  32. package/CapTimeline/CapTimelineCard.d.ts.map +1 -1
  33. package/CapTimeline/CapTimelineCard.js +40 -157
  34. package/CapTimeline/CapTimelinePanesWrapper.d.ts +4 -25
  35. package/CapTimeline/CapTimelinePanesWrapper.d.ts.map +1 -1
  36. package/CapTimeline/CapTimelinePanesWrapper.js +24 -20
  37. package/CapTimeline/index.d.ts +2 -17
  38. package/CapTimeline/index.d.ts.map +1 -1
  39. package/CapTimeline/index.js +62 -23
  40. package/CapTimeline/messages.d.ts +21 -0
  41. package/CapTimeline/messages.d.ts.map +1 -0
  42. package/CapTimeline/messages.js +24 -0
  43. package/CapTimeline/styles.css +40 -40
  44. package/CapTimeline/styles.module.scss.js +30 -0
  45. package/CapTimeline/styles.scss +76 -57
  46. package/CapTimeline/tests/CapTimeline.mockData.d.ts +14 -0
  47. package/CapTimeline/tests/CapTimeline.mockData.d.ts.map +1 -0
  48. package/CapTimeline/types.d.ts +60 -0
  49. package/CapTimeline/types.d.ts.map +1 -0
  50. package/CapTimeline/types.js +1 -0
  51. package/index.d.ts +6 -0
  52. package/index.d.ts.map +1 -1
  53. package/index.js +175 -169
  54. package/package.json +1 -1
  55. package/utils/getCapThemeConfig.d.ts.map +1 -1
  56. package/utils/getCapThemeConfig.js +9 -1
@@ -4,24 +4,8 @@
4
4
  *
5
5
  */
6
6
  import React from 'react';
7
- import './styles.scss';
8
- declare const _default: React.ComponentType<Omit<{
9
- setacceptedfiles: any;
10
- setrejectedfiles: any;
11
- accept?: {
12
- 'text/csv': string[];
13
- 'application/vnd.ms-excel': string[];
14
- };
15
- maxfilesize?: number;
16
- minfilesize?: number;
17
- multiple?: boolean;
18
- dropboxwidth?: string;
19
- dropboxtext: any;
20
- selectFilesText: any;
21
- droptext: any;
22
- invalidFileSelectionText: any;
23
- or: any;
24
- className: any;
25
- } & import("react-intl").WrappedComponentProps, "intl">>;
7
+ import type { WrappedComponentProps } from 'react-intl';
8
+ import type { CapDragAndDropProps } from './types';
9
+ declare const _default: React.ComponentType<Omit<CapDragAndDropProps & WrappedComponentProps, "intl">>;
26
10
  export default _default;
27
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapDragAndDrop/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAsB,MAAM,OAAO,CAAC;AAU3C,OAAO,eAAe,CAAC;;;;;;;;;;;;;;;;;;;AAsGvB,wBAAoE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapDragAndDrop/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAsB,MAAM,OAAO,CAAC;AAG3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAUxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;;AA4GnD,wBAA0C"}
@@ -1,16 +1,16 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import classNames from "classnames";
3
3
  import { isEmpty } from "lodash";
4
- import PropTypes from "prop-types";
5
4
  import { useCallback } from "react";
6
5
  import { useDropzone } from "react-dropzone";
6
+ import { injectIntl } from "react-intl";
7
7
  import addFileSvg from "../assets/images/file-selector.svg.js";
8
8
  import CapButton from "../CapButton/index.js";
9
9
  import CapImage from "../CapImage/index.js";
10
10
  import CapRow from "../CapRow/index.js";
11
- import LocaleHoc from "../LocaleHoc/index.js";
12
11
  import { defaultMinFileSize, defaultMaxFileSize, defaultAcceptedFiles, small } from "./constants.js";
13
- import './styles.css';/* empty css */
12
+ import messages from "./messages.js";
13
+ import styles from "./styles.module.scss.js";
14
14
  const clsPrefix = "cap-drag-and-drop-v1";
15
15
  const CapDragAndDrop = ({
16
16
  setacceptedfiles,
@@ -25,8 +25,14 @@ const CapDragAndDrop = ({
25
25
  droptext,
26
26
  invalidFileSelectionText,
27
27
  or,
28
- className
28
+ className,
29
+ intl: { formatMessage }
29
30
  }) => {
31
+ const displayDropboxtext = dropboxtext ?? formatMessage(messages.dropboxtext);
32
+ const displaySelectFilesText = selectFilesText ?? formatMessage(messages.selectFilesText);
33
+ const displayDroptext = droptext ?? formatMessage(messages.droptext);
34
+ const displayInvalidFileSelectionText = invalidFileSelectionText ?? formatMessage(messages.invalidFileSelectionText);
35
+ const displayOr = or ?? formatMessage(messages.or);
30
36
  const onDrop = useCallback(
31
37
  (filesAccepted, filesRejected) => {
32
38
  if (multiple) {
@@ -52,40 +58,29 @@ const CapDragAndDrop = ({
52
58
  maxSize: maxfilesize,
53
59
  minSize: minfilesize
54
60
  });
55
- return /* @__PURE__ */ jsx(CapRow, { className: classNames("uploadFileSlideBoxContent", className), children: /* @__PURE__ */ jsx(CapRow, { "data-testid": "dragZoneCapColumn", type: "flex", children: /* @__PURE__ */ jsxs(
61
+ return /* @__PURE__ */ jsx(CapRow, { useLegacy: true, className: classNames("uploadFileSlideBoxContent", className), children: /* @__PURE__ */ jsx(CapRow, { useLegacy: true, "data-testid": "dragZoneCapColumn", type: "flex", children: /* @__PURE__ */ jsxs(
56
62
  "div",
57
63
  {
58
- className: classNames(`${clsPrefix}-main-div`, `${clsPrefix}-${dropboxwidth}`),
64
+ className: classNames(
65
+ styles[`${clsPrefix}-main-div`],
66
+ styles[`${clsPrefix}-${dropboxwidth}`]
67
+ ),
59
68
  ...getRootProps({ isDragAccept, isDragReject }),
60
69
  children: [
61
- /* @__PURE__ */ jsx("input", { ...getInputProps(), className: "cap-drag-and-drop-input" }),
62
- !isDragActive && /* @__PURE__ */ jsxs(CapRow, { "data-testid": "dragZone", className: "dragInactiveText", children: [
63
- /* @__PURE__ */ jsx(CapRow, { className: "fileUploadImage", children: /* @__PURE__ */ jsx(CapImage, { src: addFileSvg, alt: "default" }) }),
64
- /* @__PURE__ */ jsx(CapRow, { className: classNames(`${clsPrefix}-dropboxtext`), children: dropboxtext }),
65
- /* @__PURE__ */ jsx(CapRow, { className: "intermediateOR", children: or }),
66
- /* @__PURE__ */ jsx(CapRow, { className: classNames(`${clsPrefix}-uploadButton`), children: /* @__PURE__ */ jsx(CapButton, { type: "secondary", children: selectFilesText }) })
70
+ /* @__PURE__ */ jsx("input", { ...getInputProps(), className: styles["cap-drag-and-drop-input"] }),
71
+ !isDragActive && /* @__PURE__ */ jsxs(CapRow, { "data-testid": "dragZone", useLegacy: true, className: styles["dragInactiveText"], children: [
72
+ /* @__PURE__ */ jsx(CapRow, { useLegacy: true, className: styles["fileUploadImage"], children: /* @__PURE__ */ jsx(CapImage, { src: addFileSvg, alt: "default" }) }),
73
+ /* @__PURE__ */ jsx(CapRow, { useLegacy: true, className: styles[`${clsPrefix}-dropBoxText`], children: displayDropboxtext }),
74
+ /* @__PURE__ */ jsx(CapRow, { useLegacy: true, className: styles["intermediateOR"], children: displayOr }),
75
+ /* @__PURE__ */ jsx(CapRow, { useLegacy: true, className: styles[`${clsPrefix}-uploadButton`], children: /* @__PURE__ */ jsx(CapButton, { type: "secondary", children: displaySelectFilesText }) })
67
76
  ] }),
68
- isDragReject && /* @__PURE__ */ jsx(CapRow, { className: "drag-active-section", children: invalidFileSelectionText }),
69
- isDragAccept && /* @__PURE__ */ jsx(CapRow, { className: "drag-active-section", children: droptext })
77
+ isDragReject && /* @__PURE__ */ jsx(CapRow, { useLegacy: true, className: styles["drag-active-section"], children: displayInvalidFileSelectionText }),
78
+ isDragAccept && /* @__PURE__ */ jsx(CapRow, { useLegacy: true, className: styles["drag-active-section"], children: displayDroptext })
70
79
  ]
71
80
  }
72
81
  ) }) });
73
82
  };
74
- CapDragAndDrop.propTypes = {
75
- setacceptedfiles: PropTypes.func.isRequired,
76
- setrejectedfiles: PropTypes.func,
77
- accept: PropTypes.object,
78
- maxfilesize: PropTypes.number,
79
- multiple: PropTypes.bool,
80
- dropboxwidth: PropTypes.string,
81
- dropboxtext: PropTypes.string,
82
- className: PropTypes.string
83
- };
84
- CapDragAndDrop.defaultProps = {
85
- dropboxwidth: small,
86
- multiple: true
87
- };
88
- const index = LocaleHoc(CapDragAndDrop, { key: "CapDragAndDrop" });
83
+ const index = injectIntl(CapDragAndDrop);
89
84
  export {
90
85
  index as default
91
86
  };
@@ -0,0 +1,25 @@
1
+ export declare const scope = "app.commonUtils.capUiLibrary.CapDragAndDrop";
2
+ declare const _default: {
3
+ dropboxtext: {
4
+ id: string;
5
+ defaultMessage: string;
6
+ };
7
+ selectFilesText: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ };
11
+ droptext: {
12
+ id: string;
13
+ defaultMessage: string;
14
+ };
15
+ invalidFileSelectionText: {
16
+ id: string;
17
+ defaultMessage: string;
18
+ };
19
+ or: {
20
+ id: string;
21
+ defaultMessage: string;
22
+ };
23
+ };
24
+ export default _default;
25
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../components/CapDragAndDrop/messages.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,gDAAgD,CAAC;;;;;;;;;;;;;;;;;;;;;;;AAEnE,wBAqBG"}
@@ -0,0 +1,28 @@
1
+ import { defineMessages } from "react-intl";
2
+ const scope = "app.commonUtils.capUiLibrary.CapDragAndDrop";
3
+ const messages = defineMessages({
4
+ dropboxtext: {
5
+ id: `${scope}.dropboxtext`,
6
+ defaultMessage: "Drop here!"
7
+ },
8
+ selectFilesText: {
9
+ id: `${scope}.selectFilesText`,
10
+ defaultMessage: "Select files from your computer"
11
+ },
12
+ droptext: {
13
+ id: `${scope}.droptext`,
14
+ defaultMessage: "Drag and drop files"
15
+ },
16
+ invalidFileSelectionText: {
17
+ id: `${scope}.invalidFileSelectionText`,
18
+ defaultMessage: "Invalid file selection!"
19
+ },
20
+ or: {
21
+ id: `${scope}.or`,
22
+ defaultMessage: "OR"
23
+ }
24
+ });
25
+ export {
26
+ messages as default,
27
+ scope
28
+ };
@@ -10,30 +10,31 @@
10
10
  display: flex;
11
11
  flex-direction: column;
12
12
  align-items: center;
13
- padding: 30px 158px;
14
- gap: 10px;
13
+ padding: 2.143rem 11.286rem;
14
+ gap: 0.714rem;
15
15
  background: #ffffff;
16
- border: 2px dashed #ebecf0;
17
- border-radius: 5px;
18
- border-width: 3px;
19
- height: 285px;
16
+ border: 0.143rem dashed #ebecf0;
17
+ border-radius: 0.357rem;
18
+ border-width: 0.214rem;
19
+ height: 20.357rem;
20
20
  }
21
21
  .cap-drag-and-drop-v1-size-r {
22
- width: 495px;
22
+ width: 35.357rem;
23
23
  }
24
24
  .cap-drag-and-drop-v1-size-s {
25
- width: 322px;
25
+ width: 23rem;
26
26
  }
27
27
  .dragInactiveText {
28
+ display: block;
28
29
  font-weight: 500;
29
30
  font-size: 1.428rem;
30
- line-height: 30px;
31
+ line-height: 1.875rem;
31
32
  text-align: center;
32
- width: 300px;
33
+ width: 21.429rem;
33
34
  }
34
35
  .intermediateOR {
35
- margin-top: 17px;
36
- margin-bottom: 13px;
36
+ margin-top: 1.214rem;
37
+ margin-bottom: 0.929rem;
37
38
  font-weight: 400;
38
39
  font-size: 1.142rem;
39
40
  line-height: 1.714rem;
@@ -41,17 +42,18 @@
41
42
  color: #091e42;
42
43
  }
43
44
  .fileUploadImage {
44
- margin-bottom: 31px;
45
+ margin-bottom: 2.214rem;
45
46
  }
46
47
  .cap-drag-and-drop-v1-uploadButton {
47
- margin-bottom: 10px;
48
+ margin-bottom: 0.714rem;
48
49
  }
49
50
  .cap-drag-and-drop-v1-dropBoxText {
50
51
  white-space: initial;
51
52
  word-break: break-word;
53
+ font-size: 1.428rem;
52
54
  }
53
55
  .drag-active-section {
54
- width: 200px;
56
+ width: 14.286rem;
55
57
  text-align: center;
56
58
  }
57
59
  .cap-drag-and-drop-input {
@@ -0,0 +1,21 @@
1
+ import './styles.css';const dragInactiveText = "dragInactiveText";
2
+ const intermediateOR = "intermediateOR";
3
+ const fileUploadImage = "fileUploadImage";
4
+ const styles = {
5
+ "cap-drag-and-drop-v1-main-div": "cap-drag-and-drop-v1-main-div",
6
+ "cap-drag-and-drop-v1-size-r": "cap-drag-and-drop-v1-size-r",
7
+ "cap-drag-and-drop-v1-size-s": "cap-drag-and-drop-v1-size-s",
8
+ dragInactiveText,
9
+ intermediateOR,
10
+ fileUploadImage,
11
+ "cap-drag-and-drop-v1-uploadButton": "cap-drag-and-drop-v1-uploadButton",
12
+ "cap-drag-and-drop-v1-dropBoxText": "cap-drag-and-drop-v1-dropBoxText",
13
+ "drag-active-section": "drag-active-section",
14
+ "cap-drag-and-drop-input": "cap-drag-and-drop-input"
15
+ };
16
+ export {
17
+ styles as default,
18
+ dragInactiveText,
19
+ fileUploadImage,
20
+ intermediateOR
21
+ };
@@ -1,36 +1,37 @@
1
- @import "../styles/_variables.scss";
1
+ @import '../styles/_variables.scss';
2
2
 
3
3
  .cap-drag-and-drop-v1-main-div {
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
  align-items: center;
7
- padding: 30px 158px;
8
- gap: 10px;
7
+ padding: 2.143rem 11.286rem; // 30px 158px
8
+ gap: 0.714rem; // 10px
9
9
  background: $CAP_WHITE;
10
- border: 2px dashed $CAP_G08;
11
- border-radius: 5px;
12
- border-width: 3px;
13
- height: 285px;
10
+ border: 0.143rem dashed $CAP_G08; // 2px
11
+ border-radius: 0.357rem; // 5px
12
+ border-width: 0.214rem; // 3px
13
+ height: 20.357rem; // 285px
14
14
  }
15
15
 
16
16
  .cap-drag-and-drop-v1-size-r {
17
- width: 495px;
17
+ width: 35.357rem; // 495px
18
18
  }
19
19
  .cap-drag-and-drop-v1-size-s {
20
- width: 322px;
20
+ width: 23rem; // 322px
21
21
  }
22
22
 
23
23
  .dragInactiveText {
24
+ display: block;
24
25
  font-weight: 500;
25
26
  font-size: $CAP_SPACE_20;
26
- line-height: 30px;
27
+ line-height: 1.875rem;
27
28
  text-align: center;
28
- width: 300px;
29
+ width: 21.429rem; // 300px
29
30
  }
30
31
 
31
32
  .intermediateOR {
32
- margin-top: 17px;
33
- margin-bottom: 13px;
33
+ margin-top: 1.214rem; // 17px
34
+ margin-bottom: 0.929rem; // 13px
34
35
  font-weight: $FONT_WEIGHT_REGULAR;
35
36
  font-size: $CAP_SPACE_16;
36
37
  line-height: $CAP_SPACE_24;
@@ -39,19 +40,20 @@
39
40
  }
40
41
 
41
42
  .fileUploadImage {
42
- margin-bottom: 31px;
43
+ margin-bottom: 2.214rem; // 31px
43
44
  }
44
45
 
45
46
  .cap-drag-and-drop-v1-uploadButton {
46
- margin-bottom: 10px;
47
+ margin-bottom: 0.714rem; // 10px
47
48
  }
48
49
  .cap-drag-and-drop-v1-dropBoxText {
49
50
  white-space: initial;
50
51
  word-break: break-word;
52
+ font-size: $CAP_SPACE_20;
51
53
  }
52
54
 
53
55
  .drag-active-section {
54
- width: 200px;
56
+ width: 14.286rem; // 200px
55
57
  text-align: center;
56
58
  }
57
59
 
@@ -0,0 +1,17 @@
1
+ import type React from 'react';
2
+ export interface CapDragAndDropProps {
3
+ setacceptedfiles: (value: File[] | ((prev: File[]) => File[])) => void;
4
+ setrejectedfiles?: (value: unknown) => void;
5
+ accept?: Record<string, string[]>;
6
+ maxfilesize?: number;
7
+ minfilesize?: number;
8
+ multiple?: boolean;
9
+ dropboxwidth?: string;
10
+ dropboxtext?: string;
11
+ selectFilesText?: string;
12
+ droptext?: string;
13
+ invalidFileSelectionText?: string;
14
+ or?: React.ReactNode;
15
+ className?: string;
16
+ }
17
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../components/CapDragAndDrop/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACvE,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,EAAE,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1 @@
1
+
@@ -1,17 +1,4 @@
1
- import PropTypes from 'prop-types';
2
- declare const ImageRenderer: {
3
- ({ src, imageProps }: {
4
- src: any;
5
- imageProps: any;
6
- }): import("react/jsx-runtime").JSX.Element;
7
- propTypes: {
8
- src: PropTypes.Requireable<string>;
9
- imageProps: PropTypes.Requireable<object>;
10
- };
11
- defaultProps: {
12
- src: string;
13
- imageProps: {};
14
- };
15
- };
1
+ import type { ImageRendererProps } from './types';
2
+ declare const ImageRenderer: ({ src, imageProps }: ImageRendererProps) => import("react/jsx-runtime").JSX.Element;
16
3
  export default ImageRenderer;
17
4
  //# sourceMappingURL=ImageRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImageRenderer.d.ts","sourceRoot":"","sources":["../../components/CapMediaPreview/ImageRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,YAAY,CAAC;AAOnC,QAAA,MAAM,aAAa;;;;;;;;;;;;;CAElB,CAAC;AAYF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ImageRenderer.d.ts","sourceRoot":"","sources":["../../components/CapMediaPreview/ImageRenderer.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,QAAA,MAAM,aAAa,GAAI,qBAA+B,kBAAkB,4CAIvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,18 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import classNames from "classnames";
3
- import PropTypes from "prop-types";
4
3
  import CapImage from "../CapImage/index.js";
5
4
  import { CLASS_PREFIX } from "./constants.js";
6
- const ImageRenderer = ({ src, imageProps }) => {
7
- return /* @__PURE__ */ jsx(CapImage, { className: classNames(`${CLASS_PREFIX}-image`), src, ...imageProps });
8
- };
9
- ImageRenderer.propTypes = {
10
- src: PropTypes.string,
11
- imageProps: PropTypes.object
12
- };
13
- ImageRenderer.defaultProps = {
14
- src: "",
15
- imageProps: {}
5
+ import styles from "./styles.module.scss.js";
6
+ const ImageRenderer = ({ src = "", imageProps = {} }) => {
7
+ return /* @__PURE__ */ jsx(CapImage, { className: classNames(styles[`${CLASS_PREFIX}-image`]), src, ...imageProps });
16
8
  };
17
9
  export {
18
10
  ImageRenderer as default
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
- declare const _default: React.ComponentType<Omit<import("react-intl").WrappedComponentProps, "intl">>;
2
+ import type { MediaRendererProps } from './types';
3
+ declare const _default: React.ComponentType<Omit<MediaRendererProps, "intl">>;
3
4
  export default _default;
4
5
  //# sourceMappingURL=MediaRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MediaRenderer.d.ts","sourceRoot":"","sources":["../../components/CapMediaPreview/MediaRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;;AAmEnD,wBAAyC"}
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(CapRow, { className: `${CLASS_PREFIX}-unsupported`, type: "flex", align: "middle", justify: "middle", children: [
43
- /* @__PURE__ */ jsx(CapIcon, { type: "file", className: `${CLASS_PREFIX}-unsupported-icon` }),
44
- /* @__PURE__ */ jsx(CapLabelWithStatic, { type: "label16", className: `${CLASS_PREFIX}-unsupported-label`, children: formatMessage(messages.thisFileTypeIsNotSupportedForPreview) })
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
- declare const _default: React.ComponentType<Omit<import("react-intl").WrappedComponentProps, "intl">>;
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":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;;AAsCjD,wBAAuC"}
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
- const VideoPlayer = ({ intl: { formatMessage }, src, videoProps }) => {
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
- return /* @__PURE__ */ jsxs("video", { ref: videoRef, className: classNames(`${CLASS_PREFIX}-video`), controls: true, ...videoProps, children: [
17
- /* @__PURE__ */ jsx("source", { src }),
18
- /* @__PURE__ */ jsx(CapLabelWithStatic, { type: "label16", children: formatMessage(messages.yourBrowserDoesNotSupportVideoTag) })
19
- ] });
20
- };
21
- VideoPlayer.propTypes = {
22
- intl: PropTypes.object.isRequired,
23
- src: PropTypes.string,
24
- videoProps: PropTypes.object
25
- };
26
- VideoPlayer.defaultProps = {
27
- src: "",
28
- videoProps: {}
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 './styles.scss';
10
- export declare const CapMediaPreview: {
11
- ({ intl: { formatMessage }, overrideClassName, overrideWrapperClassName, isMediaPreviewVisible, media, startIndex, width, height, topNavigationHeight, onClose, modalProps, }: {
12
- intl: {
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;AAIH,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,KAA2C,MAAM,OAAO,CAAC;AAUhE,OAAO,eAAe,CAAC;AAEvB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuI3B,CAAC;;AAqCF,wBAA2C"}
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"}