@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.
- package/AlertDialog/index.d.ts +2 -2
- package/AlertDialog/index.js +30 -9
- package/AlertDialog/types.d.ts +3 -3
- package/Autocomplete/index.d.ts +2 -2
- package/Autocomplete/index.js +32 -11
- package/Autocomplete/types.d.ts +2 -2
- package/Autocomplete/useInteractions.js +3 -3
- package/AutocompleteWithFilter/index.d.ts +2 -2
- package/AutocompleteWithFilter/index.js +35 -13
- package/AutocompleteWithFilter/types.d.ts +5 -5
- package/BasicModal/Content.js +16 -5
- package/BasicModal/index.d.ts +2 -2
- package/BasicModal/index.js +31 -10
- package/BasicModal/types.d.ts +2 -2
- package/BreadCrumbs/index.d.ts +2 -2
- package/BreadCrumbs/index.js +19 -9
- package/BreadCrumbs/types.d.ts +1 -1
- package/CheckBox/index.d.ts +4 -3
- package/CheckBox/index.js +36 -3
- package/CheckBox/types.d.ts +2 -6
- package/CheckBoxGroup/index.d.ts +4 -0
- package/CheckBoxGroup/index.js +30 -0
- package/CheckBoxGroup/types.d.ts +5 -0
- package/CheckBoxGroup/types.js +1 -0
- package/ConfirmPasswordInput/index.d.ts +4 -0
- package/ConfirmPasswordInput/index.js +42 -0
- package/ConfirmPasswordInput/types.d.ts +9 -0
- package/ConfirmPasswordInput/types.js +1 -0
- package/Copyright/index.d.ts +2 -2
- package/Copyright/index.js +14 -4
- package/Copyright/types.d.ts +1 -1
- 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.d.ts +2 -1
- package/DataTable/index.js +30 -18
- 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/DateInput/index.d.ts +4 -3
- package/DateInput/index.js +4 -3
- package/DigitInput/index.d.ts +2 -2
- package/DigitInput/index.js +28 -7
- package/DigitInput/types.d.ts +3 -3
- package/DigitInput/useInteractions.js +9 -9
- package/DynamicHeaderBar/HeaderBar.d.ts +1 -13
- package/DynamicHeaderBar/HeaderBar.js +17 -6
- package/DynamicHeaderBar/HeaderButtons.d.ts +1 -1
- package/DynamicHeaderBar/HeaderButtons.js +24 -13
- package/DynamicHeaderBar/HeaderLine.d.ts +1 -6
- package/DynamicHeaderBar/HeaderLine.js +2 -2
- package/DynamicHeaderBar/index.d.ts +1 -17
- package/DynamicHeaderBar/index.js +26 -18
- package/DynamicHeaderBar/types.d.ts +33 -5
- package/FeinInput/index.d.ts +2 -2
- package/FeinInput/index.js +38 -17
- package/FeinInput/types.d.ts +2 -2
- package/FeinInput/useInteractions.js +9 -9
- package/FileUploader/index.d.ts +2 -2
- package/FileUploader/index.js +33 -12
- package/FileUploader/useInteractions.js +44 -29
- package/FormRadioGroup/index.d.ts +2 -2
- package/FormRadioGroup/index.js +29 -5
- package/FormRadioGroup/types.d.ts +3 -4
- package/FormSelector/MultipleSelector.js +32 -9
- package/FormSelector/SimpleSelector.js +32 -9
- package/FormSelector/useInteractions.js +7 -7
- package/HelpCaption/index.d.ts +2 -2
- package/HelpCaption/index.js +17 -6
- package/HelpCaption/useInteractions.js +2 -2
- package/LoadingModal/Modal.js +15 -4
- package/LoadingModal/index.d.ts +2 -1
- package/LoadingModal/index.js +3 -1
- package/LoadingModal/useLoadingModal.d.ts +1 -1
- package/LoadingModal/useLoadingModal.js +34 -16
- 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/index.d.ts +6 -4
- package/PasswordInput/index.js +79 -4
- package/PasswordInput/{Password.d.ts → types.d.ts} +3 -6
- package/PasswordInput/types.js +1 -0
- package/PhoneNumberInput/index.js +39 -17
- package/PhoneNumberInput/useInteractions.js +10 -10
- package/README.md +4 -8
- 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.d.ts +2 -2
- package/SocialInput/index.js +40 -19
- package/SocialInput/useInteractions.js +14 -14
- package/TabGroup/index.d.ts +2 -2
- package/TabGroup/index.js +25 -15
- package/TablePagination/Actions.js +15 -4
- package/TablePagination/index.d.ts +2 -2
- package/TablePagination/index.js +14 -4
- package/TablePagination/useInteractions.js +9 -9
- package/TextInput/index.d.ts +1 -1
- package/TextInput/index.js +31 -9
- package/TextInput/useInteractions.js +4 -4
- package/ToastPrompt/Prompt.d.ts +4 -2
- package/ToastPrompt/Prompt.js +23 -55
- package/ToastPrompt/index.js +22 -8
- package/ToastPrompt/types.d.ts +10 -17
- package/ToastPrompt/useInteractions.d.ts +8 -8
- package/ToastPrompt/useInteractions.js +23 -16
- package/VideoPlayerModal/index.d.ts +2 -2
- package/VideoPlayerModal/index.js +27 -6
- package/index.d.ts +6 -0
- package/index.js +6 -0
- package/package.json +1 -2
- package/useCustomTheme.js +16 -11
- package/utils/uuid.js +11 -10
- package/CheckBox/CheckBox.d.ts +0 -3
- package/CheckBox/CheckBox.js +0 -14
- package/CheckBox/CheckBoxGroup.d.ts +0 -3
- package/CheckBox/CheckBoxGroup.js +0 -8
- package/PasswordInput/ConfirmPassword.d.ts +0 -11
- package/PasswordInput/ConfirmPassword.js +0 -20
- package/PasswordInput/Password.js +0 -56
package/SocialInput/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 { useRifm } from "rifm";
|
3
25
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
@@ -9,47 +31,46 @@ import TextField from "@mui/material/TextField";
|
|
9
31
|
import useInteractions from "./useInteractions";
|
10
32
|
import useCustomTheme from "../useCustomTheme";
|
11
33
|
export function SocialInputFormat(str) {
|
12
|
-
|
13
|
-
|
14
|
-
return chars.reduce((prev, curr, index)
|
34
|
+
var digits = (str.match(/\d+/g) || []).join("");
|
35
|
+
var chars = digits.split("");
|
36
|
+
return chars.reduce(function (prev, curr, index) {
|
15
37
|
if (index === 3) {
|
16
|
-
return
|
38
|
+
return "".concat(prev, " - ").concat(curr);
|
17
39
|
}
|
18
40
|
else if (index === 5) {
|
19
|
-
return
|
41
|
+
return "".concat(prev, " - ").concat(curr);
|
20
42
|
}
|
21
43
|
else {
|
22
|
-
return
|
44
|
+
return "".concat(prev).concat(curr);
|
23
45
|
}
|
24
|
-
},
|
46
|
+
}, "");
|
25
47
|
}
|
26
48
|
export function onValidateSocial(socialString) {
|
27
|
-
|
49
|
+
var reg = /^\d{3}\s?-\s?\d{2}\s?-\s?\d{4}$/g;
|
28
50
|
return reg.test(socialString);
|
29
51
|
}
|
30
52
|
function SocialInput(props) {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
value
|
35
|
-
});
|
36
|
-
|
53
|
+
var value = props.value, _a = props.helperText, helperText = _a === void 0 ? "Please enter a valid SSN" : _a, error = props.error, onChange = props.onChange, onValidate = props.onValidate, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["value", "helperText", "error", "onChange", "onValidate", "primaryColor", "secondaryColor"]);
|
54
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
55
|
+
var _b = useInteractions({
|
56
|
+
value: value
|
57
|
+
}), visible = _b.visible, valLength = _b.valLength, addMask = _b.addMask, onSwitching = _b.onSwitching;
|
58
|
+
var rifm = useRifm({
|
37
59
|
mask: true,
|
38
60
|
value: String(value),
|
39
|
-
onChange,
|
61
|
+
onChange: onChange,
|
40
62
|
replace: addMask,
|
41
63
|
format: SocialInputFormat
|
42
64
|
});
|
43
|
-
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(TextField, { helperText: valLength > 0 &&
|
65
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ helperText: valLength > 0 &&
|
44
66
|
(onValidate ? !onValidate(value) : !onValidateSocial(value))
|
45
67
|
? helperText
|
46
68
|
: "", value: rifm.value, onChange: rifm.onChange, type: visible ? "text" : "password", error: error ||
|
47
69
|
(valLength > 0 &&
|
48
70
|
(onValidate ? !onValidate(value) : !onValidateSocial(value))), InputProps: {
|
49
|
-
endAdornment: (_jsx(InputAdornment, { position: "end", children: valLength === 9 && (_jsx(IconButton, { "aria-label": "Toggle SSN visibility", onClick: onSwitching, children: visible ? _jsx(Visibility, {}) : _jsx(VisibilityOff, {}) })) }))
|
71
|
+
endAdornment: (_jsx(InputAdornment, __assign({ position: "end" }, { children: valLength === 9 && (_jsx(IconButton, __assign({ "aria-label": "Toggle SSN visibility", onClick: onSwitching }, { children: visible ? _jsx(Visibility, {}) : _jsx(VisibilityOff, {}) }))) })))
|
50
72
|
}, InputLabelProps: {
|
51
73
|
shrink: true
|
52
|
-
},
|
74
|
+
} }, rest)) })));
|
53
75
|
}
|
54
76
|
export default SocialInput;
|
55
|
-
export * from "./types";
|
@@ -1,26 +1,26 @@
|
|
1
1
|
import { useCallback, useMemo, useState, useEffect } from "react";
|
2
2
|
function useInteractions(props) {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
var value = props.value;
|
4
|
+
var _a = useState(false), visible = _a[0], setVisible = _a[1];
|
5
|
+
var valLength = useMemo(function () {
|
6
|
+
var digitsArr = String(value).match(/\d/g);
|
7
7
|
return digitsArr ? digitsArr.length : 0;
|
8
8
|
}, [value]);
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return
|
9
|
+
var addMask = useCallback(function (str) {
|
10
|
+
var digits = (str.match(/\d+/g) || []).join("");
|
11
|
+
var headerCode = digits.slice(0, 3).padEnd(3, "_");
|
12
|
+
var middleCode = digits.slice(3, 5).padEnd(2, "_");
|
13
|
+
var tailCode = digits.slice(5, 9).padEnd(4, "_");
|
14
|
+
return "".concat(headerCode, " - ").concat(middleCode, " - ").concat(tailCode);
|
15
15
|
}, []);
|
16
|
-
|
17
|
-
setVisible(v
|
16
|
+
var onSwitching = useCallback(function () {
|
17
|
+
setVisible(function (v) { return !v; });
|
18
18
|
}, []);
|
19
|
-
useEffect(()
|
19
|
+
useEffect(function () {
|
20
20
|
if (!visible && valLength !== 9) {
|
21
21
|
setVisible(true);
|
22
22
|
}
|
23
23
|
}, [valLength, visible]);
|
24
|
-
return { visible, valLength, addMask, onSwitching };
|
24
|
+
return { visible: visible, valLength: valLength, addMask: addMask, onSwitching: onSwitching };
|
25
25
|
}
|
26
26
|
export default useInteractions;
|
package/TabGroup/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import { TabGroupProps } from "./types";
|
2
|
+
import type { TabGroupProps } from "./types";
|
3
3
|
declare const TabGroup: import("react").ForwardRefExoticComponent<TabGroupProps & import("react").RefAttributes<unknown>>;
|
4
4
|
export default TabGroup;
|
5
|
-
export
|
5
|
+
export type { TabGroupProps };
|
package/TabGroup/index.js
CHANGED
@@ -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 } from "react/jsx-runtime";
|
2
13
|
import { useState, useEffect, forwardRef, useImperativeHandle } from "react";
|
3
14
|
import Tab from "@mui/material/Tab";
|
@@ -5,28 +16,28 @@ import Tabs from "@mui/material/Tabs";
|
|
5
16
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
6
17
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
7
18
|
import useCustomTheme from "../useCustomTheme";
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
19
|
+
var TabGroup = forwardRef(function (props, ref) {
|
20
|
+
var tabs = props.tabs, _a = props.textColor, textColor = _a === void 0 ? "primary" : _a, _b = props.variant, variant = _b === void 0 ? "scrollable" : _b, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onTabChange = props.onTabChange, outerTabIndex = props.currentTabIndex;
|
21
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
22
|
+
var mobileViewport = useMediaQuery(theme.breakpoints.down("md"));
|
23
|
+
var _c = useState(outerTabIndex || 0), currentTabIndex = _c[0], setCurrentTabIndex = _c[1];
|
24
|
+
var onClick = function (index) {
|
14
25
|
setCurrentTabIndex(index);
|
15
26
|
};
|
16
|
-
useImperativeHandle(ref, ()
|
27
|
+
useImperativeHandle(ref, function () { return ({
|
17
28
|
tabIndex: currentTabIndex
|
18
|
-
}));
|
19
|
-
useEffect(()
|
29
|
+
}); });
|
30
|
+
useEffect(function () {
|
20
31
|
if (outerTabIndex !== undefined && outerTabIndex !== currentTabIndex) {
|
21
32
|
setCurrentTabIndex(outerTabIndex);
|
22
33
|
}
|
23
34
|
}, [outerTabIndex, currentTabIndex]);
|
24
|
-
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(Tabs, { value: currentTabIndex, TabIndicatorProps: { hidden: true }, variant: mobileViewport ? "scrollable" : variant, textColor: textColor, onChange: (_, val)
|
35
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tabs, __assign({ value: currentTabIndex, TabIndicatorProps: { hidden: true }, variant: mobileViewport ? "scrollable" : variant, textColor: textColor, onChange: function (_, val) {
|
25
36
|
onClick(val);
|
26
37
|
onTabChange(val);
|
27
|
-
}, children: tabs.map((tab, index)
|
28
|
-
|
29
|
-
|
38
|
+
} }, { children: tabs.map(function (tab, index) {
|
39
|
+
var text = tab.text, _a = tab.disabled, disabled = _a === void 0 ? false : _a;
|
40
|
+
var active = currentTabIndex === index;
|
30
41
|
return (_jsx(Tab, { disableFocusRipple: true, disableRipple: true, label: text, disabled: disabled, sx: {
|
31
42
|
cursor: disabled ? "not-allowed" : "pointer",
|
32
43
|
margin: theme.spacing(0.75, 0.25),
|
@@ -34,7 +45,6 @@ const TabGroup = forwardRef((props, ref) => {
|
|
34
45
|
borderRadius: active ? theme.spacing(0.5) : undefined,
|
35
46
|
boxShadow: active ? "0px 4px 6px #acc1c2" : undefined
|
36
47
|
} }, index));
|
37
|
-
}) }) }));
|
48
|
+
}) })) })));
|
38
49
|
});
|
39
50
|
export default TabGroup;
|
40
|
-
export * from "./types";
|
@@ -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 } from "react/jsx-runtime";
|
2
13
|
import Box from "@mui/material/Box";
|
3
14
|
import IconButton from "@mui/material/IconButton";
|
@@ -8,9 +19,9 @@ import LastPageIcon from "@mui/icons-material/LastPage";
|
|
8
19
|
import useInteractions from "./useInteractions";
|
9
20
|
import useCustomTheme from "../useCustomTheme";
|
10
21
|
function TablePaginationActions(props) {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return (_jsxs(Box, { sx: { flexShrink: 0, ml: 2.5 }, children: [_jsx(IconButton, { onClick: onFirstPageButtonClick, disabled: page === 0, "aria-label": "first page", children: theme.direction === "rtl" ? _jsx(LastPageIcon, {}) : _jsx(FirstPageIcon, {}) }), _jsx(IconButton, { onClick: onBackButtonClick, disabled: page === 0, "aria-label": "previous page", children: theme.direction === "rtl" ? (_jsx(KeyboardArrowRight, {})) : (_jsx(KeyboardArrowLeft, {})) }), _jsx(IconButton, { onClick: onNextButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "next page", children: theme.direction === "rtl" ? (_jsx(KeyboardArrowLeft, {})) : (_jsx(KeyboardArrowRight, {})) }), _jsx(IconButton, { onClick: onLastPageButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "last page", children: theme.direction === "rtl" ? _jsx(FirstPageIcon, {}) : _jsx(LastPageIcon, {}) })] }));
|
22
|
+
var count = props.count, page = props.page, rowsPerPage = props.rowsPerPage, onPageChange = props.onPageChange;
|
23
|
+
var theme = useCustomTheme();
|
24
|
+
var _a = useInteractions({ count: count, page: page, rowsPerPage: rowsPerPage, onPageChange: onPageChange }), onBackButtonClick = _a.onBackButtonClick, onNextButtonClick = _a.onNextButtonClick, onLastPageButtonClick = _a.onLastPageButtonClick, onFirstPageButtonClick = _a.onFirstPageButtonClick;
|
25
|
+
return (_jsxs(Box, __assign({ sx: { flexShrink: 0, ml: 2.5 } }, { children: [_jsx(IconButton, __assign({ onClick: onFirstPageButtonClick, disabled: page === 0, "aria-label": "first page" }, { children: theme.direction === "rtl" ? _jsx(LastPageIcon, {}) : _jsx(FirstPageIcon, {}) })), _jsx(IconButton, __assign({ onClick: onBackButtonClick, disabled: page === 0, "aria-label": "previous page" }, { children: theme.direction === "rtl" ? (_jsx(KeyboardArrowRight, {})) : (_jsx(KeyboardArrowLeft, {})) })), _jsx(IconButton, __assign({ onClick: onNextButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "next page" }, { children: theme.direction === "rtl" ? (_jsx(KeyboardArrowLeft, {})) : (_jsx(KeyboardArrowRight, {})) })), _jsx(IconButton, __assign({ onClick: onLastPageButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "last page" }, { children: theme.direction === "rtl" ? _jsx(FirstPageIcon, {}) : _jsx(LastPageIcon, {}) }))] })));
|
15
26
|
}
|
16
27
|
export default TablePaginationActions;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { TablePaginationProps } from "./types";
|
1
|
+
import type { TablePaginationProps } from "./types";
|
2
2
|
declare function Pagination(props: TablePaginationProps): JSX.Element;
|
3
3
|
export default Pagination;
|
4
|
-
export
|
4
|
+
export type { TablePaginationProps };
|
package/TablePagination/index.js
CHANGED
@@ -1,12 +1,22 @@
|
|
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 TablePagination from "@mui/material/TablePagination";
|
3
14
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
4
15
|
import TablePaginationActions from "./Actions";
|
5
16
|
import useCustomTheme from "../useCustomTheme";
|
6
17
|
function Pagination(props) {
|
7
|
-
|
8
|
-
|
9
|
-
return (_jsx(ThemeProvider, { theme: theme, children: count ? (_jsx(TablePagination, { component: "div", colSpan: colSpan, count: count, rowsPerPage: rowsPerPage, page: page, SelectProps: { native: true }, rowsPerPageOptions: rowsPerPageOptions, onPageChange: onPageChange, onRowsPerPageChange: onRowsPerPageChange, ActionsComponent: TablePaginationActions })) : (_jsx(_Fragment, {})) }));
|
18
|
+
var colSpan = props.colSpan, count = props.count, page = props.page, rowsPerPage = props.rowsPerPage, _a = props.rowsPerPageOptions, rowsPerPageOptions = _a === void 0 ? [10, 20, 30, 50] : _a, onPageChange = props.onPageChange, onRowsPerPageChange = props.onRowsPerPageChange, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
|
19
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
20
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: count ? (_jsx(TablePagination, { component: "div", colSpan: colSpan, count: count, rowsPerPage: rowsPerPage, page: page, SelectProps: { native: true }, rowsPerPageOptions: rowsPerPageOptions, onPageChange: onPageChange, onRowsPerPageChange: onRowsPerPageChange, ActionsComponent: TablePaginationActions })) : (_jsx(_Fragment, {})) })));
|
10
21
|
}
|
11
22
|
export default Pagination;
|
12
|
-
export * from "./types";
|
@@ -1,23 +1,23 @@
|
|
1
1
|
import { useCallback } from "react";
|
2
2
|
function useInteractions(props) {
|
3
|
-
|
4
|
-
|
3
|
+
var count = props.count, page = props.page, rowsPerPage = props.rowsPerPage, onPageChange = props.onPageChange;
|
4
|
+
var onFirstPageButtonClick = useCallback(function (event) {
|
5
5
|
onPageChange(event, 0);
|
6
6
|
}, [onPageChange]);
|
7
|
-
|
7
|
+
var onBackButtonClick = useCallback(function (event) {
|
8
8
|
onPageChange(event, page - 1);
|
9
9
|
}, [onPageChange, page]);
|
10
|
-
|
10
|
+
var onNextButtonClick = useCallback(function (event) {
|
11
11
|
onPageChange(event, page + 1);
|
12
12
|
}, [onPageChange, page]);
|
13
|
-
|
13
|
+
var onLastPageButtonClick = useCallback(function (event) {
|
14
14
|
onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
|
15
15
|
}, [count, onPageChange, rowsPerPage]);
|
16
16
|
return {
|
17
|
-
onBackButtonClick,
|
18
|
-
onNextButtonClick,
|
19
|
-
onLastPageButtonClick,
|
20
|
-
onFirstPageButtonClick,
|
17
|
+
onBackButtonClick: onBackButtonClick,
|
18
|
+
onNextButtonClick: onNextButtonClick,
|
19
|
+
onLastPageButtonClick: onLastPageButtonClick,
|
20
|
+
onFirstPageButtonClick: onFirstPageButtonClick,
|
21
21
|
};
|
22
22
|
}
|
23
23
|
export default useInteractions;
|
package/TextInput/index.d.ts
CHANGED
@@ -9,5 +9,5 @@ export interface TextInputProps extends Omit<TextFieldProps, "onChange"> {
|
|
9
9
|
primaryColor?: CSSProperties["color"];
|
10
10
|
secondaryColor?: CSSProperties["color"];
|
11
11
|
}
|
12
|
-
declare
|
12
|
+
declare function TextInput(props: TextInputProps): JSX.Element;
|
13
13
|
export default TextInput;
|
package/TextInput/index.js
CHANGED
@@ -1,24 +1,46 @@
|
|
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";
|
4
26
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
5
27
|
import useInteractions from "./useInteractions";
|
6
28
|
import useCustomTheme from "../useCustomTheme";
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(Tooltip, { arrow: true, placement: "top", title: tooltip
|
29
|
+
function TextInput(props) {
|
30
|
+
var _a = props.type, type = _a === void 0 ? "text" : _a, onChange = props.onChange, value = props.value, _b = props.size, size = _b === void 0 ? "small" : _b, tooltip = props.tooltip, _c = props.maxLength, maxLength = _c === void 0 ? 999 : _c, _d = props.minLength, minLength = _d === void 0 ? 0 : _d, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onBlur = props.onBlur, onFocus = props.onFocus, rest = __rest(props, ["type", "onChange", "value", "size", "tooltip", "maxLength", "minLength", "primaryColor", "secondaryColor", "onBlur", "onFocus"]);
|
31
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
32
|
+
var _e = useInteractions(), tooltipOpen = _e.tooltipOpen, onOpenTooltip = _e.onOpenTooltip, onCloseTooltip = _e.onCloseTooltip;
|
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: type, value: value, onMouseEnter: onOpenTooltip, onMouseLeave: onCloseTooltip, onFocus: function (event) {
|
12
34
|
if (onFocus) {
|
13
35
|
onFocus(event);
|
14
36
|
}
|
15
|
-
}, onBlur: event
|
37
|
+
}, onBlur: function (event) {
|
16
38
|
if (onBlur) {
|
17
39
|
onBlur(event);
|
18
40
|
}
|
19
|
-
}, onChange: event
|
41
|
+
}, onChange: function (event) {
|
20
42
|
event.preventDefault();
|
21
43
|
onChange(event.target.value);
|
22
|
-
}, inputProps: { maxLength, minLength },
|
23
|
-
}
|
44
|
+
}, inputProps: { maxLength: maxLength, minLength: minLength } }, rest)) })) })));
|
45
|
+
}
|
24
46
|
export default TextInput;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { useState, useCallback } from 'react';
|
2
2
|
function useInteractions() {
|
3
|
-
|
4
|
-
|
3
|
+
var _a = useState(false), tooltipOpen = _a[0], setTooltipOpen = _a[1];
|
4
|
+
var onOpenTooltip = useCallback(function () {
|
5
5
|
setTooltipOpen(true);
|
6
6
|
}, []);
|
7
|
-
|
7
|
+
var onCloseTooltip = useCallback(function () {
|
8
8
|
setTooltipOpen(false);
|
9
9
|
}, []);
|
10
|
-
return { tooltipOpen, onOpenTooltip, onCloseTooltip };
|
10
|
+
return { tooltipOpen: tooltipOpen, onOpenTooltip: onOpenTooltip, onCloseTooltip: onCloseTooltip };
|
11
11
|
}
|
12
12
|
export default useInteractions;
|
package/ToastPrompt/Prompt.d.ts
CHANGED
@@ -1,2 +1,4 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { RefProps } from "./types";
|
3
|
+
declare const Prompt: import("react").ForwardRefExoticComponent<import("react").RefAttributes<RefProps | null>>;
|
4
|
+
export default Prompt;
|
package/ToastPrompt/Prompt.js
CHANGED
@@ -1,62 +1,30 @@
|
|
1
|
-
|
2
|
-
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
+
import { forwardRef, useImperativeHandle } from "react";
|
14
|
+
import Alert from "@mui/material/Alert";
|
3
15
|
import Slide from "@mui/material/Slide";
|
4
16
|
import Snackbar from "@mui/material/Snackbar";
|
5
17
|
import Typography from "@mui/material/Typography";
|
6
|
-
import SnackbarContent from "@mui/material/SnackbarContent";
|
7
18
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
8
|
-
import InfoIcon from "@mui/icons-material/Info";
|
9
|
-
import ErrorIcon from "@mui/icons-material/Error";
|
10
|
-
import WarningIcon from "@mui/icons-material/Warning";
|
11
|
-
import SuccessIcon from "@mui/icons-material/CheckCircle";
|
12
|
-
import { green, amber, red, blue } from "@mui/material/colors";
|
13
19
|
import useCustomTheme from "../useCustomTheme";
|
20
|
+
import useInteractions from "./useInteractions";
|
14
21
|
function Transition(args) {
|
15
|
-
return _jsx(Slide, {
|
16
|
-
}
|
17
|
-
export default function Prompt(props) {
|
18
|
-
const { open, icon, variant, message, timeout, onClose } = props;
|
19
|
-
const theme = useCustomTheme();
|
20
|
-
const styles = useMemo(() => ({
|
21
|
-
success: {
|
22
|
-
backgroundColor: green[500]
|
23
|
-
},
|
24
|
-
error: {
|
25
|
-
backgroundColor: red[400]
|
26
|
-
},
|
27
|
-
info: {
|
28
|
-
backgroundColor: blue[600]
|
29
|
-
},
|
30
|
-
warning: {
|
31
|
-
backgroundColor: amber["A700"]
|
32
|
-
}
|
33
|
-
}), []);
|
34
|
-
const VariantIcon = useMemo(() => ({
|
35
|
-
success: SuccessIcon,
|
36
|
-
warning: WarningIcon,
|
37
|
-
error: ErrorIcon,
|
38
|
-
info: InfoIcon
|
39
|
-
}), []);
|
40
|
-
const Icon = useMemo(() => VariantIcon[variant], []);
|
41
|
-
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(Snackbar, { anchorOrigin: { vertical: "bottom", horizontal: "left" }, open: open, onClose: onClose, autoHideDuration: timeout, TransitionComponent: Transition, sx: {
|
42
|
-
zIndex: 99999,
|
43
|
-
marginTop: "3vh"
|
44
|
-
}, children: _jsx(SnackbarContent, { sx: {
|
45
|
-
...styles[variant],
|
46
|
-
root: {
|
47
|
-
[theme.breakpoints.down("sm")]: {
|
48
|
-
maxWidth: "320px",
|
49
|
-
borderRadius: "4px"
|
50
|
-
}
|
51
|
-
}
|
52
|
-
}, "aria-describedby": "Toast", message: _jsxs(Typography, { id: "Toast", component: "span", sx: {
|
53
|
-
fontSize: 14,
|
54
|
-
fontWeight: 700,
|
55
|
-
display: "flex",
|
56
|
-
alignItems: "center"
|
57
|
-
}, children: [!icon ? (_jsx(Icon, { sx: {
|
58
|
-
fontSize: 20,
|
59
|
-
opacity: 0.9,
|
60
|
-
marginRight: theme.spacing(1)
|
61
|
-
} })) : (_jsx(_Fragment, { children: icon })), message] }) }) }, `${Date.now() * Math.round(Math.random())}`) }));
|
22
|
+
return _jsx(Slide, __assign({}, args, { direction: "up" }));
|
62
23
|
}
|
24
|
+
var Prompt = forwardRef(function (_, ref) {
|
25
|
+
var theme = useCustomTheme();
|
26
|
+
var _a = useInteractions(), open = _a.open, type = _a.type, message = _a.message, timeout = _a.timeout, onShow = _a.onShow, onHide = _a.onHide;
|
27
|
+
useImperativeHandle(ref, function () { return ({ onShow: onShow }); });
|
28
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Snackbar, __assign({ anchorOrigin: { vertical: "bottom", horizontal: "left" }, open: open, onClose: onHide, autoHideDuration: timeout, TransitionComponent: Transition, sx: { zIndex: 99999 } }, { children: _jsx(Alert, __assign({ variant: "filled", severity: type, sx: { width: "100%", fontSize: 14, fontWeight: 700 }, onClose: onHide }, { children: _jsx(Typography, __assign({ sx: { fontWeight: 800, fontSize: 14 } }, { children: message })) })) }), "".concat(Date.now() * Math.round(Math.random()))) })));
|
29
|
+
});
|
30
|
+
export default Prompt;
|
package/ToastPrompt/index.js
CHANGED
@@ -1,14 +1,28 @@
|
|
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 } from "react/jsx-runtime";
|
2
|
-
import { createContext, useContext } from "react";
|
3
|
-
import
|
4
|
-
|
5
|
-
|
6
|
-
showPrompt: () => { }
|
13
|
+
import { createContext, useContext, useRef, useCallback, cloneElement } from "react";
|
14
|
+
import Prompt from "./Prompt";
|
15
|
+
var PromptContext = createContext({
|
16
|
+
showPrompt: function () { }
|
7
17
|
});
|
8
18
|
export function PromptProvider(props) {
|
9
|
-
|
10
|
-
|
11
|
-
|
19
|
+
var children = props.children;
|
20
|
+
var ref = useRef(null);
|
21
|
+
var showPrompt = useCallback(function (args) {
|
22
|
+
var _a;
|
23
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.onShow(args);
|
24
|
+
}, []);
|
25
|
+
return (_jsxs(PromptContext.Provider, __assign({ value: { showPrompt: showPrompt } }, { children: [children, cloneElement(_jsx(Prompt, { ref: ref }))] })));
|
12
26
|
}
|
13
27
|
export function usePrompt() {
|
14
28
|
return useContext(PromptContext);
|
package/ToastPrompt/types.d.ts
CHANGED
@@ -1,35 +1,28 @@
|
|
1
|
-
import type { CSSProperties, ReactNode } from "react";
|
1
|
+
import type { CSSProperties, ReactNode, SyntheticEvent } from "react";
|
2
2
|
import type { SnackbarCloseReason } from "@mui/material/Snackbar";
|
3
3
|
import type { SvgIconComponent } from "@mui/icons-material";
|
4
|
-
export declare type
|
5
|
-
export declare type PromptStyles = Record<
|
4
|
+
export declare type Severity = "success" | "warning" | "info" | "error";
|
5
|
+
export declare type PromptStyles = Record<Severity, {
|
6
6
|
backgroundColor: CSSProperties["color"];
|
7
7
|
}>;
|
8
|
-
export declare type PromptIcons = Record<
|
8
|
+
export declare type PromptIcons = Record<Severity, SvgIconComponent>;
|
9
9
|
declare type PromptArgs = {
|
10
10
|
message: string | 400;
|
11
|
-
|
12
|
-
timeout
|
11
|
+
type: Severity;
|
12
|
+
timeout?: number;
|
13
13
|
};
|
14
14
|
export interface InterfaceStates {
|
15
15
|
promptArgs: PromptArgs & Record<"open", boolean>;
|
16
|
-
onHide: (
|
16
|
+
onHide: (event: SyntheticEvent | Event, reason?: SnackbarCloseReason) => void;
|
17
17
|
onShow: (args: PromptArgs) => void;
|
18
18
|
}
|
19
|
-
export interface PromptProps extends PromptArgs {
|
20
|
-
open: boolean;
|
21
|
-
icon?: SvgIconComponent;
|
22
|
-
onClose: InterfaceStates["onHide"];
|
23
|
-
}
|
24
|
-
export interface PromptStates {
|
25
|
-
styles: PromptStyles;
|
26
|
-
icons: PromptIcons;
|
27
|
-
icon: SvgIconComponent;
|
28
|
-
}
|
29
19
|
export interface PromptProviderProps {
|
30
20
|
children: ReactNode;
|
31
21
|
}
|
32
22
|
export interface PromptContextProps {
|
33
23
|
showPrompt: InterfaceStates["onShow"];
|
34
24
|
}
|
25
|
+
export interface RefProps {
|
26
|
+
onShow: InterfaceStates["onShow"];
|
27
|
+
}
|
35
28
|
export {};
|
@@ -1,14 +1,14 @@
|
|
1
|
+
/// <reference types="react" />
|
1
2
|
declare function useInteractions(): {
|
2
|
-
promptArgs: {
|
3
|
-
message: string | 400;
|
4
|
-
variant: import("./types").Variant;
|
5
|
-
timeout: number;
|
6
|
-
} & Record<"open", boolean>;
|
7
3
|
onShow: (args: {
|
8
4
|
message: string | 400;
|
9
|
-
|
10
|
-
timeout
|
5
|
+
type: import("./types").Severity;
|
6
|
+
timeout?: number | undefined;
|
11
7
|
}) => void;
|
12
|
-
onHide: (
|
8
|
+
onHide: (event: Event | import("react").SyntheticEvent<Element, Event>, reason?: import("@mui/material").SnackbarCloseReason | undefined) => void;
|
9
|
+
message: string | 400;
|
10
|
+
type: import("./types").Severity;
|
11
|
+
timeout?: number | undefined;
|
12
|
+
open: boolean;
|
13
13
|
};
|
14
14
|
export default useInteractions;
|