@symply.io/basic-components 1.4.0-alpha.5 → 1.4.0-alpha.7
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 +0 -1
- package/AlertDialog/types.d.ts +3 -3
- package/Autocomplete/index.d.ts +2 -2
- package/Autocomplete/index.js +0 -1
- package/Autocomplete/types.d.ts +2 -2
- package/AutocompleteWithFilter/index.d.ts +2 -2
- package/AutocompleteWithFilter/index.js +0 -1
- package/AutocompleteWithFilter/types.d.ts +5 -5
- package/BasicModal/index.d.ts +2 -2
- package/BasicModal/index.js +0 -1
- package/BasicModal/types.d.ts +2 -2
- package/BreadCrumbs/index.d.ts +2 -2
- package/BreadCrumbs/index.js +0 -1
- package/BreadCrumbs/types.d.ts +1 -1
- package/CheckBox/index.d.ts +4 -0
- package/CheckBox/index.js +36 -0
- 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 +2 -9
- package/ConfirmPasswordInput/index.d.ts +4 -0
- package/{PasswordInput/ConfirmPassword.js → ConfirmPasswordInput/index.js} +2 -2
- package/ConfirmPasswordInput/types.d.ts +9 -0
- package/ConfirmPasswordInput/types.js +1 -0
- package/Copyright/index.d.ts +2 -2
- package/Copyright/index.js +0 -1
- package/Copyright/types.d.ts +1 -1
- package/DataTable/index.d.ts +2 -2
- package/DataTable/index.js +2 -2
- package/DigitInput/index.d.ts +2 -2
- package/DigitInput/index.js +0 -1
- package/DigitInput/types.d.ts +3 -3
- package/LoadingModal/index.d.ts +4 -3
- package/LoadingModal/index.js +4 -3
- 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/index.d.ts +6 -0
- package/index.js +6 -0
- package/package.json +1 -1
- package/PasswordInput/ConfirmPassword.d.ts +0 -11
- package/PasswordInput/Password.js +0 -78
package/AlertDialog/index.d.ts
CHANGED
package/AlertDialog/index.js
CHANGED
@@ -45,4 +45,3 @@ var AlertDialog = function (props) {
|
|
45
45
|
}, "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description" }, rest, { children: [_jsx(DialogTitle, __assign({ id: "alert-dialog-title" }, { children: title })), _jsx(DialogContent, { children: children }), _jsx(DialogActions, { children: DialogButtons ? (cloneElement(DialogButtons)) : (_jsx(Button, __assign({ onClick: onClose, color: "primary" }, { children: "OK" }))) })] })) })));
|
46
46
|
};
|
47
47
|
export default AlertDialog;
|
48
|
-
export * from "./types";
|
package/AlertDialog/types.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { ReactElement, CSSProperties } from "react";
|
2
|
-
import { DialogProps } from "@mui/material/Dialog";
|
3
|
-
import { DialogContentProps } from "@mui/material/DialogContent";
|
1
|
+
import type { ReactElement, CSSProperties } from "react";
|
2
|
+
import type { DialogProps } from "@mui/material/Dialog";
|
3
|
+
import type { DialogContentProps } from "@mui/material/DialogContent";
|
4
4
|
export interface AlertDialogProps {
|
5
5
|
title?: string;
|
6
6
|
maxWidth?: DialogProps["maxWidth"];
|
package/Autocomplete/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AutocompleteProps } from "./types";
|
1
|
+
import type { AutocompleteProps, AutocompleteValueType, AutocompleteOptionType } from "./types";
|
2
2
|
declare function CustomAutocomplete<T, multiple extends boolean | undefined = false>(props: AutocompleteProps<T, multiple>): JSX.Element;
|
3
3
|
export default CustomAutocomplete;
|
4
|
-
export
|
4
|
+
export type { AutocompleteProps, AutocompleteValueType, AutocompleteOptionType };
|
package/Autocomplete/index.js
CHANGED
@@ -49,4 +49,3 @@ function CustomAutocomplete(props) {
|
|
49
49
|
}, renderInput: function (params) { return (_jsx(TextField, __assign({}, params, rest, { required: required, size: size, inputProps: __assign(__assign({}, params.inputProps), { required: required && (Array.isArray(value) ? value.length === 0 : !value) }) }))); } }) })));
|
50
50
|
}
|
51
51
|
export default CustomAutocomplete;
|
52
|
-
export * from "./types";
|
package/Autocomplete/types.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
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 declare type AutocompleteOptionType<T = {
|
4
4
|
[name: string]: unknown;
|
5
5
|
}> = T & {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AutocompleteWithFilterProps } from "./types";
|
1
|
+
import type { AutocompleteWithFilterProps, AutocompleteWithFilterValueType, AutocompleteWithFilterOptionType } from "./types";
|
2
2
|
declare function AutocompleteWithFilter<T, multiple extends boolean | undefined = false>(props: AutocompleteWithFilterProps<T, multiple>): JSX.Element;
|
3
3
|
export default AutocompleteWithFilter;
|
4
|
-
export
|
4
|
+
export type { AutocompleteWithFilterProps, AutocompleteWithFilterValueType, AutocompleteWithFilterOptionType };
|
@@ -57,4 +57,3 @@ function AutocompleteWithFilter(props) {
|
|
57
57
|
}, renderInput: function (params) { return (_jsx(TextField, __assign({}, params, rest, { variant: "outlined", required: required, inputProps: __assign(__assign({}, params.inputProps), { required: required && (Array.isArray(value) ? value.length === 0 : !value) }) }))); } }) })));
|
58
58
|
}
|
59
59
|
export default AutocompleteWithFilter;
|
60
|
-
export * from "./types";
|
@@ -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 declare type AutocompleteWithFilterOptionType<T> = T & {
|
4
4
|
label: string;
|
5
5
|
value?: string | number;
|
6
6
|
};
|
7
|
-
export declare type
|
7
|
+
export declare type AutocompleteWithFilterValueType<T, multiple extends boolean | undefined> = multiple extends false | undefined ? AutocompleteWithFilterOptionType<T> | null : Array<AutocompleteWithFilterOptionType<T>>;
|
8
8
|
export interface AutocompleteWithFilterProps<T, multiple extends boolean | undefined> extends Omit<TextFieldProps, "onChange" | "value" | "disabled"> {
|
9
|
-
value:
|
9
|
+
value: AutocompleteWithFilterValueType<T, multiple>;
|
10
10
|
options: Array<AutocompleteWithFilterOptionType<T>>;
|
11
11
|
disableCloseOnSelect?: boolean;
|
12
12
|
limitTags?: number;
|
@@ -15,5 +15,5 @@ export interface AutocompleteWithFilterProps<T, multiple extends boolean | undef
|
|
15
15
|
loading?: boolean;
|
16
16
|
primaryColor?: CSSProperties["color"];
|
17
17
|
secondaryColor?: CSSProperties["color"];
|
18
|
-
onChange: (value:
|
18
|
+
onChange: (value: AutocompleteWithFilterValueType<T, multiple>) => void;
|
19
19
|
}
|
package/BasicModal/index.d.ts
CHANGED
package/BasicModal/index.js
CHANGED
package/BasicModal/types.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ReactNode, CSSProperties } from "react";
|
2
|
-
import { ButtonProps } from "@mui/material/Button";
|
1
|
+
import type { ReactNode, CSSProperties } from "react";
|
2
|
+
import type { ButtonProps } from "@mui/material/Button";
|
3
3
|
export interface BasicModalContentProps {
|
4
4
|
children: ReactNode;
|
5
5
|
color?: ButtonProps["color"];
|
package/BreadCrumbs/index.d.ts
CHANGED
package/BreadCrumbs/index.js
CHANGED
package/BreadCrumbs/types.d.ts
CHANGED
@@ -0,0 +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
|
+
};
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
24
|
+
import Checkbox from "@mui/material/Checkbox";
|
25
|
+
import FormControlLabel from "@mui/material/FormControlLabel";
|
26
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
27
|
+
import useCustomTheme from "../useCustomTheme";
|
28
|
+
function CheckBox(props) {
|
29
|
+
var label = props.label, onChange = props.onChange, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["label", "onChange", "primaryColor", "secondaryColor"]);
|
30
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
31
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(FormControlLabel, { control: _jsx(Checkbox, __assign({ onChange: function (event) {
|
32
|
+
event.stopPropagation();
|
33
|
+
onChange(event.target.checked);
|
34
|
+
} }, rest)), label: label }) })));
|
35
|
+
}
|
36
|
+
export default CheckBox;
|
package/CheckBox/types.d.ts
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
import { CSSProperties, ReactElement } from "react";
|
2
|
-
import { CheckboxProps } from "@mui/material/Checkbox";
|
3
|
-
import { FormGroupProps } from "@mui/material/FormGroup";
|
1
|
+
import type { CSSProperties, ReactElement } from "react";
|
2
|
+
import type { CheckboxProps } from "@mui/material/Checkbox";
|
4
3
|
export interface CheckBoxProps extends Omit<CheckboxProps, "onChange"> {
|
5
4
|
label: string | ReactElement;
|
6
5
|
onChange: (val: boolean) => void;
|
7
6
|
primaryColor?: CSSProperties["color"];
|
8
7
|
secondaryColor?: CSSProperties["color"];
|
9
8
|
}
|
10
|
-
export interface CheckBoxGroupProps extends FormGroupProps {
|
11
|
-
checkboxes: Array<CheckBoxProps>;
|
12
|
-
}
|
@@ -0,0 +1,30 @@
|
|
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 FormGroup from "@mui/material/FormGroup";
|
25
|
+
import CheckBox from "../CheckBox";
|
26
|
+
function CheckBoxGroup(props) {
|
27
|
+
var checkboxes = props.checkboxes, rest = __rest(props, ["checkboxes"]);
|
28
|
+
return (_jsx(FormGroup, __assign({}, rest, { children: checkboxes.map(function (checkbox, index) { return (_jsx(CheckBox, __assign({}, checkbox), index)); }) })));
|
29
|
+
}
|
30
|
+
export default CheckBoxGroup;
|
package/CheckBoxGroup/types.d.ts
CHANGED
@@ -1,12 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import { FormGroupProps } from "@mui/material/FormGroup";
|
4
|
-
export interface CheckBoxProps extends Omit<CheckboxProps, "onChange"> {
|
5
|
-
label: string | ReactElement;
|
6
|
-
onChange: (val: boolean) => void;
|
7
|
-
primaryColor?: CSSProperties["color"];
|
8
|
-
secondaryColor?: CSSProperties["color"];
|
9
|
-
}
|
1
|
+
import type { FormGroupProps } from "@mui/material/FormGroup";
|
2
|
+
import type { CheckBoxProps } from "../CheckBox";
|
10
3
|
export interface CheckBoxGroupProps extends FormGroupProps {
|
11
4
|
checkboxes: Array<CheckBoxProps>;
|
12
5
|
}
|
@@ -25,7 +25,7 @@ import { useMemo } from "react";
|
|
25
25
|
import TextField from "@mui/material/TextField";
|
26
26
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
27
27
|
import useCustomTheme from "../useCustomTheme";
|
28
|
-
function
|
28
|
+
function ConfirmPasswordInput(props) {
|
29
29
|
var password = props.password, _a = props.helperText, helperText = _a === void 0 ? "Passwords do not match" : _a, value = props.value, _b = props.label, label = _b === void 0 ? "Confirm Password" : _b, _c = props.name, name = _c === void 0 ? "confirmPassword" : _c, _d = props.variant, variant = _d === void 0 ? "outlined" : _d, _e = props.margin, margin = _e === void 0 ? "dense" : _e, disabled = props.disabled, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onChange = props.onChange, rest = __rest(props, ["password", "helperText", "value", "label", "name", "variant", "margin", "disabled", "primaryColor", "secondaryColor", "onChange"]);
|
30
30
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
31
31
|
var isMatched = useMemo(function () {
|
@@ -39,4 +39,4 @@ function ConfirmPassword(props) {
|
|
39
39
|
onChange(event.target.value);
|
40
40
|
}, fullWidth: true, required: true }, rest)) })));
|
41
41
|
}
|
42
|
-
export default
|
42
|
+
export default ConfirmPasswordInput;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { CSSProperties } from "react";
|
2
|
+
import type { TextFieldProps } from "@mui/material/TextField";
|
3
|
+
export interface ConfirmPasswordInputProps extends Omit<TextFieldProps, "onChange"> {
|
4
|
+
password: string;
|
5
|
+
value: string;
|
6
|
+
primaryColor?: CSSProperties["color"];
|
7
|
+
secondaryColor?: CSSProperties["color"];
|
8
|
+
onChange: (value: string) => void;
|
9
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/Copyright/index.d.ts
CHANGED
package/Copyright/index.js
CHANGED
@@ -20,4 +20,3 @@ function Copyright(props) {
|
|
20
20
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(Typography, __assign({ sx: { fontSize: 16, fontWeight: 400 }, color: "textSecondary", align: "center" }, { children: ["Copyright © ", _jsx(Link, __assign({ color: "inherit", href: "https://symply.io/" }, { children: "Symply Software Inc" })), "\u00A0", new Date().getFullYear(), "."] })) })));
|
21
21
|
}
|
22
22
|
export default Copyright;
|
23
|
-
export * from "./types";
|
package/Copyright/types.d.ts
CHANGED
package/DataTable/index.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import
|
1
|
+
import useDataTable from "./useTable";
|
2
2
|
import { DataTableProps, KvProps } from "./types";
|
3
3
|
declare function DataTable<RowProps extends KvProps, ExtendedProps extends KvProps>(props: DataTableProps<RowProps, ExtendedProps>): JSX.Element;
|
4
4
|
export default DataTable;
|
5
5
|
export * from "./types";
|
6
|
-
export {
|
6
|
+
export { useDataTable };
|
package/DataTable/index.js
CHANGED
@@ -15,7 +15,7 @@ import Table from "@mui/material/Table";
|
|
15
15
|
import TableContainer from "@mui/material/TableContainer";
|
16
16
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
17
17
|
import useCustomTheme from "../useCustomTheme";
|
18
|
-
import
|
18
|
+
import useDataTable from "./useTable";
|
19
19
|
import TableBody from "./TableBody";
|
20
20
|
import TableHeader from "./TableHeader";
|
21
21
|
import TableFooter from "./TableFooter";
|
@@ -59,4 +59,4 @@ function DataTable(props) {
|
|
59
59
|
}
|
60
60
|
export default DataTable;
|
61
61
|
export * from "./types";
|
62
|
-
export {
|
62
|
+
export { useDataTable };
|
package/DigitInput/index.d.ts
CHANGED
package/DigitInput/index.js
CHANGED
package/DigitInput/types.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { CSSProperties } from "react";
|
2
|
-
import { InputProps } from "@mui/material/Input";
|
3
|
-
import { TextFieldProps } from "@mui/material/TextField";
|
1
|
+
import type { CSSProperties } from "react";
|
2
|
+
import type { InputProps } from "@mui/material/Input";
|
3
|
+
import type { TextFieldProps } from "@mui/material/TextField";
|
4
4
|
export interface DigitInputProps extends Omit<TextFieldProps, "onChange"> {
|
5
5
|
onChange: (value: string) => void;
|
6
6
|
value: string;
|
package/LoadingModal/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
export
|
1
|
+
import LoadingModal from "./Modal";
|
2
|
+
import useLoadingModal, { LoadingModalProvider } from "./useLoadingModal";
|
3
|
+
export default LoadingModal;
|
4
|
+
export { useLoadingModal, LoadingModalProvider };
|
4
5
|
export * from "./types";
|
package/LoadingModal/index.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
"use client";
|
2
|
-
|
3
|
-
|
4
|
-
export
|
2
|
+
import LoadingModal from "./Modal";
|
3
|
+
import useLoadingModal, { LoadingModalProvider } from "./useLoadingModal";
|
4
|
+
export default LoadingModal;
|
5
|
+
export { useLoadingModal, LoadingModalProvider };
|
5
6
|
export * from "./types";
|
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 {};
|
package/index.d.ts
CHANGED
@@ -4,6 +4,8 @@ export * from "./AutocompleteWithFilter";
|
|
4
4
|
export * from "./BasicModal";
|
5
5
|
export * from "./BreadCrumbs";
|
6
6
|
export * from "./CheckBox";
|
7
|
+
export * from "./CheckBoxGroup";
|
8
|
+
export * from "./ConfirmPasswordInput";
|
7
9
|
export * from "./Copyright";
|
8
10
|
export * from "./DataTable";
|
9
11
|
export * from "./DateInput";
|
@@ -31,6 +33,9 @@ export { default as Autocomplete } from "./Autocomplete";
|
|
31
33
|
export { default as AutocompleteWithFilter } from "./AutocompleteWithFilter";
|
32
34
|
export { default as BasicModal } from "./BasicModal";
|
33
35
|
export { default as BreadCrumbs } from "./BreadCrumbs";
|
36
|
+
export { default as CheckBox } from "./CheckBox";
|
37
|
+
export { default as CheckBoxGroup } from "./CheckBoxGroup";
|
38
|
+
export { default as ConfirmPasswordInput } from "./ConfirmPasswordInput";
|
34
39
|
export { default as Copyright } from "./Copyright";
|
35
40
|
export { default as DataTable } from "./DataTable";
|
36
41
|
export { default as DigitInput } from "./DigitInput";
|
@@ -42,6 +47,7 @@ export { default as HelpCaption } from "./HelpCaption";
|
|
42
47
|
export { default as LoadingModal } from "./LoadingModal";
|
43
48
|
export { default as MenuButtonGroup } from "./MenuButtonGroup";
|
44
49
|
export { default as NumberInput } from "./NumberInput";
|
50
|
+
export { default as PasswordInput } from "./PasswordInput";
|
45
51
|
export { default as PhoneNumberInput } from "./PhoneNumberInput";
|
46
52
|
export { default as Sidebar } from "./Sidebar";
|
47
53
|
export { default as SocialInput } from "./SocialInput";
|
package/index.js
CHANGED
@@ -4,6 +4,8 @@ export * from "./AutocompleteWithFilter";
|
|
4
4
|
export * from "./BasicModal";
|
5
5
|
export * from "./BreadCrumbs";
|
6
6
|
export * from "./CheckBox";
|
7
|
+
export * from "./CheckBoxGroup";
|
8
|
+
export * from "./ConfirmPasswordInput";
|
7
9
|
export * from "./Copyright";
|
8
10
|
export * from "./DataTable";
|
9
11
|
export * from "./DateInput";
|
@@ -31,6 +33,9 @@ export { default as Autocomplete } from "./Autocomplete";
|
|
31
33
|
export { default as AutocompleteWithFilter } from "./AutocompleteWithFilter";
|
32
34
|
export { default as BasicModal } from "./BasicModal";
|
33
35
|
export { default as BreadCrumbs } from "./BreadCrumbs";
|
36
|
+
export { default as CheckBox } from "./CheckBox";
|
37
|
+
export { default as CheckBoxGroup } from "./CheckBoxGroup";
|
38
|
+
export { default as ConfirmPasswordInput } from "./ConfirmPasswordInput";
|
34
39
|
export { default as Copyright } from "./Copyright";
|
35
40
|
export { default as DataTable } from "./DataTable";
|
36
41
|
export { default as DigitInput } from "./DigitInput";
|
@@ -42,6 +47,7 @@ export { default as HelpCaption } from "./HelpCaption";
|
|
42
47
|
export { default as LoadingModal } from "./LoadingModal";
|
43
48
|
export { default as MenuButtonGroup } from "./MenuButtonGroup";
|
44
49
|
export { default as NumberInput } from "./NumberInput";
|
50
|
+
export { default as PasswordInput } from "./PasswordInput";
|
45
51
|
export { default as PhoneNumberInput } from "./PhoneNumberInput";
|
46
52
|
export { default as Sidebar } from "./Sidebar";
|
47
53
|
export { default as SocialInput } from "./SocialInput";
|
package/package.json
CHANGED
@@ -1,11 +0,0 @@
|
|
1
|
-
import { CSSProperties } from "react";
|
2
|
-
import { TextFieldProps } from "@mui/material/TextField";
|
3
|
-
export interface ConfirmPasswordProps extends Omit<TextFieldProps, "onChange"> {
|
4
|
-
password: string;
|
5
|
-
value: string;
|
6
|
-
primaryColor?: CSSProperties["color"];
|
7
|
-
secondaryColor?: CSSProperties["color"];
|
8
|
-
onChange: (value: string) => void;
|
9
|
-
}
|
10
|
-
declare function ConfirmPassword(props: ConfirmPasswordProps): JSX.Element;
|
11
|
-
export default ConfirmPassword;
|
@@ -1,78 +0,0 @@
|
|
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
|
-
export 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 Password(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 Password;
|