@symply.io/basic-components 1.3.11-alpha.5 → 1.3.11-alpha.6
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 -1
- package/ToastPrompt/Prompt.js +20 -29
- package/ToastPrompt/index.d.ts +1 -1
- package/ToastPrompt/index.js +6 -17
- package/ToastPrompt/useInteractions.js +9 -20
- package/VideoPlayerModal/index.js +5 -27
- package/package.json +1 -1
- package/useCustomTheme.js +11 -16
- package/utils/uuid.js +10 -11
package/ToastPrompt/Prompt.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 { useMemo } from "react";
|
14
3
|
import Slide from "@mui/material/Slide";
|
@@ -22,14 +11,13 @@ import WarningIcon from "@mui/icons-material/Warning";
|
|
22
11
|
import SuccessIcon from "@mui/icons-material/CheckCircle";
|
23
12
|
import { green, amber, red, blue } from "@mui/material/colors";
|
24
13
|
import useCustomTheme from "../useCustomTheme";
|
25
|
-
|
26
|
-
return _jsx(Slide,
|
14
|
+
const Transition = (args) => {
|
15
|
+
return _jsx(Slide, { ...args, direction: "up" });
|
27
16
|
};
|
28
|
-
function Prompt(props) {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
var styles = useMemo(function () { return ({
|
17
|
+
export function Prompt(props) {
|
18
|
+
const { open, icon, variant, message, timeout, onClose } = props;
|
19
|
+
const theme = useCustomTheme();
|
20
|
+
const styles = useMemo(() => ({
|
33
21
|
success: {
|
34
22
|
backgroundColor: green[500]
|
35
23
|
},
|
@@ -42,31 +30,34 @@ function Prompt(props) {
|
|
42
30
|
warning: {
|
43
31
|
backgroundColor: amber["A700"]
|
44
32
|
}
|
45
|
-
})
|
46
|
-
|
33
|
+
}), []);
|
34
|
+
const VariantIcon = useMemo(() => ({
|
47
35
|
success: SuccessIcon,
|
48
36
|
warning: WarningIcon,
|
49
37
|
error: ErrorIcon,
|
50
38
|
info: InfoIcon
|
51
|
-
})
|
52
|
-
|
53
|
-
return (_jsx(ThemeProvider,
|
39
|
+
}), []);
|
40
|
+
const Icon = useMemo(() => VariantIcon[variant], []);
|
41
|
+
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(Snackbar, { anchorOrigin: { vertical: "bottom", horizontal: "left" }, open: open, onClose: onClose, autoHideDuration: timeout, TransitionComponent: Transition, sx: {
|
54
42
|
zIndex: 99999,
|
55
43
|
marginTop: "3vh"
|
56
|
-
}
|
57
|
-
|
44
|
+
}, children: _jsx(SnackbarContent, { sx: {
|
45
|
+
...styles[variant],
|
46
|
+
root: {
|
47
|
+
[theme.breakpoints.down("sm")]: {
|
58
48
|
maxWidth: "320px",
|
59
49
|
borderRadius: "4px"
|
60
|
-
}
|
61
|
-
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}, "aria-describedby": "Toast", message: _jsxs(Typography, { id: "Toast", component: "span", sx: {
|
62
53
|
fontSize: 14,
|
63
54
|
fontWeight: 700,
|
64
55
|
display: "flex",
|
65
56
|
alignItems: "center"
|
66
|
-
}
|
57
|
+
}, children: [!icon ? (_jsx(Icon, { sx: {
|
67
58
|
fontSize: 20,
|
68
59
|
opacity: 0.9,
|
69
60
|
marginRight: theme.spacing(1)
|
70
|
-
} })) : (_jsx(_Fragment, { children: icon })), message] })
|
61
|
+
} })) : (_jsx(_Fragment, { children: icon })), message] }) }) }, `${Date.now() * Math.round(Math.random())}`) }));
|
71
62
|
}
|
72
63
|
export default Prompt;
|
package/ToastPrompt/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import Prompt from "./Prompt";
|
1
|
+
import { Prompt } from "./Prompt";
|
2
2
|
import { PromptProviderProps, PromptContextProps } from "./types";
|
3
3
|
export declare function PromptProvider(props: PromptProviderProps): JSX.Element;
|
4
4
|
export declare function usePrompt(): PromptContextProps;
|
package/ToastPrompt/index.js
CHANGED
@@ -1,25 +1,14 @@
|
|
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 { createContext, useContext } from "react";
|
14
|
-
import Prompt from "./Prompt";
|
3
|
+
import { Prompt } from "./Prompt";
|
15
4
|
import useInteractions from "./useInteractions";
|
16
|
-
|
17
|
-
showPrompt:
|
5
|
+
const PromptContext = createContext({
|
6
|
+
showPrompt: () => { }
|
18
7
|
});
|
19
8
|
export function PromptProvider(props) {
|
20
|
-
|
21
|
-
|
22
|
-
return (_jsx(PromptContext.Provider,
|
9
|
+
const { children } = props;
|
10
|
+
const { promptArgs, onShow, onHide } = useInteractions();
|
11
|
+
return (_jsx(PromptContext.Provider, { value: { showPrompt: onShow }, children: _jsxs(_Fragment, { children: [children, _jsx(Prompt, { ...promptArgs, onClose: onHide })] }) }));
|
23
12
|
}
|
24
13
|
export function usePrompt() {
|
25
14
|
return useContext(PromptContext);
|
@@ -1,33 +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 } from "react";
|
13
2
|
function useInteractions() {
|
14
|
-
|
15
|
-
|
3
|
+
const ERROR_MESSAGE = "Internal Server Error";
|
4
|
+
const [promptArgs, setPromptArgs] = useState({
|
16
5
|
open: false,
|
17
6
|
message: "Saved",
|
18
7
|
variant: "success",
|
19
8
|
timeout: 3500
|
20
|
-
})
|
21
|
-
|
9
|
+
});
|
10
|
+
const onHide = useCallback((_, reason) => {
|
22
11
|
if (reason === "clickaway") {
|
23
12
|
return;
|
24
13
|
}
|
25
|
-
setPromptArgs(
|
14
|
+
setPromptArgs(args => ({ ...args, open: false }));
|
26
15
|
}, []);
|
27
|
-
|
28
|
-
|
29
|
-
setPromptArgs({ open: true, message
|
16
|
+
const onShow = useCallback(args => {
|
17
|
+
const { message = "Unknown message", variant = "info", timeout = 3500 } = args;
|
18
|
+
setPromptArgs({ open: true, message, variant, timeout });
|
30
19
|
}, []);
|
31
|
-
return { promptArgs
|
20
|
+
return { promptArgs, onShow, onHide };
|
32
21
|
}
|
33
22
|
export default useInteractions;
|
@@ -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 ReactPlayer from "react-player";
|
25
3
|
import Grid from "@mui/material/Grid";
|
@@ -32,12 +10,12 @@ import useMediaQuery from "@mui/material/useMediaQuery";
|
|
32
10
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
33
11
|
import useCustomTheme from "../useCustomTheme";
|
34
12
|
function VideoPlayerModal(props) {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
return (_jsx(ThemeProvider,
|
13
|
+
const { url, pip = false, open = false, title, onClose, extraButtons = [], primaryColor, secondaryColor, ...playerProps } = props;
|
14
|
+
const theme = useCustomTheme({ primaryColor, secondaryColor });
|
15
|
+
const fullScreen = useMediaQuery(theme.breakpoints.down("sm"));
|
16
|
+
return (_jsx(ThemeProvider, { theme: theme, children: _jsxs(Dialog, { open: open, fullScreen: fullScreen, onClose: onClose, fullWidth: true, maxWidth: "lg", "aria-labelledby": "react-video-dialog", children: [title && _jsx(DialogTitle, { children: title }), _jsx(DialogContent, { children: _jsx(ReactPlayer, { controls: true, url: url, style: { minHeight: "480px" }, width: "100%", config: {
|
39
17
|
file: { attributes: { disablePictureInPicture: !pip } }
|
40
|
-
}
|
18
|
+
}, ...playerProps }) }), _jsx(DialogActions, { children: _jsxs(Grid, { container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", spacing: 1, children: [extraButtons.map((buttonProps, index) => (_jsx(Grid, { item: true, xs: 12, md: 3, lg: 2, children: _jsx(Button, { ...buttonProps }) }, `extraButton_${index}`))), _jsx(Grid, { item: true, xs: 12, md: 2, lg: 1, children: _jsx(Button, { variant: "outlined", fullWidth: true, color: "secondary", onClick: onClose, children: "Close" }) })] }) })] }) }));
|
41
19
|
}
|
42
20
|
export default VideoPlayerModal;
|
43
21
|
export * from "./types";
|
package/package.json
CHANGED
package/useCustomTheme.js
CHANGED
@@ -1,18 +1,7 @@
|
|
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 { createTheme } from "@mui/material/styles";
|
13
2
|
function useCustomTheme(props) {
|
14
|
-
|
15
|
-
|
3
|
+
const { primaryColor, secondaryColor } = props || {};
|
4
|
+
const themeOptions = {
|
16
5
|
components: {
|
17
6
|
MuiButton: {
|
18
7
|
styleOverrides: {
|
@@ -34,13 +23,19 @@ function useCustomTheme(props) {
|
|
34
23
|
};
|
35
24
|
if (!!primaryColor || !!secondaryColor) {
|
36
25
|
if (!!primaryColor) {
|
37
|
-
themeOptions.palette =
|
26
|
+
themeOptions.palette = {
|
27
|
+
...themeOptions.palette,
|
28
|
+
primary: { main: primaryColor }
|
29
|
+
};
|
38
30
|
}
|
39
31
|
if (!!secondaryColor) {
|
40
|
-
themeOptions.palette =
|
32
|
+
themeOptions.palette = {
|
33
|
+
...themeOptions.palette,
|
34
|
+
secondary: { main: secondaryColor }
|
35
|
+
};
|
41
36
|
}
|
42
37
|
}
|
43
|
-
|
38
|
+
const theme = createTheme(themeOptions);
|
44
39
|
return theme;
|
45
40
|
}
|
46
41
|
export default useCustomTheme;
|
package/utils/uuid.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
function generateUUID(length) {
|
2
|
-
if (length === void 0) { length = 32; }
|
1
|
+
function generateUUID(length = 32) {
|
3
2
|
if (length < 16)
|
4
3
|
throw new Error("Length should be equal or greater than 16");
|
5
4
|
function UUID() {
|
@@ -24,28 +23,28 @@ function generateUUID(length) {
|
|
24
23
|
this.rand = "";
|
25
24
|
}
|
26
25
|
UUID.prototype = {
|
27
|
-
getRandomUInt
|
28
|
-
|
29
|
-
this.chars.sort(
|
26
|
+
getRandomUInt() {
|
27
|
+
let s = "";
|
28
|
+
this.chars.sort(() => {
|
30
29
|
return Date.now() % (Math.random() * length * 23) >
|
31
30
|
Math.random() * 7 * length
|
32
31
|
? -1
|
33
32
|
: 1;
|
34
33
|
});
|
35
|
-
for (
|
34
|
+
for (let i = 0; i < this.chars.length; i += 1) {
|
36
35
|
s = s.concat(this.chars[i]);
|
37
36
|
}
|
38
37
|
return s;
|
39
38
|
},
|
40
|
-
getRandomChars
|
39
|
+
getRandomChars() {
|
41
40
|
this.rand = Date.now().toString(16).concat(this.getRandomUInt());
|
42
41
|
return this.rand;
|
43
42
|
},
|
44
|
-
generate
|
45
|
-
|
46
|
-
|
43
|
+
generate() {
|
44
|
+
let id = Date.now().toString();
|
45
|
+
const idLen = id.length;
|
47
46
|
this.getRandomChars();
|
48
|
-
for (
|
47
|
+
for (let i = 0; i < length - idLen; i += 1) {
|
49
48
|
id = id.concat(this.rand.charAt(Math.floor(Math.random() * this.rand.length)));
|
50
49
|
}
|
51
50
|
return id.toString();
|