@symply.io/basic-components 1.3.11-alpha.9 → 1.4.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/AlertDialog/index.d.ts +2 -2
  2. package/AlertDialog/index.js +30 -9
  3. package/AlertDialog/types.d.ts +3 -3
  4. package/Autocomplete/index.d.ts +2 -2
  5. package/Autocomplete/index.js +32 -11
  6. package/Autocomplete/types.d.ts +2 -2
  7. package/Autocomplete/useInteractions.js +3 -3
  8. package/AutocompleteWithFilter/index.d.ts +2 -2
  9. package/AutocompleteWithFilter/index.js +35 -13
  10. package/AutocompleteWithFilter/types.d.ts +5 -5
  11. package/BasicModal/Content.js +16 -5
  12. package/BasicModal/index.d.ts +2 -2
  13. package/BasicModal/index.js +31 -10
  14. package/BasicModal/types.d.ts +2 -2
  15. package/BreadCrumbs/index.d.ts +2 -2
  16. package/BreadCrumbs/index.js +19 -9
  17. package/BreadCrumbs/types.d.ts +1 -1
  18. package/CheckBox/index.d.ts +4 -3
  19. package/CheckBox/index.js +36 -3
  20. package/CheckBox/types.d.ts +2 -6
  21. package/CheckBoxGroup/index.d.ts +4 -0
  22. package/CheckBoxGroup/index.js +30 -0
  23. package/CheckBoxGroup/types.d.ts +5 -0
  24. package/CheckBoxGroup/types.js +1 -0
  25. package/ConfirmPasswordInput/index.d.ts +4 -0
  26. package/ConfirmPasswordInput/index.js +42 -0
  27. package/ConfirmPasswordInput/types.d.ts +9 -0
  28. package/ConfirmPasswordInput/types.js +1 -0
  29. package/Copyright/index.d.ts +2 -2
  30. package/Copyright/index.js +14 -4
  31. package/Copyright/types.d.ts +1 -1
  32. package/DataTable/TableBody.js +24 -2
  33. package/DataTable/TableBodyRow.js +52 -41
  34. package/DataTable/TableFooter.js +41 -30
  35. package/DataTable/TableHeader.js +47 -36
  36. package/DataTable/index.d.ts +2 -1
  37. package/DataTable/index.js +30 -18
  38. package/DataTable/useTable.js +54 -46
  39. package/DateInput/FullDateInput/index.js +42 -20
  40. package/DateInput/FullDateInput/useInteractions.js +10 -10
  41. package/DateInput/MonthDayInput/index.js +36 -14
  42. package/DateInput/MonthDayInput/useInteractions.js +9 -9
  43. package/DateInput/MonthYearInput/index.js +36 -14
  44. package/DateInput/MonthYearInput/useInteractions.js +9 -9
  45. package/DateInput/index.d.ts +4 -3
  46. package/DateInput/index.js +4 -3
  47. package/DigitInput/index.d.ts +2 -2
  48. package/DigitInput/index.js +28 -7
  49. package/DigitInput/types.d.ts +3 -3
  50. package/DigitInput/useInteractions.js +9 -9
  51. package/DynamicHeaderBar/HeaderBar.d.ts +1 -13
  52. package/DynamicHeaderBar/HeaderBar.js +17 -6
  53. package/DynamicHeaderBar/HeaderButtons.d.ts +1 -1
  54. package/DynamicHeaderBar/HeaderButtons.js +24 -13
  55. package/DynamicHeaderBar/HeaderLine.d.ts +1 -6
  56. package/DynamicHeaderBar/HeaderLine.js +2 -2
  57. package/DynamicHeaderBar/index.d.ts +1 -17
  58. package/DynamicHeaderBar/index.js +26 -18
  59. package/DynamicHeaderBar/types.d.ts +33 -5
  60. package/FeinInput/index.d.ts +2 -2
  61. package/FeinInput/index.js +38 -17
  62. package/FeinInput/types.d.ts +2 -2
  63. package/FeinInput/useInteractions.js +9 -9
  64. package/FileUploader/index.d.ts +2 -2
  65. package/FileUploader/index.js +33 -12
  66. package/FileUploader/useInteractions.js +44 -29
  67. package/FormRadioGroup/index.d.ts +2 -2
  68. package/FormRadioGroup/index.js +29 -5
  69. package/FormRadioGroup/types.d.ts +3 -4
  70. package/FormSelector/MultipleSelector.js +32 -9
  71. package/FormSelector/SimpleSelector.js +32 -9
  72. package/FormSelector/useInteractions.js +7 -7
  73. package/HelpCaption/index.d.ts +2 -2
  74. package/HelpCaption/index.js +17 -6
  75. package/HelpCaption/useInteractions.js +2 -2
  76. package/LoadingModal/Modal.js +15 -4
  77. package/LoadingModal/index.d.ts +2 -1
  78. package/LoadingModal/index.js +3 -1
  79. package/LoadingModal/useLoadingModal.d.ts +1 -1
  80. package/LoadingModal/useLoadingModal.js +34 -16
  81. package/MenuButtonGroup/MenuItem.js +14 -3
  82. package/MenuButtonGroup/index.js +82 -14
  83. package/NumberInput/index.js +27 -5
  84. package/NumberInput/useInteractions.js +17 -17
  85. package/PasswordInput/index.d.ts +6 -4
  86. package/PasswordInput/index.js +79 -4
  87. package/PasswordInput/{Password.d.ts → types.d.ts} +3 -6
  88. package/PasswordInput/types.js +1 -0
  89. package/PhoneNumberInput/index.js +39 -17
  90. package/PhoneNumberInput/useInteractions.js +10 -10
  91. package/README.md +4 -8
  92. package/Sidebar/SidebarItem.js +17 -6
  93. package/Sidebar/SidebarItemsGroup.js +21 -10
  94. package/Sidebar/SidebarLink.js +27 -5
  95. package/Sidebar/index.js +17 -6
  96. package/SocialInput/index.d.ts +2 -2
  97. package/SocialInput/index.js +40 -19
  98. package/SocialInput/useInteractions.js +14 -14
  99. package/TabGroup/index.d.ts +2 -2
  100. package/TabGroup/index.js +25 -15
  101. package/TablePagination/Actions.js +15 -4
  102. package/TablePagination/index.d.ts +2 -2
  103. package/TablePagination/index.js +14 -4
  104. package/TablePagination/useInteractions.js +9 -9
  105. package/TextInput/index.d.ts +1 -1
  106. package/TextInput/index.js +31 -9
  107. package/TextInput/useInteractions.js +4 -4
  108. package/ToastPrompt/Prompt.d.ts +4 -2
  109. package/ToastPrompt/Prompt.js +23 -55
  110. package/ToastPrompt/index.js +22 -8
  111. package/ToastPrompt/types.d.ts +10 -17
  112. package/ToastPrompt/useInteractions.d.ts +8 -8
  113. package/ToastPrompt/useInteractions.js +23 -16
  114. package/VideoPlayerModal/index.d.ts +2 -2
  115. package/VideoPlayerModal/index.js +27 -6
  116. package/index.d.ts +6 -0
  117. package/index.js +6 -0
  118. package/package.json +1 -2
  119. package/useCustomTheme.js +16 -11
  120. package/utils/uuid.js +11 -10
  121. package/CheckBox/CheckBox.d.ts +0 -3
  122. package/CheckBox/CheckBox.js +0 -14
  123. package/CheckBox/CheckBoxGroup.d.ts +0 -3
  124. package/CheckBox/CheckBoxGroup.js +0 -8
  125. package/PasswordInput/ConfirmPassword.d.ts +0 -11
  126. package/PasswordInput/ConfirmPassword.js +0 -20
  127. package/PasswordInput/Password.js +0 -56
@@ -1,40 +1,63 @@
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
+ };
1
23
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
24
  import { cloneElement, useState, useMemo, useCallback } from "react";
3
25
  function useTable(props) {
4
- const { data, columns, initialState, disableSortBy, onSort, ...rest } = 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"]);
5
27
  if (!data) {
6
28
  throw new Error('"data" is required but got null or undefined');
7
29
  }
8
30
  if (!columns) {
9
31
  throw new Error('"columns" is required but got null or undefined');
10
32
  }
11
- const { sortBy } = initialState || {};
12
- const { accessor, order } = sortBy || {};
13
- const [sortingProps, setSortingProps] = useState({
33
+ var sortBy = (initialState || {}).sortBy;
34
+ var _a = sortBy || {}, accessor = _a.accessor, order = _a.order;
35
+ var _b = useState({
14
36
  accessor: accessor || "",
15
37
  order: !!accessor ? order || "NONE" : "NONE"
16
- });
17
- const handleSort = useCallback(({ accessor }) => {
38
+ }), sortingProps = _b[0], setSortingProps = _b[1];
39
+ var handleSort = useCallback(function (_a) {
40
+ var accessor = _a.accessor;
18
41
  if (!disableSortBy) {
19
- let newSortingProps = { ...sortingProps };
42
+ var newSortingProps = __assign({}, sortingProps);
20
43
  if (accessor !== sortingProps.accessor ||
21
44
  sortingProps.order === "NONE") {
22
- newSortingProps = { accessor, order: "ASC" };
45
+ newSortingProps = { accessor: accessor, order: "ASC" };
23
46
  }
24
47
  else if (sortingProps.order === "ASC") {
25
- newSortingProps = { ...sortingProps, order: "DESC" };
48
+ newSortingProps = __assign(__assign({}, sortingProps), { order: "DESC" });
26
49
  }
27
50
  else {
28
- newSortingProps = { ...sortingProps, order: "NONE" };
51
+ newSortingProps = __assign(__assign({}, sortingProps), { order: "NONE" });
29
52
  }
30
53
  if (onSort) {
31
- onSort({ ...newSortingProps });
54
+ onSort(__assign({}, newSortingProps));
32
55
  }
33
- setSortingProps({ ...newSortingProps });
56
+ setSortingProps(__assign({}, newSortingProps));
34
57
  }
35
58
  }, [disableSortBy, onSort, sortingProps]);
36
- const renderSortingSymbol = useCallback((accessor) => {
37
- const { accessor: field, order } = sortingProps;
59
+ var renderSortingSymbol = useCallback(function (accessor) {
60
+ var field = sortingProps.accessor, order = sortingProps.order;
38
61
  if (accessor !== field || order === "NONE") {
39
62
  return "";
40
63
  }
@@ -43,44 +66,29 @@ function useTable(props) {
43
66
  }
44
67
  return "↓";
45
68
  }, [sortingProps]);
46
- const rows = useMemo(() => data.map(d => ({ ...d })), [data]);
47
- const cols = useMemo(() => {
48
- return columns.map(col => {
49
- const { Body } = col;
50
- return {
51
- Cell: cloneElement(Body || _jsx(_Fragment, {}), { column: col }),
52
- ...col,
53
- ...rest
54
- };
69
+ var rows = useMemo(function () { return data.map(function (d) { return (__assign({}, 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);
55
74
  });
56
75
  }, [columns, rest]);
57
- const headers = useMemo(() => {
58
- return columns.map(col => {
59
- const { Header, accessor, sortable, headerTip } = col;
60
- const canSortBy = sortable && !disableSortBy;
61
- return {
62
- Cell: (_jsxs(_Fragment, { children: [cloneElement(Header || _jsx(_Fragment, {}), { column: col }), canSortBy && renderSortingSymbol(accessor)] })),
63
- title: `${headerTip || ""}${canSortBy ? " (Click to sort)" : ""}`,
64
- sortable: canSortBy,
65
- onSort: canSortBy ? handleSort : () => { },
66
- ...col,
67
- ...rest
68
- };
76
+ var headers = useMemo(function () {
77
+ return columns.map(function (col) {
78
+ var Header = col.Header, accessor = col.accessor, sortable = col.sortable, headerTip = col.headerTip;
79
+ var canSortBy = sortable && !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)" : ""), sortable: canSortBy, onSort: canSortBy ? handleSort : function () { } }, col), rest);
69
81
  });
70
82
  }, [columns, disableSortBy, handleSort, renderSortingSymbol, rest]);
71
- const footers = useMemo(() => {
72
- return columns.map(col => {
73
- const { Footer } = col;
74
- return {
75
- Cell: cloneElement(Footer || _jsx(_Fragment, {}), {
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, {}), {
76
87
  column: col,
77
- rows
78
- }),
79
- ...col,
80
- ...rest
81
- };
88
+ rows: rows
89
+ }) }, col), rest);
82
90
  });
83
91
  }, [columns, rest, rows]);
84
- return { headers, footers, columns: cols, rows };
92
+ return { headers: headers, footers: footers, columns: cols, rows: rows };
85
93
  }
86
94
  export default useTable;
@@ -1,3 +1,25 @@
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
+ };
1
23
  import { jsx as _jsx } from "react/jsx-runtime";
2
24
  import { useRifm } from "rifm";
3
25
  import TextField from "@mui/material/TextField";
@@ -5,28 +27,28 @@ import ThemeProvider from "@mui/material/styles/ThemeProvider";
5
27
  import useInteractions from "./useInteractions";
6
28
  import useCustomTheme from "../../useCustomTheme";
7
29
  export function MonthDayYearFormat(str) {
8
- const digits = (str.match(/\d+/g) || []).join("");
9
- const chars = digits.split("");
10
- return chars.reduce((prev, curr, index) => {
30
+ var digits = (str.match(/\d+/g) || []).join("");
31
+ var chars = digits.split("");
32
+ return chars.reduce(function (prev, curr, index) {
11
33
  if (index === 2) {
12
- return `${prev} / ${curr}`;
34
+ return "".concat(prev, " / ").concat(curr);
13
35
  }
14
36
  else if (index === 4) {
15
- return `${prev} / ${curr}`;
37
+ return "".concat(prev, " / ").concat(curr);
16
38
  }
17
39
  else {
18
- return `${prev}${curr}`;
40
+ return "".concat(prev).concat(curr);
19
41
  }
20
- }, ``);
42
+ }, "");
21
43
  }
22
44
  export function onValidateDate(dateString) {
23
- const 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;
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;
24
46
  if (reg.test(dateString)) {
25
- const tmpArr = dateString.split("/");
26
- const month = parseInt(tmpArr[0].trim(), 10);
27
- const day = parseInt(tmpArr[1].trim(), 10);
28
- const year = parseInt(tmpArr[2].trim(), 10);
29
- const verifyLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
47
+ var tmpArr = dateString.split("/");
48
+ var month = parseInt(tmpArr[0].trim(), 10);
49
+ var day = parseInt(tmpArr[1].trim(), 10);
50
+ var year = parseInt(tmpArr[2].trim(), 10);
51
+ var verifyLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
30
52
  if (month === 2 && !verifyLeapYear) {
31
53
  return day < 29;
32
54
  }
@@ -35,23 +57,23 @@ export function onValidateDate(dateString) {
35
57
  return false;
36
58
  }
37
59
  function FullDateInput(props) {
38
- const { onChange, value, margin = "normal", error, helperText = "Please enter a valid date", onValidate, primaryColor, secondaryColor, ...rest } = props;
39
- const theme = useCustomTheme({ primaryColor, secondaryColor });
40
- const { valLength, addMask } = useInteractions({ value });
41
- const rifm = useRifm({
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"]);
61
+ var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
62
+ var _c = useInteractions({ value: value }), valLength = _c.valLength, addMask = _c.addMask;
63
+ var rifm = useRifm({
42
64
  mask: true,
43
65
  value: String(value),
44
- onChange,
66
+ onChange: onChange,
45
67
  replace: addMask,
46
68
  format: MonthDayYearFormat
47
69
  });
48
- return (_jsx(ThemeProvider, { theme: theme, children: _jsx(TextField, { placeholder: "MM / DD / YYYY", error: error ||
70
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ placeholder: "MM / DD / YYYY", error: error ||
49
71
  (valLength > 0 &&
50
72
  (onValidate ? !onValidate(value) : !onValidateDate(value))), margin: margin, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 &&
51
73
  (onValidate ? !onValidate(value) : !onValidateDate(value))
52
74
  ? helperText
53
75
  : "", InputLabelProps: {
54
76
  shrink: true
55
- }, ...rest }) }));
77
+ } }, rest)) })));
56
78
  }
57
79
  export default FullDateInput;
@@ -1,20 +1,20 @@
1
1
  import { useCallback, useMemo } from "react";
2
2
  function useInteractions(props) {
3
- const { value } = props;
4
- const addMask = useCallback((str) => {
5
- const digits = (str.match(/\d+/g) || []).join("");
6
- const month = digits.slice(0, 2).padEnd(2, "_");
7
- const day = digits.slice(2, 4).padEnd(2, "_");
8
- const Year = digits.slice(4, 8).padEnd(4, "_");
3
+ var value = props.value;
4
+ var addMask = useCallback(function (str) {
5
+ var digits = (str.match(/\d+/g) || []).join("");
6
+ var month = digits.slice(0, 2).padEnd(2, "_");
7
+ var day = digits.slice(2, 4).padEnd(2, "_");
8
+ var Year = digits.slice(4, 8).padEnd(4, "_");
9
9
  if (digits) {
10
- return `${month} / ${day} / ${Year}`;
10
+ return "".concat(month, " / ").concat(day, " / ").concat(Year);
11
11
  }
12
12
  return "";
13
13
  }, []);
14
- const valLength = useMemo(() => {
15
- const digitsArr = String(value).match(/\d/g);
14
+ var valLength = useMemo(function () {
15
+ var digitsArr = String(value).match(/\d/g);
16
16
  return digitsArr ? digitsArr.length : 0;
17
17
  }, [value]);
18
- return { valLength, addMask };
18
+ return { valLength: valLength, addMask: addMask };
19
19
  }
20
20
  export default useInteractions;
@@ -1,3 +1,25 @@
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
+ };
1
23
  import { jsx as _jsx } from "react/jsx-runtime";
2
24
  import { useRifm } from "rifm";
3
25
  import TextField from "@mui/material/TextField";
@@ -5,39 +27,39 @@ import ThemeProvider from "@mui/material/styles/ThemeProvider";
5
27
  import useInteractions from "./useInteractions";
6
28
  import useCustomTheme from "../../useCustomTheme";
7
29
  export function MonthDayFormat(str) {
8
- const digits = (str.match(/\d+/g) || []).join("");
9
- const chars = digits.split("");
10
- return chars.reduce((prev, curr, index) => {
30
+ var digits = (str.match(/\d+/g) || []).join("");
31
+ var chars = digits.split("");
32
+ return chars.reduce(function (prev, curr, index) {
11
33
  if (index === 2) {
12
- return `${prev} / ${curr}`;
34
+ return "".concat(prev, " / ").concat(curr);
13
35
  }
14
36
  else {
15
- return `${prev}${curr}`;
37
+ return "".concat(prev).concat(curr);
16
38
  }
17
- }, ``);
39
+ }, "");
18
40
  }
19
41
  export function onValidateMonthDay(monthDayString) {
20
- const 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;
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;
21
43
  return reg.test(monthDayString);
22
44
  }
23
45
  function MonthDayInput(props) {
24
- const { onChange, value, margin = "normal", error, helperText = "Please enter a valid date", onValidate, primaryColor, secondaryColor, ...rest } = props;
25
- const theme = useCustomTheme({ primaryColor, secondaryColor });
26
- const { valLength, addMask } = useInteractions({ value });
27
- const rifm = useRifm({
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"]);
47
+ var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
48
+ var _c = useInteractions({ value: value }), valLength = _c.valLength, addMask = _c.addMask;
49
+ var rifm = useRifm({
28
50
  mask: true,
29
51
  value: String(value),
30
- onChange,
52
+ onChange: onChange,
31
53
  replace: addMask,
32
54
  format: MonthDayFormat
33
55
  });
34
- return (_jsx(ThemeProvider, { 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 ||
35
57
  (valLength > 0 &&
36
58
  (onValidate ? !onValidate(value) : !onValidateMonthDay(value))), margin: margin, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 &&
37
59
  (onValidate ? !onValidate(value) : !onValidateMonthDay(value))
38
60
  ? helperText
39
61
  : "", InputLabelProps: {
40
62
  shrink: true
41
- }, ...rest }) }));
63
+ } }, rest)) })));
42
64
  }
43
65
  export default MonthDayInput;
@@ -1,19 +1,19 @@
1
1
  import { useCallback, useMemo } from "react";
2
2
  function useInteractions(props) {
3
- const { value } = props;
4
- const addMask = useCallback((str) => {
5
- const digits = (str.match(/\d+/g) || []).join("");
6
- const month = digits.slice(0, 2).padEnd(2, "_");
7
- const day = digits.slice(2, 4).padEnd(2, "_");
3
+ var value = props.value;
4
+ var addMask = useCallback(function (str) {
5
+ var digits = (str.match(/\d+/g) || []).join("");
6
+ var month = digits.slice(0, 2).padEnd(2, "_");
7
+ var day = digits.slice(2, 4).padEnd(2, "_");
8
8
  if (digits) {
9
- return `${month} / ${day}`;
9
+ return "".concat(month, " / ").concat(day);
10
10
  }
11
11
  return "";
12
12
  }, []);
13
- const valLength = useMemo(() => {
14
- const digitsArr = String(value).match(/\d/g);
13
+ var valLength = useMemo(function () {
14
+ var digitsArr = String(value).match(/\d/g);
15
15
  return digitsArr ? digitsArr.length : 0;
16
16
  }, [value]);
17
- return { valLength, addMask };
17
+ return { valLength: valLength, addMask: addMask };
18
18
  }
19
19
  export default useInteractions;
@@ -1,3 +1,25 @@
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
+ };
1
23
  import { jsx as _jsx } from "react/jsx-runtime";
2
24
  import { useRifm } from "rifm";
3
25
  import TextField from "@mui/material/TextField";
@@ -5,40 +27,40 @@ import ThemeProvider from "@mui/material/styles/ThemeProvider";
5
27
  import useInteractions from "./useInteractions";
6
28
  import useCustomTheme from "../../useCustomTheme";
7
29
  export function MonthYearFormat(str) {
8
- const digits = (str.match(/\d+/g) || []).join("");
9
- const chars = digits.split("");
10
- return chars.reduce((prev, curr, index) => {
30
+ var digits = (str.match(/\d+/g) || []).join("");
31
+ var chars = digits.split("");
32
+ return chars.reduce(function (prev, curr, index) {
11
33
  if (index === 2) {
12
- return `${prev} / ${curr}`;
34
+ return "".concat(prev, " / ").concat(curr);
13
35
  }
14
36
  else {
15
- return `${prev}${curr}`;
37
+ return "".concat(prev).concat(curr);
16
38
  }
17
- }, ``);
39
+ }, "");
18
40
  }
19
41
  export function onValidateMonthYear(monthYearString) {
20
- const reg = /^(((0[1-9]{1})|(1[0-2]{1}))\s?\/\s?([1-2]{1}\d{3}))$/g;
42
+ var reg = /^(((0[1-9]{1})|(1[0-2]{1}))\s?\/\s?([1-2]{1}\d{3}))$/g;
21
43
  reg.lastIndex = 0;
22
44
  return reg.test(monthYearString);
23
45
  }
24
46
  function MonthYearInput(props) {
25
- const { onChange, value, margin = "normal", error, helperText = "Please enter a valid date", onValidate, primaryColor, secondaryColor, ...rest } = props;
26
- const theme = useCustomTheme({ primaryColor, secondaryColor });
27
- const { valLength, addMask } = useInteractions({ value });
28
- const rifm = useRifm({
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"]);
48
+ var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
49
+ var _c = useInteractions({ value: value }), valLength = _c.valLength, addMask = _c.addMask;
50
+ var rifm = useRifm({
29
51
  mask: true,
30
52
  value: String(value),
31
- onChange,
53
+ onChange: onChange,
32
54
  replace: addMask,
33
55
  format: MonthYearFormat
34
56
  });
35
- return (_jsx(ThemeProvider, { 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 ||
36
58
  (valLength > 0 &&
37
59
  (onValidate ? !onValidate(value) : !onValidateMonthYear(value))), margin: margin, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 &&
38
60
  (onValidate ? !onValidate(value) : !onValidateMonthYear(value))
39
61
  ? helperText
40
62
  : "", InputLabelProps: {
41
63
  shrink: true
42
- }, ...rest }) }));
64
+ } }, rest)) })));
43
65
  }
44
66
  export default MonthYearInput;
@@ -1,19 +1,19 @@
1
1
  import { useCallback, useMemo } from "react";
2
2
  function useInteractions(props) {
3
- const { value } = props;
4
- const addMask = useCallback((str) => {
5
- const digits = (str.match(/\d+/g) || []).join("");
6
- const month = digits.slice(0, 2).padEnd(2, "_");
7
- const Year = digits.slice(2, 6).padEnd(4, "_");
3
+ var value = props.value;
4
+ var addMask = useCallback(function (str) {
5
+ var digits = (str.match(/\d+/g) || []).join("");
6
+ var month = digits.slice(0, 2).padEnd(2, "_");
7
+ var Year = digits.slice(2, 6).padEnd(4, "_");
8
8
  if (digits) {
9
- return `${month} / ${Year}`;
9
+ return "".concat(month, " / ").concat(Year);
10
10
  }
11
11
  return "";
12
12
  }, []);
13
- const valLength = useMemo(() => {
14
- const digitsArr = String(value).match(/\d/g);
13
+ var valLength = useMemo(function () {
14
+ var digitsArr = String(value).match(/\d/g);
15
15
  return digitsArr ? digitsArr.length : 0;
16
16
  }, [value]);
17
- return { valLength, addMask };
17
+ return { valLength: valLength, addMask: addMask };
18
18
  }
19
19
  export default useInteractions;
@@ -1,6 +1,7 @@
1
+ import MonthDayInput from "./MonthDayInput";
2
+ import MonthYearInput from "./MonthYearInput";
3
+ import FullDateInput from "./FullDateInput";
1
4
  export * from "./MonthDayInput";
2
5
  export * from "./MonthYearInput";
3
6
  export * from "./FullDateInput";
4
- export { default as MonthDayInput } from "./MonthDayInput";
5
- export { default as MonthYearInput } from "./MonthYearInput";
6
- export { default as FullDateInput } from "./FullDateInput";
7
+ export { MonthDayInput, MonthYearInput, FullDateInput };
@@ -1,6 +1,7 @@
1
+ import MonthDayInput from "./MonthDayInput";
2
+ import MonthYearInput from "./MonthYearInput";
3
+ import FullDateInput from "./FullDateInput";
1
4
  export * from "./MonthDayInput";
2
5
  export * from "./MonthYearInput";
3
6
  export * from "./FullDateInput";
4
- export { default as MonthDayInput } from "./MonthDayInput";
5
- export { default as MonthYearInput } from "./MonthYearInput";
6
- export { default as FullDateInput } from "./FullDateInput";
7
+ export { MonthDayInput, MonthYearInput, FullDateInput };
@@ -1,4 +1,4 @@
1
- import { DigitInputProps } from "./types";
1
+ import type { DigitInputProps } from "./types";
2
2
  declare function DigitInput(props: DigitInputProps): JSX.Element;
3
3
  export default DigitInput;
4
- export * from "./types";
4
+ export type { DigitInputProps };
@@ -1,3 +1,25 @@
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
+ };
1
23
  import { jsx as _jsx } from "react/jsx-runtime";
2
24
  import Tooltip from "@mui/material/Tooltip";
3
25
  import Field from "@mui/material/TextField";
@@ -5,12 +27,11 @@ import ThemeProvider from "@mui/material/styles/ThemeProvider";
5
27
  import useInteractions from "./useInteractions";
6
28
  import useCustomTheme from "../useCustomTheme";
7
29
  function DigitInput(props) {
8
- const { onChange, value, size = "small", tooltip, maxLength = 999, minLength = 0, endAdornment, primaryColor, secondaryColor, ...rest } = props;
9
- const { tooltipOpen, handleChange, onOpenTooltip, onCloseTooltip } = useInteractions({ onChange });
10
- const theme = useCustomTheme({ primaryColor, secondaryColor });
11
- return (_jsx(ThemeProvider, { theme: theme, children: _jsx(Tooltip, { arrow: true, placement: "top", title: tooltip ?? "", open: !!tooltip && tooltipOpen, children: _jsx(Field, { size: size, margin: "dense", type: "text", value: value === undefined || value === null ? "" : value, onMouseEnter: onOpenTooltip, onMouseLeave: onCloseTooltip, inputProps: { maxLength, minLength }, InputProps: {
12
- endAdornment
13
- }, onChange: handleChange, ...rest }) }) }));
30
+ var onChange = props.onChange, value = props.value, _a = props.size, size = _a === void 0 ? "small" : _a, tooltip = props.tooltip, _b = props.maxLength, maxLength = _b === void 0 ? 999 : _b, _c = props.minLength, minLength = _c === void 0 ? 0 : _c, endAdornment = props.endAdornment, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["onChange", "value", "size", "tooltip", "maxLength", "minLength", "endAdornment", "primaryColor", "secondaryColor"]);
31
+ var _d = useInteractions({ onChange: onChange }), tooltipOpen = _d.tooltipOpen, handleChange = _d.handleChange, onOpenTooltip = _d.onOpenTooltip, onCloseTooltip = _d.onCloseTooltip;
32
+ var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
33
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ arrow: true, placement: "top", title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsx(Field, __assign({ size: size, margin: "dense", type: "text", value: value === undefined || value === null ? "" : value, onMouseEnter: onOpenTooltip, onMouseLeave: onCloseTooltip, inputProps: { maxLength: maxLength, minLength: minLength }, InputProps: {
34
+ endAdornment: endAdornment
35
+ }, onChange: handleChange }, rest)) })) })));
14
36
  }
15
37
  export default DigitInput;
16
- export * from "./types";
@@ -1,6 +1,6 @@
1
- import { CSSProperties } from "react";
2
- import { InputProps } from "@mui/material/Input";
3
- import { TextFieldProps } from "@mui/material/TextField";
1
+ import type { CSSProperties } from "react";
2
+ import type { InputProps } from "@mui/material/Input";
3
+ import type { TextFieldProps } from "@mui/material/TextField";
4
4
  export interface DigitInputProps extends Omit<TextFieldProps, "onChange"> {
5
5
  onChange: (value: string) => void;
6
6
  value: string;
@@ -1,24 +1,24 @@
1
1
  import { useState, useCallback } from "react";
2
2
  function useInteractions(props) {
3
- const { onChange } = props;
4
- const [tooltipOpen, setTooltipOpen] = useState(false);
5
- const handleChange = useCallback((event) => {
3
+ var onChange = props.onChange;
4
+ var _a = useState(false), tooltipOpen = _a[0], setTooltipOpen = _a[1];
5
+ var handleChange = useCallback(function (event) {
6
6
  event.preventDefault();
7
7
  if (!event.target.value || /^\d+$/g.test(event.target.value)) {
8
8
  onChange(event.target.value);
9
9
  }
10
10
  }, [onChange]);
11
- const onOpenTooltip = useCallback(() => {
11
+ var onOpenTooltip = useCallback(function () {
12
12
  setTooltipOpen(true);
13
13
  }, []);
14
- const onCloseTooltip = useCallback(() => {
14
+ var onCloseTooltip = useCallback(function () {
15
15
  setTooltipOpen(false);
16
16
  }, []);
17
17
  return {
18
- tooltipOpen,
19
- handleChange,
20
- onOpenTooltip,
21
- onCloseTooltip
18
+ tooltipOpen: tooltipOpen,
19
+ handleChange: handleChange,
20
+ onOpenTooltip: onOpenTooltip,
21
+ onCloseTooltip: onCloseTooltip
22
22
  };
23
23
  }
24
24
  export default useInteractions;
@@ -1,15 +1,3 @@
1
- import { ReactElement, CSSProperties } from "react";
2
- import { HeaderButtonProps } from "./types";
3
- export interface HeaderBarProps {
4
- title: string | ReactElement;
5
- color?: CSSProperties["color"];
6
- subtitle?: string | ReactElement;
7
- bottomEl?: ReactElement;
8
- buttons?: Array<HeaderButtonProps>;
9
- showBackButton?: boolean;
10
- primaryColor?: CSSProperties["color"];
11
- secondaryColor?: CSSProperties["color"];
12
- onBack?: () => void;
13
- }
1
+ import type { HeaderBarProps } from "./types";
14
2
  declare function HeaderBar(props: HeaderBarProps): JSX.Element;
15
3
  export default HeaderBar;