@symply.io/basic-components 1.0.0-alpha.9 → 1.0.0-bata.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 +0 -1
- package/AlertDialog/index.js +2 -2
- package/Autocomplete/index.d.ts +4 -0
- package/Autocomplete/index.js +38 -0
- package/Autocomplete/types.d.ts +14 -0
- package/Autocomplete/types.js +1 -0
- package/Autocomplete/useInteractions.d.ts +5 -0
- package/Autocomplete/useInteractions.js +9 -0
- package/AutocompleteWithFilter/index.d.ts +4 -0
- package/AutocompleteWithFilter/index.js +52 -0
- package/AutocompleteWithFilter/types.d.ts +15 -0
- package/AutocompleteWithFilter/types.js +1 -0
- package/BasicModal/Content.d.ts +0 -1
- package/BasicModal/Content.js +6 -6
- package/BasicModal/index.d.ts +0 -1
- package/BasicModal/index.js +3 -6
- package/BasicTable/TableBody.d.ts +4 -0
- package/BasicTable/TableBody.js +51 -0
- package/BasicTable/TableBodyRow.d.ts +3 -0
- package/BasicTable/TableBodyRow.js +42 -0
- package/BasicTable/TableFooter.d.ts +3 -0
- package/BasicTable/TableFooter.js +44 -0
- package/BasicTable/TableHeader.d.ts +3 -0
- package/BasicTable/TableHeader.js +47 -0
- package/BasicTable/index.d.ts +5 -0
- package/BasicTable/index.js +88 -0
- package/BasicTable/types.d.ts +70 -0
- package/BasicTable/types.js +1 -0
- package/BasicTable/useScroll.d.ts +9 -0
- package/BasicTable/useScroll.js +76 -0
- package/BasicTable/useTable.d.ts +38 -0
- package/BasicTable/useTable.js +94 -0
- package/BreadCrumbs/index.d.ts +4 -0
- package/BreadCrumbs/index.js +37 -0
- package/BreadCrumbs/types.d.ts +9 -0
- package/BreadCrumbs/types.js +1 -0
- package/CheckBox/CheckBox.d.ts +3 -0
- package/CheckBox/CheckBox.js +36 -0
- package/CheckBox/CheckBoxGroup.d.ts +3 -0
- package/CheckBox/CheckBoxGroup.js +30 -0
- package/CheckBox/index.d.ts +3 -0
- package/CheckBox/index.js +3 -0
- package/CheckBox/types.d.ts +12 -0
- package/CheckBox/types.js +1 -0
- package/Copyright/index.d.ts +4 -0
- package/Copyright/index.js +25 -0
- package/Copyright/types.d.ts +5 -0
- package/Copyright/types.js +1 -0
- package/DateInput/FullDateInput/index.d.ts +5 -0
- package/DateInput/FullDateInput/index.js +79 -0
- package/DateInput/FullDateInput/types.d.ts +9 -0
- package/DateInput/FullDateInput/types.js +1 -0
- package/DateInput/FullDateInput/useInteractions.d.ts +8 -0
- package/DateInput/FullDateInput/useInteractions.js +20 -0
- package/DateInput/MonthDayInput/index.d.ts +5 -0
- package/DateInput/MonthDayInput/index.js +65 -0
- package/DateInput/MonthDayInput/types.d.ts +9 -0
- package/DateInput/MonthDayInput/types.js +1 -0
- package/DateInput/MonthDayInput/useInteractions.d.ts +8 -0
- package/DateInput/MonthDayInput/useInteractions.js +19 -0
- package/DateInput/MonthYearInput/index.d.ts +5 -0
- package/DateInput/MonthYearInput/index.js +66 -0
- package/DateInput/MonthYearInput/types.d.ts +9 -0
- package/DateInput/MonthYearInput/types.js +1 -0
- package/DateInput/MonthYearInput/useInteractions.d.ts +8 -0
- package/DateInput/MonthYearInput/useInteractions.js +19 -0
- package/DateInput/index.d.ts +6 -0
- package/DateInput/index.js +6 -0
- package/DigitInput/index.d.ts +1 -4
- package/DigitInput/index.js +3 -3
- package/DigitInput/types.d.ts +2 -1
- package/DynamicHeaderBar/HeaderBar.js +1 -1
- package/DynamicHeaderBar/HeaderButtons.d.ts +0 -1
- package/DynamicHeaderBar/HeaderButtons.js +6 -6
- package/DynamicHeaderBar/HeaderLine.js +1 -1
- package/DynamicHeaderBar/index.js +2 -2
- package/DynamicHeaderBar/types.d.ts +3 -0
- package/FeinInput/index.d.ts +6 -0
- package/FeinInput/index.js +75 -0
- package/FeinInput/types.d.ts +9 -0
- package/FeinInput/types.js +1 -0
- package/FeinInput/useInteractions.d.ts +8 -0
- package/FeinInput/useInteractions.js +16 -0
- package/FormRadioGroup/index.d.ts +0 -1
- package/FormRadioGroup/index.js +3 -3
- package/FormSelector/MultipleSelector.d.ts +1 -3
- package/FormSelector/MultipleSelector.js +2 -2
- package/FormSelector/SimpleSelector.d.ts +1 -3
- package/FormSelector/SimpleSelector.js +2 -2
- package/FormSelector/types.d.ts +2 -1
- package/HelpCaption/index.js +2 -2
- package/LoadingModal/index.d.ts +0 -1
- package/LoadingModal/index.js +1 -1
- package/MenuButtonGroup/MenuItem.d.ts +0 -1
- package/MenuButtonGroup/MenuItem.js +1 -1
- package/MenuButtonGroup/index.js +2 -2
- package/NumberInput/index.d.ts +2 -3
- package/NumberInput/index.js +1 -1
- package/PasswordInput/ConfirmPassword.d.ts +2 -3
- package/PasswordInput/ConfirmPassword.js +1 -1
- package/PasswordInput/Password.d.ts +5 -5
- package/PasswordInput/Password.js +9 -8
- package/PhoneNumberInput/index.d.ts +4 -3
- package/PhoneNumberInput/index.js +15 -4
- package/README.md +428 -3
- package/Sidebar/SidebarItem.d.ts +3 -0
- package/Sidebar/SidebarItem.js +62 -0
- package/Sidebar/SidebarItemsGroup.d.ts +5 -0
- package/Sidebar/SidebarItemsGroup.js +38 -0
- package/Sidebar/SidebarLink.d.ts +3 -0
- package/Sidebar/SidebarLink.js +37 -0
- package/Sidebar/index.d.ts +7 -0
- package/Sidebar/index.js +30 -0
- package/Sidebar/types.d.ts +31 -0
- package/Sidebar/types.js +1 -0
- package/SocialInput/index.d.ts +6 -0
- package/SocialInput/index.js +77 -0
- package/SocialInput/types.d.ts +9 -0
- package/SocialInput/types.js +1 -0
- package/SocialInput/useInteractions.d.ts +10 -0
- package/SocialInput/useInteractions.js +26 -0
- package/TabGroup/index.js +10 -5
- package/TablePagination/Actions.d.ts +3 -0
- package/TablePagination/Actions.js +27 -0
- package/TablePagination/index.d.ts +4 -0
- package/TablePagination/index.js +30 -0
- package/TablePagination/types.d.ts +14 -0
- package/TablePagination/types.js +1 -0
- package/TablePagination/useInteractions.d.ts +14 -0
- package/TablePagination/useInteractions.js +23 -0
- package/TextInput/index.d.ts +2 -3
- package/TextInput/index.js +13 -3
- package/ToastPrompt/Presentation.js +3 -3
- package/ToastPrompt/index.js +1 -1
- package/VideoPlayerModal/index.d.ts +1 -3
- package/VideoPlayerModal/index.js +2 -2
- package/VideoPlayerModal/types.d.ts +2 -1
- package/index.d.ts +20 -0
- package/index.js +20 -0
- package/package.json +8 -2
package/NumberInput/index.js
CHANGED
@@ -36,6 +36,6 @@ function NumberInput(props) {
|
|
36
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
37
|
onCloseTooltip();
|
38
38
|
handleBlur();
|
39
|
-
}, onChange: handleChange, error: error || exceedError, helperText: helperText || (exceedError ? EXCEED_ERROR : "") }, rest)
|
39
|
+
}, onChange: handleChange, error: error || exceedError, helperText: helperText || (exceedError ? EXCEED_ERROR : "") }, rest)) })) })));
|
40
40
|
}
|
41
41
|
export default NumberInput;
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import { CSSProperties } from "react";
|
2
2
|
import { TextFieldProps } from "@mui/material/TextField";
|
3
|
-
|
4
|
-
export interface ConfirmPasswordProps {
|
3
|
+
export interface ConfirmPasswordProps extends Omit<TextFieldProps, "onChange"> {
|
5
4
|
password: string;
|
6
5
|
value: string;
|
7
6
|
primaryColor?: CSSProperties["color"];
|
8
7
|
secondaryColor?: CSSProperties["color"];
|
9
8
|
onChange: (value: string) => void;
|
10
9
|
}
|
11
|
-
declare function ConfirmPassword(props: ConfirmPasswordProps
|
10
|
+
declare function ConfirmPassword(props: ConfirmPasswordProps): JSX.Element;
|
12
11
|
export default ConfirmPassword;
|
@@ -36,6 +36,6 @@ function ConfirmPassword(props) {
|
|
36
36
|
}, [value, password]);
|
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
38
|
onChange(event.target.value);
|
39
|
-
}, fullWidth: true, required: true }, rest)
|
39
|
+
}, fullWidth: true, required: true }, rest)) })));
|
40
40
|
}
|
41
41
|
export default ConfirmPassword;
|
@@ -1,20 +1,20 @@
|
|
1
1
|
import { CSSProperties } from "react";
|
2
2
|
import { TextFieldProps } from "@mui/material/TextField";
|
3
|
-
declare type TextInputProps = Omit<TextFieldProps, "onChange">;
|
4
3
|
export interface PasswordStrategyProps {
|
5
4
|
[key: string]: {
|
6
5
|
label: string;
|
7
6
|
regex: RegExp;
|
8
7
|
};
|
9
8
|
}
|
10
|
-
export interface PasswordProps {
|
11
|
-
strategies
|
9
|
+
export interface PasswordProps extends Omit<TextFieldProps, "onChange"> {
|
10
|
+
strategies?: PasswordStrategyProps;
|
12
11
|
value: string;
|
13
12
|
successColor?: CSSProperties["color"];
|
14
13
|
primaryColor?: CSSProperties["color"];
|
15
14
|
secondaryColor?: CSSProperties["color"];
|
16
15
|
onChange: (value: string) => void;
|
17
|
-
|
16
|
+
onValidate?: (value: string) => boolean;
|
18
17
|
}
|
19
|
-
declare function
|
18
|
+
export declare function onValidatePassword(password: string): boolean;
|
19
|
+
declare function Password(props: PasswordProps): JSX.Element;
|
20
20
|
export default Password;
|
@@ -26,6 +26,10 @@ import TextField from "@mui/material/TextField";
|
|
26
26
|
import Typography from "@mui/material/Typography";
|
27
27
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
28
28
|
import useCustomTheme from "../useCustomTheme";
|
29
|
+
export function onValidatePassword(password) {
|
30
|
+
var reg = /^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~])([!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~a-zA-z0-9]{8,})$/;
|
31
|
+
return reg.test(password);
|
32
|
+
}
|
29
33
|
function Password(props) {
|
30
34
|
var _a = props.strategies, strategies = _a === void 0 ? {
|
31
35
|
uppercaseLetter: { label: "1 Uppercase Letter", regex: /[A-Z]+/ },
|
@@ -36,17 +40,14 @@ function Password(props) {
|
|
36
40
|
},
|
37
41
|
number: { label: "1 Number", regex: /\d+/ },
|
38
42
|
minimum8: { label: "Minimum 8 characters", regex: /.{8,}/ }
|
39
|
-
} : _a, _b = props.successColor, successColor = _b === void 0 ? "green" : _b, value = props.value, error = props.error, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor,
|
40
|
-
var reg = /^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~])([!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~a-zA-z0-9]{8,})$/;
|
41
|
-
return reg.test(password);
|
42
|
-
} : _c, onChange = props.onChange, rest = __rest(props, ["strategies", "successColor", "value", "error", "primaryColor", "secondaryColor", "onVerify", "onChange"]);
|
43
|
+
} : _a, _b = props.successColor, successColor = _b === void 0 ? "green" : _b, value = props.value, error = props.error, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onValidate = props.onValidate, onChange = props.onChange, rest = __rest(props, ["strategies", "successColor", "value", "error", "primaryColor", "secondaryColor", "onValidate", "onChange"]);
|
43
44
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
44
45
|
var isValidPassword = useMemo(function () {
|
45
46
|
if ((value === null || value === void 0 ? void 0 : value.length) > 0) {
|
46
|
-
return
|
47
|
+
return onValidate ? onValidate(value) : onValidatePassword(value);
|
47
48
|
}
|
48
49
|
return true;
|
49
|
-
}, [value,
|
50
|
+
}, [value, onValidate, onValidatePassword]);
|
50
51
|
var helperTextColor = useMemo(function () {
|
51
52
|
var textColors = Object.keys(strategies).reduce(function (temp, key) {
|
52
53
|
var regex = strategies[key].regex;
|
@@ -67,10 +68,10 @@ function Password(props) {
|
|
67
68
|
return (_jsx(_Fragment, { children: Object.keys(strategies).map(function (key) {
|
68
69
|
var label = strategies[key].label;
|
69
70
|
return (_jsx(Typography, __assign({ component: "li", variant: "caption", style: { color: helperTextColor[key] } }, { children: label }), key));
|
70
|
-
}) }
|
71
|
+
}) }));
|
71
72
|
}, [helperTextColor, strategies]);
|
72
73
|
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
74
|
onChange(event.target.value);
|
74
|
-
}, fullWidth: true, required: true }, rest)
|
75
|
+
}, fullWidth: true, required: true }, rest)) })));
|
75
76
|
}
|
76
77
|
export default Password;
|
@@ -1,14 +1,15 @@
|
|
1
1
|
import { CSSProperties } from "react";
|
2
2
|
import { InputProps } from "@mui/material/Input";
|
3
3
|
import { TextFieldProps } from "@mui/material/TextField";
|
4
|
-
|
5
|
-
export interface PhoneInputProps {
|
4
|
+
export interface PhoneInputProps extends Omit<TextFieldProps, "onChange"> {
|
6
5
|
value: string;
|
7
6
|
endAdornment?: InputProps["endAdornment"];
|
8
7
|
primaryColor?: CSSProperties["color"];
|
9
8
|
secondaryColor?: CSSProperties["color"];
|
10
9
|
onChange: (val: string) => void;
|
10
|
+
onValidate?: (val: string) => boolean;
|
11
11
|
}
|
12
|
+
export declare function onValidatePhone(str: string): boolean;
|
12
13
|
export declare function phoneFormat(str: string): string;
|
13
|
-
declare function PhoneInput(props:
|
14
|
+
declare function PhoneInput(props: PhoneInputProps): JSX.Element;
|
14
15
|
export default PhoneInput;
|
@@ -28,6 +28,10 @@ import TextField from "@mui/material/TextField";
|
|
28
28
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
29
29
|
import useInteractions from "./useInteractions";
|
30
30
|
import useCustomTheme from "../useCustomTheme";
|
31
|
+
export function onValidatePhone(str) {
|
32
|
+
var reg = /^\(\d{3}\)\s?\d{3}\s?-\s?\d{4}$/g;
|
33
|
+
return reg.test(str);
|
34
|
+
}
|
31
35
|
export function phoneFormat(str) {
|
32
36
|
var digits = (str.match(/\d+/g) || []).join("");
|
33
37
|
var chars = digits.split("");
|
@@ -44,9 +48,9 @@ export function phoneFormat(str) {
|
|
44
48
|
}, "(");
|
45
49
|
}
|
46
50
|
function PhoneInput(props) {
|
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"]);
|
51
|
+
var value = props.value, error = props.error, endAdornment = props.endAdornment, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, _a = props.helperText, helperText = _a === void 0 ? "Please enter a valid phone number" : _a, onChange = props.onChange, onValidate = props.onValidate, rest = __rest(props, ["value", "error", "endAdornment", "primaryColor", "secondaryColor", "helperText", "onChange", "onValidate"]);
|
48
52
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
49
|
-
var
|
53
|
+
var _b = useInteractions({ value: value }), valLength = _b.valLength, addMask = _b.addMask;
|
50
54
|
var rifm = useRifm({
|
51
55
|
mask: true,
|
52
56
|
value: String(value),
|
@@ -55,8 +59,15 @@ function PhoneInput(props) {
|
|
55
59
|
format: phoneFormat
|
56
60
|
});
|
57
61
|
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" })
|
62
|
+
startAdornment: (_jsx(InputAdornment, __assign({ position: "start" }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "+1" })) }))),
|
59
63
|
endAdornment: endAdornment
|
60
|
-
}, onChange: rifm.onChange
|
64
|
+
}, onChange: rifm.onChange, helperText: valLength > 0 &&
|
65
|
+
(onValidate ? !onValidate(rifm.value) : !onValidatePhone(rifm.value))
|
66
|
+
? helperText
|
67
|
+
: "", error: error ||
|
68
|
+
(valLength > 0 &&
|
69
|
+
(onValidate
|
70
|
+
? !onValidate(rifm.value)
|
71
|
+
: !onValidatePhone(rifm.value))) }, rest)) })));
|
61
72
|
}
|
62
73
|
export default PhoneInput;
|