@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/NumberInput/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 NumberInput(props) {
|
8
|
-
|
9
|
-
|
10
|
-
|
30
|
+
var onChange = props.onChange, value = props.value, _a = props.size, size = _a === void 0 ? "small" : _a, tooltip = props.tooltip, _b = props.integerOnly, integerOnly = _b === void 0 ? false : _b, _c = props.minValue, minValue = _c === void 0 ? Number.MIN_SAFE_INTEGER : _c, _d = props.maxValue, maxValue = _d === void 0 ? Number.MAX_SAFE_INTEGER : _d, error = props.error, helperText = props.helperText, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["onChange", "value", "size", "tooltip", "integerOnly", "minValue", "maxValue", "error", "helperText", "primaryColor", "secondaryColor"]);
|
31
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
32
|
+
var EXCEED_ERROR = "Your value exceeds the exceptable input range";
|
11
33
|
if (maxValue < minValue)
|
12
34
|
throw new Error("Max should be bigger than the `miniValue`!");
|
13
|
-
|
14
|
-
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(Tooltip, { arrow: true, placement: "top", title: tooltip
|
35
|
+
var _e = useInteractions({ maxValue: maxValue, minValue: minValue, value: value, onChange: onChange }), exceedError = _e.exceedError, tooltipOpen = _e.tooltipOpen, handleBlur = _e.handleBlur, handleChange = _e.handleChange, onOpenTooltip = _e.onOpenTooltip, onCloseTooltip = _e.onCloseTooltip;
|
36
|
+
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: "number", value: value === undefined || value === null ? "" : value, onMouseEnter: onOpenTooltip, onMouseLeave: onCloseTooltip, onBlur: handleBlur, onChange: handleChange, error: error || exceedError, helperText: helperText || (exceedError ? EXCEED_ERROR : "") }, rest)) })) })));
|
15
37
|
}
|
16
38
|
export default NumberInput;
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { useState, useCallback, useMemo } from "react";
|
2
2
|
function useInteractions(props) {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
var value = props.value, integerOnly = props.integerOnly, _a = props.minValue, minValue = _a === void 0 ? Number.MIN_SAFE_INTEGER : _a, _b = props.maxValue, maxValue = _b === void 0 ? Number.MAX_SAFE_INTEGER : _b, onChange = props.onChange;
|
4
|
+
var _c = useState(false), tooltipOpen = _c[0], setTooltipOpen = _c[1];
|
5
|
+
var exceedError = useMemo(function () { return !!value && (Number(value) < minValue || Number(value) > maxValue); }, [value, minValue, maxValue]);
|
6
|
+
var handleChange = useCallback(function (event) {
|
7
7
|
event.preventDefault();
|
8
|
-
|
8
|
+
var val = event.currentTarget.value;
|
9
9
|
if (val !== "" && minValue >= 0 && val.includes("-"))
|
10
10
|
return;
|
11
11
|
if (integerOnly) {
|
@@ -16,8 +16,8 @@ function useInteractions(props) {
|
|
16
16
|
return;
|
17
17
|
onChange(val);
|
18
18
|
}, [onChange, minValue, integerOnly]);
|
19
|
-
|
20
|
-
|
19
|
+
var handleBlur = useCallback(function () {
|
20
|
+
var excludedValue = [
|
21
21
|
null,
|
22
22
|
undefined,
|
23
23
|
".",
|
@@ -27,9 +27,9 @@ function useInteractions(props) {
|
|
27
27
|
"null",
|
28
28
|
"undefined"
|
29
29
|
];
|
30
|
-
|
30
|
+
var strVal = String(value).trim();
|
31
31
|
if (strVal !== null && strVal.lastIndexOf(".") === strVal.length - 1) {
|
32
|
-
|
32
|
+
var newValue = strVal.substring(0, String(value).length - 1);
|
33
33
|
onChange(newValue);
|
34
34
|
}
|
35
35
|
else if (excludedValue.includes(strVal)) {
|
@@ -39,19 +39,19 @@ function useInteractions(props) {
|
|
39
39
|
onChange(Number(strVal).toString());
|
40
40
|
}
|
41
41
|
}, [value, onChange]);
|
42
|
-
|
42
|
+
var onOpenTooltip = useCallback(function () {
|
43
43
|
setTooltipOpen(true);
|
44
44
|
}, []);
|
45
|
-
|
45
|
+
var onCloseTooltip = useCallback(function () {
|
46
46
|
setTooltipOpen(false);
|
47
47
|
}, []);
|
48
48
|
return {
|
49
|
-
exceedError,
|
50
|
-
tooltipOpen,
|
51
|
-
handleBlur,
|
52
|
-
handleChange,
|
53
|
-
onOpenTooltip,
|
54
|
-
onCloseTooltip
|
49
|
+
exceedError: exceedError,
|
50
|
+
tooltipOpen: tooltipOpen,
|
51
|
+
handleBlur: handleBlur,
|
52
|
+
handleChange: handleChange,
|
53
|
+
onOpenTooltip: onOpenTooltip,
|
54
|
+
onCloseTooltip: onCloseTooltip
|
55
55
|
};
|
56
56
|
}
|
57
57
|
export default useInteractions;
|
package/PasswordInput/index.d.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
export
|
1
|
+
import type { PasswordInputProps, PasswordStrategyProps } from "./types";
|
2
|
+
declare function onValidatePassword(password: string): boolean;
|
3
|
+
declare function PasswordInput(props: PasswordInputProps): JSX.Element;
|
4
|
+
export default PasswordInput;
|
5
|
+
export { onValidatePassword };
|
6
|
+
export type { PasswordInputProps, PasswordStrategyProps };
|
package/PasswordInput/index.js
CHANGED
@@ -1,4 +1,79 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
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, Fragment as _Fragment } from "react/jsx-runtime";
|
24
|
+
import { useMemo } from "react";
|
25
|
+
import TextField from "@mui/material/TextField";
|
26
|
+
import Typography from "@mui/material/Typography";
|
27
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
28
|
+
import useCustomTheme from "../useCustomTheme";
|
29
|
+
function onValidatePassword(password) {
|
30
|
+
var reg = /^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~])([!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~a-zA-z0-9]{8,})$/;
|
31
|
+
return reg.test(password);
|
32
|
+
}
|
33
|
+
function PasswordInput(props) {
|
34
|
+
var _a = props.strategies, strategies = _a === void 0 ? {
|
35
|
+
uppercaseLetter: { label: "1 Uppercase Letter", regex: /[A-Z]+/ },
|
36
|
+
lowercaseLetter: { label: "1 Lowercase Letter", regex: /[a-z]+/ },
|
37
|
+
specialCharacter: {
|
38
|
+
label: "1 Special Character",
|
39
|
+
regex: /[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]/
|
40
|
+
},
|
41
|
+
number: { label: "1 Number", regex: /\d+/ },
|
42
|
+
minimum8: { label: "Minimum 8 characters", regex: /.{8,}/ }
|
43
|
+
} : _a, _b = props.successColor, successColor = _b === void 0 ? "green" : _b, value = props.value, error = props.error, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onValidate = props.onValidate, onChange = props.onChange, rest = __rest(props, ["strategies", "successColor", "value", "error", "primaryColor", "secondaryColor", "onValidate", "onChange"]);
|
44
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
45
|
+
var isValidPassword = useMemo(function () {
|
46
|
+
if ((value === null || value === void 0 ? void 0 : value.length) > 0) {
|
47
|
+
return onValidate ? onValidate(value) : onValidatePassword(value);
|
48
|
+
}
|
49
|
+
return true;
|
50
|
+
}, [value, onValidate, onValidatePassword]);
|
51
|
+
var helperTextColor = useMemo(function () {
|
52
|
+
var textColors = Object.keys(strategies).reduce(function (temp, key) {
|
53
|
+
var regex = strategies[key].regex;
|
54
|
+
if (value === "") {
|
55
|
+
temp[key] = undefined;
|
56
|
+
}
|
57
|
+
else if (regex.test(value)) {
|
58
|
+
temp[key] = successColor;
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
temp[key] = "red";
|
62
|
+
}
|
63
|
+
return temp;
|
64
|
+
}, {});
|
65
|
+
return textColors;
|
66
|
+
}, [value, strategies]);
|
67
|
+
var helperText = useMemo(function () {
|
68
|
+
return (_jsx(_Fragment, { children: Object.keys(strategies).map(function (key) {
|
69
|
+
var label = strategies[key].label;
|
70
|
+
return (_jsx(Typography, __assign({ component: "li", variant: "caption", style: { color: helperTextColor[key] } }, { children: label }), key));
|
71
|
+
}) }));
|
72
|
+
}, [helperTextColor, strategies]);
|
73
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ error: !isValidPassword || error, helperText: helperText, type: "password", label: "Password", size: "small", margin: "dense", value: value, onChange: function (event) {
|
74
|
+
event.preventDefault();
|
75
|
+
onChange(event.target.value);
|
76
|
+
}, fullWidth: true, required: true }, rest)) })));
|
77
|
+
}
|
78
|
+
export default PasswordInput;
|
79
|
+
export { onValidatePassword };
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import { CSSProperties } from "react";
|
2
|
-
import { TextFieldProps } from "@mui/material/TextField";
|
1
|
+
import type { CSSProperties } from "react";
|
2
|
+
import type { TextFieldProps } from "@mui/material/TextField";
|
3
3
|
export interface PasswordStrategyProps {
|
4
4
|
[key: string]: {
|
5
5
|
label: string;
|
6
6
|
regex: RegExp;
|
7
7
|
};
|
8
8
|
}
|
9
|
-
export interface
|
9
|
+
export interface PasswordInputProps extends Omit<TextFieldProps, "onChange"> {
|
10
10
|
strategies?: PasswordStrategyProps;
|
11
11
|
value: string;
|
12
12
|
successColor?: CSSProperties["color"];
|
@@ -15,6 +15,3 @@ export interface PasswordProps extends Omit<TextFieldProps, "onChange"> {
|
|
15
15
|
onChange: (value: string) => void;
|
16
16
|
onValidate?: (value: string) => boolean;
|
17
17
|
}
|
18
|
-
export declare function onValidatePassword(password: string): boolean;
|
19
|
-
declare function Password(props: PasswordProps): JSX.Element;
|
20
|
-
export default Password;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -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 Typography from "@mui/material/Typography";
|
@@ -7,38 +29,38 @@ import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
|
7
29
|
import useInteractions from "./useInteractions";
|
8
30
|
import useCustomTheme from "../useCustomTheme";
|
9
31
|
export function onValidatePhone(str) {
|
10
|
-
|
32
|
+
var reg = /^\(\d{3}\)\s?\d{3}\s?-\s?\d{4}$/g;
|
11
33
|
return reg.test(str);
|
12
34
|
}
|
13
35
|
export function phoneFormat(str) {
|
14
|
-
|
15
|
-
|
16
|
-
return chars.reduce((prev, curr, index)
|
36
|
+
var digits = (str.match(/\d+/g) || []).join("");
|
37
|
+
var chars = digits.split("");
|
38
|
+
return chars.reduce(function (prev, curr, index) {
|
17
39
|
if (index === 3) {
|
18
|
-
return
|
40
|
+
return "".concat(prev, ") ").concat(curr);
|
19
41
|
}
|
20
42
|
else if (index === 6) {
|
21
|
-
return
|
43
|
+
return "".concat(prev, "-").concat(curr);
|
22
44
|
}
|
23
45
|
else {
|
24
|
-
return
|
46
|
+
return "".concat(prev).concat(curr);
|
25
47
|
}
|
26
|
-
},
|
48
|
+
}, "(");
|
27
49
|
}
|
28
50
|
function PhoneInput(props) {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
51
|
+
var value = props.value, error = props.error, endAdornment = props.endAdornment, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, _a = props.helperText, helperText = _a === void 0 ? "Please enter a valid phone number" : _a, onChange = props.onChange, onValidate = props.onValidate, rest = __rest(props, ["value", "error", "endAdornment", "primaryColor", "secondaryColor", "helperText", "onChange", "onValidate"]);
|
52
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
53
|
+
var _b = useInteractions({ value: value }), valLength = _b.valLength, addMask = _b.addMask;
|
54
|
+
var rifm = useRifm({
|
33
55
|
mask: true,
|
34
56
|
value: String(value),
|
35
|
-
onChange,
|
57
|
+
onChange: onChange,
|
36
58
|
replace: addMask,
|
37
59
|
format: phoneFormat
|
38
60
|
});
|
39
|
-
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(TextField, { value: rifm.value, InputProps: {
|
40
|
-
startAdornment: (_jsx(InputAdornment, { position: "start", children: _jsx(Typography, { sx: { fontSize: 16, fontWeight: 500 }, children: "+1" }) })),
|
41
|
-
endAdornment
|
61
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ value: rifm.value, InputProps: {
|
62
|
+
startAdornment: (_jsx(InputAdornment, __assign({ position: "start" }, { children: _jsx(Typography, __assign({ sx: { fontSize: 16, fontWeight: 500 } }, { children: "+1" })) }))),
|
63
|
+
endAdornment: endAdornment
|
42
64
|
}, onChange: rifm.onChange, helperText: valLength > 0 &&
|
43
65
|
(onValidate ? !onValidate(rifm.value) : !onValidatePhone(rifm.value))
|
44
66
|
? helperText
|
@@ -46,6 +68,6 @@ function PhoneInput(props) {
|
|
46
68
|
(valLength > 0 &&
|
47
69
|
(onValidate
|
48
70
|
? !onValidate(rifm.value)
|
49
|
-
: !onValidatePhone(rifm.value))),
|
71
|
+
: !onValidatePhone(rifm.value))) }, rest)) })));
|
50
72
|
}
|
51
73
|
export default PhoneInput;
|
@@ -1,17 +1,17 @@
|
|
1
1
|
import { useCallback, useMemo } from "react";
|
2
2
|
function useInteractions(props) {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
return
|
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, 3).padEnd(3, "_");
|
7
|
+
var prefixCode = digits.slice(3, 6).padEnd(3, "_");
|
8
|
+
var subscriber = digits.slice(6, 10).padEnd(4, "_");
|
9
|
+
return "(".concat(areaCode, ") ").concat(prefixCode, "-").concat(subscriber);
|
10
10
|
}, []);
|
11
|
-
|
12
|
-
|
11
|
+
var valLength = useMemo(function () {
|
12
|
+
var digitsArr = String(value).match(/\d/g);
|
13
13
|
return digitsArr ? digitsArr.length : 0;
|
14
14
|
}, [value]);
|
15
|
-
return { valLength, addMask };
|
15
|
+
return { valLength: valLength, addMask: addMask };
|
16
16
|
}
|
17
17
|
export default useInteractions;
|
package/README.md
CHANGED
@@ -237,9 +237,7 @@ It is extended from `@mui/material/Checkbox`, so it includes all properties of `
|
|
237
237
|
```typescript
|
238
238
|
import { CheckBox } from '@symply.io/basic-components/';
|
239
239
|
// or
|
240
|
-
import
|
241
|
-
// or
|
242
|
-
import CheckBox from '@symply.io/basic-components/CheckBox/CheckBox';
|
240
|
+
import CheckBox from '@symply.io/basic-components/CheckBox';
|
243
241
|
```
|
244
242
|
|
245
243
|
<h5>Props</h5>
|
@@ -262,9 +260,7 @@ It is extended from `@mui/material/FormGroup`, so it includes all properties of
|
|
262
260
|
```typescript
|
263
261
|
import { CheckBoxGroup } from '@symply.io/basic-components/';
|
264
262
|
// or
|
265
|
-
import
|
266
|
-
// or
|
267
|
-
import CheckBoxGroup from '@symply.io/basic-components/CheckBox/CheckBoxGroup';
|
263
|
+
import CheckBoxGroup from '@symply.io/basic-components/CheckBoxGroup';
|
268
264
|
```
|
269
265
|
|
270
266
|
<h5>Props</h5>
|
@@ -701,9 +697,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
|
|
701
697
|
|
702
698
|
```typescript
|
703
699
|
// Password
|
704
|
-
import
|
700
|
+
import Password from '@symply.io/basic-components/PasswordInput';
|
705
701
|
// Confirm Password
|
706
|
-
import
|
702
|
+
import ConfirmPassword from '@symply.io/basic-components/ConfirmPasswordInput';
|
707
703
|
```
|
708
704
|
|
709
705
|
<h5>Password Props</h5>
|
package/Sidebar/SidebarItem.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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
13
|
import Chip from "@mui/material/Chip";
|
3
14
|
import ListItemText from "@mui/material/ListItemText";
|
@@ -8,9 +19,9 @@ import { useTheme, alpha } from "@mui/material/styles";
|
|
8
19
|
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
9
20
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
10
21
|
function SidebarItem(props) {
|
11
|
-
|
12
|
-
|
13
|
-
return (_jsxs(ListItemButton, { onClick: onClick, disabled: lock, sx: {
|
22
|
+
var icon = props.icon, name = props.name, active = props.active, expand = props.expand, lock = props.lock, beta = props.beta, isSub = props.isSub, hasChildren = props.hasChildren, _a = props.betaTagColor, betaTagColor = _a === void 0 ? "#00A2A9" : _a, _b = props.showIconOnly, showIconOnly = _b === void 0 ? false : _b, onClick = props.onClick;
|
23
|
+
var theme = useTheme();
|
24
|
+
return (_jsxs(ListItemButton, __assign({ onClick: onClick, disabled: lock, sx: {
|
14
25
|
paddingLeft: isSub ? theme.spacing(4) : undefined,
|
15
26
|
display: "flex",
|
16
27
|
width: "100%",
|
@@ -22,12 +33,12 @@ function SidebarItem(props) {
|
|
22
33
|
backgroundColor: active
|
23
34
|
? alpha(theme.palette.primary.main, theme.palette.action.activatedOpacity)
|
24
35
|
: undefined
|
25
|
-
}, children: [_jsx(ListItemIcon, { sx: {
|
36
|
+
} }, { children: [_jsx(ListItemIcon, __assign({ sx: {
|
26
37
|
color: active ? theme.palette.primary.main : undefined,
|
27
38
|
borderRadius: active ? "5px" : undefined,
|
28
39
|
opacity: active ? "1" : undefined,
|
29
40
|
fontWeight: active ? 600 : undefined
|
30
|
-
}, children: icon }), !showIconOnly ? (_jsxs(_Fragment, { children: [_jsx(ListItemText, { primaryTypographyProps: {
|
41
|
+
} }, { children: icon })), !showIconOnly ? (_jsxs(_Fragment, { children: [_jsx(ListItemText, { primaryTypographyProps: {
|
31
42
|
color: active ? theme.palette.primary.main : "textPrimary",
|
32
43
|
sx: {
|
33
44
|
overflow: "hidden",
|
@@ -44,6 +55,6 @@ function SidebarItem(props) {
|
|
44
55
|
height: theme.spacing(2.5),
|
45
56
|
fontSize: theme.spacing(1.25),
|
46
57
|
padding: theme.spacing(0, 0.75)
|
47
|
-
} })) : (_jsx(_Fragment, {})), hasChildren ? (expand ? (_jsx(ExpandMoreIcon, {})) : (_jsx(ChevronRightIcon, {}))) : (_jsx(_Fragment, {}))] })) : (_jsx(_Fragment, {}))] }));
|
58
|
+
} })) : (_jsx(_Fragment, {})), hasChildren ? (expand ? (_jsx(ExpandMoreIcon, {})) : (_jsx(ChevronRightIcon, {}))) : (_jsx(_Fragment, {}))] })) : (_jsx(_Fragment, {}))] })));
|
48
59
|
}
|
49
60
|
export default SidebarItem;
|
@@ -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, jsxs as _jsxs } from "react/jsx-runtime";
|
2
13
|
import { useState, memo, useMemo, useEffect, useCallback } from "react";
|
3
14
|
import { Match, useLocation } from "@reach/router";
|
@@ -7,20 +18,20 @@ import useTheme from "@mui/material/styles/useTheme";
|
|
7
18
|
import SidebarItem from "./SidebarItem";
|
8
19
|
import SidebarLink from "./SidebarLink";
|
9
20
|
function SidebarItemsGroup(props) {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
21
|
+
var item = props.item, showIconOnly = props.showIconOnly;
|
22
|
+
var id = item.id, name = item.name, path = item.path, icon = item.icon, children = item.children, lock = item.lock, beta = item.beta, titleForLock = item.titleForLock, betaTagColor = item.betaTagColor;
|
23
|
+
var pathname = useLocation().pathname;
|
24
|
+
var match = useMemo(function () {
|
14
25
|
return pathname.includes(path);
|
15
26
|
}, [path, pathname]);
|
16
|
-
|
17
|
-
|
18
|
-
setExpand(v
|
27
|
+
var _a = useState(match), expand = _a[0], setExpand = _a[1];
|
28
|
+
var onToggleExpand = useCallback(function () {
|
29
|
+
setExpand(function (v) { return !v; });
|
19
30
|
}, []);
|
20
|
-
useEffect(()
|
31
|
+
useEffect(function () {
|
21
32
|
setExpand(match);
|
22
33
|
}, [match]);
|
23
|
-
|
24
|
-
return (_jsxs(_Fragment, { children: [_jsx(List, { component: "div", disablePadding: true, children: _jsx(SidebarItem, { id: id, active: false, name: name, icon: icon, lock: lock, beta: beta, expand: expand, hasChildren: true, showIconOnly: showIconOnly, betaTagColor: betaTagColor, onClick: onToggleExpand }) }), children && (_jsx(Collapse, { in: expand, timeout: "auto", children: _jsx(List, { component: "div", disablePadding: true, children: children.map((c)
|
34
|
+
var theme = useTheme();
|
35
|
+
return (_jsxs(_Fragment, { children: [_jsx(List, __assign({ component: "div", disablePadding: true }, { children: _jsx(SidebarItem, { id: id, active: false, name: name, icon: icon, lock: lock, beta: beta, expand: expand, hasChildren: true, showIconOnly: showIconOnly, betaTagColor: betaTagColor, onClick: onToggleExpand }) })), children && (_jsx(Collapse, __assign({ in: expand, timeout: "auto" }, { children: _jsx(List, __assign({ component: "div", disablePadding: true }, { children: children.map(function (c) { return (_jsx(Match, __assign({ path: c.path }, { children: function (prop) { return (_jsx(SidebarLink, { id: c.id, name: c.name, path: c.path, icon: c.icon, lock: c.lock, beta: c.beta, titleForLock: titleForLock, active: prop.match !== null, betaTagColor: c.betaTagColor, showIconOnly: showIconOnly, isSub: true })); } }), c.name)); }) })) })))] }));
|
25
36
|
}
|
26
37
|
export default memo(SidebarItemsGroup);
|
package/Sidebar/SidebarLink.js
CHANGED
@@ -1,14 +1,36 @@
|
|
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 { Link, useLocation } from "@reach/router";
|
3
25
|
import useTheme from "@mui/material/styles/useTheme";
|
4
26
|
import SidebarItem from "./SidebarItem";
|
5
27
|
function SidebarLink(props) {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
return (_jsx(Link, { id: id, to: lock ? pathname : path, title: lock ? titleForLock || "Feature is unavailable on Free plan" : name, style: {
|
28
|
+
var pathname = useLocation().pathname;
|
29
|
+
var id = props.id, name = props.name, path = props.path, icon = props.icon, lock = props.lock, beta = props.beta, active = props.active, titleForLock = props.titleForLock, betaTagColor = props.betaTagColor, rest = __rest(props, ["id", "name", "path", "icon", "lock", "beta", "active", "titleForLock", "betaTagColor"]);
|
30
|
+
var theme = useTheme();
|
31
|
+
return (_jsx(Link, __assign({ id: id, to: lock ? pathname : path, title: lock ? titleForLock || "Feature is unavailable on Free plan" : name, style: {
|
10
32
|
color: theme.palette.primary.main,
|
11
33
|
textDecoration: "none"
|
12
|
-
}, children: _jsx(SidebarItem, { name: name, icon: icon, lock: lock, beta: beta, active: active, betaTagColor: betaTagColor,
|
34
|
+
} }, { children: _jsx(SidebarItem, __assign({ name: name, icon: icon, lock: lock, beta: beta, active: active, betaTagColor: betaTagColor }, rest), name) })));
|
13
35
|
}
|
14
36
|
export default SidebarLink;
|
package/Sidebar/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 { Match } from "@reach/router";
|
3
14
|
import List from "@mui/material/List";
|
@@ -7,12 +18,12 @@ import SidebarItem from "./SidebarItem";
|
|
7
18
|
import SidebarItemsGroup from "./SidebarItemsGroup";
|
8
19
|
import SidebarLink from "./SidebarLink";
|
9
20
|
function Sidebar(props) {
|
10
|
-
|
11
|
-
|
12
|
-
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(List, { children: items.map((i)
|
13
|
-
|
14
|
-
return children ? (_jsx(SidebarItemsGroup, { item: i, showIconOnly: showIconOnly }, name)) : (_jsx(Match, { path: path === "/" ? path : path.concat("/*"), children: prop
|
15
|
-
}) }) }));
|
21
|
+
var items = props.items, showIconOnly = props.showIconOnly, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
|
22
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
23
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(List, { children: items.map(function (i) {
|
24
|
+
var id = i.id, children = i.children, path = i.path, icon = i.icon, name = i.name, lock = i.lock, beta = i.beta, titleForLock = i.titleForLock, betaTagColor = i.betaTagColor;
|
25
|
+
return children ? (_jsx(SidebarItemsGroup, { item: i, showIconOnly: showIconOnly }, name)) : (_jsx(Match, __assign({ path: path === "/" ? path : path.concat("/*") }, { children: function (prop) { return (_jsx(SidebarLink, { id: id, name: name, path: path, icon: icon, lock: lock, beta: beta, showIconOnly: showIconOnly, titleForLock: titleForLock, active: prop.match !== null, betaTagColor: betaTagColor }, name)); } }), name));
|
26
|
+
}) }) })));
|
16
27
|
}
|
17
28
|
export default Sidebar;
|
18
29
|
export { SidebarItem, SidebarItemsGroup };
|
package/SocialInput/index.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { SocialInputProps } from "./types";
|
1
|
+
import type { SocialInputProps } from "./types";
|
2
2
|
export declare function SocialInputFormat(str: string): string;
|
3
3
|
export declare function onValidateSocial(socialString: string): boolean;
|
4
4
|
declare function SocialInput(props: SocialInputProps): JSX.Element;
|
5
5
|
export default SocialInput;
|
6
|
-
export
|
6
|
+
export type { SocialInputProps };
|