ish-ui 1.0.19 → 1.0.21

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 (215) hide show
  1. package/dist/actions/FieldProcessing.d.ts +10 -0
  2. package/dist/actions/FieldProcessing.js +17 -0
  3. package/dist/actions/index.d.ts +1 -0
  4. package/dist/actions/index.js +8 -0
  5. package/dist/appBar/AppBarHelpMenu.d.ts +3 -0
  6. package/dist/appBar/AppBarHelpMenu.js +77 -0
  7. package/dist/appBar/index.d.ts +2 -0
  8. package/dist/appBar/index.js +9 -0
  9. package/dist/buttons/AddButton.d.ts +14 -0
  10. package/dist/buttons/AddButton.js +9 -0
  11. package/dist/buttons/TimetableButton.d.ts +3 -0
  12. package/dist/buttons/TimetableButton.js +12 -0
  13. package/dist/buttons/index.d.ts +4 -0
  14. package/dist/buttons/index.js +11 -0
  15. package/dist/colorPicker/ColorPicker.d.ts +4 -0
  16. package/dist/colorPicker/ColorPicker.js +138 -0
  17. package/dist/colorPicker/index.d.ts +2 -0
  18. package/dist/colorPicker/index.js +9 -0
  19. package/dist/dialog/BrowserWarning.d.ts +3 -0
  20. package/dist/dialog/BrowserWarning.js +16 -0
  21. package/dist/dialog/confirm/ConfirmBase.d.ts +7 -0
  22. package/dist/dialog/confirm/ConfirmBase.js +29 -0
  23. package/dist/dialog/index.d.ts +5 -0
  24. package/dist/dialog/index.js +12 -0
  25. package/dist/dialog/message/Message.d.ts +3 -0
  26. package/dist/dialog/message/Message.js +91 -0
  27. package/dist/documents/DocumentIconsChooser.d.ts +3 -0
  28. package/dist/documents/DocumentIconsChooser.js +51 -0
  29. package/dist/documents/index.d.ts +3 -0
  30. package/dist/documents/index.js +10 -0
  31. package/dist/documents/utils/index.d.ts +7 -0
  32. package/dist/documents/utils/index.js +61 -0
  33. package/dist/dynamicSizeList/DynamicSizeList.d.ts +17 -0
  34. package/dist/dynamicSizeList/DynamicSizeList.js +167 -0
  35. package/dist/dynamicSizeList/index.d.ts +2 -0
  36. package/dist/dynamicSizeList/index.js +9 -0
  37. package/dist/fieldMessage/ErrorMessage.d.ts +8 -0
  38. package/dist/fieldMessage/ErrorMessage.js +14 -0
  39. package/dist/fieldMessage/WarningMessage.d.ts +8 -0
  40. package/dist/fieldMessage/WarningMessage.js +14 -0
  41. package/dist/fieldMessage/index.d.ts +6 -0
  42. package/dist/fieldMessage/index.js +13 -0
  43. package/dist/fieldMessage/styles.d.ts +3 -0
  44. package/dist/fieldMessage/styles.js +18 -0
  45. package/dist/fileUploader/FileUploaderDialog.d.ts +15 -0
  46. package/dist/fileUploader/FileUploaderDialog.js +99 -0
  47. package/dist/fileUploader/index.d.ts +2 -0
  48. package/dist/fileUploader/index.js +9 -0
  49. package/dist/formFields/CheckboxField.d.ts +7 -0
  50. package/dist/formFields/CheckboxField.js +67 -0
  51. package/dist/formFields/CodeEditorField.d.ts +6 -0
  52. package/dist/formFields/CodeEditorField.js +69 -0
  53. package/dist/formFields/ColoredCheckBox.d.ts +3 -0
  54. package/dist/formFields/ColoredCheckBox.js +41 -0
  55. package/dist/formFields/DateTimeField.d.ts +2 -0
  56. package/dist/formFields/DateTimeField.js +27 -0
  57. package/dist/formFields/EditInPlaceDateTimeField.d.ts +10 -0
  58. package/dist/formFields/EditInPlaceDateTimeField.js +188 -0
  59. package/dist/formFields/EditInPlaceDurationField.d.ts +4 -0
  60. package/dist/formFields/EditInPlaceDurationField.js +63 -0
  61. package/dist/formFields/EditInPlaceField.d.ts +10 -0
  62. package/dist/formFields/EditInPlaceField.js +58 -0
  63. package/dist/formFields/EditInPlaceFieldBase.d.ts +28 -0
  64. package/dist/formFields/EditInPlaceFieldBase.js +123 -0
  65. package/dist/formFields/EditInPlaceFileField.d.ts +7 -0
  66. package/dist/formFields/EditInPlaceFileField.js +60 -0
  67. package/dist/formFields/EditInPlaceMoneyField.d.ts +9 -0
  68. package/dist/formFields/EditInPlaceMoneyField.js +37 -0
  69. package/dist/formFields/EditInPlacePhoneField.d.ts +4 -0
  70. package/dist/formFields/EditInPlacePhoneField.js +69 -0
  71. package/dist/formFields/EditInPlaceSearchSelect.d.ts +4 -0
  72. package/dist/formFields/EditInPlaceSearchSelect.js +321 -0
  73. package/dist/formFields/FieldAdornments.d.ts +13 -0
  74. package/dist/formFields/FieldAdornments.js +27 -0
  75. package/dist/formFields/FilePreview.d.ts +17 -0
  76. package/dist/formFields/FilePreview.js +77 -0
  77. package/dist/formFields/FormRadioButtons.d.ts +3 -0
  78. package/dist/formFields/FormRadioButtons.js +27 -0
  79. package/dist/formFields/SelectCustomComponents.d.ts +5 -0
  80. package/dist/formFields/SelectCustomComponents.js +182 -0
  81. package/dist/formFields/Switch.d.ts +7 -0
  82. package/dist/formFields/Switch.js +116 -0
  83. package/dist/formFields/TextField.d.ts +6 -0
  84. package/dist/formFields/TextField.js +42 -0
  85. package/dist/formFields/UneditableBase.d.ts +17 -0
  86. package/dist/formFields/UneditableBase.js +48 -0
  87. package/dist/formFields/index.d.ts +31 -0
  88. package/dist/formFields/index.js +38 -0
  89. package/dist/index.d.ts +18 -0
  90. package/dist/index.js +25 -0
  91. package/dist/layout/InfoPill.d.ts +7 -0
  92. package/dist/layout/InfoPill.js +26 -0
  93. package/dist/layout/index.d.ts +4 -0
  94. package/dist/layout/index.js +11 -0
  95. package/dist/layout/resizable/ResizableWrapper.d.ts +14 -0
  96. package/dist/layout/resizable/ResizableWrapper.js +42 -0
  97. package/dist/markdownEditor/HtmlEditor.d.ts +15 -0
  98. package/dist/markdownEditor/HtmlEditor.js +18 -0
  99. package/dist/markdownEditor/WysiwygEditor.d.ts +8 -0
  100. package/dist/markdownEditor/WysiwygEditor.js +98 -0
  101. package/dist/markdownEditor/index.d.ts +5 -0
  102. package/dist/markdownEditor/index.js +12 -0
  103. package/dist/markdownEditor/utils/index.d.ts +9 -0
  104. package/dist/markdownEditor/utils/index.js +38 -0
  105. package/dist/model/AppBar.d.ts +11 -0
  106. package/dist/model/AppBar.js +8 -0
  107. package/dist/model/CommomObjects.d.ts +5 -0
  108. package/dist/model/CommomObjects.js +1 -0
  109. package/dist/model/CommonFunctions.d.ts +8 -0
  110. package/dist/model/CommonFunctions.js +5 -0
  111. package/dist/model/Confirm.d.ts +16 -0
  112. package/dist/model/Confirm.js +8 -0
  113. package/dist/model/Fields.d.ts +258 -0
  114. package/dist/model/Fields.js +8 -0
  115. package/dist/model/NestedEntity.d.ts +9 -0
  116. package/dist/model/NestedEntity.js +5 -0
  117. package/dist/model/Theme.d.ts +34 -0
  118. package/dist/model/Theme.js +18 -0
  119. package/dist/model/index.d.ts +7 -0
  120. package/dist/model/index.js +14 -0
  121. package/dist/styles/GlobalStylesProvider.d.ts +3 -0
  122. package/dist/styles/GlobalStylesProvider.js +417 -0
  123. package/dist/styles/StylesProviderCustom.d.ts +3 -0
  124. package/dist/styles/StylesProviderCustom.js +6 -0
  125. package/dist/styles/animateStyles.d.ts +3 -0
  126. package/dist/styles/animateStyles.js +33 -0
  127. package/dist/styles/bootstrap.d.ts +491 -0
  128. package/dist/styles/bootstrap.js +496 -0
  129. package/dist/styles/hooks.d.ts +6 -0
  130. package/dist/styles/hooks.js +38 -0
  131. package/dist/styles/index.d.ts +11 -0
  132. package/dist/styles/index.js +18 -0
  133. package/dist/styles/makeStyles.d.ts +3 -0
  134. package/dist/styles/makeStyles.js +9 -0
  135. package/dist/styles/mixins/common.d.ts +8 -0
  136. package/dist/styles/mixins/common.js +32 -0
  137. package/dist/styles/mixins/keyframes.d.ts +3 -0
  138. package/dist/styles/mixins/keyframes.js +9 -0
  139. package/dist/styles/mixins/prefixer.d.ts +1 -0
  140. package/dist/styles/mixins/prefixer.js +23 -0
  141. package/dist/tagsInput/AddTagMenu.d.ts +12 -0
  142. package/dist/tagsInput/AddTagMenu.js +36 -0
  143. package/dist/tagsInput/AddTagMenuItem.d.ts +11 -0
  144. package/dist/tagsInput/AddTagMenuItem.js +29 -0
  145. package/dist/tagsInput/TagInputList.d.ts +4 -0
  146. package/dist/tagsInput/TagInputList.js +273 -0
  147. package/dist/tagsInput/index.d.ts +6 -0
  148. package/dist/tagsInput/index.js +6 -0
  149. package/dist/themes/appTheme.d.ts +4 -0
  150. package/dist/themes/appTheme.js +322 -0
  151. package/dist/themes/index.d.ts +2 -0
  152. package/dist/themes/index.js +9 -0
  153. package/dist/themes/ishTheme.d.ts +8 -0
  154. package/dist/themes/ishTheme.js +351 -0
  155. package/dist/timetable/datePeriodFilter/DayPeriodIcons.d.ts +8 -0
  156. package/dist/timetable/datePeriodFilter/DayPeriodIcons.js +27 -0
  157. package/dist/timetable/datePeriodFilter/index.d.ts +1 -0
  158. package/dist/timetable/datePeriodFilter/index.js +8 -0
  159. package/dist/timetable/index.d.ts +2 -0
  160. package/dist/timetable/index.js +9 -0
  161. package/dist/timetable/miniCalendar/CalendarDay.d.ts +15 -0
  162. package/dist/timetable/miniCalendar/CalendarDay.js +64 -0
  163. package/dist/timetable/miniCalendar/CalendarHeader.d.ts +10 -0
  164. package/dist/timetable/miniCalendar/CalendarHeader.js +22 -0
  165. package/dist/timetable/miniCalendar/CalendarWeekPanel.d.ts +8 -0
  166. package/dist/timetable/miniCalendar/CalendarWeekPanel.js +18 -0
  167. package/dist/timetable/miniCalendar/WeekDay.d.ts +10 -0
  168. package/dist/timetable/miniCalendar/WeekDay.js +25 -0
  169. package/dist/timetable/miniCalendar/index.d.ts +8 -0
  170. package/dist/timetable/miniCalendar/index.js +15 -0
  171. package/dist/utils/DOM/Links.d.ts +1 -0
  172. package/dist/utils/DOM/Links.js +12 -0
  173. package/dist/utils/DOM/getCaretCoordinates.d.ts +6 -0
  174. package/dist/utils/DOM/getCaretCoordinates.js +109 -0
  175. package/dist/utils/DOM/getOS.d.ts +2 -0
  176. package/dist/utils/DOM/getOS.js +32 -0
  177. package/dist/utils/DOM/index.d.ts +5 -0
  178. package/dist/utils/DOM/index.js +32 -0
  179. package/dist/utils/dates/datesNormalizing.d.ts +1 -0
  180. package/dist/utils/dates/datesNormalizing.js +3 -0
  181. package/dist/utils/dates/format.d.ts +24 -0
  182. package/dist/utils/dates/format.js +28 -0
  183. package/dist/utils/dates/formatRelative.d.ts +1 -0
  184. package/dist/utils/dates/formatRelative.js +14 -0
  185. package/dist/utils/dates/formatString.d.ts +2 -0
  186. package/dist/utils/dates/formatString.js +195 -0
  187. package/dist/utils/dates/formatTimezone.d.ts +2 -0
  188. package/dist/utils/dates/formatTimezone.js +35 -0
  189. package/dist/utils/dates/index.d.ts +6 -0
  190. package/dist/utils/dates/index.js +13 -0
  191. package/dist/utils/dates/timetable.d.ts +5 -0
  192. package/dist/utils/dates/timetable.js +38 -0
  193. package/dist/utils/events/index.d.ts +2 -0
  194. package/dist/utils/events/index.js +6 -0
  195. package/dist/utils/fields/index.d.ts +1 -0
  196. package/dist/utils/fields/index.js +20 -0
  197. package/dist/utils/formatting/PhoneMasks.d.ts +304 -0
  198. package/dist/utils/formatting/PhoneMasks.js +318 -0
  199. package/dist/utils/formatting/index.d.ts +2 -0
  200. package/dist/utils/formatting/index.js +10 -0
  201. package/dist/utils/hooks/index.d.ts +1 -0
  202. package/dist/utils/hooks/index.js +15 -0
  203. package/dist/utils/index.d.ts +9 -0
  204. package/dist/utils/index.js +16 -0
  205. package/dist/utils/numbers/decimalCalculation.d.ts +4 -0
  206. package/dist/utils/numbers/decimalCalculation.js +21 -0
  207. package/dist/utils/numbers/index.d.ts +2 -0
  208. package/dist/utils/numbers/index.js +9 -0
  209. package/dist/utils/numbers/numbersNormalizing.d.ts +10 -0
  210. package/dist/utils/numbers/numbersNormalizing.js +44 -0
  211. package/dist/utils/stubs/index.d.ts +3 -0
  212. package/dist/utils/stubs/index.js +10 -0
  213. package/dist/utils/tags/index.d.ts +3 -0
  214. package/dist/utils/tags/index.js +42 -0
  215. package/package.json +1 -1
@@ -0,0 +1,182 @@
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
+ 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
+ import useTheme from '@mui/styles/useTheme';
20
+ import useMediaQuery from '@mui/material/useMediaQuery';
21
+ import React from 'react';
22
+ import ListSubheader from '@mui/material/ListSubheader';
23
+ import InfiniteLoader from 'react-window-infinite-loader';
24
+ import { areEqual, FixedSizeList as List } from 'react-window';
25
+ import { createStyles } from '@mui/styles';
26
+ import { green } from '@mui/material/colors';
27
+ import clsx from 'clsx';
28
+ import { ListItem } from '@mui/material';
29
+ import Tooltip from '@mui/material/Tooltip';
30
+ export const selectStyles = theme => createStyles({
31
+ bottomMargin: {
32
+ marginBottom: `${theme.spacing(1) + 1}`
33
+ },
34
+ bottomPadding: {
35
+ paddingBottom: `${theme.spacing(1) + 1}`
36
+ },
37
+ topMargin: {
38
+ marginTop: `${theme.spacing(1)}`,
39
+ paddingLeft: '0'
40
+ },
41
+ editIcon: {
42
+ fontSize: '24px',
43
+ color: theme.palette.divider,
44
+ verticalAlign: 'middle',
45
+ margin: 0
46
+ },
47
+ editable: {
48
+ '&:hover': {
49
+ color: theme.palette.primary.main,
50
+ fill: theme.palette.primary.main
51
+ }
52
+ },
53
+ label: {
54
+ whiteSpace: 'nowrap',
55
+ '&$valid': {
56
+ color: green[500]
57
+ }
58
+ },
59
+ valid: {},
60
+ autoWidthSelect: {
61
+ width: 'calc(100% + 30px)'
62
+ },
63
+ emptySelect: {
64
+ color: '#fff'
65
+ },
66
+ error: {
67
+ color: theme.palette.error.main
68
+ },
69
+ validUnderline: {
70
+ '&:after': {
71
+ borderBottomColor: green[500]
72
+ }
73
+ },
74
+ menuItem: {
75
+ '&:hover .placeholderContent': {
76
+ color: '#fff'
77
+ },
78
+ overflow: 'hidden',
79
+ textOverflow: 'ellipsis'
80
+ },
81
+ menuItemActive: {
82
+ '& .placeholderContent': {
83
+ color: '#fff'
84
+ }
85
+ },
86
+ menuList: {
87
+ background: theme.palette.background.paper,
88
+ borderRadius: theme.shape.borderRadius,
89
+ },
90
+ readonly: {
91
+ fontWeight: 300,
92
+ pointerEvents: 'none'
93
+ },
94
+ multiple: {},
95
+ inline: {
96
+ display: 'inline-block',
97
+ '& .MuiInput-root .MuiInput-input': {
98
+ padding: 0
99
+ },
100
+ '& $inputEndAdornment': {
101
+ marginBottom: '-8px'
102
+ }
103
+ },
104
+ root: {
105
+ '& $multiple': {
106
+ flexWrap: 'wrap'
107
+ },
108
+ '& $multiple $inputEndAdornment': {
109
+ position: 'absolute',
110
+ right: 0,
111
+ bottom: 6,
112
+ height: 'auto'
113
+ }
114
+ },
115
+ inputEndAdornment: {
116
+ marginBottom: '-6px',
117
+ alignItems: 'center',
118
+ display: 'flex',
119
+ },
120
+ inputWrapper: {
121
+ '&:hover $inputEndAdornment': {
122
+ visibility: 'visible'
123
+ },
124
+ '&.Mui-focused $expandIcon': {
125
+ opacity: 1
126
+ }
127
+ },
128
+ expandIcon: { opacity: 0.5 },
129
+ hasPopup: {
130
+ '&$root $inputWrapper': {
131
+ paddingRight: 0
132
+ },
133
+ '&$root$hasClear $inputWrapper': {
134
+ paddingRight: 0
135
+ }
136
+ },
137
+ hasClear: {
138
+ '&$root $inputWrapper': {
139
+ paddingRight: 0
140
+ }
141
+ },
142
+ });
143
+ export const ListRow = React.memo(({ data: { children, selectAdornment }, index, style }) => {
144
+ const inlineStyle = Object.assign(Object.assign({}, style), { top: style.top + 8, paddingLeft: 0, paddingRight: 0, whiteSpace: 'nowrap' });
145
+ return (React.createElement(ListItem, { button: true, style: inlineStyle }, (((selectAdornment === null || selectAdornment === void 0 ? void 0 : selectAdornment.position) === 'start' && index === 0)
146
+ || ((selectAdornment === null || selectAdornment === void 0 ? void 0 : selectAdornment.position) === 'end' && index === children.length))
147
+ ? selectAdornment.content
148
+ : children[index]));
149
+ }, areEqual);
150
+ const OuterElementContext = React.createContext({});
151
+ const OuterElementType = React.forwardRef((props, ref) => {
152
+ const outerProps = React.useContext(OuterElementContext);
153
+ return React.createElement("div", Object.assign({ ref: ref }, props, outerProps));
154
+ });
155
+ export const ListboxComponent = React.forwardRef((props, ref) => {
156
+ const { children, rowHeight, remoteRowCount, loadMoreRows, classes, loading, selectAdornment, fieldClasses } = props, other = __rest(props, ["children", "rowHeight", "remoteRowCount", "loadMoreRows", "classes", "loading", "selectAdornment", "fieldClasses"]);
157
+ const itemData = { selectAdornment, children: React.Children.toArray(children) };
158
+ const theme = useTheme();
159
+ const smUp = useMediaQuery(theme.breakpoints.up('sm'), { noSsr: true });
160
+ const itemSize = rowHeight || (smUp ? 36 : 48);
161
+ const itemCount = (remoteRowCount > children.length ? children.length + 3 : children.length) + (selectAdornment ? 1 : 0);
162
+ const getChildSize = child => {
163
+ if (React.isValidElement(child) && child.type === ListSubheader) {
164
+ return 48;
165
+ }
166
+ return itemSize;
167
+ };
168
+ const getHeight = () => {
169
+ if (itemCount > 8) {
170
+ return 8 * itemSize;
171
+ }
172
+ return itemData.children.map(getChildSize).reduce((a, b) => a + b, 0);
173
+ };
174
+ const loadMoreItems = () => (loading ? undefined : loadMoreRows(itemData.children.length));
175
+ const isItemLoaded = index => index < (children.length + (selectAdornment ? 1 : 0));
176
+ return (React.createElement("div", { ref: ref },
177
+ React.createElement(OuterElementContext.Provider, { value: other },
178
+ React.createElement(InfiniteLoader, { isItemLoaded: isItemLoaded, itemCount: itemCount, loadMoreItems: loadMoreItems }, ({ onItemsRendered }) => (React.createElement(List, { height: getHeight() + 2 * 8, width: "100%", className: clsx(classes.menuList, fieldClasses.selectMenu), itemData: itemData, outerElementType: OuterElementType, onItemsRendered: onItemsRendered, itemSize: itemSize, itemCount: itemCount }, ListRow))))));
179
+ });
180
+ export const NoWrapOption = (content, data, search, parentProps) => (React.createElement("div", Object.assign({}, parentProps || {}),
181
+ React.createElement(Tooltip, { title: content },
182
+ React.createElement("div", { className: "text-nowrap text-truncate" }, content))));
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Wrapper component for Material UI button
3
+ * */
4
+ import React from 'react';
5
+ import { FieldInputProps, FormSwitchProps } from '../model';
6
+ export declare const Switch: React.JSXElementConstructor<Omit<any, "classes"> & import("@mui/styles").StyledComponentProps<"default" | "icon" | "bar" | "inline" | "disabled" | "checked" | "root" | "focusVisible">>;
7
+ export declare function FormSwitch<InputProps extends FieldInputProps>({ input, color, disabled, stringValue, label, className, inline, onChangeHandler, onClick }: FormSwitchProps<InputProps>): React.JSX.Element;
@@ -0,0 +1,116 @@
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
+ 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
+ /**
20
+ * Wrapper component for Material UI button
21
+ * */
22
+ import React, { useCallback } from 'react';
23
+ import MuiSwitch from '@mui/material/Switch';
24
+ import Typography from '@mui/material/Typography';
25
+ import { createStyles, withStyles } from '@mui/styles';
26
+ import clsx from 'clsx';
27
+ const getValue = value => {
28
+ switch (value) {
29
+ case 'false':
30
+ return false;
31
+ case 'true':
32
+ return true;
33
+ default:
34
+ return value;
35
+ }
36
+ };
37
+ const styles = theme => createStyles({
38
+ bar: {
39
+ height: '22px',
40
+ borderRadius: '12px',
41
+ marginTop: '2px',
42
+ marginLeft: '-7px',
43
+ width: '38px'
44
+ },
45
+ checked: {
46
+ '&$disabled + $bar ': {
47
+ opacity: 0.12
48
+ }
49
+ },
50
+ icon: {
51
+ boxShadow: theme.shadows[1],
52
+ backgroundColor: theme.palette.common.white
53
+ },
54
+ root: {
55
+ alignItems: 'center',
56
+ '&$disabled': {
57
+ opacity: 0.12
58
+ }
59
+ },
60
+ inline: {
61
+ marginLeft: '-12px'
62
+ },
63
+ default: {
64
+ top: theme.spacing(0.5),
65
+ height: theme.spacing(4),
66
+ width: theme.spacing(4),
67
+ padding: 0,
68
+ '&$disabled': {
69
+ color: theme.palette.common.white
70
+ },
71
+ '&$checked': {
72
+ transform: `translateX(${theme.spacing(2)})`
73
+ },
74
+ '&$checked + $bar': {
75
+ opacity: 1
76
+ },
77
+ '&$checked$disabled + $bar': {
78
+ backgroundColor: theme.palette.primary.main,
79
+ opacity: 0.6
80
+ }
81
+ },
82
+ focusVisible: {
83
+ background: 'red'
84
+ },
85
+ disabled: {}
86
+ });
87
+ const SwitchBase = props => {
88
+ const { classes, color = 'primary', inline, checked } = props, custom = __rest(props, ["classes", "color", "inline", "checked"]);
89
+ return (React.createElement(MuiSwitch, Object.assign({ color: color, checked: Boolean(checked), classes: {
90
+ track: classes.bar,
91
+ root: clsx(classes.root, { [classes.inline]: inline }),
92
+ checked: classes.checked,
93
+ thumb: classes.icon,
94
+ switchBase: classes.default,
95
+ disabled: classes.disabled
96
+ } }, custom)));
97
+ };
98
+ export const Switch = withStyles(styles)(SwitchBase);
99
+ export function FormSwitch({ input, color, disabled, stringValue, label, className, inline, onChangeHandler, onClick }) {
100
+ const onChange = useCallback((e, value) => {
101
+ let checked = value;
102
+ if (stringValue) {
103
+ checked = checked.toString();
104
+ }
105
+ if (typeof onChangeHandler === 'function') {
106
+ onChangeHandler(e, checked);
107
+ }
108
+ if (!e.isDefaultPrevented()) {
109
+ input.onChange(checked);
110
+ }
111
+ }, [stringValue, input, onChangeHandler]);
112
+ return (React.createElement(React.Fragment, null,
113
+ label && (React.createElement(Typography, { variant: "caption", color: "textSecondary" },
114
+ React.createElement("label", { htmlFor: `input-${input.name}` }, label))),
115
+ React.createElement(Switch, { checked: getValue(input.value), onClick: onClick, onChange: onChange, color: color, disabled: disabled, className: className, inline: inline, id: `input-${input.name}`, name: input.name })));
116
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Wrapper component for Material Text Field
3
+ * */
4
+ import * as React from 'react';
5
+ export declare const TextField: React.JSXElementConstructor<Omit<any, "classes"> & import("@mui/styles").StyledComponentProps<"textField"> & object>;
6
+ export declare const FormTextField: (props: any) => React.JSX.Element;
@@ -0,0 +1,42 @@
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
+ 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
+ /**
20
+ * Wrapper component for Material Text Field
21
+ * */
22
+ import * as React from 'react';
23
+ import { withStyles } from '@mui/styles';
24
+ import MuiTextField from '@mui/material/TextField';
25
+ const styles = theme => ({
26
+ textField: {
27
+ marginLeft: theme.spacing(1),
28
+ marginRight: theme.spacing(1)
29
+ }
30
+ });
31
+ class TextInput extends React.Component {
32
+ render() {
33
+ const _a = this.props, { classes, onChange, id, margin = 'dense' } = _a, props = __rest(_a, ["classes", "onChange", "id", "margin"]);
34
+ return (React.createElement(MuiTextField, Object.assign({ name: props.id, onChange: e => onChange(e.target.value, id), margin: margin }, props, { variant: "standard" })));
35
+ }
36
+ }
37
+ export const TextField = withStyles(styles)(TextInput);
38
+ // Form field text component creator
39
+ export const FormTextField = props => {
40
+ const { input, meta: { error, invalid, touched }, helperText, inputRef } = props, custom = __rest(props, ["input", "meta", "helperText", "inputRef"]);
41
+ return (React.createElement(TextField, Object.assign({ error: touched && invalid, inputRef: inputRef, helperText: (touched && error) || helperText, fullWidth: true }, input, custom)));
42
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ interface UneditableProps {
3
+ value: string | number;
4
+ label: string;
5
+ labelAdornment?: any;
6
+ url?: string;
7
+ currencySymbol?: string;
8
+ money?: boolean;
9
+ multiline?: boolean;
10
+ rightAligned?: boolean;
11
+ className?: string;
12
+ placeholder?: string;
13
+ error?: string;
14
+ format?: (value: any) => any;
15
+ }
16
+ declare const UneditableBase: React.NamedExoticComponent<UneditableProps>;
17
+ export default UneditableBase;
@@ -0,0 +1,48 @@
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 clsx from 'clsx';
9
+ import React, { useCallback } from 'react';
10
+ import { FormControl, FormHelperText, Input, InputLabel } from '@mui/material';
11
+ import InputAdornment from '@mui/material/InputAdornment';
12
+ import { makeAppStyles } from '../styles';
13
+ import { LinkAdornment } from './FieldAdornments';
14
+ import { formatCurrency, openInternalLink } from '../utils';
15
+ const useStyles = makeAppStyles({
16
+ rightAlignedLabel: {
17
+ left: 'unset',
18
+ right: 0,
19
+ transformOrigin: '100% 0'
20
+ }
21
+ });
22
+ const UneditableBase = React.memo(props => {
23
+ const { label, labelAdornment, placeholder = 'No value', rightAligned, value, url, money, currencySymbol, className, format, multiline, error } = props;
24
+ const classes = useStyles();
25
+ const inputId = `input-${label.toLowerCase().replace(' ', '-')}`;
26
+ const openLink = useCallback(() => {
27
+ openInternalLink(url);
28
+ }, [url]);
29
+ return (React.createElement(FormControl, { className: clsx(className, money && 'money'), error: Boolean(error), variant: "standard", fullWidth: true },
30
+ React.createElement(InputLabel, { shrink: true, classes: {
31
+ root: rightAligned ? classes.rightAlignedLabel : null
32
+ }, htmlFor: inputId },
33
+ label,
34
+ url && React.createElement(LinkAdornment, { link: url, className: "pl-0-5", clickHandler: openLink }),
35
+ labelAdornment && (React.createElement("span", { className: "pl-0-5" },
36
+ labelAdornment,
37
+ ' '))),
38
+ React.createElement(Input, { id: inputId, startAdornment: money && React.createElement(InputAdornment, { position: "start" }, currencySymbol), value: money
39
+ ? formatCurrency(value, '')
40
+ : value
41
+ ? (format
42
+ ? (format(value))
43
+ : (value)) : (''), multiline: multiline, placeholder: placeholder, inputProps: {
44
+ className: rightAligned && 'text-end'
45
+ }, disabled: true }),
46
+ React.createElement(FormHelperText, null, error)));
47
+ });
48
+ export default UneditableBase;
@@ -0,0 +1,31 @@
1
+ export * from './CheckboxField';
2
+ export * from './CodeEditorField';
3
+ export * from './ColoredCheckBox';
4
+ export * from './DateTimeField';
5
+ export * from './EditInPlaceDateTimeField';
6
+ export * from './EditInPlaceDurationField';
7
+ export * from './EditInPlaceField';
8
+ export * from './EditInPlaceFieldBase';
9
+ export * from './EditInPlaceFileField';
10
+ export * from './EditInPlaceMoneyField';
11
+ export * from './EditInPlacePhoneField';
12
+ export * from './EditInPlaceSearchSelect';
13
+ export * from './FieldAdornments';
14
+ export * from './FilePreview';
15
+ export * from './FormRadioButtons';
16
+ export * from './SelectCustomComponents';
17
+ export * from './Switch';
18
+ export * from './TextField';
19
+ export * from './UneditableBase';
20
+ export { default as CodeEditorField } from './CodeEditorField';
21
+ export { default as EditInPlaceDateTimeField } from './EditInPlaceDateTimeField';
22
+ export { default as EditInPlaceDurationField } from './EditInPlaceDurationField';
23
+ export { default as EditInPlaceField } from './EditInPlaceField';
24
+ export { default as EditInPlaceFieldBase } from './EditInPlaceFieldBase';
25
+ export { default as EditInPlaceFileField } from './EditInPlaceFileField';
26
+ export { default as EditInPlaceMoneyField } from './EditInPlaceMoneyField';
27
+ export { default as EditInPlacePhoneField } from './EditInPlacePhoneField';
28
+ export { default as EditInPlaceSearchSelect } from './EditInPlaceSearchSelect';
29
+ export { default as FilePreview } from './FilePreview';
30
+ export { default as FormRadioButtons } from './FormRadioButtons';
31
+ export { default as UneditableBase } from './UneditableBase';
@@ -0,0 +1,38 @@
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 './CheckboxField';
9
+ export * from './CodeEditorField';
10
+ export * from './ColoredCheckBox';
11
+ export * from './DateTimeField';
12
+ export * from './EditInPlaceDateTimeField';
13
+ export * from './EditInPlaceDurationField';
14
+ export * from './EditInPlaceField';
15
+ export * from './EditInPlaceFieldBase';
16
+ export * from './EditInPlaceFileField';
17
+ export * from './EditInPlaceMoneyField';
18
+ export * from './EditInPlacePhoneField';
19
+ export * from './EditInPlaceSearchSelect';
20
+ export * from './FieldAdornments';
21
+ export * from './FilePreview';
22
+ export * from './FormRadioButtons';
23
+ export * from './SelectCustomComponents';
24
+ export * from './Switch';
25
+ export * from './TextField';
26
+ export * from './UneditableBase';
27
+ export { default as CodeEditorField } from './CodeEditorField';
28
+ export { default as EditInPlaceDateTimeField } from './EditInPlaceDateTimeField';
29
+ export { default as EditInPlaceDurationField } from './EditInPlaceDurationField';
30
+ export { default as EditInPlaceField } from './EditInPlaceField';
31
+ export { default as EditInPlaceFieldBase } from './EditInPlaceFieldBase';
32
+ export { default as EditInPlaceFileField } from './EditInPlaceFileField';
33
+ export { default as EditInPlaceMoneyField } from './EditInPlaceMoneyField';
34
+ export { default as EditInPlacePhoneField } from './EditInPlacePhoneField';
35
+ export { default as EditInPlaceSearchSelect } from './EditInPlaceSearchSelect';
36
+ export { default as FilePreview } from './FilePreview';
37
+ export { default as FormRadioButtons } from './FormRadioButtons';
38
+ export { default as UneditableBase } from './UneditableBase';
@@ -0,0 +1,18 @@
1
+ export * from './actions';
2
+ export * from './appBar';
3
+ export * from './buttons';
4
+ export * from './colorPicker';
5
+ export * from './dialog';
6
+ export * from './documents';
7
+ export * from './dynamicSizeList';
8
+ export * from './fieldMessage';
9
+ export * from './fileUploader';
10
+ export * from './formFields';
11
+ export * from './layout';
12
+ export * from './markdownEditor';
13
+ export * from './model';
14
+ export * from './styles';
15
+ export * from './tagsInput';
16
+ export * from './themes';
17
+ export * from './utils';
18
+ export * from './timetable';
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
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 './actions';
9
+ export * from './appBar';
10
+ export * from './buttons';
11
+ export * from './colorPicker';
12
+ export * from './dialog';
13
+ export * from './documents';
14
+ export * from './dynamicSizeList';
15
+ export * from './fieldMessage';
16
+ export * from './fileUploader';
17
+ export * from './formFields';
18
+ export * from './layout';
19
+ export * from './markdownEditor';
20
+ export * from './model';
21
+ export * from './styles';
22
+ export * from './tagsInput';
23
+ export * from './themes';
24
+ export * from './utils';
25
+ export * from './timetable';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ label: string;
4
+ color?: 'success' | 'primary';
5
+ }
6
+ declare const InfoPill: ({ label, color }: Props) => React.JSX.Element;
7
+ export default InfoPill;
@@ -0,0 +1,26 @@
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 { Chip } from '@mui/material';
9
+ import React from 'react';
10
+ import { alpha } from '@mui/material/styles';
11
+ import { makeAppStyles } from '../styles';
12
+ const useStyles = makeAppStyles(theme => ({
13
+ chip: {
14
+ textTransform: 'uppercase',
15
+ fontWeight: 600,
16
+ fontSize: '12px',
17
+ marginLeft: theme.spacing(1),
18
+ color: ({ color }) => theme.palette[color].light,
19
+ backgroundColor: ({ color }) => alpha(theme.palette[color].light, 0.15)
20
+ }
21
+ }));
22
+ const InfoPill = ({ label, color = label === 'custom' ? 'primary' : 'success' }) => {
23
+ const classes = useStyles({ label, color });
24
+ return React.createElement(Chip, { className: classes.chip, label: label, size: "small" });
25
+ };
26
+ export default InfoPill;
@@ -0,0 +1,4 @@
1
+ export * from './resizable/ResizableWrapper';
2
+ export { default as ResizableWrapper } from './resizable/ResizableWrapper';
3
+ export * from './InfoPill';
4
+ export { default as InfoPill } from './InfoPill';
@@ -0,0 +1,11 @@
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 './resizable/ResizableWrapper';
9
+ export { default as ResizableWrapper } from './resizable/ResizableWrapper';
10
+ export * from './InfoPill';
11
+ export { default as InfoPill } from './InfoPill';
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ interface Props {
3
+ sidebarWidth: number;
4
+ minWidth?: number | string;
5
+ maxWidth?: number | string;
6
+ onResizeStop?: any;
7
+ onResize?: any;
8
+ classes?: any;
9
+ className?: any;
10
+ ignoreScreenWidth?: boolean;
11
+ children?: any;
12
+ }
13
+ declare const _default: React.FC<Props>;
14
+ export default _default;
@@ -0,0 +1,42 @@
1
+ import * as React from 'react';
2
+ import { Resizable } from 're-resizable';
3
+ import { withStyles, createStyles } from '@mui/styles';
4
+ import useMediaQuery from '@mui/material/useMediaQuery';
5
+ import clsx from 'clsx';
6
+ const LIST_SIDE_BAR_DEFAULT_WIDTH = 265;
7
+ const styles = (theme) => createStyles({
8
+ sideBar: {
9
+ borderRight: `1px solid ${theme.palette.divider}`,
10
+ display: 'flex',
11
+ paddingRight: '1px',
12
+ '&.d-none': {
13
+ display: 'none'
14
+ }
15
+ },
16
+ sideBarWrapper: {
17
+ overflowX: 'hidden',
18
+ overflowY: 'auto',
19
+ flex: 1
20
+ },
21
+ line: {
22
+ height: '100%',
23
+ width: '2px',
24
+ transition: 'background 120ms ease-in-out',
25
+ },
26
+ resizeLine: {
27
+ zIndex: theme.zIndex.drawer,
28
+ display: 'flex',
29
+ justifyContent: 'center',
30
+ '&:active $line, &:hover $line': {
31
+ background: `${theme.palette.secondary.main}`,
32
+ overflow: 'visible'
33
+ }
34
+ }
35
+ });
36
+ const ResizableWrapper = (props) => {
37
+ const { classes, onResizeStop, onResize, sidebarWidth, minWidth, maxWidth, children, className, ignoreScreenWidth } = props;
38
+ return useMediaQuery('(min-width:992px)') || ignoreScreenWidth ? (React.createElement(Resizable, { size: { width: sidebarWidth, height: '100%' }, minWidth: minWidth || LIST_SIDE_BAR_DEFAULT_WIDTH, maxWidth: maxWidth, onResizeStop: onResizeStop, onResize: onResize, enable: { right: true }, className: clsx(classes.sideBar, className), handleClasses: { right: classes.resizeLine }, handleComponent: { right: React.createElement("div", { className: props.classes.line }) } },
39
+ React.createElement("div", { className: classes.sideBarWrapper }, children))) : (children);
40
+ };
41
+ const wrapped = withStyles(styles)(ResizableWrapper);
42
+ export default wrapped;