@symply.io/basic-components 1.0.0-beta.3 → 1.0.0-beta.4
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/DateInput/FullDateInput/index.d.ts +1 -1
- package/DateInput/FullDateInput/index.js +5 -3
- package/DateInput/FullDateInput/types.d.ts +1 -1
- package/DateInput/MonthDayInput/index.d.ts +1 -1
- package/DateInput/MonthDayInput/index.js +4 -4
- package/DateInput/MonthDayInput/types.d.ts +1 -1
- package/DateInput/MonthYearInput/index.d.ts +1 -1
- package/DateInput/MonthYearInput/index.js +4 -4
- package/DateInput/MonthYearInput/types.d.ts +1 -1
- package/FeinInput/index.d.ts +1 -1
- package/FeinInput/index.js +5 -3
- package/FeinInput/types.d.ts +1 -1
- package/PasswordInput/Password.d.ts +2 -1
- package/PasswordInput/Password.js +7 -6
- package/PhoneNumberInput/index.d.ts +2 -0
- package/PhoneNumberInput/index.js +14 -3
- package/README.md +30 -29
- package/SocialInput/index.d.ts +1 -1
- package/SocialInput/index.js +5 -4
- package/SocialInput/types.d.ts +1 -1
- package/package.json +1 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import { DateInputprops } from "./types";
|
2
2
|
export declare function MonthDayYearFormat(str: string): string;
|
3
|
-
export declare function
|
3
|
+
export declare function onValidateDate(dateString: string): boolean;
|
4
4
|
declare function FullDateInput(props: DateInputprops): JSX.Element;
|
5
5
|
export default FullDateInput;
|
@@ -30,7 +30,7 @@ export function MonthDayYearFormat(str) {
|
|
30
30
|
}
|
31
31
|
}, "");
|
32
32
|
}
|
33
|
-
export function
|
33
|
+
export function onValidateDate(dateString) {
|
34
34
|
var reg = /^((((0[1,3,5,7,8]{1})|(1[0,2]{1}))\s?\/\s?((0[1-9]{1})|([1-2]{1}\d{1})|(3[0-1]{1})))|(((0[4,6,9]{1})|(11))\s?\/\s?((0[1-9]{1})|([1-2]{1}\d{1})|(30)))|((02)\s?\/\s?(0[1-9]{1}|[1-2]{1}\d{1})))\s?\/\s?\d{4}$/g;
|
35
35
|
if (reg.test(dateString)) {
|
36
36
|
var tmpArr = dateString.split("/");
|
@@ -46,7 +46,7 @@ export function verifyDate(dateString) {
|
|
46
46
|
return false;
|
47
47
|
}
|
48
48
|
function FullDateInput(props) {
|
49
|
-
var name = props.name, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, value = props.value, _a = props.margin, margin = _a === void 0 ? "normal" : _a, error = props.error, _b = props.helperText, helperText = _b === void 0 ? "Please enter a valid date" : _b,
|
49
|
+
var name = props.name, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, value = props.value, _a = props.margin, margin = _a === void 0 ? "normal" : _a, error = props.error, _b = props.helperText, helperText = _b === void 0 ? "Please enter a valid date" : _b, onValidate = props.onValidate, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
|
50
50
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
51
51
|
var _c = useInteractions({ value: value }), valLength = _c.valLength, addMask = _c.addMask;
|
52
52
|
var rifm = useRifm({
|
@@ -57,7 +57,9 @@ function FullDateInput(props) {
|
|
57
57
|
format: MonthDayYearFormat
|
58
58
|
});
|
59
59
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, { placeholder: "MM / DD / YYYY", error: error ||
|
60
|
-
(valLength > 0 &&
|
60
|
+
(valLength > 0 &&
|
61
|
+
(onValidate ? !onValidate(value) : !onValidateDate(value))), margin: margin, name: name, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 &&
|
62
|
+
(onValidate ? !onValidate(value) : !onValidateDate(value))
|
61
63
|
? helperText
|
62
64
|
: "", onFocus: onFocus, onBlur: onBlur, InputLabelProps: {
|
63
65
|
shrink: true
|
@@ -4,7 +4,7 @@ export interface DateInputprops {
|
|
4
4
|
onChange: (value: string) => void;
|
5
5
|
onFocus?: () => void;
|
6
6
|
onBlur?: () => void;
|
7
|
-
|
7
|
+
onValidate?: (value?: string) => boolean;
|
8
8
|
helperText?: string;
|
9
9
|
margin?: "none" | "normal" | "dense" | undefined;
|
10
10
|
error?: boolean;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { DateInputprops } from "./types";
|
2
2
|
export declare function MonthDayFormat(str: string): string;
|
3
|
-
export declare function
|
3
|
+
export declare function onValidateMonthDay(monthDayString: string): boolean;
|
4
4
|
declare function MonthDayInput(props: DateInputprops): JSX.Element;
|
5
5
|
export default MonthDayInput;
|
@@ -27,12 +27,12 @@ export function MonthDayFormat(str) {
|
|
27
27
|
}
|
28
28
|
}, "");
|
29
29
|
}
|
30
|
-
export function
|
30
|
+
export function onValidateMonthDay(monthDayString) {
|
31
31
|
var reg = /^((((0[1,3,5,7,8]{1})|(1[0,2]{1}))\s?\/\s?((0[1-9]{1})|([1-2]{1}\d{1})|(3[0-1]{1})))|(((0[4,6,9]{1})|(11))\s?\/\s?((0[1-9]{1})|([1-2]{1}\d{1})|(30)))|((02)\s?\/\s?(0[1-9]{1})|([1-2]{1}\d{1})))$/g;
|
32
32
|
return reg.test(monthDayString);
|
33
33
|
}
|
34
34
|
function MonthDayInput(props) {
|
35
|
-
var name = props.name, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, value = props.value, _a = props.margin, margin = _a === void 0 ? "normal" : _a, error = props.error, _b = props.helperText, helperText = _b === void 0 ? "Please enter a valid date" : _b,
|
35
|
+
var name = props.name, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, value = props.value, _a = props.margin, margin = _a === void 0 ? "normal" : _a, error = props.error, _b = props.helperText, helperText = _b === void 0 ? "Please enter a valid date" : _b, onValidate = props.onValidate, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
|
36
36
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
37
37
|
var _c = useInteractions({ value: value }), valLength = _c.valLength, addMask = _c.addMask;
|
38
38
|
var rifm = useRifm({
|
@@ -44,8 +44,8 @@ function MonthDayInput(props) {
|
|
44
44
|
});
|
45
45
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, { placeholder: "MM / DD", error: error ||
|
46
46
|
(valLength > 0 &&
|
47
|
-
(
|
48
|
-
(
|
47
|
+
(onValidate ? !onValidate(value) : !onValidateMonthDay(value))), margin: margin, name: name, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 &&
|
48
|
+
(onValidate ? !onValidate(value) : !onValidateMonthDay(value))
|
49
49
|
? helperText
|
50
50
|
: "", onFocus: onFocus, onBlur: onBlur, InputLabelProps: {
|
51
51
|
shrink: true
|
@@ -4,7 +4,7 @@ export interface DateInputprops {
|
|
4
4
|
onChange: (value: string) => void;
|
5
5
|
onFocus?: () => void;
|
6
6
|
onBlur?: () => void;
|
7
|
-
|
7
|
+
onValidate?: (value?: string) => boolean;
|
8
8
|
helperText?: string;
|
9
9
|
margin?: "none" | "normal" | "dense" | undefined;
|
10
10
|
error?: boolean;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { DateInputprops } from "./types";
|
2
2
|
export declare function MonthYearFormat(str: string): string;
|
3
|
-
export declare function
|
3
|
+
export declare function onValidateMonthYear(monthYearString: string): boolean;
|
4
4
|
declare function MonthYearInput(props: DateInputprops): JSX.Element;
|
5
5
|
export default MonthYearInput;
|
@@ -27,13 +27,13 @@ export function MonthYearFormat(str) {
|
|
27
27
|
}
|
28
28
|
}, "");
|
29
29
|
}
|
30
|
-
export function
|
30
|
+
export function onValidateMonthYear(monthYearString) {
|
31
31
|
var reg = /^(((0[1-9]{1})|(1[0-2]{1}))\s?\/\s?([1-2]{1}\d{3}))$/g;
|
32
32
|
reg.lastIndex = 0;
|
33
33
|
return reg.test(monthYearString);
|
34
34
|
}
|
35
35
|
function MonthYearInput(props) {
|
36
|
-
var name = props.name, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, value = props.value, _a = props.margin, margin = _a === void 0 ? "normal" : _a, error = props.error, _b = props.helperText, helperText = _b === void 0 ? "Please enter a valid date" : _b,
|
36
|
+
var name = props.name, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, value = props.value, _a = props.margin, margin = _a === void 0 ? "normal" : _a, error = props.error, _b = props.helperText, helperText = _b === void 0 ? "Please enter a valid date" : _b, onValidate = props.onValidate, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
|
37
37
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
38
38
|
var _c = useInteractions({ value: value }), valLength = _c.valLength, addMask = _c.addMask;
|
39
39
|
var rifm = useRifm({
|
@@ -45,8 +45,8 @@ function MonthYearInput(props) {
|
|
45
45
|
});
|
46
46
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, { placeholder: "MM / YYYY", error: error ||
|
47
47
|
(valLength > 0 &&
|
48
|
-
(
|
49
|
-
(
|
48
|
+
(onValidate ? !onValidate(value) : !onValidateMonthYear(value))), margin: margin, name: name, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 &&
|
49
|
+
(onValidate ? !onValidate(value) : !onValidateMonthYear(value))
|
50
50
|
? helperText
|
51
51
|
: "", onFocus: onFocus, onBlur: onBlur, InputLabelProps: {
|
52
52
|
shrink: true
|
@@ -4,7 +4,7 @@ export interface DateInputprops {
|
|
4
4
|
onChange: (value: string) => void;
|
5
5
|
onFocus?: () => void;
|
6
6
|
onBlur?: () => void;
|
7
|
-
|
7
|
+
onValidate?: (value?: string) => boolean;
|
8
8
|
helperText?: string;
|
9
9
|
margin?: "none" | "normal" | "dense" | undefined;
|
10
10
|
error?: boolean;
|
package/FeinInput/index.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { FeinInputProps } from "./types";
|
2
2
|
export declare function FeinInputFormat(str: string): string;
|
3
|
-
export declare function
|
3
|
+
export declare function onValidateFein(feinString: string): boolean;
|
4
4
|
declare function FeinInput(props: FeinInputProps): JSX.Element;
|
5
5
|
export default FeinInput;
|
6
6
|
export * from "./types";
|
package/FeinInput/index.js
CHANGED
@@ -38,12 +38,12 @@ export function FeinInputFormat(str) {
|
|
38
38
|
}
|
39
39
|
}, "");
|
40
40
|
}
|
41
|
-
export function
|
41
|
+
export function onValidateFein(feinString) {
|
42
42
|
var reg = /^\d{2}\s?-\s?\d{7}$/g;
|
43
43
|
return reg.test(feinString);
|
44
44
|
}
|
45
45
|
function FeinInput(props) {
|
46
|
-
var value = props.value, _a = props.error, error = _a === void 0 ? false : _a, _b = props.helperText, helperText = _b === void 0 ? "Please enter a valid FEIN" : _b,
|
46
|
+
var value = props.value, _a = props.error, error = _a === void 0 ? false : _a, _b = props.helperText, helperText = _b === void 0 ? "Please enter a valid FEIN" : _b, onBlur = props.onBlur, onFocus = props.onFocus, onChange = props.onChange, onValidate = props.onValidate, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["value", "error", "helperText", "onBlur", "onFocus", "onChange", "onValidate", "primaryColor", "secondaryColor"]);
|
47
47
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
48
48
|
var _c = useInteractions({ value: value }), valLength = _c.valLength, addMask = _c.addMask;
|
49
49
|
var rifm = useRifm({
|
@@ -54,7 +54,9 @@ function FeinInput(props) {
|
|
54
54
|
format: FeinInputFormat
|
55
55
|
});
|
56
56
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ value: rifm.value, onChange: rifm.onChange, error: error ||
|
57
|
-
(valLength > 0 &&
|
57
|
+
(valLength > 0 &&
|
58
|
+
(onValidate ? !onValidate(value) : onValidateFein(value))), helperText: valLength > 0 &&
|
59
|
+
(onValidate ? !onValidate(value) : onValidateFein(value))
|
58
60
|
? helperText
|
59
61
|
: "", onFocus: function (event) {
|
60
62
|
if (onFocus) {
|
package/FeinInput/types.d.ts
CHANGED
@@ -2,7 +2,7 @@ import { CSSProperties } from "react";
|
|
2
2
|
import { TextFieldProps } from "@mui/material/TextField";
|
3
3
|
export interface FeinInputProps extends Omit<TextFieldProps, "onChange"> {
|
4
4
|
onChange: (value: string) => void;
|
5
|
-
|
5
|
+
onValidate?: (value?: string) => boolean;
|
6
6
|
value: string;
|
7
7
|
primaryColor?: CSSProperties["color"];
|
8
8
|
secondaryColor?: CSSProperties["color"];
|
@@ -13,7 +13,8 @@ export interface PasswordProps extends Omit<TextFieldProps, "onChange"> {
|
|
13
13
|
primaryColor?: CSSProperties["color"];
|
14
14
|
secondaryColor?: CSSProperties["color"];
|
15
15
|
onChange: (value: string) => void;
|
16
|
-
|
16
|
+
onValidate?: (value: string) => boolean;
|
17
17
|
}
|
18
|
+
export declare function onValidatePassword(password: string): boolean;
|
18
19
|
declare function Password(props: PasswordProps): JSX.Element;
|
19
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;
|
@@ -7,7 +7,9 @@ export interface PhoneInputProps extends Omit<TextFieldProps, "onChange"> {
|
|
7
7
|
primaryColor?: CSSProperties["color"];
|
8
8
|
secondaryColor?: CSSProperties["color"];
|
9
9
|
onChange: (val: string) => void;
|
10
|
+
onValidate?: (val: string) => boolean;
|
10
11
|
}
|
12
|
+
export declare function onValidatePhone(str: string): boolean;
|
11
13
|
export declare function phoneFormat(str: string): string;
|
12
14
|
declare function PhoneInput(props: PhoneInputProps): JSX.Element;
|
13
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),
|
@@ -57,6 +61,13 @@ function PhoneInput(props) {
|
|
57
61
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ value: rifm.value, InputProps: {
|
58
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;
|
package/README.md
CHANGED
@@ -116,7 +116,7 @@ import { Autocomplete } from '@symply.io/basic-components/';
|
|
116
116
|
import Autocomplete from '@symply.io/basic-components/Autocomplete';
|
117
117
|
```
|
118
118
|
|
119
|
-
<h5>Option Props (
|
119
|
+
<h5>Option Props (IOption)</h5>
|
120
120
|
|
121
121
|
| Name | Type | Default | Required | Description |
|
122
122
|
| ------ | ------- | ------- | -------- | -------------------------- |
|
@@ -125,12 +125,12 @@ import Autocomplete from '@symply.io/basic-components/Autocomplete';
|
|
125
125
|
|
126
126
|
<h5>Props</h5>
|
127
127
|
|
128
|
-
| Name | Type
|
129
|
-
| -------- |
|
130
|
-
| multiple | bool
|
131
|
-
| onChange | func
|
132
|
-
| options | Array
|
133
|
-
| value |
|
128
|
+
| Name | Type | Default | Required | Description |
|
129
|
+
| -------- | ---------------------- | ------- | -------- | ------------------------------------------------------------ |
|
130
|
+
| multiple | bool | false | false | If `true`, `value` must be an array and the menu will support multiple selections. |
|
131
|
+
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: Array<IOption|string>|IOption|string|null) => void`<br/>*value:* The value of the `Input` element. |
|
132
|
+
| options | Array<IOption\|string> | | true | Array of suggestion options. |
|
133
|
+
| value | string | | true | The value of the `Input` element. |
|
134
134
|
|
135
135
|
|
136
136
|
|
@@ -148,7 +148,7 @@ import { AutocompleteWithFilter } from '@symply.io/basic-components/';
|
|
148
148
|
import AutocompleteWithFilter from '@symply.io/basic-components/AutocompleteWithFilter';
|
149
149
|
```
|
150
150
|
|
151
|
-
<h5>Option Props (
|
151
|
+
<h5>Option Props (IOption)</h5>
|
152
152
|
|
153
153
|
| Name | Type | Default | Required | Description |
|
154
154
|
| ------ | ------- | ------- | -------- | -------------------------- |
|
@@ -157,13 +157,13 @@ import AutocompleteWithFilter from '@symply.io/basic-components/AutocompleteWith
|
|
157
157
|
|
158
158
|
<h5>Props</h5>
|
159
159
|
|
160
|
-
| Name | Type
|
161
|
-
| -------------------- |
|
162
|
-
| disableCloseOnSelect | bool
|
163
|
-
| multiple | bool
|
164
|
-
| onChange | func
|
165
|
-
| options | Array
|
166
|
-
| value |
|
160
|
+
| Name | Type | Default | Required | Description |
|
161
|
+
| -------------------- | ---------------------- | ------- | -------- | ------------------------------------------------------------ |
|
162
|
+
| disableCloseOnSelect | bool | false | false | If `true`, the popup won't close when a value is selected. |
|
163
|
+
| multiple | bool | false | false | If `true`, `value` must be an array and the menu will support multiple selections. |
|
164
|
+
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: Array<IOption|string>|IOption|string|null) => void`<br/>*value:* The value of the `Input` element. |
|
165
|
+
| options | Array<IOption\|string> | | true | Array of suggestion options. |
|
166
|
+
| value | string | | true | The value of the `Input` element. |
|
167
167
|
|
168
168
|
|
169
169
|
|
@@ -311,8 +311,8 @@ import FullDateInput from '@symply.io/basic-components/DateInput/FullDateInput';
|
|
311
311
|
| onBlur | func | | false | Callback fired when the `input` is blurred. Notice that the first argument (event) might be undefined. |
|
312
312
|
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
313
313
|
| onFocus | func | | false | Callback fired when the `input` is focused. |
|
314
|
+
| onValidate | func | | false | Customized validation function. |
|
314
315
|
| value | string | | true | The value of the `Input` element. |
|
315
|
-
| verifyFn | func | | false | Customized verification function. |
|
316
316
|
|
317
317
|
<h4>MonthDayInput</h4>
|
318
318
|
|
@@ -339,8 +339,8 @@ import MonthDayInput from '@symply.io/basic-components/DateInput/MonthDayInput';
|
|
339
339
|
| onBlur | func | | false | Callback fired when the `input` is blurred. Notice that the first argument (event) might be undefined. |
|
340
340
|
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
341
341
|
| onFocus | func | | false | Callback fired when the `input` is focused. |
|
342
|
+
| onValidate | func | | false | Customized validation function. |
|
342
343
|
| value | string | | true | The value of the `Input` element. |
|
343
|
-
| verifyFn | func | | false | Customized verification function. |
|
344
344
|
|
345
345
|
<h4>MonthYearInput</h4>
|
346
346
|
|
@@ -367,8 +367,8 @@ import MonthYearInput from '@symply.io/basic-components/DateInput/MonthYearInput
|
|
367
367
|
| onBlur | func | | false | Callback fired when the `input` is blurred. Notice that the first argument (event) might be undefined. |
|
368
368
|
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
369
369
|
| onFocus | func | | false | Callback fired when the `input` is focused. |
|
370
|
+
| onValidate | func | | false | Customized validation function. |
|
370
371
|
| value | string | | true | The value of the `Input` element. |
|
371
|
-
| verifyFn | func | | false | Customized verification function. |
|
372
372
|
|
373
373
|
|
374
374
|
|
@@ -415,11 +415,11 @@ import FeinInput from '@symply.io/basic-components/FeinInput';
|
|
415
415
|
|
416
416
|
<h5>Props</h5>
|
417
417
|
|
418
|
-
| Name
|
419
|
-
|
|
420
|
-
| onChange
|
421
|
-
|
|
422
|
-
|
|
418
|
+
| Name | Type | Default | Required | Description |
|
419
|
+
| ---------- | ------ | ------- | -------- | ------------------------------------------------------------ |
|
420
|
+
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
421
|
+
| onValidate | func | | false | Customized validation function. |
|
422
|
+
| value | string | | true | The value of the `Input` element. |
|
423
423
|
|
424
424
|
|
425
425
|
|
@@ -637,7 +637,7 @@ import { ConfirmPassword } from '@symply.io/basic-components/PasswordInput';
|
|
637
637
|
| Name | Type | Default | Required | Description |
|
638
638
|
| ------------ | -------------------------------------------------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ |
|
639
639
|
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
640
|
-
|
|
640
|
+
| onValidate | func | | false | Customized verify function when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
641
641
|
| strategies | { [key: string]: { label: string, regex: RegExp }} | {<br />uppercaseLetter: { label: "1 Uppercase Letter", regex: /[A-Z]+/ },<br />lowercaseLetter: { label: "1 Lowercase Letter", regex: /[a-z]+/ },<br />specialCharacter: { label: "1 Special Character", regex: /[!"#$%&'()*+,-./:;<=>?@[\]^_`{}~]/ },<br />number: { label: "1 Number", regex: /\d+/ },<br />minimum8: { label: "Minimum 8 characters", regex: /.{8,}/ }<br />} | false | The strategies of the password |
|
642
642
|
| successColor | Color | 'green' | false | The color of component when success. |
|
643
643
|
| value | string | | true | The password value. |
|
@@ -672,6 +672,7 @@ import PhoneNumberInput from '@symply.io/basic-components/PhoneNumberInput';
|
|
672
672
|
| ------------ | ------ | ------- | -------- | ------------------------------------------------------------ |
|
673
673
|
| endAdornment | node | | false | An end adornment element for the `Input` element. |
|
674
674
|
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
675
|
+
| onValidate | func | | false | Customized validation function. |
|
675
676
|
| value | string | | true | The value of the `Input` element. |
|
676
677
|
|
677
678
|
|
@@ -725,11 +726,11 @@ import SocialInput from '@symply.io/basic-components/SocialInput';
|
|
725
726
|
|
726
727
|
<h5>Props</h5>
|
727
728
|
|
728
|
-
| Name
|
729
|
-
|
|
730
|
-
| onChange
|
731
|
-
|
|
732
|
-
|
|
729
|
+
| Name | Type | Default | Required | Description |
|
730
|
+
| ---------- | ------ | ------- | -------- | ------------------------------------------------------------ |
|
731
|
+
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
732
|
+
| onValidate | func | | false | Customized validation function. |
|
733
|
+
| value | string | | true | The value of the `Input` element. |
|
733
734
|
|
734
735
|
|
735
736
|
|
package/SocialInput/index.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { SocialInputProps } from "./types";
|
2
2
|
export declare function SocialInputFormat(str: string): string;
|
3
|
-
export declare function
|
3
|
+
export declare function onValidateSocial(socialString: string): boolean;
|
4
4
|
declare function SocialInput(props: SocialInputProps): JSX.Element;
|
5
5
|
export default SocialInput;
|
6
6
|
export * from "./types";
|
package/SocialInput/index.js
CHANGED
@@ -45,12 +45,12 @@ export function SocialInputFormat(str) {
|
|
45
45
|
}
|
46
46
|
}, "");
|
47
47
|
}
|
48
|
-
export function
|
48
|
+
export function onValidateSocial(socialString) {
|
49
49
|
var reg = /^\d{3}\s?-\s?\d{2}\s?-\s?\d{4}$/g;
|
50
50
|
return reg.test(socialString);
|
51
51
|
}
|
52
52
|
function SocialInput(props) {
|
53
|
-
var value = props.value, _a = props.helperText, helperText = _a === void 0 ? "Please enter a valid SSN" : _a, error = props.error,
|
53
|
+
var value = props.value, _a = props.helperText, helperText = _a === void 0 ? "Please enter a valid SSN" : _a, error = props.error, onChange = props.onChange, onValidate = props.onValidate, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["value", "helperText", "error", "onChange", "onValidate", "primaryColor", "secondaryColor"]);
|
54
54
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
55
55
|
var _b = useInteractions({
|
56
56
|
value: value
|
@@ -62,11 +62,12 @@ function SocialInput(props) {
|
|
62
62
|
replace: addMask,
|
63
63
|
format: SocialInputFormat
|
64
64
|
});
|
65
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ helperText: valLength > 0 &&
|
65
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ helperText: valLength > 0 &&
|
66
|
+
(onValidate ? !onValidate(value) : !onValidateSocial(value))
|
66
67
|
? helperText
|
67
68
|
: "", value: rifm.value, onChange: rifm.onChange, type: visible ? "text" : "password", error: error ||
|
68
69
|
(valLength > 0 &&
|
69
|
-
(
|
70
|
+
(onValidate ? !onValidate(value) : !onValidateSocial(value))), InputProps: {
|
70
71
|
endAdornment: (_jsx(InputAdornment, __assign({ position: "end" }, { children: valLength === 9 && (_jsx(IconButton, __assign({ "aria-label": "Toggle SSN visibility", onClick: onSwitching }, { children: visible ? _jsx(Visibility, {}) : _jsx(VisibilityOff, {}) }))) })))
|
71
72
|
}, InputLabelProps: {
|
72
73
|
shrink: true
|
package/SocialInput/types.d.ts
CHANGED
@@ -2,7 +2,7 @@ import { CSSProperties } from "react";
|
|
2
2
|
import { TextFieldProps } from "@mui/material/TextField";
|
3
3
|
export interface SocialInputProps extends Omit<TextFieldProps, "onChange"> {
|
4
4
|
onChange: (value: string) => void;
|
5
|
-
|
5
|
+
onValidate?: (value?: string) => boolean;
|
6
6
|
value: string;
|
7
7
|
primaryColor?: CSSProperties["color"];
|
8
8
|
secondaryColor?: CSSProperties["color"];
|