@symply.io/basic-components 1.4.0-beta.1 → 1.4.0-beta.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 +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 -3
- package/CheckBox/index.js +36 -3
- package/CheckBox/types.d.ts +2 -6
- package/CheckBoxGroup/index.d.ts +4 -0
- package/{CheckBox/CheckBoxGroup.js → CheckBoxGroup/index.js} +2 -2
- package/CheckBoxGroup/types.d.ts +5 -0
- package/CheckBoxGroup/types.js +1 -0
- 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 -1
- package/DataTable/index.js +2 -1
- package/DateInput/index.d.ts +4 -3
- package/DateInput/index.js +4 -3
- package/DigitInput/index.d.ts +2 -2
- package/DigitInput/index.js +0 -1
- package/DigitInput/types.d.ts +3 -3
- package/DynamicHeaderBar/HeaderBar.d.ts +1 -13
- package/DynamicHeaderBar/HeaderButtons.d.ts +1 -1
- package/DynamicHeaderBar/HeaderLine.d.ts +1 -6
- package/DynamicHeaderBar/index.d.ts +1 -17
- package/DynamicHeaderBar/index.js +0 -3
- package/DynamicHeaderBar/types.d.ts +33 -5
- package/FeinInput/index.d.ts +2 -2
- package/FeinInput/index.js +0 -1
- package/FeinInput/types.d.ts +2 -2
- package/FileUploader/index.d.ts +2 -2
- package/FileUploader/index.js +0 -1
- package/FormRadioGroup/index.d.ts +2 -2
- package/FormRadioGroup/index.js +0 -1
- package/FormRadioGroup/types.d.ts +3 -4
- package/HelpCaption/index.d.ts +2 -2
- package/LoadingModal/index.d.ts +2 -1
- package/LoadingModal/index.js +3 -1
- package/LoadingModal/useLoadingModal.d.ts +1 -1
- package/LoadingModal/useLoadingModal.js +1 -1
- 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/README.md +4 -8
- package/SocialInput/index.d.ts +2 -2
- package/SocialInput/index.js +0 -1
- package/TabGroup/index.d.ts +2 -2
- package/TabGroup/index.js +0 -1
- package/TablePagination/index.d.ts +2 -2
- package/TablePagination/index.js +0 -1
- package/TextInput/index.d.ts +1 -1
- package/TextInput/index.js +2 -2
- package/ToastPrompt/Prompt.d.ts +3 -2
- package/ToastPrompt/Prompt.js +9 -6
- package/ToastPrompt/index.js +7 -4
- package/ToastPrompt/types.d.ts +8 -9
- package/ToastPrompt/useInteractions.d.ts +6 -7
- package/ToastPrompt/useInteractions.js +6 -10
- package/VideoPlayerModal/index.d.ts +2 -2
- package/VideoPlayerModal/index.js +0 -1
- package/index.d.ts +6 -0
- package/index.js +6 -0
- package/package.json +1 -2
- package/CheckBox/CheckBox.d.ts +0 -3
- package/CheckBox/CheckBox.js +0 -36
- package/CheckBox/CheckBoxGroup.d.ts +0 -3
- package/PasswordInput/ConfirmPassword.d.ts +0 -11
- package/PasswordInput/Password.js +0 -78
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/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/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 };
|
package/SocialInput/index.js
CHANGED
package/TabGroup/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import { TabGroupProps } from "./types";
|
2
|
+
import type { TabGroupProps } from "./types";
|
3
3
|
declare const TabGroup: import("react").ForwardRefExoticComponent<TabGroupProps & import("react").RefAttributes<unknown>>;
|
4
4
|
export default TabGroup;
|
5
|
-
export
|
5
|
+
export type { TabGroupProps };
|
package/TabGroup/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { TablePaginationProps } from "./types";
|
1
|
+
import type { TablePaginationProps } from "./types";
|
2
2
|
declare function Pagination(props: TablePaginationProps): JSX.Element;
|
3
3
|
export default Pagination;
|
4
|
-
export
|
4
|
+
export type { TablePaginationProps };
|
package/TablePagination/index.js
CHANGED
@@ -20,4 +20,3 @@ function Pagination(props) {
|
|
20
20
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: count ? (_jsx(TablePagination, { component: "div", colSpan: colSpan, count: count, rowsPerPage: rowsPerPage, page: page, SelectProps: { native: true }, rowsPerPageOptions: rowsPerPageOptions, onPageChange: onPageChange, onRowsPerPageChange: onRowsPerPageChange, ActionsComponent: TablePaginationActions })) : (_jsx(_Fragment, {})) })));
|
21
21
|
}
|
22
22
|
export default Pagination;
|
23
|
-
export * from "./types";
|
package/TextInput/index.d.ts
CHANGED
@@ -9,5 +9,5 @@ export interface TextInputProps extends Omit<TextFieldProps, "onChange"> {
|
|
9
9
|
primaryColor?: CSSProperties["color"];
|
10
10
|
secondaryColor?: CSSProperties["color"];
|
11
11
|
}
|
12
|
-
declare
|
12
|
+
declare function TextInput(props: TextInputProps): JSX.Element;
|
13
13
|
export default TextInput;
|
package/TextInput/index.js
CHANGED
@@ -26,7 +26,7 @@ import Field from "@mui/material/TextField";
|
|
26
26
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
27
27
|
import useInteractions from "./useInteractions";
|
28
28
|
import useCustomTheme from "../useCustomTheme";
|
29
|
-
|
29
|
+
function TextInput(props) {
|
30
30
|
var _a = props.type, type = _a === void 0 ? "text" : _a, onChange = props.onChange, value = props.value, _b = props.size, size = _b === void 0 ? "small" : _b, tooltip = props.tooltip, _c = props.maxLength, maxLength = _c === void 0 ? 999 : _c, _d = props.minLength, minLength = _d === void 0 ? 0 : _d, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onBlur = props.onBlur, onFocus = props.onFocus, rest = __rest(props, ["type", "onChange", "value", "size", "tooltip", "maxLength", "minLength", "primaryColor", "secondaryColor", "onBlur", "onFocus"]);
|
31
31
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
32
32
|
var _e = useInteractions(), tooltipOpen = _e.tooltipOpen, onOpenTooltip = _e.onOpenTooltip, onCloseTooltip = _e.onCloseTooltip;
|
@@ -42,5 +42,5 @@ var TextInput = function (props) {
|
|
42
42
|
event.preventDefault();
|
43
43
|
onChange(event.target.value);
|
44
44
|
}, inputProps: { maxLength: maxLength, minLength: minLength } }, rest)) })) })));
|
45
|
-
}
|
45
|
+
}
|
46
46
|
export default TextInput;
|
package/ToastPrompt/Prompt.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { RefProps } from "./types";
|
3
|
+
declare const Prompt: import("react").ForwardRefExoticComponent<import("react").RefAttributes<RefProps | null>>;
|
3
4
|
export default Prompt;
|
package/ToastPrompt/Prompt.js
CHANGED
@@ -9,19 +9,22 @@ var __assign = (this && this.__assign) || function () {
|
|
9
9
|
};
|
10
10
|
return __assign.apply(this, arguments);
|
11
11
|
};
|
12
|
-
import { jsx as _jsx
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
+
import { forwardRef, useImperativeHandle } from "react";
|
13
14
|
import Alert from "@mui/material/Alert";
|
14
15
|
import Slide from "@mui/material/Slide";
|
15
|
-
import AlertTitle from "@mui/material/AlertTitle";
|
16
16
|
import Snackbar from "@mui/material/Snackbar";
|
17
|
+
import Typography from "@mui/material/Typography";
|
17
18
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
18
19
|
import useCustomTheme from "../useCustomTheme";
|
20
|
+
import useInteractions from "./useInteractions";
|
19
21
|
function Transition(args) {
|
20
22
|
return _jsx(Slide, __assign({}, args, { direction: "up" }));
|
21
23
|
}
|
22
|
-
|
23
|
-
var open = props.open, variant = props.variant, message = props.message, timeout = props.timeout, onClose = props.onClose;
|
24
|
+
var Prompt = forwardRef(function (_, ref) {
|
24
25
|
var theme = useCustomTheme();
|
25
|
-
|
26
|
-
}
|
26
|
+
var _a = useInteractions(), open = _a.open, type = _a.type, message = _a.message, timeout = _a.timeout, onShow = _a.onShow, onHide = _a.onHide;
|
27
|
+
useImperativeHandle(ref, function () { return ({ onShow: onShow }); });
|
28
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Snackbar, __assign({ anchorOrigin: { vertical: "bottom", horizontal: "left" }, open: open, onClose: onHide, autoHideDuration: timeout, TransitionComponent: Transition, sx: { zIndex: 99999 } }, { children: _jsx(Alert, __assign({ variant: "filled", severity: type, sx: { width: "100%", fontSize: 14, fontWeight: 700 }, onClose: onHide }, { children: _jsx(Typography, __assign({ sx: { fontWeight: 800, fontSize: 14 } }, { children: message })) })) }), "".concat(Date.now() * Math.round(Math.random()))) })));
|
29
|
+
});
|
27
30
|
export default Prompt;
|
package/ToastPrompt/index.js
CHANGED
@@ -10,16 +10,19 @@ var __assign = (this && this.__assign) || function () {
|
|
10
10
|
return __assign.apply(this, arguments);
|
11
11
|
};
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
13
|
-
import { createContext, useContext, cloneElement } from "react";
|
13
|
+
import { createContext, useContext, useRef, useCallback, cloneElement } from "react";
|
14
14
|
import Prompt from "./Prompt";
|
15
|
-
import useInteractions from "./useInteractions";
|
16
15
|
var PromptContext = createContext({
|
17
16
|
showPrompt: function () { }
|
18
17
|
});
|
19
18
|
export function PromptProvider(props) {
|
20
19
|
var children = props.children;
|
21
|
-
var
|
22
|
-
|
20
|
+
var ref = useRef(null);
|
21
|
+
var showPrompt = useCallback(function (args) {
|
22
|
+
var _a;
|
23
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.onShow(args);
|
24
|
+
}, []);
|
25
|
+
return (_jsxs(PromptContext.Provider, __assign({ value: { showPrompt: showPrompt } }, { children: [children, cloneElement(_jsx(Prompt, { ref: ref }))] })));
|
23
26
|
}
|
24
27
|
export function usePrompt() {
|
25
28
|
return useContext(PromptContext);
|
package/ToastPrompt/types.d.ts
CHANGED
@@ -1,29 +1,28 @@
|
|
1
1
|
import type { CSSProperties, ReactNode, SyntheticEvent } from "react";
|
2
2
|
import type { SnackbarCloseReason } from "@mui/material/Snackbar";
|
3
3
|
import type { SvgIconComponent } from "@mui/icons-material";
|
4
|
-
export declare type
|
5
|
-
export declare type PromptStyles = Record<
|
4
|
+
export declare type Severity = "success" | "warning" | "info" | "error";
|
5
|
+
export declare type PromptStyles = Record<Severity, {
|
6
6
|
backgroundColor: CSSProperties["color"];
|
7
7
|
}>;
|
8
|
-
export declare type PromptIcons = Record<
|
8
|
+
export declare type PromptIcons = Record<Severity, SvgIconComponent>;
|
9
9
|
declare type PromptArgs = {
|
10
10
|
message: string | 400;
|
11
|
-
|
12
|
-
timeout
|
11
|
+
type: Severity;
|
12
|
+
timeout?: number;
|
13
13
|
};
|
14
14
|
export interface InterfaceStates {
|
15
15
|
promptArgs: PromptArgs & Record<"open", boolean>;
|
16
16
|
onHide: (event: SyntheticEvent | Event, reason?: SnackbarCloseReason) => void;
|
17
17
|
onShow: (args: PromptArgs) => void;
|
18
18
|
}
|
19
|
-
export interface PromptProps extends PromptArgs {
|
20
|
-
open: boolean;
|
21
|
-
onClose: InterfaceStates["onHide"];
|
22
|
-
}
|
23
19
|
export interface PromptProviderProps {
|
24
20
|
children: ReactNode;
|
25
21
|
}
|
26
22
|
export interface PromptContextProps {
|
27
23
|
showPrompt: InterfaceStates["onShow"];
|
28
24
|
}
|
25
|
+
export interface RefProps {
|
26
|
+
onShow: InterfaceStates["onShow"];
|
27
|
+
}
|
29
28
|
export {};
|
@@ -1,15 +1,14 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
declare function useInteractions(): {
|
3
|
-
promptArgs: {
|
4
|
-
message: string | 400;
|
5
|
-
variant: import("./types").Variant;
|
6
|
-
timeout: number;
|
7
|
-
} & Record<"open", boolean>;
|
8
3
|
onShow: (args: {
|
9
4
|
message: string | 400;
|
10
|
-
|
11
|
-
timeout
|
5
|
+
type: import("./types").Severity;
|
6
|
+
timeout?: number | undefined;
|
12
7
|
}) => void;
|
13
8
|
onHide: (event: Event | import("react").SyntheticEvent<Element, Event>, reason?: import("@mui/material").SnackbarCloseReason | undefined) => void;
|
9
|
+
message: string | 400;
|
10
|
+
type: import("./types").Severity;
|
11
|
+
timeout?: number | undefined;
|
12
|
+
open: boolean;
|
14
13
|
};
|
15
14
|
export default useInteractions;
|
@@ -12,10 +12,11 @@ var __assign = (this && this.__assign) || function () {
|
|
12
12
|
import { useState, useCallback } from "react";
|
13
13
|
function useInteractions() {
|
14
14
|
var ERROR_MESSAGE = "Internal Server Error";
|
15
|
+
var UNKNOWN_MESSAGE = "Unknown Message";
|
15
16
|
var _a = useState({
|
16
17
|
open: false,
|
17
|
-
message:
|
18
|
-
|
18
|
+
message: UNKNOWN_MESSAGE,
|
19
|
+
type: "error",
|
19
20
|
timeout: 3500
|
20
21
|
}), promptArgs = _a[0], setPromptArgs = _a[1];
|
21
22
|
var onHide = useCallback(function (_, reason) {
|
@@ -25,14 +26,9 @@ function useInteractions() {
|
|
25
26
|
setPromptArgs(function (args) { return (__assign(__assign({}, args), { open: false })); });
|
26
27
|
}, []);
|
27
28
|
var onShow = useCallback(function (args) {
|
28
|
-
var _a = args.message, message = _a === void 0 ?
|
29
|
-
setPromptArgs({
|
30
|
-
open: true,
|
31
|
-
message: message === 400 ? ERROR_MESSAGE : message,
|
32
|
-
variant: variant,
|
33
|
-
timeout: timeout
|
34
|
-
});
|
29
|
+
var _a = args.message, message = _a === void 0 ? UNKNOWN_MESSAGE : _a, _b = args.type, type = _b === void 0 ? "error" : _b, _c = args.timeout, timeout = _c === void 0 ? 3500 : _c;
|
30
|
+
setPromptArgs(function (args) { return (__assign(__assign({}, args), { message: message === 400 ? ERROR_MESSAGE : message, type: type, timeout: timeout, open: true })); });
|
35
31
|
}, []);
|
36
|
-
return { promptArgs
|
32
|
+
return __assign(__assign({}, promptArgs), { onShow: onShow, onHide: onHide });
|
37
33
|
}
|
38
34
|
export default useInteractions;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { VideoPlayerModalProps } from "./types";
|
1
|
+
import type { VideoPlayerModalProps } from "./types";
|
2
2
|
declare function VideoPlayerModal(props: VideoPlayerModalProps): JSX.Element;
|
3
3
|
export default VideoPlayerModal;
|
4
|
-
export
|
4
|
+
export type { VideoPlayerModalProps };
|
@@ -40,4 +40,3 @@ function VideoPlayerModal(props) {
|
|
40
40
|
} }, playerProps)) }), _jsx(DialogActions, { children: _jsxs(Grid, __assign({ container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", spacing: 1 }, { children: [extraButtons.map(function (buttonProps, index) { return (_jsx(Grid, __assign({ item: true, xs: 12, md: 3, lg: 2 }, { children: _jsx(Button, __assign({}, buttonProps)) }), "extraButton_".concat(index))); }), _jsx(Grid, __assign({ item: true, xs: 12, md: 2, lg: 1 }, { children: _jsx(Button, __assign({ variant: "outlined", fullWidth: true, color: "secondary", onClick: onClose }, { children: "Close" })) }))] })) })] })) })));
|
41
41
|
}
|
42
42
|
export default VideoPlayerModal;
|
43
|
-
export * from "./types";
|
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,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@symply.io/basic-components",
|
3
|
-
"version": "1.4.0-beta.
|
3
|
+
"version": "1.4.0-beta.10",
|
4
4
|
"description": "Basic and reusable components for all frontend of Symply apps",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -8,7 +8,6 @@
|
|
8
8
|
"material-ui"
|
9
9
|
],
|
10
10
|
"main": "index.js",
|
11
|
-
"type": "module",
|
12
11
|
"types": "**/*.d.ts",
|
13
12
|
"license": "MIT",
|
14
13
|
"private": false,
|
package/CheckBox/CheckBox.d.ts
DELETED
package/CheckBox/CheckBox.js
DELETED
@@ -1,36 +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 } 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
|
-
export 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;
|
@@ -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;
|