@symply.io/basic-components 1.3.11-alpha.9 → 1.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AlertDialog/index.js +30 -8
- package/Autocomplete/index.js +32 -10
- package/Autocomplete/useInteractions.js +3 -3
- package/AutocompleteWithFilter/index.js +35 -12
- package/BasicModal/Content.js +16 -5
- package/BasicModal/index.js +31 -9
- package/BreadCrumbs/index.js +19 -8
- package/CheckBox/CheckBox.js +26 -4
- package/CheckBox/CheckBoxGroup.js +24 -2
- package/Copyright/index.js +14 -3
- package/DataTable/TableBody.js +24 -2
- package/DataTable/TableBodyRow.js +52 -41
- package/DataTable/TableFooter.js +41 -30
- package/DataTable/TableHeader.js +47 -36
- package/DataTable/index.js +28 -17
- package/DataTable/useTable.js +54 -46
- package/DateInput/FullDateInput/index.js +42 -20
- package/DateInput/FullDateInput/useInteractions.js +10 -10
- package/DateInput/MonthDayInput/index.js +36 -14
- package/DateInput/MonthDayInput/useInteractions.js +9 -9
- package/DateInput/MonthYearInput/index.js +36 -14
- package/DateInput/MonthYearInput/useInteractions.js +9 -9
- package/DigitInput/index.js +28 -6
- package/DigitInput/useInteractions.js +9 -9
- package/DynamicHeaderBar/HeaderBar.js +17 -6
- package/DynamicHeaderBar/HeaderButtons.js +24 -13
- package/DynamicHeaderBar/HeaderLine.js +2 -2
- package/DynamicHeaderBar/index.js +26 -15
- package/FeinInput/index.js +38 -16
- package/FeinInput/useInteractions.js +9 -9
- package/FileUploader/index.js +33 -11
- package/FileUploader/useInteractions.js +44 -29
- package/FormRadioGroup/index.js +29 -4
- package/FormSelector/MultipleSelector.js +32 -9
- package/FormSelector/SimpleSelector.js +32 -9
- package/FormSelector/useInteractions.js +7 -7
- package/HelpCaption/index.js +17 -6
- package/HelpCaption/useInteractions.js +2 -2
- package/LoadingModal/Modal.js +15 -4
- package/LoadingModal/useLoadingModal.js +33 -15
- package/MenuButtonGroup/MenuItem.js +14 -3
- package/MenuButtonGroup/index.js +82 -14
- package/NumberInput/index.js +27 -5
- package/NumberInput/useInteractions.js +17 -17
- package/PasswordInput/ConfirmPassword.js +28 -6
- package/PasswordInput/Password.js +37 -15
- package/PhoneNumberInput/index.js +39 -17
- package/PhoneNumberInput/useInteractions.js +10 -10
- package/Sidebar/SidebarItem.js +17 -6
- package/Sidebar/SidebarItemsGroup.js +21 -10
- package/Sidebar/SidebarLink.js +27 -5
- package/Sidebar/index.js +17 -6
- package/SocialInput/index.js +40 -18
- package/SocialInput/useInteractions.js +14 -14
- package/TabGroup/index.js +25 -14
- package/TablePagination/Actions.js +15 -4
- package/TablePagination/index.js +14 -3
- package/TablePagination/useInteractions.js +9 -9
- package/TextInput/index.js +30 -8
- package/TextInput/useInteractions.js +4 -4
- package/ToastPrompt/Prompt.d.ts +2 -1
- package/ToastPrompt/Prompt.js +20 -55
- package/ToastPrompt/index.js +18 -7
- package/ToastPrompt/types.d.ts +2 -8
- package/ToastPrompt/useInteractions.d.ts +2 -1
- package/ToastPrompt/useInteractions.js +21 -10
- package/VideoPlayerModal/index.js +27 -5
- package/package.json +1 -1
- package/useCustomTheme.js +16 -11
- package/utils/uuid.js +11 -10
|
@@ -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
|
-
|
|
9
|
-
|
|
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
|
|
34
|
+
return "".concat(prev, " / ").concat(curr);
|
|
13
35
|
}
|
|
14
36
|
else if (index === 4) {
|
|
15
|
-
return
|
|
37
|
+
return "".concat(prev, " / ").concat(curr);
|
|
16
38
|
}
|
|
17
39
|
else {
|
|
18
|
-
return
|
|
40
|
+
return "".concat(prev).concat(curr);
|
|
19
41
|
}
|
|
20
|
-
},
|
|
42
|
+
}, "");
|
|
21
43
|
}
|
|
22
44
|
export function onValidateDate(dateString) {
|
|
23
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
},
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
10
|
+
return "".concat(month, " / ").concat(day, " / ").concat(Year);
|
|
11
11
|
}
|
|
12
12
|
return "";
|
|
13
13
|
}, []);
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
9
|
-
|
|
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
|
|
34
|
+
return "".concat(prev, " / ").concat(curr);
|
|
13
35
|
}
|
|
14
36
|
else {
|
|
15
|
-
return
|
|
37
|
+
return "".concat(prev).concat(curr);
|
|
16
38
|
}
|
|
17
|
-
},
|
|
39
|
+
}, "");
|
|
18
40
|
}
|
|
19
41
|
export function onValidateMonthDay(monthDayString) {
|
|
20
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
},
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
9
|
+
return "".concat(month, " / ").concat(day);
|
|
10
10
|
}
|
|
11
11
|
return "";
|
|
12
12
|
}, []);
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
9
|
-
|
|
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
|
|
34
|
+
return "".concat(prev, " / ").concat(curr);
|
|
13
35
|
}
|
|
14
36
|
else {
|
|
15
|
-
return
|
|
37
|
+
return "".concat(prev).concat(curr);
|
|
16
38
|
}
|
|
17
|
-
},
|
|
39
|
+
}, "");
|
|
18
40
|
}
|
|
19
41
|
export function onValidateMonthYear(monthYearString) {
|
|
20
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
},
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
9
|
+
return "".concat(month, " / ").concat(Year);
|
|
10
10
|
}
|
|
11
11
|
return "";
|
|
12
12
|
}, []);
|
|
13
|
-
|
|
14
|
-
|
|
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;
|
package/DigitInput/index.js
CHANGED
|
@@ -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,12 @@ 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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(Tooltip, { arrow: true, placement: "top", title: tooltip
|
|
12
|
-
endAdornment
|
|
13
|
-
}, onChange: handleChange,
|
|
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
38
|
export * from "./types";
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { useState, useCallback } from "react";
|
|
2
2
|
function useInteractions(props) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
11
|
+
var onOpenTooltip = useCallback(function () {
|
|
12
12
|
setTooltipOpen(true);
|
|
13
13
|
}, []);
|
|
14
|
-
|
|
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,3 +1,14 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
13
|
import { cloneElement, useMemo } from "react";
|
|
3
14
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
|
@@ -10,12 +21,12 @@ import HeaderLine from "./HeaderLine";
|
|
|
10
21
|
import HeaderButtons from "./HeaderButtons";
|
|
11
22
|
import useCustomTheme from "../useCustomTheme";
|
|
12
23
|
function HeaderBar(props) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return (_jsx(ThemeProvider, { theme: theme, children: _jsxs(Grid, { sx: { mb: 1 }, children: [_jsxs(Grid, { container: true, direction: "row", justifyContent: "flex-start", alignItems: "center", children: [_jsx(Grid, { item: true, xs: 12, sm: hasButtons ? 6 : 12, md: hasButtons ? 5 : 12, lg: hasButtons ? 4 : 12, xl: hasButtons ? 3 : 12, children: _jsxs(Grid, { container: true, direction: "row", justifyContent: "flex-start", alignItems: "center", children: [showBackButton && (_jsx(IconButton, { onClick: ()
|
|
24
|
+
var title = props.title, color = props.color, subtitle = props.subtitle, bottomEl = props.bottomEl, _a = props.buttons, buttons = _a === void 0 ? [] : _a, showBackButton = props.showBackButton, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onBack = props.onBack;
|
|
25
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
|
26
|
+
var isLessThanSm = useMediaQuery(theme.breakpoints.down("sm"));
|
|
27
|
+
var hasButtons = useMemo(function () { return buttons.length > 0; }, [buttons.length]);
|
|
28
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(Grid, __assign({ sx: { mb: 1 } }, { children: [_jsxs(Grid, __assign({ container: true, direction: "row", justifyContent: "flex-start", alignItems: "center" }, { children: [_jsx(Grid, __assign({ item: true, xs: 12, sm: hasButtons ? 6 : 12, md: hasButtons ? 5 : 12, lg: hasButtons ? 4 : 12, xl: hasButtons ? 3 : 12 }, { children: _jsxs(Grid, __assign({ container: true, direction: "row", justifyContent: "flex-start", alignItems: "center" }, { children: [showBackButton && (_jsx(IconButton, __assign({ onClick: function () {
|
|
18
29
|
onBack ? onBack() : window.history.back();
|
|
19
|
-
}, children: _jsx(ArrowBackIcon, { fontSize: "small" }) })), typeof title === "string" ? (_jsx(Typography, { align: "left", sx: { fontWeight: 600, fontSize: isLessThanSm ? 21 : 24 }, children: title })) : (cloneElement(title))] }) }), hasButtons ? (_jsx(Grid, { item: true, xs: 12, sm: 6, md: 7, lg: 8, xl: 9, children: _jsx(HeaderButtons, { buttons: buttons, primaryColor: primaryColor, secondaryColor: secondaryColor }) })) : (_jsx(_Fragment, {}))] }), _jsx(Grid, { container: true, direction: "row", children: _jsx(Grid, { item: true, xs: 12, sx: { mt: 1 }, children: _jsx(HeaderLine, { color: color, primaryColor: primaryColor, secondaryColor: secondaryColor }) }) }), subtitle && (_jsx(Grid, { container: true, direction: "row", children: _jsx(Grid, { item: true, xs: 12, sx: { mt: 1 }, children: typeof subtitle === "string" ? (_jsx(Typography, { children: subtitle })) : (cloneElement(subtitle)) }) })), bottomEl && (_jsx(Grid, { container: true, direction: "row", children: _jsx(Grid, { item: true, xs: 12, sx: { mt: 1 }, children: cloneElement(bottomEl) }) }))] }) }));
|
|
30
|
+
} }, { children: _jsx(ArrowBackIcon, { fontSize: "small" }) }))), typeof title === "string" ? (_jsx(Typography, __assign({ align: "left", sx: { fontWeight: 600, fontSize: isLessThanSm ? 21 : 24 } }, { children: title }))) : (cloneElement(title))] })) })), hasButtons ? (_jsx(Grid, __assign({ item: true, xs: 12, sm: 6, md: 7, lg: 8, xl: 9 }, { children: _jsx(HeaderButtons, { buttons: buttons, primaryColor: primaryColor, secondaryColor: secondaryColor }) }))) : (_jsx(_Fragment, {}))] })), _jsx(Grid, __assign({ container: true, direction: "row" }, { children: _jsx(Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: _jsx(HeaderLine, { color: color, primaryColor: primaryColor, secondaryColor: secondaryColor }) })) })), subtitle && (_jsx(Grid, __assign({ container: true, direction: "row" }, { children: _jsx(Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: typeof subtitle === "string" ? (_jsx(Typography, { children: subtitle })) : (cloneElement(subtitle)) })) }))), bottomEl && (_jsx(Grid, __assign({ container: true, direction: "row" }, { children: _jsx(Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: cloneElement(bottomEl) })) })))] })) })));
|
|
20
31
|
}
|
|
21
32
|
export default HeaderBar;
|
|
@@ -1,3 +1,14 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
13
|
import Fab from "@mui/material/Fab";
|
|
3
14
|
import Grid from "@mui/material/Grid";
|
|
@@ -9,30 +20,30 @@ import MenuButtonGroup from "../MenuButtonGroup";
|
|
|
9
20
|
import { HeaderButtonCategory } from "./types";
|
|
10
21
|
import useCustomTheme from "../useCustomTheme";
|
|
11
22
|
function HeaderButtons(props) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(Grid, { container: true, spacing: 1, direction: "row", justifyContent: "flex-end", alignItems: "center", children: buttons.map((button)
|
|
23
|
+
var buttons = props.buttons, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
|
|
24
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
|
25
|
+
var isLessThanSm = useMediaQuery(theme.breakpoints.down("sm"));
|
|
26
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Grid, __assign({ container: true, spacing: 1, direction: "row", justifyContent: "flex-end", alignItems: "center" }, { children: buttons.map(function (button) {
|
|
16
27
|
switch (button.type) {
|
|
17
28
|
case HeaderButtonCategory.TextButton: {
|
|
18
|
-
|
|
19
|
-
return (_jsx(Grid, { item: true, xs: isLessThanSm ? 12 : undefined, style: { textAlign: "end" }, children: _jsx(Button, { fullWidth: isLessThanSm, variant: variant, onClick: onClick, color: color, size: isLessThanSm ? "small" : size, startIcon: startIcon, endIcon: endIcon, disabled: disabled, children: text }) }, text));
|
|
29
|
+
var _a = button.variant, variant = _a === void 0 ? "contained" : _a, text = button.text, onClick = button.onClick, color = button.color, size = button.size, startIcon = button.startIcon, endIcon = button.endIcon, disabled = button.disabled;
|
|
30
|
+
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));
|
|
20
31
|
}
|
|
21
32
|
case HeaderButtonCategory.FabButton: {
|
|
22
|
-
|
|
23
|
-
return (_jsx(Grid, { item: true, style: { textAlign: "end" }, children: _jsx(Fab, { onClick: onClick, color: color, title: title, size: isLessThanSm ? "small" : size, disabled: disabled, variant: variant, children: icon }) }, title));
|
|
33
|
+
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;
|
|
34
|
+
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));
|
|
24
35
|
}
|
|
25
36
|
case HeaderButtonCategory.IconButton: {
|
|
26
|
-
|
|
27
|
-
return (_jsx(Grid, { item: true, style: { textAlign: "end" }, children: _jsx(IconButton, { onClick: onClick, color: color, title: title, size: isLessThanSm ? "small" : size, disabled: disabled, children: icon }) }, title));
|
|
37
|
+
var title = button.title, onClick = button.onClick, color = button.color, _c = button.size, size = _c === void 0 ? "medium" : _c, icon = button.icon, disabled = button.disabled;
|
|
38
|
+
return (_jsx(Grid, __assign({ item: true, style: { textAlign: "end" } }, { children: _jsx(IconButton, __assign({ onClick: onClick, color: color, title: title, size: isLessThanSm ? "small" : size, disabled: disabled }, { children: icon })) }), title));
|
|
28
39
|
}
|
|
29
40
|
case HeaderButtonCategory.MenuButton: {
|
|
30
|
-
|
|
31
|
-
return (_jsx(Grid, { item: true, xs: isLessThanSm ? 12 : undefined, style: { textAlign: "end" }, children: _jsx(MenuButtonGroup, { size: isLessThanSm ? "small" : size, variant: variant, buttons: btns, color: color, buttonText: buttonText, disabled: disabled, primaryColor: primaryColor, secondaryColor: secondaryColor }) }, buttonText));
|
|
41
|
+
var btns = button.buttons, buttonText = button.buttonText, disabled = button.disabled, variant = button.variant, size = button.size, color = button.color;
|
|
42
|
+
return (_jsx(Grid, __assign({ item: true, xs: isLessThanSm ? 12 : undefined, style: { textAlign: "end" } }, { children: _jsx(MenuButtonGroup, { size: isLessThanSm ? "small" : size, variant: variant, buttons: btns, color: color, buttonText: buttonText, disabled: disabled, primaryColor: primaryColor, secondaryColor: secondaryColor }) }), buttonText));
|
|
32
43
|
}
|
|
33
44
|
default:
|
|
34
45
|
return _jsx(_Fragment, {});
|
|
35
46
|
}
|
|
36
|
-
}) }) }));
|
|
47
|
+
}) })) })));
|
|
37
48
|
}
|
|
38
49
|
export default HeaderButtons;
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import Divider from "@mui/material/Divider";
|
|
3
3
|
import useCustomTheme from "../useCustomTheme";
|
|
4
4
|
function HeaderLine(props) {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
var color = props.color, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
|
|
6
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
|
7
7
|
return (_jsx(Divider, { sx: {
|
|
8
8
|
height: "3px",
|
|
9
9
|
backgroundColor: color || theme.palette.primary.main
|
|
@@ -1,38 +1,49 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
13
|
import { cloneElement, createContext, useContext, useState, useCallback } from "react";
|
|
3
14
|
import Grid from "@mui/material/Grid";
|
|
4
15
|
import HeaderBar from "./HeaderBar";
|
|
5
|
-
|
|
6
|
-
onInit: ()
|
|
7
|
-
onShow: ()
|
|
8
|
-
onHide: ()
|
|
16
|
+
var HeaderContext = createContext({
|
|
17
|
+
onInit: function () { },
|
|
18
|
+
onShow: function () { },
|
|
19
|
+
onHide: function () { }
|
|
9
20
|
});
|
|
10
21
|
export function HeaderProvider(props) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
var children = props.children, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, _a = props.sx, sx = _a === void 0 ? {} : _a;
|
|
23
|
+
var _b = useState(false), visible = _b[0], setVisible = _b[1];
|
|
24
|
+
var _c = useState({ title: "" }), headerProps = _c[0], setHeaderProps = _c[1];
|
|
25
|
+
var _d = useState(0), height = _d[0], setHeight = _d[1];
|
|
26
|
+
var onInit = useCallback(function (args) {
|
|
16
27
|
setHeaderProps(args);
|
|
17
28
|
}, []);
|
|
18
|
-
|
|
29
|
+
var onShow = useCallback(function () {
|
|
19
30
|
setVisible(true);
|
|
20
31
|
}, []);
|
|
21
|
-
|
|
32
|
+
var onHide = useCallback(function () {
|
|
22
33
|
setVisible(false);
|
|
23
34
|
}, []);
|
|
24
|
-
|
|
35
|
+
var measureRef = useCallback(function (node) {
|
|
25
36
|
if (node && headerProps) {
|
|
26
37
|
setHeight(node.getBoundingClientRect().height);
|
|
27
38
|
}
|
|
28
39
|
}, [headerProps]);
|
|
29
|
-
return (_jsx(HeaderContext.Provider, { value: { onInit, onHide, onShow }, children: _jsxs(_Fragment, { children: [visible ? (_jsx(Grid, { container: true, direction: "row", sx: {
|
|
40
|
+
return (_jsx(HeaderContext.Provider, __assign({ value: { onInit: onInit, onHide: onHide, onShow: onShow } }, { children: _jsxs(_Fragment, { children: [visible ? (_jsx(Grid, __assign({ container: true, direction: "row", sx: __assign({}, sx), ref: measureRef }, { children: _jsx(Grid, __assign({ item: true, xs: 12 }, { children: _jsx(HeaderBar, __assign({}, headerProps, { primaryColor: primaryColor, secondaryColor: secondaryColor })) })) }))) : (_jsx(_Fragment, {})), cloneElement(children, {
|
|
30
41
|
sx: {
|
|
31
42
|
p: 3,
|
|
32
43
|
py: 1,
|
|
33
|
-
pt: visible && height ?
|
|
44
|
+
pt: visible && height ? "calc(".concat(height, "px)") : undefined
|
|
34
45
|
}
|
|
35
|
-
})] }) }));
|
|
46
|
+
})] }) })));
|
|
36
47
|
}
|
|
37
48
|
export function useHeaderBar() {
|
|
38
49
|
return useContext(HeaderContext);
|