@symply.io/basic-components 1.0.0-alpha.6 → 1.0.0-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.d.ts +3 -2
- package/AlertDialog/index.js +10 -10
- package/AlertDialog/types.d.ts +3 -1
- package/BasicModal/index.d.ts +3 -2
- package/BasicModal/index.js +19 -19
- package/BasicModal/types.d.ts +3 -1
- package/DigitInput/index.d.ts +5 -2
- package/DigitInput/index.js +8 -6
- package/DigitInput/types.d.ts +3 -0
- package/DynamicHeaderBar/HeaderBar.d.ts +4 -2
- package/DynamicHeaderBar/HeaderBar.js +8 -8
- package/DynamicHeaderBar/HeaderButtons.d.ts +2 -2
- package/DynamicHeaderBar/HeaderButtons.js +21 -21
- package/DynamicHeaderBar/HeaderLine.d.ts +6 -3
- package/DynamicHeaderBar/HeaderLine.js +3 -4
- package/FormRadioGroup/index.d.ts +3 -2
- package/FormRadioGroup/index.js +16 -14
- package/FormRadioGroup/types.d.ts +3 -0
- package/FormSelector/MultipleSelector.d.ts +3 -2
- package/FormSelector/MultipleSelector.js +15 -13
- package/FormSelector/SimpleSelector.d.ts +3 -2
- package/FormSelector/SimpleSelector.js +15 -13
- package/FormSelector/types.d.ts +3 -1
- package/HelpCaption/index.d.ts +5 -3
- package/HelpCaption/index.js +16 -16
- package/LoadingModal/index.d.ts +3 -2
- package/LoadingModal/index.js +9 -7
- package/LoadingModal/types.d.ts +3 -0
- package/MenuButtonGroup/MenuItem.d.ts +2 -2
- package/MenuButtonGroup/MenuItem.js +5 -3
- package/MenuButtonGroup/index.d.ts +5 -3
- package/MenuButtonGroup/index.js +8 -6
- package/NumberInput/index.d.ts +7 -3
- package/NumberInput/index.js +9 -7
- package/PasswordInput/ConfirmPassword.d.ts +7 -3
- package/PasswordInput/ConfirmPassword.js +8 -6
- package/PasswordInput/Password.d.ts +6 -2
- package/PasswordInput/Password.js +10 -8
- package/PhoneNumberInput/index.d.ts +7 -3
- package/PhoneNumberInput/index.js +9 -7
- package/TabGroup/index.d.ts +3 -2
- package/TabGroup/index.js +19 -19
- package/TabGroup/types.d.ts +3 -0
- package/TextInput/index.d.ts +6 -3
- package/TextInput/index.js +9 -7
- package/ToastPrompt/Presentation.d.ts +16 -3
- package/ToastPrompt/Presentation.js +21 -21
- package/VideoPlayerModal/index.d.ts +4 -2
- package/VideoPlayerModal/index.js +9 -9
- package/VideoPlayerModal/types.d.ts +3 -0
- package/package.json +2 -1
- package/useCustomTheme.d.ts +6 -0
- package/useCustomTheme.js +51 -0
- package/withTheme.d.ts +0 -3
- package/withTheme.js +0 -35
package/LoadingModal/index.js
CHANGED
@@ -16,13 +16,15 @@ import Dialog from "@mui/material/Dialog";
|
|
16
16
|
import DialogContent from "@mui/material/DialogContent";
|
17
17
|
import Typography from "@mui/material/Typography";
|
18
18
|
import CircularProgress from "@mui/material/CircularProgress";
|
19
|
-
import
|
19
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
20
|
+
import useCustomTheme from "../useCustomTheme";
|
20
21
|
function LoadingModal(props) {
|
21
|
-
var open = props.open, _a = props.text, text = _a === void 0 ? "Loading..." : _a, _b = props.direction, direction = _b === void 0 ? "column" : _b, _c = props.showProgess, showProgess = _c === void 0 ? false : _c, _d = props.percent, percent = _d === void 0 ? 0 : _d;
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
var open = props.open, _a = props.text, text = _a === void 0 ? "Loading..." : _a, _b = props.direction, direction = _b === void 0 ? "column" : _b, _c = props.showProgess, showProgess = _c === void 0 ? false : _c, _d = props.percent, percent = _d === void 0 ? 0 : _d, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
|
23
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
24
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Dialog, __assign({ maxWidth: "xs", open: open, sx: { backgroundColor: "#7A7A7A97" }, PaperProps: { sx: { backgroundColor: "#F2F2F2CF" } }, onClose: function (_, reason) {
|
25
|
+
if (reason === "backdropClick")
|
26
|
+
return;
|
27
|
+
}, disableEscapeKeyDown: true }, { children: _jsx(DialogContent, { children: _jsxs(Grid, __assign({ container: true, direction: direction, justifyContent: "space-between", alignItems: "center", "data-testid": "loading-grid" }, { children: [_jsxs(Box, __assign({ position: "relative", display: "inline-flex", sx: { mt: 1.25 } }, { children: [_jsx(CircularProgress, { size: showProgess ? 56 : 40, value: percent, variant: showProgess ? "determinate" : "indeterminate" }, void 0), showProgess && percent >= 0 && (_jsx(Box, __assign({ top: 0, left: 0, bottom: 0, right: 0, position: "absolute", display: "flex", alignItems: "center", justifyContent: "center" }, { children: _jsxs(Typography, __assign({ variant: "caption" }, { children: [Math.round(percent), "%"] }), void 0) }), void 0))] }), void 0), _jsx(Typography, __assign({ variant: "subtitle1", component: "span", sx: { mt: 1 } }, { children: text }), void 0)] }), void 0) }, void 0) }), void 0) }), void 0));
|
26
28
|
}
|
27
|
-
export default
|
29
|
+
export default LoadingModal;
|
28
30
|
export * from "./types";
|
package/LoadingModal/types.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { CSSProperties } from "react";
|
1
2
|
import { GridProps } from "@mui/material/Grid";
|
2
3
|
export interface LoadingModalProps {
|
3
4
|
open: boolean;
|
@@ -5,4 +6,6 @@ export interface LoadingModalProps {
|
|
5
6
|
direction?: GridProps["direction"];
|
6
7
|
showProgess?: boolean;
|
7
8
|
percent?: number;
|
9
|
+
primaryColor?: CSSProperties["color"];
|
10
|
+
secondaryColor?: CSSProperties["color"];
|
8
11
|
}
|
@@ -7,5 +7,5 @@ export interface ButtonItemProps {
|
|
7
7
|
disabled?: boolean;
|
8
8
|
onClick: MenuItemProps["onClick"];
|
9
9
|
}
|
10
|
-
declare
|
11
|
-
export default
|
10
|
+
declare function ButtonMenuItem(props: ButtonItemProps): JSX.Element;
|
11
|
+
export default ButtonMenuItem;
|
@@ -13,9 +13,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import MenuItem from "@mui/material/MenuItem";
|
14
14
|
import ListItemIcon from "@mui/material/ListItemIcon";
|
15
15
|
import ListItemText from "@mui/material/ListItemText";
|
16
|
-
import
|
16
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
17
|
+
import useCustomTheme from "../useCustomTheme";
|
17
18
|
function ButtonMenuItem(props) {
|
18
19
|
var buttonText = props.buttonText, buttonIcon = props.buttonIcon, _a = props.disabled, disabled = _a === void 0 ? false : _a, onClick = props.onClick;
|
19
|
-
|
20
|
+
var theme = useCustomTheme();
|
21
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(MenuItem, __assign({ onClick: onClick, disabled: disabled }, { children: [buttonIcon && _jsx(ListItemIcon, { children: buttonIcon }, void 0), _jsx(ListItemText, { primary: buttonText }, void 0)] }), void 0) }), void 0));
|
20
22
|
}
|
21
|
-
export default
|
23
|
+
export default ButtonMenuItem;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
import { CSSProperties } from "react";
|
2
2
|
import { ButtonProps } from "@mui/material/Button";
|
3
3
|
import { ButtonItemProps } from "./MenuItem";
|
4
4
|
export interface MenuButtonGroupProps {
|
@@ -8,6 +8,8 @@ export interface MenuButtonGroupProps {
|
|
8
8
|
variant?: ButtonProps["variant"];
|
9
9
|
color?: ButtonProps["color"];
|
10
10
|
buttons: Array<ButtonItemProps>;
|
11
|
+
primaryColor?: CSSProperties["color"];
|
12
|
+
secondaryColor?: CSSProperties["color"];
|
11
13
|
}
|
12
|
-
declare
|
13
|
-
export default
|
14
|
+
declare function MenuButtonGroup(props: MenuButtonGroupProps): JSX.Element;
|
15
|
+
export default MenuButtonGroup;
|
package/MenuButtonGroup/index.js
CHANGED
@@ -56,16 +56,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
56
56
|
}
|
57
57
|
return t;
|
58
58
|
};
|
59
|
-
import { jsx as _jsx,
|
59
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
60
60
|
import { useState } from "react";
|
61
61
|
import Menu from "@mui/material/Menu";
|
62
62
|
import Button from "@mui/material/Button";
|
63
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
63
64
|
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
64
65
|
import ButtonItem from "./MenuItem";
|
65
|
-
import
|
66
|
+
import useCustomTheme from "../useCustomTheme";
|
66
67
|
function MenuButtonGroup(props) {
|
67
68
|
var _this = this;
|
68
|
-
var buttonText = props.buttonText, buttons = props.buttons, size = props.size, _a = props.color, color = _a === void 0 ? "primary" : _a, _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props.variant, variant = _c === void 0 ? "outlined" : _c;
|
69
|
+
var buttonText = props.buttonText, buttons = props.buttons, size = props.size, _a = props.color, color = _a === void 0 ? "primary" : _a, _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props.variant, variant = _c === void 0 ? "outlined" : _c, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
|
70
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
69
71
|
var _d = useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
|
70
72
|
function onClick(event) {
|
71
73
|
setAnchorEl(event.currentTarget);
|
@@ -73,7 +75,7 @@ function MenuButtonGroup(props) {
|
|
73
75
|
var onClose = function () {
|
74
76
|
setAnchorEl(null);
|
75
77
|
};
|
76
|
-
return (_jsxs(
|
78
|
+
return (_jsxs(ThemeProvider, __assign({ theme: theme }, { children: [_jsx(Button, __assign({ "aria-controls": "customized-menu", "data-nw": "download-button", "aria-haspopup": "true", variant: variant, color: color, onClick: onClick, fullWidth: true, size: size, endIcon: _jsx(ArrowDropDownIcon, { fontSize: "small" }, void 0), disabled: disabled }, { children: buttonText }), void 0), _jsx(Menu, __assign({ id: "button-menu", anchorEl: anchorEl, keepMounted: true, elevation: 2, anchorOrigin: {
|
77
79
|
vertical: "bottom",
|
78
80
|
horizontal: "center"
|
79
81
|
}, transformOrigin: {
|
@@ -96,6 +98,6 @@ function MenuButtonGroup(props) {
|
|
96
98
|
}
|
97
99
|
});
|
98
100
|
}); } }), buttonText));
|
99
|
-
}) }), void 0)] }, void 0));
|
101
|
+
}) }), void 0)] }), void 0));
|
100
102
|
}
|
101
|
-
export default
|
103
|
+
export default MenuButtonGroup;
|
package/NumberInput/index.d.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
import { CSSProperties } from "react";
|
2
|
+
import { TextFieldProps } from "@mui/material/TextField";
|
3
|
+
declare type TextProps = Omit<TextFieldProps, "onChange">;
|
2
4
|
export interface NumberInputProps {
|
3
5
|
onChange: (value: string) => void;
|
4
6
|
value: string;
|
@@ -6,6 +8,8 @@ export interface NumberInputProps {
|
|
6
8
|
tooltip?: string;
|
7
9
|
maxValue?: number;
|
8
10
|
minValue?: number;
|
11
|
+
primaryColor?: CSSProperties["color"];
|
12
|
+
secondaryColor?: CSSProperties["color"];
|
9
13
|
}
|
10
|
-
declare
|
11
|
-
export default
|
14
|
+
declare function NumberInput(props: NumberInputProps & TextProps): JSX.Element;
|
15
|
+
export default NumberInput;
|
package/NumberInput/index.js
CHANGED
@@ -23,17 +23,19 @@ 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";
|
27
|
-
import
|
28
|
+
import useCustomTheme from "../useCustomTheme";
|
28
29
|
function NumberInput(props) {
|
29
|
-
var onChange = props.onChange, value = props.value, _a = props.size, size = _a === void 0 ? "small" : _a, tooltip = props.tooltip, _b = props.integerOnly, integerOnly = _b === void 0 ? false : _b, _c = props.minValue, minValue = _c === void 0 ? Number.MIN_SAFE_INTEGER : _c, _d = props.maxValue, maxValue = _d === void 0 ? Number.MAX_SAFE_INTEGER : _d, error = props.error, helperText = props.helperText, rest = __rest(props, ["onChange", "value", "size", "tooltip", "integerOnly", "minValue", "maxValue", "error", "helperText"]);
|
30
|
+
var onChange = props.onChange, value = props.value, _a = props.size, size = _a === void 0 ? "small" : _a, tooltip = props.tooltip, _b = props.integerOnly, integerOnly = _b === void 0 ? false : _b, _c = props.minValue, minValue = _c === void 0 ? Number.MIN_SAFE_INTEGER : _c, _d = props.maxValue, maxValue = _d === void 0 ? Number.MAX_SAFE_INTEGER : _d, error = props.error, helperText = props.helperText, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["onChange", "value", "size", "tooltip", "integerOnly", "minValue", "maxValue", "error", "helperText", "primaryColor", "secondaryColor"]);
|
31
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
30
32
|
var EXCEED_ERROR = "Your value exceeds the exceptable input range";
|
31
33
|
if (maxValue < minValue)
|
32
34
|
throw new Error("Max should be bigger than min!");
|
33
35
|
var _e = useInteractions({ maxValue: maxValue, minValue: minValue, value: value, onChange: onChange }), exceedError = _e.exceedError, tooltipOpen = _e.tooltipOpen, handleBlur = _e.handleBlur, handleChange = _e.handleChange, onOpenTooltip = _e.onOpenTooltip, onCloseTooltip = _e.onCloseTooltip;
|
34
|
-
return (_jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsx(Field, __assign({ size: size, margin: "dense", type: "number", value: value === undefined || value === null ? "" : value, onFocus: onOpenTooltip, onBlur: function () {
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
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: "number", value: value === undefined || value === null ? "" : value, onFocus: onOpenTooltip, onBlur: function () {
|
37
|
+
onCloseTooltip();
|
38
|
+
handleBlur();
|
39
|
+
}, onChange: handleChange, error: error || exceedError, helperText: helperText || (exceedError ? EXCEED_ERROR : "") }, rest), void 0) }), void 0) }), void 0));
|
38
40
|
}
|
39
|
-
export default
|
41
|
+
export default NumberInput;
|
@@ -1,8 +1,12 @@
|
|
1
|
-
|
1
|
+
import { CSSProperties } from "react";
|
2
|
+
import { TextFieldProps } from "@mui/material/TextField";
|
3
|
+
declare type TextInputProps = Omit<TextFieldProps, "onChange">;
|
2
4
|
export interface ConfirmPasswordProps {
|
3
5
|
password: string;
|
4
6
|
value: string;
|
7
|
+
primaryColor?: CSSProperties["color"];
|
8
|
+
secondaryColor?: CSSProperties["color"];
|
5
9
|
onChange: (value: string) => void;
|
6
10
|
}
|
7
|
-
declare
|
8
|
-
export default
|
11
|
+
declare function ConfirmPassword(props: ConfirmPasswordProps & TextInputProps): JSX.Element;
|
12
|
+
export default ConfirmPassword;
|
@@ -23,17 +23,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
24
24
|
import { useMemo } from "react";
|
25
25
|
import TextField from "@mui/material/TextField";
|
26
|
-
import
|
26
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
27
|
+
import useCustomTheme from "../useCustomTheme";
|
27
28
|
function ConfirmPassword(props) {
|
28
|
-
var password = props.password, _a = props.helperText, helperText = _a === void 0 ? "Passwords do not match" : _a, value = props.value, _b = props.label, label = _b === void 0 ? "Confirm Password" : _b, _c = props.name, name = _c === void 0 ? "confirmPassword" : _c, _d = props.variant, variant = _d === void 0 ? "outlined" : _d, _e = props.margin, margin = _e === void 0 ? "dense" : _e, disabled = props.disabled, onChange = props.onChange, rest = __rest(props, ["password", "helperText", "value", "label", "name", "variant", "margin", "disabled", "onChange"]);
|
29
|
+
var password = props.password, _a = props.helperText, helperText = _a === void 0 ? "Passwords do not match" : _a, value = props.value, _b = props.label, label = _b === void 0 ? "Confirm Password" : _b, _c = props.name, name = _c === void 0 ? "confirmPassword" : _c, _d = props.variant, variant = _d === void 0 ? "outlined" : _d, _e = props.margin, margin = _e === void 0 ? "dense" : _e, disabled = props.disabled, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onChange = props.onChange, rest = __rest(props, ["password", "helperText", "value", "label", "name", "variant", "margin", "disabled", "primaryColor", "secondaryColor", "onChange"]);
|
30
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
29
31
|
var isMatched = useMemo(function () {
|
30
32
|
if ((value === null || value === void 0 ? void 0 : value.length) > 0) {
|
31
33
|
return password === value;
|
32
34
|
}
|
33
35
|
return true;
|
34
36
|
}, [value, password]);
|
35
|
-
return (_jsx(TextField, __assign({ error: !isMatched, label: label, value: value, variant: variant, margin: margin, disabled: disabled, type: "password", size: "small", helperText: !isMatched && helperText, onChange: function (event) {
|
36
|
-
|
37
|
-
|
37
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ error: !isMatched, label: label, value: value, variant: variant, margin: margin, disabled: disabled, type: "password", size: "small", helperText: !isMatched && helperText, onChange: function (event) {
|
38
|
+
onChange(event.target.value);
|
39
|
+
}, fullWidth: true, required: true }, rest), void 0) }), void 0));
|
38
40
|
}
|
39
|
-
export default
|
41
|
+
export default ConfirmPassword;
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import { CSSProperties } from "react";
|
2
|
+
import { TextFieldProps } from "@mui/material/TextField";
|
3
|
+
declare type TextInputProps = Omit<TextFieldProps, "onChange">;
|
2
4
|
export interface PasswordStrategyProps {
|
3
5
|
[key: string]: {
|
4
6
|
label: string;
|
@@ -9,8 +11,10 @@ export interface PasswordProps {
|
|
9
11
|
strategies: PasswordStrategyProps;
|
10
12
|
value: string;
|
11
13
|
successColor?: CSSProperties["color"];
|
14
|
+
primaryColor?: CSSProperties["color"];
|
15
|
+
secondaryColor?: CSSProperties["color"];
|
12
16
|
onChange: (value: string) => void;
|
13
17
|
onVerify?: (value: string) => boolean;
|
14
18
|
}
|
15
|
-
declare
|
16
|
-
export default
|
19
|
+
declare function Password(props: PasswordProps & TextInputProps): JSX.Element;
|
20
|
+
export default Password;
|
@@ -24,7 +24,8 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
24
|
import { useMemo } from "react";
|
25
25
|
import TextField from "@mui/material/TextField";
|
26
26
|
import Typography from "@mui/material/Typography";
|
27
|
-
import
|
27
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
28
|
+
import useCustomTheme from "../useCustomTheme";
|
28
29
|
function Password(props) {
|
29
30
|
var _a = props.strategies, strategies = _a === void 0 ? {
|
30
31
|
uppercaseLetter: { label: "1 Uppercase Letter", regex: /[A-Z]+/ },
|
@@ -35,10 +36,11 @@ function Password(props) {
|
|
35
36
|
},
|
36
37
|
number: { label: "1 Number", regex: /\d+/ },
|
37
38
|
minimum8: { label: "Minimum 8 characters", regex: /.{8,}/ }
|
38
|
-
} : _a, _b = props.successColor, successColor = _b === void 0 ? "green" : _b, value = props.value, error = props.error, _c = props.onVerify, onVerify = _c === void 0 ? function (password) {
|
39
|
+
} : _a, _b = props.successColor, successColor = _b === void 0 ? "green" : _b, value = props.value, error = props.error, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, _c = props.onVerify, onVerify = _c === void 0 ? function (password) {
|
39
40
|
var reg = /^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~])([!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~a-zA-z0-9]{8,})$/;
|
40
41
|
return reg.test(password);
|
41
|
-
} : _c, onChange = props.onChange, rest = __rest(props, ["strategies", "successColor", "value", "error", "onVerify", "onChange"]);
|
42
|
+
} : _c, onChange = props.onChange, rest = __rest(props, ["strategies", "successColor", "value", "error", "primaryColor", "secondaryColor", "onVerify", "onChange"]);
|
43
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
42
44
|
var isValidPassword = useMemo(function () {
|
43
45
|
if ((value === null || value === void 0 ? void 0 : value.length) > 0) {
|
44
46
|
return onVerify(value);
|
@@ -64,11 +66,11 @@ function Password(props) {
|
|
64
66
|
var helperText = useMemo(function () {
|
65
67
|
return (_jsx(_Fragment, { children: Object.keys(strategies).map(function (key) {
|
66
68
|
var label = strategies[key].label;
|
67
|
-
return (_jsx(Typography, __assign({ component: "
|
69
|
+
return (_jsx(Typography, __assign({ component: "li", variant: "caption", style: { color: helperTextColor[key] } }, { children: label }), key));
|
68
70
|
}) }, void 0));
|
69
71
|
}, [helperTextColor, strategies]);
|
70
|
-
return (_jsx(TextField, __assign({ error: !isValidPassword || error, helperText: helperText, type: "password", label: "Password", size: "small", margin: "dense", value: value, onChange: function (event) {
|
71
|
-
|
72
|
-
|
72
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ error: !isValidPassword || error, helperText: helperText, type: "password", label: "Password", size: "small", margin: "dense", value: value, onChange: function (event) {
|
73
|
+
onChange(event.target.value);
|
74
|
+
}, fullWidth: true, required: true }, rest), void 0) }), void 0));
|
73
75
|
}
|
74
|
-
export default
|
76
|
+
export default Password;
|
@@ -1,10 +1,14 @@
|
|
1
|
-
|
1
|
+
import { CSSProperties } from "react";
|
2
2
|
import { InputProps } from "@mui/material/Input";
|
3
|
+
import { TextFieldProps } from "@mui/material/TextField";
|
4
|
+
declare type TextInputProps = Omit<TextFieldProps, "onChange">;
|
3
5
|
export interface PhoneInputProps {
|
4
6
|
value: string;
|
5
7
|
endAdornment?: InputProps["endAdornment"];
|
8
|
+
primaryColor?: CSSProperties["color"];
|
9
|
+
secondaryColor?: CSSProperties["color"];
|
6
10
|
onChange: (val: string) => void;
|
7
11
|
}
|
8
12
|
export declare function phoneFormat(str: string): string;
|
9
|
-
declare
|
10
|
-
export default
|
13
|
+
declare function PhoneInput(props: TextInputProps & PhoneInputProps): JSX.Element;
|
14
|
+
export default PhoneInput;
|
@@ -25,8 +25,9 @@ import { useRifm } from "rifm";
|
|
25
25
|
import Typography from "@mui/material/Typography";
|
26
26
|
import InputAdornment from "@mui/material/InputAdornment";
|
27
27
|
import TextField from "@mui/material/TextField";
|
28
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
28
29
|
import useInteractions from "./useInteractions";
|
29
|
-
import
|
30
|
+
import useCustomTheme from "../useCustomTheme";
|
30
31
|
export function phoneFormat(str) {
|
31
32
|
var digits = (str.match(/\d+/g) || []).join("");
|
32
33
|
var chars = digits.split("");
|
@@ -43,7 +44,8 @@ export function phoneFormat(str) {
|
|
43
44
|
}, "(");
|
44
45
|
}
|
45
46
|
function PhoneInput(props) {
|
46
|
-
var value = props.value, endAdornment = props.endAdornment, onChange = props.onChange, rest = __rest(props, ["value", "endAdornment", "onChange"]);
|
47
|
+
var value = props.value, endAdornment = props.endAdornment, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onChange = props.onChange, rest = __rest(props, ["value", "endAdornment", "primaryColor", "secondaryColor", "onChange"]);
|
48
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
47
49
|
var addMask = useInteractions({ value: value }).addMask;
|
48
50
|
var rifm = useRifm({
|
49
51
|
mask: true,
|
@@ -52,9 +54,9 @@ function PhoneInput(props) {
|
|
52
54
|
replace: addMask,
|
53
55
|
format: phoneFormat
|
54
56
|
});
|
55
|
-
return (_jsx(TextField, __assign({ value: rifm.value, InputProps: {
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ value: rifm.value, InputProps: {
|
58
|
+
startAdornment: (_jsx(InputAdornment, __assign({ position: "start" }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "+1" }), void 0) }), void 0)),
|
59
|
+
endAdornment: endAdornment
|
60
|
+
}, onChange: rifm.onChange }, rest), void 0) }), void 0));
|
59
61
|
}
|
60
|
-
export default
|
62
|
+
export default PhoneInput;
|
package/TabGroup/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
|
3
|
-
|
2
|
+
import { TabGroupProps } from "./types";
|
3
|
+
declare const TabGroup: import("react").ForwardRefExoticComponent<TabGroupProps & import("react").RefAttributes<unknown>>;
|
4
|
+
export default TabGroup;
|
4
5
|
export * from "./types";
|
package/TabGroup/index.js
CHANGED
@@ -15,12 +15,12 @@ import Tab from "@mui/material/Tab";
|
|
15
15
|
import Tabs from "@mui/material/Tabs";
|
16
16
|
import Typography from "@mui/material/Typography";
|
17
17
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
18
|
-
import
|
19
|
-
import
|
18
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
19
|
+
import useCustomTheme from "../useCustomTheme";
|
20
20
|
var TabGroup = forwardRef(function (props, ref) {
|
21
|
-
var
|
21
|
+
var tabs = props.tabs, _a = props.textColor, textColor = _a === void 0 ? "primary" : _a, _b = props.variant, variant = _b === void 0 ? "scrollable" : _b, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onTabChange = props.onTabChange, _c = props.currentTabIndex, outerTabIndex = _c === void 0 ? 0 : _c;
|
22
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
22
23
|
var mobileViewport = useMediaQuery(theme.breakpoints.down("md"));
|
23
|
-
var tabs = props.tabs, _a = props.textColor, textColor = _a === void 0 ? "primary" : _a, _b = props.variant, variant = _b === void 0 ? "scrollable" : _b, onTabChange = props.onTabChange, _c = props.currentTabIndex, outerTabIndex = _c === void 0 ? 0 : _c;
|
24
24
|
var _d = useState(outerTabIndex), currentTabIndex = _d[0], setCurrentTabIndex = _d[1];
|
25
25
|
var onClick = function (index) {
|
26
26
|
setCurrentTabIndex(index);
|
@@ -28,20 +28,20 @@ var TabGroup = forwardRef(function (props, ref) {
|
|
28
28
|
useImperativeHandle(ref, function () { return ({
|
29
29
|
tabIndex: currentTabIndex
|
30
30
|
}); });
|
31
|
-
return (_jsx(Tabs, __assign({ value: currentTabIndex, TabIndicatorProps: { hidden: true }, variant: mobileViewport ? "scrollable" : variant, textColor: textColor, onChange: function (_, val) {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
31
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tabs, __assign({ value: currentTabIndex, TabIndicatorProps: { hidden: true }, variant: mobileViewport ? "scrollable" : variant, textColor: textColor, onChange: function (_, val) {
|
32
|
+
onClick(val);
|
33
|
+
onTabChange(val);
|
34
|
+
} }, { children: tabs.map(function (tab, index) {
|
35
|
+
var text = tab.text, _a = tab.disabled, disabled = _a === void 0 ? false : _a;
|
36
|
+
var active = currentTabIndex === index;
|
37
|
+
return (_jsx(Tab, { disableFocusRipple: true, disableRipple: true, label: _jsx(Typography, __assign({ variant: "body2" }, { children: text }), void 0), disabled: disabled, sx: {
|
38
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
39
|
+
margin: theme.spacing(0.75, 0.25),
|
40
|
+
background: active ? "#fff" : undefined,
|
41
|
+
borderRadius: active ? theme.spacing(0.5) : undefined,
|
42
|
+
boxShadow: active ? "0px 4px 6px #acc1c2" : undefined
|
43
|
+
} }, index));
|
44
|
+
}) }), void 0) }), void 0));
|
45
45
|
});
|
46
|
-
export default
|
46
|
+
export default TabGroup;
|
47
47
|
export * from "./types";
|
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,11 +1,14 @@
|
|
1
|
-
|
1
|
+
import { CSSProperties } from "react";
|
2
2
|
import { TextFieldProps } from "@mui/material/TextField";
|
3
|
+
declare type TextProps = Omit<TextFieldProps, "onChange">;
|
3
4
|
export interface TextInputProps {
|
4
5
|
onChange: (value: string) => void;
|
5
6
|
value: string;
|
6
7
|
tooltip?: TextFieldProps;
|
7
8
|
maxLength?: number;
|
8
9
|
minLength?: number;
|
10
|
+
primaryColor?: CSSProperties["color"];
|
11
|
+
secondaryColor?: CSSProperties["color"];
|
9
12
|
}
|
10
|
-
declare const
|
11
|
-
export default
|
13
|
+
declare const TextInput: (props: TextInputProps & TextProps) => JSX.Element;
|
14
|
+
export default TextInput;
|
package/TextInput/index.js
CHANGED
@@ -23,14 +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";
|
27
|
-
import
|
28
|
+
import useCustomTheme from "../useCustomTheme";
|
28
29
|
var TextInput = function (props) {
|
29
|
-
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 });
|
30
32
|
var _e = useInteractions(), tooltipOpen = _e.tooltipOpen, onOpenTooltip = _e.onOpenTooltip, onCloseTooltip = _e.onCloseTooltip;
|
31
|
-
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) {
|
32
|
-
|
33
|
-
|
34
|
-
|
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));
|
35
37
|
};
|
36
|
-
export default
|
38
|
+
export default TextInput;
|
@@ -1,3 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
import { ElementType } from "react";
|
2
|
+
import { SlideProps } from "@mui/material/Slide";
|
3
|
+
import { SnackbarOrigin } from "@mui/material/Snackbar";
|
4
|
+
interface ToastPromptProps {
|
5
|
+
open?: boolean;
|
6
|
+
vertical?: SnackbarOrigin["vertical"];
|
7
|
+
horizontal?: SnackbarOrigin["horizontal"];
|
8
|
+
timeout?: number;
|
9
|
+
onClose?: () => void;
|
10
|
+
transitionDirection?: SlideProps["direction"];
|
11
|
+
message?: string;
|
12
|
+
icon?: ElementType;
|
13
|
+
variant?: "success" | "warning" | "info" | "error";
|
14
|
+
}
|
15
|
+
declare const ToastPrompt: (props: ToastPromptProps) => JSX.Element;
|
16
|
+
export default ToastPrompt;
|
@@ -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,11 +31,11 @@ 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
|
34
|
+
import useCustomTheme from "../useCustomTheme";
|
35
35
|
var ToastPrompt = function (props) {
|
36
36
|
var _a;
|
37
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"]);
|
38
|
-
var theme =
|
38
|
+
var theme = useCustomTheme();
|
39
39
|
var styles = {
|
40
40
|
success: {
|
41
41
|
backgroundColor: green[600]
|
@@ -60,22 +60,22 @@ var ToastPrompt = function (props) {
|
|
60
60
|
info: InfoIcon
|
61
61
|
};
|
62
62
|
var Icon = VariantIcon[variant];
|
63
|
-
return (_jsx(Snackbar, __assign({ anchorOrigin: { vertical: vertical, horizontal: horizontal }, open: open, onClose: onClose, autoHideDuration: timeout, TransitionComponent: Transition, sx: {
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
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));
|
80
80
|
};
|
81
|
-
export default
|
81
|
+
export default ToastPrompt;
|
@@ -1,4 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
|
3
|
-
|
2
|
+
import { ReactPlayerProps } from "react-player";
|
3
|
+
import { VideoPlayerModalProps } from "./types";
|
4
|
+
declare function VideoPlayerModal(props: VideoPlayerModalProps & ReactPlayerProps): JSX.Element;
|
5
|
+
export default VideoPlayerModal;
|
4
6
|
export * from "./types";
|
@@ -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,16 +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";
|
33
|
-
import
|
32
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
33
|
+
import useCustomTheme from "../useCustomTheme";
|
34
34
|
function VideoPlayerModal(props) {
|
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, playerProps = __rest(props, ["url", "pip", "open", "title", "onClose", "extraButtons"]);
|
36
|
-
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();
|
37
37
|
var fullScreen = useMediaQuery(theme.breakpoints.down("sm"));
|
38
|
-
return (_jsx(
|
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));
|
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));
|
41
41
|
}
|
42
|
-
export default
|
42
|
+
export default VideoPlayerModal;
|
43
43
|
export * from "./types";
|