@tenancy.nz/ui 1.2.9 → 1.2.10
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.
- package/dist/cjs/components/Button.styled.cjs +6 -5
- package/dist/cjs/components/Confirmation.cjs +50 -11
- package/dist/cjs/components/DropZone.styled.cjs +3 -3
- package/dist/cjs/components/FileUpload.cjs +55 -63
- package/dist/cjs/components/FileUpload.styled.cjs +2 -21
- package/dist/cjs/components/FileUploadItem.cjs +90 -0
- package/dist/cjs/components/IconButton.cjs +5 -2
- package/dist/cjs/components/IconButton.styled.cjs +16 -6
- package/dist/cjs/components/Modal.cjs +1 -1
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/theme/index.cjs +1 -1
- package/dist/cjs/utils/helpers/file.cjs +1 -1
- package/dist/esm/components/Button.styled.js +6 -5
- package/dist/esm/components/Confirmation.js +50 -11
- package/dist/esm/components/DropZone.styled.js +3 -3
- package/dist/esm/components/FileUpload.js +57 -65
- package/dist/esm/components/FileUpload.styled.js +2 -21
- package/dist/esm/components/FileUploadItem.js +86 -0
- package/dist/esm/components/IconButton.js +5 -2
- package/dist/esm/components/IconButton.styled.js +16 -7
- package/dist/esm/components/Modal.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/theme/index.js +1 -1
- package/dist/esm/utils/helpers/file.js +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ var react = require('@emotion/react');
|
|
|
8
8
|
var styles = require('@mui/material/styles');
|
|
9
9
|
var object = require('../utils/helpers/object.cjs');
|
|
10
10
|
|
|
11
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1, _templateObject10, _templateObject11, _templateObject12;
|
|
11
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
|
|
12
12
|
var edgesStyles = function edgesStyles(_ref) {
|
|
13
13
|
var edges = _ref.edges,
|
|
14
14
|
theme = _ref.theme;
|
|
@@ -21,24 +21,25 @@ var sizeStyles = function sizeStyles(_ref2) {
|
|
|
21
21
|
return react.css(_templateObject6 || (_templateObject6 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n font-weight: ", ";\n ", "\n ", "\n ", "\n"])), object.getObjectProp(theme, "typography.button.fontWeight", "700"), size === "small" && react.css(_templateObject7 || (_templateObject7 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n font-size: calc(\n ", "px - 2px\n );\n height: 32px;\n "])), object.getObjectProp(theme, "typography.button.fontSize", "14")), size === "medium" && react.css(_templateObject8 || (_templateObject8 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n font-size: ", "px;\n height: 36px;\n "])), object.getObjectProp(theme, "typography.button.fontSize", "14")), size === "large" && react.css(_templateObject9 || (_templateObject9 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n font-size: font-size: calc(\n ", "px + 2px\n );\n height: 44px;\n "])), object.getObjectProp(theme, "typography.button.fontSize", "14")));
|
|
22
22
|
};
|
|
23
23
|
var disabledStyles = react.css(_templateObject0 || (_templateObject0 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n color: var(--tn-palette-text-muted);\n background-color: var(--tn-palette-background-muted);\n border: none;\n"])));
|
|
24
|
+
var colors = ["primary", "secondary", "tertiary"];
|
|
24
25
|
var containedStyles = function containedStyles(_ref3) {
|
|
25
26
|
var color = _ref3.color,
|
|
26
27
|
theme = _ref3.theme;
|
|
27
|
-
return react.css(_templateObject1 || (_templateObject1 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n\n
|
|
28
|
+
return react.css(_templateObject1 || (_templateObject1 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n\n ", "\n\n ", "\n\n &:active {\n background-color: ", ";\n color: ", ";\n }\n .MuiButton-loadingWrapper {\n color: ", ";\n }\n\n ", "\n"])), object.getObjectProp(theme, "vars.palette.".concat(color, ".contrastText")), object.getObjectProp(theme, "vars.palette.".concat(color, ".main")), colors.includes(color) && react.css(_templateObject10 || (_templateObject10 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n "])), object.getObjectProp(theme, "vars.palette.".concat(color, ".light")), object.getObjectProp(theme, "vars.palette.".concat(color, ".contrastText"))), !colors.includes(color) && react.css(_templateObject11 || (_templateObject11 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n &:hover {\n opacity: 0.8;\n }\n "]))), object.getObjectProp(theme, "vars.palette.".concat(color, ".dark")), object.getObjectProp(theme, "vars.palette.".concat(color, ".contrastText")), object.getObjectProp(theme, "vars.palette.".concat(color, ".contrastText")), focusStyles);
|
|
28
29
|
};
|
|
29
30
|
var outlinedStyles = function outlinedStyles(_ref4) {
|
|
30
31
|
var color = _ref4.color,
|
|
31
32
|
theme = _ref4.theme;
|
|
32
|
-
return react.css(
|
|
33
|
+
return react.css(_templateObject12 || (_templateObject12 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n color: ", ";\n background-color: transparent;\n border: 1px solid currentColor;\n\n .MuiButton-loadingWrapper {\n color: ", ";\n }\n\n &:hover,\n &:active {\n background-color: ", ";\n }\n\n ", "\n"])), object.getObjectProp(theme, "vars.palette.".concat(color, ".main")), object.getObjectProp(theme, "vars.palette.".concat(color, ".main")), object.getObjectProp(theme, "vars.palette.background.muted"), focusStyles);
|
|
33
34
|
};
|
|
34
|
-
var StyledButton = styles.styled(Button)(
|
|
35
|
+
var StyledButton = styles.styled(Button)(_templateObject13 || (_templateObject13 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n ", "\n"])), function (_ref5) {
|
|
35
36
|
var color = _ref5.color,
|
|
36
37
|
disabled = _ref5.disabled,
|
|
37
38
|
edges = _ref5.edges,
|
|
38
39
|
size = _ref5.size,
|
|
39
40
|
theme = _ref5.theme,
|
|
40
41
|
variant = _ref5.variant;
|
|
41
|
-
return react.css(
|
|
42
|
+
return react.css(_templateObject14 || (_templateObject14 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n && {\n padding: 0px 24px;\n text-transform: initial;\n font-weight: 700;\n\n ", "\n ", "\n ", "\n ", "\n ", "\n }\n "])), edgesStyles({
|
|
42
43
|
edges: edges,
|
|
43
44
|
theme: theme
|
|
44
45
|
}), sizeStyles({
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
+
var Stack = require('@mui/material/Stack');
|
|
7
|
+
var CheckCircleOutlineOutlinedIcon = require('@mui/icons-material/CheckCircleOutlineOutlined');
|
|
8
|
+
var WarningAmberRoundedIcon = require('@mui/icons-material/WarningAmberRounded');
|
|
9
|
+
var InfoOutlinedIcon = require('@mui/icons-material/InfoOutlined');
|
|
10
|
+
var ReportGmailerrorredRoundedIcon = require('@mui/icons-material/ReportGmailerrorredRounded');
|
|
11
|
+
var Box = require('./Box.cjs');
|
|
6
12
|
var Button = require('./Button.cjs');
|
|
7
13
|
var Heading = require('./Heading.cjs');
|
|
8
14
|
var Modal = require('./Modal.cjs');
|
|
@@ -27,30 +33,63 @@ function Confirmation(_ref) {
|
|
|
27
33
|
severity = _ref$severity === void 0 ? "default" : _ref$severity,
|
|
28
34
|
_ref$title = _ref.title,
|
|
29
35
|
title = _ref$title === void 0 ? "Are you sure?" : _ref$title;
|
|
36
|
+
var severityIconMap = {
|
|
37
|
+
error: /* @__PURE__ */React.createElement(WarningAmberRoundedIcon, {
|
|
38
|
+
color: "inherit",
|
|
39
|
+
fontSize: "inherit"
|
|
40
|
+
}),
|
|
41
|
+
info: /* @__PURE__ */React.createElement(InfoOutlinedIcon, {
|
|
42
|
+
color: "inherit",
|
|
43
|
+
fontSize: "inherit"
|
|
44
|
+
}),
|
|
45
|
+
success: /* @__PURE__ */React.createElement(CheckCircleOutlineOutlinedIcon, {
|
|
46
|
+
color: "inherit",
|
|
47
|
+
fontSize: "inherit"
|
|
48
|
+
}),
|
|
49
|
+
warning: /* @__PURE__ */React.createElement(ReportGmailerrorredRoundedIcon, {
|
|
50
|
+
color: "inherit",
|
|
51
|
+
fontSize: "inherit"
|
|
52
|
+
})
|
|
53
|
+
};
|
|
30
54
|
var actions = /* @__PURE__ */React.createElement(React.Fragment, null, onCancel && cancelBtnText && /* @__PURE__ */React.createElement(Button.default, {
|
|
31
55
|
onClick: onCancel,
|
|
32
|
-
color: "primaryAlt",
|
|
33
56
|
variant: "outlined",
|
|
34
|
-
size: "small",
|
|
35
57
|
loading: cancelling
|
|
36
58
|
}, cancelBtnText), onConfirm && confirmBtnText && /* @__PURE__ */React.createElement(Button.default, {
|
|
37
59
|
onClick: onConfirm,
|
|
38
60
|
color: severity === "default" ? "primary" : severity,
|
|
39
|
-
size: "small",
|
|
40
61
|
loading: confirming
|
|
41
62
|
}, confirmBtnText));
|
|
42
63
|
return /* @__PURE__ */React.createElement(Modal.default, {
|
|
43
|
-
maxWidth: "
|
|
64
|
+
maxWidth: "sm",
|
|
44
65
|
open: open,
|
|
45
|
-
heading: /* @__PURE__ */React.createElement(Heading.default, {
|
|
46
|
-
as: "h5",
|
|
47
|
-
gutterBottom: false
|
|
48
|
-
}, title),
|
|
49
66
|
actions: actions,
|
|
50
|
-
content: /* @__PURE__ */React.createElement(
|
|
67
|
+
content: /* @__PURE__ */React.createElement(Stack, {
|
|
68
|
+
direction: "row",
|
|
69
|
+
spacing: "32px",
|
|
70
|
+
sx: {
|
|
71
|
+
maxWidth: "532px"
|
|
72
|
+
}
|
|
73
|
+
}, severity !== "default" && /* @__PURE__ */React.createElement(Box.default, null, /* @__PURE__ */React.createElement(Box.default, {
|
|
74
|
+
sx: {
|
|
75
|
+
width: "48px",
|
|
76
|
+
height: "48px",
|
|
77
|
+
borderRadius: "99999px",
|
|
78
|
+
fontSize: "32px",
|
|
79
|
+
bgcolor: "".concat(severity, ".light"),
|
|
80
|
+
color: "".concat(severity, ".main"),
|
|
81
|
+
display: "flex",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
justifyContent: "center",
|
|
84
|
+
mt: "12px"
|
|
85
|
+
}
|
|
86
|
+
}, severityIconMap[severity])), /* @__PURE__ */React.createElement(Stack, null, /* @__PURE__ */React.createElement(Heading.default, {
|
|
87
|
+
as: "h3",
|
|
88
|
+
gutterBottom: true
|
|
89
|
+
}, title), /* @__PURE__ */React.createElement(Text.default, {
|
|
51
90
|
as: "div",
|
|
52
|
-
|
|
53
|
-
}, message)
|
|
91
|
+
weight: "500"
|
|
92
|
+
}, message)))
|
|
54
93
|
});
|
|
55
94
|
}
|
|
56
95
|
|
|
@@ -26,15 +26,15 @@ var StyledWrapper = styles.styled(Box)(function (_ref) {
|
|
|
26
26
|
position: "relative",
|
|
27
27
|
display: compact === "yes" ? "flex" : "block",
|
|
28
28
|
textAlign: "center",
|
|
29
|
-
border: "2px dashed ".concat(errors === "yes" ? theme.palette.error.main : theme.palette.
|
|
29
|
+
border: "2px dashed ".concat(errors === "yes" ? theme.palette.error.main : theme.palette.tertiary.main),
|
|
30
30
|
padding: compact === "yes" ? theme.spacing(2, 4) : theme.spacing(6, 4),
|
|
31
31
|
background: disabled ? theme.palette.grey[300] : null,
|
|
32
32
|
opacity: disabled ? 0.5 : 1,
|
|
33
33
|
borderRadius: borderRadius(edges, theme),
|
|
34
34
|
"&:focus": {
|
|
35
|
-
border: "2px solid ".concat(theme.palette.
|
|
35
|
+
border: "2px solid ".concat(theme.palette.tertiary.main),
|
|
36
36
|
outline: "none",
|
|
37
|
-
background: colors.hexToRgba(theme.palette.
|
|
37
|
+
background: colors.hexToRgba(theme.palette.tertiary.main, 0.1)
|
|
38
38
|
},
|
|
39
39
|
alignItems: "center",
|
|
40
40
|
"& .MuiTypography-root": {
|
|
@@ -6,35 +6,28 @@ var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.c
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var PropTypes = require('prop-types');
|
|
8
8
|
var framerMotion = require('framer-motion');
|
|
9
|
-
var
|
|
10
|
-
var DropZone = require('./DropZone.cjs');
|
|
11
|
-
var FormControl = require('./FormControl.cjs');
|
|
12
|
-
var Alert = require('./Alert.cjs');
|
|
13
|
-
var Button = require('./Button.cjs');
|
|
9
|
+
var Stack = require('@mui/material/Stack');
|
|
14
10
|
var Confirmation = require('./Confirmation.cjs');
|
|
15
|
-
var
|
|
11
|
+
var Divider = require('./Divider.cjs');
|
|
12
|
+
var DropZone = require('./DropZone.cjs');
|
|
16
13
|
var FileViewer = require('./FileViewer.cjs');
|
|
14
|
+
var FileUploadItem = require('./FileUploadItem.cjs');
|
|
15
|
+
var FormControl = require('./FormControl.cjs');
|
|
17
16
|
var FormFocus = require('./FormFocus.cjs');
|
|
18
|
-
var Grid = require('./Grid.cjs');
|
|
19
|
-
var Tooltip = require('./Tooltip.cjs');
|
|
20
17
|
var FileUpload_styled = require('./FileUpload.styled.cjs');
|
|
21
18
|
var file = require('../utils/helpers/file.cjs');
|
|
22
19
|
|
|
23
20
|
function FileUpload(_ref) {
|
|
24
|
-
var _ref$
|
|
25
|
-
fileActions = _ref$fileActions === void 0 ? function () {
|
|
26
|
-
return null;
|
|
27
|
-
} : _ref$fileActions,
|
|
28
|
-
_ref$fileErrors = _ref.fileErrors,
|
|
21
|
+
var _ref$fileErrors = _ref.fileErrors,
|
|
29
22
|
fileErrors = _ref$fileErrors === void 0 ? function () {
|
|
30
23
|
return null;
|
|
31
24
|
} : _ref$fileErrors,
|
|
32
25
|
_ref$disabled = _ref.disabled,
|
|
33
26
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
34
27
|
_ref$dropzoneLabel = _ref.dropzoneLabel,
|
|
35
|
-
dropzoneLabel = _ref$dropzoneLabel === void 0 ? "
|
|
28
|
+
dropzoneLabel = _ref$dropzoneLabel === void 0 ? "" : _ref$dropzoneLabel,
|
|
36
29
|
_ref$dropzoneDescript = _ref.dropzoneDescription,
|
|
37
|
-
dropzoneDescription = _ref$dropzoneDescript === void 0 ? "Drag and drop
|
|
30
|
+
dropzoneDescription = _ref$dropzoneDescript === void 0 ? "Drag and drop file(s) here, or choose file" : _ref$dropzoneDescript,
|
|
38
31
|
_ref$helperText = _ref.helperText,
|
|
39
32
|
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
40
33
|
_ref$helperTextPlacem = _ref.helperTextPlacement,
|
|
@@ -58,7 +51,11 @@ function FileUpload(_ref) {
|
|
|
58
51
|
saving = _ref$saving === void 0 ? void 0 : _ref$saving,
|
|
59
52
|
name = _ref.name,
|
|
60
53
|
_ref$files = _ref.files,
|
|
61
|
-
files = _ref$files === void 0 ? null : _ref$files
|
|
54
|
+
files = _ref$files === void 0 ? null : _ref$files,
|
|
55
|
+
_ref$itemDivider = _ref.itemDivider,
|
|
56
|
+
itemDivider = _ref$itemDivider === void 0 ? true : _ref$itemDivider,
|
|
57
|
+
_ref$renderItem = _ref.renderItem,
|
|
58
|
+
renderItem = _ref$renderItem === void 0 ? void 0 : _ref$renderItem;
|
|
62
59
|
var _useState = React.useState(null),
|
|
63
60
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
64
61
|
confirmDelete = _useState2[0],
|
|
@@ -158,18 +155,28 @@ function FileUpload(_ref) {
|
|
|
158
155
|
edges: edges
|
|
159
156
|
}, /* @__PURE__ */React.createElement(FormFocus.default, {
|
|
160
157
|
name: name
|
|
161
|
-
}), files
|
|
158
|
+
}), (!files || files.length === 0 || !dropzoneProps || dropzoneProps.maxFiles === void 0 || dropzoneProps.maxFiles > 1) && /* @__PURE__ */React.createElement(framerMotion.motion.div, _rollupPluginBabelHelpers.objectSpread2({}, fade), /* @__PURE__ */React.createElement(DropZone.default, {
|
|
159
|
+
loading: loading,
|
|
160
|
+
disabled: disabled,
|
|
161
|
+
onDrop: onDrop,
|
|
162
|
+
edges: edges,
|
|
163
|
+
dropzoneLabel: dropzoneLabel,
|
|
164
|
+
dropzoneDescription: dropzoneDescription,
|
|
165
|
+
dropzoneProps: dropzoneProps
|
|
166
|
+
})), files && files.length > 0 && /* @__PURE__ */React.createElement(framerMotion.AnimatePresence, null, /* @__PURE__ */React.createElement(FileUpload_styled.StyledSavedWrapper, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, fade), {}, {
|
|
162
167
|
edges: edges
|
|
163
168
|
}), (saving || loading) && /* @__PURE__ */React.createElement(FileUpload_styled.StyledLoader, {
|
|
164
169
|
disableShrink: true
|
|
165
|
-
}), /* @__PURE__ */React.createElement(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
xs: 12
|
|
170
|
+
}), /* @__PURE__ */React.createElement(Stack, {
|
|
171
|
+
divider: itemDivider ? /* @__PURE__ */React.createElement(Divider.default, {
|
|
172
|
+
disableGutter: true
|
|
173
|
+
}) : null,
|
|
174
|
+
useFlexGap: true,
|
|
175
|
+
spacing: "24px"
|
|
172
176
|
}, files.map(function (file$1, index) {
|
|
177
|
+
if (typeof renderItem === "function") {
|
|
178
|
+
return renderItem(file$1, index);
|
|
179
|
+
}
|
|
173
180
|
return /* @__PURE__ */React.createElement(framerMotion.motion.div, {
|
|
174
181
|
key: file.getFileName(file$1),
|
|
175
182
|
positionTransition: true,
|
|
@@ -190,48 +197,22 @@ function FileUpload(_ref) {
|
|
|
190
197
|
duration: 0.2
|
|
191
198
|
}
|
|
192
199
|
}
|
|
193
|
-
}, /* @__PURE__ */React.createElement(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
color: "success",
|
|
203
|
-
size: "small",
|
|
204
|
-
variant: "text"
|
|
205
|
-
}, "View"), /* @__PURE__ */React.createElement(Tooltip.default, {
|
|
206
|
-
title: "Delete"
|
|
207
|
-
}, /* @__PURE__ */React.createElement(IconButton.default, {
|
|
208
|
-
disabled: saving,
|
|
209
|
-
size: "small",
|
|
210
|
-
onClick: function onClick() {
|
|
211
|
-
return !showError ? handleDeleteConfirmation(index) : handleDeleteWithoutConfirmation(index);
|
|
212
|
-
}
|
|
213
|
-
}, /* @__PURE__ */React.createElement(DeleteIcon, null))))
|
|
214
|
-
}, /* @__PURE__ */React.createElement(FileUpload_styled.StyledAlertTitle, null, file.getFileName(file$1)), fileErrors(file$1, index)));
|
|
215
|
-
}))))), (!files || files.length === 0 || !dropzoneProps || dropzoneProps.maxFiles === void 0 || dropzoneProps.maxFiles > 1) && /* @__PURE__ */React.createElement(framerMotion.motion.div, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, fade), {}, {
|
|
216
|
-
style: files && files.length > 0 ? {
|
|
217
|
-
marginTop: 8
|
|
218
|
-
} : null
|
|
219
|
-
}), /* @__PURE__ */React.createElement(DropZone.default, {
|
|
220
|
-
loading: loading,
|
|
221
|
-
disabled: disabled,
|
|
222
|
-
onDrop: onDrop,
|
|
223
|
-
edges: edges,
|
|
224
|
-
dropzoneLabel: dropzoneLabel,
|
|
225
|
-
dropzoneDescription: dropzoneDescription,
|
|
226
|
-
dropzoneProps: dropzoneProps,
|
|
227
|
-
compact: files && files.length > 0
|
|
228
|
-
}))), /* @__PURE__ */React.createElement(Confirmation.default, {
|
|
200
|
+
}, /* @__PURE__ */React.createElement(FileUploadItem.default, {
|
|
201
|
+
message: fileErrors(file$1, index),
|
|
202
|
+
file: file$1,
|
|
203
|
+
error: showError || fileErrors(file$1, index) !== null,
|
|
204
|
+
onDelete: function onDelete() {
|
|
205
|
+
return !showError ? handleDeleteConfirmation(index) : handleDeleteWithoutConfirmation(index);
|
|
206
|
+
}
|
|
207
|
+
}));
|
|
208
|
+
}))))), /* @__PURE__ */React.createElement(Confirmation.default, {
|
|
229
209
|
open: confirmDeleteAll,
|
|
230
210
|
onCancel: function onCancel() {
|
|
231
211
|
return setConfirmDeleteAll(false);
|
|
232
212
|
},
|
|
233
213
|
onConfirm: handleDeleteAll,
|
|
234
|
-
message: "Are you sure you want to remove the attached file(s)?"
|
|
214
|
+
message: "Are you sure you want to remove the attached file(s)?",
|
|
215
|
+
severity: "error"
|
|
235
216
|
}), /* @__PURE__ */React.createElement(Confirmation.default, {
|
|
236
217
|
open: confirmDelete !== null,
|
|
237
218
|
onCancel: function onCancel() {
|
|
@@ -239,7 +220,8 @@ function FileUpload(_ref) {
|
|
|
239
220
|
setLoading(false);
|
|
240
221
|
},
|
|
241
222
|
onConfirm: handleDelete,
|
|
242
|
-
message: "Are you sure you want to remove the attached file?"
|
|
223
|
+
message: "Are you sure you want to remove the attached file?",
|
|
224
|
+
severity: "error"
|
|
243
225
|
}), /* @__PURE__ */React.createElement(FileViewer.default, {
|
|
244
226
|
file: viewedFile,
|
|
245
227
|
open: viewedFile !== null,
|
|
@@ -250,6 +232,8 @@ function FileUpload(_ref) {
|
|
|
250
232
|
}
|
|
251
233
|
FileUpload.propTypes = {
|
|
252
234
|
/**
|
|
235
|
+
* @deprecated
|
|
236
|
+
*
|
|
253
237
|
* Add actions to file line items
|
|
254
238
|
*/
|
|
255
239
|
fileActions: PropTypes.func,
|
|
@@ -329,7 +313,15 @@ FileUpload.propTypes = {
|
|
|
329
313
|
/**
|
|
330
314
|
* Make button edges rounded or square
|
|
331
315
|
*/
|
|
332
|
-
edges: PropTypes.oneOf(["normal", "rounded", "sharp"])
|
|
316
|
+
edges: PropTypes.oneOf(["normal", "rounded", "sharp"]),
|
|
317
|
+
/**
|
|
318
|
+
* Function to render custom element or component when file is uploaded.
|
|
319
|
+
*/
|
|
320
|
+
renderItem: PropTypes.func,
|
|
321
|
+
/**
|
|
322
|
+
* If true, will show divider between uploaded files
|
|
323
|
+
*/
|
|
324
|
+
itemDivider: PropTypes.bool
|
|
333
325
|
};
|
|
334
326
|
|
|
335
327
|
exports.default = FileUpload;
|
|
@@ -5,16 +5,6 @@ var styles = require('@mui/material/styles');
|
|
|
5
5
|
var AlertTitle = require('@mui/material/AlertTitle');
|
|
6
6
|
var CircularProgress = require('@mui/material/CircularProgress');
|
|
7
7
|
|
|
8
|
-
var borderRadius = function borderRadius(edges, theme) {
|
|
9
|
-
switch (edges) {
|
|
10
|
-
case "rounded":
|
|
11
|
-
return 99;
|
|
12
|
-
case "sharp":
|
|
13
|
-
return 0;
|
|
14
|
-
default:
|
|
15
|
-
return theme.shape.borderRadius;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
8
|
var StyledAlertTitle = styles.styled(AlertTitle)({
|
|
19
9
|
fontSize: 14,
|
|
20
10
|
overflow: "hidden",
|
|
@@ -30,18 +20,9 @@ var StyledLoader = styles.styled(CircularProgress)({
|
|
|
30
20
|
marginLeft: -20,
|
|
31
21
|
zIndex: 1
|
|
32
22
|
});
|
|
33
|
-
var StyledSavedWrapper = styles.styled(framerMotion.motion.div)(function (
|
|
34
|
-
var edges = _ref.edges,
|
|
35
|
-
theme = _ref.theme;
|
|
23
|
+
var StyledSavedWrapper = styles.styled(framerMotion.motion.div)(function () {
|
|
36
24
|
return {
|
|
37
|
-
|
|
38
|
-
border: "1px solid ".concat(theme.palette.text.secondary),
|
|
39
|
-
padding: theme.spacing(6, 4),
|
|
40
|
-
"& .MuiAlert-message": {
|
|
41
|
-
overflow: "hidden",
|
|
42
|
-
textOverflow: "ellipsis",
|
|
43
|
-
whiteSpace: "nowrap"
|
|
44
|
-
}
|
|
25
|
+
marginTop: "24px"
|
|
45
26
|
};
|
|
46
27
|
});
|
|
47
28
|
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.cjs');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var Stack = require('@mui/material/Stack');
|
|
8
|
+
var ImageOutlinedIcon = require('@mui/icons-material/ImageOutlined');
|
|
9
|
+
var FileCopyOutlinedIcon = require('@mui/icons-material/FileCopyOutlined');
|
|
10
|
+
var PictureAsPdfOutlinedIcon = require('@mui/icons-material/PictureAsPdfOutlined');
|
|
11
|
+
var DeleteTwoToneIcon = require('@mui/icons-material/DeleteTwoTone');
|
|
12
|
+
var CheckCircleOutlineRoundedIcon = require('@mui/icons-material/CheckCircleOutlineRounded');
|
|
13
|
+
var ErrorOutlineRoundedIcon = require('@mui/icons-material/ErrorOutlineRounded');
|
|
14
|
+
var Box = require('./Box.cjs');
|
|
15
|
+
var IconButton = require('./IconButton.cjs');
|
|
16
|
+
var Text = require('./Text.cjs');
|
|
17
|
+
var file = require('../utils/helpers/file.cjs');
|
|
18
|
+
|
|
19
|
+
function FileUploadItem(_ref) {
|
|
20
|
+
var _ref$error = _ref.error,
|
|
21
|
+
error = _ref$error === void 0 ? false : _ref$error,
|
|
22
|
+
file$1 = _ref.file,
|
|
23
|
+
_ref$message = _ref.message,
|
|
24
|
+
message = _ref$message === void 0 ? void 0 : _ref$message,
|
|
25
|
+
onDelete = _ref.onDelete,
|
|
26
|
+
_ref$sx = _ref.sx,
|
|
27
|
+
sx = _ref$sx === void 0 ? {} : _ref$sx;
|
|
28
|
+
var displayName = file.getFileName(file$1).replace("./", "");
|
|
29
|
+
var styles = _rollupPluginBabelHelpers.objectSpread2({
|
|
30
|
+
py: "6px"
|
|
31
|
+
}, sx);
|
|
32
|
+
var icon = function icon() {
|
|
33
|
+
if (file.isImage(file$1)) {
|
|
34
|
+
return /* @__PURE__ */React.createElement(ImageOutlinedIcon, {
|
|
35
|
+
fontSize: "medium",
|
|
36
|
+
color: "inherit"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (file.getFileExtension(file$1) === "pdf") {
|
|
40
|
+
return /* @__PURE__ */React.createElement(PictureAsPdfOutlinedIcon, {
|
|
41
|
+
fontSize: "medium",
|
|
42
|
+
color: "inherit"
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return /* @__PURE__ */React.createElement(FileCopyOutlinedIcon, {
|
|
46
|
+
fontSize: "medium",
|
|
47
|
+
color: "inherit"
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
return /* @__PURE__ */React.createElement(Stack, {
|
|
51
|
+
direction: "row",
|
|
52
|
+
spacing: "16px",
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
sx: styles,
|
|
55
|
+
useFlexGap: true
|
|
56
|
+
}, /* @__PURE__ */React.createElement(Stack, {
|
|
57
|
+
direction: "row",
|
|
58
|
+
alignItems: message ? "flex-start" : "center",
|
|
59
|
+
flex: 1,
|
|
60
|
+
spacing: "16px",
|
|
61
|
+
color: "grey.500",
|
|
62
|
+
useFlexGap: true
|
|
63
|
+
}, icon(), /* @__PURE__ */React.createElement(Box.default, null, /* @__PURE__ */React.createElement(Text.default, {
|
|
64
|
+
weight: "600",
|
|
65
|
+
sx: {
|
|
66
|
+
fontSize: "16px"
|
|
67
|
+
},
|
|
68
|
+
color: "primary"
|
|
69
|
+
}, displayName), message && /* @__PURE__ */React.createElement(Text.default, {
|
|
70
|
+
sx: {
|
|
71
|
+
fontSize: "14px",
|
|
72
|
+
mt: "4px"
|
|
73
|
+
},
|
|
74
|
+
color: error ? "error" : "grey.700"
|
|
75
|
+
}, message))), /* @__PURE__ */React.createElement(Stack, {
|
|
76
|
+
direction: "row",
|
|
77
|
+
alignItems: "center",
|
|
78
|
+
spacing: "16px",
|
|
79
|
+
useFlexGap: true
|
|
80
|
+
}, error ? /* @__PURE__ */React.createElement(ErrorOutlineRoundedIcon, {
|
|
81
|
+
color: "error"
|
|
82
|
+
}) : /* @__PURE__ */React.createElement(CheckCircleOutlineRoundedIcon, {
|
|
83
|
+
color: "tertiary"
|
|
84
|
+
}), /* @__PURE__ */React.createElement(IconButton.default, {
|
|
85
|
+
onClick: onDelete,
|
|
86
|
+
color: "primary"
|
|
87
|
+
}, /* @__PURE__ */React.createElement(DeleteTwoToneIcon, null))));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
exports.default = FileUploadItem;
|
|
@@ -6,7 +6,7 @@ var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.c
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var IconButton_styled = require('./IconButton.styled.cjs');
|
|
8
8
|
|
|
9
|
-
var _excluded = ["children", "color", "edges", "disabled", "size"];
|
|
9
|
+
var _excluded = ["children", "color", "edges", "disabled", "size", "loading"];
|
|
10
10
|
function IconButton(_ref) {
|
|
11
11
|
var children = _ref.children,
|
|
12
12
|
_ref$color = _ref.color,
|
|
@@ -17,9 +17,12 @@ function IconButton(_ref) {
|
|
|
17
17
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
18
18
|
_ref$size = _ref.size,
|
|
19
19
|
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
20
|
+
_ref$loading = _ref.loading,
|
|
21
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
20
22
|
others = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
21
23
|
var rest = _rollupPluginBabelHelpers.objectSpread2({
|
|
22
|
-
size: size
|
|
24
|
+
size: size,
|
|
25
|
+
loading: loading
|
|
23
26
|
}, others);
|
|
24
27
|
return /* @__PURE__ */React.createElement(IconButton_styled.default, _rollupPluginBabelHelpers.objectSpread2({
|
|
25
28
|
type: "button",
|
|
@@ -9,7 +9,7 @@ var IconButton = require('@mui/material/IconButton');
|
|
|
9
9
|
var Button_styled = require('./Button.styled.cjs');
|
|
10
10
|
var object = require('../utils/helpers/object.cjs');
|
|
11
11
|
|
|
12
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
12
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
13
13
|
var sizeStyles = function sizeStyles(_ref) {
|
|
14
14
|
var size = _ref.size;
|
|
15
15
|
return react.css(_templateObject || (_templateObject = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n"])), size === "small" && react.css(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n font-size: 24px;\n "]))), size === "medium" && react.css(_templateObject3 || (_templateObject3 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n font-size: 30px;\n "]))), size === "large" && react.css(_templateObject4 || (_templateObject4 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n font-size: 36px;\n "]))));
|
|
@@ -19,13 +19,19 @@ var hoverStyles = function hoverStyles(_ref2) {
|
|
|
19
19
|
theme = _ref2.theme;
|
|
20
20
|
return react.css(_templateObject5 || (_templateObject5 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n &:hover,\n &:active {\n background-color: var(--IconButton-hoverBg) !important;\n color: ", ";\n }\n"])), object.getObjectProp(theme, "vars.palette.".concat(color, ".main")));
|
|
21
21
|
};
|
|
22
|
-
var
|
|
22
|
+
var loadingStyles = function loadingStyles(_ref3) {
|
|
23
23
|
var color = _ref3.color,
|
|
24
|
-
disabled = _ref3.disabled,
|
|
25
|
-
edges = _ref3.edges,
|
|
26
|
-
size = _ref3.size,
|
|
27
24
|
theme = _ref3.theme;
|
|
28
|
-
return react.css(
|
|
25
|
+
return react.css(_templateObject6 || (_templateObject6 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n color: ", ";\n .MuiSvgIcon-root {\n display: none;\n }\n"])), object.getObjectProp(theme, "vars.palette.".concat(color, ".main")));
|
|
26
|
+
};
|
|
27
|
+
var StyledIconButton = styles.styled(IconButton)(_templateObject7 || (_templateObject7 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n ", "\n"])), function (_ref4) {
|
|
28
|
+
var color = _ref4.color,
|
|
29
|
+
disabled = _ref4.disabled,
|
|
30
|
+
loading = _ref4.loading,
|
|
31
|
+
edges = _ref4.edges,
|
|
32
|
+
size = _ref4.size,
|
|
33
|
+
theme = _ref4.theme;
|
|
34
|
+
return react.css(_templateObject8 || (_templateObject8 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n && {\n padding: 4px;\n ", "\n ", "\n ", "\n ", "\n ", "\n }\n "])), disabled && Button_styled.disabledStyles, Button_styled.edgesStyles({
|
|
29
35
|
edges: edges,
|
|
30
36
|
theme: theme
|
|
31
37
|
}), sizeStyles({
|
|
@@ -33,8 +39,12 @@ var StyledIconButton = styles.styled(IconButton)(_templateObject6 || (_templateO
|
|
|
33
39
|
}), hoverStyles({
|
|
34
40
|
color: color,
|
|
35
41
|
theme: theme
|
|
42
|
+
}), loading && loadingStyles({
|
|
43
|
+
color: color,
|
|
44
|
+
theme: theme
|
|
36
45
|
}));
|
|
37
46
|
});
|
|
38
47
|
|
|
39
48
|
exports.default = StyledIconButton;
|
|
40
49
|
exports.hoverStyles = hoverStyles;
|
|
50
|
+
exports.loadingStyles = loadingStyles;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -25,6 +25,7 @@ var Divider = require('./components/Divider.cjs');
|
|
|
25
25
|
var DropZone = require('./components/DropZone.cjs');
|
|
26
26
|
var Embed = require('./components/Embed.cjs');
|
|
27
27
|
var FileUpload = require('./components/FileUpload.cjs');
|
|
28
|
+
var FileUploadItem = require('./components/FileUploadItem.cjs');
|
|
28
29
|
var FileUploadButton = require('./components/FileUploadButton.cjs');
|
|
29
30
|
var FileViewer = require('./components/FileViewer.cjs');
|
|
30
31
|
var FlashMessage = require('./components/FlashMessage.cjs');
|
|
@@ -113,6 +114,7 @@ exports.Divider = Divider.default;
|
|
|
113
114
|
exports.DropZone = DropZone.default;
|
|
114
115
|
exports.Embed = Embed.default;
|
|
115
116
|
exports.FileUpload = FileUpload.default;
|
|
117
|
+
exports.FileUploadItem = FileUploadItem.default;
|
|
116
118
|
exports.FileUploadButton = FileUploadButton.default;
|
|
117
119
|
exports.FileViewer = FileViewer.default;
|
|
118
120
|
exports.FlashMessage = FlashMessage.default;
|
package/dist/cjs/theme/index.cjs
CHANGED
|
@@ -33,7 +33,7 @@ var getFileExtension = function getFileExtension(file) {
|
|
|
33
33
|
};
|
|
34
34
|
var isImage = function isImage(file) {
|
|
35
35
|
var extension = getFileExtension(file);
|
|
36
|
-
var extensions = ["jpg", "jpeg", "png", "gif", "svg"];
|
|
36
|
+
var extensions = ["jpg", "jpeg", "png", "gif", "svg", "webp"];
|
|
37
37
|
return extensions.includes(extension);
|
|
38
38
|
};
|
|
39
39
|
var formatBytes = function formatBytes(bytes) {
|
|
@@ -4,7 +4,7 @@ import { css } from '@emotion/react';
|
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
import { getObjectProp } from '../utils/helpers/object.js';
|
|
6
6
|
|
|
7
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1, _templateObject10, _templateObject11, _templateObject12;
|
|
7
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
|
|
8
8
|
var edgesStyles = function edgesStyles(_ref) {
|
|
9
9
|
var edges = _ref.edges,
|
|
10
10
|
theme = _ref.theme;
|
|
@@ -17,24 +17,25 @@ var sizeStyles = function sizeStyles(_ref2) {
|
|
|
17
17
|
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-weight: ", ";\n ", "\n ", "\n ", "\n"])), getObjectProp(theme, "typography.button.fontWeight", "700"), size === "small" && css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n font-size: calc(\n ", "px - 2px\n );\n height: 32px;\n "])), getObjectProp(theme, "typography.button.fontSize", "14")), size === "medium" && css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-size: ", "px;\n height: 36px;\n "])), getObjectProp(theme, "typography.button.fontSize", "14")), size === "large" && css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n font-size: font-size: calc(\n ", "px + 2px\n );\n height: 44px;\n "])), getObjectProp(theme, "typography.button.fontSize", "14")));
|
|
18
18
|
};
|
|
19
19
|
var disabledStyles = css(_templateObject0 || (_templateObject0 = _taggedTemplateLiteral(["\n color: var(--tn-palette-text-muted);\n background-color: var(--tn-palette-background-muted);\n border: none;\n"])));
|
|
20
|
+
var colors = ["primary", "secondary", "tertiary"];
|
|
20
21
|
var containedStyles = function containedStyles(_ref3) {
|
|
21
22
|
var color = _ref3.color,
|
|
22
23
|
theme = _ref3.theme;
|
|
23
|
-
return css(_templateObject1 || (_templateObject1 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n\n
|
|
24
|
+
return css(_templateObject1 || (_templateObject1 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n\n ", "\n\n ", "\n\n &:active {\n background-color: ", ";\n color: ", ";\n }\n .MuiButton-loadingWrapper {\n color: ", ";\n }\n\n ", "\n"])), getObjectProp(theme, "vars.palette.".concat(color, ".contrastText")), getObjectProp(theme, "vars.palette.".concat(color, ".main")), colors.includes(color) && css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n "])), getObjectProp(theme, "vars.palette.".concat(color, ".light")), getObjectProp(theme, "vars.palette.".concat(color, ".contrastText"))), !colors.includes(color) && css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n &:hover {\n opacity: 0.8;\n }\n "]))), getObjectProp(theme, "vars.palette.".concat(color, ".dark")), getObjectProp(theme, "vars.palette.".concat(color, ".contrastText")), getObjectProp(theme, "vars.palette.".concat(color, ".contrastText")), focusStyles);
|
|
24
25
|
};
|
|
25
26
|
var outlinedStyles = function outlinedStyles(_ref4) {
|
|
26
27
|
var color = _ref4.color,
|
|
27
28
|
theme = _ref4.theme;
|
|
28
|
-
return css(
|
|
29
|
+
return css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: transparent;\n border: 1px solid currentColor;\n\n .MuiButton-loadingWrapper {\n color: ", ";\n }\n\n &:hover,\n &:active {\n background-color: ", ";\n }\n\n ", "\n"])), getObjectProp(theme, "vars.palette.".concat(color, ".main")), getObjectProp(theme, "vars.palette.".concat(color, ".main")), getObjectProp(theme, "vars.palette.background.muted"), focusStyles);
|
|
29
30
|
};
|
|
30
|
-
var StyledButton = styled(Button)(
|
|
31
|
+
var StyledButton = styled(Button)(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref5) {
|
|
31
32
|
var color = _ref5.color,
|
|
32
33
|
disabled = _ref5.disabled,
|
|
33
34
|
edges = _ref5.edges,
|
|
34
35
|
size = _ref5.size,
|
|
35
36
|
theme = _ref5.theme,
|
|
36
37
|
variant = _ref5.variant;
|
|
37
|
-
return css(
|
|
38
|
+
return css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n && {\n padding: 0px 24px;\n text-transform: initial;\n font-weight: 700;\n\n ", "\n ", "\n ", "\n ", "\n ", "\n }\n "])), edgesStyles({
|
|
38
39
|
edges: edges,
|
|
39
40
|
theme: theme
|
|
40
41
|
}), sizeStyles({
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import Stack from '@mui/material/Stack';
|
|
3
|
+
import CheckCircleOutlineOutlinedIcon from '@mui/icons-material/CheckCircleOutlineOutlined';
|
|
4
|
+
import WarningAmberRoundedIcon from '@mui/icons-material/WarningAmberRounded';
|
|
5
|
+
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
6
|
+
import ReportGmailerrorredRoundedIcon from '@mui/icons-material/ReportGmailerrorredRounded';
|
|
7
|
+
import Box from './Box.js';
|
|
2
8
|
import Button from './Button.js';
|
|
3
9
|
import Heading from './Heading.js';
|
|
4
10
|
import Modal from './Modal.js';
|
|
@@ -23,30 +29,63 @@ function Confirmation(_ref) {
|
|
|
23
29
|
severity = _ref$severity === void 0 ? "default" : _ref$severity,
|
|
24
30
|
_ref$title = _ref.title,
|
|
25
31
|
title = _ref$title === void 0 ? "Are you sure?" : _ref$title;
|
|
32
|
+
var severityIconMap = {
|
|
33
|
+
error: /* @__PURE__ */React.createElement(WarningAmberRoundedIcon, {
|
|
34
|
+
color: "inherit",
|
|
35
|
+
fontSize: "inherit"
|
|
36
|
+
}),
|
|
37
|
+
info: /* @__PURE__ */React.createElement(InfoOutlinedIcon, {
|
|
38
|
+
color: "inherit",
|
|
39
|
+
fontSize: "inherit"
|
|
40
|
+
}),
|
|
41
|
+
success: /* @__PURE__ */React.createElement(CheckCircleOutlineOutlinedIcon, {
|
|
42
|
+
color: "inherit",
|
|
43
|
+
fontSize: "inherit"
|
|
44
|
+
}),
|
|
45
|
+
warning: /* @__PURE__ */React.createElement(ReportGmailerrorredRoundedIcon, {
|
|
46
|
+
color: "inherit",
|
|
47
|
+
fontSize: "inherit"
|
|
48
|
+
})
|
|
49
|
+
};
|
|
26
50
|
var actions = /* @__PURE__ */React.createElement(React.Fragment, null, onCancel && cancelBtnText && /* @__PURE__ */React.createElement(Button, {
|
|
27
51
|
onClick: onCancel,
|
|
28
|
-
color: "primaryAlt",
|
|
29
52
|
variant: "outlined",
|
|
30
|
-
size: "small",
|
|
31
53
|
loading: cancelling
|
|
32
54
|
}, cancelBtnText), onConfirm && confirmBtnText && /* @__PURE__ */React.createElement(Button, {
|
|
33
55
|
onClick: onConfirm,
|
|
34
56
|
color: severity === "default" ? "primary" : severity,
|
|
35
|
-
size: "small",
|
|
36
57
|
loading: confirming
|
|
37
58
|
}, confirmBtnText));
|
|
38
59
|
return /* @__PURE__ */React.createElement(Modal, {
|
|
39
|
-
maxWidth: "
|
|
60
|
+
maxWidth: "sm",
|
|
40
61
|
open: open,
|
|
41
|
-
heading: /* @__PURE__ */React.createElement(Heading, {
|
|
42
|
-
as: "h5",
|
|
43
|
-
gutterBottom: false
|
|
44
|
-
}, title),
|
|
45
62
|
actions: actions,
|
|
46
|
-
content: /* @__PURE__ */React.createElement(
|
|
63
|
+
content: /* @__PURE__ */React.createElement(Stack, {
|
|
64
|
+
direction: "row",
|
|
65
|
+
spacing: "32px",
|
|
66
|
+
sx: {
|
|
67
|
+
maxWidth: "532px"
|
|
68
|
+
}
|
|
69
|
+
}, severity !== "default" && /* @__PURE__ */React.createElement(Box, null, /* @__PURE__ */React.createElement(Box, {
|
|
70
|
+
sx: {
|
|
71
|
+
width: "48px",
|
|
72
|
+
height: "48px",
|
|
73
|
+
borderRadius: "99999px",
|
|
74
|
+
fontSize: "32px",
|
|
75
|
+
bgcolor: "".concat(severity, ".light"),
|
|
76
|
+
color: "".concat(severity, ".main"),
|
|
77
|
+
display: "flex",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
justifyContent: "center",
|
|
80
|
+
mt: "12px"
|
|
81
|
+
}
|
|
82
|
+
}, severityIconMap[severity])), /* @__PURE__ */React.createElement(Stack, null, /* @__PURE__ */React.createElement(Heading, {
|
|
83
|
+
as: "h3",
|
|
84
|
+
gutterBottom: true
|
|
85
|
+
}, title), /* @__PURE__ */React.createElement(Text, {
|
|
47
86
|
as: "div",
|
|
48
|
-
|
|
49
|
-
}, message)
|
|
87
|
+
weight: "500"
|
|
88
|
+
}, message)))
|
|
50
89
|
});
|
|
51
90
|
}
|
|
52
91
|
|
|
@@ -24,15 +24,15 @@ var StyledWrapper = styled(Box)(function (_ref) {
|
|
|
24
24
|
position: "relative",
|
|
25
25
|
display: compact === "yes" ? "flex" : "block",
|
|
26
26
|
textAlign: "center",
|
|
27
|
-
border: "2px dashed ".concat(errors === "yes" ? theme.palette.error.main : theme.palette.
|
|
27
|
+
border: "2px dashed ".concat(errors === "yes" ? theme.palette.error.main : theme.palette.tertiary.main),
|
|
28
28
|
padding: compact === "yes" ? theme.spacing(2, 4) : theme.spacing(6, 4),
|
|
29
29
|
background: disabled ? theme.palette.grey[300] : null,
|
|
30
30
|
opacity: disabled ? 0.5 : 1,
|
|
31
31
|
borderRadius: borderRadius(edges, theme),
|
|
32
32
|
"&:focus": {
|
|
33
|
-
border: "2px solid ".concat(theme.palette.
|
|
33
|
+
border: "2px solid ".concat(theme.palette.tertiary.main),
|
|
34
34
|
outline: "none",
|
|
35
|
-
background: hexToRgba(theme.palette.
|
|
35
|
+
background: hexToRgba(theme.palette.tertiary.main, 0.1)
|
|
36
36
|
},
|
|
37
37
|
alignItems: "center",
|
|
38
38
|
"& .MuiTypography-root": {
|
|
@@ -1,36 +1,29 @@
|
|
|
1
1
|
import { slicedToArray as _slicedToArray, toConsumableArray as _toConsumableArray, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React, { useState, useCallback } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import DropZone from './DropZone.js';
|
|
7
|
-
import FormControl from './FormControl.js';
|
|
8
|
-
import Alert from './Alert.js';
|
|
9
|
-
import Button from './Button.js';
|
|
4
|
+
import { motion, AnimatePresence } from 'framer-motion';
|
|
5
|
+
import Stack from '@mui/material/Stack';
|
|
10
6
|
import Confirmation from './Confirmation.js';
|
|
11
|
-
import
|
|
7
|
+
import Divider from './Divider.js';
|
|
8
|
+
import DropZone from './DropZone.js';
|
|
12
9
|
import FileViewer from './FileViewer.js';
|
|
10
|
+
import FileUploadItem from './FileUploadItem.js';
|
|
11
|
+
import FormControl from './FormControl.js';
|
|
13
12
|
import FormFocus from './FormFocus.js';
|
|
14
|
-
import
|
|
15
|
-
import Tooltip from './Tooltip.js';
|
|
16
|
-
import { StyledSavedWrapper, StyledLoader, StyledAlertTitle } from './FileUpload.styled.js';
|
|
13
|
+
import { StyledSavedWrapper, StyledLoader } from './FileUpload.styled.js';
|
|
17
14
|
import { getFileName } from '../utils/helpers/file.js';
|
|
18
15
|
|
|
19
16
|
function FileUpload(_ref) {
|
|
20
|
-
var _ref$
|
|
21
|
-
fileActions = _ref$fileActions === void 0 ? function () {
|
|
22
|
-
return null;
|
|
23
|
-
} : _ref$fileActions,
|
|
24
|
-
_ref$fileErrors = _ref.fileErrors,
|
|
17
|
+
var _ref$fileErrors = _ref.fileErrors,
|
|
25
18
|
fileErrors = _ref$fileErrors === void 0 ? function () {
|
|
26
19
|
return null;
|
|
27
20
|
} : _ref$fileErrors,
|
|
28
21
|
_ref$disabled = _ref.disabled,
|
|
29
22
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
30
23
|
_ref$dropzoneLabel = _ref.dropzoneLabel,
|
|
31
|
-
dropzoneLabel = _ref$dropzoneLabel === void 0 ? "
|
|
24
|
+
dropzoneLabel = _ref$dropzoneLabel === void 0 ? "" : _ref$dropzoneLabel,
|
|
32
25
|
_ref$dropzoneDescript = _ref.dropzoneDescription,
|
|
33
|
-
dropzoneDescription = _ref$dropzoneDescript === void 0 ? "Drag and drop
|
|
26
|
+
dropzoneDescription = _ref$dropzoneDescript === void 0 ? "Drag and drop file(s) here, or choose file" : _ref$dropzoneDescript,
|
|
34
27
|
_ref$helperText = _ref.helperText,
|
|
35
28
|
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
36
29
|
_ref$helperTextPlacem = _ref.helperTextPlacement,
|
|
@@ -54,7 +47,11 @@ function FileUpload(_ref) {
|
|
|
54
47
|
saving = _ref$saving === void 0 ? void 0 : _ref$saving,
|
|
55
48
|
name = _ref.name,
|
|
56
49
|
_ref$files = _ref.files,
|
|
57
|
-
files = _ref$files === void 0 ? null : _ref$files
|
|
50
|
+
files = _ref$files === void 0 ? null : _ref$files,
|
|
51
|
+
_ref$itemDivider = _ref.itemDivider,
|
|
52
|
+
itemDivider = _ref$itemDivider === void 0 ? true : _ref$itemDivider,
|
|
53
|
+
_ref$renderItem = _ref.renderItem,
|
|
54
|
+
renderItem = _ref$renderItem === void 0 ? void 0 : _ref$renderItem;
|
|
58
55
|
var _useState = useState(null),
|
|
59
56
|
_useState2 = _slicedToArray(_useState, 2),
|
|
60
57
|
confirmDelete = _useState2[0],
|
|
@@ -154,18 +151,28 @@ function FileUpload(_ref) {
|
|
|
154
151
|
edges: edges
|
|
155
152
|
}, /* @__PURE__ */React.createElement(FormFocus, {
|
|
156
153
|
name: name
|
|
157
|
-
}), files
|
|
154
|
+
}), (!files || files.length === 0 || !dropzoneProps || dropzoneProps.maxFiles === void 0 || dropzoneProps.maxFiles > 1) && /* @__PURE__ */React.createElement(motion.div, _objectSpread2({}, fade), /* @__PURE__ */React.createElement(DropZone, {
|
|
155
|
+
loading: loading,
|
|
156
|
+
disabled: disabled,
|
|
157
|
+
onDrop: onDrop,
|
|
158
|
+
edges: edges,
|
|
159
|
+
dropzoneLabel: dropzoneLabel,
|
|
160
|
+
dropzoneDescription: dropzoneDescription,
|
|
161
|
+
dropzoneProps: dropzoneProps
|
|
162
|
+
})), files && files.length > 0 && /* @__PURE__ */React.createElement(AnimatePresence, null, /* @__PURE__ */React.createElement(StyledSavedWrapper, _objectSpread2(_objectSpread2({}, fade), {}, {
|
|
158
163
|
edges: edges
|
|
159
164
|
}), (saving || loading) && /* @__PURE__ */React.createElement(StyledLoader, {
|
|
160
165
|
disableShrink: true
|
|
161
|
-
}), /* @__PURE__ */React.createElement(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
xs: 12
|
|
166
|
+
}), /* @__PURE__ */React.createElement(Stack, {
|
|
167
|
+
divider: itemDivider ? /* @__PURE__ */React.createElement(Divider, {
|
|
168
|
+
disableGutter: true
|
|
169
|
+
}) : null,
|
|
170
|
+
useFlexGap: true,
|
|
171
|
+
spacing: "24px"
|
|
168
172
|
}, files.map(function (file, index) {
|
|
173
|
+
if (typeof renderItem === "function") {
|
|
174
|
+
return renderItem(file, index);
|
|
175
|
+
}
|
|
169
176
|
return /* @__PURE__ */React.createElement(motion.div, {
|
|
170
177
|
key: getFileName(file),
|
|
171
178
|
positionTransition: true,
|
|
@@ -186,48 +193,22 @@ function FileUpload(_ref) {
|
|
|
186
193
|
duration: 0.2
|
|
187
194
|
}
|
|
188
195
|
}
|
|
189
|
-
}, /* @__PURE__ */React.createElement(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
color: "success",
|
|
199
|
-
size: "small",
|
|
200
|
-
variant: "text"
|
|
201
|
-
}, "View"), /* @__PURE__ */React.createElement(Tooltip, {
|
|
202
|
-
title: "Delete"
|
|
203
|
-
}, /* @__PURE__ */React.createElement(IconButton, {
|
|
204
|
-
disabled: saving,
|
|
205
|
-
size: "small",
|
|
206
|
-
onClick: function onClick() {
|
|
207
|
-
return !showError ? handleDeleteConfirmation(index) : handleDeleteWithoutConfirmation(index);
|
|
208
|
-
}
|
|
209
|
-
}, /* @__PURE__ */React.createElement(DeleteIcon, null))))
|
|
210
|
-
}, /* @__PURE__ */React.createElement(StyledAlertTitle, null, getFileName(file)), fileErrors(file, index)));
|
|
211
|
-
}))))), (!files || files.length === 0 || !dropzoneProps || dropzoneProps.maxFiles === void 0 || dropzoneProps.maxFiles > 1) && /* @__PURE__ */React.createElement(motion.div, _objectSpread2(_objectSpread2({}, fade), {}, {
|
|
212
|
-
style: files && files.length > 0 ? {
|
|
213
|
-
marginTop: 8
|
|
214
|
-
} : null
|
|
215
|
-
}), /* @__PURE__ */React.createElement(DropZone, {
|
|
216
|
-
loading: loading,
|
|
217
|
-
disabled: disabled,
|
|
218
|
-
onDrop: onDrop,
|
|
219
|
-
edges: edges,
|
|
220
|
-
dropzoneLabel: dropzoneLabel,
|
|
221
|
-
dropzoneDescription: dropzoneDescription,
|
|
222
|
-
dropzoneProps: dropzoneProps,
|
|
223
|
-
compact: files && files.length > 0
|
|
224
|
-
}))), /* @__PURE__ */React.createElement(Confirmation, {
|
|
196
|
+
}, /* @__PURE__ */React.createElement(FileUploadItem, {
|
|
197
|
+
message: fileErrors(file, index),
|
|
198
|
+
file: file,
|
|
199
|
+
error: showError || fileErrors(file, index) !== null,
|
|
200
|
+
onDelete: function onDelete() {
|
|
201
|
+
return !showError ? handleDeleteConfirmation(index) : handleDeleteWithoutConfirmation(index);
|
|
202
|
+
}
|
|
203
|
+
}));
|
|
204
|
+
}))))), /* @__PURE__ */React.createElement(Confirmation, {
|
|
225
205
|
open: confirmDeleteAll,
|
|
226
206
|
onCancel: function onCancel() {
|
|
227
207
|
return setConfirmDeleteAll(false);
|
|
228
208
|
},
|
|
229
209
|
onConfirm: handleDeleteAll,
|
|
230
|
-
message: "Are you sure you want to remove the attached file(s)?"
|
|
210
|
+
message: "Are you sure you want to remove the attached file(s)?",
|
|
211
|
+
severity: "error"
|
|
231
212
|
}), /* @__PURE__ */React.createElement(Confirmation, {
|
|
232
213
|
open: confirmDelete !== null,
|
|
233
214
|
onCancel: function onCancel() {
|
|
@@ -235,7 +216,8 @@ function FileUpload(_ref) {
|
|
|
235
216
|
setLoading(false);
|
|
236
217
|
},
|
|
237
218
|
onConfirm: handleDelete,
|
|
238
|
-
message: "Are you sure you want to remove the attached file?"
|
|
219
|
+
message: "Are you sure you want to remove the attached file?",
|
|
220
|
+
severity: "error"
|
|
239
221
|
}), /* @__PURE__ */React.createElement(FileViewer, {
|
|
240
222
|
file: viewedFile,
|
|
241
223
|
open: viewedFile !== null,
|
|
@@ -246,6 +228,8 @@ function FileUpload(_ref) {
|
|
|
246
228
|
}
|
|
247
229
|
FileUpload.propTypes = {
|
|
248
230
|
/**
|
|
231
|
+
* @deprecated
|
|
232
|
+
*
|
|
249
233
|
* Add actions to file line items
|
|
250
234
|
*/
|
|
251
235
|
fileActions: PropTypes.func,
|
|
@@ -325,7 +309,15 @@ FileUpload.propTypes = {
|
|
|
325
309
|
/**
|
|
326
310
|
* Make button edges rounded or square
|
|
327
311
|
*/
|
|
328
|
-
edges: PropTypes.oneOf(["normal", "rounded", "sharp"])
|
|
312
|
+
edges: PropTypes.oneOf(["normal", "rounded", "sharp"]),
|
|
313
|
+
/**
|
|
314
|
+
* Function to render custom element or component when file is uploaded.
|
|
315
|
+
*/
|
|
316
|
+
renderItem: PropTypes.func,
|
|
317
|
+
/**
|
|
318
|
+
* If true, will show divider between uploaded files
|
|
319
|
+
*/
|
|
320
|
+
itemDivider: PropTypes.bool
|
|
329
321
|
};
|
|
330
322
|
|
|
331
323
|
export { FileUpload as default };
|
|
@@ -3,16 +3,6 @@ import { styled } from '@mui/material/styles';
|
|
|
3
3
|
import AlertTitle from '@mui/material/AlertTitle';
|
|
4
4
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
5
5
|
|
|
6
|
-
var borderRadius = function borderRadius(edges, theme) {
|
|
7
|
-
switch (edges) {
|
|
8
|
-
case "rounded":
|
|
9
|
-
return 99;
|
|
10
|
-
case "sharp":
|
|
11
|
-
return 0;
|
|
12
|
-
default:
|
|
13
|
-
return theme.shape.borderRadius;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
6
|
var StyledAlertTitle = styled(AlertTitle)({
|
|
17
7
|
fontSize: 14,
|
|
18
8
|
overflow: "hidden",
|
|
@@ -28,18 +18,9 @@ var StyledLoader = styled(CircularProgress)({
|
|
|
28
18
|
marginLeft: -20,
|
|
29
19
|
zIndex: 1
|
|
30
20
|
});
|
|
31
|
-
var StyledSavedWrapper = styled(motion.div)(function (
|
|
32
|
-
var edges = _ref.edges,
|
|
33
|
-
theme = _ref.theme;
|
|
21
|
+
var StyledSavedWrapper = styled(motion.div)(function () {
|
|
34
22
|
return {
|
|
35
|
-
|
|
36
|
-
border: "1px solid ".concat(theme.palette.text.secondary),
|
|
37
|
-
padding: theme.spacing(6, 4),
|
|
38
|
-
"& .MuiAlert-message": {
|
|
39
|
-
overflow: "hidden",
|
|
40
|
-
textOverflow: "ellipsis",
|
|
41
|
-
whiteSpace: "nowrap"
|
|
42
|
-
}
|
|
23
|
+
marginTop: "24px"
|
|
43
24
|
};
|
|
44
25
|
});
|
|
45
26
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Stack from '@mui/material/Stack';
|
|
4
|
+
import ImageOutlinedIcon from '@mui/icons-material/ImageOutlined';
|
|
5
|
+
import FileCopyOutlinedIcon from '@mui/icons-material/FileCopyOutlined';
|
|
6
|
+
import PictureAsPdfOutlinedIcon from '@mui/icons-material/PictureAsPdfOutlined';
|
|
7
|
+
import DeleteTwoToneIcon from '@mui/icons-material/DeleteTwoTone';
|
|
8
|
+
import CheckCircleOutlineRoundedIcon from '@mui/icons-material/CheckCircleOutlineRounded';
|
|
9
|
+
import ErrorOutlineRoundedIcon from '@mui/icons-material/ErrorOutlineRounded';
|
|
10
|
+
import Box from './Box.js';
|
|
11
|
+
import IconButton from './IconButton.js';
|
|
12
|
+
import Text from './Text.js';
|
|
13
|
+
import { getFileName, isImage, getFileExtension } from '../utils/helpers/file.js';
|
|
14
|
+
|
|
15
|
+
function FileUploadItem(_ref) {
|
|
16
|
+
var _ref$error = _ref.error,
|
|
17
|
+
error = _ref$error === void 0 ? false : _ref$error,
|
|
18
|
+
file = _ref.file,
|
|
19
|
+
_ref$message = _ref.message,
|
|
20
|
+
message = _ref$message === void 0 ? void 0 : _ref$message,
|
|
21
|
+
onDelete = _ref.onDelete,
|
|
22
|
+
_ref$sx = _ref.sx,
|
|
23
|
+
sx = _ref$sx === void 0 ? {} : _ref$sx;
|
|
24
|
+
var displayName = getFileName(file).replace("./", "");
|
|
25
|
+
var styles = _objectSpread2({
|
|
26
|
+
py: "6px"
|
|
27
|
+
}, sx);
|
|
28
|
+
var icon = function icon() {
|
|
29
|
+
if (isImage(file)) {
|
|
30
|
+
return /* @__PURE__ */React.createElement(ImageOutlinedIcon, {
|
|
31
|
+
fontSize: "medium",
|
|
32
|
+
color: "inherit"
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (getFileExtension(file) === "pdf") {
|
|
36
|
+
return /* @__PURE__ */React.createElement(PictureAsPdfOutlinedIcon, {
|
|
37
|
+
fontSize: "medium",
|
|
38
|
+
color: "inherit"
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return /* @__PURE__ */React.createElement(FileCopyOutlinedIcon, {
|
|
42
|
+
fontSize: "medium",
|
|
43
|
+
color: "inherit"
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
return /* @__PURE__ */React.createElement(Stack, {
|
|
47
|
+
direction: "row",
|
|
48
|
+
spacing: "16px",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
sx: styles,
|
|
51
|
+
useFlexGap: true
|
|
52
|
+
}, /* @__PURE__ */React.createElement(Stack, {
|
|
53
|
+
direction: "row",
|
|
54
|
+
alignItems: message ? "flex-start" : "center",
|
|
55
|
+
flex: 1,
|
|
56
|
+
spacing: "16px",
|
|
57
|
+
color: "grey.500",
|
|
58
|
+
useFlexGap: true
|
|
59
|
+
}, icon(), /* @__PURE__ */React.createElement(Box, null, /* @__PURE__ */React.createElement(Text, {
|
|
60
|
+
weight: "600",
|
|
61
|
+
sx: {
|
|
62
|
+
fontSize: "16px"
|
|
63
|
+
},
|
|
64
|
+
color: "primary"
|
|
65
|
+
}, displayName), message && /* @__PURE__ */React.createElement(Text, {
|
|
66
|
+
sx: {
|
|
67
|
+
fontSize: "14px",
|
|
68
|
+
mt: "4px"
|
|
69
|
+
},
|
|
70
|
+
color: error ? "error" : "grey.700"
|
|
71
|
+
}, message))), /* @__PURE__ */React.createElement(Stack, {
|
|
72
|
+
direction: "row",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
spacing: "16px",
|
|
75
|
+
useFlexGap: true
|
|
76
|
+
}, error ? /* @__PURE__ */React.createElement(ErrorOutlineRoundedIcon, {
|
|
77
|
+
color: "error"
|
|
78
|
+
}) : /* @__PURE__ */React.createElement(CheckCircleOutlineRoundedIcon, {
|
|
79
|
+
color: "tertiary"
|
|
80
|
+
}), /* @__PURE__ */React.createElement(IconButton, {
|
|
81
|
+
onClick: onDelete,
|
|
82
|
+
color: "primary"
|
|
83
|
+
}, /* @__PURE__ */React.createElement(DeleteTwoToneIcon, null))));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { FileUploadItem as default };
|
|
@@ -2,7 +2,7 @@ import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import StyledIconButton from './IconButton.styled.js';
|
|
4
4
|
|
|
5
|
-
var _excluded = ["children", "color", "edges", "disabled", "size"];
|
|
5
|
+
var _excluded = ["children", "color", "edges", "disabled", "size", "loading"];
|
|
6
6
|
function IconButton(_ref) {
|
|
7
7
|
var children = _ref.children,
|
|
8
8
|
_ref$color = _ref.color,
|
|
@@ -13,9 +13,12 @@ function IconButton(_ref) {
|
|
|
13
13
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
14
14
|
_ref$size = _ref.size,
|
|
15
15
|
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
16
|
+
_ref$loading = _ref.loading,
|
|
17
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
16
18
|
others = _objectWithoutProperties(_ref, _excluded);
|
|
17
19
|
var rest = _objectSpread2({
|
|
18
|
-
size: size
|
|
20
|
+
size: size,
|
|
21
|
+
loading: loading
|
|
19
22
|
}, others);
|
|
20
23
|
return /* @__PURE__ */React.createElement(StyledIconButton, _objectSpread2({
|
|
21
24
|
type: "button",
|
|
@@ -5,7 +5,7 @@ import IconButton from '@mui/material/IconButton';
|
|
|
5
5
|
import { disabledStyles, edgesStyles } from './Button.styled.js';
|
|
6
6
|
import { getObjectProp } from '../utils/helpers/object.js';
|
|
7
7
|
|
|
8
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
8
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
9
9
|
var sizeStyles = function sizeStyles(_ref) {
|
|
10
10
|
var size = _ref.size;
|
|
11
11
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n"])), size === "small" && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 24px;\n "]))), size === "medium" && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: 30px;\n "]))), size === "large" && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: 36px;\n "]))));
|
|
@@ -15,13 +15,19 @@ var hoverStyles = function hoverStyles(_ref2) {
|
|
|
15
15
|
theme = _ref2.theme;
|
|
16
16
|
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n &:hover,\n &:active {\n background-color: var(--IconButton-hoverBg) !important;\n color: ", ";\n }\n"])), getObjectProp(theme, "vars.palette.".concat(color, ".main")));
|
|
17
17
|
};
|
|
18
|
-
var
|
|
18
|
+
var loadingStyles = function loadingStyles(_ref3) {
|
|
19
19
|
var color = _ref3.color,
|
|
20
|
-
disabled = _ref3.disabled,
|
|
21
|
-
edges = _ref3.edges,
|
|
22
|
-
size = _ref3.size,
|
|
23
20
|
theme = _ref3.theme;
|
|
24
|
-
return css(
|
|
21
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n color: ", ";\n .MuiSvgIcon-root {\n display: none;\n }\n"])), getObjectProp(theme, "vars.palette.".concat(color, ".main")));
|
|
22
|
+
};
|
|
23
|
+
var StyledIconButton = styled(IconButton)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref4) {
|
|
24
|
+
var color = _ref4.color,
|
|
25
|
+
disabled = _ref4.disabled,
|
|
26
|
+
loading = _ref4.loading,
|
|
27
|
+
edges = _ref4.edges,
|
|
28
|
+
size = _ref4.size,
|
|
29
|
+
theme = _ref4.theme;
|
|
30
|
+
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n && {\n padding: 4px;\n ", "\n ", "\n ", "\n ", "\n ", "\n }\n "])), disabled && disabledStyles, edgesStyles({
|
|
25
31
|
edges: edges,
|
|
26
32
|
theme: theme
|
|
27
33
|
}), sizeStyles({
|
|
@@ -29,7 +35,10 @@ var StyledIconButton = styled(IconButton)(_templateObject6 || (_templateObject6
|
|
|
29
35
|
}), hoverStyles({
|
|
30
36
|
color: color,
|
|
31
37
|
theme: theme
|
|
38
|
+
}), loading && loadingStyles({
|
|
39
|
+
color: color,
|
|
40
|
+
theme: theme
|
|
32
41
|
}));
|
|
33
42
|
});
|
|
34
43
|
|
|
35
|
-
export { StyledIconButton as default, hoverStyles };
|
|
44
|
+
export { StyledIconButton as default, hoverStyles, loadingStyles };
|
package/dist/esm/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export { default as Divider } from './components/Divider.js';
|
|
|
23
23
|
export { default as DropZone } from './components/DropZone.js';
|
|
24
24
|
export { default as Embed } from './components/Embed.js';
|
|
25
25
|
export { default as FileUpload } from './components/FileUpload.js';
|
|
26
|
+
export { default as FileUploadItem } from './components/FileUploadItem.js';
|
|
26
27
|
export { default as FileUploadButton } from './components/FileUploadButton.js';
|
|
27
28
|
export { default as FileViewer } from './components/FileViewer.js';
|
|
28
29
|
export { default as FlashMessage } from './components/FlashMessage.js';
|
package/dist/esm/theme/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var getFileExtension = function getFileExtension(file) {
|
|
|
31
31
|
};
|
|
32
32
|
var isImage = function isImage(file) {
|
|
33
33
|
var extension = getFileExtension(file);
|
|
34
|
-
var extensions = ["jpg", "jpeg", "png", "gif", "svg"];
|
|
34
|
+
var extensions = ["jpg", "jpeg", "png", "gif", "svg", "webp"];
|
|
35
35
|
return extensions.includes(extension);
|
|
36
36
|
};
|
|
37
37
|
var formatBytes = function formatBytes(bytes) {
|