@symply.io/basic-components 1.0.0-alpha.8 → 1.0.0-beta.1
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 +0 -1
- package/AlertDialog/index.js +2 -2
- package/Autocomplete/index.d.ts +4 -0
- package/Autocomplete/index.js +38 -0
- package/Autocomplete/types.d.ts +15 -0
- package/Autocomplete/types.js +1 -0
- package/Autocomplete/useInteractions.d.ts +5 -0
- package/Autocomplete/useInteractions.js +9 -0
- package/AutocompleteWithFilter/index.d.ts +4 -0
- package/AutocompleteWithFilter/index.js +54 -0
- package/AutocompleteWithFilter/types.d.ts +16 -0
- package/AutocompleteWithFilter/types.js +1 -0
- package/BasicModal/Content.d.ts +0 -1
- package/BasicModal/Content.js +1 -1
- package/BasicModal/index.d.ts +0 -1
- package/BasicModal/index.js +3 -6
- package/BreadCrumbs/index.d.ts +4 -0
- package/BreadCrumbs/index.js +37 -0
- package/BreadCrumbs/types.d.ts +9 -0
- package/BreadCrumbs/types.js +1 -0
- package/CheckBox/CheckBox.d.ts +3 -0
- package/CheckBox/CheckBox.js +36 -0
- package/CheckBox/CheckBoxGroup.d.ts +3 -0
- package/CheckBox/CheckBoxGroup.js +30 -0
- package/CheckBox/index.d.ts +3 -0
- package/CheckBox/index.js +3 -0
- package/CheckBox/types.d.ts +12 -0
- package/CheckBox/types.js +1 -0
- package/Copyright/index.d.ts +4 -0
- package/Copyright/index.js +25 -0
- package/Copyright/types.d.ts +5 -0
- package/Copyright/types.js +1 -0
- package/DateInput/FullDateInput/index.d.ts +5 -0
- package/DateInput/FullDateInput/index.js +66 -0
- package/DateInput/FullDateInput/types.d.ts +14 -0
- package/DateInput/FullDateInput/types.js +1 -0
- package/DateInput/FullDateInput/useInteractions.d.ts +8 -0
- package/DateInput/FullDateInput/useInteractions.js +20 -0
- package/DateInput/MonthDayInput/index.d.ts +5 -0
- package/DateInput/MonthDayInput/index.js +54 -0
- package/DateInput/MonthDayInput/types.d.ts +14 -0
- package/DateInput/MonthDayInput/types.js +1 -0
- package/DateInput/MonthDayInput/useInteractions.d.ts +8 -0
- package/DateInput/MonthDayInput/useInteractions.js +19 -0
- package/DateInput/MonthYearInput/index.d.ts +5 -0
- package/DateInput/MonthYearInput/index.js +55 -0
- package/DateInput/MonthYearInput/types.d.ts +14 -0
- package/DateInput/MonthYearInput/types.js +1 -0
- package/DateInput/MonthYearInput/useInteractions.d.ts +8 -0
- package/DateInput/MonthYearInput/useInteractions.js +19 -0
- package/DateInput/index.d.ts +6 -0
- package/DateInput/index.js +6 -0
- package/DigitInput/index.d.ts +1 -4
- package/DigitInput/index.js +3 -3
- package/DigitInput/types.d.ts +2 -1
- package/DynamicHeaderBar/HeaderBar.js +1 -1
- package/DynamicHeaderBar/HeaderButtons.d.ts +0 -1
- package/DynamicHeaderBar/HeaderButtons.js +5 -5
- package/DynamicHeaderBar/HeaderLine.js +1 -1
- package/DynamicHeaderBar/index.js +2 -2
- package/FeinInput/index.d.ts +6 -0
- package/FeinInput/index.js +73 -0
- package/FeinInput/types.d.ts +9 -0
- package/FeinInput/types.js +1 -0
- package/FeinInput/useInteractions.d.ts +8 -0
- package/FeinInput/useInteractions.js +16 -0
- package/FormRadioGroup/index.d.ts +0 -1
- package/FormRadioGroup/index.js +3 -3
- package/FormSelector/MultipleSelector.d.ts +0 -1
- package/FormSelector/MultipleSelector.js +14 -3
- package/FormSelector/SimpleSelector.d.ts +0 -1
- package/FormSelector/SimpleSelector.js +3 -3
- package/FormSelector/types.d.ts +2 -7
- package/HelpCaption/index.js +2 -2
- package/LoadingModal/index.d.ts +0 -1
- package/LoadingModal/index.js +1 -1
- package/MenuButtonGroup/MenuItem.d.ts +0 -1
- package/MenuButtonGroup/MenuItem.js +1 -1
- package/MenuButtonGroup/index.js +2 -2
- package/NumberInput/index.d.ts +2 -3
- package/NumberInput/index.js +1 -1
- package/PasswordInput/ConfirmPassword.d.ts +2 -3
- package/PasswordInput/ConfirmPassword.js +1 -1
- package/PasswordInput/Password.d.ts +3 -4
- package/PasswordInput/Password.js +2 -2
- package/PhoneNumberInput/index.d.ts +2 -3
- package/PhoneNumberInput/index.js +2 -2
- package/README.md +380 -14
- package/Sidebar/SidebarItem.d.ts +3 -0
- package/Sidebar/SidebarItem.js +62 -0
- package/Sidebar/SidebarItemsGroup.d.ts +5 -0
- package/Sidebar/SidebarItemsGroup.js +38 -0
- package/Sidebar/SidebarLink.d.ts +3 -0
- package/Sidebar/SidebarLink.js +37 -0
- package/Sidebar/index.d.ts +7 -0
- package/Sidebar/index.js +30 -0
- package/Sidebar/types.d.ts +31 -0
- package/Sidebar/types.js +1 -0
- package/SocialInput/index.d.ts +6 -0
- package/SocialInput/index.js +76 -0
- package/SocialInput/types.d.ts +9 -0
- package/SocialInput/types.js +1 -0
- package/SocialInput/useInteractions.d.ts +10 -0
- package/SocialInput/useInteractions.js +26 -0
- package/TabGroup/index.js +10 -5
- package/TablePagination/Actions.d.ts +3 -0
- package/TablePagination/Actions.js +27 -0
- package/TablePagination/index.d.ts +4 -0
- package/TablePagination/index.js +30 -0
- package/TablePagination/types.d.ts +14 -0
- package/TablePagination/types.js +1 -0
- package/TablePagination/useInteractions.d.ts +14 -0
- package/TablePagination/useInteractions.js +23 -0
- package/TextInput/index.d.ts +2 -3
- package/TextInput/index.js +13 -3
- package/ToastPrompt/Presentation.js +3 -3
- package/ToastPrompt/index.js +1 -1
- package/VideoPlayerModal/index.d.ts +1 -3
- package/VideoPlayerModal/index.js +2 -2
- package/VideoPlayerModal/types.d.ts +2 -1
- package/index.d.ts +18 -0
- package/index.js +18 -0
- package/package.json +8 -2
@@ -0,0 +1,54 @@
|
|
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 { useRifm } from "rifm";
|
14
|
+
import TextField from "@mui/material/TextField";
|
15
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
16
|
+
import useInteractions from "./useInteractions";
|
17
|
+
import useCustomTheme from "../../useCustomTheme";
|
18
|
+
export function MonthDayFormat(str) {
|
19
|
+
var digits = (str.match(/\d+/g) || []).join("");
|
20
|
+
var chars = digits.split("");
|
21
|
+
return chars.reduce(function (prev, curr, index) {
|
22
|
+
if (index === 2) {
|
23
|
+
return "".concat(prev, " / ").concat(curr);
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
return "".concat(prev).concat(curr);
|
27
|
+
}
|
28
|
+
}, "");
|
29
|
+
}
|
30
|
+
export function verifyMonthDayDate(monthDayString) {
|
31
|
+
var reg = /^((((0[1,3,5,7,8]{1})|(1[0,2]{1}))\s?\/\s?((0[1-9]{1})|([1-2]{1}\d{1})|(3[0-1]{1})))|(((0[4,6,9]{1})|(11))\s?\/\s?((0[1-9]{1})|([1-2]{1}\d{1})|(30)))|((02)\s?\/\s?(0[1-9]{1})|([1-2]{1}\d{1})))$/g;
|
32
|
+
return reg.test(monthDayString);
|
33
|
+
}
|
34
|
+
function MonthDayInput(props) {
|
35
|
+
var name = props.name, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, value = props.value, _a = props.margin, margin = _a === void 0 ? "normal" : _a, error = props.error, _b = props.helperText, helperText = _b === void 0 ? "Please enter a valid date" : _b, verifyFn = props.verifyFn, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
|
36
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
37
|
+
var _c = useInteractions({ value: value }), valLength = _c.valLength, addMask = _c.addMask;
|
38
|
+
var rifm = useRifm({
|
39
|
+
mask: true,
|
40
|
+
value: String(value),
|
41
|
+
onChange: onChange,
|
42
|
+
replace: addMask,
|
43
|
+
format: MonthDayFormat
|
44
|
+
});
|
45
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, { placeholder: "MM / DD", error: error ||
|
46
|
+
(valLength > 0 &&
|
47
|
+
(verifyFn ? !verifyFn(value) : !verifyMonthDayDate(value))), margin: margin, name: name, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 &&
|
48
|
+
(verifyFn ? !verifyFn(value) : !verifyMonthDayDate(value))
|
49
|
+
? helperText
|
50
|
+
: "", onFocus: onFocus, onBlur: onBlur, InputLabelProps: {
|
51
|
+
shrink: true
|
52
|
+
} }) })));
|
53
|
+
}
|
54
|
+
export default MonthDayInput;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { CSSProperties } from "react";
|
2
|
+
export interface DateInputprops {
|
3
|
+
name: string;
|
4
|
+
onChange: (value: string) => void;
|
5
|
+
onFocus?: () => void;
|
6
|
+
onBlur?: () => void;
|
7
|
+
verifyFn?: (value?: string) => boolean;
|
8
|
+
helperText?: string;
|
9
|
+
margin?: "none" | "normal" | "dense" | undefined;
|
10
|
+
error?: boolean;
|
11
|
+
value: string;
|
12
|
+
primaryColor?: CSSProperties["color"];
|
13
|
+
secondaryColor?: CSSProperties["color"];
|
14
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
2
|
+
function useInteractions(props) {
|
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
|
+
if (digits) {
|
9
|
+
return "".concat(month, " / ").concat(day);
|
10
|
+
}
|
11
|
+
return "";
|
12
|
+
}, []);
|
13
|
+
var valLength = useMemo(function () {
|
14
|
+
var digitsArr = String(value).match(/\d/g);
|
15
|
+
return digitsArr ? digitsArr.length : 0;
|
16
|
+
}, [value]);
|
17
|
+
return { valLength: valLength, addMask: addMask };
|
18
|
+
}
|
19
|
+
export default useInteractions;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { DateInputprops } from "./types";
|
2
|
+
export declare function MonthYearFormat(str: string): string;
|
3
|
+
export declare function verifyMonthYearDate(monthYearString: string): boolean;
|
4
|
+
declare function MonthYearInput(props: DateInputprops): JSX.Element;
|
5
|
+
export default MonthYearInput;
|
@@ -0,0 +1,55 @@
|
|
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 { useRifm } from "rifm";
|
14
|
+
import TextField from "@mui/material/TextField";
|
15
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
16
|
+
import useInteractions from "./useInteractions";
|
17
|
+
import useCustomTheme from "../../useCustomTheme";
|
18
|
+
export function MonthYearFormat(str) {
|
19
|
+
var digits = (str.match(/\d+/g) || []).join("");
|
20
|
+
var chars = digits.split("");
|
21
|
+
return chars.reduce(function (prev, curr, index) {
|
22
|
+
if (index === 2) {
|
23
|
+
return "".concat(prev, " / ").concat(curr);
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
return "".concat(prev).concat(curr);
|
27
|
+
}
|
28
|
+
}, "");
|
29
|
+
}
|
30
|
+
export function verifyMonthYearDate(monthYearString) {
|
31
|
+
var reg = /^(((0[1-9]{1})|(1[0-2]{1}))\s?\/\s?([1-2]{1}\d{3}))$/g;
|
32
|
+
reg.lastIndex = 0;
|
33
|
+
return reg.test(monthYearString);
|
34
|
+
}
|
35
|
+
function MonthYearInput(props) {
|
36
|
+
var name = props.name, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, value = props.value, _a = props.margin, margin = _a === void 0 ? "normal" : _a, error = props.error, _b = props.helperText, helperText = _b === void 0 ? "Please enter a valid date" : _b, verifyFn = props.verifyFn, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
|
37
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
38
|
+
var _c = useInteractions({ value: value }), valLength = _c.valLength, addMask = _c.addMask;
|
39
|
+
var rifm = useRifm({
|
40
|
+
mask: true,
|
41
|
+
value: String(value),
|
42
|
+
onChange: onChange,
|
43
|
+
replace: addMask,
|
44
|
+
format: MonthYearFormat
|
45
|
+
});
|
46
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, { placeholder: "MM / YYYY", error: error ||
|
47
|
+
(valLength > 0 &&
|
48
|
+
(verifyFn ? !verifyFn(value) : !verifyMonthYearDate(value))), margin: margin, name: name, value: rifm.value, onChange: rifm.onChange, helperText: valLength > 0 &&
|
49
|
+
(verifyFn ? !verifyFn(value) : !verifyMonthYearDate(value))
|
50
|
+
? helperText
|
51
|
+
: "", onFocus: onFocus, onBlur: onBlur, InputLabelProps: {
|
52
|
+
shrink: true
|
53
|
+
} }) })));
|
54
|
+
}
|
55
|
+
export default MonthYearInput;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { CSSProperties } from "react";
|
2
|
+
export interface DateInputprops {
|
3
|
+
name: string;
|
4
|
+
onChange: (value: string) => void;
|
5
|
+
onFocus?: () => void;
|
6
|
+
onBlur?: () => void;
|
7
|
+
verifyFn?: (value?: string) => boolean;
|
8
|
+
helperText?: string;
|
9
|
+
margin?: "none" | "normal" | "dense" | undefined;
|
10
|
+
error?: boolean;
|
11
|
+
value: string;
|
12
|
+
primaryColor?: CSSProperties["color"];
|
13
|
+
secondaryColor?: CSSProperties["color"];
|
14
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
2
|
+
function useInteractions(props) {
|
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
|
+
if (digits) {
|
9
|
+
return "".concat(month, " / ").concat(Year);
|
10
|
+
}
|
11
|
+
return "";
|
12
|
+
}, []);
|
13
|
+
var valLength = useMemo(function () {
|
14
|
+
var digitsArr = String(value).match(/\d/g);
|
15
|
+
return digitsArr ? digitsArr.length : 0;
|
16
|
+
}, [value]);
|
17
|
+
return { valLength: valLength, addMask: addMask };
|
18
|
+
}
|
19
|
+
export default useInteractions;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export * from "./MonthDayInput";
|
2
|
+
export * from "./MonthYearInput";
|
3
|
+
export * from "./FullDateInput";
|
4
|
+
export { default as MonthDayInput } from "./MonthDayInput";
|
5
|
+
export { default as MonthYearInput } from "./MonthYearInput";
|
6
|
+
export { default as FullDateInput } from "./FullDateInput";
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export * from "./MonthDayInput";
|
2
|
+
export * from "./MonthYearInput";
|
3
|
+
export * from "./FullDateInput";
|
4
|
+
export { default as MonthDayInput } from "./MonthDayInput";
|
5
|
+
export { default as MonthYearInput } from "./MonthYearInput";
|
6
|
+
export { default as FullDateInput } from "./FullDateInput";
|
package/DigitInput/index.d.ts
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
import { TextFieldProps } from "@mui/material/TextField";
|
3
1
|
import { DigitInputProps } from "./types";
|
4
|
-
declare
|
5
|
-
declare function DigitInput(props: DigitInputProps & TextProps): JSX.Element;
|
2
|
+
declare function DigitInput(props: DigitInputProps): JSX.Element;
|
6
3
|
export default DigitInput;
|
7
4
|
export * from "./types";
|
package/DigitInput/index.js
CHANGED
@@ -27,12 +27,12 @@ import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
|
27
27
|
import useInteractions from "./useInteractions";
|
28
28
|
import useCustomTheme from "../useCustomTheme";
|
29
29
|
function DigitInput(props) {
|
30
|
-
var onChange = props.onChange, value = props.value, _a = props.size, size = _a === void 0 ? "small" : _a, tooltip = props.tooltip,
|
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
31
|
var _d = useInteractions({ onChange: onChange }), tooltipOpen = _d.tooltipOpen, handleChange = _d.handleChange, onOpenTooltip = _d.onOpenTooltip, onCloseTooltip = _d.onCloseTooltip;
|
32
32
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
33
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsx(Field, __assign({ size: size, margin: "dense", type: "
|
33
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ 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, onFocus: onOpenTooltip, onBlur: onCloseTooltip, inputProps: { maxLength: maxLength, minLength: minLength }, InputProps: {
|
34
34
|
endAdornment: endAdornment
|
35
|
-
}, onChange: handleChange }, rest)
|
35
|
+
}, onChange: handleChange }, rest)) })) })));
|
36
36
|
}
|
37
37
|
export default DigitInput;
|
38
38
|
export * from "./types";
|
package/DigitInput/types.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { CSSProperties } from "react";
|
2
2
|
import { InputProps } from "@mui/material/Input";
|
3
|
-
|
3
|
+
import { TextFieldProps } from "@mui/material/TextField";
|
4
|
+
export interface DigitInputProps extends Omit<TextFieldProps, "onChange"> {
|
4
5
|
onChange: (value: string) => void;
|
5
6
|
value: string;
|
6
7
|
tooltip?: string;
|
@@ -27,6 +27,6 @@ function HeaderBar(props) {
|
|
27
27
|
var hasButtons = useMemo(function () { return buttons.length > 0; }, [buttons.length]);
|
28
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 () {
|
29
29
|
onBack ? onBack() : window.history.back();
|
30
|
-
} }, { children: _jsx(ArrowBackIcon, { fontSize: "small" }
|
30
|
+
} }, { children: _jsx(ArrowBackIcon, { fontSize: "small" }) }))), _jsx(Typography, __assign({ align: "left", variant: isLessThanSm ? "h6" : "h3", sx: { fontWeight: 600 } }, { children: title }))] })) })), hasButtons ? (_jsx(Grid, __assign({ item: true, xs: 12, sm: 6, md: 7, lg: 8, xl: 9 }, { children: _jsx(HeaderButtons, { buttons: buttons }) }))) : (_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 }) })) })), 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) })) })))] })) })));
|
31
31
|
}
|
32
32
|
export default HeaderBar;
|
@@ -26,19 +26,19 @@ function HeaderButtons(props) {
|
|
26
26
|
switch (button.type) {
|
27
27
|
case HeaderButtonCategory.TextButton: {
|
28
28
|
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;
|
29
|
-
return (_jsx(Grid, __assign({ item: true, xs: isLessThanSm ? 12 : undefined, style: { textAlign: "end" } }, { children: _jsx(Button, __assign({ fullWidth: isLessThanSm, variant: variant, onClick: onClick, color: color, size: isLessThanSm ? "small" : size, startIcon: startIcon, endIcon: endIcon, disabled: disabled }, { children: text })
|
29
|
+
return (_jsx(Grid, __assign({ item: true, xs: isLessThanSm ? 12 : undefined, style: { textAlign: "end" } }, { children: _jsx(Button, __assign({ fullWidth: isLessThanSm, variant: variant, onClick: onClick, color: color, size: isLessThanSm ? "small" : size, startIcon: startIcon, endIcon: endIcon, disabled: disabled }, { children: text })) }), text));
|
30
30
|
}
|
31
31
|
case HeaderButtonCategory.IconButton: {
|
32
32
|
var title = button.title, onClick = button.onClick, color = button.color, _b = button.size, size = _b === void 0 ? "medium" : _b, icon = button.icon;
|
33
|
-
return (_jsx(Grid, __assign({ item: true, style: { textAlign: "end" } }, { children: _jsx(Fab, __assign({ onClick: onClick, color: color, title: title, size: isLessThanSm ? "small" : size }, { children: icon })
|
33
|
+
return (_jsx(Grid, __assign({ item: true, style: { textAlign: "end" } }, { children: _jsx(Fab, __assign({ onClick: onClick, color: color, title: title, size: isLessThanSm ? "small" : size }, { children: icon })) }), title));
|
34
34
|
}
|
35
35
|
case HeaderButtonCategory.MenuButton: {
|
36
36
|
var btns = button.buttons, buttonText = button.buttonText, disabled = button.disabled, variant = button.variant, size = button.size;
|
37
|
-
return (_jsx(Grid, __assign({ item: true, xs: isLessThanSm ? 12 : undefined, style: { textAlign: "end" } }, { children: _jsx(MenuButtonGroup, { size: isLessThanSm ? "small" : size, variant: variant, buttons: btns, buttonText: buttonText, disabled: disabled }
|
37
|
+
return (_jsx(Grid, __assign({ item: true, xs: isLessThanSm ? 12 : undefined, style: { textAlign: "end" } }, { children: _jsx(MenuButtonGroup, { size: isLessThanSm ? "small" : size, variant: variant, buttons: btns, buttonText: buttonText, disabled: disabled }) }), buttonText));
|
38
38
|
}
|
39
39
|
default:
|
40
|
-
return _jsx(_Fragment, {}
|
40
|
+
return _jsx(_Fragment, {});
|
41
41
|
}
|
42
|
-
}) })
|
42
|
+
}) })) })));
|
43
43
|
}
|
44
44
|
export default HeaderButtons;
|
@@ -37,13 +37,13 @@ export function HeaderProvider(props) {
|
|
37
37
|
setHeight(node.getBoundingClientRect().height);
|
38
38
|
}
|
39
39
|
}, [headerProps]);
|
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)
|
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)) })) }))) : (_jsx(_Fragment, {})), cloneElement(children, {
|
41
41
|
sx: {
|
42
42
|
p: 3,
|
43
43
|
py: 1,
|
44
44
|
pt: height ? "calc(".concat(height, "px)") : undefined,
|
45
45
|
},
|
46
|
-
})] }
|
46
|
+
})] }) })));
|
47
47
|
}
|
48
48
|
export function useHeaderBar() {
|
49
49
|
return useContext(HeaderContext);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { FeinInputProps } from "./types";
|
2
|
+
export declare function FeinInputFormat(str: string): string;
|
3
|
+
export declare function verifyFein(feinString: string): boolean;
|
4
|
+
declare function FeinInput(props: FeinInputProps): JSX.Element;
|
5
|
+
export default FeinInput;
|
6
|
+
export * from "./types";
|
@@ -0,0 +1,73 @@
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
2
|
+
__assign = Object.assign || function(t) {
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
+
s = arguments[i];
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
+
t[p] = s[p];
|
7
|
+
}
|
8
|
+
return t;
|
9
|
+
};
|
10
|
+
return __assign.apply(this, arguments);
|
11
|
+
};
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
+
var t = {};
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
+
t[p] = s[p];
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
+
t[p[i]] = s[p[i]];
|
20
|
+
}
|
21
|
+
return t;
|
22
|
+
};
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
24
|
+
import { useRifm } from "rifm";
|
25
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
26
|
+
import TextField from "@mui/material/TextField";
|
27
|
+
import useInteractions from "./useInteractions";
|
28
|
+
import useCustomTheme from "../useCustomTheme";
|
29
|
+
export function FeinInputFormat(str) {
|
30
|
+
var digits = (str.match(/\d+/g) || []).join("");
|
31
|
+
var chars = digits.split("");
|
32
|
+
return chars.reduce(function (prev, curr, index) {
|
33
|
+
if (index === 2) {
|
34
|
+
return "".concat(prev, " - ").concat(curr);
|
35
|
+
}
|
36
|
+
else {
|
37
|
+
return "".concat(prev).concat(curr);
|
38
|
+
}
|
39
|
+
}, "");
|
40
|
+
}
|
41
|
+
export function verifyFein(feinString) {
|
42
|
+
var reg = /^\d{2}\s?-\s?\d{7}$/g;
|
43
|
+
return reg.test(feinString);
|
44
|
+
}
|
45
|
+
function FeinInput(props) {
|
46
|
+
var value = props.value, _a = props.error, error = _a === void 0 ? false : _a, _b = props.helperText, helperText = _b === void 0 ? "Please enter a valid FEIN" : _b, onChange = props.onChange, verifyFn = props.verifyFn, onFocus = props.onFocus, onBlur = props.onBlur, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["value", "error", "helperText", "onChange", "verifyFn", "onFocus", "onBlur", "primaryColor", "secondaryColor"]);
|
47
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
48
|
+
var _c = useInteractions({ value: value }), valLength = _c.valLength, addMask = _c.addMask;
|
49
|
+
var rifm = useRifm({
|
50
|
+
mask: true,
|
51
|
+
value: String(value),
|
52
|
+
onChange: onChange,
|
53
|
+
replace: addMask,
|
54
|
+
format: FeinInputFormat
|
55
|
+
});
|
56
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ value: rifm.value, onChange: rifm.onChange, error: error ||
|
57
|
+
(valLength > 0 && (verifyFn ? !verifyFn(value) : verifyFein(value))), helperText: valLength > 0 && (verifyFn ? !verifyFn(value) : verifyFein(value))
|
58
|
+
? helperText
|
59
|
+
: "", onFocus: function (event) {
|
60
|
+
if (onFocus) {
|
61
|
+
onFocus(event);
|
62
|
+
}
|
63
|
+
}, onBlur: function (event) {
|
64
|
+
onChange(value.trim());
|
65
|
+
if (onBlur) {
|
66
|
+
onBlur(event);
|
67
|
+
}
|
68
|
+
}, InputLabelProps: {
|
69
|
+
shrink: true
|
70
|
+
} }, rest)) })));
|
71
|
+
}
|
72
|
+
export default FeinInput;
|
73
|
+
export * from "./types";
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { CSSProperties } from "react";
|
2
|
+
import { TextFieldProps } from "@mui/material/TextField";
|
3
|
+
export interface FeinInputProps extends Omit<TextFieldProps, "onChange"> {
|
4
|
+
onChange: (value: string) => void;
|
5
|
+
verifyFn?: (value?: string) => boolean;
|
6
|
+
value: string;
|
7
|
+
primaryColor?: CSSProperties["color"];
|
8
|
+
secondaryColor?: CSSProperties["color"];
|
9
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
2
|
+
function useInteractions(props) {
|
3
|
+
var value = props.value;
|
4
|
+
var addMask = useCallback(function (str) {
|
5
|
+
var digits = (str.match(/\d+/g) || []).join("");
|
6
|
+
var areaCode = digits.slice(0, 2).padEnd(2, "_");
|
7
|
+
var prefixCode = digits.slice(2, 9).padEnd(7, "_");
|
8
|
+
return "".concat(areaCode, " - ").concat(prefixCode);
|
9
|
+
}, []);
|
10
|
+
var valLength = useMemo(function () {
|
11
|
+
var digitsArr = String(value).match(/\d/g);
|
12
|
+
return digitsArr ? digitsArr.length : 0;
|
13
|
+
}, [value]);
|
14
|
+
return { valLength: valLength, addMask: addMask };
|
15
|
+
}
|
16
|
+
export default useInteractions;
|
package/FormRadioGroup/index.js
CHANGED
@@ -22,7 +22,7 @@ import useCustomTheme from "../useCustomTheme";
|
|
22
22
|
function FormRadioGroup(props) {
|
23
23
|
var formLabel = props.formLabel, color = props.color, value = props.value, options = props.options, disabled = props.disabled, tooltip = props.tooltip, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onChange = props.onChange;
|
24
24
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
25
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(FormControl, __assign({ sx: { mt: 3 }, component: "fieldset", disabled: disabled }, { children: [tooltip ? (_jsx(Tooltip, __assign({ title: tooltip, placement: "right", disableTouchListener: true }, { children: _jsx(FormLabel, __assign({ sx: { lineHeight: "24px" }, component: "legend" }, { children: formLabel })
|
25
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(FormControl, __assign({ sx: { mt: 3 }, component: "fieldset", disabled: disabled }, { children: [tooltip ? (_jsx(Tooltip, __assign({ title: tooltip, placement: "right", disableTouchListener: true }, { children: _jsx(FormLabel, __assign({ sx: { lineHeight: "24px" }, component: "legend" }, { children: formLabel })) }))) : (_jsx(FormLabel, __assign({ sx: { lineHeight: "24px" }, component: "legend" }, { children: formLabel }))), _jsx(RadioGroup, __assign({ value: value, onChange: function (event) {
|
26
26
|
onChange(event.target.value);
|
27
27
|
}, sx: {
|
28
28
|
my: 1,
|
@@ -31,8 +31,8 @@ function FormRadioGroup(props) {
|
|
31
31
|
}
|
32
32
|
} }, { children: options.map(function (opt) {
|
33
33
|
var _a;
|
34
|
-
return (_jsx(FormControlLabel, { value: opt.value, control: _jsx(Radio, { color: color || "primary" }
|
35
|
-
}) })
|
34
|
+
return (_jsx(FormControlLabel, { value: opt.value, control: _jsx(Radio, { color: color || "primary" }), label: _jsx(Typography, { children: opt.label }), disabled: ((_a = opt.disabled) !== null && _a !== void 0 ? _a : false) || disabled }, String(opt.value)));
|
35
|
+
}) }))] })) })));
|
36
36
|
}
|
37
37
|
export default FormRadioGroup;
|
38
38
|
export * from "./types";
|
@@ -9,6 +9,17 @@ var __assign = (this && this.__assign) || function () {
|
|
9
9
|
};
|
10
10
|
return __assign.apply(this, arguments);
|
11
11
|
};
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
+
var t = {};
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
+
t[p] = s[p];
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
+
t[p[i]] = s[p[i]];
|
20
|
+
}
|
21
|
+
return t;
|
22
|
+
};
|
12
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
13
24
|
import Select from "@mui/material/Select";
|
14
25
|
import Tooltip from "@mui/material/Tooltip";
|
@@ -20,10 +31,10 @@ import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
|
20
31
|
import useInteractions from "./useInteractions";
|
21
32
|
import useCustomTheme from "../useCustomTheme";
|
22
33
|
function MultipleSelector(props) {
|
23
|
-
var
|
34
|
+
var label = props.label, _a = props.variant, variant = _a === void 0 ? "outlined" : _a, value = props.value, tooltip = props.tooltip, _b = props.required, required = _b === void 0 ? false : _b, _c = props.disabled, disabled = _c === void 0 ? false : _c, _d = props.multiple, multiple = _d === void 0 ? false : _d, _e = props.showHelperText, showHelperText = _e === void 0 ? false : _e, helperText = props.helperText, _f = props.options, options = _f === void 0 ? [] : _f, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onChange = props.onChange, rest = __rest(props, ["label", "variant", "value", "tooltip", "required", "disabled", "multiple", "showHelperText", "helperText", "options", "primaryColor", "secondaryColor", "onChange"]);
|
24
35
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
25
36
|
var _g = useInteractions(), tooltipOpen = _g.tooltipOpen, onOpenTooltip = _g.onOpenTooltip, onCloseTooltip = _g.onCloseTooltip;
|
26
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsxs(FormControl, __assign({ variant: variant, disabled: disabled,
|
37
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsxs(FormControl, __assign({ variant: variant, disabled: disabled, required: required }, rest, { children: [label && (_jsx(InputLabel, __assign({ id: "symply-multiple-select" }, { children: label }))), _jsx(Select, __assign({ disabled: disabled, required: required, value: value, multiple: true, onChange: function (event) {
|
27
38
|
var _a;
|
28
39
|
onChange((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value);
|
29
40
|
}, inputProps: {
|
@@ -32,6 +43,6 @@ function MultipleSelector(props) {
|
|
32
43
|
}, label: label, renderValue: multiple ? function (selected) { return selected.join("; "); } : undefined }, { children: (options === null || options === void 0 ? void 0 : options.length) > 0 ? (options.map(function (option) {
|
33
44
|
var _a = option, label = _a.label, value = _a.value;
|
34
45
|
return (_jsx(MenuItem, __assign({ value: value }, { children: label }), value));
|
35
|
-
})) : (_jsx(MenuItem, __assign({ value: "", disabled: true }, { children: "No Options" })
|
46
|
+
})) : (_jsx(MenuItem, __assign({ value: "", disabled: true }, { children: "No Options" }))) })), !!helperText && showHelperText && (_jsx(FormHelperText, { children: showHelperText }))] })) })) })));
|
36
47
|
}
|
37
48
|
export default MultipleSelector;
|
@@ -31,10 +31,10 @@ import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
|
31
31
|
import useInteractions from "./useInteractions";
|
32
32
|
import useCustomTheme from "../useCustomTheme";
|
33
33
|
function SimpleSelector(props) {
|
34
|
-
var
|
34
|
+
var label = props.label, _a = props.variant, variant = _a === void 0 ? "outlined" : _a, value = props.value, tooltip = props.tooltip, _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props.required, required = _c === void 0 ? false : _c, _d = props.showHelperText, showHelperText = _d === void 0 ? false : _d, helperText = props.helperText, _e = props.options, options = _e === void 0 ? [] : _e, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onChange = props.onChange, rest = __rest(props, ["label", "variant", "value", "tooltip", "disabled", "required", "showHelperText", "helperText", "options", "primaryColor", "secondaryColor", "onChange"]);
|
35
35
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
36
36
|
var _f = useInteractions(), tooltipOpen = _f.tooltipOpen, onOpenTooltip = _f.onOpenTooltip, onCloseTooltip = _f.onCloseTooltip;
|
37
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsxs(FormControl, __assign({ variant: variant, disabled: disabled,
|
37
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsxs(FormControl, __assign({ variant: variant, disabled: disabled, required: required }, rest, { children: [label && (_jsx(InputLabel, __assign({ id: "symply-simple-selector" }, { children: label }))), _jsx(Select, __assign({ value: value, required: required, disabled: disabled, onChange: function (event) {
|
38
38
|
var _a;
|
39
39
|
onChange((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value);
|
40
40
|
}, inputProps: {
|
@@ -43,6 +43,6 @@ function SimpleSelector(props) {
|
|
43
43
|
}, label: label }, { children: (options === null || options === void 0 ? void 0 : options.length) > 0 ? (options.map(function (option) {
|
44
44
|
var label = option.label, value = option.value, disabled = option.disabled;
|
45
45
|
return (_jsx(MenuItem, __assign({ value: value, disabled: disabled }, { children: label }), value));
|
46
|
-
})) : (_jsx(MenuItem, __assign({ value: "", disabled: true }, { children: "No Options" })
|
46
|
+
})) : (_jsx(MenuItem, __assign({ value: "", disabled: true }, { children: "No Options" }))) })), !!helperText && showHelperText && (_jsx(FormHelperText, { children: showHelperText }))] })) })) })));
|
47
47
|
}
|
48
48
|
export default SimpleSelector;
|
package/FormSelector/types.d.ts
CHANGED
@@ -1,16 +1,11 @@
|
|
1
1
|
import { ReactNode, CSSProperties } from "react";
|
2
2
|
import { SelectProps } from "@mui/material/Select";
|
3
|
-
|
4
|
-
|
3
|
+
import { FormControlProps } from "@mui/material/FormControl";
|
4
|
+
interface SelectorBaseProps extends Omit<FormControlProps, "onChange"> {
|
5
5
|
label?: string;
|
6
6
|
tooltip?: ReactNode;
|
7
|
-
variant?: SelectProps["variant"];
|
8
|
-
disabled?: SelectProps["disabled"];
|
9
7
|
showHelperText?: boolean;
|
10
|
-
fullWidth?: boolean;
|
11
8
|
helperText?: string;
|
12
|
-
error?: boolean;
|
13
|
-
size?: SelectProps["size"];
|
14
9
|
multiple?: SelectProps["multiple"];
|
15
10
|
primaryColor?: CSSProperties["color"];
|
16
11
|
secondaryColor?: CSSProperties["color"];
|