ish-ui 1.0.0-alpha.12

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 (222) hide show
  1. package/README.md +80 -0
  2. package/assets/fonts/inter/Inter-Italic.var.woff2 +0 -0
  3. package/assets/fonts/inter/Inter-Roman.var.woff2 +0 -0
  4. package/assets/fonts/inter/LICENSE.txt +92 -0
  5. package/assets/fonts/inter/index.d.ts +10 -0
  6. package/assets/fonts/inter/inter.scss +17 -0
  7. package/dist/actions/FieldProcessing.d.ts +10 -0
  8. package/dist/actions/FieldProcessing.js +17 -0
  9. package/dist/actions/index.d.ts +1 -0
  10. package/dist/actions/index.js +8 -0
  11. package/dist/appBar/AppBarHelpMenu.d.ts +3 -0
  12. package/dist/appBar/AppBarHelpMenu.js +77 -0
  13. package/dist/appBar/index.d.ts +2 -0
  14. package/dist/appBar/index.js +9 -0
  15. package/dist/buttons/AddButton.d.ts +14 -0
  16. package/dist/buttons/AddButton.js +9 -0
  17. package/dist/buttons/TimetableButton.d.ts +3 -0
  18. package/dist/buttons/TimetableButton.js +12 -0
  19. package/dist/buttons/index.d.ts +4 -0
  20. package/dist/buttons/index.js +11 -0
  21. package/dist/colorPicker/ColorPicker.d.ts +11 -0
  22. package/dist/colorPicker/ColorPicker.js +132 -0
  23. package/dist/colorPicker/index.d.ts +2 -0
  24. package/dist/colorPicker/index.js +9 -0
  25. package/dist/dialog/BrowserWarning.d.ts +3 -0
  26. package/dist/dialog/BrowserWarning.js +16 -0
  27. package/dist/dialog/confirm/ConfirmBase.d.ts +7 -0
  28. package/dist/dialog/confirm/ConfirmBase.js +29 -0
  29. package/dist/dialog/index.d.ts +5 -0
  30. package/dist/dialog/index.js +12 -0
  31. package/dist/dialog/message/Message.d.ts +3 -0
  32. package/dist/dialog/message/Message.js +91 -0
  33. package/dist/documents/DocumentIconsChooser.d.ts +3 -0
  34. package/dist/documents/DocumentIconsChooser.js +51 -0
  35. package/dist/documents/index.d.ts +3 -0
  36. package/dist/documents/index.js +10 -0
  37. package/dist/documents/utils/index.d.ts +7 -0
  38. package/dist/documents/utils/index.js +61 -0
  39. package/dist/dynamicSizeList/DynamicSizeList.d.ts +21 -0
  40. package/dist/dynamicSizeList/DynamicSizeList.js +169 -0
  41. package/dist/dynamicSizeList/index.d.ts +2 -0
  42. package/dist/dynamicSizeList/index.js +9 -0
  43. package/dist/fieldMessage/ErrorMessage.d.ts +8 -0
  44. package/dist/fieldMessage/ErrorMessage.js +14 -0
  45. package/dist/fieldMessage/WarningMessage.d.ts +8 -0
  46. package/dist/fieldMessage/WarningMessage.js +14 -0
  47. package/dist/fieldMessage/index.d.ts +6 -0
  48. package/dist/fieldMessage/index.js +13 -0
  49. package/dist/fieldMessage/styles.d.ts +3 -0
  50. package/dist/fieldMessage/styles.js +18 -0
  51. package/dist/fileUploader/FileUploaderDialog.d.ts +15 -0
  52. package/dist/fileUploader/FileUploaderDialog.js +99 -0
  53. package/dist/fileUploader/index.d.ts +2 -0
  54. package/dist/fileUploader/index.js +9 -0
  55. package/dist/formFields/CheckboxField.d.ts +7 -0
  56. package/dist/formFields/CheckboxField.js +67 -0
  57. package/dist/formFields/CodeEditorField.d.ts +6 -0
  58. package/dist/formFields/CodeEditorField.js +69 -0
  59. package/dist/formFields/ColoredCheckBox.d.ts +3 -0
  60. package/dist/formFields/ColoredCheckBox.js +41 -0
  61. package/dist/formFields/DateTimeField.d.ts +2 -0
  62. package/dist/formFields/DateTimeField.js +27 -0
  63. package/dist/formFields/EditInPlaceDateTimeField.d.ts +10 -0
  64. package/dist/formFields/EditInPlaceDateTimeField.js +188 -0
  65. package/dist/formFields/EditInPlaceDurationField.d.ts +4 -0
  66. package/dist/formFields/EditInPlaceDurationField.js +63 -0
  67. package/dist/formFields/EditInPlaceField.d.ts +10 -0
  68. package/dist/formFields/EditInPlaceField.js +58 -0
  69. package/dist/formFields/EditInPlaceFieldBase.d.ts +28 -0
  70. package/dist/formFields/EditInPlaceFieldBase.js +123 -0
  71. package/dist/formFields/EditInPlaceFileField.d.ts +7 -0
  72. package/dist/formFields/EditInPlaceFileField.js +60 -0
  73. package/dist/formFields/EditInPlaceMoneyField.d.ts +9 -0
  74. package/dist/formFields/EditInPlaceMoneyField.js +37 -0
  75. package/dist/formFields/EditInPlacePhoneField.d.ts +4 -0
  76. package/dist/formFields/EditInPlacePhoneField.js +69 -0
  77. package/dist/formFields/EditInPlaceSearchSelect.d.ts +4 -0
  78. package/dist/formFields/EditInPlaceSearchSelect.js +321 -0
  79. package/dist/formFields/FieldAdornments.d.ts +13 -0
  80. package/dist/formFields/FieldAdornments.js +27 -0
  81. package/dist/formFields/FilePreview.d.ts +17 -0
  82. package/dist/formFields/FilePreview.js +77 -0
  83. package/dist/formFields/FormRadioButtons.d.ts +3 -0
  84. package/dist/formFields/FormRadioButtons.js +27 -0
  85. package/dist/formFields/SelectCustomComponents.d.ts +5 -0
  86. package/dist/formFields/SelectCustomComponents.js +182 -0
  87. package/dist/formFields/Switch.d.ts +7 -0
  88. package/dist/formFields/Switch.js +116 -0
  89. package/dist/formFields/TextField.d.ts +6 -0
  90. package/dist/formFields/TextField.js +42 -0
  91. package/dist/formFields/UneditableBase.d.ts +17 -0
  92. package/dist/formFields/UneditableBase.js +48 -0
  93. package/dist/formFields/index.d.ts +31 -0
  94. package/dist/formFields/index.js +38 -0
  95. package/dist/index.d.ts +18 -0
  96. package/dist/index.js +25 -0
  97. package/dist/layout/InfoPill.d.ts +7 -0
  98. package/dist/layout/InfoPill.js +26 -0
  99. package/dist/layout/index.d.ts +4 -0
  100. package/dist/layout/index.js +11 -0
  101. package/dist/layout/resizable/ResizableWrapper.d.ts +14 -0
  102. package/dist/layout/resizable/ResizableWrapper.js +42 -0
  103. package/dist/markdownEditor/HtmlEditor.d.ts +15 -0
  104. package/dist/markdownEditor/HtmlEditor.js +18 -0
  105. package/dist/markdownEditor/WysiwygEditor.d.ts +8 -0
  106. package/dist/markdownEditor/WysiwygEditor.js +100 -0
  107. package/dist/markdownEditor/index.d.ts +5 -0
  108. package/dist/markdownEditor/index.js +12 -0
  109. package/dist/markdownEditor/utils/index.d.ts +9 -0
  110. package/dist/markdownEditor/utils/index.js +38 -0
  111. package/dist/model/AppBar.d.ts +11 -0
  112. package/dist/model/AppBar.js +8 -0
  113. package/dist/model/CommomObjects.d.ts +5 -0
  114. package/dist/model/CommomObjects.js +1 -0
  115. package/dist/model/CommonFunctions.d.ts +8 -0
  116. package/dist/model/CommonFunctions.js +5 -0
  117. package/dist/model/Confirm.d.ts +16 -0
  118. package/dist/model/Confirm.js +8 -0
  119. package/dist/model/Fields.d.ts +250 -0
  120. package/dist/model/Fields.js +8 -0
  121. package/dist/model/NestedEntity.d.ts +9 -0
  122. package/dist/model/NestedEntity.js +5 -0
  123. package/dist/model/Theme.d.ts +34 -0
  124. package/dist/model/Theme.js +18 -0
  125. package/dist/model/index.d.ts +7 -0
  126. package/dist/model/index.js +14 -0
  127. package/dist/styles/GlobalStylesProvider.d.ts +3 -0
  128. package/dist/styles/GlobalStylesProvider.js +417 -0
  129. package/dist/styles/StylesProviderCustom.d.ts +3 -0
  130. package/dist/styles/StylesProviderCustom.js +6 -0
  131. package/dist/styles/animateStyles.d.ts +3 -0
  132. package/dist/styles/animateStyles.js +33 -0
  133. package/dist/styles/bootstrap.d.ts +491 -0
  134. package/dist/styles/bootstrap.js +496 -0
  135. package/dist/styles/hooks.d.ts +6 -0
  136. package/dist/styles/hooks.js +38 -0
  137. package/dist/styles/index.d.ts +11 -0
  138. package/dist/styles/index.js +18 -0
  139. package/dist/styles/makeStyles.d.ts +3 -0
  140. package/dist/styles/makeStyles.js +9 -0
  141. package/dist/styles/mixins/common.d.ts +8 -0
  142. package/dist/styles/mixins/common.js +32 -0
  143. package/dist/styles/mixins/keyframes.d.ts +3 -0
  144. package/dist/styles/mixins/keyframes.js +9 -0
  145. package/dist/styles/mixins/prefixer.d.ts +1 -0
  146. package/dist/styles/mixins/prefixer.js +23 -0
  147. package/dist/tagsInput/AddTagMenu.d.ts +11 -0
  148. package/dist/tagsInput/AddTagMenu.js +36 -0
  149. package/dist/tagsInput/AddTagMenuItem.d.ts +10 -0
  150. package/dist/tagsInput/AddTagMenuItem.js +26 -0
  151. package/dist/tagsInput/TagInputList.d.ts +2 -0
  152. package/dist/tagsInput/TagInputList.js +278 -0
  153. package/dist/tagsInput/index.d.ts +6 -0
  154. package/dist/tagsInput/index.js +6 -0
  155. package/dist/themes/appTheme.d.ts +4 -0
  156. package/dist/themes/appTheme.js +322 -0
  157. package/dist/themes/index.d.ts +2 -0
  158. package/dist/themes/index.js +9 -0
  159. package/dist/themes/ishTheme.d.ts +8 -0
  160. package/dist/themes/ishTheme.js +351 -0
  161. package/dist/timetable/datePeriodFilter/DayPeriodIcons.d.ts +8 -0
  162. package/dist/timetable/datePeriodFilter/DayPeriodIcons.js +27 -0
  163. package/dist/timetable/datePeriodFilter/index.d.ts +1 -0
  164. package/dist/timetable/datePeriodFilter/index.js +8 -0
  165. package/dist/timetable/index.d.ts +2 -0
  166. package/dist/timetable/index.js +9 -0
  167. package/dist/timetable/miniCalendar/CalendarDay.d.ts +15 -0
  168. package/dist/timetable/miniCalendar/CalendarDay.js +64 -0
  169. package/dist/timetable/miniCalendar/CalendarHeader.d.ts +10 -0
  170. package/dist/timetable/miniCalendar/CalendarHeader.js +22 -0
  171. package/dist/timetable/miniCalendar/CalendarWeekPanel.d.ts +8 -0
  172. package/dist/timetable/miniCalendar/CalendarWeekPanel.js +18 -0
  173. package/dist/timetable/miniCalendar/WeekDay.d.ts +10 -0
  174. package/dist/timetable/miniCalendar/WeekDay.js +25 -0
  175. package/dist/timetable/miniCalendar/index.d.ts +8 -0
  176. package/dist/timetable/miniCalendar/index.js +15 -0
  177. package/dist/utils/DOM/Links.d.ts +1 -0
  178. package/dist/utils/DOM/Links.js +12 -0
  179. package/dist/utils/DOM/getCaretCoordinates.d.ts +6 -0
  180. package/dist/utils/DOM/getCaretCoordinates.js +109 -0
  181. package/dist/utils/DOM/getOS.d.ts +2 -0
  182. package/dist/utils/DOM/getOS.js +32 -0
  183. package/dist/utils/DOM/index.d.ts +5 -0
  184. package/dist/utils/DOM/index.js +32 -0
  185. package/dist/utils/dates/datesNormalizing.d.ts +1 -0
  186. package/dist/utils/dates/datesNormalizing.js +3 -0
  187. package/dist/utils/dates/format.d.ts +24 -0
  188. package/dist/utils/dates/format.js +28 -0
  189. package/dist/utils/dates/formatRelative.d.ts +1 -0
  190. package/dist/utils/dates/formatRelative.js +14 -0
  191. package/dist/utils/dates/formatString.d.ts +2 -0
  192. package/dist/utils/dates/formatString.js +195 -0
  193. package/dist/utils/dates/formatTimezone.d.ts +2 -0
  194. package/dist/utils/dates/formatTimezone.js +35 -0
  195. package/dist/utils/dates/index.d.ts +6 -0
  196. package/dist/utils/dates/index.js +13 -0
  197. package/dist/utils/dates/timetable.d.ts +5 -0
  198. package/dist/utils/dates/timetable.js +38 -0
  199. package/dist/utils/events/index.d.ts +2 -0
  200. package/dist/utils/events/index.js +6 -0
  201. package/dist/utils/fields/index.d.ts +1 -0
  202. package/dist/utils/fields/index.js +20 -0
  203. package/dist/utils/formatting/PhoneMasks.d.ts +304 -0
  204. package/dist/utils/formatting/PhoneMasks.js +318 -0
  205. package/dist/utils/formatting/index.d.ts +2 -0
  206. package/dist/utils/formatting/index.js +10 -0
  207. package/dist/utils/hooks/index.d.ts +1 -0
  208. package/dist/utils/hooks/index.js +15 -0
  209. package/dist/utils/index.d.ts +7 -0
  210. package/dist/utils/index.js +14 -0
  211. package/dist/utils/numbers/decimalCalculation.d.ts +4 -0
  212. package/dist/utils/numbers/decimalCalculation.js +21 -0
  213. package/dist/utils/numbers/index.d.ts +2 -0
  214. package/dist/utils/numbers/index.js +9 -0
  215. package/dist/utils/numbers/numbersNormalizing.d.ts +10 -0
  216. package/dist/utils/numbers/numbersNormalizing.js +44 -0
  217. package/dist/utils/stubs/index.d.ts +3 -0
  218. package/dist/utils/stubs/index.js +10 -0
  219. package/dist/utils/tags/index.d.ts +3 -0
  220. package/dist/utils/tags/index.js +42 -0
  221. package/index.ts +10 -0
  222. package/package.json +108 -0
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: React.JSXElementConstructor<Omit<any, "classes"> & (import("@mui/styles").StyledComponentProps<any> | (import("@mui/styles").StyledComponentProps<any> & object))>;
3
+ export default _default;
@@ -0,0 +1,91 @@
1
+ /*
2
+ * Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
3
+ * No copying or use of this code is allowed without permission in writing from ish.
4
+ */
5
+ import React from 'react';
6
+ import clsx from 'clsx';
7
+ import { withStyles } from '@mui/styles';
8
+ import Snackbar from '@mui/material/Snackbar';
9
+ import IconButton from '@mui/material/IconButton';
10
+ import Alert from '@mui/material/Alert';
11
+ import CloseIcon from '@mui/icons-material/Close';
12
+ const styles = theme => ({
13
+ close: {
14
+ color: theme.palette.primary.contrastText,
15
+ width: theme.spacing(4),
16
+ height: theme.spacing(4),
17
+ padding: theme.spacing(0.5)
18
+ },
19
+ success: {
20
+ maxWidth: 'unset'
21
+ },
22
+ autoWidth: {
23
+ [theme.breakpoints.down('md')]: {
24
+ flexGrow: 'unset',
25
+ borderRadius: `${theme.shape.borderRadius}px`
26
+ }
27
+ },
28
+ autoWidthRoot: {
29
+ [theme.breakpoints.down('md')]: {
30
+ left: '24px',
31
+ right: 'auto',
32
+ bottom: '24px'
33
+ }
34
+ },
35
+ fullScreenMessage: {
36
+ maxHeight: 'calc(100vh - 90px)',
37
+ overflow: 'auto',
38
+ marginRight: theme.spacing(-2),
39
+ paddingRight: theme.spacing(2)
40
+ }
41
+ });
42
+ class Message extends React.Component {
43
+ constructor(props) {
44
+ super(props);
45
+ this.handleClose = () => {
46
+ if (!this.state.persist) {
47
+ this.props.clearMessage();
48
+ }
49
+ };
50
+ this.state = {
51
+ success: props.isSuccess,
52
+ text: props.text,
53
+ persist: props.persist
54
+ };
55
+ }
56
+ componentDidUpdate(prevProps) {
57
+ if (this.props.opened !== prevProps.opened) {
58
+ this.setState({
59
+ success: this.props.opened ? this.props.isSuccess : this.state.success,
60
+ text: this.props.opened ? this.props.text : this.state.text,
61
+ persist: this.props.opened ? this.props.persist : this.state.persist
62
+ });
63
+ }
64
+ }
65
+ render() {
66
+ const { classes, opened, clearMessage } = this.props;
67
+ const { success, text, persist } = this.state;
68
+ return (React.createElement(Snackbar, { open: opened, anchorOrigin: {
69
+ vertical: 'bottom',
70
+ horizontal: 'left'
71
+ }, classes: {
72
+ root: classes.autoWidthRoot
73
+ }, ContentProps: {
74
+ classes: {
75
+ root: clsx(classes.autoWidth, {
76
+ [classes.success]: success
77
+ }),
78
+ message: persist ? classes.fullScreenMessage : undefined
79
+ }
80
+ }, ClickAwayListenerProps: {
81
+ onClickAway: this.handleClose
82
+ }, autoHideDuration: persist ? null : 6000, onClose: this.handleClose, disableWindowBlurListener: persist },
83
+ React.createElement(Alert, { variant: "filled", severity: success ? 'success' : 'error', classes: {
84
+ message: 'text-pre-wrap',
85
+ standardError: 'errorBackgroundColor',
86
+ standardSuccess: 'successBackgroundColor'
87
+ }, action: (React.createElement(IconButton, { key: "close", "aria-label": "Close", color: "inherit", className: classes.close, onClick: clearMessage },
88
+ React.createElement(CloseIcon, null))) }, text)));
89
+ }
90
+ }
91
+ export default withStyles(styles)(Message);
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare const _default: React.JSXElementConstructor<Omit<any, "classes"> & import("@mui/styles/withStyles").StyledComponentProps<"preview" | "previewNormal" | "previewHoverIcon" | "previewHoverImage">>;
3
+ export default _default;
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ import * as React from 'react';
9
+ import createStyles from '@mui/styles/createStyles';
10
+ import withStyles from '@mui/styles/withStyles';
11
+ import clsx from 'clsx';
12
+ import { FileTypeIcon } from './utils';
13
+ const styles = theme => createStyles({
14
+ preview: {
15
+ backgroundSize: 'cover',
16
+ width: '36px',
17
+ height: '48px',
18
+ borderRadius: '4px',
19
+ marginRight: '16px',
20
+ color: 'rgba(0,0,0,.2)',
21
+ transition: 'color 200ms ease-in-out',
22
+ backgroundPosition: 'center'
23
+ },
24
+ previewNormal: {
25
+ width: '60px',
26
+ height: 'calc(100% - 16px)'
27
+ },
28
+ previewHoverIcon: {
29
+ '&:hover': {
30
+ color: theme.palette.primary.main
31
+ }
32
+ },
33
+ previewHoverImage: {
34
+ '&:hover': {
35
+ boxShadow: `0 0 1px 1px ${theme.palette.primary.main}`
36
+ }
37
+ }
38
+ });
39
+ const DocumentIconsChooser = props => {
40
+ const { type, thumbnail, classes, hovered = true, isHeader } = props;
41
+ return thumbnail ? (React.createElement("div", { style: {
42
+ backgroundImage: `url(data:image;base64,${thumbnail})`
43
+ }, className: clsx(classes.preview, {
44
+ [classes.previewHoverImage]: hovered,
45
+ [classes.previewNormal]: isHeader
46
+ }) })) : (React.createElement("div", { className: clsx(classes.preview, {
47
+ [classes.previewHoverIcon]: hovered
48
+ }) },
49
+ React.createElement(FileTypeIcon, { mimeType: type })));
50
+ };
51
+ export default withStyles(styles)(DocumentIconsChooser);
@@ -0,0 +1,3 @@
1
+ export * from './utils';
2
+ export * from './DocumentIconsChooser';
3
+ export { default as DocumentIconsChooser } from './DocumentIconsChooser';
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ export * from './utils';
9
+ export * from './DocumentIconsChooser';
10
+ export { default as DocumentIconsChooser } from './DocumentIconsChooser';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export declare const formatDocumentSize: (size: number) => string;
3
+ export declare const getDocumentContent: (file: File) => Promise<string>;
4
+ export declare const getDocumentThumbnail: (file: File) => Promise<string>;
5
+ export declare const FileTypeIcon: ({ mimeType }: {
6
+ mimeType: any;
7
+ }) => React.JSX.Element;
@@ -0,0 +1,61 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2022.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ import React from 'react';
9
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
10
+ export const formatDocumentSize = (size) => {
11
+ if (size < Math.pow(1024, 2)) {
12
+ return `${Math.round(size / 1024)} kb`;
13
+ }
14
+ if (size < Math.pow(1024, 3)) {
15
+ return `${Math.round(size / 1024 / 1024)} Mb`;
16
+ }
17
+ if (size < Math.pow(1024, 4)) {
18
+ return `${Math.round(size / 1024 / 1024 / 1024)} Gb`;
19
+ }
20
+ return size.toString();
21
+ };
22
+ export const getDocumentContent = (file) => {
23
+ const reader = new FileReader();
24
+ return new Promise(resolve => {
25
+ reader.onload = () => resolve(reader.result);
26
+ reader.readAsDataURL(file);
27
+ }).then((result) => result.replace(`data:${file.type};base64,`, ''));
28
+ };
29
+ export const getDocumentThumbnail = (file) => {
30
+ if (file.type.match(/image/)) {
31
+ return getDocumentContent(file);
32
+ }
33
+ return new Promise(resolve => resolve(''));
34
+ };
35
+ const getIcon = type => {
36
+ switch (type) {
37
+ case 'image/tiff':
38
+ case 'image/bmp':
39
+ case 'image/png':
40
+ case 'image/gif':
41
+ case 'image/jpeg':
42
+ return 'file-image';
43
+ case 'application/pdf':
44
+ return 'file-pdf';
45
+ case 'application/msword':
46
+ return 'file-word';
47
+ case 'application/vnd.ms-excel':
48
+ return 'file-excel';
49
+ case 'application/vnd.ms-powerpoint':
50
+ return 'file-powerpoint';
51
+ case 'application/zip':
52
+ return 'file-archive';
53
+ case 'application/x-gzip':
54
+ return 'file-archive';
55
+ case 'application/txt':
56
+ return 'file-alt';
57
+ default:
58
+ return 'file';
59
+ }
60
+ };
61
+ export const FileTypeIcon = ({ mimeType }) => React.createElement(FontAwesomeIcon, { icon: getIcon(mimeType), fixedWidth: true, className: "w-100 h-100" });
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ height: number;
4
+ itemCount: number;
5
+ width: number;
6
+ estimatedItemSize: number;
7
+ children: any;
8
+ listRef?: any;
9
+ }
10
+ declare class DynamicSizeList extends React.Component<Props> {
11
+ listRef: React.RefObject<any>;
12
+ rowSizes: any[];
13
+ componentDidMount(): void;
14
+ attachRefs: (node: any) => void;
15
+ render(): React.JSX.Element;
16
+ scrollToItem(index: any, align: any): void;
17
+ renderItem: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
18
+ handleNewMeasurements: (index: any, newSize: any) => void;
19
+ getItemSize: (index: any) => any;
20
+ }
21
+ export default DynamicSizeList;
@@ -0,0 +1,169 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2022.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ var __rest = (this && this.__rest) || function (s, e) {
9
+ var t = {};
10
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
11
+ t[p] = s[p];
12
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
13
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
14
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
15
+ t[p[i]] = s[p[i]];
16
+ }
17
+ return t;
18
+ };
19
+ // Temporary implementation
20
+ // TODO: Remove component when native DynamicSizeList will be included in react-window v.2
21
+ import React from 'react';
22
+ import { VariableSizeList } from 'react-window';
23
+ class ItemMeasurer extends React.Component {
24
+ constructor() {
25
+ super(...arguments);
26
+ this._node = null;
27
+ this._resizeObserver = null;
28
+ this._measureItem = () => {
29
+ const { handleNewMeasurements, index } = this.props;
30
+ const node = this._node;
31
+ if (node) {
32
+ const { height, width } = node.getBoundingClientRect();
33
+ const isVisible = height > 0 || width > 0;
34
+ if (isVisible) {
35
+ const newSize = Math.ceil(height);
36
+ handleNewMeasurements(index, newSize);
37
+ }
38
+ }
39
+ };
40
+ this._refSetter = ref => {
41
+ if (this._resizeObserver !== null && this._node !== null) {
42
+ this._resizeObserver.unobserve(this._node);
43
+ }
44
+ if (ref) {
45
+ this._node = ref;
46
+ }
47
+ else {
48
+ this._node = null;
49
+ }
50
+ if (this._resizeObserver !== null && this._node !== null) {
51
+ this._resizeObserver.observe(this._node);
52
+ }
53
+ };
54
+ this._onResize = entries => {
55
+ const _this = this;
56
+ window.requestAnimationFrame(() => {
57
+ if (!Array.isArray(entries) || !entries.length) {
58
+ return;
59
+ }
60
+ _this._measureItem();
61
+ });
62
+ };
63
+ }
64
+ componentDidMount() {
65
+ this._measureItem();
66
+ // @ts-ignore
67
+ if (typeof window.ResizeObserver !== 'undefined') {
68
+ // @ts-ignore
69
+ this._resizeObserver = new window.ResizeObserver(this._onResize);
70
+ if (this._node !== null) {
71
+ this._resizeObserver.observe(this._node);
72
+ }
73
+ }
74
+ else {
75
+ //
76
+ }
77
+ }
78
+ componentWillUnmount() {
79
+ if (this._resizeObserver !== null) {
80
+ this._resizeObserver.disconnect();
81
+ this._resizeObserver = null;
82
+ }
83
+ }
84
+ render() {
85
+ return React.cloneElement(this.props.item, {
86
+ ref: this._refSetter
87
+ });
88
+ }
89
+ }
90
+ class DynamicSizeList extends React.Component {
91
+ constructor() {
92
+ super(...arguments);
93
+ this.listRef = React.createRef();
94
+ this.rowSizes = [];
95
+ this.attachRefs = node => {
96
+ const { listRef } = this.props;
97
+ if (node) {
98
+ if (!this.listRef.current) {
99
+ // @ts-ignore
100
+ this.listRef.current = node;
101
+ }
102
+ if (typeof listRef === 'function') {
103
+ listRef(node);
104
+ }
105
+ if (typeof listRef === 'object') {
106
+ listRef.current = node;
107
+ }
108
+ }
109
+ };
110
+ this.renderItem = props => {
111
+ // clear height
112
+ if (props.style.height !== undefined) {
113
+ props.style.height = undefined;
114
+ }
115
+ return React.createElement(ItemMeasurer, {
116
+ index: props.index,
117
+ // @ts-ignore
118
+ item: React.createElement(this.props.children, props),
119
+ handleNewMeasurements: this.handleNewMeasurements
120
+ });
121
+ };
122
+ this.handleNewMeasurements = (index, newSize) => {
123
+ const itemSizeDelta = newSize - this.getItemSize(index);
124
+ if (itemSizeDelta !== 0) {
125
+ this.rowSizes[index] = newSize;
126
+ const ref = this.listRef.current;
127
+ if (ref) {
128
+ const { isScrolling, scrollDirection } = ref.state;
129
+ if (isScrolling && scrollDirection === 'backward') {
130
+ ref._outerRef.scrollBy({
131
+ top: itemSizeDelta,
132
+ left: 0,
133
+ behavior: 'auto'
134
+ });
135
+ }
136
+ ref.resetAfterIndex(index, true);
137
+ }
138
+ }
139
+ };
140
+ this.getItemSize = index => {
141
+ // https://react-window.now.sh/#/api/VariableSizeList
142
+ const defaultEstimatedItemSize = 50;
143
+ return (this.rowSizes[index]
144
+ || this.props.estimatedItemSize
145
+ || defaultEstimatedItemSize);
146
+ };
147
+ }
148
+ componentDidMount() {
149
+ const ref = this.listRef.current;
150
+ if (ref) {
151
+ ref.resetAfterIndex(0, true);
152
+ }
153
+ }
154
+ render() {
155
+ const _a = this.props, { children } = _a, rest = __rest(_a, ["children"]);
156
+ return (React.createElement(VariableSizeList, Object.assign({}, rest, { ref: this.attachRefs, itemSize: this.getItemSize }), this.renderItem));
157
+ }
158
+ scrollToItem(index, align) {
159
+ const ref = this.listRef.current;
160
+ if (ref) {
161
+ ref.scrollToItem(index, align);
162
+ //
163
+ window.requestAnimationFrame(() => {
164
+ ref.scrollToItem(index, align);
165
+ });
166
+ }
167
+ }
168
+ }
169
+ export default DynamicSizeList;
@@ -0,0 +1,2 @@
1
+ export * from './DynamicSizeList';
2
+ export { default as DynamicSizeList } from './DynamicSizeList';
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ export * from './DynamicSizeList';
9
+ export { default as DynamicSizeList } from './DynamicSizeList';
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ classes?: any;
4
+ className?: string;
5
+ message: string;
6
+ }
7
+ declare const _default: React.JSXElementConstructor<Omit<Props, "classes"> & import("@mui/styles/withStyles").StyledComponentProps<"icon" | "root">>;
8
+ export default _default;
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
3
+ * No copying or use of this code is allowed without permission in writing from ish.
4
+ */
5
+ import React from 'react';
6
+ import Error from '@mui/icons-material/Error';
7
+ import Typography from '@mui/material/Typography';
8
+ import withStyles from '@mui/styles/withStyles';
9
+ import clsx from 'clsx';
10
+ import styles from './styles';
11
+ const ErrorMessage = ({ classes, className, message }) => (React.createElement("div", { className: clsx(classes.root, className) },
12
+ React.createElement(Error, { color: "error", className: classes.icon }),
13
+ React.createElement(Typography, { variant: "caption", className: "errorColor" }, message)));
14
+ export default withStyles(styles)(ErrorMessage);
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ classes?: any;
4
+ className?: string;
5
+ warning: string;
6
+ }
7
+ declare const _default: React.JSXElementConstructor<Omit<Props, "classes"> & import("@mui/styles/withStyles").StyledComponentProps<"icon" | "root">>;
8
+ export default _default;
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
3
+ * No copying or use of this code is allowed without permission in writing from ish.
4
+ */
5
+ import React from 'react';
6
+ import Warning from '@mui/icons-material/Warning';
7
+ import Typography from '@mui/material/Typography';
8
+ import withStyles from '@mui/styles/withStyles';
9
+ import clsx from 'clsx';
10
+ import styles from './styles';
11
+ const WarningMessage = ({ classes, className, warning }) => (React.createElement("div", { className: clsx(classes.root, className) },
12
+ React.createElement(Warning, { className: clsx(classes.icon, 'warningColor') }),
13
+ React.createElement(Typography, { variant: "caption", className: "warningColor" }, warning)));
14
+ export default withStyles(styles)(WarningMessage);
@@ -0,0 +1,6 @@
1
+ export * from './styles';
2
+ export * from './ErrorMessage';
3
+ export * from './WarningMessage';
4
+ export { default as styles } from './styles';
5
+ export { default as ErrorMessage } from './ErrorMessage';
6
+ export { default as WarningMessage } from './WarningMessage';
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ export * from './styles';
9
+ export * from './ErrorMessage';
10
+ export * from './WarningMessage';
11
+ export { default as styles } from './styles';
12
+ export { default as ErrorMessage } from './ErrorMessage';
13
+ export { default as WarningMessage } from './WarningMessage';
@@ -0,0 +1,3 @@
1
+ import { AppTheme } from '../model';
2
+ declare const _default: (theme: AppTheme) => import("@mui/styles").StyleRules<{}, "icon" | "root">;
3
+ export default _default;
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
3
+ * No copying or use of this code is allowed without permission in writing from ish.
4
+ */
5
+ import { createStyles } from '@mui/styles';
6
+ export default (theme) => createStyles({
7
+ root: {
8
+ marginTop: `-${theme.spacing(1)}`,
9
+ // @ts-ignore
10
+ paddingBottom: `${theme.spacing(2) - 3}`,
11
+ },
12
+ icon: {
13
+ fontSize: theme.spacing(2),
14
+ display: 'inline-block',
15
+ verticalAlign: 'middle',
16
+ marginRight: theme.spacing(0.5),
17
+ }
18
+ });
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ fileRef?: any;
4
+ classes?: any;
5
+ opened?: boolean;
6
+ backdropEnabled?: boolean;
7
+ dialog?: boolean;
8
+ onChange?: (acceptedfiles: any[], fileRejections: any[]) => void;
9
+ disabled?: boolean;
10
+ accept?: string | string[];
11
+ onClose?: () => void;
12
+ isBackdropDragging?: boolean;
13
+ }
14
+ declare const _default: React.JSXElementConstructor<Omit<Props, "classes"> & import("@mui/styles").StyledComponentProps<never>>;
15
+ export default _default;
@@ -0,0 +1,99 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ import React from 'react';
9
+ import clsx from 'clsx';
10
+ import { useDropzone } from 'react-dropzone';
11
+ import { createStyles, withStyles } from '@mui/styles';
12
+ import { darken } from '@mui/material/styles';
13
+ import Typography from '@mui/material/Typography';
14
+ import Dialog from '@mui/material/Dialog';
15
+ import IconButton from '@mui/material/IconButton';
16
+ import CloseIcon from '@mui/icons-material/Close';
17
+ import Button from '@mui/material/Button';
18
+ const styles = createStyles((theme) => ({
19
+ fileContainer: {
20
+ border: `2px dotted ${theme.palette.primary.main}`,
21
+ borderRadius: 6,
22
+ transition: theme.transitions.create('background-color', {
23
+ duration: theme.transitions.duration.shorter,
24
+ easing: theme.transitions.easing.easeInOut
25
+ })
26
+ },
27
+ dragActive: {
28
+ backgroundColor: darken(theme.palette.background.default, 0.03),
29
+ boxShadow: theme.shadows[2]
30
+ },
31
+ fullScreenFileDropContainer: {
32
+ zIndex: 1300,
33
+ left: 0,
34
+ top: 0,
35
+ position: 'fixed'
36
+ },
37
+ boxDropContainer: {
38
+ zIndex: 1400
39
+ },
40
+ dialogCloseButton: {
41
+ right: theme.spacing(1),
42
+ top: theme.spacing(1),
43
+ color: theme.palette.grey[100]
44
+ }
45
+ }));
46
+ const FileUploaderDialog = (props => {
47
+ const { fileRef, accept, disabled, classes, dialog, onChange, onClose, opened, backdropEnabled, isBackdropDragging } = props;
48
+ const onFileDrop = (acceptedfiles, fileRejections) => {
49
+ if (onChange)
50
+ onChange(acceptedfiles, fileRejections);
51
+ };
52
+ const { getRootProps, getInputProps, isDragActive } = useDropzone({
53
+ onDrop: onFileDrop,
54
+ multiple: false,
55
+ disabled,
56
+ accept
57
+ });
58
+ const acceptText = () => {
59
+ const text = [];
60
+ if (Array.isArray(accept)) {
61
+ accept.forEach(type => {
62
+ const typePart = type.split('/');
63
+ if (typePart.length > 1)
64
+ text.push(`*.${typePart[1]}`);
65
+ });
66
+ }
67
+ else {
68
+ const typePart = accept.split('/');
69
+ if (typePart.length > 1)
70
+ text.push(`*.${typePart[1]}`);
71
+ }
72
+ return text.join(', ');
73
+ };
74
+ const backdropUploaderContent = (React.createElement("div", Object.assign({}, getRootProps(), { className: clsx('w-100 h-100', classes.fullScreenFileDropContainer) }),
75
+ React.createElement("div", { className: "h-100 outline-none overflow-hidden cursor-pointer" },
76
+ React.createElement("div", { className: "h-100 p-1" },
77
+ React.createElement("input", Object.assign({}, getInputProps()))))));
78
+ const uploadContent = (React.createElement("div", Object.assign({}, getRootProps(), { className: clsx('w-100 overflow-y-auto relative', classes.boxDropContainer, { 'zIndex2': isBackdropDragging }) }),
79
+ React.createElement("div", { className: "h-100 outline-none overflow-hidden cursor-pointer" },
80
+ React.createElement("div", { className: "h-100 p-1" },
81
+ React.createElement("input", Object.assign({}, getInputProps())),
82
+ React.createElement("div", { className: clsx('w-100 h-100 flex-column align-items-center justify-content-center text-center p-2 pb-3', classes.fileContainer, { [classes.dragActive]: isDragActive }) },
83
+ React.createElement(Typography, { variant: "subtitle1", gutterBottom: true, className: "mb-0" }, "Drop files here"),
84
+ React.createElement(Typography, { variant: "caption", className: "mb-1" }, "or"),
85
+ React.createElement(Button, { variant: "contained", size: "small", color: "primary", className: "mb-1 fontWeight-normal" }, "Browse"),
86
+ accept && (React.createElement(Typography, { variant: "caption", color: "error" },
87
+ "Please upload only:",
88
+ ' ',
89
+ acceptText())))))));
90
+ return dialog ? (React.createElement(Dialog, { ref: fileRef, open: opened, disableEscapeKeyDown: true, onClose: onClose, classes: {
91
+ paper: 'w-100'
92
+ } },
93
+ React.createElement("div", null,
94
+ onClose && (React.createElement(IconButton, { className: clsx('fixed zIndex1401 p-1', classes.dialogCloseButton), onClick: onClose },
95
+ React.createElement(CloseIcon, { fontSize: "small" }))),
96
+ uploadContent,
97
+ isBackdropDragging && backdropEnabled && backdropUploaderContent))) : backdropEnabled ? backdropUploaderContent : uploadContent;
98
+ });
99
+ export default withStyles(styles)(FileUploaderDialog);
@@ -0,0 +1,2 @@
1
+ export * from './FileUploaderDialog';
2
+ export { default as FileUploaderDialog } from './FileUploaderDialog';