@symply.io/basic-components 1.3.11-alpha.5 → 1.3.11-alpha.7
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/AlertDialog/index.js +8 -30
- package/Autocomplete/index.js +10 -32
- package/Autocomplete/useInteractions.js +3 -3
- package/AutocompleteWithFilter/index.js +12 -35
- package/BasicModal/Content.js +5 -16
- package/BasicModal/index.js +9 -31
- package/BreadCrumbs/index.js +8 -19
- package/CheckBox/CheckBox.js +4 -26
- package/CheckBox/CheckBoxGroup.js +2 -24
- package/Copyright/index.js +3 -14
- package/DataTable/TableBody.js +2 -24
- package/DataTable/TableBodyRow.js +41 -52
- package/DataTable/TableFooter.js +30 -41
- package/DataTable/TableHeader.js +36 -47
- package/DataTable/index.js +17 -28
- package/DataTable/useTable.js +46 -54
- package/DateInput/FullDateInput/index.js +20 -42
- package/DateInput/FullDateInput/useInteractions.js +10 -10
- package/DateInput/MonthDayInput/index.js +14 -36
- package/DateInput/MonthDayInput/useInteractions.js +9 -9
- package/DateInput/MonthYearInput/index.js +14 -36
- package/DateInput/MonthYearInput/useInteractions.js +9 -9
- package/DigitInput/index.js +6 -28
- package/DigitInput/useInteractions.js +9 -9
- package/DynamicHeaderBar/HeaderBar.js +6 -17
- package/DynamicHeaderBar/HeaderButtons.js +13 -24
- package/DynamicHeaderBar/HeaderLine.js +2 -2
- package/DynamicHeaderBar/index.js +15 -26
- package/FeinInput/index.js +16 -38
- package/FeinInput/useInteractions.js +9 -9
- package/FileUploader/index.js +11 -33
- package/FileUploader/useInteractions.js +29 -44
- package/FormRadioGroup/index.js +4 -29
- package/FormSelector/MultipleSelector.js +9 -32
- package/FormSelector/SimpleSelector.js +9 -32
- package/FormSelector/useInteractions.js +7 -7
- package/HelpCaption/index.js +6 -17
- package/HelpCaption/useInteractions.js +2 -2
- package/LoadingModal/Modal.js +4 -15
- package/LoadingModal/useLoadingModal.js +15 -33
- package/MenuButtonGroup/MenuItem.js +3 -14
- package/MenuButtonGroup/index.js +14 -82
- package/NumberInput/index.js +5 -27
- package/NumberInput/useInteractions.js +17 -17
- package/PasswordInput/ConfirmPassword.js +6 -28
- package/PasswordInput/Password.js +15 -37
- package/PhoneNumberInput/index.js +17 -39
- package/PhoneNumberInput/useInteractions.js +10 -10
- package/Sidebar/SidebarItem.js +6 -17
- package/Sidebar/SidebarItemsGroup.js +10 -21
- package/Sidebar/SidebarLink.js +5 -27
- package/Sidebar/index.js +6 -17
- package/SocialInput/index.js +18 -40
- package/SocialInput/useInteractions.js +14 -14
- package/TabGroup/index.js +14 -25
- package/TablePagination/Actions.js +4 -15
- package/TablePagination/index.js +3 -14
- package/TablePagination/useInteractions.js +9 -9
- package/TextInput/index.js +8 -30
- package/TextInput/useInteractions.js +4 -4
- package/ToastPrompt/Prompt.d.ts +1 -2
- package/ToastPrompt/Prompt.js +20 -30
- package/ToastPrompt/index.d.ts +0 -2
- package/ToastPrompt/index.js +6 -18
- package/ToastPrompt/useInteractions.js +9 -20
- package/VideoPlayerModal/index.js +5 -27
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +1 -1
- package/useCustomTheme.js +11 -16
- package/utils/uuid.js +10 -11
package/FeinInput/index.js
CHANGED
@@ -1,25 +1,3 @@
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
2
|
-
__assign = Object.assign || function(t) {
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
-
s = arguments[i];
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
-
t[p] = s[p];
|
7
|
-
}
|
8
|
-
return t;
|
9
|
-
};
|
10
|
-
return __assign.apply(this, arguments);
|
11
|
-
};
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
-
var t = {};
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
-
t[p] = s[p];
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
-
t[p[i]] = s[p[i]];
|
20
|
-
}
|
21
|
-
return t;
|
22
|
-
};
|
23
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
24
2
|
import { useRifm } from "rifm";
|
25
3
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
@@ -27,49 +5,49 @@ import TextField from "@mui/material/TextField";
|
|
27
5
|
import useInteractions from "./useInteractions";
|
28
6
|
import useCustomTheme from "../useCustomTheme";
|
29
7
|
export function FeinInputFormat(str) {
|
30
|
-
|
31
|
-
|
32
|
-
return chars.reduce(
|
8
|
+
const digits = (str.match(/\d+/g) || []).join("");
|
9
|
+
const chars = digits.split("");
|
10
|
+
return chars.reduce((prev, curr, index) => {
|
33
11
|
if (index === 2) {
|
34
|
-
return
|
12
|
+
return `${prev} - ${curr}`;
|
35
13
|
}
|
36
14
|
else {
|
37
|
-
return
|
15
|
+
return `${prev}${curr}`;
|
38
16
|
}
|
39
|
-
},
|
17
|
+
}, ``);
|
40
18
|
}
|
41
19
|
export function onValidateFein(feinString) {
|
42
|
-
|
20
|
+
const reg = /^\d{2}\s?-\s?\d{7}$/g;
|
43
21
|
return reg.test(feinString);
|
44
22
|
}
|
45
23
|
function FeinInput(props) {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
24
|
+
const { value, error = false, helperText = "Please enter a valid FEIN", onBlur, onFocus, onChange, onValidate, primaryColor, secondaryColor, ...rest } = props;
|
25
|
+
const theme = useCustomTheme({ primaryColor, secondaryColor });
|
26
|
+
const { valLength, addMask } = useInteractions({ value });
|
27
|
+
const rifm = useRifm({
|
50
28
|
mask: true,
|
51
29
|
value: String(value),
|
52
|
-
onChange
|
30
|
+
onChange,
|
53
31
|
replace: addMask,
|
54
32
|
format: FeinInputFormat
|
55
33
|
});
|
56
|
-
return (_jsx(ThemeProvider,
|
34
|
+
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(TextField, { value: rifm.value, onChange: rifm.onChange, error: error ||
|
57
35
|
(valLength > 0 &&
|
58
36
|
(onValidate ? !onValidate(value) : !onValidateFein(value))), helperText: valLength > 0 &&
|
59
37
|
(onValidate ? !onValidate(value) : !onValidateFein(value))
|
60
38
|
? helperText
|
61
|
-
: "", onFocus:
|
39
|
+
: "", onFocus: event => {
|
62
40
|
if (onFocus) {
|
63
41
|
onFocus(event);
|
64
42
|
}
|
65
|
-
}, onBlur:
|
43
|
+
}, onBlur: event => {
|
66
44
|
onChange(value.trim());
|
67
45
|
if (onBlur) {
|
68
46
|
onBlur(event);
|
69
47
|
}
|
70
48
|
}, InputLabelProps: {
|
71
49
|
shrink: true
|
72
|
-
}
|
50
|
+
}, ...rest }) }));
|
73
51
|
}
|
74
52
|
export default FeinInput;
|
75
53
|
export * from "./types";
|
@@ -1,16 +1,16 @@
|
|
1
1
|
import { useCallback, useMemo } from "react";
|
2
2
|
function useInteractions(props) {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
return
|
3
|
+
const { value } = props;
|
4
|
+
const addMask = useCallback((str) => {
|
5
|
+
const digits = (str.match(/\d+/g) || []).join("");
|
6
|
+
const areaCode = digits.slice(0, 2).padEnd(2, "_");
|
7
|
+
const prefixCode = digits.slice(2, 9).padEnd(7, "_");
|
8
|
+
return `${areaCode} - ${prefixCode}`;
|
9
9
|
}, []);
|
10
|
-
|
11
|
-
|
10
|
+
const valLength = useMemo(() => {
|
11
|
+
const digitsArr = String(value).match(/\d/g);
|
12
12
|
return digitsArr ? digitsArr.length : 0;
|
13
13
|
}, [value]);
|
14
|
-
return { valLength
|
14
|
+
return { valLength, addMask };
|
15
15
|
}
|
16
16
|
export default useInteractions;
|
package/FileUploader/index.js
CHANGED
@@ -1,25 +1,3 @@
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
2
|
-
__assign = Object.assign || function(t) {
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
-
s = arguments[i];
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
-
t[p] = s[p];
|
7
|
-
}
|
8
|
-
return t;
|
9
|
-
};
|
10
|
-
return __assign.apply(this, arguments);
|
11
|
-
};
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
-
var t = {};
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
-
t[p] = s[p];
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
-
t[p[i]] = s[p[i]];
|
20
|
-
}
|
21
|
-
return t;
|
22
|
-
};
|
23
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
24
2
|
import Link from "@mui/material/Link";
|
25
3
|
import Grid from "@mui/material/Grid";
|
@@ -32,32 +10,32 @@ import AlertDialog from "../AlertDialog";
|
|
32
10
|
import useInteractions from "./useInteractions";
|
33
11
|
import useCustomTheme from "../useCustomTheme";
|
34
12
|
function FileUploader(props) {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
return (_jsxs(ThemeProvider,
|
13
|
+
const { height = "150px", maxWidth = "430px", loading = false, disabled = false, dropFileText, chooseFileText, primaryColor, secondaryColor, ...rest } = props;
|
14
|
+
const theme = useCustomTheme({ primaryColor, secondaryColor });
|
15
|
+
const lessThanSm = useMediaQuery(theme.breakpoints.down("sm"));
|
16
|
+
const { alertArgs, rootProps, onCloseAlert, onSelectFile, getRootProps, getInputProps } = useInteractions({ ...rest, disabled });
|
17
|
+
return (_jsxs(ThemeProvider, { theme: theme, children: [lessThanSm ? (_jsxs("div", { ...getRootProps(), children: [_jsx("input", { ...getInputProps() }), _jsx(Link, { color: disabled ? theme.palette.grey[400] : theme.palette.primary.main, sx: {
|
40
18
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
41
19
|
cursor: disabled ? "not-allowed" : "pointer"
|
42
|
-
}
|
20
|
+
}, children: loading ? (_jsx(CircularProgress, { sx: { height: "25px", width: "25px" } })) : (chooseFileText || "Choose a file") })] })) : (_jsx(Grid, { container: true, direction: "column", justifyContent: "center", alignItems: "center", sx: {
|
43
21
|
border: "1px dashed #0099a7",
|
44
22
|
borderRadius: "5px",
|
45
23
|
outline: "none",
|
46
24
|
backgroundColor: "#F2F2F2",
|
47
|
-
maxWidth
|
48
|
-
height
|
25
|
+
maxWidth,
|
26
|
+
height,
|
49
27
|
width: "100%"
|
50
|
-
}
|
28
|
+
}, ...rootProps, children: loading ? (_jsx(CircularProgress, { style: { height: "30px", width: "30px" } })) : (_jsxs("div", { children: [_jsx("input", { ...getInputProps() }), _jsx(Typography, { component: "p", variant: "caption", sx: {
|
51
29
|
fontSize: ".875rem",
|
52
30
|
textAlign: "center"
|
53
|
-
}
|
31
|
+
}, children: dropFileText || "Drop files here" }), _jsx(Button, { variant: "contained", onClick: onSelectFile, sx: {
|
54
32
|
backgroundColor: "white !important",
|
55
33
|
color: disabled
|
56
34
|
? theme.palette.grey[400]
|
57
35
|
: theme.palette.primary.main,
|
58
36
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
59
37
|
cursor: disabled ? "not-allowed" : "pointer"
|
60
|
-
}, disabled: disabled
|
38
|
+
}, disabled: disabled, children: _jsx(Typography, { children: chooseFileText || "Choose a file" }) })] })) })), _jsx(AlertDialog, { open: alertArgs.open, primaryColor: primaryColor, secondaryColor: secondaryColor, onClose: onCloseAlert, children: alertArgs.message })] }));
|
61
39
|
}
|
62
40
|
export default FileUploader;
|
63
41
|
export * from "./types";
|
@@ -1,37 +1,22 @@
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
2
|
-
__assign = Object.assign || function(t) {
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
-
s = arguments[i];
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
-
t[p] = s[p];
|
7
|
-
}
|
8
|
-
return t;
|
9
|
-
};
|
10
|
-
return __assign.apply(this, arguments);
|
11
|
-
};
|
12
1
|
import { useState, useCallback, useMemo } from "react";
|
13
2
|
import { useDropzone } from "react-dropzone";
|
14
3
|
function useInteractions(props) {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
}, [sizeExceededErrorText, maxSize]);
|
24
|
-
var _d = useState({ open: false, message: "" }), alertArgs = _d[0], setAlertArgs = _d[1];
|
25
|
-
var onOpenAlert = useCallback(function (message) {
|
26
|
-
setAlertArgs(function (args) { return (__assign(__assign({}, args), { open: true, message: message })); });
|
4
|
+
const { multiple = false, disabled = false, maxFiles, maxSize = 1024 * 1024 * 5, accept, onUpload, sizeExceededErrorText, wrongFileTypeErrorText } = props;
|
5
|
+
const ERROR_TYPE_MSG = useMemo(() => wrongFileTypeErrorText ||
|
6
|
+
"The type of the file you uploaded is not accepted, please reupload!", [wrongFileTypeErrorText]);
|
7
|
+
const ERROR_SIZE_MSG = useMemo(() => sizeExceededErrorText ||
|
8
|
+
`Your file exceed the max size of ${maxSize / 1024 / 1024}MB.`, [sizeExceededErrorText, maxSize]);
|
9
|
+
const [alertArgs, setAlertArgs] = useState({ open: false, message: "" });
|
10
|
+
const onOpenAlert = useCallback((message) => {
|
11
|
+
setAlertArgs(args => ({ ...args, open: true, message }));
|
27
12
|
}, []);
|
28
|
-
|
13
|
+
const onCloseAlert = useCallback(() => {
|
29
14
|
setAlertArgs({ open: false, message: "" });
|
30
15
|
}, []);
|
31
|
-
|
16
|
+
const onDrop = useCallback((acceptedFiles, rejectedFiles) => {
|
32
17
|
if (rejectedFiles && rejectedFiles.length > 0) {
|
33
|
-
rejectedFiles.some(
|
34
|
-
|
18
|
+
rejectedFiles.some((rejectedFile) => {
|
19
|
+
const { file, errors } = rejectedFile;
|
35
20
|
if (accept && !Object.keys(accept).includes(file.type)) {
|
36
21
|
onOpenAlert(ERROR_TYPE_MSG);
|
37
22
|
return true;
|
@@ -51,29 +36,29 @@ function useInteractions(props) {
|
|
51
36
|
onUpload(acceptedFiles);
|
52
37
|
}
|
53
38
|
}, [accept, onUpload]);
|
54
|
-
|
55
|
-
onDrop
|
56
|
-
accept
|
57
|
-
multiple
|
58
|
-
disabled
|
59
|
-
maxSize
|
60
|
-
maxFiles
|
61
|
-
})
|
62
|
-
|
63
|
-
onClick:
|
64
|
-
onKeyDown:
|
39
|
+
const { getRootProps, getInputProps, open: onSelectFile } = useDropzone({
|
40
|
+
onDrop,
|
41
|
+
accept,
|
42
|
+
multiple,
|
43
|
+
disabled,
|
44
|
+
maxSize,
|
45
|
+
maxFiles
|
46
|
+
});
|
47
|
+
const rootProps = getRootProps({
|
48
|
+
onClick: e => e.stopPropagation(),
|
49
|
+
onKeyDown: e => {
|
65
50
|
if (e.key === "Space" || e.key === "Enter") {
|
66
51
|
e.stopPropagation();
|
67
52
|
}
|
68
53
|
}
|
69
54
|
});
|
70
55
|
return {
|
71
|
-
alertArgs
|
72
|
-
rootProps
|
73
|
-
onCloseAlert
|
74
|
-
onSelectFile
|
75
|
-
getRootProps
|
76
|
-
getInputProps
|
56
|
+
alertArgs,
|
57
|
+
rootProps,
|
58
|
+
onCloseAlert,
|
59
|
+
onSelectFile,
|
60
|
+
getRootProps,
|
61
|
+
getInputProps
|
77
62
|
};
|
78
63
|
}
|
79
64
|
export default useInteractions;
|
package/FormRadioGroup/index.js
CHANGED
@@ -1,25 +1,3 @@
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
2
|
-
__assign = Object.assign || function(t) {
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
-
s = arguments[i];
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
-
t[p] = s[p];
|
7
|
-
}
|
8
|
-
return t;
|
9
|
-
};
|
10
|
-
return __assign.apply(this, arguments);
|
11
|
-
};
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
-
var t = {};
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
-
t[p] = s[p];
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
-
t[p[i]] = s[p[i]];
|
20
|
-
}
|
21
|
-
return t;
|
22
|
-
};
|
23
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
24
2
|
import Radio from "@mui/material/Radio";
|
25
3
|
import Tooltip from "@mui/material/Tooltip";
|
@@ -31,14 +9,11 @@ import FormControlLabel from "@mui/material/FormControlLabel";
|
|
31
9
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
32
10
|
import useCustomTheme from "../useCustomTheme";
|
33
11
|
function FormRadioGroup(props) {
|
34
|
-
|
35
|
-
|
36
|
-
return (_jsx(ThemeProvider,
|
12
|
+
const { formLabel, value, options, disabled, tooltip, primaryColor, secondaryColor, radioLabelPlacement, onChange, ...rest } = props;
|
13
|
+
const theme = useCustomTheme({ primaryColor, secondaryColor });
|
14
|
+
return (_jsx(ThemeProvider, { theme: theme, children: _jsxs(FormControl, { disabled: disabled, ...rest, children: [tooltip ? (_jsx(Tooltip, { arrow: true, placement: "top", title: tooltip, disableTouchListener: true, children: _jsx(FormLabel, { children: formLabel }) })) : (_jsx(FormLabel, { children: formLabel })), _jsx(RadioGroup, { value: value, onChange: event => {
|
37
15
|
onChange(event.target.value);
|
38
|
-
} }, { children:
|
39
|
-
var _a;
|
40
|
-
return (_jsx(FormControlLabel, { value: opt.value, control: _jsx(Radio, {}), label: _jsx(Typography, { children: opt.label }), labelPlacement: radioLabelPlacement || "end", disabled: ((_a = opt.disabled) !== null && _a !== void 0 ? _a : false) || disabled }, String(opt.value)));
|
41
|
-
}) }))] })) })));
|
16
|
+
}, children: options.map(opt => (_jsx(FormControlLabel, { value: opt.value, control: _jsx(Radio, {}), label: _jsx(Typography, { children: opt.label }), labelPlacement: radioLabelPlacement || "end", disabled: (opt.disabled ?? false) || disabled }, String(opt.value)))) })] }) }));
|
42
17
|
}
|
43
18
|
export default FormRadioGroup;
|
44
19
|
export * from "./types";
|
@@ -1,25 +1,3 @@
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
2
|
-
__assign = Object.assign || function(t) {
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
-
s = arguments[i];
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
-
t[p] = s[p];
|
7
|
-
}
|
8
|
-
return t;
|
9
|
-
};
|
10
|
-
return __assign.apply(this, arguments);
|
11
|
-
};
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
-
var t = {};
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
-
t[p] = s[p];
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
-
t[p[i]] = s[p[i]];
|
20
|
-
}
|
21
|
-
return t;
|
22
|
-
};
|
23
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
24
2
|
import Select from "@mui/material/Select";
|
25
3
|
import Tooltip from "@mui/material/Tooltip";
|
@@ -31,19 +9,18 @@ import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
|
31
9
|
import useInteractions from "./useInteractions";
|
32
10
|
import useCustomTheme from "../useCustomTheme";
|
33
11
|
function MultipleSelector(props) {
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
return (_jsx(ThemeProvider,
|
38
|
-
var _a;
|
12
|
+
const { label, variant = "outlined", value, tooltip, required = false, disabled = false, multiple = false, showHelperText = false, helperText, options = [], primaryColor, secondaryColor, onChange, ...rest } = props;
|
13
|
+
const theme = useCustomTheme({ primaryColor, secondaryColor });
|
14
|
+
const { tooltipOpen, onOpenTooltip, onCloseTooltip } = useInteractions();
|
15
|
+
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(Tooltip, { arrow: true, placement: "top", title: tooltip ?? "", open: !!tooltip && tooltipOpen, children: _jsxs(FormControl, { variant: variant, disabled: disabled, required: required, ...rest, children: [label && (_jsx(InputLabel, { id: "symply-multiple-select", children: label })), _jsx(Select, { disabled: disabled, required: required, value: value, multiple: true, onChange: event => {
|
39
16
|
event.preventDefault();
|
40
|
-
onChange(
|
17
|
+
onChange(event?.target?.value);
|
41
18
|
}, inputProps: {
|
42
19
|
onFocus: onOpenTooltip,
|
43
20
|
onBlur: onCloseTooltip
|
44
|
-
}, label: label, renderValue: multiple ?
|
45
|
-
|
46
|
-
return (_jsx(MenuItem,
|
47
|
-
})) : (_jsx(MenuItem,
|
21
|
+
}, label: label, renderValue: multiple ? selected => selected.join("; ") : undefined, children: options?.length > 0 ? (options.map(option => {
|
22
|
+
const { label, value } = option;
|
23
|
+
return (_jsx(MenuItem, { value: value, children: label }, value));
|
24
|
+
})) : (_jsx(MenuItem, { value: "", disabled: true, children: "No Options" })) }), !!helperText && showHelperText && (_jsx(FormHelperText, { children: showHelperText }))] }) }) }));
|
48
25
|
}
|
49
26
|
export default MultipleSelector;
|
@@ -1,25 +1,3 @@
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
2
|
-
__assign = Object.assign || function(t) {
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
-
s = arguments[i];
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
-
t[p] = s[p];
|
7
|
-
}
|
8
|
-
return t;
|
9
|
-
};
|
10
|
-
return __assign.apply(this, arguments);
|
11
|
-
};
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
-
var t = {};
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
-
t[p] = s[p];
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
-
t[p[i]] = s[p[i]];
|
20
|
-
}
|
21
|
-
return t;
|
22
|
-
};
|
23
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
24
2
|
import Select from "@mui/material/Select";
|
25
3
|
import Tooltip from "@mui/material/Tooltip";
|
@@ -31,19 +9,18 @@ import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
|
31
9
|
import useInteractions from "./useInteractions";
|
32
10
|
import useCustomTheme from "../useCustomTheme";
|
33
11
|
function SimpleSelector(props) {
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
return (_jsx(ThemeProvider,
|
38
|
-
var _a;
|
12
|
+
const { label, variant = "outlined", value, tooltip, disabled = false, required = false, showHelperText = false, helperText, options = [], primaryColor, secondaryColor, onChange, ...rest } = props;
|
13
|
+
const theme = useCustomTheme({ primaryColor, secondaryColor });
|
14
|
+
const { tooltipOpen, onOpenTooltip, onCloseTooltip } = useInteractions();
|
15
|
+
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(Tooltip, { arrow: true, placement: "top", title: tooltip ?? "", open: !!tooltip && tooltipOpen, children: _jsxs(FormControl, { variant: variant, disabled: disabled, required: required, ...rest, children: [label && (_jsx(InputLabel, { id: "symply-simple-selector", children: label })), _jsx(Select, { value: value, required: required, disabled: disabled, onChange: event => {
|
39
16
|
event.preventDefault();
|
40
|
-
onChange(
|
17
|
+
onChange(event?.target?.value);
|
41
18
|
}, inputProps: {
|
42
19
|
onFocus: onOpenTooltip,
|
43
20
|
onBlur: onCloseTooltip
|
44
|
-
}, label: label
|
45
|
-
|
46
|
-
return (_jsx(MenuItem,
|
47
|
-
})) : (_jsx(MenuItem,
|
21
|
+
}, label: label, children: options?.length > 0 ? (options.map(option => {
|
22
|
+
const { label, value, disabled } = option;
|
23
|
+
return (_jsx(MenuItem, { value: value, disabled: disabled, children: label }, value));
|
24
|
+
})) : (_jsx(MenuItem, { value: "", disabled: true, children: "No Options" })) }), !!helperText && showHelperText && (_jsx(FormHelperText, { children: showHelperText }))] }) }) }));
|
48
25
|
}
|
49
26
|
export default SimpleSelector;
|
@@ -1,20 +1,20 @@
|
|
1
1
|
import { useState, useEffect, useCallback } from "react";
|
2
2
|
function useInteractions() {
|
3
|
-
|
4
|
-
|
3
|
+
const [tooltipOpen, setTooltipOpen] = useState(false);
|
4
|
+
const onOpenTooltip = useCallback(() => {
|
5
5
|
setTooltipOpen(true);
|
6
6
|
}, []);
|
7
|
-
|
7
|
+
const onCloseTooltip = useCallback(() => {
|
8
8
|
setTooltipOpen(false);
|
9
9
|
}, []);
|
10
|
-
useEffect(
|
10
|
+
useEffect(() => {
|
11
11
|
window.addEventListener("scroll", onCloseTooltip);
|
12
12
|
window.addEventListener("resize", onCloseTooltip);
|
13
13
|
}, [onCloseTooltip]);
|
14
|
-
useEffect(
|
14
|
+
useEffect(() => () => {
|
15
15
|
window.removeEventListener("resize", onCloseTooltip);
|
16
16
|
window.removeEventListener("scroll", onCloseTooltip);
|
17
|
-
}
|
18
|
-
return { tooltipOpen
|
17
|
+
}, [onCloseTooltip]);
|
18
|
+
return { tooltipOpen, onOpenTooltip, onCloseTooltip };
|
19
19
|
}
|
20
20
|
export default useInteractions;
|
package/HelpCaption/index.js
CHANGED
@@ -1,14 +1,3 @@
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
2
|
-
__assign = Object.assign || function(t) {
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
-
s = arguments[i];
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
-
t[p] = s[p];
|
7
|
-
}
|
8
|
-
return t;
|
9
|
-
};
|
10
|
-
return __assign.apply(this, arguments);
|
11
|
-
};
|
12
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
13
2
|
import Grid from "@mui/material/Grid";
|
14
3
|
import Typography from "@mui/material/Typography";
|
@@ -17,11 +6,11 @@ import VideoPlayerModal from "../VideoPlayerModal";
|
|
17
6
|
import useInteractions from "./useInteractions";
|
18
7
|
import useCustomTheme from "../useCustomTheme";
|
19
8
|
function HelpCaption(props) {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
return (_jsx(ThemeProvider,
|
24
|
-
?
|
9
|
+
const { mainCaption, subCaption, linkUrl, linkText = "Watch Demo", linkType = "WEBPAGE", primaryColor, secondaryColor } = props;
|
10
|
+
const theme = useCustomTheme({ primaryColor, secondaryColor });
|
11
|
+
const { videoModalOpen, onOpenVideoModal, onCloseVideoModal } = useInteractions();
|
12
|
+
return (_jsx(ThemeProvider, { theme: theme, children: _jsxs(Grid, { container: true, spacing: 1, direction: subCaption ? "column" : "row", children: [_jsx(Grid, { item: true, children: _jsx(Typography, { align: "left", component: "span", children: mainCaption }) }), _jsxs(Grid, { item: true, children: [subCaption && (_jsxs(_Fragment, { children: [_jsx(Typography, { align: "left", component: "span", children: subCaption }), "\u00A0"] })), linkUrl && (_jsx(Typography, { onClick: linkType === "WEBPAGE"
|
13
|
+
? () => {
|
25
14
|
window.open(linkUrl);
|
26
15
|
}
|
27
16
|
: onOpenVideoModal, align: "left", color: "primary", component: "span", sx: {
|
@@ -30,6 +19,6 @@ function HelpCaption(props) {
|
|
30
19
|
color: theme.palette.primary.dark,
|
31
20
|
textDecoration: "underline"
|
32
21
|
}
|
33
|
-
}
|
22
|
+
}, children: _jsx("b", { children: linkText }) }))] }), linkUrl && (_jsx(VideoPlayerModal, { open: videoModalOpen, url: linkUrl, onClose: onCloseVideoModal }))] }) }));
|
34
23
|
}
|
35
24
|
export default HelpCaption;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { useState } from 'react';
|
2
2
|
function useInteractions() {
|
3
|
-
|
3
|
+
const [videoModalOpen, setVideoModalOpen] = useState(false);
|
4
4
|
function onOpenVideoModal() {
|
5
5
|
setVideoModalOpen(true);
|
6
6
|
}
|
7
7
|
function onCloseVideoModal() {
|
8
8
|
setVideoModalOpen(false);
|
9
9
|
}
|
10
|
-
return { videoModalOpen
|
10
|
+
return { videoModalOpen, onOpenVideoModal, onCloseVideoModal };
|
11
11
|
}
|
12
12
|
export default useInteractions;
|
package/LoadingModal/Modal.js
CHANGED
@@ -1,14 +1,3 @@
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
2
|
-
__assign = Object.assign || function(t) {
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
-
s = arguments[i];
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
-
t[p] = s[p];
|
7
|
-
}
|
8
|
-
return t;
|
9
|
-
};
|
10
|
-
return __assign.apply(this, arguments);
|
11
|
-
};
|
12
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
13
2
|
import Box from "@mui/material/Box";
|
14
3
|
import Grid from "@mui/material/Grid";
|
@@ -19,11 +8,11 @@ import CircularProgress from "@mui/material/CircularProgress";
|
|
19
8
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
20
9
|
import useCustomTheme from "../useCustomTheme";
|
21
10
|
function LoadingModal(props) {
|
22
|
-
|
23
|
-
|
24
|
-
return (_jsx(ThemeProvider,
|
11
|
+
const { open, text = "Loading...", direction = "column", showProgess = false, percent = 0, primaryColor, secondaryColor } = props;
|
12
|
+
const theme = useCustomTheme({ primaryColor, secondaryColor });
|
13
|
+
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(Dialog, { maxWidth: "xs", open: open, sx: { backgroundColor: "#7A7A7A97" }, PaperProps: { sx: { backgroundColor: "#F2F2F2CF" } }, onClose: (_, reason) => {
|
25
14
|
if (reason === "backdropClick")
|
26
15
|
return;
|
27
|
-
}, disableScrollLock: true, disableAutoFocus: true, disableEnforceFocus: true, disableEscapeKeyDown: true
|
16
|
+
}, disableScrollLock: true, disableAutoFocus: true, disableEnforceFocus: true, disableEscapeKeyDown: true, children: _jsx(DialogContent, { children: _jsxs(Grid, { container: true, direction: direction, justifyContent: "space-between", alignItems: "center", "data-testid": "loading-grid", children: [_jsxs(Box, { position: "relative", display: "inline-flex", sx: { mt: 1.25 }, children: [_jsx(CircularProgress, { size: showProgess ? 56 : 40, value: percent, variant: showProgess ? "determinate" : "indeterminate" }), showProgess && percent >= 0 && (_jsx(Box, { top: 0, left: 0, bottom: 0, right: 0, position: "absolute", display: "flex", alignItems: "center", justifyContent: "center", children: _jsxs(Typography, { variant: "caption", children: [Math.round(percent), "%"] }) }))] }), _jsx(Typography, { component: "span", sx: { mt: 1, fontSize: 16, fontWeight: 400 }, children: text })] }) }) }) }));
|
28
17
|
}
|
29
18
|
export default LoadingModal;
|