component-shared 1.0.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 (283) hide show
  1. package/Components/Charts/AreaChart.d.ts +19 -0
  2. package/Components/Charts/AreaChart.js +59 -0
  3. package/Components/Charts/AreaChart.js.map +1 -0
  4. package/Components/Charts/BarChart.d.ts +20 -0
  5. package/Components/Charts/BarChart.js +81 -0
  6. package/Components/Charts/BarChart.js.map +1 -0
  7. package/Components/Charts/DoughnutChart.d.ts +12 -0
  8. package/Components/Charts/DoughnutChart.js +81 -0
  9. package/Components/Charts/DoughnutChart.js.map +1 -0
  10. package/Components/Charts/HorizontalBarChart.d.ts +38 -0
  11. package/Components/Charts/HorizontalBarChart.js +83 -0
  12. package/Components/Charts/HorizontalBarChart.js.map +1 -0
  13. package/Components/Charts/LineChart.d.ts +21 -0
  14. package/Components/Charts/LineChart.js +133 -0
  15. package/Components/Charts/LineChart.js.map +1 -0
  16. package/Components/Charts/PieChart.d.ts +20 -0
  17. package/Components/Charts/PieChart.js +123 -0
  18. package/Components/Charts/PieChart.js.map +1 -0
  19. package/Components/Charts/index.d.ts +5 -0
  20. package/Components/Charts/index.js +6 -0
  21. package/Components/Charts/index.js.map +1 -0
  22. package/Components/Charts/type.d.ts +6 -0
  23. package/Components/Charts/type.js +2 -0
  24. package/Components/Charts/type.js.map +1 -0
  25. package/Components/CopyToClipboard/index.d.ts +23 -0
  26. package/Components/CopyToClipboard/index.js +54 -0
  27. package/Components/CopyToClipboard/index.js.map +1 -0
  28. package/Components/CopyToClipboard/indexv2.d.ts +30 -0
  29. package/Components/CopyToClipboard/indexv2.js +63 -0
  30. package/Components/CopyToClipboard/indexv2.js.map +1 -0
  31. package/Components/DropZone/components/DropzoneArea.d.ts +31 -0
  32. package/Components/DropZone/components/DropzoneArea.js +221 -0
  33. package/Components/DropZone/components/DropzoneArea.js.map +1 -0
  34. package/Components/DropZone/components/DropzoneAreaBase.d.ts +4 -0
  35. package/Components/DropZone/components/DropzoneAreaBase.js +555 -0
  36. package/Components/DropZone/components/DropzoneAreaBase.js.map +1 -0
  37. package/Components/DropZone/components/DropzoneDialog.d.ts +33 -0
  38. package/Components/DropZone/components/DropzoneDialog.js +222 -0
  39. package/Components/DropZone/components/DropzoneDialog.js.map +1 -0
  40. package/Components/DropZone/components/DropzoneDialogBase.d.ts +27 -0
  41. package/Components/DropZone/components/DropzoneDialogBase.js +152 -0
  42. package/Components/DropZone/components/DropzoneDialogBase.js.map +1 -0
  43. package/Components/DropZone/components/PreviewList.d.ts +3 -0
  44. package/Components/DropZone/components/PreviewList.js +132 -0
  45. package/Components/DropZone/components/PreviewList.js.map +1 -0
  46. package/Components/DropZone/components/SnackbarContentWrapper.d.ts +3 -0
  47. package/Components/DropZone/components/SnackbarContentWrapper.js +94 -0
  48. package/Components/DropZone/components/SnackbarContentWrapper.js.map +1 -0
  49. package/Components/DropZone/helpers.d.ts +5 -0
  50. package/Components/DropZone/helpers.js +64 -0
  51. package/Components/DropZone/helpers.js.map +1 -0
  52. package/Components/DropZone/index.d.ts +120 -0
  53. package/Components/EditAvatar/index.d.ts +26 -0
  54. package/Components/EditAvatar/index.js +137 -0
  55. package/Components/EditAvatar/index.js.map +1 -0
  56. package/Components/FlexInfiniteScroll/index.d.ts +26 -0
  57. package/Components/FlexInfiniteScroll/index.js +82 -0
  58. package/Components/FlexInfiniteScroll/index.js.map +1 -0
  59. package/Components/Helper/LazySpinner.d.ts +5 -0
  60. package/Components/Helper/LazySpinner.js +33 -0
  61. package/Components/Helper/LazySpinner.js.map +1 -0
  62. package/Components/Helper/RoleKey.d.ts +9 -0
  63. package/Components/Helper/RoleKey.js +15 -0
  64. package/Components/Helper/RoleKey.js.map +1 -0
  65. package/Components/Helper/index.d.ts +41 -0
  66. package/Components/Helper/index.js +247 -0
  67. package/Components/Helper/index.js.map +1 -0
  68. package/Components/HocLazyView/index.d.ts +51 -0
  69. package/Components/HocLazyView/index.js +123 -0
  70. package/Components/HocLazyView/index.js.map +1 -0
  71. package/Components/HtmlTooltip/index.d.ts +3 -0
  72. package/Components/HtmlTooltip/index.js +28 -0
  73. package/Components/HtmlTooltip/index.js.map +1 -0
  74. package/Components/Icons/index.d.ts +6 -0
  75. package/Components/Icons/index.js +52 -0
  76. package/Components/Icons/index.js.map +1 -0
  77. package/Components/LazySpinner.css +6 -0
  78. package/Components/MapLayout/index.d.ts +33 -0
  79. package/Components/MapLayout/index.js +80 -0
  80. package/Components/MapLayout/index.js.map +1 -0
  81. package/Components/MessageBox/index.d.ts +28 -0
  82. package/Components/MessageBox/index.js +93 -0
  83. package/Components/MessageBox/index.js.map +1 -0
  84. package/Components/Models/index.d.ts +641 -0
  85. package/Components/Models/index.js +87 -0
  86. package/Components/Models/index.js.map +1 -0
  87. package/Components/Redux/core/CRUDSlice.d.ts +20 -0
  88. package/Components/Redux/core/CRUDSlice.js +62 -0
  89. package/Components/Redux/core/CRUDSlice.js.map +1 -0
  90. package/Components/Redux/core/type.d.ts +11 -0
  91. package/Components/Redux/core/type.js +9 -0
  92. package/Components/Redux/core/type.js.map +1 -0
  93. package/Components/SkeletonLazyView/index.d.ts +9 -0
  94. package/Components/SkeletonLazyView/index.js +38 -0
  95. package/Components/SkeletonLazyView/index.js.map +1 -0
  96. package/Components/SkeletonService/index.d.ts +15 -0
  97. package/Components/SkeletonService/index.js +57 -0
  98. package/Components/SkeletonService/index.js.map +1 -0
  99. package/Components/SubComponent/index.d.ts +151 -0
  100. package/Components/SubComponent/index.js +883 -0
  101. package/Components/SubComponent/index.js.map +1 -0
  102. package/Components/SubComponent/v2/index.d.ts +20 -0
  103. package/Components/SubComponent/v2/index.js +58 -0
  104. package/Components/SubComponent/v2/index.js.map +1 -0
  105. package/Components/SubUserInputModels/ContactInfoForm/index.d.ts +11 -0
  106. package/Components/SubUserInputModels/ContactInfoForm/index.js +130 -0
  107. package/Components/SubUserInputModels/ContactInfoForm/index.js.map +1 -0
  108. package/Components/SubUserInputModels/index.d.ts +59 -0
  109. package/Components/SubUserInputModels/index.js +928 -0
  110. package/Components/SubUserInputModels/index.js.map +1 -0
  111. package/Components/SwitchComponent/index.d.ts +21 -0
  112. package/Components/SwitchComponent/index.js +71 -0
  113. package/Components/SwitchComponent/index.js.map +1 -0
  114. package/Components/TemplateModal/index.d.ts +29 -0
  115. package/Components/TemplateModal/index.js +94 -0
  116. package/Components/TemplateModal/index.js.map +1 -0
  117. package/Components/TemplateTable/FormTest/index.d.ts +4 -0
  118. package/Components/TemplateTable/FormTest/index.js +22 -0
  119. package/Components/TemplateTable/FormTest/index.js.map +1 -0
  120. package/Components/TemplateTable/InputFormBase/index.d.ts +23 -0
  121. package/Components/TemplateTable/InputFormBase/index.js +111 -0
  122. package/Components/TemplateTable/InputFormBase/index.js.map +1 -0
  123. package/Components/TemplateTable/InputFormModal/index.d.ts +22 -0
  124. package/Components/TemplateTable/InputFormModal/index.js +103 -0
  125. package/Components/TemplateTable/InputFormModal/index.js.map +1 -0
  126. package/Components/TemplateTable/ItemRowMenu/index.d.ts +13 -0
  127. package/Components/TemplateTable/ItemRowMenu/index.js +49 -0
  128. package/Components/TemplateTable/ItemRowMenu/index.js.map +1 -0
  129. package/Components/TemplateTable/PanelAction/index.d.ts +11 -0
  130. package/Components/TemplateTable/PanelAction/index.js +51 -0
  131. package/Components/TemplateTable/PanelAction/index.js.map +1 -0
  132. package/Components/TemplateTable/TableContext/index.d.ts +1 -0
  133. package/Components/TemplateTable/TableContext/index.js +2 -0
  134. package/Components/TemplateTable/TableContext/index.js.map +1 -0
  135. package/Components/TemplateTable/helper.d.ts +3 -0
  136. package/Components/TemplateTable/helper.js +20 -0
  137. package/Components/TemplateTable/helper.js.map +1 -0
  138. package/Components/TemplateTable/index.d.ts +49 -0
  139. package/Components/TemplateTable/index.js +208 -0
  140. package/Components/TemplateTable/index.js.map +1 -0
  141. package/Components/UploadLayout/ProgressItem.d.ts +27 -0
  142. package/Components/UploadLayout/ProgressItem.js +210 -0
  143. package/Components/UploadLayout/ProgressItem.js.map +1 -0
  144. package/Components/UploadLayout/UploadArea.d.ts +9 -0
  145. package/Components/UploadLayout/UploadArea.js +58 -0
  146. package/Components/UploadLayout/UploadArea.js.map +1 -0
  147. package/Components/UploadLayout/UploadMonitor.d.ts +42 -0
  148. package/Components/UploadLayout/UploadMonitor.js +259 -0
  149. package/Components/UploadLayout/UploadMonitor.js.map +1 -0
  150. package/Components/UploadLayout/UploadPannel.d.ts +4 -0
  151. package/Components/UploadLayout/UploadPannel.js +20 -0
  152. package/Components/UploadLayout/UploadPannel.js.map +1 -0
  153. package/Components/UploadLayout/UploadStatus.d.ts +21 -0
  154. package/Components/UploadLayout/UploadStatus.js +184 -0
  155. package/Components/UploadLayout/UploadStatus.js.map +1 -0
  156. package/Components/UploadLayout/index.d.ts +69 -0
  157. package/Components/UploadLayout/index.js +265 -0
  158. package/Components/UploadLayout/index.js.map +1 -0
  159. package/Components/UploadLayout/types.d.ts +10 -0
  160. package/Components/UploadLayout/types.js +2 -0
  161. package/Components/UploadLayout/types.js.map +1 -0
  162. package/Components/Views/Billing/BillingForm/index.d.ts +16 -0
  163. package/Components/Views/Billing/BillingForm/index.js +49 -0
  164. package/Components/Views/Billing/BillingForm/index.js.map +1 -0
  165. package/Components/Views/Billing/ItemBillingRowMenu/index.d.ts +23 -0
  166. package/Components/Views/Billing/ItemBillingRowMenu/index.js +153 -0
  167. package/Components/Views/Billing/ItemBillingRowMenu/index.js.map +1 -0
  168. package/Components/Views/Billing/MenuMore/index.d.ts +6 -0
  169. package/Components/Views/Billing/MenuMore/index.js +89 -0
  170. package/Components/Views/Billing/MenuMore/index.js.map +1 -0
  171. package/Components/Views/Billing/SubBillingFormComponent/index.d.ts +14 -0
  172. package/Components/Views/Billing/SubBillingFormComponent/index.js +306 -0
  173. package/Components/Views/Billing/SubBillingFormComponent/index.js.map +1 -0
  174. package/Components/Views/BillingDetail/BillingDetailForm/index.d.ts +16 -0
  175. package/Components/Views/BillingDetail/BillingDetailForm/index.js +49 -0
  176. package/Components/Views/BillingDetail/BillingDetailForm/index.js.map +1 -0
  177. package/Components/Views/BillingDetail/SubComponent/index.d.ts +10 -0
  178. package/Components/Views/BillingDetail/SubComponent/index.js +152 -0
  179. package/Components/Views/BillingDetail/SubComponent/index.js.map +1 -0
  180. package/Components/Views/DashBoard/Common/index.d.ts +18 -0
  181. package/Components/Views/DashBoard/Common/index.js +55 -0
  182. package/Components/Views/DashBoard/Common/index.js.map +1 -0
  183. package/Components/Views/DashBoard/DeliveryInfo/index.d.ts +17 -0
  184. package/Components/Views/DashBoard/DeliveryInfo/index.js +92 -0
  185. package/Components/Views/DashBoard/DeliveryInfo/index.js.map +1 -0
  186. package/Components/Views/DashBoard/OverViewInfo/index.d.ts +29 -0
  187. package/Components/Views/DashBoard/OverViewInfo/index.js +237 -0
  188. package/Components/Views/DashBoard/OverViewInfo/index.js.map +1 -0
  189. package/Components/Views/DashBoard/PanelIntro/index.d.ts +4 -0
  190. package/Components/Views/DashBoard/PanelIntro/index.js +76 -0
  191. package/Components/Views/DashBoard/PanelIntro/index.js.map +1 -0
  192. package/Components/Views/DashBoard/SummaryPanel/index.d.ts +20 -0
  193. package/Components/Views/DashBoard/SummaryPanel/index.js +229 -0
  194. package/Components/Views/DashBoard/SummaryPanel/index.js.map +1 -0
  195. package/Components/Views/DashBoard/TopChannel/index.d.ts +13 -0
  196. package/Components/Views/DashBoard/TopChannel/index.js +89 -0
  197. package/Components/Views/DashBoard/TopChannel/index.js.map +1 -0
  198. package/Components/Views/DashBoard/TopViewTable/index.d.ts +12 -0
  199. package/Components/Views/DashBoard/TopViewTable/index.js +79 -0
  200. package/Components/Views/DashBoard/TopViewTable/index.js.map +1 -0
  201. package/Components/Views/DashBoard/type.d.ts +9 -0
  202. package/Components/Views/DashBoard/type.js +2 -0
  203. package/Components/Views/DashBoard/type.js.map +1 -0
  204. package/Components/Views/Helper/index.d.ts +2 -0
  205. package/Components/Views/Helper/index.js +10 -0
  206. package/Components/Views/Helper/index.js.map +1 -0
  207. package/Components/YoutubeImage/index.d.ts +45 -0
  208. package/Components/YoutubeImage/index.js +52 -0
  209. package/Components/YoutubeImage/index.js.map +1 -0
  210. package/Components/excel-icon-disabled.svg +16 -0
  211. package/Components/excel-icon.svg +9 -0
  212. package/Components/index.css +0 -0
  213. package/Components/index.d.ts +120 -0
  214. package/ComponentsV2/GlobalModal/index.d.ts +37 -0
  215. package/ComponentsV2/GlobalModal/index.js +100 -0
  216. package/ComponentsV2/GlobalModal/index.js.map +1 -0
  217. package/ComponentsV2/HeightEqualWidth/index.d.ts +8 -0
  218. package/ComponentsV2/HeightEqualWidth/index.js +41 -0
  219. package/ComponentsV2/HeightEqualWidth/index.js.map +1 -0
  220. package/ComponentsV2/LazyView/index.d.ts +6 -0
  221. package/ComponentsV2/LazyView/index.js +30 -0
  222. package/ComponentsV2/LazyView/index.js.map +1 -0
  223. package/ComponentsV2/LoadingAnimation/LoadingSquare.d.ts +3 -0
  224. package/ComponentsV2/LoadingAnimation/LoadingSquare.js +203 -0
  225. package/ComponentsV2/LoadingAnimation/LoadingSquare.js.map +1 -0
  226. package/ComponentsV2/LoadingAnimation/index.d.ts +9 -0
  227. package/ComponentsV2/LoadingAnimation/index.js +25 -0
  228. package/ComponentsV2/LoadingAnimation/index.js.map +1 -0
  229. package/ComponentsV2/TableTemplate/CRUDPannel.d.ts +22 -0
  230. package/ComponentsV2/TableTemplate/CRUDPannel.js +199 -0
  231. package/ComponentsV2/TableTemplate/CRUDPannel.js.map +1 -0
  232. package/ComponentsV2/TableTemplate/CreateTableTemplate.d.ts +60 -0
  233. package/ComponentsV2/TableTemplate/CreateTableTemplate.js +330 -0
  234. package/ComponentsV2/TableTemplate/CreateTableTemplate.js.map +1 -0
  235. package/ComponentsV2/TableTemplate/CustomGridFilterPanel.d.ts +6 -0
  236. package/ComponentsV2/TableTemplate/CustomGridFilterPanel.js +71 -0
  237. package/ComponentsV2/TableTemplate/CustomGridFilterPanel.js.map +1 -0
  238. package/ComponentsV2/TableTemplate/CustomerGridToolbar.d.ts +2 -0
  239. package/ComponentsV2/TableTemplate/CustomerGridToolbar.js +45 -0
  240. package/ComponentsV2/TableTemplate/CustomerGridToolbar.js.map +1 -0
  241. package/ComponentsV2/TableTemplate/ItemRowMenu/index.d.ts +14 -0
  242. package/ComponentsV2/TableTemplate/ItemRowMenu/index.js +49 -0
  243. package/ComponentsV2/TableTemplate/ItemRowMenu/index.js.map +1 -0
  244. package/ComponentsV2/TableTemplate/MapOperators.d.ts +5 -0
  245. package/ComponentsV2/TableTemplate/MapOperators.js +49 -0
  246. package/ComponentsV2/TableTemplate/MapOperators.js.map +1 -0
  247. package/ComponentsV2/TableTemplate/NoRowsOverlay.d.ts +5 -0
  248. package/ComponentsV2/TableTemplate/NoRowsOverlay.js +39 -0
  249. package/ComponentsV2/TableTemplate/NoRowsOverlay.js.map +1 -0
  250. package/ComponentsV2/TableTemplate/TableConverter.d.ts +33 -0
  251. package/ComponentsV2/TableTemplate/TableConverter.js +112 -0
  252. package/ComponentsV2/TableTemplate/TableConverter.js.map +1 -0
  253. package/ComponentsV2/TableTemplate/TableFormatter.d.ts +10 -0
  254. package/ComponentsV2/TableTemplate/TableFormatter.js +122 -0
  255. package/ComponentsV2/TableTemplate/TableFormatter.js.map +1 -0
  256. package/ComponentsV2/TableTemplate/TableTemplateContext.d.ts +16 -0
  257. package/ComponentsV2/TableTemplate/TableTemplateContext.js +6 -0
  258. package/ComponentsV2/TableTemplate/TableTemplateContext.js.map +1 -0
  259. package/ComponentsV2/TableTemplate/index.d.ts +14 -0
  260. package/ComponentsV2/TableTemplate/index.js +9 -0
  261. package/ComponentsV2/TableTemplate/index.js.map +1 -0
  262. package/ComponentsV2/TableTemplate/type.d.ts +59 -0
  263. package/ComponentsV2/TableTemplate/type.js +14 -0
  264. package/ComponentsV2/TableTemplate/type.js.map +1 -0
  265. package/ComponentsV2/index.css +4 -0
  266. package/ComponentsV2/index.d.ts +4 -0
  267. package/ComponentsV2/index.js +6 -0
  268. package/ComponentsV2/index.js.map +1 -0
  269. package/Services/Getway/RequestHelper.d.ts +2 -0
  270. package/Services/Getway/RequestHelper.js +51 -0
  271. package/Services/Getway/RequestHelper.js.map +1 -0
  272. package/Services/Getway/index.d.ts +3 -0
  273. package/Services/Getway/index.js +14 -0
  274. package/Services/Getway/index.js.map +1 -0
  275. package/Services/ServiceBase.d.ts +32 -0
  276. package/Services/ServiceBase.js +523 -0
  277. package/Services/ServiceBase.js.map +1 -0
  278. package/_virtual/_rollupPluginBabelHelpers.js +393 -0
  279. package/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
  280. package/index.css +2 -0
  281. package/index.css.map +1 -0
  282. package/package.json +118 -0
  283. package/types/clipboard-copy.d.ts +6 -0
@@ -0,0 +1,94 @@
1
+ import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import IconButton from '@mui/material/IconButton';
3
+ import SnackbarContent from '@mui/material/SnackbarContent';
4
+ import { withStyles } from '@mui/styles';
5
+ import CheckCircleIcon from '@mui/icons-material/CheckCircle';
6
+ import CloseIcon from '@mui/icons-material/Close';
7
+ import ErrorIcon from '@mui/icons-material/Error';
8
+ import InfoIcon from '@mui/icons-material/Info';
9
+ import WarningIcon from '@mui/icons-material/Warning';
10
+ import clsx from 'clsx';
11
+ import PropTypes from 'prop-types';
12
+ import * as React from 'react';
13
+ import { defaultTheme } from '../helpers.js';
14
+ import { jsx, jsxs } from 'react/jsx-runtime';
15
+
16
+ var _excluded = ["classes", "className", "message", "onClose", "variant"];
17
+ var variantIcon = {
18
+ success: CheckCircleIcon,
19
+ warning: WarningIcon,
20
+ error: ErrorIcon,
21
+ info: InfoIcon
22
+ };
23
+ var styles = function styles(theme) {
24
+ return {
25
+ successAlert: {
26
+ backgroundColor: theme.palette.success.main
27
+ },
28
+ errorAlert: {
29
+ backgroundColor: theme.palette.error.main
30
+ },
31
+ infoAlert: {
32
+ backgroundColor: theme.palette.info.main
33
+ },
34
+ warningAlert: {
35
+ backgroundColor: theme.palette.warning.main
36
+ },
37
+ message: {
38
+ display: "flex",
39
+ alignItems: "center",
40
+ "& > svg": {
41
+ marginRight: theme.spacing(1)
42
+ }
43
+ },
44
+ icon: {
45
+ fontSize: 20,
46
+ opacity: 0.9
47
+ },
48
+ closeButton: {}
49
+ };
50
+ };
51
+ var SnackbarContentWrapper = /*#__PURE__*/React.forwardRef(function (props, refObject) {
52
+ var classes = props.classes,
53
+ className = props.className,
54
+ message = props.message,
55
+ onClose = props.onClose,
56
+ variant = props.variant,
57
+ other = _objectWithoutProperties(props, _excluded);
58
+ var Icon = variantIcon[variant];
59
+ return /*#__PURE__*/jsx(SnackbarContent, _objectSpread2({
60
+ ref: refObject,
61
+ className: clsx(classes["".concat(variant, "Alert")], className),
62
+ "aria-describedby": "client-snackbar",
63
+ message: /*#__PURE__*/jsxs("span", {
64
+ id: "client-snackbar",
65
+ className: classes.message,
66
+ children: [/*#__PURE__*/jsx(Icon, {
67
+ className: classes.icon
68
+ }), message]
69
+ }),
70
+ action: [/*#__PURE__*/jsx(IconButton, {
71
+ "aria-label": "Close",
72
+ color: "inherit",
73
+ className: classes.closeButton,
74
+ onClick: onClose,
75
+ children: /*#__PURE__*/jsx(CloseIcon, {
76
+ className: classes.icon
77
+ })
78
+ }, "close")]
79
+ }, other));
80
+ });
81
+ SnackbarContentWrapper.propTypes = {
82
+ classes: PropTypes.object.isRequired,
83
+ className: PropTypes.string,
84
+ message: PropTypes.node,
85
+ onClose: PropTypes.func,
86
+ variant: PropTypes.oneOf(["success", "warning", "error", "info"]).isRequired
87
+ };
88
+ var SnackbarContentWrapper$1 = withStyles(styles, {
89
+ name: "MuiDropzoneSnackbar",
90
+ defaultTheme: defaultTheme
91
+ })(SnackbarContentWrapper);
92
+
93
+ export { SnackbarContentWrapper$1 as default };
94
+ //# sourceMappingURL=SnackbarContentWrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SnackbarContentWrapper.js","sources":["../../../../src/Components/DropZone/components/SnackbarContentWrapper.jsx"],"sourcesContent":["import IconButton from \"@mui/material/IconButton\";\r\nimport SnackbarContent from \"@mui/material/SnackbarContent\";\r\nimport { withStyles } from \"@mui/styles\";\r\nimport CheckCircleIcon from \"@mui/icons-material/CheckCircle\";\r\nimport CloseIcon from \"@mui/icons-material/Close\";\r\nimport ErrorIcon from \"@mui/icons-material/Error\";\r\nimport InfoIcon from \"@mui/icons-material/Info\";\r\nimport WarningIcon from \"@mui/icons-material/Warning\";\r\nimport clsx from \"clsx\";\r\nimport PropTypes from \"prop-types\";\r\nimport * as React from \"react\";\r\nimport { defaultTheme } from \"../helpers\";\r\n\r\nconst variantIcon = {\r\n success: CheckCircleIcon,\r\n warning: WarningIcon,\r\n error: ErrorIcon,\r\n info: InfoIcon,\r\n};\r\n\r\nconst styles = (theme) => ({\r\n successAlert: {\r\n backgroundColor: theme.palette.success.main,\r\n },\r\n errorAlert: {\r\n backgroundColor: theme.palette.error.main,\r\n },\r\n infoAlert: {\r\n backgroundColor: theme.palette.info.main,\r\n },\r\n warningAlert: {\r\n backgroundColor: theme.palette.warning.main,\r\n },\r\n message: {\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n \"& > svg\": {\r\n marginRight: theme.spacing(1),\r\n },\r\n },\r\n icon: {\r\n fontSize: 20,\r\n opacity: 0.9,\r\n },\r\n closeButton: {},\r\n});\r\n\r\nconst SnackbarContentWrapper = React.forwardRef((props, refObject) => {\r\n const { classes, className, message, onClose, variant, ...other } = props;\r\n const Icon = variantIcon[variant];\r\n return (\r\n <SnackbarContent\r\n ref={refObject}\r\n className={clsx(classes[`${variant}Alert`], className)}\r\n aria-describedby=\"client-snackbar\"\r\n message={\r\n <span id=\"client-snackbar\" className={classes.message}>\r\n <Icon className={classes.icon} />\r\n {message}\r\n </span>\r\n }\r\n action={[\r\n <IconButton\r\n key=\"close\"\r\n aria-label=\"Close\"\r\n color=\"inherit\"\r\n className={classes.closeButton}\r\n onClick={onClose}\r\n >\r\n <CloseIcon className={classes.icon} />\r\n </IconButton>,\r\n ]}\r\n {...other}\r\n />\r\n );\r\n});\r\n\r\nSnackbarContentWrapper.propTypes = {\r\n classes: PropTypes.object.isRequired,\r\n className: PropTypes.string,\r\n message: PropTypes.node,\r\n onClose: PropTypes.func,\r\n variant: PropTypes.oneOf([\"success\", \"warning\", \"error\", \"info\"]).isRequired,\r\n};\r\n\r\nexport default withStyles(styles, {\r\n name: \"MuiDropzoneSnackbar\",\r\n defaultTheme,\r\n})(SnackbarContentWrapper);\r\n"],"names":["variantIcon","success","CheckCircleIcon","warning","WarningIcon","error","ErrorIcon","info","InfoIcon","styles","theme","successAlert","backgroundColor","palette","main","errorAlert","infoAlert","warningAlert","message","display","alignItems","marginRight","spacing","icon","fontSize","opacity","closeButton","SnackbarContentWrapper","React","forwardRef","props","refObject","classes","className","onClose","variant","other","_objectWithoutProperties","_excluded","Icon","_jsx","SnackbarContent","_objectSpread","ref","clsx","concat","_jsxs","id","children","action","IconButton","color","onClick","CloseIcon","propTypes","PropTypes","object","isRequired","string","node","func","oneOf","withStyles","name","defaultTheme"],"mappings":";;;;;;;;;;;;;;;;AAaA,IAAMA,WAAW,GAAG;AAClBC,EAAAA,OAAO,EAAEC,eAAe;AACxBC,EAAAA,OAAO,EAAEC,WAAW;AACpBC,EAAAA,KAAK,EAAEC,SAAS;AAChBC,EAAAA,IAAI,EAAEC;AACR,CAAC;AAED,IAAMC,MAAM,GAAG,SAATA,MAAMA,CAAIC,KAAK,EAAA;EAAA,OAAM;AACzBC,IAAAA,YAAY,EAAE;AACZC,MAAAA,eAAe,EAAEF,KAAK,CAACG,OAAO,CAACZ,OAAO,CAACa;KACxC;AACDC,IAAAA,UAAU,EAAE;AACVH,MAAAA,eAAe,EAAEF,KAAK,CAACG,OAAO,CAACR,KAAK,CAACS;KACtC;AACDE,IAAAA,SAAS,EAAE;AACTJ,MAAAA,eAAe,EAAEF,KAAK,CAACG,OAAO,CA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;MAAA8B,QAAA,EAAA,cACpDR,GAAA,CAACD,IAAI,EAAA;QAACN,SAAS,EAAED,OAAO,CAACT;OAAO,CAAC,EAChCL,OAAO;AAAA,KACJ,CACP;AACD+B,IAAAA,MAAM,EAAE,cACNT,GAAA,CAACU,UAAU,EAAA;AAET,MAAA,YAAA,EAAW,OAAO;AAClBC,MAAAA,KAAK,EAAC,SAAS;MACflB,SAAS,EAAED,OAAO,CAACN,WAAY;AAC/B0B,MAAAA,OAAO,EAAElB,OAAQ;MAAAc,QAAA,eAEjBR,GAAA,CAACa,SAAS,EAAA;QAACpB,SAAS,EAAED,OAAO,CAACT;OAAO;AAAC,KAAA,EANlC,OAOM,CAAC;GAEXa,EAAAA,KAAK,CACV,CAAC;AAEN,CAAC,CAAC;AAEFT,sBAAsB,CAAC2B,SAAS,GAAG;AACjCtB,EAAAA,OAAO,EAAEuB,SAAS,CAACC,MAAM,CAACC,UAAU;EACpCxB,SAAS,EAAEsB,SAAS,CAACG,MAAM;EAC3BxC,OAAO,EAAEqC,SAAS,CAACI,IAAI;EACvBzB,OAAO,EAAEqB,SAAS,CAACK,IAAI;AACvBzB,EAAAA,OAAO,EAAEoB,SAAS,CAACM,KAAK,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAACJ;AACpE,CAAC;AAED,+BAAeK,UAAU,CAACrD,MAAM,EAAE;AAChCsD,EAAAA,IAAI,EAAE,qBAAqB;AAC3BC,EAAAA,YAAY,EAAZA;AACF,CAAC,CAAC,CAACrC,sBAAsB,CAAC;;;;"}
@@ -0,0 +1,5 @@
1
+ export function isImage(file: any): true | undefined;
2
+ export function convertBytesToMbsOrKbs(filesize: any): string;
3
+ export function createFileFromUrl(url: any): Promise<File>;
4
+ export function readFile(file: any): Promise<any>;
5
+ export const defaultTheme: import("@mui/material").Theme;
@@ -0,0 +1,64 @@
1
+ import { asyncToGenerator as _asyncToGenerator, regenerator as _regenerator } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { createTheme } from '@mui/material';
3
+
4
+ function isImage(file) {
5
+ if (file.type.split("/")[0] === "image") {
6
+ return true;
7
+ }
8
+ }
9
+ function convertBytesToMbsOrKbs(filesize) {
10
+ var size = "";
11
+ if (filesize >= 1048576) {
12
+ size = filesize / 1048576 + " megabytes";
13
+ } else if (filesize >= 1024) {
14
+ size = filesize / 1024 + " kilobytes";
15
+ } else {
16
+ size = filesize + " bytes";
17
+ }
18
+ return size;
19
+ }
20
+ function createFileFromUrl(_x) {
21
+ return _createFileFromUrl.apply(this, arguments);
22
+ }
23
+ function _createFileFromUrl() {
24
+ _createFileFromUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(url) {
25
+ var response, data, metadata, filename;
26
+ return _regenerator().w(function (_context) {
27
+ while (1) switch (_context.n) {
28
+ case 0:
29
+ _context.n = 1;
30
+ return fetch(url);
31
+ case 1:
32
+ response = _context.v;
33
+ _context.n = 2;
34
+ return response.blob();
35
+ case 2:
36
+ data = _context.v;
37
+ metadata = {
38
+ type: data.type
39
+ };
40
+ filename = url.replace(/\?.+/, "").split("/").pop();
41
+ return _context.a(2, new File([data], filename, metadata));
42
+ }
43
+ }, _callee);
44
+ }));
45
+ return _createFileFromUrl.apply(this, arguments);
46
+ }
47
+ function readFile(file) {
48
+ return new Promise(function (resolve, reject) {
49
+ var reader = new FileReader();
50
+ reader.onload = function (event) {
51
+ var _event$target;
52
+ resolve(event === null || event === void 0 || (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.result);
53
+ };
54
+ reader.onerror = function (event) {
55
+ reader.abort();
56
+ reject(event);
57
+ };
58
+ reader.readAsDataURL(file);
59
+ });
60
+ }
61
+ var defaultTheme = createTheme();
62
+
63
+ export { convertBytesToMbsOrKbs, createFileFromUrl, defaultTheme, isImage, readFile };
64
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sources":["../../../src/Components/DropZone/helpers.js"],"sourcesContent":["import { createTheme } from \"@mui/material\";\r\n\r\nexport function isImage(file) {\r\n if (file.type.split(\"/\")[0] === \"image\") {\r\n return true;\r\n }\r\n}\r\n\r\nexport function convertBytesToMbsOrKbs(filesize) {\r\n let size = \"\";\r\n if (filesize >= 1048576) {\r\n size = filesize / 1048576 + \" megabytes\";\r\n } else if (filesize >= 1024) {\r\n size = filesize / 1024 + \" kilobytes\";\r\n } else {\r\n size = filesize + \" bytes\";\r\n }\r\n return size;\r\n}\r\n\r\nexport async function createFileFromUrl(url) {\r\n const response = await fetch(url);\r\n const data = await response.blob();\r\n const metadata = { type: data.type };\r\n const filename = url.replace(/\\?.+/, \"\").split(\"/\").pop();\r\n return new File([data], filename, metadata);\r\n}\r\n\r\nexport function readFile(file) {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader();\r\n reader.onload = (event) => {\r\n resolve(event?.target?.result);\r\n };\r\n reader.onerror = (event) => {\r\n reader.abort();\r\n reject(event);\r\n };\r\n reader.readAsDataURL(file);\r\n });\r\n}\r\n\r\nexport const defaultTheme = createTheme();\r\n"],"names":["isImage","file","type","split","convertBytesToMbsOrKbs","filesize","size","createFileFromUrl","_x","_createFileFromUrl","apply","arguments","_asyncToGenerator","_regenerator","m","_callee","url","response","data","metadata","filename","w","_context","n","fetch","v","blob","replace","pop","a","File","readFile","Promise","resolve","reject","reader","FileReader","onload","event","_event$target","target","result","onerror","abort","readAsDataURL","defaultTheme","createTheme"],"mappings":";;;AAEO,SAASA,OAAOA,CAACC,IAAI,EAAE;AAC5B,EAAA,IAAIA,IAAI,CAACC,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;AACvC,IAAA,OAAO,IAAI;AACb;AACF;AAEO,SAASC,sBAAsBA,CAACC,QAAQ,EAAE;EAC/C,IAAIC,IAAI,GAAG,EAAE;EACb,IAAID,QAAQ,IAAI,OAAO,EAAE;AACvBC,IAAAA,IAAI,GAAGD,QAA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,CAAA,CAAA,EAClD,IAAIC,IAAI,CAAC,CAACZ,IAAI,CAAC,EAAEE,QAAQ,EAAED,QAAQ,CAAC,CAAA;AAAA;AAAA,KAAA,EAAAJ,OAAA,CAAA;GAC5C,CAAA,CAAA;AAAA,EAAA,OAAAN,kBAAA,CAAAC,KAAA,CAAA,IAAA,EAAAC,SAAA,CAAA;AAAA;AAEM,SAASoB,QAAQA,CAAC9B,IAAI,EAAE;AAC7B,EAAA,OAAO,IAAI+B,OAAO,CAAC,UAACC,OAAO,EAAEC,MAAM,EAAK;AACtC,IAAA,IAAMC,MAAM,GAAG,IAAIC,UAAU,EAAE;AAC/BD,IAAAA,MAAM,CAACE,MAAM,GAAG,UAACC,KAAK,EAAK;AAAA,MAAA,IAAAC,aAAA;AACzBN,MAAAA,OAAO,CAACK,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,MAAA,IAAA,CAAAC,aAAA,GAALD,KAAK,CAAEE,MAAM,cAAAD,aAAA,KAAA,MAAA,GAAA,MAAA,GAAbA,aAAA,CAAeE,MAAM,CAAC;KAC/B;AACDN,IAAAA,MAAM,CAACO,OAAO,GAAG,UAACJ,KAAK,EAAK;MAC1BH,MAAM,CAACQ,KAAK,EAAE;MACdT,MAAM,CAACI,KAAK,CAAC;KACd;AACDH,IAAAA,MAAM,CAACS,aAAa,CAAC3C,IAAI,CAAC;AAC5B,GAAC,CAAC;AACJ;AAEa4C,IAAAA,YAAY,GAAGC,WAAW;;;;"}
@@ -0,0 +1,120 @@
1
+ import { ChipProps } from '@mui/material/Chip'
2
+ import { DialogProps } from '@mui/material/Dialog'
3
+ import { GridProps } from '@mui/material/Grid'
4
+ import { SnackbarProps } from '@mui/material/Snackbar'
5
+ import * as React from 'react'
6
+ import { DropEvent, DropzoneProps } from 'react-dropzone'
7
+
8
+ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
9
+
10
+ export interface FileObject {
11
+ readonly file: File
12
+ readonly data: string | ArrayBuffer | null
13
+ }
14
+
15
+ export interface PreviewIconProps {
16
+ readonly classes: string
17
+ }
18
+
19
+ export type AlertType = 'error' | 'success' | 'info'
20
+
21
+ // DropzoneAreaBase
22
+
23
+ export type DropzoneAreaBaseClasses = {
24
+ /** Material-UI class applied to the root Dropzone div */
25
+ root: string
26
+ /** Material-UI class applied to the Dropzone when 'active' */
27
+ active: string
28
+ /** Material-UI class applied to the Dropzone when 'invalid' */
29
+ invalid: string
30
+ /** Material-UI class applied to the Dropzone text container div */
31
+ textContainer: string
32
+ /** Material-UI class applied to the Dropzone text */
33
+ text: string
34
+ /** Material-UI class applied to the Dropzone icon */
35
+ icon: string
36
+ }
37
+
38
+ export type DropzoneAreaBaseProps = {
39
+ classes?: Partial<DropzoneAreaBaseClasses>
40
+ acceptedFiles?: { [key: string]: string[] }
41
+ fileObjects: FileObject[]
42
+ filesLimit?: number
43
+ Icon?: React.ComponentType
44
+ maxFileSize?: number
45
+ dropzoneText?: string
46
+ previewText?: string
47
+ showPreviews?: boolean
48
+ showPreviewsInDropzone?: boolean
49
+ showFileNamesInPreview?: boolean
50
+ showFileNames?: boolean
51
+ useChipsForPreview?: boolean
52
+ previewChipProps?: ChipProps
53
+ previewGridClasses?: {
54
+ container?: string
55
+ item?: string
56
+ image?: string
57
+ }
58
+ previewGridProps?: {
59
+ container?: GridProps
60
+ item?: GridProps
61
+ }
62
+ showAlerts?: boolean | AlertType[]
63
+ alertSnackbarProps?: SnackbarProps
64
+ dropzoneProps?: DropzoneProps
65
+ inputProps?: React.HTMLProps<HTMLInputElement>
66
+ clearOnUnmount?: boolean
67
+ dropzoneClass?: string
68
+ dropzoneParagraphClass?: string
69
+ disableRejectionFeedback?: boolean
70
+ onAdd?: (newFiles: FileObject[]) => void
71
+ onDelete?: (deletedFileObject: FileObject, index: number) => void
72
+ onDrop?: (files: File[], event: DropEvent) => void
73
+ onDropRejected?: (files: File[], event: DropEvent) => void
74
+ onAlert?: (message: string, variant: AlertType) => void
75
+ getFileLimitExceedMessage?: (filesLimit: number) => string
76
+ getFileAddedMessage?: (fileName: string) => string
77
+ getFileRemovedMessage?: (fileName: string) => string
78
+ getDropRejectMessage?: (rejectedFile: File, acceptedFiles: string[], maxFileSize: number) => string
79
+ getPreviewIcon?: (file: FileObject, classes: PreviewIconProps) => React.ReactElement
80
+ }
81
+
82
+ export const DropzoneAreaBase: React.ComponentType<DropzoneAreaBaseProps>
83
+
84
+ // DropzoneArea
85
+
86
+ export type DropzoneAreaProps = Omit<DropzoneAreaBaseProps, 'fileObjects' | 'onAdd' | 'onDelete'> & {
87
+ clearOnUnmount?: boolean
88
+ initialFiles?: (File | string)[]
89
+ onChange?: (files: File[]) => void
90
+ onDelete?: (file: File) => void
91
+ }
92
+
93
+ export const DropzoneArea: React.ComponentType<DropzoneAreaProps>
94
+
95
+ // DropzoneDialogBase
96
+
97
+ export type DropzoneDialogBaseProps = DropzoneAreaBaseProps & {
98
+ cancelButtonText?: string
99
+ dialogProps?: DialogProps
100
+ dialogTitle?: string | JSX.Element
101
+ fullWidth?: boolean
102
+ maxWidth?: string
103
+ onClose?: (event: React.SyntheticEvent) => void
104
+ onSave?: (event: React.SyntheticEvent) => void
105
+ open?: boolean
106
+ submitButtonText?: string
107
+ }
108
+
109
+ export const DropzoneDialogBase: React.ComponentType<DropzoneDialogBaseProps>
110
+
111
+ // DropzoneDialog
112
+
113
+ export type DropzoneDialogProps = Omit<DropzoneDialogBaseProps, 'fileObjects' | 'onAdd' | 'onDelete' | 'onSave'> & {
114
+ clearOnUnmount?: boolean
115
+ initialFiles?: (File | string)[]
116
+ onSave?: (files: File[], event: React.SyntheticEvent) => void
117
+ onDelete?: (file: File) => void
118
+ }
119
+
120
+ export const DropzoneDialog: React.ComponentType<DropzoneDialogProps>
@@ -0,0 +1,26 @@
1
+ import { SxProps, Theme } from '@mui/material';
2
+ import { Component } from 'react';
3
+ import './index.css';
4
+ import { CSSProperties } from '@mui/styles';
5
+ interface EditAvatarProps {
6
+ sx?: SxProps<Theme>;
7
+ onSave?: (image: string) => void;
8
+ extra?: any;
9
+ }
10
+ interface EditAvatarState {
11
+ preview?: string;
12
+ src?: string;
13
+ labelStyle: CSSProperties;
14
+ }
15
+ export default class EditAvatar extends Component<EditAvatarProps, EditAvatarState> {
16
+ constructor(props: EditAvatarProps);
17
+ onClose(): void;
18
+ onCrop(preview: any): void;
19
+ renderEditAvatar: () => JSX.Element;
20
+ onEditClick: () => void;
21
+ onChange: () => void;
22
+ refInput: HTMLInputElement | null;
23
+ onSave: () => void;
24
+ render(): JSX.Element;
25
+ }
26
+ export {};
@@ -0,0 +1,137 @@
1
+ import { inherits as _inherits, createClass as _createClass, objectSpread2 as _objectSpread2, classCallCheck as _classCallCheck, callSuper as _callSuper, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
+ import { Box, IconButton } from '@mui/material';
4
+ import Modal from '@mui/material/Modal';
5
+ import { Component } from 'react';
6
+ import Avatar from 'react-avatar-edit';
7
+ import { Edit } from '@mui/icons-material';
8
+ import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';
9
+
10
+ var EditAvatar = /*#__PURE__*/function (_Component) {
11
+ function EditAvatar(props) {
12
+ var _this;
13
+ _classCallCheck(this, EditAvatar);
14
+ _this = _callSuper(this, EditAvatar, [props]);
15
+ _defineProperty(_this, "renderEditAvatar", function () {
16
+ return jsx(Avatar, {
17
+ width: 390,
18
+ height: 295,
19
+ minCropRadius: 100,
20
+ onCrop: _this.onCrop,
21
+ onClose: _this.onClose,
22
+ borderStyle: {
23
+ display: 'none'
24
+ },
25
+ src: _this.state.src,
26
+ labelStyle: _this.state.labelStyle
27
+ });
28
+ });
29
+ _defineProperty(_this, "onEditClick", function () {
30
+ var _this$refInput;
31
+ (_this$refInput = _this.refInput) === null || _this$refInput === void 0 || _this$refInput.click();
32
+ });
33
+ _defineProperty(_this, "onChange", function () {
34
+ if (!_this.refInput || !_this.refInput.files) return;
35
+ var file = _this.refInput.files[0];
36
+ _this.setState({
37
+ src: URL.createObjectURL(file)
38
+ });
39
+ });
40
+ _defineProperty(_this, "refInput", null);
41
+ _defineProperty(_this, "onSave", function () {
42
+ _this.onClose();
43
+ _this.state.preview && _this.props.onSave && _this.props.onSave(_this.state.preview);
44
+ });
45
+ _this.state = {
46
+ labelStyle: {
47
+ color: 'red',
48
+ fontSize: '24px'
49
+ }
50
+ };
51
+ _this.onCrop = _this.onCrop.bind(_this);
52
+ _this.onClose = _this.onClose.bind(_this);
53
+ return _this;
54
+ }
55
+ _inherits(EditAvatar, _Component);
56
+ return _createClass(EditAvatar, [{
57
+ key: "onClose",
58
+ value: function onClose() {
59
+ if (this.refInput) {
60
+ this.refInput.value = '';
61
+ }
62
+ this.setState({
63
+ preview: undefined,
64
+ src: undefined
65
+ });
66
+ }
67
+ }, {
68
+ key: "onCrop",
69
+ value: function onCrop(preview) {
70
+ this.setState({
71
+ preview: preview
72
+ });
73
+ }
74
+ }, {
75
+ key: "render",
76
+ value: function render() {
77
+ var _this$props$sx,
78
+ _this2 = this;
79
+ return jsxs(Fragment, {
80
+ children: [jsxs(Box, {
81
+ className: 'container-edit',
82
+ sx: _objectSpread2({
83
+ position: 'relative',
84
+ minWidth: '100px',
85
+ minHeight: '100px'
86
+ }, (_this$props$sx = this.props.sx) !== null && _this$props$sx !== void 0 ? _this$props$sx : {}),
87
+ children: [this.props.children, jsx("a", {
88
+ onClick: this.onEditClick,
89
+ className: 'overlay-edit',
90
+ children: jsx(Edit, {})
91
+ }), jsx("input", {
92
+ onChange: this.onChange,
93
+ accept: 'image/*',
94
+ type: 'file',
95
+ ref: function ref(_ref) {
96
+ return _this2.refInput = _ref;
97
+ },
98
+ hidden: true
99
+ })]
100
+ }), jsx(Modal, {
101
+ open: !!this.state.src,
102
+ "aria-labelledby": 'edit-avatar-title',
103
+ "aria-describedby": 'edit-avatar-description',
104
+ sx: {
105
+ height: '100vh',
106
+ display: 'flex',
107
+ justifyContent: 'center',
108
+ alignItems: 'center'
109
+ },
110
+ children: jsxs(Box, {
111
+ sx: {
112
+ display: 'flex',
113
+ justifyContent: 'center',
114
+ alignItems: 'center',
115
+ background: '#e0e0e0',
116
+ position: 'relative'
117
+ },
118
+ children: [this.renderEditAvatar(), jsx(IconButton, {
119
+ onClick: this.onSave,
120
+ sx: {
121
+ color: 'white',
122
+ position: 'absolute',
123
+ right: 0,
124
+ top: 0,
125
+ p: '7px'
126
+ },
127
+ children: jsx(CheckCircleOutlineIcon, {})
128
+ })]
129
+ })
130
+ })]
131
+ });
132
+ }
133
+ }]);
134
+ }(Component);
135
+
136
+ export { EditAvatar as default };
137
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/Components/EditAvatar/index.tsx"],"sourcesContent":["import { Box, IconButton, SxProps, Theme } from '@mui/material'\r\nimport Modal from '@mui/material/Modal'\r\nimport React, { Component } from 'react'\r\nimport './index.css'\r\nimport Avatar from 'react-avatar-edit'\r\nimport { CSSProperties } from '@mui/styles'\r\nimport { Edit } from '@mui/icons-material'\r\nimport CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'\r\ninterface EditAvatarProps {\r\n sx?: SxProps<Theme>\r\n onSave?: (image: string) => void\r\n extra?: any\r\n}\r\ninterface EditAvatarState {\r\n preview?: string\r\n src?: string\r\n labelStyle: CSSProperties\r\n}\r\nexport default class EditAvatar extends Component<EditAvatarProps, EditAvatarState> {\r\n constructor(props: EditAvatarProps) {\r\n super(props)\r\n this.state = {\r\n labelStyle: {\r\n color: 'red',\r\n fontSize: '24px'\r\n }\r\n }\r\n this.onCrop = this.onCrop.bind(this)\r\n this.onClose = this.onClose.bind(this)\r\n }\r\n onClose() {\r\n if (this.refInput) {\r\n this.refInput.value = ''\r\n }\r\n this.setState({ preview: undefined, src: undefined })\r\n }\r\n\r\n onCrop(preview: any) {\r\n this.setState({ preview })\r\n }\r\n renderEditAvatar = () => {\r\n return (\r\n <Avatar\r\n width={390}\r\n height={295}\r\n minCropRadius={100}\r\n onCrop={this.onCrop}\r\n onClose={this.onClose}\r\n borderStyle={{ display: 'none' }}\r\n src={this.state.src}\r\n labelStyle={this.state.labelStyle}\r\n />\r\n )\r\n }\r\n onEditClick = () => {\r\n this.refInput?.click()\r\n }\r\n onChange = () => {\r\n if (!this.refInput || !this.refInput.files) return\r\n const file = this.refInput.files[0]\r\n this.setState({ src: URL.createObjectURL(file) })\r\n }\r\n refInput: HTMLInputElement | null = null\r\n onSave = () => {\r\n this.onClose()\r\n this.state.preview && this.props.onSave && this.props.onSave(this.state.preview)\r\n }\r\n render() {\r\n return (\r\n <>\r\n <Box className='container-edit' sx={{ position: 'relative', minWidth: '100px', minHeight: '100px', ...(this.props.sx ?? {}) }}>\r\n {this.props.children}\r\n <a onClick={this.onEditClick} className='overlay-edit'>\r\n <Edit />\r\n </a>\r\n <input onChange={this.onChange} accept='image/*' type='file' ref={(ref) => (this.refInput = ref)} hidden />\r\n </Box>\r\n <Modal\r\n open={!!this.state.src}\r\n aria-labelledby='edit-avatar-title'\r\n aria-describedby='edit-avatar-description'\r\n sx={{\r\n height: '100vh',\r\n display: 'flex',\r\n justifyContent: 'center',\r\n alignItems: 'center'\r\n }}\r\n >\r\n <Box\r\n sx={{\r\n display: 'flex',\r\n justifyContent: 'center',\r\n alignItems: 'center',\r\n background: '#e0e0e0',\r\n position: 'relative'\r\n }}\r\n >\r\n {this.renderEditAvatar()}\r\n <IconButton onClick={this.onSave} sx={{ color: 'white', position: 'absolute', right: 0, top: 0, p: '7px' }}>\r\n <CheckCircleOutlineIcon />\r\n </IconButton>\r\n </Box>\r\n </Modal>\r\n </>\r\n )\r\n }\r\n}\r\n"],"names":["EditAvatar","_Component","props","_this","_classCallCheck","_callSuper","_defineProperty","_jsx","Avatar","width","height","minCropRadius","onCrop","onClose","borderStyle","display","src","state","labelStyle","_this$refInput","refInput","click","files","file","setState","URL","createObjectURL","preview","onSave","color","fontSize","bind","_inherits","_createClass","key","value","undefined","render","_this$props$sx","_this2","_jsxs","_Fragment","children","Box","className","sx","_objectSpread","position","minWidth","minHeight","onClick","onEditClick","Edit","onChange","accept","type","ref","hidden","Modal","open","justifyContent","alignItems","background","renderEditAvatar","IconButton","right","top","p","CheckCircleOutlineIcon","Component"],"mappings":";;;;;;;;;AAkBqBA,IAAAA,UAAW,0BAAAC,UAAA,EAAA;EAC9B,SAAAD,UAAAA,CAAYE,KAAsB,EAAA;AAAA,IAAA,IAAAC,KAAA;AAAAC,IAAAA,eAAA,OAAAJ,UAAA,CAAA;AAChCG,IAAAA,KAAA,GAAAE,UAAA,CAAAL,IAAAA,EAAAA,UAAA,GAAME,KAAK,CAAA,CAAA;IAACI,eAAA,CAAAH,KAAA,EAAA,kBAAA,EAoBK,YAAK;MACtB,OACEI,GAAC,CAAAC,MAAM,EACL;AAAAC,QAAAA,KAAK,EAAE,GAAG;AACVC,QAAAA,MAAM,EAAE,GAAG;AACXC,QAAAA,aAAa,EAAE,GAAG;QAClBC,MAAM,EAAET,KAAA,CAAKS,MAAM;QACnBC,OAAO,EAAEV,KAAA,CAAKU,OAAO;AACrBC,QAAAA,WAAW,EAAE;AAAEC,UAAAA,OAAO,EAAE;SAAQ;AAChCC,QAAAA,GAAG,EAAEb,KAAA,CAAKc,KAAK,CAACD,GAAG;AACnBE,QAAAA,UAAU,EAAEf,KAAA,CAAKc,KAAK,CAACC;AACvB,OAAA,CAAA;KAEL,CAAA;IAAAZ,eAAA,CAAAH,KAAA,EAAA,aAAA,EACa,YAAK;AAAA,MAAA,IAAAgB,cAAA;AACjB,MAAA,CAAAA,cAAA,GAAAhB,KAAA,CAAKiB,QAAQ,MAAA,IAAA,IAAAD,cAAA,KAAA,MAAA,IAAbA,cAAA,CAAeE,KAAK,EAAE;KACvB,CAAA;IAAAf,eAAA,CAAAH,KAAA,EAAA,UAAA,EACU,YAAK;MACd,IAAI,CAACA,KAAA,CAAKiB,QAAQ,IAAI,CAACjB,KAAA,CAAKiB,Q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C,IAAG;aAAC;AAAEC,YAAAA,MAAM,EAAA;AAAA,WAAA,CAAG;UACvG,EACNlD,GAAA,CAACmD,KAAK,EAAA;AACJC,UAAAA,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC1C,KAAK,CAACD,GAAG;AACN,UAAA,iBAAA,EAAA,mBAAmB;AAClB,UAAA,kBAAA,EAAA,yBAAyB;AAC1C6B,UAAAA,EAAE,EAAE;AACFnC,YAAAA,MAAM,EAAE,OAAO;AACfK,YAAAA,OAAO,EAAE,MAAM;AACf6C,YAAAA,cAAc,EAAE,QAAQ;AACxBC,YAAAA,UAAU,EAAE;WACb;AAAAnB,UAAAA,QAAA,EAEDF,IAAC,CAAAG,GAAG,EACF;AAAAE,YAAAA,EAAE,EAAE;AACF9B,cAAAA,OAAO,EAAE,MAAM;AACf6C,cAAAA,cAAc,EAAE,QAAQ;AACxBC,cAAAA,UAAU,EAAE,QAAQ;AACpBC,cAAAA,UAAU,EAAE,SAAS;AACrBf,cAAAA,QAAQ,EAAE;aACX;YAEAL,QAAA,EAAA,CAAA,IAAI,CAACqB,gBAAgB,EAAE,EACxBxD,GAAC,CAAAyD,UAAU;cAACd,OAAO,EAAE,IAAI,CAACtB,MAAM;AAAEiB,cAAAA,EAAE,EAAE;AAAEhB,gBAAAA,KAAK,EAAE,OAAO;AAAEkB,gBAAAA,QAAQ,EAAE,UAAU;AAAEkB,gBAAAA,KAAK,EAAE,CAAC;AAAEC,gBAAAA,GAAG,EAAE,CAAC;AAAEC,gBAAAA,CAAC,EAAE;eAAO;AAAAzB,cAAAA,QAAA,EACxGnC,IAAC6D,sBAAsB,EAAA,EAAA;cACZ;WACT;AAAA,SAAA,CACA;AACP,OAAA,CAAA;AAEP;AAAC,GAAA,CAAA,CAAA;AAAA,CAAA,CAvFqCC,SAA2C;;;;"}
@@ -0,0 +1,26 @@
1
+ import { SxProps, Theme } from '@mui/material';
2
+ import React, { Component } from 'react';
3
+ export type TActionLoadMore = (sender: FlexInfiniteScroll) => void;
4
+ interface FlexInfiniteScrollProps {
5
+ ContainerSx?: SxProps<Theme>;
6
+ ContentSx?: SxProps<Theme>;
7
+ onLoadMore?: TActionLoadMore;
8
+ lock?: boolean;
9
+ loading?: boolean;
10
+ }
11
+ interface FlexInfiniteScrollState {
12
+ lock: boolean;
13
+ loading: boolean;
14
+ }
15
+ export default class FlexInfiniteScroll extends Component<FlexInfiniteScrollProps, FlexInfiniteScrollState> {
16
+ constructor(props: FlexInfiniteScrollProps);
17
+ loadMore: () => void;
18
+ lock: () => void;
19
+ getHeightItem: () => number;
20
+ isLoading: () => boolean;
21
+ isPinShow: () => boolean;
22
+ onScroll: React.UIEventHandler<HTMLDivElement>;
23
+ refScrollView: HTMLDivElement | null;
24
+ render(): JSX.Element;
25
+ }
26
+ export {};
@@ -0,0 +1,82 @@
1
+ import { inherits as _inherits, createClass as _createClass, objectSpread2 as _objectSpread2, classCallCheck as _classCallCheck, callSuper as _callSuper, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { Box } from '@mui/material';
4
+ import { Component } from 'react';
5
+ import LazySpinner from '../Helper/LazySpinner.js';
6
+
7
+ var FlexInfiniteScroll = /*#__PURE__*/function (_Component) {
8
+ function FlexInfiniteScroll(props) {
9
+ var _this;
10
+ _classCallCheck(this, FlexInfiniteScroll);
11
+ _this = _callSuper(this, FlexInfiniteScroll, [props]);
12
+ _defineProperty(_this, "loadMore", function () {
13
+ if (!_this.props.onLoadMore) return;
14
+ _this.props.onLoadMore(_this);
15
+ });
16
+ _defineProperty(_this, "lock", function () {
17
+ _this.setState({
18
+ lock: true
19
+ });
20
+ });
21
+ _defineProperty(_this, "getHeightItem", function () {
22
+ return 340;
23
+ });
24
+ _defineProperty(_this, "isLoading", function () {
25
+ return _this.props.loading || _this.props.lock || _this.state.loading || _this.state.lock;
26
+ });
27
+ _defineProperty(_this, "isPinShow", function () {
28
+ return (_this.props.loading || _this.state.loading) && (!_this.state.lock || !_this.props.lock);
29
+ });
30
+ _defineProperty(_this, "onScroll", function (event) {
31
+ var _this$refScrollView$s, _this$refScrollView, _this$refScrollView$o, _this$refScrollView2, _this$refScrollView$s2, _this$refScrollView3;
32
+ if (_this.isLoading()) return;
33
+ var scrollHeight = (_this$refScrollView$s = (_this$refScrollView = _this.refScrollView) === null || _this$refScrollView === void 0 ? void 0 : _this$refScrollView.scrollHeight) !== null && _this$refScrollView$s !== void 0 ? _this$refScrollView$s : 0;
34
+ var height = (_this$refScrollView$o = (_this$refScrollView2 = _this.refScrollView) === null || _this$refScrollView2 === void 0 ? void 0 : _this$refScrollView2.offsetHeight) !== null && _this$refScrollView$o !== void 0 ? _this$refScrollView$o : 0;
35
+ var position = (_this$refScrollView$s2 = (_this$refScrollView3 = _this.refScrollView) === null || _this$refScrollView3 === void 0 ? void 0 : _this$refScrollView3.scrollTop) !== null && _this$refScrollView$s2 !== void 0 ? _this$refScrollView$s2 : 0;
36
+ if (scrollHeight - position - height < _this.getHeightItem() * 3) {
37
+ _this.loadMore();
38
+ }
39
+ });
40
+ _defineProperty(_this, "refScrollView", null);
41
+ _this.state = {
42
+ loading: props.loading || false,
43
+ lock: props.lock || !props.onLoadMore
44
+ };
45
+ return _this;
46
+ }
47
+ _inherits(FlexInfiniteScroll, _Component);
48
+ return _createClass(FlexInfiniteScroll, [{
49
+ key: "render",
50
+ value: function render() {
51
+ var _this2 = this;
52
+ return jsx(Box, {
53
+ sx: _objectSpread2({
54
+ display: 'flex',
55
+ flex: 1,
56
+ overflowY: "auto"
57
+ }, this.props.ContainerSx || {}),
58
+ component: 'div',
59
+ ref: function ref(_ref) {
60
+ return _this2.refScrollView = _ref;
61
+ },
62
+ className: "flex-infinite-scroll",
63
+ onScroll: this.onScroll,
64
+ children: jsxs(Box, {
65
+ sx: _objectSpread2({
66
+ height: 0
67
+ }, this.props.ContentSx || {}),
68
+ children: [this.props.children, this.isPinShow() ? jsx(Box, {
69
+ sx: {
70
+ width: '100%',
71
+ margin: "10px 0"
72
+ },
73
+ children: jsx(LazySpinner, {})
74
+ }) : '']
75
+ })
76
+ });
77
+ }
78
+ }]);
79
+ }(Component);
80
+
81
+ export { FlexInfiniteScroll as default };
82
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/Components/FlexInfiniteScroll/index.tsx"],"sourcesContent":["import { Box, SxProps, Theme } from '@mui/material'\r\nimport React, { Component } from 'react'\r\nimport LazySpinner from '../Helper/LazySpinner'\r\n\r\n\r\nexport type TActionLoadMore = (sender: FlexInfiniteScroll) => void\r\ninterface FlexInfiniteScrollProps {\r\n ContainerSx?: SxProps<Theme>\r\n ContentSx?: SxProps<Theme>\r\n onLoadMore?: TActionLoadMore\r\n lock?: boolean\r\n loading?: boolean\r\n}\r\ninterface FlexInfiniteScrollState {\r\n lock: boolean\r\n loading: boolean\r\n}\r\nexport default class FlexInfiniteScroll extends Component<FlexInfiniteScrollProps, FlexInfiniteScrollState> {\r\n constructor(props: FlexInfiniteScrollProps) {\r\n super(props)\r\n this.state = {\r\n loading: props.loading || false,\r\n lock: props.lock || !props.onLoadMore\r\n }\r\n }\r\n loadMore = () => {\r\n if (!this.props.onLoadMore) return\r\n this.props.onLoadMore(this)\r\n }\r\n lock = () => {\r\n this.setState({ lock: true })\r\n }\r\n getHeightItem = () => 340\r\n isLoading = () => this.props.loading || this.props.lock || this.state.loading || this.state.lock\r\n isPinShow = () => (this.props.loading || this.state.loading) && (!this.state.lock || !this.props.lock)\r\n onScroll: React.UIEventHandler<HTMLDivElement> = (event) => {\r\n if (this.isLoading()) return;\r\n const scrollHeight = this.refScrollView?.scrollHeight ?? 0\r\n const height = this.refScrollView?.offsetHeight ?? 0\r\n const position = this.refScrollView?.scrollTop ?? 0\r\n if (scrollHeight - position - height < this.getHeightItem() * 3) {\r\n this.loadMore()\r\n }\r\n }\r\n refScrollView: HTMLDivElement | null = null\r\n render() {\r\n return (\r\n <Box\r\n sx={{ display: 'flex', flex: 1, overflowY: \"auto\", ...(this.props.ContainerSx || {}) }}\r\n component={'div'}\r\n ref={ref => this.refScrollView = ref as HTMLDivElement}\r\n className=\"flex-infinite-scroll\"\r\n onScroll={this.onScroll}\r\n >\r\n <Box sx={{ height: 0, ...(this.props.ContentSx || {}) }}>\r\n {this.props.children}\r\n {this.isPinShow() ?\r\n <Box sx={{ width: '100%', margin: \"10px 0\" }}>\r\n <LazySpinner />\r\n </Box>\r\n : ''\r\n }\r\n </Box>\r\n </Box>\r\n )\r\n }\r\n}\r\n"],"names":["FlexInfiniteScroll","_Component","props","_this","_classCallCheck","_callSuper","_defineProperty","onLoadMore","setState","lock","loading","state","event","_this$refScrollView$s","_this$refScrollView","_this$refScrollView$o","_this$refScrollView2","_this$refScrollView$s2","_this$refScrollView3","isLoading","scrollHeight","refScrollView","height","offsetHeight","position","scrollTop","getHeightItem","loadMore","_inherits","_createClass","key","value","render","_this2","_jsx","Box","sx","_objectSpread","display","flex","overflowY","ContainerSx","component","ref","className","onScroll","_jsxs","ContentSx","children","isPinShow","width","margin","LazySpinner","Component"],"mappings":";;;;;;AAiBqBA,IAAAA,kBAAmB,0BAAAC,UAAA,EAAA;EACpC,SAAAD,kBAAAA,CAAYE,KAA8B,EAAA;AAAA,IAAA,IAAAC,KAAA;AAAAC,IAAAA,eAAA,OAAAJ,kBAAA,CAAA;AACtCG,IAAAA,KAAA,GAAAE,UAAA,CAAAL,IAAAA,EAAAA,kBAAA,GAAME,KAAK,CAAA,CAAA;IAACI,eAAA,CAAAH,KAAA,EAAA,UAAA,EAML,YAAK;AACZ,MAAA,IAAI,CAACA,KAAA,CAAKD,KAAK,CAACK,UAAU,EAAE;AAC5BJ,MAAAA,KAAA,CAAKD,KAAK,CAACK,UAAU,CAAAJ,KAAK,CAAC;KAC9B,CAAA;IAAAG,eAAA,CAAAH,KAAA,EAAA,MAAA,EACM,YAAK;MACRA,KAAA,CAAKK,QAAQ,CAAC;AAAEC,QAAAA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AEA,IAAG,EAAA;AAAA,UAAA,OAAIV,MAAI,CAACZ,aAAa,GAAGsB,IAAqB;AAAA,SAAA;AACtDC,QAAAA,SAAS,EAAC,sBAAsB;QAChCC,QAAQ,EAAE,IAAI,CAACA,QAAQ;kBAEvBC,IAAC,CAAAX,GAAG;AAACC,UAAAA,EAAE,EAAAC,cAAA,CAAA;AAAIf,YAAAA,MAAM,EAAE;WAAO,EAAA,IAAI,CAACpB,KAAK,CAAC6C,SAAS,IAAI,EAAE,CAAG;AAClDC,UAAAA,QAAA,EAAA,CAAA,IAAI,CAAC9C,KAAK,CAAC8C,QAAQ,EACnB,IAAI,CAACC,SAAS,EAAE,GACbf,GAAA,CAACC,GAAG,EAAC;AAAAC,YAAAA,EAAE,EAAE;AAAEc,cAAAA,KAAK,EAAE,MAAM;AAAEC,cAAAA,MAAM,EAAE;aAAU;sBACxCjB,GAAC,CAAAkB,WAAW;WACV,CAAA,GACJ,EAAE;SAEN;AAAA,OAAA,CACJ;AAEd;AAAC,GAAA,CAAA,CAAA;AAAA,CAAA,CAhD2CC,SAA2D;;;;"}
@@ -0,0 +1,5 @@
1
+ import { Component } from 'react';
2
+ import './LazySpinner.css';
3
+ export default class LazySpinner extends Component {
4
+ render(): JSX.Element;
5
+ }
@@ -0,0 +1,33 @@
1
+ import { inherits as _inherits, createClass as _createClass, classCallCheck as _classCallCheck, callSuper as _callSuper } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { Component } from 'react';
4
+ import { Spinner } from 'reactstrap';
5
+
6
+ var LazySpinner = /*#__PURE__*/function (_Component) {
7
+ function LazySpinner() {
8
+ _classCallCheck(this, LazySpinner);
9
+ return _callSuper(this, LazySpinner, arguments);
10
+ }
11
+ _inherits(LazySpinner, _Component);
12
+ return _createClass(LazySpinner, [{
13
+ key: "render",
14
+ value: function render() {
15
+ return jsxs("div", {
16
+ className: "container-spinner",
17
+ children: [jsx(Spinner, {
18
+ type: "grow",
19
+ color: "primary"
20
+ }), jsx(Spinner, {
21
+ type: "grow",
22
+ color: "primary"
23
+ }), jsx(Spinner, {
24
+ type: "grow",
25
+ color: "primary"
26
+ })]
27
+ });
28
+ }
29
+ }]);
30
+ }(Component);
31
+
32
+ export { LazySpinner as default };
33
+ //# sourceMappingURL=LazySpinner.js.map