@symply.io/basic-components 1.0.0-alpha.1 → 1.0.0-alpha.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/AlertDialog/index.js +9 -8
- package/AlertDialog/types.d.ts +3 -1
- package/BasicModal/index.js +18 -17
- package/BasicModal/types.d.ts +3 -1
- package/DigitInput/index.js +8 -4
- package/DigitInput/types.d.ts +3 -0
- package/DynamicHeaderBar/HeaderBar.d.ts +2 -0
- package/DynamicHeaderBar/HeaderBar.js +7 -6
- package/DynamicHeaderBar/HeaderButtons.js +20 -19
- package/DynamicHeaderBar/HeaderLine.js +3 -3
- package/FormRadioGroup/index.js +15 -12
- package/FormRadioGroup/types.d.ts +3 -0
- package/FormSelector/MultipleSelector.d.ts +2 -1
- package/FormSelector/MultipleSelector.js +25 -11
- package/FormSelector/SimpleSelector.d.ts +2 -1
- package/FormSelector/SimpleSelector.js +25 -11
- package/FormSelector/types.d.ts +5 -7
- package/HelpCaption/index.d.ts +3 -1
- package/HelpCaption/index.js +15 -14
- package/LoadingModal/index.js +8 -5
- package/LoadingModal/types.d.ts +3 -0
- package/MenuButtonGroup/MenuItem.d.ts +1 -2
- package/MenuButtonGroup/MenuItem.js +5 -3
- package/MenuButtonGroup/index.d.ts +3 -1
- package/MenuButtonGroup/index.js +9 -6
- package/NumberInput/index.d.ts +3 -1
- package/NumberInput/index.js +8 -5
- package/PasswordInput/ConfirmPassword.d.ts +3 -1
- package/PasswordInput/ConfirmPassword.js +10 -7
- package/PasswordInput/Password.d.ts +2 -0
- package/PasswordInput/Password.js +17 -9
- package/PhoneNumberInput/index.d.ts +4 -1
- package/PhoneNumberInput/index.js +25 -7
- package/PhoneNumberInput/useInteractions.d.ts +0 -1
- package/PhoneNumberInput/useInteractions.js +1 -14
- package/README.md +45 -46
- package/TabGroup/index.js +19 -18
- package/TabGroup/types.d.ts +3 -0
- package/TextInput/index.d.ts +3 -1
- package/TextInput/index.js +8 -5
- package/ToastPrompt/Presentation.js +26 -25
- package/VideoPlayerModal/index.js +8 -7
- package/VideoPlayerModal/types.d.ts +3 -0
- package/package.json +2 -1
- package/useCustomTheme.d.ts +6 -0
- package/useCustomTheme.js +51 -0
package/TabGroup/types.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { CSSProperties } from "react";
|
1
2
|
import { TabsProps } from "@mui/material/Tabs";
|
2
3
|
export interface TabGroupProps {
|
3
4
|
textColor?: TabsProps["textColor"];
|
@@ -7,5 +8,7 @@ export interface TabGroupProps {
|
|
7
8
|
}>;
|
8
9
|
variant?: TabsProps["variant"];
|
9
10
|
currentTabIndex?: number;
|
11
|
+
primaryColor?: CSSProperties["color"];
|
12
|
+
secondaryColor?: CSSProperties["color"];
|
10
13
|
onTabChange: (index: number) => void;
|
11
14
|
}
|
package/TextInput/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
import { CSSProperties } from "react";
|
2
2
|
import { TextFieldProps } from "@mui/material/TextField";
|
3
3
|
declare type TextProps = Omit<TextFieldProps, "onChange">;
|
4
4
|
export interface TextInputProps {
|
@@ -7,6 +7,8 @@ export interface TextInputProps {
|
|
7
7
|
tooltip?: TextFieldProps;
|
8
8
|
maxLength?: number;
|
9
9
|
minLength?: number;
|
10
|
+
primaryColor?: CSSProperties["color"];
|
11
|
+
secondaryColor?: CSSProperties["color"];
|
10
12
|
}
|
11
13
|
declare const TextInput: (props: TextInputProps & TextProps) => JSX.Element;
|
12
14
|
export default TextInput;
|
package/TextInput/index.js
CHANGED
@@ -23,13 +23,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
24
24
|
import Tooltip from "@mui/material/Tooltip";
|
25
25
|
import Field from "@mui/material/TextField";
|
26
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
26
27
|
import useInteractions from "./useInteractions";
|
28
|
+
import useCustomTheme from "../useCustomTheme";
|
27
29
|
var TextInput = function (props) {
|
28
|
-
var _a = props.type, type = _a === void 0 ? "text" : _a, onChange = props.onChange, value = props.value, _b = props.size, size = _b === void 0 ? "small" : _b, tooltip = props.tooltip, _c = props.maxLength, maxLength = _c === void 0 ? 999 : _c, _d = props.minLength, minLength = _d === void 0 ? 0 : _d, rest = __rest(props, ["type", "onChange", "value", "size", "tooltip", "maxLength", "minLength"]);
|
30
|
+
var _a = props.type, type = _a === void 0 ? "text" : _a, onChange = props.onChange, value = props.value, _b = props.size, size = _b === void 0 ? "small" : _b, tooltip = props.tooltip, _c = props.maxLength, maxLength = _c === void 0 ? 999 : _c, _d = props.minLength, minLength = _d === void 0 ? 0 : _d, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["type", "onChange", "value", "size", "tooltip", "maxLength", "minLength", "primaryColor", "secondaryColor"]);
|
31
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
29
32
|
var _e = useInteractions(), tooltipOpen = _e.tooltipOpen, onOpenTooltip = _e.onOpenTooltip, onCloseTooltip = _e.onCloseTooltip;
|
30
|
-
return (_jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsx(Field, __assign({ size: size, margin: "dense", type: type, value: value, onFocus: onOpenTooltip, onBlur: onCloseTooltip, onChange: function (event) {
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsx(Field, __assign({ size: size, margin: "dense", type: type, value: value, onFocus: onOpenTooltip, onBlur: onCloseTooltip, onChange: function (event) {
|
34
|
+
event.preventDefault();
|
35
|
+
onChange(event.target.value);
|
36
|
+
}, inputProps: { maxLength: maxLength, minLength: minLength } }, rest), void 0) }), void 0) }), void 0));
|
34
37
|
};
|
35
38
|
export default TextInput;
|
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
22
22
|
};
|
23
23
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
24
24
|
import Typography from "@mui/material/Typography";
|
25
|
-
import
|
25
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
26
26
|
import Slide from "@mui/material/Slide";
|
27
27
|
import SnackbarContent from "@mui/material/SnackbarContent";
|
28
28
|
import Snackbar from "@mui/material/Snackbar";
|
@@ -31,23 +31,24 @@ import ErrorIcon from "@mui/icons-material/Error";
|
|
31
31
|
import WarningIcon from "@mui/icons-material/Warning";
|
32
32
|
import SuccessIcon from "@mui/icons-material/CheckCircle";
|
33
33
|
import { green, amber, red, blue } from "@mui/material/colors";
|
34
|
+
import useCustomTheme from "../useCustomTheme";
|
34
35
|
var ToastPrompt = function (props) {
|
35
36
|
var _a;
|
36
37
|
var _b = props.open, open = _b === void 0 ? false : _b, _c = props.vertical, vertical = _c === void 0 ? "top" : _c, _d = props.horizontal, horizontal = _d === void 0 ? "center" : _d, _e = props.timeout, timeout = _e === void 0 ? 3000 : _e, onClose = props.onClose, _f = props.transitionDirection, transitionDirection = _f === void 0 ? "down" : _f, _g = props.message, message = _g === void 0 ? "Unknown message" : _g, _h = props.icon, icon = _h === void 0 ? _jsx(_Fragment, {}, void 0) : _h, _j = props.variant, variant = _j === void 0 ? "info" : _j, other = __rest(props, ["open", "vertical", "horizontal", "timeout", "onClose", "transitionDirection", "message", "icon", "variant"]);
|
37
|
-
var theme =
|
38
|
+
var theme = useCustomTheme();
|
38
39
|
var styles = {
|
39
40
|
success: {
|
40
|
-
backgroundColor: green[600]
|
41
|
+
backgroundColor: green[600]
|
41
42
|
},
|
42
43
|
error: {
|
43
|
-
backgroundColor: red[700]
|
44
|
+
backgroundColor: red[700]
|
44
45
|
},
|
45
46
|
info: {
|
46
|
-
backgroundColor: blue[600]
|
47
|
+
backgroundColor: blue[600]
|
47
48
|
},
|
48
49
|
warning: {
|
49
|
-
backgroundColor: amber[900]
|
50
|
-
}
|
50
|
+
backgroundColor: amber[900]
|
51
|
+
}
|
51
52
|
};
|
52
53
|
var Transition = function (args) {
|
53
54
|
return _jsx(Slide, __assign({}, args, { direction: transitionDirection }), void 0);
|
@@ -56,25 +57,25 @@ var ToastPrompt = function (props) {
|
|
56
57
|
success: SuccessIcon,
|
57
58
|
warning: WarningIcon,
|
58
59
|
error: ErrorIcon,
|
59
|
-
info: InfoIcon
|
60
|
+
info: InfoIcon
|
60
61
|
};
|
61
62
|
var Icon = VariantIcon[variant];
|
62
|
-
return (_jsx(Snackbar, __assign({ anchorOrigin: { vertical: vertical, horizontal: horizontal }, open: open, onClose: onClose, autoHideDuration: timeout, TransitionComponent: Transition, sx: {
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
63
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Snackbar, __assign({ anchorOrigin: { vertical: vertical, horizontal: horizontal }, open: open, onClose: onClose, autoHideDuration: timeout, TransitionComponent: Transition, sx: {
|
64
|
+
zIndex: 99999,
|
65
|
+
marginTop: "3vh"
|
66
|
+
} }, { children: _jsx(SnackbarContent, __assign({ sx: __assign(__assign({}, styles[variant]), { root: (_a = {},
|
67
|
+
_a[theme.breakpoints.down("sm")] = {
|
68
|
+
maxWidth: "320px",
|
69
|
+
borderRadius: "4px"
|
70
|
+
},
|
71
|
+
_a) }), "aria-describedby": "Toast", message: _jsxs(Typography, __assign({ id: "Toast", component: "span", sx: {
|
72
|
+
fontSize: 14,
|
73
|
+
display: "flex",
|
74
|
+
alignItems: "center"
|
75
|
+
} }, { children: [variant ? (_jsx(Icon, { sx: {
|
76
|
+
fontSize: 20,
|
77
|
+
opacity: 0.9,
|
78
|
+
marginRight: theme.spacing(1)
|
79
|
+
} }, void 0)) : (_jsx(_Fragment, { children: icon }, void 0)), message] }), void 0) }, other), void 0) }), "".concat(Date.now() * Math.round(Math.random()))) }), void 0));
|
79
80
|
};
|
80
81
|
export default ToastPrompt;
|
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
20
20
|
}
|
21
21
|
return t;
|
22
22
|
};
|
23
|
-
import { jsx as _jsx, jsxs as _jsxs
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
24
24
|
import ReactPlayer from "react-player";
|
25
25
|
import Grid from "@mui/material/Grid";
|
26
26
|
import Dialog from "@mui/material/Dialog";
|
@@ -28,15 +28,16 @@ import DialogTitle from "@mui/material/DialogTitle";
|
|
28
28
|
import DialogContent from "@mui/material/DialogContent";
|
29
29
|
import DialogActions from "@mui/material/DialogActions";
|
30
30
|
import Button from "@mui/material/Button";
|
31
|
-
import useTheme from "@mui/material/styles/useTheme";
|
32
31
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
32
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
33
|
+
import useCustomTheme from "../useCustomTheme";
|
33
34
|
function VideoPlayerModal(props) {
|
34
|
-
var url = props.url, _a = props.pip, pip = _a === void 0 ? false : _a, _b = props.open, open = _b === void 0 ? false : _b, title = props.title, onClose = props.onClose, _c = props.extraButtons, extraButtons = _c === void 0 ? [] : _c, playerProps = __rest(props, ["url", "pip", "open", "title", "onClose", "extraButtons"]);
|
35
|
-
var theme =
|
35
|
+
var url = props.url, _a = props.pip, pip = _a === void 0 ? false : _a, _b = props.open, open = _b === void 0 ? false : _b, title = props.title, onClose = props.onClose, _c = props.extraButtons, extraButtons = _c === void 0 ? [] : _c, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, playerProps = __rest(props, ["url", "pip", "open", "title", "onClose", "extraButtons", "primaryColor", "secondaryColor"]);
|
36
|
+
var theme = useCustomTheme();
|
36
37
|
var fullScreen = useMediaQuery(theme.breakpoints.down("sm"));
|
37
|
-
return (_jsx(
|
38
|
-
file: { attributes: { disablePictureInPicture: !pip } }
|
39
|
-
} }, playerProps), void 0) }, void 0), _jsxs(DialogActions, { children: [extraButtons.map(function (buttonProps, index) { return (_jsx(Grid, __assign({ item: true, xs: 12, md: 3, lg: 2 }, { children: _jsx(Button, __assign({}, buttonProps), void 0) }), "extraButton_".concat(index))); }), _jsx(Button, __assign({ variant: "outlined", color: "secondary", onClick: onClose }, { children: "Close" }), void 0)] }, void 0)] }), void 0) }, void 0));
|
38
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(Dialog, __assign({ open: open, fullScreen: fullScreen, onClose: onClose, fullWidth: true, maxWidth: "lg", "aria-labelledby": "react-video-dialog" }, { children: [title && _jsx(DialogTitle, { children: title }, void 0), _jsx(DialogContent, { children: _jsx(ReactPlayer, __assign({ controls: true, url: url, style: { minHeight: "480px" }, width: "100%", config: {
|
39
|
+
file: { attributes: { disablePictureInPicture: !pip } }
|
40
|
+
} }, playerProps), void 0) }, void 0), _jsxs(DialogActions, { children: [extraButtons.map(function (buttonProps, index) { return (_jsx(Grid, __assign({ item: true, xs: 12, md: 3, lg: 2 }, { children: _jsx(Button, __assign({}, buttonProps), void 0) }), "extraButton_".concat(index))); }), _jsx(Button, __assign({ variant: "outlined", color: "secondary", onClick: onClose }, { children: "Close" }), void 0)] }, void 0)] }), void 0) }), void 0));
|
40
41
|
}
|
41
42
|
export default VideoPlayerModal;
|
42
43
|
export * from "./types";
|
@@ -1,8 +1,11 @@
|
|
1
|
+
import { CSSProperties } from "react";
|
1
2
|
import { ButtonProps } from "@mui/material/Button";
|
2
3
|
export interface VideoPlayerModalProps {
|
3
4
|
title?: string;
|
4
5
|
open: boolean;
|
5
6
|
pip?: boolean;
|
6
7
|
extraButtons?: Array<ButtonProps>;
|
8
|
+
primaryColor?: CSSProperties["color"];
|
9
|
+
secondaryColor?: CSSProperties["color"];
|
7
10
|
onClose: () => void;
|
8
11
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@symply.io/basic-components",
|
3
|
-
"version": "1.0.0-alpha.
|
3
|
+
"version": "1.0.0-alpha.10",
|
4
4
|
"description": "Basic and reusable components for all frontend of Symply apps",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -55,6 +55,7 @@
|
|
55
55
|
"@mui/icons-material": "^5.4.2",
|
56
56
|
"@mui/material": "^5.4.2",
|
57
57
|
"@mui/system": "^5.4.2",
|
58
|
+
"color-alpha": "^1.1.3",
|
58
59
|
"react-player": "^2.9.0",
|
59
60
|
"rifm": "^0.12.1"
|
60
61
|
},
|
@@ -0,0 +1,51 @@
|
|
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
|
+
import colorAlpha from "color-alpha";
|
13
|
+
import { createTheme } from "@mui/material/styles";
|
14
|
+
function useCustomTheme(props) {
|
15
|
+
var _a = props || {}, primaryColor = _a.primaryColor, secondaryColor = _a.secondaryColor;
|
16
|
+
var themeOptions = {
|
17
|
+
components: {
|
18
|
+
MuiButton: {
|
19
|
+
styleOverrides: {
|
20
|
+
root: {
|
21
|
+
whiteSpace: "nowrap",
|
22
|
+
fontWeight: 600,
|
23
|
+
fontFamily: "Dinpro"
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
},
|
28
|
+
typography: {
|
29
|
+
fontFamily: "Dinpro"
|
30
|
+
}
|
31
|
+
};
|
32
|
+
if (primaryColor) {
|
33
|
+
themeOptions = __assign(__assign({}, themeOptions), { palette: {
|
34
|
+
primary: {
|
35
|
+
main: primaryColor,
|
36
|
+
light: colorAlpha(primaryColor, 0.08)
|
37
|
+
}
|
38
|
+
} });
|
39
|
+
}
|
40
|
+
if (secondaryColor) {
|
41
|
+
themeOptions = __assign(__assign({}, themeOptions), { palette: {
|
42
|
+
secondary: {
|
43
|
+
main: secondaryColor,
|
44
|
+
light: colorAlpha(secondaryColor, 0.08)
|
45
|
+
}
|
46
|
+
} });
|
47
|
+
}
|
48
|
+
var theme = createTheme(themeOptions);
|
49
|
+
return theme;
|
50
|
+
}
|
51
|
+
export default useCustomTheme;
|