@symply.io/basic-components 1.0.0-beta.1 → 1.0.0-beta.11

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.
Files changed (47) hide show
  1. package/Autocomplete/index.d.ts +2 -2
  2. package/Autocomplete/types.d.ts +8 -9
  3. package/AutocompleteWithFilter/index.d.ts +2 -2
  4. package/AutocompleteWithFilter/index.js +3 -5
  5. package/AutocompleteWithFilter/types.d.ts +8 -9
  6. package/BasicModal/Content.js +5 -5
  7. package/BasicTable/TableBody.d.ts +4 -0
  8. package/BasicTable/TableBody.js +50 -0
  9. package/BasicTable/TableBodyRow.d.ts +3 -0
  10. package/BasicTable/TableBodyRow.js +43 -0
  11. package/BasicTable/TableFooter.d.ts +3 -0
  12. package/BasicTable/TableFooter.js +45 -0
  13. package/BasicTable/TableHeader.d.ts +3 -0
  14. package/BasicTable/TableHeader.js +48 -0
  15. package/BasicTable/index.d.ts +5 -0
  16. package/BasicTable/index.js +80 -0
  17. package/BasicTable/types.d.ts +73 -0
  18. package/BasicTable/types.js +1 -0
  19. package/BasicTable/useScroll.d.ts +9 -0
  20. package/BasicTable/useScroll.js +76 -0
  21. package/BasicTable/useTable.d.ts +47 -0
  22. package/BasicTable/useTable.js +94 -0
  23. package/DateInput/FullDateInput/index.d.ts +1 -1
  24. package/DateInput/FullDateInput/index.js +19 -6
  25. package/DateInput/FullDateInput/types.d.ts +3 -8
  26. package/DateInput/MonthDayInput/index.d.ts +1 -1
  27. package/DateInput/MonthDayInput/index.js +18 -7
  28. package/DateInput/MonthDayInput/types.d.ts +3 -8
  29. package/DateInput/MonthYearInput/index.d.ts +1 -1
  30. package/DateInput/MonthYearInput/index.js +18 -7
  31. package/DateInput/MonthYearInput/types.d.ts +3 -8
  32. package/DynamicHeaderBar/HeaderButtons.js +2 -2
  33. package/DynamicHeaderBar/types.d.ts +3 -0
  34. package/FeinInput/index.d.ts +1 -1
  35. package/FeinInput/index.js +5 -3
  36. package/FeinInput/types.d.ts +1 -1
  37. package/PasswordInput/Password.d.ts +2 -1
  38. package/PasswordInput/Password.js +7 -6
  39. package/PhoneNumberInput/index.d.ts +2 -0
  40. package/PhoneNumberInput/index.js +14 -3
  41. package/README.md +75 -15
  42. package/SocialInput/index.d.ts +1 -1
  43. package/SocialInput/index.js +5 -4
  44. package/SocialInput/types.d.ts +1 -1
  45. package/index.d.ts +2 -0
  46. package/index.js +2 -0
  47. package/package.json +1 -1
@@ -0,0 +1,94 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import { cloneElement, useState, useMemo, useCallback } from "react";
25
+ function useTable(props) {
26
+ var data = props.data, columns = props.columns, initialState = props.initialState, disableSortBy = props.disableSortBy, onSort = props.onSort, rest = __rest(props, ["data", "columns", "initialState", "disableSortBy", "onSort"]);
27
+ if (!data) {
28
+ throw new Error('"data" is required but got null or undefined');
29
+ }
30
+ if (!columns) {
31
+ throw new Error('"columns" is required but got null or undefined');
32
+ }
33
+ var sortBy = (initialState || {}).sortBy;
34
+ var _a = sortBy || {}, id = _a.id, desc = _a.desc;
35
+ var _b = useState({
36
+ field: id || "",
37
+ isSorted: !!id,
38
+ descending: desc || false
39
+ }), sortingProps = _b[0], setSortingProps = _b[1];
40
+ var handleSort = useCallback(function (_a) {
41
+ var field = _a.field;
42
+ if (!disableSortBy) {
43
+ var newSortingProps = __assign({}, sortingProps);
44
+ if (field !== sortingProps.field || !sortingProps.isSorted) {
45
+ newSortingProps = { field: field, isSorted: true, descending: false };
46
+ }
47
+ else if (!sortingProps.descending) {
48
+ newSortingProps = __assign(__assign({}, sortingProps), { descending: true });
49
+ }
50
+ else {
51
+ newSortingProps = __assign(__assign({}, sortingProps), { isSorted: false });
52
+ }
53
+ if (onSort) {
54
+ onSort(__assign({}, newSortingProps));
55
+ }
56
+ setSortingProps(__assign({}, newSortingProps));
57
+ }
58
+ }, [disableSortBy, onSort, sortingProps]);
59
+ var renderSortingSymbol = useCallback(function (accessor) {
60
+ var field = sortingProps.field, isSorted = sortingProps.isSorted, descending = sortingProps.descending;
61
+ if (accessor !== field || !isSorted) {
62
+ return "";
63
+ }
64
+ if (!descending) {
65
+ return "↑";
66
+ }
67
+ return "↓";
68
+ }, [sortingProps]);
69
+ var rows = useMemo(function () { return data.map(function (d) { return d; }); }, [data]);
70
+ var cols = useMemo(function () {
71
+ return columns.map(function (col) {
72
+ var Body = col.Body;
73
+ return __assign(__assign({ Cell: cloneElement(Body || _jsx(_Fragment, {}), { column: col }) }, col), rest);
74
+ });
75
+ }, [columns, rest]);
76
+ var headers = useMemo(function () {
77
+ return columns.map(function (col) {
78
+ var Header = col.Header, accessor = col.accessor, canSort = col.canSort, headerTip = col.headerTip;
79
+ var canSortBy = canSort && !disableSortBy;
80
+ return __assign(__assign({ Cell: (_jsxs(_Fragment, { children: [cloneElement(Header || _jsx(_Fragment, {}), { column: col }), canSortBy && renderSortingSymbol(accessor)] })), title: "".concat(headerTip || "").concat(canSortBy ? " (Click to sort)" : ""), canSort: canSortBy, onSort: canSortBy ? handleSort : function () { } }, col), rest);
81
+ });
82
+ }, [columns, disableSortBy, handleSort, renderSortingSymbol, rest]);
83
+ var footers = useMemo(function () {
84
+ return columns.map(function (col) {
85
+ var Footer = col.Footer;
86
+ return __assign(__assign({ Cell: cloneElement(Footer || _jsx(_Fragment, {}), {
87
+ column: col,
88
+ rows: rows
89
+ }) }, col), rest);
90
+ });
91
+ }, [columns, rest, rows]);
92
+ return { headers: headers, footers: footers, columns: cols, rows: rows };
93
+ }
94
+ export default useTable;
@@ -1,5 +1,5 @@
1
1
  import { DateInputprops } from "./types";
2
2
  export declare function MonthDayYearFormat(str: string): string;
3
- export declare function verifyDate(dateString: string): boolean;
3
+ export declare function onValidateDate(dateString: string): boolean;
4
4
  declare function FullDateInput(props: DateInputprops): JSX.Element;
5
5
  export default FullDateInput;
@@ -9,6 +9,17 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
12
23
  import { jsx as _jsx } from "react/jsx-runtime";
13
24
  import { useRifm } from "rifm";
14
25
  import TextField from "@mui/material/TextField";
@@ -30,7 +41,7 @@ export function MonthDayYearFormat(str) {
30
41
  }
31
42
  }, "");
32
43
  }
33
- export function verifyDate(dateString) {
44
+ export function onValidateDate(dateString) {
34
45
  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
46
  if (reg.test(dateString)) {
36
47
  var tmpArr = dateString.split("/");
@@ -46,7 +57,7 @@ export function verifyDate(dateString) {
46
57
  return false;
47
58
  }
48
59
  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, verifyFn = props.verifyFn, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
60
+ var onChange = props.onChange, 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, rest = __rest(props, ["onChange", "value", "margin", "error", "helperText", "onValidate", "primaryColor", "secondaryColor"]);
50
61
  var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
51
62
  var _c = useInteractions({ value: value }), valLength = _c.valLength, addMask = _c.addMask;
52
63
  var rifm = useRifm({
@@ -56,11 +67,13 @@ function FullDateInput(props) {
56
67
  replace: addMask,
57
68
  format: MonthDayYearFormat
58
69
  });
59
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, { placeholder: "MM / DD / YYYY", error: error ||
60
- (valLength > 0 && (verifyFn ? !verifyFn(value) : !verifyDate(value))), margin: margin, name: name, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 && (verifyFn ? !verifyFn(value) : !verifyDate(value))
70
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ placeholder: "MM / DD / YYYY", error: error ||
71
+ (valLength > 0 &&
72
+ (onValidate ? !onValidate(value) : !onValidateDate(value))), margin: margin, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 &&
73
+ (onValidate ? !onValidate(value) : !onValidateDate(value))
61
74
  ? helperText
62
- : "", onFocus: onFocus, onBlur: onBlur, InputLabelProps: {
75
+ : "", InputLabelProps: {
63
76
  shrink: true
64
- } }) })));
77
+ } }, rest)) })));
65
78
  }
66
79
  export default FullDateInput;
@@ -1,13 +1,8 @@
1
1
  import { CSSProperties } from "react";
2
- export interface DateInputprops {
3
- name: string;
2
+ import { TextFieldProps } from "@mui/material/TextField";
3
+ export interface DateInputprops extends Omit<TextFieldProps, "onChange"> {
4
4
  onChange: (value: string) => void;
5
- onFocus?: () => void;
6
- onBlur?: () => void;
7
- verifyFn?: (value?: string) => boolean;
8
- helperText?: string;
9
- margin?: "none" | "normal" | "dense" | undefined;
10
- error?: boolean;
5
+ onValidate?: (value?: string) => boolean;
11
6
  value: string;
12
7
  primaryColor?: CSSProperties["color"];
13
8
  secondaryColor?: CSSProperties["color"];
@@ -1,5 +1,5 @@
1
1
  import { DateInputprops } from "./types";
2
2
  export declare function MonthDayFormat(str: string): string;
3
- export declare function verifyMonthDayDate(monthDayString: string): boolean;
3
+ export declare function onValidateMonthDay(monthDayString: string): boolean;
4
4
  declare function MonthDayInput(props: DateInputprops): JSX.Element;
5
5
  export default MonthDayInput;
@@ -9,6 +9,17 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
12
23
  import { jsx as _jsx } from "react/jsx-runtime";
13
24
  import { useRifm } from "rifm";
14
25
  import TextField from "@mui/material/TextField";
@@ -27,12 +38,12 @@ export function MonthDayFormat(str) {
27
38
  }
28
39
  }, "");
29
40
  }
30
- export function verifyMonthDayDate(monthDayString) {
41
+ export function onValidateMonthDay(monthDayString) {
31
42
  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
43
  return reg.test(monthDayString);
33
44
  }
34
45
  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, verifyFn = props.verifyFn, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
46
+ var onChange = props.onChange, 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, rest = __rest(props, ["onChange", "value", "margin", "error", "helperText", "onValidate", "primaryColor", "secondaryColor"]);
36
47
  var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
37
48
  var _c = useInteractions({ value: value }), valLength = _c.valLength, addMask = _c.addMask;
38
49
  var rifm = useRifm({
@@ -42,13 +53,13 @@ function MonthDayInput(props) {
42
53
  replace: addMask,
43
54
  format: MonthDayFormat
44
55
  });
45
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, { placeholder: "MM / DD", error: error ||
56
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ placeholder: "MM / DD", error: error ||
46
57
  (valLength > 0 &&
47
- (verifyFn ? !verifyFn(value) : !verifyMonthDayDate(value))), margin: margin, name: name, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 &&
48
- (verifyFn ? !verifyFn(value) : !verifyMonthDayDate(value))
58
+ (onValidate ? !onValidate(value) : !onValidateMonthDay(value))), margin: margin, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 &&
59
+ (onValidate ? !onValidate(value) : !onValidateMonthDay(value))
49
60
  ? helperText
50
- : "", onFocus: onFocus, onBlur: onBlur, InputLabelProps: {
61
+ : "", InputLabelProps: {
51
62
  shrink: true
52
- } }) })));
63
+ } }, rest)) })));
53
64
  }
54
65
  export default MonthDayInput;
@@ -1,13 +1,8 @@
1
1
  import { CSSProperties } from "react";
2
- export interface DateInputprops {
3
- name: string;
2
+ import { TextFieldProps } from "@mui/material/TextField";
3
+ export interface DateInputprops extends Omit<TextFieldProps, "onChange"> {
4
4
  onChange: (value: string) => void;
5
- onFocus?: () => void;
6
- onBlur?: () => void;
7
- verifyFn?: (value?: string) => boolean;
8
- helperText?: string;
9
- margin?: "none" | "normal" | "dense" | undefined;
10
- error?: boolean;
5
+ onValidate?: (value?: string) => boolean;
11
6
  value: string;
12
7
  primaryColor?: CSSProperties["color"];
13
8
  secondaryColor?: CSSProperties["color"];
@@ -1,5 +1,5 @@
1
1
  import { DateInputprops } from "./types";
2
2
  export declare function MonthYearFormat(str: string): string;
3
- export declare function verifyMonthYearDate(monthYearString: string): boolean;
3
+ export declare function onValidateMonthYear(monthYearString: string): boolean;
4
4
  declare function MonthYearInput(props: DateInputprops): JSX.Element;
5
5
  export default MonthYearInput;
@@ -9,6 +9,17 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
12
23
  import { jsx as _jsx } from "react/jsx-runtime";
13
24
  import { useRifm } from "rifm";
14
25
  import TextField from "@mui/material/TextField";
@@ -27,13 +38,13 @@ export function MonthYearFormat(str) {
27
38
  }
28
39
  }, "");
29
40
  }
30
- export function verifyMonthYearDate(monthYearString) {
41
+ export function onValidateMonthYear(monthYearString) {
31
42
  var reg = /^(((0[1-9]{1})|(1[0-2]{1}))\s?\/\s?([1-2]{1}\d{3}))$/g;
32
43
  reg.lastIndex = 0;
33
44
  return reg.test(monthYearString);
34
45
  }
35
46
  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, verifyFn = props.verifyFn, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
47
+ var onChange = props.onChange, 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, rest = __rest(props, ["onChange", "value", "margin", "error", "helperText", "onValidate", "primaryColor", "secondaryColor"]);
37
48
  var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
38
49
  var _c = useInteractions({ value: value }), valLength = _c.valLength, addMask = _c.addMask;
39
50
  var rifm = useRifm({
@@ -43,13 +54,13 @@ function MonthYearInput(props) {
43
54
  replace: addMask,
44
55
  format: MonthYearFormat
45
56
  });
46
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, { placeholder: "MM / YYYY", error: error ||
57
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ placeholder: "MM / YYYY", error: error ||
47
58
  (valLength > 0 &&
48
- (verifyFn ? !verifyFn(value) : !verifyMonthYearDate(value))), margin: margin, name: name, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 &&
49
- (verifyFn ? !verifyFn(value) : !verifyMonthYearDate(value))
59
+ (onValidate ? !onValidate(value) : !onValidateMonthYear(value))), margin: margin, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 &&
60
+ (onValidate ? !onValidate(value) : !onValidateMonthYear(value))
50
61
  ? helperText
51
- : "", onFocus: onFocus, onBlur: onBlur, InputLabelProps: {
62
+ : "", InputLabelProps: {
52
63
  shrink: true
53
- } }) })));
64
+ } }, rest)) })));
54
65
  }
55
66
  export default MonthYearInput;
@@ -1,13 +1,8 @@
1
1
  import { CSSProperties } from "react";
2
- export interface DateInputprops {
3
- name: string;
2
+ import { TextFieldProps } from "@mui/material/TextField";
3
+ export interface DateInputprops extends Omit<TextFieldProps, "onChange"> {
4
4
  onChange: (value: string) => void;
5
- onFocus?: () => void;
6
- onBlur?: () => void;
7
- verifyFn?: (value?: string) => boolean;
8
- helperText?: string;
9
- margin?: "none" | "normal" | "dense" | undefined;
10
- error?: boolean;
5
+ onValidate?: (value?: string) => boolean;
11
6
  value: string;
12
7
  primaryColor?: CSSProperties["color"];
13
8
  secondaryColor?: CSSProperties["color"];
@@ -29,8 +29,8 @@ function HeaderButtons(props) {
29
29
  return (_jsx(Grid, __assign({ item: true, xs: isLessThanSm ? 12 : undefined, style: { textAlign: "end" } }, { children: _jsx(Button, __assign({ fullWidth: isLessThanSm, variant: variant, onClick: onClick, color: color, size: isLessThanSm ? "small" : size, startIcon: startIcon, endIcon: endIcon, disabled: disabled }, { children: text })) }), text));
30
30
  }
31
31
  case HeaderButtonCategory.IconButton: {
32
- var title = button.title, onClick = button.onClick, color = button.color, _b = button.size, size = _b === void 0 ? "medium" : _b, icon = button.icon;
33
- return (_jsx(Grid, __assign({ item: true, style: { textAlign: "end" } }, { children: _jsx(Fab, __assign({ onClick: onClick, color: color, title: title, size: isLessThanSm ? "small" : size }, { children: icon })) }), title));
32
+ var title = button.title, onClick = button.onClick, color = button.color, _b = button.size, size = _b === void 0 ? "medium" : _b, icon = button.icon, disabled = button.disabled, variant = button.variant;
33
+ return (_jsx(Grid, __assign({ item: true, style: { textAlign: "end" } }, { children: _jsx(Fab, __assign({ onClick: onClick, color: color, title: title, size: isLessThanSm ? "small" : size, disabled: disabled, variant: variant }, { children: icon })) }), title));
34
34
  }
35
35
  case HeaderButtonCategory.MenuButton: {
36
36
  var btns = button.buttons, buttonText = button.buttonText, disabled = button.disabled, variant = button.variant, size = button.size;
@@ -1,6 +1,7 @@
1
1
  import { ReactElement } from "react";
2
2
  import { ButtonProps } from "@mui/material/Button";
3
3
  import { IconButtonProps } from "@mui/material/IconButton";
4
+ import { FabProps } from "@mui/material/Fab";
4
5
  import { MenuButtonGroupProps } from "../MenuButtonGroup";
5
6
  export declare enum HeaderButtonCategory {
6
7
  IconButton = "icon",
@@ -21,7 +22,9 @@ interface HeaderTextButtonProps {
21
22
  interface HeaderIconButtonProps {
22
23
  title: string;
23
24
  icon: ReactElement;
25
+ disabled?: boolean;
24
26
  type: HeaderButtonCategory.IconButton;
27
+ variant?: FabProps["variant"];
25
28
  color?: IconButtonProps["color"];
26
29
  size?: IconButtonProps["size"];
27
30
  onClick: IconButtonProps["onClick"];
@@ -1,6 +1,6 @@
1
1
  import { FeinInputProps } from "./types";
2
2
  export declare function FeinInputFormat(str: string): string;
3
- export declare function verifyFein(feinString: string): boolean;
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";
@@ -38,12 +38,12 @@ export function FeinInputFormat(str) {
38
38
  }
39
39
  }, "");
40
40
  }
41
- export function verifyFein(feinString) {
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, onChange = props.onChange, verifyFn = props.verifyFn, onFocus = props.onFocus, onBlur = props.onBlur, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["value", "error", "helperText", "onChange", "verifyFn", "onFocus", "onBlur", "primaryColor", "secondaryColor"]);
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 && (verifyFn ? !verifyFn(value) : verifyFein(value))), helperText: valLength > 0 && (verifyFn ? !verifyFn(value) : verifyFein(value))
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) {
@@ -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
- verifyFn?: (value?: string) => boolean;
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
- onVerify?: (value: string) => boolean;
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, _c = props.onVerify, onVerify = _c === void 0 ? function (password) {
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 onVerify(value);
47
+ return onValidate ? onValidate(value) : onValidatePassword(value);
47
48
  }
48
49
  return true;
49
- }, [value, onVerify]);
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 addMask = useInteractions({ value: value }).addMask;
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 }, rest)) })));
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;