@capillarytech/blaze-ui 6.5.0 → 6.6.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.
Files changed (121) hide show
  1. package/CapAdvancedIcon/types.d.ts +1 -0
  2. package/CapAdvancedIcon/types.d.ts.map +1 -1
  3. package/CapDnDGraph/index.js +2 -2
  4. package/CapDndGraphSidebar/SideBarIcon.d.ts +3 -23
  5. package/CapDndGraphSidebar/SideBarIcon.d.ts.map +1 -1
  6. package/CapDndGraphSidebar/SideBarIcon.js +21 -39
  7. package/CapDndGraphSidebar/SidebarNodesRendered.d.ts +3 -9
  8. package/CapDndGraphSidebar/SidebarNodesRendered.d.ts.map +1 -1
  9. package/CapDndGraphSidebar/SidebarNodesRendered.js +13 -4
  10. package/CapDndGraphSidebar/index.d.ts +4 -20
  11. package/CapDndGraphSidebar/index.d.ts.map +1 -1
  12. package/CapDndGraphSidebar/index.js +31 -33
  13. package/CapDndGraphSidebar/styles.css +20 -6
  14. package/CapDndGraphSidebar/styles.module.scss.js +15 -0
  15. package/CapDndGraphSidebar/styles.scss +69 -51
  16. package/CapDndGraphSidebar/types.d.ts +106 -0
  17. package/CapDndGraphSidebar/types.d.ts.map +1 -0
  18. package/CapDragAndDrop/index.d.ts +3 -19
  19. package/CapDragAndDrop/index.d.ts.map +1 -1
  20. package/CapDragAndDrop/index.js +24 -29
  21. package/CapDragAndDrop/messages.d.ts +25 -0
  22. package/CapDragAndDrop/messages.d.ts.map +1 -0
  23. package/CapDragAndDrop/messages.js +28 -0
  24. package/CapDragAndDrop/styles.css +17 -15
  25. package/CapDragAndDrop/styles.module.scss.js +21 -0
  26. package/CapDragAndDrop/styles.scss +18 -16
  27. package/CapDragAndDrop/types.d.ts +17 -0
  28. package/CapDragAndDrop/types.d.ts.map +1 -0
  29. package/CapDragAndDrop/types.js +1 -0
  30. package/CapIcon/index.js +12 -12
  31. package/CapIcon/styles.css +17 -21
  32. package/CapIcon/styles.module.scss.js +3 -4
  33. package/CapIcon/styles.scss +10 -15
  34. package/CapMediaPreview/ImageRenderer.d.ts +2 -15
  35. package/CapMediaPreview/ImageRenderer.d.ts.map +1 -1
  36. package/CapMediaPreview/ImageRenderer.js +3 -11
  37. package/CapMediaPreview/MediaRenderer.d.ts +2 -1
  38. package/CapMediaPreview/MediaRenderer.d.ts.map +1 -1
  39. package/CapMediaPreview/MediaRenderer.js +17 -15
  40. package/CapMediaPreview/VideoPlayer.d.ts +2 -1
  41. package/CapMediaPreview/VideoPlayer.d.ts.map +1 -1
  42. package/CapMediaPreview/VideoPlayer.js +16 -15
  43. package/CapMediaPreview/index.d.ts +4 -51
  44. package/CapMediaPreview/index.d.ts.map +1 -1
  45. package/CapMediaPreview/index.js +86 -69
  46. package/CapMediaPreview/styles.css +31 -21
  47. package/CapMediaPreview/styles.module.scss.js +24 -0
  48. package/CapMediaPreview/styles.scss +38 -27
  49. package/CapMediaPreview/types.d.ts +48 -0
  50. package/CapMediaPreview/types.d.ts.map +1 -0
  51. package/CapMediaPreview/types.js +1 -0
  52. package/CapPopoverTree/index.d.ts +40 -3
  53. package/CapPopoverTree/index.d.ts.map +1 -1
  54. package/CapPopoverTree/index.js +82 -72
  55. package/CapPopoverTree/style.d.ts +1 -5
  56. package/CapPopoverTree/style.d.ts.map +1 -1
  57. package/CapPopoverTree/styles.css +18 -119
  58. package/CapPopoverTree/styles.scss +31 -179
  59. package/CapSelectFilter/types.d.ts +1 -1
  60. package/CapSelectFilter/types.d.ts.map +1 -1
  61. package/CapTimeline/CapTimelineCard.d.ts +4 -27
  62. package/CapTimeline/CapTimelineCard.d.ts.map +1 -1
  63. package/CapTimeline/CapTimelineCard.js +40 -157
  64. package/CapTimeline/CapTimelinePanesWrapper.d.ts +4 -25
  65. package/CapTimeline/CapTimelinePanesWrapper.d.ts.map +1 -1
  66. package/CapTimeline/CapTimelinePanesWrapper.js +24 -20
  67. package/CapTimeline/index.d.ts +2 -17
  68. package/CapTimeline/index.d.ts.map +1 -1
  69. package/CapTimeline/index.js +62 -23
  70. package/CapTimeline/messages.d.ts +21 -0
  71. package/CapTimeline/messages.d.ts.map +1 -0
  72. package/CapTimeline/messages.js +24 -0
  73. package/CapTimeline/styles.css +40 -40
  74. package/CapTimeline/styles.module.scss.js +30 -0
  75. package/CapTimeline/styles.scss +76 -57
  76. package/CapTimeline/tests/CapTimeline.mockData.d.ts +14 -0
  77. package/CapTimeline/tests/CapTimeline.mockData.d.ts.map +1 -0
  78. package/CapTimeline/types.d.ts +60 -0
  79. package/CapTimeline/types.d.ts.map +1 -0
  80. package/CapTimeline/types.js +1 -0
  81. package/index.d.ts +8 -0
  82. package/index.d.ts.map +1 -1
  83. package/index.js +179 -171
  84. package/package.json +2 -2
  85. package/utils/getCapThemeConfig.d.ts +1 -1
  86. package/utils/getCapThemeConfig.d.ts.map +1 -1
  87. package/utils/getCapThemeConfig.js +9 -1
  88. package/CapPopoverTree/styles.module.scss.js +0 -26
  89. package/CapPopoverTree/tests/CapPopoverTree.mockData.d.ts +0 -22
  90. package/CapPopoverTree/tests/CapPopoverTree.mockData.d.ts.map +0 -1
  91. package/CapPopoverTree/types.d.ts +0 -62
  92. package/CapPopoverTree/types.d.ts.map +0 -1
  93. package/CapVirtualSelect/actions.d.ts +0 -16
  94. package/CapVirtualSelect/actions.d.ts.map +0 -1
  95. package/CapVirtualSelect/actions.js +0 -21
  96. package/CapVirtualSelect/constants.d.ts +0 -13
  97. package/CapVirtualSelect/constants.d.ts.map +0 -1
  98. package/CapVirtualSelect/constants.js +0 -26
  99. package/CapVirtualSelect/index.d.ts +0 -169
  100. package/CapVirtualSelect/index.d.ts.map +0 -1
  101. package/CapVirtualSelect/index.js +0 -409
  102. package/CapVirtualSelect/messages.d.ts +0 -9
  103. package/CapVirtualSelect/messages.d.ts.map +0 -1
  104. package/CapVirtualSelect/messages.js +0 -12
  105. package/CapVirtualSelect/reducer.d.ts +0 -4
  106. package/CapVirtualSelect/reducer.d.ts.map +0 -1
  107. package/CapVirtualSelect/reducer.js +0 -63
  108. package/CapVirtualSelect/saga.d.ts +0 -40
  109. package/CapVirtualSelect/saga.d.ts.map +0 -1
  110. package/CapVirtualSelect/saga.js +0 -91
  111. package/CapVirtualSelect/selectors.d.ts +0 -28
  112. package/CapVirtualSelect/selectors.d.ts.map +0 -1
  113. package/CapVirtualSelect/selectors.js +0 -30
  114. package/CapVirtualSelect/styles.css +0 -110
  115. package/CapVirtualSelect/styles.scss +0 -106
  116. package/CapVirtualSelect/tests/mockData.d.ts +0 -7
  117. package/CapVirtualSelect/tests/mockData.d.ts.map +0 -1
  118. package/CapVirtualSelect/utils.d.ts +0 -2
  119. package/CapVirtualSelect/utils.d.ts.map +0 -1
  120. package/CapVirtualSelect/utils.js +0 -12
  121. /package/{CapPopoverTree → CapDndGraphSidebar}/types.js +0 -0
@@ -1,6 +1,6 @@
1
1
  @import '../styles/_variables';
2
2
 
3
- .cap-icon-wrapper {
3
+ .cap-icon-v2 {
4
4
  display: inline-flex;
5
5
  align-items: center;
6
6
  justify-content: center;
@@ -31,19 +31,6 @@
31
31
  align-items: center;
32
32
  gap: 0.571rem;
33
33
  }
34
- }
35
-
36
- .cap-icon-background-wrapper {
37
- display: inline-flex;
38
- align-items: center;
39
- justify-content: center;
40
- border-radius: 50%;
41
- background-color: $cap-g07;
42
- }
43
-
44
- .cap-icon {
45
- display: inline-flex;
46
- align-items: center;
47
34
 
48
35
  .anticon {
49
36
  display: flex;
@@ -56,6 +43,14 @@
56
43
  }
57
44
  }
58
45
 
46
+ .cap-icon-background {
47
+ display: inline-flex;
48
+ align-items: center;
49
+ justify-content: center;
50
+ border-radius: 50%;
51
+ background-color: $cap-g07;
52
+ }
53
+
59
54
  @keyframes rotate {
60
55
  from {
61
56
  transform: rotate(0deg);
@@ -65,7 +60,7 @@
65
60
  }
66
61
  }
67
62
 
68
- .cap-icon-avatar {
63
+ .cap-icon-v2-avatar {
69
64
  display: inline-flex;
70
65
  align-items: center;
71
66
  justify-content: center;
@@ -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"}
@@ -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 './styles.css';/* empty css */
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
- modalProps
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 || 0);
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 && startIndex !== void 0) {
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
- visible: isMediaPreviewVisible,
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: onClose,
122
+ onCancel: finalOnCancel,
84
123
  className: classNames(CLASS_PREFIX, overrideClassName),
85
- wrapClassName: classNames(`${CLASS_PREFIX}-wrapper`, overrideWrapperClassName),
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
- ...modalProps,
92
- children: /* @__PURE__ */ jsxs(CapRow, { className: `${CLASS_PREFIX}-container`, children: [
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: onClose })
145
+ /* @__PURE__ */ jsx(CapIcon, { type: "close", onClick: finalOnCancel })
103
146
  ]
104
147
  }
105
148
  ),
106
- /* @__PURE__ */ jsxs(CapRow, { className: `${CLASS_PREFIX}-content`, children: [
149
+ /* @__PURE__ */ jsxs(CapRow, { className: styles[`${CLASS_PREFIX}-content`], children: [
107
150
  showNavigation && /* @__PURE__ */ jsx(
108
151
  CapRow,
109
152
  {
110
- className: classNames(`${CLASS_PREFIX}-nav-button`, "left", {
111
- disabled: isLeftNavDisabled
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`, type: "chevron-left" })
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`, children: /* @__PURE__ */ jsx(MediaRenderer, { currentMedia }) }),
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(`${CLASS_PREFIX}-nav-button`, "right", {
123
- disabled: isRightNavDisabled
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`, type: "chevron-right" })
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`, children: [
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 .ant-modal-body {
35
- flex: 1;
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
- height: 100%;
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
- height: 100%;
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
+ };