@capillarytech/blaze-ui 6.4.0 → 6.6.0

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 (80) hide show
  1. package/CapAdvancedIcon/types.d.ts +1 -0
  2. package/CapAdvancedIcon/types.d.ts.map +1 -1
  3. package/CapDateRangePicker/index.d.ts.map +1 -1
  4. package/CapDateRangePicker/index.js +5 -1
  5. package/CapDateRangePicker/styles.css +28 -0
  6. package/CapDateRangePicker/styles.module.scss.js +2 -1
  7. package/CapDateRangePicker/styles.scss +37 -0
  8. package/CapDateRangePicker/types.d.ts +5 -0
  9. package/CapDateRangePicker/types.d.ts.map +1 -1
  10. package/CapDnDGraph/index.js +2 -2
  11. package/CapDndGraphSidebar/SideBarIcon.d.ts +3 -23
  12. package/CapDndGraphSidebar/SideBarIcon.d.ts.map +1 -1
  13. package/CapDndGraphSidebar/SideBarIcon.js +21 -39
  14. package/CapDndGraphSidebar/SidebarNodesRendered.d.ts +3 -9
  15. package/CapDndGraphSidebar/SidebarNodesRendered.d.ts.map +1 -1
  16. package/CapDndGraphSidebar/SidebarNodesRendered.js +13 -4
  17. package/CapDndGraphSidebar/index.d.ts +4 -20
  18. package/CapDndGraphSidebar/index.d.ts.map +1 -1
  19. package/CapDndGraphSidebar/index.js +31 -33
  20. package/CapDndGraphSidebar/styles.css +19 -6
  21. package/CapDndGraphSidebar/styles.module.scss.js +15 -0
  22. package/CapDndGraphSidebar/styles.scss +68 -51
  23. package/CapDndGraphSidebar/types.d.ts +106 -0
  24. package/CapDndGraphSidebar/types.d.ts.map +1 -0
  25. package/CapDndGraphSidebar/types.js +1 -0
  26. package/CapIcon/index.js +12 -12
  27. package/CapIcon/styles.css +17 -21
  28. package/CapIcon/styles.module.scss.js +3 -4
  29. package/CapIcon/styles.scss +10 -15
  30. package/CapMediaPreview/ImageRenderer.d.ts +2 -15
  31. package/CapMediaPreview/ImageRenderer.d.ts.map +1 -1
  32. package/CapMediaPreview/ImageRenderer.js +3 -11
  33. package/CapMediaPreview/MediaRenderer.d.ts +2 -1
  34. package/CapMediaPreview/MediaRenderer.d.ts.map +1 -1
  35. package/CapMediaPreview/MediaRenderer.js +17 -15
  36. package/CapMediaPreview/VideoPlayer.d.ts +2 -1
  37. package/CapMediaPreview/VideoPlayer.d.ts.map +1 -1
  38. package/CapMediaPreview/VideoPlayer.js +16 -15
  39. package/CapMediaPreview/index.d.ts +4 -51
  40. package/CapMediaPreview/index.d.ts.map +1 -1
  41. package/CapMediaPreview/index.js +86 -69
  42. package/CapMediaPreview/styles.css +31 -21
  43. package/CapMediaPreview/styles.module.scss.js +24 -0
  44. package/CapMediaPreview/styles.scss +38 -27
  45. package/CapMediaPreview/types.d.ts +48 -0
  46. package/CapMediaPreview/types.d.ts.map +1 -0
  47. package/CapMediaPreview/types.js +1 -0
  48. package/CapMobileDateRangePicker/DateRangeInputSelectors.d.ts +7 -0
  49. package/CapMobileDateRangePicker/DateRangeInputSelectors.d.ts.map +1 -0
  50. package/CapMobileDateRangePicker/DateRangeInputSelectors.js +68 -0
  51. package/CapMobileDateRangePicker/ReactMobileDatePickerModule.d.ts.map +1 -1
  52. package/CapMobileDateRangePicker/ReactMobileDatePickerModule.js +2 -1
  53. package/CapMobileDateRangePicker/index.d.ts +5 -21
  54. package/CapMobileDateRangePicker/index.d.ts.map +1 -1
  55. package/CapMobileDateRangePicker/index.js +256 -309
  56. package/CapMobileDateRangePicker/messages.d.ts +17 -0
  57. package/CapMobileDateRangePicker/messages.d.ts.map +1 -0
  58. package/CapMobileDateRangePicker/messages.js +20 -0
  59. package/CapMobileDateRangePicker/styles.css +107 -144
  60. package/CapMobileDateRangePicker/styles.module.scss.js +21 -0
  61. package/CapMobileDateRangePicker/styles.scss +188 -192
  62. package/CapMobileDateRangePicker/tests/CapMobileDateRangePicker.mockData.d.ts +18 -0
  63. package/CapMobileDateRangePicker/tests/CapMobileDateRangePicker.mockData.d.ts.map +1 -0
  64. package/CapMobileDateRangePicker/types.d.ts +95 -0
  65. package/CapMobileDateRangePicker/types.d.ts.map +1 -0
  66. package/CapMobileDateRangePicker/types.js +1 -0
  67. package/CapMobileDateRangePicker/utils.d.ts +3 -0
  68. package/CapMobileDateRangePicker/utils.d.ts.map +1 -0
  69. package/CapMobileDateRangePicker/utils.js +5 -0
  70. package/CapSelectFilter/types.d.ts +1 -1
  71. package/CapSelectFilter/types.d.ts.map +1 -1
  72. package/index.d.ts +6 -0
  73. package/index.d.ts.map +1 -1
  74. package/index.js +118 -112
  75. package/package.json +2 -2
  76. package/utils/dayjs.d.ts +29 -0
  77. package/utils/dayjs.d.ts.map +1 -1
  78. package/utils/dayjs.js +30 -0
  79. package/utils/getCapThemeConfig.d.ts +1 -1
  80. package/utils/getCapThemeConfig.d.ts.map +1 -1
@@ -1,57 +1,74 @@
1
1
  @import '../styles/_variables.scss';
2
2
 
3
- .dnd-graph-sidebar-container{
4
- background: $CAP_G10;
5
- width: 240px;
6
- height: 100%;
7
- display: inline-block;
8
- padding: 15px $CAP_SPACE_24;
9
- overflow: auto;
10
-
11
- .title-row {
12
- display: flex;
13
-
14
- .info-icon {
15
- display: flex;
16
- align-items: center;
17
- margin-left: $CAP_SPACE_04;
3
+ .dnd-graph-sidebar-container {
4
+ background: $CAP_G10;
5
+ width: 17.143rem;
6
+ height: 100%;
7
+ display: inline-block;
8
+ padding: 1.071rem $CAP_SPACE_24;
9
+ overflow: auto;
10
+
11
+ .align-items-center {
12
+ display: flex;
13
+ align-items: center;
14
+ }
15
+
16
+ .margin-l-4 {
17
+ margin-left: $CAP_SPACE_04;
18
+ }
19
+
20
+ .margin-t-4 {
21
+ margin-top: $CAP_SPACE_04;
22
+ }
23
+
24
+ .info-icon {
25
+ display: flex;
26
+ align-items: center;
27
+ }
28
+
29
+ .title-row {
30
+ display: flex;
31
+ }
32
+
33
+ .category-container {
34
+ margin: $CAP_SPACE_16 0;
35
+
36
+ .icons-container {
37
+ display: flex;
38
+ flex-wrap: wrap;
39
+ width: 100%;
40
+
41
+ .node-container {
42
+ width: calc(100% / 3);
43
+ text-align: center;
44
+ margin: $CAP_SPACE_04 0;
45
+ position: relative;
46
+
47
+ .cap-icon-background {
48
+ padding: 0.643rem;
49
+ }
50
+
51
+ .node-label {
52
+ white-space: nowrap;
53
+ align-items: center;
54
+ display: inline-block;
55
+ white-space: normal;
56
+ }
57
+
58
+ .premium-icon {
59
+ position: absolute;
60
+ top: -0.313rem;
61
+ right: 0.25rem;
62
+ z-index: 99;
63
+ padding: 0.125rem;
64
+ background-color: $CAP_WHITE;
65
+ border-radius: 50%;
18
66
  }
19
- }
20
67
 
21
- .category-container {
22
- margin: $CAP_SPACE_16 0;
23
-
24
- .icons-container {
25
- display: flex;
26
- flex-wrap: wrap;
27
-
28
- .node-container {
29
- width: calc(100% / 3);
30
- text-align: center;
31
- margin: $CAP_SPACE_04 0;
32
- position: relative;
33
-
34
- .cap-icon-background {
35
- padding: 9px;
36
- }
37
-
38
- .node-label {
39
- white-space: nowrap;
40
- align-items: center;
41
- display: inline-block;
42
- white-space: normal;
43
- }
44
-
45
- .premium-icon {
46
- position: absolute;
47
- top: -0.313rem;
48
- right: 0.25rem;
49
- z-index: 99;
50
- padding: 0.125rem;
51
- background-color: $CAP_WHITE;
52
- border-radius: 50%;
53
- }
54
- }
68
+ :global(.cap-tooltip-wrapper) {
69
+ display: block;
55
70
  }
71
+ }
56
72
  }
57
- }
73
+ }
74
+ }
@@ -0,0 +1,106 @@
1
+ import type React from 'react';
2
+ import type { DragSourceMonitor } from 'react-dnd';
3
+ /**
4
+ * Child node structure for sidebar icons
5
+ */
6
+ export interface ChildNode {
7
+ id: string;
8
+ type: string;
9
+ label: string;
10
+ isMultiPath?: boolean;
11
+ isDisabled?: boolean;
12
+ tooltipText?: string | ((id: string, isDisabled: boolean, handleModel: () => void) => React.ReactNode);
13
+ premiumTooltipText?: string;
14
+ showPremiumIcon?: boolean;
15
+ premiumModelContent?: () => React.ReactNode;
16
+ }
17
+ /**
18
+ * Node structure with categories and children
19
+ */
20
+ export interface Node {
21
+ key: string;
22
+ title: string;
23
+ tooltipText?: string;
24
+ children: ChildNode[];
25
+ color: string;
26
+ }
27
+ /**
28
+ * Props for CapDndGraphSidebar component
29
+ */
30
+ export interface CapDndGraphSidebarProps {
31
+ /** Array of node categories with their children */
32
+ nodes?: Node[];
33
+ /** Title displayed at the top of the sidebar */
34
+ sidebarTitle?: string;
35
+ /** Description text displayed below the title */
36
+ sidebarDescription?: string;
37
+ /** Info tooltip text for the sidebar title */
38
+ sidebarTitleInfo?: string;
39
+ /** Whether nodes can be dragged */
40
+ isNodeDraggable?: boolean;
41
+ /** Handler for drag end events */
42
+ endDrag?: (item: unknown, monitor: DragSourceMonitor) => void;
43
+ /** Whether the sidebar is in view-only mode */
44
+ viewMode?: boolean;
45
+ /** Callback when a node is dropped outside the canvas */
46
+ onDropOutsideCanvas?: (item: {
47
+ id: string;
48
+ type: string;
49
+ iconType: string;
50
+ color: string;
51
+ isMultiPath?: boolean;
52
+ }) => void;
53
+ }
54
+ /**
55
+ * Props for SideBarIcon component
56
+ */
57
+ export interface SideBarIconProps {
58
+ /** Child node data */
59
+ childNode: ChildNode;
60
+ /** Color for the icon background */
61
+ color: string;
62
+ /** Whether the node can be dragged */
63
+ isNodeDraggable?: boolean;
64
+ /** Whether the sidebar is in view-only mode */
65
+ viewMode?: boolean;
66
+ /** Callback when a node is dropped outside the canvas */
67
+ onDropOutsideCanvas?: (item: {
68
+ id: string;
69
+ type: string;
70
+ iconType: string;
71
+ color: string;
72
+ isMultiPath?: boolean;
73
+ }) => void;
74
+ /** Whether the premium modal is shown */
75
+ showModel?: boolean;
76
+ /** Handler to toggle the premium modal */
77
+ setShowModel?: (show: boolean) => void;
78
+ /** Handler for drag end events (passed through but not used directly) */
79
+ endDrag?: (item: unknown, monitor: DragSourceMonitor) => void;
80
+ }
81
+ /**
82
+ * Props for SidebarNodesRendered component
83
+ */
84
+ export interface SidebarNodesRenderedProps {
85
+ /** Array of node categories with their children */
86
+ nodes?: Node[];
87
+ /** Whether nodes can be dragged */
88
+ isNodeDraggable?: boolean;
89
+ /** Handler for drag end events */
90
+ endDrag?: (item: unknown, monitor: DragSourceMonitor) => void;
91
+ /** Whether the sidebar is in view-only mode */
92
+ viewMode?: boolean;
93
+ /** Callback when a node is dropped outside the canvas */
94
+ onDropOutsideCanvas?: (item: {
95
+ id: string;
96
+ type: string;
97
+ iconType: string;
98
+ color: string;
99
+ isMultiPath?: boolean;
100
+ }) => void;
101
+ /** Whether the premium modal is shown */
102
+ showModel?: boolean;
103
+ /** Handler to toggle the premium modal */
104
+ setShowModel?: (show: boolean) => void;
105
+ }
106
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../components/CapDndGraphSidebar/types.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1 @@
1
+
package/CapIcon/index.js CHANGED
@@ -55,8 +55,8 @@ const CapIcon = React.forwardRef(
55
55
  {
56
56
  ref,
57
57
  className: classNames(
58
- styles["cap-icon-wrapper"],
59
- styles["cap-icon"],
58
+ styles["cap-icon-v2"],
59
+ type ? `cap-icon-v2-${type}` : null,
60
60
  styles[size],
61
61
  { [styles["with-text-label"]]: textLabel, [styles.disabled]: disabled },
62
62
  className
@@ -84,8 +84,8 @@ const CapIcon = React.forwardRef(
84
84
  {
85
85
  ref: withBackground ? void 0 : ref,
86
86
  className: classNames(
87
- styles["cap-icon-wrapper"],
88
- styles["cap-icon"],
87
+ styles["cap-icon-v2"],
88
+ type ? `cap-icon-v2-${type}` : null,
89
89
  styles[size],
90
90
  {
91
91
  [styles.spin]: spin,
@@ -106,7 +106,7 @@ const CapIcon = React.forwardRef(
106
106
  "div",
107
107
  {
108
108
  ref,
109
- className: classNames(styles["cap-icon-background-wrapper"], styles[size]),
109
+ className: classNames(styles["cap-icon-background"], styles[size]),
110
110
  ...backgroundProps,
111
111
  children: iconComponent
112
112
  }
@@ -120,8 +120,8 @@ const CapIcon = React.forwardRef(
120
120
  {
121
121
  ref: withBackground ? void 0 : ref,
122
122
  className: classNames(
123
- styles["cap-icon-wrapper"],
124
- styles["cap-icon"],
123
+ styles["cap-icon-v2"],
124
+ type ? `cap-icon-v2-${type}` : null,
125
125
  styles[size],
126
126
  { [styles.disabled]: disabled, [styles["with-text-label"]]: textLabel },
127
127
  className
@@ -139,7 +139,7 @@ const CapIcon = React.forwardRef(
139
139
  "span",
140
140
  {
141
141
  ref,
142
- className: classNames(styles["cap-icon-background-wrapper"], styles[size]),
142
+ className: classNames(styles["cap-icon-background"], styles[size]),
143
143
  ...backgroundProps,
144
144
  children: iconComponent
145
145
  }
@@ -150,8 +150,8 @@ const CapIcon = React.forwardRef(
150
150
  {
151
151
  ref,
152
152
  className: classNames(
153
- styles["cap-icon-wrapper"],
154
- styles["cap-icon"],
153
+ styles["cap-icon-v2"],
154
+ type ? `cap-icon-v2-${type}` : null,
155
155
  styles[size],
156
156
  { [styles.disabled]: disabled, [styles["with-text-label"]]: textLabel },
157
157
  className
@@ -168,7 +168,7 @@ CapIcon.displayName = "CapIcon";
168
168
  const AntIcon = ({ className, ...rest }) => /* @__PURE__ */ jsx(
169
169
  "i",
170
170
  {
171
- className: classNames(styles["cap-icon-ant-icon"], className),
171
+ className: classNames(styles["cap-icon-v2"], className),
172
172
  style: { display: "inline-flex", alignItems: "center", justifyContent: "center" },
173
173
  ...rest
174
174
  }
@@ -181,7 +181,7 @@ const CapIconAvatar = ({
181
181
  backgroundProps = {},
182
182
  labelProps = {}
183
183
  }) => {
184
- return /* @__PURE__ */ jsxs("div", { className: classNames(styles["cap-icon-avatar"], className), children: [
184
+ return /* @__PURE__ */ jsxs("div", { className: classNames(styles["cap-icon-v2-avatar"], className), children: [
185
185
  /* @__PURE__ */ jsx(LogoBackground, { width, height, ...backgroundProps }),
186
186
  text && /* @__PURE__ */ jsx("span", { className: styles["text-label"], ...labelProps, children: text })
187
187
  ] });
@@ -6,50 +6,46 @@
6
6
  /* Border Width */
7
7
  /* Transition */
8
8
  /* Timezones Footer */
9
- .cap-icon-wrapper {
9
+ .cap-icon-v2 {
10
10
  display: inline-flex;
11
11
  align-items: center;
12
12
  justify-content: center;
13
13
  }
14
- .cap-icon-wrapper.disabled {
14
+ .cap-icon-v2.disabled {
15
15
  cursor: not-allowed;
16
16
  opacity: 0.5;
17
17
  }
18
- .cap-icon-wrapper.xs {
18
+ .cap-icon-v2.xs {
19
19
  font-size: 0.857rem;
20
20
  }
21
- .cap-icon-wrapper.s {
21
+ .cap-icon-v2.s {
22
22
  font-size: 1.143rem;
23
23
  }
24
- .cap-icon-wrapper.m {
24
+ .cap-icon-v2.m {
25
25
  font-size: 1.714rem;
26
26
  }
27
- .cap-icon-wrapper.l {
27
+ .cap-icon-v2.l {
28
28
  font-size: 2.286rem;
29
29
  }
30
- .cap-icon-wrapper.with-text-label {
30
+ .cap-icon-v2.with-text-label {
31
31
  display: inline-flex;
32
32
  align-items: center;
33
33
  gap: 0.571rem;
34
34
  }
35
- .cap-icon-background-wrapper {
36
- display: inline-flex;
35
+ .cap-icon-v2 .anticon {
36
+ display: flex;
37
37
  align-items: center;
38
38
  justify-content: center;
39
- border-radius: 50%;
40
- background-color: #dfe2e7;
41
39
  }
42
- .cap-icon {
43
- display: inline-flex;
44
- align-items: center;
40
+ .cap-icon-v2.spin {
41
+ animation: rotate 2s linear infinite;
45
42
  }
46
- .cap-icon .anticon {
47
- display: flex;
43
+ .cap-icon-background {
44
+ display: inline-flex;
48
45
  align-items: center;
49
46
  justify-content: center;
50
- }
51
- .cap-icon.spin {
52
- animation: rotate 2s linear infinite;
47
+ border-radius: 50%;
48
+ background-color: #dfe2e7;
53
49
  }
54
50
  @keyframes rotate {
55
51
  from {
@@ -59,13 +55,13 @@
59
55
  transform: rotate(360deg);
60
56
  }
61
57
  }
62
- .cap-icon-avatar {
58
+ .cap-icon-v2-avatar {
63
59
  display: inline-flex;
64
60
  align-items: center;
65
61
  justify-content: center;
66
62
  position: relative;
67
63
  }
68
- .cap-icon-avatar .text-label {
64
+ .cap-icon-v2-avatar .text-label {
69
65
  position: absolute;
70
66
  display: flex;
71
67
  align-items: center;
@@ -7,19 +7,18 @@ const anticon = "anticon";
7
7
  const spin = "spin";
8
8
  const rotate = "rotate";
9
9
  const styles = {
10
- "cap-icon-wrapper": "cap-icon-wrapper",
10
+ "cap-icon-v2": "cap-icon-v2",
11
11
  disabled,
12
12
  xs,
13
13
  s,
14
14
  m,
15
15
  l,
16
16
  "with-text-label": "with-text-label",
17
- "cap-icon-background-wrapper": "cap-icon-background-wrapper",
18
- "cap-icon": "cap-icon",
19
17
  anticon,
20
18
  spin,
21
19
  rotate,
22
- "cap-icon-avatar": "cap-icon-avatar",
20
+ "cap-icon-background": "cap-icon-background",
21
+ "cap-icon-v2-avatar": "cap-icon-v2-avatar",
23
22
  "text-label": "text-label"
24
23
  };
25
24
  export {
@@ -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 {